gdb.info 2.4 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303
  1. This is gdb.info, produced by makeinfo version 6.8 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 (GDB) Version 10.1.
  20. Copyright (C) 1988-2020 Free Software Foundation, Inc.
  21. Permission is granted to copy, distribute and/or modify this document
  22. under the terms of the GNU Free Documentation License, Version 1.3 or
  23. any later version published by the Free Software Foundation; with the
  24. Invariant Sections being "Free Software" and "Free Software Needs Free
  25. Documentation", with the Front-Cover Texts being "A GNU Manual," and
  26. with the Back-Cover Texts as in (a) below.
  27. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  28. this GNU Manual. Buying copies from GNU Press supports the FSF in
  29. developing GNU and promoting software freedom."
  30. 
  31. File: gdb.info, Node: Top, Next: Summary, Up: (dir)
  32. Debugging with GDB
  33. ******************
  34. This file describes GDB, the GNU symbolic debugger.
  35. This is the Tenth Edition, for GDB (GDB) Version 10.1.
  36. Copyright (C) 1988-2020 Free Software Foundation, Inc.
  37. This edition of the GDB manual is dedicated to the memory of Fred
  38. Fish. Fred was a long-standing contributor to GDB and to Free software
  39. in general. We will miss him.
  40. * Menu:
  41. * Summary:: Summary of GDB
  42. * Sample Session:: A sample GDB session
  43. * Invocation:: Getting in and out of GDB
  44. * Commands:: GDB commands
  45. * Running:: Running programs under GDB
  46. * Stopping:: Stopping and continuing
  47. * Reverse Execution:: Running programs backward
  48. * Process Record and Replay:: Recording inferior's execution and replaying it
  49. * Stack:: Examining the stack
  50. * Source:: Examining source files
  51. * Data:: Examining data
  52. * Optimized Code:: Debugging optimized code
  53. * Macros:: Preprocessor Macros
  54. * Tracepoints:: Debugging remote targets non-intrusively
  55. * Overlays:: Debugging programs that use overlays
  56. * Languages:: Using GDB with different languages
  57. * Symbols:: Examining the symbol table
  58. * Altering:: Altering execution
  59. * GDB Files:: GDB files
  60. * Targets:: Specifying a debugging target
  61. * Remote Debugging:: Debugging remote programs
  62. * Configurations:: Configuration-specific information
  63. * Controlling GDB:: Controlling GDB
  64. * Extending GDB:: Extending GDB
  65. * Interpreters:: Command Interpreters
  66. * TUI:: GDB Text User Interface
  67. * Emacs:: Using GDB under GNU Emacs
  68. * GDB/MI:: GDB's Machine Interface.
  69. * Annotations:: GDB's annotation interface.
  70. * JIT Interface:: Using the JIT debugging interface.
  71. * In-Process Agent:: In-Process Agent
  72. * GDB Bugs:: Reporting bugs in GDB
  73. * Command Line Editing:: Command Line Editing
  74. * Using History Interactively:: Using History Interactively
  75. * In Memoriam:: In Memoriam
  76. * Formatting Documentation:: How to format and print GDB documentation
  77. * Installing GDB:: Installing GDB
  78. * Maintenance Commands:: Maintenance Commands
  79. * Remote Protocol:: GDB Remote Serial Protocol
  80. * Agent Expressions:: The GDB Agent Expression Mechanism
  81. * Target Descriptions:: How targets can describe themselves to
  82. GDB
  83. * Operating System Information:: Getting additional information from
  84. the operating system
  85. * Trace File Format:: GDB trace file format
  86. * Index Section Format:: .gdb_index section format
  87. * Man Pages:: Manual pages
  88. * Copying:: GNU General Public License says
  89. how you can copy and share GDB
  90. * GNU Free Documentation License:: The license for this documentation
  91. * Concept Index:: Index of GDB concepts
  92. * Command and Variable Index:: Index of GDB commands, variables,
  93. functions, and Python data types
  94. 
  95. File: gdb.info, Node: Summary, Next: Sample Session, Up: Top
  96. Summary of GDB
  97. **************
  98. The purpose of a debugger such as GDB is to allow you to see what is
  99. going on "inside" another program while it executes--or what another
  100. program was doing at the moment it crashed.
  101. GDB can do four main kinds of things (plus other things in support of
  102. these) to help you catch bugs in the act:
  103. * Start your program, specifying anything that might affect its
  104. behavior.
  105. * Make your program stop on specified conditions.
  106. * Examine what has happened, when your program has stopped.
  107. * Change things in your program, so you can experiment with
  108. correcting the effects of one bug and go on to learn about another.
  109. You can use GDB to debug programs written in C and C++. For more
  110. information, see *note Supported Languages: Supported Languages. For
  111. more information, see *note C and C++: C.
  112. Support for D is partial. For information on D, see *note D: D.
  113. Support for Modula-2 is partial. For information on Modula-2, see
  114. *note Modula-2: Modula-2.
  115. Support for OpenCL C is partial. For information on OpenCL C, see
  116. *note OpenCL C: OpenCL C.
  117. Debugging Pascal programs which use sets, subranges, file variables,
  118. or nested functions does not currently work. GDB does not support
  119. entering expressions, printing values, or similar features using Pascal
  120. syntax.
  121. GDB can be used to debug programs written in Fortran, although it may
  122. be necessary to refer to some variables with a trailing underscore.
  123. GDB can be used to debug programs written in Objective-C, using
  124. either the Apple/NeXT or the GNU Objective-C runtime.
  125. * Menu:
  126. * Free Software:: Freely redistributable software
  127. * Free Documentation:: Free Software Needs Free Documentation
  128. * Contributors:: Contributors to GDB
  129. 
  130. File: gdb.info, Node: Free Software, Next: Free Documentation, Up: Summary
  131. Free Software
  132. =============
  133. GDB is "free software", protected by the GNU General Public License
  134. (GPL). The GPL gives you the freedom to copy or adapt a licensed
  135. program--but every person getting a copy also gets with it the freedom
  136. to modify that copy (which means that they must get access to the source
  137. code), and the freedom to distribute further copies. Typical software
  138. companies use copyrights to limit your freedoms; the Free Software
  139. Foundation uses the GPL to preserve these freedoms.
  140. Fundamentally, the General Public License is a license which says
  141. that you have these freedoms and that you cannot take these freedoms
  142. away from anyone else.
  143. 
  144. File: gdb.info, Node: Free Documentation, Next: Contributors, Prev: Free Software, Up: Summary
  145. Free Software Needs Free Documentation
  146. ======================================
  147. The biggest deficiency in the free software community today is not in
  148. the software--it is the lack of good free documentation that we can
  149. include with the free software. Many of our most important programs do
  150. not come with free reference manuals and free introductory texts.
  151. Documentation is an essential part of any software package; when an
  152. important free software package does not come with a free manual and a
  153. free tutorial, that is a major gap. We have many such gaps today.
  154. Consider Perl, for instance. The tutorial manuals that people
  155. normally use are non-free. How did this come about? Because the
  156. authors of those manuals published them with restrictive terms--no
  157. copying, no modification, source files not available--which exclude them
  158. from the free software world.
  159. That wasn't the first time this sort of thing happened, and it was
  160. far from the last. Many times we have heard a GNU user eagerly describe
  161. a manual that he is writing, his intended contribution to the community,
  162. only to learn that he had ruined everything by signing a publication
  163. contract to make it non-free.
  164. Free documentation, like free software, is a matter of freedom, not
  165. price. The problem with the non-free manual is not that publishers
  166. charge a price for printed copies--that in itself is fine. (The Free
  167. Software Foundation sells printed copies of manuals, too.) The problem
  168. is the restrictions on the use of the manual. Free manuals are
  169. available in source code form, and give you permission to copy and
  170. modify. Non-free manuals do not allow this.
  171. The criteria of freedom for a free manual are roughly the same as for
  172. free software. Redistribution (including the normal kinds of commercial
  173. redistribution) must be permitted, so that the manual can accompany
  174. every copy of the program, both on-line and on paper.
  175. Permission for modification of the technical content is crucial too.
  176. When people modify the software, adding or changing features, if they
  177. are conscientious they will change the manual too--so they can provide
  178. accurate and clear documentation for the modified program. A manual
  179. that leaves you no choice but to write a new manual to document a
  180. changed version of the program is not really available to our community.
  181. Some kinds of limits on the way modification is handled are
  182. acceptable. For example, requirements to preserve the original author's
  183. copyright notice, the distribution terms, or the list of authors, are
  184. ok. It is also no problem to require modified versions to include
  185. notice that they were modified. Even entire sections that may not be
  186. deleted or changed are acceptable, as long as they deal with
  187. nontechnical topics (like this one). These kinds of restrictions are
  188. acceptable because they don't obstruct the community's normal use of the
  189. manual.
  190. However, it must be possible to modify all the _technical_ content of
  191. the manual, and then distribute the result in all the usual media,
  192. through all the usual channels. Otherwise, the restrictions obstruct
  193. the use of the manual, it is not free, and we need another manual to
  194. replace it.
  195. Please spread the word about this issue. Our community continues to
  196. lose manuals to proprietary publishing. If we spread the word that free
  197. software needs free reference manuals and free tutorials, perhaps the
  198. next person who wants to contribute by writing documentation will
  199. realize, before it is too late, that only free manuals contribute to the
  200. free software community.
  201. If you are writing documentation, please insist on publishing it
  202. under the GNU Free Documentation License or another free documentation
  203. license. Remember that this decision requires your approval--you don't
  204. have to let the publisher decide. Some commercial publishers will use a
  205. free license if you insist, but they will not propose the option; it is
  206. up to you to raise the issue and say firmly that this is what you want.
  207. If the publisher you are dealing with refuses, please try other
  208. publishers. If you're not sure whether a proposed license is free,
  209. write to <licensing@gnu.org>.
  210. You can encourage commercial publishers to sell more free, copylefted
  211. manuals and tutorials by buying them, and particularly by buying copies
  212. from the publishers that paid for their writing or for major
  213. improvements. Meanwhile, try to avoid buying non-free documentation at
  214. all. Check the distribution terms of a manual before you buy it, and
  215. insist that whoever seeks your business must respect your freedom.
  216. Check the history of the book, and try to reward the publishers that
  217. have paid or pay the authors to work on it.
  218. The Free Software Foundation maintains a list of free documentation
  219. published by other publishers, at
  220. <http://www.fsf.org/doc/other-free-books.html>.
  221. 
  222. File: gdb.info, Node: Contributors, Prev: Free Documentation, Up: Summary
  223. Contributors to GDB
  224. ===================
  225. Richard Stallman was the original author of GDB, and of many other GNU
  226. programs. Many others have contributed to its development. This
  227. section attempts to credit major contributors. One of the virtues of
  228. free software is that everyone is free to contribute to it; with regret,
  229. we cannot actually acknowledge everyone here. The file 'ChangeLog' in
  230. the GDB distribution approximates a blow-by-blow account.
  231. Changes much prior to version 2.0 are lost in the mists of time.
  232. _Plea:_ Additions to this section are particularly welcome. If you
  233. or your friends (or enemies, to be evenhanded) have been unfairly
  234. omitted from this list, we would like to add your names!
  235. So that they may not regard their many labors as thankless, we
  236. particularly thank those who shepherded GDB through major releases:
  237. Andrew Cagney (releases 6.3, 6.2, 6.1, 6.0, 5.3, 5.2, 5.1 and 5.0); Jim
  238. Blandy (release 4.18); Jason Molenda (release 4.17); Stan Shebs (release
  239. 4.14); Fred Fish (releases 4.16, 4.15, 4.13, 4.12, 4.11, 4.10, and 4.9);
  240. Stu Grossman and John Gilmore (releases 4.8, 4.7, 4.6, 4.5, and 4.4);
  241. John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and 3.9); Jim Kingdon
  242. (releases 3.5, 3.4, and 3.3); and Randy Smith (releases 3.2, 3.1, and
  243. 3.0).
  244. Richard Stallman, assisted at various times by Peter TerMaat, Chris
  245. Hanson, and Richard Mlynarik, handled releases through 2.8.
  246. Michael Tiemann is the author of most of the GNU C++ support in GDB,
  247. with significant additional contributions from Per Bothner and Daniel
  248. Berlin. James Clark wrote the GNU C++ demangler. Early work on C++ was
  249. by Peter TerMaat (who also did much general update work leading to
  250. release 3.0).
  251. GDB uses the BFD subroutine library to examine multiple object-file
  252. formats; BFD was a joint project of David V. Henkel-Wallace, Rich
  253. Pixley, Steve Chamberlain, and John Gilmore.
  254. David Johnson wrote the original COFF support; Pace Willison did the
  255. original support for encapsulated COFF.
  256. Brent Benson of Harris Computer Systems contributed DWARF 2 support.
  257. Adam de Boor and Bradley Davis contributed the ISI Optimum V support.
  258. Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS
  259. support. Jean-Daniel Fekete contributed Sun 386i support. Chris Hanson
  260. improved the HP9000 support. Noboyuki Hikichi and Tomoyuki Hasei
  261. contributed Sony/News OS 3 support. David Johnson contributed Encore
  262. Umax support. Jyrki Kuoppala contributed Altos 3068 support. Jeff Law
  263. contributed HP PA and SOM support. Keith Packard contributed NS32K
  264. support. Doug Rabson contributed Acorn Risc Machine support. Bob Rusk
  265. contributed Harris Nighthawk CX-UX support. Chris Smith contributed
  266. Convex support (and Fortran debugging). Jonathan Stone contributed
  267. Pyramid support. Michael Tiemann contributed SPARC support. Tim Tucker
  268. contributed support for the Gould NP1 and Gould Powernode. Pace
  269. Willison contributed Intel 386 support. Jay Vosburgh contributed
  270. Symmetry support. Marko Mlinar contributed OpenRISC 1000 support.
  271. Andreas Schwab contributed M68K GNU/Linux support.
  272. Rich Schaefer and Peter Schauer helped with support of SunOS shared
  273. libraries.
  274. Jay Fenlason and Roland McGrath ensured that GDB and GAS agree about
  275. several machine instruction sets.
  276. Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped
  277. develop remote debugging. Intel Corporation, Wind River Systems, AMD,
  278. and ARM contributed remote debugging modules for the i960, VxWorks, A29K
  279. UDI, and RDI targets, respectively.
  280. Brian Fox is the author of the readline libraries providing
  281. command-line editing and command history.
  282. Andrew Beers of SUNY Buffalo wrote the language-switching code, the
  283. Modula-2 support, and contributed the Languages chapter of this manual.
  284. Fred Fish wrote most of the support for Unix System Vr4. He also
  285. enhanced the command-completion support to cover C++ overloaded symbols.
  286. Hitachi America (now Renesas America), Ltd. sponsored the support
  287. for H8/300, H8/500, and Super-H processors.
  288. NEC sponsored the support for the v850, Vr4xxx, and Vr5xxx
  289. processors.
  290. Mitsubishi (now Renesas) sponsored the support for D10V, D30V, and
  291. M32R/D processors.
  292. Toshiba sponsored the support for the TX39 Mips processor.
  293. Matsushita sponsored the support for the MN10200 and MN10300
  294. processors.
  295. Fujitsu sponsored the support for SPARClite and FR30 processors.
  296. Kung Hsu, Jeff Law, and Rick Sladkey added support for hardware
  297. watchpoints.
  298. Michael Snyder added support for tracepoints.
  299. Stu Grossman wrote gdbserver.
  300. Jim Kingdon, Peter Schauer, Ian Taylor, and Stu Grossman made nearly
  301. innumerable bug fixes and cleanups throughout GDB.
  302. The following people at the Hewlett-Packard Company contributed
  303. support for the PA-RISC 2.0 architecture, HP-UX 10.20, 10.30, and 11.0
  304. (narrow mode), HP's implementation of kernel threads, HP's aC++
  305. compiler, and the Text User Interface (nee Terminal User Interface): Ben
  306. Krepp, Richard Title, John Bishop, Susan Macchia, Kathy Mann, Satish
  307. Pai, India Paul, Steve Rehrauer, and Elena Zannoni. Kim Haase provided
  308. HP-specific information in this manual.
  309. DJ Delorie ported GDB to MS-DOS, for the DJGPP project. Robert
  310. Hoehne made significant contributions to the DJGPP port.
  311. Cygnus Solutions has sponsored GDB maintenance and much of its
  312. development since 1991. Cygnus engineers who have worked on GDB
  313. fulltime include Mark Alexander, Jim Blandy, Per Bothner, Kevin
  314. Buettner, Edith Epstein, Chris Faylor, Fred Fish, Martin Hunt, Jim
  315. Ingham, John Gilmore, Stu Grossman, Kung Hsu, Jim Kingdon, John Metzler,
  316. Fernando Nasser, Geoffrey Noer, Dawn Perchik, Rich Pixley, Zdenek
  317. Radouch, Keith Seitz, Stan Shebs, David Taylor, and Elena Zannoni. In
  318. addition, Dave Brolley, Ian Carmichael, Steve Chamberlain, Nick Clifton,
  319. JT Conklin, Stan Cox, DJ Delorie, Ulrich Drepper, Frank Eigler, Doug
  320. Evans, Sean Fagan, David Henkel-Wallace, Richard Henderson, Jeff
  321. Holcomb, Jeff Law, Jim Lemke, Tom Lord, Bob Manson, Michael Meissner,
  322. Jason Merrill, Catherine Moore, Drew Moseley, Ken Raeburn, Gavin
  323. Romig-Koch, Rob Savoye, Jamie Smith, Mike Stump, Ian Taylor, Angela
  324. Thomas, Michael Tiemann, Tom Tromey, Ron Unrau, Jim Wilson, and David
  325. Zuhn have made contributions both large and small.
  326. Andrew Cagney, Fernando Nasser, and Elena Zannoni, while working for
  327. Cygnus Solutions, implemented the original GDB/MI interface.
  328. Jim Blandy added support for preprocessor macros, while working for
  329. Red Hat.
  330. Andrew Cagney designed GDB's architecture vector. Many people
  331. including Andrew Cagney, Stephane Carrez, Randolph Chung, Nick Duffek,
  332. Richard Henderson, Mark Kettenis, Grace Sainsbury, Kei Sakamoto,
  333. Yoshinori Sato, Michael Snyder, Andreas Schwab, Jason Thorpe, Corinna
  334. Vinschen, Ulrich Weigand, and Elena Zannoni, helped with the migration
  335. of old architectures to this new framework.
  336. Andrew Cagney completely re-designed and re-implemented GDB's
  337. unwinder framework, this consisting of a fresh new design featuring
  338. frame IDs, independent frame sniffers, and the sentinel frame. Mark
  339. Kettenis implemented the DWARF 2 unwinder, Jeff Johnston the libunwind
  340. unwinder, and Andrew Cagney the dummy, sentinel, tramp, and trad
  341. unwinders. The architecture-specific changes, each involving a complete
  342. rewrite of the architecture's frame code, were carried out by Jim
  343. Blandy, Joel Brobecker, Kevin Buettner, Andrew Cagney, Stephane Carrez,
  344. Randolph Chung, Orjan Friberg, Richard Henderson, Daniel Jacobowitz,
  345. Jeff Johnston, Mark Kettenis, Theodore A. Roth, Kei Sakamoto, Yoshinori
  346. Sato, Michael Snyder, Corinna Vinschen, and Ulrich Weigand.
  347. Christian Zankel, Ross Morley, Bob Wilson, and Maxim Grigoriev from
  348. Tensilica, Inc. contributed support for Xtensa processors. Others who
  349. have worked on the Xtensa port of GDB in the past include Steve Tjiang,
  350. John Newlin, and Scott Foehner.
  351. Michael Eager and staff of Xilinx, Inc., contributed support for the
  352. Xilinx MicroBlaze architecture.
  353. Initial support for the FreeBSD/mips target and native configuration
  354. was developed by SRI International and the University of Cambridge
  355. Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
  356. ("CTSRD"), as part of the DARPA CRASH research programme.
  357. Initial support for the FreeBSD/riscv target and native configuration
  358. was developed by SRI International and the University of Cambridge
  359. Computer Laboratory (Department of Computer Science and Technology)
  360. under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the DARPA
  361. SSITH research programme.
  362. The original port to the OpenRISC 1000 is believed to be due to
  363. Alessandro Forin and Per Bothner. More recent ports have been the work
  364. of Jeremy Bennett, Franck Jullien, Stefan Wallentowitz and Stafford
  365. Horne.
  366. Weimin Pan, David Faust and Jose E. Marchesi contributed support for
  367. the Linux kernel BPF virtual architecture. This work was sponsored by
  368. Oracle.
  369. 
  370. File: gdb.info, Node: Sample Session, Next: Invocation, Prev: Summary, Up: Top
  371. 1 A Sample GDB Session
  372. **********************
  373. You can use this manual at your leisure to read all about GDB. However,
  374. a handful of commands are enough to get started using the debugger.
  375. This chapter illustrates those commands.
  376. One of the preliminary versions of GNU 'm4' (a generic macro
  377. processor) exhibits the following bug: sometimes, when we change its
  378. quote strings from the default, the commands used to capture one macro
  379. definition within another stop working. In the following short 'm4'
  380. session, we define a macro 'foo' which expands to '0000'; we then use
  381. the 'm4' built-in 'defn' to define 'bar' as the same thing. However,
  382. when we change the open quote string to '<QUOTE>' and the close quote
  383. string to '<UNQUOTE>', the same procedure fails to define a new synonym
  384. 'baz':
  385. $ cd gnu/m4
  386. $ ./m4
  387. define(foo,0000)
  388. foo
  389. 0000
  390. define(bar,defn('foo'))
  391. bar
  392. 0000
  393. changequote(<QUOTE>,<UNQUOTE>)
  394. define(baz,defn(<QUOTE>foo<UNQUOTE>))
  395. baz
  396. Ctrl-d
  397. m4: End of input: 0: fatal error: EOF in string
  398. Let us use GDB to try to see what is going on.
  399. $ gdb m4
  400. GDB is free software and you are welcome to distribute copies
  401. of it under certain conditions; type "show copying" to see
  402. the conditions.
  403. There is absolutely no warranty for GDB; type "show warranty"
  404. for details.
  405. GDB 10.1, Copyright 1999 Free Software Foundation, Inc...
  406. (gdb)
  407. GDB reads only enough symbol data to know where to find the rest when
  408. needed; as a result, the first prompt comes up very quickly. We now
  409. tell GDB to use a narrower display width than usual, so that examples
  410. fit in this manual.
  411. (gdb) set width 70
  412. We need to see how the 'm4' built-in 'changequote' works. Having looked
  413. at the source, we know the relevant subroutine is 'm4_changequote', so
  414. we set a breakpoint there with the GDB 'break' command.
  415. (gdb) break m4_changequote
  416. Breakpoint 1 at 0x62f4: file builtin.c, line 879.
  417. Using the 'run' command, we start 'm4' running under GDB control; as
  418. long as control does not reach the 'm4_changequote' subroutine, the
  419. program runs as usual:
  420. (gdb) run
  421. Starting program: /work/Editorial/gdb/gnu/m4/m4
  422. define(foo,0000)
  423. foo
  424. 0000
  425. To trigger the breakpoint, we call 'changequote'. GDB suspends
  426. execution of 'm4', displaying information about the context where it
  427. stops.
  428. changequote(<QUOTE>,<UNQUOTE>)
  429. Breakpoint 1, m4_changequote (argc=3, argv=0x33c70)
  430. at builtin.c:879
  431. 879 if (bad_argc(TOKEN_DATA_TEXT(argv[0]),argc,1,3))
  432. Now we use the command 'n' ('next') to advance execution to the next
  433. line of the current function.
  434. (gdb) n
  435. 882 set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1])\
  436. : nil,
  437. 'set_quotes' looks like a promising subroutine. We can go into it by
  438. using the command 's' ('step') instead of 'next'. 'step' goes to the
  439. next line to be executed in _any_ subroutine, so it steps into
  440. 'set_quotes'.
  441. (gdb) s
  442. set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
  443. at input.c:530
  444. 530 if (lquote != def_lquote)
  445. The display that shows the subroutine where 'm4' is now suspended (and
  446. its arguments) is called a stack frame display. It shows a summary of
  447. the stack. We can use the 'backtrace' command (which can also be
  448. spelled 'bt'), to see where we are in the stack as a whole: the
  449. 'backtrace' command displays a stack frame for each active subroutine.
  450. (gdb) bt
  451. #0 set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
  452. at input.c:530
  453. #1 0x6344 in m4_changequote (argc=3, argv=0x33c70)
  454. at builtin.c:882
  455. #2 0x8174 in expand_macro (sym=0x33320) at macro.c:242
  456. #3 0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30)
  457. at macro.c:71
  458. #4 0x79dc in expand_input () at macro.c:40
  459. #5 0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195
  460. We step through a few more lines to see what happens. The first two
  461. times, we can use 's'; the next two times we use 'n' to avoid falling
  462. into the 'xstrdup' subroutine.
  463. (gdb) s
  464. 0x3b5c 532 if (rquote != def_rquote)
  465. (gdb) s
  466. 0x3b80 535 lquote = (lq == nil || *lq == '\0') ? \
  467. def_lquote : xstrdup(lq);
  468. (gdb) n
  469. 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
  470. : xstrdup(rq);
  471. (gdb) n
  472. 538 len_lquote = strlen(rquote);
  473. The last line displayed looks a little odd; we can examine the variables
  474. 'lquote' and 'rquote' to see if they are in fact the new left and right
  475. quotes we specified. We use the command 'p' ('print') to see their
  476. values.
  477. (gdb) p lquote
  478. $1 = 0x35d40 "<QUOTE>"
  479. (gdb) p rquote
  480. $2 = 0x35d50 "<UNQUOTE>"
  481. 'lquote' and 'rquote' are indeed the new left and right quotes. To look
  482. at some context, we can display ten lines of source surrounding the
  483. current line with the 'l' ('list') command.
  484. (gdb) l
  485. 533 xfree(rquote);
  486. 534
  487. 535 lquote = (lq == nil || *lq == '\0') ? def_lquote\
  488. : xstrdup (lq);
  489. 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
  490. : xstrdup (rq);
  491. 537
  492. 538 len_lquote = strlen(rquote);
  493. 539 len_rquote = strlen(lquote);
  494. 540 }
  495. 541
  496. 542 void
  497. Let us step past the two lines that set 'len_lquote' and 'len_rquote',
  498. and then examine the values of those variables.
  499. (gdb) n
  500. 539 len_rquote = strlen(lquote);
  501. (gdb) n
  502. 540 }
  503. (gdb) p len_lquote
  504. $3 = 9
  505. (gdb) p len_rquote
  506. $4 = 7
  507. That certainly looks wrong, assuming 'len_lquote' and 'len_rquote' are
  508. meant to be the lengths of 'lquote' and 'rquote' respectively. We can
  509. set them to better values using the 'p' command, since it can print the
  510. value of any expression--and that expression can include subroutine
  511. calls and assignments.
  512. (gdb) p len_lquote=strlen(lquote)
  513. $5 = 7
  514. (gdb) p len_rquote=strlen(rquote)
  515. $6 = 9
  516. Is that enough to fix the problem of using the new quotes with the 'm4'
  517. built-in 'defn'? We can allow 'm4' to continue executing with the 'c'
  518. ('continue') command, and then try the example that caused trouble
  519. initially:
  520. (gdb) c
  521. Continuing.
  522. define(baz,defn(<QUOTE>foo<UNQUOTE>))
  523. baz
  524. 0000
  525. Success! The new quotes now work just as well as the default ones. The
  526. problem seems to have been just the two typos defining the wrong
  527. lengths. We allow 'm4' exit by giving it an EOF as input:
  528. Ctrl-d
  529. Program exited normally.
  530. The message 'Program exited normally.' is from GDB; it indicates 'm4'
  531. has finished executing. We can end our GDB session with the GDB 'quit'
  532. command.
  533. (gdb) quit
  534. 
  535. File: gdb.info, Node: Invocation, Next: Commands, Prev: Sample Session, Up: Top
  536. 2 Getting In and Out of GDB
  537. ***************************
  538. This chapter discusses how to start GDB, and how to get out of it. The
  539. essentials are:
  540. * type 'gdb' to start GDB.
  541. * type 'quit' or 'Ctrl-d' to exit.
  542. * Menu:
  543. * Invoking GDB:: How to start GDB
  544. * Quitting GDB:: How to quit GDB
  545. * Shell Commands:: How to use shell commands inside GDB
  546. * Logging Output:: How to log GDB's output to a file
  547. 
  548. File: gdb.info, Node: Invoking GDB, Next: Quitting GDB, Up: Invocation
  549. 2.1 Invoking GDB
  550. ================
  551. Invoke GDB by running the program 'gdb'. Once started, GDB reads
  552. commands from the terminal until you tell it to exit.
  553. You can also run 'gdb' with a variety of arguments and options, to
  554. specify more of your debugging environment at the outset.
  555. The command-line options described here are designed to cover a
  556. variety of situations; in some environments, some of these options may
  557. effectively be unavailable.
  558. The most usual way to start GDB is with one argument, specifying an
  559. executable program:
  560. gdb PROGRAM
  561. You can also start with both an executable program and a core file
  562. specified:
  563. gdb PROGRAM CORE
  564. You can, instead, specify a process ID as a second argument or use
  565. option '-p', if you want to debug a running process:
  566. gdb PROGRAM 1234
  567. gdb -p 1234
  568. would attach GDB to process '1234'. With option '-p' you can omit the
  569. PROGRAM filename.
  570. Taking advantage of the second command-line argument requires a
  571. fairly complete operating system; when you use GDB as a remote debugger
  572. attached to a bare board, there may not be any notion of "process", and
  573. there is often no way to get a core dump. GDB will warn you if it is
  574. unable to attach or to read core dumps.
  575. You can optionally have 'gdb' pass any arguments after the executable
  576. file to the inferior using '--args'. This option stops option
  577. processing.
  578. gdb --args gcc -O2 -c foo.c
  579. This will cause 'gdb' to debug 'gcc', and to set 'gcc''s command-line
  580. arguments (*note Arguments::) to '-O2 -c foo.c'.
  581. You can run 'gdb' without printing the front material, which
  582. describes GDB's non-warranty, by specifying '--silent' (or
  583. '-q'/'--quiet'):
  584. gdb --silent
  585. You can further control how GDB starts up by using command-line options.
  586. GDB itself can remind you of the options available.
  587. Type
  588. gdb -help
  589. to display all available options and briefly describe their use ('gdb
  590. -h' is a shorter equivalent).
  591. All options and command line arguments you give are processed in
  592. sequential order. The order makes a difference when the '-x' option is
  593. used.
  594. * Menu:
  595. * File Options:: Choosing files
  596. * Mode Options:: Choosing modes
  597. * Startup:: What GDB does during startup
  598. 
  599. File: gdb.info, Node: File Options, Next: Mode Options, Up: Invoking GDB
  600. 2.1.1 Choosing Files
  601. --------------------
  602. When GDB starts, it reads any arguments other than options as specifying
  603. an executable file and core file (or process ID). This is the same as if
  604. the arguments were specified by the '-se' and '-c' (or '-p') options
  605. respectively. (GDB reads the first argument that does not have an
  606. associated option flag as equivalent to the '-se' option followed by
  607. that argument; and the second argument that does not have an associated
  608. option flag, if any, as equivalent to the '-c'/'-p' option followed by
  609. that argument.) If the second argument begins with a decimal digit, GDB
  610. will first attempt to attach to it as a process, and if that fails,
  611. attempt to open it as a corefile. If you have a corefile whose name
  612. begins with a digit, you can prevent GDB from treating it as a pid by
  613. prefixing it with './', e.g. './12345'.
  614. If GDB has not been configured to included core file support, such as
  615. for most embedded targets, then it will complain about a second argument
  616. and ignore it.
  617. Many options have both long and short forms; both are shown in the
  618. following list. GDB also recognizes the long forms if you truncate
  619. them, so long as enough of the option is present to be unambiguous. (If
  620. you prefer, you can flag option arguments with '--' rather than '-',
  621. though we illustrate the more usual convention.)
  622. '-symbols FILE'
  623. '-s FILE'
  624. Read symbol table from file FILE.
  625. '-exec FILE'
  626. '-e FILE'
  627. Use file FILE as the executable file to execute when appropriate,
  628. and for examining pure data in conjunction with a core dump.
  629. '-se FILE'
  630. Read symbol table from file FILE and use it as the executable file.
  631. '-core FILE'
  632. '-c FILE'
  633. Use file FILE as a core dump to examine.
  634. '-pid NUMBER'
  635. '-p NUMBER'
  636. Connect to process ID NUMBER, as with the 'attach' command.
  637. '-command FILE'
  638. '-x FILE'
  639. Execute commands from file FILE. The contents of this file is
  640. evaluated exactly as the 'source' command would. *Note Command
  641. files: Command Files.
  642. '-eval-command COMMAND'
  643. '-ex COMMAND'
  644. Execute a single GDB command.
  645. This option may be used multiple times to call multiple commands.
  646. It may also be interleaved with '-command' as required.
  647. gdb -ex 'target sim' -ex 'load' \
  648. -x setbreakpoints -ex 'run' a.out
  649. '-init-command FILE'
  650. '-ix FILE'
  651. Execute commands from file FILE before loading the inferior (but
  652. after loading gdbinit files). *Note Startup::.
  653. '-init-eval-command COMMAND'
  654. '-iex COMMAND'
  655. Execute a single GDB command before loading the inferior (but after
  656. loading gdbinit files). *Note Startup::.
  657. '-directory DIRECTORY'
  658. '-d DIRECTORY'
  659. Add DIRECTORY to the path to search for source and script files.
  660. '-r'
  661. '-readnow'
  662. Read each symbol file's entire symbol table immediately, rather
  663. than the default, which is to read it incrementally as it is
  664. needed. This makes startup slower, but makes future operations
  665. faster.
  666. '--readnever'
  667. Do not read each symbol file's symbolic debug information. This
  668. makes startup faster but at the expense of not being able to
  669. perform symbolic debugging. DWARF unwind information is also not
  670. read, meaning backtraces may become incomplete or inaccurate. One
  671. use of this is when a user simply wants to do the following
  672. sequence: attach, dump core, detach. Loading the debugging
  673. information in this case is an unnecessary cause of delay.
  674. 
  675. File: gdb.info, Node: Mode Options, Next: Startup, Prev: File Options, Up: Invoking GDB
  676. 2.1.2 Choosing Modes
  677. --------------------
  678. You can run GDB in various alternative modes--for example, in batch mode
  679. or quiet mode.
  680. '-nx'
  681. '-n'
  682. Do not execute commands found in any initialization file. There
  683. are three init files, loaded in the following order:
  684. 'system.gdbinit'
  685. This is the system-wide init file. Its location is specified
  686. with the '--with-system-gdbinit' configure option (*note
  687. System-wide configuration::). It is loaded first when GDB
  688. starts, before command line options have been processed.
  689. 'system.gdbinit.d'
  690. This is the system-wide init directory. Its location is
  691. specified with the '--with-system-gdbinit-dir' configure
  692. option (*note System-wide configuration::). Files in this
  693. directory are loaded in alphabetical order immediately after
  694. system.gdbinit (if enabled) when GDB starts, before command
  695. line options have been processed. Files need to have a
  696. recognized scripting language extension ('.py'/'.scm') or be
  697. named with a '.gdb' extension to be interpreted as regular GDB
  698. commands. GDB will not recurse into any subdirectories of
  699. this directory.
  700. '~/.gdbinit'
  701. This is the init file in your home directory. It is loaded
  702. next, after 'system.gdbinit', and before command options have
  703. been processed.
  704. './.gdbinit'
  705. This is the init file in the current directory. It is loaded
  706. last, after command line options other than '-x' and '-ex'
  707. have been processed. Command line options '-x' and '-ex' are
  708. processed last, after './.gdbinit' has been loaded.
  709. For further documentation on startup processing, *Note Startup::.
  710. For documentation on how to write command files, *Note Command
  711. Files: Command Files.
  712. '-nh'
  713. Do not execute commands found in '~/.gdbinit', the init file in
  714. your home directory. *Note Startup::.
  715. '-quiet'
  716. '-silent'
  717. '-q'
  718. "Quiet". Do not print the introductory and copyright messages.
  719. These messages are also suppressed in batch mode.
  720. '-batch'
  721. Run in batch mode. Exit with status '0' after processing all the
  722. command files specified with '-x' (and all commands from
  723. initialization files, if not inhibited with '-n'). Exit with
  724. nonzero status if an error occurs in executing the GDB commands in
  725. the command files. Batch mode also disables pagination, sets
  726. unlimited terminal width and height *note Screen Size::, and acts
  727. as if 'set confirm off' were in effect (*note Messages/Warnings::).
  728. Batch mode may be useful for running GDB as a filter, for example
  729. to download and run a program on another computer; in order to make
  730. this more useful, the message
  731. Program exited normally.
  732. (which is ordinarily issued whenever a program running under GDB
  733. control terminates) is not issued when running in batch mode.
  734. '-batch-silent'
  735. Run in batch mode exactly like '-batch', but totally silently. All
  736. GDB output to 'stdout' is prevented ('stderr' is unaffected). This
  737. is much quieter than '-silent' and would be useless for an
  738. interactive session.
  739. This is particularly useful when using targets that give 'Loading
  740. section' messages, for example.
  741. Note that targets that give their output via GDB, as opposed to
  742. writing directly to 'stdout', will also be made silent.
  743. '-return-child-result'
  744. The return code from GDB will be the return code from the child
  745. process (the process being debugged), with the following
  746. exceptions:
  747. * GDB exits abnormally. E.g., due to an incorrect argument or
  748. an internal error. In this case the exit code is the same as
  749. it would have been without '-return-child-result'.
  750. * The user quits with an explicit value. E.g., 'quit 1'.
  751. * The child process never runs, or is not allowed to terminate,
  752. in which case the exit code will be -1.
  753. This option is useful in conjunction with '-batch' or
  754. '-batch-silent', when GDB is being used as a remote program loader
  755. or simulator interface.
  756. '-nowindows'
  757. '-nw'
  758. "No windows". If GDB comes with a graphical user interface (GUI)
  759. built in, then this option tells GDB to only use the command-line
  760. interface. If no GUI is available, this option has no effect.
  761. '-windows'
  762. '-w'
  763. If GDB includes a GUI, then this option requires it to be used if
  764. possible.
  765. '-cd DIRECTORY'
  766. Run GDB using DIRECTORY as its working directory, instead of the
  767. current directory.
  768. '-data-directory DIRECTORY'
  769. '-D DIRECTORY'
  770. Run GDB using DIRECTORY as its data directory. The data directory
  771. is where GDB searches for its auxiliary files. *Note Data Files::.
  772. '-fullname'
  773. '-f'
  774. GNU Emacs sets this option when it runs GDB as a subprocess. It
  775. tells GDB to output the full file name and line number in a
  776. standard, recognizable fashion each time a stack frame is displayed
  777. (which includes each time your program stops). This recognizable
  778. format looks like two '\032' characters, followed by the file name,
  779. line number and character position separated by colons, and a
  780. newline. The Emacs-to-GDB interface program uses the two '\032'
  781. characters as a signal to display the source code for the frame.
  782. '-annotate LEVEL'
  783. This option sets the "annotation level" inside GDB. Its effect is
  784. identical to using 'set annotate LEVEL' (*note Annotations::). The
  785. annotation LEVEL controls how much information GDB prints together
  786. with its prompt, values of expressions, source lines, and other
  787. types of output. Level 0 is the normal, level 1 is for use when
  788. GDB is run as a subprocess of GNU Emacs, level 3 is the maximum
  789. annotation suitable for programs that control GDB, and level 2 has
  790. been deprecated.
  791. The annotation mechanism has largely been superseded by GDB/MI
  792. (*note GDB/MI::).
  793. '--args'
  794. Change interpretation of command line so that arguments following
  795. the executable file are passed as command line arguments to the
  796. inferior. This option stops option processing.
  797. '-baud BPS'
  798. '-b BPS'
  799. Set the line speed (baud rate or bits per second) of any serial
  800. interface used by GDB for remote debugging.
  801. '-l TIMEOUT'
  802. Set the timeout (in seconds) of any communication used by GDB for
  803. remote debugging.
  804. '-tty DEVICE'
  805. '-t DEVICE'
  806. Run using DEVICE for your program's standard input and output.
  807. '-tui'
  808. Activate the "Text User Interface" when starting. The Text User
  809. Interface manages several text windows on the terminal, showing
  810. source, assembly, registers and GDB command outputs (*note GDB Text
  811. User Interface: TUI.). Do not use this option if you run GDB from
  812. Emacs (*note Using GDB under GNU Emacs: Emacs.).
  813. '-interpreter INTERP'
  814. Use the interpreter INTERP for interface with the controlling
  815. program or device. This option is meant to be set by programs
  816. which communicate with GDB using it as a back end. *Note Command
  817. Interpreters: Interpreters.
  818. '--interpreter=mi' (or '--interpreter=mi3') causes GDB to use the
  819. "GDB/MI interface" version 3 (*note The GDB/MI Interface: GDB/MI.)
  820. included since GDB version 9.1. GDB/MI version 2 ('mi2'), included
  821. in GDB 6.0 and version 1 ('mi1'), included in GDB 5.3, are also
  822. available. Earlier GDB/MI interfaces are no longer supported.
  823. '-write'
  824. Open the executable and core files for both reading and writing.
  825. This is equivalent to the 'set write on' command inside GDB (*note
  826. Patching::).
  827. '-statistics'
  828. This option causes GDB to print statistics about time and memory
  829. usage after it completes each command and returns to the prompt.
  830. '-version'
  831. This option causes GDB to print its version number and no-warranty
  832. blurb, and exit.
  833. '-configuration'
  834. This option causes GDB to print details about its build-time
  835. configuration parameters, and then exit. These details can be
  836. important when reporting GDB bugs (*note GDB Bugs::).
  837. 
  838. File: gdb.info, Node: Startup, Prev: Mode Options, Up: Invoking GDB
  839. 2.1.3 What GDB Does During Startup
  840. ----------------------------------
  841. Here's the description of what GDB does during session startup:
  842. 1. Sets up the command interpreter as specified by the command line
  843. (*note interpreter: Mode Options.).
  844. 2. Reads the system-wide "init file" (if '--with-system-gdbinit' was
  845. used when building GDB; *note System-wide configuration and
  846. settings: System-wide configuration.) and the files in the
  847. system-wide gdbinit directory (if '--with-system-gdbinit-dir' was
  848. used) and executes all the commands in those files. The files need
  849. to be named with a '.gdb' extension to be interpreted as GDB
  850. commands, or they can be written in a supported scripting language
  851. with an appropriate file extension.
  852. 3. Reads the init file (if any) in your home directory(1) and executes
  853. all the commands in that file.
  854. 4. Executes commands and command files specified by the '-iex' and
  855. '-ix' options in their specified order. Usually you should use the
  856. '-ex' and '-x' options instead, but this way you can apply settings
  857. before GDB init files get executed and before inferior gets loaded.
  858. 5. Processes command line options and operands.
  859. 6. Reads and executes the commands from init file (if any) in the
  860. current working directory as long as 'set auto-load local-gdbinit'
  861. is set to 'on' (*note Init File in the Current Directory::). This
  862. is only done if the current directory is different from your home
  863. directory. Thus, you can have more than one init file, one generic
  864. in your home directory, and another, specific to the program you
  865. are debugging, in the directory where you invoke GDB.
  866. 7. If the command line specified a program to debug, or a process to
  867. attach to, or a core file, GDB loads any auto-loaded scripts
  868. provided for the program or for its loaded shared libraries. *Note
  869. Auto-loading::.
  870. If you wish to disable the auto-loading during startup, you must do
  871. something like the following:
  872. $ gdb -iex "set auto-load python-scripts off" myprogram
  873. Option '-ex' does not work because the auto-loading is then turned
  874. off too late.
  875. 8. Executes commands and command files specified by the '-ex' and '-x'
  876. options in their specified order. *Note Command Files::, for more
  877. details about GDB command files.
  878. 9. Reads the command history recorded in the "history file". *Note
  879. Command History::, for more details about the command history and
  880. the files where GDB records it.
  881. Init files use the same syntax as "command files" (*note Command
  882. Files::) and are processed by GDB in the same way. The init file in
  883. your home directory can set options (such as 'set complaints') that
  884. affect subsequent processing of command line options and operands. Init
  885. files are not executed if you use the '-nx' option (*note Choosing
  886. Modes: Mode Options.).
  887. To display the list of init files loaded by gdb at startup, you can
  888. use 'gdb --help'.
  889. The GDB init files are normally called '.gdbinit'. The DJGPP port of
  890. GDB uses the name 'gdb.ini', due to the limitations of file names
  891. imposed by DOS filesystems. The Windows port of GDB uses the standard
  892. name, but if it finds a 'gdb.ini' file in your home directory, it warns
  893. you about that and suggests to rename the file to the standard name.
  894. ---------- Footnotes ----------
  895. (1) On DOS/Windows systems, the home directory is the one pointed to
  896. by the 'HOME' environment variable.
  897. 
  898. File: gdb.info, Node: Quitting GDB, Next: Shell Commands, Prev: Invoking GDB, Up: Invocation
  899. 2.2 Quitting GDB
  900. ================
  901. 'quit [EXPRESSION]'
  902. 'q'
  903. To exit GDB, use the 'quit' command (abbreviated 'q'), or type an
  904. end-of-file character (usually 'Ctrl-d'). If you do not supply
  905. EXPRESSION, GDB will terminate normally; otherwise it will
  906. terminate using the result of EXPRESSION as the error code.
  907. An interrupt (often 'Ctrl-c') does not exit from GDB, but rather
  908. terminates the action of any GDB command that is in progress and returns
  909. to GDB command level. It is safe to type the interrupt character at any
  910. time because GDB does not allow it to take effect until a time when it
  911. is safe.
  912. If you have been using GDB to control an attached process or device,
  913. you can release it with the 'detach' command (*note Debugging an
  914. Already-running Process: Attach.).
  915. 
  916. File: gdb.info, Node: Shell Commands, Next: Logging Output, Prev: Quitting GDB, Up: Invocation
  917. 2.3 Shell Commands
  918. ==================
  919. If you need to execute occasional shell commands during your debugging
  920. session, there is no need to leave or suspend GDB; you can just use the
  921. 'shell' command.
  922. 'shell COMMAND-STRING'
  923. '!COMMAND-STRING'
  924. Invoke a standard shell to execute COMMAND-STRING. Note that no
  925. space is needed between '!' and COMMAND-STRING. On GNU and Unix
  926. systems, the environment variable 'SHELL', if it exists, determines
  927. which shell to run. Otherwise GDB uses the default shell
  928. ('/bin/sh' on GNU and Unix systems, 'cmd.exe' on MS-Windows,
  929. 'COMMAND.COM' on MS-DOS, etc.).
  930. The utility 'make' is often needed in development environments. You
  931. do not have to use the 'shell' command for this purpose in GDB:
  932. 'make MAKE-ARGS'
  933. Execute the 'make' program with the specified arguments. This is
  934. equivalent to 'shell make MAKE-ARGS'.
  935. 'pipe [COMMAND] | SHELL_COMMAND'
  936. '| [COMMAND] | SHELL_COMMAND'
  937. 'pipe -d DELIM COMMAND DELIM SHELL_COMMAND'
  938. '| -d DELIM COMMAND DELIM SHELL_COMMAND'
  939. Executes COMMAND and sends its output to SHELL_COMMAND. Note that
  940. no space is needed around '|'. If no COMMAND is provided, the last
  941. command executed is repeated.
  942. In case the COMMAND contains a '|', the option '-d DELIM' can be
  943. used to specify an alternate delimiter string DELIM that separates
  944. the COMMAND from the SHELL_COMMAND.
  945. Example:
  946. (gdb) p var
  947. $1 = {
  948. black = 144,
  949. red = 233,
  950. green = 377,
  951. blue = 610,
  952. white = 987
  953. }
  954. (gdb) pipe p var|wc
  955. 7 19 80
  956. (gdb) |p var|wc -l
  957. 7
  958. (gdb) p /x var
  959. $4 = {
  960. black = 0x90,
  961. red = 0xe9,
  962. green = 0x179,
  963. blue = 0x262,
  964. white = 0x3db
  965. }
  966. (gdb) ||grep red
  967. red => 0xe9,
  968. (gdb) | -d ! echo this contains a | char\n ! sed -e 's/|/PIPE/'
  969. this contains a PIPE char
  970. (gdb) | -d xxx echo this contains a | char!\n xxx sed -e 's/|/PIPE/'
  971. this contains a PIPE char!
  972. (gdb)
  973. The convenience variables '$_shell_exitcode' and '$_shell_exitsignal'
  974. can be used to examine the exit status of the last shell command
  975. launched by 'shell', 'make', 'pipe' and '|'. *Note Convenience
  976. Variables: Convenience Vars.
  977. 
  978. File: gdb.info, Node: Logging Output, Prev: Shell Commands, Up: Invocation
  979. 2.4 Logging Output
  980. ==================
  981. You may want to save the output of GDB commands to a file. There are
  982. several commands to control GDB's logging.
  983. 'set logging on'
  984. Enable logging.
  985. 'set logging off'
  986. Disable logging.
  987. 'set logging file FILE'
  988. Change the name of the current logfile. The default logfile is
  989. 'gdb.txt'.
  990. 'set logging overwrite [on|off]'
  991. By default, GDB will append to the logfile. Set 'overwrite' if you
  992. want 'set logging on' to overwrite the logfile instead.
  993. 'set logging redirect [on|off]'
  994. By default, GDB output will go to both the terminal and the
  995. logfile. Set 'redirect' if you want output to go only to the log
  996. file.
  997. 'set logging debugredirect [on|off]'
  998. By default, GDB debug output will go to both the terminal and the
  999. logfile. Set 'debugredirect' if you want debug output to go only
  1000. to the log file.
  1001. 'show logging'
  1002. Show the current values of the logging settings.
  1003. You can also redirect the output of a GDB command to a shell command.
  1004. *Note pipe::.
  1005. 
  1006. File: gdb.info, Node: Commands, Next: Running, Prev: Invocation, Up: Top
  1007. 3 GDB Commands
  1008. **************
  1009. You can abbreviate a GDB command to the first few letters of the command
  1010. name, if that abbreviation is unambiguous; and you can repeat certain
  1011. GDB commands by typing just <RET>. You can also use the <TAB> key to
  1012. get GDB to fill out the rest of a word in a command (or to show you the
  1013. alternatives available, if there is more than one possibility).
  1014. * Menu:
  1015. * Command Syntax:: How to give commands to GDB
  1016. * Command Settings:: How to change default behavior of commands
  1017. * Completion:: Command completion
  1018. * Command Options:: Command options
  1019. * Command aliases default args:: Automatically prepend default arguments to user-defined aliases
  1020. * Help:: How to ask GDB for help
  1021. 
  1022. File: gdb.info, Node: Command Syntax, Next: Command Settings, Up: Commands
  1023. 3.1 Command Syntax
  1024. ==================
  1025. A GDB command is a single line of input. There is no limit on how long
  1026. it can be. It starts with a command name, which is followed by
  1027. arguments whose meaning depends on the command name. For example, the
  1028. command 'step' accepts an argument which is the number of times to step,
  1029. as in 'step 5'. You can also use the 'step' command with no arguments.
  1030. Some commands do not allow any arguments.
  1031. GDB command names may always be truncated if that abbreviation is
  1032. unambiguous. Other possible command abbreviations are listed in the
  1033. documentation for individual commands. In some cases, even ambiguous
  1034. abbreviations are allowed; for example, 's' is specially defined as
  1035. equivalent to 'step' even though there are other commands whose names
  1036. start with 's'. You can test abbreviations by using them as arguments
  1037. to the 'help' command.
  1038. A blank line as input to GDB (typing just <RET>) means to repeat the
  1039. previous command. Certain commands (for example, 'run') will not repeat
  1040. this way; these are commands whose unintentional repetition might cause
  1041. trouble and which you are unlikely to want to repeat. User-defined
  1042. commands can disable this feature; see *note dont-repeat: Define.
  1043. The 'list' and 'x' commands, when you repeat them with <RET>,
  1044. construct new arguments rather than repeating exactly as typed. This
  1045. permits easy scanning of source or memory.
  1046. GDB can also use <RET> in another way: to partition lengthy output,
  1047. in a way similar to the common utility 'more' (*note Screen Size: Screen
  1048. Size.). Since it is easy to press one <RET> too many in this situation,
  1049. GDB disables command repetition after any command that generates this
  1050. sort of display.
  1051. Any text from a '#' to the end of the line is a comment; it does
  1052. nothing. This is useful mainly in command files (*note Command Files:
  1053. Command Files.).
  1054. The 'Ctrl-o' binding is useful for repeating a complex sequence of
  1055. commands. This command accepts the current line, like <RET>, and then
  1056. fetches the next line relative to the current line from the history for
  1057. editing.
  1058. 
  1059. File: gdb.info, Node: Command Settings, Next: Completion, Prev: Command Syntax, Up: Commands
  1060. 3.2 Command Settings
  1061. ====================
  1062. Many commands change their behavior according to command-specific
  1063. variables or settings. These settings can be changed with the 'set'
  1064. subcommands. For example, the 'print' command (*note Examining Data:
  1065. Data.) prints arrays differently depending on settings changeable with
  1066. the commands 'set print elements NUMBER-OF-ELEMENTS' and 'set print
  1067. array-indexes', among others.
  1068. You can change these settings to your preference in the gdbinit files
  1069. loaded at GDB startup. *Note Startup::.
  1070. The settings can also be changed interactively during the debugging
  1071. session. For example, to change the limit of array elements to print,
  1072. you can do the following:
  1073. (GDB) set print elements 10
  1074. (GDB) print some_array
  1075. $1 = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90...}
  1076. The above 'set print elements 10' command changes the number of
  1077. elements to print from the default of 200 to 10. If you only intend
  1078. this limit of 10 to be used for printing 'some_array', then you must
  1079. restore the limit back to 200, with 'set print elements 200'.
  1080. Some commands allow overriding settings with command options. For
  1081. example, the 'print' command supports a number of options that allow
  1082. overriding relevant global print settings as set by 'set print'
  1083. subcommands. *Note print options::. The example above could be
  1084. rewritten as:
  1085. (GDB) print -elements 10 -- some_array
  1086. $1 = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90...}
  1087. Alternatively, you can use the 'with' command to change a setting
  1088. temporarily, for the duration of a command invocation.
  1089. 'with SETTING [VALUE] [-- COMMAND]'
  1090. 'w SETTING [VALUE] [-- COMMAND]'
  1091. Temporarily set SETTING to VALUE for the duration of COMMAND.
  1092. SETTING is any setting you can change with the 'set' subcommands.
  1093. VALUE is the value to assign to 'setting' while running 'command'.
  1094. If no COMMAND is provided, the last command executed is repeated.
  1095. If a COMMAND is provided, it must be preceded by a double dash
  1096. ('--') separator. This is required because some settings accept
  1097. free-form arguments, such as expressions or filenames.
  1098. For example, the command
  1099. (GDB) with print array on -- print some_array
  1100. is equivalent to the following 3 commands:
  1101. (GDB) set print array on
  1102. (GDB) print some_array
  1103. (GDB) set print array off
  1104. The 'with' command is particularly useful when you want to override
  1105. a setting while running user-defined commands, or commands defined
  1106. in Python or Guile. *Note Extending GDB: Extending GDB.
  1107. (GDB) with print pretty on -- my_complex_command
  1108. To change several settings for the same command, you can nest
  1109. 'with' commands. For example, 'with language ada -- with print
  1110. elements 10' temporarily changes the language to Ada and sets a
  1111. limit of 10 elements to print for arrays and strings.
  1112. 
  1113. File: gdb.info, Node: Completion, Next: Command Options, Prev: Command Settings, Up: Commands
  1114. 3.3 Command Completion
  1115. ======================
  1116. GDB can fill in the rest of a word in a command for you, if there is
  1117. only one possibility; it can also show you what the valid possibilities
  1118. are for the next word in a command, at any time. This works for GDB
  1119. commands, GDB subcommands, command options, and the names of symbols in
  1120. your program.
  1121. Press the <TAB> key whenever you want GDB to fill out the rest of a
  1122. word. If there is only one possibility, GDB fills in the word, and
  1123. waits for you to finish the command (or press <RET> to enter it). For
  1124. example, if you type
  1125. (gdb) info bre <TAB>
  1126. GDB fills in the rest of the word 'breakpoints', since that is the only
  1127. 'info' subcommand beginning with 'bre':
  1128. (gdb) info breakpoints
  1129. You can either press <RET> at this point, to run the 'info breakpoints'
  1130. command, or backspace and enter something else, if 'breakpoints' does
  1131. not look like the command you expected. (If you were sure you wanted
  1132. 'info breakpoints' in the first place, you might as well just type <RET>
  1133. immediately after 'info bre', to exploit command abbreviations rather
  1134. than command completion).
  1135. If there is more than one possibility for the next word when you
  1136. press <TAB>, GDB sounds a bell. You can either supply more characters
  1137. and try again, or just press <TAB> a second time; GDB displays all the
  1138. possible completions for that word. For example, you might want to set
  1139. a breakpoint on a subroutine whose name begins with 'make_', but when
  1140. you type 'b make_<TAB>' GDB just sounds the bell. Typing <TAB> again
  1141. displays all the function names in your program that begin with those
  1142. characters, for example:
  1143. (gdb) b make_ <TAB>
  1144. GDB sounds bell; press <TAB> again, to see:
  1145. make_a_section_from_file make_environ
  1146. make_abs_section make_function_type
  1147. make_blockvector make_pointer_type
  1148. make_cleanup make_reference_type
  1149. make_command make_symbol_completion_list
  1150. (gdb) b make_
  1151. After displaying the available possibilities, GDB copies your partial
  1152. input ('b make_' in the example) so you can finish the command.
  1153. If you just want to see the list of alternatives in the first place,
  1154. you can press 'M-?' rather than pressing <TAB> twice. 'M-?' means
  1155. '<META> ?'. You can type this either by holding down a key designated
  1156. as the <META> shift on your keyboard (if there is one) while typing '?',
  1157. or as <ESC> followed by '?'.
  1158. If the number of possible completions is large, GDB will print as
  1159. much of the list as it has collected, as well as a message indicating
  1160. that the list may be truncated.
  1161. (gdb) b m<TAB><TAB>
  1162. main
  1163. <... the rest of the possible completions ...>
  1164. *** List may be truncated, max-completions reached. ***
  1165. (gdb) b m
  1166. This behavior can be controlled with the following commands:
  1167. 'set max-completions LIMIT'
  1168. 'set max-completions unlimited'
  1169. Set the maximum number of completion candidates. GDB will stop
  1170. looking for more completions once it collects this many candidates.
  1171. This is useful when completing on things like function names as
  1172. collecting all the possible candidates can be time consuming. The
  1173. default value is 200. A value of zero disables tab-completion.
  1174. Note that setting either no limit or a very large limit can make
  1175. completion slow.
  1176. 'show max-completions'
  1177. Show the maximum number of candidates that GDB will collect and
  1178. show during completion.
  1179. Sometimes the string you need, while logically a "word", may contain
  1180. parentheses or other characters that GDB normally excludes from its
  1181. notion of a word. To permit word completion to work in this situation,
  1182. you may enclose words in ''' (single quote marks) in GDB commands.
  1183. A likely situation where you might need this is in typing an
  1184. expression that involves a C++ symbol name with template parameters.
  1185. This is because when completing expressions, GDB treats the '<'
  1186. character as word delimiter, assuming that it's the less-than comparison
  1187. operator (*note C and C++ Operators: C Operators.).
  1188. For example, when you want to call a C++ template function
  1189. interactively using the 'print' or 'call' commands, you may need to
  1190. distinguish whether you mean the version of 'name' that was specialized
  1191. for 'int', 'name<int>()', or the version that was specialized for
  1192. 'float', 'name<float>()'. To use the word-completion facilities in this
  1193. situation, type a single quote ''' at the beginning of the function
  1194. name. This alerts GDB that it may need to consider more information
  1195. than usual when you press <TAB> or 'M-?' to request word completion:
  1196. (gdb) p 'func< M-?
  1197. func<int>() func<float>()
  1198. (gdb) p 'func<
  1199. When setting breakpoints however (*note Specify Location::), you
  1200. don't usually need to type a quote before the function name, because GDB
  1201. understands that you want to set a breakpoint on a function:
  1202. (gdb) b func< M-?
  1203. func<int>() func<float>()
  1204. (gdb) b func<
  1205. This is true even in the case of typing the name of C++ overloaded
  1206. functions (multiple definitions of the same function, distinguished by
  1207. argument type). For example, when you want to set a breakpoint you
  1208. don't need to distinguish whether you mean the version of 'name' that
  1209. takes an 'int' parameter, 'name(int)', or the version that takes a
  1210. 'float' parameter, 'name(float)'.
  1211. (gdb) b bubble( M-?
  1212. bubble(int) bubble(double)
  1213. (gdb) b bubble(dou M-?
  1214. bubble(double)
  1215. See *note quoting names:: for a description of other scenarios that
  1216. require quoting.
  1217. For more information about overloaded functions, see *note C++
  1218. Expressions: C Plus Plus Expressions. You can use the command 'set
  1219. overload-resolution off' to disable overload resolution; see *note GDB
  1220. Features for C++: Debugging C Plus Plus.
  1221. When completing in an expression which looks up a field in a
  1222. structure, GDB also tries(1) to limit completions to the field names
  1223. available in the type of the left-hand-side:
  1224. (gdb) p gdb_stdout.M-?
  1225. magic to_fputs to_rewind
  1226. to_data to_isatty to_write
  1227. to_delete to_put to_write_async_safe
  1228. to_flush to_read
  1229. This is because the 'gdb_stdout' is a variable of the type 'struct
  1230. ui_file' that is defined in GDB sources as follows:
  1231. struct ui_file
  1232. {
  1233. int *magic;
  1234. ui_file_flush_ftype *to_flush;
  1235. ui_file_write_ftype *to_write;
  1236. ui_file_write_async_safe_ftype *to_write_async_safe;
  1237. ui_file_fputs_ftype *to_fputs;
  1238. ui_file_read_ftype *to_read;
  1239. ui_file_delete_ftype *to_delete;
  1240. ui_file_isatty_ftype *to_isatty;
  1241. ui_file_rewind_ftype *to_rewind;
  1242. ui_file_put_ftype *to_put;
  1243. void *to_data;
  1244. }
  1245. ---------- Footnotes ----------
  1246. (1) The completer can be confused by certain kinds of invalid
  1247. expressions. Also, it only examines the static type of the expression,
  1248. not the dynamic type.
  1249. 
  1250. File: gdb.info, Node: Command Options, Next: Command aliases default args, Prev: Completion, Up: Commands
  1251. 3.4 Command options
  1252. ===================
  1253. Some commands accept options starting with a leading dash. For example,
  1254. 'print -pretty'. Similarly to command names, you can abbreviate a GDB
  1255. option to the first few letters of the option name, if that abbreviation
  1256. is unambiguous, and you can also use the <TAB> key to get GDB to fill
  1257. out the rest of a word in an option (or to show you the alternatives
  1258. available, if there is more than one possibility).
  1259. Some commands take raw input as argument. For example, the print
  1260. command processes arbitrary expressions in any of the languages
  1261. supported by GDB. With such commands, because raw input may start with
  1262. a leading dash that would be confused with an option or any of its
  1263. abbreviations, e.g. 'print -p' (short for 'print -pretty' or printing
  1264. negative 'p'?), if you specify any command option, then you must use a
  1265. double-dash ('--') delimiter to indicate the end of options.
  1266. Some options are described as accepting an argument which can be
  1267. either 'on' or 'off'. These are known as "boolean options". Similarly
  1268. to boolean settings commands--'on' and 'off' are the typical values, but
  1269. any of '1', 'yes' and 'enable' can also be used as "true" value, and any
  1270. of '0', 'no' and 'disable' can also be used as "false" value. You can
  1271. also omit a "true" value, as it is implied by default.
  1272. For example, these are equivalent:
  1273. (gdb) print -object on -pretty off -element unlimited -- *myptr
  1274. (gdb) p -o -p 0 -e u -- *myptr
  1275. You can discover the set of options some command accepts by
  1276. completing on '-' after the command name. For example:
  1277. (gdb) print -<TAB><TAB>
  1278. -address -max-depth -raw-values -union
  1279. -array -null-stop -repeats -vtbl
  1280. -array-indexes -object -static-members
  1281. -elements -pretty -symbol
  1282. Completion will in some cases guide you with a suggestion of what
  1283. kind of argument an option expects. For example:
  1284. (gdb) print -elements <TAB><TAB>
  1285. NUMBER unlimited
  1286. Here, the option expects a number (e.g., '100'), not literal
  1287. 'NUMBER'. Such metasyntactical arguments are always presented in
  1288. uppercase.
  1289. (For more on using the 'print' command, see *note Examining Data:
  1290. Data.)
  1291. 
  1292. File: gdb.info, Node: Command aliases default args, Next: Help, Prev: Command Options, Up: Commands
  1293. 3.5 Automatically prepend default arguments to user-defined aliases
  1294. ===================================================================
  1295. You can tell GDB to always prepend some default arguments to the list of
  1296. arguments provided explicitly by the user when using a user-defined
  1297. alias.
  1298. If you repeatedly use the same arguments or options for a command,
  1299. you can define an alias for this command and tell GDB to automatically
  1300. prepend these arguments or options to the list of arguments you type
  1301. explicitly when using the alias(1).
  1302. For example, if you often use the command 'thread apply all'
  1303. specifying to work on the threads in ascending order and to continue in
  1304. case it encounters an error, you can tell GDB to automatically preprend
  1305. the '-ascending' and '-c' options by using:
  1306. (gdb) alias thread apply asc-all = thread apply all -ascending -c
  1307. Once you have defined this alias with its default args, any time you
  1308. type the 'thread apply asc-all' followed by 'some arguments', GDB will
  1309. execute 'thread apply all -ascending -c some arguments'.
  1310. To have even less to type, you can also define a one word alias:
  1311. (gdb) alias t_a_c = thread apply all -ascending -c
  1312. As usual, unambiguous abbreviations can be used for ALIAS and
  1313. DEFAULT-ARGS.
  1314. The different aliases of a command do not share their default args.
  1315. For example, you define a new alias 'bt_ALL' showing all possible
  1316. information and another alias 'bt_SMALL' showing very limited
  1317. information using:
  1318. (gdb) alias bt_ALL = backtrace -entry-values both -frame-arg all \
  1319. -past-main -past-entry -full
  1320. (gdb) alias bt_SMALL = backtrace -entry-values no -frame-arg none \
  1321. -past-main off -past-entry off
  1322. (For more on using the 'alias' command, see *note Aliases::.)
  1323. Default args are not limited to the arguments and options of COMMAND,
  1324. but can specify nested commands if COMMAND accepts such a nested command
  1325. as argument. For example, the below defines 'faalocalsoftype' that
  1326. lists the frames having locals of a certain type, together with the
  1327. matching local vars:
  1328. (gdb) alias faalocalsoftype = frame apply all info locals -q -t
  1329. (gdb) faalocalsoftype int
  1330. #1 0x55554f5e in sleeper_or_burner (v=0xdf50) at sleepers.c:86
  1331. i = 0
  1332. ret = 21845
  1333. This is also very useful to define an alias for a set of nested
  1334. 'with' commands to have a particular combination of temporary settings.
  1335. For example, the below defines the alias 'pp10' that pretty prints an
  1336. expression argument, with a maximum of 10 elements if the expression is
  1337. a string or an array:
  1338. (gdb) alias pp10 = with print pretty -- with print elements 10 -- print
  1339. This defines the alias 'pp10' as being a sequence of 3 commands. The
  1340. first part 'with print pretty --' temporarily activates the setting 'set
  1341. print pretty', then launches the command that follows the separator
  1342. '--'. The command following the first part is also a 'with' command
  1343. that temporarily changes the setting 'set print elements' to 10, then
  1344. launches the command that follows the second separator '--'. The third
  1345. part 'print' is the command the 'pp10' alias will launch, using the
  1346. temporary values of the settings and the arguments explicitly given by
  1347. the user. For more information about the 'with' command usage, see
  1348. *note Command Settings::.
  1349. ---------- Footnotes ----------
  1350. (1) GDB could easily accept default arguments for pre-defined
  1351. commands and aliases, but it was deemed this would be confusing, and so
  1352. is not allowed.
  1353. 
  1354. File: gdb.info, Node: Help, Prev: Command aliases default args, Up: Commands
  1355. 3.6 Getting Help
  1356. ================
  1357. You can always ask GDB itself for information on its commands, using the
  1358. command 'help'.
  1359. 'help'
  1360. 'h'
  1361. You can use 'help' (abbreviated 'h') with no arguments to display a
  1362. short list of named classes of commands:
  1363. (gdb) help
  1364. List of classes of commands:
  1365. aliases -- User-defined aliases of other commands
  1366. breakpoints -- Making program stop at certain points
  1367. data -- Examining data
  1368. files -- Specifying and examining files
  1369. internals -- Maintenance commands
  1370. obscure -- Obscure features
  1371. running -- Running the program
  1372. stack -- Examining the stack
  1373. status -- Status inquiries
  1374. support -- Support facilities
  1375. tracepoints -- Tracing of program execution without
  1376. stopping the program
  1377. user-defined -- User-defined commands
  1378. Type "help" followed by a class name for a list of
  1379. commands in that class.
  1380. Type "help" followed by command name for full
  1381. documentation.
  1382. Command name abbreviations are allowed if unambiguous.
  1383. (gdb)
  1384. 'help CLASS'
  1385. Using one of the general help classes as an argument, you can get a
  1386. list of the individual commands in that class. If a command has
  1387. aliases, the aliases are given after the command name, separated by
  1388. commas. If an alias has default arguments, the full definition of
  1389. the alias is given after the first line. For example, here is the
  1390. help display for the class 'status':
  1391. (gdb) help status
  1392. Status inquiries.
  1393. List of commands:
  1394. info, inf, i -- Generic command for showing things
  1395. about the program being debugged
  1396. info address, iamain -- Describe where symbol SYM is stored.
  1397. alias iamain = info address main
  1398. info all-registers -- List of all registers and their contents,
  1399. for selected stack frame.
  1400. ...
  1401. show, info set -- Generic command for showing things
  1402. about the debugger
  1403. Type "help" followed by command name for full
  1404. documentation.
  1405. Command name abbreviations are allowed if unambiguous.
  1406. (gdb)
  1407. 'help COMMAND'
  1408. With a command name as 'help' argument, GDB displays a short
  1409. paragraph on how to use that command. If that command has one or
  1410. more aliases, GDB will display a first line with the command name
  1411. and all its aliases separated by commas. This first line will be
  1412. followed by the full definition of all aliases having default
  1413. arguments.
  1414. 'apropos [-v] REGEXP'
  1415. The 'apropos' command searches through all of the GDB commands, and
  1416. their documentation, for the regular expression specified in ARGS.
  1417. It prints out all matches found. The optional flag '-v', which
  1418. stands for 'verbose', indicates to output the full documentation of
  1419. the matching commands and highlight the parts of the documentation
  1420. matching REGEXP. For example:
  1421. apropos alias
  1422. results in:
  1423. alias -- Define a new command that is an alias of an existing command
  1424. aliases -- User-defined aliases of other commands
  1425. while
  1426. apropos -v cut.*thread apply
  1427. results in the below output, where 'cut for 'thread apply' is
  1428. highlighted if styling is enabled.
  1429. taas -- Apply a command to all threads (ignoring errors
  1430. and empty output).
  1431. Usage: taas COMMAND
  1432. shortcut for 'thread apply all -s COMMAND'
  1433. tfaas -- Apply a command to all frames of all threads
  1434. (ignoring errors and empty output).
  1435. Usage: tfaas COMMAND
  1436. shortcut for 'thread apply all -s frame apply all -s COMMAND'
  1437. 'complete ARGS'
  1438. The 'complete ARGS' command lists all the possible completions for
  1439. the beginning of a command. Use ARGS to specify the beginning of
  1440. the command you want completed. For example:
  1441. complete i
  1442. results in:
  1443. if
  1444. ignore
  1445. info
  1446. inspect
  1447. This is intended for use by GNU Emacs.
  1448. In addition to 'help', you can use the GDB commands 'info' and 'show'
  1449. to inquire about the state of your program, or the state of GDB itself.
  1450. Each command supports many topics of inquiry; this manual introduces
  1451. each of them in the appropriate context. The listings under 'info' and
  1452. under 'show' in the Command, Variable, and Function Index point to all
  1453. the sub-commands. *Note Command and Variable Index::.
  1454. 'info'
  1455. This command (abbreviated 'i') is for describing the state of your
  1456. program. For example, you can show the arguments passed to a
  1457. function with 'info args', list the registers currently in use with
  1458. 'info registers', or list the breakpoints you have set with 'info
  1459. breakpoints'. You can get a complete list of the 'info'
  1460. sub-commands with 'help info'.
  1461. 'set'
  1462. You can assign the result of an expression to an environment
  1463. variable with 'set'. For example, you can set the GDB prompt to a
  1464. $-sign with 'set prompt $'.
  1465. 'show'
  1466. In contrast to 'info', 'show' is for describing the state of GDB
  1467. itself. You can change most of the things you can 'show', by using
  1468. the related command 'set'; for example, you can control what number
  1469. system is used for displays with 'set radix', or simply inquire
  1470. which is currently in use with 'show radix'.
  1471. To display all the settable parameters and their current values,
  1472. you can use 'show' with no arguments; you may also use 'info set'.
  1473. Both commands produce the same display.
  1474. Here are several miscellaneous 'show' subcommands, all of which are
  1475. exceptional in lacking corresponding 'set' commands:
  1476. 'show version'
  1477. Show what version of GDB is running. You should include this
  1478. information in GDB bug-reports. If multiple versions of GDB are in
  1479. use at your site, you may need to determine which version of GDB
  1480. you are running; as GDB evolves, new commands are introduced, and
  1481. old ones may wither away. Also, many system vendors ship variant
  1482. versions of GDB, and there are variant versions of GDB in GNU/Linux
  1483. distributions as well. The version number is the same as the one
  1484. announced when you start GDB.
  1485. 'show copying'
  1486. 'info copying'
  1487. Display information about permission for copying GDB.
  1488. 'show warranty'
  1489. 'info warranty'
  1490. Display the GNU "NO WARRANTY" statement, or a warranty, if your
  1491. version of GDB comes with one.
  1492. 'show configuration'
  1493. Display detailed information about the way GDB was configured when
  1494. it was built. This displays the optional arguments passed to the
  1495. 'configure' script and also configuration parameters detected
  1496. automatically by 'configure'. When reporting a GDB bug (*note GDB
  1497. Bugs::), it is important to include this information in your
  1498. report.
  1499. 
  1500. File: gdb.info, Node: Running, Next: Stopping, Prev: Commands, Up: Top
  1501. 4 Running Programs Under GDB
  1502. ****************************
  1503. When you run a program under GDB, you must first generate debugging
  1504. information when you compile it.
  1505. You may start GDB with its arguments, if any, in an environment of
  1506. your choice. If you are doing native debugging, you may redirect your
  1507. program's input and output, debug an already running process, or kill a
  1508. child process.
  1509. * Menu:
  1510. * Compilation:: Compiling for debugging
  1511. * Starting:: Starting your program
  1512. * Arguments:: Your program's arguments
  1513. * Environment:: Your program's environment
  1514. * Working Directory:: Your program's working directory
  1515. * Input/Output:: Your program's input and output
  1516. * Attach:: Debugging an already-running process
  1517. * Kill Process:: Killing the child process
  1518. * Inferiors Connections and Programs:: Debugging multiple inferiors
  1519. connections and programs
  1520. * Threads:: Debugging programs with multiple threads
  1521. * Forks:: Debugging forks
  1522. * Checkpoint/Restart:: Setting a _bookmark_ to return to later
  1523. 
  1524. File: gdb.info, Node: Compilation, Next: Starting, Up: Running
  1525. 4.1 Compiling for Debugging
  1526. ===========================
  1527. In order to debug a program effectively, you need to generate debugging
  1528. information when you compile it. This debugging information is stored
  1529. in the object file; it describes the data type of each variable or
  1530. function and the correspondence between source line numbers and
  1531. addresses in the executable code.
  1532. To request debugging information, specify the '-g' option when you
  1533. run the compiler.
  1534. Programs that are to be shipped to your customers are compiled with
  1535. optimizations, using the '-O' compiler option. However, some compilers
  1536. are unable to handle the '-g' and '-O' options together. Using those
  1537. compilers, you cannot generate optimized executables containing
  1538. debugging information.
  1539. GCC, the GNU C/C++ compiler, supports '-g' with or without '-O',
  1540. making it possible to debug optimized code. We recommend that you
  1541. _always_ use '-g' whenever you compile a program. You may think your
  1542. program is correct, but there is no sense in pushing your luck. For
  1543. more information, see *note Optimized Code::.
  1544. Older versions of the GNU C compiler permitted a variant option '-gg'
  1545. for debugging information. GDB no longer supports this format; if your
  1546. GNU C compiler has this option, do not use it.
  1547. GDB knows about preprocessor macros and can show you their expansion
  1548. (*note Macros::). Most compilers do not include information about
  1549. preprocessor macros in the debugging information if you specify the '-g'
  1550. flag alone. Version 3.1 and later of GCC, the GNU C compiler, provides
  1551. macro information if you are using the DWARF debugging format, and
  1552. specify the option '-g3'.
  1553. *Note Options for Debugging Your Program or GCC: (gcc)Debugging
  1554. Options, for more information on GCC options affecting debug
  1555. information.
  1556. You will have the best debugging experience if you use the latest
  1557. version of the DWARF debugging format that your compiler supports.
  1558. DWARF is currently the most expressive and best supported debugging
  1559. format in GDB.
  1560. 
  1561. File: gdb.info, Node: Starting, Next: Arguments, Prev: Compilation, Up: Running
  1562. 4.2 Starting your Program
  1563. =========================
  1564. 'run'
  1565. 'r'
  1566. Use the 'run' command to start your program under GDB. You must
  1567. first specify the program name with an argument to GDB (*note
  1568. Getting In and Out of GDB: Invocation.), or by using the 'file' or
  1569. 'exec-file' command (*note Commands to Specify Files: Files.).
  1570. If you are running your program in an execution environment that
  1571. supports processes, 'run' creates an inferior process and makes that
  1572. process run your program. In some environments without processes, 'run'
  1573. jumps to the start of your program. Other targets, like 'remote', are
  1574. always running. If you get an error message like this one:
  1575. The "remote" target does not support "run".
  1576. Try "help target" or "continue".
  1577. then use 'continue' to run your program. You may need 'load' first
  1578. (*note load::).
  1579. The execution of a program is affected by certain information it
  1580. receives from its superior. GDB provides ways to specify this
  1581. information, which you must do _before_ starting your program. (You can
  1582. change it after starting your program, but such changes only affect your
  1583. program the next time you start it.) This information may be divided
  1584. into four categories:
  1585. The _arguments._
  1586. Specify the arguments to give your program as the arguments of the
  1587. 'run' command. If a shell is available on your target, the shell
  1588. is used to pass the arguments, so that you may use normal
  1589. conventions (such as wildcard expansion or variable substitution)
  1590. in describing the arguments. In Unix systems, you can control
  1591. which shell is used with the 'SHELL' environment variable. If you
  1592. do not define 'SHELL', GDB uses the default shell ('/bin/sh'). You
  1593. can disable use of any shell with the 'set startup-with-shell'
  1594. command (see below for details).
  1595. The _environment._
  1596. Your program normally inherits its environment from GDB, but you
  1597. can use the GDB commands 'set environment' and 'unset environment'
  1598. to change parts of the environment that affect your program. *Note
  1599. Your Program's Environment: Environment.
  1600. The _working directory._
  1601. You can set your program's working directory with the command 'set
  1602. cwd'. If you do not set any working directory with this command,
  1603. your program will inherit GDB's working directory if native
  1604. debugging, or the remote server's working directory if remote
  1605. debugging. *Note Your Program's Working Directory: Working
  1606. Directory.
  1607. The _standard input and output._
  1608. Your program normally uses the same device for standard input and
  1609. standard output as GDB is using. You can redirect input and output
  1610. in the 'run' command line, or you can use the 'tty' command to set
  1611. a different device for your program. *Note Your Program's Input
  1612. and Output: Input/Output.
  1613. _Warning:_ While input and output redirection work, you cannot use
  1614. pipes to pass the output of the program you are debugging to
  1615. another program; if you attempt this, GDB is likely to wind up
  1616. debugging the wrong program.
  1617. When you issue the 'run' command, your program begins to execute
  1618. immediately. *Note Stopping and Continuing: Stopping, for discussion of
  1619. how to arrange for your program to stop. Once your program has stopped,
  1620. you may call functions in your program, using the 'print' or 'call'
  1621. commands. *Note Examining Data: Data.
  1622. If the modification time of your symbol file has changed since the
  1623. last time GDB read its symbols, GDB discards its symbol table, and reads
  1624. it again. When it does this, GDB tries to retain your current
  1625. breakpoints.
  1626. 'start'
  1627. The name of the main procedure can vary from language to language.
  1628. With C or C++, the main procedure name is always 'main', but other
  1629. languages such as Ada do not require a specific name for their main
  1630. procedure. The debugger provides a convenient way to start the
  1631. execution of the program and to stop at the beginning of the main
  1632. procedure, depending on the language used.
  1633. The 'start' command does the equivalent of setting a temporary
  1634. breakpoint at the beginning of the main procedure and then invoking
  1635. the 'run' command.
  1636. Some programs contain an "elaboration" phase where some startup
  1637. code is executed before the main procedure is called. This depends
  1638. on the languages used to write your program. In C++, for instance,
  1639. constructors for static and global objects are executed before
  1640. 'main' is called. It is therefore possible that the debugger stops
  1641. before reaching the main procedure. However, the temporary
  1642. breakpoint will remain to halt execution.
  1643. Specify the arguments to give to your program as arguments to the
  1644. 'start' command. These arguments will be given verbatim to the
  1645. underlying 'run' command. Note that the same arguments will be
  1646. reused if no argument is provided during subsequent calls to
  1647. 'start' or 'run'.
  1648. It is sometimes necessary to debug the program during elaboration.
  1649. In these cases, using the 'start' command would stop the execution
  1650. of your program too late, as the program would have already
  1651. completed the elaboration phase. Under these circumstances, either
  1652. insert breakpoints in your elaboration code before running your
  1653. program or use the 'starti' command.
  1654. 'starti'
  1655. The 'starti' command does the equivalent of setting a temporary
  1656. breakpoint at the first instruction of a program's execution and
  1657. then invoking the 'run' command. For programs containing an
  1658. elaboration phase, the 'starti' command will stop execution at the
  1659. start of the elaboration phase.
  1660. 'set exec-wrapper WRAPPER'
  1661. 'show exec-wrapper'
  1662. 'unset exec-wrapper'
  1663. When 'exec-wrapper' is set, the specified wrapper is used to launch
  1664. programs for debugging. GDB starts your program with a shell
  1665. command of the form 'exec WRAPPER PROGRAM'. Quoting is added to
  1666. PROGRAM and its arguments, but not to WRAPPER, so you should add
  1667. quotes if appropriate for your shell. The wrapper runs until it
  1668. executes your program, and then GDB takes control.
  1669. You can use any program that eventually calls 'execve' with its
  1670. arguments as a wrapper. Several standard Unix utilities do this,
  1671. e.g. 'env' and 'nohup'. Any Unix shell script ending with 'exec
  1672. "$@"' will also work.
  1673. For example, you can use 'env' to pass an environment variable to
  1674. the debugged program, without setting the variable in your shell's
  1675. environment:
  1676. (gdb) set exec-wrapper env 'LD_PRELOAD=libtest.so'
  1677. (gdb) run
  1678. This command is available when debugging locally on most targets,
  1679. excluding DJGPP, Cygwin, MS Windows, and QNX Neutrino.
  1680. 'set startup-with-shell'
  1681. 'set startup-with-shell on'
  1682. 'set startup-with-shell off'
  1683. 'show startup-with-shell'
  1684. On Unix systems, by default, if a shell is available on your
  1685. target, GDB) uses it to start your program. Arguments of the 'run'
  1686. command are passed to the shell, which does variable substitution,
  1687. expands wildcard characters and performs redirection of I/O. In
  1688. some circumstances, it may be useful to disable such use of a
  1689. shell, for example, when debugging the shell itself or diagnosing
  1690. startup failures such as:
  1691. (gdb) run
  1692. Starting program: ./a.out
  1693. During startup program terminated with signal SIGSEGV, Segmentation fault.
  1694. which indicates the shell or the wrapper specified with
  1695. 'exec-wrapper' crashed, not your program. Most often, this is
  1696. caused by something odd in your shell's non-interactive mode
  1697. initialization file--such as '.cshrc' for C-shell, $'.zshenv' for
  1698. the Z shell, or the file specified in the 'BASH_ENV' environment
  1699. variable for BASH.
  1700. 'set auto-connect-native-target'
  1701. 'set auto-connect-native-target on'
  1702. 'set auto-connect-native-target off'
  1703. 'show auto-connect-native-target'
  1704. By default, if the current inferior is not connected to any target
  1705. yet (e.g., with 'target remote'), the 'run' command starts your
  1706. program as a native process under GDB, on your local machine. If
  1707. you're sure you don't want to debug programs on your local machine,
  1708. you can tell GDB to not connect to the native target automatically
  1709. with the 'set auto-connect-native-target off' command.
  1710. If 'on', which is the default, and if the current inferior is not
  1711. connected to a target already, the 'run' command automaticaly
  1712. connects to the native target, if one is available.
  1713. If 'off', and if the current inferior is not connected to a target
  1714. already, the 'run' command fails with an error:
  1715. (gdb) run
  1716. Don't know how to run. Try "help target".
  1717. If the current inferior is already connected to a target, GDB
  1718. always uses it with the 'run' command.
  1719. In any case, you can explicitly connect to the native target with
  1720. the 'target native' command. For example,
  1721. (gdb) set auto-connect-native-target off
  1722. (gdb) run
  1723. Don't know how to run. Try "help target".
  1724. (gdb) target native
  1725. (gdb) run
  1726. Starting program: ./a.out
  1727. [Inferior 1 (process 10421) exited normally]
  1728. In case you connected explicitly to the 'native' target, GDB
  1729. remains connected even if all inferiors exit, ready for the next
  1730. 'run' command. Use the 'disconnect' command to disconnect.
  1731. Examples of other commands that likewise respect the
  1732. 'auto-connect-native-target' setting: 'attach', 'info proc', 'info
  1733. os'.
  1734. 'set disable-randomization'
  1735. 'set disable-randomization on'
  1736. This option (enabled by default in GDB) will turn off the native
  1737. randomization of the virtual address space of the started program.
  1738. This option is useful for multiple debugging sessions to make the
  1739. execution better reproducible and memory addresses reusable across
  1740. debugging sessions.
  1741. This feature is implemented only on certain targets, including
  1742. GNU/Linux. On GNU/Linux you can get the same behavior using
  1743. (gdb) set exec-wrapper setarch `uname -m` -R
  1744. 'set disable-randomization off'
  1745. Leave the behavior of the started executable unchanged. Some bugs
  1746. rear their ugly heads only when the program is loaded at certain
  1747. addresses. If your bug disappears when you run the program under
  1748. GDB, that might be because GDB by default disables the address
  1749. randomization on platforms, such as GNU/Linux, which do that for
  1750. stand-alone programs. Use 'set disable-randomization off' to try
  1751. to reproduce such elusive bugs.
  1752. On targets where it is available, virtual address space
  1753. randomization protects the programs against certain kinds of
  1754. security attacks. In these cases the attacker needs to know the
  1755. exact location of a concrete executable code. Randomizing its
  1756. location makes it impossible to inject jumps misusing a code at its
  1757. expected addresses.
  1758. Prelinking shared libraries provides a startup performance
  1759. advantage but it makes addresses in these libraries predictable for
  1760. privileged processes by having just unprivileged access at the
  1761. target system. Reading the shared library binary gives enough
  1762. information for assembling the malicious code misusing it. Still
  1763. even a prelinked shared library can get loaded at a new random
  1764. address just requiring the regular relocation process during the
  1765. startup. Shared libraries not already prelinked are always loaded
  1766. at a randomly chosen address.
  1767. Position independent executables (PIE) contain position independent
  1768. code similar to the shared libraries and therefore such executables
  1769. get loaded at a randomly chosen address upon startup. PIE
  1770. executables always load even already prelinked shared libraries at
  1771. a random address. You can build such executable using 'gcc -fPIE
  1772. -pie'.
  1773. Heap (malloc storage), stack and custom mmap areas are always
  1774. placed randomly (as long as the randomization is enabled).
  1775. 'show disable-randomization'
  1776. Show the current setting of the explicit disable of the native
  1777. randomization of the virtual address space of the started program.
  1778. 
  1779. File: gdb.info, Node: Arguments, Next: Environment, Prev: Starting, Up: Running
  1780. 4.3 Your Program's Arguments
  1781. ============================
  1782. The arguments to your program can be specified by the arguments of the
  1783. 'run' command. They are passed to a shell, which expands wildcard
  1784. characters and performs redirection of I/O, and thence to your program.
  1785. Your 'SHELL' environment variable (if it exists) specifies what shell
  1786. GDB uses. If you do not define 'SHELL', GDB uses the default shell
  1787. ('/bin/sh' on Unix).
  1788. On non-Unix systems, the program is usually invoked directly by GDB,
  1789. which emulates I/O redirection via the appropriate system calls, and the
  1790. wildcard characters are expanded by the startup code of the program, not
  1791. by the shell.
  1792. 'run' with no arguments uses the same arguments used by the previous
  1793. 'run', or those set by the 'set args' command.
  1794. 'set args'
  1795. Specify the arguments to be used the next time your program is run.
  1796. If 'set args' has no arguments, 'run' executes your program with no
  1797. arguments. Once you have run your program with arguments, using
  1798. 'set args' before the next 'run' is the only way to run it again
  1799. without arguments.
  1800. 'show args'
  1801. Show the arguments to give your program when it is started.
  1802. 
  1803. File: gdb.info, Node: Environment, Next: Working Directory, Prev: Arguments, Up: Running
  1804. 4.4 Your Program's Environment
  1805. ==============================
  1806. The "environment" consists of a set of environment variables and their
  1807. values. Environment variables conventionally record such things as your
  1808. user name, your home directory, your terminal type, and your search path
  1809. for programs to run. Usually you set up environment variables with the
  1810. shell and they are inherited by all the other programs you run. When
  1811. debugging, it can be useful to try running your program with a modified
  1812. environment without having to start GDB over again.
  1813. 'path DIRECTORY'
  1814. Add DIRECTORY to the front of the 'PATH' environment variable (the
  1815. search path for executables) that will be passed to your program.
  1816. The value of 'PATH' used by GDB does not change. You may specify
  1817. several directory names, separated by whitespace or by a
  1818. system-dependent separator character (':' on Unix, ';' on MS-DOS
  1819. and MS-Windows). If DIRECTORY is already in the path, it is moved
  1820. to the front, so it is searched sooner.
  1821. You can use the string '$cwd' to refer to whatever is the current
  1822. working directory at the time GDB searches the path. If you use
  1823. '.' instead, it refers to the directory where you executed the
  1824. 'path' command. GDB replaces '.' in the DIRECTORY argument (with
  1825. the current path) before adding DIRECTORY to the search path.
  1826. 'show paths'
  1827. Display the list of search paths for executables (the 'PATH'
  1828. environment variable).
  1829. 'show environment [VARNAME]'
  1830. Print the value of environment variable VARNAME to be given to your
  1831. program when it starts. If you do not supply VARNAME, print the
  1832. names and values of all environment variables to be given to your
  1833. program. You can abbreviate 'environment' as 'env'.
  1834. 'set environment VARNAME [=VALUE]'
  1835. Set environment variable VARNAME to VALUE. The value changes for
  1836. your program (and the shell GDB uses to launch it), not for GDB
  1837. itself. The VALUE may be any string; the values of environment
  1838. variables are just strings, and any interpretation is supplied by
  1839. your program itself. The VALUE parameter is optional; if it is
  1840. eliminated, the variable is set to a null value.
  1841. For example, this command:
  1842. set env USER = foo
  1843. tells the debugged program, when subsequently run, that its user is
  1844. named 'foo'. (The spaces around '=' are used for clarity here;
  1845. they are not actually required.)
  1846. Note that on Unix systems, GDB runs your program via a shell, which
  1847. also inherits the environment set with 'set environment'. If
  1848. necessary, you can avoid that by using the 'env' program as a
  1849. wrapper instead of using 'set environment'. *Note set
  1850. exec-wrapper::, for an example doing just that.
  1851. Environment variables that are set by the user are also transmitted
  1852. to 'gdbserver' to be used when starting the remote inferior. *note
  1853. QEnvironmentHexEncoded::.
  1854. 'unset environment VARNAME'
  1855. Remove variable VARNAME from the environment to be passed to your
  1856. program. This is different from 'set env VARNAME ='; 'unset
  1857. environment' removes the variable from the environment, rather than
  1858. assigning it an empty value.
  1859. Environment variables that are unset by the user are also unset on
  1860. 'gdbserver' when starting the remote inferior. *note
  1861. QEnvironmentUnset::.
  1862. _Warning:_ On Unix systems, GDB runs your program using the shell
  1863. indicated by your 'SHELL' environment variable if it exists (or
  1864. '/bin/sh' if not). If your 'SHELL' variable names a shell that runs an
  1865. initialization file when started non-interactively--such as '.cshrc' for
  1866. C-shell, $'.zshenv' for the Z shell, or the file specified in the
  1867. 'BASH_ENV' environment variable for BASH--any variables you set in that
  1868. file affect your program. You may wish to move setting of environment
  1869. variables to files that are only run when you sign on, such as '.login'
  1870. or '.profile'.
  1871. 
  1872. File: gdb.info, Node: Working Directory, Next: Input/Output, Prev: Environment, Up: Running
  1873. 4.5 Your Program's Working Directory
  1874. ====================================
  1875. Each time you start your program with 'run', the inferior will be
  1876. initialized with the current working directory specified by the 'set
  1877. cwd' command. If no directory has been specified by this command, then
  1878. the inferior will inherit GDB's current working directory as its working
  1879. directory if native debugging, or it will inherit the remote server's
  1880. current working directory if remote debugging.
  1881. 'set cwd [DIRECTORY]'
  1882. Set the inferior's working directory to DIRECTORY, which will be
  1883. 'glob'-expanded in order to resolve tildes ('~'). If no argument
  1884. has been specified, the command clears the setting and resets it to
  1885. an empty state. This setting has no effect on GDB's working
  1886. directory, and it only takes effect the next time you start the
  1887. inferior. The '~' in DIRECTORY is a short for the "home
  1888. directory", usually pointed to by the 'HOME' environment variable.
  1889. On MS-Windows, if 'HOME' is not defined, GDB uses the concatenation
  1890. of 'HOMEDRIVE' and 'HOMEPATH' as fallback.
  1891. You can also change GDB's current working directory by using the
  1892. 'cd' command. *Note cd command::.
  1893. 'show cwd'
  1894. Show the inferior's working directory. If no directory has been
  1895. specified by 'set cwd', then the default inferior's working
  1896. directory is the same as GDB's working directory.
  1897. 'cd [DIRECTORY]'
  1898. Set the GDB working directory to DIRECTORY. If not given,
  1899. DIRECTORY uses ''~''.
  1900. The GDB working directory serves as a default for the commands that
  1901. specify files for GDB to operate on. *Note Commands to Specify
  1902. Files: Files. *Note set cwd command::.
  1903. 'pwd'
  1904. Print the GDB working directory.
  1905. It is generally impossible to find the current working directory of
  1906. the process being debugged (since a program can change its directory
  1907. during its run). If you work on a system where GDB supports the 'info
  1908. proc' command (*note Process Information::), you can use the 'info proc'
  1909. command to find out the current working directory of the debuggee.
  1910. 
  1911. File: gdb.info, Node: Input/Output, Next: Attach, Prev: Working Directory, Up: Running
  1912. 4.6 Your Program's Input and Output
  1913. ===================================
  1914. By default, the program you run under GDB does input and output to the
  1915. same terminal that GDB uses. GDB switches the terminal to its own
  1916. terminal modes to interact with you, but it records the terminal modes
  1917. your program was using and switches back to them when you continue
  1918. running your program.
  1919. 'info terminal'
  1920. Displays information recorded by GDB about the terminal modes your
  1921. program is using.
  1922. You can redirect your program's input and/or output using shell
  1923. redirection with the 'run' command. For example,
  1924. run > outfile
  1925. starts your program, diverting its output to the file 'outfile'.
  1926. Another way to specify where your program should do input and output
  1927. is with the 'tty' command. This command accepts a file name as
  1928. argument, and causes this file to be the default for future 'run'
  1929. commands. It also resets the controlling terminal for the child
  1930. process, for future 'run' commands. For example,
  1931. tty /dev/ttyb
  1932. directs that processes started with subsequent 'run' commands default to
  1933. do input and output on the terminal '/dev/ttyb' and have that as their
  1934. controlling terminal.
  1935. An explicit redirection in 'run' overrides the 'tty' command's effect
  1936. on the input/output device, but not its effect on the controlling
  1937. terminal.
  1938. When you use the 'tty' command or redirect input in the 'run'
  1939. command, only the input _for your program_ is affected. The input for
  1940. GDB still comes from your terminal. 'tty' is an alias for 'set
  1941. inferior-tty'.
  1942. You can use the 'show inferior-tty' command to tell GDB to display
  1943. the name of the terminal that will be used for future runs of your
  1944. program.
  1945. 'set inferior-tty [ TTY ]'
  1946. Set the tty for the program being debugged to TTY. Omitting TTY
  1947. restores the default behavior, which is to use the same terminal as
  1948. GDB.
  1949. 'show inferior-tty'
  1950. Show the current tty for the program being debugged.
  1951. 
  1952. File: gdb.info, Node: Attach, Next: Kill Process, Prev: Input/Output, Up: Running
  1953. 4.7 Debugging an Already-running Process
  1954. ========================================
  1955. 'attach PROCESS-ID'
  1956. This command attaches to a running process--one that was started
  1957. outside GDB. ('info files' shows your active targets.) The
  1958. command takes as argument a process ID. The usual way to find out
  1959. the PROCESS-ID of a Unix process is with the 'ps' utility, or with
  1960. the 'jobs -l' shell command.
  1961. 'attach' does not repeat if you press <RET> a second time after
  1962. executing the command.
  1963. To use 'attach', your program must be running in an environment which
  1964. supports processes; for example, 'attach' does not work for programs on
  1965. bare-board targets that lack an operating system. You must also have
  1966. permission to send the process a signal.
  1967. When you use 'attach', the debugger finds the program running in the
  1968. process first by looking in the current working directory, then (if the
  1969. program is not found) by using the source file search path (*note
  1970. Specifying Source Directories: Source Path.). You can also use the
  1971. 'file' command to load the program. *Note Commands to Specify Files:
  1972. Files.
  1973. If the debugger can determine that the executable file running in the
  1974. process it is attaching to does not match the current exec-file loaded
  1975. by GDB, the option 'exec-file-mismatch' specifies how to handle the
  1976. mismatch. GDB tries to compare the files by comparing their build IDs
  1977. (*note build ID::), if available.
  1978. 'set exec-file-mismatch 'ask|warn|off''
  1979. Whether to detect mismatch between the current executable file
  1980. loaded by GDB and the executable file used to start the process.
  1981. If 'ask', the default, display a warning and ask the user whether
  1982. to load the process executable file; if 'warn', just display a
  1983. warning; if 'off', don't attempt to detect a mismatch. If the user
  1984. confirms loading the process executable file, then its symbols will
  1985. be loaded as well.
  1986. 'show exec-file-mismatch'
  1987. Show the current value of 'exec-file-mismatch'.
  1988. The first thing GDB does after arranging to debug the specified
  1989. process is to stop it. You can examine and modify an attached process
  1990. with all the GDB commands that are ordinarily available when you start
  1991. processes with 'run'. You can insert breakpoints; you can step and
  1992. continue; you can modify storage. If you would rather the process
  1993. continue running, you may use the 'continue' command after attaching GDB
  1994. to the process.
  1995. 'detach'
  1996. When you have finished debugging the attached process, you can use
  1997. the 'detach' command to release it from GDB control. Detaching the
  1998. process continues its execution. After the 'detach' command, that
  1999. process and GDB become completely independent once more, and you
  2000. are ready to 'attach' another process or start one with 'run'.
  2001. 'detach' does not repeat if you press <RET> again after executing
  2002. the command.
  2003. If you exit GDB while you have an attached process, you detach that
  2004. process. If you use the 'run' command, you kill that process. By
  2005. default, GDB asks for confirmation if you try to do either of these
  2006. things; you can control whether or not you need to confirm by using the
  2007. 'set confirm' command (*note Optional Warnings and Messages:
  2008. Messages/Warnings.).
  2009. 
  2010. File: gdb.info, Node: Kill Process, Next: Inferiors Connections and Programs, Prev: Attach, Up: Running
  2011. 4.8 Killing the Child Process
  2012. =============================
  2013. 'kill'
  2014. Kill the child process in which your program is running under GDB.
  2015. This command is useful if you wish to debug a core dump instead of a
  2016. running process. GDB ignores any core dump file while your program is
  2017. running.
  2018. On some operating systems, a program cannot be executed outside GDB
  2019. while you have breakpoints set on it inside GDB. You can use the 'kill'
  2020. command in this situation to permit running your program outside the
  2021. debugger.
  2022. The 'kill' command is also useful if you wish to recompile and relink
  2023. your program, since on many systems it is impossible to modify an
  2024. executable file while it is running in a process. In this case, when
  2025. you next type 'run', GDB notices that the file has changed, and reads
  2026. the symbol table again (while trying to preserve your current breakpoint
  2027. settings).
  2028. 
  2029. File: gdb.info, Node: Inferiors Connections and Programs, Next: Threads, Prev: Kill Process, Up: Running
  2030. 4.9 Debugging Multiple Inferiors Connections and Programs
  2031. =========================================================
  2032. GDB lets you run and debug multiple programs in a single session. In
  2033. addition, GDB on some systems may let you run several programs
  2034. simultaneously (otherwise you have to exit from one before starting
  2035. another). On some systems GDB may even let you debug several programs
  2036. simultaneously on different remote systems. In the most general case,
  2037. you can have multiple threads of execution in each of multiple
  2038. processes, launched from multiple executables, running on different
  2039. machines.
  2040. GDB represents the state of each program execution with an object
  2041. called an "inferior". An inferior typically corresponds to a process,
  2042. but is more general and applies also to targets that do not have
  2043. processes. Inferiors may be created before a process runs, and may be
  2044. retained after a process exits. Inferiors have unique identifiers that
  2045. are different from process ids. Usually each inferior will also have
  2046. its own distinct address space, although some embedded targets may have
  2047. several inferiors running in different parts of a single address space.
  2048. Each inferior may in turn have multiple threads running in it.
  2049. To find out what inferiors exist at any moment, use 'info inferiors':
  2050. 'info inferiors'
  2051. Print a list of all inferiors currently being managed by GDB. By
  2052. default all inferiors are printed, but the argument ID... - a space
  2053. separated list of inferior numbers - can be used to limit the
  2054. display to just the requested inferiors.
  2055. GDB displays for each inferior (in this order):
  2056. 1. the inferior number assigned by GDB
  2057. 2. the target system's inferior identifier
  2058. 3. the target connection the inferior is bound to, including the
  2059. unique connection number assigned by GDB, and the protocol
  2060. used by the connection.
  2061. 4. the name of the executable the inferior is running.
  2062. An asterisk '*' preceding the GDB inferior number indicates the
  2063. current inferior.
  2064. For example,
  2065. (gdb) info inferiors
  2066. Num Description Connection Executable
  2067. * 1 process 3401 1 (native) goodbye
  2068. 2 process 2307 2 (extended-remote host:10000) hello
  2069. To find out what open target connections exist at any moment, use
  2070. 'info connections':
  2071. 'info connections'
  2072. Print a list of all open target connections currently being managed
  2073. by GDB. By default all connections are printed, but the argument
  2074. ID... - a space separated list of connections numbers - can be used
  2075. to limit the display to just the requested connections.
  2076. GDB displays for each connection (in this order):
  2077. 1. the connection number assigned by GDB.
  2078. 2. the protocol used by the connection.
  2079. 3. a textual description of the protocol used by the connection.
  2080. An asterisk '*' preceding the connection number indicates the
  2081. connection of the current inferior.
  2082. For example,
  2083. (gdb) info connections
  2084. Num What Description
  2085. * 1 extended-remote host:10000 Extended remote serial target in gdb-specific protocol
  2086. 2 native Native process
  2087. 3 core Local core dump file
  2088. To switch focus between inferiors, use the 'inferior' command:
  2089. 'inferior INFNO'
  2090. Make inferior number INFNO the current inferior. The argument
  2091. INFNO is the inferior number assigned by GDB, as shown in the first
  2092. field of the 'info inferiors' display.
  2093. The debugger convenience variable '$_inferior' contains the number of
  2094. the current inferior. You may find this useful in writing breakpoint
  2095. conditional expressions, command scripts, and so forth. *Note
  2096. Convenience Variables: Convenience Vars, for general information on
  2097. convenience variables.
  2098. You can get multiple executables into a debugging session via the
  2099. 'add-inferior' and 'clone-inferior' commands. On some systems GDB can
  2100. add inferiors to the debug session automatically by following calls to
  2101. 'fork' and 'exec'. To remove inferiors from the debugging session use
  2102. the 'remove-inferiors' command.
  2103. 'add-inferior [ -copies N ] [ -exec EXECUTABLE ] [-no-connection ]'
  2104. Adds N inferiors to be run using EXECUTABLE as the executable; N
  2105. defaults to 1. If no executable is specified, the inferiors begins
  2106. empty, with no program. You can still assign or change the program
  2107. assigned to the inferior at any time by using the 'file' command
  2108. with the executable name as its argument.
  2109. By default, the new inferior begins connected to the same target
  2110. connection as the current inferior. For example, if the current
  2111. inferior was connected to 'gdbserver' with 'target remote', then
  2112. the new inferior will be connected to the same 'gdbserver'
  2113. instance. The '-no-connection' option starts the new inferior with
  2114. no connection yet. You can then for example use the 'target
  2115. remote' command to connect to some other 'gdbserver' instance, use
  2116. 'run' to spawn a local program, etc.
  2117. 'clone-inferior [ -copies N ] [ INFNO ]'
  2118. Adds N inferiors ready to execute the same program as inferior
  2119. INFNO; N defaults to 1, and INFNO defaults to the number of the
  2120. current inferior. This is a convenient command when you want to
  2121. run another instance of the inferior you are debugging.
  2122. (gdb) info inferiors
  2123. Num Description Connection Executable
  2124. * 1 process 29964 1 (native) helloworld
  2125. (gdb) clone-inferior
  2126. Added inferior 2.
  2127. 1 inferiors added.
  2128. (gdb) info inferiors
  2129. Num Description Connection Executable
  2130. * 1 process 29964 1 (native) helloworld
  2131. 2 <null> 1 (native) helloworld
  2132. You can now simply switch focus to inferior 2 and run it.
  2133. 'remove-inferiors INFNO...'
  2134. Removes the inferior or inferiors INFNO.... It is not possible to
  2135. remove an inferior that is running with this command. For those,
  2136. use the 'kill' or 'detach' command first.
  2137. To quit debugging one of the running inferiors that is not the
  2138. current inferior, you can either detach from it by using the
  2139. 'detach inferior' command (allowing it to run independently), or kill it
  2140. using the 'kill inferiors' command:
  2141. 'detach inferior INFNO...'
  2142. Detach from the inferior or inferiors identified by GDB inferior
  2143. number(s) INFNO.... Note that the inferior's entry still stays on
  2144. the list of inferiors shown by 'info inferiors', but its
  2145. Description will show '<null>'.
  2146. 'kill inferiors INFNO...'
  2147. Kill the inferior or inferiors identified by GDB inferior number(s)
  2148. INFNO.... Note that the inferior's entry still stays on the list
  2149. of inferiors shown by 'info inferiors', but its Description will
  2150. show '<null>'.
  2151. After the successful completion of a command such as 'detach',
  2152. 'detach inferiors', 'kill' or 'kill inferiors', or after a normal
  2153. process exit, the inferior is still valid and listed with 'info
  2154. inferiors', ready to be restarted.
  2155. To be notified when inferiors are started or exit under GDB's control
  2156. use 'set print inferior-events':
  2157. 'set print inferior-events'
  2158. 'set print inferior-events on'
  2159. 'set print inferior-events off'
  2160. The 'set print inferior-events' command allows you to enable or
  2161. disable printing of messages when GDB notices that new inferiors
  2162. have started or that inferiors have exited or have been detached.
  2163. By default, these messages will not be printed.
  2164. 'show print inferior-events'
  2165. Show whether messages will be printed when GDB detects that
  2166. inferiors have started, exited or have been detached.
  2167. Many commands will work the same with multiple programs as with a
  2168. single program: e.g., 'print myglobal' will simply display the value of
  2169. 'myglobal' in the current inferior.
  2170. Occasionally, when debugging GDB itself, it may be useful to get more
  2171. info about the relationship of inferiors, programs, address spaces in a
  2172. debug session. You can do that with the 'maint info program-spaces'
  2173. command.
  2174. 'maint info program-spaces'
  2175. Print a list of all program spaces currently being managed by GDB.
  2176. GDB displays for each program space (in this order):
  2177. 1. the program space number assigned by GDB
  2178. 2. the name of the executable loaded into the program space, with
  2179. e.g., the 'file' command.
  2180. An asterisk '*' preceding the GDB program space number indicates
  2181. the current program space.
  2182. In addition, below each program space line, GDB prints extra
  2183. information that isn't suitable to display in tabular form. For
  2184. example, the list of inferiors bound to the program space.
  2185. (gdb) maint info program-spaces
  2186. Id Executable
  2187. * 1 hello
  2188. 2 goodbye
  2189. Bound inferiors: ID 1 (process 21561)
  2190. Here we can see that no inferior is running the program 'hello',
  2191. while 'process 21561' is running the program 'goodbye'. On some
  2192. targets, it is possible that multiple inferiors are bound to the
  2193. same program space. The most common example is that of debugging
  2194. both the parent and child processes of a 'vfork' call. For
  2195. example,
  2196. (gdb) maint info program-spaces
  2197. Id Executable
  2198. * 1 vfork-test
  2199. Bound inferiors: ID 2 (process 18050), ID 1 (process 18045)
  2200. Here, both inferior 2 and inferior 1 are running in the same
  2201. program space as a result of inferior 1 having executed a 'vfork'
  2202. call.
  2203. 
  2204. File: gdb.info, Node: Threads, Next: Forks, Prev: Inferiors Connections and Programs, Up: Running
  2205. 4.10 Debugging Programs with Multiple Threads
  2206. =============================================
  2207. In some operating systems, such as GNU/Linux and Solaris, a single
  2208. program may have more than one "thread" of execution. The precise
  2209. semantics of threads differ from one operating system to another, but in
  2210. general the threads of a single program are akin to multiple
  2211. processes--except that they share one address space (that is, they can
  2212. all examine and modify the same variables). On the other hand, each
  2213. thread has its own registers and execution stack, and perhaps private
  2214. memory.
  2215. GDB provides these facilities for debugging multi-thread programs:
  2216. * automatic notification of new threads
  2217. * 'thread THREAD-ID', a command to switch among threads
  2218. * 'info threads', a command to inquire about existing threads
  2219. * 'thread apply [THREAD-ID-LIST | all] ARGS', a command to apply a
  2220. command to a list of threads
  2221. * thread-specific breakpoints
  2222. * 'set print thread-events', which controls printing of messages on
  2223. thread start and exit.
  2224. * 'set libthread-db-search-path PATH', which lets the user specify
  2225. which 'libthread_db' to use if the default choice isn't compatible
  2226. with the program.
  2227. The GDB thread debugging facility allows you to observe all threads
  2228. while your program runs--but whenever GDB takes control, one thread in
  2229. particular is always the focus of debugging. This thread is called the
  2230. "current thread". Debugging commands show program information from the
  2231. perspective of the current thread.
  2232. Whenever GDB detects a new thread in your program, it displays the
  2233. target system's identification for the thread with a message in the form
  2234. '[New SYSTAG]', where SYSTAG is a thread identifier whose form varies
  2235. depending on the particular system. For example, on GNU/Linux, you
  2236. might see
  2237. [New Thread 0x41e02940 (LWP 25582)]
  2238. when GDB notices a new thread. In contrast, on other systems, the
  2239. SYSTAG is simply something like 'process 368', with no further
  2240. qualifier.
  2241. For debugging purposes, GDB associates its own thread number --always
  2242. a single integer--with each thread of an inferior. This number is
  2243. unique between all threads of an inferior, but not unique between
  2244. threads of different inferiors.
  2245. You can refer to a given thread in an inferior using the qualified
  2246. INFERIOR-NUM.THREAD-NUM syntax, also known as "qualified thread ID",
  2247. with INFERIOR-NUM being the inferior number and THREAD-NUM being the
  2248. thread number of the given inferior. For example, thread '2.3' refers
  2249. to thread number 3 of inferior 2. If you omit INFERIOR-NUM (e.g.,
  2250. 'thread 3'), then GDB infers you're referring to a thread of the current
  2251. inferior.
  2252. Until you create a second inferior, GDB does not show the
  2253. INFERIOR-NUM part of thread IDs, even though you can always use the full
  2254. INFERIOR-NUM.THREAD-NUM form to refer to threads of inferior 1, the
  2255. initial inferior.
  2256. Some commands accept a space-separated "thread ID list" as argument.
  2257. A list element can be:
  2258. 1. A thread ID as shown in the first field of the 'info threads'
  2259. display, with or without an inferior qualifier. E.g., '2.1' or
  2260. '1'.
  2261. 2. A range of thread numbers, again with or without an inferior
  2262. qualifier, as in INF.THR1-THR2 or THR1-THR2. E.g., '1.2-4' or
  2263. '2-4'.
  2264. 3. All threads of an inferior, specified with a star wildcard, with or
  2265. without an inferior qualifier, as in INF.'*' (e.g., '1.*') or '*'.
  2266. The former refers to all threads of the given inferior, and the
  2267. latter form without an inferior qualifier refers to all threads of
  2268. the current inferior.
  2269. For example, if the current inferior is 1, and inferior 7 has one
  2270. thread with ID 7.1, the thread list '1 2-3 4.5 6.7-9 7.*' includes
  2271. threads 1 to 3 of inferior 1, thread 5 of inferior 4, threads 7 to 9 of
  2272. inferior 6 and all threads of inferior 7. That is, in expanded
  2273. qualified form, the same as '1.1 1.2 1.3 4.5 6.7 6.8 6.9 7.1'.
  2274. In addition to a _per-inferior_ number, each thread is also assigned
  2275. a unique _global_ number, also known as "global thread ID", a single
  2276. integer. Unlike the thread number component of the thread ID, no two
  2277. threads have the same global ID, even when you're debugging multiple
  2278. inferiors.
  2279. From GDB's perspective, a process always has at least one thread. In
  2280. other words, GDB assigns a thread number to the program's "main thread"
  2281. even if the program is not multi-threaded.
  2282. The debugger convenience variables '$_thread' and '$_gthread'
  2283. contain, respectively, the per-inferior thread number and the global
  2284. thread number of the current thread. You may find this useful in
  2285. writing breakpoint conditional expressions, command scripts, and so
  2286. forth. *Note Convenience Variables: Convenience Vars, for general
  2287. information on convenience variables.
  2288. If GDB detects the program is multi-threaded, it augments the usual
  2289. message about stopping at a breakpoint with the ID and name of the
  2290. thread that hit the breakpoint.
  2291. Thread 2 "client" hit Breakpoint 1, send_message () at client.c:68
  2292. Likewise when the program receives a signal:
  2293. Thread 1 "main" received signal SIGINT, Interrupt.
  2294. 'info threads [THREAD-ID-LIST]'
  2295. Display information about one or more threads. With no arguments
  2296. displays information about all threads. You can specify the list
  2297. of threads that you want to display using the thread ID list syntax
  2298. (*note thread ID lists::).
  2299. GDB displays for each thread (in this order):
  2300. 1. the per-inferior thread number assigned by GDB
  2301. 2. the global thread number assigned by GDB, if the '-gid' option
  2302. was specified
  2303. 3. the target system's thread identifier (SYSTAG)
  2304. 4. the thread's name, if one is known. A thread can either be
  2305. named by the user (see 'thread name', below), or, in some
  2306. cases, by the program itself.
  2307. 5. the current stack frame summary for that thread
  2308. An asterisk '*' to the left of the GDB thread number indicates the
  2309. current thread.
  2310. For example,
  2311. (gdb) info threads
  2312. Id Target Id Frame
  2313. * 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8)
  2314. 2 process 35 thread 23 0x34e5 in sigpause ()
  2315. 3 process 35 thread 27 0x34e5 in sigpause ()
  2316. at threadtest.c:68
  2317. If you're debugging multiple inferiors, GDB displays thread IDs using
  2318. the qualified INFERIOR-NUM.THREAD-NUM format. Otherwise, only
  2319. THREAD-NUM is shown.
  2320. If you specify the '-gid' option, GDB displays a column indicating
  2321. each thread's global thread ID:
  2322. (gdb) info threads
  2323. Id GId Target Id Frame
  2324. 1.1 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8)
  2325. 1.2 3 process 35 thread 23 0x34e5 in sigpause ()
  2326. 1.3 4 process 35 thread 27 0x34e5 in sigpause ()
  2327. * 2.1 2 process 65 thread 1 main (argc=1, argv=0x7ffffff8)
  2328. On Solaris, you can display more information about user threads with
  2329. a Solaris-specific command:
  2330. 'maint info sol-threads'
  2331. Display info on Solaris user threads.
  2332. 'thread THREAD-ID'
  2333. Make thread ID THREAD-ID the current thread. The command argument
  2334. THREAD-ID is the GDB thread ID, as shown in the first field of the
  2335. 'info threads' display, with or without an inferior qualifier
  2336. (e.g., '2.1' or '1').
  2337. GDB responds by displaying the system identifier of the thread you
  2338. selected, and its current stack frame summary:
  2339. (gdb) thread 2
  2340. [Switching to thread 2 (Thread 0xb7fdab70 (LWP 12747))]
  2341. #0 some_function (ignore=0x0) at example.c:8
  2342. 8 printf ("hello\n");
  2343. As with the '[New ...]' message, the form of the text after
  2344. 'Switching to' depends on your system's conventions for identifying
  2345. threads.
  2346. 'thread apply [THREAD-ID-LIST | all [-ascending]] [FLAG]... COMMAND'
  2347. The 'thread apply' command allows you to apply the named COMMAND to
  2348. one or more threads. Specify the threads that you want affected
  2349. using the thread ID list syntax (*note thread ID lists::), or
  2350. specify 'all' to apply to all threads. To apply a command to all
  2351. threads in descending order, type 'thread apply all COMMAND'. To
  2352. apply a command to all threads in ascending order, type 'thread
  2353. apply all -ascending COMMAND'.
  2354. The FLAG arguments control what output to produce and how to handle
  2355. errors raised when applying COMMAND to a thread. FLAG must start
  2356. with a '-' directly followed by one letter in 'qcs'. If several
  2357. flags are provided, they must be given individually, such as '-c
  2358. -q'.
  2359. By default, GDB displays some thread information before the output
  2360. produced by COMMAND, and an error raised during the execution of a
  2361. COMMAND will abort 'thread apply'. The following flags can be used
  2362. to fine-tune this behavior:
  2363. '-c'
  2364. The flag '-c', which stands for 'continue', causes any errors
  2365. in COMMAND to be displayed, and the execution of 'thread
  2366. apply' then continues.
  2367. '-s'
  2368. The flag '-s', which stands for 'silent', causes any errors or
  2369. empty output produced by a COMMAND to be silently ignored.
  2370. That is, the execution continues, but the thread information
  2371. and errors are not printed.
  2372. '-q'
  2373. The flag '-q' ('quiet') disables printing the thread
  2374. information.
  2375. Flags '-c' and '-s' cannot be used together.
  2376. 'taas [OPTION]... COMMAND'
  2377. Shortcut for 'thread apply all -s [OPTION]... COMMAND'. Applies
  2378. COMMAND on all threads, ignoring errors and empty output.
  2379. The 'taas' command accepts the same options as the 'thread apply
  2380. all' command. *Note thread apply all::.
  2381. 'tfaas [OPTION]... COMMAND'
  2382. Shortcut for 'thread apply all -s -- frame apply all -s [OPTION]...
  2383. COMMAND'. Applies COMMAND on all frames of all threads, ignoring
  2384. errors and empty output. Note that the flag '-s' is specified
  2385. twice: The first '-s' ensures that 'thread apply' only shows the
  2386. thread information of the threads for which 'frame apply' produces
  2387. some output. The second '-s' is needed to ensure that 'frame
  2388. apply' shows the frame information of a frame only if the COMMAND
  2389. successfully produced some output.
  2390. It can for example be used to print a local variable or a function
  2391. argument without knowing the thread or frame where this variable or
  2392. argument is, using:
  2393. (gdb) tfaas p some_local_var_i_do_not_remember_where_it_is
  2394. The 'tfaas' command accepts the same options as the 'frame apply'
  2395. command. *Note frame apply: Frame Apply.
  2396. 'thread name [NAME]'
  2397. This command assigns a name to the current thread. If no argument
  2398. is given, any existing user-specified name is removed. The thread
  2399. name appears in the 'info threads' display.
  2400. On some systems, such as GNU/Linux, GDB is able to determine the
  2401. name of the thread as given by the OS. On these systems, a name
  2402. specified with 'thread name' will override the system-give name,
  2403. and removing the user-specified name will cause GDB to once again
  2404. display the system-specified name.
  2405. 'thread find [REGEXP]'
  2406. Search for and display thread ids whose name or SYSTAG matches the
  2407. supplied regular expression.
  2408. As well as being the complement to the 'thread name' command, this
  2409. command also allows you to identify a thread by its target SYSTAG.
  2410. For instance, on GNU/Linux, the target SYSTAG is the LWP id.
  2411. (GDB) thread find 26688
  2412. Thread 4 has target id 'Thread 0x41e02940 (LWP 26688)'
  2413. (GDB) info thread 4
  2414. Id Target Id Frame
  2415. 4 Thread 0x41e02940 (LWP 26688) 0x00000031ca6cd372 in select ()
  2416. 'set print thread-events'
  2417. 'set print thread-events on'
  2418. 'set print thread-events off'
  2419. The 'set print thread-events' command allows you to enable or
  2420. disable printing of messages when GDB notices that new threads have
  2421. started or that threads have exited. By default, these messages
  2422. will be printed if detection of these events is supported by the
  2423. target. Note that these messages cannot be disabled on all
  2424. targets.
  2425. 'show print thread-events'
  2426. Show whether messages will be printed when GDB detects that threads
  2427. have started and exited.
  2428. *Note Stopping and Starting Multi-thread Programs: Thread Stops, for
  2429. more information about how GDB behaves when you stop and start programs
  2430. with multiple threads.
  2431. *Note Setting Watchpoints: Set Watchpoints, for information about
  2432. watchpoints in programs with multiple threads.
  2433. 'set libthread-db-search-path [PATH]'
  2434. If this variable is set, PATH is a colon-separated list of
  2435. directories GDB will use to search for 'libthread_db'. If you omit
  2436. PATH, 'libthread-db-search-path' will be reset to its default value
  2437. ('$sdir:$pdir' on GNU/Linux and Solaris systems). Internally, the
  2438. default value comes from the 'LIBTHREAD_DB_SEARCH_PATH' macro.
  2439. On GNU/Linux and Solaris systems, GDB uses a "helper"
  2440. 'libthread_db' library to obtain information about threads in the
  2441. inferior process. GDB will use 'libthread-db-search-path' to find
  2442. 'libthread_db'. GDB also consults first if inferior specific
  2443. thread debugging library loading is enabled by 'set auto-load
  2444. libthread-db' (*note libthread_db.so.1 file::).
  2445. A special entry '$sdir' for 'libthread-db-search-path' refers to
  2446. the default system directories that are normally searched for
  2447. loading shared libraries. The '$sdir' entry is the only kind not
  2448. needing to be enabled by 'set auto-load libthread-db' (*note
  2449. libthread_db.so.1 file::).
  2450. A special entry '$pdir' for 'libthread-db-search-path' refers to
  2451. the directory from which 'libpthread' was loaded in the inferior
  2452. process.
  2453. For any 'libthread_db' library GDB finds in above directories, GDB
  2454. attempts to initialize it with the current inferior process. If
  2455. this initialization fails (which could happen because of a version
  2456. mismatch between 'libthread_db' and 'libpthread'), GDB will unload
  2457. 'libthread_db', and continue with the next directory. If none of
  2458. 'libthread_db' libraries initialize successfully, GDB will issue a
  2459. warning and thread debugging will be disabled.
  2460. Setting 'libthread-db-search-path' is currently implemented only on
  2461. some platforms.
  2462. 'show libthread-db-search-path'
  2463. Display current libthread_db search path.
  2464. 'set debug libthread-db'
  2465. 'show debug libthread-db'
  2466. Turns on or off display of 'libthread_db'-related events. Use '1'
  2467. to enable, '0' to disable.
  2468. 
  2469. File: gdb.info, Node: Forks, Next: Checkpoint/Restart, Prev: Threads, Up: Running
  2470. 4.11 Debugging Forks
  2471. ====================
  2472. On most systems, GDB has no special support for debugging programs which
  2473. create additional processes using the 'fork' function. When a program
  2474. forks, GDB will continue to debug the parent process and the child
  2475. process will run unimpeded. If you have set a breakpoint in any code
  2476. which the child then executes, the child will get a 'SIGTRAP' signal
  2477. which (unless it catches the signal) will cause it to terminate.
  2478. However, if you want to debug the child process there is a workaround
  2479. which isn't too painful. Put a call to 'sleep' in the code which the
  2480. child process executes after the fork. It may be useful to sleep only
  2481. if a certain environment variable is set, or a certain file exists, so
  2482. that the delay need not occur when you don't want to run GDB on the
  2483. child. While the child is sleeping, use the 'ps' program to get its
  2484. process ID. Then tell GDB (a new invocation of GDB if you are also
  2485. debugging the parent process) to attach to the child process (*note
  2486. Attach::). From that point on you can debug the child process just like
  2487. any other process which you attached to.
  2488. On some systems, GDB provides support for debugging programs that
  2489. create additional processes using the 'fork' or 'vfork' functions. On
  2490. GNU/Linux platforms, this feature is supported with kernel version
  2491. 2.5.46 and later.
  2492. The fork debugging commands are supported in native mode and when
  2493. connected to 'gdbserver' in either 'target remote' mode or 'target
  2494. extended-remote' mode.
  2495. By default, when a program forks, GDB will continue to debug the
  2496. parent process and the child process will run unimpeded.
  2497. If you want to follow the child process instead of the parent
  2498. process, use the command 'set follow-fork-mode'.
  2499. 'set follow-fork-mode MODE'
  2500. Set the debugger response to a program call of 'fork' or 'vfork'.
  2501. A call to 'fork' or 'vfork' creates a new process. The MODE
  2502. argument can be:
  2503. 'parent'
  2504. The original process is debugged after a fork. The child
  2505. process runs unimpeded. This is the default.
  2506. 'child'
  2507. The new process is debugged after a fork. The parent process
  2508. runs unimpeded.
  2509. 'show follow-fork-mode'
  2510. Display the current debugger response to a 'fork' or 'vfork' call.
  2511. On Linux, if you want to debug both the parent and child processes,
  2512. use the command 'set detach-on-fork'.
  2513. 'set detach-on-fork MODE'
  2514. Tells gdb whether to detach one of the processes after a fork, or
  2515. retain debugger control over them both.
  2516. 'on'
  2517. The child process (or parent process, depending on the value
  2518. of 'follow-fork-mode') will be detached and allowed to run
  2519. independently. This is the default.
  2520. 'off'
  2521. Both processes will be held under the control of GDB. One
  2522. process (child or parent, depending on the value of
  2523. 'follow-fork-mode') is debugged as usual, while the other is
  2524. held suspended.
  2525. 'show detach-on-fork'
  2526. Show whether detach-on-fork mode is on/off.
  2527. If you choose to set 'detach-on-fork' mode off, then GDB will retain
  2528. control of all forked processes (including nested forks). You can list
  2529. the forked processes under the control of GDB by using the
  2530. 'info inferiors' command, and switch from one fork to another by using
  2531. the 'inferior' command (*note Debugging Multiple Inferiors Connections
  2532. and Programs: Inferiors Connections and Programs.).
  2533. To quit debugging one of the forked processes, you can either detach
  2534. from it by using the 'detach inferiors' command (allowing it to run
  2535. independently), or kill it using the 'kill inferiors' command. *Note
  2536. Debugging Multiple Inferiors Connections and Programs: Inferiors
  2537. Connections and Programs.
  2538. If you ask to debug a child process and a 'vfork' is followed by an
  2539. 'exec', GDB executes the new target up to the first breakpoint in the
  2540. new target. If you have a breakpoint set on 'main' in your original
  2541. program, the breakpoint will also be set on the child process's 'main'.
  2542. On some systems, when a child process is spawned by 'vfork', you
  2543. cannot debug the child or parent until an 'exec' call completes.
  2544. If you issue a 'run' command to GDB after an 'exec' call executes,
  2545. the new target restarts. To restart the parent process, use the 'file'
  2546. command with the parent executable name as its argument. By default,
  2547. after an 'exec' call executes, GDB discards the symbols of the previous
  2548. executable image. You can change this behaviour with the
  2549. 'set follow-exec-mode' command.
  2550. 'set follow-exec-mode MODE'
  2551. Set debugger response to a program call of 'exec'. An 'exec' call
  2552. replaces the program image of a process.
  2553. 'follow-exec-mode' can be:
  2554. 'new'
  2555. GDB creates a new inferior and rebinds the process to this new
  2556. inferior. The program the process was running before the
  2557. 'exec' call can be restarted afterwards by restarting the
  2558. original inferior.
  2559. For example:
  2560. (gdb) info inferiors
  2561. (gdb) info inferior
  2562. Id Description Executable
  2563. * 1 <null> prog1
  2564. (gdb) run
  2565. process 12020 is executing new program: prog2
  2566. Program exited normally.
  2567. (gdb) info inferiors
  2568. Id Description Executable
  2569. 1 <null> prog1
  2570. * 2 <null> prog2
  2571. 'same'
  2572. GDB keeps the process bound to the same inferior. The new
  2573. executable image replaces the previous executable loaded in
  2574. the inferior. Restarting the inferior after the 'exec' call,
  2575. with e.g., the 'run' command, restarts the executable the
  2576. process was running after the 'exec' call. This is the
  2577. default mode.
  2578. For example:
  2579. (gdb) info inferiors
  2580. Id Description Executable
  2581. * 1 <null> prog1
  2582. (gdb) run
  2583. process 12020 is executing new program: prog2
  2584. Program exited normally.
  2585. (gdb) info inferiors
  2586. Id Description Executable
  2587. * 1 <null> prog2
  2588. 'follow-exec-mode' is supported in native mode and 'target
  2589. extended-remote' mode.
  2590. You can use the 'catch' command to make GDB stop whenever a 'fork',
  2591. 'vfork', or 'exec' call is made. *Note Setting Catchpoints: Set
  2592. Catchpoints.
  2593. 
  2594. File: gdb.info, Node: Checkpoint/Restart, Prev: Forks, Up: Running
  2595. 4.12 Setting a _Bookmark_ to Return to Later
  2596. ============================================
  2597. On certain operating systems(1), GDB is able to save a "snapshot" of a
  2598. program's state, called a "checkpoint", and come back to it later.
  2599. Returning to a checkpoint effectively undoes everything that has
  2600. happened in the program since the 'checkpoint' was saved. This includes
  2601. changes in memory, registers, and even (within some limits) system
  2602. state. Effectively, it is like going back in time to the moment when
  2603. the checkpoint was saved.
  2604. Thus, if you're stepping thru a program and you think you're getting
  2605. close to the point where things go wrong, you can save a checkpoint.
  2606. Then, if you accidentally go too far and miss the critical statement,
  2607. instead of having to restart your program from the beginning, you can
  2608. just go back to the checkpoint and start again from there.
  2609. This can be especially useful if it takes a lot of time or steps to
  2610. reach the point where you think the bug occurs.
  2611. To use the 'checkpoint'/'restart' method of debugging:
  2612. 'checkpoint'
  2613. Save a snapshot of the debugged program's current execution state.
  2614. The 'checkpoint' command takes no arguments, but each checkpoint is
  2615. assigned a small integer id, similar to a breakpoint id.
  2616. 'info checkpoints'
  2617. List the checkpoints that have been saved in the current debugging
  2618. session. For each checkpoint, the following information will be
  2619. listed:
  2620. 'Checkpoint ID'
  2621. 'Process ID'
  2622. 'Code Address'
  2623. 'Source line, or label'
  2624. 'restart CHECKPOINT-ID'
  2625. Restore the program state that was saved as checkpoint number
  2626. CHECKPOINT-ID. All program variables, registers, stack frames etc.
  2627. will be returned to the values that they had when the checkpoint
  2628. was saved. In essence, gdb will "wind back the clock" to the point
  2629. in time when the checkpoint was saved.
  2630. Note that breakpoints, GDB variables, command history etc. are not
  2631. affected by restoring a checkpoint. In general, a checkpoint only
  2632. restores things that reside in the program being debugged, not in
  2633. the debugger.
  2634. 'delete checkpoint CHECKPOINT-ID'
  2635. Delete the previously-saved checkpoint identified by CHECKPOINT-ID.
  2636. Returning to a previously saved checkpoint will restore the user
  2637. state of the program being debugged, plus a significant subset of the
  2638. system (OS) state, including file pointers. It won't "un-write" data
  2639. from a file, but it will rewind the file pointer to the previous
  2640. location, so that the previously written data can be overwritten. For
  2641. files opened in read mode, the pointer will also be restored so that the
  2642. previously read data can be read again.
  2643. Of course, characters that have been sent to a printer (or other
  2644. external device) cannot be "snatched back", and characters received from
  2645. eg. a serial device can be removed from internal program buffers, but
  2646. they cannot be "pushed back" into the serial pipeline, ready to be
  2647. received again. Similarly, the actual contents of files that have been
  2648. changed cannot be restored (at this time).
  2649. However, within those constraints, you actually can "rewind" your
  2650. program to a previously saved point in time, and begin debugging it
  2651. again -- and you can change the course of events so as to debug a
  2652. different execution path this time.
  2653. Finally, there is one bit of internal program state that will be
  2654. different when you return to a checkpoint -- the program's process id.
  2655. Each checkpoint will have a unique process id (or PID), and each will be
  2656. different from the program's original PID. If your program has saved a
  2657. local copy of its process id, this could potentially pose a problem.
  2658. 4.12.1 A Non-obvious Benefit of Using Checkpoints
  2659. -------------------------------------------------
  2660. On some systems such as GNU/Linux, address space randomization is
  2661. performed on new processes for security reasons. This makes it
  2662. difficult or impossible to set a breakpoint, or watchpoint, on an
  2663. absolute address if you have to restart the program, since the absolute
  2664. location of a symbol will change from one execution to the next.
  2665. A checkpoint, however, is an _identical_ copy of a process.
  2666. Therefore if you create a checkpoint at (eg.) the start of main, and
  2667. simply return to that checkpoint instead of restarting the process, you
  2668. can avoid the effects of address randomization and your symbols will all
  2669. stay in the same place.
  2670. ---------- Footnotes ----------
  2671. (1) Currently, only GNU/Linux.
  2672. 
  2673. File: gdb.info, Node: Stopping, Next: Reverse Execution, Prev: Running, Up: Top
  2674. 5 Stopping and Continuing
  2675. *************************
  2676. The principal purposes of using a debugger are so that you can stop your
  2677. program before it terminates; or so that, if your program runs into
  2678. trouble, you can investigate and find out why.
  2679. Inside GDB, your program may stop for any of several reasons, such as
  2680. a signal, a breakpoint, or reaching a new line after a GDB command such
  2681. as 'step'. You may then examine and change variables, set new
  2682. breakpoints or remove old ones, and then continue execution. Usually,
  2683. the messages shown by GDB provide ample explanation of the status of
  2684. your program--but you can also explicitly request this information at
  2685. any time.
  2686. 'info program'
  2687. Display information about the status of your program: whether it is
  2688. running or not, what process it is, and why it stopped.
  2689. * Menu:
  2690. * Breakpoints:: Breakpoints, watchpoints, and catchpoints
  2691. * Continuing and Stepping:: Resuming execution
  2692. * Skipping Over Functions and Files::
  2693. Skipping over functions and files
  2694. * Signals:: Signals
  2695. * Thread Stops:: Stopping and starting multi-thread programs
  2696. 
  2697. File: gdb.info, Node: Breakpoints, Next: Continuing and Stepping, Up: Stopping
  2698. 5.1 Breakpoints, Watchpoints, and Catchpoints
  2699. =============================================
  2700. A "breakpoint" makes your program stop whenever a certain point in the
  2701. program is reached. For each breakpoint, you can add conditions to
  2702. control in finer detail whether your program stops. You can set
  2703. breakpoints with the 'break' command and its variants (*note Setting
  2704. Breakpoints: Set Breaks.), to specify the place where your program
  2705. should stop by line number, function name or exact address in the
  2706. program.
  2707. On some systems, you can set breakpoints in shared libraries before
  2708. the executable is run.
  2709. A "watchpoint" is a special breakpoint that stops your program when
  2710. the value of an expression changes. The expression may be a value of a
  2711. variable, or it could involve values of one or more variables combined
  2712. by operators, such as 'a + b'. This is sometimes called "data
  2713. breakpoints". You must use a different command to set watchpoints
  2714. (*note Setting Watchpoints: Set Watchpoints.), but aside from that, you
  2715. can manage a watchpoint like any other breakpoint: you enable, disable,
  2716. and delete both breakpoints and watchpoints using the same commands.
  2717. You can arrange to have values from your program displayed
  2718. automatically whenever GDB stops at a breakpoint. *Note Automatic
  2719. Display: Auto Display.
  2720. A "catchpoint" is another special breakpoint that stops your program
  2721. when a certain kind of event occurs, such as the throwing of a C++
  2722. exception or the loading of a library. As with watchpoints, you use a
  2723. different command to set a catchpoint (*note Setting Catchpoints: Set
  2724. Catchpoints.), but aside from that, you can manage a catchpoint like any
  2725. other breakpoint. (To stop when your program receives a signal, use the
  2726. 'handle' command; see *note Signals: Signals.)
  2727. GDB assigns a number to each breakpoint, watchpoint, or catchpoint
  2728. when you create it; these numbers are successive integers starting with
  2729. one. In many of the commands for controlling various features of
  2730. breakpoints you use the breakpoint number to say which breakpoint you
  2731. want to change. Each breakpoint may be "enabled" or "disabled"; if
  2732. disabled, it has no effect on your program until you enable it again.
  2733. Some GDB commands accept a space-separated list of breakpoints on
  2734. which to operate. A list element can be either a single breakpoint
  2735. number, like '5', or a range of such numbers, like '5-7'. When a
  2736. breakpoint list is given to a command, all breakpoints in that list are
  2737. operated on.
  2738. * Menu:
  2739. * Set Breaks:: Setting breakpoints
  2740. * Set Watchpoints:: Setting watchpoints
  2741. * Set Catchpoints:: Setting catchpoints
  2742. * Delete Breaks:: Deleting breakpoints
  2743. * Disabling:: Disabling breakpoints
  2744. * Conditions:: Break conditions
  2745. * Break Commands:: Breakpoint command lists
  2746. * Dynamic Printf:: Dynamic printf
  2747. * Save Breakpoints:: How to save breakpoints in a file
  2748. * Static Probe Points:: Listing static probe points
  2749. * Error in Breakpoints:: "Cannot insert breakpoints"
  2750. * Breakpoint-related Warnings:: "Breakpoint address adjusted..."
  2751. 
  2752. File: gdb.info, Node: Set Breaks, Next: Set Watchpoints, Up: Breakpoints
  2753. 5.1.1 Setting Breakpoints
  2754. -------------------------
  2755. Breakpoints are set with the 'break' command (abbreviated 'b'). The
  2756. debugger convenience variable '$bpnum' records the number of the
  2757. breakpoint you've set most recently; see *note Convenience Variables:
  2758. Convenience Vars, for a discussion of what you can do with convenience
  2759. variables.
  2760. 'break LOCATION'
  2761. Set a breakpoint at the given LOCATION, which can specify a
  2762. function name, a line number, or an address of an instruction.
  2763. (*Note Specify Location::, for a list of all the possible ways to
  2764. specify a LOCATION.) The breakpoint will stop your program just
  2765. before it executes any of the code in the specified LOCATION.
  2766. When using source languages that permit overloading of symbols,
  2767. such as C++, a function name may refer to more than one possible
  2768. place to break. *Note Ambiguous Expressions: Ambiguous
  2769. Expressions, for a discussion of that situation.
  2770. It is also possible to insert a breakpoint that will stop the
  2771. program only if a specific thread (*note Thread-Specific
  2772. Breakpoints::) or a specific task (*note Ada Tasks::) hits that
  2773. breakpoint.
  2774. 'break'
  2775. When called without any arguments, 'break' sets a breakpoint at the
  2776. next instruction to be executed in the selected stack frame (*note
  2777. Examining the Stack: Stack.). In any selected frame but the
  2778. innermost, this makes your program stop as soon as control returns
  2779. to that frame. This is similar to the effect of a 'finish' command
  2780. in the frame inside the selected frame--except that 'finish' does
  2781. not leave an active breakpoint. If you use 'break' without an
  2782. argument in the innermost frame, GDB stops the next time it reaches
  2783. the current location; this may be useful inside loops.
  2784. GDB normally ignores breakpoints when it resumes execution, until
  2785. at least one instruction has been executed. If it did not do this,
  2786. you would be unable to proceed past a breakpoint without first
  2787. disabling the breakpoint. This rule applies whether or not the
  2788. breakpoint already existed when your program stopped.
  2789. 'break ... if COND'
  2790. Set a breakpoint with condition COND; evaluate the expression COND
  2791. each time the breakpoint is reached, and stop only if the value is
  2792. nonzero--that is, if COND evaluates as true. '...' stands for one
  2793. of the possible arguments described above (or no argument)
  2794. specifying where to break. *Note Break Conditions: Conditions, for
  2795. more information on breakpoint conditions.
  2796. 'tbreak ARGS'
  2797. Set a breakpoint enabled only for one stop. The ARGS are the same
  2798. as for the 'break' command, and the breakpoint is set in the same
  2799. way, but the breakpoint is automatically deleted after the first
  2800. time your program stops there. *Note Disabling Breakpoints:
  2801. Disabling.
  2802. 'hbreak ARGS'
  2803. Set a hardware-assisted breakpoint. The ARGS are the same as for
  2804. the 'break' command and the breakpoint is set in the same way, but
  2805. the breakpoint requires hardware support and some target hardware
  2806. may not have this support. The main purpose of this is EPROM/ROM
  2807. code debugging, so you can set a breakpoint at an instruction
  2808. without changing the instruction. This can be used with the new
  2809. trap-generation provided by SPARClite DSU and most x86-based
  2810. targets. These targets will generate traps when a program accesses
  2811. some data or instruction address that is assigned to the debug
  2812. registers. However the hardware breakpoint registers can take a
  2813. limited number of breakpoints. For example, on the DSU, only two
  2814. data breakpoints can be set at a time, and GDB will reject this
  2815. command if more than two are used. Delete or disable unused
  2816. hardware breakpoints before setting new ones (*note Disabling
  2817. Breakpoints: Disabling.). *Note Break Conditions: Conditions. For
  2818. remote targets, you can restrict the number of hardware breakpoints
  2819. GDB will use, see *note set remote hardware-breakpoint-limit::.
  2820. 'thbreak ARGS'
  2821. Set a hardware-assisted breakpoint enabled only for one stop. The
  2822. ARGS are the same as for the 'hbreak' command and the breakpoint is
  2823. set in the same way. However, like the 'tbreak' command, the
  2824. breakpoint is automatically deleted after the first time your
  2825. program stops there. Also, like the 'hbreak' command, the
  2826. breakpoint requires hardware support and some target hardware may
  2827. not have this support. *Note Disabling Breakpoints: Disabling.
  2828. See also *note Break Conditions: Conditions.
  2829. 'rbreak REGEX'
  2830. Set breakpoints on all functions matching the regular expression
  2831. REGEX. This command sets an unconditional breakpoint on all
  2832. matches, printing a list of all breakpoints it set. Once these
  2833. breakpoints are set, they are treated just like the breakpoints set
  2834. with the 'break' command. You can delete them, disable them, or
  2835. make them conditional the same way as any other breakpoint.
  2836. In programs using different languages, GDB chooses the syntax to
  2837. print the list of all breakpoints it sets according to the 'set
  2838. language' value: using 'set language auto' (see *note Set Language
  2839. Automatically: Automatically.) means to use the language of the
  2840. breakpoint's function, other values mean to use the manually
  2841. specified language (see *note Set Language Manually: Manually.).
  2842. The syntax of the regular expression is the standard one used with
  2843. tools like 'grep'. Note that this is different from the syntax
  2844. used by shells, so for instance 'foo*' matches all functions that
  2845. include an 'fo' followed by zero or more 'o's. There is an
  2846. implicit '.*' leading and trailing the regular expression you
  2847. supply, so to match only functions that begin with 'foo', use
  2848. '^foo'.
  2849. When debugging C++ programs, 'rbreak' is useful for setting
  2850. breakpoints on overloaded functions that are not members of any
  2851. special classes.
  2852. The 'rbreak' command can be used to set breakpoints in *all* the
  2853. functions in a program, like this:
  2854. (gdb) rbreak .
  2855. 'rbreak FILE:REGEX'
  2856. If 'rbreak' is called with a filename qualification, it limits the
  2857. search for functions matching the given regular expression to the
  2858. specified FILE. This can be used, for example, to set breakpoints
  2859. on every function in a given file:
  2860. (gdb) rbreak file.c:.
  2861. The colon separating the filename qualifier from the regex may
  2862. optionally be surrounded by spaces.
  2863. 'info breakpoints [LIST...]'
  2864. 'info break [LIST...]'
  2865. Print a table of all breakpoints, watchpoints, and catchpoints set
  2866. and not deleted. Optional argument N means print information only
  2867. about the specified breakpoint(s) (or watchpoint(s) or
  2868. catchpoint(s)). For each breakpoint, following columns are
  2869. printed:
  2870. _Breakpoint Numbers_
  2871. _Type_
  2872. Breakpoint, watchpoint, or catchpoint.
  2873. _Disposition_
  2874. Whether the breakpoint is marked to be disabled or deleted
  2875. when hit.
  2876. _Enabled or Disabled_
  2877. Enabled breakpoints are marked with 'y'. 'n' marks
  2878. breakpoints that are not enabled.
  2879. _Address_
  2880. Where the breakpoint is in your program, as a memory address.
  2881. For a pending breakpoint whose address is not yet known, this
  2882. field will contain '<PENDING>'. Such breakpoint won't fire
  2883. until a shared library that has the symbol or line referred by
  2884. breakpoint is loaded. See below for details. A breakpoint
  2885. with several locations will have '<MULTIPLE>' in this
  2886. field--see below for details.
  2887. _What_
  2888. Where the breakpoint is in the source for your program, as a
  2889. file and line number. For a pending breakpoint, the original
  2890. string passed to the breakpoint command will be listed as it
  2891. cannot be resolved until the appropriate shared library is
  2892. loaded in the future.
  2893. If a breakpoint is conditional, there are two evaluation modes:
  2894. "host" and "target". If mode is "host", breakpoint condition
  2895. evaluation is done by GDB on the host's side. If it is "target",
  2896. then the condition is evaluated by the target. The 'info break'
  2897. command shows the condition on the line following the affected
  2898. breakpoint, together with its condition evaluation mode in between
  2899. parentheses.
  2900. Breakpoint commands, if any, are listed after that. A pending
  2901. breakpoint is allowed to have a condition specified for it. The
  2902. condition is not parsed for validity until a shared library is
  2903. loaded that allows the pending breakpoint to resolve to a valid
  2904. location.
  2905. 'info break' with a breakpoint number N as argument lists only that
  2906. breakpoint. The convenience variable '$_' and the default
  2907. examining-address for the 'x' command are set to the address of the
  2908. last breakpoint listed (*note Examining Memory: Memory.).
  2909. 'info break' displays a count of the number of times the breakpoint
  2910. has been hit. This is especially useful in conjunction with the
  2911. 'ignore' command. You can ignore a large number of breakpoint
  2912. hits, look at the breakpoint info to see how many times the
  2913. breakpoint was hit, and then run again, ignoring one less than that
  2914. number. This will get you quickly to the last hit of that
  2915. breakpoint.
  2916. For a breakpoints with an enable count (xref) greater than 1, 'info
  2917. break' also displays that count.
  2918. GDB allows you to set any number of breakpoints at the same place in
  2919. your program. There is nothing silly or meaningless about this. When
  2920. the breakpoints are conditional, this is even useful (*note Break
  2921. Conditions: Conditions.).
  2922. It is possible that a breakpoint corresponds to several locations in
  2923. your program. Examples of this situation are:
  2924. * Multiple functions in the program may have the same name.
  2925. * For a C++ constructor, the GCC compiler generates several instances
  2926. of the function body, used in different cases.
  2927. * For a C++ template function, a given line in the function can
  2928. correspond to any number of instantiations.
  2929. * For an inlined function, a given source line can correspond to
  2930. several places where that function is inlined.
  2931. In all those cases, GDB will insert a breakpoint at all the relevant
  2932. locations.
  2933. A breakpoint with multiple locations is displayed in the breakpoint
  2934. table using several rows--one header row, followed by one row for each
  2935. breakpoint location. The header row has '<MULTIPLE>' in the address
  2936. column. The rows for individual locations contain the actual addresses
  2937. for locations, and show the functions to which those locations belong.
  2938. The number column for a location is of the form
  2939. BREAKPOINT-NUMBER.LOCATION-NUMBER.
  2940. For example:
  2941. Num Type Disp Enb Address What
  2942. 1 breakpoint keep y <MULTIPLE>
  2943. stop only if i==1
  2944. breakpoint already hit 1 time
  2945. 1.1 y 0x080486a2 in void foo<int>() at t.cc:8
  2946. 1.2 y 0x080486ca in void foo<double>() at t.cc:8
  2947. You cannot delete the individual locations from a breakpoint.
  2948. However, each location can be individually enabled or disabled by
  2949. passing BREAKPOINT-NUMBER.LOCATION-NUMBER as argument to the 'enable'
  2950. and 'disable' commands. It's also possible to 'enable' and 'disable' a
  2951. range of LOCATION-NUMBER locations using a BREAKPOINT-NUMBER and two
  2952. LOCATION-NUMBERs, in increasing order, separated by a hyphen, like
  2953. 'BREAKPOINT-NUMBER.LOCATION-NUMBER1-LOCATION-NUMBER2', in which case GDB
  2954. acts on all the locations in the range (inclusive). Disabling or
  2955. enabling the parent breakpoint (*note Disabling::) affects all of the
  2956. locations that belong to that breakpoint.
  2957. It's quite common to have a breakpoint inside a shared library.
  2958. Shared libraries can be loaded and unloaded explicitly, and possibly
  2959. repeatedly, as the program is executed. To support this use case, GDB
  2960. updates breakpoint locations whenever any shared library is loaded or
  2961. unloaded. Typically, you would set a breakpoint in a shared library at
  2962. the beginning of your debugging session, when the library is not loaded,
  2963. and when the symbols from the library are not available. When you try
  2964. to set breakpoint, GDB will ask you if you want to set a so called
  2965. "pending breakpoint"--breakpoint whose address is not yet resolved.
  2966. After the program is run, whenever a new shared library is loaded,
  2967. GDB reevaluates all the breakpoints. When a newly loaded shared library
  2968. contains the symbol or line referred to by some pending breakpoint, that
  2969. breakpoint is resolved and becomes an ordinary breakpoint. When a
  2970. library is unloaded, all breakpoints that refer to its symbols or source
  2971. lines become pending again.
  2972. This logic works for breakpoints with multiple locations, too. For
  2973. example, if you have a breakpoint in a C++ template function, and a
  2974. newly loaded shared library has an instantiation of that template, a new
  2975. location is added to the list of locations for the breakpoint.
  2976. Except for having unresolved address, pending breakpoints do not
  2977. differ from regular breakpoints. You can set conditions or commands,
  2978. enable and disable them and perform other breakpoint operations.
  2979. GDB provides some additional commands for controlling what happens
  2980. when the 'break' command cannot resolve breakpoint address specification
  2981. to an address:
  2982. 'set breakpoint pending auto'
  2983. This is the default behavior. When GDB cannot find the breakpoint
  2984. location, it queries you whether a pending breakpoint should be
  2985. created.
  2986. 'set breakpoint pending on'
  2987. This indicates that an unrecognized breakpoint location should
  2988. automatically result in a pending breakpoint being created.
  2989. 'set breakpoint pending off'
  2990. This indicates that pending breakpoints are not to be created. Any
  2991. unrecognized breakpoint location results in an error. This setting
  2992. does not affect any pending breakpoints previously created.
  2993. 'show breakpoint pending'
  2994. Show the current behavior setting for creating pending breakpoints.
  2995. The settings above only affect the 'break' command and its variants.
  2996. Once breakpoint is set, it will be automatically updated as shared
  2997. libraries are loaded and unloaded.
  2998. For some targets, GDB can automatically decide if hardware or
  2999. software breakpoints should be used, depending on whether the breakpoint
  3000. address is read-only or read-write. This applies to breakpoints set
  3001. with the 'break' command as well as to internal breakpoints set by
  3002. commands like 'next' and 'finish'. For breakpoints set with 'hbreak',
  3003. GDB will always use hardware breakpoints.
  3004. You can control this automatic behaviour with the following commands:
  3005. 'set breakpoint auto-hw on'
  3006. This is the default behavior. When GDB sets a breakpoint, it will
  3007. try to use the target memory map to decide if software or hardware
  3008. breakpoint must be used.
  3009. 'set breakpoint auto-hw off'
  3010. This indicates GDB should not automatically select breakpoint type.
  3011. If the target provides a memory map, GDB will warn when trying to
  3012. set software breakpoint at a read-only address.
  3013. GDB normally implements breakpoints by replacing the program code at
  3014. the breakpoint address with a special instruction, which, when executed,
  3015. given control to the debugger. By default, the program code is so
  3016. modified only when the program is resumed. As soon as the program
  3017. stops, GDB restores the original instructions. This behaviour guards
  3018. against leaving breakpoints inserted in the target should gdb abrubptly
  3019. disconnect. However, with slow remote targets, inserting and removing
  3020. breakpoint can reduce the performance. This behavior can be controlled
  3021. with the following commands::
  3022. 'set breakpoint always-inserted off'
  3023. All breakpoints, including newly added by the user, are inserted in
  3024. the target only when the target is resumed. All breakpoints are
  3025. removed from the target when it stops. This is the default mode.
  3026. 'set breakpoint always-inserted on'
  3027. Causes all breakpoints to be inserted in the target at all times.
  3028. If the user adds a new breakpoint, or changes an existing
  3029. breakpoint, the breakpoints in the target are updated immediately.
  3030. A breakpoint is removed from the target only when breakpoint itself
  3031. is deleted.
  3032. GDB handles conditional breakpoints by evaluating these conditions
  3033. when a breakpoint breaks. If the condition is true, then the process
  3034. being debugged stops, otherwise the process is resumed.
  3035. If the target supports evaluating conditions on its end, GDB may
  3036. download the breakpoint, together with its conditions, to it.
  3037. This feature can be controlled via the following commands:
  3038. 'set breakpoint condition-evaluation host'
  3039. This option commands GDB to evaluate the breakpoint conditions on
  3040. the host's side. Unconditional breakpoints are sent to the target
  3041. which in turn receives the triggers and reports them back to GDB
  3042. for condition evaluation. This is the standard evaluation mode.
  3043. 'set breakpoint condition-evaluation target'
  3044. This option commands GDB to download breakpoint conditions to the
  3045. target at the moment of their insertion. The target is responsible
  3046. for evaluating the conditional expression and reporting breakpoint
  3047. stop events back to GDB whenever the condition is true. Due to
  3048. limitations of target-side evaluation, some conditions cannot be
  3049. evaluated there, e.g., conditions that depend on local data that is
  3050. only known to the host. Examples include conditional expressions
  3051. involving convenience variables, complex types that cannot be
  3052. handled by the agent expression parser and expressions that are too
  3053. long to be sent over to the target, specially when the target is a
  3054. remote system. In these cases, the conditions will be evaluated by
  3055. GDB.
  3056. 'set breakpoint condition-evaluation auto'
  3057. This is the default mode. If the target supports evaluating
  3058. breakpoint conditions on its end, GDB will download breakpoint
  3059. conditions to the target (limitations mentioned previously apply).
  3060. If the target does not support breakpoint condition evaluation,
  3061. then GDB will fallback to evaluating all these conditions on the
  3062. host's side.
  3063. GDB itself sometimes sets breakpoints in your program for special
  3064. purposes, such as proper handling of 'longjmp' (in C programs). These
  3065. internal breakpoints are assigned negative numbers, starting with '-1';
  3066. 'info breakpoints' does not display them. You can see these breakpoints
  3067. with the GDB maintenance command 'maint info breakpoints' (*note maint
  3068. info breakpoints::).
  3069. 
  3070. File: gdb.info, Node: Set Watchpoints, Next: Set Catchpoints, Prev: Set Breaks, Up: Breakpoints
  3071. 5.1.2 Setting Watchpoints
  3072. -------------------------
  3073. You can use a watchpoint to stop execution whenever the value of an
  3074. expression changes, without having to predict a particular place where
  3075. this may happen. (This is sometimes called a "data breakpoint".) The
  3076. expression may be as simple as the value of a single variable, or as
  3077. complex as many variables combined by operators. Examples include:
  3078. * A reference to the value of a single variable.
  3079. * An address cast to an appropriate data type. For example, '*(int
  3080. *)0x12345678' will watch a 4-byte region at the specified address
  3081. (assuming an 'int' occupies 4 bytes).
  3082. * An arbitrarily complex expression, such as 'a*b + c/d'. The
  3083. expression can use any operators valid in the program's native
  3084. language (*note Languages::).
  3085. You can set a watchpoint on an expression even if the expression can
  3086. not be evaluated yet. For instance, you can set a watchpoint on
  3087. '*global_ptr' before 'global_ptr' is initialized. GDB will stop when
  3088. your program sets 'global_ptr' and the expression produces a valid
  3089. value. If the expression becomes valid in some other way than changing
  3090. a variable (e.g. if the memory pointed to by '*global_ptr' becomes
  3091. readable as the result of a 'malloc' call), GDB may not stop until the
  3092. next time the expression changes.
  3093. Depending on your system, watchpoints may be implemented in software
  3094. or hardware. GDB does software watchpointing by single-stepping your
  3095. program and testing the variable's value each time, which is hundreds of
  3096. times slower than normal execution. (But this may still be worth it, to
  3097. catch errors where you have no clue what part of your program is the
  3098. culprit.)
  3099. On some systems, such as most PowerPC or x86-based targets, GDB
  3100. includes support for hardware watchpoints, which do not slow down the
  3101. running of your program.
  3102. 'watch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  3103. Set a watchpoint for an expression. GDB will break when the
  3104. expression EXPR is written into by the program and its value
  3105. changes. The simplest (and the most popular) use of this command
  3106. is to watch the value of a single variable:
  3107. (gdb) watch foo
  3108. If the command includes a '[thread THREAD-ID]' argument, GDB breaks
  3109. only when the thread identified by THREAD-ID changes the value of
  3110. EXPR. If any other threads change the value of EXPR, GDB will not
  3111. break. Note that watchpoints restricted to a single thread in this
  3112. way only work with Hardware Watchpoints.
  3113. Ordinarily a watchpoint respects the scope of variables in EXPR
  3114. (see below). The '-location' argument tells GDB to instead watch
  3115. the memory referred to by EXPR. In this case, GDB will evaluate
  3116. EXPR, take the address of the result, and watch the memory at that
  3117. address. The type of the result is used to determine the size of
  3118. the watched memory. If the expression's result does not have an
  3119. address, then GDB will print an error.
  3120. The '[mask MASKVALUE]' argument allows creation of masked
  3121. watchpoints, if the current architecture supports this feature
  3122. (e.g., PowerPC Embedded architecture, see *note PowerPC
  3123. Embedded::.) A "masked watchpoint" specifies a mask in addition to
  3124. an address to watch. The mask specifies that some bits of an
  3125. address (the bits which are reset in the mask) should be ignored
  3126. when matching the address accessed by the inferior against the
  3127. watchpoint address. Thus, a masked watchpoint watches many
  3128. addresses simultaneously--those addresses whose unmasked bits are
  3129. identical to the unmasked bits in the watchpoint address. The
  3130. 'mask' argument implies '-location'. Examples:
  3131. (gdb) watch foo mask 0xffff00ff
  3132. (gdb) watch *0xdeadbeef mask 0xffffff00
  3133. 'rwatch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  3134. Set a watchpoint that will break when the value of EXPR is read by
  3135. the program.
  3136. 'awatch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  3137. Set a watchpoint that will break when EXPR is either read from or
  3138. written into by the program.
  3139. 'info watchpoints [LIST...]'
  3140. This command prints a list of watchpoints, using the same format as
  3141. 'info break' (*note Set Breaks::).
  3142. If you watch for a change in a numerically entered address you need
  3143. to dereference it, as the address itself is just a constant number which
  3144. will never change. GDB refuses to create a watchpoint that watches a
  3145. never-changing value:
  3146. (gdb) watch 0x600850
  3147. Cannot watch constant value 0x600850.
  3148. (gdb) watch *(int *) 0x600850
  3149. Watchpoint 1: *(int *) 6293584
  3150. GDB sets a "hardware watchpoint" if possible. Hardware watchpoints
  3151. execute very quickly, and the debugger reports a change in value at the
  3152. exact instruction where the change occurs. If GDB cannot set a hardware
  3153. watchpoint, it sets a software watchpoint, which executes more slowly
  3154. and reports the change in value at the next _statement_, not the
  3155. instruction, after the change occurs.
  3156. You can force GDB to use only software watchpoints with the 'set
  3157. can-use-hw-watchpoints 0' command. With this variable set to zero, GDB
  3158. will never try to use hardware watchpoints, even if the underlying
  3159. system supports them. (Note that hardware-assisted watchpoints that
  3160. were set _before_ setting 'can-use-hw-watchpoints' to zero will still
  3161. use the hardware mechanism of watching expression values.)
  3162. 'set can-use-hw-watchpoints'
  3163. Set whether or not to use hardware watchpoints.
  3164. 'show can-use-hw-watchpoints'
  3165. Show the current mode of using hardware watchpoints.
  3166. For remote targets, you can restrict the number of hardware
  3167. watchpoints GDB will use, see *note set remote
  3168. hardware-breakpoint-limit::.
  3169. When you issue the 'watch' command, GDB reports
  3170. Hardware watchpoint NUM: EXPR
  3171. if it was able to set a hardware watchpoint.
  3172. Currently, the 'awatch' and 'rwatch' commands can only set hardware
  3173. watchpoints, because accesses to data that don't change the value of the
  3174. watched expression cannot be detected without examining every
  3175. instruction as it is being executed, and GDB does not do that currently.
  3176. If GDB finds that it is unable to set a hardware breakpoint with the
  3177. 'awatch' or 'rwatch' command, it will print a message like this:
  3178. Expression cannot be implemented with read/access watchpoint.
  3179. Sometimes, GDB cannot set a hardware watchpoint because the data type
  3180. of the watched expression is wider than what a hardware watchpoint on
  3181. the target machine can handle. For example, some systems can only watch
  3182. regions that are up to 4 bytes wide; on such systems you cannot set
  3183. hardware watchpoints for an expression that yields a double-precision
  3184. floating-point number (which is typically 8 bytes wide). As a
  3185. work-around, it might be possible to break the large region into a
  3186. series of smaller ones and watch them with separate watchpoints.
  3187. If you set too many hardware watchpoints, GDB might be unable to
  3188. insert all of them when you resume the execution of your program. Since
  3189. the precise number of active watchpoints is unknown until such time as
  3190. the program is about to be resumed, GDB might not be able to warn you
  3191. about this when you set the watchpoints, and the warning will be printed
  3192. only when the program is resumed:
  3193. Hardware watchpoint NUM: Could not insert watchpoint
  3194. If this happens, delete or disable some of the watchpoints.
  3195. Watching complex expressions that reference many variables can also
  3196. exhaust the resources available for hardware-assisted watchpoints.
  3197. That's because GDB needs to watch every variable in the expression with
  3198. separately allocated resources.
  3199. If you call a function interactively using 'print' or 'call', any
  3200. watchpoints you have set will be inactive until GDB reaches another kind
  3201. of breakpoint or the call completes.
  3202. GDB automatically deletes watchpoints that watch local (automatic)
  3203. variables, or expressions that involve such variables, when they go out
  3204. of scope, that is, when the execution leaves the block in which these
  3205. variables were defined. In particular, when the program being debugged
  3206. terminates, _all_ local variables go out of scope, and so only
  3207. watchpoints that watch global variables remain set. If you rerun the
  3208. program, you will need to set all such watchpoints again. One way of
  3209. doing that would be to set a code breakpoint at the entry to the 'main'
  3210. function and when it breaks, set all the watchpoints.
  3211. In multi-threaded programs, watchpoints will detect changes to the
  3212. watched expression from every thread.
  3213. _Warning:_ In multi-threaded programs, software watchpoints have
  3214. only limited usefulness. If GDB creates a software watchpoint, it
  3215. can only watch the value of an expression _in a single thread_. If
  3216. you are confident that the expression can only change due to the
  3217. current thread's activity (and if you are also confident that no
  3218. other thread can become current), then you can use software
  3219. watchpoints as usual. However, GDB may not notice when a
  3220. non-current thread's activity changes the expression. (Hardware
  3221. watchpoints, in contrast, watch an expression in all threads.)
  3222. *Note set remote hardware-watchpoint-limit::.
  3223. 
  3224. File: gdb.info, Node: Set Catchpoints, Next: Delete Breaks, Prev: Set Watchpoints, Up: Breakpoints
  3225. 5.1.3 Setting Catchpoints
  3226. -------------------------
  3227. You can use "catchpoints" to cause the debugger to stop for certain
  3228. kinds of program events, such as C++ exceptions or the loading of a
  3229. shared library. Use the 'catch' command to set a catchpoint.
  3230. 'catch EVENT'
  3231. Stop when EVENT occurs. The EVENT can be any of the following:
  3232. 'throw [REGEXP]'
  3233. 'rethrow [REGEXP]'
  3234. 'catch [REGEXP]'
  3235. The throwing, re-throwing, or catching of a C++ exception.
  3236. If REGEXP is given, then only exceptions whose type matches
  3237. the regular expression will be caught.
  3238. The convenience variable '$_exception' is available at an
  3239. exception-related catchpoint, on some systems. This holds the
  3240. exception being thrown.
  3241. There are currently some limitations to C++ exception handling
  3242. in GDB:
  3243. * The support for these commands is system-dependent.
  3244. Currently, only systems using the 'gnu-v3' C++ ABI (*note
  3245. ABI::) are supported.
  3246. * The regular expression feature and the '$_exception'
  3247. convenience variable rely on the presence of some SDT
  3248. probes in 'libstdc++'. If these probes are not present,
  3249. then these features cannot be used. These probes were
  3250. first available in the GCC 4.8 release, but whether or
  3251. not they are available in your GCC also depends on how it
  3252. was built.
  3253. * The '$_exception' convenience variable is only valid at
  3254. the instruction at which an exception-related catchpoint
  3255. is set.
  3256. * When an exception-related catchpoint is hit, GDB stops at
  3257. a location in the system library which implements runtime
  3258. exception support for C++, usually 'libstdc++'. You can
  3259. use 'up' (*note Selection::) to get to your code.
  3260. * If you call a function interactively, GDB normally
  3261. returns control to you when the function has finished
  3262. executing. If the call raises an exception, however, the
  3263. call may bypass the mechanism that returns control to you
  3264. and cause your program either to abort or to simply
  3265. continue running until it hits a breakpoint, catches a
  3266. signal that GDB is listening for, or exits. This is the
  3267. case even if you set a catchpoint for the exception;
  3268. catchpoints on exceptions are disabled within interactive
  3269. calls. *Note Calling::, for information on controlling
  3270. this with 'set unwind-on-terminating-exception'.
  3271. * You cannot raise an exception interactively.
  3272. * You cannot install an exception handler interactively.
  3273. 'exception [NAME]'
  3274. An Ada exception being raised. If an exception name is
  3275. specified at the end of the command (eg 'catch exception
  3276. Program_Error'), the debugger will stop only when this
  3277. specific exception is raised. Otherwise, the debugger stops
  3278. execution when any Ada exception is raised.
  3279. When inserting an exception catchpoint on a user-defined
  3280. exception whose name is identical to one of the exceptions
  3281. defined by the language, the fully qualified name must be used
  3282. as the exception name. Otherwise, GDB will assume that it
  3283. should stop on the pre-defined exception rather than the
  3284. user-defined one. For instance, assuming an exception called
  3285. 'Constraint_Error' is defined in package 'Pck', then the
  3286. command to use to catch such exceptions is 'catch exception
  3287. Pck.Constraint_Error'.
  3288. The convenience variable '$_ada_exception' holds the address
  3289. of the exception being thrown. This can be useful when
  3290. setting a condition for such a catchpoint.
  3291. 'exception unhandled'
  3292. An exception that was raised but is not handled by the
  3293. program. The convenience variable '$_ada_exception' is set as
  3294. for 'catch exception'.
  3295. 'handlers [NAME]'
  3296. An Ada exception being handled. If an exception name is
  3297. specified at the end of the command (eg 'catch handlers
  3298. Program_Error'), the debugger will stop only when this
  3299. specific exception is handled. Otherwise, the debugger stops
  3300. execution when any Ada exception is handled.
  3301. When inserting a handlers catchpoint on a user-defined
  3302. exception whose name is identical to one of the exceptions
  3303. defined by the language, the fully qualified name must be used
  3304. as the exception name. Otherwise, GDB will assume that it
  3305. should stop on the pre-defined exception rather than the
  3306. user-defined one. For instance, assuming an exception called
  3307. 'Constraint_Error' is defined in package 'Pck', then the
  3308. command to use to catch such exceptions handling is 'catch
  3309. handlers Pck.Constraint_Error'.
  3310. The convenience variable '$_ada_exception' is set as for
  3311. 'catch exception'.
  3312. 'assert'
  3313. A failed Ada assertion. Note that the convenience variable
  3314. '$_ada_exception' is _not_ set by this catchpoint.
  3315. 'exec'
  3316. A call to 'exec'.
  3317. 'syscall'
  3318. 'syscall [NAME | NUMBER | group:GROUPNAME | g:GROUPNAME] ...'
  3319. A call to or return from a system call, a.k.a. "syscall". A
  3320. syscall is a mechanism for application programs to request a
  3321. service from the operating system (OS) or one of the OS system
  3322. services. GDB can catch some or all of the syscalls issued by
  3323. the debuggee, and show the related information for each
  3324. syscall. If no argument is specified, calls to and returns
  3325. from all system calls will be caught.
  3326. NAME can be any system call name that is valid for the
  3327. underlying OS. Just what syscalls are valid depends on the OS.
  3328. On GNU and Unix systems, you can find the full list of valid
  3329. syscall names on '/usr/include/asm/unistd.h'.
  3330. Normally, GDB knows in advance which syscalls are valid for
  3331. each OS, so you can use the GDB command-line completion
  3332. facilities (*note command completion: Completion.) to list the
  3333. available choices.
  3334. You may also specify the system call numerically. A syscall's
  3335. number is the value passed to the OS's syscall dispatcher to
  3336. identify the requested service. When you specify the syscall
  3337. by its name, GDB uses its database of syscalls to convert the
  3338. name into the corresponding numeric code, but using the number
  3339. directly may be useful if GDB's database does not have the
  3340. complete list of syscalls on your system (e.g., because GDB
  3341. lags behind the OS upgrades).
  3342. You may specify a group of related syscalls to be caught at
  3343. once using the 'group:' syntax ('g:' is a shorter equivalent).
  3344. For instance, on some platforms GDB allows you to catch all
  3345. network related syscalls, by passing the argument
  3346. 'group:network' to 'catch syscall'. Note that not all syscall
  3347. groups are available in every system. You can use the command
  3348. completion facilities (*note command completion: Completion.)
  3349. to list the syscall groups available on your environment.
  3350. The example below illustrates how this command works if you
  3351. don't provide arguments to it:
  3352. (gdb) catch syscall
  3353. Catchpoint 1 (syscall)
  3354. (gdb) r
  3355. Starting program: /tmp/catch-syscall
  3356. Catchpoint 1 (call to syscall 'close'), \
  3357. 0xffffe424 in __kernel_vsyscall ()
  3358. (gdb) c
  3359. Continuing.
  3360. Catchpoint 1 (returned from syscall 'close'), \
  3361. 0xffffe424 in __kernel_vsyscall ()
  3362. (gdb)
  3363. Here is an example of catching a system call by name:
  3364. (gdb) catch syscall chroot
  3365. Catchpoint 1 (syscall 'chroot' [61])
  3366. (gdb) r
  3367. Starting program: /tmp/catch-syscall
  3368. Catchpoint 1 (call to syscall 'chroot'), \
  3369. 0xffffe424 in __kernel_vsyscall ()
  3370. (gdb) c
  3371. Continuing.
  3372. Catchpoint 1 (returned from syscall 'chroot'), \
  3373. 0xffffe424 in __kernel_vsyscall ()
  3374. (gdb)
  3375. An example of specifying a system call numerically. In the
  3376. case below, the syscall number has a corresponding entry in
  3377. the XML file, so GDB finds its name and prints it:
  3378. (gdb) catch syscall 252
  3379. Catchpoint 1 (syscall(s) 'exit_group')
  3380. (gdb) r
  3381. Starting program: /tmp/catch-syscall
  3382. Catchpoint 1 (call to syscall 'exit_group'), \
  3383. 0xffffe424 in __kernel_vsyscall ()
  3384. (gdb) c
  3385. Continuing.
  3386. Program exited normally.
  3387. (gdb)
  3388. Here is an example of catching a syscall group:
  3389. (gdb) catch syscall group:process
  3390. Catchpoint 1 (syscalls 'exit' [1] 'fork' [2] 'waitpid' [7]
  3391. 'execve' [11] 'wait4' [114] 'clone' [120] 'vfork' [190]
  3392. 'exit_group' [252] 'waitid' [284] 'unshare' [310])
  3393. (gdb) r
  3394. Starting program: /tmp/catch-syscall
  3395. Catchpoint 1 (call to syscall fork), 0x00007ffff7df4e27 in open64 ()
  3396. from /lib64/ld-linux-x86-64.so.2
  3397. (gdb) c
  3398. Continuing.
  3399. However, there can be situations when there is no
  3400. corresponding name in XML file for that syscall number. In
  3401. this case, GDB prints a warning message saying that it was not
  3402. able to find the syscall name, but the catchpoint will be set
  3403. anyway. See the example below:
  3404. (gdb) catch syscall 764
  3405. warning: The number '764' does not represent a known syscall.
  3406. Catchpoint 2 (syscall 764)
  3407. (gdb)
  3408. If you configure GDB using the '--without-expat' option, it
  3409. will not be able to display syscall names. Also, if your
  3410. architecture does not have an XML file describing its system
  3411. calls, you will not be able to see the syscall names. It is
  3412. important to notice that these two features are used for
  3413. accessing the syscall name database. In either case, you will
  3414. see a warning like this:
  3415. (gdb) catch syscall
  3416. warning: Could not open "syscalls/i386-linux.xml"
  3417. warning: Could not load the syscall XML file 'syscalls/i386-linux.xml'.
  3418. GDB will not be able to display syscall names.
  3419. Catchpoint 1 (syscall)
  3420. (gdb)
  3421. Of course, the file name will change depending on your
  3422. architecture and system.
  3423. Still using the example above, you can also try to catch a
  3424. syscall by its number. In this case, you would see something
  3425. like:
  3426. (gdb) catch syscall 252
  3427. Catchpoint 1 (syscall(s) 252)
  3428. Again, in this case GDB would not be able to display syscall's
  3429. names.
  3430. 'fork'
  3431. A call to 'fork'.
  3432. 'vfork'
  3433. A call to 'vfork'.
  3434. 'load [REGEXP]'
  3435. 'unload [REGEXP]'
  3436. The loading or unloading of a shared library. If REGEXP is
  3437. given, then the catchpoint will stop only if the regular
  3438. expression matches one of the affected libraries.
  3439. 'signal [SIGNAL... | 'all']'
  3440. The delivery of a signal.
  3441. With no arguments, this catchpoint will catch any signal that
  3442. is not used internally by GDB, specifically, all signals
  3443. except 'SIGTRAP' and 'SIGINT'.
  3444. With the argument 'all', all signals, including those used by
  3445. GDB, will be caught. This argument cannot be used with other
  3446. signal names.
  3447. Otherwise, the arguments are a list of signal names as given
  3448. to 'handle' (*note Signals::). Only signals specified in this
  3449. list will be caught.
  3450. One reason that 'catch signal' can be more useful than
  3451. 'handle' is that you can attach commands and conditions to the
  3452. catchpoint.
  3453. When a signal is caught by a catchpoint, the signal's 'stop'
  3454. and 'print' settings, as specified by 'handle', are ignored.
  3455. However, whether the signal is still delivered to the inferior
  3456. depends on the 'pass' setting; this can be changed in the
  3457. catchpoint's commands.
  3458. 'tcatch EVENT'
  3459. Set a catchpoint that is enabled only for one stop. The catchpoint
  3460. is automatically deleted after the first time the event is caught.
  3461. Use the 'info break' command to list the current catchpoints.
  3462. 
  3463. File: gdb.info, Node: Delete Breaks, Next: Disabling, Prev: Set Catchpoints, Up: Breakpoints
  3464. 5.1.4 Deleting Breakpoints
  3465. --------------------------
  3466. It is often necessary to eliminate a breakpoint, watchpoint, or
  3467. catchpoint once it has done its job and you no longer want your program
  3468. to stop there. This is called "deleting" the breakpoint. A breakpoint
  3469. that has been deleted no longer exists; it is forgotten.
  3470. With the 'clear' command you can delete breakpoints according to
  3471. where they are in your program. With the 'delete' command you can
  3472. delete individual breakpoints, watchpoints, or catchpoints by specifying
  3473. their breakpoint numbers.
  3474. It is not necessary to delete a breakpoint to proceed past it. GDB
  3475. automatically ignores breakpoints on the first instruction to be
  3476. executed when you continue execution without changing the execution
  3477. address.
  3478. 'clear'
  3479. Delete any breakpoints at the next instruction to be executed in
  3480. the selected stack frame (*note Selecting a Frame: Selection.).
  3481. When the innermost frame is selected, this is a good way to delete
  3482. a breakpoint where your program just stopped.
  3483. 'clear LOCATION'
  3484. Delete any breakpoints set at the specified LOCATION. *Note
  3485. Specify Location::, for the various forms of LOCATION; the most
  3486. useful ones are listed below:
  3487. 'clear FUNCTION'
  3488. 'clear FILENAME:FUNCTION'
  3489. Delete any breakpoints set at entry to the named FUNCTION.
  3490. 'clear LINENUM'
  3491. 'clear FILENAME:LINENUM'
  3492. Delete any breakpoints set at or within the code of the
  3493. specified LINENUM of the specified FILENAME.
  3494. 'delete [breakpoints] [LIST...]'
  3495. Delete the breakpoints, watchpoints, or catchpoints of the
  3496. breakpoint list specified as argument. If no argument is
  3497. specified, delete all breakpoints (GDB asks confirmation, unless
  3498. you have 'set confirm off'). You can abbreviate this command as
  3499. 'd'.
  3500. 
  3501. File: gdb.info, Node: Disabling, Next: Conditions, Prev: Delete Breaks, Up: Breakpoints
  3502. 5.1.5 Disabling Breakpoints
  3503. ---------------------------
  3504. Rather than deleting a breakpoint, watchpoint, or catchpoint, you might
  3505. prefer to "disable" it. This makes the breakpoint inoperative as if it
  3506. had been deleted, but remembers the information on the breakpoint so
  3507. that you can "enable" it again later.
  3508. You disable and enable breakpoints, watchpoints, and catchpoints with
  3509. the 'enable' and 'disable' commands, optionally specifying one or more
  3510. breakpoint numbers as arguments. Use 'info break' to print a list of
  3511. all breakpoints, watchpoints, and catchpoints if you do not know which
  3512. numbers to use.
  3513. Disabling and enabling a breakpoint that has multiple locations
  3514. affects all of its locations.
  3515. A breakpoint, watchpoint, or catchpoint can have any of several
  3516. different states of enablement:
  3517. * Enabled. The breakpoint stops your program. A breakpoint set with
  3518. the 'break' command starts out in this state.
  3519. * Disabled. The breakpoint has no effect on your program.
  3520. * Enabled once. The breakpoint stops your program, but then becomes
  3521. disabled.
  3522. * Enabled for a count. The breakpoint stops your program for the
  3523. next N times, then becomes disabled.
  3524. * Enabled for deletion. The breakpoint stops your program, but
  3525. immediately after it does so it is deleted permanently. A
  3526. breakpoint set with the 'tbreak' command starts out in this state.
  3527. You can use the following commands to enable or disable breakpoints,
  3528. watchpoints, and catchpoints:
  3529. 'disable [breakpoints] [LIST...]'
  3530. Disable the specified breakpoints--or all breakpoints, if none are
  3531. listed. A disabled breakpoint has no effect but is not forgotten.
  3532. All options such as ignore-counts, conditions and commands are
  3533. remembered in case the breakpoint is enabled again later. You may
  3534. abbreviate 'disable' as 'dis'.
  3535. 'enable [breakpoints] [LIST...]'
  3536. Enable the specified breakpoints (or all defined breakpoints).
  3537. They become effective once again in stopping your program.
  3538. 'enable [breakpoints] once LIST...'
  3539. Enable the specified breakpoints temporarily. GDB disables any of
  3540. these breakpoints immediately after stopping your program.
  3541. 'enable [breakpoints] count COUNT LIST...'
  3542. Enable the specified breakpoints temporarily. GDB records COUNT
  3543. with each of the specified breakpoints, and decrements a
  3544. breakpoint's count when it is hit. When any count reaches 0, GDB
  3545. disables that breakpoint. If a breakpoint has an ignore count
  3546. (*note Break Conditions: Conditions.), that will be decremented to
  3547. 0 before COUNT is affected.
  3548. 'enable [breakpoints] delete LIST...'
  3549. Enable the specified breakpoints to work once, then die. GDB
  3550. deletes any of these breakpoints as soon as your program stops
  3551. there. Breakpoints set by the 'tbreak' command start out in this
  3552. state.
  3553. Except for a breakpoint set with 'tbreak' (*note Setting Breakpoints:
  3554. Set Breaks.), breakpoints that you set are initially enabled;
  3555. subsequently, they become disabled or enabled only when you use one of
  3556. the commands above. (The command 'until' can set and delete a
  3557. breakpoint of its own, but it does not change the state of your other
  3558. breakpoints; see *note Continuing and Stepping: Continuing and
  3559. Stepping.)
  3560. 
  3561. File: gdb.info, Node: Conditions, Next: Break Commands, Prev: Disabling, Up: Breakpoints
  3562. 5.1.6 Break Conditions
  3563. ----------------------
  3564. The simplest sort of breakpoint breaks every time your program reaches a
  3565. specified place. You can also specify a "condition" for a breakpoint.
  3566. A condition is just a Boolean expression in your programming language
  3567. (*note Expressions: Expressions.). A breakpoint with a condition
  3568. evaluates the expression each time your program reaches it, and your
  3569. program stops only if the condition is _true_.
  3570. This is the converse of using assertions for program validation; in
  3571. that situation, you want to stop when the assertion is violated--that
  3572. is, when the condition is false. In C, if you want to test an assertion
  3573. expressed by the condition ASSERT, you should set the condition '!
  3574. ASSERT' on the appropriate breakpoint.
  3575. Conditions are also accepted for watchpoints; you may not need them,
  3576. since a watchpoint is inspecting the value of an expression anyhow--but
  3577. it might be simpler, say, to just set a watchpoint on a variable name,
  3578. and specify a condition that tests whether the new value is an
  3579. interesting one.
  3580. Break conditions can have side effects, and may even call functions
  3581. in your program. This can be useful, for example, to activate functions
  3582. that log program progress, or to use your own print functions to format
  3583. special data structures. The effects are completely predictable unless
  3584. there is another enabled breakpoint at the same address. (In that case,
  3585. GDB might see the other breakpoint first and stop your program without
  3586. checking the condition of this one.) Note that breakpoint commands are
  3587. usually more convenient and flexible than break conditions for the
  3588. purpose of performing side effects when a breakpoint is reached (*note
  3589. Breakpoint Command Lists: Break Commands.).
  3590. Breakpoint conditions can also be evaluated on the target's side if
  3591. the target supports it. Instead of evaluating the conditions locally,
  3592. GDB encodes the expression into an agent expression (*note Agent
  3593. Expressions::) suitable for execution on the target, independently of
  3594. GDB. Global variables become raw memory locations, locals become stack
  3595. accesses, and so forth.
  3596. In this case, GDB will only be notified of a breakpoint trigger when
  3597. its condition evaluates to true. This mechanism may provide faster
  3598. response times depending on the performance characteristics of the
  3599. target since it does not need to keep GDB informed about every
  3600. breakpoint trigger, even those with false conditions.
  3601. Break conditions can be specified when a breakpoint is set, by using
  3602. 'if' in the arguments to the 'break' command. *Note Setting
  3603. Breakpoints: Set Breaks. They can also be changed at any time with the
  3604. 'condition' command.
  3605. You can also use the 'if' keyword with the 'watch' command. The
  3606. 'catch' command does not recognize the 'if' keyword; 'condition' is the
  3607. only way to impose a further condition on a catchpoint.
  3608. 'condition BNUM EXPRESSION'
  3609. Specify EXPRESSION as the break condition for breakpoint,
  3610. watchpoint, or catchpoint number BNUM. After you set a condition,
  3611. breakpoint BNUM stops your program only if the value of EXPRESSION
  3612. is true (nonzero, in C). When you use 'condition', GDB checks
  3613. EXPRESSION immediately for syntactic correctness, and to determine
  3614. whether symbols in it have referents in the context of your
  3615. breakpoint. If EXPRESSION uses symbols not referenced in the
  3616. context of the breakpoint, GDB prints an error message:
  3617. No symbol "foo" in current context.
  3618. GDB does not actually evaluate EXPRESSION at the time the
  3619. 'condition' command (or a command that sets a breakpoint with a
  3620. condition, like 'break if ...') is given, however. *Note
  3621. Expressions: Expressions.
  3622. 'condition BNUM'
  3623. Remove the condition from breakpoint number BNUM. It becomes an
  3624. ordinary unconditional breakpoint.
  3625. A special case of a breakpoint condition is to stop only when the
  3626. breakpoint has been reached a certain number of times. This is so
  3627. useful that there is a special way to do it, using the "ignore count" of
  3628. the breakpoint. Every breakpoint has an ignore count, which is an
  3629. integer. Most of the time, the ignore count is zero, and therefore has
  3630. no effect. But if your program reaches a breakpoint whose ignore count
  3631. is positive, then instead of stopping, it just decrements the ignore
  3632. count by one and continues. As a result, if the ignore count value is
  3633. N, the breakpoint does not stop the next N times your program reaches
  3634. it.
  3635. 'ignore BNUM COUNT'
  3636. Set the ignore count of breakpoint number BNUM to COUNT. The next
  3637. COUNT times the breakpoint is reached, your program's execution
  3638. does not stop; other than to decrement the ignore count, GDB takes
  3639. no action.
  3640. To make the breakpoint stop the next time it is reached, specify a
  3641. count of zero.
  3642. When you use 'continue' to resume execution of your program from a
  3643. breakpoint, you can specify an ignore count directly as an argument
  3644. to 'continue', rather than using 'ignore'. *Note Continuing and
  3645. Stepping: Continuing and Stepping.
  3646. If a breakpoint has a positive ignore count and a condition, the
  3647. condition is not checked. Once the ignore count reaches zero, GDB
  3648. resumes checking the condition.
  3649. You could achieve the effect of the ignore count with a condition
  3650. such as '$foo-- <= 0' using a debugger convenience variable that is
  3651. decremented each time. *Note Convenience Variables: Convenience
  3652. Vars.
  3653. Ignore counts apply to breakpoints, watchpoints, and catchpoints.
  3654. 
  3655. File: gdb.info, Node: Break Commands, Next: Dynamic Printf, Prev: Conditions, Up: Breakpoints
  3656. 5.1.7 Breakpoint Command Lists
  3657. ------------------------------
  3658. You can give any breakpoint (or watchpoint or catchpoint) a series of
  3659. commands to execute when your program stops due to that breakpoint. For
  3660. example, you might want to print the values of certain expressions, or
  3661. enable other breakpoints.
  3662. 'commands [LIST...]'
  3663. '... COMMAND-LIST ...'
  3664. 'end'
  3665. Specify a list of commands for the given breakpoints. The commands
  3666. themselves appear on the following lines. Type a line containing
  3667. just 'end' to terminate the commands.
  3668. To remove all commands from a breakpoint, type 'commands' and
  3669. follow it immediately with 'end'; that is, give no commands.
  3670. With no argument, 'commands' refers to the last breakpoint,
  3671. watchpoint, or catchpoint set (not to the breakpoint most recently
  3672. encountered). If the most recent breakpoints were set with a
  3673. single command, then the 'commands' will apply to all the
  3674. breakpoints set by that command. This applies to breakpoints set
  3675. by 'rbreak', and also applies when a single 'break' command creates
  3676. multiple breakpoints (*note Ambiguous Expressions: Ambiguous
  3677. Expressions.).
  3678. Pressing <RET> as a means of repeating the last GDB command is
  3679. disabled within a COMMAND-LIST.
  3680. You can use breakpoint commands to start your program up again.
  3681. Simply use the 'continue' command, or 'step', or any other command that
  3682. resumes execution.
  3683. Any other commands in the command list, after a command that resumes
  3684. execution, are ignored. This is because any time you resume execution
  3685. (even with a simple 'next' or 'step'), you may encounter another
  3686. breakpoint--which could have its own command list, leading to
  3687. ambiguities about which list to execute.
  3688. If the first command you specify in a command list is 'silent', the
  3689. usual message about stopping at a breakpoint is not printed. This may
  3690. be desirable for breakpoints that are to print a specific message and
  3691. then continue. If none of the remaining commands print anything, you
  3692. see no sign that the breakpoint was reached. 'silent' is meaningful
  3693. only at the beginning of a breakpoint command list.
  3694. The commands 'echo', 'output', and 'printf' allow you to print
  3695. precisely controlled output, and are often useful in silent breakpoints.
  3696. *Note Commands for Controlled Output: Output.
  3697. For example, here is how you could use breakpoint commands to print
  3698. the value of 'x' at entry to 'foo' whenever 'x' is positive.
  3699. break foo if x>0
  3700. commands
  3701. silent
  3702. printf "x is %d\n",x
  3703. cont
  3704. end
  3705. One application for breakpoint commands is to compensate for one bug
  3706. so you can test for another. Put a breakpoint just after the erroneous
  3707. line of code, give it a condition to detect the case in which something
  3708. erroneous has been done, and give it commands to assign correct values
  3709. to any variables that need them. End with the 'continue' command so
  3710. that your program does not stop, and start with the 'silent' command so
  3711. that no output is produced. Here is an example:
  3712. break 403
  3713. commands
  3714. silent
  3715. set x = y + 4
  3716. cont
  3717. end
  3718. 
  3719. File: gdb.info, Node: Dynamic Printf, Next: Save Breakpoints, Prev: Break Commands, Up: Breakpoints
  3720. 5.1.8 Dynamic Printf
  3721. --------------------
  3722. The dynamic printf command 'dprintf' combines a breakpoint with
  3723. formatted printing of your program's data to give you the effect of
  3724. inserting 'printf' calls into your program on-the-fly, without having to
  3725. recompile it.
  3726. In its most basic form, the output goes to the GDB console. However,
  3727. you can set the variable 'dprintf-style' for alternate handling. For
  3728. instance, you can ask to format the output by calling your program's
  3729. 'printf' function. This has the advantage that the characters go to the
  3730. program's output device, so they can recorded in redirects to files and
  3731. so forth.
  3732. If you are doing remote debugging with a stub or agent, you can also
  3733. ask to have the printf handled by the remote agent. In addition to
  3734. ensuring that the output goes to the remote program's device along with
  3735. any other output the program might produce, you can also ask that the
  3736. dprintf remain active even after disconnecting from the remote target.
  3737. Using the stub/agent is also more efficient, as it can do everything
  3738. without needing to communicate with GDB.
  3739. 'dprintf LOCATION,TEMPLATE,EXPRESSION[,EXPRESSION...]'
  3740. Whenever execution reaches LOCATION, print the values of one or
  3741. more EXPRESSIONS under the control of the string TEMPLATE. To
  3742. print several values, separate them with commas.
  3743. 'set dprintf-style STYLE'
  3744. Set the dprintf output to be handled in one of several different
  3745. styles enumerated below. A change of style affects all existing
  3746. dynamic printfs immediately. (If you need individual control over
  3747. the print commands, simply define normal breakpoints with
  3748. explicitly-supplied command lists.)
  3749. 'gdb'
  3750. Handle the output using the GDB 'printf' command.
  3751. 'call'
  3752. Handle the output by calling a function in your program
  3753. (normally 'printf').
  3754. 'agent'
  3755. Have the remote debugging agent (such as 'gdbserver') handle
  3756. the output itself. This style is only available for agents
  3757. that support running commands on the target.
  3758. 'set dprintf-function FUNCTION'
  3759. Set the function to call if the dprintf style is 'call'. By
  3760. default its value is 'printf'. You may set it to any expression.
  3761. that GDB can evaluate to a function, as per the 'call' command.
  3762. 'set dprintf-channel CHANNEL'
  3763. Set a "channel" for dprintf. If set to a non-empty value, GDB will
  3764. evaluate it as an expression and pass the result as a first
  3765. argument to the 'dprintf-function', in the manner of 'fprintf' and
  3766. similar functions. Otherwise, the dprintf format string will be
  3767. the first argument, in the manner of 'printf'.
  3768. As an example, if you wanted 'dprintf' output to go to a logfile
  3769. that is a standard I/O stream assigned to the variable 'mylog', you
  3770. could do the following:
  3771. (gdb) set dprintf-style call
  3772. (gdb) set dprintf-function fprintf
  3773. (gdb) set dprintf-channel mylog
  3774. (gdb) dprintf 25,"at line 25, glob=%d\n",glob
  3775. Dprintf 1 at 0x123456: file main.c, line 25.
  3776. (gdb) info break
  3777. 1 dprintf keep y 0x00123456 in main at main.c:25
  3778. call (void) fprintf (mylog,"at line 25, glob=%d\n",glob)
  3779. continue
  3780. (gdb)
  3781. Note that the 'info break' displays the dynamic printf commands as
  3782. normal breakpoint commands; you can thus easily see the effect of
  3783. the variable settings.
  3784. 'set disconnected-dprintf on'
  3785. 'set disconnected-dprintf off'
  3786. Choose whether 'dprintf' commands should continue to run if GDB has
  3787. disconnected from the target. This only applies if the
  3788. 'dprintf-style' is 'agent'.
  3789. 'show disconnected-dprintf off'
  3790. Show the current choice for disconnected 'dprintf'.
  3791. GDB does not check the validity of function and channel, relying on
  3792. you to supply values that are meaningful for the contexts in which they
  3793. are being used. For instance, the function and channel may be the
  3794. values of local variables, but if that is the case, then all enabled
  3795. dynamic prints must be at locations within the scope of those locals.
  3796. If evaluation fails, GDB will report an error.
  3797. 
  3798. File: gdb.info, Node: Save Breakpoints, Next: Static Probe Points, Prev: Dynamic Printf, Up: Breakpoints
  3799. 5.1.9 How to save breakpoints to a file
  3800. ---------------------------------------
  3801. To save breakpoint definitions to a file use the 'save breakpoints'
  3802. command.
  3803. 'save breakpoints [FILENAME]'
  3804. This command saves all current breakpoint definitions together with
  3805. their commands and ignore counts, into a file 'FILENAME' suitable
  3806. for use in a later debugging session. This includes all types of
  3807. breakpoints (breakpoints, watchpoints, catchpoints, tracepoints).
  3808. To read the saved breakpoint definitions, use the 'source' command
  3809. (*note Command Files::). Note that watchpoints with expressions
  3810. involving local variables may fail to be recreated because it may
  3811. not be possible to access the context where the watchpoint is valid
  3812. anymore. Because the saved breakpoint definitions are simply a
  3813. sequence of GDB commands that recreate the breakpoints, you can
  3814. edit the file in your favorite editing program, and remove the
  3815. breakpoint definitions you're not interested in, or that can no
  3816. longer be recreated.
  3817. 
  3818. File: gdb.info, Node: Static Probe Points, Next: Error in Breakpoints, Prev: Save Breakpoints, Up: Breakpoints
  3819. 5.1.10 Static Probe Points
  3820. --------------------------
  3821. GDB supports "SDT" probes in the code. SDT stands for Statically
  3822. Defined Tracing, and the probes are designed to have a tiny runtime code
  3823. and data footprint, and no dynamic relocations.
  3824. Currently, the following types of probes are supported on
  3825. ELF-compatible systems:
  3826. * 'SystemTap' (<http://sourceware.org/systemtap/>) SDT probes(1).
  3827. 'SystemTap' probes are usable from assembly, C and C++
  3828. languages(2).
  3829. * 'DTrace' (<http://oss.oracle.com/projects/DTrace>) USDT probes.
  3830. 'DTrace' probes are usable from C and C++ languages.
  3831. Some 'SystemTap' probes have an associated semaphore variable; for
  3832. instance, this happens automatically if you defined your probe using a
  3833. DTrace-style '.d' file. If your probe has a semaphore, GDB will
  3834. automatically enable it when you specify a breakpoint using the
  3835. '-probe-stap' notation. But, if you put a breakpoint at a probe's
  3836. location by some other method (e.g., 'break file:line'), then GDB will
  3837. not automatically set the semaphore. 'DTrace' probes do not support
  3838. semaphores.
  3839. You can examine the available static static probes using 'info
  3840. probes', with optional arguments:
  3841. 'info probes [TYPE] [PROVIDER [NAME [OBJFILE]]]'
  3842. If given, TYPE is either 'stap' for listing 'SystemTap' probes or
  3843. 'dtrace' for listing 'DTrace' probes. If omitted all probes are
  3844. listed regardless of their types.
  3845. If given, PROVIDER is a regular expression used to match against
  3846. provider names when selecting which probes to list. If omitted,
  3847. probes by all probes from all providers are listed.
  3848. If given, NAME is a regular expression to match against probe names
  3849. when selecting which probes to list. If omitted, probe names are
  3850. not considered when deciding whether to display them.
  3851. If given, OBJFILE is a regular expression used to select which
  3852. object files (executable or shared libraries) to examine. If not
  3853. given, all object files are considered.
  3854. 'info probes all'
  3855. List the available static probes, from all types.
  3856. Some probe points can be enabled and/or disabled. The effect of
  3857. enabling or disabling a probe depends on the type of probe being
  3858. handled. Some 'DTrace' probes can be enabled or disabled, but
  3859. 'SystemTap' probes cannot be disabled.
  3860. You can enable (or disable) one or more probes using the following
  3861. commands, with optional arguments:
  3862. 'enable probes [PROVIDER [NAME [OBJFILE]]]'
  3863. If given, PROVIDER is a regular expression used to match against
  3864. provider names when selecting which probes to enable. If omitted,
  3865. all probes from all providers are enabled.
  3866. If given, NAME is a regular expression to match against probe names
  3867. when selecting which probes to enable. If omitted, probe names are
  3868. not considered when deciding whether to enable them.
  3869. If given, OBJFILE is a regular expression used to select which
  3870. object files (executable or shared libraries) to examine. If not
  3871. given, all object files are considered.
  3872. 'disable probes [PROVIDER [NAME [OBJFILE]]]'
  3873. See the 'enable probes' command above for a description of the
  3874. optional arguments accepted by this command.
  3875. A probe may specify up to twelve arguments. These are available at
  3876. the point at which the probe is defined--that is, when the current PC is
  3877. at the probe's location. The arguments are available using the
  3878. convenience variables (*note Convenience Vars::)
  3879. '$_probe_arg0'...'$_probe_arg11'. In 'SystemTap' probes each probe
  3880. argument is an integer of the appropriate size; types are not preserved.
  3881. In 'DTrace' probes types are preserved provided that they are recognized
  3882. as such by GDB; otherwise the value of the probe argument will be a long
  3883. integer. The convenience variable '$_probe_argc' holds the number of
  3884. arguments at the current probe point.
  3885. These variables are always available, but attempts to access them at
  3886. any location other than a probe point will cause GDB to give an error
  3887. message.
  3888. ---------- Footnotes ----------
  3889. (1) See
  3890. <http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps> for
  3891. more information on how to add 'SystemTap' SDT probes in your
  3892. applications.
  3893. (2) See
  3894. <http://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation> for
  3895. a good reference on how the SDT probes are implemented.
  3896. 
  3897. File: gdb.info, Node: Error in Breakpoints, Next: Breakpoint-related Warnings, Prev: Static Probe Points, Up: Breakpoints
  3898. 5.1.11 "Cannot insert breakpoints"
  3899. ----------------------------------
  3900. If you request too many active hardware-assisted breakpoints and
  3901. watchpoints, you will see this error message:
  3902. Stopped; cannot insert breakpoints.
  3903. You may have requested too many hardware breakpoints and watchpoints.
  3904. This message is printed when you attempt to resume the program, since
  3905. only then GDB knows exactly how many hardware breakpoints and
  3906. watchpoints it needs to insert.
  3907. When this message is printed, you need to disable or remove some of
  3908. the hardware-assisted breakpoints and watchpoints, and then continue.
  3909. 
  3910. File: gdb.info, Node: Breakpoint-related Warnings, Prev: Error in Breakpoints, Up: Breakpoints
  3911. 5.1.12 "Breakpoint address adjusted..."
  3912. ---------------------------------------
  3913. Some processor architectures place constraints on the addresses at which
  3914. breakpoints may be placed. For architectures thus constrained, GDB will
  3915. attempt to adjust the breakpoint's address to comply with the
  3916. constraints dictated by the architecture.
  3917. One example of such an architecture is the Fujitsu FR-V. The FR-V is
  3918. a VLIW architecture in which a number of RISC-like instructions may be
  3919. bundled together for parallel execution. The FR-V architecture
  3920. constrains the location of a breakpoint instruction within such a bundle
  3921. to the instruction with the lowest address. GDB honors this constraint
  3922. by adjusting a breakpoint's address to the first in the bundle.
  3923. It is not uncommon for optimized code to have bundles which contain
  3924. instructions from different source statements, thus it may happen that a
  3925. breakpoint's address will be adjusted from one source statement to
  3926. another. Since this adjustment may significantly alter GDB's breakpoint
  3927. related behavior from what the user expects, a warning is printed when
  3928. the breakpoint is first set and also when the breakpoint is hit.
  3929. A warning like the one below is printed when setting a breakpoint
  3930. that's been subject to address adjustment:
  3931. warning: Breakpoint address adjusted from 0x00010414 to 0x00010410.
  3932. Such warnings are printed both for user settable and GDB's internal
  3933. breakpoints. If you see one of these warnings, you should verify that a
  3934. breakpoint set at the adjusted address will have the desired affect. If
  3935. not, the breakpoint in question may be removed and other breakpoints may
  3936. be set which will have the desired behavior. E.g., it may be sufficient
  3937. to place the breakpoint at a later instruction. A conditional
  3938. breakpoint may also be useful in some cases to prevent the breakpoint
  3939. from triggering too often.
  3940. GDB will also issue a warning when stopping at one of these adjusted
  3941. breakpoints:
  3942. warning: Breakpoint 1 address previously adjusted from 0x00010414
  3943. to 0x00010410.
  3944. When this warning is encountered, it may be too late to take remedial
  3945. action except in cases where the breakpoint is hit earlier or more
  3946. frequently than expected.
  3947. 
  3948. File: gdb.info, Node: Continuing and Stepping, Next: Skipping Over Functions and Files, Prev: Breakpoints, Up: Stopping
  3949. 5.2 Continuing and Stepping
  3950. ===========================
  3951. "Continuing" means resuming program execution until your program
  3952. completes normally. In contrast, "stepping" means executing just one
  3953. more "step" of your program, where "step" may mean either one line of
  3954. source code, or one machine instruction (depending on what particular
  3955. command you use). Either when continuing or when stepping, your program
  3956. may stop even sooner, due to a breakpoint or a signal. (If it stops due
  3957. to a signal, you may want to use 'handle', or use 'signal 0' to resume
  3958. execution (*note Signals: Signals.), or you may step into the signal's
  3959. handler (*note stepping and signal handlers::).)
  3960. 'continue [IGNORE-COUNT]'
  3961. 'c [IGNORE-COUNT]'
  3962. 'fg [IGNORE-COUNT]'
  3963. Resume program execution, at the address where your program last
  3964. stopped; any breakpoints set at that address are bypassed. The
  3965. optional argument IGNORE-COUNT allows you to specify a further
  3966. number of times to ignore a breakpoint at this location; its effect
  3967. is like that of 'ignore' (*note Break Conditions: Conditions.).
  3968. The argument IGNORE-COUNT is meaningful only when your program
  3969. stopped due to a breakpoint. At other times, the argument to
  3970. 'continue' is ignored.
  3971. The synonyms 'c' and 'fg' (for "foreground", as the debugged
  3972. program is deemed to be the foreground program) are provided purely
  3973. for convenience, and have exactly the same behavior as 'continue'.
  3974. To resume execution at a different place, you can use 'return' (*note
  3975. Returning from a Function: Returning.) to go back to the calling
  3976. function; or 'jump' (*note Continuing at a Different Address: Jumping.)
  3977. to go to an arbitrary location in your program.
  3978. A typical technique for using stepping is to set a breakpoint (*note
  3979. Breakpoints; Watchpoints; and Catchpoints: Breakpoints.) at the
  3980. beginning of the function or the section of your program where a problem
  3981. is believed to lie, run your program until it stops at that breakpoint,
  3982. and then step through the suspect area, examining the variables that are
  3983. interesting, until you see the problem happen.
  3984. 'step'
  3985. Continue running your program until control reaches a different
  3986. source line, then stop it and return control to GDB. This command
  3987. is abbreviated 's'.
  3988. _Warning:_ If you use the 'step' command while control is
  3989. within a function that was compiled without debugging
  3990. information, execution proceeds until control reaches a
  3991. function that does have debugging information. Likewise, it
  3992. will not step into a function which is compiled without
  3993. debugging information. To step through functions without
  3994. debugging information, use the 'stepi' command, described
  3995. below.
  3996. The 'step' command only stops at the first instruction of a source
  3997. line. This prevents the multiple stops that could otherwise occur
  3998. in 'switch' statements, 'for' loops, etc. 'step' continues to stop
  3999. if a function that has debugging information is called within the
  4000. line. In other words, 'step' _steps inside_ any functions called
  4001. within the line.
  4002. Also, the 'step' command only enters a function if there is line
  4003. number information for the function. Otherwise it acts like the
  4004. 'next' command. This avoids problems when using 'cc -gl' on MIPS
  4005. machines. Previously, 'step' entered subroutines if there was any
  4006. debugging information about the routine.
  4007. 'step COUNT'
  4008. Continue running as in 'step', but do so COUNT times. If a
  4009. breakpoint is reached, or a signal not related to stepping occurs
  4010. before COUNT steps, stepping stops right away.
  4011. 'next [COUNT]'
  4012. Continue to the next source line in the current (innermost) stack
  4013. frame. This is similar to 'step', but function calls that appear
  4014. within the line of code are executed without stopping. Execution
  4015. stops when control reaches a different line of code at the original
  4016. stack level that was executing when you gave the 'next' command.
  4017. This command is abbreviated 'n'.
  4018. An argument COUNT is a repeat count, as for 'step'.
  4019. The 'next' command only stops at the first instruction of a source
  4020. line. This prevents multiple stops that could otherwise occur in
  4021. 'switch' statements, 'for' loops, etc.
  4022. 'set step-mode'
  4023. 'set step-mode on'
  4024. The 'set step-mode on' command causes the 'step' command to stop at
  4025. the first instruction of a function which contains no debug line
  4026. information rather than stepping over it.
  4027. This is useful in cases where you may be interested in inspecting
  4028. the machine instructions of a function which has no symbolic info
  4029. and do not want GDB to automatically skip over this function.
  4030. 'set step-mode off'
  4031. Causes the 'step' command to step over any functions which contains
  4032. no debug information. This is the default.
  4033. 'show step-mode'
  4034. Show whether GDB will stop in or step over functions without source
  4035. line debug information.
  4036. 'finish'
  4037. Continue running until just after function in the selected stack
  4038. frame returns. Print the returned value (if any). This command
  4039. can be abbreviated as 'fin'.
  4040. Contrast this with the 'return' command (*note Returning from a
  4041. Function: Returning.).
  4042. 'set print finish [on|off]'
  4043. 'show print finish'
  4044. By default the 'finish' command will show the value that is
  4045. returned by the function. This can be disabled using 'set print
  4046. finish off'. When disabled, the value is still entered into the
  4047. value history (*note Value History::), but not displayed.
  4048. 'until'
  4049. 'u'
  4050. Continue running until a source line past the current line, in the
  4051. current stack frame, is reached. This command is used to avoid
  4052. single stepping through a loop more than once. It is like the
  4053. 'next' command, except that when 'until' encounters a jump, it
  4054. automatically continues execution until the program counter is
  4055. greater than the address of the jump.
  4056. This means that when you reach the end of a loop after single
  4057. stepping though it, 'until' makes your program continue execution
  4058. until it exits the loop. In contrast, a 'next' command at the end
  4059. of a loop simply steps back to the beginning of the loop, which
  4060. forces you to step through the next iteration.
  4061. 'until' always stops your program if it attempts to exit the
  4062. current stack frame.
  4063. 'until' may produce somewhat counterintuitive results if the order
  4064. of machine code does not match the order of the source lines. For
  4065. example, in the following excerpt from a debugging session, the 'f'
  4066. ('frame') command shows that execution is stopped at line '206';
  4067. yet when we use 'until', we get to line '195':
  4068. (gdb) f
  4069. #0 main (argc=4, argv=0xf7fffae8) at m4.c:206
  4070. 206 expand_input();
  4071. (gdb) until
  4072. 195 for ( ; argc > 0; NEXTARG) {
  4073. This happened because, for execution efficiency, the compiler had
  4074. generated code for the loop closure test at the end, rather than
  4075. the start, of the loop--even though the test in a C 'for'-loop is
  4076. written before the body of the loop. The 'until' command appeared
  4077. to step back to the beginning of the loop when it advanced to this
  4078. expression; however, it has not really gone to an earlier
  4079. statement--not in terms of the actual machine code.
  4080. 'until' with no argument works by means of single instruction
  4081. stepping, and hence is slower than 'until' with an argument.
  4082. 'until LOCATION'
  4083. 'u LOCATION'
  4084. Continue running your program until either the specified LOCATION
  4085. is reached, or the current stack frame returns. The location is
  4086. any of the forms described in *note Specify Location::. This form
  4087. of the command uses temporary breakpoints, and hence is quicker
  4088. than 'until' without an argument. The specified location is
  4089. actually reached only if it is in the current frame. This implies
  4090. that 'until' can be used to skip over recursive function
  4091. invocations. For instance in the code below, if the current
  4092. location is line '96', issuing 'until 99' will execute the program
  4093. up to line '99' in the same invocation of factorial, i.e., after
  4094. the inner invocations have returned.
  4095. 94 int factorial (int value)
  4096. 95 {
  4097. 96 if (value > 1) {
  4098. 97 value *= factorial (value - 1);
  4099. 98 }
  4100. 99 return (value);
  4101. 100 }
  4102. 'advance LOCATION'
  4103. Continue running the program up to the given LOCATION. An argument
  4104. is required, which should be of one of the forms described in *note
  4105. Specify Location::. Execution will also stop upon exit from the
  4106. current stack frame. This command is similar to 'until', but
  4107. 'advance' will not skip over recursive function calls, and the
  4108. target location doesn't have to be in the same frame as the current
  4109. one.
  4110. 'stepi'
  4111. 'stepi ARG'
  4112. 'si'
  4113. Execute one machine instruction, then stop and return to the
  4114. debugger.
  4115. It is often useful to do 'display/i $pc' when stepping by machine
  4116. instructions. This makes GDB automatically display the next
  4117. instruction to be executed, each time your program stops. *Note
  4118. Automatic Display: Auto Display.
  4119. An argument is a repeat count, as in 'step'.
  4120. 'nexti'
  4121. 'nexti ARG'
  4122. 'ni'
  4123. Execute one machine instruction, but if it is a function call,
  4124. proceed until the function returns.
  4125. An argument is a repeat count, as in 'next'.
  4126. By default, and if available, GDB makes use of target-assisted "range
  4127. stepping". In other words, whenever you use a stepping command (e.g.,
  4128. 'step', 'next'), GDB tells the target to step the corresponding range of
  4129. instruction addresses instead of issuing multiple single-steps. This
  4130. speeds up line stepping, particularly for remote targets. Ideally,
  4131. there should be no reason you would want to turn range stepping off.
  4132. However, it's possible that a bug in the debug info, a bug in the remote
  4133. stub (for remote targets), or even a bug in GDB could make line stepping
  4134. behave incorrectly when target-assisted range stepping is enabled. You
  4135. can use the following command to turn off range stepping if necessary:
  4136. 'set range-stepping'
  4137. 'show range-stepping'
  4138. Control whether range stepping is enabled.
  4139. If 'on', and the target supports it, GDB tells the target to step a
  4140. range of addresses itself, instead of issuing multiple
  4141. single-steps. If 'off', GDB always issues single-steps, even if
  4142. range stepping is supported by the target. The default is 'on'.
  4143. 
  4144. File: gdb.info, Node: Skipping Over Functions and Files, Next: Signals, Prev: Continuing and Stepping, Up: Stopping
  4145. 5.3 Skipping Over Functions and Files
  4146. =====================================
  4147. The program you are debugging may contain some functions which are
  4148. uninteresting to debug. The 'skip' command lets you tell GDB to skip a
  4149. function, all functions in a file or a particular function in a
  4150. particular file when stepping.
  4151. For example, consider the following C function:
  4152. 101 int func()
  4153. 102 {
  4154. 103 foo(boring());
  4155. 104 bar(boring());
  4156. 105 }
  4157. Suppose you wish to step into the functions 'foo' and 'bar', but you are
  4158. not interested in stepping through 'boring'. If you run 'step' at line
  4159. 103, you'll enter 'boring()', but if you run 'next', you'll step over
  4160. both 'foo' and 'boring'!
  4161. One solution is to 'step' into 'boring' and use the 'finish' command
  4162. to immediately exit it. But this can become tedious if 'boring' is
  4163. called from many places.
  4164. A more flexible solution is to execute 'skip boring'. This instructs
  4165. GDB never to step into 'boring'. Now when you execute 'step' at line
  4166. 103, you'll step over 'boring' and directly into 'foo'.
  4167. Functions may be skipped by providing either a function name,
  4168. linespec (*note Specify Location::), regular expression that matches the
  4169. function's name, file name or a 'glob'-style pattern that matches the
  4170. file name.
  4171. On Posix systems the form of the regular expression is "Extended
  4172. Regular Expressions". See for example 'man 7 regex' on GNU/Linux
  4173. systems. On non-Posix systems the form of the regular expression is
  4174. whatever is provided by the 'regcomp' function of the underlying system.
  4175. See for example 'man 7 glob' on GNU/Linux systems for a description of
  4176. 'glob'-style patterns.
  4177. 'skip [OPTIONS]'
  4178. The basic form of the 'skip' command takes zero or more options
  4179. that specify what to skip. The OPTIONS argument is any useful
  4180. combination of the following:
  4181. '-file FILE'
  4182. '-fi FILE'
  4183. Functions in FILE will be skipped over when stepping.
  4184. '-gfile FILE-GLOB-PATTERN'
  4185. '-gfi FILE-GLOB-PATTERN'
  4186. Functions in files matching FILE-GLOB-PATTERN will be skipped
  4187. over when stepping.
  4188. (gdb) skip -gfi utils/*.c
  4189. '-function LINESPEC'
  4190. '-fu LINESPEC'
  4191. Functions named by LINESPEC or the function containing the
  4192. line named by LINESPEC will be skipped over when stepping.
  4193. *Note Specify Location::.
  4194. '-rfunction REGEXP'
  4195. '-rfu REGEXP'
  4196. Functions whose name matches REGEXP will be skipped over when
  4197. stepping.
  4198. This form is useful for complex function names. For example,
  4199. there is generally no need to step into C++ 'std::string'
  4200. constructors or destructors. Plus with C++ templates it can
  4201. be hard to write out the full name of the function, and often
  4202. it doesn't matter what the template arguments are. Specifying
  4203. the function to be skipped as a regular expression makes this
  4204. easier.
  4205. (gdb) skip -rfu ^std::(allocator|basic_string)<.*>::~?\1 *\(
  4206. If you want to skip every templated C++ constructor and
  4207. destructor in the 'std' namespace you can do:
  4208. (gdb) skip -rfu ^std::([a-zA-z0-9_]+)<.*>::~?\1 *\(
  4209. If no options are specified, the function you're currently
  4210. debugging will be skipped.
  4211. 'skip function [LINESPEC]'
  4212. After running this command, the function named by LINESPEC or the
  4213. function containing the line named by LINESPEC will be skipped over
  4214. when stepping. *Note Specify Location::.
  4215. If you do not specify LINESPEC, the function you're currently
  4216. debugging will be skipped.
  4217. (If you have a function called 'file' that you want to skip, use
  4218. 'skip function file'.)
  4219. 'skip file [FILENAME]'
  4220. After running this command, any function whose source lives in
  4221. FILENAME will be skipped over when stepping.
  4222. (gdb) skip file boring.c
  4223. File boring.c will be skipped when stepping.
  4224. If you do not specify FILENAME, functions whose source lives in the
  4225. file you're currently debugging will be skipped.
  4226. Skips can be listed, deleted, disabled, and enabled, much like
  4227. breakpoints. These are the commands for managing your list of skips:
  4228. 'info skip [RANGE]'
  4229. Print details about the specified skip(s). If RANGE is not
  4230. specified, print a table with details about all functions and files
  4231. marked for skipping. 'info skip' prints the following information
  4232. about each skip:
  4233. _Identifier_
  4234. A number identifying this skip.
  4235. _Enabled or Disabled_
  4236. Enabled skips are marked with 'y'. Disabled skips are marked
  4237. with 'n'.
  4238. _Glob_
  4239. If the file name is a 'glob' pattern this is 'y'. Otherwise
  4240. it is 'n'.
  4241. _File_
  4242. The name or 'glob' pattern of the file to be skipped. If no
  4243. file is specified this is '<none>'.
  4244. _RE_
  4245. If the function name is a 'regular expression' this is 'y'.
  4246. Otherwise it is 'n'.
  4247. _Function_
  4248. The name or regular expression of the function to skip. If no
  4249. function is specified this is '<none>'.
  4250. 'skip delete [RANGE]'
  4251. Delete the specified skip(s). If RANGE is not specified, delete
  4252. all skips.
  4253. 'skip enable [RANGE]'
  4254. Enable the specified skip(s). If RANGE is not specified, enable
  4255. all skips.
  4256. 'skip disable [RANGE]'
  4257. Disable the specified skip(s). If RANGE is not specified, disable
  4258. all skips.
  4259. 'set debug skip [on|off]'
  4260. Set whether to print the debug output about skipping files and
  4261. functions.
  4262. 'show debug skip'
  4263. Show whether the debug output about skipping files and functions is
  4264. printed.
  4265. 
  4266. File: gdb.info, Node: Signals, Next: Thread Stops, Prev: Skipping Over Functions and Files, Up: Stopping
  4267. 5.4 Signals
  4268. ===========
  4269. A signal is an asynchronous event that can happen in a program. The
  4270. operating system defines the possible kinds of signals, and gives each
  4271. kind a name and a number. For example, in Unix 'SIGINT' is the signal a
  4272. program gets when you type an interrupt character (often 'Ctrl-c');
  4273. 'SIGSEGV' is the signal a program gets from referencing a place in
  4274. memory far away from all the areas in use; 'SIGALRM' occurs when the
  4275. alarm clock timer goes off (which happens only if your program has
  4276. requested an alarm).
  4277. Some signals, including 'SIGALRM', are a normal part of the
  4278. functioning of your program. Others, such as 'SIGSEGV', indicate
  4279. errors; these signals are "fatal" (they kill your program immediately)
  4280. if the program has not specified in advance some other way to handle the
  4281. signal. 'SIGINT' does not indicate an error in your program, but it is
  4282. normally fatal so it can carry out the purpose of the interrupt: to kill
  4283. the program.
  4284. GDB has the ability to detect any occurrence of a signal in your
  4285. program. You can tell GDB in advance what to do for each kind of
  4286. signal.
  4287. Normally, GDB is set up to let the non-erroneous signals like
  4288. 'SIGALRM' be silently passed to your program (so as not to interfere
  4289. with their role in the program's functioning) but to stop your program
  4290. immediately whenever an error signal happens. You can change these
  4291. settings with the 'handle' command.
  4292. 'info signals'
  4293. 'info handle'
  4294. Print a table of all the kinds of signals and how GDB has been told
  4295. to handle each one. You can use this to see the signal numbers of
  4296. all the defined types of signals.
  4297. 'info signals SIG'
  4298. Similar, but print information only about the specified signal
  4299. number.
  4300. 'info handle' is an alias for 'info signals'.
  4301. 'catch signal [SIGNAL... | 'all']'
  4302. Set a catchpoint for the indicated signals. *Note Set
  4303. Catchpoints::, for details about this command.
  4304. 'handle SIGNAL [KEYWORDS...]'
  4305. Change the way GDB handles signal SIGNAL. The SIGNAL can be the
  4306. number of a signal or its name (with or without the 'SIG' at the
  4307. beginning); a list of signal numbers of the form 'LOW-HIGH'; or the
  4308. word 'all', meaning all the known signals. Optional arguments
  4309. KEYWORDS, described below, say what change to make.
  4310. The keywords allowed by the 'handle' command can be abbreviated.
  4311. Their full names are:
  4312. 'nostop'
  4313. GDB should not stop your program when this signal happens. It may
  4314. still print a message telling you that the signal has come in.
  4315. 'stop'
  4316. GDB should stop your program when this signal happens. This
  4317. implies the 'print' keyword as well.
  4318. 'print'
  4319. GDB should print a message when this signal happens.
  4320. 'noprint'
  4321. GDB should not mention the occurrence of the signal at all. This
  4322. implies the 'nostop' keyword as well.
  4323. 'pass'
  4324. 'noignore'
  4325. GDB should allow your program to see this signal; your program can
  4326. handle the signal, or else it may terminate if the signal is fatal
  4327. and not handled. 'pass' and 'noignore' are synonyms.
  4328. 'nopass'
  4329. 'ignore'
  4330. GDB should not allow your program to see this signal. 'nopass' and
  4331. 'ignore' are synonyms.
  4332. When a signal stops your program, the signal is not visible to the
  4333. program until you continue. Your program sees the signal then, if
  4334. 'pass' is in effect for the signal in question _at that time_. In other
  4335. words, after GDB reports a signal, you can use the 'handle' command with
  4336. 'pass' or 'nopass' to control whether your program sees that signal when
  4337. you continue.
  4338. The default is set to 'nostop', 'noprint', 'pass' for non-erroneous
  4339. signals such as 'SIGALRM', 'SIGWINCH' and 'SIGCHLD', and to 'stop',
  4340. 'print', 'pass' for the erroneous signals.
  4341. You can also use the 'signal' command to prevent your program from
  4342. seeing a signal, or cause it to see a signal it normally would not see,
  4343. or to give it any signal at any time. For example, if your program
  4344. stopped due to some sort of memory reference error, you might store
  4345. correct values into the erroneous variables and continue, hoping to see
  4346. more execution; but your program would probably terminate immediately as
  4347. a result of the fatal signal once it saw the signal. To prevent this,
  4348. you can continue with 'signal 0'. *Note Giving your Program a Signal:
  4349. Signaling.
  4350. GDB optimizes for stepping the mainline code. If a signal that has
  4351. 'handle nostop' and 'handle pass' set arrives while a stepping command
  4352. (e.g., 'stepi', 'step', 'next') is in progress, GDB lets the signal
  4353. handler run and then resumes stepping the mainline code once the signal
  4354. handler returns. In other words, GDB steps over the signal handler.
  4355. This prevents signals that you've specified as not interesting (with
  4356. 'handle nostop') from changing the focus of debugging unexpectedly.
  4357. Note that the signal handler itself may still hit a breakpoint, stop for
  4358. another signal that has 'handle stop' in effect, or for any other event
  4359. that normally results in stopping the stepping command sooner. Also
  4360. note that GDB still informs you that the program received a signal if
  4361. 'handle print' is set.
  4362. If you set 'handle pass' for a signal, and your program sets up a
  4363. handler for it, then issuing a stepping command, such as 'step' or
  4364. 'stepi', when your program is stopped due to the signal will step _into_
  4365. the signal handler (if the target supports that).
  4366. Likewise, if you use the 'queue-signal' command to queue a signal to
  4367. be delivered to the current thread when execution of the thread resumes
  4368. (*note Giving your Program a Signal: Signaling.), then a stepping
  4369. command will step into the signal handler.
  4370. Here's an example, using 'stepi' to step to the first instruction of
  4371. 'SIGUSR1''s handler:
  4372. (gdb) handle SIGUSR1
  4373. Signal Stop Print Pass to program Description
  4374. SIGUSR1 Yes Yes Yes User defined signal 1
  4375. (gdb) c
  4376. Continuing.
  4377. Program received signal SIGUSR1, User defined signal 1.
  4378. main () sigusr1.c:28
  4379. 28 p = 0;
  4380. (gdb) si
  4381. sigusr1_handler () at sigusr1.c:9
  4382. 9 {
  4383. The same, but using 'queue-signal' instead of waiting for the program
  4384. to receive the signal first:
  4385. (gdb) n
  4386. 28 p = 0;
  4387. (gdb) queue-signal SIGUSR1
  4388. (gdb) si
  4389. sigusr1_handler () at sigusr1.c:9
  4390. 9 {
  4391. (gdb)
  4392. On some targets, GDB can inspect extra signal information associated
  4393. with the intercepted signal, before it is actually delivered to the
  4394. program being debugged. This information is exported by the convenience
  4395. variable '$_siginfo', and consists of data that is passed by the kernel
  4396. to the signal handler at the time of the receipt of a signal. The data
  4397. type of the information itself is target dependent. You can see the
  4398. data type using the 'ptype $_siginfo' command. On Unix systems, it
  4399. typically corresponds to the standard 'siginfo_t' type, as defined in
  4400. the 'signal.h' system header.
  4401. Here's an example, on a GNU/Linux system, printing the stray
  4402. referenced address that raised a segmentation fault.
  4403. (gdb) continue
  4404. Program received signal SIGSEGV, Segmentation fault.
  4405. 0x0000000000400766 in main ()
  4406. 69 *(int *)p = 0;
  4407. (gdb) ptype $_siginfo
  4408. type = struct {
  4409. int si_signo;
  4410. int si_errno;
  4411. int si_code;
  4412. union {
  4413. int _pad[28];
  4414. struct {...} _kill;
  4415. struct {...} _timer;
  4416. struct {...} _rt;
  4417. struct {...} _sigchld;
  4418. struct {...} _sigfault;
  4419. struct {...} _sigpoll;
  4420. } _sifields;
  4421. }
  4422. (gdb) ptype $_siginfo._sifields._sigfault
  4423. type = struct {
  4424. void *si_addr;
  4425. }
  4426. (gdb) p $_siginfo._sifields._sigfault.si_addr
  4427. $1 = (void *) 0x7ffff7ff7000
  4428. Depending on target support, '$_siginfo' may also be writable.
  4429. On some targets, a 'SIGSEGV' can be caused by a boundary violation,
  4430. i.e., accessing an address outside of the allowed range. In those cases
  4431. GDB may displays additional information, depending on how GDB has been
  4432. told to handle the signal. With 'handle stop SIGSEGV', GDB displays the
  4433. violation kind: "Upper" or "Lower", the memory address accessed and the
  4434. bounds, while with 'handle nostop SIGSEGV' no additional information is
  4435. displayed.
  4436. The usual output of a segfault is:
  4437. Program received signal SIGSEGV, Segmentation fault
  4438. 0x0000000000400d7c in upper () at i386-mpx-sigsegv.c:68
  4439. 68 value = *(p + len);
  4440. While a bound violation is presented as:
  4441. Program received signal SIGSEGV, Segmentation fault
  4442. Upper bound violation while accessing address 0x7fffffffc3b3
  4443. Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
  4444. 0x0000000000400d7c in upper () at i386-mpx-sigsegv.c:68
  4445. 68 value = *(p + len);
  4446. 
  4447. File: gdb.info, Node: Thread Stops, Prev: Signals, Up: Stopping
  4448. 5.5 Stopping and Starting Multi-thread Programs
  4449. ===============================================
  4450. GDB supports debugging programs with multiple threads (*note Debugging
  4451. Programs with Multiple Threads: Threads.). There are two modes of
  4452. controlling execution of your program within the debugger. In the
  4453. default mode, referred to as "all-stop mode", when any thread in your
  4454. program stops (for example, at a breakpoint or while being stepped), all
  4455. other threads in the program are also stopped by GDB. On some targets,
  4456. GDB also supports "non-stop mode", in which other threads can continue
  4457. to run freely while you examine the stopped thread in the debugger.
  4458. * Menu:
  4459. * All-Stop Mode:: All threads stop when GDB takes control
  4460. * Non-Stop Mode:: Other threads continue to execute
  4461. * Background Execution:: Running your program asynchronously
  4462. * Thread-Specific Breakpoints:: Controlling breakpoints
  4463. * Interrupted System Calls:: GDB may interfere with system calls
  4464. * Observer Mode:: GDB does not alter program behavior
  4465. 
  4466. File: gdb.info, Node: All-Stop Mode, Next: Non-Stop Mode, Up: Thread Stops
  4467. 5.5.1 All-Stop Mode
  4468. -------------------
  4469. In all-stop mode, whenever your program stops under GDB for any reason,
  4470. _all_ threads of execution stop, not just the current thread. This
  4471. allows you to examine the overall state of the program, including
  4472. switching between threads, without worrying that things may change
  4473. underfoot.
  4474. Conversely, whenever you restart the program, _all_ threads start
  4475. executing. _This is true even when single-stepping_ with commands like
  4476. 'step' or 'next'.
  4477. In particular, GDB cannot single-step all threads in lockstep. Since
  4478. thread scheduling is up to your debugging target's operating system (not
  4479. controlled by GDB), other threads may execute more than one statement
  4480. while the current thread completes a single step. Moreover, in general
  4481. other threads stop in the middle of a statement, rather than at a clean
  4482. statement boundary, when the program stops.
  4483. You might even find your program stopped in another thread after
  4484. continuing or even single-stepping. This happens whenever some other
  4485. thread runs into a breakpoint, a signal, or an exception before the
  4486. first thread completes whatever you requested.
  4487. Whenever GDB stops your program, due to a breakpoint or a signal, it
  4488. automatically selects the thread where that breakpoint or signal
  4489. happened. GDB alerts you to the context switch with a message such as
  4490. '[Switching to Thread N]' to identify the thread.
  4491. On some OSes, you can modify GDB's default behavior by locking the OS
  4492. scheduler to allow only a single thread to run.
  4493. 'set scheduler-locking MODE'
  4494. Set the scheduler locking mode. It applies to normal execution,
  4495. record mode, and replay mode. If it is 'off', then there is no
  4496. locking and any thread may run at any time. If 'on', then only the
  4497. current thread may run when the inferior is resumed. The 'step'
  4498. mode optimizes for single-stepping; it prevents other threads from
  4499. preempting the current thread while you are stepping, so that the
  4500. focus of debugging does not change unexpectedly. Other threads
  4501. never get a chance to run when you step, and they are completely
  4502. free to run when you use commands like 'continue', 'until', or
  4503. 'finish'. However, unless another thread hits a breakpoint during
  4504. its timeslice, GDB does not change the current thread away from the
  4505. thread that you are debugging. The 'replay' mode behaves like
  4506. 'off' in record mode and like 'on' in replay mode.
  4507. 'show scheduler-locking'
  4508. Display the current scheduler locking mode.
  4509. By default, when you issue one of the execution commands such as
  4510. 'continue', 'next' or 'step', GDB allows only threads of the current
  4511. inferior to run. For example, if GDB is attached to two inferiors, each
  4512. with two threads, the 'continue' command resumes only the two threads of
  4513. the current inferior. This is useful, for example, when you debug a
  4514. program that forks and you want to hold the parent stopped (so that, for
  4515. instance, it doesn't run to exit), while you debug the child. In other
  4516. situations, you may not be interested in inspecting the current state of
  4517. any of the processes GDB is attached to, and you may want to resume them
  4518. all until some breakpoint is hit. In the latter case, you can instruct
  4519. GDB to allow all threads of all the inferiors to run with the
  4520. 'set schedule-multiple' command.
  4521. 'set schedule-multiple'
  4522. Set the mode for allowing threads of multiple processes to be
  4523. resumed when an execution command is issued. When 'on', all
  4524. threads of all processes are allowed to run. When 'off', only the
  4525. threads of the current process are resumed. The default is 'off'.
  4526. The 'scheduler-locking' mode takes precedence when set to 'on', or
  4527. while you are stepping and set to 'step'.
  4528. 'show schedule-multiple'
  4529. Display the current mode for resuming the execution of threads of
  4530. multiple processes.
  4531. 
  4532. File: gdb.info, Node: Non-Stop Mode, Next: Background Execution, Prev: All-Stop Mode, Up: Thread Stops
  4533. 5.5.2 Non-Stop Mode
  4534. -------------------
  4535. For some multi-threaded targets, GDB supports an optional mode of
  4536. operation in which you can examine stopped program threads in the
  4537. debugger while other threads continue to execute freely. This minimizes
  4538. intrusion when debugging live systems, such as programs where some
  4539. threads have real-time constraints or must continue to respond to
  4540. external events. This is referred to as "non-stop" mode.
  4541. In non-stop mode, when a thread stops to report a debugging event,
  4542. _only_ that thread is stopped; GDB does not stop other threads as well,
  4543. in contrast to the all-stop mode behavior. Additionally, execution
  4544. commands such as 'continue' and 'step' apply by default only to the
  4545. current thread in non-stop mode, rather than all threads as in all-stop
  4546. mode. This allows you to control threads explicitly in ways that are
  4547. not possible in all-stop mode -- for example, stepping one thread while
  4548. allowing others to run freely, stepping one thread while holding all
  4549. others stopped, or stepping several threads independently and
  4550. simultaneously.
  4551. To enter non-stop mode, use this sequence of commands before you run
  4552. or attach to your program:
  4553. # If using the CLI, pagination breaks non-stop.
  4554. set pagination off
  4555. # Finally, turn it on!
  4556. set non-stop on
  4557. You can use these commands to manipulate the non-stop mode setting:
  4558. 'set non-stop on'
  4559. Enable selection of non-stop mode.
  4560. 'set non-stop off'
  4561. Disable selection of non-stop mode.
  4562. 'show non-stop'
  4563. Show the current non-stop enablement setting.
  4564. Note these commands only reflect whether non-stop mode is enabled,
  4565. not whether the currently-executing program is being run in non-stop
  4566. mode. In particular, the 'set non-stop' preference is only consulted
  4567. when GDB starts or connects to the target program, and it is generally
  4568. not possible to switch modes once debugging has started. Furthermore,
  4569. since not all targets support non-stop mode, even when you have enabled
  4570. non-stop mode, GDB may still fall back to all-stop operation by default.
  4571. In non-stop mode, all execution commands apply only to the current
  4572. thread by default. That is, 'continue' only continues one thread. To
  4573. continue all threads, issue 'continue -a' or 'c -a'.
  4574. You can use GDB's background execution commands (*note Background
  4575. Execution::) to run some threads in the background while you continue to
  4576. examine or step others from GDB. The MI execution commands (*note
  4577. GDB/MI Program Execution::) are always executed asynchronously in
  4578. non-stop mode.
  4579. Suspending execution is done with the 'interrupt' command when
  4580. running in the background, or 'Ctrl-c' during foreground execution. In
  4581. all-stop mode, this stops the whole process; but in non-stop mode the
  4582. interrupt applies only to the current thread. To stop the whole
  4583. program, use 'interrupt -a'.
  4584. Other execution commands do not currently support the '-a' option.
  4585. In non-stop mode, when a thread stops, GDB doesn't automatically make
  4586. that thread current, as it does in all-stop mode. This is because the
  4587. thread stop notifications are asynchronous with respect to GDB's command
  4588. interpreter, and it would be confusing if GDB unexpectedly changed to a
  4589. different thread just as you entered a command to operate on the
  4590. previously current thread.
  4591. 
  4592. File: gdb.info, Node: Background Execution, Next: Thread-Specific Breakpoints, Prev: Non-Stop Mode, Up: Thread Stops
  4593. 5.5.3 Background Execution
  4594. --------------------------
  4595. GDB's execution commands have two variants: the normal foreground
  4596. (synchronous) behavior, and a background (asynchronous) behavior. In
  4597. foreground execution, GDB waits for the program to report that some
  4598. thread has stopped before prompting for another command. In background
  4599. execution, GDB immediately gives a command prompt so that you can issue
  4600. other commands while your program runs.
  4601. If the target doesn't support async mode, GDB issues an error message
  4602. if you attempt to use the background execution commands.
  4603. To specify background execution, add a '&' to the command. For
  4604. example, the background form of the 'continue' command is 'continue&',
  4605. or just 'c&'. The execution commands that accept background execution
  4606. are:
  4607. 'run'
  4608. *Note Starting your Program: Starting.
  4609. 'attach'
  4610. *Note Debugging an Already-running Process: Attach.
  4611. 'step'
  4612. *Note step: Continuing and Stepping.
  4613. 'stepi'
  4614. *Note stepi: Continuing and Stepping.
  4615. 'next'
  4616. *Note next: Continuing and Stepping.
  4617. 'nexti'
  4618. *Note nexti: Continuing and Stepping.
  4619. 'continue'
  4620. *Note continue: Continuing and Stepping.
  4621. 'finish'
  4622. *Note finish: Continuing and Stepping.
  4623. 'until'
  4624. *Note until: Continuing and Stepping.
  4625. Background execution is especially useful in conjunction with
  4626. non-stop mode for debugging programs with multiple threads; see *note
  4627. Non-Stop Mode::. However, you can also use these commands in the normal
  4628. all-stop mode with the restriction that you cannot issue another
  4629. execution command until the previous one finishes. Examples of commands
  4630. that are valid in all-stop mode while the program is running include
  4631. 'help' and 'info break'.
  4632. You can interrupt your program while it is running in the background
  4633. by using the 'interrupt' command.
  4634. 'interrupt'
  4635. 'interrupt -a'
  4636. Suspend execution of the running program. In all-stop mode,
  4637. 'interrupt' stops the whole process, but in non-stop mode, it stops
  4638. only the current thread. To stop the whole program in non-stop
  4639. mode, use 'interrupt -a'.
  4640. 
  4641. File: gdb.info, Node: Thread-Specific Breakpoints, Next: Interrupted System Calls, Prev: Background Execution, Up: Thread Stops
  4642. 5.5.4 Thread-Specific Breakpoints
  4643. ---------------------------------
  4644. When your program has multiple threads (*note Debugging Programs with
  4645. Multiple Threads: Threads.), you can choose whether to set breakpoints
  4646. on all threads, or on a particular thread.
  4647. 'break LOCATION thread THREAD-ID'
  4648. 'break LOCATION thread THREAD-ID if ...'
  4649. LOCATION specifies source lines; there are several ways of writing
  4650. them (*note Specify Location::), but the effect is always to
  4651. specify some source line.
  4652. Use the qualifier 'thread THREAD-ID' with a breakpoint command to
  4653. specify that you only want GDB to stop the program when a
  4654. particular thread reaches this breakpoint. The THREAD-ID specifier
  4655. is one of the thread identifiers assigned by GDB, shown in the
  4656. first column of the 'info threads' display.
  4657. If you do not specify 'thread THREAD-ID' when you set a breakpoint,
  4658. the breakpoint applies to _all_ threads of your program.
  4659. You can use the 'thread' qualifier on conditional breakpoints as
  4660. well; in this case, place 'thread THREAD-ID' before or after the
  4661. breakpoint condition, like this:
  4662. (gdb) break frik.c:13 thread 28 if bartab > lim
  4663. Thread-specific breakpoints are automatically deleted when GDB
  4664. detects the corresponding thread is no longer in the thread list. For
  4665. example:
  4666. (gdb) c
  4667. Thread-specific breakpoint 3 deleted - thread 28 no longer in the thread list.
  4668. There are several ways for a thread to disappear, such as a regular
  4669. thread exit, but also when you detach from the process with the 'detach'
  4670. command (*note Debugging an Already-running Process: Attach.), or if GDB
  4671. loses the remote connection (*note Remote Debugging::), etc. Note that
  4672. with some targets, GDB is only able to detect a thread has exited when
  4673. the user explictly asks for the thread list with the 'info threads'
  4674. command.
  4675. 
  4676. File: gdb.info, Node: Interrupted System Calls, Next: Observer Mode, Prev: Thread-Specific Breakpoints, Up: Thread Stops
  4677. 5.5.5 Interrupted System Calls
  4678. ------------------------------
  4679. There is an unfortunate side effect when using GDB to debug
  4680. multi-threaded programs. If one thread stops for a breakpoint, or for
  4681. some other reason, and another thread is blocked in a system call, then
  4682. the system call may return prematurely. This is a consequence of the
  4683. interaction between multiple threads and the signals that GDB uses to
  4684. implement breakpoints and other events that stop execution.
  4685. To handle this problem, your program should check the return value of
  4686. each system call and react appropriately. This is good programming
  4687. style anyways.
  4688. For example, do not write code like this:
  4689. sleep (10);
  4690. The call to 'sleep' will return early if a different thread stops at
  4691. a breakpoint or for some other reason.
  4692. Instead, write this:
  4693. int unslept = 10;
  4694. while (unslept > 0)
  4695. unslept = sleep (unslept);
  4696. A system call is allowed to return early, so the system is still
  4697. conforming to its specification. But GDB does cause your multi-threaded
  4698. program to behave differently than it would without GDB.
  4699. Also, GDB uses internal breakpoints in the thread library to monitor
  4700. certain events such as thread creation and thread destruction. When
  4701. such an event happens, a system call in another thread may return
  4702. prematurely, even though your program does not appear to stop.
  4703. 
  4704. File: gdb.info, Node: Observer Mode, Prev: Interrupted System Calls, Up: Thread Stops
  4705. 5.5.6 Observer Mode
  4706. -------------------
  4707. If you want to build on non-stop mode and observe program behavior
  4708. without any chance of disruption by GDB, you can set variables to
  4709. disable all of the debugger's attempts to modify state, whether by
  4710. writing memory, inserting breakpoints, etc. These operate at a low
  4711. level, intercepting operations from all commands.
  4712. When all of these are set to 'off', then GDB is said to be "observer
  4713. mode". As a convenience, the variable 'observer' can be set to disable
  4714. these, plus enable non-stop mode.
  4715. Note that GDB will not prevent you from making nonsensical
  4716. combinations of these settings. For instance, if you have enabled
  4717. 'may-insert-breakpoints' but disabled 'may-write-memory', then
  4718. breakpoints that work by writing trap instructions into the code stream
  4719. will still not be able to be placed.
  4720. 'set observer on'
  4721. 'set observer off'
  4722. When set to 'on', this disables all the permission variables below
  4723. (except for 'insert-fast-tracepoints'), plus enables non-stop
  4724. debugging. Setting this to 'off' switches back to normal
  4725. debugging, though remaining in non-stop mode.
  4726. 'show observer'
  4727. Show whether observer mode is on or off.
  4728. 'set may-write-registers on'
  4729. 'set may-write-registers off'
  4730. This controls whether GDB will attempt to alter the values of
  4731. registers, such as with assignment expressions in 'print', or the
  4732. 'jump' command. It defaults to 'on'.
  4733. 'show may-write-registers'
  4734. Show the current permission to write registers.
  4735. 'set may-write-memory on'
  4736. 'set may-write-memory off'
  4737. This controls whether GDB will attempt to alter the contents of
  4738. memory, such as with assignment expressions in 'print'. It
  4739. defaults to 'on'.
  4740. 'show may-write-memory'
  4741. Show the current permission to write memory.
  4742. 'set may-insert-breakpoints on'
  4743. 'set may-insert-breakpoints off'
  4744. This controls whether GDB will attempt to insert breakpoints. This
  4745. affects all breakpoints, including internal breakpoints defined by
  4746. GDB. It defaults to 'on'.
  4747. 'show may-insert-breakpoints'
  4748. Show the current permission to insert breakpoints.
  4749. 'set may-insert-tracepoints on'
  4750. 'set may-insert-tracepoints off'
  4751. This controls whether GDB will attempt to insert (regular)
  4752. tracepoints at the beginning of a tracing experiment. It affects
  4753. only non-fast tracepoints, fast tracepoints being under the control
  4754. of 'may-insert-fast-tracepoints'. It defaults to 'on'.
  4755. 'show may-insert-tracepoints'
  4756. Show the current permission to insert tracepoints.
  4757. 'set may-insert-fast-tracepoints on'
  4758. 'set may-insert-fast-tracepoints off'
  4759. This controls whether GDB will attempt to insert fast tracepoints
  4760. at the beginning of a tracing experiment. It affects only fast
  4761. tracepoints, regular (non-fast) tracepoints being under the control
  4762. of 'may-insert-tracepoints'. It defaults to 'on'.
  4763. 'show may-insert-fast-tracepoints'
  4764. Show the current permission to insert fast tracepoints.
  4765. 'set may-interrupt on'
  4766. 'set may-interrupt off'
  4767. This controls whether GDB will attempt to interrupt or stop program
  4768. execution. When this variable is 'off', the 'interrupt' command
  4769. will have no effect, nor will 'Ctrl-c'. It defaults to 'on'.
  4770. 'show may-interrupt'
  4771. Show the current permission to interrupt or stop the program.
  4772. 
  4773. File: gdb.info, Node: Reverse Execution, Next: Process Record and Replay, Prev: Stopping, Up: Top
  4774. 6 Running programs backward
  4775. ***************************
  4776. When you are debugging a program, it is not unusual to realize that you
  4777. have gone too far, and some event of interest has already happened. If
  4778. the target environment supports it, GDB can allow you to "rewind" the
  4779. program by running it backward.
  4780. A target environment that supports reverse execution should be able
  4781. to "undo" the changes in machine state that have taken place as the
  4782. program was executing normally. Variables, registers etc. should revert
  4783. to their previous values. Obviously this requires a great deal of
  4784. sophistication on the part of the target environment; not all target
  4785. environments can support reverse execution.
  4786. When a program is executed in reverse, the instructions that have
  4787. most recently been executed are "un-executed", in reverse order. The
  4788. program counter runs backward, following the previous thread of
  4789. execution in reverse. As each instruction is "un-executed", the values
  4790. of memory and/or registers that were changed by that instruction are
  4791. reverted to their previous states. After executing a piece of source
  4792. code in reverse, all side effects of that code should be "undone", and
  4793. all variables should be returned to their prior values(1).
  4794. On some platforms, GDB has built-in support for reverse execution,
  4795. activated with the 'record' or 'record btrace' commands. *Note Process
  4796. Record and Replay::. Some remote targets, typically full system
  4797. emulators, support reverse execution directly without requiring any
  4798. special command.
  4799. If you are debugging in a target environment that supports reverse
  4800. execution, GDB provides the following commands.
  4801. 'reverse-continue [IGNORE-COUNT]'
  4802. 'rc [IGNORE-COUNT]'
  4803. Beginning at the point where your program last stopped, start
  4804. executing in reverse. Reverse execution will stop for breakpoints
  4805. and synchronous exceptions (signals), just like normal execution.
  4806. Behavior of asynchronous signals depends on the target environment.
  4807. 'reverse-step [COUNT]'
  4808. Run the program backward until control reaches the start of a
  4809. different source line; then stop it, and return control to GDB.
  4810. Like the 'step' command, 'reverse-step' will only stop at the
  4811. beginning of a source line. It "un-executes" the previously
  4812. executed source line. If the previous source line included calls
  4813. to debuggable functions, 'reverse-step' will step (backward) into
  4814. the called function, stopping at the beginning of the _last_
  4815. statement in the called function (typically a return statement).
  4816. Also, as with the 'step' command, if non-debuggable functions are
  4817. called, 'reverse-step' will run thru them backward without
  4818. stopping.
  4819. 'reverse-stepi [COUNT]'
  4820. Reverse-execute one machine instruction. Note that the instruction
  4821. to be reverse-executed is _not_ the one pointed to by the program
  4822. counter, but the instruction executed prior to that one. For
  4823. instance, if the last instruction was a jump, 'reverse-stepi' will
  4824. take you back from the destination of the jump to the jump
  4825. instruction itself.
  4826. 'reverse-next [COUNT]'
  4827. Run backward to the beginning of the previous line executed in the
  4828. current (innermost) stack frame. If the line contains function
  4829. calls, they will be "un-executed" without stopping. Starting from
  4830. the first line of a function, 'reverse-next' will take you back to
  4831. the caller of that function, _before_ the function was called, just
  4832. as the normal 'next' command would take you from the last line of a
  4833. function back to its return to its caller (2).
  4834. 'reverse-nexti [COUNT]'
  4835. Like 'nexti', 'reverse-nexti' executes a single instruction in
  4836. reverse, except that called functions are "un-executed" atomically.
  4837. That is, if the previously executed instruction was a return from
  4838. another function, 'reverse-nexti' will continue to execute in
  4839. reverse until the call to that function (from the current stack
  4840. frame) is reached.
  4841. 'reverse-finish'
  4842. Just as the 'finish' command takes you to the point where the
  4843. current function returns, 'reverse-finish' takes you to the point
  4844. where it was called. Instead of ending up at the end of the
  4845. current function invocation, you end up at the beginning.
  4846. 'set exec-direction'
  4847. Set the direction of target execution.
  4848. 'set exec-direction reverse'
  4849. GDB will perform all execution commands in reverse, until the
  4850. exec-direction mode is changed to "forward". Affected commands
  4851. include 'step, stepi, next, nexti, continue, and finish'. The
  4852. 'return' command cannot be used in reverse mode.
  4853. 'set exec-direction forward'
  4854. GDB will perform all execution commands in the normal fashion.
  4855. This is the default.
  4856. ---------- Footnotes ----------
  4857. (1) Note that some side effects are easier to undo than others. For
  4858. instance, memory and registers are relatively easy, but device I/O is
  4859. hard. Some targets may be able undo things like device I/O, and some
  4860. may not.
  4861. The contract between GDB and the reverse executing target requires
  4862. only that the target do something reasonable when GDB tells it to
  4863. execute backwards, and then report the results back to GDB. Whatever
  4864. the target reports back to GDB, GDB will report back to the user. GDB
  4865. assumes that the memory and registers that the target reports are in a
  4866. consistent state, but GDB accepts whatever it is given.
  4867. (2) Unless the code is too heavily optimized.
  4868. 
  4869. File: gdb.info, Node: Process Record and Replay, Next: Stack, Prev: Reverse Execution, Up: Top
  4870. 7 Recording Inferior's Execution and Replaying It
  4871. *************************************************
  4872. On some platforms, GDB provides a special "process record and replay"
  4873. target that can record a log of the process execution, and replay it
  4874. later with both forward and reverse execution commands.
  4875. When this target is in use, if the execution log includes the record
  4876. for the next instruction, GDB will debug in "replay mode". In the
  4877. replay mode, the inferior does not really execute code instructions.
  4878. Instead, all the events that normally happen during code execution are
  4879. taken from the execution log. While code is not really executed in
  4880. replay mode, the values of registers (including the program counter
  4881. register) and the memory of the inferior are still changed as they
  4882. normally would. Their contents are taken from the execution log.
  4883. If the record for the next instruction is not in the execution log,
  4884. GDB will debug in "record mode". In this mode, the inferior executes
  4885. normally, and GDB records the execution log for future replay.
  4886. The process record and replay target supports reverse execution
  4887. (*note Reverse Execution::), even if the platform on which the inferior
  4888. runs does not. However, the reverse execution is limited in this case
  4889. by the range of the instructions recorded in the execution log. In
  4890. other words, reverse execution on platforms that don't support it
  4891. directly can only be done in the replay mode.
  4892. When debugging in the reverse direction, GDB will work in replay mode
  4893. as long as the execution log includes the record for the previous
  4894. instruction; otherwise, it will work in record mode, if the platform
  4895. supports reverse execution, or stop if not.
  4896. Currently, process record and replay is supported on ARM, Aarch64,
  4897. Moxie, PowerPC, PowerPC64, S/390, and x86 (i386/amd64) running
  4898. GNU/Linux. Process record and replay can be used both when native
  4899. debugging, and when remote debugging via 'gdbserver'.
  4900. For architecture environments that support process record and replay,
  4901. GDB provides the following commands:
  4902. 'record METHOD'
  4903. This command starts the process record and replay target. The
  4904. recording method can be specified as parameter. Without a
  4905. parameter the command uses the 'full' recording method. The
  4906. following recording methods are available:
  4907. 'full'
  4908. Full record/replay recording using GDB's software record and
  4909. replay implementation. This method allows replaying and
  4910. reverse execution.
  4911. 'btrace FORMAT'
  4912. Hardware-supported instruction recording, supported on Intel
  4913. processors. This method does not record data. Further, the
  4914. data is collected in a ring buffer so old data will be
  4915. overwritten when the buffer is full. It allows limited
  4916. reverse execution. Variables and registers are not available
  4917. during reverse execution. In remote debugging, recording
  4918. continues on disconnect. Recorded data can be inspected after
  4919. reconnecting. The recording may be stopped using 'record
  4920. stop'.
  4921. The recording format can be specified as parameter. Without a
  4922. parameter the command chooses the recording format. The
  4923. following recording formats are available:
  4924. 'bts'
  4925. Use the "Branch Trace Store" (BTS) recording format. In
  4926. this format, the processor stores a from/to record for
  4927. each executed branch in the btrace ring buffer.
  4928. 'pt'
  4929. Use the "Intel Processor Trace" recording format. In
  4930. this format, the processor stores the execution trace in
  4931. a compressed form that is afterwards decoded by GDB.
  4932. The trace can be recorded with very low overhead. The
  4933. compressed trace format also allows small trace buffers
  4934. to already contain a big number of instructions compared
  4935. to BTS.
  4936. Decoding the recorded execution trace, on the other hand,
  4937. is more expensive than decoding BTS trace. This is
  4938. mostly due to the increased number of instructions to
  4939. process. You should increase the buffer-size with care.
  4940. Not all recording formats may be available on all processors.
  4941. The process record and replay target can only debug a process that
  4942. is already running. Therefore, you need first to start the process
  4943. with the 'run' or 'start' commands, and then start the recording
  4944. with the 'record METHOD' command.
  4945. Displaced stepping (*note displaced stepping: Maintenance
  4946. Commands.) will be automatically disabled when process record and
  4947. replay target is started. That's because the process record and
  4948. replay target doesn't support displaced stepping.
  4949. If the inferior is in the non-stop mode (*note Non-Stop Mode::) or
  4950. in the asynchronous execution mode (*note Background Execution::),
  4951. not all recording methods are available. The 'full' recording
  4952. method does not support these two modes.
  4953. 'record stop'
  4954. Stop the process record and replay target. When process record and
  4955. replay target stops, the entire execution log will be deleted and
  4956. the inferior will either be terminated, or will remain in its final
  4957. state.
  4958. When you stop the process record and replay target in record mode
  4959. (at the end of the execution log), the inferior will be stopped at
  4960. the next instruction that would have been recorded. In other
  4961. words, if you record for a while and then stop recording, the
  4962. inferior process will be left in the same state as if the recording
  4963. never happened.
  4964. On the other hand, if the process record and replay target is
  4965. stopped while in replay mode (that is, not at the end of the
  4966. execution log, but at some earlier point), the inferior process
  4967. will become "live" at that earlier state, and it will then be
  4968. possible to continue the usual "live" debugging of the process from
  4969. that state.
  4970. When the inferior process exits, or GDB detaches from it, process
  4971. record and replay target will automatically stop itself.
  4972. 'record goto'
  4973. Go to a specific location in the execution log. There are several
  4974. ways to specify the location to go to:
  4975. 'record goto begin'
  4976. 'record goto start'
  4977. Go to the beginning of the execution log.
  4978. 'record goto end'
  4979. Go to the end of the execution log.
  4980. 'record goto N'
  4981. Go to instruction number N in the execution log.
  4982. 'record save FILENAME'
  4983. Save the execution log to a file 'FILENAME'. Default filename is
  4984. 'gdb_record.PROCESS_ID', where PROCESS_ID is the process ID of the
  4985. inferior.
  4986. This command may not be available for all recording methods.
  4987. 'record restore FILENAME'
  4988. Restore the execution log from a file 'FILENAME'. File must have
  4989. been created with 'record save'.
  4990. 'set record full insn-number-max LIMIT'
  4991. 'set record full insn-number-max unlimited'
  4992. Set the limit of instructions to be recorded for the 'full'
  4993. recording method. Default value is 200000.
  4994. If LIMIT is a positive number, then GDB will start deleting
  4995. instructions from the log once the number of the record
  4996. instructions becomes greater than LIMIT. For every new recorded
  4997. instruction, GDB will delete the earliest recorded instruction to
  4998. keep the number of recorded instructions at the limit. (Since
  4999. deleting recorded instructions loses information, GDB lets you
  5000. control what happens when the limit is reached, by means of the
  5001. 'stop-at-limit' option, described below.)
  5002. If LIMIT is 'unlimited' or zero, GDB will never delete recorded
  5003. instructions from the execution log. The number of recorded
  5004. instructions is limited only by the available memory.
  5005. 'show record full insn-number-max'
  5006. Show the limit of instructions to be recorded with the 'full'
  5007. recording method.
  5008. 'set record full stop-at-limit'
  5009. Control the behavior of the 'full' recording method when the number
  5010. of recorded instructions reaches the limit. If ON (the default),
  5011. GDB will stop when the limit is reached for the first time and ask
  5012. you whether you want to stop the inferior or continue running it
  5013. and recording the execution log. If you decide to continue
  5014. recording, each new recorded instruction will cause the oldest one
  5015. to be deleted.
  5016. If this option is OFF, GDB will automatically delete the oldest
  5017. record to make room for each new one, without asking.
  5018. 'show record full stop-at-limit'
  5019. Show the current setting of 'stop-at-limit'.
  5020. 'set record full memory-query'
  5021. Control the behavior when GDB is unable to record memory changes
  5022. caused by an instruction for the 'full' recording method. If ON,
  5023. GDB will query whether to stop the inferior in that case.
  5024. If this option is OFF (the default), GDB will automatically ignore
  5025. the effect of such instructions on memory. Later, when GDB replays
  5026. this execution log, it will mark the log of this instruction as not
  5027. accessible, and it will not affect the replay results.
  5028. 'show record full memory-query'
  5029. Show the current setting of 'memory-query'.
  5030. The 'btrace' record target does not trace data. As a convenience,
  5031. when replaying, GDB reads read-only memory off the live program
  5032. directly, assuming that the addresses of the read-only areas don't
  5033. change. This for example makes it possible to disassemble code
  5034. while replaying, but not to print variables. In some cases, being
  5035. able to inspect variables might be useful. You can use the
  5036. following command for that:
  5037. 'set record btrace replay-memory-access'
  5038. Control the behavior of the 'btrace' recording method when
  5039. accessing memory during replay. If 'read-only' (the default), GDB
  5040. will only allow accesses to read-only memory. If 'read-write', GDB
  5041. will allow accesses to read-only and to read-write memory. Beware
  5042. that the accessed memory corresponds to the live target and not
  5043. necessarily to the current replay position.
  5044. 'set record btrace cpu IDENTIFIER'
  5045. Set the processor to be used for enabling workarounds for processor
  5046. errata when decoding the trace.
  5047. Processor errata are defects in processor operation, caused by its
  5048. design or manufacture. They can cause a trace not to match the
  5049. specification. This, in turn, may cause trace decode to fail. GDB
  5050. can detect erroneous trace packets and correct them, thus avoiding
  5051. the decoding failures. These corrections are known as "errata
  5052. workarounds", and are enabled based on the processor on which the
  5053. trace was recorded.
  5054. By default, GDB attempts to detect the processor automatically, and
  5055. apply the necessary workarounds for it. However, you may need to
  5056. specify the processor if GDB does not yet support it. This command
  5057. allows you to do that, and also allows to disable the workarounds.
  5058. The argument IDENTIFIER identifies the CPU and is of the form:
  5059. 'VENDOR:PROCESSOR IDENTIFIER'. In addition, there are two special
  5060. identifiers, 'none' and 'auto' (default).
  5061. The following vendor identifiers and corresponding processor
  5062. identifiers are currently supported:
  5063. 'intel' FAMILY/MODEL[/STEPPING]
  5064. On GNU/Linux systems, the processor FAMILY, MODEL, and STEPPING can
  5065. be obtained from '/proc/cpuinfo'.
  5066. If IDENTIFIER is 'auto', enable errata workarounds for the
  5067. processor on which the trace was recorded. If IDENTIFIER is
  5068. 'none', errata workarounds are disabled.
  5069. For example, when using an old GDB on a new system, decode may fail
  5070. because GDB does not support the new processor. It often suffices
  5071. to specify an older processor that GDB supports.
  5072. (gdb) info record
  5073. Active record target: record-btrace
  5074. Recording format: Intel Processor Trace.
  5075. Buffer size: 16kB.
  5076. Failed to configure the Intel Processor Trace decoder: unknown cpu.
  5077. (gdb) set record btrace cpu intel:6/158
  5078. (gdb) info record
  5079. Active record target: record-btrace
  5080. Recording format: Intel Processor Trace.
  5081. Buffer size: 16kB.
  5082. Recorded 84872 instructions in 3189 functions (0 gaps) for thread 1 (...).
  5083. 'show record btrace replay-memory-access'
  5084. Show the current setting of 'replay-memory-access'.
  5085. 'show record btrace cpu'
  5086. Show the processor to be used for enabling trace decode errata
  5087. workarounds.
  5088. 'set record btrace bts buffer-size SIZE'
  5089. 'set record btrace bts buffer-size unlimited'
  5090. Set the requested ring buffer size for branch tracing in BTS
  5091. format. Default is 64KB.
  5092. If SIZE is a positive number, then GDB will try to allocate a
  5093. buffer of at least SIZE bytes for each new thread that uses the
  5094. btrace recording method and the BTS format. The actually obtained
  5095. buffer size may differ from the requested SIZE. Use the 'info
  5096. record' command to see the actual buffer size for each thread that
  5097. uses the btrace recording method and the BTS format.
  5098. If LIMIT is 'unlimited' or zero, GDB will try to allocate a buffer
  5099. of 4MB.
  5100. Bigger buffers mean longer traces. On the other hand, GDB will
  5101. also need longer to process the branch trace data before it can be
  5102. used.
  5103. 'show record btrace bts buffer-size SIZE'
  5104. Show the current setting of the requested ring buffer size for
  5105. branch tracing in BTS format.
  5106. 'set record btrace pt buffer-size SIZE'
  5107. 'set record btrace pt buffer-size unlimited'
  5108. Set the requested ring buffer size for branch tracing in Intel
  5109. Processor Trace format. Default is 16KB.
  5110. If SIZE is a positive number, then GDB will try to allocate a
  5111. buffer of at least SIZE bytes for each new thread that uses the
  5112. btrace recording method and the Intel Processor Trace format. The
  5113. actually obtained buffer size may differ from the requested SIZE.
  5114. Use the 'info record' command to see the actual buffer size for
  5115. each thread.
  5116. If LIMIT is 'unlimited' or zero, GDB will try to allocate a buffer
  5117. of 4MB.
  5118. Bigger buffers mean longer traces. On the other hand, GDB will
  5119. also need longer to process the branch trace data before it can be
  5120. used.
  5121. 'show record btrace pt buffer-size SIZE'
  5122. Show the current setting of the requested ring buffer size for
  5123. branch tracing in Intel Processor Trace format.
  5124. 'info record'
  5125. Show various statistics about the recording depending on the
  5126. recording method:
  5127. 'full'
  5128. For the 'full' recording method, it shows the state of process
  5129. record and its in-memory execution log buffer, including:
  5130. * Whether in record mode or replay mode.
  5131. * Lowest recorded instruction number (counting from when
  5132. the current execution log started recording
  5133. instructions).
  5134. * Highest recorded instruction number.
  5135. * Current instruction about to be replayed (if in replay
  5136. mode).
  5137. * Number of instructions contained in the execution log.
  5138. * Maximum number of instructions that may be contained in
  5139. the execution log.
  5140. 'btrace'
  5141. For the 'btrace' recording method, it shows:
  5142. * Recording format.
  5143. * Number of instructions that have been recorded.
  5144. * Number of blocks of sequential control-flow formed by the
  5145. recorded instructions.
  5146. * Whether in record mode or replay mode.
  5147. For the 'bts' recording format, it also shows:
  5148. * Size of the perf ring buffer.
  5149. For the 'pt' recording format, it also shows:
  5150. * Size of the perf ring buffer.
  5151. 'record delete'
  5152. When record target runs in replay mode ("in the past"), delete the
  5153. subsequent execution log and begin to record a new execution log
  5154. starting from the current address. This means you will abandon the
  5155. previously recorded "future" and begin recording a new "future".
  5156. 'record instruction-history'
  5157. Disassembles instructions from the recorded execution log. By
  5158. default, ten instructions are disassembled. This can be changed
  5159. using the 'set record instruction-history-size' command.
  5160. Instructions are printed in execution order.
  5161. It can also print mixed source+disassembly if you specify the the
  5162. '/m' or '/s' modifier, and print the raw instructions in hex as
  5163. well as in symbolic form by specifying the '/r' modifier.
  5164. The current position marker is printed for the instruction at the
  5165. current program counter value. This instruction can appear
  5166. multiple times in the trace and the current position marker will be
  5167. printed every time. To omit the current position marker, specify
  5168. the '/p' modifier.
  5169. To better align the printed instructions when the trace contains
  5170. instructions from more than one function, the function name may be
  5171. omitted by specifying the '/f' modifier.
  5172. Speculatively executed instructions are prefixed with '?'. This
  5173. feature is not available for all recording formats.
  5174. There are several ways to specify what part of the execution log to
  5175. disassemble:
  5176. 'record instruction-history INSN'
  5177. Disassembles ten instructions starting from instruction number
  5178. INSN.
  5179. 'record instruction-history INSN, +/-N'
  5180. Disassembles N instructions around instruction number INSN.
  5181. If N is preceded with '+', disassembles N instructions after
  5182. instruction number INSN. If N is preceded with '-',
  5183. disassembles N instructions before instruction number INSN.
  5184. 'record instruction-history'
  5185. Disassembles ten more instructions after the last disassembly.
  5186. 'record instruction-history -'
  5187. Disassembles ten more instructions before the last
  5188. disassembly.
  5189. 'record instruction-history BEGIN, END'
  5190. Disassembles instructions beginning with instruction number
  5191. BEGIN until instruction number END. The instruction number
  5192. END is included.
  5193. This command may not be available for all recording methods.
  5194. 'set record instruction-history-size SIZE'
  5195. 'set record instruction-history-size unlimited'
  5196. Define how many instructions to disassemble in the 'record
  5197. instruction-history' command. The default value is 10. A SIZE of
  5198. 'unlimited' means unlimited instructions.
  5199. 'show record instruction-history-size'
  5200. Show how many instructions to disassemble in the 'record
  5201. instruction-history' command.
  5202. 'record function-call-history'
  5203. Prints the execution history at function granularity. It prints
  5204. one line for each sequence of instructions that belong to the same
  5205. function giving the name of that function, the source lines for
  5206. this instruction sequence (if the '/l' modifier is specified), and
  5207. the instructions numbers that form the sequence (if the '/i'
  5208. modifier is specified). The function names are indented to reflect
  5209. the call stack depth if the '/c' modifier is specified. The '/l',
  5210. '/i', and '/c' modifiers can be given together.
  5211. (gdb) list 1, 10
  5212. 1 void foo (void)
  5213. 2 {
  5214. 3 }
  5215. 4
  5216. 5 void bar (void)
  5217. 6 {
  5218. 7 ...
  5219. 8 foo ();
  5220. 9 ...
  5221. 10 }
  5222. (gdb) record function-call-history /ilc
  5223. 1 bar inst 1,4 at foo.c:6,8
  5224. 2 foo inst 5,10 at foo.c:2,3
  5225. 3 bar inst 11,13 at foo.c:9,10
  5226. By default, ten lines are printed. This can be changed using the
  5227. 'set record function-call-history-size' command. Functions are
  5228. printed in execution order. There are several ways to specify what
  5229. to print:
  5230. 'record function-call-history FUNC'
  5231. Prints ten functions starting from function number FUNC.
  5232. 'record function-call-history FUNC, +/-N'
  5233. Prints N functions around function number FUNC. If N is
  5234. preceded with '+', prints N functions after function number
  5235. FUNC. If N is preceded with '-', prints N functions before
  5236. function number FUNC.
  5237. 'record function-call-history'
  5238. Prints ten more functions after the last ten-line print.
  5239. 'record function-call-history -'
  5240. Prints ten more functions before the last ten-line print.
  5241. 'record function-call-history BEGIN, END'
  5242. Prints functions beginning with function number BEGIN until
  5243. function number END. The function number END is included.
  5244. This command may not be available for all recording methods.
  5245. 'set record function-call-history-size SIZE'
  5246. 'set record function-call-history-size unlimited'
  5247. Define how many lines to print in the 'record
  5248. function-call-history' command. The default value is 10. A size
  5249. of 'unlimited' means unlimited lines.
  5250. 'show record function-call-history-size'
  5251. Show how many lines to print in the 'record function-call-history'
  5252. command.
  5253. 
  5254. File: gdb.info, Node: Stack, Next: Source, Prev: Process Record and Replay, Up: Top
  5255. 8 Examining the Stack
  5256. *********************
  5257. When your program has stopped, the first thing you need to know is where
  5258. it stopped and how it got there.
  5259. Each time your program performs a function call, information about
  5260. the call is generated. That information includes the location of the
  5261. call in your program, the arguments of the call, and the local variables
  5262. of the function being called. The information is saved in a block of
  5263. data called a "stack frame". The stack frames are allocated in a region
  5264. of memory called the "call stack".
  5265. When your program stops, the GDB commands for examining the stack
  5266. allow you to see all of this information.
  5267. One of the stack frames is "selected" by GDB and many GDB commands
  5268. refer implicitly to the selected frame. In particular, whenever you ask
  5269. GDB for the value of a variable in your program, the value is found in
  5270. the selected frame. There are special GDB commands to select whichever
  5271. frame you are interested in. *Note Selecting a Frame: Selection.
  5272. When your program stops, GDB automatically selects the currently
  5273. executing frame and describes it briefly, similar to the 'frame' command
  5274. (*note Information about a Frame: Frame Info.).
  5275. * Menu:
  5276. * Frames:: Stack frames
  5277. * Backtrace:: Backtraces
  5278. * Selection:: Selecting a frame
  5279. * Frame Info:: Information on a frame
  5280. * Frame Apply:: Applying a command to several frames
  5281. * Frame Filter Management:: Managing frame filters
  5282. 
  5283. File: gdb.info, Node: Frames, Next: Backtrace, Up: Stack
  5284. 8.1 Stack Frames
  5285. ================
  5286. The call stack is divided up into contiguous pieces called "stack
  5287. frames", or "frames" for short; each frame is the data associated with
  5288. one call to one function. The frame contains the arguments given to the
  5289. function, the function's local variables, and the address at which the
  5290. function is executing.
  5291. When your program is started, the stack has only one frame, that of
  5292. the function 'main'. This is called the "initial" frame or the
  5293. "outermost" frame. Each time a function is called, a new frame is made.
  5294. Each time a function returns, the frame for that function invocation is
  5295. eliminated. If a function is recursive, there can be many frames for
  5296. the same function. The frame for the function in which execution is
  5297. actually occurring is called the "innermost" frame. This is the most
  5298. recently created of all the stack frames that still exist.
  5299. Inside your program, stack frames are identified by their addresses.
  5300. A stack frame consists of many bytes, each of which has its own address;
  5301. each kind of computer has a convention for choosing one byte whose
  5302. address serves as the address of the frame. Usually this address is
  5303. kept in a register called the "frame pointer register" (*note $fp:
  5304. Registers.) while execution is going on in that frame.
  5305. GDB labels each existing stack frame with a "level", a number that is
  5306. zero for the innermost frame, one for the frame that called it, and so
  5307. on upward. These level numbers give you a way of designating stack
  5308. frames in GDB commands. The terms "frame number" and "frame level" can
  5309. be used interchangeably to describe this number.
  5310. Some compilers provide a way to compile functions so that they
  5311. operate without stack frames. (For example, the GCC option
  5312. '-fomit-frame-pointer'
  5313. generates functions without a frame.) This is occasionally done with
  5314. heavily used library functions to save the frame setup time. GDB has
  5315. limited facilities for dealing with these function invocations. If the
  5316. innermost function invocation has no stack frame, GDB nevertheless
  5317. regards it as though it had a separate frame, which is numbered zero as
  5318. usual, allowing correct tracing of the function call chain. However,
  5319. GDB has no provision for frameless functions elsewhere in the stack.
  5320. 
  5321. File: gdb.info, Node: Backtrace, Next: Selection, Prev: Frames, Up: Stack
  5322. 8.2 Backtraces
  5323. ==============
  5324. A backtrace is a summary of how your program got where it is. It shows
  5325. one line per frame, for many frames, starting with the currently
  5326. executing frame (frame zero), followed by its caller (frame one), and on
  5327. up the stack.
  5328. To print a backtrace of the entire stack, use the 'backtrace'
  5329. command, or its alias 'bt'. This command will print one line per frame
  5330. for frames in the stack. By default, all stack frames are printed. You
  5331. can stop the backtrace at any time by typing the system interrupt
  5332. character, normally 'Ctrl-c'.
  5333. 'backtrace [OPTION]... [QUALIFIER]... [COUNT]'
  5334. 'bt [OPTION]... [QUALIFIER]... [COUNT]'
  5335. Print the backtrace of the entire stack.
  5336. The optional COUNT can be one of the following:
  5337. 'N'
  5338. 'N'
  5339. Print only the innermost N frames, where N is a positive
  5340. number.
  5341. '-N'
  5342. '-N'
  5343. Print only the outermost N frames, where N is a positive
  5344. number.
  5345. Options:
  5346. '-full'
  5347. Print the values of the local variables also. This can be
  5348. combined with the optional COUNT to limit the number of frames
  5349. shown.
  5350. '-no-filters'
  5351. Do not run Python frame filters on this backtrace. *Note
  5352. Frame Filter API::, for more information. Additionally use
  5353. *note disable frame-filter all:: to turn off all frame
  5354. filters. This is only relevant when GDB has been configured
  5355. with 'Python' support.
  5356. '-hide'
  5357. A Python frame filter might decide to "elide" some frames.
  5358. Normally such elided frames are still printed, but they are
  5359. indented relative to the filtered frames that cause them to be
  5360. elided. The '-hide' option causes elided frames to not be
  5361. printed at all.
  5362. The 'backtrace' command also supports a number of options that
  5363. allow overriding relevant global print settings as set by 'set
  5364. backtrace' and 'set print' subcommands:
  5365. '-past-main [on|off]'
  5366. Set whether backtraces should continue past 'main'. Related
  5367. setting: *note set backtrace past-main::.
  5368. '-past-entry [on|off]'
  5369. Set whether backtraces should continue past the entry point of
  5370. a program. Related setting: *note set backtrace past-entry::.
  5371. '-entry-values no|only|preferred|if-needed|both|compact|default'
  5372. Set printing of function arguments at function entry. Related
  5373. setting: *note set print entry-values::.
  5374. '-frame-arguments all|scalars|none'
  5375. Set printing of non-scalar frame arguments. Related setting:
  5376. *note set print frame-arguments::.
  5377. '-raw-frame-arguments [on|off]'
  5378. Set whether to print frame arguments in raw form. Related
  5379. setting: *note set print raw-frame-arguments::.
  5380. '-frame-info auto|source-line|location|source-and-location|location-and-address|short-location'
  5381. Set printing of frame information. Related setting: *note set
  5382. print frame-info::.
  5383. The optional QUALIFIER is maintained for backward compatibility.
  5384. It can be one of the following:
  5385. 'full'
  5386. Equivalent to the '-full' option.
  5387. 'no-filters'
  5388. Equivalent to the '-no-filters' option.
  5389. 'hide'
  5390. Equivalent to the '-hide' option.
  5391. The names 'where' and 'info stack' (abbreviated 'info s') are
  5392. additional aliases for 'backtrace'.
  5393. In a multi-threaded program, GDB by default shows the backtrace only
  5394. for the current thread. To display the backtrace for several or all of
  5395. the threads, use the command 'thread apply' (*note thread apply:
  5396. Threads.). For example, if you type 'thread apply all backtrace', GDB
  5397. will display the backtrace for all the threads; this is handy when you
  5398. debug a core dump of a multi-threaded program.
  5399. Each line in the backtrace shows the frame number and the function
  5400. name. The program counter value is also shown--unless you use 'set
  5401. print address off'. The backtrace also shows the source file name and
  5402. line number, as well as the arguments to the function. The program
  5403. counter value is omitted if it is at the beginning of the code for that
  5404. line number.
  5405. Here is an example of a backtrace. It was made with the command 'bt
  5406. 3', so it shows the innermost three frames.
  5407. #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
  5408. at builtin.c:993
  5409. #1 0x6e38 in expand_macro (sym=0x2b600, data=...) at macro.c:242
  5410. #2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
  5411. at macro.c:71
  5412. (More stack frames follow...)
  5413. The display for frame zero does not begin with a program counter value,
  5414. indicating that your program has stopped at the beginning of the code
  5415. for line '993' of 'builtin.c'.
  5416. The value of parameter 'data' in frame 1 has been replaced by '...'. By
  5417. default, GDB prints the value of a parameter only if it is a scalar
  5418. (integer, pointer, enumeration, etc). See command 'set print
  5419. frame-arguments' in *note Print Settings:: for more details on how to
  5420. configure the way function parameter values are printed. The command
  5421. 'set print frame-info' (*note Print Settings::) controls what frame
  5422. information is printed.
  5423. If your program was compiled with optimizations, some compilers will
  5424. optimize away arguments passed to functions if those arguments are never
  5425. used after the call. Such optimizations generate code that passes
  5426. arguments through registers, but doesn't store those arguments in the
  5427. stack frame. GDB has no way of displaying such arguments in stack
  5428. frames other than the innermost one. Here's what such a backtrace might
  5429. look like:
  5430. #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
  5431. at builtin.c:993
  5432. #1 0x6e38 in expand_macro (sym=<optimized out>) at macro.c:242
  5433. #2 0x6840 in expand_token (obs=0x0, t=<optimized out>, td=0xf7fffb08)
  5434. at macro.c:71
  5435. (More stack frames follow...)
  5436. The values of arguments that were not saved in their stack frames are
  5437. shown as '<optimized out>'.
  5438. If you need to display the values of such optimized-out arguments,
  5439. either deduce that from other variables whose values depend on the one
  5440. you are interested in, or recompile without optimizations.
  5441. Most programs have a standard user entry point--a place where system
  5442. libraries and startup code transition into user code. For C this is
  5443. 'main'(1). When GDB finds the entry function in a backtrace it will
  5444. terminate the backtrace, to avoid tracing into highly system-specific
  5445. (and generally uninteresting) code.
  5446. If you need to examine the startup code, or limit the number of
  5447. levels in a backtrace, you can change this behavior:
  5448. 'set backtrace past-main'
  5449. 'set backtrace past-main on'
  5450. Backtraces will continue past the user entry point.
  5451. 'set backtrace past-main off'
  5452. Backtraces will stop when they encounter the user entry point.
  5453. This is the default.
  5454. 'show backtrace past-main'
  5455. Display the current user entry point backtrace policy.
  5456. 'set backtrace past-entry'
  5457. 'set backtrace past-entry on'
  5458. Backtraces will continue past the internal entry point of an
  5459. application. This entry point is encoded by the linker when the
  5460. application is built, and is likely before the user entry point
  5461. 'main' (or equivalent) is called.
  5462. 'set backtrace past-entry off'
  5463. Backtraces will stop when they encounter the internal entry point
  5464. of an application. This is the default.
  5465. 'show backtrace past-entry'
  5466. Display the current internal entry point backtrace policy.
  5467. 'set backtrace limit N'
  5468. 'set backtrace limit 0'
  5469. 'set backtrace limit unlimited'
  5470. Limit the backtrace to N levels. A value of 'unlimited' or zero
  5471. means unlimited levels.
  5472. 'show backtrace limit'
  5473. Display the current limit on backtrace levels.
  5474. You can control how file names are displayed.
  5475. 'set filename-display'
  5476. 'set filename-display relative'
  5477. Display file names relative to the compilation directory. This is
  5478. the default.
  5479. 'set filename-display basename'
  5480. Display only basename of a filename.
  5481. 'set filename-display absolute'
  5482. Display an absolute filename.
  5483. 'show filename-display'
  5484. Show the current way to display filenames.
  5485. ---------- Footnotes ----------
  5486. (1) Note that embedded programs (the so-called "free-standing"
  5487. environment) are not required to have a 'main' function as the entry
  5488. point. They could even have multiple entry points.
  5489. 
  5490. File: gdb.info, Node: Selection, Next: Frame Info, Prev: Backtrace, Up: Stack
  5491. 8.3 Selecting a Frame
  5492. =====================
  5493. Most commands for examining the stack and other data in your program
  5494. work on whichever stack frame is selected at the moment. Here are the
  5495. commands for selecting a stack frame; all of them finish by printing a
  5496. brief description of the stack frame just selected.
  5497. 'frame [ FRAME-SELECTION-SPEC ]'
  5498. 'f [ FRAME-SELECTION-SPEC ]'
  5499. The 'frame' command allows different stack frames to be selected.
  5500. The FRAME-SELECTION-SPEC can be any of the following:
  5501. 'NUM'
  5502. 'level NUM'
  5503. Select frame level NUM. Recall that frame zero is the
  5504. innermost (currently executing) frame, frame one is the frame
  5505. that called the innermost one, and so on. The highest level
  5506. frame is usually the one for 'main'.
  5507. As this is the most common method of navigating the frame
  5508. stack, the string 'level' can be omitted. For example, the
  5509. following two commands are equivalent:
  5510. (gdb) frame 3
  5511. (gdb) frame level 3
  5512. 'address STACK-ADDRESS'
  5513. Select the frame with stack address STACK-ADDRESS. The
  5514. STACK-ADDRESS for a frame can be seen in the output of 'info
  5515. frame', for example:
  5516. (gdb) info frame
  5517. Stack level 1, frame at 0x7fffffffda30:
  5518. rip = 0x40066d in b (amd64-entry-value.cc:59); saved rip 0x4004c5
  5519. tail call frame, caller of frame at 0x7fffffffda30
  5520. source language c++.
  5521. Arglist at unknown address.
  5522. Locals at unknown address, Previous frame's sp is 0x7fffffffda30
  5523. The STACK-ADDRESS for this frame is '0x7fffffffda30' as
  5524. indicated by the line:
  5525. Stack level 1, frame at 0x7fffffffda30:
  5526. 'function FUNCTION-NAME'
  5527. Select the stack frame for function FUNCTION-NAME. If there
  5528. are multiple stack frames for function FUNCTION-NAME then the
  5529. inner most stack frame is selected.
  5530. 'view STACK-ADDRESS [ PC-ADDR ]'
  5531. View a frame that is not part of GDB's backtrace. The frame
  5532. viewed has stack address STACK-ADDR, and optionally, a program
  5533. counter address of PC-ADDR.
  5534. This is useful mainly if the chaining of stack frames has been
  5535. damaged by a bug, making it impossible for GDB to assign
  5536. numbers properly to all frames. In addition, this can be
  5537. useful when your program has multiple stacks and switches
  5538. between them.
  5539. When viewing a frame outside the current backtrace using
  5540. 'frame view' then you can always return to the original stack
  5541. using one of the previous stack frame selection instructions,
  5542. for example 'frame level 0'.
  5543. 'up N'
  5544. Move N frames up the stack; N defaults to 1. For positive numbers
  5545. N, this advances toward the outermost frame, to higher frame
  5546. numbers, to frames that have existed longer.
  5547. 'down N'
  5548. Move N frames down the stack; N defaults to 1. For positive
  5549. numbers N, this advances toward the innermost frame, to lower frame
  5550. numbers, to frames that were created more recently. You may
  5551. abbreviate 'down' as 'do'.
  5552. All of these commands end by printing two lines of output describing
  5553. the frame. The first line shows the frame number, the function name,
  5554. the arguments, and the source file and line number of execution in that
  5555. frame. The second line shows the text of that source line.
  5556. For example:
  5557. (gdb) up
  5558. #1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc)
  5559. at env.c:10
  5560. 10 read_input_file (argv[i]);
  5561. After such a printout, the 'list' command with no arguments prints
  5562. ten lines centered on the point of execution in the frame. You can also
  5563. edit the program at the point of execution with your favorite editing
  5564. program by typing 'edit'. *Note Printing Source Lines: List, for
  5565. details.
  5566. 'select-frame [ FRAME-SELECTION-SPEC ]'
  5567. The 'select-frame' command is a variant of 'frame' that does not
  5568. display the new frame after selecting it. This command is intended
  5569. primarily for use in GDB command scripts, where the output might be
  5570. unnecessary and distracting. The FRAME-SELECTION-SPEC is as for
  5571. the 'frame' command described in *note Selecting a Frame:
  5572. Selection.
  5573. 'up-silently N'
  5574. 'down-silently N'
  5575. These two commands are variants of 'up' and 'down', respectively;
  5576. they differ in that they do their work silently, without causing
  5577. display of the new frame. They are intended primarily for use in
  5578. GDB command scripts, where the output might be unnecessary and
  5579. distracting.
  5580. 
  5581. File: gdb.info, Node: Frame Info, Next: Frame Apply, Prev: Selection, Up: Stack
  5582. 8.4 Information About a Frame
  5583. =============================
  5584. There are several other commands to print information about the selected
  5585. stack frame.
  5586. 'frame'
  5587. 'f'
  5588. When used without any argument, this command does not change which
  5589. frame is selected, but prints a brief description of the currently
  5590. selected stack frame. It can be abbreviated 'f'. With an
  5591. argument, this command is used to select a stack frame. *Note
  5592. Selecting a Frame: Selection.
  5593. 'info frame'
  5594. 'info f'
  5595. This command prints a verbose description of the selected stack
  5596. frame, including:
  5597. * the address of the frame
  5598. * the address of the next frame down (called by this frame)
  5599. * the address of the next frame up (caller of this frame)
  5600. * the language in which the source code corresponding to this
  5601. frame is written
  5602. * the address of the frame's arguments
  5603. * the address of the frame's local variables
  5604. * the program counter saved in it (the address of execution in
  5605. the caller frame)
  5606. * which registers were saved in the frame
  5607. The verbose description is useful when something has gone wrong
  5608. that has made the stack format fail to fit the usual conventions.
  5609. 'info frame [ FRAME-SELECTION-SPEC ]'
  5610. 'info f [ FRAME-SELECTION-SPEC ]'
  5611. Print a verbose description of the frame selected by
  5612. FRAME-SELECTION-SPEC. The FRAME-SELECTION-SPEC is the same as for
  5613. the 'frame' command (*note Selecting a Frame: Selection.). The
  5614. selected frame remains unchanged by this command.
  5615. 'info args [-q]'
  5616. Print the arguments of the selected frame, each on a separate line.
  5617. The optional flag '-q', which stands for 'quiet', disables printing
  5618. header information and messages explaining why no argument have
  5619. been printed.
  5620. 'info args [-q] [-t TYPE_REGEXP] [REGEXP]'
  5621. Like 'info args', but only print the arguments selected with the
  5622. provided regexp(s).
  5623. If REGEXP is provided, print only the arguments whose names match
  5624. the regular expression REGEXP.
  5625. If TYPE_REGEXP is provided, print only the arguments whose types,
  5626. as printed by the 'whatis' command, match the regular expression
  5627. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  5628. enclosed in quote characters. If needed, use backslash to escape
  5629. the meaning of special characters or quotes.
  5630. If both REGEXP and TYPE_REGEXP are provided, an argument is printed
  5631. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  5632. 'info locals [-q]'
  5633. Print the local variables of the selected frame, each on a separate
  5634. line. These are all variables (declared either static or
  5635. automatic) accessible at the point of execution of the selected
  5636. frame.
  5637. The optional flag '-q', which stands for 'quiet', disables printing
  5638. header information and messages explaining why no local variables
  5639. have been printed.
  5640. 'info locals [-q] [-t TYPE_REGEXP] [REGEXP]'
  5641. Like 'info locals', but only print the local variables selected
  5642. with the provided regexp(s).
  5643. If REGEXP is provided, print only the local variables whose names
  5644. match the regular expression REGEXP.
  5645. If TYPE_REGEXP is provided, print only the local variables whose
  5646. types, as printed by the 'whatis' command, match the regular
  5647. expression TYPE_REGEXP. If TYPE_REGEXP contains space(s), it
  5648. should be enclosed in quote characters. If needed, use backslash
  5649. to escape the meaning of special characters or quotes.
  5650. If both REGEXP and TYPE_REGEXP are provided, a local variable is
  5651. printed only if its name matches REGEXP and its type matches
  5652. TYPE_REGEXP.
  5653. The command 'info locals -q -t TYPE_REGEXP' can usefully be
  5654. combined with the commands 'frame apply' and 'thread apply'. For
  5655. example, your program might use Resource Acquisition Is
  5656. Initialization types (RAII) such as 'lock_something_t': each local
  5657. variable of type 'lock_something_t' automatically places a lock
  5658. that is destroyed when the variable goes out of scope. You can
  5659. then list all acquired locks in your program by doing
  5660. thread apply all -s frame apply all -s info locals -q -t lock_something_t
  5661. or the equivalent shorter form
  5662. tfaas i lo -q -t lock_something_t
  5663. 
  5664. File: gdb.info, Node: Frame Apply, Next: Frame Filter Management, Prev: Frame Info, Up: Stack
  5665. 8.5 Applying a Command to Several Frames.
  5666. =========================================
  5667. 'frame apply [all | COUNT | -COUNT | level LEVEL...] [OPTION]... COMMAND'
  5668. The 'frame apply' command allows you to apply the named COMMAND to
  5669. one or more frames.
  5670. 'all'
  5671. Specify 'all' to apply COMMAND to all frames.
  5672. 'COUNT'
  5673. Use COUNT to apply COMMAND to the innermost COUNT frames,
  5674. where COUNT is a positive number.
  5675. '-COUNT'
  5676. Use -COUNT to apply COMMAND to the outermost COUNT frames,
  5677. where COUNT is a positive number.
  5678. 'level'
  5679. Use 'level' to apply COMMAND to the set of frames identified
  5680. by the LEVEL list. LEVEL is a frame level or a range of frame
  5681. levels as LEVEL1-LEVEL2. The frame level is the number shown
  5682. in the first field of the 'backtrace' command output. E.g.,
  5683. '2-4 6-8 3' indicates to apply COMMAND for the frames at
  5684. levels 2, 3, 4, 6, 7, 8, and then again on frame at level 3.
  5685. Note that the frames on which 'frame apply' applies a command are
  5686. also influenced by the 'set backtrace' settings such as 'set
  5687. backtrace past-main' and 'set backtrace limit N'. *Note
  5688. Backtraces: Backtrace.
  5689. The 'frame apply' command also supports a number of options that
  5690. allow overriding relevant 'set backtrace' settings:
  5691. '-past-main [on|off]'
  5692. Whether backtraces should continue past 'main'. Related
  5693. setting: *note set backtrace past-main::.
  5694. '-past-entry [on|off]'
  5695. Whether backtraces should continue past the entry point of a
  5696. program. Related setting: *note set backtrace past-entry::.
  5697. By default, GDB displays some frame information before the output
  5698. produced by COMMAND, and an error raised during the execution of a
  5699. COMMAND will abort 'frame apply'. The following options can be
  5700. used to fine-tune these behaviors:
  5701. '-c'
  5702. The flag '-c', which stands for 'continue', causes any errors
  5703. in COMMAND to be displayed, and the execution of 'frame apply'
  5704. then continues.
  5705. '-s'
  5706. The flag '-s', which stands for 'silent', causes any errors or
  5707. empty output produced by a COMMAND to be silently ignored.
  5708. That is, the execution continues, but the frame information
  5709. and errors are not printed.
  5710. '-q'
  5711. The flag '-q' ('quiet') disables printing the frame
  5712. information.
  5713. The following example shows how the flags '-c' and '-s' are working
  5714. when applying the command 'p j' to all frames, where variable 'j'
  5715. can only be successfully printed in the outermost '#1 main' frame.
  5716. (gdb) frame apply all p j
  5717. #0 some_function (i=5) at fun.c:4
  5718. No symbol "j" in current context.
  5719. (gdb) frame apply all -c p j
  5720. #0 some_function (i=5) at fun.c:4
  5721. No symbol "j" in current context.
  5722. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5723. $1 = 5
  5724. (gdb) frame apply all -s p j
  5725. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5726. $2 = 5
  5727. (gdb)
  5728. By default, 'frame apply', prints the frame location information
  5729. before the command output:
  5730. (gdb) frame apply all p $sp
  5731. #0 some_function (i=5) at fun.c:4
  5732. $4 = (void *) 0xffffd1e0
  5733. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5734. $5 = (void *) 0xffffd1f0
  5735. (gdb)
  5736. If the flag '-q' is given, no frame information is printed:
  5737. (gdb) frame apply all -q p $sp
  5738. $12 = (void *) 0xffffd1e0
  5739. $13 = (void *) 0xffffd1f0
  5740. (gdb)
  5741. 'faas COMMAND'
  5742. Shortcut for 'frame apply all -s COMMAND'. Applies COMMAND on all
  5743. frames, ignoring errors and empty output.
  5744. It can for example be used to print a local variable or a function
  5745. argument without knowing the frame where this variable or argument
  5746. is, using:
  5747. (gdb) faas p some_local_var_i_do_not_remember_where_it_is
  5748. The 'faas' command accepts the same options as the 'frame apply'
  5749. command. *Note frame apply: Frame Apply.
  5750. Note that the command 'tfaas COMMAND' applies COMMAND on all frames
  5751. of all threads. See *Note Threads: Threads.
  5752. 
  5753. File: gdb.info, Node: Frame Filter Management, Prev: Frame Apply, Up: Stack
  5754. 8.6 Management of Frame Filters.
  5755. ================================
  5756. Frame filters are Python based utilities to manage and decorate the
  5757. output of frames. *Note Frame Filter API::, for further information.
  5758. Managing frame filters is performed by several commands available
  5759. within GDB, detailed here.
  5760. 'info frame-filter'
  5761. Print a list of installed frame filters from all dictionaries,
  5762. showing their name, priority and enabled status.
  5763. 'disable frame-filter FILTER-DICTIONARY FILTER-NAME'
  5764. Disable a frame filter in the dictionary matching FILTER-DICTIONARY
  5765. and FILTER-NAME. The FILTER-DICTIONARY may be 'all', 'global',
  5766. 'progspace', or the name of the object file where the frame filter
  5767. dictionary resides. When 'all' is specified, all frame filters
  5768. across all dictionaries are disabled. The FILTER-NAME is the name
  5769. of the frame filter and is used when 'all' is not the option for
  5770. FILTER-DICTIONARY. A disabled frame-filter is not deleted, it may
  5771. be enabled again later.
  5772. 'enable frame-filter FILTER-DICTIONARY FILTER-NAME'
  5773. Enable a frame filter in the dictionary matching FILTER-DICTIONARY
  5774. and FILTER-NAME. The FILTER-DICTIONARY may be 'all', 'global',
  5775. 'progspace' or the name of the object file where the frame filter
  5776. dictionary resides. When 'all' is specified, all frame filters
  5777. across all dictionaries are enabled. The FILTER-NAME is the name
  5778. of the frame filter and is used when 'all' is not the option for
  5779. FILTER-DICTIONARY.
  5780. Example:
  5781. (gdb) info frame-filter
  5782. global frame-filters:
  5783. Priority Enabled Name
  5784. 1000 No PrimaryFunctionFilter
  5785. 100 Yes Reverse
  5786. progspace /build/test frame-filters:
  5787. Priority Enabled Name
  5788. 100 Yes ProgspaceFilter
  5789. objfile /build/test frame-filters:
  5790. Priority Enabled Name
  5791. 999 Yes BuildProgramFilter
  5792. (gdb) disable frame-filter /build/test BuildProgramFilter
  5793. (gdb) info frame-filter
  5794. global frame-filters:
  5795. Priority Enabled Name
  5796. 1000 No PrimaryFunctionFilter
  5797. 100 Yes Reverse
  5798. progspace /build/test frame-filters:
  5799. Priority Enabled Name
  5800. 100 Yes ProgspaceFilter
  5801. objfile /build/test frame-filters:
  5802. Priority Enabled Name
  5803. 999 No BuildProgramFilter
  5804. (gdb) enable frame-filter global PrimaryFunctionFilter
  5805. (gdb) info frame-filter
  5806. global frame-filters:
  5807. Priority Enabled Name
  5808. 1000 Yes PrimaryFunctionFilter
  5809. 100 Yes Reverse
  5810. progspace /build/test frame-filters:
  5811. Priority Enabled Name
  5812. 100 Yes ProgspaceFilter
  5813. objfile /build/test frame-filters:
  5814. Priority Enabled Name
  5815. 999 No BuildProgramFilter
  5816. 'set frame-filter priority FILTER-DICTIONARY FILTER-NAME PRIORITY'
  5817. Set the PRIORITY of a frame filter in the dictionary matching
  5818. FILTER-DICTIONARY, and the frame filter name matching FILTER-NAME.
  5819. The FILTER-DICTIONARY may be 'global', 'progspace' or the name of
  5820. the object file where the frame filter dictionary resides. The
  5821. PRIORITY is an integer.
  5822. 'show frame-filter priority FILTER-DICTIONARY FILTER-NAME'
  5823. Show the PRIORITY of a frame filter in the dictionary matching
  5824. FILTER-DICTIONARY, and the frame filter name matching FILTER-NAME.
  5825. The FILTER-DICTIONARY may be 'global', 'progspace' or the name of
  5826. the object file where the frame filter dictionary resides.
  5827. Example:
  5828. (gdb) info frame-filter
  5829. global frame-filters:
  5830. Priority Enabled Name
  5831. 1000 Yes PrimaryFunctionFilter
  5832. 100 Yes Reverse
  5833. progspace /build/test frame-filters:
  5834. Priority Enabled Name
  5835. 100 Yes ProgspaceFilter
  5836. objfile /build/test frame-filters:
  5837. Priority Enabled Name
  5838. 999 No BuildProgramFilter
  5839. (gdb) set frame-filter priority global Reverse 50
  5840. (gdb) info frame-filter
  5841. global frame-filters:
  5842. Priority Enabled Name
  5843. 1000 Yes PrimaryFunctionFilter
  5844. 50 Yes Reverse
  5845. progspace /build/test frame-filters:
  5846. Priority Enabled Name
  5847. 100 Yes ProgspaceFilter
  5848. objfile /build/test frame-filters:
  5849. Priority Enabled Name
  5850. 999 No BuildProgramFilter
  5851. 
  5852. File: gdb.info, Node: Source, Next: Data, Prev: Stack, Up: Top
  5853. 9 Examining Source Files
  5854. ************************
  5855. GDB can print parts of your program's source, since the debugging
  5856. information recorded in the program tells GDB what source files were
  5857. used to build it. When your program stops, GDB spontaneously prints the
  5858. line where it stopped. Likewise, when you select a stack frame (*note
  5859. Selecting a Frame: Selection.), GDB prints the line where execution in
  5860. that frame has stopped. You can print other portions of source files by
  5861. explicit command.
  5862. If you use GDB through its GNU Emacs interface, you may prefer to use
  5863. Emacs facilities to view source; see *note Using GDB under GNU Emacs:
  5864. Emacs.
  5865. * Menu:
  5866. * List:: Printing source lines
  5867. * Specify Location:: How to specify code locations
  5868. * Edit:: Editing source files
  5869. * Search:: Searching source files
  5870. * Source Path:: Specifying source directories
  5871. * Machine Code:: Source and machine code
  5872. 
  5873. File: gdb.info, Node: List, Next: Specify Location, Up: Source
  5874. 9.1 Printing Source Lines
  5875. =========================
  5876. To print lines from a source file, use the 'list' command (abbreviated
  5877. 'l'). By default, ten lines are printed. There are several ways to
  5878. specify what part of the file you want to print; see *note Specify
  5879. Location::, for the full list.
  5880. Here are the forms of the 'list' command most commonly used:
  5881. 'list LINENUM'
  5882. Print lines centered around line number LINENUM in the current
  5883. source file.
  5884. 'list FUNCTION'
  5885. Print lines centered around the beginning of function FUNCTION.
  5886. 'list'
  5887. Print more lines. If the last lines printed were printed with a
  5888. 'list' command, this prints lines following the last lines printed;
  5889. however, if the last line printed was a solitary line printed as
  5890. part of displaying a stack frame (*note Examining the Stack:
  5891. Stack.), this prints lines centered around that line.
  5892. 'list -'
  5893. Print lines just before the lines last printed.
  5894. By default, GDB prints ten source lines with any of these forms of
  5895. the 'list' command. You can change this using 'set listsize':
  5896. 'set listsize COUNT'
  5897. 'set listsize unlimited'
  5898. Make the 'list' command display COUNT source lines (unless the
  5899. 'list' argument explicitly specifies some other number). Setting
  5900. COUNT to 'unlimited' or 0 means there's no limit.
  5901. 'show listsize'
  5902. Display the number of lines that 'list' prints.
  5903. Repeating a 'list' command with <RET> discards the argument, so it is
  5904. equivalent to typing just 'list'. This is more useful than listing the
  5905. same lines again. An exception is made for an argument of '-'; that
  5906. argument is preserved in repetition so that each repetition moves up in
  5907. the source file.
  5908. In general, the 'list' command expects you to supply zero, one or two
  5909. "locations". Locations specify source lines; there are several ways of
  5910. writing them (*note Specify Location::), but the effect is always to
  5911. specify some source line.
  5912. Here is a complete description of the possible arguments for 'list':
  5913. 'list LOCATION'
  5914. Print lines centered around the line specified by LOCATION.
  5915. 'list FIRST,LAST'
  5916. Print lines from FIRST to LAST. Both arguments are locations.
  5917. When a 'list' command has two locations, and the source file of the
  5918. second location is omitted, this refers to the same source file as
  5919. the first location.
  5920. 'list ,LAST'
  5921. Print lines ending with LAST.
  5922. 'list FIRST,'
  5923. Print lines starting with FIRST.
  5924. 'list +'
  5925. Print lines just after the lines last printed.
  5926. 'list -'
  5927. Print lines just before the lines last printed.
  5928. 'list'
  5929. As described in the preceding table.
  5930. 
  5931. File: gdb.info, Node: Specify Location, Next: Edit, Prev: List, Up: Source
  5932. 9.2 Specifying a Location
  5933. =========================
  5934. * Menu:
  5935. * Linespec Locations:: Linespec locations
  5936. * Explicit Locations:: Explicit locations
  5937. * Address Locations:: Address locations
  5938. Several GDB commands accept arguments that specify a location of your
  5939. program's code. Since GDB is a source-level debugger, a location
  5940. usually specifies some line in the source code. Locations may be
  5941. specified using three different formats: linespec locations, explicit
  5942. locations, or address locations.
  5943. 
  5944. File: gdb.info, Node: Linespec Locations, Next: Explicit Locations, Up: Specify Location
  5945. 9.2.1 Linespec Locations
  5946. ------------------------
  5947. A "linespec" is a colon-separated list of source location parameters
  5948. such as file name, function name, etc. Here are all the different ways
  5949. of specifying a linespec:
  5950. 'LINENUM'
  5951. Specifies the line number LINENUM of the current source file.
  5952. '-OFFSET'
  5953. '+OFFSET'
  5954. Specifies the line OFFSET lines before or after the "current line".
  5955. For the 'list' command, the current line is the last one printed;
  5956. for the breakpoint commands, this is the line at which execution
  5957. stopped in the currently selected "stack frame" (*note Frames:
  5958. Frames, for a description of stack frames.) When used as the
  5959. second of the two linespecs in a 'list' command, this specifies the
  5960. line OFFSET lines up or down from the first linespec.
  5961. 'FILENAME:LINENUM'
  5962. Specifies the line LINENUM in the source file FILENAME. If
  5963. FILENAME is a relative file name, then it will match any source
  5964. file name with the same trailing components. For example, if
  5965. FILENAME is 'gcc/expr.c', then it will match source file name of
  5966. '/build/trunk/gcc/expr.c', but not '/build/trunk/libcpp/expr.c' or
  5967. '/build/trunk/gcc/x-expr.c'.
  5968. 'FUNCTION'
  5969. Specifies the line that begins the body of the function FUNCTION.
  5970. For example, in C, this is the line with the open brace.
  5971. By default, in C++ and Ada, FUNCTION is interpreted as specifying
  5972. all functions named FUNCTION in all scopes. For C++, this means in
  5973. all namespaces and classes. For Ada, this means in all packages.
  5974. For example, assuming a program with C++ symbols named 'A::B::func'
  5975. and 'B::func', both commands 'break func' and 'break B::func' set a
  5976. breakpoint on both symbols.
  5977. Commands that accept a linespec let you override this with the
  5978. '-qualified' option. For example, 'break -qualified func' sets a
  5979. breakpoint on a free-function named 'func' ignoring any C++ class
  5980. methods and namespace functions called 'func'.
  5981. *Note Explicit Locations::.
  5982. 'FUNCTION:LABEL'
  5983. Specifies the line where LABEL appears in FUNCTION.
  5984. 'FILENAME:FUNCTION'
  5985. Specifies the line that begins the body of the function FUNCTION in
  5986. the file FILENAME. You only need the file name with a function
  5987. name to avoid ambiguity when there are identically named functions
  5988. in different source files.
  5989. 'LABEL'
  5990. Specifies the line at which the label named LABEL appears in the
  5991. function corresponding to the currently selected stack frame. If
  5992. there is no current selected stack frame (for instance, if the
  5993. inferior is not running), then GDB will not search for a label.
  5994. '-pstap|-probe-stap [OBJFILE:[PROVIDER:]]NAME'
  5995. The GNU/Linux tool 'SystemTap' provides a way for applications to
  5996. embed static probes. *Note Static Probe Points::, for more
  5997. information on finding and using static probes. This form of
  5998. linespec specifies the location of such a static probe.
  5999. If OBJFILE is given, only probes coming from that shared library or
  6000. executable matching OBJFILE as a regular expression are considered.
  6001. If PROVIDER is given, then only probes from that provider are
  6002. considered. If several probes match the spec, GDB will insert a
  6003. breakpoint at each one of those probes.
  6004. 
  6005. File: gdb.info, Node: Explicit Locations, Next: Address Locations, Prev: Linespec Locations, Up: Specify Location
  6006. 9.2.2 Explicit Locations
  6007. ------------------------
  6008. "Explicit locations" allow the user to directly specify the source
  6009. location's parameters using option-value pairs.
  6010. Explicit locations are useful when several functions, labels, or file
  6011. names have the same name (base name for files) in the program's sources.
  6012. In these cases, explicit locations point to the source line you meant
  6013. more accurately and unambiguously. Also, using explicit locations might
  6014. be faster in large programs.
  6015. For example, the linespec 'foo:bar' may refer to a function 'bar'
  6016. defined in the file named 'foo' or the label 'bar' in a function named
  6017. 'foo'. GDB must search either the file system or the symbol table to
  6018. know.
  6019. The list of valid explicit location options is summarized in the
  6020. following table:
  6021. '-source FILENAME'
  6022. The value specifies the source file name. To differentiate between
  6023. files with the same base name, prepend as many directories as is
  6024. necessary to uniquely identify the desired file, e.g.,
  6025. 'foo/bar/baz.c'. Otherwise GDB will use the first file it finds
  6026. with the given base name. This option requires the use of either
  6027. '-function' or '-line'.
  6028. '-function FUNCTION'
  6029. The value specifies the name of a function. Operations on function
  6030. locations unmodified by other options (such as '-label' or '-line')
  6031. refer to the line that begins the body of the function. In C, for
  6032. example, this is the line with the open brace.
  6033. By default, in C++ and Ada, FUNCTION is interpreted as specifying
  6034. all functions named FUNCTION in all scopes. For C++, this means in
  6035. all namespaces and classes. For Ada, this means in all packages.
  6036. For example, assuming a program with C++ symbols named 'A::B::func'
  6037. and 'B::func', both commands 'break -function func' and
  6038. 'break -function B::func' set a breakpoint on both symbols.
  6039. You can use the '-qualified' flag to override this (see below).
  6040. '-qualified'
  6041. This flag makes GDB interpret a function name specified with
  6042. '-function' as a complete fully-qualified name.
  6043. For example, assuming a C++ program with symbols named 'A::B::func'
  6044. and 'B::func', the 'break -qualified -function B::func' command
  6045. sets a breakpoint on 'B::func', only.
  6046. (Note: the '-qualified' option can precede a linespec as well
  6047. (*note Linespec Locations::), so the particular example above could
  6048. be simplified as 'break -qualified B::func'.)
  6049. '-label LABEL'
  6050. The value specifies the name of a label. When the function name is
  6051. not specified, the label is searched in the function of the
  6052. currently selected stack frame.
  6053. '-line NUMBER'
  6054. The value specifies a line offset for the location. The offset may
  6055. either be absolute ('-line 3') or relative ('-line +3'), depending
  6056. on the command. When specified without any other options, the line
  6057. offset is relative to the current line.
  6058. Explicit location options may be abbreviated by omitting any
  6059. non-unique trailing characters from the option name, e.g.,
  6060. 'break -s main.c -li 3'.
  6061. 
  6062. File: gdb.info, Node: Address Locations, Prev: Explicit Locations, Up: Specify Location
  6063. 9.2.3 Address Locations
  6064. -----------------------
  6065. "Address locations" indicate a specific program address. They have the
  6066. generalized form *ADDRESS.
  6067. For line-oriented commands, such as 'list' and 'edit', this specifies
  6068. a source line that contains ADDRESS. For 'break' and other
  6069. breakpoint-oriented commands, this can be used to set breakpoints in
  6070. parts of your program which do not have debugging information or source
  6071. files.
  6072. Here ADDRESS may be any expression valid in the current working
  6073. language (*note working language: Languages.) that specifies a code
  6074. address. In addition, as a convenience, GDB extends the semantics of
  6075. expressions used in locations to cover several situations that
  6076. frequently occur during debugging. Here are the various forms of
  6077. ADDRESS:
  6078. 'EXPRESSION'
  6079. Any expression valid in the current working language.
  6080. 'FUNCADDR'
  6081. An address of a function or procedure derived from its name. In C,
  6082. C++, Objective-C, Fortran, minimal, and assembly, this is simply
  6083. the function's name FUNCTION (and actually a special case of a
  6084. valid expression). In Pascal and Modula-2, this is '&FUNCTION'.
  6085. In Ada, this is 'FUNCTION'Address' (although the Pascal form also
  6086. works).
  6087. This form specifies the address of the function's first
  6088. instruction, before the stack frame and arguments have been set up.
  6089. ''FILENAME':FUNCADDR'
  6090. Like FUNCADDR above, but also specifies the name of the source file
  6091. explicitly. This is useful if the name of the function does not
  6092. specify the function unambiguously, e.g., if there are several
  6093. functions with identical names in different source files.
  6094. 
  6095. File: gdb.info, Node: Edit, Next: Search, Prev: Specify Location, Up: Source
  6096. 9.3 Editing Source Files
  6097. ========================
  6098. To edit the lines in a source file, use the 'edit' command. The editing
  6099. program of your choice is invoked with the current line set to the
  6100. active line in the program. Alternatively, there are several ways to
  6101. specify what part of the file you want to print if you want to see other
  6102. parts of the program:
  6103. 'edit LOCATION'
  6104. Edit the source file specified by 'location'. Editing starts at
  6105. that LOCATION, e.g., at the specified source line of the specified
  6106. file. *Note Specify Location::, for all the possible forms of the
  6107. LOCATION argument; here are the forms of the 'edit' command most
  6108. commonly used:
  6109. 'edit NUMBER'
  6110. Edit the current source file with NUMBER as the active line
  6111. number.
  6112. 'edit FUNCTION'
  6113. Edit the file containing FUNCTION at the beginning of its
  6114. definition.
  6115. 9.3.1 Choosing your Editor
  6116. --------------------------
  6117. You can customize GDB to use any editor you want (1). By default, it is
  6118. '/bin/ex', but you can change this by setting the environment variable
  6119. 'EDITOR' before using GDB. For example, to configure GDB to use the
  6120. 'vi' editor, you could use these commands with the 'sh' shell:
  6121. EDITOR=/usr/bin/vi
  6122. export EDITOR
  6123. gdb ...
  6124. or in the 'csh' shell,
  6125. setenv EDITOR /usr/bin/vi
  6126. gdb ...
  6127. ---------- Footnotes ----------
  6128. (1) The only restriction is that your editor (say 'ex'), recognizes
  6129. the following command-line syntax:
  6130. ex +NUMBER file
  6131. The optional numeric value +NUMBER specifies the number of the line
  6132. in the file where to start editing.
  6133. 
  6134. File: gdb.info, Node: Search, Next: Source Path, Prev: Edit, Up: Source
  6135. 9.4 Searching Source Files
  6136. ==========================
  6137. There are two commands for searching through the current source file for
  6138. a regular expression.
  6139. 'forward-search REGEXP'
  6140. 'search REGEXP'
  6141. The command 'forward-search REGEXP' checks each line, starting with
  6142. the one following the last line listed, for a match for REGEXP. It
  6143. lists the line that is found. You can use the synonym 'search
  6144. REGEXP' or abbreviate the command name as 'fo'.
  6145. 'reverse-search REGEXP'
  6146. The command 'reverse-search REGEXP' checks each line, starting with
  6147. the one before the last line listed and going backward, for a match
  6148. for REGEXP. It lists the line that is found. You can abbreviate
  6149. this command as 'rev'.
  6150. 
  6151. File: gdb.info, Node: Source Path, Next: Machine Code, Prev: Search, Up: Source
  6152. 9.5 Specifying Source Directories
  6153. =================================
  6154. Executable programs sometimes do not record the directories of the
  6155. source files from which they were compiled, just the names. Even when
  6156. they do, the directories could be moved between the compilation and your
  6157. debugging session. GDB has a list of directories to search for source
  6158. files; this is called the "source path". Each time GDB wants a source
  6159. file, it tries all the directories in the list, in the order they are
  6160. present in the list, until it finds a file with the desired name.
  6161. For example, suppose an executable references the file
  6162. '/usr/src/foo-1.0/lib/foo.c', does not record a compilation directory,
  6163. and the "source path" is '/mnt/cross'. GDB would look for the source
  6164. file in the following locations:
  6165. 1. '/usr/src/foo-1.0/lib/foo.c'
  6166. 2. '/mnt/cross/usr/src/foo-1.0/lib/foo.c'
  6167. 3. '/mnt/cross/foo.c'
  6168. If the source file is not present at any of the above locations then
  6169. an error is printed. GDB does not look up the parts of the source file
  6170. name, such as '/mnt/cross/src/foo-1.0/lib/foo.c'. Likewise, the
  6171. subdirectories of the source path are not searched: if the source path
  6172. is '/mnt/cross', and the binary refers to 'foo.c', GDB would not find it
  6173. under '/mnt/cross/usr/src/foo-1.0/lib'.
  6174. Plain file names, relative file names with leading directories, file
  6175. names containing dots, etc. are all treated as described above, except
  6176. that non-absolute file names are not looked up literally. If the
  6177. "source path" is '/mnt/cross', the source file is recorded as
  6178. '../lib/foo.c', and no compilation directory is recorded, then GDB will
  6179. search in the following locations:
  6180. 1. '/mnt/cross/../lib/foo.c'
  6181. 2. '/mnt/cross/foo.c'
  6182. The "source path" will always include two special entries '$cdir' and
  6183. '$cwd', these refer to the compilation directory (if one is recorded)
  6184. and the current working directory respectively.
  6185. '$cdir' causes GDB to search within the compilation directory, if one
  6186. is recorded in the debug information. If no compilation directory is
  6187. recorded in the debug information then '$cdir' is ignored.
  6188. '$cwd' is not the same as '.'--the former tracks the current working
  6189. directory as it changes during your GDB session, while the latter is
  6190. immediately expanded to the current directory at the time you add an
  6191. entry to the source path.
  6192. If a compilation directory is recorded in the debug information, and
  6193. GDB has not found the source file after the first search using "source
  6194. path", then GDB will combine the compilation directory and the filename,
  6195. and then search for the source file again using the "source path".
  6196. For example, if the executable records the source file as
  6197. '/usr/src/foo-1.0/lib/foo.c', the compilation directory is recorded as
  6198. '/project/build', and the "source path" is '/mnt/cross:$cdir:$cwd' while
  6199. the current working directory of the GDB session is '/home/user', then
  6200. GDB will search for the source file in the following locations:
  6201. 1. '/usr/src/foo-1.0/lib/foo.c'
  6202. 2. '/mnt/cross/usr/src/foo-1.0/lib/foo.c'
  6203. 3. '/project/build/usr/src/foo-1.0/lib/foo.c'
  6204. 4. '/home/user/usr/src/foo-1.0/lib/foo.c'
  6205. 5. '/mnt/cross/project/build/usr/src/foo-1.0/lib/foo.c'
  6206. 6. '/project/build/project/build/usr/src/foo-1.0/lib/foo.c'
  6207. 7. '/home/user/project/build/usr/src/foo-1.0/lib/foo.c'
  6208. 8. '/mnt/cross/foo.c'
  6209. 9. '/project/build/foo.c'
  6210. 10. '/home/user/foo.c'
  6211. If the file name in the previous example had been recorded in the
  6212. executable as a relative path rather than an absolute path, then the
  6213. first look up would not have occurred, but all of the remaining steps
  6214. would be similar.
  6215. When searching for source files on MS-DOS and MS-Windows, where
  6216. absolute paths start with a drive letter (e.g. 'C:/project/foo.c'), GDB
  6217. will remove the drive letter from the file name before appending it to a
  6218. search directory from "source path"; for instance if the executable
  6219. references the source file 'C:/project/foo.c' and "source path" is set
  6220. to 'D:/mnt/cross', then GDB will search in the following locations for
  6221. the source file:
  6222. 1. 'C:/project/foo.c'
  6223. 2. 'D:/mnt/cross/project/foo.c'
  6224. 3. 'D:/mnt/cross/foo.c'
  6225. Note that the executable search path is _not_ used to locate the
  6226. source files.
  6227. Whenever you reset or rearrange the source path, GDB clears out any
  6228. information it has cached about where source files are found and where
  6229. each line is in the file.
  6230. When you start GDB, its source path includes only '$cdir' and '$cwd',
  6231. in that order. To add other directories, use the 'directory' command.
  6232. The search path is used to find both program source files and GDB
  6233. script files (read using the '-command' option and 'source' command).
  6234. In addition to the source path, GDB provides a set of commands that
  6235. manage a list of source path substitution rules. A "substitution rule"
  6236. specifies how to rewrite source directories stored in the program's
  6237. debug information in case the sources were moved to a different
  6238. directory between compilation and debugging. A rule is made of two
  6239. strings, the first specifying what needs to be rewritten in the path,
  6240. and the second specifying how it should be rewritten. In *note set
  6241. substitute-path::, we name these two parts FROM and TO respectively.
  6242. GDB does a simple string replacement of FROM with TO at the start of the
  6243. directory part of the source file name, and uses that result instead of
  6244. the original file name to look up the sources.
  6245. Using the previous example, suppose the 'foo-1.0' tree has been moved
  6246. from '/usr/src' to '/mnt/cross', then you can tell GDB to replace
  6247. '/usr/src' in all source path names with '/mnt/cross'. The first lookup
  6248. will then be '/mnt/cross/foo-1.0/lib/foo.c' in place of the original
  6249. location of '/usr/src/foo-1.0/lib/foo.c'. To define a source path
  6250. substitution rule, use the 'set substitute-path' command (*note set
  6251. substitute-path::).
  6252. To avoid unexpected substitution results, a rule is applied only if
  6253. the FROM part of the directory name ends at a directory separator. For
  6254. instance, a rule substituting '/usr/source' into '/mnt/cross' will be
  6255. applied to '/usr/source/foo-1.0' but not to '/usr/sourceware/foo-2.0'.
  6256. And because the substitution is applied only at the beginning of the
  6257. directory name, this rule will not be applied to
  6258. '/root/usr/source/baz.c' either.
  6259. In many cases, you can achieve the same result using the 'directory'
  6260. command. However, 'set substitute-path' can be more efficient in the
  6261. case where the sources are organized in a complex tree with multiple
  6262. subdirectories. With the 'directory' command, you need to add each
  6263. subdirectory of your project. If you moved the entire tree while
  6264. preserving its internal organization, then 'set substitute-path' allows
  6265. you to direct the debugger to all the sources with one single command.
  6266. 'set substitute-path' is also more than just a shortcut command. The
  6267. source path is only used if the file at the original location no longer
  6268. exists. On the other hand, 'set substitute-path' modifies the debugger
  6269. behavior to look at the rewritten location instead. So, if for any
  6270. reason a source file that is not relevant to your executable is located
  6271. at the original location, a substitution rule is the only method
  6272. available to point GDB at the new location.
  6273. You can configure a default source path substitution rule by
  6274. configuring GDB with the '--with-relocated-sources=DIR' option. The DIR
  6275. should be the name of a directory under GDB's configured prefix (set
  6276. with '--prefix' or '--exec-prefix'), and directory names in debug
  6277. information under DIR will be adjusted automatically if the installed
  6278. GDB is moved to a new location. This is useful if GDB, libraries or
  6279. executables with debug information and corresponding source code are
  6280. being moved together.
  6281. 'directory DIRNAME ...'
  6282. 'dir DIRNAME ...'
  6283. Add directory DIRNAME to the front of the source path. Several
  6284. directory names may be given to this command, separated by ':' (';'
  6285. on MS-DOS and MS-Windows, where ':' usually appears as part of
  6286. absolute file names) or whitespace. You may specify a directory
  6287. that is already in the source path; this moves it forward, so GDB
  6288. searches it sooner.
  6289. The special strings '$cdir' (to refer to the compilation directory,
  6290. if one is recorded), and '$cwd' (to refer to the current working
  6291. directory) can also be included in the list of directories DIRNAME.
  6292. Though these will already be in the source path they will be moved
  6293. forward in the list so GDB searches them sooner.
  6294. 'directory'
  6295. Reset the source path to its default value ('$cdir:$cwd' on Unix
  6296. systems). This requires confirmation.
  6297. 'set directories PATH-LIST'
  6298. Set the source path to PATH-LIST. '$cdir:$cwd' are added if
  6299. missing.
  6300. 'show directories'
  6301. Print the source path: show which directories it contains.
  6302. 'set substitute-path FROM TO'
  6303. Define a source path substitution rule, and add it at the end of
  6304. the current list of existing substitution rules. If a rule with
  6305. the same FROM was already defined, then the old rule is also
  6306. deleted.
  6307. For example, if the file '/foo/bar/baz.c' was moved to
  6308. '/mnt/cross/baz.c', then the command
  6309. (gdb) set substitute-path /foo/bar /mnt/cross
  6310. will tell GDB to replace '/foo/bar' with '/mnt/cross', which will
  6311. allow GDB to find the file 'baz.c' even though it was moved.
  6312. In the case when more than one substitution rule have been defined,
  6313. the rules are evaluated one by one in the order where they have
  6314. been defined. The first one matching, if any, is selected to
  6315. perform the substitution.
  6316. For instance, if we had entered the following commands:
  6317. (gdb) set substitute-path /usr/src/include /mnt/include
  6318. (gdb) set substitute-path /usr/src /mnt/src
  6319. GDB would then rewrite '/usr/src/include/defs.h' into
  6320. '/mnt/include/defs.h' by using the first rule. However, it would
  6321. use the second rule to rewrite '/usr/src/lib/foo.c' into
  6322. '/mnt/src/lib/foo.c'.
  6323. 'unset substitute-path [path]'
  6324. If a path is specified, search the current list of substitution
  6325. rules for a rule that would rewrite that path. Delete that rule if
  6326. found. A warning is emitted by the debugger if no rule could be
  6327. found.
  6328. If no path is specified, then all substitution rules are deleted.
  6329. 'show substitute-path [path]'
  6330. If a path is specified, then print the source path substitution
  6331. rule which would rewrite that path, if any.
  6332. If no path is specified, then print all existing source path
  6333. substitution rules.
  6334. If your source path is cluttered with directories that are no longer
  6335. of interest, GDB may sometimes cause confusion by finding the wrong
  6336. versions of source. You can correct the situation as follows:
  6337. 1. Use 'directory' with no argument to reset the source path to its
  6338. default value.
  6339. 2. Use 'directory' with suitable arguments to reinstall the
  6340. directories you want in the source path. You can add all the
  6341. directories in one command.
  6342. 
  6343. File: gdb.info, Node: Machine Code, Prev: Source Path, Up: Source
  6344. 9.6 Source and Machine Code
  6345. ===========================
  6346. You can use the command 'info line' to map source lines to program
  6347. addresses (and vice versa), and the command 'disassemble' to display a
  6348. range of addresses as machine instructions. You can use the command
  6349. 'set disassemble-next-line' to set whether to disassemble next source
  6350. line when execution stops. When run under GNU Emacs mode, the 'info
  6351. line' command causes the arrow to point to the line specified. Also,
  6352. 'info line' prints addresses in symbolic form as well as hex.
  6353. 'info line'
  6354. 'info line LOCATION'
  6355. Print the starting and ending addresses of the compiled code for
  6356. source line LOCATION. You can specify source lines in any of the
  6357. ways documented in *note Specify Location::. With no LOCATION
  6358. information about the current source line is printed.
  6359. For example, we can use 'info line' to discover the location of the
  6360. object code for the first line of function 'm4_changequote':
  6361. (gdb) info line m4_changequote
  6362. Line 895 of "builtin.c" starts at pc 0x634c <m4_changequote> and \
  6363. ends at 0x6350 <m4_changequote+4>.
  6364. We can also inquire (using '*ADDR' as the form for LOCATION) what source
  6365. line covers a particular address:
  6366. (gdb) info line *0x63ff
  6367. Line 926 of "builtin.c" starts at pc 0x63e4 <m4_changequote+152> and \
  6368. ends at 0x6404 <m4_changequote+184>.
  6369. After 'info line', the default address for the 'x' command is changed
  6370. to the starting address of the line, so that 'x/i' is sufficient to
  6371. begin examining the machine code (*note Examining Memory: Memory.).
  6372. Also, this address is saved as the value of the convenience variable
  6373. '$_' (*note Convenience Variables: Convenience Vars.).
  6374. After 'info line', using 'info line' again without specifying a
  6375. location will display information about the next source line.
  6376. 'disassemble'
  6377. 'disassemble /m'
  6378. 'disassemble /s'
  6379. 'disassemble /r'
  6380. This specialized command dumps a range of memory as machine
  6381. instructions. It can also print mixed source+disassembly by
  6382. specifying the '/m' or '/s' modifier and print the raw instructions
  6383. in hex as well as in symbolic form by specifying the '/r' modifier.
  6384. The default memory range is the function surrounding the program
  6385. counter of the selected frame. A single argument to this command
  6386. is a program counter value; GDB dumps the function surrounding this
  6387. value. When two arguments are given, they should be separated by a
  6388. comma, possibly surrounded by whitespace. The arguments specify a
  6389. range of addresses to dump, in one of two forms:
  6390. 'START,END'
  6391. the addresses from START (inclusive) to END (exclusive)
  6392. 'START,+LENGTH'
  6393. the addresses from START (inclusive) to 'START+LENGTH'
  6394. (exclusive).
  6395. When 2 arguments are specified, the name of the function is also
  6396. printed (since there could be several functions in the given
  6397. range).
  6398. The argument(s) can be any expression yielding a numeric value,
  6399. such as '0x32c4', '&main+10' or '$pc - 8'.
  6400. If the range of memory being disassembled contains current program
  6401. counter, the instruction at that location is shown with a '=>'
  6402. marker.
  6403. The following example shows the disassembly of a range of addresses
  6404. of HP PA-RISC 2.0 code:
  6405. (gdb) disas 0x32c4, 0x32e4
  6406. Dump of assembler code from 0x32c4 to 0x32e4:
  6407. 0x32c4 <main+204>: addil 0,dp
  6408. 0x32c8 <main+208>: ldw 0x22c(sr0,r1),r26
  6409. 0x32cc <main+212>: ldil 0x3000,r31
  6410. 0x32d0 <main+216>: ble 0x3f8(sr4,r31)
  6411. 0x32d4 <main+220>: ldo 0(r31),rp
  6412. 0x32d8 <main+224>: addil -0x800,dp
  6413. 0x32dc <main+228>: ldo 0x588(r1),r26
  6414. 0x32e0 <main+232>: ldil 0x3000,r31
  6415. End of assembler dump.
  6416. Here is an example showing mixed source+assembly for Intel x86 with
  6417. '/m' or '/s', when the program is stopped just after function prologue
  6418. in a non-optimized function with no inline code.
  6419. (gdb) disas /m main
  6420. Dump of assembler code for function main:
  6421. 5 {
  6422. 0x08048330 <+0>: push %ebp
  6423. 0x08048331 <+1>: mov %esp,%ebp
  6424. 0x08048333 <+3>: sub $0x8,%esp
  6425. 0x08048336 <+6>: and $0xfffffff0,%esp
  6426. 0x08048339 <+9>: sub $0x10,%esp
  6427. 6 printf ("Hello.\n");
  6428. => 0x0804833c <+12>: movl $0x8048440,(%esp)
  6429. 0x08048343 <+19>: call 0x8048284 <puts@plt>
  6430. 7 return 0;
  6431. 8 }
  6432. 0x08048348 <+24>: mov $0x0,%eax
  6433. 0x0804834d <+29>: leave
  6434. 0x0804834e <+30>: ret
  6435. End of assembler dump.
  6436. The '/m' option is deprecated as its output is not useful when there
  6437. is either inlined code or re-ordered code. The '/s' option is the
  6438. preferred choice. Here is an example for AMD x86-64 showing the
  6439. difference between '/m' output and '/s' output. This example has one
  6440. inline function defined in a header file, and the code is compiled with
  6441. '-O2' optimization. Note how the '/m' output is missing the disassembly
  6442. of several instructions that are present in the '/s' output.
  6443. 'foo.h':
  6444. int
  6445. foo (int a)
  6446. {
  6447. if (a < 0)
  6448. return a * 2;
  6449. if (a == 0)
  6450. return 1;
  6451. return a + 10;
  6452. }
  6453. 'foo.c':
  6454. #include "foo.h"
  6455. volatile int x, y;
  6456. int
  6457. main ()
  6458. {
  6459. x = foo (y);
  6460. return 0;
  6461. }
  6462. (gdb) disas /m main
  6463. Dump of assembler code for function main:
  6464. 5 {
  6465. 6 x = foo (y);
  6466. 0x0000000000400400 <+0>: mov 0x200c2e(%rip),%eax # 0x601034 <y>
  6467. 0x0000000000400417 <+23>: mov %eax,0x200c13(%rip) # 0x601030 <x>
  6468. 7 return 0;
  6469. 8 }
  6470. 0x000000000040041d <+29>: xor %eax,%eax
  6471. 0x000000000040041f <+31>: retq
  6472. 0x0000000000400420 <+32>: add %eax,%eax
  6473. 0x0000000000400422 <+34>: jmp 0x400417 <main+23>
  6474. End of assembler dump.
  6475. (gdb) disas /s main
  6476. Dump of assembler code for function main:
  6477. foo.c:
  6478. 5 {
  6479. 6 x = foo (y);
  6480. 0x0000000000400400 <+0>: mov 0x200c2e(%rip),%eax # 0x601034 <y>
  6481. foo.h:
  6482. 4 if (a < 0)
  6483. 0x0000000000400406 <+6>: test %eax,%eax
  6484. 0x0000000000400408 <+8>: js 0x400420 <main+32>
  6485. 6 if (a == 0)
  6486. 7 return 1;
  6487. 8 return a + 10;
  6488. 0x000000000040040a <+10>: lea 0xa(%rax),%edx
  6489. 0x000000000040040d <+13>: test %eax,%eax
  6490. 0x000000000040040f <+15>: mov $0x1,%eax
  6491. 0x0000000000400414 <+20>: cmovne %edx,%eax
  6492. foo.c:
  6493. 6 x = foo (y);
  6494. 0x0000000000400417 <+23>: mov %eax,0x200c13(%rip) # 0x601030 <x>
  6495. 7 return 0;
  6496. 8 }
  6497. 0x000000000040041d <+29>: xor %eax,%eax
  6498. 0x000000000040041f <+31>: retq
  6499. foo.h:
  6500. 5 return a * 2;
  6501. 0x0000000000400420 <+32>: add %eax,%eax
  6502. 0x0000000000400422 <+34>: jmp 0x400417 <main+23>
  6503. End of assembler dump.
  6504. Here is another example showing raw instructions in hex for AMD
  6505. x86-64,
  6506. (gdb) disas /r 0x400281,+10
  6507. Dump of assembler code from 0x400281 to 0x40028b:
  6508. 0x0000000000400281: 38 36 cmp %dh,(%rsi)
  6509. 0x0000000000400283: 2d 36 34 2e 73 sub $0x732e3436,%eax
  6510. 0x0000000000400288: 6f outsl %ds:(%rsi),(%dx)
  6511. 0x0000000000400289: 2e 32 00 xor %cs:(%rax),%al
  6512. End of assembler dump.
  6513. Addresses cannot be specified as a location (*note Specify
  6514. Location::). So, for example, if you want to disassemble function 'bar'
  6515. in file 'foo.c', you must type 'disassemble 'foo.c'::bar' and not
  6516. 'disassemble foo.c:bar'.
  6517. Some architectures have more than one commonly-used set of
  6518. instruction mnemonics or other syntax.
  6519. For programs that were dynamically linked and use shared libraries,
  6520. instructions that call functions or branch to locations in the shared
  6521. libraries might show a seemingly bogus location--it's actually a
  6522. location of the relocation table. On some architectures, GDB might be
  6523. able to resolve these to actual function names.
  6524. 'set disassembler-options OPTION1[,OPTION2...]'
  6525. This command controls the passing of target specific information to
  6526. the disassembler. For a list of valid options, please refer to the
  6527. '-M'/'--disassembler-options' section of the 'objdump' manual
  6528. and/or the output of 'objdump --help' (*note objdump:
  6529. (binutils)objdump.). The default value is the empty string.
  6530. If it is necessary to specify more than one disassembler option,
  6531. then multiple options can be placed together into a comma separated
  6532. list. Currently this command is only supported on targets ARM,
  6533. MIPS, PowerPC and S/390.
  6534. 'show disassembler-options'
  6535. Show the current setting of the disassembler options.
  6536. 'set disassembly-flavor INSTRUCTION-SET'
  6537. Select the instruction set to use when disassembling the program
  6538. via the 'disassemble' or 'x/i' commands.
  6539. Currently this command is only defined for the Intel x86 family.
  6540. You can set INSTRUCTION-SET to either 'intel' or 'att'. The
  6541. default is 'att', the AT&T flavor used by default by Unix
  6542. assemblers for x86-based targets.
  6543. 'show disassembly-flavor'
  6544. Show the current setting of the disassembly flavor.
  6545. 'set disassemble-next-line'
  6546. 'show disassemble-next-line'
  6547. Control whether or not GDB will disassemble the next source line or
  6548. instruction when execution stops. If ON, GDB will display
  6549. disassembly of the next source line when execution of the program
  6550. being debugged stops. This is _in addition_ to displaying the
  6551. source line itself, which GDB always does if possible. If the next
  6552. source line cannot be displayed for some reason (e.g., if GDB
  6553. cannot find the source file, or there's no line info in the debug
  6554. info), GDB will display disassembly of the next _instruction_
  6555. instead of showing the next source line. If AUTO, GDB will display
  6556. disassembly of next instruction only if the source line cannot be
  6557. displayed. This setting causes GDB to display some feedback when
  6558. you step through a function with no line info or whose source file
  6559. is unavailable. The default is OFF, which means never display the
  6560. disassembly of the next line or instruction.
  6561. 
  6562. File: gdb.info, Node: Data, Next: Optimized Code, Prev: Source, Up: Top
  6563. 10 Examining Data
  6564. *****************
  6565. The usual way to examine data in your program is with the 'print'
  6566. command (abbreviated 'p'), or its synonym 'inspect'. It evaluates and
  6567. prints the value of an expression of the language your program is
  6568. written in (*note Using GDB with Different Languages: Languages.). It
  6569. may also print the expression using a Python-based pretty-printer (*note
  6570. Pretty Printing::).
  6571. 'print [[OPTIONS] --] EXPR'
  6572. 'print [[OPTIONS] --] /F EXPR'
  6573. EXPR is an expression (in the source language). By default the
  6574. value of EXPR is printed in a format appropriate to its data type;
  6575. you can choose a different format by specifying '/F', where F is a
  6576. letter specifying the format; see *note Output Formats: Output
  6577. Formats.
  6578. The 'print' command supports a number of options that allow
  6579. overriding relevant global print settings as set by 'set print'
  6580. subcommands:
  6581. '-address [on|off]'
  6582. Set printing of addresses. Related setting: *note set print
  6583. address::.
  6584. '-array [on|off]'
  6585. Pretty formatting of arrays. Related setting: *note set print
  6586. array::.
  6587. '-array-indexes [on|off]'
  6588. Set printing of array indexes. Related setting: *note set
  6589. print array-indexes::.
  6590. '-elements NUMBER-OF-ELEMENTS|unlimited'
  6591. Set limit on string chars or array elements to print. The
  6592. value 'unlimited' causes there to be no limit. Related
  6593. setting: *note set print elements::.
  6594. '-max-depth DEPTH|unlimited'
  6595. Set the threshold after which nested structures are replaced
  6596. with ellipsis. Related setting: *note set print max-depth::.
  6597. '-null-stop [on|off]'
  6598. Set printing of char arrays to stop at first null char.
  6599. Related setting: *note set print null-stop::.
  6600. '-object [on|off]'
  6601. Set printing C++ virtual function tables. Related setting:
  6602. *note set print object::.
  6603. '-pretty [on|off]'
  6604. Set pretty formatting of structures. Related setting: *note
  6605. set print pretty::.
  6606. '-raw-values [on|off]'
  6607. Set whether to print values in raw form, bypassing any
  6608. pretty-printers for that value. Related setting: *note set
  6609. print raw-values::.
  6610. '-repeats NUMBER-OF-REPEATS|unlimited'
  6611. Set threshold for repeated print elements. 'unlimited' causes
  6612. all elements to be individually printed. Related setting:
  6613. *note set print repeats::.
  6614. '-static-members [on|off]'
  6615. Set printing C++ static members. Related setting: *note set
  6616. print static-members::.
  6617. '-symbol [on|off]'
  6618. Set printing of symbol names when printing pointers. Related
  6619. setting: *note set print symbol::.
  6620. '-union [on|off]'
  6621. Set printing of unions interior to structures. Related
  6622. setting: *note set print union::.
  6623. '-vtbl [on|off]'
  6624. Set printing of C++ virtual function tables. Related setting:
  6625. *note set print vtbl::.
  6626. Because the 'print' command accepts arbitrary expressions which may
  6627. look like options (including abbreviations), if you specify any
  6628. command option, then you must use a double dash ('--') to mark the
  6629. end of option processing.
  6630. For example, this prints the value of the '-p' expression:
  6631. (gdb) print -p
  6632. While this repeats the last value in the value history (see below)
  6633. with the '-pretty' option in effect:
  6634. (gdb) print -p --
  6635. Here is an example including both on option and an expression:
  6636. (gdb) print -pretty -- *myptr
  6637. $1 = {
  6638. next = 0x0,
  6639. flags = {
  6640. sweet = 1,
  6641. sour = 1
  6642. },
  6643. meat = 0x54 "Pork"
  6644. }
  6645. 'print [OPTIONS]'
  6646. 'print [OPTIONS] /F'
  6647. If you omit EXPR, GDB displays the last value again (from the
  6648. "value history"; *note Value History: Value History.). This allows
  6649. you to conveniently inspect the same value in an alternative
  6650. format.
  6651. A more low-level way of examining data is with the 'x' command. It
  6652. examines data in memory at a specified address and prints it in a
  6653. specified format. *Note Examining Memory: Memory.
  6654. If you are interested in information about types, or about how the
  6655. fields of a struct or a class are declared, use the 'ptype EXP' command
  6656. rather than 'print'. *Note Examining the Symbol Table: Symbols.
  6657. Another way of examining values of expressions and type information
  6658. is through the Python extension command 'explore' (available only if the
  6659. GDB build is configured with '--with-python'). It offers an interactive
  6660. way to start at the highest level (or, the most abstract level) of the
  6661. data type of an expression (or, the data type itself) and explore all
  6662. the way down to leaf scalar values/fields embedded in the higher level
  6663. data types.
  6664. 'explore ARG'
  6665. ARG is either an expression (in the source language), or a type
  6666. visible in the current context of the program being debugged.
  6667. The working of the 'explore' command can be illustrated with an
  6668. example. If a data type 'struct ComplexStruct' is defined in your C
  6669. program as
  6670. struct SimpleStruct
  6671. {
  6672. int i;
  6673. double d;
  6674. };
  6675. struct ComplexStruct
  6676. {
  6677. struct SimpleStruct *ss_p;
  6678. int arr[10];
  6679. };
  6680. followed by variable declarations as
  6681. struct SimpleStruct ss = { 10, 1.11 };
  6682. struct ComplexStruct cs = { &ss, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } };
  6683. then, the value of the variable 'cs' can be explored using the 'explore'
  6684. command as follows.
  6685. (gdb) explore cs
  6686. The value of `cs' is a struct/class of type `struct ComplexStruct' with
  6687. the following fields:
  6688. ss_p = <Enter 0 to explore this field of type `struct SimpleStruct *'>
  6689. arr = <Enter 1 to explore this field of type `int [10]'>
  6690. Enter the field number of choice:
  6691. Since the fields of 'cs' are not scalar values, you are being prompted
  6692. to chose the field you want to explore. Let's say you choose the field
  6693. 'ss_p' by entering '0'. Then, since this field is a pointer, you will
  6694. be asked if it is pointing to a single value. From the declaration of
  6695. 'cs' above, it is indeed pointing to a single value, hence you enter
  6696. 'y'. If you enter 'n', then you will be asked if it were pointing to an
  6697. array of values, in which case this field will be explored as if it were
  6698. an array.
  6699. `cs.ss_p' is a pointer to a value of type `struct SimpleStruct'
  6700. Continue exploring it as a pointer to a single value [y/n]: y
  6701. The value of `*(cs.ss_p)' is a struct/class of type `struct
  6702. SimpleStruct' with the following fields:
  6703. i = 10 .. (Value of type `int')
  6704. d = 1.1100000000000001 .. (Value of type `double')
  6705. Press enter to return to parent value:
  6706. If the field 'arr' of 'cs' was chosen for exploration by entering '1'
  6707. earlier, then since it is as array, you will be prompted to enter the
  6708. index of the element in the array that you want to explore.
  6709. `cs.arr' is an array of `int'.
  6710. Enter the index of the element you want to explore in `cs.arr': 5
  6711. `(cs.arr)[5]' is a scalar value of type `int'.
  6712. (cs.arr)[5] = 4
  6713. Press enter to return to parent value:
  6714. In general, at any stage of exploration, you can go deeper towards
  6715. the leaf values by responding to the prompts appropriately, or hit the
  6716. return key to return to the enclosing data structure (the higher level
  6717. data structure).
  6718. Similar to exploring values, you can use the 'explore' command to
  6719. explore types. Instead of specifying a value (which is typically a
  6720. variable name or an expression valid in the current context of the
  6721. program being debugged), you specify a type name. If you consider the
  6722. same example as above, your can explore the type 'struct ComplexStruct'
  6723. by passing the argument 'struct ComplexStruct' to the 'explore' command.
  6724. (gdb) explore struct ComplexStruct
  6725. By responding to the prompts appropriately in the subsequent interactive
  6726. session, you can explore the type 'struct ComplexStruct' in a manner
  6727. similar to how the value 'cs' was explored in the above example.
  6728. The 'explore' command also has two sub-commands, 'explore value' and
  6729. 'explore type'. The former sub-command is a way to explicitly specify
  6730. that value exploration of the argument is being invoked, while the
  6731. latter is a way to explicitly specify that type exploration of the
  6732. argument is being invoked.
  6733. 'explore value EXPR'
  6734. This sub-command of 'explore' explores the value of the expression
  6735. EXPR (if EXPR is an expression valid in the current context of the
  6736. program being debugged). The behavior of this command is identical
  6737. to that of the behavior of the 'explore' command being passed the
  6738. argument EXPR.
  6739. 'explore type ARG'
  6740. This sub-command of 'explore' explores the type of ARG (if ARG is a
  6741. type visible in the current context of program being debugged), or
  6742. the type of the value/expression ARG (if ARG is an expression valid
  6743. in the current context of the program being debugged). If ARG is a
  6744. type, then the behavior of this command is identical to that of the
  6745. 'explore' command being passed the argument ARG. If ARG is an
  6746. expression, then the behavior of this command will be identical to
  6747. that of the 'explore' command being passed the type of ARG as the
  6748. argument.
  6749. * Menu:
  6750. * Expressions:: Expressions
  6751. * Ambiguous Expressions:: Ambiguous Expressions
  6752. * Variables:: Program variables
  6753. * Arrays:: Artificial arrays
  6754. * Output Formats:: Output formats
  6755. * Memory:: Examining memory
  6756. * Auto Display:: Automatic display
  6757. * Print Settings:: Print settings
  6758. * Pretty Printing:: Python pretty printing
  6759. * Value History:: Value history
  6760. * Convenience Vars:: Convenience variables
  6761. * Convenience Funs:: Convenience functions
  6762. * Registers:: Registers
  6763. * Floating Point Hardware:: Floating point hardware
  6764. * Vector Unit:: Vector Unit
  6765. * OS Information:: Auxiliary data provided by operating system
  6766. * Memory Region Attributes:: Memory region attributes
  6767. * Dump/Restore Files:: Copy between memory and a file
  6768. * Core File Generation:: Cause a program dump its core
  6769. * Character Sets:: Debugging programs that use a different
  6770. character set than GDB does
  6771. * Caching Target Data:: Data caching for targets
  6772. * Searching Memory:: Searching memory for a sequence of bytes
  6773. * Value Sizes:: Managing memory allocated for values
  6774. 
  6775. File: gdb.info, Node: Expressions, Next: Ambiguous Expressions, Up: Data
  6776. 10.1 Expressions
  6777. ================
  6778. 'print' and many other GDB commands accept an expression and compute its
  6779. value. Any kind of constant, variable or operator defined by the
  6780. programming language you are using is valid in an expression in GDB.
  6781. This includes conditional expressions, function calls, casts, and string
  6782. constants. It also includes preprocessor macros, if you compiled your
  6783. program to include this information; see *note Compilation::.
  6784. GDB supports array constants in expressions input by the user. The
  6785. syntax is {ELEMENT, ELEMENT...}. For example, you can use the command
  6786. 'print {1, 2, 3}' to create an array of three integers. If you pass an
  6787. array to a function or assign it to a program variable, GDB copies the
  6788. array to memory that is 'malloc'ed in the target program.
  6789. Because C is so widespread, most of the expressions shown in examples
  6790. in this manual are in C. *Note Using GDB with Different Languages:
  6791. Languages, for information on how to use expressions in other languages.
  6792. In this section, we discuss operators that you can use in GDB
  6793. expressions regardless of your programming language.
  6794. Casts are supported in all languages, not just in C, because it is so
  6795. useful to cast a number into a pointer in order to examine a structure
  6796. at that address in memory.
  6797. GDB supports these operators, in addition to those common to
  6798. programming languages:
  6799. '@'
  6800. '@' is a binary operator for treating parts of memory as arrays.
  6801. *Note Artificial Arrays: Arrays, for more information.
  6802. '::'
  6803. '::' allows you to specify a variable in terms of the file or
  6804. function where it is defined. *Note Program Variables: Variables.
  6805. '{TYPE} ADDR'
  6806. Refers to an object of type TYPE stored at address ADDR in memory.
  6807. The address ADDR may be any expression whose value is an integer or
  6808. pointer (but parentheses are required around binary operators, just
  6809. as in a cast). This construct is allowed regardless of what kind
  6810. of data is normally supposed to reside at ADDR.
  6811. 
  6812. File: gdb.info, Node: Ambiguous Expressions, Next: Variables, Prev: Expressions, Up: Data
  6813. 10.2 Ambiguous Expressions
  6814. ==========================
  6815. Expressions can sometimes contain some ambiguous elements. For
  6816. instance, some programming languages (notably Ada, C++ and Objective-C)
  6817. permit a single function name to be defined several times, for
  6818. application in different contexts. This is called "overloading".
  6819. Another example involving Ada is generics. A "generic package" is
  6820. similar to C++ templates and is typically instantiated several times,
  6821. resulting in the same function name being defined in different contexts.
  6822. In some cases and depending on the language, it is possible to adjust
  6823. the expression to remove the ambiguity. For instance in C++, you can
  6824. specify the signature of the function you want to break on, as in 'break
  6825. FUNCTION(TYPES)'. In Ada, using the fully qualified name of your
  6826. function often makes the expression unambiguous as well.
  6827. When an ambiguity that needs to be resolved is detected, the debugger
  6828. has the capability to display a menu of numbered choices for each
  6829. possibility, and then waits for the selection with the prompt '>'. The
  6830. first option is always '[0] cancel', and typing '0 <RET>' aborts the
  6831. current command. If the command in which the expression was used allows
  6832. more than one choice to be selected, the next option in the menu is '[1]
  6833. all', and typing '1 <RET>' selects all possible choices.
  6834. For example, the following session excerpt shows an attempt to set a
  6835. breakpoint at the overloaded symbol 'String::after'. We choose three
  6836. particular definitions of that function name:
  6837. (gdb) b String::after
  6838. [0] cancel
  6839. [1] all
  6840. [2] file:String.cc; line number:867
  6841. [3] file:String.cc; line number:860
  6842. [4] file:String.cc; line number:875
  6843. [5] file:String.cc; line number:853
  6844. [6] file:String.cc; line number:846
  6845. [7] file:String.cc; line number:735
  6846. > 2 4 6
  6847. Breakpoint 1 at 0xb26c: file String.cc, line 867.
  6848. Breakpoint 2 at 0xb344: file String.cc, line 875.
  6849. Breakpoint 3 at 0xafcc: file String.cc, line 846.
  6850. Multiple breakpoints were set.
  6851. Use the "delete" command to delete unwanted
  6852. breakpoints.
  6853. (gdb)
  6854. 'set multiple-symbols MODE'
  6855. This option allows you to adjust the debugger behavior when an
  6856. expression is ambiguous.
  6857. By default, MODE is set to 'all'. If the command with which the
  6858. expression is used allows more than one choice, then GDB
  6859. automatically selects all possible choices. For instance,
  6860. inserting a breakpoint on a function using an ambiguous name
  6861. results in a breakpoint inserted on each possible match. However,
  6862. if a unique choice must be made, then GDB uses the menu to help you
  6863. disambiguate the expression. For instance, printing the address of
  6864. an overloaded function will result in the use of the menu.
  6865. When MODE is set to 'ask', the debugger always uses the menu when
  6866. an ambiguity is detected.
  6867. Finally, when MODE is set to 'cancel', the debugger reports an
  6868. error due to the ambiguity and the command is aborted.
  6869. 'show multiple-symbols'
  6870. Show the current value of the 'multiple-symbols' setting.
  6871. 
  6872. File: gdb.info, Node: Variables, Next: Arrays, Prev: Ambiguous Expressions, Up: Data
  6873. 10.3 Program Variables
  6874. ======================
  6875. The most common kind of expression to use is the name of a variable in
  6876. your program.
  6877. Variables in expressions are understood in the selected stack frame
  6878. (*note Selecting a Frame: Selection.); they must be either:
  6879. * global (or file-static)
  6880. or
  6881. * visible according to the scope rules of the programming language
  6882. from the point of execution in that frame
  6883. This means that in the function
  6884. foo (a)
  6885. int a;
  6886. {
  6887. bar (a);
  6888. {
  6889. int b = test ();
  6890. bar (b);
  6891. }
  6892. }
  6893. you can examine and use the variable 'a' whenever your program is
  6894. executing within the function 'foo', but you can only use or examine the
  6895. variable 'b' while your program is executing inside the block where 'b'
  6896. is declared.
  6897. There is an exception: you can refer to a variable or function whose
  6898. scope is a single source file even if the current execution point is not
  6899. in this file. But it is possible to have more than one such variable or
  6900. function with the same name (in different source files). If that
  6901. happens, referring to that name has unpredictable effects. If you wish,
  6902. you can specify a static variable in a particular function or file by
  6903. using the colon-colon ('::') notation:
  6904. FILE::VARIABLE
  6905. FUNCTION::VARIABLE
  6906. Here FILE or FUNCTION is the name of the context for the static
  6907. VARIABLE. In the case of file names, you can use quotes to make sure
  6908. GDB parses the file name as a single word--for example, to print a
  6909. global value of 'x' defined in 'f2.c':
  6910. (gdb) p 'f2.c'::x
  6911. The '::' notation is normally used for referring to static variables,
  6912. since you typically disambiguate uses of local variables in functions by
  6913. selecting the appropriate frame and using the simple name of the
  6914. variable. However, you may also use this notation to refer to local
  6915. variables in frames enclosing the selected frame:
  6916. void
  6917. foo (int a)
  6918. {
  6919. if (a < 10)
  6920. bar (a);
  6921. else
  6922. process (a); /* Stop here */
  6923. }
  6924. int
  6925. bar (int a)
  6926. {
  6927. foo (a + 5);
  6928. }
  6929. For example, if there is a breakpoint at the commented line, here is
  6930. what you might see when the program stops after executing the call
  6931. 'bar(0)':
  6932. (gdb) p a
  6933. $1 = 10
  6934. (gdb) p bar::a
  6935. $2 = 5
  6936. (gdb) up 2
  6937. #2 0x080483d0 in foo (a=5) at foobar.c:12
  6938. (gdb) p a
  6939. $3 = 5
  6940. (gdb) p bar::a
  6941. $4 = 0
  6942. These uses of '::' are very rarely in conflict with the very similar
  6943. use of the same notation in C++. When they are in conflict, the C++
  6944. meaning takes precedence; however, this can be overridden by quoting the
  6945. file or function name with single quotes.
  6946. For example, suppose the program is stopped in a method of a class
  6947. that has a field named 'includefile', and there is also an include file
  6948. named 'includefile' that defines a variable, 'some_global'.
  6949. (gdb) p includefile
  6950. $1 = 23
  6951. (gdb) p includefile::some_global
  6952. A syntax error in expression, near `'.
  6953. (gdb) p 'includefile'::some_global
  6954. $2 = 27
  6955. _Warning:_ Occasionally, a local variable may appear to have the
  6956. wrong value at certain points in a function--just after entry to a
  6957. new scope, and just before exit.
  6958. You may see this problem when you are stepping by machine
  6959. instructions. This is because, on most machines, it takes more than one
  6960. instruction to set up a stack frame (including local variable
  6961. definitions); if you are stepping by machine instructions, variables may
  6962. appear to have the wrong values until the stack frame is completely
  6963. built. On exit, it usually also takes more than one machine instruction
  6964. to destroy a stack frame; after you begin stepping through that group of
  6965. instructions, local variable definitions may be gone.
  6966. This may also happen when the compiler does significant
  6967. optimizations. To be sure of always seeing accurate values, turn off
  6968. all optimization when compiling.
  6969. Another possible effect of compiler optimizations is to optimize
  6970. unused variables out of existence, or assign variables to registers (as
  6971. opposed to memory addresses). Depending on the support for such cases
  6972. offered by the debug info format used by the compiler, GDB might not be
  6973. able to display values for such local variables. If that happens, GDB
  6974. will print a message like this:
  6975. No symbol "foo" in current context.
  6976. To solve such problems, either recompile without optimizations, or
  6977. use a different debug info format, if the compiler supports several such
  6978. formats. *Note Compilation::, for more information on choosing compiler
  6979. options. *Note C and C++: C, for more information about debug info
  6980. formats that are best suited to C++ programs.
  6981. If you ask to print an object whose contents are unknown to GDB,
  6982. e.g., because its data type is not completely specified by the debug
  6983. information, GDB will say '<incomplete type>'. *Note incomplete type:
  6984. Symbols, for more about this.
  6985. If you try to examine or use the value of a (global) variable for
  6986. which GDB has no type information, e.g., because the program includes no
  6987. debug information, GDB displays an error message. *Note unknown type:
  6988. Symbols, for more about unknown types. If you cast the variable to its
  6989. declared type, GDB gets the variable's value using the cast-to type as
  6990. the variable's type. For example, in a C program:
  6991. (gdb) p var
  6992. 'var' has unknown type; cast it to its declared type
  6993. (gdb) p (float) var
  6994. $1 = 3.14
  6995. If you append '@entry' string to a function parameter name you get
  6996. its value at the time the function got called. If the value is not
  6997. available an error message is printed. Entry values are available only
  6998. with some compilers. Entry values are normally also printed at the
  6999. function parameter list according to *note set print entry-values::.
  7000. Breakpoint 1, d (i=30) at gdb.base/entry-value.c:29
  7001. 29 i++;
  7002. (gdb) next
  7003. 30 e (i);
  7004. (gdb) print i
  7005. $1 = 31
  7006. (gdb) print i@entry
  7007. $2 = 30
  7008. Strings are identified as arrays of 'char' values without specified
  7009. signedness. Arrays of either 'signed char' or 'unsigned char' get
  7010. printed as arrays of 1 byte sized integers. '-fsigned-char' or
  7011. '-funsigned-char' GCC options have no effect as GDB defines literal
  7012. string type '"char"' as 'char' without a sign. For program code
  7013. char var0[] = "A";
  7014. signed char var1[] = "A";
  7015. You get during debugging
  7016. (gdb) print var0
  7017. $1 = "A"
  7018. (gdb) print var1
  7019. $2 = {65 'A', 0 '\0'}
  7020. 
  7021. File: gdb.info, Node: Arrays, Next: Output Formats, Prev: Variables, Up: Data
  7022. 10.4 Artificial Arrays
  7023. ======================
  7024. It is often useful to print out several successive objects of the same
  7025. type in memory; a section of an array, or an array of dynamically
  7026. determined size for which only a pointer exists in the program.
  7027. You can do this by referring to a contiguous span of memory as an
  7028. "artificial array", using the binary operator '@'. The left operand of
  7029. '@' should be the first element of the desired array and be an
  7030. individual object. The right operand should be the desired length of
  7031. the array. The result is an array value whose elements are all of the
  7032. type of the left argument. The first element is actually the left
  7033. argument; the second element comes from bytes of memory immediately
  7034. following those that hold the first element, and so on. Here is an
  7035. example. If a program says
  7036. int *array = (int *) malloc (len * sizeof (int));
  7037. you can print the contents of 'array' with
  7038. p *array@len
  7039. The left operand of '@' must reside in memory. Array values made
  7040. with '@' in this way behave just like other arrays in terms of
  7041. subscripting, and are coerced to pointers when used in expressions.
  7042. Artificial arrays most often appear in expressions via the value history
  7043. (*note Value History: Value History.), after printing one out.
  7044. Another way to create an artificial array is to use a cast. This
  7045. re-interprets a value as if it were an array. The value need not be in
  7046. memory:
  7047. (gdb) p/x (short[2])0x12345678
  7048. $1 = {0x1234, 0x5678}
  7049. As a convenience, if you leave the array length out (as in
  7050. '(TYPE[])VALUE') GDB calculates the size to fill the value (as
  7051. 'sizeof(VALUE)/sizeof(TYPE)':
  7052. (gdb) p/x (short[])0x12345678
  7053. $2 = {0x1234, 0x5678}
  7054. Sometimes the artificial array mechanism is not quite enough; in
  7055. moderately complex data structures, the elements of interest may not
  7056. actually be adjacent--for example, if you are interested in the values
  7057. of pointers in an array. One useful work-around in this situation is to
  7058. use a convenience variable (*note Convenience Variables: Convenience
  7059. Vars.) as a counter in an expression that prints the first interesting
  7060. value, and then repeat that expression via <RET>. For instance, suppose
  7061. you have an array 'dtab' of pointers to structures, and you are
  7062. interested in the values of a field 'fv' in each structure. Here is an
  7063. example of what you might type:
  7064. set $i = 0
  7065. p dtab[$i++]->fv
  7066. <RET>
  7067. <RET>
  7068. ...
  7069. 
  7070. File: gdb.info, Node: Output Formats, Next: Memory, Prev: Arrays, Up: Data
  7071. 10.5 Output Formats
  7072. ===================
  7073. By default, GDB prints a value according to its data type. Sometimes
  7074. this is not what you want. For example, you might want to print a
  7075. number in hex, or a pointer in decimal. Or you might want to view data
  7076. in memory at a certain address as a character string or as an
  7077. instruction. To do these things, specify an "output format" when you
  7078. print a value.
  7079. The simplest use of output formats is to say how to print a value
  7080. already computed. This is done by starting the arguments of the 'print'
  7081. command with a slash and a format letter. The format letters supported
  7082. are:
  7083. 'x'
  7084. Regard the bits of the value as an integer, and print the integer
  7085. in hexadecimal.
  7086. 'd'
  7087. Print as integer in signed decimal.
  7088. 'u'
  7089. Print as integer in unsigned decimal.
  7090. 'o'
  7091. Print as integer in octal.
  7092. 't'
  7093. Print as integer in binary. The letter 't' stands for "two". (1)
  7094. 'a'
  7095. Print as an address, both absolute in hexadecimal and as an offset
  7096. from the nearest preceding symbol. You can use this format used to
  7097. discover where (in what function) an unknown address is located:
  7098. (gdb) p/a 0x54320
  7099. $3 = 0x54320 <_initialize_vx+396>
  7100. The command 'info symbol 0x54320' yields similar results. *Note
  7101. info symbol: Symbols.
  7102. 'c'
  7103. Regard as an integer and print it as a character constant. This
  7104. prints both the numerical value and its character representation.
  7105. The character representation is replaced with the octal escape
  7106. '\nnn' for characters outside the 7-bit ASCII range.
  7107. Without this format, GDB displays 'char', 'unsigned char', and
  7108. 'signed char' data as character constants. Single-byte members of
  7109. vectors are displayed as integer data.
  7110. 'f'
  7111. Regard the bits of the value as a floating point number and print
  7112. using typical floating point syntax.
  7113. 's'
  7114. Regard as a string, if possible. With this format, pointers to
  7115. single-byte data are displayed as null-terminated strings and
  7116. arrays of single-byte data are displayed as fixed-length strings.
  7117. Other values are displayed in their natural types.
  7118. Without this format, GDB displays pointers to and arrays of 'char',
  7119. 'unsigned char', and 'signed char' as strings. Single-byte members
  7120. of a vector are displayed as an integer array.
  7121. 'z'
  7122. Like 'x' formatting, the value is treated as an integer and printed
  7123. as hexadecimal, but leading zeros are printed to pad the value to
  7124. the size of the integer type.
  7125. 'r'
  7126. Print using the 'raw' formatting. By default, GDB will use a
  7127. Python-based pretty-printer, if one is available (*note Pretty
  7128. Printing::). This typically results in a higher-level display of
  7129. the value's contents. The 'r' format bypasses any Python
  7130. pretty-printer which might exist.
  7131. For example, to print the program counter in hex (*note Registers::),
  7132. type
  7133. p/x $pc
  7134. Note that no space is required before the slash; this is because command
  7135. names in GDB cannot contain a slash.
  7136. To reprint the last value in the value history with a different
  7137. format, you can use the 'print' command with just a format and no
  7138. expression. For example, 'p/x' reprints the last value in hex.
  7139. ---------- Footnotes ----------
  7140. (1) 'b' cannot be used because these format letters are also used
  7141. with the 'x' command, where 'b' stands for "byte"; see *note Examining
  7142. Memory: Memory.
  7143. 
  7144. File: gdb.info, Node: Memory, Next: Auto Display, Prev: Output Formats, Up: Data
  7145. 10.6 Examining Memory
  7146. =====================
  7147. You can use the command 'x' (for "examine") to examine memory in any of
  7148. several formats, independently of your program's data types.
  7149. 'x/NFU ADDR'
  7150. 'x ADDR'
  7151. 'x'
  7152. Use the 'x' command to examine memory.
  7153. N, F, and U are all optional parameters that specify how much memory
  7154. to display and how to format it; ADDR is an expression giving the
  7155. address where you want to start displaying memory. If you use defaults
  7156. for NFU, you need not type the slash '/'. Several commands set
  7157. convenient defaults for ADDR.
  7158. N, the repeat count
  7159. The repeat count is a decimal integer; the default is 1. It
  7160. specifies how much memory (counting by units U) to display. If a
  7161. negative number is specified, memory is examined backward from
  7162. ADDR.
  7163. F, the display format
  7164. The display format is one of the formats used by 'print' ('x', 'd',
  7165. 'u', 'o', 't', 'a', 'c', 'f', 's'), and in addition 'i' (for
  7166. machine instructions). The default is 'x' (hexadecimal) initially.
  7167. The default changes each time you use either 'x' or 'print'.
  7168. U, the unit size
  7169. The unit size is any of
  7170. 'b'
  7171. Bytes.
  7172. 'h'
  7173. Halfwords (two bytes).
  7174. 'w'
  7175. Words (four bytes). This is the initial default.
  7176. 'g'
  7177. Giant words (eight bytes).
  7178. Each time you specify a unit size with 'x', that size becomes the
  7179. default unit the next time you use 'x'. For the 'i' format, the
  7180. unit size is ignored and is normally not written. For the 's'
  7181. format, the unit size defaults to 'b', unless it is explicitly
  7182. given. Use 'x /hs' to display 16-bit char strings and 'x /ws' to
  7183. display 32-bit strings. The next use of 'x /s' will again display
  7184. 8-bit strings. Note that the results depend on the programming
  7185. language of the current compilation unit. If the language is C,
  7186. the 's' modifier will use the UTF-16 encoding while 'w' will use
  7187. UTF-32. The encoding is set by the programming language and cannot
  7188. be altered.
  7189. ADDR, starting display address
  7190. ADDR is the address where you want GDB to begin displaying memory.
  7191. The expression need not have a pointer value (though it may); it is
  7192. always interpreted as an integer address of a byte of memory.
  7193. *Note Expressions: Expressions, for more information on
  7194. expressions. The default for ADDR is usually just after the last
  7195. address examined--but several other commands also set the default
  7196. address: 'info breakpoints' (to the address of the last breakpoint
  7197. listed), 'info line' (to the starting address of a line), and
  7198. 'print' (if you use it to display a value from memory).
  7199. For example, 'x/3uh 0x54320' is a request to display three halfwords
  7200. ('h') of memory, formatted as unsigned decimal integers ('u'), starting
  7201. at address '0x54320'. 'x/4xw $sp' prints the four words ('w') of memory
  7202. above the stack pointer (here, '$sp'; *note Registers: Registers.) in
  7203. hexadecimal ('x').
  7204. You can also specify a negative repeat count to examine memory
  7205. backward from the given address. For example, 'x/-3uh 0x54320' prints
  7206. three halfwords ('h') at '0x54314', '0x54328', and '0x5431c'.
  7207. Since the letters indicating unit sizes are all distinct from the
  7208. letters specifying output formats, you do not have to remember whether
  7209. unit size or format comes first; either order works. The output
  7210. specifications '4xw' and '4wx' mean exactly the same thing. (However,
  7211. the count N must come first; 'wx4' does not work.)
  7212. Even though the unit size U is ignored for the formats 's' and 'i',
  7213. you might still want to use a count N; for example, '3i' specifies that
  7214. you want to see three machine instructions, including any operands. For
  7215. convenience, especially when used with the 'display' command, the 'i'
  7216. format also prints branch delay slot instructions, if any, beyond the
  7217. count specified, which immediately follow the last instruction that is
  7218. within the count. The command 'disassemble' gives an alternative way of
  7219. inspecting machine instructions; see *note Source and Machine Code:
  7220. Machine Code.
  7221. If a negative repeat count is specified for the formats 's' or 'i',
  7222. the command displays null-terminated strings or instructions before the
  7223. given address as many as the absolute value of the given number. For
  7224. the 'i' format, we use line number information in the debug info to
  7225. accurately locate instruction boundaries while disassembling backward.
  7226. If line info is not available, the command stops examining memory with
  7227. an error message.
  7228. All the defaults for the arguments to 'x' are designed to make it
  7229. easy to continue scanning memory with minimal specifications each time
  7230. you use 'x'. For example, after you have inspected three machine
  7231. instructions with 'x/3i ADDR', you can inspect the next seven with just
  7232. 'x/7'. If you use <RET> to repeat the 'x' command, the repeat count N
  7233. is used again; the other arguments default as for successive uses of
  7234. 'x'.
  7235. When examining machine instructions, the instruction at current
  7236. program counter is shown with a '=>' marker. For example:
  7237. (gdb) x/5i $pc-6
  7238. 0x804837f <main+11>: mov %esp,%ebp
  7239. 0x8048381 <main+13>: push %ecx
  7240. 0x8048382 <main+14>: sub $0x4,%esp
  7241. => 0x8048385 <main+17>: movl $0x8048460,(%esp)
  7242. 0x804838c <main+24>: call 0x80482d4 <puts@plt>
  7243. The addresses and contents printed by the 'x' command are not saved
  7244. in the value history because there is often too much of them and they
  7245. would get in the way. Instead, GDB makes these values available for
  7246. subsequent use in expressions as values of the convenience variables
  7247. '$_' and '$__'. After an 'x' command, the last address examined is
  7248. available for use in expressions in the convenience variable '$_'. The
  7249. contents of that address, as examined, are available in the convenience
  7250. variable '$__'.
  7251. If the 'x' command has a repeat count, the address and contents saved
  7252. are from the last memory unit printed; this is not the same as the last
  7253. address printed if several units were printed on the last line of
  7254. output.
  7255. Most targets have an addressable memory unit size of 8 bits. This
  7256. means that to each memory address are associated 8 bits of data. Some
  7257. targets, however, have other addressable memory unit sizes. Within GDB
  7258. and this document, the term "addressable memory unit" (or "memory unit"
  7259. for short) is used when explicitly referring to a chunk of data of that
  7260. size. The word "byte" is used to refer to a chunk of data of 8 bits,
  7261. regardless of the addressable memory unit size of the target. For most
  7262. systems, addressable memory unit is a synonym of byte.
  7263. When you are debugging a program running on a remote target machine
  7264. (*note Remote Debugging::), you may wish to verify the program's image
  7265. in the remote machine's memory against the executable file you
  7266. downloaded to the target. Or, on any target, you may want to check
  7267. whether the program has corrupted its own read-only sections. The
  7268. 'compare-sections' command is provided for such situations.
  7269. 'compare-sections [SECTION-NAME|-r]'
  7270. Compare the data of a loadable section SECTION-NAME in the
  7271. executable file of the program being debugged with the same section
  7272. in the target machine's memory, and report any mismatches. With no
  7273. arguments, compares all loadable sections. With an argument of
  7274. '-r', compares all loadable read-only sections.
  7275. Note: for remote targets, this command can be accelerated if the
  7276. target supports computing the CRC checksum of a block of memory
  7277. (*note qCRC packet::).
  7278. 
  7279. File: gdb.info, Node: Auto Display, Next: Print Settings, Prev: Memory, Up: Data
  7280. 10.7 Automatic Display
  7281. ======================
  7282. If you find that you want to print the value of an expression frequently
  7283. (to see how it changes), you might want to add it to the "automatic
  7284. display list" so that GDB prints its value each time your program stops.
  7285. Each expression added to the list is given a number to identify it; to
  7286. remove an expression from the list, you specify that number. The
  7287. automatic display looks like this:
  7288. 2: foo = 38
  7289. 3: bar[5] = (struct hack *) 0x3804
  7290. This display shows item numbers, expressions and their current values.
  7291. As with displays you request manually using 'x' or 'print', you can
  7292. specify the output format you prefer; in fact, 'display' decides whether
  7293. to use 'print' or 'x' depending your format specification--it uses 'x'
  7294. if you specify either the 'i' or 's' format, or a unit size; otherwise
  7295. it uses 'print'.
  7296. 'display EXPR'
  7297. Add the expression EXPR to the list of expressions to display each
  7298. time your program stops. *Note Expressions: Expressions.
  7299. 'display' does not repeat if you press <RET> again after using it.
  7300. 'display/FMT EXPR'
  7301. For FMT specifying only a display format and not a size or count,
  7302. add the expression EXPR to the auto-display list but arrange to
  7303. display it each time in the specified format FMT. *Note Output
  7304. Formats: Output Formats.
  7305. 'display/FMT ADDR'
  7306. For FMT 'i' or 's', or including a unit-size or a number of units,
  7307. add the expression ADDR as a memory address to be examined each
  7308. time your program stops. Examining means in effect doing 'x/FMT
  7309. ADDR'. *Note Examining Memory: Memory.
  7310. For example, 'display/i $pc' can be helpful, to see the machine
  7311. instruction about to be executed each time execution stops ('$pc' is a
  7312. common name for the program counter; *note Registers: Registers.).
  7313. 'undisplay DNUMS...'
  7314. 'delete display DNUMS...'
  7315. Remove items from the list of expressions to display. Specify the
  7316. numbers of the displays that you want affected with the command
  7317. argument DNUMS. It can be a single display number, one of the
  7318. numbers shown in the first field of the 'info display' display; or
  7319. it could be a range of display numbers, as in '2-4'.
  7320. 'undisplay' does not repeat if you press <RET> after using it.
  7321. (Otherwise you would just get the error 'No display number ...'.)
  7322. 'disable display DNUMS...'
  7323. Disable the display of item numbers DNUMS. A disabled display item
  7324. is not printed automatically, but is not forgotten. It may be
  7325. enabled again later. Specify the numbers of the displays that you
  7326. want affected with the command argument DNUMS. It can be a single
  7327. display number, one of the numbers shown in the first field of the
  7328. 'info display' display; or it could be a range of display numbers,
  7329. as in '2-4'.
  7330. 'enable display DNUMS...'
  7331. Enable display of item numbers DNUMS. It becomes effective once
  7332. again in auto display of its expression, until you specify
  7333. otherwise. Specify the numbers of the displays that you want
  7334. affected with the command argument DNUMS. It can be a single
  7335. display number, one of the numbers shown in the first field of the
  7336. 'info display' display; or it could be a range of display numbers,
  7337. as in '2-4'.
  7338. 'display'
  7339. Display the current values of the expressions on the list, just as
  7340. is done when your program stops.
  7341. 'info display'
  7342. Print the list of expressions previously set up to display
  7343. automatically, each one with its item number, but without showing
  7344. the values. This includes disabled expressions, which are marked
  7345. as such. It also includes expressions which would not be displayed
  7346. right now because they refer to automatic variables not currently
  7347. available.
  7348. If a display expression refers to local variables, then it does not
  7349. make sense outside the lexical context for which it was set up. Such an
  7350. expression is disabled when execution enters a context where one of its
  7351. variables is not defined. For example, if you give the command 'display
  7352. last_char' while inside a function with an argument 'last_char', GDB
  7353. displays this argument while your program continues to stop inside that
  7354. function. When it stops elsewhere--where there is no variable
  7355. 'last_char'--the display is disabled automatically. The next time your
  7356. program stops where 'last_char' is meaningful, you can enable the
  7357. display expression once again.
  7358. 
  7359. File: gdb.info, Node: Print Settings, Next: Pretty Printing, Prev: Auto Display, Up: Data
  7360. 10.8 Print Settings
  7361. ===================
  7362. GDB provides the following ways to control how arrays, structures, and
  7363. symbols are printed.
  7364. These settings are useful for debugging programs in any language:
  7365. 'set print address'
  7366. 'set print address on'
  7367. GDB prints memory addresses showing the location of stack traces,
  7368. structure values, pointer values, breakpoints, and so forth, even
  7369. when it also displays the contents of those addresses. The default
  7370. is 'on'. For example, this is what a stack frame display looks
  7371. like with 'set print address on':
  7372. (gdb) f
  7373. #0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>")
  7374. at input.c:530
  7375. 530 if (lquote != def_lquote)
  7376. 'set print address off'
  7377. Do not print addresses when displaying their contents. For
  7378. example, this is the same stack frame displayed with 'set print
  7379. address off':
  7380. (gdb) set print addr off
  7381. (gdb) f
  7382. #0 set_quotes (lq="<<", rq=">>") at input.c:530
  7383. 530 if (lquote != def_lquote)
  7384. You can use 'set print address off' to eliminate all machine
  7385. dependent displays from the GDB interface. For example, with
  7386. 'print address off', you should get the same text for backtraces on
  7387. all machines--whether or not they involve pointer arguments.
  7388. 'show print address'
  7389. Show whether or not addresses are to be printed.
  7390. When GDB prints a symbolic address, it normally prints the closest
  7391. earlier symbol plus an offset. If that symbol does not uniquely
  7392. identify the address (for example, it is a name whose scope is a single
  7393. source file), you may need to clarify. One way to do this is with 'info
  7394. line', for example 'info line *0x4537'. Alternately, you can set GDB to
  7395. print the source file and line number when it prints a symbolic address:
  7396. 'set print symbol-filename on'
  7397. Tell GDB to print the source file name and line number of a symbol
  7398. in the symbolic form of an address.
  7399. 'set print symbol-filename off'
  7400. Do not print source file name and line number of a symbol. This is
  7401. the default.
  7402. 'show print symbol-filename'
  7403. Show whether or not GDB will print the source file name and line
  7404. number of a symbol in the symbolic form of an address.
  7405. Another situation where it is helpful to show symbol filenames and
  7406. line numbers is when disassembling code; GDB shows you the line number
  7407. and source file that corresponds to each instruction.
  7408. Also, you may wish to see the symbolic form only if the address being
  7409. printed is reasonably close to the closest earlier symbol:
  7410. 'set print max-symbolic-offset MAX-OFFSET'
  7411. 'set print max-symbolic-offset unlimited'
  7412. Tell GDB to only display the symbolic form of an address if the
  7413. offset between the closest earlier symbol and the address is less
  7414. than MAX-OFFSET. The default is 'unlimited', which tells GDB to
  7415. always print the symbolic form of an address if any symbol precedes
  7416. it. Zero is equivalent to 'unlimited'.
  7417. 'show print max-symbolic-offset'
  7418. Ask how large the maximum offset is that GDB prints in a symbolic
  7419. address.
  7420. If you have a pointer and you are not sure where it points, try 'set
  7421. print symbol-filename on'. Then you can determine the name and source
  7422. file location of the variable where it points, using 'p/a POINTER'.
  7423. This interprets the address in symbolic form. For example, here GDB
  7424. shows that a variable 'ptt' points at another variable 't', defined in
  7425. 'hi2.c':
  7426. (gdb) set print symbol-filename on
  7427. (gdb) p/a ptt
  7428. $4 = 0xe008 <t in hi2.c>
  7429. _Warning:_ For pointers that point to a local variable, 'p/a' does
  7430. not show the symbol name and filename of the referent, even with
  7431. the appropriate 'set print' options turned on.
  7432. You can also enable '/a'-like formatting all the time using 'set
  7433. print symbol on':
  7434. 'set print symbol on'
  7435. Tell GDB to print the symbol corresponding to an address, if one
  7436. exists.
  7437. 'set print symbol off'
  7438. Tell GDB not to print the symbol corresponding to an address. In
  7439. this mode, GDB will still print the symbol corresponding to
  7440. pointers to functions. This is the default.
  7441. 'show print symbol'
  7442. Show whether GDB will display the symbol corresponding to an
  7443. address.
  7444. Other settings control how different kinds of objects are printed:
  7445. 'set print array'
  7446. 'set print array on'
  7447. Pretty print arrays. This format is more convenient to read, but
  7448. uses more space. The default is off.
  7449. 'set print array off'
  7450. Return to compressed format for arrays.
  7451. 'show print array'
  7452. Show whether compressed or pretty format is selected for displaying
  7453. arrays.
  7454. 'set print array-indexes'
  7455. 'set print array-indexes on'
  7456. Print the index of each element when displaying arrays. May be
  7457. more convenient to locate a given element in the array or quickly
  7458. find the index of a given element in that printed array. The
  7459. default is off.
  7460. 'set print array-indexes off'
  7461. Stop printing element indexes when displaying arrays.
  7462. 'show print array-indexes'
  7463. Show whether the index of each element is printed when displaying
  7464. arrays.
  7465. 'set print elements NUMBER-OF-ELEMENTS'
  7466. 'set print elements unlimited'
  7467. Set a limit on how many elements of an array GDB will print. If
  7468. GDB is printing a large array, it stops printing after it has
  7469. printed the number of elements set by the 'set print elements'
  7470. command. This limit also applies to the display of strings. When
  7471. GDB starts, this limit is set to 200. Setting NUMBER-OF-ELEMENTS
  7472. to 'unlimited' or zero means that the number of elements to print
  7473. is unlimited.
  7474. 'show print elements'
  7475. Display the number of elements of a large array that GDB will
  7476. print. If the number is 0, then the printing is unlimited.
  7477. 'set print frame-arguments VALUE'
  7478. This command allows to control how the values of arguments are
  7479. printed when the debugger prints a frame (*note Frames::). The
  7480. possible values are:
  7481. 'all'
  7482. The values of all arguments are printed.
  7483. 'scalars'
  7484. Print the value of an argument only if it is a scalar. The
  7485. value of more complex arguments such as arrays, structures,
  7486. unions, etc, is replaced by '...'. This is the default. Here
  7487. is an example where only scalar arguments are shown:
  7488. #1 0x08048361 in call_me (i=3, s=..., ss=0xbf8d508c, u=..., e=green)
  7489. at frame-args.c:23
  7490. 'none'
  7491. None of the argument values are printed. Instead, the value
  7492. of each argument is replaced by '...'. In this case, the
  7493. example above now becomes:
  7494. #1 0x08048361 in call_me (i=..., s=..., ss=..., u=..., e=...)
  7495. at frame-args.c:23
  7496. 'presence'
  7497. Only the presence of arguments is indicated by '...'. The
  7498. '...' are not printed for function without any arguments.
  7499. None of the argument names and values are printed. In this
  7500. case, the example above now becomes:
  7501. #1 0x08048361 in call_me (...) at frame-args.c:23
  7502. By default, only scalar arguments are printed. This command can be
  7503. used to configure the debugger to print the value of all arguments,
  7504. regardless of their type. However, it is often advantageous to not
  7505. print the value of more complex parameters. For instance, it
  7506. reduces the amount of information printed in each frame, making the
  7507. backtrace more readable. Also, it improves performance when
  7508. displaying Ada frames, because the computation of large arguments
  7509. can sometimes be CPU-intensive, especially in large applications.
  7510. Setting 'print frame-arguments' to 'scalars' (the default), 'none'
  7511. or 'presence' avoids this computation, thus speeding up the display
  7512. of each Ada frame.
  7513. 'show print frame-arguments'
  7514. Show how the value of arguments should be displayed when printing a
  7515. frame.
  7516. 'set print raw-frame-arguments on'
  7517. Print frame arguments in raw, non pretty-printed, form.
  7518. 'set print raw-frame-arguments off'
  7519. Print frame arguments in pretty-printed form, if there is a
  7520. pretty-printer for the value (*note Pretty Printing::), otherwise
  7521. print the value in raw form. This is the default.
  7522. 'show print raw-frame-arguments'
  7523. Show whether to print frame arguments in raw form.
  7524. 'set print entry-values VALUE'
  7525. Set printing of frame argument values at function entry. In some
  7526. cases GDB can determine the value of function argument which was
  7527. passed by the function caller, even if the value was modified
  7528. inside the called function and therefore is different. With
  7529. optimized code, the current value could be unavailable, but the
  7530. entry value may still be known.
  7531. The default value is 'default' (see below for its description).
  7532. Older GDB behaved as with the setting 'no'. Compilers not
  7533. supporting this feature will behave in the 'default' setting the
  7534. same way as with the 'no' setting.
  7535. This functionality is currently supported only by DWARF 2 debugging
  7536. format and the compiler has to produce 'DW_TAG_call_site' tags.
  7537. With GCC, you need to specify '-O -g' during compilation, to get
  7538. this information.
  7539. The VALUE parameter can be one of the following:
  7540. 'no'
  7541. Print only actual parameter values, never print values from
  7542. function entry point.
  7543. #0 equal (val=5)
  7544. #0 different (val=6)
  7545. #0 lost (val=<optimized out>)
  7546. #0 born (val=10)
  7547. #0 invalid (val=<optimized out>)
  7548. 'only'
  7549. Print only parameter values from function entry point. The
  7550. actual parameter values are never printed.
  7551. #0 equal (val@entry=5)
  7552. #0 different (val@entry=5)
  7553. #0 lost (val@entry=5)
  7554. #0 born (val@entry=<optimized out>)
  7555. #0 invalid (val@entry=<optimized out>)
  7556. 'preferred'
  7557. Print only parameter values from function entry point. If
  7558. value from function entry point is not known while the actual
  7559. value is known, print the actual value for such parameter.
  7560. #0 equal (val@entry=5)
  7561. #0 different (val@entry=5)
  7562. #0 lost (val@entry=5)
  7563. #0 born (val=10)
  7564. #0 invalid (val@entry=<optimized out>)
  7565. 'if-needed'
  7566. Print actual parameter values. If actual parameter value is
  7567. not known while value from function entry point is known,
  7568. print the entry point value for such parameter.
  7569. #0 equal (val=5)
  7570. #0 different (val=6)
  7571. #0 lost (val@entry=5)
  7572. #0 born (val=10)
  7573. #0 invalid (val=<optimized out>)
  7574. 'both'
  7575. Always print both the actual parameter value and its value
  7576. from function entry point, even if values of one or both are
  7577. not available due to compiler optimizations.
  7578. #0 equal (val=5, val@entry=5)
  7579. #0 different (val=6, val@entry=5)
  7580. #0 lost (val=<optimized out>, val@entry=5)
  7581. #0 born (val=10, val@entry=<optimized out>)
  7582. #0 invalid (val=<optimized out>, val@entry=<optimized out>)
  7583. 'compact'
  7584. Print the actual parameter value if it is known and also its
  7585. value from function entry point if it is known. If neither is
  7586. known, print for the actual value '<optimized out>'. If not
  7587. in MI mode (*note GDB/MI::) and if both values are known and
  7588. identical, print the shortened 'param=param@entry=VALUE'
  7589. notation.
  7590. #0 equal (val=val@entry=5)
  7591. #0 different (val=6, val@entry=5)
  7592. #0 lost (val@entry=5)
  7593. #0 born (val=10)
  7594. #0 invalid (val=<optimized out>)
  7595. 'default'
  7596. Always print the actual parameter value. Print also its value
  7597. from function entry point, but only if it is known. If not in
  7598. MI mode (*note GDB/MI::) and if both values are known and
  7599. identical, print the shortened 'param=param@entry=VALUE'
  7600. notation.
  7601. #0 equal (val=val@entry=5)
  7602. #0 different (val=6, val@entry=5)
  7603. #0 lost (val=<optimized out>, val@entry=5)
  7604. #0 born (val=10)
  7605. #0 invalid (val=<optimized out>)
  7606. For analysis messages on possible failures of frame argument values
  7607. at function entry resolution see *note set debug entry-values::.
  7608. 'show print entry-values'
  7609. Show the method being used for printing of frame argument values at
  7610. function entry.
  7611. 'set print frame-info VALUE'
  7612. This command allows to control the information printed when the
  7613. debugger prints a frame. See *note Frames::, *note Backtrace::,
  7614. for a general explanation about frames and frame information. Note
  7615. that some other settings (such as 'set print frame-arguments' and
  7616. 'set print address') are also influencing if and how some frame
  7617. information is displayed. In particular, the frame program counter
  7618. is never printed if 'set print address' is off.
  7619. The possible values for 'set print frame-info' are:
  7620. 'short-location'
  7621. Print the frame level, the program counter (if not at the
  7622. beginning of the location source line), the function, the
  7623. function arguments.
  7624. 'location'
  7625. Same as 'short-location' but also print the source file and
  7626. source line number.
  7627. 'location-and-address'
  7628. Same as 'location' but print the program counter even if
  7629. located at the beginning of the location source line.
  7630. 'source-line'
  7631. Print the program counter (if not at the beginning of the
  7632. location source line), the line number and the source line.
  7633. 'source-and-location'
  7634. Print what 'location' and 'source-line' are printing.
  7635. 'auto'
  7636. The information printed for a frame is decided automatically
  7637. by the GDB command that prints a frame. For example, 'frame'
  7638. prints the information printed by 'source-and-location' while
  7639. 'stepi' will switch between 'source-line' and
  7640. 'source-and-location' depending on the program counter. The
  7641. default value is 'auto'.
  7642. 'set print repeats NUMBER-OF-REPEATS'
  7643. 'set print repeats unlimited'
  7644. Set the threshold for suppressing display of repeated array
  7645. elements. When the number of consecutive identical elements of an
  7646. array exceeds the threshold, GDB prints the string '"<repeats N
  7647. times>"', where N is the number of identical repetitions, instead
  7648. of displaying the identical elements themselves. Setting the
  7649. threshold to 'unlimited' or zero will cause all elements to be
  7650. individually printed. The default threshold is 10.
  7651. 'show print repeats'
  7652. Display the current threshold for printing repeated identical
  7653. elements.
  7654. 'set print max-depth DEPTH'
  7655. 'set print max-depth unlimited'
  7656. Set the threshold after which nested structures are replaced with
  7657. ellipsis, this can make visualising deeply nested structures
  7658. easier.
  7659. For example, given this C code
  7660. typedef struct s1 { int a; } s1;
  7661. typedef struct s2 { s1 b; } s2;
  7662. typedef struct s3 { s2 c; } s3;
  7663. typedef struct s4 { s3 d; } s4;
  7664. s4 var = { { { { 3 } } } };
  7665. The following table shows how different values of DEPTH will effect
  7666. how 'var' is printed by GDB:
  7667. DEPTH setting Result of 'p var'
  7668. --------------------------------------------------------------------------
  7669. unlimited '$1 = {d = {c = {b = {a = 3}}}}'
  7670. '0' '$1 = {...}'
  7671. '1' '$1 = {d = {...}}'
  7672. '2' '$1 = {d = {c = {...}}}'
  7673. '3' '$1 = {d = {c = {b = {...}}}}'
  7674. '4' '$1 = {d = {c = {b = {a = 3}}}}'
  7675. To see the contents of structures that have been hidden the user
  7676. can either increase the print max-depth, or they can print the
  7677. elements of the structure that are visible, for example
  7678. (gdb) set print max-depth 2
  7679. (gdb) p var
  7680. $1 = {d = {c = {...}}}
  7681. (gdb) p var.d
  7682. $2 = {c = {b = {...}}}
  7683. (gdb) p var.d.c
  7684. $3 = {b = {a = 3}}
  7685. The pattern used to replace nested structures varies based on
  7686. language, for most languages '{...}' is used, but Fortran uses
  7687. '(...)'.
  7688. 'show print max-depth'
  7689. Display the current threshold after which nested structures are
  7690. replaces with ellipsis.
  7691. 'set print null-stop'
  7692. Cause GDB to stop printing the characters of an array when the
  7693. first NULL is encountered. This is useful when large arrays
  7694. actually contain only short strings. The default is off.
  7695. 'show print null-stop'
  7696. Show whether GDB stops printing an array on the first NULL
  7697. character.
  7698. 'set print pretty on'
  7699. Cause GDB to print structures in an indented format with one member
  7700. per line, like this:
  7701. $1 = {
  7702. next = 0x0,
  7703. flags = {
  7704. sweet = 1,
  7705. sour = 1
  7706. },
  7707. meat = 0x54 "Pork"
  7708. }
  7709. 'set print pretty off'
  7710. Cause GDB to print structures in a compact format, like this:
  7711. $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \
  7712. meat = 0x54 "Pork"}
  7713. This is the default format.
  7714. 'show print pretty'
  7715. Show which format GDB is using to print structures.
  7716. 'set print raw-values on'
  7717. Print values in raw form, without applying the pretty printers for
  7718. the value.
  7719. 'set print raw-values off'
  7720. Print values in pretty-printed form, if there is a pretty-printer
  7721. for the value (*note Pretty Printing::), otherwise print the value
  7722. in raw form.
  7723. The default setting is "off".
  7724. 'show print raw-values'
  7725. Show whether to print values in raw form.
  7726. 'set print sevenbit-strings on'
  7727. Print using only seven-bit characters; if this option is set, GDB
  7728. displays any eight-bit characters (in strings or character values)
  7729. using the notation '\'NNN. This setting is best if you are working
  7730. in English (ASCII) and you use the high-order bit of characters as
  7731. a marker or "meta" bit.
  7732. 'set print sevenbit-strings off'
  7733. Print full eight-bit characters. This allows the use of more
  7734. international character sets, and is the default.
  7735. 'show print sevenbit-strings'
  7736. Show whether or not GDB is printing only seven-bit characters.
  7737. 'set print union on'
  7738. Tell GDB to print unions which are contained in structures and
  7739. other unions. This is the default setting.
  7740. 'set print union off'
  7741. Tell GDB not to print unions which are contained in structures and
  7742. other unions. GDB will print '"{...}"' instead.
  7743. 'show print union'
  7744. Ask GDB whether or not it will print unions which are contained in
  7745. structures and other unions.
  7746. For example, given the declarations
  7747. typedef enum {Tree, Bug} Species;
  7748. typedef enum {Big_tree, Acorn, Seedling} Tree_forms;
  7749. typedef enum {Caterpillar, Cocoon, Butterfly}
  7750. Bug_forms;
  7751. struct thing {
  7752. Species it;
  7753. union {
  7754. Tree_forms tree;
  7755. Bug_forms bug;
  7756. } form;
  7757. };
  7758. struct thing foo = {Tree, {Acorn}};
  7759. with 'set print union on' in effect 'p foo' would print
  7760. $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}}
  7761. and with 'set print union off' in effect it would print
  7762. $1 = {it = Tree, form = {...}}
  7763. 'set print union' affects programs written in C-like languages and
  7764. in Pascal.
  7765. These settings are of interest when debugging C++ programs:
  7766. 'set print demangle'
  7767. 'set print demangle on'
  7768. Print C++ names in their source form rather than in the encoded
  7769. ("mangled") form passed to the assembler and linker for type-safe
  7770. linkage. The default is on.
  7771. 'show print demangle'
  7772. Show whether C++ names are printed in mangled or demangled form.
  7773. 'set print asm-demangle'
  7774. 'set print asm-demangle on'
  7775. Print C++ names in their source form rather than their mangled
  7776. form, even in assembler code printouts such as instruction
  7777. disassemblies. The default is off.
  7778. 'show print asm-demangle'
  7779. Show whether C++ names in assembly listings are printed in mangled
  7780. or demangled form.
  7781. 'set demangle-style STYLE'
  7782. Choose among several encoding schemes used by different compilers
  7783. to represent C++ names. If you omit STYLE, you will see a list of
  7784. possible formats. The default value is AUTO, which lets GDB choose
  7785. a decoding style by inspecting your program.
  7786. 'show demangle-style'
  7787. Display the encoding style currently in use for decoding C++
  7788. symbols.
  7789. 'set print object'
  7790. 'set print object on'
  7791. When displaying a pointer to an object, identify the _actual_
  7792. (derived) type of the object rather than the _declared_ type, using
  7793. the virtual function table. Note that the virtual function table
  7794. is required--this feature can only work for objects that have
  7795. run-time type identification; a single virtual method in the
  7796. object's declared type is sufficient. Note that this setting is
  7797. also taken into account when working with variable objects via MI
  7798. (*note GDB/MI::).
  7799. 'set print object off'
  7800. Display only the declared type of objects, without reference to the
  7801. virtual function table. This is the default setting.
  7802. 'show print object'
  7803. Show whether actual, or declared, object types are displayed.
  7804. 'set print static-members'
  7805. 'set print static-members on'
  7806. Print static members when displaying a C++ object. The default is
  7807. on.
  7808. 'set print static-members off'
  7809. Do not print static members when displaying a C++ object.
  7810. 'show print static-members'
  7811. Show whether C++ static members are printed or not.
  7812. 'set print pascal_static-members'
  7813. 'set print pascal_static-members on'
  7814. Print static members when displaying a Pascal object. The default
  7815. is on.
  7816. 'set print pascal_static-members off'
  7817. Do not print static members when displaying a Pascal object.
  7818. 'show print pascal_static-members'
  7819. Show whether Pascal static members are printed or not.
  7820. 'set print vtbl'
  7821. 'set print vtbl on'
  7822. Pretty print C++ virtual function tables. The default is off.
  7823. (The 'vtbl' commands do not work on programs compiled with the HP
  7824. ANSI C++ compiler ('aCC').)
  7825. 'set print vtbl off'
  7826. Do not pretty print C++ virtual function tables.
  7827. 'show print vtbl'
  7828. Show whether C++ virtual function tables are pretty printed, or
  7829. not.
  7830. 
  7831. File: gdb.info, Node: Pretty Printing, Next: Value History, Prev: Print Settings, Up: Data
  7832. 10.9 Pretty Printing
  7833. ====================
  7834. GDB provides a mechanism to allow pretty-printing of values using Python
  7835. code. It greatly simplifies the display of complex objects. This
  7836. mechanism works for both MI and the CLI.
  7837. * Menu:
  7838. * Pretty-Printer Introduction:: Introduction to pretty-printers
  7839. * Pretty-Printer Example:: An example pretty-printer
  7840. * Pretty-Printer Commands:: Pretty-printer commands
  7841. 
  7842. File: gdb.info, Node: Pretty-Printer Introduction, Next: Pretty-Printer Example, Up: Pretty Printing
  7843. 10.9.1 Pretty-Printer Introduction
  7844. ----------------------------------
  7845. When GDB prints a value, it first sees if there is a pretty-printer
  7846. registered for the value. If there is then GDB invokes the
  7847. pretty-printer to print the value. Otherwise the value is printed
  7848. normally.
  7849. Pretty-printers are normally named. This makes them easy to manage.
  7850. The 'info pretty-printer' command will list all the installed
  7851. pretty-printers with their names. If a pretty-printer can handle
  7852. multiple data types, then its "subprinters" are the printers for the
  7853. individual data types. Each such subprinter has its own name. The
  7854. format of the name is PRINTER-NAME;SUBPRINTER-NAME.
  7855. Pretty-printers are installed by "registering" them with GDB.
  7856. Typically they are automatically loaded and registered when the
  7857. corresponding debug information is loaded, thus making them available
  7858. without having to do anything special.
  7859. There are three places where a pretty-printer can be registered.
  7860. * Pretty-printers registered globally are available when debugging
  7861. all inferiors.
  7862. * Pretty-printers registered with a program space are available only
  7863. when debugging that program. *Note Progspaces In Python::, for
  7864. more details on program spaces in Python.
  7865. * Pretty-printers registered with an objfile are loaded and unloaded
  7866. with the corresponding objfile (e.g., shared library). *Note
  7867. Objfiles In Python::, for more details on objfiles in Python.
  7868. *Note Selecting Pretty-Printers::, for further information on how
  7869. pretty-printers are selected,
  7870. *Note Writing a Pretty-Printer::, for implementing pretty printers
  7871. for new types.
  7872. 
  7873. File: gdb.info, Node: Pretty-Printer Example, Next: Pretty-Printer Commands, Prev: Pretty-Printer Introduction, Up: Pretty Printing
  7874. 10.9.2 Pretty-Printer Example
  7875. -----------------------------
  7876. Here is how a C++ 'std::string' looks without a pretty-printer:
  7877. (gdb) print s
  7878. $1 = {
  7879. static npos = 4294967295,
  7880. _M_dataplus = {
  7881. <std::allocator<char>> = {
  7882. <__gnu_cxx::new_allocator<char>> = {
  7883. <No data fields>}, <No data fields>
  7884. },
  7885. members of std::basic_string<char, std::char_traits<char>,
  7886. std::allocator<char> >::_Alloc_hider:
  7887. _M_p = 0x804a014 "abcd"
  7888. }
  7889. }
  7890. With a pretty-printer for 'std::string' only the contents are
  7891. printed:
  7892. (gdb) print s
  7893. $2 = "abcd"
  7894. 
  7895. File: gdb.info, Node: Pretty-Printer Commands, Prev: Pretty-Printer Example, Up: Pretty Printing
  7896. 10.9.3 Pretty-Printer Commands
  7897. ------------------------------
  7898. 'info pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7899. Print the list of installed pretty-printers. This includes
  7900. disabled pretty-printers, which are marked as such.
  7901. OBJECT-REGEXP is a regular expression matching the objects whose
  7902. pretty-printers to list. Objects can be 'global', the program
  7903. space's file (*note Progspaces In Python::), and the object files
  7904. within that program space (*note Objfiles In Python::). *Note
  7905. Selecting Pretty-Printers::, for details on how GDB looks up a
  7906. printer from these three objects.
  7907. NAME-REGEXP is a regular expression matching the name of the
  7908. printers to list.
  7909. 'disable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7910. Disable pretty-printers matching OBJECT-REGEXP and NAME-REGEXP. A
  7911. disabled pretty-printer is not forgotten, it may be enabled again
  7912. later.
  7913. 'enable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7914. Enable pretty-printers matching OBJECT-REGEXP and NAME-REGEXP.
  7915. Example:
  7916. Suppose we have three pretty-printers installed: one from library1.so
  7917. named 'foo' that prints objects of type 'foo', and another from
  7918. library2.so named 'bar' that prints two types of objects, 'bar1' and
  7919. 'bar2'.
  7920. (gdb) info pretty-printer
  7921. library1.so:
  7922. foo
  7923. library2.so:
  7924. bar
  7925. bar1
  7926. bar2
  7927. (gdb) info pretty-printer library2
  7928. library2.so:
  7929. bar
  7930. bar1
  7931. bar2
  7932. (gdb) disable pretty-printer library1
  7933. 1 printer disabled
  7934. 2 of 3 printers enabled
  7935. (gdb) info pretty-printer
  7936. library1.so:
  7937. foo [disabled]
  7938. library2.so:
  7939. bar
  7940. bar1
  7941. bar2
  7942. (gdb) disable pretty-printer library2 bar;bar1
  7943. 1 printer disabled
  7944. 1 of 3 printers enabled
  7945. (gdb) info pretty-printer library2
  7946. library1.so:
  7947. foo [disabled]
  7948. library2.so:
  7949. bar
  7950. bar1 [disabled]
  7951. bar2
  7952. (gdb) disable pretty-printer library2 bar
  7953. 1 printer disabled
  7954. 0 of 3 printers enabled
  7955. (gdb) info pretty-printer library2
  7956. library1.so:
  7957. foo [disabled]
  7958. library2.so:
  7959. bar [disabled]
  7960. bar1 [disabled]
  7961. bar2
  7962. Note that for 'bar' the entire printer can be disabled, as can each
  7963. individual subprinter.
  7964. Printing values and frame arguments is done by default using the
  7965. enabled pretty printers.
  7966. The print option '-raw-values' and GDB setting 'set print raw-values'
  7967. (*note set print raw-values::) can be used to print values without
  7968. applying the enabled pretty printers.
  7969. Similarly, the backtrace option '-raw-frame-arguments' and GDB
  7970. setting 'set print raw-frame-arguments' (*note set print
  7971. raw-frame-arguments::) can be used to ignore the enabled pretty printers
  7972. when printing frame argument values.
  7973. 
  7974. File: gdb.info, Node: Value History, Next: Convenience Vars, Prev: Pretty Printing, Up: Data
  7975. 10.10 Value History
  7976. ===================
  7977. Values printed by the 'print' command are saved in the GDB "value
  7978. history". This allows you to refer to them in other expressions.
  7979. Values are kept until the symbol table is re-read or discarded (for
  7980. example with the 'file' or 'symbol-file' commands). When the symbol
  7981. table changes, the value history is discarded, since the values may
  7982. contain pointers back to the types defined in the symbol table.
  7983. The values printed are given "history numbers" by which you can refer
  7984. to them. These are successive integers starting with one. 'print'
  7985. shows you the history number assigned to a value by printing '$NUM = '
  7986. before the value; here NUM is the history number.
  7987. To refer to any previous value, use '$' followed by the value's
  7988. history number. The way 'print' labels its output is designed to remind
  7989. you of this. Just '$' refers to the most recent value in the history,
  7990. and '$$' refers to the value before that. '$$N' refers to the Nth value
  7991. from the end; '$$2' is the value just prior to '$$', '$$1' is equivalent
  7992. to '$$', and '$$0' is equivalent to '$'.
  7993. For example, suppose you have just printed a pointer to a structure
  7994. and want to see the contents of the structure. It suffices to type
  7995. p *$
  7996. If you have a chain of structures where the component 'next' points
  7997. to the next one, you can print the contents of the next one with this:
  7998. p *$.next
  7999. You can print successive links in the chain by repeating this
  8000. command--which you can do by just typing <RET>.
  8001. Note that the history records values, not expressions. If the value
  8002. of 'x' is 4 and you type these commands:
  8003. print x
  8004. set x=5
  8005. then the value recorded in the value history by the 'print' command
  8006. remains 4 even though the value of 'x' has changed.
  8007. 'show values'
  8008. Print the last ten values in the value history, with their item
  8009. numbers. This is like 'p $$9' repeated ten times, except that
  8010. 'show values' does not change the history.
  8011. 'show values N'
  8012. Print ten history values centered on history item number N.
  8013. 'show values +'
  8014. Print ten history values just after the values last printed. If no
  8015. more values are available, 'show values +' produces no display.
  8016. Pressing <RET> to repeat 'show values N' has exactly the same effect
  8017. as 'show values +'.
  8018. 
  8019. File: gdb.info, Node: Convenience Vars, Next: Convenience Funs, Prev: Value History, Up: Data
  8020. 10.11 Convenience Variables
  8021. ===========================
  8022. GDB provides "convenience variables" that you can use within GDB to hold
  8023. on to a value and refer to it later. These variables exist entirely
  8024. within GDB; they are not part of your program, and setting a convenience
  8025. variable has no direct effect on further execution of your program.
  8026. That is why you can use them freely.
  8027. Convenience variables are prefixed with '$'. Any name preceded by
  8028. '$' can be used for a convenience variable, unless it is one of the
  8029. predefined machine-specific register names (*note Registers:
  8030. Registers.). (Value history references, in contrast, are _numbers_
  8031. preceded by '$'. *Note Value History: Value History.)
  8032. You can save a value in a convenience variable with an assignment
  8033. expression, just as you would set a variable in your program. For
  8034. example:
  8035. set $foo = *object_ptr
  8036. would save in '$foo' the value contained in the object pointed to by
  8037. 'object_ptr'.
  8038. Using a convenience variable for the first time creates it, but its
  8039. value is 'void' until you assign a new value. You can alter the value
  8040. with another assignment at any time.
  8041. Convenience variables have no fixed types. You can assign a
  8042. convenience variable any type of value, including structures and arrays,
  8043. even if that variable already has a value of a different type. The
  8044. convenience variable, when used as an expression, has the type of its
  8045. current value.
  8046. 'show convenience'
  8047. Print a list of convenience variables used so far, and their
  8048. values, as well as a list of the convenience functions.
  8049. Abbreviated 'show conv'.
  8050. 'init-if-undefined $VARIABLE = EXPRESSION'
  8051. Set a convenience variable if it has not already been set. This is
  8052. useful for user-defined commands that keep some state. It is
  8053. similar, in concept, to using local static variables with
  8054. initializers in C (except that convenience variables are global).
  8055. It can also be used to allow users to override default values used
  8056. in a command script.
  8057. If the variable is already defined then the expression is not
  8058. evaluated so any side-effects do not occur.
  8059. One of the ways to use a convenience variable is as a counter to be
  8060. incremented or a pointer to be advanced. For example, to print a field
  8061. from successive elements of an array of structures:
  8062. set $i = 0
  8063. print bar[$i++]->contents
  8064. Repeat that command by typing <RET>.
  8065. Some convenience variables are created automatically by GDB and given
  8066. values likely to be useful.
  8067. '$_'
  8068. The variable '$_' is automatically set by the 'x' command to the
  8069. last address examined (*note Examining Memory: Memory.). Other
  8070. commands which provide a default address for 'x' to examine also
  8071. set '$_' to that address; these commands include 'info line' and
  8072. 'info breakpoint'. The type of '$_' is 'void *' except when set by
  8073. the 'x' command, in which case it is a pointer to the type of
  8074. '$__'.
  8075. '$__'
  8076. The variable '$__' is automatically set by the 'x' command to the
  8077. value found in the last address examined. Its type is chosen to
  8078. match the format in which the data was printed.
  8079. '$_exitcode'
  8080. When the program being debugged terminates normally, GDB
  8081. automatically sets this variable to the exit code of the program,
  8082. and resets '$_exitsignal' to 'void'.
  8083. '$_exitsignal'
  8084. When the program being debugged dies due to an uncaught signal, GDB
  8085. automatically sets this variable to that signal's number, and
  8086. resets '$_exitcode' to 'void'.
  8087. To distinguish between whether the program being debugged has
  8088. exited (i.e., '$_exitcode' is not 'void') or signalled (i.e.,
  8089. '$_exitsignal' is not 'void'), the convenience function '$_isvoid'
  8090. can be used (*note Convenience Functions: Convenience Funs.). For
  8091. example, considering the following source code:
  8092. #include <signal.h>
  8093. int
  8094. main (int argc, char *argv[])
  8095. {
  8096. raise (SIGALRM);
  8097. return 0;
  8098. }
  8099. A valid way of telling whether the program being debugged has
  8100. exited or signalled would be:
  8101. (gdb) define has_exited_or_signalled
  8102. Type commands for definition of ``has_exited_or_signalled''.
  8103. End with a line saying just ``end''.
  8104. >if $_isvoid ($_exitsignal)
  8105. >echo The program has exited\n
  8106. >else
  8107. >echo The program has signalled\n
  8108. >end
  8109. >end
  8110. (gdb) run
  8111. Starting program:
  8112. Program terminated with signal SIGALRM, Alarm clock.
  8113. The program no longer exists.
  8114. (gdb) has_exited_or_signalled
  8115. The program has signalled
  8116. As can be seen, GDB correctly informs that the program being
  8117. debugged has signalled, since it calls 'raise' and raises a
  8118. 'SIGALRM' signal. If the program being debugged had not called
  8119. 'raise', then GDB would report a normal exit:
  8120. (gdb) has_exited_or_signalled
  8121. The program has exited
  8122. '$_exception'
  8123. The variable '$_exception' is set to the exception object being
  8124. thrown at an exception-related catchpoint. *Note Set
  8125. Catchpoints::.
  8126. '$_ada_exception'
  8127. The variable '$_ada_exception' is set to the address of the
  8128. exception being caught or thrown at an Ada exception-related
  8129. catchpoint. *Note Set Catchpoints::.
  8130. '$_probe_argc'
  8131. '$_probe_arg0...$_probe_arg11'
  8132. Arguments to a static probe. *Note Static Probe Points::.
  8133. '$_sdata'
  8134. The variable '$_sdata' contains extra collected static tracepoint
  8135. data. *Note Tracepoint Action Lists: Tracepoint Actions. Note
  8136. that '$_sdata' could be empty, if not inspecting a trace buffer, or
  8137. if extra static tracepoint data has not been collected.
  8138. '$_siginfo'
  8139. The variable '$_siginfo' contains extra signal information (*note
  8140. extra signal information::). Note that '$_siginfo' could be empty,
  8141. if the application has not yet received any signals. For example,
  8142. it will be empty before you execute the 'run' command.
  8143. '$_tlb'
  8144. The variable '$_tlb' is automatically set when debugging
  8145. applications running on MS-Windows in native mode or connected to
  8146. gdbserver that supports the 'qGetTIBAddr' request. *Note General
  8147. Query Packets::. This variable contains the address of the thread
  8148. information block.
  8149. '$_inferior'
  8150. The number of the current inferior. *Note Debugging Multiple
  8151. Inferiors Connections and Programs: Inferiors Connections and
  8152. Programs.
  8153. '$_thread'
  8154. The thread number of the current thread. *Note thread numbers::.
  8155. '$_gthread'
  8156. The global number of the current thread. *Note global thread
  8157. numbers::.
  8158. '$_gdb_major'
  8159. '$_gdb_minor'
  8160. The major and minor version numbers of the running GDB.
  8161. Development snapshots and pretest versions have their minor version
  8162. incremented by one; thus, GDB pretest 9.11.90 will produce the
  8163. value 12 for '$_gdb_minor'. These variables allow you to write
  8164. scripts that work with different versions of GDB without errors
  8165. caused by features unavailable in some of those versions.
  8166. '$_shell_exitcode'
  8167. '$_shell_exitsignal'
  8168. GDB commands such as 'shell' and '|' are launching shell commands.
  8169. When a launched command terminates, GDB automatically maintains the
  8170. variables '$_shell_exitcode' and '$_shell_exitsignal' according to
  8171. the exit status of the last launched command. These variables are
  8172. set and used similarly to the variables '$_exitcode' and
  8173. '$_exitsignal'.
  8174. 
  8175. File: gdb.info, Node: Convenience Funs, Next: Registers, Prev: Convenience Vars, Up: Data
  8176. 10.12 Convenience Functions
  8177. ===========================
  8178. GDB also supplies some "convenience functions". These have a syntax
  8179. similar to convenience variables. A convenience function can be used in
  8180. an expression just like an ordinary function; however, a convenience
  8181. function is implemented internally to GDB.
  8182. These functions do not require GDB to be configured with 'Python'
  8183. support, which means that they are always available.
  8184. '$_isvoid (EXPR)'
  8185. Return one if the expression EXPR is 'void'. Otherwise it returns
  8186. zero.
  8187. A 'void' expression is an expression where the type of the result
  8188. is 'void'. For example, you can examine a convenience variable
  8189. (see *note Convenience Variables: Convenience Vars.) to check
  8190. whether it is 'void':
  8191. (gdb) print $_exitcode
  8192. $1 = void
  8193. (gdb) print $_isvoid ($_exitcode)
  8194. $2 = 1
  8195. (gdb) run
  8196. Starting program: ./a.out
  8197. [Inferior 1 (process 29572) exited normally]
  8198. (gdb) print $_exitcode
  8199. $3 = 0
  8200. (gdb) print $_isvoid ($_exitcode)
  8201. $4 = 0
  8202. In the example above, we used '$_isvoid' to check whether
  8203. '$_exitcode' is 'void' before and after the execution of the
  8204. program being debugged. Before the execution there is no exit code
  8205. to be examined, therefore '$_exitcode' is 'void'. After the
  8206. execution the program being debugged returned zero, therefore
  8207. '$_exitcode' is zero, which means that it is not 'void' anymore.
  8208. The 'void' expression can also be a call of a function from the
  8209. program being debugged. For example, given the following function:
  8210. void
  8211. foo (void)
  8212. {
  8213. }
  8214. The result of calling it inside GDB is 'void':
  8215. (gdb) print foo ()
  8216. $1 = void
  8217. (gdb) print $_isvoid (foo ())
  8218. $2 = 1
  8219. (gdb) set $v = foo ()
  8220. (gdb) print $v
  8221. $3 = void
  8222. (gdb) print $_isvoid ($v)
  8223. $4 = 1
  8224. '$_gdb_setting_str (SETTING)'
  8225. Return the value of the GDB SETTING as a string. SETTING is any
  8226. setting that can be used in a 'set' or 'show' command (*note
  8227. Controlling GDB::).
  8228. (gdb) show print frame-arguments
  8229. Printing of non-scalar frame arguments is "scalars".
  8230. (gdb) p $_gdb_setting_str("print frame-arguments")
  8231. $1 = "scalars"
  8232. (gdb) p $_gdb_setting_str("height")
  8233. $2 = "30"
  8234. (gdb)
  8235. '$_gdb_setting (SETTING)'
  8236. Return the value of the GDB SETTING. The type of the returned
  8237. value depends on the setting.
  8238. The value type for boolean and auto boolean settings is 'int'. The
  8239. boolean values 'off' and 'on' are converted to the integer values
  8240. '0' and '1'. The value 'auto' is converted to the value '-1'.
  8241. The value type for integer settings is either 'unsigned int' or
  8242. 'int', depending on the setting.
  8243. Some integer settings accept an 'unlimited' value. Depending on
  8244. the setting, the 'set' command also accepts the value '0' or the
  8245. value '-1' as a synonym for 'unlimited'. For example, 'set height
  8246. unlimited' is equivalent to 'set height 0'.
  8247. Some other settings that accept the 'unlimited' value use the value
  8248. '0' to literally mean zero. For example, 'set history size 0'
  8249. indicates to not record any GDB commands in the command history.
  8250. For such settings, '-1' is the synonym for 'unlimited'.
  8251. See the documentation of the corresponding 'set' command for the
  8252. numerical value equivalent to 'unlimited'.
  8253. The '$_gdb_setting' function converts the unlimited value to a '0'
  8254. or a '-1' value according to what the 'set' command uses.
  8255. (gdb) p $_gdb_setting_str("height")
  8256. $1 = "30"
  8257. (gdb) p $_gdb_setting("height")
  8258. $2 = 30
  8259. (gdb) set height unlimited
  8260. (gdb) p $_gdb_setting_str("height")
  8261. $3 = "unlimited"
  8262. (gdb) p $_gdb_setting("height")
  8263. $4 = 0
  8264. (gdb) p $_gdb_setting_str("history size")
  8265. $5 = "unlimited"
  8266. (gdb) p $_gdb_setting("history size")
  8267. $6 = -1
  8268. (gdb) p $_gdb_setting_str("disassemble-next-line")
  8269. $7 = "auto"
  8270. (gdb) p $_gdb_setting("disassemble-next-line")
  8271. $8 = -1
  8272. (gdb)
  8273. Other setting types (enum, filename, optional filename, string,
  8274. string noescape) are returned as string values.
  8275. '$_gdb_maint_setting_str (SETTING)'
  8276. Like the '$_gdb_setting_str' function, but works with 'maintenance
  8277. set' variables.
  8278. '$_gdb_maint_setting (SETTING)'
  8279. Like the '$_gdb_setting' function, but works with 'maintenance set'
  8280. variables.
  8281. The following functions require GDB to be configured with 'Python'
  8282. support.
  8283. '$_memeq(BUF1, BUF2, LENGTH)'
  8284. Returns one if the LENGTH bytes at the addresses given by BUF1 and
  8285. BUF2 are equal. Otherwise it returns zero.
  8286. '$_regex(STR, REGEX)'
  8287. Returns one if the string STR matches the regular expression REGEX.
  8288. Otherwise it returns zero. The syntax of the regular expression is
  8289. that specified by 'Python''s regular expression support.
  8290. '$_streq(STR1, STR2)'
  8291. Returns one if the strings STR1 and STR2 are equal. Otherwise it
  8292. returns zero.
  8293. '$_strlen(STR)'
  8294. Returns the length of string STR.
  8295. '$_caller_is(NAME[, NUMBER_OF_FRAMES])'
  8296. Returns one if the calling function's name is equal to NAME.
  8297. Otherwise it returns zero.
  8298. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8299. number of frames up in the stack to look. The default is 1.
  8300. Example:
  8301. (gdb) backtrace
  8302. #0 bottom_func ()
  8303. at testsuite/gdb.python/py-caller-is.c:21
  8304. #1 0x00000000004005a0 in middle_func ()
  8305. at testsuite/gdb.python/py-caller-is.c:27
  8306. #2 0x00000000004005ab in top_func ()
  8307. at testsuite/gdb.python/py-caller-is.c:33
  8308. #3 0x00000000004005b6 in main ()
  8309. at testsuite/gdb.python/py-caller-is.c:39
  8310. (gdb) print $_caller_is ("middle_func")
  8311. $1 = 1
  8312. (gdb) print $_caller_is ("top_func", 2)
  8313. $1 = 1
  8314. '$_caller_matches(REGEXP[, NUMBER_OF_FRAMES])'
  8315. Returns one if the calling function's name matches the regular
  8316. expression REGEXP. Otherwise it returns zero.
  8317. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8318. number of frames up in the stack to look. The default is 1.
  8319. '$_any_caller_is(NAME[, NUMBER_OF_FRAMES])'
  8320. Returns one if any calling function's name is equal to NAME.
  8321. Otherwise it returns zero.
  8322. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8323. number of frames up in the stack to look. The default is 1.
  8324. This function differs from '$_caller_is' in that this function
  8325. checks all stack frames from the immediate caller to the frame
  8326. specified by NUMBER_OF_FRAMES, whereas '$_caller_is' only checks
  8327. the frame specified by NUMBER_OF_FRAMES.
  8328. '$_any_caller_matches(REGEXP[, NUMBER_OF_FRAMES])'
  8329. Returns one if any calling function's name matches the regular
  8330. expression REGEXP. Otherwise it returns zero.
  8331. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8332. number of frames up in the stack to look. The default is 1.
  8333. This function differs from '$_caller_matches' in that this function
  8334. checks all stack frames from the immediate caller to the frame
  8335. specified by NUMBER_OF_FRAMES, whereas '$_caller_matches' only
  8336. checks the frame specified by NUMBER_OF_FRAMES.
  8337. '$_as_string(VALUE)'
  8338. Return the string representation of VALUE.
  8339. This function is useful to obtain the textual label (enumerator) of
  8340. an enumeration value. For example, assuming the variable NODE is
  8341. of an enumerated type:
  8342. (gdb) printf "Visiting node of type %s\n", $_as_string(node)
  8343. Visiting node of type NODE_INTEGER
  8344. '$_cimag(VALUE)'
  8345. '$_creal(VALUE)'
  8346. Return the imaginary ('$_cimag') or real ('$_creal') part of the
  8347. complex number VALUE.
  8348. The type of the imaginary or real part depends on the type of the
  8349. complex number, e.g., using '$_cimag' on a 'float complex' will
  8350. return an imaginary part of type 'float'.
  8351. GDB provides the ability to list and get help on convenience
  8352. functions.
  8353. 'help function'
  8354. Print a list of all convenience functions.
  8355. 
  8356. File: gdb.info, Node: Registers, Next: Floating Point Hardware, Prev: Convenience Funs, Up: Data
  8357. 10.13 Registers
  8358. ===============
  8359. You can refer to machine register contents, in expressions, as variables
  8360. with names starting with '$'. The names of registers are different for
  8361. each machine; use 'info registers' to see the names used on your
  8362. machine.
  8363. 'info registers'
  8364. Print the names and values of all registers except floating-point
  8365. and vector registers (in the selected stack frame).
  8366. 'info all-registers'
  8367. Print the names and values of all registers, including
  8368. floating-point and vector registers (in the selected stack frame).
  8369. 'info registers REGGROUP ...'
  8370. Print the name and value of the registers in each of the specified
  8371. REGGROUPs. The REGGROUP can be any of those returned by 'maint
  8372. print reggroups' (*note Maintenance Commands::).
  8373. 'info registers REGNAME ...'
  8374. Print the "relativized" value of each specified register REGNAME.
  8375. As discussed in detail below, register values are normally relative
  8376. to the selected stack frame. The REGNAME may be any register name
  8377. valid on the machine you are using, with or without the initial
  8378. '$'.
  8379. GDB has four "standard" register names that are available (in
  8380. expressions) on most machines--whenever they do not conflict with an
  8381. architecture's canonical mnemonics for registers. The register names
  8382. '$pc' and '$sp' are used for the program counter register and the stack
  8383. pointer. '$fp' is used for a register that contains a pointer to the
  8384. current stack frame, and '$ps' is used for a register that contains the
  8385. processor status. For example, you could print the program counter in
  8386. hex with
  8387. p/x $pc
  8388. or print the instruction to be executed next with
  8389. x/i $pc
  8390. or add four to the stack pointer(1) with
  8391. set $sp += 4
  8392. Whenever possible, these four standard register names are available
  8393. on your machine even though the machine has different canonical
  8394. mnemonics, so long as there is no conflict. The 'info registers'
  8395. command shows the canonical names. For example, on the SPARC, 'info
  8396. registers' displays the processor status register as '$psr' but you can
  8397. also refer to it as '$ps'; and on x86-based machines '$ps' is an alias
  8398. for the EFLAGS register.
  8399. GDB always considers the contents of an ordinary register as an
  8400. integer when the register is examined in this way. Some machines have
  8401. special registers which can hold nothing but floating point; these
  8402. registers are considered to have floating point values. There is no way
  8403. to refer to the contents of an ordinary register as floating point value
  8404. (although you can _print_ it as a floating point value with 'print/f
  8405. $REGNAME').
  8406. Some registers have distinct "raw" and "virtual" data formats. This
  8407. means that the data format in which the register contents are saved by
  8408. the operating system is not the same one that your program normally
  8409. sees. For example, the registers of the 68881 floating point
  8410. coprocessor are always saved in "extended" (raw) format, but all C
  8411. programs expect to work with "double" (virtual) format. In such cases,
  8412. GDB normally works with the virtual format only (the format that makes
  8413. sense for your program), but the 'info registers' command prints the
  8414. data in both formats.
  8415. Some machines have special registers whose contents can be
  8416. interpreted in several different ways. For example, modern x86-based
  8417. machines have SSE and MMX registers that can hold several values packed
  8418. together in several different formats. GDB refers to such registers in
  8419. 'struct' notation:
  8420. (gdb) print $xmm1
  8421. $1 = {
  8422. v4_float = {0, 3.43859137e-038, 1.54142831e-044, 1.821688e-044},
  8423. v2_double = {9.92129282474342e-303, 2.7585945287983262e-313},
  8424. v16_int8 = "\000\000\000\000\3706;\001\v\000\000\000\r\000\000",
  8425. v8_int16 = {0, 0, 14072, 315, 11, 0, 13, 0},
  8426. v4_int32 = {0, 20657912, 11, 13},
  8427. v2_int64 = {88725056443645952, 55834574859},
  8428. uint128 = 0x0000000d0000000b013b36f800000000
  8429. }
  8430. To set values of such registers, you need to tell GDB which view of the
  8431. register you wish to change, as if you were assigning value to a
  8432. 'struct' member:
  8433. (gdb) set $xmm1.uint128 = 0x000000000000000000000000FFFFFFFF
  8434. Normally, register values are relative to the selected stack frame
  8435. (*note Selecting a Frame: Selection.). This means that you get the
  8436. value that the register would contain if all stack frames farther in
  8437. were exited and their saved registers restored. In order to see the
  8438. true contents of hardware registers, you must select the innermost frame
  8439. (with 'frame 0').
  8440. Usually ABIs reserve some registers as not needed to be saved by the
  8441. callee (a.k.a.: "caller-saved", "call-clobbered" or "volatile"
  8442. registers). It may therefore not be possible for GDB to know the value
  8443. a register had before the call (in other words, in the outer frame), if
  8444. the register value has since been changed by the callee. GDB tries to
  8445. deduce where the inner frame saved ("callee-saved") registers, from the
  8446. debug info, unwind info, or the machine code generated by your compiler.
  8447. If some register is not saved, and GDB knows the register is
  8448. "caller-saved" (via its own knowledge of the ABI, or because the
  8449. debug/unwind info explicitly says the register's value is undefined),
  8450. GDB displays '<not saved>' as the register's value. With targets that
  8451. GDB has no knowledge of the register saving convention, if a register
  8452. was not saved by the callee, then its value and location in the outer
  8453. frame are assumed to be the same of the inner frame. This is usually
  8454. harmless, because if the register is call-clobbered, the caller either
  8455. does not care what is in the register after the call, or has code to
  8456. restore the value that it does care about. Note, however, that if you
  8457. change such a register in the outer frame, you may also be affecting the
  8458. inner frame. Also, the more "outer" the frame is you're looking at, the
  8459. more likely a call-clobbered register's value is to be wrong, in the
  8460. sense that it doesn't actually represent the value the register had just
  8461. before the call.
  8462. ---------- Footnotes ----------
  8463. (1) This is a way of removing one word from the stack, on machines
  8464. where stacks grow downward in memory (most machines, nowadays). This
  8465. assumes that the innermost stack frame is selected; setting '$sp' is not
  8466. allowed when other stack frames are selected. To pop entire frames off
  8467. the stack, regardless of machine architecture, use 'return'; see *note
  8468. Returning from a Function: Returning.
  8469. 
  8470. File: gdb.info, Node: Floating Point Hardware, Next: Vector Unit, Prev: Registers, Up: Data
  8471. 10.14 Floating Point Hardware
  8472. =============================
  8473. Depending on the configuration, GDB may be able to give you more
  8474. information about the status of the floating point hardware.
  8475. 'info float'
  8476. Display hardware-dependent information about the floating point
  8477. unit. The exact contents and layout vary depending on the floating
  8478. point chip. Currently, 'info float' is supported on the ARM and
  8479. x86 machines.
  8480. 
  8481. File: gdb.info, Node: Vector Unit, Next: OS Information, Prev: Floating Point Hardware, Up: Data
  8482. 10.15 Vector Unit
  8483. =================
  8484. Depending on the configuration, GDB may be able to give you more
  8485. information about the status of the vector unit.
  8486. 'info vector'
  8487. Display information about the vector unit. The exact contents and
  8488. layout vary depending on the hardware.
  8489. 
  8490. File: gdb.info, Node: OS Information, Next: Memory Region Attributes, Prev: Vector Unit, Up: Data
  8491. 10.16 Operating System Auxiliary Information
  8492. ============================================
  8493. GDB provides interfaces to useful OS facilities that can help you debug
  8494. your program.
  8495. Some operating systems supply an "auxiliary vector" to programs at
  8496. startup. This is akin to the arguments and environment that you specify
  8497. for a program, but contains a system-dependent variety of binary values
  8498. that tell system libraries important details about the hardware,
  8499. operating system, and process. Each value's purpose is identified by an
  8500. integer tag; the meanings are well-known but system-specific. Depending
  8501. on the configuration and operating system facilities, GDB may be able to
  8502. show you this information. For remote targets, this functionality may
  8503. further depend on the remote stub's support of the 'qXfer:auxv:read'
  8504. packet, see *note qXfer auxiliary vector read::.
  8505. 'info auxv'
  8506. Display the auxiliary vector of the inferior, which can be either a
  8507. live process or a core dump file. GDB prints each tag value
  8508. numerically, and also shows names and text descriptions for
  8509. recognized tags. Some values in the vector are numbers, some bit
  8510. masks, and some pointers to strings or other data. GDB displays
  8511. each value in the most appropriate form for a recognized tag, and
  8512. in hexadecimal for an unrecognized tag.
  8513. On some targets, GDB can access operating system-specific information
  8514. and show it to you. The types of information available will differ
  8515. depending on the type of operating system running on the target. The
  8516. mechanism used to fetch the data is described in *note Operating System
  8517. Information::. For remote targets, this functionality depends on the
  8518. remote stub's support of the 'qXfer:osdata:read' packet, see *note qXfer
  8519. osdata read::.
  8520. 'info os INFOTYPE'
  8521. Display OS information of the requested type.
  8522. On GNU/Linux, the following values of INFOTYPE are valid:
  8523. 'cpus'
  8524. Display the list of all CPUs/cores. For each CPU/core, GDB
  8525. prints the available fields from /proc/cpuinfo. For each
  8526. supported architecture different fields are available. Two
  8527. common entries are processor which gives CPU number and
  8528. bogomips; a system constant that is calculated during kernel
  8529. initialization.
  8530. 'files'
  8531. Display the list of open file descriptors on the target. For
  8532. each file descriptor, GDB prints the identifier of the process
  8533. owning the descriptor, the command of the owning process, the
  8534. value of the descriptor, and the target of the descriptor.
  8535. 'modules'
  8536. Display the list of all loaded kernel modules on the target.
  8537. For each module, GDB prints the module name, the size of the
  8538. module in bytes, the number of times the module is used, the
  8539. dependencies of the module, the status of the module, and the
  8540. address of the loaded module in memory.
  8541. 'msg'
  8542. Display the list of all System V message queues on the target.
  8543. For each message queue, GDB prints the message queue key, the
  8544. message queue identifier, the access permissions, the current
  8545. number of bytes on the queue, the current number of messages
  8546. on the queue, the processes that last sent and received a
  8547. message on the queue, the user and group of the owner and
  8548. creator of the message queue, the times at which a message was
  8549. last sent and received on the queue, and the time at which the
  8550. message queue was last changed.
  8551. 'processes'
  8552. Display the list of processes on the target. For each
  8553. process, GDB prints the process identifier, the name of the
  8554. user, the command corresponding to the process, and the list
  8555. of processor cores that the process is currently running on.
  8556. (To understand what these properties mean, for this and the
  8557. following info types, please consult the general GNU/Linux
  8558. documentation.)
  8559. 'procgroups'
  8560. Display the list of process groups on the target. For each
  8561. process, GDB prints the identifier of the process group that
  8562. it belongs to, the command corresponding to the process group
  8563. leader, the process identifier, and the command line of the
  8564. process. The list is sorted first by the process group
  8565. identifier, then by the process identifier, so that processes
  8566. belonging to the same process group are grouped together and
  8567. the process group leader is listed first.
  8568. 'semaphores'
  8569. Display the list of all System V semaphore sets on the target.
  8570. For each semaphore set, GDB prints the semaphore set key, the
  8571. semaphore set identifier, the access permissions, the number
  8572. of semaphores in the set, the user and group of the owner and
  8573. creator of the semaphore set, and the times at which the
  8574. semaphore set was operated upon and changed.
  8575. 'shm'
  8576. Display the list of all System V shared-memory regions on the
  8577. target. For each shared-memory region, GDB prints the region
  8578. key, the shared-memory identifier, the access permissions, the
  8579. size of the region, the process that created the region, the
  8580. process that last attached to or detached from the region, the
  8581. current number of live attaches to the region, and the times
  8582. at which the region was last attached to, detach from, and
  8583. changed.
  8584. 'sockets'
  8585. Display the list of Internet-domain sockets on the target.
  8586. For each socket, GDB prints the address and port of the local
  8587. and remote endpoints, the current state of the connection, the
  8588. creator of the socket, the IP address family of the socket,
  8589. and the type of the connection.
  8590. 'threads'
  8591. Display the list of threads running on the target. For each
  8592. thread, GDB prints the identifier of the process that the
  8593. thread belongs to, the command of the process, the thread
  8594. identifier, and the processor core that it is currently
  8595. running on. The main thread of a process is not listed.
  8596. 'info os'
  8597. If INFOTYPE is omitted, then list the possible values for INFOTYPE
  8598. and the kind of OS information available for each INFOTYPE. If the
  8599. target does not return a list of possible types, this command will
  8600. report an error.
  8601. 
  8602. File: gdb.info, Node: Memory Region Attributes, Next: Dump/Restore Files, Prev: OS Information, Up: Data
  8603. 10.17 Memory Region Attributes
  8604. ==============================
  8605. "Memory region attributes" allow you to describe special handling
  8606. required by regions of your target's memory. GDB uses attributes to
  8607. determine whether to allow certain types of memory accesses; whether to
  8608. use specific width accesses; and whether to cache target memory. By
  8609. default the description of memory regions is fetched from the target (if
  8610. the current target supports this), but the user can override the fetched
  8611. regions.
  8612. Defined memory regions can be individually enabled and disabled.
  8613. When a memory region is disabled, GDB uses the default attributes when
  8614. accessing memory in that region. Similarly, if no memory regions have
  8615. been defined, GDB uses the default attributes when accessing all memory.
  8616. When a memory region is defined, it is given a number to identify it;
  8617. to enable, disable, or remove a memory region, you specify that number.
  8618. 'mem LOWER UPPER ATTRIBUTES...'
  8619. Define a memory region bounded by LOWER and UPPER with attributes
  8620. ATTRIBUTES..., and add it to the list of regions monitored by GDB.
  8621. Note that UPPER == 0 is a special case: it is treated as the
  8622. target's maximum memory address. (0xffff on 16 bit targets,
  8623. 0xffffffff on 32 bit targets, etc.)
  8624. 'mem auto'
  8625. Discard any user changes to the memory regions and use
  8626. target-supplied regions, if available, or no regions if the target
  8627. does not support.
  8628. 'delete mem NUMS...'
  8629. Remove memory regions NUMS... from the list of regions monitored by
  8630. GDB.
  8631. 'disable mem NUMS...'
  8632. Disable monitoring of memory regions NUMS.... A disabled memory
  8633. region is not forgotten. It may be enabled again later.
  8634. 'enable mem NUMS...'
  8635. Enable monitoring of memory regions NUMS....
  8636. 'info mem'
  8637. Print a table of all defined memory regions, with the following
  8638. columns for each region:
  8639. _Memory Region Number_
  8640. _Enabled or Disabled._
  8641. Enabled memory regions are marked with 'y'. Disabled memory
  8642. regions are marked with 'n'.
  8643. _Lo Address_
  8644. The address defining the inclusive lower bound of the memory
  8645. region.
  8646. _Hi Address_
  8647. The address defining the exclusive upper bound of the memory
  8648. region.
  8649. _Attributes_
  8650. The list of attributes set for this memory region.
  8651. 10.17.1 Attributes
  8652. ------------------
  8653. 10.17.1.1 Memory Access Mode
  8654. ............................
  8655. The access mode attributes set whether GDB may make read or write
  8656. accesses to a memory region.
  8657. While these attributes prevent GDB from performing invalid memory
  8658. accesses, they do nothing to prevent the target system, I/O DMA, etc.
  8659. from accessing memory.
  8660. 'ro'
  8661. Memory is read only.
  8662. 'wo'
  8663. Memory is write only.
  8664. 'rw'
  8665. Memory is read/write. This is the default.
  8666. 10.17.1.2 Memory Access Size
  8667. ............................
  8668. The access size attribute tells GDB to use specific sized accesses in
  8669. the memory region. Often memory mapped device registers require
  8670. specific sized accesses. If no access size attribute is specified, GDB
  8671. may use accesses of any size.
  8672. '8'
  8673. Use 8 bit memory accesses.
  8674. '16'
  8675. Use 16 bit memory accesses.
  8676. '32'
  8677. Use 32 bit memory accesses.
  8678. '64'
  8679. Use 64 bit memory accesses.
  8680. 10.17.1.3 Data Cache
  8681. ....................
  8682. The data cache attributes set whether GDB will cache target memory.
  8683. While this generally improves performance by reducing debug protocol
  8684. overhead, it can lead to incorrect results because GDB does not know
  8685. about volatile variables or memory mapped device registers.
  8686. 'cache'
  8687. Enable GDB to cache target memory.
  8688. 'nocache'
  8689. Disable GDB from caching target memory. This is the default.
  8690. 10.17.2 Memory Access Checking
  8691. ------------------------------
  8692. GDB can be instructed to refuse accesses to memory that is not
  8693. explicitly described. This can be useful if accessing such regions has
  8694. undesired effects for a specific target, or to provide better error
  8695. checking. The following commands control this behaviour.
  8696. 'set mem inaccessible-by-default [on|off]'
  8697. If 'on' is specified, make GDB treat memory not explicitly
  8698. described by the memory ranges as non-existent and refuse accesses
  8699. to such memory. The checks are only performed if there's at least
  8700. one memory range defined. If 'off' is specified, make GDB treat
  8701. the memory not explicitly described by the memory ranges as RAM.
  8702. The default value is 'on'.
  8703. 'show mem inaccessible-by-default'
  8704. Show the current handling of accesses to unknown memory.
  8705. 
  8706. File: gdb.info, Node: Dump/Restore Files, Next: Core File Generation, Prev: Memory Region Attributes, Up: Data
  8707. 10.18 Copy Between Memory and a File
  8708. ====================================
  8709. You can use the commands 'dump', 'append', and 'restore' to copy data
  8710. between target memory and a file. The 'dump' and 'append' commands
  8711. write data to a file, and the 'restore' command reads data from a file
  8712. back into the inferior's memory. Files may be in binary, Motorola
  8713. S-record, Intel hex, Tektronix Hex, or Verilog Hex format; however, GDB
  8714. can only append to binary files, and cannot read from Verilog Hex files.
  8715. 'dump [FORMAT] memory FILENAME START_ADDR END_ADDR'
  8716. 'dump [FORMAT] value FILENAME EXPR'
  8717. Dump the contents of memory from START_ADDR to END_ADDR, or the
  8718. value of EXPR, to FILENAME in the given format.
  8719. The FORMAT parameter may be any one of:
  8720. 'binary'
  8721. Raw binary form.
  8722. 'ihex'
  8723. Intel hex format.
  8724. 'srec'
  8725. Motorola S-record format.
  8726. 'tekhex'
  8727. Tektronix Hex format.
  8728. 'verilog'
  8729. Verilog Hex format.
  8730. GDB uses the same definitions of these formats as the GNU binary
  8731. utilities, like 'objdump' and 'objcopy'. If FORMAT is omitted, GDB
  8732. dumps the data in raw binary form.
  8733. 'append [binary] memory FILENAME START_ADDR END_ADDR'
  8734. 'append [binary] value FILENAME EXPR'
  8735. Append the contents of memory from START_ADDR to END_ADDR, or the
  8736. value of EXPR, to the file FILENAME, in raw binary form. (GDB can
  8737. only append data to files in raw binary form.)
  8738. 'restore FILENAME [binary] BIAS START END'
  8739. Restore the contents of file FILENAME into memory. The 'restore'
  8740. command can automatically recognize any known BFD file format,
  8741. except for raw binary. To restore a raw binary file you must
  8742. specify the optional keyword 'binary' after the filename.
  8743. If BIAS is non-zero, its value will be added to the addresses
  8744. contained in the file. Binary files always start at address zero,
  8745. so they will be restored at address BIAS. Other bfd files have a
  8746. built-in location; they will be restored at offset BIAS from that
  8747. location.
  8748. If START and/or END are non-zero, then only data between file
  8749. offset START and file offset END will be restored. These offsets
  8750. are relative to the addresses in the file, before the BIAS argument
  8751. is applied.
  8752. 
  8753. File: gdb.info, Node: Core File Generation, Next: Character Sets, Prev: Dump/Restore Files, Up: Data
  8754. 10.19 How to Produce a Core File from Your Program
  8755. ==================================================
  8756. A "core file" or "core dump" is a file that records the memory image of
  8757. a running process and its process status (register values etc.). Its
  8758. primary use is post-mortem debugging of a program that crashed while it
  8759. ran outside a debugger. A program that crashes automatically produces a
  8760. core file, unless this feature is disabled by the user. *Note Files::,
  8761. for information on invoking GDB in the post-mortem debugging mode.
  8762. Occasionally, you may wish to produce a core file of the program you
  8763. are debugging in order to preserve a snapshot of its state. GDB has a
  8764. special command for that.
  8765. 'generate-core-file [FILE]'
  8766. 'gcore [FILE]'
  8767. Produce a core dump of the inferior process. The optional argument
  8768. FILE specifies the file name where to put the core dump. If not
  8769. specified, the file name defaults to 'core.PID', where PID is the
  8770. inferior process ID.
  8771. Note that this command is implemented only for some systems (as of
  8772. this writing, GNU/Linux, FreeBSD, Solaris, and S390).
  8773. On GNU/Linux, this command can take into account the value of the
  8774. file '/proc/PID/coredump_filter' when generating the core dump
  8775. (*note set use-coredump-filter::), and by default honors the
  8776. 'VM_DONTDUMP' flag for mappings where it is present in the file
  8777. '/proc/PID/smaps' (*note set dump-excluded-mappings::).
  8778. 'set use-coredump-filter on'
  8779. 'set use-coredump-filter off'
  8780. Enable or disable the use of the file '/proc/PID/coredump_filter'
  8781. when generating core dump files. This file is used by the Linux
  8782. kernel to decide what types of memory mappings will be dumped or
  8783. ignored when generating a core dump file. PID is the process ID of
  8784. a currently running process.
  8785. To make use of this feature, you have to write in the
  8786. '/proc/PID/coredump_filter' file a value, in hexadecimal, which is
  8787. a bit mask representing the memory mapping types. If a bit is set
  8788. in the bit mask, then the memory mappings of the corresponding
  8789. types will be dumped; otherwise, they will be ignored. This
  8790. configuration is inherited by child processes. For more
  8791. information about the bits that can be set in the
  8792. '/proc/PID/coredump_filter' file, please refer to the manpage of
  8793. 'core(5)'.
  8794. By default, this option is 'on'. If this option is turned 'off',
  8795. GDB does not read the 'coredump_filter' file and instead uses the
  8796. same default value as the Linux kernel in order to decide which
  8797. pages will be dumped in the core dump file. This value is
  8798. currently '0x33', which means that bits '0' (anonymous private
  8799. mappings), '1' (anonymous shared mappings), '4' (ELF headers) and
  8800. '5' (private huge pages) are active. This will cause these memory
  8801. mappings to be dumped automatically.
  8802. 'set dump-excluded-mappings on'
  8803. 'set dump-excluded-mappings off'
  8804. If 'on' is specified, GDB will dump memory mappings marked with the
  8805. 'VM_DONTDUMP' flag. This flag is represented in the file
  8806. '/proc/PID/smaps' with the acronym 'dd'.
  8807. The default value is 'off'.
  8808. 
  8809. File: gdb.info, Node: Character Sets, Next: Caching Target Data, Prev: Core File Generation, Up: Data
  8810. 10.20 Character Sets
  8811. ====================
  8812. If the program you are debugging uses a different character set to
  8813. represent characters and strings than the one GDB uses itself, GDB can
  8814. automatically translate between the character sets for you. The
  8815. character set GDB uses we call the "host character set"; the one the
  8816. inferior program uses we call the "target character set".
  8817. For example, if you are running GDB on a GNU/Linux system, which uses
  8818. the ISO Latin 1 character set, but you are using GDB's remote protocol
  8819. (*note Remote Debugging::) to debug a program running on an IBM
  8820. mainframe, which uses the EBCDIC character set, then the host character
  8821. set is Latin-1, and the target character set is EBCDIC. If you give GDB
  8822. the command 'set target-charset EBCDIC-US', then GDB translates between
  8823. EBCDIC and Latin 1 as you print character or string values, or use
  8824. character and string literals in expressions.
  8825. GDB has no way to automatically recognize which character set the
  8826. inferior program uses; you must tell it, using the 'set target-charset'
  8827. command, described below.
  8828. Here are the commands for controlling GDB's character set support:
  8829. 'set target-charset CHARSET'
  8830. Set the current target character set to CHARSET. To display the
  8831. list of supported target character sets, type
  8832. 'set target-charset <TAB><TAB>'.
  8833. 'set host-charset CHARSET'
  8834. Set the current host character set to CHARSET.
  8835. By default, GDB uses a host character set appropriate to the system
  8836. it is running on; you can override that default using the 'set
  8837. host-charset' command. On some systems, GDB cannot automatically
  8838. determine the appropriate host character set. In this case, GDB
  8839. uses 'UTF-8'.
  8840. GDB can only use certain character sets as its host character set.
  8841. If you type 'set host-charset <TAB><TAB>', GDB will list the host
  8842. character sets it supports.
  8843. 'set charset CHARSET'
  8844. Set the current host and target character sets to CHARSET. As
  8845. above, if you type 'set charset <TAB><TAB>', GDB will list the
  8846. names of the character sets that can be used for both host and
  8847. target.
  8848. 'show charset'
  8849. Show the names of the current host and target character sets.
  8850. 'show host-charset'
  8851. Show the name of the current host character set.
  8852. 'show target-charset'
  8853. Show the name of the current target character set.
  8854. 'set target-wide-charset CHARSET'
  8855. Set the current target's wide character set to CHARSET. This is
  8856. the character set used by the target's 'wchar_t' type. To display
  8857. the list of supported wide character sets, type
  8858. 'set target-wide-charset <TAB><TAB>'.
  8859. 'show target-wide-charset'
  8860. Show the name of the current target's wide character set.
  8861. Here is an example of GDB's character set support in action. Assume
  8862. that the following source code has been placed in the file
  8863. 'charset-test.c':
  8864. #include <stdio.h>
  8865. char ascii_hello[]
  8866. = {72, 101, 108, 108, 111, 44, 32, 119,
  8867. 111, 114, 108, 100, 33, 10, 0};
  8868. char ibm1047_hello[]
  8869. = {200, 133, 147, 147, 150, 107, 64, 166,
  8870. 150, 153, 147, 132, 90, 37, 0};
  8871. main ()
  8872. {
  8873. printf ("Hello, world!\n");
  8874. }
  8875. In this program, 'ascii_hello' and 'ibm1047_hello' are arrays
  8876. containing the string 'Hello, world!' followed by a newline, encoded in
  8877. the ASCII and IBM1047 character sets.
  8878. We compile the program, and invoke the debugger on it:
  8879. $ gcc -g charset-test.c -o charset-test
  8880. $ gdb -nw charset-test
  8881. GNU gdb 2001-12-19-cvs
  8882. Copyright 2001 Free Software Foundation, Inc.
  8883. ...
  8884. (gdb)
  8885. We can use the 'show charset' command to see what character sets GDB
  8886. is currently using to interpret and display characters and strings:
  8887. (gdb) show charset
  8888. The current host and target character set is `ISO-8859-1'.
  8889. (gdb)
  8890. For the sake of printing this manual, let's use ASCII as our initial
  8891. character set:
  8892. (gdb) set charset ASCII
  8893. (gdb) show charset
  8894. The current host and target character set is `ASCII'.
  8895. (gdb)
  8896. Let's assume that ASCII is indeed the correct character set for our
  8897. host system -- in other words, let's assume that if GDB prints
  8898. characters using the ASCII character set, our terminal will display them
  8899. properly. Since our current target character set is also ASCII, the
  8900. contents of 'ascii_hello' print legibly:
  8901. (gdb) print ascii_hello
  8902. $1 = 0x401698 "Hello, world!\n"
  8903. (gdb) print ascii_hello[0]
  8904. $2 = 72 'H'
  8905. (gdb)
  8906. GDB uses the target character set for character and string literals
  8907. you use in expressions:
  8908. (gdb) print '+'
  8909. $3 = 43 '+'
  8910. (gdb)
  8911. The ASCII character set uses the number 43 to encode the '+'
  8912. character.
  8913. GDB relies on the user to tell it which character set the target
  8914. program uses. If we print 'ibm1047_hello' while our target character
  8915. set is still ASCII, we get jibberish:
  8916. (gdb) print ibm1047_hello
  8917. $4 = 0x4016a8 "\310\205\223\223\226k@\246\226\231\223\204Z%"
  8918. (gdb) print ibm1047_hello[0]
  8919. $5 = 200 '\310'
  8920. (gdb)
  8921. If we invoke the 'set target-charset' followed by <TAB><TAB>, GDB
  8922. tells us the character sets it supports:
  8923. (gdb) set target-charset
  8924. ASCII EBCDIC-US IBM1047 ISO-8859-1
  8925. (gdb) set target-charset
  8926. We can select IBM1047 as our target character set, and examine the
  8927. program's strings again. Now the ASCII string is wrong, but GDB
  8928. translates the contents of 'ibm1047_hello' from the target character
  8929. set, IBM1047, to the host character set, ASCII, and they display
  8930. correctly:
  8931. (gdb) set target-charset IBM1047
  8932. (gdb) show charset
  8933. The current host character set is `ASCII'.
  8934. The current target character set is `IBM1047'.
  8935. (gdb) print ascii_hello
  8936. $6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012"
  8937. (gdb) print ascii_hello[0]
  8938. $7 = 72 '\110'
  8939. (gdb) print ibm1047_hello
  8940. $8 = 0x4016a8 "Hello, world!\n"
  8941. (gdb) print ibm1047_hello[0]
  8942. $9 = 200 'H'
  8943. (gdb)
  8944. As above, GDB uses the target character set for character and string
  8945. literals you use in expressions:
  8946. (gdb) print '+'
  8947. $10 = 78 '+'
  8948. (gdb)
  8949. The IBM1047 character set uses the number 78 to encode the '+'
  8950. character.
  8951. 
  8952. File: gdb.info, Node: Caching Target Data, Next: Searching Memory, Prev: Character Sets, Up: Data
  8953. 10.21 Caching Data of Targets
  8954. =============================
  8955. GDB caches data exchanged between the debugger and a target. Each cache
  8956. is associated with the address space of the inferior. *Note Inferiors
  8957. Connections and Programs::, about inferior and address space. Such
  8958. caching generally improves performance in remote debugging (*note Remote
  8959. Debugging::), because it reduces the overhead of the remote protocol by
  8960. bundling memory reads and writes into large chunks. Unfortunately,
  8961. simply caching everything would lead to incorrect results, since GDB
  8962. does not necessarily know anything about volatile values, memory-mapped
  8963. I/O addresses, etc. Furthermore, in non-stop mode (*note Non-Stop
  8964. Mode::) memory can be changed _while_ a gdb command is executing.
  8965. Therefore, by default, GDB only caches data known to be on the stack(1)
  8966. or in the code segment. Other regions of memory can be explicitly
  8967. marked as cacheable; *note Memory Region Attributes::.
  8968. 'set remotecache on'
  8969. 'set remotecache off'
  8970. This option no longer does anything; it exists for compatibility
  8971. with old scripts.
  8972. 'show remotecache'
  8973. Show the current state of the obsolete remotecache flag.
  8974. 'set stack-cache on'
  8975. 'set stack-cache off'
  8976. Enable or disable caching of stack accesses. When 'on', use
  8977. caching. By default, this option is 'on'.
  8978. 'show stack-cache'
  8979. Show the current state of data caching for memory accesses.
  8980. 'set code-cache on'
  8981. 'set code-cache off'
  8982. Enable or disable caching of code segment accesses. When 'on', use
  8983. caching. By default, this option is 'on'. This improves
  8984. performance of disassembly in remote debugging.
  8985. 'show code-cache'
  8986. Show the current state of target memory cache for code segment
  8987. accesses.
  8988. 'info dcache [line]'
  8989. Print the information about the performance of data cache of the
  8990. current inferior's address space. The information displayed
  8991. includes the dcache width and depth, and for each cache line, its
  8992. number, address, and how many times it was referenced. This
  8993. command is useful for debugging the data cache operation.
  8994. If a line number is specified, the contents of that line will be
  8995. printed in hex.
  8996. 'set dcache size SIZE'
  8997. Set maximum number of entries in dcache (dcache depth above).
  8998. 'set dcache line-size LINE-SIZE'
  8999. Set number of bytes each dcache entry caches (dcache width above).
  9000. Must be a power of 2.
  9001. 'show dcache size'
  9002. Show maximum number of dcache entries. *Note info dcache: Caching
  9003. Target Data.
  9004. 'show dcache line-size'
  9005. Show default size of dcache lines.
  9006. ---------- Footnotes ----------
  9007. (1) In non-stop mode, it is moderately rare for a running thread to
  9008. modify the stack of a stopped thread in a way that would interfere with
  9009. a backtrace, and caching of stack reads provides a significant speed up
  9010. of remote backtraces.
  9011. 
  9012. File: gdb.info, Node: Searching Memory, Next: Value Sizes, Prev: Caching Target Data, Up: Data
  9013. 10.22 Search Memory
  9014. ===================
  9015. Memory can be searched for a particular sequence of bytes with the
  9016. 'find' command.
  9017. 'find [/SN] START_ADDR, +LEN, VAL1 [, VAL2, ...]'
  9018. 'find [/SN] START_ADDR, END_ADDR, VAL1 [, VAL2, ...]'
  9019. Search memory for the sequence of bytes specified by VAL1, VAL2,
  9020. etc. The search begins at address START_ADDR and continues for
  9021. either LEN bytes or through to END_ADDR inclusive.
  9022. S and N are optional parameters. They may be specified in either
  9023. order, apart or together.
  9024. S, search query size
  9025. The size of each search query value.
  9026. 'b'
  9027. bytes
  9028. 'h'
  9029. halfwords (two bytes)
  9030. 'w'
  9031. words (four bytes)
  9032. 'g'
  9033. giant words (eight bytes)
  9034. All values are interpreted in the current language. This means,
  9035. for example, that if the current source language is C/C++ then
  9036. searching for the string "hello" includes the trailing '\0'. The
  9037. null terminator can be removed from searching by using casts, e.g.:
  9038. '{char[5]}"hello"'.
  9039. If the value size is not specified, it is taken from the value's
  9040. type in the current language. This is useful when one wants to
  9041. specify the search pattern as a mixture of types. Note that this
  9042. means, for example, that in the case of C-like languages a search
  9043. for an untyped 0x42 will search for '(int) 0x42' which is typically
  9044. four bytes.
  9045. N, maximum number of finds
  9046. The maximum number of matches to print. The default is to print
  9047. all finds.
  9048. You can use strings as search values. Quote them with double-quotes
  9049. ('"'). The string value is copied into the search pattern byte by byte,
  9050. regardless of the endianness of the target and the size specification.
  9051. The address of each match found is printed as well as a count of the
  9052. number of matches found.
  9053. The address of the last value found is stored in convenience variable
  9054. '$_'. A count of the number of matches is stored in '$numfound'.
  9055. For example, if stopped at the 'printf' in this function:
  9056. void
  9057. hello ()
  9058. {
  9059. static char hello[] = "hello-hello";
  9060. static struct { char c; short s; int i; }
  9061. __attribute__ ((packed)) mixed
  9062. = { 'c', 0x1234, 0x87654321 };
  9063. printf ("%s\n", hello);
  9064. }
  9065. you get during debugging:
  9066. (gdb) find &hello[0], +sizeof(hello), "hello"
  9067. 0x804956d <hello.1620+6>
  9068. 1 pattern found
  9069. (gdb) find &hello[0], +sizeof(hello), 'h', 'e', 'l', 'l', 'o'
  9070. 0x8049567 <hello.1620>
  9071. 0x804956d <hello.1620+6>
  9072. 2 patterns found.
  9073. (gdb) find &hello[0], +sizeof(hello), {char[5]}"hello"
  9074. 0x8049567 <hello.1620>
  9075. 0x804956d <hello.1620+6>
  9076. 2 patterns found.
  9077. (gdb) find /b1 &hello[0], +sizeof(hello), 'h', 0x65, 'l'
  9078. 0x8049567 <hello.1620>
  9079. 1 pattern found
  9080. (gdb) find &mixed, +sizeof(mixed), (char) 'c', (short) 0x1234, (int) 0x87654321
  9081. 0x8049560 <mixed.1625>
  9082. 1 pattern found
  9083. (gdb) print $numfound
  9084. $1 = 1
  9085. (gdb) print $_
  9086. $2 = (void *) 0x8049560
  9087. 
  9088. File: gdb.info, Node: Value Sizes, Prev: Searching Memory, Up: Data
  9089. 10.23 Value Sizes
  9090. =================
  9091. Whenever GDB prints a value memory will be allocated within GDB to hold
  9092. the contents of the value. It is possible in some languages with
  9093. dynamic typing systems, that an invalid program may indicate a value
  9094. that is incorrectly large, this in turn may cause GDB to try and
  9095. allocate an overly large amount of memory.
  9096. 'set max-value-size BYTES'
  9097. 'set max-value-size unlimited'
  9098. Set the maximum size of memory that GDB will allocate for the
  9099. contents of a value to BYTES, trying to display a value that
  9100. requires more memory than that will result in an error.
  9101. Setting this variable does not effect values that have already been
  9102. allocated within GDB, only future allocations.
  9103. There's a minimum size that 'max-value-size' can be set to in order
  9104. that GDB can still operate correctly, this minimum is currently 16
  9105. bytes.
  9106. The limit applies to the results of some subexpressions as well as
  9107. to complete expressions. For example, an expression denoting a
  9108. simple integer component, such as 'x.y.z', may fail if the size of
  9109. X.Y is dynamic and exceeds BYTES. On the other hand, GDB is
  9110. sometimes clever; the expression 'A[i]', where A is an array
  9111. variable with non-constant size, will generally succeed regardless
  9112. of the bounds on A, as long as the component size is less than
  9113. BYTES.
  9114. The default value of 'max-value-size' is currently 64k.
  9115. 'show max-value-size'
  9116. Show the maximum size of memory, in bytes, that GDB will allocate
  9117. for the contents of a value.
  9118. 
  9119. File: gdb.info, Node: Optimized Code, Next: Macros, Prev: Data, Up: Top
  9120. 11 Debugging Optimized Code
  9121. ***************************
  9122. Almost all compilers support optimization. With optimization disabled,
  9123. the compiler generates assembly code that corresponds directly to your
  9124. source code, in a simplistic way. As the compiler applies more powerful
  9125. optimizations, the generated assembly code diverges from your original
  9126. source code. With help from debugging information generated by the
  9127. compiler, GDB can map from the running program back to constructs from
  9128. your original source.
  9129. GDB is more accurate with optimization disabled. If you can
  9130. recompile without optimization, it is easier to follow the progress of
  9131. your program during debugging. But, there are many cases where you may
  9132. need to debug an optimized version.
  9133. When you debug a program compiled with '-g -O', remember that the
  9134. optimizer has rearranged your code; the debugger shows you what is
  9135. really there. Do not be too surprised when the execution path does not
  9136. exactly match your source file! An extreme example: if you define a
  9137. variable, but never use it, GDB never sees that variable--because the
  9138. compiler optimizes it out of existence.
  9139. Some things do not work as well with '-g -O' as with just '-g',
  9140. particularly on machines with instruction scheduling. If in doubt,
  9141. recompile with '-g' alone, and if this fixes the problem, please report
  9142. it to us as a bug (including a test case!). *Note Variables::, for more
  9143. information about debugging optimized code.
  9144. * Menu:
  9145. * Inline Functions:: How GDB presents inlining
  9146. * Tail Call Frames:: GDB analysis of jumps to functions
  9147. 
  9148. File: gdb.info, Node: Inline Functions, Next: Tail Call Frames, Up: Optimized Code
  9149. 11.1 Inline Functions
  9150. =====================
  9151. "Inlining" is an optimization that inserts a copy of the function body
  9152. directly at each call site, instead of jumping to a shared routine. GDB
  9153. displays inlined functions just like non-inlined functions. They appear
  9154. in backtraces. You can view their arguments and local variables, step
  9155. into them with 'step', skip them with 'next', and escape from them with
  9156. 'finish'. You can check whether a function was inlined by using the
  9157. 'info frame' command.
  9158. For GDB to support inlined functions, the compiler must record
  9159. information about inlining in the debug information -- GCC using the
  9160. DWARF 2 format does this, and several other compilers do also. GDB only
  9161. supports inlined functions when using DWARF 2. Versions of GCC before
  9162. 4.1 do not emit two required attributes ('DW_AT_call_file' and
  9163. 'DW_AT_call_line'); GDB does not display inlined function calls with
  9164. earlier versions of GCC. It instead displays the arguments and local
  9165. variables of inlined functions as local variables in the caller.
  9166. The body of an inlined function is directly included at its call
  9167. site; unlike a non-inlined function, there are no instructions devoted
  9168. to the call. GDB still pretends that the call site and the start of the
  9169. inlined function are different instructions. Stepping to the call site
  9170. shows the call site, and then stepping again shows the first line of the
  9171. inlined function, even though no additional instructions are executed.
  9172. This makes source-level debugging much clearer; you can see both the
  9173. context of the call and then the effect of the call. Only stepping by a
  9174. single instruction using 'stepi' or 'nexti' does not do this; single
  9175. instruction steps always show the inlined body.
  9176. There are some ways that GDB does not pretend that inlined function
  9177. calls are the same as normal calls:
  9178. * Setting breakpoints at the call site of an inlined function may not
  9179. work, because the call site does not contain any code. GDB may
  9180. incorrectly move the breakpoint to the next line of the enclosing
  9181. function, after the call. This limitation will be removed in a
  9182. future version of GDB; until then, set a breakpoint on an earlier
  9183. line or inside the inlined function instead.
  9184. * GDB cannot locate the return value of inlined calls after using the
  9185. 'finish' command. This is a limitation of compiler-generated
  9186. debugging information; after 'finish', you can step to the next
  9187. line and print a variable where your program stored the return
  9188. value.
  9189. 
  9190. File: gdb.info, Node: Tail Call Frames, Prev: Inline Functions, Up: Optimized Code
  9191. 11.2 Tail Call Frames
  9192. =====================
  9193. Function 'B' can call function 'C' in its very last statement. In
  9194. unoptimized compilation the call of 'C' is immediately followed by
  9195. return instruction at the end of 'B' code. Optimizing compiler may
  9196. replace the call and return in function 'B' into one jump to function
  9197. 'C' instead. Such use of a jump instruction is called "tail call".
  9198. During execution of function 'C', there will be no indication in the
  9199. function call stack frames that it was tail-called from 'B'. If
  9200. function 'A' regularly calls function 'B' which tail-calls function 'C',
  9201. then GDB will see 'A' as the caller of 'C'. However, in some cases GDB
  9202. can determine that 'C' was tail-called from 'B', and it will then create
  9203. fictitious call frame for that, with the return address set up as if 'B'
  9204. called 'C' normally.
  9205. This functionality is currently supported only by DWARF 2 debugging
  9206. format and the compiler has to produce 'DW_TAG_call_site' tags. With
  9207. GCC, you need to specify '-O -g' during compilation, to get this
  9208. information.
  9209. 'info frame' command (*note Frame Info::) will indicate the tail call
  9210. frame kind by text 'tail call frame' such as in this sample GDB output:
  9211. (gdb) x/i $pc - 2
  9212. 0x40066b <b(int, double)+11>: jmp 0x400640 <c(int, double)>
  9213. (gdb) info frame
  9214. Stack level 1, frame at 0x7fffffffda30:
  9215. rip = 0x40066d in b (amd64-entry-value.cc:59); saved rip 0x4004c5
  9216. tail call frame, caller of frame at 0x7fffffffda30
  9217. source language c++.
  9218. Arglist at unknown address.
  9219. Locals at unknown address, Previous frame's sp is 0x7fffffffda30
  9220. The detection of all the possible code path executions can find them
  9221. ambiguous. There is no execution history stored (possible *note Reverse
  9222. Execution:: is never used for this purpose) and the last known caller
  9223. could have reached the known callee by multiple different jump
  9224. sequences. In such case GDB still tries to show at least all the
  9225. unambiguous top tail callers and all the unambiguous bottom tail calees,
  9226. if any.
  9227. 'set debug entry-values'
  9228. When set to on, enables printing of analysis messages for both
  9229. frame argument values at function entry and tail calls. It will
  9230. show all the possible valid tail calls code paths it has
  9231. considered. It will also print the intersection of them with the
  9232. final unambiguous (possibly partial or even empty) code path
  9233. result.
  9234. 'show debug entry-values'
  9235. Show the current state of analysis messages printing for both frame
  9236. argument values at function entry and tail calls.
  9237. The analysis messages for tail calls can for example show why the
  9238. virtual tail call frame for function 'c' has not been recognized (due to
  9239. the indirect reference by variable 'x'):
  9240. static void __attribute__((noinline, noclone)) c (void);
  9241. void (*x) (void) = c;
  9242. static void __attribute__((noinline, noclone)) a (void) { x++; }
  9243. static void __attribute__((noinline, noclone)) c (void) { a (); }
  9244. int main (void) { x (); return 0; }
  9245. Breakpoint 1, DW_OP_entry_value resolving cannot find
  9246. DW_TAG_call_site 0x40039a in main
  9247. a () at t.c:3
  9248. 3 static void __attribute__((noinline, noclone)) a (void) { x++; }
  9249. (gdb) bt
  9250. #0 a () at t.c:3
  9251. #1 0x000000000040039a in main () at t.c:5
  9252. Another possibility is an ambiguous virtual tail call frames
  9253. resolution:
  9254. int i;
  9255. static void __attribute__((noinline, noclone)) f (void) { i++; }
  9256. static void __attribute__((noinline, noclone)) e (void) { f (); }
  9257. static void __attribute__((noinline, noclone)) d (void) { f (); }
  9258. static void __attribute__((noinline, noclone)) c (void) { d (); }
  9259. static void __attribute__((noinline, noclone)) b (void)
  9260. { if (i) c (); else e (); }
  9261. static void __attribute__((noinline, noclone)) a (void) { b (); }
  9262. int main (void) { a (); return 0; }
  9263. tailcall: initial: 0x4004d2(a) 0x4004ce(b) 0x4004b2(c) 0x4004a2(d)
  9264. tailcall: compare: 0x4004d2(a) 0x4004cc(b) 0x400492(e)
  9265. tailcall: reduced: 0x4004d2(a) |
  9266. (gdb) bt
  9267. #0 f () at t.c:2
  9268. #1 0x00000000004004d2 in a () at t.c:8
  9269. #2 0x0000000000400395 in main () at t.c:9
  9270. Frames #0 and #2 are real, #1 is a virtual tail call frame. The code
  9271. can have possible execution paths 'main->a->b->c->d->f' or
  9272. 'main->a->b->e->f', GDB cannot find which one from the inferior state.
  9273. 'initial:' state shows some random possible calling sequence GDB has
  9274. found. It then finds another possible calling sequence - that one is
  9275. prefixed by 'compare:'. The non-ambiguous intersection of these two is
  9276. printed as the 'reduced:' calling sequence. That one could have many
  9277. further 'compare:' and 'reduced:' statements as long as there remain any
  9278. non-ambiguous sequence entries.
  9279. For the frame of function 'b' in both cases there are different
  9280. possible '$pc' values ('0x4004cc' or '0x4004ce'), therefore this frame
  9281. is also ambiguous. The only non-ambiguous frame is the one for function
  9282. 'a', therefore this one is displayed to the user while the ambiguous
  9283. frames are omitted.
  9284. There can be also reasons why printing of frame argument values at
  9285. function entry may fail:
  9286. int v;
  9287. static void __attribute__((noinline, noclone)) c (int i) { v++; }
  9288. static void __attribute__((noinline, noclone)) a (int i);
  9289. static void __attribute__((noinline, noclone)) b (int i) { a (i); }
  9290. static void __attribute__((noinline, noclone)) a (int i)
  9291. { if (i) b (i - 1); else c (0); }
  9292. int main (void) { a (5); return 0; }
  9293. (gdb) bt
  9294. #0 c (i=i@entry=0) at t.c:2
  9295. #1 0x0000000000400428 in a (DW_OP_entry_value resolving has found
  9296. function "a" at 0x400420 can call itself via tail calls
  9297. i=<optimized out>) at t.c:6
  9298. #2 0x000000000040036e in main () at t.c:7
  9299. GDB cannot find out from the inferior state if and how many times did
  9300. function 'a' call itself (via function 'b') as these calls would be tail
  9301. calls. Such tail calls would modify the 'i' variable, therefore GDB
  9302. cannot be sure the value it knows would be right - GDB prints
  9303. '<optimized out>' instead.
  9304. 
  9305. File: gdb.info, Node: Macros, Next: Tracepoints, Prev: Optimized Code, Up: Top
  9306. 12 C Preprocessor Macros
  9307. ************************
  9308. Some languages, such as C and C++, provide a way to define and invoke
  9309. "preprocessor macros" which expand into strings of tokens. GDB can
  9310. evaluate expressions containing macro invocations, show the result of
  9311. macro expansion, and show a macro's definition, including where it was
  9312. defined.
  9313. You may need to compile your program specially to provide GDB with
  9314. information about preprocessor macros. Most compilers do not include
  9315. macros in their debugging information, even when you compile with the
  9316. '-g' flag. *Note Compilation::.
  9317. A program may define a macro at one point, remove that definition
  9318. later, and then provide a different definition after that. Thus, at
  9319. different points in the program, a macro may have different definitions,
  9320. or have no definition at all. If there is a current stack frame, GDB
  9321. uses the macros in scope at that frame's source code line. Otherwise,
  9322. GDB uses the macros in scope at the current listing location; see *note
  9323. List::.
  9324. Whenever GDB evaluates an expression, it always expands any macro
  9325. invocations present in the expression. GDB also provides the following
  9326. commands for working with macros explicitly.
  9327. 'macro expand EXPRESSION'
  9328. 'macro exp EXPRESSION'
  9329. Show the results of expanding all preprocessor macro invocations in
  9330. EXPRESSION. Since GDB simply expands macros, but does not parse
  9331. the result, EXPRESSION need not be a valid expression; it can be
  9332. any string of tokens.
  9333. 'macro expand-once EXPRESSION'
  9334. 'macro exp1 EXPRESSION'
  9335. (This command is not yet implemented.) Show the results of
  9336. expanding those preprocessor macro invocations that appear
  9337. explicitly in EXPRESSION. Macro invocations appearing in that
  9338. expansion are left unchanged. This command allows you to see the
  9339. effect of a particular macro more clearly, without being confused
  9340. by further expansions. Since GDB simply expands macros, but does
  9341. not parse the result, EXPRESSION need not be a valid expression; it
  9342. can be any string of tokens.
  9343. 'info macro [-a|-all] [--] MACRO'
  9344. Show the current definition or all definitions of the named MACRO,
  9345. and describe the source location or compiler command-line where
  9346. that definition was established. The optional double dash is to
  9347. signify the end of argument processing and the beginning of MACRO
  9348. for non C-like macros where the macro may begin with a hyphen.
  9349. 'info macros LOCATION'
  9350. Show all macro definitions that are in effect at the location
  9351. specified by LOCATION, and describe the source location or compiler
  9352. command-line where those definitions were established.
  9353. 'macro define MACRO REPLACEMENT-LIST'
  9354. 'macro define MACRO(ARGLIST) REPLACEMENT-LIST'
  9355. Introduce a definition for a preprocessor macro named MACRO,
  9356. invocations of which are replaced by the tokens given in
  9357. REPLACEMENT-LIST. The first form of this command defines an
  9358. "object-like" macro, which takes no arguments; the second form
  9359. defines a "function-like" macro, which takes the arguments given in
  9360. ARGLIST.
  9361. A definition introduced by this command is in scope in every
  9362. expression evaluated in GDB, until it is removed with the 'macro
  9363. undef' command, described below. The definition overrides all
  9364. definitions for MACRO present in the program being debugged, as
  9365. well as any previous user-supplied definition.
  9366. 'macro undef MACRO'
  9367. Remove any user-supplied definition for the macro named MACRO.
  9368. This command only affects definitions provided with the 'macro
  9369. define' command, described above; it cannot remove definitions
  9370. present in the program being debugged.
  9371. 'macro list'
  9372. List all the macros defined using the 'macro define' command.
  9373. Here is a transcript showing the above commands in action. First, we
  9374. show our source files:
  9375. $ cat sample.c
  9376. #include <stdio.h>
  9377. #include "sample.h"
  9378. #define M 42
  9379. #define ADD(x) (M + x)
  9380. main ()
  9381. {
  9382. #define N 28
  9383. printf ("Hello, world!\n");
  9384. #undef N
  9385. printf ("We're so creative.\n");
  9386. #define N 1729
  9387. printf ("Goodbye, world!\n");
  9388. }
  9389. $ cat sample.h
  9390. #define Q <
  9391. $
  9392. Now, we compile the program using the GNU C compiler, GCC. We pass
  9393. the '-gdwarf-2'(1) _and_ '-g3' flags to ensure the compiler includes
  9394. information about preprocessor macros in the debugging information.
  9395. $ gcc -gdwarf-2 -g3 sample.c -o sample
  9396. $
  9397. Now, we start GDB on our sample program:
  9398. $ gdb -nw sample
  9399. GNU gdb 2002-05-06-cvs
  9400. Copyright 2002 Free Software Foundation, Inc.
  9401. GDB is free software, ...
  9402. (gdb)
  9403. We can expand macros and examine their definitions, even when the
  9404. program is not running. GDB uses the current listing position to decide
  9405. which macro definitions are in scope:
  9406. (gdb) list main
  9407. 3
  9408. 4 #define M 42
  9409. 5 #define ADD(x) (M + x)
  9410. 6
  9411. 7 main ()
  9412. 8 {
  9413. 9 #define N 28
  9414. 10 printf ("Hello, world!\n");
  9415. 11 #undef N
  9416. 12 printf ("We're so creative.\n");
  9417. (gdb) info macro ADD
  9418. Defined at /home/jimb/gdb/macros/play/sample.c:5
  9419. #define ADD(x) (M + x)
  9420. (gdb) info macro Q
  9421. Defined at /home/jimb/gdb/macros/play/sample.h:1
  9422. included at /home/jimb/gdb/macros/play/sample.c:2
  9423. #define Q <
  9424. (gdb) macro expand ADD(1)
  9425. expands to: (42 + 1)
  9426. (gdb) macro expand-once ADD(1)
  9427. expands to: once (M + 1)
  9428. (gdb)
  9429. In the example above, note that 'macro expand-once' expands only the
  9430. macro invocation explicit in the original text -- the invocation of
  9431. 'ADD' -- but does not expand the invocation of the macro 'M', which was
  9432. introduced by 'ADD'.
  9433. Once the program is running, GDB uses the macro definitions in force
  9434. at the source line of the current stack frame:
  9435. (gdb) break main
  9436. Breakpoint 1 at 0x8048370: file sample.c, line 10.
  9437. (gdb) run
  9438. Starting program: /home/jimb/gdb/macros/play/sample
  9439. Breakpoint 1, main () at sample.c:10
  9440. 10 printf ("Hello, world!\n");
  9441. (gdb)
  9442. At line 10, the definition of the macro 'N' at line 9 is in force:
  9443. (gdb) info macro N
  9444. Defined at /home/jimb/gdb/macros/play/sample.c:9
  9445. #define N 28
  9446. (gdb) macro expand N Q M
  9447. expands to: 28 < 42
  9448. (gdb) print N Q M
  9449. $1 = 1
  9450. (gdb)
  9451. As we step over directives that remove 'N''s definition, and then
  9452. give it a new definition, GDB finds the definition (or lack thereof) in
  9453. force at each point:
  9454. (gdb) next
  9455. Hello, world!
  9456. 12 printf ("We're so creative.\n");
  9457. (gdb) info macro N
  9458. The symbol `N' has no definition as a C/C++ preprocessor macro
  9459. at /home/jimb/gdb/macros/play/sample.c:12
  9460. (gdb) next
  9461. We're so creative.
  9462. 14 printf ("Goodbye, world!\n");
  9463. (gdb) info macro N
  9464. Defined at /home/jimb/gdb/macros/play/sample.c:13
  9465. #define N 1729
  9466. (gdb) macro expand N Q M
  9467. expands to: 1729 < 42
  9468. (gdb) print N Q M
  9469. $2 = 0
  9470. (gdb)
  9471. In addition to source files, macros can be defined on the compilation
  9472. command line using the '-DNAME=VALUE' syntax. For macros defined in
  9473. such a way, GDB displays the location of their definition as line zero
  9474. of the source file submitted to the compiler.
  9475. (gdb) info macro __STDC__
  9476. Defined at /home/jimb/gdb/macros/play/sample.c:0
  9477. -D__STDC__=1
  9478. (gdb)
  9479. ---------- Footnotes ----------
  9480. (1) This is the minimum. Recent versions of GCC support '-gdwarf-3'
  9481. and '-gdwarf-4'; we recommend always choosing the most recent version of
  9482. DWARF.
  9483. 
  9484. File: gdb.info, Node: Tracepoints, Next: Overlays, Prev: Macros, Up: Top
  9485. 13 Tracepoints
  9486. **************
  9487. In some applications, it is not feasible for the debugger to interrupt
  9488. the program's execution long enough for the developer to learn anything
  9489. helpful about its behavior. If the program's correctness depends on its
  9490. real-time behavior, delays introduced by a debugger might cause the
  9491. program to change its behavior drastically, or perhaps fail, even when
  9492. the code itself is correct. It is useful to be able to observe the
  9493. program's behavior without interrupting it.
  9494. Using GDB's 'trace' and 'collect' commands, you can specify locations
  9495. in the program, called "tracepoints", and arbitrary expressions to
  9496. evaluate when those tracepoints are reached. Later, using the 'tfind'
  9497. command, you can examine the values those expressions had when the
  9498. program hit the tracepoints. The expressions may also denote objects in
  9499. memory--structures or arrays, for example--whose values GDB should
  9500. record; while visiting a particular tracepoint, you may inspect those
  9501. objects as if they were in memory at that moment. However, because GDB
  9502. records these values without interacting with you, it can do so quickly
  9503. and unobtrusively, hopefully not disturbing the program's behavior.
  9504. The tracepoint facility is currently available only for remote
  9505. targets. *Note Targets::. In addition, your remote target must know
  9506. how to collect trace data. This functionality is implemented in the
  9507. remote stub; however, none of the stubs distributed with GDB support
  9508. tracepoints as of this writing. The format of the remote packets used
  9509. to implement tracepoints are described in *note Tracepoint Packets::.
  9510. It is also possible to get trace data from a file, in a manner
  9511. reminiscent of corefiles; you specify the filename, and use 'tfind' to
  9512. search through the file. *Note Trace Files::, for more details.
  9513. This chapter describes the tracepoint commands and features.
  9514. * Menu:
  9515. * Set Tracepoints::
  9516. * Analyze Collected Data::
  9517. * Tracepoint Variables::
  9518. * Trace Files::
  9519. 
  9520. File: gdb.info, Node: Set Tracepoints, Next: Analyze Collected Data, Up: Tracepoints
  9521. 13.1 Commands to Set Tracepoints
  9522. ================================
  9523. Before running such a "trace experiment", an arbitrary number of
  9524. tracepoints can be set. A tracepoint is actually a special type of
  9525. breakpoint (*note Set Breaks::), so you can manipulate it using standard
  9526. breakpoint commands. For instance, as with breakpoints, tracepoint
  9527. numbers are successive integers starting from one, and many of the
  9528. commands associated with tracepoints take the tracepoint number as their
  9529. argument, to identify which tracepoint to work on.
  9530. For each tracepoint, you can specify, in advance, some arbitrary set
  9531. of data that you want the target to collect in the trace buffer when it
  9532. hits that tracepoint. The collected data can include registers, local
  9533. variables, or global data. Later, you can use GDB commands to examine
  9534. the values these data had at the time the tracepoint was hit.
  9535. Tracepoints do not support every breakpoint feature. Ignore counts
  9536. on tracepoints have no effect, and tracepoints cannot run GDB commands
  9537. when they are hit. Tracepoints may not be thread-specific either.
  9538. Some targets may support "fast tracepoints", which are inserted in a
  9539. different way (such as with a jump instead of a trap), that is faster
  9540. but possibly restricted in where they may be installed.
  9541. Regular and fast tracepoints are dynamic tracing facilities, meaning
  9542. that they can be used to insert tracepoints at (almost) any location in
  9543. the target. Some targets may also support controlling "static
  9544. tracepoints" from GDB. With static tracing, a set of instrumentation
  9545. points, also known as "markers", are embedded in the target program, and
  9546. can be activated or deactivated by name or address. These are usually
  9547. placed at locations which facilitate investigating what the target is
  9548. actually doing. GDB's support for static tracing includes being able to
  9549. list instrumentation points, and attach them with GDB defined high level
  9550. tracepoints that expose the whole range of convenience of GDB's
  9551. tracepoints support. Namely, support for collecting registers values
  9552. and values of global or local (to the instrumentation point) variables;
  9553. tracepoint conditions and trace state variables. The act of installing
  9554. a GDB static tracepoint on an instrumentation point, or marker, is
  9555. referred to as "probing" a static tracepoint marker.
  9556. 'gdbserver' supports tracepoints on some target systems. *Note
  9557. Tracepoints support in 'gdbserver': Server.
  9558. This section describes commands to set tracepoints and associated
  9559. conditions and actions.
  9560. * Menu:
  9561. * Create and Delete Tracepoints::
  9562. * Enable and Disable Tracepoints::
  9563. * Tracepoint Passcounts::
  9564. * Tracepoint Conditions::
  9565. * Trace State Variables::
  9566. * Tracepoint Actions::
  9567. * Listing Tracepoints::
  9568. * Listing Static Tracepoint Markers::
  9569. * Starting and Stopping Trace Experiments::
  9570. * Tracepoint Restrictions::
  9571. 
  9572. File: gdb.info, Node: Create and Delete Tracepoints, Next: Enable and Disable Tracepoints, Up: Set Tracepoints
  9573. 13.1.1 Create and Delete Tracepoints
  9574. ------------------------------------
  9575. 'trace LOCATION'
  9576. The 'trace' command is very similar to the 'break' command. Its
  9577. argument LOCATION can be any valid location. *Note Specify
  9578. Location::. The 'trace' command defines a tracepoint, which is a
  9579. point in the target program where the debugger will briefly stop,
  9580. collect some data, and then allow the program to continue. Setting
  9581. a tracepoint or changing its actions takes effect immediately if
  9582. the remote stub supports the 'InstallInTrace' feature (*note
  9583. install tracepoint in tracing::). If remote stub doesn't support
  9584. the 'InstallInTrace' feature, all these changes don't take effect
  9585. until the next 'tstart' command, and once a trace experiment is
  9586. running, further changes will not have any effect until the next
  9587. trace experiment starts. In addition, GDB supports "pending
  9588. tracepoints"--tracepoints whose address is not yet resolved. (This
  9589. is similar to pending breakpoints.) Pending tracepoints are not
  9590. downloaded to the target and not installed until they are resolved.
  9591. The resolution of pending tracepoints requires GDB support--when
  9592. debugging with the remote target, and GDB disconnects from the
  9593. remote stub (*note disconnected tracing::), pending tracepoints can
  9594. not be resolved (and downloaded to the remote stub) while GDB is
  9595. disconnected.
  9596. Here are some examples of using the 'trace' command:
  9597. (gdb) trace foo.c:121 // a source file and line number
  9598. (gdb) trace +2 // 2 lines forward
  9599. (gdb) trace my_function // first source line of function
  9600. (gdb) trace *my_function // EXACT start address of function
  9601. (gdb) trace *0x2117c4 // an address
  9602. You can abbreviate 'trace' as 'tr'.
  9603. 'trace LOCATION if COND'
  9604. Set a tracepoint with condition COND; evaluate the expression COND
  9605. each time the tracepoint is reached, and collect data only if the
  9606. value is nonzero--that is, if COND evaluates as true. *Note
  9607. Tracepoint Conditions: Tracepoint Conditions, for more information
  9608. on tracepoint conditions.
  9609. 'ftrace LOCATION [ if COND ]'
  9610. The 'ftrace' command sets a fast tracepoint. For targets that
  9611. support them, fast tracepoints will use a more efficient but
  9612. possibly less general technique to trigger data collection, such as
  9613. a jump instruction instead of a trap, or some sort of hardware
  9614. support. It may not be possible to create a fast tracepoint at the
  9615. desired location, in which case the command will exit with an
  9616. explanatory message.
  9617. GDB handles arguments to 'ftrace' exactly as for 'trace'.
  9618. On 32-bit x86-architecture systems, fast tracepoints normally need
  9619. to be placed at an instruction that is 5 bytes or longer, but can
  9620. be placed at 4-byte instructions if the low 64K of memory of the
  9621. target program is available to install trampolines. Some Unix-type
  9622. systems, such as GNU/Linux, exclude low addresses from the
  9623. program's address space; but for instance with the Linux kernel it
  9624. is possible to let GDB use this area by doing a 'sysctl' command to
  9625. set the 'mmap_min_addr' kernel parameter, as in
  9626. sudo sysctl -w vm.mmap_min_addr=32768
  9627. which sets the low address to 32K, which leaves plenty of room for
  9628. trampolines. The minimum address should be set to a page boundary.
  9629. 'strace LOCATION [ if COND ]'
  9630. The 'strace' command sets a static tracepoint. For targets that
  9631. support it, setting a static tracepoint probes a static
  9632. instrumentation point, or marker, found at LOCATION. It may not be
  9633. possible to set a static tracepoint at the desired location, in
  9634. which case the command will exit with an explanatory message.
  9635. GDB handles arguments to 'strace' exactly as for 'trace', with the
  9636. addition that the user can also specify '-m MARKER' as LOCATION.
  9637. This probes the marker identified by the MARKER string identifier.
  9638. This identifier depends on the static tracepoint backend library
  9639. your program is using. You can find all the marker identifiers in
  9640. the 'ID' field of the 'info static-tracepoint-markers' command
  9641. output. *Note Listing Static Tracepoint Markers: Listing Static
  9642. Tracepoint Markers. For example, in the following small program
  9643. using the UST tracing engine:
  9644. main ()
  9645. {
  9646. trace_mark(ust, bar33, "str %s", "FOOBAZ");
  9647. }
  9648. the marker id is composed of joining the first two arguments to the
  9649. 'trace_mark' call with a slash, which translates to:
  9650. (gdb) info static-tracepoint-markers
  9651. Cnt Enb ID Address What
  9652. 1 n ust/bar33 0x0000000000400ddc in main at stexample.c:22
  9653. Data: "str %s"
  9654. [etc...]
  9655. so you may probe the marker above with:
  9656. (gdb) strace -m ust/bar33
  9657. Static tracepoints accept an extra collect action -- 'collect
  9658. $_sdata'. This collects arbitrary user data passed in the probe
  9659. point call to the tracing library. In the UST example above,
  9660. you'll see that the third argument to 'trace_mark' is a printf-like
  9661. format string. The user data is then the result of running that
  9662. formatting string against the following arguments. Note that 'info
  9663. static-tracepoint-markers' command output lists that format string
  9664. in the 'Data:' field.
  9665. You can inspect this data when analyzing the trace buffer, by
  9666. printing the $_sdata variable like any other variable available to
  9667. GDB. *Note Tracepoint Action Lists: Tracepoint Actions.
  9668. The convenience variable '$tpnum' records the tracepoint number of
  9669. the most recently set tracepoint.
  9670. 'delete tracepoint [NUM]'
  9671. Permanently delete one or more tracepoints. With no argument, the
  9672. default is to delete all tracepoints. Note that the regular
  9673. 'delete' command can remove tracepoints also.
  9674. Examples:
  9675. (gdb) delete trace 1 2 3 // remove three tracepoints
  9676. (gdb) delete trace // remove all tracepoints
  9677. You can abbreviate this command as 'del tr'.
  9678. 
  9679. File: gdb.info, Node: Enable and Disable Tracepoints, Next: Tracepoint Passcounts, Prev: Create and Delete Tracepoints, Up: Set Tracepoints
  9680. 13.1.2 Enable and Disable Tracepoints
  9681. -------------------------------------
  9682. These commands are deprecated; they are equivalent to plain 'disable'
  9683. and 'enable'.
  9684. 'disable tracepoint [NUM]'
  9685. Disable tracepoint NUM, or all tracepoints if no argument NUM is
  9686. given. A disabled tracepoint will have no effect during a trace
  9687. experiment, but it is not forgotten. You can re-enable a disabled
  9688. tracepoint using the 'enable tracepoint' command. If the command
  9689. is issued during a trace experiment and the debug target has
  9690. support for disabling tracepoints during a trace experiment, then
  9691. the change will be effective immediately. Otherwise, it will be
  9692. applied to the next trace experiment.
  9693. 'enable tracepoint [NUM]'
  9694. Enable tracepoint NUM, or all tracepoints. If this command is
  9695. issued during a trace experiment and the debug target supports
  9696. enabling tracepoints during a trace experiment, then the enabled
  9697. tracepoints will become effective immediately. Otherwise, they
  9698. will become effective the next time a trace experiment is run.
  9699. 
  9700. File: gdb.info, Node: Tracepoint Passcounts, Next: Tracepoint Conditions, Prev: Enable and Disable Tracepoints, Up: Set Tracepoints
  9701. 13.1.3 Tracepoint Passcounts
  9702. ----------------------------
  9703. 'passcount [N [NUM]]'
  9704. Set the "passcount" of a tracepoint. The passcount is a way to
  9705. automatically stop a trace experiment. If a tracepoint's passcount
  9706. is N, then the trace experiment will be automatically stopped on
  9707. the N'th time that tracepoint is hit. If the tracepoint number NUM
  9708. is not specified, the 'passcount' command sets the passcount of the
  9709. most recently defined tracepoint. If no passcount is given, the
  9710. trace experiment will run until stopped explicitly by the user.
  9711. Examples:
  9712. (gdb) passcount 5 2 // Stop on the 5th execution of
  9713. // tracepoint 2
  9714. (gdb) passcount 12 // Stop on the 12th execution of the
  9715. // most recently defined tracepoint.
  9716. (gdb) trace foo
  9717. (gdb) pass 3
  9718. (gdb) trace bar
  9719. (gdb) pass 2
  9720. (gdb) trace baz
  9721. (gdb) pass 1 // Stop tracing when foo has been
  9722. // executed 3 times OR when bar has
  9723. // been executed 2 times
  9724. // OR when baz has been executed 1 time.
  9725. 
  9726. File: gdb.info, Node: Tracepoint Conditions, Next: Trace State Variables, Prev: Tracepoint Passcounts, Up: Set Tracepoints
  9727. 13.1.4 Tracepoint Conditions
  9728. ----------------------------
  9729. The simplest sort of tracepoint collects data every time your program
  9730. reaches a specified place. You can also specify a "condition" for a
  9731. tracepoint. A condition is just a Boolean expression in your
  9732. programming language (*note Expressions: Expressions.). A tracepoint
  9733. with a condition evaluates the expression each time your program reaches
  9734. it, and data collection happens only if the condition is true.
  9735. Tracepoint conditions can be specified when a tracepoint is set, by
  9736. using 'if' in the arguments to the 'trace' command. *Note Setting
  9737. Tracepoints: Create and Delete Tracepoints. They can also be set or
  9738. changed at any time with the 'condition' command, just as with
  9739. breakpoints.
  9740. Unlike breakpoint conditions, GDB does not actually evaluate the
  9741. conditional expression itself. Instead, GDB encodes the expression into
  9742. an agent expression (*note Agent Expressions::) suitable for execution
  9743. on the target, independently of GDB. Global variables become raw memory
  9744. locations, locals become stack accesses, and so forth.
  9745. For instance, suppose you have a function that is usually called
  9746. frequently, but should not be called after an error has occurred. You
  9747. could use the following tracepoint command to collect data about calls
  9748. of that function that happen while the error code is propagating through
  9749. the program; an unconditional tracepoint could end up collecting
  9750. thousands of useless trace frames that you would have to search through.
  9751. (gdb) trace normal_operation if errcode > 0
  9752. 
  9753. File: gdb.info, Node: Trace State Variables, Next: Tracepoint Actions, Prev: Tracepoint Conditions, Up: Set Tracepoints
  9754. 13.1.5 Trace State Variables
  9755. ----------------------------
  9756. A "trace state variable" is a special type of variable that is created
  9757. and managed by target-side code. The syntax is the same as that for
  9758. GDB's convenience variables (a string prefixed with "$"), but they are
  9759. stored on the target. They must be created explicitly, using a
  9760. 'tvariable' command. They are always 64-bit signed integers.
  9761. Trace state variables are remembered by GDB, and downloaded to the
  9762. target along with tracepoint information when the trace experiment
  9763. starts. There are no intrinsic limits on the number of trace state
  9764. variables, beyond memory limitations of the target.
  9765. Although trace state variables are managed by the target, you can use
  9766. them in print commands and expressions as if they were convenience
  9767. variables; GDB will get the current value from the target while the
  9768. trace experiment is running. Trace state variables share the same
  9769. namespace as other "$" variables, which means that you cannot have trace
  9770. state variables with names like '$23' or '$pc', nor can you have a trace
  9771. state variable and a convenience variable with the same name.
  9772. 'tvariable $NAME [ = EXPRESSION ]'
  9773. The 'tvariable' command creates a new trace state variable named
  9774. '$NAME', and optionally gives it an initial value of EXPRESSION.
  9775. The EXPRESSION is evaluated when this command is entered; the
  9776. result will be converted to an integer if possible, otherwise GDB
  9777. will report an error. A subsequent 'tvariable' command specifying
  9778. the same name does not create a variable, but instead assigns the
  9779. supplied initial value to the existing variable of that name,
  9780. overwriting any previous initial value. The default initial value
  9781. is 0.
  9782. 'info tvariables'
  9783. List all the trace state variables along with their initial values.
  9784. Their current values may also be displayed, if the trace experiment
  9785. is currently running.
  9786. 'delete tvariable [ $NAME ... ]'
  9787. Delete the given trace state variables, or all of them if no
  9788. arguments are specified.
  9789. 
  9790. File: gdb.info, Node: Tracepoint Actions, Next: Listing Tracepoints, Prev: Trace State Variables, Up: Set Tracepoints
  9791. 13.1.6 Tracepoint Action Lists
  9792. ------------------------------
  9793. 'actions [NUM]'
  9794. This command will prompt for a list of actions to be taken when the
  9795. tracepoint is hit. If the tracepoint number NUM is not specified,
  9796. this command sets the actions for the one that was most recently
  9797. defined (so that you can define a tracepoint and then say 'actions'
  9798. without bothering about its number). You specify the actions
  9799. themselves on the following lines, one action at a time, and
  9800. terminate the actions list with a line containing just 'end'. So
  9801. far, the only defined actions are 'collect', 'teval', and
  9802. 'while-stepping'.
  9803. 'actions' is actually equivalent to 'commands' (*note Breakpoint
  9804. Command Lists: Break Commands.), except that only the defined
  9805. actions are allowed; any other GDB command is rejected.
  9806. To remove all actions from a tracepoint, type 'actions NUM' and
  9807. follow it immediately with 'end'.
  9808. (gdb) collect DATA // collect some data
  9809. (gdb) while-stepping 5 // single-step 5 times, collect data
  9810. (gdb) end // signals the end of actions.
  9811. In the following example, the action list begins with 'collect'
  9812. commands indicating the things to be collected when the tracepoint
  9813. is hit. Then, in order to single-step and collect additional data
  9814. following the tracepoint, a 'while-stepping' command is used,
  9815. followed by the list of things to be collected after each step in a
  9816. sequence of single steps. The 'while-stepping' command is
  9817. terminated by its own separate 'end' command. Lastly, the action
  9818. list is terminated by an 'end' command.
  9819. (gdb) trace foo
  9820. (gdb) actions
  9821. Enter actions for tracepoint 1, one per line:
  9822. > collect bar,baz
  9823. > collect $regs
  9824. > while-stepping 12
  9825. > collect $pc, arr[i]
  9826. > end
  9827. end
  9828. 'collect[/MODS] EXPR1, EXPR2, ...'
  9829. Collect values of the given expressions when the tracepoint is hit.
  9830. This command accepts a comma-separated list of any valid
  9831. expressions. In addition to global, static, or local variables,
  9832. the following special arguments are supported:
  9833. '$regs'
  9834. Collect all registers.
  9835. '$args'
  9836. Collect all function arguments.
  9837. '$locals'
  9838. Collect all local variables.
  9839. '$_ret'
  9840. Collect the return address. This is helpful if you want to
  9841. see more of a backtrace.
  9842. _Note:_ The return address location can not always be reliably
  9843. determined up front, and the wrong address / registers may end
  9844. up collected instead. On some architectures the reliability
  9845. is higher for tracepoints at function entry, while on others
  9846. it's the opposite. When this happens, backtracing will stop
  9847. because the return address is found unavailable (unless
  9848. another collect rule happened to match it).
  9849. '$_probe_argc'
  9850. Collects the number of arguments from the static probe at
  9851. which the tracepoint is located. *Note Static Probe Points::.
  9852. '$_probe_argN'
  9853. N is an integer between 0 and 11. Collects the Nth argument
  9854. from the static probe at which the tracepoint is located.
  9855. *Note Static Probe Points::.
  9856. '$_sdata'
  9857. Collect static tracepoint marker specific data. Only
  9858. available for static tracepoints. *Note Tracepoint Action
  9859. Lists: Tracepoint Actions. On the UST static tracepoints
  9860. library backend, an instrumentation point resembles a 'printf'
  9861. function call. The tracing library is able to collect user
  9862. specified data formatted to a character string using the
  9863. format provided by the programmer that instrumented the
  9864. program. Other backends have similar mechanisms. Here's an
  9865. example of a UST marker call:
  9866. const char master_name[] = "$your_name";
  9867. trace_mark(channel1, marker1, "hello %s", master_name)
  9868. In this case, collecting '$_sdata' collects the string 'hello
  9869. $yourname'. When analyzing the trace buffer, you can inspect
  9870. '$_sdata' like any other variable available to GDB.
  9871. You can give several consecutive 'collect' commands, each one with
  9872. a single argument, or one 'collect' command with several arguments
  9873. separated by commas; the effect is the same.
  9874. The optional MODS changes the usual handling of the arguments. 's'
  9875. requests that pointers to chars be handled as strings, in
  9876. particular collecting the contents of the memory being pointed at,
  9877. up to the first zero. The upper bound is by default the value of
  9878. the 'print elements' variable; if 's' is followed by a decimal
  9879. number, that is the upper bound instead. So for instance
  9880. 'collect/s25 mystr' collects as many as 25 characters at 'mystr'.
  9881. The command 'info scope' (*note info scope: Symbols.) is
  9882. particularly useful for figuring out what data to collect.
  9883. 'teval EXPR1, EXPR2, ...'
  9884. Evaluate the given expressions when the tracepoint is hit. This
  9885. command accepts a comma-separated list of expressions. The results
  9886. are discarded, so this is mainly useful for assigning values to
  9887. trace state variables (*note Trace State Variables::) without
  9888. adding those values to the trace buffer, as would be the case if
  9889. the 'collect' action were used.
  9890. 'while-stepping N'
  9891. Perform N single-step instruction traces after the tracepoint,
  9892. collecting new data after each step. The 'while-stepping' command
  9893. is followed by the list of what to collect while stepping (followed
  9894. by its own 'end' command):
  9895. > while-stepping 12
  9896. > collect $regs, myglobal
  9897. > end
  9898. >
  9899. Note that '$pc' is not automatically collected by 'while-stepping';
  9900. you need to explicitly collect that register if you need it. You
  9901. may abbreviate 'while-stepping' as 'ws' or 'stepping'.
  9902. 'set default-collect EXPR1, EXPR2, ...'
  9903. This variable is a list of expressions to collect at each
  9904. tracepoint hit. It is effectively an additional 'collect' action
  9905. prepended to every tracepoint action list. The expressions are
  9906. parsed individually for each tracepoint, so for instance a variable
  9907. named 'xyz' may be interpreted as a global for one tracepoint, and
  9908. a local for another, as appropriate to the tracepoint's location.
  9909. 'show default-collect'
  9910. Show the list of expressions that are collected by default at each
  9911. tracepoint hit.
  9912. 
  9913. File: gdb.info, Node: Listing Tracepoints, Next: Listing Static Tracepoint Markers, Prev: Tracepoint Actions, Up: Set Tracepoints
  9914. 13.1.7 Listing Tracepoints
  9915. --------------------------
  9916. 'info tracepoints [NUM...]'
  9917. Display information about the tracepoint NUM. If you don't specify
  9918. a tracepoint number, displays information about all the tracepoints
  9919. defined so far. The format is similar to that used for 'info
  9920. breakpoints'; in fact, 'info tracepoints' is the same command,
  9921. simply restricting itself to tracepoints.
  9922. A tracepoint's listing may include additional information specific
  9923. to tracing:
  9924. * its passcount as given by the 'passcount N' command
  9925. * the state about installed on target of each location
  9926. (gdb) info trace
  9927. Num Type Disp Enb Address What
  9928. 1 tracepoint keep y 0x0804ab57 in foo() at main.cxx:7
  9929. while-stepping 20
  9930. collect globfoo, $regs
  9931. end
  9932. collect globfoo2
  9933. end
  9934. pass count 1200
  9935. 2 tracepoint keep y <MULTIPLE>
  9936. collect $eip
  9937. 2.1 y 0x0804859c in func4 at change-loc.h:35
  9938. installed on target
  9939. 2.2 y 0xb7ffc480 in func4 at change-loc.h:35
  9940. installed on target
  9941. 2.3 y <PENDING> set_tracepoint
  9942. 3 tracepoint keep y 0x080485b1 in foo at change-loc.c:29
  9943. not installed on target
  9944. (gdb)
  9945. This command can be abbreviated 'info tp'.
  9946. 
  9947. File: gdb.info, Node: Listing Static Tracepoint Markers, Next: Starting and Stopping Trace Experiments, Prev: Listing Tracepoints, Up: Set Tracepoints
  9948. 13.1.8 Listing Static Tracepoint Markers
  9949. ----------------------------------------
  9950. 'info static-tracepoint-markers'
  9951. Display information about all static tracepoint markers defined in
  9952. the program.
  9953. For each marker, the following columns are printed:
  9954. _Count_
  9955. An incrementing counter, output to help readability. This is
  9956. not a stable identifier.
  9957. _ID_
  9958. The marker ID, as reported by the target.
  9959. _Enabled or Disabled_
  9960. Probed markers are tagged with 'y'. 'n' identifies marks that
  9961. are not enabled.
  9962. _Address_
  9963. Where the marker is in your program, as a memory address.
  9964. _What_
  9965. Where the marker is in the source for your program, as a file
  9966. and line number. If the debug information included in the
  9967. program does not allow GDB to locate the source of the marker,
  9968. this column will be left blank.
  9969. In addition, the following information may be printed for each
  9970. marker:
  9971. _Data_
  9972. User data passed to the tracing library by the marker call.
  9973. In the UST backend, this is the format string passed as
  9974. argument to the marker call.
  9975. _Static tracepoints probing the marker_
  9976. The list of static tracepoints attached to the marker.
  9977. (gdb) info static-tracepoint-markers
  9978. Cnt ID Enb Address What
  9979. 1 ust/bar2 y 0x0000000000400e1a in main at stexample.c:25
  9980. Data: number1 %d number2 %d
  9981. Probed by static tracepoints: #2
  9982. 2 ust/bar33 n 0x0000000000400c87 in main at stexample.c:24
  9983. Data: str %s
  9984. (gdb)
  9985. 
  9986. File: gdb.info, Node: Starting and Stopping Trace Experiments, Next: Tracepoint Restrictions, Prev: Listing Static Tracepoint Markers, Up: Set Tracepoints
  9987. 13.1.9 Starting and Stopping Trace Experiments
  9988. ----------------------------------------------
  9989. 'tstart'
  9990. This command starts the trace experiment, and begins collecting
  9991. data. It has the side effect of discarding all the data collected
  9992. in the trace buffer during the previous trace experiment. If any
  9993. arguments are supplied, they are taken as a note and stored with
  9994. the trace experiment's state. The notes may be arbitrary text, and
  9995. are especially useful with disconnected tracing in a multi-user
  9996. context; the notes can explain what the trace is doing, supply user
  9997. contact information, and so forth.
  9998. 'tstop'
  9999. This command stops the trace experiment. If any arguments are
  10000. supplied, they are recorded with the experiment as a note. This is
  10001. useful if you are stopping a trace started by someone else, for
  10002. instance if the trace is interfering with the system's behavior and
  10003. needs to be stopped quickly.
  10004. *Note*: a trace experiment and data collection may stop
  10005. automatically if any tracepoint's passcount is reached (*note
  10006. Tracepoint Passcounts::), or if the trace buffer becomes full.
  10007. 'tstatus'
  10008. This command displays the status of the current trace data
  10009. collection.
  10010. Here is an example of the commands we described so far:
  10011. (gdb) trace gdb_c_test
  10012. (gdb) actions
  10013. Enter actions for tracepoint #1, one per line.
  10014. > collect $regs,$locals,$args
  10015. > while-stepping 11
  10016. > collect $regs
  10017. > end
  10018. > end
  10019. (gdb) tstart
  10020. [time passes ...]
  10021. (gdb) tstop
  10022. You can choose to continue running the trace experiment even if GDB
  10023. disconnects from the target, voluntarily or involuntarily. For commands
  10024. such as 'detach', the debugger will ask what you want to do with the
  10025. trace. But for unexpected terminations (GDB crash, network outage), it
  10026. would be unfortunate to lose hard-won trace data, so the variable
  10027. 'disconnected-tracing' lets you decide whether the trace should continue
  10028. running without GDB.
  10029. 'set disconnected-tracing on'
  10030. 'set disconnected-tracing off'
  10031. Choose whether a tracing run should continue to run if GDB has
  10032. disconnected from the target. Note that 'detach' or 'quit' will
  10033. ask you directly what to do about a running trace no matter what
  10034. this variable's setting, so the variable is mainly useful for
  10035. handling unexpected situations, such as loss of the network.
  10036. 'show disconnected-tracing'
  10037. Show the current choice for disconnected tracing.
  10038. When you reconnect to the target, the trace experiment may or may not
  10039. still be running; it might have filled the trace buffer in the meantime,
  10040. or stopped for one of the other reasons. If it is running, it will
  10041. continue after reconnection.
  10042. Upon reconnection, the target will upload information about the
  10043. tracepoints in effect. GDB will then compare that information to the
  10044. set of tracepoints currently defined, and attempt to match them up,
  10045. allowing for the possibility that the numbers may have changed due to
  10046. creation and deletion in the meantime. If one of the target's
  10047. tracepoints does not match any in GDB, the debugger will create a new
  10048. tracepoint, so that you have a number with which to specify that
  10049. tracepoint. This matching-up process is necessarily heuristic, and it
  10050. may result in useless tracepoints being created; you may simply delete
  10051. them if they are of no use.
  10052. If your target agent supports a "circular trace buffer", then you can
  10053. run a trace experiment indefinitely without filling the trace buffer;
  10054. when space runs out, the agent deletes already-collected trace frames,
  10055. oldest first, until there is enough room to continue collecting. This
  10056. is especially useful if your tracepoints are being hit too often, and
  10057. your trace gets terminated prematurely because the buffer is full. To
  10058. ask for a circular trace buffer, simply set 'circular-trace-buffer' to
  10059. on. You can set this at any time, including during tracing; if the
  10060. agent can do it, it will change buffer handling on the fly, otherwise it
  10061. will not take effect until the next run.
  10062. 'set circular-trace-buffer on'
  10063. 'set circular-trace-buffer off'
  10064. Choose whether a tracing run should use a linear or circular buffer
  10065. for trace data. A linear buffer will not lose any trace data, but
  10066. may fill up prematurely, while a circular buffer will discard old
  10067. trace data, but it will have always room for the latest tracepoint
  10068. hits.
  10069. 'show circular-trace-buffer'
  10070. Show the current choice for the trace buffer. Note that this may
  10071. not match the agent's current buffer handling, nor is it guaranteed
  10072. to match the setting that might have been in effect during a past
  10073. run, for instance if you are looking at frames from a trace file.
  10074. 'set trace-buffer-size N'
  10075. 'set trace-buffer-size unlimited'
  10076. Request that the target use a trace buffer of N bytes. Not all
  10077. targets will honor the request; they may have a compiled-in size
  10078. for the trace buffer, or some other limitation. Set to a value of
  10079. 'unlimited' or '-1' to let the target use whatever size it likes.
  10080. This is also the default.
  10081. 'show trace-buffer-size'
  10082. Show the current requested size for the trace buffer. Note that
  10083. this will only match the actual size if the target supports
  10084. size-setting, and was able to handle the requested size. For
  10085. instance, if the target can only change buffer size between runs,
  10086. this variable will not reflect the change until the next run
  10087. starts. Use 'tstatus' to get a report of the actual buffer size.
  10088. 'set trace-user TEXT'
  10089. 'show trace-user'
  10090. 'set trace-notes TEXT'
  10091. Set the trace run's notes.
  10092. 'show trace-notes'
  10093. Show the trace run's notes.
  10094. 'set trace-stop-notes TEXT'
  10095. Set the trace run's stop notes. The handling of the note is as for
  10096. 'tstop' arguments; the set command is convenient way to fix a stop
  10097. note that is mistaken or incomplete.
  10098. 'show trace-stop-notes'
  10099. Show the trace run's stop notes.
  10100. 
  10101. File: gdb.info, Node: Tracepoint Restrictions, Prev: Starting and Stopping Trace Experiments, Up: Set Tracepoints
  10102. 13.1.10 Tracepoint Restrictions
  10103. -------------------------------
  10104. There are a number of restrictions on the use of tracepoints. As
  10105. described above, tracepoint data gathering occurs on the target without
  10106. interaction from GDB. Thus the full capabilities of the debugger are
  10107. not available during data gathering, and then at data examination time,
  10108. you will be limited by only having what was collected. The following
  10109. items describe some common problems, but it is not exhaustive, and you
  10110. may run into additional difficulties not mentioned here.
  10111. * Tracepoint expressions are intended to gather objects (lvalues).
  10112. Thus the full flexibility of GDB's expression evaluator is not
  10113. available. You cannot call functions, cast objects to aggregate
  10114. types, access convenience variables or modify values (except by
  10115. assignment to trace state variables). Some language features may
  10116. implicitly call functions (for instance Objective-C fields with
  10117. accessors), and therefore cannot be collected either.
  10118. * Collection of local variables, either individually or in bulk with
  10119. '$locals' or '$args', during 'while-stepping' may behave
  10120. erratically. The stepping action may enter a new scope (for
  10121. instance by stepping into a function), or the location of the
  10122. variable may change (for instance it is loaded into a register).
  10123. The tracepoint data recorded uses the location information for the
  10124. variables that is correct for the tracepoint location. When the
  10125. tracepoint is created, it is not possible, in general, to determine
  10126. where the steps of a 'while-stepping' sequence will advance the
  10127. program--particularly if a conditional branch is stepped.
  10128. * Collection of an incompletely-initialized or partially-destroyed
  10129. object may result in something that GDB cannot display, or displays
  10130. in a misleading way.
  10131. * When GDB displays a pointer to character it automatically
  10132. dereferences the pointer to also display characters of the string
  10133. being pointed to. However, collecting the pointer during tracing
  10134. does not automatically collect the string. You need to explicitly
  10135. dereference the pointer and provide size information if you want to
  10136. collect not only the pointer, but the memory pointed to. For
  10137. example, '*ptr@50' can be used to collect the 50 element array
  10138. pointed to by 'ptr'.
  10139. * It is not possible to collect a complete stack backtrace at a
  10140. tracepoint. Instead, you may collect the registers and a few
  10141. hundred bytes from the stack pointer with something like
  10142. '*(unsigned char *)$esp@300' (adjust to use the name of the actual
  10143. stack pointer register on your target architecture, and the amount
  10144. of stack you wish to capture). Then the 'backtrace' command will
  10145. show a partial backtrace when using a trace frame. The number of
  10146. stack frames that can be examined depends on the sizes of the
  10147. frames in the collected stack. Note that if you ask for a block so
  10148. large that it goes past the bottom of the stack, the target agent
  10149. may report an error trying to read from an invalid address.
  10150. * If you do not collect registers at a tracepoint, GDB can infer that
  10151. the value of '$pc' must be the same as the address of the
  10152. tracepoint and use that when you are looking at a trace frame for
  10153. that tracepoint. However, this cannot work if the tracepoint has
  10154. multiple locations (for instance if it was set in a function that
  10155. was inlined), or if it has a 'while-stepping' loop. In those cases
  10156. GDB will warn you that it can't infer '$pc', and default it to
  10157. zero.
  10158. 
  10159. File: gdb.info, Node: Analyze Collected Data, Next: Tracepoint Variables, Prev: Set Tracepoints, Up: Tracepoints
  10160. 13.2 Using the Collected Data
  10161. =============================
  10162. After the tracepoint experiment ends, you use GDB commands for examining
  10163. the trace data. The basic idea is that each tracepoint collects a trace
  10164. "snapshot" every time it is hit and another snapshot every time it
  10165. single-steps. All these snapshots are consecutively numbered from zero
  10166. and go into a buffer, and you can examine them later. The way you
  10167. examine them is to "focus" on a specific trace snapshot. When the
  10168. remote stub is focused on a trace snapshot, it will respond to all GDB
  10169. requests for memory and registers by reading from the buffer which
  10170. belongs to that snapshot, rather than from _real_ memory or registers of
  10171. the program being debugged. This means that *all* GDB commands
  10172. ('print', 'info registers', 'backtrace', etc.) will behave as if we
  10173. were currently debugging the program state as it was when the tracepoint
  10174. occurred. Any requests for data that are not in the buffer will fail.
  10175. * Menu:
  10176. * tfind:: How to select a trace snapshot
  10177. * tdump:: How to display all data for a snapshot
  10178. * save tracepoints:: How to save tracepoints for a future run
  10179. 
  10180. File: gdb.info, Node: tfind, Next: tdump, Up: Analyze Collected Data
  10181. 13.2.1 'tfind N'
  10182. ----------------
  10183. The basic command for selecting a trace snapshot from the buffer is
  10184. 'tfind N', which finds trace snapshot number N, counting from zero. If
  10185. no argument N is given, the next snapshot is selected.
  10186. Here are the various forms of using the 'tfind' command.
  10187. 'tfind start'
  10188. Find the first snapshot in the buffer. This is a synonym for
  10189. 'tfind 0' (since 0 is the number of the first snapshot).
  10190. 'tfind none'
  10191. Stop debugging trace snapshots, resume _live_ debugging.
  10192. 'tfind end'
  10193. Same as 'tfind none'.
  10194. 'tfind'
  10195. No argument means find the next trace snapshot or find the first
  10196. one if no trace snapshot is selected.
  10197. 'tfind -'
  10198. Find the previous trace snapshot before the current one. This
  10199. permits retracing earlier steps.
  10200. 'tfind tracepoint NUM'
  10201. Find the next snapshot associated with tracepoint NUM. Search
  10202. proceeds forward from the last examined trace snapshot. If no
  10203. argument NUM is given, it means find the next snapshot collected
  10204. for the same tracepoint as the current snapshot.
  10205. 'tfind pc ADDR'
  10206. Find the next snapshot associated with the value ADDR of the
  10207. program counter. Search proceeds forward from the last examined
  10208. trace snapshot. If no argument ADDR is given, it means find the
  10209. next snapshot with the same value of PC as the current snapshot.
  10210. 'tfind outside ADDR1, ADDR2'
  10211. Find the next snapshot whose PC is outside the given range of
  10212. addresses (exclusive).
  10213. 'tfind range ADDR1, ADDR2'
  10214. Find the next snapshot whose PC is between ADDR1 and ADDR2
  10215. (inclusive).
  10216. 'tfind line [FILE:]N'
  10217. Find the next snapshot associated with the source line N. If the
  10218. optional argument FILE is given, refer to line N in that source
  10219. file. Search proceeds forward from the last examined trace
  10220. snapshot. If no argument N is given, it means find the next line
  10221. other than the one currently being examined; thus saying 'tfind
  10222. line' repeatedly can appear to have the same effect as stepping
  10223. from line to line in a _live_ debugging session.
  10224. The default arguments for the 'tfind' commands are specifically
  10225. designed to make it easy to scan through the trace buffer. For
  10226. instance, 'tfind' with no argument selects the next trace snapshot, and
  10227. 'tfind -' with no argument selects the previous trace snapshot. So, by
  10228. giving one 'tfind' command, and then simply hitting <RET> repeatedly you
  10229. can examine all the trace snapshots in order. Or, by saying 'tfind -'
  10230. and then hitting <RET> repeatedly you can examine the snapshots in
  10231. reverse order. The 'tfind line' command with no argument selects the
  10232. snapshot for the next source line executed. The 'tfind pc' command with
  10233. no argument selects the next snapshot with the same program counter (PC)
  10234. as the current frame. The 'tfind tracepoint' command with no argument
  10235. selects the next trace snapshot collected by the same tracepoint as the
  10236. current one.
  10237. In addition to letting you scan through the trace buffer manually,
  10238. these commands make it easy to construct GDB scripts that scan through
  10239. the trace buffer and print out whatever collected data you are
  10240. interested in. Thus, if we want to examine the PC, FP, and SP registers
  10241. from each trace frame in the buffer, we can say this:
  10242. (gdb) tfind start
  10243. (gdb) while ($trace_frame != -1)
  10244. > printf "Frame %d, PC = %08X, SP = %08X, FP = %08X\n", \
  10245. $trace_frame, $pc, $sp, $fp
  10246. > tfind
  10247. > end
  10248. Frame 0, PC = 0020DC64, SP = 0030BF3C, FP = 0030BF44
  10249. Frame 1, PC = 0020DC6C, SP = 0030BF38, FP = 0030BF44
  10250. Frame 2, PC = 0020DC70, SP = 0030BF34, FP = 0030BF44
  10251. Frame 3, PC = 0020DC74, SP = 0030BF30, FP = 0030BF44
  10252. Frame 4, PC = 0020DC78, SP = 0030BF2C, FP = 0030BF44
  10253. Frame 5, PC = 0020DC7C, SP = 0030BF28, FP = 0030BF44
  10254. Frame 6, PC = 0020DC80, SP = 0030BF24, FP = 0030BF44
  10255. Frame 7, PC = 0020DC84, SP = 0030BF20, FP = 0030BF44
  10256. Frame 8, PC = 0020DC88, SP = 0030BF1C, FP = 0030BF44
  10257. Frame 9, PC = 0020DC8E, SP = 0030BF18, FP = 0030BF44
  10258. Frame 10, PC = 00203F6C, SP = 0030BE3C, FP = 0030BF14
  10259. Or, if we want to examine the variable 'X' at each source line in the
  10260. buffer:
  10261. (gdb) tfind start
  10262. (gdb) while ($trace_frame != -1)
  10263. > printf "Frame %d, X == %d\n", $trace_frame, X
  10264. > tfind line
  10265. > end
  10266. Frame 0, X = 1
  10267. Frame 7, X = 2
  10268. Frame 13, X = 255
  10269. 
  10270. File: gdb.info, Node: tdump, Next: save tracepoints, Prev: tfind, Up: Analyze Collected Data
  10271. 13.2.2 'tdump'
  10272. --------------
  10273. This command takes no arguments. It prints all the data collected at
  10274. the current trace snapshot.
  10275. (gdb) trace 444
  10276. (gdb) actions
  10277. Enter actions for tracepoint #2, one per line:
  10278. > collect $regs, $locals, $args, gdb_long_test
  10279. > end
  10280. (gdb) tstart
  10281. (gdb) tfind line 444
  10282. #0 gdb_test (p1=0x11, p2=0x22, p3=0x33, p4=0x44, p5=0x55, p6=0x66)
  10283. at gdb_test.c:444
  10284. 444 printp( "%s: arguments = 0x%X 0x%X 0x%X 0x%X 0x%X 0x%X\n", )
  10285. (gdb) tdump
  10286. Data collected at tracepoint 2, trace frame 1:
  10287. d0 0xc4aa0085 -995491707
  10288. d1 0x18 24
  10289. d2 0x80 128
  10290. d3 0x33 51
  10291. d4 0x71aea3d 119204413
  10292. d5 0x22 34
  10293. d6 0xe0 224
  10294. d7 0x380035 3670069
  10295. a0 0x19e24a 1696330
  10296. a1 0x3000668 50333288
  10297. a2 0x100 256
  10298. a3 0x322000 3284992
  10299. a4 0x3000698 50333336
  10300. a5 0x1ad3cc 1758156
  10301. fp 0x30bf3c 0x30bf3c
  10302. sp 0x30bf34 0x30bf34
  10303. ps 0x0 0
  10304. pc 0x20b2c8 0x20b2c8
  10305. fpcontrol 0x0 0
  10306. fpstatus 0x0 0
  10307. fpiaddr 0x0 0
  10308. p = 0x20e5b4 "gdb-test"
  10309. p1 = (void *) 0x11
  10310. p2 = (void *) 0x22
  10311. p3 = (void *) 0x33
  10312. p4 = (void *) 0x44
  10313. p5 = (void *) 0x55
  10314. p6 = (void *) 0x66
  10315. gdb_long_test = 17 '\021'
  10316. (gdb)
  10317. 'tdump' works by scanning the tracepoint's current collection actions
  10318. and printing the value of each expression listed. So 'tdump' can fail,
  10319. if after a run, you change the tracepoint's actions to mention variables
  10320. that were not collected during the run.
  10321. Also, for tracepoints with 'while-stepping' loops, 'tdump' uses the
  10322. collected value of '$pc' to distinguish between trace frames that were
  10323. collected at the tracepoint hit, and frames that were collected while
  10324. stepping. This allows it to correctly choose whether to display the
  10325. basic list of collections, or the collections from the body of the
  10326. while-stepping loop. However, if '$pc' was not collected, then 'tdump'
  10327. will always attempt to dump using the basic collection list, and may
  10328. fail if a while-stepping frame does not include all the same data that
  10329. is collected at the tracepoint hit.
  10330. 
  10331. File: gdb.info, Node: save tracepoints, Prev: tdump, Up: Analyze Collected Data
  10332. 13.2.3 'save tracepoints FILENAME'
  10333. ----------------------------------
  10334. This command saves all current tracepoint definitions together with
  10335. their actions and passcounts, into a file 'FILENAME' suitable for use in
  10336. a later debugging session. To read the saved tracepoint definitions,
  10337. use the 'source' command (*note Command Files::). The
  10338. 'save-tracepoints' command is a deprecated alias for 'save tracepoints'
  10339. 
  10340. File: gdb.info, Node: Tracepoint Variables, Next: Trace Files, Prev: Analyze Collected Data, Up: Tracepoints
  10341. 13.3 Convenience Variables for Tracepoints
  10342. ==========================================
  10343. '(int) $trace_frame'
  10344. The current trace snapshot (a.k.a. "frame") number, or -1 if no
  10345. snapshot is selected.
  10346. '(int) $tracepoint'
  10347. The tracepoint for the current trace snapshot.
  10348. '(int) $trace_line'
  10349. The line number for the current trace snapshot.
  10350. '(char []) $trace_file'
  10351. The source file for the current trace snapshot.
  10352. '(char []) $trace_func'
  10353. The name of the function containing '$tracepoint'.
  10354. Note: '$trace_file' is not suitable for use in 'printf', use 'output'
  10355. instead.
  10356. Here's a simple example of using these convenience variables for
  10357. stepping through all the trace snapshots and printing some of their
  10358. data. Note that these are not the same as trace state variables, which
  10359. are managed by the target.
  10360. (gdb) tfind start
  10361. (gdb) while $trace_frame != -1
  10362. > output $trace_file
  10363. > printf ", line %d (tracepoint #%d)\n", $trace_line, $tracepoint
  10364. > tfind
  10365. > end
  10366. 
  10367. File: gdb.info, Node: Trace Files, Prev: Tracepoint Variables, Up: Tracepoints
  10368. 13.4 Using Trace Files
  10369. ======================
  10370. In some situations, the target running a trace experiment may no longer
  10371. be available; perhaps it crashed, or the hardware was needed for a
  10372. different activity. To handle these cases, you can arrange to dump the
  10373. trace data into a file, and later use that file as a source of trace
  10374. data, via the 'target tfile' command.
  10375. 'tsave [ -r ] FILENAME'
  10376. 'tsave [-ctf] DIRNAME'
  10377. Save the trace data to FILENAME. By default, this command assumes
  10378. that FILENAME refers to the host filesystem, so if necessary GDB
  10379. will copy raw trace data up from the target and then save it. If
  10380. the target supports it, you can also supply the optional argument
  10381. '-r' ("remote") to direct the target to save the data directly into
  10382. FILENAME in its own filesystem, which may be more efficient if the
  10383. trace buffer is very large. (Note, however, that 'target tfile'
  10384. can only read from files accessible to the host.) By default, this
  10385. command will save trace frame in tfile format. You can supply the
  10386. optional argument '-ctf' to save data in CTF format. The "Common
  10387. Trace Format" (CTF) is proposed as a trace format that can be
  10388. shared by multiple debugging and tracing tools. Please go to
  10389. 'http://www.efficios.com/ctf' to get more information.
  10390. 'target tfile FILENAME'
  10391. 'target ctf DIRNAME'
  10392. Use the file named FILENAME or directory named DIRNAME as a source
  10393. of trace data. Commands that examine data work as they do with a
  10394. live target, but it is not possible to run any new trace
  10395. experiments. 'tstatus' will report the state of the trace run at
  10396. the moment the data was saved, as well as the current trace frame
  10397. you are examining. Both FILENAME and DIRNAME must be on a
  10398. filesystem accessible to the host.
  10399. (gdb) target ctf ctf.ctf
  10400. (gdb) tfind
  10401. Found trace frame 0, tracepoint 2
  10402. 39 ++a; /* set tracepoint 1 here */
  10403. (gdb) tdump
  10404. Data collected at tracepoint 2, trace frame 0:
  10405. i = 0
  10406. a = 0
  10407. b = 1 '\001'
  10408. c = {"123", "456", "789", "123", "456", "789"}
  10409. d = {{{a = 1, b = 2}, {a = 3, b = 4}}, {{a = 5, b = 6}, {a = 7, b = 8}}}
  10410. (gdb) p b
  10411. $1 = 1
  10412. 
  10413. File: gdb.info, Node: Overlays, Next: Languages, Prev: Tracepoints, Up: Top
  10414. 14 Debugging Programs That Use Overlays
  10415. ***************************************
  10416. If your program is too large to fit completely in your target system's
  10417. memory, you can sometimes use "overlays" to work around this problem.
  10418. GDB provides some support for debugging programs that use overlays.
  10419. * Menu:
  10420. * How Overlays Work:: A general explanation of overlays.
  10421. * Overlay Commands:: Managing overlays in GDB.
  10422. * Automatic Overlay Debugging:: GDB can find out which overlays are
  10423. mapped by asking the inferior.
  10424. * Overlay Sample Program:: A sample program using overlays.
  10425. 
  10426. File: gdb.info, Node: How Overlays Work, Next: Overlay Commands, Up: Overlays
  10427. 14.1 How Overlays Work
  10428. ======================
  10429. Suppose you have a computer whose instruction address space is only 64
  10430. kilobytes long, but which has much more memory which can be accessed by
  10431. other means: special instructions, segment registers, or memory
  10432. management hardware, for example. Suppose further that you want to
  10433. adapt a program which is larger than 64 kilobytes to run on this system.
  10434. One solution is to identify modules of your program which are
  10435. relatively independent, and need not call each other directly; call
  10436. these modules "overlays". Separate the overlays from the main program,
  10437. and place their machine code in the larger memory. Place your main
  10438. program in instruction memory, but leave at least enough space there to
  10439. hold the largest overlay as well.
  10440. Now, to call a function located in an overlay, you must first copy
  10441. that overlay's machine code from the large memory into the space set
  10442. aside for it in the instruction memory, and then jump to its entry point
  10443. there.
  10444. Data Instruction Larger
  10445. Address Space Address Space Address Space
  10446. +-----------+ +-----------+ +-----------+
  10447. | | | | | |
  10448. +-----------+ +-----------+ +-----------+<-- overlay 1
  10449. | program | | main | .----| overlay 1 | load address
  10450. | variables | | program | | +-----------+
  10451. | and heap | | | | | |
  10452. +-----------+ | | | +-----------+<-- overlay 2
  10453. | | +-----------+ | | | load address
  10454. +-----------+ | | | .-| overlay 2 |
  10455. | | | | | |
  10456. mapped --->+-----------+ | | +-----------+
  10457. address | | | | | |
  10458. | overlay | <-' | | |
  10459. | area | <---' +-----------+<-- overlay 3
  10460. | | <---. | | load address
  10461. +-----------+ `--| overlay 3 |
  10462. | | | |
  10463. +-----------+ | |
  10464. +-----------+
  10465. | |
  10466. +-----------+
  10467. A code overlay
  10468. The diagram (*note A code overlay::) shows a system with separate
  10469. data and instruction address spaces. To map an overlay, the program
  10470. copies its code from the larger address space to the instruction address
  10471. space. Since the overlays shown here all use the same mapped address,
  10472. only one may be mapped at a time. For a system with a single address
  10473. space for data and instructions, the diagram would be similar, except
  10474. that the program variables and heap would share an address space with
  10475. the main program and the overlay area.
  10476. An overlay loaded into instruction memory and ready for use is called
  10477. a "mapped" overlay; its "mapped address" is its address in the
  10478. instruction memory. An overlay not present (or only partially present)
  10479. in instruction memory is called "unmapped"; its "load address" is its
  10480. address in the larger memory. The mapped address is also called the
  10481. "virtual memory address", or "VMA"; the load address is also called the
  10482. "load memory address", or "LMA".
  10483. Unfortunately, overlays are not a completely transparent way to adapt
  10484. a program to limited instruction memory. They introduce a new set of
  10485. global constraints you must keep in mind as you design your program:
  10486. * Before calling or returning to a function in an overlay, your
  10487. program must make sure that overlay is actually mapped. Otherwise,
  10488. the call or return will transfer control to the right address, but
  10489. in the wrong overlay, and your program will probably crash.
  10490. * If the process of mapping an overlay is expensive on your system,
  10491. you will need to choose your overlays carefully to minimize their
  10492. effect on your program's performance.
  10493. * The executable file you load onto your system must contain each
  10494. overlay's instructions, appearing at the overlay's load address,
  10495. not its mapped address. However, each overlay's instructions must
  10496. be relocated and its symbols defined as if the overlay were at its
  10497. mapped address. You can use GNU linker scripts to specify
  10498. different load and relocation addresses for pieces of your program;
  10499. see *note (ld.info)Overlay Description::.
  10500. * The procedure for loading executable files onto your system must be
  10501. able to load their contents into the larger address space as well
  10502. as the instruction and data spaces.
  10503. The overlay system described above is rather simple, and could be
  10504. improved in many ways:
  10505. * If your system has suitable bank switch registers or memory
  10506. management hardware, you could use those facilities to make an
  10507. overlay's load area contents simply appear at their mapped address
  10508. in instruction space. This would probably be faster than copying
  10509. the overlay to its mapped area in the usual way.
  10510. * If your overlays are small enough, you could set aside more than
  10511. one overlay area, and have more than one overlay mapped at a time.
  10512. * You can use overlays to manage data, as well as instructions. In
  10513. general, data overlays are even less transparent to your design
  10514. than code overlays: whereas code overlays only require care when
  10515. you call or return to functions, data overlays require care every
  10516. time you access the data. Also, if you change the contents of a
  10517. data overlay, you must copy its contents back out to its load
  10518. address before you can copy a different data overlay into the same
  10519. mapped area.
  10520. 
  10521. File: gdb.info, Node: Overlay Commands, Next: Automatic Overlay Debugging, Prev: How Overlays Work, Up: Overlays
  10522. 14.2 Overlay Commands
  10523. =====================
  10524. To use GDB's overlay support, each overlay in your program must
  10525. correspond to a separate section of the executable file. The section's
  10526. virtual memory address and load memory address must be the overlay's
  10527. mapped and load addresses. Identifying overlays with sections allows
  10528. GDB to determine the appropriate address of a function or variable,
  10529. depending on whether the overlay is mapped or not.
  10530. GDB's overlay commands all start with the word 'overlay'; you can
  10531. abbreviate this as 'ov' or 'ovly'. The commands are:
  10532. 'overlay off'
  10533. Disable GDB's overlay support. When overlay support is disabled,
  10534. GDB assumes that all functions and variables are always present at
  10535. their mapped addresses. By default, GDB's overlay support is
  10536. disabled.
  10537. 'overlay manual'
  10538. Enable "manual" overlay debugging. In this mode, GDB relies on you
  10539. to tell it which overlays are mapped, and which are not, using the
  10540. 'overlay map-overlay' and 'overlay unmap-overlay' commands
  10541. described below.
  10542. 'overlay map-overlay OVERLAY'
  10543. 'overlay map OVERLAY'
  10544. Tell GDB that OVERLAY is now mapped; OVERLAY must be the name of
  10545. the object file section containing the overlay. When an overlay is
  10546. mapped, GDB assumes it can find the overlay's functions and
  10547. variables at their mapped addresses. GDB assumes that any other
  10548. overlays whose mapped ranges overlap that of OVERLAY are now
  10549. unmapped.
  10550. 'overlay unmap-overlay OVERLAY'
  10551. 'overlay unmap OVERLAY'
  10552. Tell GDB that OVERLAY is no longer mapped; OVERLAY must be the name
  10553. of the object file section containing the overlay. When an overlay
  10554. is unmapped, GDB assumes it can find the overlay's functions and
  10555. variables at their load addresses.
  10556. 'overlay auto'
  10557. Enable "automatic" overlay debugging. In this mode, GDB consults a
  10558. data structure the overlay manager maintains in the inferior to see
  10559. which overlays are mapped. For details, see *note Automatic
  10560. Overlay Debugging::.
  10561. 'overlay load-target'
  10562. 'overlay load'
  10563. Re-read the overlay table from the inferior. Normally, GDB
  10564. re-reads the table GDB automatically each time the inferior stops,
  10565. so this command should only be necessary if you have changed the
  10566. overlay mapping yourself using GDB. This command is only useful
  10567. when using automatic overlay debugging.
  10568. 'overlay list-overlays'
  10569. 'overlay list'
  10570. Display a list of the overlays currently mapped, along with their
  10571. mapped addresses, load addresses, and sizes.
  10572. Normally, when GDB prints a code address, it includes the name of the
  10573. function the address falls in:
  10574. (gdb) print main
  10575. $3 = {int ()} 0x11a0 <main>
  10576. When overlay debugging is enabled, GDB recognizes code in unmapped
  10577. overlays, and prints the names of unmapped functions with asterisks
  10578. around them. For example, if 'foo' is a function in an unmapped
  10579. overlay, GDB prints it this way:
  10580. (gdb) overlay list
  10581. No sections are mapped.
  10582. (gdb) print foo
  10583. $5 = {int (int)} 0x100000 <*foo*>
  10584. When 'foo''s overlay is mapped, GDB prints the function's name normally:
  10585. (gdb) overlay list
  10586. Section .ov.foo.text, loaded at 0x100000 - 0x100034,
  10587. mapped at 0x1016 - 0x104a
  10588. (gdb) print foo
  10589. $6 = {int (int)} 0x1016 <foo>
  10590. When overlay debugging is enabled, GDB can find the correct address
  10591. for functions and variables in an overlay, whether or not the overlay is
  10592. mapped. This allows most GDB commands, like 'break' and 'disassemble',
  10593. to work normally, even on unmapped code. However, GDB's breakpoint
  10594. support has some limitations:
  10595. * You can set breakpoints in functions in unmapped overlays, as long
  10596. as GDB can write to the overlay at its load address.
  10597. * GDB can not set hardware or simulator-based breakpoints in unmapped
  10598. overlays. However, if you set a breakpoint at the end of your
  10599. overlay manager (and tell GDB which overlays are now mapped, if you
  10600. are using manual overlay management), GDB will re-set its
  10601. breakpoints properly.
  10602. 
  10603. File: gdb.info, Node: Automatic Overlay Debugging, Next: Overlay Sample Program, Prev: Overlay Commands, Up: Overlays
  10604. 14.3 Automatic Overlay Debugging
  10605. ================================
  10606. GDB can automatically track which overlays are mapped and which are not,
  10607. given some simple co-operation from the overlay manager in the inferior.
  10608. If you enable automatic overlay debugging with the 'overlay auto'
  10609. command (*note Overlay Commands::), GDB looks in the inferior's memory
  10610. for certain variables describing the current state of the overlays.
  10611. Here are the variables your overlay manager must define to support
  10612. GDB's automatic overlay debugging:
  10613. '_ovly_table':
  10614. This variable must be an array of the following structures:
  10615. struct
  10616. {
  10617. /* The overlay's mapped address. */
  10618. unsigned long vma;
  10619. /* The size of the overlay, in bytes. */
  10620. unsigned long size;
  10621. /* The overlay's load address. */
  10622. unsigned long lma;
  10623. /* Non-zero if the overlay is currently mapped;
  10624. zero otherwise. */
  10625. unsigned long mapped;
  10626. }
  10627. '_novlys':
  10628. This variable must be a four-byte signed integer, holding the total
  10629. number of elements in '_ovly_table'.
  10630. To decide whether a particular overlay is mapped or not, GDB looks
  10631. for an entry in '_ovly_table' whose 'vma' and 'lma' members equal the
  10632. VMA and LMA of the overlay's section in the executable file. When GDB
  10633. finds a matching entry, it consults the entry's 'mapped' member to
  10634. determine whether the overlay is currently mapped.
  10635. In addition, your overlay manager may define a function called
  10636. '_ovly_debug_event'. If this function is defined, GDB will silently set
  10637. a breakpoint there. If the overlay manager then calls this function
  10638. whenever it has changed the overlay table, this will enable GDB to
  10639. accurately keep track of which overlays are in program memory, and
  10640. update any breakpoints that may be set in overlays. This will allow
  10641. breakpoints to work even if the overlays are kept in ROM or other
  10642. non-writable memory while they are not being executed.
  10643. 
  10644. File: gdb.info, Node: Overlay Sample Program, Prev: Automatic Overlay Debugging, Up: Overlays
  10645. 14.4 Overlay Sample Program
  10646. ===========================
  10647. When linking a program which uses overlays, you must place the overlays
  10648. at their load addresses, while relocating them to run at their mapped
  10649. addresses. To do this, you must write a linker script (*note
  10650. (ld.info)Overlay Description::). Unfortunately, since linker scripts
  10651. are specific to a particular host system, target architecture, and
  10652. target memory layout, this manual cannot provide portable sample code
  10653. demonstrating GDB's overlay support.
  10654. However, the GDB source distribution does contain an overlaid
  10655. program, with linker scripts for a few systems, as part of its test
  10656. suite. The program consists of the following files from
  10657. 'gdb/testsuite/gdb.base':
  10658. 'overlays.c'
  10659. The main program file.
  10660. 'ovlymgr.c'
  10661. A simple overlay manager, used by 'overlays.c'.
  10662. 'foo.c'
  10663. 'bar.c'
  10664. 'baz.c'
  10665. 'grbx.c'
  10666. Overlay modules, loaded and used by 'overlays.c'.
  10667. 'd10v.ld'
  10668. 'm32r.ld'
  10669. Linker scripts for linking the test program on the 'd10v-elf' and
  10670. 'm32r-elf' targets.
  10671. You can build the test program using the 'd10v-elf' GCC
  10672. cross-compiler like this:
  10673. $ d10v-elf-gcc -g -c overlays.c
  10674. $ d10v-elf-gcc -g -c ovlymgr.c
  10675. $ d10v-elf-gcc -g -c foo.c
  10676. $ d10v-elf-gcc -g -c bar.c
  10677. $ d10v-elf-gcc -g -c baz.c
  10678. $ d10v-elf-gcc -g -c grbx.c
  10679. $ d10v-elf-gcc -g overlays.o ovlymgr.o foo.o bar.o \
  10680. baz.o grbx.o -Wl,-Td10v.ld -o overlays
  10681. The build process is identical for any other architecture, except
  10682. that you must substitute the appropriate compiler and linker script for
  10683. the target system for 'd10v-elf-gcc' and 'd10v.ld'.
  10684. 
  10685. File: gdb.info, Node: Languages, Next: Symbols, Prev: Overlays, Up: Top
  10686. 15 Using GDB with Different Languages
  10687. *************************************
  10688. Although programming languages generally have common aspects, they are
  10689. rarely expressed in the same manner. For instance, in ANSI C,
  10690. dereferencing a pointer 'p' is accomplished by '*p', but in Modula-2, it
  10691. is accomplished by 'p^'. Values can also be represented (and displayed)
  10692. differently. Hex numbers in C appear as '0x1ae', while in Modula-2 they
  10693. appear as '1AEH'.
  10694. Language-specific information is built into GDB for some languages,
  10695. allowing you to express operations like the above in your program's
  10696. native language, and allowing GDB to output values in a manner
  10697. consistent with the syntax of your program's native language. The
  10698. language you use to build expressions is called the "working language".
  10699. * Menu:
  10700. * Setting:: Switching between source languages
  10701. * Show:: Displaying the language
  10702. * Checks:: Type and range checks
  10703. * Supported Languages:: Supported languages
  10704. * Unsupported Languages:: Unsupported languages
  10705. 
  10706. File: gdb.info, Node: Setting, Next: Show, Up: Languages
  10707. 15.1 Switching Between Source Languages
  10708. =======================================
  10709. There are two ways to control the working language--either have GDB set
  10710. it automatically, or select it manually yourself. You can use the 'set
  10711. language' command for either purpose. On startup, GDB defaults to
  10712. setting the language automatically. The working language is used to
  10713. determine how expressions you type are interpreted, how values are
  10714. printed, etc.
  10715. In addition to the working language, every source file that GDB knows
  10716. about has its own working language. For some object file formats, the
  10717. compiler might indicate which language a particular source file is in.
  10718. However, most of the time GDB infers the language from the name of the
  10719. file. The language of a source file controls whether C++ names are
  10720. demangled--this way 'backtrace' can show each frame appropriately for
  10721. its own language. There is no way to set the language of a source file
  10722. from within GDB, but you can set the language associated with a filename
  10723. extension. *Note Displaying the Language: Show.
  10724. This is most commonly a problem when you use a program, such as
  10725. 'cfront' or 'f2c', that generates C but is written in another language.
  10726. In that case, make the program use '#line' directives in its C output;
  10727. that way GDB will know the correct language of the source code of the
  10728. original program, and will display that source code, not the generated C
  10729. code.
  10730. * Menu:
  10731. * Filenames:: Filename extensions and languages.
  10732. * Manually:: Setting the working language manually
  10733. * Automatically:: Having GDB infer the source language
  10734. 
  10735. File: gdb.info, Node: Filenames, Next: Manually, Up: Setting
  10736. 15.1.1 List of Filename Extensions and Languages
  10737. ------------------------------------------------
  10738. If a source file name ends in one of the following extensions, then GDB
  10739. infers that its language is the one indicated.
  10740. '.ada'
  10741. '.ads'
  10742. '.adb'
  10743. '.a'
  10744. Ada source file.
  10745. '.c'
  10746. C source file
  10747. '.C'
  10748. '.cc'
  10749. '.cp'
  10750. '.cpp'
  10751. '.cxx'
  10752. '.c++'
  10753. C++ source file
  10754. '.d'
  10755. D source file
  10756. '.m'
  10757. Objective-C source file
  10758. '.f'
  10759. '.F'
  10760. Fortran source file
  10761. '.mod'
  10762. Modula-2 source file
  10763. '.s'
  10764. '.S'
  10765. Assembler source file. This actually behaves almost like C, but
  10766. GDB does not skip over function prologues when stepping.
  10767. In addition, you may set the language associated with a filename
  10768. extension. *Note Displaying the Language: Show.
  10769. 
  10770. File: gdb.info, Node: Manually, Next: Automatically, Prev: Filenames, Up: Setting
  10771. 15.1.2 Setting the Working Language
  10772. -----------------------------------
  10773. If you allow GDB to set the language automatically, expressions are
  10774. interpreted the same way in your debugging session and your program.
  10775. If you wish, you may set the language manually. To do this, issue
  10776. the command 'set language LANG', where LANG is the name of a language,
  10777. such as 'c' or 'modula-2'. For a list of the supported languages, type
  10778. 'set language'.
  10779. Setting the language manually prevents GDB from updating the working
  10780. language automatically. This can lead to confusion if you try to debug
  10781. a program when the working language is not the same as the source
  10782. language, when an expression is acceptable to both languages--but means
  10783. different things. For instance, if the current source file were written
  10784. in C, and GDB was parsing Modula-2, a command such as:
  10785. print a = b + c
  10786. might not have the effect you intended. In C, this means to add 'b' and
  10787. 'c' and place the result in 'a'. The result printed would be the value
  10788. of 'a'. In Modula-2, this means to compare 'a' to the result of 'b+c',
  10789. yielding a 'BOOLEAN' value.
  10790. 
  10791. File: gdb.info, Node: Automatically, Prev: Manually, Up: Setting
  10792. 15.1.3 Having GDB Infer the Source Language
  10793. -------------------------------------------
  10794. To have GDB set the working language automatically, use 'set language
  10795. local' or 'set language auto'. GDB then infers the working language.
  10796. That is, when your program stops in a frame (usually by encountering a
  10797. breakpoint), GDB sets the working language to the language recorded for
  10798. the function in that frame. If the language for a frame is unknown
  10799. (that is, if the function or block corresponding to the frame was
  10800. defined in a source file that does not have a recognized extension), the
  10801. current working language is not changed, and GDB issues a warning.
  10802. This may not seem necessary for most programs, which are written
  10803. entirely in one source language. However, program modules and libraries
  10804. written in one source language can be used by a main program written in
  10805. a different source language. Using 'set language auto' in this case
  10806. frees you from having to set the working language manually.
  10807. 
  10808. File: gdb.info, Node: Show, Next: Checks, Prev: Setting, Up: Languages
  10809. 15.2 Displaying the Language
  10810. ============================
  10811. The following commands help you find out which language is the working
  10812. language, and also what language source files were written in.
  10813. 'show language'
  10814. Display the current working language. This is the language you can
  10815. use with commands such as 'print' to build and compute expressions
  10816. that may involve variables in your program.
  10817. 'info frame'
  10818. Display the source language for this frame. This language becomes
  10819. the working language if you use an identifier from this frame.
  10820. *Note Information about a Frame: Frame Info, to identify the other
  10821. information listed here.
  10822. 'info source'
  10823. Display the source language of this source file. *Note Examining
  10824. the Symbol Table: Symbols, to identify the other information listed
  10825. here.
  10826. In unusual circumstances, you may have source files with extensions
  10827. not in the standard list. You can then set the extension associated
  10828. with a language explicitly:
  10829. 'set extension-language EXT LANGUAGE'
  10830. Tell GDB that source files with extension EXT are to be assumed as
  10831. written in the source language LANGUAGE.
  10832. 'info extensions'
  10833. List all the filename extensions and the associated languages.
  10834. 
  10835. File: gdb.info, Node: Checks, Next: Supported Languages, Prev: Show, Up: Languages
  10836. 15.3 Type and Range Checking
  10837. ============================
  10838. Some languages are designed to guard you against making seemingly common
  10839. errors through a series of compile- and run-time checks. These include
  10840. checking the type of arguments to functions and operators and making
  10841. sure mathematical overflows are caught at run time. Checks such as
  10842. these help to ensure a program's correctness once it has been compiled
  10843. by eliminating type mismatches and providing active checks for range
  10844. errors when your program is running.
  10845. By default GDB checks for these errors according to the rules of the
  10846. current source language. Although GDB does not check the statements in
  10847. your program, it can check expressions entered directly into GDB for
  10848. evaluation via the 'print' command, for example.
  10849. * Menu:
  10850. * Type Checking:: An overview of type checking
  10851. * Range Checking:: An overview of range checking
  10852. 
  10853. File: gdb.info, Node: Type Checking, Next: Range Checking, Up: Checks
  10854. 15.3.1 An Overview of Type Checking
  10855. -----------------------------------
  10856. Some languages, such as C and C++, are strongly typed, meaning that the
  10857. arguments to operators and functions have to be of the correct type,
  10858. otherwise an error occurs. These checks prevent type mismatch errors
  10859. from ever causing any run-time problems. For example,
  10860. int klass::my_method(char *b) { return b ? 1 : 2; }
  10861. (gdb) print obj.my_method (0)
  10862. $1 = 2
  10863. but
  10864. (gdb) print obj.my_method (0x1234)
  10865. Cannot resolve method klass::my_method to any overloaded instance
  10866. The second example fails because in C++ the integer constant '0x1234'
  10867. is not type-compatible with the pointer parameter type.
  10868. For the expressions you use in GDB commands, you can tell GDB to not
  10869. enforce strict type checking or to treat any mismatches as errors and
  10870. abandon the expression; When type checking is disabled, GDB successfully
  10871. evaluates expressions like the second example above.
  10872. Even if type checking is off, there may be other reasons related to
  10873. type that prevent GDB from evaluating an expression. For instance, GDB
  10874. does not know how to add an 'int' and a 'struct foo'. These particular
  10875. type errors have nothing to do with the language in use and usually
  10876. arise from expressions which make little sense to evaluate anyway.
  10877. GDB provides some additional commands for controlling type checking:
  10878. 'set check type on'
  10879. 'set check type off'
  10880. Set strict type checking on or off. If any type mismatches occur
  10881. in evaluating an expression while type checking is on, GDB prints a
  10882. message and aborts evaluation of the expression.
  10883. 'show check type'
  10884. Show the current setting of type checking and whether GDB is
  10885. enforcing strict type checking rules.
  10886. 
  10887. File: gdb.info, Node: Range Checking, Prev: Type Checking, Up: Checks
  10888. 15.3.2 An Overview of Range Checking
  10889. ------------------------------------
  10890. In some languages (such as Modula-2), it is an error to exceed the
  10891. bounds of a type; this is enforced with run-time checks. Such range
  10892. checking is meant to ensure program correctness by making sure
  10893. computations do not overflow, or indices on an array element access do
  10894. not exceed the bounds of the array.
  10895. For expressions you use in GDB commands, you can tell GDB to treat
  10896. range errors in one of three ways: ignore them, always treat them as
  10897. errors and abandon the expression, or issue warnings but evaluate the
  10898. expression anyway.
  10899. A range error can result from numerical overflow, from exceeding an
  10900. array index bound, or when you type a constant that is not a member of
  10901. any type. Some languages, however, do not treat overflows as an error.
  10902. In many implementations of C, mathematical overflow causes the result to
  10903. "wrap around" to lower values--for example, if M is the largest integer
  10904. value, and S is the smallest, then
  10905. M + 1 => S
  10906. This, too, is specific to individual languages, and in some cases
  10907. specific to individual compilers or machines. *Note Supported
  10908. Languages: Supported Languages, for further details on specific
  10909. languages.
  10910. GDB provides some additional commands for controlling the range
  10911. checker:
  10912. 'set check range auto'
  10913. Set range checking on or off based on the current working language.
  10914. *Note Supported Languages: Supported Languages, for the default
  10915. settings for each language.
  10916. 'set check range on'
  10917. 'set check range off'
  10918. Set range checking on or off, overriding the default setting for
  10919. the current working language. A warning is issued if the setting
  10920. does not match the language default. If a range error occurs and
  10921. range checking is on, then a message is printed and evaluation of
  10922. the expression is aborted.
  10923. 'set check range warn'
  10924. Output messages when the GDB range checker detects a range error,
  10925. but attempt to evaluate the expression anyway. Evaluating the
  10926. expression may still be impossible for other reasons, such as
  10927. accessing memory that the process does not own (a typical example
  10928. from many Unix systems).
  10929. 'show range'
  10930. Show the current setting of the range checker, and whether or not
  10931. it is being set automatically by GDB.
  10932. 
  10933. File: gdb.info, Node: Supported Languages, Next: Unsupported Languages, Prev: Checks, Up: Languages
  10934. 15.4 Supported Languages
  10935. ========================
  10936. GDB supports C, C++, D, Go, Objective-C, Fortran, OpenCL C, Pascal,
  10937. Rust, assembly, Modula-2, and Ada. Some GDB features may be used in
  10938. expressions regardless of the language you use: the GDB '@' and '::'
  10939. operators, and the '{type}addr' construct (*note Expressions:
  10940. Expressions.) can be used with the constructs of any supported language.
  10941. The following sections detail to what degree each source language is
  10942. supported by GDB. These sections are not meant to be language tutorials
  10943. or references, but serve only as a reference guide to what the GDB
  10944. expression parser accepts, and what input and output formats should look
  10945. like for different languages. There are many good books written on each
  10946. of these languages; please look to these for a language reference or
  10947. tutorial.
  10948. * Menu:
  10949. * C:: C and C++
  10950. * D:: D
  10951. * Go:: Go
  10952. * Objective-C:: Objective-C
  10953. * OpenCL C:: OpenCL C
  10954. * Fortran:: Fortran
  10955. * Pascal:: Pascal
  10956. * Rust:: Rust
  10957. * Modula-2:: Modula-2
  10958. * Ada:: Ada
  10959. 
  10960. File: gdb.info, Node: C, Next: D, Up: Supported Languages
  10961. 15.4.1 C and C++
  10962. ----------------
  10963. Since C and C++ are so closely related, many features of GDB apply to
  10964. both languages. Whenever this is the case, we discuss those languages
  10965. together.
  10966. The C++ debugging facilities are jointly implemented by the C++
  10967. compiler and GDB. Therefore, to debug your C++ code effectively, you
  10968. must compile your C++ programs with a supported C++ compiler, such as
  10969. GNU 'g++', or the HP ANSI C++ compiler ('aCC').
  10970. * Menu:
  10971. * C Operators:: C and C++ operators
  10972. * C Constants:: C and C++ constants
  10973. * C Plus Plus Expressions:: C++ expressions
  10974. * C Defaults:: Default settings for C and C++
  10975. * C Checks:: C and C++ type and range checks
  10976. * Debugging C:: GDB and C
  10977. * Debugging C Plus Plus:: GDB features for C++
  10978. * Decimal Floating Point:: Numbers in Decimal Floating Point format
  10979. 
  10980. File: gdb.info, Node: C Operators, Next: C Constants, Up: C
  10981. 15.4.1.1 C and C++ Operators
  10982. ............................
  10983. Operators must be defined on values of specific types. For instance,
  10984. '+' is defined on numbers, but not on structures. Operators are often
  10985. defined on groups of types.
  10986. For the purposes of C and C++, the following definitions hold:
  10987. * _Integral types_ include 'int' with any of its storage-class
  10988. specifiers; 'char'; 'enum'; and, for C++, 'bool'.
  10989. * _Floating-point types_ include 'float', 'double', and 'long double'
  10990. (if supported by the target platform).
  10991. * _Pointer types_ include all types defined as '(TYPE *)'.
  10992. * _Scalar types_ include all of the above.
  10993. The following operators are supported. They are listed here in order of
  10994. increasing precedence:
  10995. ','
  10996. The comma or sequencing operator. Expressions in a comma-separated
  10997. list are evaluated from left to right, with the result of the
  10998. entire expression being the last expression evaluated.
  10999. '='
  11000. Assignment. The value of an assignment expression is the value
  11001. assigned. Defined on scalar types.
  11002. 'OP='
  11003. Used in an expression of the form 'A OP= B', and translated to
  11004. 'A = A OP B'. 'OP=' and '=' have the same precedence. The
  11005. operator OP is any one of the operators '|', '^', '&', '<<', '>>',
  11006. '+', '-', '*', '/', '%'.
  11007. '?:'
  11008. The ternary operator. 'A ? B : C' can be thought of as: if A then
  11009. B else C. The argument A should be of an integral type.
  11010. '||'
  11011. Logical OR. Defined on integral types.
  11012. '&&'
  11013. Logical AND. Defined on integral types.
  11014. '|'
  11015. Bitwise OR. Defined on integral types.
  11016. '^'
  11017. Bitwise exclusive-OR. Defined on integral types.
  11018. '&'
  11019. Bitwise AND. Defined on integral types.
  11020. '==, !='
  11021. Equality and inequality. Defined on scalar types. The value of
  11022. these expressions is 0 for false and non-zero for true.
  11023. '<, >, <=, >='
  11024. Less than, greater than, less than or equal, greater than or equal.
  11025. Defined on scalar types. The value of these expressions is 0 for
  11026. false and non-zero for true.
  11027. '<<, >>'
  11028. left shift, and right shift. Defined on integral types.
  11029. '@'
  11030. The GDB "artificial array" operator (*note Expressions:
  11031. Expressions.).
  11032. '+, -'
  11033. Addition and subtraction. Defined on integral types,
  11034. floating-point types and pointer types.
  11035. '*, /, %'
  11036. Multiplication, division, and modulus. Multiplication and division
  11037. are defined on integral and floating-point types. Modulus is
  11038. defined on integral types.
  11039. '++, --'
  11040. Increment and decrement. When appearing before a variable, the
  11041. operation is performed before the variable is used in an
  11042. expression; when appearing after it, the variable's value is used
  11043. before the operation takes place.
  11044. '*'
  11045. Pointer dereferencing. Defined on pointer types. Same precedence
  11046. as '++'.
  11047. '&'
  11048. Address operator. Defined on variables. Same precedence as '++'.
  11049. For debugging C++, GDB implements a use of '&' beyond what is
  11050. allowed in the C++ language itself: you can use '&(&REF)' to
  11051. examine the address where a C++ reference variable (declared with
  11052. '&REF') is stored.
  11053. '-'
  11054. Negative. Defined on integral and floating-point types. Same
  11055. precedence as '++'.
  11056. '!'
  11057. Logical negation. Defined on integral types. Same precedence as
  11058. '++'.
  11059. '~'
  11060. Bitwise complement operator. Defined on integral types. Same
  11061. precedence as '++'.
  11062. '., ->'
  11063. Structure member, and pointer-to-structure member. For
  11064. convenience, GDB regards the two as equivalent, choosing whether to
  11065. dereference a pointer based on the stored type information.
  11066. Defined on 'struct' and 'union' data.
  11067. '.*, ->*'
  11068. Dereferences of pointers to members.
  11069. '[]'
  11070. Array indexing. 'A[I]' is defined as '*(A+I)'. Same precedence as
  11071. '->'.
  11072. '()'
  11073. Function parameter list. Same precedence as '->'.
  11074. '::'
  11075. C++ scope resolution operator. Defined on 'struct', 'union', and
  11076. 'class' types.
  11077. '::'
  11078. Doubled colons also represent the GDB scope operator (*note
  11079. Expressions: Expressions.). Same precedence as '::', above.
  11080. If an operator is redefined in the user code, GDB usually attempts to
  11081. invoke the redefined version instead of using the operator's predefined
  11082. meaning.
  11083. 
  11084. File: gdb.info, Node: C Constants, Next: C Plus Plus Expressions, Prev: C Operators, Up: C
  11085. 15.4.1.2 C and C++ Constants
  11086. ............................
  11087. GDB allows you to express the constants of C and C++ in the following
  11088. ways:
  11089. * Integer constants are a sequence of digits. Octal constants are
  11090. specified by a leading '0' (i.e. zero), and hexadecimal constants
  11091. by a leading '0x' or '0X'. Constants may also end with a letter
  11092. 'l', specifying that the constant should be treated as a 'long'
  11093. value.
  11094. * Floating point constants are a sequence of digits, followed by a
  11095. decimal point, followed by a sequence of digits, and optionally
  11096. followed by an exponent. An exponent is of the form:
  11097. 'e[[+]|-]NNN', where NNN is another sequence of digits. The '+' is
  11098. optional for positive exponents. A floating-point constant may
  11099. also end with a letter 'f' or 'F', specifying that the constant
  11100. should be treated as being of the 'float' (as opposed to the
  11101. default 'double') type; or with a letter 'l' or 'L', which
  11102. specifies a 'long double' constant.
  11103. * Enumerated constants consist of enumerated identifiers, or their
  11104. integral equivalents.
  11105. * Character constants are a single character surrounded by single
  11106. quotes ('''), or a number--the ordinal value of the corresponding
  11107. character (usually its ASCII value). Within quotes, the single
  11108. character may be represented by a letter or by "escape sequences",
  11109. which are of the form '\NNN', where NNN is the octal representation
  11110. of the character's ordinal value; or of the form '\X', where 'X' is
  11111. a predefined special character--for example, '\n' for newline.
  11112. Wide character constants can be written by prefixing a character
  11113. constant with 'L', as in C. For example, 'L'x'' is the wide form of
  11114. 'x'. The target wide character set is used when computing the
  11115. value of this constant (*note Character Sets::).
  11116. * String constants are a sequence of character constants surrounded
  11117. by double quotes ('"'). Any valid character constant (as described
  11118. above) may appear. Double quotes within the string must be
  11119. preceded by a backslash, so for instance '"a\"b'c"' is a string of
  11120. five characters.
  11121. Wide string constants can be written by prefixing a string constant
  11122. with 'L', as in C. The target wide character set is used when
  11123. computing the value of this constant (*note Character Sets::).
  11124. * Pointer constants are an integral value. You can also write
  11125. pointers to constants using the C operator '&'.
  11126. * Array constants are comma-separated lists surrounded by braces '{'
  11127. and '}'; for example, '{1,2,3}' is a three-element array of
  11128. integers, '{{1,2}, {3,4}, {5,6}}' is a three-by-two array, and
  11129. '{&"hi", &"there", &"fred"}' is a three-element array of pointers.
  11130. 
  11131. File: gdb.info, Node: C Plus Plus Expressions, Next: C Defaults, Prev: C Constants, Up: C
  11132. 15.4.1.3 C++ Expressions
  11133. ........................
  11134. GDB expression handling can interpret most C++ expressions.
  11135. _Warning:_ GDB can only debug C++ code if you use the proper
  11136. compiler and the proper debug format. Currently, GDB works best
  11137. when debugging C++ code that is compiled with the most recent
  11138. version of GCC possible. The DWARF debugging format is preferred;
  11139. GCC defaults to this on most popular platforms. Other compilers
  11140. and/or debug formats are likely to work badly or not at all when
  11141. using GDB to debug C++ code. *Note Compilation::.
  11142. 1. Member function calls are allowed; you can use expressions like
  11143. count = aml->GetOriginal(x, y)
  11144. 2. While a member function is active (in the selected stack frame),
  11145. your expressions have the same namespace available as the member
  11146. function; that is, GDB allows implicit references to the class
  11147. instance pointer 'this' following the same rules as C++. 'using'
  11148. declarations in the current scope are also respected by GDB.
  11149. 3. You can call overloaded functions; GDB resolves the function call
  11150. to the right definition, with some restrictions. GDB does not
  11151. perform overload resolution involving user-defined type
  11152. conversions, calls to constructors, or instantiations of templates
  11153. that do not exist in the program. It also cannot handle ellipsis
  11154. argument lists or default arguments.
  11155. It does perform integral conversions and promotions, floating-point
  11156. promotions, arithmetic conversions, pointer conversions,
  11157. conversions of class objects to base classes, and standard
  11158. conversions such as those of functions or arrays to pointers; it
  11159. requires an exact match on the number of function arguments.
  11160. Overload resolution is always performed, unless you have specified
  11161. 'set overload-resolution off'. *Note GDB Features for C++:
  11162. Debugging C Plus Plus.
  11163. You must specify 'set overload-resolution off' in order to use an
  11164. explicit function signature to call an overloaded function, as in
  11165. p 'foo(char,int)'('x', 13)
  11166. The GDB command-completion facility can simplify this; see *note
  11167. Command Completion: Completion.
  11168. 4. GDB understands variables declared as C++ lvalue or rvalue
  11169. references; you can use them in expressions just as you do in C++
  11170. source--they are automatically dereferenced.
  11171. In the parameter list shown when GDB displays a frame, the values
  11172. of reference variables are not displayed (unlike other variables);
  11173. this avoids clutter, since references are often used for large
  11174. structures. The _address_ of a reference variable is always shown,
  11175. unless you have specified 'set print address off'.
  11176. 5. GDB supports the C++ name resolution operator '::'--your
  11177. expressions can use it just as expressions in your program do.
  11178. Since one scope may be defined in another, you can use '::'
  11179. repeatedly if necessary, for example in an expression like
  11180. 'SCOPE1::SCOPE2::NAME'. GDB also allows resolving name scope by
  11181. reference to source files, in both C and C++ debugging (*note
  11182. Program Variables: Variables.).
  11183. 6. GDB performs argument-dependent lookup, following the C++
  11184. specification.
  11185. 
  11186. File: gdb.info, Node: C Defaults, Next: C Checks, Prev: C Plus Plus Expressions, Up: C
  11187. 15.4.1.4 C and C++ Defaults
  11188. ...........................
  11189. If you allow GDB to set range checking automatically, it defaults to
  11190. 'off' whenever the working language changes to C or C++. This happens
  11191. regardless of whether you or GDB selects the working language.
  11192. If you allow GDB to set the language automatically, it recognizes
  11193. source files whose names end with '.c', '.C', or '.cc', etc, and when
  11194. GDB enters code compiled from one of these files, it sets the working
  11195. language to C or C++. *Note Having GDB Infer the Source Language:
  11196. Automatically, for further details.
  11197. 
  11198. File: gdb.info, Node: C Checks, Next: Debugging C, Prev: C Defaults, Up: C
  11199. 15.4.1.5 C and C++ Type and Range Checks
  11200. ........................................
  11201. By default, when GDB parses C or C++ expressions, strict type checking
  11202. is used. However, if you turn type checking off, GDB will allow certain
  11203. non-standard conversions, such as promoting integer constants to
  11204. pointers.
  11205. Range checking, if turned on, is done on mathematical operations.
  11206. Array indices are not checked, since they are often used to index a
  11207. pointer that is not itself an array.
  11208. 
  11209. File: gdb.info, Node: Debugging C, Next: Debugging C Plus Plus, Prev: C Checks, Up: C
  11210. 15.4.1.6 GDB and C
  11211. ..................
  11212. The 'set print union' and 'show print union' commands apply to the
  11213. 'union' type. When set to 'on', any 'union' that is inside a 'struct'
  11214. or 'class' is also printed. Otherwise, it appears as '{...}'.
  11215. The '@' operator aids in the debugging of dynamic arrays, formed with
  11216. pointers and a memory allocation function. *Note Expressions:
  11217. Expressions.
  11218. 
  11219. File: gdb.info, Node: Debugging C Plus Plus, Next: Decimal Floating Point, Prev: Debugging C, Up: C
  11220. 15.4.1.7 GDB Features for C++
  11221. .............................
  11222. Some GDB commands are particularly useful with C++, and some are
  11223. designed specifically for use with C++. Here is a summary:
  11224. 'breakpoint menus'
  11225. When you want a breakpoint in a function whose name is overloaded,
  11226. GDB has the capability to display a menu of possible breakpoint
  11227. locations to help you specify which function definition you want.
  11228. *Note Ambiguous Expressions: Ambiguous Expressions.
  11229. 'rbreak REGEX'
  11230. Setting breakpoints using regular expressions is helpful for
  11231. setting breakpoints on overloaded functions that are not members of
  11232. any special classes. *Note Setting Breakpoints: Set Breaks.
  11233. 'catch throw'
  11234. 'catch rethrow'
  11235. 'catch catch'
  11236. Debug C++ exception handling using these commands. *Note Setting
  11237. Catchpoints: Set Catchpoints.
  11238. 'ptype TYPENAME'
  11239. Print inheritance relationships as well as other information for
  11240. type TYPENAME. *Note Examining the Symbol Table: Symbols.
  11241. 'info vtbl EXPRESSION.'
  11242. The 'info vtbl' command can be used to display the virtual method
  11243. tables of the object computed by EXPRESSION. This shows one entry
  11244. per virtual table; there may be multiple virtual tables when
  11245. multiple inheritance is in use.
  11246. 'demangle NAME'
  11247. Demangle NAME. *Note Symbols::, for a more complete description of
  11248. the 'demangle' command.
  11249. 'set print demangle'
  11250. 'show print demangle'
  11251. 'set print asm-demangle'
  11252. 'show print asm-demangle'
  11253. Control whether C++ symbols display in their source form, both when
  11254. displaying code as C++ source and when displaying disassemblies.
  11255. *Note Print Settings: Print Settings.
  11256. 'set print object'
  11257. 'show print object'
  11258. Choose whether to print derived (actual) or declared types of
  11259. objects. *Note Print Settings: Print Settings.
  11260. 'set print vtbl'
  11261. 'show print vtbl'
  11262. Control the format for printing virtual function tables. *Note
  11263. Print Settings: Print Settings. (The 'vtbl' commands do not work
  11264. on programs compiled with the HP ANSI C++ compiler ('aCC').)
  11265. 'set overload-resolution on'
  11266. Enable overload resolution for C++ expression evaluation. The
  11267. default is on. For overloaded functions, GDB evaluates the
  11268. arguments and searches for a function whose signature matches the
  11269. argument types, using the standard C++ conversion rules (see *note
  11270. C++ Expressions: C Plus Plus Expressions, for details). If it
  11271. cannot find a match, it emits a message.
  11272. 'set overload-resolution off'
  11273. Disable overload resolution for C++ expression evaluation. For
  11274. overloaded functions that are not class member functions, GDB
  11275. chooses the first function of the specified name that it finds in
  11276. the symbol table, whether or not its arguments are of the correct
  11277. type. For overloaded functions that are class member functions,
  11278. GDB searches for a function whose signature _exactly_ matches the
  11279. argument types.
  11280. 'show overload-resolution'
  11281. Show the current setting of overload resolution.
  11282. 'Overloaded symbol names'
  11283. You can specify a particular definition of an overloaded symbol,
  11284. using the same notation that is used to declare such symbols in
  11285. C++: type 'SYMBOL(TYPES)' rather than just SYMBOL. You can also
  11286. use the GDB command-line word completion facilities to list the
  11287. available choices, or to finish the type list for you. *Note
  11288. Command Completion: Completion, for details on how to do this.
  11289. 'Breakpoints in functions with ABI tags'
  11290. The GNU C++ compiler introduced the notion of ABI "tags", which
  11291. correspond to changes in the ABI of a type, function, or variable
  11292. that would not otherwise be reflected in a mangled name. See
  11293. <https://developers.redhat.com/blog/2015/02/05/gcc5-and-the-c11-abi/>
  11294. for more detail.
  11295. The ABI tags are visible in C++ demangled names. For example, a
  11296. function that returns a std::string:
  11297. std::string function(int);
  11298. when compiled for the C++11 ABI is marked with the 'cxx11' ABI tag,
  11299. and GDB displays the symbol like this:
  11300. function[abi:cxx11](int)
  11301. You can set a breakpoint on such functions simply as if they had no
  11302. tag. For example:
  11303. (gdb) b function(int)
  11304. Breakpoint 2 at 0x40060d: file main.cc, line 10.
  11305. (gdb) info breakpoints
  11306. Num Type Disp Enb Address What
  11307. 1 breakpoint keep y 0x0040060d in function[abi:cxx11](int)
  11308. at main.cc:10
  11309. On the rare occasion you need to disambiguate between different ABI
  11310. tags, you can do so by simply including the ABI tag in the function
  11311. name, like:
  11312. (gdb) b ambiguous[abi:other_tag](int)
  11313. 
  11314. File: gdb.info, Node: Decimal Floating Point, Prev: Debugging C Plus Plus, Up: C
  11315. 15.4.1.8 Decimal Floating Point format
  11316. ......................................
  11317. GDB can examine, set and perform computations with numbers in decimal
  11318. floating point format, which in the C language correspond to the
  11319. '_Decimal32', '_Decimal64' and '_Decimal128' types as specified by the
  11320. extension to support decimal floating-point arithmetic.
  11321. There are two encodings in use, depending on the architecture: BID
  11322. (Binary Integer Decimal) for x86 and x86-64, and DPD (Densely Packed
  11323. Decimal) for PowerPC and S/390. GDB will use the appropriate encoding
  11324. for the configured target.
  11325. Because of a limitation in 'libdecnumber', the library used by GDB to
  11326. manipulate decimal floating point numbers, it is not possible to convert
  11327. (using a cast, for example) integers wider than 32-bit to decimal float.
  11328. In addition, in order to imitate GDB's behaviour with binary floating
  11329. point computations, error checking in decimal float operations ignores
  11330. underflow, overflow and divide by zero exceptions.
  11331. In the PowerPC architecture, GDB provides a set of pseudo-registers
  11332. to inspect '_Decimal128' values stored in floating point registers. See
  11333. *note PowerPC: PowerPC. for more details.
  11334. 
  11335. File: gdb.info, Node: D, Next: Go, Prev: C, Up: Supported Languages
  11336. 15.4.2 D
  11337. --------
  11338. GDB can be used to debug programs written in D and compiled with GDC,
  11339. LDC or DMD compilers. Currently GDB supports only one D specific
  11340. feature -- dynamic arrays.
  11341. 
  11342. File: gdb.info, Node: Go, Next: Objective-C, Prev: D, Up: Supported Languages
  11343. 15.4.3 Go
  11344. ---------
  11345. GDB can be used to debug programs written in Go and compiled with
  11346. 'gccgo' or '6g' compilers.
  11347. Here is a summary of the Go-specific features and restrictions:
  11348. 'The current Go package'
  11349. The name of the current package does not need to be specified when
  11350. specifying global variables and functions.
  11351. For example, given the program:
  11352. package main
  11353. var myglob = "Shall we?"
  11354. func main () {
  11355. // ...
  11356. }
  11357. When stopped inside 'main' either of these work:
  11358. (gdb) p myglob
  11359. (gdb) p main.myglob
  11360. 'Builtin Go types'
  11361. The 'string' type is recognized by GDB and is printed as a string.
  11362. 'Builtin Go functions'
  11363. The GDB expression parser recognizes the 'unsafe.Sizeof' function
  11364. and handles it internally.
  11365. 'Restrictions on Go expressions'
  11366. All Go operators are supported except '&^'. The Go '_' "blank
  11367. identifier" is not supported. Automatic dereferencing of pointers
  11368. is not supported.
  11369. 
  11370. File: gdb.info, Node: Objective-C, Next: OpenCL C, Prev: Go, Up: Supported Languages
  11371. 15.4.4 Objective-C
  11372. ------------------
  11373. This section provides information about some commands and command
  11374. options that are useful for debugging Objective-C code. See also *note
  11375. info classes: Symbols, and *note info selectors: Symbols, for a few more
  11376. commands specific to Objective-C support.
  11377. * Menu:
  11378. * Method Names in Commands::
  11379. * The Print Command with Objective-C::
  11380. 
  11381. File: gdb.info, Node: Method Names in Commands, Next: The Print Command with Objective-C, Up: Objective-C
  11382. 15.4.4.1 Method Names in Commands
  11383. .................................
  11384. The following commands have been extended to accept Objective-C method
  11385. names as line specifications:
  11386. * 'clear'
  11387. * 'break'
  11388. * 'info line'
  11389. * 'jump'
  11390. * 'list'
  11391. A fully qualified Objective-C method name is specified as
  11392. -[CLASS METHODNAME]
  11393. where the minus sign is used to indicate an instance method and a
  11394. plus sign (not shown) is used to indicate a class method. The class
  11395. name CLASS and method name METHODNAME are enclosed in brackets, similar
  11396. to the way messages are specified in Objective-C source code. For
  11397. example, to set a breakpoint at the 'create' instance method of class
  11398. 'Fruit' in the program currently being debugged, enter:
  11399. break -[Fruit create]
  11400. To list ten program lines around the 'initialize' class method,
  11401. enter:
  11402. list +[NSText initialize]
  11403. In the current version of GDB, the plus or minus sign is required.
  11404. In future versions of GDB, the plus or minus sign will be optional, but
  11405. you can use it to narrow the search. It is also possible to specify
  11406. just a method name:
  11407. break create
  11408. You must specify the complete method name, including any colons. If
  11409. your program's source files contain more than one 'create' method,
  11410. you'll be presented with a numbered list of classes that implement that
  11411. method. Indicate your choice by number, or type '0' to exit if none
  11412. apply.
  11413. As another example, to clear a breakpoint established at the
  11414. 'makeKeyAndOrderFront:' method of the 'NSWindow' class, enter:
  11415. clear -[NSWindow makeKeyAndOrderFront:]
  11416. 
  11417. File: gdb.info, Node: The Print Command with Objective-C, Prev: Method Names in Commands, Up: Objective-C
  11418. 15.4.4.2 The Print Command With Objective-C
  11419. ...........................................
  11420. The print command has also been extended to accept methods. For
  11421. example:
  11422. print -[OBJECT hash]
  11423. will tell GDB to send the 'hash' message to OBJECT and print the result.
  11424. Also, an additional command has been added, 'print-object' or 'po' for
  11425. short, which is meant to print the description of an object. However,
  11426. this command may only work with certain Objective-C libraries that have
  11427. a particular hook function, '_NSPrintForDebugger', defined.
  11428. 
  11429. File: gdb.info, Node: OpenCL C, Next: Fortran, Prev: Objective-C, Up: Supported Languages
  11430. 15.4.5 OpenCL C
  11431. ---------------
  11432. This section provides information about GDBs OpenCL C support.
  11433. * Menu:
  11434. * OpenCL C Datatypes::
  11435. * OpenCL C Expressions::
  11436. * OpenCL C Operators::
  11437. 
  11438. File: gdb.info, Node: OpenCL C Datatypes, Next: OpenCL C Expressions, Up: OpenCL C
  11439. 15.4.5.1 OpenCL C Datatypes
  11440. ...........................
  11441. GDB supports the builtin scalar and vector datatypes specified by OpenCL
  11442. 1.1. In addition the half- and double-precision floating point data
  11443. types of the 'cl_khr_fp16' and 'cl_khr_fp64' OpenCL extensions are also
  11444. known to GDB.
  11445. 
  11446. File: gdb.info, Node: OpenCL C Expressions, Next: OpenCL C Operators, Prev: OpenCL C Datatypes, Up: OpenCL C
  11447. 15.4.5.2 OpenCL C Expressions
  11448. .............................
  11449. GDB supports accesses to vector components including the access as
  11450. lvalue where possible. Since OpenCL C is based on C99 most C
  11451. expressions supported by GDB can be used as well.
  11452. 
  11453. File: gdb.info, Node: OpenCL C Operators, Prev: OpenCL C Expressions, Up: OpenCL C
  11454. 15.4.5.3 OpenCL C Operators
  11455. ...........................
  11456. GDB supports the operators specified by OpenCL 1.1 for scalar and vector
  11457. data types.
  11458. 
  11459. File: gdb.info, Node: Fortran, Next: Pascal, Prev: OpenCL C, Up: Supported Languages
  11460. 15.4.6 Fortran
  11461. --------------
  11462. GDB can be used to debug programs written in Fortran, but it currently
  11463. supports only the features of Fortran 77 language.
  11464. Some Fortran compilers (GNU Fortran 77 and Fortran 95 compilers among
  11465. them) append an underscore to the names of variables and functions.
  11466. When you debug programs compiled by those compilers, you will need to
  11467. refer to variables and functions with a trailing underscore.
  11468. * Menu:
  11469. * Fortran Operators:: Fortran operators and expressions
  11470. * Fortran Defaults:: Default settings for Fortran
  11471. * Special Fortran Commands:: Special GDB commands for Fortran
  11472. 
  11473. File: gdb.info, Node: Fortran Operators, Next: Fortran Defaults, Up: Fortran
  11474. 15.4.6.1 Fortran Operators and Expressions
  11475. ..........................................
  11476. Operators must be defined on values of specific types. For instance,
  11477. '+' is defined on numbers, but not on characters or other non-
  11478. arithmetic types. Operators are often defined on groups of types.
  11479. '**'
  11480. The exponentiation operator. It raises the first operand to the
  11481. power of the second one.
  11482. ':'
  11483. The range operator. Normally used in the form of array(low:high)
  11484. to represent a section of array.
  11485. '%'
  11486. The access component operator. Normally used to access elements in
  11487. derived types. Also suitable for unions. As unions aren't part of
  11488. regular Fortran, this can only happen when accessing a register
  11489. that uses a gdbarch-defined union type.
  11490. '::'
  11491. The scope operator. Normally used to access variables in modules
  11492. or to set breakpoints on subroutines nested in modules or in other
  11493. subroutines (internal subroutines).
  11494. 
  11495. File: gdb.info, Node: Fortran Defaults, Next: Special Fortran Commands, Prev: Fortran Operators, Up: Fortran
  11496. 15.4.6.2 Fortran Defaults
  11497. .........................
  11498. Fortran symbols are usually case-insensitive, so GDB by default uses
  11499. case-insensitive matches for Fortran symbols. You can change that with
  11500. the 'set case-insensitive' command, see *note Symbols::, for the
  11501. details.
  11502. 
  11503. File: gdb.info, Node: Special Fortran Commands, Prev: Fortran Defaults, Up: Fortran
  11504. 15.4.6.3 Special Fortran Commands
  11505. .................................
  11506. GDB has some commands to support Fortran-specific features, such as
  11507. displaying common blocks.
  11508. 'info common [COMMON-NAME]'
  11509. This command prints the values contained in the Fortran 'COMMON'
  11510. block whose name is COMMON-NAME. With no argument, the names of
  11511. all 'COMMON' blocks visible at the current program location are
  11512. printed.
  11513. 
  11514. File: gdb.info, Node: Pascal, Next: Rust, Prev: Fortran, Up: Supported Languages
  11515. 15.4.7 Pascal
  11516. -------------
  11517. Debugging Pascal programs which use sets, subranges, file variables, or
  11518. nested functions does not currently work. GDB does not support entering
  11519. expressions, printing values, or similar features using Pascal syntax.
  11520. The Pascal-specific command 'set print pascal_static-members'
  11521. controls whether static members of Pascal objects are displayed. *Note
  11522. pascal_static-members: Print Settings.
  11523. 
  11524. File: gdb.info, Node: Rust, Next: Modula-2, Prev: Pascal, Up: Supported Languages
  11525. 15.4.8 Rust
  11526. -----------
  11527. GDB supports the Rust Programming Language (https://www.rust-lang.org/).
  11528. Type- and value-printing, and expression parsing, are reasonably
  11529. complete. However, there are a few peculiarities and holes to be aware
  11530. of.
  11531. * Linespecs (*note Specify Location::) are never relative to the
  11532. current crate. Instead, they act as if there were a global
  11533. namespace of crates, somewhat similar to the way 'extern crate'
  11534. behaves.
  11535. That is, if GDB is stopped at a breakpoint in a function in crate
  11536. 'A', module 'B', then 'break B::f' will attempt to set a breakpoint
  11537. in a function named 'f' in a crate named 'B'.
  11538. As a consequence of this approach, linespecs also cannot refer to
  11539. items using 'self::' or 'super::'.
  11540. * Because GDB implements Rust name-lookup semantics in expressions,
  11541. it will sometimes prepend the current crate to a name. For
  11542. example, if GDB is stopped at a breakpoint in the crate 'K', then
  11543. 'print ::x::y' will try to find the symbol 'K::x::y'.
  11544. However, since it is useful to be able to refer to other crates
  11545. when debugging, GDB provides the 'extern' extension to circumvent
  11546. this. To use the extension, just put 'extern' before a path
  11547. expression to refer to the otherwise unavailable "global" scope.
  11548. In the above example, if you wanted to refer to the symbol 'y' in
  11549. the crate 'x', you would use 'print extern x::y'.
  11550. * The Rust expression evaluator does not support "statement-like"
  11551. expressions such as 'if' or 'match', or lambda expressions.
  11552. * Tuple expressions are not implemented.
  11553. * The Rust expression evaluator does not currently implement the
  11554. 'Drop' trait. Objects that may be created by the evaluator will
  11555. never be destroyed.
  11556. * GDB does not implement type inference for generics. In order to
  11557. call generic functions or otherwise refer to generic items, you
  11558. will have to specify the type parameters manually.
  11559. * GDB currently uses the C++ demangler for Rust. In most cases this
  11560. does not cause any problems. However, in an expression context,
  11561. completing a generic function name will give syntactically invalid
  11562. results. This happens because Rust requires the '::' operator
  11563. between the function name and its generic arguments. For example,
  11564. GDB might provide a completion like 'crate::f<u32>', where the
  11565. parser would require 'crate::f::<u32>'.
  11566. * As of this writing, the Rust compiler (version 1.8) has a few holes
  11567. in the debugging information it generates. These holes prevent
  11568. certain features from being implemented by GDB:
  11569. * Method calls cannot be made via traits.
  11570. * Operator overloading is not implemented.
  11571. * When debugging in a monomorphized function, you cannot use the
  11572. generic type names.
  11573. * The type 'Self' is not available.
  11574. * 'use' statements are not available, so some names may not be
  11575. available in the crate.
  11576. 
  11577. File: gdb.info, Node: Modula-2, Next: Ada, Prev: Rust, Up: Supported Languages
  11578. 15.4.9 Modula-2
  11579. ---------------
  11580. The extensions made to GDB to support Modula-2 only support output from
  11581. the GNU Modula-2 compiler (which is currently being developed). Other
  11582. Modula-2 compilers are not currently supported, and attempting to debug
  11583. executables produced by them is most likely to give an error as GDB
  11584. reads in the executable's symbol table.
  11585. * Menu:
  11586. * M2 Operators:: Built-in operators
  11587. * Built-In Func/Proc:: Built-in functions and procedures
  11588. * M2 Constants:: Modula-2 constants
  11589. * M2 Types:: Modula-2 types
  11590. * M2 Defaults:: Default settings for Modula-2
  11591. * Deviations:: Deviations from standard Modula-2
  11592. * M2 Checks:: Modula-2 type and range checks
  11593. * M2 Scope:: The scope operators '::' and '.'
  11594. * GDB/M2:: GDB and Modula-2
  11595. 
  11596. File: gdb.info, Node: M2 Operators, Next: Built-In Func/Proc, Up: Modula-2
  11597. 15.4.9.1 Operators
  11598. ..................
  11599. Operators must be defined on values of specific types. For instance,
  11600. '+' is defined on numbers, but not on structures. Operators are often
  11601. defined on groups of types. For the purposes of Modula-2, the following
  11602. definitions hold:
  11603. * _Integral types_ consist of 'INTEGER', 'CARDINAL', and their
  11604. subranges.
  11605. * _Character types_ consist of 'CHAR' and its subranges.
  11606. * _Floating-point types_ consist of 'REAL'.
  11607. * _Pointer types_ consist of anything declared as 'POINTER TO TYPE'.
  11608. * _Scalar types_ consist of all of the above.
  11609. * _Set types_ consist of 'SET' and 'BITSET' types.
  11610. * _Boolean types_ consist of 'BOOLEAN'.
  11611. The following operators are supported, and appear in order of increasing
  11612. precedence:
  11613. ','
  11614. Function argument or array index separator.
  11615. ':='
  11616. Assignment. The value of VAR ':=' VALUE is VALUE.
  11617. '<, >'
  11618. Less than, greater than on integral, floating-point, or enumerated
  11619. types.
  11620. '<=, >='
  11621. Less than or equal to, greater than or equal to on integral,
  11622. floating-point and enumerated types, or set inclusion on set types.
  11623. Same precedence as '<'.
  11624. '=, <>, #'
  11625. Equality and two ways of expressing inequality, valid on scalar
  11626. types. Same precedence as '<'. In GDB scripts, only '<>' is
  11627. available for inequality, since '#' conflicts with the script
  11628. comment character.
  11629. 'IN'
  11630. Set membership. Defined on set types and the types of their
  11631. members. Same precedence as '<'.
  11632. 'OR'
  11633. Boolean disjunction. Defined on boolean types.
  11634. 'AND, &'
  11635. Boolean conjunction. Defined on boolean types.
  11636. '@'
  11637. The GDB "artificial array" operator (*note Expressions:
  11638. Expressions.).
  11639. '+, -'
  11640. Addition and subtraction on integral and floating-point types, or
  11641. union and difference on set types.
  11642. '*'
  11643. Multiplication on integral and floating-point types, or set
  11644. intersection on set types.
  11645. '/'
  11646. Division on floating-point types, or symmetric set difference on
  11647. set types. Same precedence as '*'.
  11648. 'DIV, MOD'
  11649. Integer division and remainder. Defined on integral types. Same
  11650. precedence as '*'.
  11651. '-'
  11652. Negative. Defined on 'INTEGER' and 'REAL' data.
  11653. '^'
  11654. Pointer dereferencing. Defined on pointer types.
  11655. 'NOT'
  11656. Boolean negation. Defined on boolean types. Same precedence as
  11657. '^'.
  11658. '.'
  11659. 'RECORD' field selector. Defined on 'RECORD' data. Same
  11660. precedence as '^'.
  11661. '[]'
  11662. Array indexing. Defined on 'ARRAY' data. Same precedence as '^'.
  11663. '()'
  11664. Procedure argument list. Defined on 'PROCEDURE' objects. Same
  11665. precedence as '^'.
  11666. '::, .'
  11667. GDB and Modula-2 scope operators.
  11668. _Warning:_ Set expressions and their operations are not yet
  11669. supported, so GDB treats the use of the operator 'IN', or the use
  11670. of operators '+', '-', '*', '/', '=', , '<>', '#', '<=', and '>='
  11671. on sets as an error.
  11672. 
  11673. File: gdb.info, Node: Built-In Func/Proc, Next: M2 Constants, Prev: M2 Operators, Up: Modula-2
  11674. 15.4.9.2 Built-in Functions and Procedures
  11675. ..........................................
  11676. Modula-2 also makes available several built-in procedures and functions.
  11677. In describing these, the following metavariables are used:
  11678. A
  11679. represents an 'ARRAY' variable.
  11680. C
  11681. represents a 'CHAR' constant or variable.
  11682. I
  11683. represents a variable or constant of integral type.
  11684. M
  11685. represents an identifier that belongs to a set. Generally used in
  11686. the same function with the metavariable S. The type of S should be
  11687. 'SET OF MTYPE' (where MTYPE is the type of M).
  11688. N
  11689. represents a variable or constant of integral or floating-point
  11690. type.
  11691. R
  11692. represents a variable or constant of floating-point type.
  11693. T
  11694. represents a type.
  11695. V
  11696. represents a variable.
  11697. X
  11698. represents a variable or constant of one of many types. See the
  11699. explanation of the function for details.
  11700. All Modula-2 built-in procedures also return a result, described
  11701. below.
  11702. 'ABS(N)'
  11703. Returns the absolute value of N.
  11704. 'CAP(C)'
  11705. If C is a lower case letter, it returns its upper case equivalent,
  11706. otherwise it returns its argument.
  11707. 'CHR(I)'
  11708. Returns the character whose ordinal value is I.
  11709. 'DEC(V)'
  11710. Decrements the value in the variable V by one. Returns the new
  11711. value.
  11712. 'DEC(V,I)'
  11713. Decrements the value in the variable V by I. Returns the new
  11714. value.
  11715. 'EXCL(M,S)'
  11716. Removes the element M from the set S. Returns the new set.
  11717. 'FLOAT(I)'
  11718. Returns the floating point equivalent of the integer I.
  11719. 'HIGH(A)'
  11720. Returns the index of the last member of A.
  11721. 'INC(V)'
  11722. Increments the value in the variable V by one. Returns the new
  11723. value.
  11724. 'INC(V,I)'
  11725. Increments the value in the variable V by I. Returns the new
  11726. value.
  11727. 'INCL(M,S)'
  11728. Adds the element M to the set S if it is not already there.
  11729. Returns the new set.
  11730. 'MAX(T)'
  11731. Returns the maximum value of the type T.
  11732. 'MIN(T)'
  11733. Returns the minimum value of the type T.
  11734. 'ODD(I)'
  11735. Returns boolean TRUE if I is an odd number.
  11736. 'ORD(X)'
  11737. Returns the ordinal value of its argument. For example, the
  11738. ordinal value of a character is its ASCII value (on machines
  11739. supporting the ASCII character set). The argument X must be of an
  11740. ordered type, which include integral, character and enumerated
  11741. types.
  11742. 'SIZE(X)'
  11743. Returns the size of its argument. The argument X can be a variable
  11744. or a type.
  11745. 'TRUNC(R)'
  11746. Returns the integral part of R.
  11747. 'TSIZE(X)'
  11748. Returns the size of its argument. The argument X can be a variable
  11749. or a type.
  11750. 'VAL(T,I)'
  11751. Returns the member of the type T whose ordinal value is I.
  11752. _Warning:_ Sets and their operations are not yet supported, so GDB
  11753. treats the use of procedures 'INCL' and 'EXCL' as an error.
  11754. 
  11755. File: gdb.info, Node: M2 Constants, Next: M2 Types, Prev: Built-In Func/Proc, Up: Modula-2
  11756. 15.4.9.3 Constants
  11757. ..................
  11758. GDB allows you to express the constants of Modula-2 in the following
  11759. ways:
  11760. * Integer constants are simply a sequence of digits. When used in an
  11761. expression, a constant is interpreted to be type-compatible with
  11762. the rest of the expression. Hexadecimal integers are specified by
  11763. a trailing 'H', and octal integers by a trailing 'B'.
  11764. * Floating point constants appear as a sequence of digits, followed
  11765. by a decimal point and another sequence of digits. An optional
  11766. exponent can then be specified, in the form 'E[+|-]NNN', where
  11767. '[+|-]NNN' is the desired exponent. All of the digits of the
  11768. floating point constant must be valid decimal (base 10) digits.
  11769. * Character constants consist of a single character enclosed by a
  11770. pair of like quotes, either single (''') or double ('"'). They may
  11771. also be expressed by their ordinal value (their ASCII value,
  11772. usually) followed by a 'C'.
  11773. * String constants consist of a sequence of characters enclosed by a
  11774. pair of like quotes, either single (''') or double ('"'). Escape
  11775. sequences in the style of C are also allowed. *Note C and C++
  11776. Constants: C Constants, for a brief explanation of escape
  11777. sequences.
  11778. * Enumerated constants consist of an enumerated identifier.
  11779. * Boolean constants consist of the identifiers 'TRUE' and 'FALSE'.
  11780. * Pointer constants consist of integral values only.
  11781. * Set constants are not yet supported.
  11782. 
  11783. File: gdb.info, Node: M2 Types, Next: M2 Defaults, Prev: M2 Constants, Up: Modula-2
  11784. 15.4.9.4 Modula-2 Types
  11785. .......................
  11786. Currently GDB can print the following data types in Modula-2 syntax:
  11787. array types, record types, set types, pointer types, procedure types,
  11788. enumerated types, subrange types and base types. You can also print the
  11789. contents of variables declared using these type. This section gives a
  11790. number of simple source code examples together with sample GDB sessions.
  11791. The first example contains the following section of code:
  11792. VAR
  11793. s: SET OF CHAR ;
  11794. r: [20..40] ;
  11795. and you can request GDB to interrogate the type and value of 'r' and
  11796. 's'.
  11797. (gdb) print s
  11798. {'A'..'C', 'Z'}
  11799. (gdb) ptype s
  11800. SET OF CHAR
  11801. (gdb) print r
  11802. 21
  11803. (gdb) ptype r
  11804. [20..40]
  11805. Likewise if your source code declares 's' as:
  11806. VAR
  11807. s: SET ['A'..'Z'] ;
  11808. then you may query the type of 's' by:
  11809. (gdb) ptype s
  11810. type = SET ['A'..'Z']
  11811. Note that at present you cannot interactively manipulate set expressions
  11812. using the debugger.
  11813. The following example shows how you might declare an array in
  11814. Modula-2 and how you can interact with GDB to print its type and
  11815. contents:
  11816. VAR
  11817. s: ARRAY [-10..10] OF CHAR ;
  11818. (gdb) ptype s
  11819. ARRAY [-10..10] OF CHAR
  11820. Note that the array handling is not yet complete and although the
  11821. type is printed correctly, expression handling still assumes that all
  11822. arrays have a lower bound of zero and not '-10' as in the example above.
  11823. Here are some more type related Modula-2 examples:
  11824. TYPE
  11825. colour = (blue, red, yellow, green) ;
  11826. t = [blue..yellow] ;
  11827. VAR
  11828. s: t ;
  11829. BEGIN
  11830. s := blue ;
  11831. The GDB interaction shows how you can query the data type and value of a
  11832. variable.
  11833. (gdb) print s
  11834. $1 = blue
  11835. (gdb) ptype t
  11836. type = [blue..yellow]
  11837. In this example a Modula-2 array is declared and its contents displayed.
  11838. Observe that the contents are written in the same way as their 'C'
  11839. counterparts.
  11840. VAR
  11841. s: ARRAY [1..5] OF CARDINAL ;
  11842. BEGIN
  11843. s[1] := 1 ;
  11844. (gdb) print s
  11845. $1 = {1, 0, 0, 0, 0}
  11846. (gdb) ptype s
  11847. type = ARRAY [1..5] OF CARDINAL
  11848. The Modula-2 language interface to GDB also understands pointer types
  11849. as shown in this example:
  11850. VAR
  11851. s: POINTER TO ARRAY [1..5] OF CARDINAL ;
  11852. BEGIN
  11853. NEW(s) ;
  11854. s^[1] := 1 ;
  11855. and you can request that GDB describes the type of 's'.
  11856. (gdb) ptype s
  11857. type = POINTER TO ARRAY [1..5] OF CARDINAL
  11858. GDB handles compound types as we can see in this example. Here we
  11859. combine array types, record types, pointer types and subrange types:
  11860. TYPE
  11861. foo = RECORD
  11862. f1: CARDINAL ;
  11863. f2: CHAR ;
  11864. f3: myarray ;
  11865. END ;
  11866. myarray = ARRAY myrange OF CARDINAL ;
  11867. myrange = [-2..2] ;
  11868. VAR
  11869. s: POINTER TO ARRAY myrange OF foo ;
  11870. and you can ask GDB to describe the type of 's' as shown below.
  11871. (gdb) ptype s
  11872. type = POINTER TO ARRAY [-2..2] OF foo = RECORD
  11873. f1 : CARDINAL;
  11874. f2 : CHAR;
  11875. f3 : ARRAY [-2..2] OF CARDINAL;
  11876. END
  11877. 
  11878. File: gdb.info, Node: M2 Defaults, Next: Deviations, Prev: M2 Types, Up: Modula-2
  11879. 15.4.9.5 Modula-2 Defaults
  11880. ..........................
  11881. If type and range checking are set automatically by GDB, they both
  11882. default to 'on' whenever the working language changes to Modula-2. This
  11883. happens regardless of whether you or GDB selected the working language.
  11884. If you allow GDB to set the language automatically, then entering
  11885. code compiled from a file whose name ends with '.mod' sets the working
  11886. language to Modula-2. *Note Having GDB Infer the Source Language:
  11887. Automatically, for further details.
  11888. 
  11889. File: gdb.info, Node: Deviations, Next: M2 Checks, Prev: M2 Defaults, Up: Modula-2
  11890. 15.4.9.6 Deviations from Standard Modula-2
  11891. ..........................................
  11892. A few changes have been made to make Modula-2 programs easier to debug.
  11893. This is done primarily via loosening its type strictness:
  11894. * Unlike in standard Modula-2, pointer constants can be formed by
  11895. integers. This allows you to modify pointer variables during
  11896. debugging. (In standard Modula-2, the actual address contained in
  11897. a pointer variable is hidden from you; it can only be modified
  11898. through direct assignment to another pointer variable or expression
  11899. that returned a pointer.)
  11900. * C escape sequences can be used in strings and characters to
  11901. represent non-printable characters. GDB prints out strings with
  11902. these escape sequences embedded. Single non-printable characters
  11903. are printed using the 'CHR(NNN)' format.
  11904. * The assignment operator (':=') returns the value of its right-hand
  11905. argument.
  11906. * All built-in procedures both modify _and_ return their argument.
  11907. 
  11908. File: gdb.info, Node: M2 Checks, Next: M2 Scope, Prev: Deviations, Up: Modula-2
  11909. 15.4.9.7 Modula-2 Type and Range Checks
  11910. .......................................
  11911. _Warning:_ in this release, GDB does not yet perform type or range
  11912. checking.
  11913. GDB considers two Modula-2 variables type equivalent if:
  11914. * They are of types that have been declared equivalent via a 'TYPE T1
  11915. = T2' statement
  11916. * They have been declared on the same line. (Note: This is true of
  11917. the GNU Modula-2 compiler, but it may not be true of other
  11918. compilers.)
  11919. As long as type checking is enabled, any attempt to combine variables
  11920. whose types are not equivalent is an error.
  11921. Range checking is done on all mathematical operations, assignment,
  11922. array index bounds, and all built-in functions and procedures.
  11923. 
  11924. File: gdb.info, Node: M2 Scope, Next: GDB/M2, Prev: M2 Checks, Up: Modula-2
  11925. 15.4.9.8 The Scope Operators '::' and '.'
  11926. .........................................
  11927. There are a few subtle differences between the Modula-2 scope operator
  11928. ('.') and the GDB scope operator ('::'). The two have similar syntax:
  11929. MODULE . ID
  11930. SCOPE :: ID
  11931. where SCOPE is the name of a module or a procedure, MODULE the name of a
  11932. module, and ID is any declared identifier within your program, except
  11933. another module.
  11934. Using the '::' operator makes GDB search the scope specified by SCOPE
  11935. for the identifier ID. If it is not found in the specified scope, then
  11936. GDB searches all scopes enclosing the one specified by SCOPE.
  11937. Using the '.' operator makes GDB search the current scope for the
  11938. identifier specified by ID that was imported from the definition module
  11939. specified by MODULE. With this operator, it is an error if the
  11940. identifier ID was not imported from definition module MODULE, or if ID
  11941. is not an identifier in MODULE.
  11942. 
  11943. File: gdb.info, Node: GDB/M2, Prev: M2 Scope, Up: Modula-2
  11944. 15.4.9.9 GDB and Modula-2
  11945. .........................
  11946. Some GDB commands have little use when debugging Modula-2 programs.
  11947. Five subcommands of 'set print' and 'show print' apply specifically to C
  11948. and C++: 'vtbl', 'demangle', 'asm-demangle', 'object', and 'union'. The
  11949. first four apply to C++, and the last to the C 'union' type, which has
  11950. no direct analogue in Modula-2.
  11951. The '@' operator (*note Expressions: Expressions.), while available
  11952. with any language, is not useful with Modula-2. Its intent is to aid
  11953. the debugging of "dynamic arrays", which cannot be created in Modula-2
  11954. as they can in C or C++. However, because an address can be specified
  11955. by an integral constant, the construct '{TYPE}ADREXP' is still useful.
  11956. In GDB scripts, the Modula-2 inequality operator '#' is interpreted
  11957. as the beginning of a comment. Use '<>' instead.
  11958. 
  11959. File: gdb.info, Node: Ada, Prev: Modula-2, Up: Supported Languages
  11960. 15.4.10 Ada
  11961. -----------
  11962. The extensions made to GDB for Ada only support output from the GNU Ada
  11963. (GNAT) compiler. Other Ada compilers are not currently supported, and
  11964. attempting to debug executables produced by them is most likely to be
  11965. difficult.
  11966. * Menu:
  11967. * Ada Mode Intro:: General remarks on the Ada syntax
  11968. and semantics supported by Ada mode
  11969. in GDB.
  11970. * Omissions from Ada:: Restrictions on the Ada expression syntax.
  11971. * Additions to Ada:: Extensions of the Ada expression syntax.
  11972. * Overloading support for Ada:: Support for expressions involving overloaded
  11973. subprograms.
  11974. * Stopping Before Main Program:: Debugging the program during elaboration.
  11975. * Ada Exceptions:: Ada Exceptions
  11976. * Ada Tasks:: Listing and setting breakpoints in tasks.
  11977. * Ada Tasks and Core Files:: Tasking Support when Debugging Core Files
  11978. * Ravenscar Profile:: Tasking Support when using the Ravenscar
  11979. Profile
  11980. * Ada Settings:: New settable GDB parameters for Ada.
  11981. * Ada Glitches:: Known peculiarities of Ada mode.
  11982. 
  11983. File: gdb.info, Node: Ada Mode Intro, Next: Omissions from Ada, Up: Ada
  11984. 15.4.10.1 Introduction
  11985. ......................
  11986. The Ada mode of GDB supports a fairly large subset of Ada expression
  11987. syntax, with some extensions. The philosophy behind the design of this
  11988. subset is
  11989. * That GDB should provide basic literals and access to operations for
  11990. arithmetic, dereferencing, field selection, indexing, and
  11991. subprogram calls, leaving more sophisticated computations to
  11992. subprograms written into the program (which therefore may be called
  11993. from GDB).
  11994. * That type safety and strict adherence to Ada language restrictions
  11995. are not particularly important to the GDB user.
  11996. * That brevity is important to the GDB user.
  11997. Thus, for brevity, the debugger acts as if all names declared in
  11998. user-written packages are directly visible, even if they are not visible
  11999. according to Ada rules, thus making it unnecessary to fully qualify most
  12000. names with their packages, regardless of context. Where this causes
  12001. ambiguity, GDB asks the user's intent.
  12002. The debugger will start in Ada mode if it detects an Ada main
  12003. program. As for other languages, it will enter Ada mode when stopped in
  12004. a program that was translated from an Ada source file.
  12005. While in Ada mode, you may use '--' for comments. This is useful
  12006. mostly for documenting command files. The standard GDB comment ('#')
  12007. still works at the beginning of a line in Ada mode, but not in the
  12008. middle (to allow based literals).
  12009. 
  12010. File: gdb.info, Node: Omissions from Ada, Next: Additions to Ada, Prev: Ada Mode Intro, Up: Ada
  12011. 15.4.10.2 Omissions from Ada
  12012. ............................
  12013. Here are the notable omissions from the subset:
  12014. * Only a subset of the attributes are supported:
  12015. - 'First, 'Last, and 'Length on array objects (not on types and
  12016. subtypes).
  12017. - 'Min and 'Max.
  12018. - 'Pos and 'Val.
  12019. - 'Tag.
  12020. - 'Range on array objects (not subtypes), but only as the right
  12021. operand of the membership ('in') operator.
  12022. - 'Access, 'Unchecked_Access, and 'Unrestricted_Access (a GNAT
  12023. extension).
  12024. - 'Address.
  12025. * The names in 'Characters.Latin_1' are not available and
  12026. concatenation is not implemented. Thus, escape characters in
  12027. strings are not currently available.
  12028. * Equality tests ('=' and '/=') on arrays test for bitwise equality
  12029. of representations. They will generally work correctly for strings
  12030. and arrays whose elements have integer or enumeration types. They
  12031. may not work correctly for arrays whose element types have
  12032. user-defined equality, for arrays of real values (in particular,
  12033. IEEE-conformant floating point, because of negative zeroes and
  12034. NaNs), and for arrays whose elements contain unused bits with
  12035. indeterminate values.
  12036. * The other component-by-component array operations ('and', 'or',
  12037. 'xor', 'not', and relational tests other than equality) are not
  12038. implemented.
  12039. * There is limited support for array and record aggregates. They are
  12040. permitted only on the right sides of assignments, as in these
  12041. examples:
  12042. (gdb) set An_Array := (1, 2, 3, 4, 5, 6)
  12043. (gdb) set An_Array := (1, others => 0)
  12044. (gdb) set An_Array := (0|4 => 1, 1..3 => 2, 5 => 6)
  12045. (gdb) set A_2D_Array := ((1, 2, 3), (4, 5, 6), (7, 8, 9))
  12046. (gdb) set A_Record := (1, "Peter", True);
  12047. (gdb) set A_Record := (Name => "Peter", Id => 1, Alive => True)
  12048. Changing a discriminant's value by assigning an aggregate has an
  12049. undefined effect if that discriminant is used within the record.
  12050. However, you can first modify discriminants by directly assigning
  12051. to them (which normally would not be allowed in Ada), and then
  12052. performing an aggregate assignment. For example, given a variable
  12053. 'A_Rec' declared to have a type such as:
  12054. type Rec (Len : Small_Integer := 0) is record
  12055. Id : Integer;
  12056. Vals : IntArray (1 .. Len);
  12057. end record;
  12058. you can assign a value with a different size of 'Vals' with two
  12059. assignments:
  12060. (gdb) set A_Rec.Len := 4
  12061. (gdb) set A_Rec := (Id => 42, Vals => (1, 2, 3, 4))
  12062. As this example also illustrates, GDB is very loose about the usual
  12063. rules concerning aggregates. You may leave out some of the
  12064. components of an array or record aggregate (such as the 'Len'
  12065. component in the assignment to 'A_Rec' above); they will retain
  12066. their original values upon assignment. You may freely use dynamic
  12067. values as indices in component associations. You may even use
  12068. overlapping or redundant component associations, although which
  12069. component values are assigned in such cases is not defined.
  12070. * Calls to dispatching subprograms are not implemented.
  12071. * The overloading algorithm is much more limited (i.e., less
  12072. selective) than that of real Ada. It makes only limited use of the
  12073. context in which a subexpression appears to resolve its meaning,
  12074. and it is much looser in its rules for allowing type matches. As a
  12075. result, some function calls will be ambiguous, and the user will be
  12076. asked to choose the proper resolution.
  12077. * The 'new' operator is not implemented.
  12078. * Entry calls are not implemented.
  12079. * Aside from printing, arithmetic operations on the native VAX
  12080. floating-point formats are not supported.
  12081. * It is not possible to slice a packed array.
  12082. * The names 'True' and 'False', when not part of a qualified name,
  12083. are interpreted as if implicitly prefixed by 'Standard', regardless
  12084. of context. Should your program redefine these names in a package
  12085. or procedure (at best a dubious practice), you will have to use
  12086. fully qualified names to access their new definitions.
  12087. 
  12088. File: gdb.info, Node: Additions to Ada, Next: Overloading support for Ada, Prev: Omissions from Ada, Up: Ada
  12089. 15.4.10.3 Additions to Ada
  12090. ..........................
  12091. As it does for other languages, GDB makes certain generic extensions to
  12092. Ada (*note Expressions::):
  12093. * If the expression E is a variable residing in memory (typically a
  12094. local variable or array element) and N is a positive integer, then
  12095. 'E@N' displays the values of E and the N-1 adjacent variables
  12096. following it in memory as an array. In Ada, this operator is
  12097. generally not necessary, since its prime use is in displaying parts
  12098. of an array, and slicing will usually do this in Ada. However,
  12099. there are occasional uses when debugging programs in which certain
  12100. debugging information has been optimized away.
  12101. * 'B::VAR' means "the variable named VAR that appears in function or
  12102. file B." When B is a file name, you must typically surround it in
  12103. single quotes.
  12104. * The expression '{TYPE} ADDR' means "the variable of type TYPE that
  12105. appears at address ADDR."
  12106. * A name starting with '$' is a convenience variable (*note
  12107. Convenience Vars::) or a machine register (*note Registers::).
  12108. In addition, GDB provides a few other shortcuts and outright
  12109. additions specific to Ada:
  12110. * The assignment statement is allowed as an expression, returning its
  12111. right-hand operand as its value. Thus, you may enter
  12112. (gdb) set x := y + 3
  12113. (gdb) print A(tmp := y + 1)
  12114. * The semicolon is allowed as an "operator," returning as its value
  12115. the value of its right-hand operand. This allows, for example,
  12116. complex conditional breaks:
  12117. (gdb) break f
  12118. (gdb) condition 1 (report(i); k += 1; A(k) > 100)
  12119. * Rather than use catenation and symbolic character names to
  12120. introduce special characters into strings, one may instead use a
  12121. special bracket notation, which is also used to print strings. A
  12122. sequence of characters of the form '["XX"]' within a string or
  12123. character literal denotes the (single) character whose numeric
  12124. encoding is XX in hexadecimal. The sequence of characters '["""]'
  12125. also denotes a single quotation mark in strings. For example,
  12126. "One line.["0a"]Next line.["0a"]"
  12127. contains an ASCII newline character ('Ada.Characters.Latin_1.LF')
  12128. after each period.
  12129. * The subtype used as a prefix for the attributes 'Pos, 'Min, and
  12130. 'Max is optional (and is ignored in any case). For example, it is
  12131. valid to write
  12132. (gdb) print 'max(x, y)
  12133. * When printing arrays, GDB uses positional notation when the array
  12134. has a lower bound of 1, and uses a modified named notation
  12135. otherwise. For example, a one-dimensional array of three integers
  12136. with a lower bound of 3 might print as
  12137. (3 => 10, 17, 1)
  12138. That is, in contrast to valid Ada, only the first component has a
  12139. '=>' clause.
  12140. * You may abbreviate attributes in expressions with any unique,
  12141. multi-character subsequence of their names (an exact match gets
  12142. preference). For example, you may use a'len, a'gth, or a'lh in
  12143. place of a'length.
  12144. * Since Ada is case-insensitive, the debugger normally maps
  12145. identifiers you type to lower case. The GNAT compiler uses
  12146. upper-case characters for some of its internal identifiers, which
  12147. are normally of no interest to users. For the rare occasions when
  12148. you actually have to look at them, enclose them in angle brackets
  12149. to avoid the lower-case mapping. For example,
  12150. (gdb) print <JMPBUF_SAVE>[0]
  12151. * Printing an object of class-wide type or dereferencing an
  12152. access-to-class-wide value will display all the components of the
  12153. object's specific type (as indicated by its run-time tag).
  12154. Likewise, component selection on such a value will operate on the
  12155. specific type of the object.
  12156. 
  12157. File: gdb.info, Node: Overloading support for Ada, Next: Stopping Before Main Program, Prev: Additions to Ada, Up: Ada
  12158. 15.4.10.4 Overloading support for Ada
  12159. .....................................
  12160. The debugger supports limited overloading. Given a subprogram call in
  12161. which the function symbol has multiple definitions, it will use the
  12162. number of actual parameters and some information about their types to
  12163. attempt to narrow the set of definitions. It also makes very limited
  12164. use of context, preferring procedures to functions in the context of the
  12165. 'call' command, and functions to procedures elsewhere.
  12166. If, after narrowing, the set of matching definitions still contains
  12167. more than one definition, GDB will display a menu to query which one it
  12168. should use, for instance:
  12169. (gdb) print f(1)
  12170. Multiple matches for f
  12171. [0] cancel
  12172. [1] foo.f (integer) return boolean at foo.adb:23
  12173. [2] foo.f (foo.new_integer) return boolean at foo.adb:28
  12174. >
  12175. In this case, just select one menu entry either to cancel expression
  12176. evaluation (type '0' and press <RET>) or to continue evaluation with a
  12177. specific instance (type the corresponding number and press <RET>).
  12178. Here are a couple of commands to customize GDB's behavior in this
  12179. case:
  12180. 'set ada print-signatures'
  12181. Control whether parameter types and return types are displayed in
  12182. overloads selection menus. It is 'on' by default. *Note
  12183. Overloading support for Ada::.
  12184. 'show ada print-signatures'
  12185. Show the current setting for displaying parameter types and return
  12186. types in overloads selection menu. *Note Overloading support for
  12187. Ada::.
  12188. 
  12189. File: gdb.info, Node: Stopping Before Main Program, Next: Ada Exceptions, Prev: Overloading support for Ada, Up: Ada
  12190. 15.4.10.5 Stopping at the Very Beginning
  12191. ........................................
  12192. It is sometimes necessary to debug the program during elaboration, and
  12193. before reaching the main procedure. As defined in the Ada Reference
  12194. Manual, the elaboration code is invoked from a procedure called
  12195. 'adainit'. To run your program up to the beginning of elaboration,
  12196. simply use the following two commands: 'tbreak adainit' and 'run'.
  12197. 
  12198. File: gdb.info, Node: Ada Exceptions, Next: Ada Tasks, Prev: Stopping Before Main Program, Up: Ada
  12199. 15.4.10.6 Ada Exceptions
  12200. ........................
  12201. A command is provided to list all Ada exceptions:
  12202. 'info exceptions'
  12203. 'info exceptions REGEXP'
  12204. The 'info exceptions' command allows you to list all Ada exceptions
  12205. defined within the program being debugged, as well as their
  12206. addresses. With a regular expression, REGEXP, as argument, only
  12207. those exceptions whose names match REGEXP are listed.
  12208. Below is a small example, showing how the command can be used, first
  12209. without argument, and next with a regular expression passed as an
  12210. argument.
  12211. (gdb) info exceptions
  12212. All defined Ada exceptions:
  12213. constraint_error: 0x613da0
  12214. program_error: 0x613d20
  12215. storage_error: 0x613ce0
  12216. tasking_error: 0x613ca0
  12217. const.aint_global_e: 0x613b00
  12218. (gdb) info exceptions const.aint
  12219. All Ada exceptions matching regular expression "const.aint":
  12220. constraint_error: 0x613da0
  12221. const.aint_global_e: 0x613b00
  12222. It is also possible to ask GDB to stop your program's execution when
  12223. an exception is raised. For more details, see *note Set Catchpoints::.
  12224. 
  12225. File: gdb.info, Node: Ada Tasks, Next: Ada Tasks and Core Files, Prev: Ada Exceptions, Up: Ada
  12226. 15.4.10.7 Extensions for Ada Tasks
  12227. ..................................
  12228. Support for Ada tasks is analogous to that for threads (*note
  12229. Threads::). GDB provides the following task-related commands:
  12230. 'info tasks'
  12231. This command shows a list of current Ada tasks, as in the following
  12232. example:
  12233. (gdb) info tasks
  12234. ID TID P-ID Pri State Name
  12235. 1 8088000 0 15 Child Activation Wait main_task
  12236. 2 80a4000 1 15 Accept Statement b
  12237. 3 809a800 1 15 Child Activation Wait a
  12238. * 4 80ae800 3 15 Runnable c
  12239. In this listing, the asterisk before the last task indicates it to
  12240. be the task currently being inspected.
  12241. ID
  12242. Represents GDB's internal task number.
  12243. TID
  12244. The Ada task ID.
  12245. P-ID
  12246. The parent's task ID (GDB's internal task number).
  12247. Pri
  12248. The base priority of the task.
  12249. State
  12250. Current state of the task.
  12251. 'Unactivated'
  12252. The task has been created but has not been activated. It
  12253. cannot be executing.
  12254. 'Runnable'
  12255. The task is not blocked for any reason known to Ada. (It
  12256. may be waiting for a mutex, though.) It is conceptually
  12257. "executing" in normal mode.
  12258. 'Terminated'
  12259. The task is terminated, in the sense of ARM 9.3 (5). Any
  12260. dependents that were waiting on terminate alternatives
  12261. have been awakened and have terminated themselves.
  12262. 'Child Activation Wait'
  12263. The task is waiting for created tasks to complete
  12264. activation.
  12265. 'Accept Statement'
  12266. The task is waiting on an accept or selective wait
  12267. statement.
  12268. 'Waiting on entry call'
  12269. The task is waiting on an entry call.
  12270. 'Async Select Wait'
  12271. The task is waiting to start the abortable part of an
  12272. asynchronous select statement.
  12273. 'Delay Sleep'
  12274. The task is waiting on a select statement with only a
  12275. delay alternative open.
  12276. 'Child Termination Wait'
  12277. The task is sleeping having completed a master within
  12278. itself, and is waiting for the tasks dependent on that
  12279. master to become terminated or waiting on a terminate
  12280. Phase.
  12281. 'Wait Child in Term Alt'
  12282. The task is sleeping waiting for tasks on terminate
  12283. alternatives to finish terminating.
  12284. 'Accepting RV with TASKNO'
  12285. The task is accepting a rendez-vous with the task TASKNO.
  12286. Name
  12287. Name of the task in the program.
  12288. 'info task TASKNO'
  12289. This command shows detailed informations on the specified task, as
  12290. in the following example:
  12291. (gdb) info tasks
  12292. ID TID P-ID Pri State Name
  12293. 1 8077880 0 15 Child Activation Wait main_task
  12294. * 2 807c468 1 15 Runnable task_1
  12295. (gdb) info task 2
  12296. Ada Task: 0x807c468
  12297. Name: "task_1"
  12298. Thread: 0
  12299. LWP: 0x1fac
  12300. Parent: 1 ("main_task")
  12301. Base Priority: 15
  12302. State: Runnable
  12303. 'task'
  12304. This command prints the ID and name of the current task.
  12305. (gdb) info tasks
  12306. ID TID P-ID Pri State Name
  12307. 1 8077870 0 15 Child Activation Wait main_task
  12308. * 2 807c458 1 15 Runnable some_task
  12309. (gdb) task
  12310. [Current task is 2 "some_task"]
  12311. 'task TASKNO'
  12312. This command is like the 'thread THREAD-ID' command (*note
  12313. Threads::). It switches the context of debugging from the current
  12314. task to the given task.
  12315. (gdb) info tasks
  12316. ID TID P-ID Pri State Name
  12317. 1 8077870 0 15 Child Activation Wait main_task
  12318. * 2 807c458 1 15 Runnable some_task
  12319. (gdb) task 1
  12320. [Switching to task 1 "main_task"]
  12321. #0 0x8067726 in pthread_cond_wait ()
  12322. (gdb) bt
  12323. #0 0x8067726 in pthread_cond_wait ()
  12324. #1 0x8056714 in system.os_interface.pthread_cond_wait ()
  12325. #2 0x805cb63 in system.task_primitives.operations.sleep ()
  12326. #3 0x806153e in system.tasking.stages.activate_tasks ()
  12327. #4 0x804aacc in un () at un.adb:5
  12328. 'break LOCATION task TASKNO'
  12329. 'break LOCATION task TASKNO if ...'
  12330. These commands are like the 'break ... thread ...' command (*note
  12331. Thread Stops::). The LOCATION argument specifies source lines, as
  12332. described in *note Specify Location::.
  12333. Use the qualifier 'task TASKNO' with a breakpoint command to
  12334. specify that you only want GDB to stop the program when a
  12335. particular Ada task reaches this breakpoint. The TASKNO is one of
  12336. the numeric task identifiers assigned by GDB, shown in the first
  12337. column of the 'info tasks' display.
  12338. If you do not specify 'task TASKNO' when you set a breakpoint, the
  12339. breakpoint applies to _all_ tasks of your program.
  12340. You can use the 'task' qualifier on conditional breakpoints as
  12341. well; in this case, place 'task TASKNO' before the breakpoint
  12342. condition (before the 'if').
  12343. For example,
  12344. (gdb) info tasks
  12345. ID TID P-ID Pri State Name
  12346. 1 140022020 0 15 Child Activation Wait main_task
  12347. 2 140045060 1 15 Accept/Select Wait t2
  12348. 3 140044840 1 15 Runnable t1
  12349. * 4 140056040 1 15 Runnable t3
  12350. (gdb) b 15 task 2
  12351. Breakpoint 5 at 0x120044cb0: file test_task_debug.adb, line 15.
  12352. (gdb) cont
  12353. Continuing.
  12354. task # 1 running
  12355. task # 2 running
  12356. Breakpoint 5, test_task_debug () at test_task_debug.adb:15
  12357. 15 flush;
  12358. (gdb) info tasks
  12359. ID TID P-ID Pri State Name
  12360. 1 140022020 0 15 Child Activation Wait main_task
  12361. * 2 140045060 1 15 Runnable t2
  12362. 3 140044840 1 15 Runnable t1
  12363. 4 140056040 1 15 Delay Sleep t3
  12364. 
  12365. File: gdb.info, Node: Ada Tasks and Core Files, Next: Ravenscar Profile, Prev: Ada Tasks, Up: Ada
  12366. 15.4.10.8 Tasking Support when Debugging Core Files
  12367. ...................................................
  12368. When inspecting a core file, as opposed to debugging a live program,
  12369. tasking support may be limited or even unavailable, depending on the
  12370. platform being used. For instance, on x86-linux, the list of tasks is
  12371. available, but task switching is not supported.
  12372. On certain platforms, the debugger needs to perform some memory
  12373. writes in order to provide Ada tasking support. When inspecting a core
  12374. file, this means that the core file must be opened with read-write
  12375. privileges, using the command '"set write on"' (*note Patching::).
  12376. Under these circumstances, you should make a backup copy of the core
  12377. file before inspecting it with GDB.
  12378. 
  12379. File: gdb.info, Node: Ravenscar Profile, Next: Ada Settings, Prev: Ada Tasks and Core Files, Up: Ada
  12380. 15.4.10.9 Tasking Support when using the Ravenscar Profile
  12381. ..........................................................
  12382. The "Ravenscar Profile" is a subset of the Ada tasking features,
  12383. specifically designed for systems with safety-critical real-time
  12384. requirements.
  12385. 'set ravenscar task-switching on'
  12386. Allows task switching when debugging a program that uses the
  12387. Ravenscar Profile. This is the default.
  12388. 'set ravenscar task-switching off'
  12389. Turn off task switching when debugging a program that uses the
  12390. Ravenscar Profile. This is mostly intended to disable the code
  12391. that adds support for the Ravenscar Profile, in case a bug in
  12392. either GDB or in the Ravenscar runtime is preventing GDB from
  12393. working properly. To be effective, this command should be run
  12394. before the program is started.
  12395. 'show ravenscar task-switching'
  12396. Show whether it is possible to switch from task to task in a
  12397. program using the Ravenscar Profile.
  12398. When Ravenscar task-switching is enabled, Ravenscar tasks are
  12399. announced by GDB as if they were threads:
  12400. (gdb) continue
  12401. [New Ravenscar Thread 0x2b8f0]
  12402. Both Ravenscar tasks and the underlying CPU threads will show up in
  12403. the output of 'info threads':
  12404. (gdb) info threads
  12405. Id Target Id Frame
  12406. 1 Thread 1 (CPU#0 [running]) simple () at simple.adb:10
  12407. 2 Thread 2 (CPU#1 [running]) 0x0000000000003d34 in __gnat_initialize_cpu_devices ()
  12408. 3 Thread 3 (CPU#2 [running]) 0x0000000000003d28 in __gnat_initialize_cpu_devices ()
  12409. 4 Thread 4 (CPU#3 [halted ]) 0x000000000000c6ec in system.task_primitives.operations.idle ()
  12410. * 5 Ravenscar Thread 0x2b8f0 simple () at simple.adb:10
  12411. 6 Ravenscar Thread 0x2f150 0x000000000000c6ec in system.task_primitives.operations.idle ()
  12412. One known limitation of the Ravenscar support in GDB is that it isn't
  12413. currently possible to single-step through the runtime initialization
  12414. sequence. If you need to debug this code, you should use 'set ravenscar
  12415. task-switching off'.
  12416. 
  12417. File: gdb.info, Node: Ada Settings, Next: Ada Glitches, Prev: Ravenscar Profile, Up: Ada
  12418. 15.4.10.10 Ada Settings
  12419. .......................
  12420. 'set varsize-limit SIZE'
  12421. Prevent GDB from attempting to evaluate objects whose size is above
  12422. the given limit (SIZE) when those sizes are computed from run-time
  12423. quantities. This is typically the case when the object has a
  12424. variable size, such as an array whose bounds are not known at
  12425. compile time for example. Setting SIZE to 'unlimited' removes the
  12426. size limitation. By default, the limit is about 65KB.
  12427. The purpose of having such a limit is to prevent GDB from trying to
  12428. grab enormous chunks of virtual memory when asked to evaluate a
  12429. quantity whose bounds have been corrupted or have not yet been
  12430. fully initialized. The limit applies to the results of some
  12431. subexpressions as well as to complete expressions. For example, an
  12432. expression denoting a simple integer component, such as 'x.y.z',
  12433. may fail if the size of 'x.y' is variable and exceeds 'size'. On
  12434. the other hand, GDB is sometimes clever; the expression 'A(i)',
  12435. where 'A' is an array variable with non-constant size, will
  12436. generally succeed regardless of the bounds on 'A', as long as the
  12437. component size is less than SIZE.
  12438. 'show varsize-limit'
  12439. Show the limit on types whose size is determined by run-time
  12440. quantities.
  12441. 
  12442. File: gdb.info, Node: Ada Glitches, Prev: Ada Settings, Up: Ada
  12443. 15.4.10.11 Known Peculiarities of Ada Mode
  12444. ..........................................
  12445. Besides the omissions listed previously (*note Omissions from Ada::), we
  12446. know of several problems with and limitations of Ada mode in GDB, some
  12447. of which will be fixed with planned future releases of the debugger and
  12448. the GNU Ada compiler.
  12449. * Static constants that the compiler chooses not to materialize as
  12450. objects in storage are invisible to the debugger.
  12451. * Named parameter associations in function argument lists are ignored
  12452. (the argument lists are treated as positional).
  12453. * Many useful library packages are currently invisible to the
  12454. debugger.
  12455. * Fixed-point arithmetic, conversions, input, and output is carried
  12456. out using floating-point arithmetic, and may give results that only
  12457. approximate those on the host machine.
  12458. * The GNAT compiler never generates the prefix 'Standard' for any of
  12459. the standard symbols defined by the Ada language. GDB knows about
  12460. this: it will strip the prefix from names when you use it, and will
  12461. never look for a name you have so qualified among local symbols,
  12462. nor match against symbols in other packages or subprograms. If you
  12463. have defined entities anywhere in your program other than
  12464. parameters and local variables whose simple names match names in
  12465. 'Standard', GNAT's lack of qualification here can cause confusion.
  12466. When this happens, you can usually resolve the confusion by
  12467. qualifying the problematic names with package 'Standard'
  12468. explicitly.
  12469. Older versions of the compiler sometimes generate erroneous debugging
  12470. information, resulting in the debugger incorrectly printing the value of
  12471. affected entities. In some cases, the debugger is able to work around
  12472. an issue automatically. In other cases, the debugger is able to work
  12473. around the issue, but the work-around has to be specifically enabled.
  12474. 'set ada trust-PAD-over-XVS on'
  12475. Configure GDB to strictly follow the GNAT encoding when computing
  12476. the value of Ada entities, particularly when 'PAD' and 'PAD___XVS'
  12477. types are involved (see 'ada/exp_dbug.ads' in the GCC sources for a
  12478. complete description of the encoding used by the GNAT compiler).
  12479. This is the default.
  12480. 'set ada trust-PAD-over-XVS off'
  12481. This is related to the encoding using by the GNAT compiler. If GDB
  12482. sometimes prints the wrong value for certain entities, changing
  12483. 'ada trust-PAD-over-XVS' to 'off' activates a work-around which may
  12484. fix the issue. It is always safe to set 'ada trust-PAD-over-XVS'
  12485. to 'off', but this incurs a slight performance penalty, so it is
  12486. recommended to leave this setting to 'on' unless necessary.
  12487. Internally, the debugger also relies on the compiler following a
  12488. number of conventions known as the 'GNAT Encoding', all documented in
  12489. 'gcc/ada/exp_dbug.ads' in the GCC sources. This encoding describes how
  12490. the debugging information should be generated for certain types. In
  12491. particular, this convention makes use of "descriptive types", which are
  12492. artificial types generated purely to help the debugger.
  12493. These encodings were defined at a time when the debugging information
  12494. format used was not powerful enough to describe some of the more complex
  12495. types available in Ada. Since DWARF allows us to express nearly all Ada
  12496. features, the long-term goal is to slowly replace these descriptive
  12497. types by their pure DWARF equivalent. To facilitate that transition, a
  12498. new maintenance option is available to force the debugger to ignore
  12499. those descriptive types. It allows the user to quickly evaluate how
  12500. well GDB works without them.
  12501. 'maintenance ada set ignore-descriptive-types [on|off]'
  12502. Control whether the debugger should ignore descriptive types. The
  12503. default is not to ignore descriptives types ('off').
  12504. 'maintenance ada show ignore-descriptive-types'
  12505. Show if descriptive types are ignored by GDB.
  12506. 
  12507. File: gdb.info, Node: Unsupported Languages, Prev: Supported Languages, Up: Languages
  12508. 15.5 Unsupported Languages
  12509. ==========================
  12510. In addition to the other fully-supported programming languages, GDB also
  12511. provides a pseudo-language, called 'minimal'. It does not represent a
  12512. real programming language, but provides a set of capabilities close to
  12513. what the C or assembly languages provide. This should allow most simple
  12514. operations to be performed while debugging an application that uses a
  12515. language currently not supported by GDB.
  12516. If the language is set to 'auto', GDB will automatically select this
  12517. language if the current frame corresponds to an unsupported language.
  12518. 
  12519. File: gdb.info, Node: Symbols, Next: Altering, Prev: Languages, Up: Top
  12520. 16 Examining the Symbol Table
  12521. *****************************
  12522. The commands described in this chapter allow you to inquire about the
  12523. symbols (names of variables, functions and types) defined in your
  12524. program. This information is inherent in the text of your program and
  12525. does not change as your program executes. GDB finds it in your
  12526. program's symbol table, in the file indicated when you started GDB
  12527. (*note Choosing Files: File Options.), or by one of the file-management
  12528. commands (*note Commands to Specify Files: Files.).
  12529. Occasionally, you may need to refer to symbols that contain unusual
  12530. characters, which GDB ordinarily treats as word delimiters. The most
  12531. frequent case is in referring to static variables in other source files
  12532. (*note Program Variables: Variables.). File names are recorded in
  12533. object files as debugging symbols, but GDB would ordinarily parse a
  12534. typical file name, like 'foo.c', as the three words 'foo' '.' 'c'. To
  12535. allow GDB to recognize 'foo.c' as a single symbol, enclose it in single
  12536. quotes; for example,
  12537. p 'foo.c'::x
  12538. looks up the value of 'x' in the scope of the file 'foo.c'.
  12539. 'set case-sensitive on'
  12540. 'set case-sensitive off'
  12541. 'set case-sensitive auto'
  12542. Normally, when GDB looks up symbols, it matches their names with
  12543. case sensitivity determined by the current source language.
  12544. Occasionally, you may wish to control that. The command 'set
  12545. case-sensitive' lets you do that by specifying 'on' for
  12546. case-sensitive matches or 'off' for case-insensitive ones. If you
  12547. specify 'auto', case sensitivity is reset to the default suitable
  12548. for the source language. The default is case-sensitive matches for
  12549. all languages except for Fortran, for which the default is
  12550. case-insensitive matches.
  12551. 'show case-sensitive'
  12552. This command shows the current setting of case sensitivity for
  12553. symbols lookups.
  12554. 'set print type methods'
  12555. 'set print type methods on'
  12556. 'set print type methods off'
  12557. Normally, when GDB prints a class, it displays any methods declared
  12558. in that class. You can control this behavior either by passing the
  12559. appropriate flag to 'ptype', or using 'set print type methods'.
  12560. Specifying 'on' will cause GDB to display the methods; this is the
  12561. default. Specifying 'off' will cause GDB to omit the methods.
  12562. 'show print type methods'
  12563. This command shows the current setting of method display when
  12564. printing classes.
  12565. 'set print type nested-type-limit LIMIT'
  12566. 'set print type nested-type-limit unlimited'
  12567. Set the limit of displayed nested types that the type printer will
  12568. show. A LIMIT of 'unlimited' or '-1' will show all nested
  12569. definitions. By default, the type printer will not show any nested
  12570. types defined in classes.
  12571. 'show print type nested-type-limit'
  12572. This command shows the current display limit of nested types when
  12573. printing classes.
  12574. 'set print type typedefs'
  12575. 'set print type typedefs on'
  12576. 'set print type typedefs off'
  12577. Normally, when GDB prints a class, it displays any typedefs defined
  12578. in that class. You can control this behavior either by passing the
  12579. appropriate flag to 'ptype', or using 'set print type typedefs'.
  12580. Specifying 'on' will cause GDB to display the typedef definitions;
  12581. this is the default. Specifying 'off' will cause GDB to omit the
  12582. typedef definitions. Note that this controls whether the typedef
  12583. definition itself is printed, not whether typedef names are
  12584. substituted when printing other types.
  12585. 'show print type typedefs'
  12586. This command shows the current setting of typedef display when
  12587. printing classes.
  12588. 'info address SYMBOL'
  12589. Describe where the data for SYMBOL is stored. For a register
  12590. variable, this says which register it is kept in. For a
  12591. non-register local variable, this prints the stack-frame offset at
  12592. which the variable is always stored.
  12593. Note the contrast with 'print &SYMBOL', which does not work at all
  12594. for a register variable, and for a stack local variable prints the
  12595. exact address of the current instantiation of the variable.
  12596. 'info symbol ADDR'
  12597. Print the name of a symbol which is stored at the address ADDR. If
  12598. no symbol is stored exactly at ADDR, GDB prints the nearest symbol
  12599. and an offset from it:
  12600. (gdb) info symbol 0x54320
  12601. _initialize_vx + 396 in section .text
  12602. This is the opposite of the 'info address' command. You can use it
  12603. to find out the name of a variable or a function given its address.
  12604. For dynamically linked executables, the name of executable or
  12605. shared library containing the symbol is also printed:
  12606. (gdb) info symbol 0x400225
  12607. _start + 5 in section .text of /tmp/a.out
  12608. (gdb) info symbol 0x2aaaac2811cf
  12609. __read_nocancel + 6 in section .text of /usr/lib64/libc.so.6
  12610. 'demangle [-l LANGUAGE] [--] NAME'
  12611. Demangle NAME. If LANGUAGE is provided it is the name of the
  12612. language to demangle NAME in. Otherwise NAME is demangled in the
  12613. current language.
  12614. The '--' option specifies the end of options, and is useful when
  12615. NAME begins with a dash.
  12616. The parameter 'demangle-style' specifies how to interpret the kind
  12617. of mangling used. *Note Print Settings::.
  12618. 'whatis[/FLAGS] [ARG]'
  12619. Print the data type of ARG, which can be either an expression or a
  12620. name of a data type. With no argument, print the data type of '$',
  12621. the last value in the value history.
  12622. If ARG is an expression (*note Expressions: Expressions.), it is
  12623. not actually evaluated, and any side-effecting operations (such as
  12624. assignments or function calls) inside it do not take place.
  12625. If ARG is a variable or an expression, 'whatis' prints its literal
  12626. type as it is used in the source code. If the type was defined
  12627. using a 'typedef', 'whatis' will _not_ print the data type
  12628. underlying the 'typedef'. If the type of the variable or the
  12629. expression is a compound data type, such as 'struct' or 'class',
  12630. 'whatis' never prints their fields or methods. It just prints the
  12631. 'struct'/'class' name (a.k.a. its "tag"). If you want to see the
  12632. members of such a compound data type, use 'ptype'.
  12633. If ARG is a type name that was defined using 'typedef', 'whatis'
  12634. "unrolls" only one level of that 'typedef'. Unrolling means that
  12635. 'whatis' will show the underlying type used in the 'typedef'
  12636. declaration of ARG. However, if that underlying type is also a
  12637. 'typedef', 'whatis' will not unroll it.
  12638. For C code, the type names may also have the form 'class
  12639. CLASS-NAME', 'struct STRUCT-TAG', 'union UNION-TAG' or 'enum
  12640. ENUM-TAG'.
  12641. FLAGS can be used to modify how the type is displayed. Available
  12642. flags are:
  12643. 'r'
  12644. Display in "raw" form. Normally, GDB substitutes template
  12645. parameters and typedefs defined in a class when printing the
  12646. class' members. The '/r' flag disables this.
  12647. 'm'
  12648. Do not print methods defined in the class.
  12649. 'M'
  12650. Print methods defined in the class. This is the default, but
  12651. the flag exists in case you change the default with 'set print
  12652. type methods'.
  12653. 't'
  12654. Do not print typedefs defined in the class. Note that this
  12655. controls whether the typedef definition itself is printed, not
  12656. whether typedef names are substituted when printing other
  12657. types.
  12658. 'T'
  12659. Print typedefs defined in the class. This is the default, but
  12660. the flag exists in case you change the default with 'set print
  12661. type typedefs'.
  12662. 'o'
  12663. Print the offsets and sizes of fields in a struct, similar to
  12664. what the 'pahole' tool does. This option implies the '/tm'
  12665. flags.
  12666. For example, given the following declarations:
  12667. struct tuv
  12668. {
  12669. int a1;
  12670. char *a2;
  12671. int a3;
  12672. };
  12673. struct xyz
  12674. {
  12675. int f1;
  12676. char f2;
  12677. void *f3;
  12678. struct tuv f4;
  12679. };
  12680. union qwe
  12681. {
  12682. struct tuv fff1;
  12683. struct xyz fff2;
  12684. };
  12685. struct tyu
  12686. {
  12687. int a1 : 1;
  12688. int a2 : 3;
  12689. int a3 : 23;
  12690. char a4 : 2;
  12691. int64_t a5;
  12692. int a6 : 5;
  12693. int64_t a7 : 3;
  12694. };
  12695. Issuing a 'ptype /o struct tuv' command would print:
  12696. (gdb) ptype /o struct tuv
  12697. /* offset | size */ type = struct tuv {
  12698. /* 0 | 4 */ int a1;
  12699. /* XXX 4-byte hole */
  12700. /* 8 | 8 */ char *a2;
  12701. /* 16 | 4 */ int a3;
  12702. /* total size (bytes): 24 */
  12703. }
  12704. Notice the format of the first column of comments. There, you
  12705. can find two parts separated by the '|' character: the
  12706. _offset_, which indicates where the field is located inside
  12707. the struct, in bytes, and the _size_ of the field. Another
  12708. interesting line is the marker of a _hole_ in the struct,
  12709. indicating that it may be possible to pack the struct and make
  12710. it use less space by reorganizing its fields.
  12711. It is also possible to print offsets inside an union:
  12712. (gdb) ptype /o union qwe
  12713. /* offset | size */ type = union qwe {
  12714. /* 24 */ struct tuv {
  12715. /* 0 | 4 */ int a1;
  12716. /* XXX 4-byte hole */
  12717. /* 8 | 8 */ char *a2;
  12718. /* 16 | 4 */ int a3;
  12719. /* total size (bytes): 24 */
  12720. } fff1;
  12721. /* 40 */ struct xyz {
  12722. /* 0 | 4 */ int f1;
  12723. /* 4 | 1 */ char f2;
  12724. /* XXX 3-byte hole */
  12725. /* 8 | 8 */ void *f3;
  12726. /* 16 | 24 */ struct tuv {
  12727. /* 16 | 4 */ int a1;
  12728. /* XXX 4-byte hole */
  12729. /* 24 | 8 */ char *a2;
  12730. /* 32 | 4 */ int a3;
  12731. /* total size (bytes): 24 */
  12732. } f4;
  12733. /* total size (bytes): 40 */
  12734. } fff2;
  12735. /* total size (bytes): 40 */
  12736. }
  12737. In this case, since 'struct tuv' and 'struct xyz' occupy the
  12738. same space (because we are dealing with an union), the offset
  12739. is not printed for them. However, you can still examine the
  12740. offset of each of these structures' fields.
  12741. Another useful scenario is printing the offsets of a struct
  12742. containing bitfields:
  12743. (gdb) ptype /o struct tyu
  12744. /* offset | size */ type = struct tyu {
  12745. /* 0:31 | 4 */ int a1 : 1;
  12746. /* 0:28 | 4 */ int a2 : 3;
  12747. /* 0: 5 | 4 */ int a3 : 23;
  12748. /* 3: 3 | 1 */ signed char a4 : 2;
  12749. /* XXX 3-bit hole */
  12750. /* XXX 4-byte hole */
  12751. /* 8 | 8 */ int64_t a5;
  12752. /* 16: 0 | 4 */ int a6 : 5;
  12753. /* 16: 5 | 8 */ int64_t a7 : 3;
  12754. "/* XXX 7-byte padding */
  12755. /* total size (bytes): 24 */
  12756. }
  12757. Note how the offset information is now extended to also
  12758. include the first bit of the bitfield.
  12759. 'ptype[/FLAGS] [ARG]'
  12760. 'ptype' accepts the same arguments as 'whatis', but prints a
  12761. detailed description of the type, instead of just the name of the
  12762. type. *Note Expressions: Expressions.
  12763. Contrary to 'whatis', 'ptype' always unrolls any 'typedef's in its
  12764. argument declaration, whether the argument is a variable,
  12765. expression, or a data type. This means that 'ptype' of a variable
  12766. or an expression will not print literally its type as present in
  12767. the source code--use 'whatis' for that. 'typedef's at the pointer
  12768. or reference targets are also unrolled. Only 'typedef's of fields,
  12769. methods and inner 'class typedef's of 'struct's, 'class'es and
  12770. 'union's are not unrolled even with 'ptype'.
  12771. For example, for this variable declaration:
  12772. typedef double real_t;
  12773. struct complex { real_t real; double imag; };
  12774. typedef struct complex complex_t;
  12775. complex_t var;
  12776. real_t *real_pointer_var;
  12777. the two commands give this output:
  12778. (gdb) whatis var
  12779. type = complex_t
  12780. (gdb) ptype var
  12781. type = struct complex {
  12782. real_t real;
  12783. double imag;
  12784. }
  12785. (gdb) whatis complex_t
  12786. type = struct complex
  12787. (gdb) whatis struct complex
  12788. type = struct complex
  12789. (gdb) ptype struct complex
  12790. type = struct complex {
  12791. real_t real;
  12792. double imag;
  12793. }
  12794. (gdb) whatis real_pointer_var
  12795. type = real_t *
  12796. (gdb) ptype real_pointer_var
  12797. type = double *
  12798. As with 'whatis', using 'ptype' without an argument refers to the
  12799. type of '$', the last value in the value history.
  12800. Sometimes, programs use opaque data types or incomplete
  12801. specifications of complex data structure. If the debug information
  12802. included in the program does not allow GDB to display a full
  12803. declaration of the data type, it will say '<incomplete type>'. For
  12804. example, given these declarations:
  12805. struct foo;
  12806. struct foo *fooptr;
  12807. but no definition for 'struct foo' itself, GDB will say:
  12808. (gdb) ptype foo
  12809. $1 = <incomplete type>
  12810. "Incomplete type" is C terminology for data types that are not
  12811. completely specified.
  12812. Othertimes, information about a variable's type is completely
  12813. absent from the debug information included in the program. This
  12814. most often happens when the program or library where the variable
  12815. is defined includes no debug information at all. GDB knows the
  12816. variable exists from inspecting the linker/loader symbol table
  12817. (e.g., the ELF dynamic symbol table), but such symbols do not
  12818. contain type information. Inspecting the type of a (global)
  12819. variable for which GDB has no type information shows:
  12820. (gdb) ptype var
  12821. type = <data variable, no debug info>
  12822. *Note no debug info variables: Variables, for how to print the
  12823. values of such variables.
  12824. 'info types [-q] [REGEXP]'
  12825. Print a brief description of all types whose names match the
  12826. regular expression REGEXP (or all types in your program, if you
  12827. supply no argument). Each complete typename is matched as though
  12828. it were a complete line; thus, 'i type value' gives information on
  12829. all types in your program whose names include the string 'value',
  12830. but 'i type ^value$' gives information only on types whose complete
  12831. name is 'value'.
  12832. In programs using different languages, GDB chooses the syntax to
  12833. print the type description according to the 'set language' value:
  12834. using 'set language auto' (see *note Set Language Automatically:
  12835. Automatically.) means to use the language of the type, other values
  12836. mean to use the manually specified language (see *note Set Language
  12837. Manually: Manually.).
  12838. This command differs from 'ptype' in two ways: first, like
  12839. 'whatis', it does not print a detailed description; second, it
  12840. lists all source files and line numbers where a type is defined.
  12841. The output from 'into types' is proceeded with a header line
  12842. describing what types are being listed. The optional flag '-q',
  12843. which stands for 'quiet', disables printing this header
  12844. information.
  12845. 'info type-printers'
  12846. Versions of GDB that ship with Python scripting enabled may have
  12847. "type printers" available. When using 'ptype' or 'whatis', these
  12848. printers are consulted when the name of a type is needed. *Note
  12849. Type Printing API::, for more information on writing type printers.
  12850. 'info type-printers' displays all the available type printers.
  12851. 'enable type-printer NAME...'
  12852. 'disable type-printer NAME...'
  12853. These commands can be used to enable or disable type printers.
  12854. 'info scope LOCATION'
  12855. List all the variables local to a particular scope. This command
  12856. accepts a LOCATION argument--a function name, a source line, or an
  12857. address preceded by a '*', and prints all the variables local to
  12858. the scope defined by that location. (*Note Specify Location::, for
  12859. details about supported forms of LOCATION.) For example:
  12860. (gdb) info scope command_line_handler
  12861. Scope for command_line_handler:
  12862. Symbol rl is an argument at stack/frame offset 8, length 4.
  12863. Symbol linebuffer is in static storage at address 0x150a18, length 4.
  12864. Symbol linelength is in static storage at address 0x150a1c, length 4.
  12865. Symbol p is a local variable in register $esi, length 4.
  12866. Symbol p1 is a local variable in register $ebx, length 4.
  12867. Symbol nline is a local variable in register $edx, length 4.
  12868. Symbol repeat is a local variable at frame offset -8, length 4.
  12869. This command is especially useful for determining what data to
  12870. collect during a "trace experiment", see *note collect: Tracepoint
  12871. Actions.
  12872. 'info source'
  12873. Show information about the current source file--that is, the source
  12874. file for the function containing the current point of execution:
  12875. * the name of the source file, and the directory containing it,
  12876. * the directory it was compiled in,
  12877. * its length, in lines,
  12878. * which programming language it is written in,
  12879. * if the debug information provides it, the program that
  12880. compiled the file (which may include, e.g., the compiler
  12881. version and command line arguments),
  12882. * whether the executable includes debugging information for that
  12883. file, and if so, what format the information is in (e.g.,
  12884. STABS, Dwarf 2, etc.), and
  12885. * whether the debugging information includes information about
  12886. preprocessor macros.
  12887. 'info sources'
  12888. Print the names of all source files in your program for which there
  12889. is debugging information, organized into two lists: files whose
  12890. symbols have already been read, and files whose symbols will be
  12891. read when needed.
  12892. 'info sources [-dirname | -basename] [--] [REGEXP]'
  12893. Like 'info sources', but only print the names of the files matching
  12894. the provided REGEXP. By default, the REGEXP is used to match
  12895. anywhere in the filename. If '-dirname', only files having a
  12896. dirname matching REGEXP are shown. If '-basename', only files
  12897. having a basename matching REGEXP are shown. The matching is
  12898. case-sensitive, except on operating systems that have
  12899. case-insensitive filesystem (e.g., MS-Windows).
  12900. 'info functions [-q] [-n]'
  12901. Print the names and data types of all defined functions. Similarly
  12902. to 'info types', this command groups its output by source files and
  12903. annotates each function definition with its source line number.
  12904. In programs using different languages, GDB chooses the syntax to
  12905. print the function name and type according to the 'set language'
  12906. value: using 'set language auto' (see *note Set Language
  12907. Automatically: Automatically.) means to use the language of the
  12908. function, other values mean to use the manually specified language
  12909. (see *note Set Language Manually: Manually.).
  12910. The '-n' flag excludes "non-debugging symbols" from the results. A
  12911. non-debugging symbol is a symbol that comes from the executable's
  12912. symbol table, not from the debug information (for example, DWARF)
  12913. associated with the executable.
  12914. The optional flag '-q', which stands for 'quiet', disables printing
  12915. header information and messages explaining why no functions have
  12916. been printed.
  12917. 'info functions [-q] [-n] [-t TYPE_REGEXP] [REGEXP]'
  12918. Like 'info functions', but only print the names and data types of
  12919. the functions selected with the provided regexp(s).
  12920. If REGEXP is provided, print only the functions whose names match
  12921. the regular expression REGEXP. Thus, 'info fun step' finds all
  12922. functions whose names include 'step'; 'info fun ^step' finds those
  12923. whose names start with 'step'. If a function name contains
  12924. characters that conflict with the regular expression language (e.g.
  12925. 'operator*()'), they may be quoted with a backslash.
  12926. If TYPE_REGEXP is provided, print only the functions whose types,
  12927. as printed by the 'whatis' command, match the regular expression
  12928. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  12929. enclosed in quote characters. If needed, use backslash to escape
  12930. the meaning of special characters or quotes. Thus, 'info fun -t
  12931. '^int ('' finds the functions that return an integer; 'info fun -t
  12932. '(.*int.*'' finds the functions that have an argument type
  12933. containing int; 'info fun -t '^int (' ^step' finds the functions
  12934. whose names start with 'step' and that return int.
  12935. If both REGEXP and TYPE_REGEXP are provided, a function is printed
  12936. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  12937. 'info variables [-q] [-n]'
  12938. Print the names and data types of all variables that are defined
  12939. outside of functions (i.e. excluding local variables). The printed
  12940. variables are grouped by source files and annotated with their
  12941. respective source line numbers.
  12942. In programs using different languages, GDB chooses the syntax to
  12943. print the variable name and type according to the 'set language'
  12944. value: using 'set language auto' (see *note Set Language
  12945. Automatically: Automatically.) means to use the language of the
  12946. variable, other values mean to use the manually specified language
  12947. (see *note Set Language Manually: Manually.).
  12948. The '-n' flag excludes non-debugging symbols from the results.
  12949. The optional flag '-q', which stands for 'quiet', disables printing
  12950. header information and messages explaining why no variables have
  12951. been printed.
  12952. 'info variables [-q] [-n] [-t TYPE_REGEXP] [REGEXP]'
  12953. Like 'info variables', but only print the variables selected with
  12954. the provided regexp(s).
  12955. If REGEXP is provided, print only the variables whose names match
  12956. the regular expression REGEXP.
  12957. If TYPE_REGEXP is provided, print only the variables whose types,
  12958. as printed by the 'whatis' command, match the regular expression
  12959. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  12960. enclosed in quote characters. If needed, use backslash to escape
  12961. the meaning of special characters or quotes.
  12962. If both REGEXP and TYPE_REGEXP are provided, an argument is printed
  12963. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  12964. 'info modules [-q] [REGEXP]'
  12965. List all Fortran modules in the program, or all modules matching
  12966. the optional regular expression REGEXP.
  12967. The optional flag '-q', which stands for 'quiet', disables printing
  12968. header information and messages explaining why no modules have been
  12969. printed.
  12970. 'info module functions [-q] [-m MODULE-REGEXP] [-t TYPE-REGEXP] [REGEXP]'
  12971. 'info module variables [-q] [-m MODULE-REGEXP] [-t TYPE-REGEXP] [REGEXP]'
  12972. List all functions or variables within all Fortran modules. The
  12973. set of functions or variables listed can be limited by providing
  12974. some or all of the optional regular expressions. If MODULE-REGEXP
  12975. is provided, then only Fortran modules matching MODULE-REGEXP will
  12976. be searched. Only functions or variables whose type matches the
  12977. optional regular expression TYPE-REGEXP will be listed. And only
  12978. functions or variables whose name matches the optional regular
  12979. expression REGEXP will be listed.
  12980. The optional flag '-q', which stands for 'quiet', disables printing
  12981. header information and messages explaining why no functions or
  12982. variables have been printed.
  12983. 'info classes'
  12984. 'info classes REGEXP'
  12985. Display all Objective-C classes in your program, or (with the
  12986. REGEXP argument) all those matching a particular regular
  12987. expression.
  12988. 'info selectors'
  12989. 'info selectors REGEXP'
  12990. Display all Objective-C selectors in your program, or (with the
  12991. REGEXP argument) all those matching a particular regular
  12992. expression.
  12993. 'set opaque-type-resolution on'
  12994. Tell GDB to resolve opaque types. An opaque type is a type
  12995. declared as a pointer to a 'struct', 'class', or 'union'--for
  12996. example, 'struct MyType *'--that is used in one source file
  12997. although the full declaration of 'struct MyType' is in another
  12998. source file. The default is on.
  12999. A change in the setting of this subcommand will not take effect
  13000. until the next time symbols for a file are loaded.
  13001. 'set opaque-type-resolution off'
  13002. Tell GDB not to resolve opaque types. In this case, the type is
  13003. printed as follows:
  13004. {<no data fields>}
  13005. 'show opaque-type-resolution'
  13006. Show whether opaque types are resolved or not.
  13007. 'set print symbol-loading'
  13008. 'set print symbol-loading full'
  13009. 'set print symbol-loading brief'
  13010. 'set print symbol-loading off'
  13011. The 'set print symbol-loading' command allows you to control the
  13012. printing of messages when GDB loads symbol information. By default
  13013. a message is printed for the executable and one for each shared
  13014. library, and normally this is what you want. However, when
  13015. debugging apps with large numbers of shared libraries these
  13016. messages can be annoying. When set to 'brief' a message is printed
  13017. for each executable, and when GDB loads a collection of shared
  13018. libraries at once it will only print one message regardless of the
  13019. number of shared libraries. When set to 'off' no messages are
  13020. printed.
  13021. 'show print symbol-loading'
  13022. Show whether messages will be printed when a GDB command entered
  13023. from the keyboard causes symbol information to be loaded.
  13024. 'maint print symbols [-pc ADDRESS] [FILENAME]'
  13025. 'maint print symbols [-objfile OBJFILE] [-source SOURCE] [--] [FILENAME]'
  13026. 'maint print psymbols [-objfile OBJFILE] [-pc ADDRESS] [--] [FILENAME]'
  13027. 'maint print psymbols [-objfile OBJFILE] [-source SOURCE] [--] [FILENAME]'
  13028. 'maint print msymbols [-objfile OBJFILE] [--] [FILENAME]'
  13029. Write a dump of debugging symbol data into the file FILENAME or the
  13030. terminal if FILENAME is unspecified. If '-objfile OBJFILE' is
  13031. specified, only dump symbols for that objfile. If '-pc ADDRESS' is
  13032. specified, only dump symbols for the file with code at that
  13033. address. Note that ADDRESS may be a symbol like 'main'. If
  13034. '-source SOURCE' is specified, only dump symbols for that source
  13035. file.
  13036. These commands are used to debug the GDB symbol-reading code.
  13037. These commands do not modify internal GDB state, therefore 'maint
  13038. print symbols' will only print symbols for already expanded symbol
  13039. tables. You can use the command 'info sources' to find out which
  13040. files these are. If you use 'maint print psymbols' instead, the
  13041. dump shows information about symbols that GDB only knows
  13042. partially--that is, symbols defined in files that GDB has skimmed,
  13043. but not yet read completely. Finally, 'maint print msymbols' just
  13044. dumps "minimal symbols", e.g., "ELF symbols".
  13045. *Note Commands to Specify Files: Files, for a discussion of how GDB
  13046. reads symbols (in the description of 'symbol-file').
  13047. 'maint info symtabs [ REGEXP ]'
  13048. 'maint info psymtabs [ REGEXP ]'
  13049. List the 'struct symtab' or 'struct partial_symtab' structures
  13050. whose names match REGEXP. If REGEXP is not given, list them all.
  13051. The output includes expressions which you can copy into a GDB
  13052. debugging this one to examine a particular structure in more
  13053. detail. For example:
  13054. (gdb) maint info psymtabs dwarf2read
  13055. { objfile /home/gnu/build/gdb/gdb
  13056. ((struct objfile *) 0x82e69d0)
  13057. { psymtab /home/gnu/src/gdb/dwarf2read.c
  13058. ((struct partial_symtab *) 0x8474b10)
  13059. readin no
  13060. fullname (null)
  13061. text addresses 0x814d3c8 -- 0x8158074
  13062. globals (* (struct partial_symbol **) 0x8507a08 @ 9)
  13063. statics (* (struct partial_symbol **) 0x40e95b78 @ 2882)
  13064. dependencies (none)
  13065. }
  13066. }
  13067. (gdb) maint info symtabs
  13068. (gdb)
  13069. We see that there is one partial symbol table whose filename
  13070. contains the string 'dwarf2read', belonging to the 'gdb'
  13071. executable; and we see that GDB has not read in any symtabs yet at
  13072. all. If we set a breakpoint on a function, that will cause GDB to
  13073. read the symtab for the compilation unit containing that function:
  13074. (gdb) break dwarf2_psymtab_to_symtab
  13075. Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c,
  13076. line 1574.
  13077. (gdb) maint info symtabs
  13078. { objfile /home/gnu/build/gdb/gdb
  13079. ((struct objfile *) 0x82e69d0)
  13080. { symtab /home/gnu/src/gdb/dwarf2read.c
  13081. ((struct symtab *) 0x86c1f38)
  13082. dirname (null)
  13083. fullname (null)
  13084. blockvector ((struct blockvector *) 0x86c1bd0) (primary)
  13085. linetable ((struct linetable *) 0x8370fa0)
  13086. debugformat DWARF 2
  13087. }
  13088. }
  13089. (gdb)
  13090. 'maint info line-table [ REGEXP ]'
  13091. List the 'struct linetable' from all 'struct symtab' instances
  13092. whose name matches REGEXP. If REGEXP is not given, list the
  13093. 'struct linetable' from all 'struct symtab'.
  13094. 'maint set symbol-cache-size SIZE'
  13095. Set the size of the symbol cache to SIZE. The default size is
  13096. intended to be good enough for debugging most applications. This
  13097. option exists to allow for experimenting with different sizes.
  13098. 'maint show symbol-cache-size'
  13099. Show the size of the symbol cache.
  13100. 'maint print symbol-cache'
  13101. Print the contents of the symbol cache. This is useful when
  13102. debugging symbol cache issues.
  13103. 'maint print symbol-cache-statistics'
  13104. Print symbol cache usage statistics. This helps determine how well
  13105. the cache is being utilized.
  13106. 'maint flush-symbol-cache'
  13107. Flush the contents of the symbol cache, all entries are removed.
  13108. This command is useful when debugging the symbol cache. It is also
  13109. useful when collecting performance data.
  13110. 
  13111. File: gdb.info, Node: Altering, Next: GDB Files, Prev: Symbols, Up: Top
  13112. 17 Altering Execution
  13113. *********************
  13114. Once you think you have found an error in your program, you might want
  13115. to find out for certain whether correcting the apparent error would lead
  13116. to correct results in the rest of the run. You can find the answer by
  13117. experiment, using the GDB features for altering execution of the
  13118. program.
  13119. For example, you can store new values into variables or memory
  13120. locations, give your program a signal, restart it at a different
  13121. address, or even return prematurely from a function.
  13122. * Menu:
  13123. * Assignment:: Assignment to variables
  13124. * Jumping:: Continuing at a different address
  13125. * Signaling:: Giving your program a signal
  13126. * Returning:: Returning from a function
  13127. * Calling:: Calling your program's functions
  13128. * Patching:: Patching your program
  13129. * Compiling and Injecting Code:: Compiling and injecting code in GDB
  13130. 
  13131. File: gdb.info, Node: Assignment, Next: Jumping, Up: Altering
  13132. 17.1 Assignment to Variables
  13133. ============================
  13134. To alter the value of a variable, evaluate an assignment expression.
  13135. *Note Expressions: Expressions. For example,
  13136. print x=4
  13137. stores the value 4 into the variable 'x', and then prints the value of
  13138. the assignment expression (which is 4). *Note Using GDB with Different
  13139. Languages: Languages, for more information on operators in supported
  13140. languages.
  13141. If you are not interested in seeing the value of the assignment, use
  13142. the 'set' command instead of the 'print' command. 'set' is really the
  13143. same as 'print' except that the expression's value is not printed and is
  13144. not put in the value history (*note Value History: Value History.). The
  13145. expression is evaluated only for its effects.
  13146. If the beginning of the argument string of the 'set' command appears
  13147. identical to a 'set' subcommand, use the 'set variable' command instead
  13148. of just 'set'. This command is identical to 'set' except for its lack
  13149. of subcommands. For example, if your program has a variable 'width',
  13150. you get an error if you try to set a new value with just 'set width=13',
  13151. because GDB has the command 'set width':
  13152. (gdb) whatis width
  13153. type = double
  13154. (gdb) p width
  13155. $4 = 13
  13156. (gdb) set width=47
  13157. Invalid syntax in expression.
  13158. The invalid expression, of course, is '=47'. In order to actually set
  13159. the program's variable 'width', use
  13160. (gdb) set var width=47
  13161. Because the 'set' command has many subcommands that can conflict with
  13162. the names of program variables, it is a good idea to use the 'set
  13163. variable' command instead of just 'set'. For example, if your program
  13164. has a variable 'g', you run into problems if you try to set a new value
  13165. with just 'set g=4', because GDB has the command 'set gnutarget',
  13166. abbreviated 'set g':
  13167. (gdb) whatis g
  13168. type = double
  13169. (gdb) p g
  13170. $1 = 1
  13171. (gdb) set g=4
  13172. (gdb) p g
  13173. $2 = 1
  13174. (gdb) r
  13175. The program being debugged has been started already.
  13176. Start it from the beginning? (y or n) y
  13177. Starting program: /home/smith/cc_progs/a.out
  13178. "/home/smith/cc_progs/a.out": can't open to read symbols:
  13179. Invalid bfd target.
  13180. (gdb) show g
  13181. The current BFD target is "=4".
  13182. The program variable 'g' did not change, and you silently set the
  13183. 'gnutarget' to an invalid value. In order to set the variable 'g', use
  13184. (gdb) set var g=4
  13185. GDB allows more implicit conversions in assignments than C; you can
  13186. freely store an integer value into a pointer variable or vice versa, and
  13187. you can convert any structure to any other structure that is the same
  13188. length or shorter.
  13189. To store values into arbitrary places in memory, use the '{...}'
  13190. construct to generate a value of specified type at a specified address
  13191. (*note Expressions: Expressions.). For example, '{int}0x83040' refers
  13192. to memory location '0x83040' as an integer (which implies a certain size
  13193. and representation in memory), and
  13194. set {int}0x83040 = 4
  13195. stores the value 4 into that memory location.
  13196. 
  13197. File: gdb.info, Node: Jumping, Next: Signaling, Prev: Assignment, Up: Altering
  13198. 17.2 Continuing at a Different Address
  13199. ======================================
  13200. Ordinarily, when you continue your program, you do so at the place where
  13201. it stopped, with the 'continue' command. You can instead continue at an
  13202. address of your own choosing, with the following commands:
  13203. 'jump LOCATION'
  13204. 'j LOCATION'
  13205. Resume execution at LOCATION. Execution stops again immediately if
  13206. there is a breakpoint there. *Note Specify Location::, for a
  13207. description of the different forms of LOCATION. It is common
  13208. practice to use the 'tbreak' command in conjunction with 'jump'.
  13209. *Note Setting Breakpoints: Set Breaks.
  13210. The 'jump' command does not change the current stack frame, or the
  13211. stack pointer, or the contents of any memory location or any
  13212. register other than the program counter. If LOCATION is in a
  13213. different function from the one currently executing, the results
  13214. may be bizarre if the two functions expect different patterns of
  13215. arguments or of local variables. For this reason, the 'jump'
  13216. command requests confirmation if the specified line is not in the
  13217. function currently executing. However, even bizarre results are
  13218. predictable if you are well acquainted with the machine-language
  13219. code of your program.
  13220. On many systems, you can get much the same effect as the 'jump'
  13221. command by storing a new value into the register '$pc'. The difference
  13222. is that this does not start your program running; it only changes the
  13223. address of where it _will_ run when you continue. For example,
  13224. set $pc = 0x485
  13225. makes the next 'continue' command or stepping command execute at address
  13226. '0x485', rather than at the address where your program stopped. *Note
  13227. Continuing and Stepping: Continuing and Stepping.
  13228. The most common occasion to use the 'jump' command is to back
  13229. up--perhaps with more breakpoints set--over a portion of a program that
  13230. has already executed, in order to examine its execution in more detail.
  13231. 
  13232. File: gdb.info, Node: Signaling, Next: Returning, Prev: Jumping, Up: Altering
  13233. 17.3 Giving your Program a Signal
  13234. =================================
  13235. 'signal SIGNAL'
  13236. Resume execution where your program is stopped, but immediately
  13237. give it the signal SIGNAL. The SIGNAL can be the name or the
  13238. number of a signal. For example, on many systems 'signal 2' and
  13239. 'signal SIGINT' are both ways of sending an interrupt signal.
  13240. Alternatively, if SIGNAL is zero, continue execution without giving
  13241. a signal. This is useful when your program stopped on account of a
  13242. signal and would ordinarily see the signal when resumed with the
  13243. 'continue' command; 'signal 0' causes it to resume without a
  13244. signal.
  13245. _Note:_ When resuming a multi-threaded program, SIGNAL is delivered
  13246. to the currently selected thread, not the thread that last reported
  13247. a stop. This includes the situation where a thread was stopped due
  13248. to a signal. So if you want to continue execution suppressing the
  13249. signal that stopped a thread, you should select that same thread
  13250. before issuing the 'signal 0' command. If you issue the 'signal 0'
  13251. command with another thread as the selected one, GDB detects that
  13252. and asks for confirmation.
  13253. Invoking the 'signal' command is not the same as invoking the
  13254. 'kill' utility from the shell. Sending a signal with 'kill' causes
  13255. GDB to decide what to do with the signal depending on the signal
  13256. handling tables (*note Signals::). The 'signal' command passes the
  13257. signal directly to your program.
  13258. 'signal' does not repeat when you press <RET> a second time after
  13259. executing the command.
  13260. 'queue-signal SIGNAL'
  13261. Queue SIGNAL to be delivered immediately to the current thread when
  13262. execution of the thread resumes. The SIGNAL can be the name or the
  13263. number of a signal. For example, on many systems 'signal 2' and
  13264. 'signal SIGINT' are both ways of sending an interrupt signal. The
  13265. handling of the signal must be set to pass the signal to the
  13266. program, otherwise GDB will report an error. You can control the
  13267. handling of signals from GDB with the 'handle' command (*note
  13268. Signals::).
  13269. Alternatively, if SIGNAL is zero, any currently queued signal for
  13270. the current thread is discarded and when execution resumes no
  13271. signal will be delivered. This is useful when your program stopped
  13272. on account of a signal and would ordinarily see the signal when
  13273. resumed with the 'continue' command.
  13274. This command differs from the 'signal' command in that the signal
  13275. is just queued, execution is not resumed. And 'queue-signal'
  13276. cannot be used to pass a signal whose handling state has been set
  13277. to 'nopass' (*note Signals::).
  13278. *Note stepping into signal handlers::, for information on how
  13279. stepping commands behave when the thread has a signal queued.
  13280. 
  13281. File: gdb.info, Node: Returning, Next: Calling, Prev: Signaling, Up: Altering
  13282. 17.4 Returning from a Function
  13283. ==============================
  13284. 'return'
  13285. 'return EXPRESSION'
  13286. You can cancel execution of a function call with the 'return'
  13287. command. If you give an EXPRESSION argument, its value is used as
  13288. the function's return value.
  13289. When you use 'return', GDB discards the selected stack frame (and all
  13290. frames within it). You can think of this as making the discarded frame
  13291. return prematurely. If you wish to specify a value to be returned, give
  13292. that value as the argument to 'return'.
  13293. This pops the selected stack frame (*note Selecting a Frame:
  13294. Selection.), and any other frames inside of it, leaving its caller as
  13295. the innermost remaining frame. That frame becomes selected. The
  13296. specified value is stored in the registers used for returning values of
  13297. functions.
  13298. The 'return' command does not resume execution; it leaves the program
  13299. stopped in the state that would exist if the function had just returned.
  13300. In contrast, the 'finish' command (*note Continuing and Stepping:
  13301. Continuing and Stepping.) resumes execution until the selected stack
  13302. frame returns naturally.
  13303. GDB needs to know how the EXPRESSION argument should be set for the
  13304. inferior. The concrete registers assignment depends on the OS ABI and
  13305. the type being returned by the selected stack frame. For example it is
  13306. common for OS ABI to return floating point values in FPU registers while
  13307. integer values in CPU registers. Still some ABIs return even floating
  13308. point values in CPU registers. Larger integer widths (such as 'long
  13309. long int') also have specific placement rules. GDB already knows the OS
  13310. ABI from its current target so it needs to find out also the type being
  13311. returned to make the assignment into the right register(s).
  13312. Normally, the selected stack frame has debug info. GDB will always
  13313. use the debug info instead of the implicit type of EXPRESSION when the
  13314. debug info is available. For example, if you type 'return -1', and the
  13315. function in the current stack frame is declared to return a 'long long
  13316. int', GDB transparently converts the implicit 'int' value of -1 into a
  13317. 'long long int':
  13318. Breakpoint 1, func () at gdb.base/return-nodebug.c:29
  13319. 29 return 31;
  13320. (gdb) return -1
  13321. Make func return now? (y or n) y
  13322. #0 0x004004f6 in main () at gdb.base/return-nodebug.c:43
  13323. 43 printf ("result=%lld\n", func ());
  13324. (gdb)
  13325. However, if the selected stack frame does not have a debug info,
  13326. e.g., if the function was compiled without debug info, GDB has to find
  13327. out the type to return from user. Specifying a different type by
  13328. mistake may set the value in different inferior registers than the
  13329. caller code expects. For example, typing 'return -1' with its implicit
  13330. type 'int' would set only a part of a 'long long int' result for a debug
  13331. info less function (on 32-bit architectures). Therefore the user is
  13332. required to specify the return type by an appropriate cast explicitly:
  13333. Breakpoint 2, 0x0040050b in func ()
  13334. (gdb) return -1
  13335. Return value type not available for selected stack frame.
  13336. Please use an explicit cast of the value to return.
  13337. (gdb) return (long long int) -1
  13338. Make selected stack frame return now? (y or n) y
  13339. #0 0x00400526 in main ()
  13340. (gdb)
  13341. 
  13342. File: gdb.info, Node: Calling, Next: Patching, Prev: Returning, Up: Altering
  13343. 17.5 Calling Program Functions
  13344. ==============================
  13345. 'print EXPR'
  13346. Evaluate the expression EXPR and display the resulting value. The
  13347. expression may include calls to functions in the program being
  13348. debugged.
  13349. 'call EXPR'
  13350. Evaluate the expression EXPR without displaying 'void' returned
  13351. values.
  13352. You can use this variant of the 'print' command if you want to
  13353. execute a function from your program that does not return anything
  13354. (a.k.a. "a void function"), but without cluttering the output with
  13355. 'void' returned values that GDB will otherwise print. If the
  13356. result is not void, it is printed and saved in the value history.
  13357. It is possible for the function you call via the 'print' or 'call'
  13358. command to generate a signal (e.g., if there's a bug in the function, or
  13359. if you passed it incorrect arguments). What happens in that case is
  13360. controlled by the 'set unwindonsignal' command.
  13361. Similarly, with a C++ program it is possible for the function you
  13362. call via the 'print' or 'call' command to generate an exception that is
  13363. not handled due to the constraints of the dummy frame. In this case,
  13364. any exception that is raised in the frame, but has an out-of-frame
  13365. exception handler will not be found. GDB builds a dummy-frame for the
  13366. inferior function call, and the unwinder cannot seek for exception
  13367. handlers outside of this dummy-frame. What happens in that case is
  13368. controlled by the 'set unwind-on-terminating-exception' command.
  13369. 'set unwindonsignal'
  13370. Set unwinding of the stack if a signal is received while in a
  13371. function that GDB called in the program being debugged. If set to
  13372. on, GDB unwinds the stack it created for the call and restores the
  13373. context to what it was before the call. If set to off (the
  13374. default), GDB stops in the frame where the signal was received.
  13375. 'show unwindonsignal'
  13376. Show the current setting of stack unwinding in the functions called
  13377. by GDB.
  13378. 'set unwind-on-terminating-exception'
  13379. Set unwinding of the stack if a C++ exception is raised, but left
  13380. unhandled while in a function that GDB called in the program being
  13381. debugged. If set to on (the default), GDB unwinds the stack it
  13382. created for the call and restores the context to what it was before
  13383. the call. If set to off, GDB the exception is delivered to the
  13384. default C++ exception handler and the inferior terminated.
  13385. 'show unwind-on-terminating-exception'
  13386. Show the current setting of stack unwinding in the functions called
  13387. by GDB.
  13388. 'set may-call-functions'
  13389. Set permission to call functions in the program. This controls
  13390. whether GDB will attempt to call functions in the program, such as
  13391. with expressions in the 'print' command. It defaults to 'on'.
  13392. To call a function in the program, GDB has to temporarily modify
  13393. the state of the inferior. This has potentially undesired side
  13394. effects. Also, having GDB call nested functions is likely to be
  13395. erroneous and may even crash the program being debugged. You can
  13396. avoid such hazards by forbidding GDB from calling functions in the
  13397. program being debugged. If calling functions in the program is
  13398. forbidden, GDB will throw an error when a command (such as printing
  13399. an expression) starts a function call in the program.
  13400. 'show may-call-functions'
  13401. Show permission to call functions in the program.
  13402. 17.5.1 Calling functions with no debug info
  13403. -------------------------------------------
  13404. Sometimes, a function you wish to call is missing debug information. In
  13405. such case, GDB does not know the type of the function, including the
  13406. types of the function's parameters. To avoid calling the inferior
  13407. function incorrectly, which could result in the called function
  13408. functioning erroneously and even crash, GDB refuses to call the function
  13409. unless you tell it the type of the function.
  13410. For prototyped (i.e. ANSI/ISO style) functions, there are two ways to
  13411. do that. The simplest is to cast the call to the function's declared
  13412. return type. For example:
  13413. (gdb) p getenv ("PATH")
  13414. 'getenv' has unknown return type; cast the call to its declared return type
  13415. (gdb) p (char *) getenv ("PATH")
  13416. $1 = 0x7fffffffe7ba "/usr/local/bin:/"...
  13417. Casting the return type of a no-debug function is equivalent to
  13418. casting the function to a pointer to a prototyped function that has a
  13419. prototype that matches the types of the passed-in arguments, and calling
  13420. that. I.e., the call above is equivalent to:
  13421. (gdb) p ((char * (*) (const char *)) getenv) ("PATH")
  13422. and given this prototyped C or C++ function with float parameters:
  13423. float multiply (float v1, float v2) { return v1 * v2; }
  13424. these calls are equivalent:
  13425. (gdb) p (float) multiply (2.0f, 3.0f)
  13426. (gdb) p ((float (*) (float, float)) multiply) (2.0f, 3.0f)
  13427. If the function you wish to call is declared as unprototyped (i.e.
  13428. old K&R style), you must use the cast-to-function-pointer syntax, so
  13429. that GDB knows that it needs to apply default argument promotions
  13430. (promote float arguments to double). *Note float promotion: ABI. For
  13431. example, given this unprototyped C function with float parameters, and
  13432. no debug info:
  13433. float
  13434. multiply_noproto (v1, v2)
  13435. float v1, v2;
  13436. {
  13437. return v1 * v2;
  13438. }
  13439. you call it like this:
  13440. (gdb) p ((float (*) ()) multiply_noproto) (2.0f, 3.0f)
  13441. 
  13442. File: gdb.info, Node: Patching, Next: Compiling and Injecting Code, Prev: Calling, Up: Altering
  13443. 17.6 Patching Programs
  13444. ======================
  13445. By default, GDB opens the file containing your program's executable code
  13446. (or the corefile) read-only. This prevents accidental alterations to
  13447. machine code; but it also prevents you from intentionally patching your
  13448. program's binary.
  13449. If you'd like to be able to patch the binary, you can specify that
  13450. explicitly with the 'set write' command. For example, you might want to
  13451. turn on internal debugging flags, or even to make emergency repairs.
  13452. 'set write on'
  13453. 'set write off'
  13454. If you specify 'set write on', GDB opens executable and core files
  13455. for both reading and writing; if you specify 'set write off' (the
  13456. default), GDB opens them read-only.
  13457. If you have already loaded a file, you must load it again (using
  13458. the 'exec-file' or 'core-file' command) after changing 'set write',
  13459. for your new setting to take effect.
  13460. 'show write'
  13461. Display whether executable files and core files are opened for
  13462. writing as well as reading.
  13463. 
  13464. File: gdb.info, Node: Compiling and Injecting Code, Prev: Patching, Up: Altering
  13465. 17.7 Compiling and injecting code in GDB
  13466. ========================================
  13467. GDB supports on-demand compilation and code injection into programs
  13468. running under GDB. GCC 5.0 or higher built with 'libcc1.so' must be
  13469. installed for this functionality to be enabled. This functionality is
  13470. implemented with the following commands.
  13471. 'compile code SOURCE-CODE'
  13472. 'compile code -raw -- SOURCE-CODE'
  13473. Compile SOURCE-CODE with the compiler language found as the current
  13474. language in GDB (*note Languages::). If compilation and injection
  13475. is not supported with the current language specified in GDB, or the
  13476. compiler does not support this feature, an error message will be
  13477. printed. If SOURCE-CODE compiles and links successfully, GDB will
  13478. load the object-code emitted, and execute it within the context of
  13479. the currently selected inferior. It is important to note that the
  13480. compiled code is executed immediately. After execution, the
  13481. compiled code is removed from GDB and any new types or variables
  13482. you have defined will be deleted.
  13483. The command allows you to specify SOURCE-CODE in two ways. The
  13484. simplest method is to provide a single line of code to the command.
  13485. E.g.:
  13486. compile code printf ("hello world\n");
  13487. If you specify options on the command line as well as source code,
  13488. they may conflict. The '--' delimiter can be used to separate
  13489. options from actual source code. E.g.:
  13490. compile code -r -- printf ("hello world\n");
  13491. Alternatively you can enter source code as multiple lines of text.
  13492. To enter this mode, invoke the 'compile code' command without any
  13493. text following the command. This will start the multiple-line
  13494. editor and allow you to type as many lines of source code as
  13495. required. When you have completed typing, enter 'end' on its own
  13496. line to exit the editor.
  13497. compile code
  13498. >printf ("hello\n");
  13499. >printf ("world\n");
  13500. >end
  13501. Specifying '-raw', prohibits GDB from wrapping the provided
  13502. SOURCE-CODE in a callable scope. In this case, you must specify
  13503. the entry point of the code by defining a function named
  13504. '_gdb_expr_'. The '-raw' code cannot access variables of the
  13505. inferior. Using '-raw' option may be needed for example when
  13506. SOURCE-CODE requires '#include' lines which may conflict with
  13507. inferior symbols otherwise.
  13508. 'compile file FILENAME'
  13509. 'compile file -raw FILENAME'
  13510. Like 'compile code', but take the source code from FILENAME.
  13511. compile file /home/user/example.c
  13512. 'compile print [[OPTIONS] --] EXPR'
  13513. 'compile print [[OPTIONS] --] /F EXPR'
  13514. Compile and execute EXPR with the compiler language found as the
  13515. current language in GDB (*note Languages::). By default the value
  13516. of EXPR is printed in a format appropriate to its data type; you
  13517. can choose a different format by specifying '/F', where F is a
  13518. letter specifying the format; see *note Output Formats: Output
  13519. Formats. The 'compile print' command accepts the same options as
  13520. the 'print' command; see *note print options::.
  13521. 'compile print [[OPTIONS] --]'
  13522. 'compile print [[OPTIONS] --] /F'
  13523. Alternatively you can enter the expression (source code producing
  13524. it) as multiple lines of text. To enter this mode, invoke the
  13525. 'compile print' command without any text following the command.
  13526. This will start the multiple-line editor.
  13527. The process of compiling and injecting the code can be inspected using:
  13528. 'set debug compile'
  13529. Turns on or off display of GDB process of compiling and injecting
  13530. the code. The default is off.
  13531. 'show debug compile'
  13532. Displays the current state of displaying GDB process of compiling
  13533. and injecting the code.
  13534. 'set debug compile-cplus-types'
  13535. Turns on or off the display of C++ type conversion debugging
  13536. information. The default is off.
  13537. 'show debug compile-cplus-types'
  13538. Displays the current state of displaying debugging information for
  13539. C++ type conversion.
  13540. 17.7.1 Compilation options for the 'compile' command
  13541. ----------------------------------------------------
  13542. GDB needs to specify the right compilation options for the code to be
  13543. injected, in part to make its ABI compatible with the inferior and in
  13544. part to make the injected code compatible with GDB's injecting process.
  13545. The options used, in increasing precedence:
  13546. target architecture and OS options ('gdbarch')
  13547. These options depend on target processor type and target operating
  13548. system, usually they specify at least 32-bit ('-m32') or 64-bit
  13549. ('-m64') compilation option.
  13550. compilation options recorded in the target
  13551. GCC (since version 4.7) stores the options used for compilation
  13552. into 'DW_AT_producer' part of DWARF debugging information according
  13553. to the GCC option '-grecord-gcc-switches'. One has to explicitly
  13554. specify '-g' during inferior compilation otherwise GCC produces no
  13555. DWARF. This feature is only relevant for platforms where '-g'
  13556. produces DWARF by default, otherwise one may try to enforce DWARF
  13557. by using '-gdwarf-4'.
  13558. compilation options set by 'set compile-args'
  13559. You can override compilation options using the following command:
  13560. 'set compile-args'
  13561. Set compilation options used for compiling and injecting code with
  13562. the 'compile' commands. These options override any conflicting
  13563. ones from the target architecture and/or options stored during
  13564. inferior compilation.
  13565. 'show compile-args'
  13566. Displays the current state of compilation options override. This
  13567. does not show all the options actually used during compilation, use
  13568. *note set debug compile:: for that.
  13569. 17.7.2 Caveats when using the 'compile' command
  13570. -----------------------------------------------
  13571. There are a few caveats to keep in mind when using the 'compile'
  13572. command. As the caveats are different per language, the table below
  13573. highlights specific issues on a per language basis.
  13574. C code examples and caveats
  13575. When the language in GDB is set to 'C', the compiler will attempt
  13576. to compile the source code with a 'C' compiler. The source code
  13577. provided to the 'compile' command will have much the same access to
  13578. variables and types as it normally would if it were part of the
  13579. program currently being debugged in GDB.
  13580. Below is a sample program that forms the basis of the examples that
  13581. follow. This program has been compiled and loaded into GDB, much
  13582. like any other normal debugging session.
  13583. void function1 (void)
  13584. {
  13585. int i = 42;
  13586. printf ("function 1\n");
  13587. }
  13588. void function2 (void)
  13589. {
  13590. int j = 12;
  13591. function1 ();
  13592. }
  13593. int main(void)
  13594. {
  13595. int k = 6;
  13596. int *p;
  13597. function2 ();
  13598. return 0;
  13599. }
  13600. For the purposes of the examples in this section, the program above
  13601. has been compiled, loaded into GDB, stopped at the function 'main',
  13602. and GDB is awaiting input from the user.
  13603. To access variables and types for any program in GDB, the program
  13604. must be compiled and packaged with debug information. The
  13605. 'compile' command is not an exception to this rule. Without debug
  13606. information, you can still use the 'compile' command, but you will
  13607. be very limited in what variables and types you can access.
  13608. So with that in mind, the example above has been compiled with
  13609. debug information enabled. The 'compile' command will have access
  13610. to all variables and types (except those that may have been
  13611. optimized out). Currently, as GDB has stopped the program in the
  13612. 'main' function, the 'compile' command would have access to the
  13613. variable 'k'. You could invoke the 'compile' command and type some
  13614. source code to set the value of 'k'. You can also read it, or do
  13615. anything with that variable you would normally do in 'C'. Be aware
  13616. that changes to inferior variables in the 'compile' command are
  13617. persistent. In the following example:
  13618. compile code k = 3;
  13619. the variable 'k' is now 3. It will retain that value until
  13620. something else in the example program changes it, or another
  13621. 'compile' command changes it.
  13622. Normal scope and access rules apply to source code compiled and
  13623. injected by the 'compile' command. In the example, the variables
  13624. 'j' and 'k' are not accessible yet, because the program is
  13625. currently stopped in the 'main' function, where these variables are
  13626. not in scope. Therefore, the following command
  13627. compile code j = 3;
  13628. will result in a compilation error message.
  13629. Once the program is continued, execution will bring these variables
  13630. in scope, and they will become accessible; then the code you
  13631. specify via the 'compile' command will be able to access them.
  13632. You can create variables and types with the 'compile' command as
  13633. part of your source code. Variables and types that are created as
  13634. part of the 'compile' command are not visible to the rest of the
  13635. program for the duration of its run. This example is valid:
  13636. compile code int ff = 5; printf ("ff is %d\n", ff);
  13637. However, if you were to type the following into GDB after that
  13638. command has completed:
  13639. compile code printf ("ff is %d\n'', ff);
  13640. a compiler error would be raised as the variable 'ff' no longer
  13641. exists. Object code generated and injected by the 'compile'
  13642. command is removed when its execution ends. Caution is advised
  13643. when assigning to program variables values of variables created by
  13644. the code submitted to the 'compile' command. This example is
  13645. valid:
  13646. compile code int ff = 5; k = ff;
  13647. The value of the variable 'ff' is assigned to 'k'. The variable
  13648. 'k' does not require the existence of 'ff' to maintain the value it
  13649. has been assigned. However, pointers require particular care in
  13650. assignment. If the source code compiled with the 'compile' command
  13651. changed the address of a pointer in the example program, perhaps to
  13652. a variable created in the 'compile' command, that pointer would
  13653. point to an invalid location when the command exits. The following
  13654. example would likely cause issues with your debugged program:
  13655. compile code int ff = 5; p = &ff;
  13656. In this example, 'p' would point to 'ff' when the 'compile' command
  13657. is executing the source code provided to it. However, as variables
  13658. in the (example) program persist with their assigned values, the
  13659. variable 'p' would point to an invalid location when the command
  13660. exists. A general rule should be followed in that you should
  13661. either assign 'NULL' to any assigned pointers, or restore a valid
  13662. location to the pointer before the command exits.
  13663. Similar caution must be exercised with any structs, unions, and
  13664. typedefs defined in 'compile' command. Types defined in the
  13665. 'compile' command will no longer be available in the next 'compile'
  13666. command. Therefore, if you cast a variable to a type defined in
  13667. the 'compile' command, care must be taken to ensure that any future
  13668. need to resolve the type can be achieved.
  13669. (gdb) compile code static struct a { int a; } v = { 42 }; argv = &v;
  13670. (gdb) compile code printf ("%d\n", ((struct a *) argv)->a);
  13671. gdb command line:1:36: error: dereferencing pointer to incomplete type ‘struct a’
  13672. Compilation failed.
  13673. (gdb) compile code struct a { int a; }; printf ("%d\n", ((struct a *) argv)->a);
  13674. 42
  13675. Variables that have been optimized away by the compiler are not
  13676. accessible to the code submitted to the 'compile' command. Access
  13677. to those variables will generate a compiler error which GDB will
  13678. print to the console.
  13679. 17.7.3 Compiler search for the 'compile' command
  13680. ------------------------------------------------
  13681. GDB needs to find GCC for the inferior being debugged which may not be
  13682. obvious for remote targets of different architecture than where GDB is
  13683. running. Environment variable 'PATH' on GDB host is searched for GCC
  13684. binary matching the target architecture and operating system. This
  13685. search can be overriden by 'set compile-gcc' GDB command below. 'PATH'
  13686. is taken from shell that executed GDB, it is not the value set by GDB
  13687. command 'set environment'). *Note Environment::.
  13688. Specifically 'PATH' is searched for binaries matching regular
  13689. expression 'ARCH(-[^-]*)?-OS-gcc' according to the inferior target being
  13690. debugged. ARCH is processor name -- multiarch is supported, so for
  13691. example both 'i386' and 'x86_64' targets look for pattern
  13692. '(x86_64|i.86)' and both 's390' and 's390x' targets look for pattern
  13693. 's390x?'. OS is currently supported only for pattern 'linux(-gnu)?'.
  13694. On Posix hosts the compiler driver GDB needs to find also shared
  13695. library 'libcc1.so' from the compiler. It is searched in default shared
  13696. library search path (overridable with usual environment variable
  13697. 'LD_LIBRARY_PATH'), unrelated to 'PATH' or 'set compile-gcc' settings.
  13698. Contrary to it 'libcc1plugin.so' is found according to the installation
  13699. of the found compiler -- as possibly specified by the 'set compile-gcc'
  13700. command.
  13701. 'set compile-gcc'
  13702. Set compilation command used for compiling and injecting code with
  13703. the 'compile' commands. If this option is not set (it is set to an
  13704. empty string), the search described above will occur -- that is the
  13705. default.
  13706. 'show compile-gcc'
  13707. Displays the current compile command GCC driver filename. If set,
  13708. it is the main command 'gcc', found usually for example under name
  13709. 'x86_64-linux-gnu-gcc'.
  13710. 
  13711. File: gdb.info, Node: GDB Files, Next: Targets, Prev: Altering, Up: Top
  13712. 18 GDB Files
  13713. ************
  13714. GDB needs to know the file name of the program to be debugged, both in
  13715. order to read its symbol table and in order to start your program. To
  13716. debug a core dump of a previous run, you must also tell GDB the name of
  13717. the core dump file.
  13718. * Menu:
  13719. * Files:: Commands to specify files
  13720. * File Caching:: Information about GDB's file caching
  13721. * Separate Debug Files:: Debugging information in separate files
  13722. * MiniDebugInfo:: Debugging information in a special section
  13723. * Index Files:: Index files speed up GDB
  13724. * Symbol Errors:: Errors reading symbol files
  13725. * Data Files:: GDB data files
  13726. 
  13727. File: gdb.info, Node: Files, Next: File Caching, Up: GDB Files
  13728. 18.1 Commands to Specify Files
  13729. ==============================
  13730. You may want to specify executable and core dump file names. The usual
  13731. way to do this is at start-up time, using the arguments to GDB's
  13732. start-up commands (*note Getting In and Out of GDB: Invocation.).
  13733. Occasionally it is necessary to change to a different file during a
  13734. GDB session. Or you may run GDB and forget to specify a file you want
  13735. to use. Or you are debugging a remote target via 'gdbserver' (*note
  13736. file: Server.). In these situations the GDB commands to specify new
  13737. files are useful.
  13738. 'file FILENAME'
  13739. Use FILENAME as the program to be debugged. It is read for its
  13740. symbols and for the contents of pure memory. It is also the
  13741. program executed when you use the 'run' command. If you do not
  13742. specify a directory and the file is not found in the GDB working
  13743. directory, GDB uses the environment variable 'PATH' as a list of
  13744. directories to search, just as the shell does when looking for a
  13745. program to run. You can change the value of this variable, for
  13746. both GDB and your program, using the 'path' command.
  13747. You can load unlinked object '.o' files into GDB using the 'file'
  13748. command. You will not be able to "run" an object file, but you can
  13749. disassemble functions and inspect variables. Also, if the
  13750. underlying BFD functionality supports it, you could use 'gdb
  13751. -write' to patch object files using this technique. Note that GDB
  13752. can neither interpret nor modify relocations in this case, so
  13753. branches and some initialized variables will appear to go to the
  13754. wrong place. But this feature is still handy from time to time.
  13755. 'file'
  13756. 'file' with no argument makes GDB discard any information it has on
  13757. both executable file and the symbol table.
  13758. 'exec-file [ FILENAME ]'
  13759. Specify that the program to be run (but not the symbol table) is
  13760. found in FILENAME. GDB searches the environment variable 'PATH' if
  13761. necessary to locate your program. Omitting FILENAME means to
  13762. discard information on the executable file.
  13763. 'symbol-file [ FILENAME [ -o OFFSET ]]'
  13764. Read symbol table information from file FILENAME. 'PATH' is
  13765. searched when necessary. Use the 'file' command to get both symbol
  13766. table and program to run from the same file.
  13767. If an optional OFFSET is specified, it is added to the start
  13768. address of each section in the symbol file. This is useful if the
  13769. program is relocated at runtime, such as the Linux kernel with
  13770. kASLR enabled.
  13771. 'symbol-file' with no argument clears out GDB information on your
  13772. program's symbol table.
  13773. The 'symbol-file' command causes GDB to forget the contents of some
  13774. breakpoints and auto-display expressions. This is because they may
  13775. contain pointers to the internal data recording symbols and data
  13776. types, which are part of the old symbol table data being discarded
  13777. inside GDB.
  13778. 'symbol-file' does not repeat if you press <RET> again after
  13779. executing it once.
  13780. When GDB is configured for a particular environment, it understands
  13781. debugging information in whatever format is the standard generated
  13782. for that environment; you may use either a GNU compiler, or other
  13783. compilers that adhere to the local conventions. Best results are
  13784. usually obtained from GNU compilers; for example, using 'GCC' you
  13785. can generate debugging information for optimized code.
  13786. For most kinds of object files, with the exception of old SVR3
  13787. systems using COFF, the 'symbol-file' command does not normally
  13788. read the symbol table in full right away. Instead, it scans the
  13789. symbol table quickly to find which source files and which symbols
  13790. are present. The details are read later, one source file at a
  13791. time, as they are needed.
  13792. The purpose of this two-stage reading strategy is to make GDB start
  13793. up faster. For the most part, it is invisible except for
  13794. occasional pauses while the symbol table details for a particular
  13795. source file are being read. (The 'set verbose' command can turn
  13796. these pauses into messages if desired. *Note Optional Warnings and
  13797. Messages: Messages/Warnings.)
  13798. We have not implemented the two-stage strategy for COFF yet. When
  13799. the symbol table is stored in COFF format, 'symbol-file' reads the
  13800. symbol table data in full right away. Note that "stabs-in-COFF"
  13801. still does the two-stage strategy, since the debug info is actually
  13802. in stabs format.
  13803. 'symbol-file [ -readnow ] FILENAME'
  13804. 'file [ -readnow ] FILENAME'
  13805. You can override the GDB two-stage strategy for reading symbol
  13806. tables by using the '-readnow' option with any of the commands that
  13807. load symbol table information, if you want to be sure GDB has the
  13808. entire symbol table available.
  13809. 'symbol-file [ -readnever ] FILENAME'
  13810. 'file [ -readnever ] FILENAME'
  13811. You can instruct GDB to never read the symbolic information
  13812. contained in FILENAME by using the '-readnever' option. *Note
  13813. --readnever::.
  13814. 'core-file [FILENAME]'
  13815. 'core'
  13816. Specify the whereabouts of a core dump file to be used as the
  13817. "contents of memory". Traditionally, core files contain only some
  13818. parts of the address space of the process that generated them; GDB
  13819. can access the executable file itself for other parts.
  13820. 'core-file' with no argument specifies that no core file is to be
  13821. used.
  13822. Note that the core file is ignored when your program is actually
  13823. running under GDB. So, if you have been running your program and
  13824. you wish to debug a core file instead, you must kill the subprocess
  13825. in which the program is running. To do this, use the 'kill'
  13826. command (*note Killing the Child Process: Kill Process.).
  13827. 'add-symbol-file FILENAME [ -readnow | -readnever ] [ -o OFFSET ] [ TEXTADDRESS ] [ -s SECTION ADDRESS ... ]'
  13828. The 'add-symbol-file' command reads additional symbol table
  13829. information from the file FILENAME. You would use this command
  13830. when FILENAME has been dynamically loaded (by some other means)
  13831. into the program that is running. The TEXTADDRESS parameter gives
  13832. the memory address at which the file's text section has been
  13833. loaded. You can additionally specify the base address of other
  13834. sections using an arbitrary number of '-s SECTION ADDRESS' pairs.
  13835. If a section is omitted, GDB will use its default addresses as
  13836. found in FILENAME. Any ADDRESS or TEXTADDRESS can be given as an
  13837. expression.
  13838. If an optional OFFSET is specified, it is added to the start
  13839. address of each section, except those for which the address was
  13840. specified explicitly.
  13841. The symbol table of the file FILENAME is added to the symbol table
  13842. originally read with the 'symbol-file' command. You can use the
  13843. 'add-symbol-file' command any number of times; the new symbol data
  13844. thus read is kept in addition to the old.
  13845. Changes can be reverted using the command 'remove-symbol-file'.
  13846. Although FILENAME is typically a shared library file, an executable
  13847. file, or some other object file which has been fully relocated for
  13848. loading into a process, you can also load symbolic information from
  13849. relocatable '.o' files, as long as:
  13850. * the file's symbolic information refers only to linker symbols
  13851. defined in that file, not to symbols defined by other object
  13852. files,
  13853. * every section the file's symbolic information refers to has
  13854. actually been loaded into the inferior, as it appears in the
  13855. file, and
  13856. * you can determine the address at which every section was
  13857. loaded, and provide these to the 'add-symbol-file' command.
  13858. Some embedded operating systems, like Sun Chorus and VxWorks, can
  13859. load relocatable files into an already running program; such
  13860. systems typically make the requirements above easy to meet.
  13861. However, it's important to recognize that many native systems use
  13862. complex link procedures ('.linkonce' section factoring and C++
  13863. constructor table assembly, for example) that make the requirements
  13864. difficult to meet. In general, one cannot assume that using
  13865. 'add-symbol-file' to read a relocatable object file's symbolic
  13866. information will have the same effect as linking the relocatable
  13867. object file into the program in the normal way.
  13868. 'add-symbol-file' does not repeat if you press <RET> after using
  13869. it.
  13870. 'remove-symbol-file FILENAME'
  13871. 'remove-symbol-file -a ADDRESS'
  13872. Remove a symbol file added via the 'add-symbol-file' command. The
  13873. file to remove can be identified by its FILENAME or by an ADDRESS
  13874. that lies within the boundaries of this symbol file in memory.
  13875. Example:
  13876. (gdb) add-symbol-file /home/user/gdb/mylib.so 0x7ffff7ff9480
  13877. add symbol table from file "/home/user/gdb/mylib.so" at
  13878. .text_addr = 0x7ffff7ff9480
  13879. (y or n) y
  13880. Reading symbols from /home/user/gdb/mylib.so...
  13881. (gdb) remove-symbol-file -a 0x7ffff7ff9480
  13882. Remove symbol table from file "/home/user/gdb/mylib.so"? (y or n) y
  13883. (gdb)
  13884. 'remove-symbol-file' does not repeat if you press <RET> after using
  13885. it.
  13886. 'add-symbol-file-from-memory ADDRESS'
  13887. Load symbols from the given ADDRESS in a dynamically loaded object
  13888. file whose image is mapped directly into the inferior's memory.
  13889. For example, the Linux kernel maps a 'syscall DSO' into each
  13890. process's address space; this DSO provides kernel-specific code for
  13891. some system calls. The argument can be any expression whose
  13892. evaluation yields the address of the file's shared object file
  13893. header. For this command to work, you must have used 'symbol-file'
  13894. or 'exec-file' commands in advance.
  13895. 'section SECTION ADDR'
  13896. The 'section' command changes the base address of the named SECTION
  13897. of the exec file to ADDR. This can be used if the exec file does
  13898. not contain section addresses, (such as in the 'a.out' format), or
  13899. when the addresses specified in the file itself are wrong. Each
  13900. section must be changed separately. The 'info files' command,
  13901. described below, lists all the sections and their addresses.
  13902. 'info files'
  13903. 'info target'
  13904. 'info files' and 'info target' are synonymous; both print the
  13905. current target (*note Specifying a Debugging Target: Targets.),
  13906. including the names of the executable and core dump files currently
  13907. in use by GDB, and the files from which symbols were loaded. The
  13908. command 'help target' lists all possible targets rather than
  13909. current ones.
  13910. 'maint info sections'
  13911. Another command that can give you extra information about program
  13912. sections is 'maint info sections'. In addition to the section
  13913. information displayed by 'info files', this command displays the
  13914. flags and file offset of each section in the executable and core
  13915. dump files. In addition, 'maint info sections' provides the
  13916. following command options (which may be arbitrarily combined):
  13917. 'ALLOBJ'
  13918. Display sections for all loaded object files, including shared
  13919. libraries.
  13920. 'SECTIONS'
  13921. Display info only for named SECTIONS.
  13922. 'SECTION-FLAGS'
  13923. Display info only for sections for which SECTION-FLAGS are
  13924. true. The section flags that GDB currently knows about are:
  13925. 'ALLOC'
  13926. Section will have space allocated in the process when
  13927. loaded. Set for all sections except those containing
  13928. debug information.
  13929. 'LOAD'
  13930. Section will be loaded from the file into the child
  13931. process memory. Set for pre-initialized code and data,
  13932. clear for '.bss' sections.
  13933. 'RELOC'
  13934. Section needs to be relocated before loading.
  13935. 'READONLY'
  13936. Section cannot be modified by the child process.
  13937. 'CODE'
  13938. Section contains executable code only.
  13939. 'DATA'
  13940. Section contains data only (no executable code).
  13941. 'ROM'
  13942. Section will reside in ROM.
  13943. 'CONSTRUCTOR'
  13944. Section contains data for constructor/destructor lists.
  13945. 'HAS_CONTENTS'
  13946. Section is not empty.
  13947. 'NEVER_LOAD'
  13948. An instruction to the linker to not output the section.
  13949. 'COFF_SHARED_LIBRARY'
  13950. A notification to the linker that the section contains
  13951. COFF shared library information.
  13952. 'IS_COMMON'
  13953. Section contains common symbols.
  13954. 'set trust-readonly-sections on'
  13955. Tell GDB that readonly sections in your object file really are
  13956. read-only (i.e. that their contents will not change). In that
  13957. case, GDB can fetch values from these sections out of the object
  13958. file, rather than from the target program. For some targets
  13959. (notably embedded ones), this can be a significant enhancement to
  13960. debugging performance.
  13961. The default is off.
  13962. 'set trust-readonly-sections off'
  13963. Tell GDB not to trust readonly sections. This means that the
  13964. contents of the section might change while the program is running,
  13965. and must therefore be fetched from the target when needed.
  13966. 'show trust-readonly-sections'
  13967. Show the current setting of trusting readonly sections.
  13968. All file-specifying commands allow both absolute and relative file
  13969. names as arguments. GDB always converts the file name to an absolute
  13970. file name and remembers it that way.
  13971. GDB supports GNU/Linux, MS-Windows, SunOS, Darwin/Mach-O, SVr4, IBM
  13972. RS/6000 AIX, QNX Neutrino, FDPIC (FR-V), and DSBT (TIC6X) shared
  13973. libraries.
  13974. On MS-Windows GDB must be linked with the Expat library to support
  13975. shared libraries. *Note Expat::.
  13976. GDB automatically loads symbol definitions from shared libraries when
  13977. you use the 'run' command, or when you examine a core file. (Before you
  13978. issue the 'run' command, GDB does not understand references to a
  13979. function in a shared library, however--unless you are debugging a core
  13980. file).
  13981. There are times, however, when you may wish to not automatically load
  13982. symbol definitions from shared libraries, such as when they are
  13983. particularly large or there are many of them.
  13984. To control the automatic loading of shared library symbols, use the
  13985. commands:
  13986. 'set auto-solib-add MODE'
  13987. If MODE is 'on', symbols from all shared object libraries will be
  13988. loaded automatically when the inferior begins execution, you attach
  13989. to an independently started inferior, or when the dynamic linker
  13990. informs GDB that a new library has been loaded. If MODE is 'off',
  13991. symbols must be loaded manually, using the 'sharedlibrary' command.
  13992. The default value is 'on'.
  13993. If your program uses lots of shared libraries with debug info that
  13994. takes large amounts of memory, you can decrease the GDB memory
  13995. footprint by preventing it from automatically loading the symbols
  13996. from shared libraries. To that end, type 'set auto-solib-add off'
  13997. before running the inferior, then load each library whose debug
  13998. symbols you do need with 'sharedlibrary REGEXP', where REGEXP is a
  13999. regular expression that matches the libraries whose symbols you
  14000. want to be loaded.
  14001. 'show auto-solib-add'
  14002. Display the current autoloading mode.
  14003. To explicitly load shared library symbols, use the 'sharedlibrary'
  14004. command:
  14005. 'info share REGEX'
  14006. 'info sharedlibrary REGEX'
  14007. Print the names of the shared libraries which are currently loaded
  14008. that match REGEX. If REGEX is omitted then print all shared
  14009. libraries that are loaded.
  14010. 'info dll REGEX'
  14011. This is an alias of 'info sharedlibrary'.
  14012. 'sharedlibrary REGEX'
  14013. 'share REGEX'
  14014. Load shared object library symbols for files matching a Unix
  14015. regular expression. As with files loaded automatically, it only
  14016. loads shared libraries required by your program for a core file or
  14017. after typing 'run'. If REGEX is omitted all shared libraries
  14018. required by your program are loaded.
  14019. 'nosharedlibrary'
  14020. Unload all shared object library symbols. This discards all
  14021. symbols that have been loaded from all shared libraries. Symbols
  14022. from shared libraries that were loaded by explicit user requests
  14023. are not discarded.
  14024. Sometimes you may wish that GDB stops and gives you control when any
  14025. of shared library events happen. The best way to do this is to use
  14026. 'catch load' and 'catch unload' (*note Set Catchpoints::).
  14027. GDB also supports the 'set stop-on-solib-events' command for this.
  14028. This command exists for historical reasons. It is less useful than
  14029. setting a catchpoint, because it does not allow for conditions or
  14030. commands as a catchpoint does.
  14031. 'set stop-on-solib-events'
  14032. This command controls whether GDB should give you control when the
  14033. dynamic linker notifies it about some shared library event. The
  14034. most common event of interest is loading or unloading of a new
  14035. shared library.
  14036. 'show stop-on-solib-events'
  14037. Show whether GDB stops and gives you control when shared library
  14038. events happen.
  14039. Shared libraries are also supported in many cross or remote debugging
  14040. configurations. GDB needs to have access to the target's libraries;
  14041. this can be accomplished either by providing copies of the libraries on
  14042. the host system, or by asking GDB to automatically retrieve the
  14043. libraries from the target. If copies of the target libraries are
  14044. provided, they need to be the same as the target libraries, although the
  14045. copies on the target can be stripped as long as the copies on the host
  14046. are not.
  14047. For remote debugging, you need to tell GDB where the target libraries
  14048. are, so that it can load the correct copies--otherwise, it may try to
  14049. load the host's libraries. GDB has two variables to specify the search
  14050. directories for target libraries.
  14051. 'set sysroot PATH'
  14052. Use PATH as the system root for the program being debugged. Any
  14053. absolute shared library paths will be prefixed with PATH; many
  14054. runtime loaders store the absolute paths to the shared library in
  14055. the target program's memory. When starting processes remotely, and
  14056. when attaching to already-running processes (local or remote),
  14057. their executable filenames will be prefixed with PATH if reported
  14058. to GDB as absolute by the operating system. If you use 'set
  14059. sysroot' to find executables and shared libraries, they need to be
  14060. laid out in the same way that they are on the target, with e.g. a
  14061. '/bin', '/lib' and '/usr/lib' hierarchy under PATH.
  14062. If PATH starts with the sequence 'target:' and the target system is
  14063. remote then GDB will retrieve the target binaries from the remote
  14064. system. This is only supported when using a remote target that
  14065. supports the 'remote get' command (*note Sending files to a remote
  14066. system: File Transfer.). The part of PATH following the initial
  14067. 'target:' (if present) is used as system root prefix on the remote
  14068. file system. If PATH starts with the sequence 'remote:' this is
  14069. converted to the sequence 'target:' by 'set sysroot'(1). If you
  14070. want to specify a local system root using a directory that happens
  14071. to be named 'target:' or 'remote:', you need to use some equivalent
  14072. variant of the name like './target:'.
  14073. For targets with an MS-DOS based filesystem, such as MS-Windows and
  14074. SymbianOS, GDB tries prefixing a few variants of the target
  14075. absolute file name with PATH. But first, on Unix hosts, GDB
  14076. converts all backslash directory separators into forward slashes,
  14077. because the backslash is not a directory separator on Unix:
  14078. c:\foo\bar.dll => c:/foo/bar.dll
  14079. Then, GDB attempts prefixing the target file name with PATH, and
  14080. looks for the resulting file name in the host file system:
  14081. c:/foo/bar.dll => /path/to/sysroot/c:/foo/bar.dll
  14082. If that does not find the binary, GDB tries removing the ':'
  14083. character from the drive spec, both for convenience, and, for the
  14084. case of the host file system not supporting file names with colons:
  14085. c:/foo/bar.dll => /path/to/sysroot/c/foo/bar.dll
  14086. This makes it possible to have a system root that mirrors a target
  14087. with more than one drive. E.g., you may want to setup your local
  14088. copies of the target system shared libraries like so (note 'c' vs
  14089. 'z'):
  14090. /path/to/sysroot/c/sys/bin/foo.dll
  14091. /path/to/sysroot/c/sys/bin/bar.dll
  14092. /path/to/sysroot/z/sys/bin/bar.dll
  14093. and point the system root at '/path/to/sysroot', so that GDB can
  14094. find the correct copies of both 'c:\sys\bin\foo.dll', and
  14095. 'z:\sys\bin\bar.dll'.
  14096. If that still does not find the binary, GDB tries removing the
  14097. whole drive spec from the target file name:
  14098. c:/foo/bar.dll => /path/to/sysroot/foo/bar.dll
  14099. This last lookup makes it possible to not care about the drive
  14100. name, if you don't want or need to.
  14101. The 'set solib-absolute-prefix' command is an alias for 'set
  14102. sysroot'.
  14103. You can set the default system root by using the configure-time
  14104. '--with-sysroot' option. If the system root is inside GDB's
  14105. configured binary prefix (set with '--prefix' or '--exec-prefix'),
  14106. then the default system root will be updated automatically if the
  14107. installed GDB is moved to a new location.
  14108. 'show sysroot'
  14109. Display the current executable and shared library prefix.
  14110. 'set solib-search-path PATH'
  14111. If this variable is set, PATH is a colon-separated list of
  14112. directories to search for shared libraries. 'solib-search-path' is
  14113. used after 'sysroot' fails to locate the library, or if the path to
  14114. the library is relative instead of absolute. If you want to use
  14115. 'solib-search-path' instead of 'sysroot', be sure to set 'sysroot'
  14116. to a nonexistent directory to prevent GDB from finding your host's
  14117. libraries. 'sysroot' is preferred; setting it to a nonexistent
  14118. directory may interfere with automatic loading of shared library
  14119. symbols.
  14120. 'show solib-search-path'
  14121. Display the current shared library search path.
  14122. 'set target-file-system-kind KIND'
  14123. Set assumed file system kind for target reported file names.
  14124. Shared library file names as reported by the target system may not
  14125. make sense as is on the system GDB is running on. For example,
  14126. when remote debugging a target that has MS-DOS based file system
  14127. semantics, from a Unix host, the target may be reporting to GDB a
  14128. list of loaded shared libraries with file names such as
  14129. 'c:\Windows\kernel32.dll'. On Unix hosts, there's no concept of
  14130. drive letters, so the 'c:\' prefix is not normally understood as
  14131. indicating an absolute file name, and neither is the backslash
  14132. normally considered a directory separator character. In that case,
  14133. the native file system would interpret this whole absolute file
  14134. name as a relative file name with no directory components. This
  14135. would make it impossible to point GDB at a copy of the remote
  14136. target's shared libraries on the host using 'set sysroot', and
  14137. impractical with 'set solib-search-path'. Setting
  14138. 'target-file-system-kind' to 'dos-based' tells GDB to interpret
  14139. such file names similarly to how the target would, and to map them
  14140. to file names valid on GDB's native file system semantics. The
  14141. value of KIND can be '"auto"', in addition to one of the supported
  14142. file system kinds. In that case, GDB tries to determine the
  14143. appropriate file system variant based on the current target's
  14144. operating system (*note Configuring the Current ABI: ABI.). The
  14145. supported file system settings are:
  14146. 'unix'
  14147. Instruct GDB to assume the target file system is of Unix kind.
  14148. Only file names starting the forward slash ('/') character are
  14149. considered absolute, and the directory separator character is
  14150. also the forward slash.
  14151. 'dos-based'
  14152. Instruct GDB to assume the target file system is DOS based.
  14153. File names starting with either a forward slash, or a drive
  14154. letter followed by a colon (e.g., 'c:'), are considered
  14155. absolute, and both the slash ('/') and the backslash ('\\')
  14156. characters are considered directory separators.
  14157. 'auto'
  14158. Instruct GDB to use the file system kind associated with the
  14159. target operating system (*note Configuring the Current ABI:
  14160. ABI.). This is the default.
  14161. When processing file names provided by the user, GDB frequently needs
  14162. to compare them to the file names recorded in the program's debug info.
  14163. Normally, GDB compares just the "base names" of the files as strings,
  14164. which is reasonably fast even for very large programs. (The base name
  14165. of a file is the last portion of its name, after stripping all the
  14166. leading directories.) This shortcut in comparison is based upon the
  14167. assumption that files cannot have more than one base name. This is
  14168. usually true, but references to files that use symlinks or similar
  14169. filesystem facilities violate that assumption. If your program records
  14170. files using such facilities, or if you provide file names to GDB using
  14171. symlinks etc., you can set 'basenames-may-differ' to 'true' to instruct
  14172. GDB to completely canonicalize each pair of file names it needs to
  14173. compare. This will make file-name comparisons accurate, but at a price
  14174. of a significant slowdown.
  14175. 'set basenames-may-differ'
  14176. Set whether a source file may have multiple base names.
  14177. 'show basenames-may-differ'
  14178. Show whether a source file may have multiple base names.
  14179. ---------- Footnotes ----------
  14180. (1) Historically the functionality to retrieve binaries from the
  14181. remote system was provided by prefixing PATH with 'remote:'
  14182. 
  14183. File: gdb.info, Node: File Caching, Next: Separate Debug Files, Prev: Files, Up: GDB Files
  14184. 18.2 File Caching
  14185. =================
  14186. To speed up file loading, and reduce memory usage, GDB will reuse the
  14187. 'bfd' objects used to track open files. *Note BFD: (bfd)Top. The
  14188. following commands allow visibility and control of the caching behavior.
  14189. 'maint info bfds'
  14190. This prints information about each 'bfd' object that is known to
  14191. GDB.
  14192. 'maint set bfd-sharing'
  14193. 'maint show bfd-sharing'
  14194. Control whether 'bfd' objects can be shared. When sharing is
  14195. enabled GDB reuses already open 'bfd' objects rather than reopening
  14196. the same file. Turning sharing off does not cause already shared
  14197. 'bfd' objects to be unshared, but all future files that are opened
  14198. will create a new 'bfd' object. Similarly, re-enabling sharing
  14199. does not cause multiple existing 'bfd' objects to be collapsed into
  14200. a single shared 'bfd' object.
  14201. 'set debug bfd-cache LEVEL'
  14202. Turns on debugging of the bfd cache, setting the level to LEVEL.
  14203. 'show debug bfd-cache'
  14204. Show the current debugging level of the bfd cache.
  14205. 
  14206. File: gdb.info, Node: Separate Debug Files, Next: MiniDebugInfo, Prev: File Caching, Up: GDB Files
  14207. 18.3 Debugging Information in Separate Files
  14208. ============================================
  14209. GDB allows you to put a program's debugging information in a file
  14210. separate from the executable itself, in a way that allows GDB to find
  14211. and load the debugging information automatically. Since debugging
  14212. information can be very large--sometimes larger than the executable code
  14213. itself--some systems distribute debugging information for their
  14214. executables in separate files, which users can install only when they
  14215. need to debug a problem.
  14216. GDB supports two ways of specifying the separate debug info file:
  14217. * The executable contains a "debug link" that specifies the name of
  14218. the separate debug info file. The separate debug file's name is
  14219. usually 'EXECUTABLE.debug', where EXECUTABLE is the name of the
  14220. corresponding executable file without leading directories (e.g.,
  14221. 'ls.debug' for '/usr/bin/ls'). In addition, the debug link
  14222. specifies a 32-bit "Cyclic Redundancy Check" (CRC) checksum for the
  14223. debug file, which GDB uses to validate that the executable and the
  14224. debug file came from the same build.
  14225. * The executable contains a "build ID", a unique bit string that is
  14226. also present in the corresponding debug info file. (This is
  14227. supported only on some operating systems, when using the ELF or PE
  14228. file formats for binary files and the GNU Binutils.) For more
  14229. details about this feature, see the description of the '--build-id'
  14230. command-line option in *note Command Line Options: (ld)Options.
  14231. The debug info file's name is not specified explicitly by the build
  14232. ID, but can be computed from the build ID, see below.
  14233. Depending on the way the debug info file is specified, GDB uses two
  14234. different methods of looking for the debug file:
  14235. * For the "debug link" method, GDB looks up the named file in the
  14236. directory of the executable file, then in a subdirectory of that
  14237. directory named '.debug', and finally under each one of the global
  14238. debug directories, in a subdirectory whose name is identical to the
  14239. leading directories of the executable's absolute file name. (On
  14240. MS-Windows/MS-DOS, the drive letter of the executable's leading
  14241. directories is converted to a one-letter subdirectory, i.e.
  14242. 'd:/usr/bin/' is converted to '/d/usr/bin/', because Windows
  14243. filesystems disallow colons in file names.)
  14244. * For the "build ID" method, GDB looks in the '.build-id'
  14245. subdirectory of each one of the global debug directories for a file
  14246. named 'NN/NNNNNNNN.debug', where NN are the first 2 hex characters
  14247. of the build ID bit string, and NNNNNNNN are the rest of the bit
  14248. string. (Real build ID strings are 32 or more hex characters, not
  14249. 10.)
  14250. So, for example, suppose you ask GDB to debug '/usr/bin/ls', which
  14251. has a debug link that specifies the file 'ls.debug', and a build ID
  14252. whose value in hex is 'abcdef1234'. If the list of the global debug
  14253. directories includes '/usr/lib/debug', then GDB will look for the
  14254. following debug information files, in the indicated order:
  14255. - '/usr/lib/debug/.build-id/ab/cdef1234.debug'
  14256. - '/usr/bin/ls.debug'
  14257. - '/usr/bin/.debug/ls.debug'
  14258. - '/usr/lib/debug/usr/bin/ls.debug'.
  14259. Global debugging info directories default to what is set by GDB
  14260. configure option '--with-separate-debug-dir'. During GDB run you can
  14261. also set the global debugging info directories, and view the list GDB is
  14262. currently using.
  14263. 'set debug-file-directory DIRECTORIES'
  14264. Set the directories which GDB searches for separate debugging
  14265. information files to DIRECTORY. Multiple path components can be
  14266. set concatenating them by a path separator.
  14267. 'show debug-file-directory'
  14268. Show the directories GDB searches for separate debugging
  14269. information files.
  14270. A debug link is a special section of the executable file named
  14271. '.gnu_debuglink'. The section must contain:
  14272. * A filename, with any leading directory components removed, followed
  14273. by a zero byte,
  14274. * zero to three bytes of padding, as needed to reach the next
  14275. four-byte boundary within the section, and
  14276. * a four-byte CRC checksum, stored in the same endianness used for
  14277. the executable file itself. The checksum is computed on the
  14278. debugging information file's full contents by the function given
  14279. below, passing zero as the CRC argument.
  14280. Any executable file format can carry a debug link, as long as it can
  14281. contain a section named '.gnu_debuglink' with the contents described
  14282. above.
  14283. The build ID is a special section in the executable file (and in
  14284. other ELF binary files that GDB may consider). This section is often
  14285. named '.note.gnu.build-id', but that name is not mandatory. It contains
  14286. unique identification for the built files--the ID remains the same
  14287. across multiple builds of the same build tree. The default algorithm
  14288. SHA1 produces 160 bits (40 hexadecimal characters) of the content for
  14289. the build ID string. The same section with an identical value is
  14290. present in the original built binary with symbols, in its stripped
  14291. variant, and in the separate debugging information file.
  14292. The debugging information file itself should be an ordinary
  14293. executable, containing a full set of linker symbols, sections, and
  14294. debugging information. The sections of the debugging information file
  14295. should have the same names, addresses, and sizes as the original file,
  14296. but they need not contain any data--much like a '.bss' section in an
  14297. ordinary executable.
  14298. The GNU binary utilities (Binutils) package includes the 'objcopy'
  14299. utility that can produce the separated executable / debugging
  14300. information file pairs using the following commands:
  14301. objcopy --only-keep-debug foo foo.debug
  14302. strip -g foo
  14303. These commands remove the debugging information from the executable file
  14304. 'foo' and place it in the file 'foo.debug'. You can use the first,
  14305. second or both methods to link the two files:
  14306. * The debug link method needs the following additional command to
  14307. also leave behind a debug link in 'foo':
  14308. objcopy --add-gnu-debuglink=foo.debug foo
  14309. Ulrich Drepper's 'elfutils' package, starting with version 0.53,
  14310. contains a version of the 'strip' command such that the command
  14311. 'strip foo -f foo.debug' has the same functionality as the two
  14312. 'objcopy' commands and the 'ln -s' command above, together.
  14313. * Build ID gets embedded into the main executable using 'ld
  14314. --build-id' or the GCC counterpart 'gcc -Wl,--build-id'. Build ID
  14315. support plus compatibility fixes for debug files separation are
  14316. present in GNU binary utilities (Binutils) package since version
  14317. 2.18.
  14318. The CRC used in '.gnu_debuglink' is the CRC-32 defined in IEEE 802.3
  14319. using the polynomial:
  14320. x^{32} + x^{26} + x^{23} + x^{22} + x^{16} + x^{12} + x^{11}
  14321. + x^{10} + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1
  14322. The function is computed byte at a time, taking the least significant
  14323. bit of each byte first. The initial pattern '0xffffffff' is used, to
  14324. ensure leading zeros affect the CRC and the final result is inverted to
  14325. ensure trailing zeros also affect the CRC.
  14326. _Note:_ This is the same CRC polynomial as used in handling the
  14327. "Remote Serial Protocol" 'qCRC' packet (*note qCRC packet::). However
  14328. in the case of the Remote Serial Protocol, the CRC is computed _most_
  14329. significant bit first, and the result is not inverted, so trailing zeros
  14330. have no effect on the CRC value.
  14331. To complete the description, we show below the code of the function
  14332. which produces the CRC used in '.gnu_debuglink'. Inverting the
  14333. initially supplied 'crc' argument means that an initial call to this
  14334. function passing in zero will start computing the CRC using
  14335. '0xffffffff'.
  14336. unsigned long
  14337. gnu_debuglink_crc32 (unsigned long crc,
  14338. unsigned char *buf, size_t len)
  14339. {
  14340. static const unsigned long crc32_table[256] =
  14341. {
  14342. 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
  14343. 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
  14344. 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
  14345. 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
  14346. 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
  14347. 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
  14348. 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
  14349. 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
  14350. 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
  14351. 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
  14352. 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
  14353. 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
  14354. 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
  14355. 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
  14356. 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
  14357. 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
  14358. 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
  14359. 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
  14360. 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
  14361. 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
  14362. 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
  14363. 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
  14364. 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
  14365. 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
  14366. 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
  14367. 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
  14368. 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
  14369. 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
  14370. 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
  14371. 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
  14372. 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
  14373. 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
  14374. 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
  14375. 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
  14376. 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
  14377. 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
  14378. 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
  14379. 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
  14380. 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
  14381. 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
  14382. 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
  14383. 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
  14384. 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
  14385. 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
  14386. 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
  14387. 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
  14388. 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
  14389. 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
  14390. 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
  14391. 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
  14392. 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
  14393. 0x2d02ef8d
  14394. };
  14395. unsigned char *end;
  14396. crc = ~crc & 0xffffffff;
  14397. for (end = buf + len; buf < end; ++buf)
  14398. crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
  14399. return ~crc & 0xffffffff;
  14400. }
  14401. This computation does not apply to the "build ID" method.
  14402. 
  14403. File: gdb.info, Node: MiniDebugInfo, Next: Index Files, Prev: Separate Debug Files, Up: GDB Files
  14404. 18.4 Debugging information in a special section
  14405. ===============================================
  14406. Some systems ship pre-built executables and libraries that have a
  14407. special '.gnu_debugdata' section. This feature is called
  14408. "MiniDebugInfo". This section holds an LZMA-compressed object and is
  14409. used to supply extra symbols for backtraces.
  14410. The intent of this section is to provide extra minimal debugging
  14411. information for use in simple backtraces. It is not intended to be a
  14412. replacement for full separate debugging information (*note Separate
  14413. Debug Files::). The example below shows the intended use; however, GDB
  14414. does not currently put restrictions on what sort of debugging
  14415. information might be included in the section.
  14416. GDB has support for this extension. If the section exists, then it
  14417. is used provided that no other source of debugging information can be
  14418. found, and that GDB was configured with LZMA support.
  14419. This section can be easily created using 'objcopy' and other standard
  14420. utilities:
  14421. # Extract the dynamic symbols from the main binary, there is no need
  14422. # to also have these in the normal symbol table.
  14423. nm -D BINARY --format=posix --defined-only \
  14424. | awk '{ print $1 }' | sort > dynsyms
  14425. # Extract all the text (i.e. function) symbols from the debuginfo.
  14426. # (Note that we actually also accept "D" symbols, for the benefit
  14427. # of platforms like PowerPC64 that use function descriptors.)
  14428. nm BINARY --format=posix --defined-only \
  14429. | awk '{ if ($2 == "T" || $2 == "t" || $2 == "D") print $1 }' \
  14430. | sort > funcsyms
  14431. # Keep all the function symbols not already in the dynamic symbol
  14432. # table.
  14433. comm -13 dynsyms funcsyms > keep_symbols
  14434. # Separate full debug info into debug binary.
  14435. objcopy --only-keep-debug BINARY debug
  14436. # Copy the full debuginfo, keeping only a minimal set of symbols and
  14437. # removing some unnecessary sections.
  14438. objcopy -S --remove-section .gdb_index --remove-section .comment \
  14439. --keep-symbols=keep_symbols debug mini_debuginfo
  14440. # Drop the full debug info from the original binary.
  14441. strip --strip-all -R .comment BINARY
  14442. # Inject the compressed data into the .gnu_debugdata section of the
  14443. # original binary.
  14444. xz mini_debuginfo
  14445. objcopy --add-section .gnu_debugdata=mini_debuginfo.xz BINARY
  14446. 
  14447. File: gdb.info, Node: Index Files, Next: Symbol Errors, Prev: MiniDebugInfo, Up: GDB Files
  14448. 18.5 Index Files Speed Up GDB
  14449. =============================
  14450. When GDB finds a symbol file, it scans the symbols in the file in order
  14451. to construct an internal symbol table. This lets most GDB operations
  14452. work quickly--at the cost of a delay early on. For large programs, this
  14453. delay can be quite lengthy, so GDB provides a way to build an index,
  14454. which speeds up startup.
  14455. For convenience, GDB comes with a program, 'gdb-add-index', which can
  14456. be used to add the index to a symbol file. It takes the symbol file as
  14457. its only argument:
  14458. $ gdb-add-index symfile
  14459. *Note gdb-add-index::.
  14460. It is also possible to do the work manually. Here is what
  14461. 'gdb-add-index' does behind the curtains.
  14462. The index is stored as a section in the symbol file. GDB can write
  14463. the index to a file, then you can put it into the symbol file using
  14464. 'objcopy'.
  14465. To create an index file, use the 'save gdb-index' command:
  14466. 'save gdb-index [-dwarf-5] DIRECTORY'
  14467. Create index files for all symbol files currently known by GDB.
  14468. For each known SYMBOL-FILE, this command by default creates it
  14469. produces a single file 'SYMBOL-FILE.gdb-index'. If you invoke this
  14470. command with the '-dwarf-5' option, it produces 2 files:
  14471. 'SYMBOL-FILE.debug_names' and 'SYMBOL-FILE.debug_str'. The files
  14472. are created in the given DIRECTORY.
  14473. Once you have created an index file you can merge it into your symbol
  14474. file, here named 'symfile', using 'objcopy':
  14475. $ objcopy --add-section .gdb_index=symfile.gdb-index \
  14476. --set-section-flags .gdb_index=readonly symfile symfile
  14477. Or for '-dwarf-5':
  14478. $ objcopy --dump-section .debug_str=symfile.debug_str.new symfile
  14479. $ cat symfile.debug_str >>symfile.debug_str.new
  14480. $ objcopy --add-section .debug_names=symfile.gdb-index \
  14481. --set-section-flags .debug_names=readonly \
  14482. --update-section .debug_str=symfile.debug_str.new symfile symfile
  14483. GDB will normally ignore older versions of '.gdb_index' sections that
  14484. have been deprecated. Usually they are deprecated because they are
  14485. missing a new feature or have performance issues. To tell GDB to use a
  14486. deprecated index section anyway specify 'set
  14487. use-deprecated-index-sections on'. The default is 'off'. This can
  14488. speed up startup, but may result in some functionality being lost.
  14489. *Note Index Section Format::.
  14490. _Warning:_ Setting 'use-deprecated-index-sections' to 'on' must be
  14491. done before gdb reads the file. The following will not work:
  14492. $ gdb -ex "set use-deprecated-index-sections on" <program>
  14493. Instead you must do, for example,
  14494. $ gdb -iex "set use-deprecated-index-sections on" <program>
  14495. Indices only work when using DWARF debugging information, not stabs.
  14496. 18.5.1 Automatic symbol index cache
  14497. -----------------------------------
  14498. It is possible for GDB to automatically save a copy of this index in a
  14499. cache on disk and retrieve it from there when loading the same binary in
  14500. the future. This feature can be turned on with 'set index-cache on'.
  14501. The following commands can be used to tweak the behavior of the index
  14502. cache.
  14503. 'set index-cache on'
  14504. 'set index-cache off'
  14505. Enable or disable the use of the symbol index cache.
  14506. 'set index-cache directory DIRECTORY'
  14507. 'show index-cache directory'
  14508. Set/show the directory where index files will be saved.
  14509. The default value for this directory depends on the host platform.
  14510. On most systems, the index is cached in the 'gdb' subdirectory of
  14511. the directory pointed to by the 'XDG_CACHE_HOME' environment
  14512. variable, if it is defined, else in the '.cache/gdb' subdirectory
  14513. of your home directory. However, on some systems, the default may
  14514. differ according to local convention.
  14515. There is no limit on the disk space used by index cache. It is
  14516. perfectly safe to delete the content of that directory to free up
  14517. disk space.
  14518. 'show index-cache stats'
  14519. Print the number of cache hits and misses since the launch of GDB.
  14520. 
  14521. File: gdb.info, Node: Symbol Errors, Next: Data Files, Prev: Index Files, Up: GDB Files
  14522. 18.6 Errors Reading Symbol Files
  14523. ================================
  14524. While reading a symbol file, GDB occasionally encounters problems, such
  14525. as symbol types it does not recognize, or known bugs in compiler output.
  14526. By default, GDB does not notify you of such problems, since they are
  14527. relatively common and primarily of interest to people debugging
  14528. compilers. If you are interested in seeing information about
  14529. ill-constructed symbol tables, you can either ask GDB to print only one
  14530. message about each such type of problem, no matter how many times the
  14531. problem occurs; or you can ask GDB to print more messages, to see how
  14532. many times the problems occur, with the 'set complaints' command (*note
  14533. Optional Warnings and Messages: Messages/Warnings.).
  14534. The messages currently printed, and their meanings, include:
  14535. 'inner block not inside outer block in SYMBOL'
  14536. The symbol information shows where symbol scopes begin and end
  14537. (such as at the start of a function or a block of statements).
  14538. This error indicates that an inner scope block is not fully
  14539. contained in its outer scope blocks.
  14540. GDB circumvents the problem by treating the inner block as if it
  14541. had the same scope as the outer block. In the error message,
  14542. SYMBOL may be shown as "'(don't know)'" if the outer block is not a
  14543. function.
  14544. 'block at ADDRESS out of order'
  14545. The symbol information for symbol scope blocks should occur in
  14546. order of increasing addresses. This error indicates that it does
  14547. not do so.
  14548. GDB does not circumvent this problem, and has trouble locating
  14549. symbols in the source file whose symbols it is reading. (You can
  14550. often determine what source file is affected by specifying 'set
  14551. verbose on'. *Note Optional Warnings and Messages:
  14552. Messages/Warnings.)
  14553. 'bad block start address patched'
  14554. The symbol information for a symbol scope block has a start address
  14555. smaller than the address of the preceding source line. This is
  14556. known to occur in the SunOS 4.1.1 (and earlier) C compiler.
  14557. GDB circumvents the problem by treating the symbol scope block as
  14558. starting on the previous source line.
  14559. 'bad string table offset in symbol N'
  14560. Symbol number N contains a pointer into the string table which is
  14561. larger than the size of the string table.
  14562. GDB circumvents the problem by considering the symbol to have the
  14563. name 'foo', which may cause other problems if many symbols end up
  14564. with this name.
  14565. 'unknown symbol type 0xNN'
  14566. The symbol information contains new data types that GDB does not
  14567. yet know how to read. '0xNN' is the symbol type of the
  14568. uncomprehended information, in hexadecimal.
  14569. GDB circumvents the error by ignoring this symbol information.
  14570. This usually allows you to debug your program, though certain
  14571. symbols are not accessible. If you encounter such a problem and
  14572. feel like debugging it, you can debug 'gdb' with itself, breakpoint
  14573. on 'complain', then go up to the function 'read_dbx_symtab' and
  14574. examine '*bufp' to see the symbol.
  14575. 'stub type has NULL name'
  14576. GDB could not find the full definition for a struct or class.
  14577. 'const/volatile indicator missing (ok if using g++ v1.x), got...'
  14578. The symbol information for a C++ member function is missing some
  14579. information that recent versions of the compiler should have output
  14580. for it.
  14581. 'info mismatch between compiler and debugger'
  14582. GDB could not parse a type specification output by the compiler.
  14583. 
  14584. File: gdb.info, Node: Data Files, Prev: Symbol Errors, Up: GDB Files
  14585. 18.7 GDB Data Files
  14586. ===================
  14587. GDB will sometimes read an auxiliary data file. These files are kept in
  14588. a directory known as the "data directory".
  14589. You can set the data directory's name, and view the name GDB is
  14590. currently using.
  14591. 'set data-directory DIRECTORY'
  14592. Set the directory which GDB searches for auxiliary data files to
  14593. DIRECTORY.
  14594. 'show data-directory'
  14595. Show the directory GDB searches for auxiliary data files.
  14596. You can set the default data directory by using the configure-time
  14597. '--with-gdb-datadir' option. If the data directory is inside GDB's
  14598. configured binary prefix (set with '--prefix' or '--exec-prefix'), then
  14599. the default data directory will be updated automatically if the
  14600. installed GDB is moved to a new location.
  14601. The data directory may also be specified with the '--data-directory'
  14602. command line option. *Note Mode Options::.
  14603. 
  14604. File: gdb.info, Node: Targets, Next: Remote Debugging, Prev: GDB Files, Up: Top
  14605. 19 Specifying a Debugging Target
  14606. ********************************
  14607. A "target" is the execution environment occupied by your program.
  14608. Often, GDB runs in the same host environment as your program; in that
  14609. case, the debugging target is specified as a side effect when you use
  14610. the 'file' or 'core' commands. When you need more flexibility--for
  14611. example, running GDB on a physically separate host, or controlling a
  14612. standalone system over a serial port or a realtime system over a TCP/IP
  14613. connection--you can use the 'target' command to specify one of the
  14614. target types configured for GDB (*note Commands for Managing Targets:
  14615. Target Commands.).
  14616. It is possible to build GDB for several different "target
  14617. architectures". When GDB is built like that, you can choose one of the
  14618. available architectures with the 'set architecture' command.
  14619. 'set architecture ARCH'
  14620. This command sets the current target architecture to ARCH. The
  14621. value of ARCH can be '"auto"', in addition to one of the supported
  14622. architectures.
  14623. 'show architecture'
  14624. Show the current target architecture.
  14625. 'set processor'
  14626. 'processor'
  14627. These are alias commands for, respectively, 'set architecture' and
  14628. 'show architecture'.
  14629. * Menu:
  14630. * Active Targets:: Active targets
  14631. * Target Commands:: Commands for managing targets
  14632. * Byte Order:: Choosing target byte order
  14633. 
  14634. File: gdb.info, Node: Active Targets, Next: Target Commands, Up: Targets
  14635. 19.1 Active Targets
  14636. ===================
  14637. There are multiple classes of targets such as: processes, executable
  14638. files or recording sessions. Core files belong to the process class,
  14639. making core file and process mutually exclusive. Otherwise, GDB can
  14640. work concurrently on multiple active targets, one in each class. This
  14641. allows you to (for example) start a process and inspect its activity,
  14642. while still having access to the executable file after the process
  14643. finishes. Or if you start process recording (*note Reverse Execution::)
  14644. and 'reverse-step' there, you are presented a virtual layer of the
  14645. recording target, while the process target remains stopped at the
  14646. chronologically last point of the process execution.
  14647. Use the 'core-file' and 'exec-file' commands to select a new core
  14648. file or executable target (*note Commands to Specify Files: Files.). To
  14649. specify as a target a process that is already running, use the 'attach'
  14650. command (*note Debugging an Already-running Process: Attach.).
  14651. 
  14652. File: gdb.info, Node: Target Commands, Next: Byte Order, Prev: Active Targets, Up: Targets
  14653. 19.2 Commands for Managing Targets
  14654. ==================================
  14655. 'target TYPE PARAMETERS'
  14656. Connects the GDB host environment to a target machine or process.
  14657. A target is typically a protocol for talking to debugging
  14658. facilities. You use the argument TYPE to specify the type or
  14659. protocol of the target machine.
  14660. Further PARAMETERS are interpreted by the target protocol, but
  14661. typically include things like device names or host names to connect
  14662. with, process numbers, and baud rates.
  14663. The 'target' command does not repeat if you press <RET> again after
  14664. executing the command.
  14665. 'help target'
  14666. Displays the names of all targets available. To display targets
  14667. currently selected, use either 'info target' or 'info files' (*note
  14668. Commands to Specify Files: Files.).
  14669. 'help target NAME'
  14670. Describe a particular target, including any parameters necessary to
  14671. select it.
  14672. 'set gnutarget ARGS'
  14673. GDB uses its own library BFD to read your files. GDB knows whether
  14674. it is reading an "executable", a "core", or a ".o" file; however,
  14675. you can specify the file format with the 'set gnutarget' command.
  14676. Unlike most 'target' commands, with 'gnutarget' the 'target' refers
  14677. to a program, not a machine.
  14678. _Warning:_ To specify a file format with 'set gnutarget', you
  14679. must know the actual BFD name.
  14680. *Note Commands to Specify Files: Files.
  14681. 'show gnutarget'
  14682. Use the 'show gnutarget' command to display what file format
  14683. 'gnutarget' is set to read. If you have not set 'gnutarget', GDB
  14684. will determine the file format for each file automatically, and
  14685. 'show gnutarget' displays 'The current BFD target is "auto"'.
  14686. Here are some common targets (available, or not, depending on the GDB
  14687. configuration):
  14688. 'target exec PROGRAM'
  14689. An executable file. 'target exec PROGRAM' is the same as
  14690. 'exec-file PROGRAM'.
  14691. 'target core FILENAME'
  14692. A core dump file. 'target core FILENAME' is the same as 'core-file
  14693. FILENAME'.
  14694. 'target remote MEDIUM'
  14695. A remote system connected to GDB via a serial line or network
  14696. connection. This command tells GDB to use its own remote protocol
  14697. over MEDIUM for debugging. *Note Remote Debugging::.
  14698. For example, if you have a board connected to '/dev/ttya' on the
  14699. machine running GDB, you could say:
  14700. target remote /dev/ttya
  14701. 'target remote' supports the 'load' command. This is only useful
  14702. if you have some other way of getting the stub to the target
  14703. system, and you can put it somewhere in memory where it won't get
  14704. clobbered by the download.
  14705. 'target sim [SIMARGS] ...'
  14706. Builtin CPU simulator. GDB includes simulators for most
  14707. architectures. In general,
  14708. target sim
  14709. load
  14710. run
  14711. works; however, you cannot assume that a specific memory map,
  14712. device drivers, or even basic I/O is available, although some
  14713. simulators do provide these. For info about any processor-specific
  14714. simulator details, see the appropriate section in *note Embedded
  14715. Processors: Embedded Processors.
  14716. 'target native'
  14717. Setup for local/native process debugging. Useful to make the 'run'
  14718. command spawn native processes (likewise 'attach', etc.) even when
  14719. 'set auto-connect-native-target' is 'off' (*note set
  14720. auto-connect-native-target::).
  14721. Different targets are available on different configurations of GDB;
  14722. your configuration may have more or fewer targets.
  14723. Many remote targets require you to download the executable's code
  14724. once you've successfully established a connection. You may wish to
  14725. control various aspects of this process.
  14726. 'set hash'
  14727. This command controls whether a hash mark '#' is displayed while
  14728. downloading a file to the remote monitor. If on, a hash mark is
  14729. displayed after each S-record is successfully downloaded to the
  14730. monitor.
  14731. 'show hash'
  14732. Show the current status of displaying the hash mark.
  14733. 'set debug monitor'
  14734. Enable or disable display of communications messages between GDB
  14735. and the remote monitor.
  14736. 'show debug monitor'
  14737. Show the current status of displaying communications between GDB
  14738. and the remote monitor.
  14739. 'load FILENAME OFFSET'
  14740. Depending on what remote debugging facilities are configured into
  14741. GDB, the 'load' command may be available. Where it exists, it is
  14742. meant to make FILENAME (an executable) available for debugging on
  14743. the remote system--by downloading, or dynamic linking, for example.
  14744. 'load' also records the FILENAME symbol table in GDB, like the
  14745. 'add-symbol-file' command.
  14746. If your GDB does not have a 'load' command, attempting to execute
  14747. it gets the error message "'You can't do that when your target is
  14748. ...'"
  14749. The file is loaded at whatever address is specified in the
  14750. executable. For some object file formats, you can specify the load
  14751. address when you link the program; for other formats, like a.out,
  14752. the object file format specifies a fixed address.
  14753. It is also possible to tell GDB to load the executable file at a
  14754. specific offset described by the optional argument OFFSET. When
  14755. OFFSET is provided, FILENAME must also be provided.
  14756. Depending on the remote side capabilities, GDB may be able to load
  14757. programs into flash memory.
  14758. 'load' does not repeat if you press <RET> again after using it.
  14759. 'flash-erase'
  14760. Erases all known flash memory regions on the target.
  14761. 
  14762. File: gdb.info, Node: Byte Order, Prev: Target Commands, Up: Targets
  14763. 19.3 Choosing Target Byte Order
  14764. ===============================
  14765. Some types of processors, such as the MIPS, PowerPC, and Renesas SH,
  14766. offer the ability to run either big-endian or little-endian byte orders.
  14767. Usually the executable or symbol will include a bit to designate the
  14768. endian-ness, and you will not need to worry about which to use.
  14769. However, you may still find it useful to adjust GDB's idea of processor
  14770. endian-ness manually.
  14771. 'set endian big'
  14772. Instruct GDB to assume the target is big-endian.
  14773. 'set endian little'
  14774. Instruct GDB to assume the target is little-endian.
  14775. 'set endian auto'
  14776. Instruct GDB to use the byte order associated with the executable.
  14777. 'show endian'
  14778. Display GDB's current idea of the target byte order.
  14779. If the 'set endian auto' mode is in effect and no executable has been
  14780. selected, then the endianness used is the last one chosen either by one
  14781. of the 'set endian big' and 'set endian little' commands or by inferring
  14782. from the last executable used. If no endianness has been previously
  14783. chosen, then the default for this mode is inferred from the target GDB
  14784. has been built for, and is 'little' if the name of the target CPU has an
  14785. 'el' suffix and 'big' otherwise.
  14786. Note that these commands merely adjust interpretation of symbolic
  14787. data on the host, and that they have absolutely no effect on the target
  14788. system.
  14789. 
  14790. File: gdb.info, Node: Remote Debugging, Next: Configurations, Prev: Targets, Up: Top
  14791. 20 Debugging Remote Programs
  14792. ****************************
  14793. If you are trying to debug a program running on a machine that cannot
  14794. run GDB in the usual way, it is often useful to use remote debugging.
  14795. For example, you might use remote debugging on an operating system
  14796. kernel, or on a small system which does not have a general purpose
  14797. operating system powerful enough to run a full-featured debugger.
  14798. Some configurations of GDB have special serial or TCP/IP interfaces
  14799. to make this work with particular debugging targets. In addition, GDB
  14800. comes with a generic serial protocol (specific to GDB, but not specific
  14801. to any particular target system) which you can use if you write the
  14802. remote stubs--the code that runs on the remote system to communicate
  14803. with GDB.
  14804. Other remote targets may be available in your configuration of GDB;
  14805. use 'help target' to list them.
  14806. * Menu:
  14807. * Connecting:: Connecting to a remote target
  14808. * File Transfer:: Sending files to a remote system
  14809. * Server:: Using the gdbserver program
  14810. * Remote Configuration:: Remote configuration
  14811. * Remote Stub:: Implementing a remote stub
  14812. 
  14813. File: gdb.info, Node: Connecting, Next: File Transfer, Up: Remote Debugging
  14814. 20.1 Connecting to a Remote Target
  14815. ==================================
  14816. This section describes how to connect to a remote target, including the
  14817. types of connections and their differences, how to set up executable and
  14818. symbol files on the host and target, and the commands used for
  14819. connecting to and disconnecting from the remote target.
  14820. 20.1.1 Types of Remote Connections
  14821. ----------------------------------
  14822. GDB supports two types of remote connections, 'target remote' mode and
  14823. 'target extended-remote' mode. Note that many remote targets support
  14824. only 'target remote' mode. There are several major differences between
  14825. the two types of connections, enumerated here:
  14826. Result of detach or program exit
  14827. *With target remote mode:* When the debugged program exits or you
  14828. detach from it, GDB disconnects from the target. When using
  14829. 'gdbserver', 'gdbserver' will exit.
  14830. *With target extended-remote mode:* When the debugged program exits
  14831. or you detach from it, GDB remains connected to the target, even
  14832. though no program is running. You can rerun the program, attach to
  14833. a running program, or use 'monitor' commands specific to the
  14834. target.
  14835. When using 'gdbserver' in this case, it does not exit unless it was
  14836. invoked using the '--once' option. If the '--once' option was not
  14837. used, you can ask 'gdbserver' to exit using the 'monitor exit'
  14838. command (*note Monitor Commands for gdbserver::).
  14839. Specifying the program to debug
  14840. For both connection types you use the 'file' command to specify the
  14841. program on the host system. If you are using 'gdbserver' there are
  14842. some differences in how to specify the location of the program on
  14843. the target.
  14844. *With target remote mode:* You must either specify the program to
  14845. debug on the 'gdbserver' command line or use the '--attach' option
  14846. (*note Attaching to a Running Program: Attaching to a program.).
  14847. *With target extended-remote mode:* You may specify the program to
  14848. debug on the 'gdbserver' command line, or you can load the program
  14849. or attach to it using GDB commands after connecting to 'gdbserver'.
  14850. You can start 'gdbserver' without supplying an initial command to
  14851. run or process ID to attach. To do this, use the '--multi' command
  14852. line option. Then you can connect using 'target extended-remote'
  14853. and start the program you want to debug (see below for details on
  14854. using the 'run' command in this scenario). Note that the
  14855. conditions under which 'gdbserver' terminates depend on how GDB
  14856. connects to it ('target remote' or 'target extended-remote'). The
  14857. '--multi' option to 'gdbserver' has no influence on that.
  14858. The 'run' command
  14859. *With target remote mode:* The 'run' command is not supported.
  14860. Once a connection has been established, you can use all the usual
  14861. GDB commands to examine and change data. The remote program is
  14862. already running, so you can use commands like 'step' and
  14863. 'continue'.
  14864. *With target extended-remote mode:* The 'run' command is supported.
  14865. The 'run' command uses the value set by 'set remote exec-file'
  14866. (*note set remote exec-file::) to select the program to run.
  14867. Command line arguments are supported, except for wildcard expansion
  14868. and I/O redirection (*note Arguments::).
  14869. If you specify the program to debug on the command line, then the
  14870. 'run' command is not required to start execution, and you can
  14871. resume using commands like 'step' and 'continue' as with 'target
  14872. remote' mode.
  14873. Attaching
  14874. *With target remote mode:* The GDB command 'attach' is not
  14875. supported. To attach to a running program using 'gdbserver', you
  14876. must use the '--attach' option (*note Running gdbserver::).
  14877. *With target extended-remote mode:* To attach to a running program,
  14878. you may use the 'attach' command after the connection has been
  14879. established. If you are using 'gdbserver', you may also invoke
  14880. 'gdbserver' using the '--attach' option (*note Running
  14881. gdbserver::).
  14882. Some remote targets allow GDB to determine the executable file
  14883. running in the process the debugger is attaching to. In such a
  14884. case, GDB uses the value of 'exec-file-mismatch' to handle a
  14885. possible mismatch between the executable file name running in the
  14886. process and the name of the current exec-file loaded by GDB (*note
  14887. set exec-file-mismatch::).
  14888. 20.1.2 Host and Target Files
  14889. ----------------------------
  14890. GDB, running on the host, needs access to symbol and debugging
  14891. information for your program running on the target. This requires
  14892. access to an unstripped copy of your program, and possibly any
  14893. associated symbol files. Note that this section applies equally to both
  14894. 'target remote' mode and 'target extended-remote' mode.
  14895. Some remote targets (*note qXfer executable filename read::, and
  14896. *note Host I/O Packets::) allow GDB to access program files over the
  14897. same connection used to communicate with GDB. With such a target, if
  14898. the remote program is unstripped, the only command you need is 'target
  14899. remote' (or 'target extended-remote').
  14900. If the remote program is stripped, or the target does not support
  14901. remote program file access, start up GDB using the name of the local
  14902. unstripped copy of your program as the first argument, or use the 'file'
  14903. command. Use 'set sysroot' to specify the location (on the host) of
  14904. target libraries (unless your GDB was compiled with the correct sysroot
  14905. using '--with-sysroot'). Alternatively, you may use 'set
  14906. solib-search-path' to specify how GDB locates target libraries.
  14907. The symbol file and target libraries must exactly match the
  14908. executable and libraries on the target, with one exception: the files on
  14909. the host system should not be stripped, even if the files on the target
  14910. system are. Mismatched or missing files will lead to confusing results
  14911. during debugging. On GNU/Linux targets, mismatched or missing files may
  14912. also prevent 'gdbserver' from debugging multi-threaded programs.
  14913. 20.1.3 Remote Connection Commands
  14914. ---------------------------------
  14915. GDB can communicate with the target over a serial line, a local Unix
  14916. domain socket, or over an IP network using TCP or UDP. In each case,
  14917. GDB uses the same protocol for debugging your program; only the medium
  14918. carrying the debugging packets varies. The 'target remote' and 'target
  14919. extended-remote' commands establish a connection to the target. Both
  14920. commands accept the same arguments, which indicate the medium to use:
  14921. 'target remote SERIAL-DEVICE'
  14922. 'target extended-remote SERIAL-DEVICE'
  14923. Use SERIAL-DEVICE to communicate with the target. For example, to
  14924. use a serial line connected to the device named '/dev/ttyb':
  14925. target remote /dev/ttyb
  14926. If you're using a serial line, you may want to give GDB the
  14927. '--baud' option, or use the 'set serial baud' command (*note set
  14928. serial baud: Remote Configuration.) before the 'target' command.
  14929. 'target remote LOCAL-SOCKET'
  14930. 'target extended-remote LOCAL-SOCKET'
  14931. Use LOCAL-SOCKET to communicate with the target. For example, to
  14932. use a local Unix domain socket bound to the file system entry
  14933. '/tmp/gdb-socket0':
  14934. target remote /tmp/gdb-socket0
  14935. Note that this command has the same form as the command to connect
  14936. to a serial line. GDB will automatically determine which kind of
  14937. file you have specified and will make the appropriate kind of
  14938. connection. This feature is not available if the host system does
  14939. not support Unix domain sockets.
  14940. 'target remote HOST:PORT'
  14941. 'target remote [HOST]:PORT'
  14942. 'target remote tcp:HOST:PORT'
  14943. 'target remote tcp:[HOST]:PORT'
  14944. 'target remote tcp4:HOST:PORT'
  14945. 'target remote tcp6:HOST:PORT'
  14946. 'target remote tcp6:[HOST]:PORT'
  14947. 'target extended-remote HOST:PORT'
  14948. 'target extended-remote [HOST]:PORT'
  14949. 'target extended-remote tcp:HOST:PORT'
  14950. 'target extended-remote tcp:[HOST]:PORT'
  14951. 'target extended-remote tcp4:HOST:PORT'
  14952. 'target extended-remote tcp6:HOST:PORT'
  14953. 'target extended-remote tcp6:[HOST]:PORT'
  14954. Debug using a TCP connection to PORT on HOST. The HOST may be
  14955. either a host name, a numeric IPv4 address, or a numeric IPv6
  14956. address (with or without the square brackets to separate the
  14957. address from the port); PORT must be a decimal number. The HOST
  14958. could be the target machine itself, if it is directly connected to
  14959. the net, or it might be a terminal server which in turn has a
  14960. serial line to the target.
  14961. For example, to connect to port 2828 on a terminal server named
  14962. 'manyfarms':
  14963. target remote manyfarms:2828
  14964. To connect to port 2828 on a terminal server whose address is
  14965. '2001:0db8:85a3:0000:0000:8a2e:0370:7334', you can either use the
  14966. square bracket syntax:
  14967. target remote [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:2828
  14968. or explicitly specify the IPv6 protocol:
  14969. target remote tcp6:2001:0db8:85a3:0000:0000:8a2e:0370:7334:2828
  14970. This last example may be confusing to the reader, because there is
  14971. no visible separation between the hostname and the port number.
  14972. Therefore, we recommend the user to provide IPv6 addresses using
  14973. square brackets for clarity. However, it is important to mention
  14974. that for GDB there is no ambiguity: the number after the last colon
  14975. is considered to be the port number.
  14976. If your remote target is actually running on the same machine as
  14977. your debugger session (e.g. a simulator for your target running on
  14978. the same host), you can omit the hostname. For example, to connect
  14979. to port 1234 on your local machine:
  14980. target remote :1234
  14981. Note that the colon is still required here.
  14982. 'target remote udp:HOST:PORT'
  14983. 'target remote udp:[HOST]:PORT'
  14984. 'target remote udp4:HOST:PORT'
  14985. 'target remote udp6:[HOST]:PORT'
  14986. 'target extended-remote udp:HOST:PORT'
  14987. 'target extended-remote udp:HOST:PORT'
  14988. 'target extended-remote udp:[HOST]:PORT'
  14989. 'target extended-remote udp4:HOST:PORT'
  14990. 'target extended-remote udp6:HOST:PORT'
  14991. 'target extended-remote udp6:[HOST]:PORT'
  14992. Debug using UDP packets to PORT on HOST. For example, to connect
  14993. to UDP port 2828 on a terminal server named 'manyfarms':
  14994. target remote udp:manyfarms:2828
  14995. When using a UDP connection for remote debugging, you should keep
  14996. in mind that the 'U' stands for "Unreliable". UDP can silently
  14997. drop packets on busy or unreliable networks, which will cause havoc
  14998. with your debugging session.
  14999. 'target remote | COMMAND'
  15000. 'target extended-remote | COMMAND'
  15001. Run COMMAND in the background and communicate with it using a pipe.
  15002. The COMMAND is a shell command, to be parsed and expanded by the
  15003. system's command shell, '/bin/sh'; it should expect remote protocol
  15004. packets on its standard input, and send replies on its standard
  15005. output. You could use this to run a stand-alone simulator that
  15006. speaks the remote debugging protocol, to make net connections using
  15007. programs like 'ssh', or for other similar tricks.
  15008. If COMMAND closes its standard output (perhaps by exiting), GDB
  15009. will try to send it a 'SIGTERM' signal. (If the program has
  15010. already exited, this will have no effect.)
  15011. Whenever GDB is waiting for the remote program, if you type the
  15012. interrupt character (often 'Ctrl-c'), GDB attempts to stop the program.
  15013. This may or may not succeed, depending in part on the hardware and the
  15014. serial drivers the remote system uses. If you type the interrupt
  15015. character once again, GDB displays this prompt:
  15016. Interrupted while waiting for the program.
  15017. Give up (and stop debugging it)? (y or n)
  15018. In 'target remote' mode, if you type 'y', GDB abandons the remote
  15019. debugging session. (If you decide you want to try again later, you can
  15020. use 'target remote' again to connect once more.) If you type 'n', GDB
  15021. goes back to waiting.
  15022. In 'target extended-remote' mode, typing 'n' will leave GDB connected
  15023. to the target.
  15024. 'detach'
  15025. When you have finished debugging the remote program, you can use
  15026. the 'detach' command to release it from GDB control. Detaching
  15027. from the target normally resumes its execution, but the results
  15028. will depend on your particular remote stub. After the 'detach'
  15029. command in 'target remote' mode, GDB is free to connect to another
  15030. target. In 'target extended-remote' mode, GDB is still connected
  15031. to the target.
  15032. 'disconnect'
  15033. The 'disconnect' command closes the connection to the target, and
  15034. the target is generally not resumed. It will wait for GDB (this
  15035. instance or another one) to connect and continue debugging. After
  15036. the 'disconnect' command, GDB is again free to connect to another
  15037. target.
  15038. 'monitor CMD'
  15039. This command allows you to send arbitrary commands directly to the
  15040. remote monitor. Since GDB doesn't care about the commands it sends
  15041. like this, this command is the way to extend GDB--you can add new
  15042. commands that only the external monitor will understand and
  15043. implement.
  15044. 
  15045. File: gdb.info, Node: File Transfer, Next: Server, Prev: Connecting, Up: Remote Debugging
  15046. 20.2 Sending files to a remote system
  15047. =====================================
  15048. Some remote targets offer the ability to transfer files over the same
  15049. connection used to communicate with GDB. This is convenient for targets
  15050. accessible through other means, e.g. GNU/Linux systems running
  15051. 'gdbserver' over a network interface. For other targets, e.g. embedded
  15052. devices with only a single serial port, this may be the only way to
  15053. upload or download files.
  15054. Not all remote targets support these commands.
  15055. 'remote put HOSTFILE TARGETFILE'
  15056. Copy file HOSTFILE from the host system (the machine running GDB)
  15057. to TARGETFILE on the target system.
  15058. 'remote get TARGETFILE HOSTFILE'
  15059. Copy file TARGETFILE from the target system to HOSTFILE on the host
  15060. system.
  15061. 'remote delete TARGETFILE'
  15062. Delete TARGETFILE from the target system.
  15063. 
  15064. File: gdb.info, Node: Server, Next: Remote Configuration, Prev: File Transfer, Up: Remote Debugging
  15065. 20.3 Using the 'gdbserver' Program
  15066. ==================================
  15067. 'gdbserver' is a control program for Unix-like systems, which allows you
  15068. to connect your program with a remote GDB via 'target remote' or 'target
  15069. extended-remote'--but without linking in the usual debugging stub.
  15070. 'gdbserver' is not a complete replacement for the debugging stubs,
  15071. because it requires essentially the same operating-system facilities
  15072. that GDB itself does. In fact, a system that can run 'gdbserver' to
  15073. connect to a remote GDB could also run GDB locally! 'gdbserver' is
  15074. sometimes useful nevertheless, because it is a much smaller program than
  15075. GDB itself. It is also easier to port than all of GDB, so you may be
  15076. able to get started more quickly on a new system by using 'gdbserver'.
  15077. Finally, if you develop code for real-time systems, you may find that
  15078. the tradeoffs involved in real-time operation make it more convenient to
  15079. do as much development work as possible on another system, for example
  15080. by cross-compiling. You can use 'gdbserver' to make a similar choice
  15081. for debugging.
  15082. GDB and 'gdbserver' communicate via either a serial line or a TCP
  15083. connection, using the standard GDB remote serial protocol.
  15084. _Warning:_ 'gdbserver' does not have any built-in security. Do not
  15085. run 'gdbserver' connected to any public network; a GDB connection
  15086. to 'gdbserver' provides access to the target system with the same
  15087. privileges as the user running 'gdbserver'.
  15088. 20.3.1 Running 'gdbserver'
  15089. --------------------------
  15090. Run 'gdbserver' on the target system. You need a copy of the program
  15091. you want to debug, including any libraries it requires. 'gdbserver'
  15092. does not need your program's symbol table, so you can strip the program
  15093. if necessary to save space. GDB on the host system does all the symbol
  15094. handling.
  15095. To use the server, you must tell it how to communicate with GDB; the
  15096. name of your program; and the arguments for your program. The usual
  15097. syntax is:
  15098. target> gdbserver COMM PROGRAM [ ARGS ... ]
  15099. COMM is either a device name (to use a serial line), or a TCP
  15100. hostname and portnumber, or '-' or 'stdio' to use stdin/stdout of
  15101. 'gdbserver'. For example, to debug Emacs with the argument 'foo.txt'
  15102. and communicate with GDB over the serial port '/dev/com1':
  15103. target> gdbserver /dev/com1 emacs foo.txt
  15104. 'gdbserver' waits passively for the host GDB to communicate with it.
  15105. To use a TCP connection instead of a serial line:
  15106. target> gdbserver host:2345 emacs foo.txt
  15107. The only difference from the previous example is the first argument,
  15108. specifying that you are communicating with the host GDB via TCP. The
  15109. 'host:2345' argument means that 'gdbserver' is to expect a TCP
  15110. connection from machine 'host' to local TCP port 2345. (Currently, the
  15111. 'host' part is ignored.) You can choose any number you want for the
  15112. port number as long as it does not conflict with any TCP ports already
  15113. in use on the target system (for example, '23' is reserved for
  15114. 'telnet').(1) You must use the same port number with the host GDB
  15115. 'target remote' command.
  15116. The 'stdio' connection is useful when starting 'gdbserver' with ssh:
  15117. (gdb) target remote | ssh -T hostname gdbserver - hello
  15118. The '-T' option to ssh is provided because we don't need a remote
  15119. pty, and we don't want escape-character handling. Ssh does this by
  15120. default when a command is provided, the flag is provided to make it
  15121. explicit. You could elide it if you want to.
  15122. Programs started with stdio-connected gdbserver have '/dev/null' for
  15123. 'stdin', and 'stdout','stderr' are sent back to gdb for display through
  15124. a pipe connected to gdbserver. Both 'stdout' and 'stderr' use the same
  15125. pipe.
  15126. 20.3.1.1 Attaching to a Running Program
  15127. .......................................
  15128. On some targets, 'gdbserver' can also attach to running programs. This
  15129. is accomplished via the '--attach' argument. The syntax is:
  15130. target> gdbserver --attach COMM PID
  15131. PID is the process ID of a currently running process. It isn't
  15132. necessary to point 'gdbserver' at a binary for the running process.
  15133. In 'target extended-remote' mode, you can also attach using the GDB
  15134. attach command (*note Attaching in Types of Remote Connections::).
  15135. You can debug processes by name instead of process ID if your target
  15136. has the 'pidof' utility:
  15137. target> gdbserver --attach COMM `pidof PROGRAM`
  15138. In case more than one copy of PROGRAM is running, or PROGRAM has
  15139. multiple threads, most versions of 'pidof' support the '-s' option to
  15140. only return the first process ID.
  15141. 20.3.1.2 TCP port allocation lifecycle of 'gdbserver'
  15142. .....................................................
  15143. This section applies only when 'gdbserver' is run to listen on a TCP
  15144. port.
  15145. 'gdbserver' normally terminates after all of its debugged processes
  15146. have terminated in 'target remote' mode. On the other hand, for 'target
  15147. extended-remote', 'gdbserver' stays running even with no processes left.
  15148. GDB normally terminates the spawned debugged process on its exit, which
  15149. normally also terminates 'gdbserver' in the 'target remote' mode.
  15150. Therefore, when the connection drops unexpectedly, and GDB cannot ask
  15151. 'gdbserver' to kill its debugged processes, 'gdbserver' stays running
  15152. even in the 'target remote' mode.
  15153. When 'gdbserver' stays running, GDB can connect to it again later.
  15154. Such reconnecting is useful for features like *note disconnected
  15155. tracing::. For completeness, at most one GDB can be connected at a
  15156. time.
  15157. By default, 'gdbserver' keeps the listening TCP port open, so that
  15158. subsequent connections are possible. However, if you start 'gdbserver'
  15159. with the '--once' option, it will stop listening for any further
  15160. connection attempts after connecting to the first GDB session. This
  15161. means no further connections to 'gdbserver' will be possible after the
  15162. first one. It also means 'gdbserver' will terminate after the first
  15163. connection with remote GDB has closed, even for unexpectedly closed
  15164. connections and even in the 'target extended-remote' mode. The '--once'
  15165. option allows reusing the same port number for connecting to multiple
  15166. instances of 'gdbserver' running on the same host, since each instance
  15167. closes its port after the first connection.
  15168. 20.3.1.3 Other Command-Line Arguments for 'gdbserver'
  15169. .....................................................
  15170. You can use the '--multi' option to start 'gdbserver' without specifying
  15171. a program to debug or a process to attach to. Then you can attach in
  15172. 'target extended-remote' mode and run or attach to a program. For more
  15173. information, *note --multi Option in Types of Remote Connnections::.
  15174. The '--debug' option tells 'gdbserver' to display extra status
  15175. information about the debugging process. The '--remote-debug' option
  15176. tells 'gdbserver' to display remote protocol debug output. The
  15177. '--debug-file=FILENAME' option tells 'gdbserver' to write any debug
  15178. output to the given FILENAME. These options are intended for
  15179. 'gdbserver' development and for bug reports to the developers.
  15180. The '--debug-format=option1[,option2,...]' option tells 'gdbserver'
  15181. to include additional information in each output. Possible options are:
  15182. 'none'
  15183. Turn off all extra information in debugging output.
  15184. 'all'
  15185. Turn on all extra information in debugging output.
  15186. 'timestamps'
  15187. Include a timestamp in each line of debugging output.
  15188. Options are processed in order. Thus, for example, if 'none' appears
  15189. last then no additional information is added to debugging output.
  15190. The '--wrapper' option specifies a wrapper to launch programs for
  15191. debugging. The option should be followed by the name of the wrapper,
  15192. then any command-line arguments to pass to the wrapper, then '--'
  15193. indicating the end of the wrapper arguments.
  15194. 'gdbserver' runs the specified wrapper program with a combined
  15195. command line including the wrapper arguments, then the name of the
  15196. program to debug, then any arguments to the program. The wrapper runs
  15197. until it executes your program, and then GDB gains control.
  15198. You can use any program that eventually calls 'execve' with its
  15199. arguments as a wrapper. Several standard Unix utilities do this, e.g.
  15200. 'env' and 'nohup'. Any Unix shell script ending with 'exec "$@"' will
  15201. also work.
  15202. For example, you can use 'env' to pass an environment variable to the
  15203. debugged program, without setting the variable in 'gdbserver''s
  15204. environment:
  15205. $ gdbserver --wrapper env LD_PRELOAD=libtest.so -- :2222 ./testprog
  15206. The '--selftest' option runs the self tests in 'gdbserver':
  15207. $ gdbserver --selftest
  15208. Ran 2 unit tests, 0 failed
  15209. These tests are disabled in release.
  15210. 20.3.2 Connecting to 'gdbserver'
  15211. --------------------------------
  15212. The basic procedure for connecting to the remote target is:
  15213. * Run GDB on the host system.
  15214. * Make sure you have the necessary symbol files (*note Host and
  15215. target files::). Load symbols for your application using the
  15216. 'file' command before you connect. Use 'set sysroot' to locate
  15217. target libraries (unless your GDB was compiled with the correct
  15218. sysroot using '--with-sysroot').
  15219. * Connect to your target (*note Connecting to a Remote Target:
  15220. Connecting.). For TCP connections, you must start up 'gdbserver'
  15221. prior to using the 'target' command. Otherwise you may get an
  15222. error whose text depends on the host system, but which usually
  15223. looks something like 'Connection refused'. Don't use the 'load'
  15224. command in GDB when using 'target remote' mode, since the program
  15225. is already on the target.
  15226. 20.3.3 Monitor Commands for 'gdbserver'
  15227. ---------------------------------------
  15228. During a GDB session using 'gdbserver', you can use the 'monitor'
  15229. command to send special requests to 'gdbserver'. Here are the available
  15230. commands.
  15231. 'monitor help'
  15232. List the available monitor commands.
  15233. 'monitor set debug 0'
  15234. 'monitor set debug 1'
  15235. Disable or enable general debugging messages.
  15236. 'monitor set remote-debug 0'
  15237. 'monitor set remote-debug 1'
  15238. Disable or enable specific debugging messages associated with the
  15239. remote protocol (*note Remote Protocol::).
  15240. 'monitor set debug-file filename'
  15241. 'monitor set debug-file'
  15242. Send any debug output to the given file, or to stderr.
  15243. 'monitor set debug-format option1[,option2,...]'
  15244. Specify additional text to add to debugging messages. Possible
  15245. options are:
  15246. 'none'
  15247. Turn off all extra information in debugging output.
  15248. 'all'
  15249. Turn on all extra information in debugging output.
  15250. 'timestamps'
  15251. Include a timestamp in each line of debugging output.
  15252. Options are processed in order. Thus, for example, if 'none'
  15253. appears last then no additional information is added to debugging
  15254. output.
  15255. 'monitor set libthread-db-search-path [PATH]'
  15256. When this command is issued, PATH is a colon-separated list of
  15257. directories to search for 'libthread_db' (*note set
  15258. libthread-db-search-path: Threads.). If you omit PATH,
  15259. 'libthread-db-search-path' will be reset to its default value.
  15260. The special entry '$pdir' for 'libthread-db-search-path' is not
  15261. supported in 'gdbserver'.
  15262. 'monitor exit'
  15263. Tell gdbserver to exit immediately. This command should be
  15264. followed by 'disconnect' to close the debugging session.
  15265. 'gdbserver' will detach from any attached processes and kill any
  15266. processes it created. Use 'monitor exit' to terminate 'gdbserver'
  15267. at the end of a multi-process mode debug session.
  15268. 20.3.4 Tracepoints support in 'gdbserver'
  15269. -----------------------------------------
  15270. On some targets, 'gdbserver' supports tracepoints, fast tracepoints and
  15271. static tracepoints.
  15272. For fast or static tracepoints to work, a special library called the
  15273. "in-process agent" (IPA), must be loaded in the inferior process. This
  15274. library is built and distributed as an integral part of 'gdbserver'. In
  15275. addition, support for static tracepoints requires building the
  15276. in-process agent library with static tracepoints support. At present,
  15277. the UST (LTTng Userspace Tracer, <http://lttng.org/ust>) tracing engine
  15278. is supported. This support is automatically available if UST
  15279. development headers are found in the standard include path when
  15280. 'gdbserver' is built, or if 'gdbserver' was explicitly configured using
  15281. '--with-ust' to point at such headers. You can explicitly disable the
  15282. support using '--with-ust=no'.
  15283. There are several ways to load the in-process agent in your program:
  15284. 'Specifying it as dependency at link time'
  15285. You can link your program dynamically with the in-process agent
  15286. library. On most systems, this is accomplished by adding
  15287. '-linproctrace' to the link command.
  15288. 'Using the system's preloading mechanisms'
  15289. You can force loading the in-process agent at startup time by using
  15290. your system's support for preloading shared libraries. Many Unixes
  15291. support the concept of preloading user defined libraries. In most
  15292. cases, you do that by specifying 'LD_PRELOAD=libinproctrace.so' in
  15293. the environment. See also the description of 'gdbserver''s
  15294. '--wrapper' command line option.
  15295. 'Using GDB to force loading the agent at run time'
  15296. On some systems, you can force the inferior to load a shared
  15297. library, by calling a dynamic loader function in the inferior that
  15298. takes care of dynamically looking up and loading a shared library.
  15299. On most Unix systems, the function is 'dlopen'. You'll use the
  15300. 'call' command for that. For example:
  15301. (gdb) call dlopen ("libinproctrace.so", ...)
  15302. Note that on most Unix systems, for the 'dlopen' function to be
  15303. available, the program needs to be linked with '-ldl'.
  15304. On systems that have a userspace dynamic loader, like most Unix
  15305. systems, when you connect to 'gdbserver' using 'target remote', you'll
  15306. find that the program is stopped at the dynamic loader's entry point,
  15307. and no shared library has been loaded in the program's address space
  15308. yet, including the in-process agent. In that case, before being able to
  15309. use any of the fast or static tracepoints features, you need to let the
  15310. loader run and load the shared libraries. The simplest way to do that
  15311. is to run the program to the main procedure. E.g., if debugging a C or
  15312. C++ program, start 'gdbserver' like so:
  15313. $ gdbserver :9999 myprogram
  15314. Start GDB and connect to 'gdbserver' like so, and run to main:
  15315. $ gdb myprogram
  15316. (gdb) target remote myhost:9999
  15317. 0x00007f215893ba60 in ?? () from /lib64/ld-linux-x86-64.so.2
  15318. (gdb) b main
  15319. (gdb) continue
  15320. The in-process tracing agent library should now be loaded into the
  15321. process; you can confirm it with the 'info sharedlibrary' command, which
  15322. will list 'libinproctrace.so' as loaded in the process. You are now
  15323. ready to install fast tracepoints, list static tracepoint markers, probe
  15324. static tracepoints markers, and start tracing.
  15325. ---------- Footnotes ----------
  15326. (1) If you choose a port number that conflicts with another service,
  15327. 'gdbserver' prints an error message and exits.
  15328. 
  15329. File: gdb.info, Node: Remote Configuration, Next: Remote Stub, Prev: Server, Up: Remote Debugging
  15330. 20.4 Remote Configuration
  15331. =========================
  15332. This section documents the configuration options available when
  15333. debugging remote programs. For the options related to the File I/O
  15334. extensions of the remote protocol, see *note system-call-allowed:
  15335. system.
  15336. 'set remoteaddresssize BITS'
  15337. Set the maximum size of address in a memory packet to the specified
  15338. number of bits. GDB will mask off the address bits above that
  15339. number, when it passes addresses to the remote target. The default
  15340. value is the number of bits in the target's address.
  15341. 'show remoteaddresssize'
  15342. Show the current value of remote address size in bits.
  15343. 'set serial baud N'
  15344. Set the baud rate for the remote serial I/O to N baud. The value
  15345. is used to set the speed of the serial port used for debugging
  15346. remote targets.
  15347. 'show serial baud'
  15348. Show the current speed of the remote connection.
  15349. 'set serial parity PARITY'
  15350. Set the parity for the remote serial I/O. Supported values of
  15351. PARITY are: 'even', 'none', and 'odd'. The default is 'none'.
  15352. 'show serial parity'
  15353. Show the current parity of the serial port.
  15354. 'set remotebreak'
  15355. If set to on, GDB sends a 'BREAK' signal to the remote when you
  15356. type 'Ctrl-c' to interrupt the program running on the remote. If
  15357. set to off, GDB sends the 'Ctrl-C' character instead. The default
  15358. is off, since most remote systems expect to see 'Ctrl-C' as the
  15359. interrupt signal.
  15360. 'show remotebreak'
  15361. Show whether GDB sends 'BREAK' or 'Ctrl-C' to interrupt the remote
  15362. program.
  15363. 'set remoteflow on'
  15364. 'set remoteflow off'
  15365. Enable or disable hardware flow control ('RTS'/'CTS') on the serial
  15366. port used to communicate to the remote target.
  15367. 'show remoteflow'
  15368. Show the current setting of hardware flow control.
  15369. 'set remotelogbase BASE'
  15370. Set the base (a.k.a. radix) of logging serial protocol
  15371. communications to BASE. Supported values of BASE are: 'ascii',
  15372. 'octal', and 'hex'. The default is 'ascii'.
  15373. 'show remotelogbase'
  15374. Show the current setting of the radix for logging remote serial
  15375. protocol.
  15376. 'set remotelogfile FILE'
  15377. Record remote serial communications on the named FILE. The default
  15378. is not to record at all.
  15379. 'show remotelogfile'
  15380. Show the current setting of the file name on which to record the
  15381. serial communications.
  15382. 'set remotetimeout NUM'
  15383. Set the timeout limit to wait for the remote target to respond to
  15384. NUM seconds. The default is 2 seconds.
  15385. 'show remotetimeout'
  15386. Show the current number of seconds to wait for the remote target
  15387. responses.
  15388. 'set remote hardware-watchpoint-limit LIMIT'
  15389. 'set remote hardware-breakpoint-limit LIMIT'
  15390. Restrict GDB to using LIMIT remote hardware watchpoints or
  15391. breakpoints. The LIMIT can be set to 0 to disable hardware
  15392. watchpoints or breakpoints, and 'unlimited' for unlimited
  15393. watchpoints or breakpoints.
  15394. 'show remote hardware-watchpoint-limit'
  15395. 'show remote hardware-breakpoint-limit'
  15396. Show the current limit for the number of hardware watchpoints or
  15397. breakpoints that GDB can use.
  15398. 'set remote hardware-watchpoint-length-limit LIMIT'
  15399. Restrict GDB to using LIMIT bytes for the maximum length of a
  15400. remote hardware watchpoint. A LIMIT of 0 disables hardware
  15401. watchpoints and 'unlimited' allows watchpoints of any length.
  15402. 'show remote hardware-watchpoint-length-limit'
  15403. Show the current limit (in bytes) of the maximum length of a remote
  15404. hardware watchpoint.
  15405. 'set remote exec-file FILENAME'
  15406. 'show remote exec-file'
  15407. Select the file used for 'run' with 'target extended-remote'. This
  15408. should be set to a filename valid on the target system. If it is
  15409. not set, the target will use a default filename (e.g. the last
  15410. program run).
  15411. 'set remote interrupt-sequence'
  15412. Allow the user to select one of 'Ctrl-C', a 'BREAK' or 'BREAK-g' as
  15413. the sequence to the remote target in order to interrupt the
  15414. execution. 'Ctrl-C' is a default. Some system prefers 'BREAK'
  15415. which is high level of serial line for some certain time. Linux
  15416. kernel prefers 'BREAK-g', a.k.a Magic SysRq g. It is 'BREAK'
  15417. signal followed by character 'g'.
  15418. 'show interrupt-sequence'
  15419. Show which of 'Ctrl-C', 'BREAK' or 'BREAK-g' is sent by GDB to
  15420. interrupt the remote program. 'BREAK-g' is BREAK signal followed
  15421. by 'g' and also known as Magic SysRq g.
  15422. 'set remote interrupt-on-connect'
  15423. Specify whether interrupt-sequence is sent to remote target when
  15424. GDB connects to it. This is mostly needed when you debug Linux
  15425. kernel. Linux kernel expects 'BREAK' followed by 'g' which is
  15426. known as Magic SysRq g in order to connect GDB.
  15427. 'show interrupt-on-connect'
  15428. Show whether interrupt-sequence is sent to remote target when GDB
  15429. connects to it.
  15430. 'set tcp auto-retry on'
  15431. Enable auto-retry for remote TCP connections. This is useful if
  15432. the remote debugging agent is launched in parallel with GDB; there
  15433. is a race condition because the agent may not become ready to
  15434. accept the connection before GDB attempts to connect. When
  15435. auto-retry is enabled, if the initial attempt to connect fails, GDB
  15436. reattempts to establish the connection using the timeout specified
  15437. by 'set tcp connect-timeout'.
  15438. 'set tcp auto-retry off'
  15439. Do not auto-retry failed TCP connections.
  15440. 'show tcp auto-retry'
  15441. Show the current auto-retry setting.
  15442. 'set tcp connect-timeout SECONDS'
  15443. 'set tcp connect-timeout unlimited'
  15444. Set the timeout for establishing a TCP connection to the remote
  15445. target to SECONDS. The timeout affects both polling to retry
  15446. failed connections (enabled by 'set tcp auto-retry on') and waiting
  15447. for connections that are merely slow to complete, and represents an
  15448. approximate cumulative value. If SECONDS is 'unlimited', there is
  15449. no timeout and GDB will keep attempting to establish a connection
  15450. forever, unless interrupted with 'Ctrl-c'. The default is 15
  15451. seconds.
  15452. 'show tcp connect-timeout'
  15453. Show the current connection timeout setting.
  15454. The GDB remote protocol autodetects the packets supported by your
  15455. debugging stub. If you need to override the autodetection, you can use
  15456. these commands to enable or disable individual packets. Each packet can
  15457. be set to 'on' (the remote target supports this packet), 'off' (the
  15458. remote target does not support this packet), or 'auto' (detect remote
  15459. target support for this packet). They all default to 'auto'. For more
  15460. information about each packet, see *note Remote Protocol::.
  15461. During normal use, you should not have to use any of these commands.
  15462. If you do, that may be a bug in your remote debugging stub, or a bug in
  15463. GDB. You may want to report the problem to the GDB developers.
  15464. For each packet NAME, the command to enable or disable the packet is
  15465. 'set remote NAME-packet'. The available settings are:
  15466. Command Name Remote Packet Related Features
  15467. 'fetch-register' 'p' 'info registers'
  15468. 'set-register' 'P' 'set'
  15469. 'binary-download' 'X' 'load', 'set'
  15470. 'read-aux-vector' 'qXfer:auxv:read' 'info auxv'
  15471. 'symbol-lookup' 'qSymbol' Detecting
  15472. multiple threads
  15473. 'attach' 'vAttach' 'attach'
  15474. 'verbose-resume' 'vCont' Stepping or
  15475. resuming
  15476. multiple threads
  15477. 'run' 'vRun' 'run'
  15478. 'software-breakpoint''Z0' 'break'
  15479. 'hardware-breakpoint''Z1' 'hbreak'
  15480. 'write-watchpoint' 'Z2' 'watch'
  15481. 'read-watchpoint' 'Z3' 'rwatch'
  15482. 'access-watchpoint' 'Z4' 'awatch'
  15483. 'pid-to-exec-file' 'qXfer:exec-file:read' 'attach', 'run'
  15484. 'target-features' 'qXfer:features:read' 'set
  15485. architecture'
  15486. 'library-info' 'qXfer:libraries:read' 'info
  15487. sharedlibrary'
  15488. 'memory-map' 'qXfer:memory-map:read' 'info mem'
  15489. 'read-sdata-object' 'qXfer:sdata:read' 'print $_sdata'
  15490. 'read-siginfo-object''qXfer:siginfo:read' 'print
  15491. $_siginfo'
  15492. 'write-siginfo-object''qXfer:siginfo:write' 'set $_siginfo'
  15493. 'threads' 'qXfer:threads:read' 'info threads'
  15494. 'get-thread-local- 'qGetTLSAddr' Displaying
  15495. storage-address' '__thread'
  15496. variables
  15497. 'get-thread-information-block-address''qGetTIBAddr'Display
  15498. MS-Windows
  15499. Thread
  15500. Information
  15501. Block.
  15502. 'search-memory' 'qSearch:memory' 'find'
  15503. 'supported-packets' 'qSupported' Remote
  15504. communications
  15505. parameters
  15506. 'catch-syscalls' 'QCatchSyscalls' 'catch syscall'
  15507. 'pass-signals' 'QPassSignals' 'handle SIGNAL'
  15508. 'program-signals' 'QProgramSignals' 'handle SIGNAL'
  15509. 'hostio-close-packet''vFile:close' 'remote get',
  15510. 'remote put'
  15511. 'hostio-open-packet' 'vFile:open' 'remote get',
  15512. 'remote put'
  15513. 'hostio-pread-packet''vFile:pread' 'remote get',
  15514. 'remote put'
  15515. 'hostio-pwrite-packet''vFile:pwrite' 'remote get',
  15516. 'remote put'
  15517. 'hostio-unlink-packet''vFile:unlink' 'remote delete'
  15518. 'hostio-readlink-packet''vFile:readlink' Host I/O
  15519. 'hostio-fstat-packet''vFile:fstat' Host I/O
  15520. 'hostio-setfs-packet''vFile:setfs' Host I/O
  15521. 'noack-packet' 'QStartNoAckMode' Packet
  15522. acknowledgment
  15523. 'osdata' 'qXfer:osdata:read' 'info os'
  15524. 'query-attached' 'qAttached' Querying remote
  15525. process attach
  15526. state.
  15527. 'trace-buffer-size' 'QTBuffer:size' 'set
  15528. trace-buffer-size'
  15529. 'trace-status' 'qTStatus' 'tstatus'
  15530. 'traceframe-info' 'qXfer:traceframe-info:read'Traceframe info
  15531. 'install-in-trace' 'InstallInTrace' Install
  15532. tracepoint in
  15533. tracing
  15534. 'disable-randomization''QDisableRandomization''set
  15535. disable-randomization'
  15536. 'startup-with-shell' 'QStartupWithShell' 'set
  15537. startup-with-shell'
  15538. 'environment-hex-encoded''QEnvironmentHexEncoded''set
  15539. environment'
  15540. 'environment-unset' 'QEnvironmentUnset' 'unset
  15541. environment'
  15542. 'environment-reset' 'QEnvironmentReset' 'Reset the
  15543. inferior
  15544. environment
  15545. (i.e., unset
  15546. user-set
  15547. variables)'
  15548. 'set-working-dir' 'QSetWorkingDir' 'set cwd'
  15549. 'conditional-breakpoints-packet''Z0 and Z1' 'Support for
  15550. target-side
  15551. breakpoint
  15552. condition
  15553. evaluation'
  15554. 'multiprocess-extensions''multiprocess Debug multiple
  15555. extensions' processes and
  15556. remote process
  15557. PID awareness
  15558. 'swbreak-feature' 'swbreak stop reason' 'break'
  15559. 'hwbreak-feature' 'hwbreak stop reason' 'hbreak'
  15560. 'fork-event-feature' 'fork stop reason' 'fork'
  15561. 'vfork-event-feature''vfork stop reason' 'vfork'
  15562. 'exec-event-feature' 'exec stop reason' 'exec'
  15563. 'thread-events' 'QThreadEvents' Tracking thread
  15564. lifetime.
  15565. 'no-resumed-stop-reply''no resumed thread Tracking thread
  15566. left stop reply' lifetime.
  15567. 
  15568. File: gdb.info, Node: Remote Stub, Prev: Remote Configuration, Up: Remote Debugging
  15569. 20.5 Implementing a Remote Stub
  15570. ===============================
  15571. The stub files provided with GDB implement the target side of the
  15572. communication protocol, and the GDB side is implemented in the GDB
  15573. source file 'remote.c'. Normally, you can simply allow these
  15574. subroutines to communicate, and ignore the details. (If you're
  15575. implementing your own stub file, you can still ignore the details: start
  15576. with one of the existing stub files. 'sparc-stub.c' is the best
  15577. organized, and therefore the easiest to read.)
  15578. To debug a program running on another machine (the debugging "target"
  15579. machine), you must first arrange for all the usual prerequisites for the
  15580. program to run by itself. For example, for a C program, you need:
  15581. 1. A startup routine to set up the C runtime environment; these
  15582. usually have a name like 'crt0'. The startup routine may be
  15583. supplied by your hardware supplier, or you may have to write your
  15584. own.
  15585. 2. A C subroutine library to support your program's subroutine calls,
  15586. notably managing input and output.
  15587. 3. A way of getting your program to the other machine--for example, a
  15588. download program. These are often supplied by the hardware
  15589. manufacturer, but you may have to write your own from hardware
  15590. documentation.
  15591. The next step is to arrange for your program to use a serial port to
  15592. communicate with the machine where GDB is running (the "host" machine).
  15593. In general terms, the scheme looks like this:
  15594. _On the host,_
  15595. GDB already understands how to use this protocol; when everything
  15596. else is set up, you can simply use the 'target remote' command
  15597. (*note Specifying a Debugging Target: Targets.).
  15598. _On the target,_
  15599. you must link with your program a few special-purpose subroutines
  15600. that implement the GDB remote serial protocol. The file containing
  15601. these subroutines is called a "debugging stub".
  15602. On certain remote targets, you can use an auxiliary program
  15603. 'gdbserver' instead of linking a stub into your program. *Note
  15604. Using the 'gdbserver' Program: Server, for details.
  15605. The debugging stub is specific to the architecture of the remote
  15606. machine; for example, use 'sparc-stub.c' to debug programs on SPARC
  15607. boards.
  15608. These working remote stubs are distributed with GDB:
  15609. 'i386-stub.c'
  15610. For Intel 386 and compatible architectures.
  15611. 'm68k-stub.c'
  15612. For Motorola 680x0 architectures.
  15613. 'sh-stub.c'
  15614. For Renesas SH architectures.
  15615. 'sparc-stub.c'
  15616. For SPARC architectures.
  15617. 'sparcl-stub.c'
  15618. For Fujitsu SPARCLITE architectures.
  15619. The 'README' file in the GDB distribution may list other recently
  15620. added stubs.
  15621. * Menu:
  15622. * Stub Contents:: What the stub can do for you
  15623. * Bootstrapping:: What you must do for the stub
  15624. * Debug Session:: Putting it all together
  15625. 
  15626. File: gdb.info, Node: Stub Contents, Next: Bootstrapping, Up: Remote Stub
  15627. 20.5.1 What the Stub Can Do for You
  15628. -----------------------------------
  15629. The debugging stub for your architecture supplies these three
  15630. subroutines:
  15631. 'set_debug_traps'
  15632. This routine arranges for 'handle_exception' to run when your
  15633. program stops. You must call this subroutine explicitly in your
  15634. program's startup code.
  15635. 'handle_exception'
  15636. This is the central workhorse, but your program never calls it
  15637. explicitly--the setup code arranges for 'handle_exception' to run
  15638. when a trap is triggered.
  15639. 'handle_exception' takes control when your program stops during
  15640. execution (for example, on a breakpoint), and mediates
  15641. communications with GDB on the host machine. This is where the
  15642. communications protocol is implemented; 'handle_exception' acts as
  15643. the GDB representative on the target machine. It begins by sending
  15644. summary information on the state of your program, then continues to
  15645. execute, retrieving and transmitting any information GDB needs,
  15646. until you execute a GDB command that makes your program resume; at
  15647. that point, 'handle_exception' returns control to your own code on
  15648. the target machine.
  15649. 'breakpoint'
  15650. Use this auxiliary subroutine to make your program contain a
  15651. breakpoint. Depending on the particular situation, this may be the
  15652. only way for GDB to get control. For instance, if your target
  15653. machine has some sort of interrupt button, you won't need to call
  15654. this; pressing the interrupt button transfers control to
  15655. 'handle_exception'--in effect, to GDB. On some machines, simply
  15656. receiving characters on the serial port may also trigger a trap;
  15657. again, in that situation, you don't need to call 'breakpoint' from
  15658. your own program--simply running 'target remote' from the host GDB
  15659. session gets control.
  15660. Call 'breakpoint' if none of these is true, or if you simply want
  15661. to make certain your program stops at a predetermined point for the
  15662. start of your debugging session.
  15663. 
  15664. File: gdb.info, Node: Bootstrapping, Next: Debug Session, Prev: Stub Contents, Up: Remote Stub
  15665. 20.5.2 What You Must Do for the Stub
  15666. ------------------------------------
  15667. The debugging stubs that come with GDB are set up for a particular chip
  15668. architecture, but they have no information about the rest of your
  15669. debugging target machine.
  15670. First of all you need to tell the stub how to communicate with the
  15671. serial port.
  15672. 'int getDebugChar()'
  15673. Write this subroutine to read a single character from the serial
  15674. port. It may be identical to 'getchar' for your target system; a
  15675. different name is used to allow you to distinguish the two if you
  15676. wish.
  15677. 'void putDebugChar(int)'
  15678. Write this subroutine to write a single character to the serial
  15679. port. It may be identical to 'putchar' for your target system; a
  15680. different name is used to allow you to distinguish the two if you
  15681. wish.
  15682. If you want GDB to be able to stop your program while it is running,
  15683. you need to use an interrupt-driven serial driver, and arrange for it to
  15684. stop when it receives a '^C' ('\003', the control-C character). That is
  15685. the character which GDB uses to tell the remote system to stop.
  15686. Getting the debugging target to return the proper status to GDB
  15687. probably requires changes to the standard stub; one quick and dirty way
  15688. is to just execute a breakpoint instruction (the "dirty" part is that
  15689. GDB reports a 'SIGTRAP' instead of a 'SIGINT').
  15690. Other routines you need to supply are:
  15691. 'void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)'
  15692. Write this function to install EXCEPTION_ADDRESS in the exception
  15693. handling tables. You need to do this because the stub does not
  15694. have any way of knowing what the exception handling tables on your
  15695. target system are like (for example, the processor's table might be
  15696. in ROM, containing entries which point to a table in RAM). The
  15697. EXCEPTION_NUMBER specifies the exception which should be changed;
  15698. its meaning is architecture-dependent (for example, different
  15699. numbers might represent divide by zero, misaligned access, etc).
  15700. When this exception occurs, control should be transferred directly
  15701. to EXCEPTION_ADDRESS, and the processor state (stack, registers,
  15702. and so on) should be just as it is when a processor exception
  15703. occurs. So if you want to use a jump instruction to reach
  15704. EXCEPTION_ADDRESS, it should be a simple jump, not a jump to
  15705. subroutine.
  15706. For the 386, EXCEPTION_ADDRESS should be installed as an interrupt
  15707. gate so that interrupts are masked while the handler runs. The
  15708. gate should be at privilege level 0 (the most privileged level).
  15709. The SPARC and 68k stubs are able to mask interrupts themselves
  15710. without help from 'exceptionHandler'.
  15711. 'void flush_i_cache()'
  15712. On SPARC and SPARCLITE only, write this subroutine to flush the
  15713. instruction cache, if any, on your target machine. If there is no
  15714. instruction cache, this subroutine may be a no-op.
  15715. On target machines that have instruction caches, GDB requires this
  15716. function to make certain that the state of your program is stable.
  15717. You must also make sure this library routine is available:
  15718. 'void *memset(void *, int, int)'
  15719. This is the standard library function 'memset' that sets an area of
  15720. memory to a known value. If you have one of the free versions of
  15721. 'libc.a', 'memset' can be found there; otherwise, you must either
  15722. obtain it from your hardware manufacturer, or write your own.
  15723. If you do not use the GNU C compiler, you may need other standard
  15724. library subroutines as well; this varies from one stub to another, but
  15725. in general the stubs are likely to use any of the common library
  15726. subroutines which 'GCC' generates as inline code.
  15727. 
  15728. File: gdb.info, Node: Debug Session, Prev: Bootstrapping, Up: Remote Stub
  15729. 20.5.3 Putting it All Together
  15730. ------------------------------
  15731. In summary, when your program is ready to debug, you must follow these
  15732. steps.
  15733. 1. Make sure you have defined the supporting low-level routines (*note
  15734. What You Must Do for the Stub: Bootstrapping.):
  15735. 'getDebugChar', 'putDebugChar',
  15736. 'flush_i_cache', 'memset', 'exceptionHandler'.
  15737. 2. Insert these lines in your program's startup code, before the main
  15738. procedure is called:
  15739. set_debug_traps();
  15740. breakpoint();
  15741. On some machines, when a breakpoint trap is raised, the hardware
  15742. automatically makes the PC point to the instruction after the
  15743. breakpoint. If your machine doesn't do that, you may need to
  15744. adjust 'handle_exception' to arrange for it to return to the
  15745. instruction after the breakpoint on this first invocation, so that
  15746. your program doesn't keep hitting the initial breakpoint instead of
  15747. making progress.
  15748. 3. For the 680x0 stub only, you need to provide a variable called
  15749. 'exceptionHook'. Normally you just use:
  15750. void (*exceptionHook)() = 0;
  15751. but if before calling 'set_debug_traps', you set it to point to a
  15752. function in your program, that function is called when 'GDB'
  15753. continues after stopping on a trap (for example, bus error). The
  15754. function indicated by 'exceptionHook' is called with one parameter:
  15755. an 'int' which is the exception number.
  15756. 4. Compile and link together: your program, the GDB debugging stub for
  15757. your target architecture, and the supporting subroutines.
  15758. 5. Make sure you have a serial connection between your target machine
  15759. and the GDB host, and identify the serial port on the host.
  15760. 6. Download your program to your target machine (or get it there by
  15761. whatever means the manufacturer provides), and start it.
  15762. 7. Start GDB on the host, and connect to the target (*note Connecting
  15763. to a Remote Target: Connecting.).
  15764. 
  15765. File: gdb.info, Node: Configurations, Next: Controlling GDB, Prev: Remote Debugging, Up: Top
  15766. 21 Configuration-Specific Information
  15767. *************************************
  15768. While nearly all GDB commands are available for all native and cross
  15769. versions of the debugger, there are some exceptions. This chapter
  15770. describes things that are only available in certain configurations.
  15771. There are three major categories of configurations: native
  15772. configurations, where the host and target are the same, embedded
  15773. operating system configurations, which are usually the same for several
  15774. different processor architectures, and bare embedded processors, which
  15775. are quite different from each other.
  15776. * Menu:
  15777. * Native::
  15778. * Embedded OS::
  15779. * Embedded Processors::
  15780. * Architectures::
  15781. 
  15782. File: gdb.info, Node: Native, Next: Embedded OS, Up: Configurations
  15783. 21.1 Native
  15784. ===========
  15785. This section describes details specific to particular native
  15786. configurations.
  15787. * Menu:
  15788. * BSD libkvm Interface:: Debugging BSD kernel memory images
  15789. * Process Information:: Process information
  15790. * DJGPP Native:: Features specific to the DJGPP port
  15791. * Cygwin Native:: Features specific to the Cygwin port
  15792. * Hurd Native:: Features specific to GNU Hurd
  15793. * Darwin:: Features specific to Darwin
  15794. * FreeBSD:: Features specific to FreeBSD
  15795. 
  15796. File: gdb.info, Node: BSD libkvm Interface, Next: Process Information, Up: Native
  15797. 21.1.1 BSD libkvm Interface
  15798. ---------------------------
  15799. BSD-derived systems (FreeBSD/NetBSD/OpenBSD) have a kernel memory
  15800. interface that provides a uniform interface for accessing kernel virtual
  15801. memory images, including live systems and crash dumps. GDB uses this
  15802. interface to allow you to debug live kernels and kernel crash dumps on
  15803. many native BSD configurations. This is implemented as a special 'kvm'
  15804. debugging target. For debugging a live system, load the currently
  15805. running kernel into GDB and connect to the 'kvm' target:
  15806. (gdb) target kvm
  15807. For debugging crash dumps, provide the file name of the crash dump as
  15808. an argument:
  15809. (gdb) target kvm /var/crash/bsd.0
  15810. Once connected to the 'kvm' target, the following commands are
  15811. available:
  15812. 'kvm pcb'
  15813. Set current context from the "Process Control Block" (PCB) address.
  15814. 'kvm proc'
  15815. Set current context from proc address. This command isn't
  15816. available on modern FreeBSD systems.
  15817. 
  15818. File: gdb.info, Node: Process Information, Next: DJGPP Native, Prev: BSD libkvm Interface, Up: Native
  15819. 21.1.2 Process Information
  15820. --------------------------
  15821. Some operating systems provide interfaces to fetch additional
  15822. information about running processes beyond memory and per-thread
  15823. register state. If GDB is configured for an operating system with a
  15824. supported interface, the command 'info proc' is available to report
  15825. information about the process running your program, or about any process
  15826. running on your system.
  15827. One supported interface is a facility called '/proc' that can be used
  15828. to examine the image of a running process using file-system subroutines.
  15829. This facility is supported on GNU/Linux and Solaris systems.
  15830. On FreeBSD and NetBSD systems, system control nodes are used to query
  15831. process information.
  15832. In addition, some systems may provide additional process information
  15833. in core files. Note that a core file may include a subset of the
  15834. information available from a live process. Process information is
  15835. currently available from cores created on GNU/Linux and FreeBSD systems.
  15836. 'info proc'
  15837. 'info proc PROCESS-ID'
  15838. Summarize available information about a process. If a process ID
  15839. is specified by PROCESS-ID, display information about that process;
  15840. otherwise display information about the program being debugged.
  15841. The summary includes the debugged process ID, the command line used
  15842. to invoke it, its current working directory, and its executable
  15843. file's absolute file name.
  15844. On some systems, PROCESS-ID can be of the form '[PID]/TID' which
  15845. specifies a certain thread ID within a process. If the optional
  15846. PID part is missing, it means a thread from the process being
  15847. debugged (the leading '/' still needs to be present, or else GDB
  15848. will interpret the number as a process ID rather than a thread ID).
  15849. 'info proc cmdline'
  15850. Show the original command line of the process. This command is
  15851. supported on GNU/Linux, FreeBSD and NetBSD.
  15852. 'info proc cwd'
  15853. Show the current working directory of the process. This command is
  15854. supported on GNU/Linux, FreeBSD and NetBSD.
  15855. 'info proc exe'
  15856. Show the name of executable of the process. This command is
  15857. supported on GNU/Linux, FreeBSD and NetBSD.
  15858. 'info proc files'
  15859. Show the file descriptors open by the process. For each open file
  15860. descriptor, GDB shows its number, type (file, directory, character
  15861. device, socket), file pointer offset, and the name of the resource
  15862. open on the descriptor. The resource name can be a file name (for
  15863. files, directories, and devices) or a protocol followed by socket
  15864. address (for network connections). This command is supported on
  15865. FreeBSD.
  15866. This example shows the open file descriptors for a process using a
  15867. tty for standard input and output as well as two network sockets:
  15868. (gdb) info proc files 22136
  15869. process 22136
  15870. Open files:
  15871. FD Type Offset Flags Name
  15872. text file - r-------- /usr/bin/ssh
  15873. ctty chr - rw------- /dev/pts/20
  15874. cwd dir - r-------- /usr/home/john
  15875. root dir - r-------- /
  15876. 0 chr 0x32933a4 rw------- /dev/pts/20
  15877. 1 chr 0x32933a4 rw------- /dev/pts/20
  15878. 2 chr 0x32933a4 rw------- /dev/pts/20
  15879. 3 socket 0x0 rw----n-- tcp4 10.0.1.2:53014 -> 10.0.1.10:22
  15880. 4 socket 0x0 rw------- unix stream:/tmp/ssh-FIt89oAzOn5f/agent.2456
  15881. 'info proc mappings'
  15882. Report the memory address space ranges accessible in a process. On
  15883. Solaris, FreeBSD and NetBSD systems, each memory range includes
  15884. information on whether the process has read, write, or execute
  15885. access rights to each range. On GNU/Linux, FreeBSD and NetBSD
  15886. systems, each memory range includes the object file which is mapped
  15887. to that range.
  15888. 'info proc stat'
  15889. 'info proc status'
  15890. Show additional process-related information, including the user ID
  15891. and group ID; virtual memory usage; the signals that are pending,
  15892. blocked, and ignored; its TTY; its consumption of system and user
  15893. time; its stack size; its 'nice' value; etc. These commands are
  15894. supported on GNU/Linux, FreeBSD and NetBSD.
  15895. For GNU/Linux systems, see the 'proc' man page for more information
  15896. (type 'man 5 proc' from your shell prompt).
  15897. For FreeBSD and NetBSD systems, 'info proc stat' is an alias for
  15898. 'info proc status'.
  15899. 'info proc all'
  15900. Show all the information about the process described under all of
  15901. the above 'info proc' subcommands.
  15902. 'set procfs-trace'
  15903. This command enables and disables tracing of 'procfs' API calls.
  15904. 'show procfs-trace'
  15905. Show the current state of 'procfs' API call tracing.
  15906. 'set procfs-file FILE'
  15907. Tell GDB to write 'procfs' API trace to the named FILE. GDB
  15908. appends the trace info to the previous contents of the file. The
  15909. default is to display the trace on the standard output.
  15910. 'show procfs-file'
  15911. Show the file to which 'procfs' API trace is written.
  15912. 'proc-trace-entry'
  15913. 'proc-trace-exit'
  15914. 'proc-untrace-entry'
  15915. 'proc-untrace-exit'
  15916. These commands enable and disable tracing of entries into and exits
  15917. from the 'syscall' interface.
  15918. 'info pidlist'
  15919. For QNX Neutrino only, this command displays the list of all the
  15920. processes and all the threads within each process.
  15921. 'info meminfo'
  15922. For QNX Neutrino only, this command displays the list of all
  15923. mapinfos.
  15924. 
  15925. File: gdb.info, Node: DJGPP Native, Next: Cygwin Native, Prev: Process Information, Up: Native
  15926. 21.1.3 Features for Debugging DJGPP Programs
  15927. --------------------------------------------
  15928. DJGPP is a port of the GNU development tools to MS-DOS and MS-Windows.
  15929. DJGPP programs are 32-bit protected-mode programs that use the "DPMI"
  15930. (DOS Protected-Mode Interface) API to run on top of real-mode DOS
  15931. systems and their emulations.
  15932. GDB supports native debugging of DJGPP programs, and defines a few
  15933. commands specific to the DJGPP port. This subsection describes those
  15934. commands.
  15935. 'info dos'
  15936. This is a prefix of DJGPP-specific commands which print information
  15937. about the target system and important OS structures.
  15938. 'info dos sysinfo'
  15939. This command displays assorted information about the underlying
  15940. platform: the CPU type and features, the OS version and flavor, the
  15941. DPMI version, and the available conventional and DPMI memory.
  15942. 'info dos gdt'
  15943. 'info dos ldt'
  15944. 'info dos idt'
  15945. These 3 commands display entries from, respectively, Global, Local,
  15946. and Interrupt Descriptor Tables (GDT, LDT, and IDT). The descriptor
  15947. tables are data structures which store a descriptor for each
  15948. segment that is currently in use. The segment's selector is an
  15949. index into a descriptor table; the table entry for that index holds
  15950. the descriptor's base address and limit, and its attributes and
  15951. access rights.
  15952. A typical DJGPP program uses 3 segments: a code segment, a data
  15953. segment (used for both data and the stack), and a DOS segment
  15954. (which allows access to DOS/BIOS data structures and absolute
  15955. addresses in conventional memory). However, the DPMI host will
  15956. usually define additional segments in order to support the DPMI
  15957. environment.
  15958. These commands allow to display entries from the descriptor tables.
  15959. Without an argument, all entries from the specified table are
  15960. displayed. An argument, which should be an integer expression,
  15961. means display a single entry whose index is given by the argument.
  15962. For example, here's a convenient way to display information about
  15963. the debugged program's data segment:
  15964. (gdb) info dos ldt $ds
  15965. 0x13f: base=0x11970000 limit=0x0009ffff 32-Bit Data (Read/Write, Exp-up)
  15966. This comes in handy when you want to see whether a pointer is
  15967. outside the data segment's limit (i.e. "garbled").
  15968. 'info dos pde'
  15969. 'info dos pte'
  15970. These two commands display entries from, respectively, the Page
  15971. Directory and the Page Tables. Page Directories and Page Tables
  15972. are data structures which control how virtual memory addresses are
  15973. mapped into physical addresses. A Page Table includes an entry for
  15974. every page of memory that is mapped into the program's address
  15975. space; there may be several Page Tables, each one holding up to
  15976. 4096 entries. A Page Directory has up to 4096 entries, one each
  15977. for every Page Table that is currently in use.
  15978. Without an argument, 'info dos pde' displays the entire Page
  15979. Directory, and 'info dos pte' displays all the entries in all of
  15980. the Page Tables. An argument, an integer expression, given to the
  15981. 'info dos pde' command means display only that entry from the Page
  15982. Directory table. An argument given to the 'info dos pte' command
  15983. means display entries from a single Page Table, the one pointed to
  15984. by the specified entry in the Page Directory.
  15985. These commands are useful when your program uses "DMA" (Direct
  15986. Memory Access), which needs physical addresses to program the DMA
  15987. controller.
  15988. These commands are supported only with some DPMI servers.
  15989. 'info dos address-pte ADDR'
  15990. This command displays the Page Table entry for a specified linear
  15991. address. The argument ADDR is a linear address which should
  15992. already have the appropriate segment's base address added to it,
  15993. because this command accepts addresses which may belong to _any_
  15994. segment. For example, here's how to display the Page Table entry
  15995. for the page where a variable 'i' is stored:
  15996. (gdb) info dos address-pte __djgpp_base_address + (char *)&i
  15997. Page Table entry for address 0x11a00d30:
  15998. Base=0x02698000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0xd30
  15999. This says that 'i' is stored at offset '0xd30' from the page whose
  16000. physical base address is '0x02698000', and shows all the attributes
  16001. of that page.
  16002. Note that you must cast the addresses of variables to a 'char *',
  16003. since otherwise the value of '__djgpp_base_address', the base
  16004. address of all variables and functions in a DJGPP program, will be
  16005. added using the rules of C pointer arithmetics: if 'i' is declared
  16006. an 'int', GDB will add 4 times the value of '__djgpp_base_address'
  16007. to the address of 'i'.
  16008. Here's another example, it displays the Page Table entry for the
  16009. transfer buffer:
  16010. (gdb) info dos address-pte *((unsigned *)&_go32_info_block + 3)
  16011. Page Table entry for address 0x29110:
  16012. Base=0x00029000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0x110
  16013. (The '+ 3' offset is because the transfer buffer's address is the
  16014. 3rd member of the '_go32_info_block' structure.) The output
  16015. clearly shows that this DPMI server maps the addresses in
  16016. conventional memory 1:1, i.e. the physical ('0x00029000' + '0x110')
  16017. and linear ('0x29110') addresses are identical.
  16018. This command is supported only with some DPMI servers.
  16019. In addition to native debugging, the DJGPP port supports remote
  16020. debugging via a serial data link. The following commands are specific
  16021. to remote serial debugging in the DJGPP port of GDB.
  16022. 'set com1base ADDR'
  16023. This command sets the base I/O port address of the 'COM1' serial
  16024. port.
  16025. 'set com1irq IRQ'
  16026. This command sets the "Interrupt Request" ('IRQ') line to use for
  16027. the 'COM1' serial port.
  16028. There are similar commands 'set com2base', 'set com3irq', etc. for
  16029. setting the port address and the 'IRQ' lines for the other 3 COM
  16030. ports.
  16031. The related commands 'show com1base', 'show com1irq' etc. display
  16032. the current settings of the base address and the 'IRQ' lines used
  16033. by the COM ports.
  16034. 'info serial'
  16035. This command prints the status of the 4 DOS serial ports. For each
  16036. port, it prints whether it's active or not, its I/O base address
  16037. and IRQ number, whether it uses a 16550-style FIFO, its baudrate,
  16038. and the counts of various errors encountered so far.
  16039. 
  16040. File: gdb.info, Node: Cygwin Native, Next: Hurd Native, Prev: DJGPP Native, Up: Native
  16041. 21.1.4 Features for Debugging MS Windows PE Executables
  16042. -------------------------------------------------------
  16043. GDB supports native debugging of MS Windows programs, including DLLs
  16044. with and without symbolic debugging information.
  16045. MS-Windows programs that call 'SetConsoleMode' to switch off the
  16046. special meaning of the 'Ctrl-C' keystroke cannot be interrupted by
  16047. typing 'C-c'. For this reason, GDB on MS-Windows supports 'C-<BREAK>'
  16048. as an alternative interrupt key sequence, which can be used to interrupt
  16049. the debuggee even if it ignores 'C-c'.
  16050. There are various additional Cygwin-specific commands, described in
  16051. this section. Working with DLLs that have no debugging symbols is
  16052. described in *note Non-debug DLL Symbols::.
  16053. 'info w32'
  16054. This is a prefix of MS Windows-specific commands which print
  16055. information about the target system and important OS structures.
  16056. 'info w32 selector'
  16057. This command displays information returned by the Win32 API
  16058. 'GetThreadSelectorEntry' function. It takes an optional argument
  16059. that is evaluated to a long value to give the information about
  16060. this given selector. Without argument, this command displays
  16061. information about the six segment registers.
  16062. 'info w32 thread-information-block'
  16063. This command displays thread specific information stored in the
  16064. Thread Information Block (readable on the X86 CPU family using
  16065. '$fs' selector for 32-bit programs and '$gs' for 64-bit programs).
  16066. 'signal-event ID'
  16067. This command signals an event with user-provided ID. Used to
  16068. resume crashing process when attached to it using MS-Windows JIT
  16069. debugging (AeDebug).
  16070. To use it, create or edit the following keys in
  16071. 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug' and/or
  16072. 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows
  16073. NT\CurrentVersion\AeDebug' (for x86_64 versions):
  16074. - 'Debugger' (REG_SZ) -- a command to launch the debugger.
  16075. Suggested command is: 'FULLY-QUALIFIED-PATH-TO-GDB.EXE -ex
  16076. "attach %ld" -ex "signal-event %ld" -ex "continue"'.
  16077. The first '%ld' will be replaced by the process ID of the
  16078. crashing process, the second '%ld' will be replaced by the ID
  16079. of the event that blocks the crashing process, waiting for GDB
  16080. to attach.
  16081. - 'Auto' (REG_SZ) -- either '1' or '0'. '1' will make the
  16082. system run debugger specified by the Debugger key
  16083. automatically, '0' will cause a dialog box with "OK" and
  16084. "Cancel" buttons to appear, which allows the user to either
  16085. terminate the crashing process (OK) or debug it (Cancel).
  16086. 'set cygwin-exceptions MODE'
  16087. If MODE is 'on', GDB will break on exceptions that happen inside
  16088. the Cygwin DLL. If MODE is 'off', GDB will delay recognition of
  16089. exceptions, and may ignore some exceptions which seem to be caused
  16090. by internal Cygwin DLL "bookkeeping". This option is meant
  16091. primarily for debugging the Cygwin DLL itself; the default value is
  16092. 'off' to avoid annoying GDB users with false 'SIGSEGV' signals.
  16093. 'show cygwin-exceptions'
  16094. Displays whether GDB will break on exceptions that happen inside
  16095. the Cygwin DLL itself.
  16096. 'set new-console MODE'
  16097. If MODE is 'on' the debuggee will be started in a new console on
  16098. next start. If MODE is 'off', the debuggee will be started in the
  16099. same console as the debugger.
  16100. 'show new-console'
  16101. Displays whether a new console is used when the debuggee is
  16102. started.
  16103. 'set new-group MODE'
  16104. This boolean value controls whether the debuggee should start a new
  16105. group or stay in the same group as the debugger. This affects the
  16106. way the Windows OS handles 'Ctrl-C'.
  16107. 'show new-group'
  16108. Displays current value of new-group boolean.
  16109. 'set debugevents'
  16110. This boolean value adds debug output concerning kernel events
  16111. related to the debuggee seen by the debugger. This includes events
  16112. that signal thread and process creation and exit, DLL loading and
  16113. unloading, console interrupts, and debugging messages produced by
  16114. the Windows 'OutputDebugString' API call.
  16115. 'set debugexec'
  16116. This boolean value adds debug output concerning execute events
  16117. (such as resume thread) seen by the debugger.
  16118. 'set debugexceptions'
  16119. This boolean value adds debug output concerning exceptions in the
  16120. debuggee seen by the debugger.
  16121. 'set debugmemory'
  16122. This boolean value adds debug output concerning debuggee memory
  16123. reads and writes by the debugger.
  16124. 'set shell'
  16125. This boolean values specifies whether the debuggee is called via a
  16126. shell or directly (default value is on).
  16127. 'show shell'
  16128. Displays if the debuggee will be started with a shell.
  16129. * Menu:
  16130. * Non-debug DLL Symbols:: Support for DLLs without debugging symbols
  16131. 
  16132. File: gdb.info, Node: Non-debug DLL Symbols, Up: Cygwin Native
  16133. 21.1.4.1 Support for DLLs without Debugging Symbols
  16134. ...................................................
  16135. Very often on windows, some of the DLLs that your program relies on do
  16136. not include symbolic debugging information (for example,
  16137. 'kernel32.dll'). When GDB doesn't recognize any debugging symbols in a
  16138. DLL, it relies on the minimal amount of symbolic information contained
  16139. in the DLL's export table. This section describes working with such
  16140. symbols, known internally to GDB as "minimal symbols".
  16141. Note that before the debugged program has started execution, no DLLs
  16142. will have been loaded. The easiest way around this problem is simply to
  16143. start the program -- either by setting a breakpoint or letting the
  16144. program run once to completion.
  16145. 21.1.4.2 DLL Name Prefixes
  16146. ..........................
  16147. In keeping with the naming conventions used by the Microsoft debugging
  16148. tools, DLL export symbols are made available with a prefix based on the
  16149. DLL name, for instance 'KERNEL32!CreateFileA'. The plain name is also
  16150. entered into the symbol table, so 'CreateFileA' is often sufficient. In
  16151. some cases there will be name clashes within a program (particularly if
  16152. the executable itself includes full debugging symbols) necessitating the
  16153. use of the fully qualified name when referring to the contents of the
  16154. DLL. Use single-quotes around the name to avoid the exclamation mark
  16155. ("!") being interpreted as a language operator.
  16156. Note that the internal name of the DLL may be all upper-case, even
  16157. though the file name of the DLL is lower-case, or vice-versa. Since
  16158. symbols within GDB are _case-sensitive_ this may cause some confusion.
  16159. If in doubt, try the 'info functions' and 'info variables' commands or
  16160. even 'maint print msymbols' (*note Symbols::). Here's an example:
  16161. (gdb) info function CreateFileA
  16162. All functions matching regular expression "CreateFileA":
  16163. Non-debugging symbols:
  16164. 0x77e885f4 CreateFileA
  16165. 0x77e885f4 KERNEL32!CreateFileA
  16166. (gdb) info function !
  16167. All functions matching regular expression "!":
  16168. Non-debugging symbols:
  16169. 0x6100114c cygwin1!__assert
  16170. 0x61004034 cygwin1!_dll_crt0@0
  16171. 0x61004240 cygwin1!dll_crt0(per_process *)
  16172. [etc...]
  16173. 21.1.4.3 Working with Minimal Symbols
  16174. .....................................
  16175. Symbols extracted from a DLL's export table do not contain very much
  16176. type information. All that GDB can do is guess whether a symbol refers
  16177. to a function or variable depending on the linker section that contains
  16178. the symbol. Also note that the actual contents of the memory contained
  16179. in a DLL are not available unless the program is running. This means
  16180. that you cannot examine the contents of a variable or disassemble a
  16181. function within a DLL without a running program.
  16182. Variables are generally treated as pointers and dereferenced
  16183. automatically. For this reason, it is often necessary to prefix a
  16184. variable name with the address-of operator ("&") and provide explicit
  16185. type information in the command. Here's an example of the type of
  16186. problem:
  16187. (gdb) print 'cygwin1!__argv'
  16188. 'cygwin1!__argv' has unknown type; cast it to its declared type
  16189. (gdb) x 'cygwin1!__argv'
  16190. 'cygwin1!__argv' has unknown type; cast it to its declared type
  16191. And two possible solutions:
  16192. (gdb) print ((char **)'cygwin1!__argv')[0]
  16193. $2 = 0x22fd98 "/cygdrive/c/mydirectory/myprogram"
  16194. (gdb) x/2x &'cygwin1!__argv'
  16195. 0x610c0aa8 <cygwin1!__argv>: 0x10021608 0x00000000
  16196. (gdb) x/x 0x10021608
  16197. 0x10021608: 0x0022fd98
  16198. (gdb) x/s 0x0022fd98
  16199. 0x22fd98: "/cygdrive/c/mydirectory/myprogram"
  16200. Setting a break point within a DLL is possible even before the
  16201. program starts execution. However, under these circumstances, GDB can't
  16202. examine the initial instructions of the function in order to skip the
  16203. function's frame set-up code. You can work around this by using "*&" to
  16204. set the breakpoint at a raw memory address:
  16205. (gdb) break *&'python22!PyOS_Readline'
  16206. Breakpoint 1 at 0x1e04eff0
  16207. The author of these extensions is not entirely convinced that setting
  16208. a break point within a shared DLL like 'kernel32.dll' is completely
  16209. safe.
  16210. 
  16211. File: gdb.info, Node: Hurd Native, Next: Darwin, Prev: Cygwin Native, Up: Native
  16212. 21.1.5 Commands Specific to GNU Hurd Systems
  16213. --------------------------------------------
  16214. This subsection describes GDB commands specific to the GNU Hurd native
  16215. debugging.
  16216. 'set signals'
  16217. 'set sigs'
  16218. This command toggles the state of inferior signal interception by
  16219. GDB. Mach exceptions, such as breakpoint traps, are not affected
  16220. by this command. 'sigs' is a shorthand alias for 'signals'.
  16221. 'show signals'
  16222. 'show sigs'
  16223. Show the current state of intercepting inferior's signals.
  16224. 'set signal-thread'
  16225. 'set sigthread'
  16226. This command tells GDB which thread is the 'libc' signal thread.
  16227. That thread is run when a signal is delivered to a running process.
  16228. 'set sigthread' is the shorthand alias of 'set signal-thread'.
  16229. 'show signal-thread'
  16230. 'show sigthread'
  16231. These two commands show which thread will run when the inferior is
  16232. delivered a signal.
  16233. 'set stopped'
  16234. This commands tells GDB that the inferior process is stopped, as
  16235. with the 'SIGSTOP' signal. The stopped process can be continued by
  16236. delivering a signal to it.
  16237. 'show stopped'
  16238. This command shows whether GDB thinks the debuggee is stopped.
  16239. 'set exceptions'
  16240. Use this command to turn off trapping of exceptions in the
  16241. inferior. When exception trapping is off, neither breakpoints nor
  16242. single-stepping will work. To restore the default, set exception
  16243. trapping on.
  16244. 'show exceptions'
  16245. Show the current state of trapping exceptions in the inferior.
  16246. 'set task pause'
  16247. This command toggles task suspension when GDB has control. Setting
  16248. it to on takes effect immediately, and the task is suspended
  16249. whenever GDB gets control. Setting it to off will take effect the
  16250. next time the inferior is continued. If this option is set to off,
  16251. you can use 'set thread default pause on' or 'set thread pause on'
  16252. (see below) to pause individual threads.
  16253. 'show task pause'
  16254. Show the current state of task suspension.
  16255. 'set task detach-suspend-count'
  16256. This command sets the suspend count the task will be left with when
  16257. GDB detaches from it.
  16258. 'show task detach-suspend-count'
  16259. Show the suspend count the task will be left with when detaching.
  16260. 'set task exception-port'
  16261. 'set task excp'
  16262. This command sets the task exception port to which GDB will forward
  16263. exceptions. The argument should be the value of the "send rights"
  16264. of the task. 'set task excp' is a shorthand alias.
  16265. 'set noninvasive'
  16266. This command switches GDB to a mode that is the least invasive as
  16267. far as interfering with the inferior is concerned. This is the
  16268. same as using 'set task pause', 'set exceptions', and 'set signals'
  16269. to values opposite to the defaults.
  16270. 'info send-rights'
  16271. 'info receive-rights'
  16272. 'info port-rights'
  16273. 'info port-sets'
  16274. 'info dead-names'
  16275. 'info ports'
  16276. 'info psets'
  16277. These commands display information about, respectively, send
  16278. rights, receive rights, port rights, port sets, and dead names of a
  16279. task. There are also shorthand aliases: 'info ports' for 'info
  16280. port-rights' and 'info psets' for 'info port-sets'.
  16281. 'set thread pause'
  16282. This command toggles current thread suspension when GDB has
  16283. control. Setting it to on takes effect immediately, and the
  16284. current thread is suspended whenever GDB gets control. Setting it
  16285. to off will take effect the next time the inferior is continued.
  16286. Normally, this command has no effect, since when GDB has control,
  16287. the whole task is suspended. However, if you used 'set task pause
  16288. off' (see above), this command comes in handy to suspend only the
  16289. current thread.
  16290. 'show thread pause'
  16291. This command shows the state of current thread suspension.
  16292. 'set thread run'
  16293. This command sets whether the current thread is allowed to run.
  16294. 'show thread run'
  16295. Show whether the current thread is allowed to run.
  16296. 'set thread detach-suspend-count'
  16297. This command sets the suspend count GDB will leave on a thread when
  16298. detaching. This number is relative to the suspend count found by
  16299. GDB when it notices the thread; use 'set thread
  16300. takeover-suspend-count' to force it to an absolute value.
  16301. 'show thread detach-suspend-count'
  16302. Show the suspend count GDB will leave on the thread when detaching.
  16303. 'set thread exception-port'
  16304. 'set thread excp'
  16305. Set the thread exception port to which to forward exceptions. This
  16306. overrides the port set by 'set task exception-port' (see above).
  16307. 'set thread excp' is the shorthand alias.
  16308. 'set thread takeover-suspend-count'
  16309. Normally, GDB's thread suspend counts are relative to the value GDB
  16310. finds when it notices each thread. This command changes the
  16311. suspend counts to be absolute instead.
  16312. 'set thread default'
  16313. 'show thread default'
  16314. Each of the above 'set thread' commands has a 'set thread default'
  16315. counterpart (e.g., 'set thread default pause', 'set thread default
  16316. exception-port', etc.). The 'thread default' variety of commands
  16317. sets the default thread properties for all threads; you can then
  16318. change the properties of individual threads with the non-default
  16319. commands.
  16320. 
  16321. File: gdb.info, Node: Darwin, Next: FreeBSD, Prev: Hurd Native, Up: Native
  16322. 21.1.6 Darwin
  16323. -------------
  16324. GDB provides the following commands specific to the Darwin target:
  16325. 'set debug darwin NUM'
  16326. When set to a non zero value, enables debugging messages specific
  16327. to the Darwin support. Higher values produce more verbose output.
  16328. 'show debug darwin'
  16329. Show the current state of Darwin messages.
  16330. 'set debug mach-o NUM'
  16331. When set to a non zero value, enables debugging messages while GDB
  16332. is reading Darwin object files. ("Mach-O" is the file format used
  16333. on Darwin for object and executable files.) Higher values produce
  16334. more verbose output. This is a command to diagnose problems
  16335. internal to GDB and should not be needed in normal usage.
  16336. 'show debug mach-o'
  16337. Show the current state of Mach-O file messages.
  16338. 'set mach-exceptions on'
  16339. 'set mach-exceptions off'
  16340. On Darwin, faults are first reported as a Mach exception and are
  16341. then mapped to a Posix signal. Use this command to turn on
  16342. trapping of Mach exceptions in the inferior. This might be
  16343. sometimes useful to better understand the cause of a fault. The
  16344. default is off.
  16345. 'show mach-exceptions'
  16346. Show the current state of exceptions trapping.
  16347. 
  16348. File: gdb.info, Node: FreeBSD, Prev: Darwin, Up: Native
  16349. 21.1.7 FreeBSD
  16350. --------------
  16351. When the ABI of a system call is changed in the FreeBSD kernel, this is
  16352. implemented by leaving a compatibility system call using the old ABI at
  16353. the existing number and allocating a new system call number for the
  16354. version using the new ABI. As a convenience, when a system call is
  16355. caught by name (*note catch syscall::), compatibility system calls are
  16356. also caught.
  16357. For example, FreeBSD 12 introduced a new variant of the 'kevent'
  16358. system call and catching the 'kevent' system call by name catches both
  16359. variants:
  16360. (gdb) catch syscall kevent
  16361. Catchpoint 1 (syscalls 'freebsd11_kevent' [363] 'kevent' [560])
  16362. (gdb)
  16363. 
  16364. File: gdb.info, Node: Embedded OS, Next: Embedded Processors, Prev: Native, Up: Configurations
  16365. 21.2 Embedded Operating Systems
  16366. ===============================
  16367. This section describes configurations involving the debugging of
  16368. embedded operating systems that are available for several different
  16369. architectures.
  16370. GDB includes the ability to debug programs running on various
  16371. real-time operating systems.
  16372. 
  16373. File: gdb.info, Node: Embedded Processors, Next: Architectures, Prev: Embedded OS, Up: Configurations
  16374. 21.3 Embedded Processors
  16375. ========================
  16376. This section goes into details specific to particular embedded
  16377. configurations.
  16378. Whenever a specific embedded processor has a simulator, GDB allows to
  16379. send an arbitrary command to the simulator.
  16380. 'sim COMMAND'
  16381. Send an arbitrary COMMAND string to the simulator. Consult the
  16382. documentation for the specific simulator in use for information
  16383. about acceptable commands.
  16384. * Menu:
  16385. * ARC:: Synopsys ARC
  16386. * ARM:: ARM
  16387. * BPF:: eBPF
  16388. * M68K:: Motorola M68K
  16389. * MicroBlaze:: Xilinx MicroBlaze
  16390. * MIPS Embedded:: MIPS Embedded
  16391. * OpenRISC 1000:: OpenRISC 1000 (or1k)
  16392. * PowerPC Embedded:: PowerPC Embedded
  16393. * AVR:: Atmel AVR
  16394. * CRIS:: CRIS
  16395. * Super-H:: Renesas Super-H
  16396. 
  16397. File: gdb.info, Node: ARC, Next: ARM, Up: Embedded Processors
  16398. 21.3.1 Synopsys ARC
  16399. -------------------
  16400. GDB provides the following ARC-specific commands:
  16401. 'set debug arc'
  16402. Control the level of ARC specific debug messages. Use 0 for no
  16403. messages (the default), 1 for debug messages, and 2 for even more
  16404. debug messages.
  16405. 'show debug arc'
  16406. Show the level of ARC specific debugging in operation.
  16407. 'maint print arc arc-instruction ADDRESS'
  16408. Print internal disassembler information about instruction at a
  16409. given address.
  16410. 
  16411. File: gdb.info, Node: ARM, Next: BPF, Prev: ARC, Up: Embedded Processors
  16412. 21.3.2 ARM
  16413. ----------
  16414. GDB provides the following ARM-specific commands:
  16415. 'set arm disassembler'
  16416. This commands selects from a list of disassembly styles. The
  16417. '"std"' style is the standard style.
  16418. 'show arm disassembler'
  16419. Show the current disassembly style.
  16420. 'set arm apcs32'
  16421. This command toggles ARM operation mode between 32-bit and 26-bit.
  16422. 'show arm apcs32'
  16423. Display the current usage of the ARM 32-bit mode.
  16424. 'set arm fpu FPUTYPE'
  16425. This command sets the ARM floating-point unit (FPU) type. The
  16426. argument FPUTYPE can be one of these:
  16427. 'auto'
  16428. Determine the FPU type by querying the OS ABI.
  16429. 'softfpa'
  16430. Software FPU, with mixed-endian doubles on little-endian ARM
  16431. processors.
  16432. 'fpa'
  16433. GCC-compiled FPA co-processor.
  16434. 'softvfp'
  16435. Software FPU with pure-endian doubles.
  16436. 'vfp'
  16437. VFP co-processor.
  16438. 'show arm fpu'
  16439. Show the current type of the FPU.
  16440. 'set arm abi'
  16441. This command forces GDB to use the specified ABI.
  16442. 'show arm abi'
  16443. Show the currently used ABI.
  16444. 'set arm fallback-mode (arm|thumb|auto)'
  16445. GDB uses the symbol table, when available, to determine whether
  16446. instructions are ARM or Thumb. This command controls GDB's default
  16447. behavior when the symbol table is not available. The default is
  16448. 'auto', which causes GDB to use the current execution mode (from
  16449. the 'T' bit in the 'CPSR' register).
  16450. 'show arm fallback-mode'
  16451. Show the current fallback instruction mode.
  16452. 'set arm force-mode (arm|thumb|auto)'
  16453. This command overrides use of the symbol table to determine whether
  16454. instructions are ARM or Thumb. The default is 'auto', which causes
  16455. GDB to use the symbol table and then the setting of 'set arm
  16456. fallback-mode'.
  16457. 'show arm force-mode'
  16458. Show the current forced instruction mode.
  16459. 'set debug arm'
  16460. Toggle whether to display ARM-specific debugging messages from the
  16461. ARM target support subsystem.
  16462. 'show debug arm'
  16463. Show whether ARM-specific debugging messages are enabled.
  16464. 'target sim [SIMARGS] ...'
  16465. The GDB ARM simulator accepts the following optional arguments.
  16466. '--swi-support=TYPE'
  16467. Tell the simulator which SWI interfaces to support. The
  16468. argument TYPE may be a comma separated list of the following
  16469. values. The default value is 'all'.
  16470. 'none'
  16471. 'demon'
  16472. 'angel'
  16473. 'redboot'
  16474. 'all'
  16475. 
  16476. File: gdb.info, Node: BPF, Next: M68K, Prev: ARM, Up: Embedded Processors
  16477. 21.3.3 BPF
  16478. ----------
  16479. 'target sim [SIMARGS] ...'
  16480. The GDB BPF simulator accepts the following optional arguments.
  16481. '--skb-data-offset=OFFSET'
  16482. Tell the simulator the offset, measured in bytes, of the
  16483. 'skb_data' field in the kernel 'struct sk_buff' structure.
  16484. This offset is used by some BPF specific-purpose load/store
  16485. instructions. Defaults to 0.
  16486. 
  16487. File: gdb.info, Node: M68K, Next: MicroBlaze, Prev: BPF, Up: Embedded Processors
  16488. 21.3.4 M68k
  16489. -----------
  16490. The Motorola m68k configuration includes ColdFire support.
  16491. 
  16492. File: gdb.info, Node: MicroBlaze, Next: MIPS Embedded, Prev: M68K, Up: Embedded Processors
  16493. 21.3.5 MicroBlaze
  16494. -----------------
  16495. The MicroBlaze is a soft-core processor supported on various Xilinx
  16496. FPGAs, such as Spartan or Virtex series. Boards with these processors
  16497. usually have JTAG ports which connect to a host system running the
  16498. Xilinx Embedded Development Kit (EDK) or Software Development Kit (SDK).
  16499. This host system is used to download the configuration bitstream to the
  16500. target FPGA. The Xilinx Microprocessor Debugger (XMD) program
  16501. communicates with the target board using the JTAG interface and presents
  16502. a 'gdbserver' interface to the board. By default 'xmd' uses port
  16503. '1234'. (While it is possible to change this default port, it requires
  16504. the use of undocumented 'xmd' commands. Contact Xilinx support if you
  16505. need to do this.)
  16506. Use these GDB commands to connect to the MicroBlaze target processor.
  16507. 'target remote :1234'
  16508. Use this command to connect to the target if you are running GDB on
  16509. the same system as 'xmd'.
  16510. 'target remote XMD-HOST:1234'
  16511. Use this command to connect to the target if it is connected to
  16512. 'xmd' running on a different system named XMD-HOST.
  16513. 'load'
  16514. Use this command to download a program to the MicroBlaze target.
  16515. 'set debug microblaze N'
  16516. Enable MicroBlaze-specific debugging messages if non-zero.
  16517. 'show debug microblaze N'
  16518. Show MicroBlaze-specific debugging level.
  16519. 
  16520. File: gdb.info, Node: MIPS Embedded, Next: OpenRISC 1000, Prev: MicroBlaze, Up: Embedded Processors
  16521. 21.3.6 MIPS Embedded
  16522. --------------------
  16523. GDB supports these special commands for MIPS targets:
  16524. 'set mipsfpu double'
  16525. 'set mipsfpu single'
  16526. 'set mipsfpu none'
  16527. 'set mipsfpu auto'
  16528. 'show mipsfpu'
  16529. If your target board does not support the MIPS floating point
  16530. coprocessor, you should use the command 'set mipsfpu none' (if you
  16531. need this, you may wish to put the command in your GDB init file).
  16532. This tells GDB how to find the return value of functions which
  16533. return floating point values. It also allows GDB to avoid saving
  16534. the floating point registers when calling functions on the board.
  16535. If you are using a floating point coprocessor with only single
  16536. precision floating point support, as on the R4650 processor, use
  16537. the command 'set mipsfpu single'. The default double precision
  16538. floating point coprocessor may be selected using 'set mipsfpu
  16539. double'.
  16540. In previous versions the only choices were double precision or no
  16541. floating point, so 'set mipsfpu on' will select double precision
  16542. and 'set mipsfpu off' will select no floating point.
  16543. As usual, you can inquire about the 'mipsfpu' variable with 'show
  16544. mipsfpu'.
  16545. 
  16546. File: gdb.info, Node: OpenRISC 1000, Next: PowerPC Embedded, Prev: MIPS Embedded, Up: Embedded Processors
  16547. 21.3.7 OpenRISC 1000
  16548. --------------------
  16549. The OpenRISC 1000 provides a free RISC instruction set architecture. It
  16550. is mainly provided as a soft-core which can run on Xilinx, Altera and
  16551. other FPGA's.
  16552. GDB for OpenRISC supports the below commands when connecting to a
  16553. target:
  16554. 'target sim'
  16555. Runs the builtin CPU simulator which can run very basic programs
  16556. but does not support most hardware functions like MMU. For more
  16557. complex use cases the user is advised to run an external target,
  16558. and connect using 'target remote'.
  16559. Example: 'target sim'
  16560. 'set debug or1k'
  16561. Toggle whether to display OpenRISC-specific debugging messages from
  16562. the OpenRISC target support subsystem.
  16563. 'show debug or1k'
  16564. Show whether OpenRISC-specific debugging messages are enabled.
  16565. 
  16566. File: gdb.info, Node: PowerPC Embedded, Next: AVR, Prev: OpenRISC 1000, Up: Embedded Processors
  16567. 21.3.8 PowerPC Embedded
  16568. -----------------------
  16569. GDB supports using the DVC (Data Value Compare) register to implement in
  16570. hardware simple hardware watchpoint conditions of the form:
  16571. (gdb) watch ADDRESS|VARIABLE \
  16572. if ADDRESS|VARIABLE == CONSTANT EXPRESSION
  16573. The DVC register will be automatically used when GDB detects such
  16574. pattern in a condition expression, and the created watchpoint uses one
  16575. debug register (either the 'exact-watchpoints' option is on and the
  16576. variable is scalar, or the variable has a length of one byte). This
  16577. feature is available in native GDB running on a Linux kernel version
  16578. 2.6.34 or newer.
  16579. When running on PowerPC embedded processors, GDB automatically uses
  16580. ranged hardware watchpoints, unless the 'exact-watchpoints' option is
  16581. on, in which case watchpoints using only one debug register are created
  16582. when watching variables of scalar types.
  16583. You can create an artificial array to watch an arbitrary memory
  16584. region using one of the following commands (*note Expressions::):
  16585. (gdb) watch *((char *) ADDRESS)@LENGTH
  16586. (gdb) watch {char[LENGTH]} ADDRESS
  16587. PowerPC embedded processors support masked watchpoints. See the
  16588. discussion about the 'mask' argument in *note Set Watchpoints::.
  16589. PowerPC embedded processors support hardware accelerated "ranged
  16590. breakpoints". A ranged breakpoint stops execution of the inferior
  16591. whenever it executes an instruction at any address within the range it
  16592. specifies. To set a ranged breakpoint in GDB, use the 'break-range'
  16593. command.
  16594. GDB provides the following PowerPC-specific commands:
  16595. 'break-range START-LOCATION, END-LOCATION'
  16596. Set a breakpoint for an address range given by START-LOCATION and
  16597. END-LOCATION, which can specify a function name, a line number, an
  16598. offset of lines from the current line or from the start location,
  16599. or an address of an instruction (see *note Specify Location::, for
  16600. a list of all the possible ways to specify a LOCATION.) The
  16601. breakpoint will stop execution of the inferior whenever it executes
  16602. an instruction at any address within the specified range,
  16603. (including START-LOCATION and END-LOCATION.)
  16604. 'set powerpc soft-float'
  16605. 'show powerpc soft-float'
  16606. Force GDB to use (or not use) a software floating point calling
  16607. convention. By default, GDB selects the calling convention based
  16608. on the selected architecture and the provided executable file.
  16609. 'set powerpc vector-abi'
  16610. 'show powerpc vector-abi'
  16611. Force GDB to use the specified calling convention for vector
  16612. arguments and return values. The valid options are 'auto';
  16613. 'generic', to avoid vector registers even if they are present;
  16614. 'altivec', to use AltiVec registers; and 'spe' to use SPE
  16615. registers. By default, GDB selects the calling convention based on
  16616. the selected architecture and the provided executable file.
  16617. 'set powerpc exact-watchpoints'
  16618. 'show powerpc exact-watchpoints'
  16619. Allow GDB to use only one debug register when watching a variable
  16620. of scalar type, thus assuming that the variable is accessed through
  16621. the address of its first byte.
  16622. 
  16623. File: gdb.info, Node: AVR, Next: CRIS, Prev: PowerPC Embedded, Up: Embedded Processors
  16624. 21.3.9 Atmel AVR
  16625. ----------------
  16626. When configured for debugging the Atmel AVR, GDB supports the following
  16627. AVR-specific commands:
  16628. 'info io_registers'
  16629. This command displays information about the AVR I/O registers. For
  16630. each register, GDB prints its number and value.
  16631. 
  16632. File: gdb.info, Node: CRIS, Next: Super-H, Prev: AVR, Up: Embedded Processors
  16633. 21.3.10 CRIS
  16634. ------------
  16635. When configured for debugging CRIS, GDB provides the following
  16636. CRIS-specific commands:
  16637. 'set cris-version VER'
  16638. Set the current CRIS version to VER, either '10' or '32'. The CRIS
  16639. version affects register names and sizes. This command is useful
  16640. in case autodetection of the CRIS version fails.
  16641. 'show cris-version'
  16642. Show the current CRIS version.
  16643. 'set cris-dwarf2-cfi'
  16644. Set the usage of DWARF-2 CFI for CRIS debugging. The default is
  16645. 'on'. Change to 'off' when using 'gcc-cris' whose version is below
  16646. 'R59'.
  16647. 'show cris-dwarf2-cfi'
  16648. Show the current state of using DWARF-2 CFI.
  16649. 'set cris-mode MODE'
  16650. Set the current CRIS mode to MODE. It should only be changed when
  16651. debugging in guru mode, in which case it should be set to 'guru'
  16652. (the default is 'normal').
  16653. 'show cris-mode'
  16654. Show the current CRIS mode.
  16655. 
  16656. File: gdb.info, Node: Super-H, Prev: CRIS, Up: Embedded Processors
  16657. 21.3.11 Renesas Super-H
  16658. -----------------------
  16659. For the Renesas Super-H processor, GDB provides these commands:
  16660. 'set sh calling-convention CONVENTION'
  16661. Set the calling-convention used when calling functions from GDB.
  16662. Allowed values are 'gcc', which is the default setting, and
  16663. 'renesas'. With the 'gcc' setting, functions are called using the
  16664. GCC calling convention. If the DWARF-2 information of the called
  16665. function specifies that the function follows the Renesas calling
  16666. convention, the function is called using the Renesas calling
  16667. convention. If the calling convention is set to 'renesas', the
  16668. Renesas calling convention is always used, regardless of the
  16669. DWARF-2 information. This can be used to override the default of
  16670. 'gcc' if debug information is missing, or the compiler does not
  16671. emit the DWARF-2 calling convention entry for a function.
  16672. 'show sh calling-convention'
  16673. Show the current calling convention setting.
  16674. 
  16675. File: gdb.info, Node: Architectures, Prev: Embedded Processors, Up: Configurations
  16676. 21.4 Architectures
  16677. ==================
  16678. This section describes characteristics of architectures that affect all
  16679. uses of GDB with the architecture, both native and cross.
  16680. * Menu:
  16681. * AArch64::
  16682. * i386::
  16683. * Alpha::
  16684. * MIPS::
  16685. * HPPA:: HP PA architecture
  16686. * PowerPC::
  16687. * Nios II::
  16688. * Sparc64::
  16689. * S12Z::
  16690. 
  16691. File: gdb.info, Node: AArch64, Next: i386, Up: Architectures
  16692. 21.4.1 AArch64
  16693. --------------
  16694. When GDB is debugging the AArch64 architecture, it provides the
  16695. following special commands:
  16696. 'set debug aarch64'
  16697. This command determines whether AArch64 architecture-specific
  16698. debugging messages are to be displayed.
  16699. 'show debug aarch64'
  16700. Show whether AArch64 debugging messages are displayed.
  16701. 21.4.1.1 AArch64 SVE.
  16702. .....................
  16703. When GDB is debugging the AArch64 architecture, if the Scalable Vector
  16704. Extension (SVE) is present, then GDB will provide the vector registers
  16705. '$z0' through '$z31', vector predicate registers '$p0' through '$p15',
  16706. and the '$ffr' register. In addition, the pseudo register '$vg' will be
  16707. provided. This is the vector granule for the current thread and
  16708. represents the number of 64-bit chunks in an SVE 'z' register.
  16709. If the vector length changes, then the '$vg' register will be
  16710. updated, but the lengths of the 'z' and 'p' registers will not change.
  16711. This is a known limitation of GDB and does not affect the execution of
  16712. the target process.
  16713. 21.4.1.2 AArch64 Pointer Authentication.
  16714. ........................................
  16715. When GDB is debugging the AArch64 architecture, and the program is using
  16716. the v8.3-A feature Pointer Authentication (PAC), then whenever the link
  16717. register '$lr' is pointing to an PAC function its value will be masked.
  16718. When GDB prints a backtrace, any addresses that required unmasking will
  16719. be postfixed with the marker [PAC]. When using the MI, this is printed
  16720. as part of the 'addr_flags' field.
  16721. 
  16722. File: gdb.info, Node: i386, Next: Alpha, Prev: AArch64, Up: Architectures
  16723. 21.4.2 x86 Architecture-specific Issues
  16724. ---------------------------------------
  16725. 'set struct-convention MODE'
  16726. Set the convention used by the inferior to return 'struct's and
  16727. 'union's from functions to MODE. Possible values of MODE are
  16728. '"pcc"', '"reg"', and '"default"' (the default). '"default"' or
  16729. '"pcc"' means that 'struct's are returned on the stack, while
  16730. '"reg"' means that a 'struct' or a 'union' whose size is 1, 2, 4,
  16731. or 8 bytes will be returned in a register.
  16732. 'show struct-convention'
  16733. Show the current setting of the convention to return 'struct's from
  16734. functions.
  16735. 21.4.2.1 Intel "Memory Protection Extensions" (MPX).
  16736. ....................................................
  16737. Memory Protection Extension (MPX) adds the bound registers 'BND0' (1)
  16738. through 'BND3'. Bound registers store a pair of 64-bit values which are
  16739. the lower bound and upper bound. Bounds are effective addresses or
  16740. memory locations. The upper bounds are architecturally represented in
  16741. 1's complement form. A bound having lower bound = 0, and upper bound =
  16742. 0 (1's complement of all bits set) will allow access to the entire
  16743. address space.
  16744. 'BND0' through 'BND3' are represented in GDB as 'bnd0raw' through
  16745. 'bnd3raw'. Pseudo registers 'bnd0' through 'bnd3' display the upper
  16746. bound performing the complement of one operation on the upper bound
  16747. value, i.e. when upper bound in 'bnd0raw' is 0 in the GDB 'bnd0' it will
  16748. be '0xfff...'. In this sense it can also be noted that the upper bounds
  16749. are inclusive.
  16750. As an example, assume that the register BND0 holds bounds for a
  16751. pointer having access allowed for the range between 0x32 and 0x71. The
  16752. values present on bnd0raw and bnd registers are presented as follows:
  16753. bnd0raw = {0x32, 0xffffffff8e}
  16754. bnd0 = {lbound = 0x32, ubound = 0x71} : size 64
  16755. This way the raw value can be accessed via bnd0raw...bnd3raw. Any
  16756. change on bnd0...bnd3 or bnd0raw...bnd3raw is reflect on its
  16757. counterpart. When the bnd0...bnd3 registers are displayed via Python,
  16758. the display includes the memory size, in bits, accessible to the
  16759. pointer.
  16760. Bounds can also be stored in bounds tables, which are stored in
  16761. application memory. These tables store bounds for pointers by
  16762. specifying the bounds pointer's value along with its bounds. Evaluating
  16763. and changing bounds located in bound tables is therefore interesting
  16764. while investigating bugs on MPX context. GDB provides commands for this
  16765. purpose:
  16766. 'show mpx bound POINTER'
  16767. Display bounds of the given POINTER.
  16768. 'set mpx bound POINTER, LBOUND, UBOUND'
  16769. Set the bounds of a pointer in the bound table. This command takes
  16770. three parameters: POINTER is the pointers whose bounds are to be
  16771. changed, LBOUND and UBOUND are new values for lower and upper
  16772. bounds respectively.
  16773. When you call an inferior function on an Intel MPX enabled program,
  16774. GDB sets the inferior's bound registers to the init (disabled) state
  16775. before calling the function. As a consequence, bounds checks for the
  16776. pointer arguments passed to the function will always pass.
  16777. This is necessary because when you call an inferior function, the
  16778. program is usually in the middle of the execution of other function.
  16779. Since at that point bound registers are in an arbitrary state, not
  16780. clearing them would lead to random bound violations in the called
  16781. function.
  16782. You can still examine the influence of the bound registers on the
  16783. execution of the called function by stopping the execution of the called
  16784. function at its prologue, setting bound registers, and continuing the
  16785. execution. For example:
  16786. $ break *upper
  16787. Breakpoint 2 at 0x4009de: file i386-mpx-call.c, line 47.
  16788. $ print upper (a, b, c, d, 1)
  16789. Breakpoint 2, upper (a=0x0, b=0x6e0000005b, c=0x0, d=0x0, len=48)....
  16790. $ print $bnd0
  16791. {lbound = 0x0, ubound = ffffffff} : size -1
  16792. At this last step the value of bnd0 can be changed for investigation
  16793. of bound violations caused along the execution of the call. In order to
  16794. know how to set the bound registers or bound table for the call consult
  16795. the ABI.
  16796. ---------- Footnotes ----------
  16797. (1) The register named with capital letters represent the
  16798. architecture registers.
  16799. 
  16800. File: gdb.info, Node: Alpha, Next: MIPS, Prev: i386, Up: Architectures
  16801. 21.4.3 Alpha
  16802. ------------
  16803. See the following section.
  16804. 
  16805. File: gdb.info, Node: MIPS, Next: HPPA, Prev: Alpha, Up: Architectures
  16806. 21.4.4 MIPS
  16807. -----------
  16808. Alpha- and MIPS-based computers use an unusual stack frame, which
  16809. sometimes requires GDB to search backward in the object code to find the
  16810. beginning of a function.
  16811. To improve response time (especially for embedded applications, where
  16812. GDB may be restricted to a slow serial line for this search) you may
  16813. want to limit the size of this search, using one of these commands:
  16814. 'set heuristic-fence-post LIMIT'
  16815. Restrict GDB to examining at most LIMIT bytes in its search for the
  16816. beginning of a function. A value of 0 (the default) means there is
  16817. no limit. However, except for 0, the larger the limit the more
  16818. bytes 'heuristic-fence-post' must search and therefore the longer
  16819. it takes to run. You should only need to use this command when
  16820. debugging a stripped executable.
  16821. 'show heuristic-fence-post'
  16822. Display the current limit.
  16823. These commands are available _only_ when GDB is configured for debugging
  16824. programs on Alpha or MIPS processors.
  16825. Several MIPS-specific commands are available when debugging MIPS
  16826. programs:
  16827. 'set mips abi ARG'
  16828. Tell GDB which MIPS ABI is used by the inferior. Possible values
  16829. of ARG are:
  16830. 'auto'
  16831. The default ABI associated with the current binary (this is
  16832. the default).
  16833. 'o32'
  16834. 'o64'
  16835. 'n32'
  16836. 'n64'
  16837. 'eabi32'
  16838. 'eabi64'
  16839. 'show mips abi'
  16840. Show the MIPS ABI used by GDB to debug the inferior.
  16841. 'set mips compression ARG'
  16842. Tell GDB which MIPS compressed ISA (Instruction Set Architecture)
  16843. encoding is used by the inferior. GDB uses this for code
  16844. disassembly and other internal interpretation purposes. This
  16845. setting is only referred to when no executable has been associated
  16846. with the debugging session or the executable does not provide
  16847. information about the encoding it uses. Otherwise this setting is
  16848. automatically updated from information provided by the executable.
  16849. Possible values of ARG are 'mips16' and 'micromips'. The default
  16850. compressed ISA encoding is 'mips16', as executables containing
  16851. MIPS16 code frequently are not identified as such.
  16852. This setting is "sticky"; that is, it retains its value across
  16853. debugging sessions until reset either explicitly with this command
  16854. or implicitly from an executable.
  16855. The compiler and/or assembler typically add symbol table
  16856. annotations to identify functions compiled for the MIPS16 or
  16857. microMIPS ISAs. If these function-scope annotations are present,
  16858. GDB uses them in preference to the global compressed ISA encoding
  16859. setting.
  16860. 'show mips compression'
  16861. Show the MIPS compressed ISA encoding used by GDB to debug the
  16862. inferior.
  16863. 'set mipsfpu'
  16864. 'show mipsfpu'
  16865. *Note set mipsfpu: MIPS Embedded.
  16866. 'set mips mask-address ARG'
  16867. This command determines whether the most-significant 32 bits of
  16868. 64-bit MIPS addresses are masked off. The argument ARG can be
  16869. 'on', 'off', or 'auto'. The latter is the default setting, which
  16870. lets GDB determine the correct value.
  16871. 'show mips mask-address'
  16872. Show whether the upper 32 bits of MIPS addresses are masked off or
  16873. not.
  16874. 'set remote-mips64-transfers-32bit-regs'
  16875. This command controls compatibility with 64-bit MIPS targets that
  16876. transfer data in 32-bit quantities. If you have an old MIPS 64
  16877. target that transfers 32 bits for some registers, like SR and FSR,
  16878. and 64 bits for other registers, set this option to 'on'.
  16879. 'show remote-mips64-transfers-32bit-regs'
  16880. Show the current setting of compatibility with older MIPS 64
  16881. targets.
  16882. 'set debug mips'
  16883. This command turns on and off debugging messages for the
  16884. MIPS-specific target code in GDB.
  16885. 'show debug mips'
  16886. Show the current setting of MIPS debugging messages.
  16887. 
  16888. File: gdb.info, Node: HPPA, Next: PowerPC, Prev: MIPS, Up: Architectures
  16889. 21.4.5 HPPA
  16890. -----------
  16891. When GDB is debugging the HP PA architecture, it provides the following
  16892. special commands:
  16893. 'set debug hppa'
  16894. This command determines whether HPPA architecture-specific
  16895. debugging messages are to be displayed.
  16896. 'show debug hppa'
  16897. Show whether HPPA debugging messages are displayed.
  16898. 'maint print unwind ADDRESS'
  16899. This command displays the contents of the unwind table entry at the
  16900. given ADDRESS.
  16901. 
  16902. File: gdb.info, Node: PowerPC, Next: Nios II, Prev: HPPA, Up: Architectures
  16903. 21.4.6 PowerPC
  16904. --------------
  16905. When GDB is debugging the PowerPC architecture, it provides a set of
  16906. pseudo-registers to enable inspection of 128-bit wide Decimal Floating
  16907. Point numbers stored in the floating point registers. These values must
  16908. be stored in two consecutive registers, always starting at an even
  16909. register like 'f0' or 'f2'.
  16910. The pseudo-registers go from '$dl0' through '$dl15', and are formed
  16911. by joining the even/odd register pairs 'f0' and 'f1' for '$dl0', 'f2'
  16912. and 'f3' for '$dl1' and so on.
  16913. For POWER7 processors, GDB provides a set of pseudo-registers, the
  16914. 64-bit wide Extended Floating Point Registers ('f32' through 'f63').
  16915. 
  16916. File: gdb.info, Node: Nios II, Next: Sparc64, Prev: PowerPC, Up: Architectures
  16917. 21.4.7 Nios II
  16918. --------------
  16919. When GDB is debugging the Nios II architecture, it provides the
  16920. following special commands:
  16921. 'set debug nios2'
  16922. This command turns on and off debugging messages for the Nios II
  16923. target code in GDB.
  16924. 'show debug nios2'
  16925. Show the current setting of Nios II debugging messages.
  16926. 
  16927. File: gdb.info, Node: Sparc64, Next: S12Z, Prev: Nios II, Up: Architectures
  16928. 21.4.8 Sparc64
  16929. --------------
  16930. 21.4.8.1 ADI Support
  16931. ....................
  16932. The M7 processor supports an Application Data Integrity (ADI) feature
  16933. that detects invalid data accesses. When software allocates memory and
  16934. enables ADI on the allocated memory, it chooses a 4-bit version number,
  16935. sets the version in the upper 4 bits of the 64-bit pointer to that data,
  16936. and stores the 4-bit version in every cacheline of that data. Hardware
  16937. saves the latter in spare bits in the cache and memory hierarchy. On
  16938. each load and store, the processor compares the upper 4 VA (virtual
  16939. address) bits to the cacheline's version. If there is a mismatch, the
  16940. processor generates a version mismatch trap which can be either precise
  16941. or disrupting. The trap is an error condition which the kernel delivers
  16942. to the process as a SIGSEGV signal.
  16943. Note that only 64-bit applications can use ADI and need to be built
  16944. with ADI-enabled.
  16945. Values of the ADI version tags, which are in granularity of a
  16946. cacheline (64 bytes), can be viewed or modified.
  16947. 'adi (examine | x) [ / N ] ADDR'
  16948. The 'adi examine' command displays the value of one ADI version tag
  16949. per cacheline.
  16950. N is a decimal integer specifying the number in bytes; the default
  16951. is 1. It specifies how much ADI version information, at the ratio
  16952. of 1:ADI block size, to display.
  16953. ADDR is the address in user address space where you want GDB to
  16954. begin displaying the ADI version tags.
  16955. Below is an example of displaying ADI versions of variable
  16956. "shmaddr".
  16957. (gdb) adi x/100 shmaddr
  16958. 0xfff800010002c000: 0 0
  16959. 'adi (assign | a) [ / N ] ADDR = TAG'
  16960. The 'adi assign' command is used to assign new ADI version tag to
  16961. an address.
  16962. N is a decimal integer specifying the number in bytes; the default
  16963. is 1. It specifies how much ADI version information, at the ratio
  16964. of 1:ADI block size, to modify.
  16965. ADDR is the address in user address space where you want GDB to
  16966. begin modifying the ADI version tags.
  16967. TAG is the new ADI version tag.
  16968. For example, do the following to modify then verify ADI versions of
  16969. variable "shmaddr":
  16970. (gdb) adi a/100 shmaddr = 7
  16971. (gdb) adi x/100 shmaddr
  16972. 0xfff800010002c000: 7 7
  16973. 
  16974. File: gdb.info, Node: S12Z, Prev: Sparc64, Up: Architectures
  16975. 21.4.9 S12Z
  16976. -----------
  16977. When GDB is debugging the S12Z architecture, it provides the following
  16978. special command:
  16979. 'maint info bdccsr'
  16980. This command displays the current value of the microprocessor's
  16981. BDCCSR register.
  16982. 
  16983. File: gdb.info, Node: Controlling GDB, Next: Extending GDB, Prev: Configurations, Up: Top
  16984. 22 Controlling GDB
  16985. ******************
  16986. You can alter the way GDB interacts with you by using the 'set' command.
  16987. For commands controlling how GDB displays data, see *note Print
  16988. Settings: Print Settings. Other settings are described here.
  16989. * Menu:
  16990. * Prompt:: Prompt
  16991. * Editing:: Command editing
  16992. * Command History:: Command history
  16993. * Screen Size:: Screen size
  16994. * Output Styling:: Output styling
  16995. * Numbers:: Numbers
  16996. * ABI:: Configuring the current ABI
  16997. * Auto-loading:: Automatically loading associated files
  16998. * Messages/Warnings:: Optional warnings and messages
  16999. * Debugging Output:: Optional messages about internal happenings
  17000. * Other Misc Settings:: Other Miscellaneous Settings
  17001. 
  17002. File: gdb.info, Node: Prompt, Next: Editing, Up: Controlling GDB
  17003. 22.1 Prompt
  17004. ===========
  17005. GDB indicates its readiness to read a command by printing a string
  17006. called the "prompt". This string is normally '(gdb)'. You can change
  17007. the prompt string with the 'set prompt' command. For instance, when
  17008. debugging GDB with GDB, it is useful to change the prompt in one of the
  17009. GDB sessions so that you can always tell which one you are talking to.
  17010. _Note:_ 'set prompt' does not add a space for you after the prompt
  17011. you set. This allows you to set a prompt which ends in a space or a
  17012. prompt that does not.
  17013. 'set prompt NEWPROMPT'
  17014. Directs GDB to use NEWPROMPT as its prompt string henceforth.
  17015. 'show prompt'
  17016. Prints a line of the form: 'Gdb's prompt is: YOUR-PROMPT'
  17017. Versions of GDB that ship with Python scripting enabled have prompt
  17018. extensions. The commands for interacting with these extensions are:
  17019. 'set extended-prompt PROMPT'
  17020. Set an extended prompt that allows for substitutions. *Note
  17021. gdb.prompt::, for a list of escape sequences that can be used for
  17022. substitution. Any escape sequences specified as part of the prompt
  17023. string are replaced with the corresponding strings each time the
  17024. prompt is displayed.
  17025. For example:
  17026. set extended-prompt Current working directory: \w (gdb)
  17027. Note that when an extended-prompt is set, it takes control of the
  17028. PROMPT_HOOK hook. *Note prompt_hook::, for further information.
  17029. 'show extended-prompt'
  17030. Prints the extended prompt. Any escape sequences specified as part
  17031. of the prompt string with 'set extended-prompt', are replaced with
  17032. the corresponding strings each time the prompt is displayed.
  17033. 
  17034. File: gdb.info, Node: Editing, Next: Command History, Prev: Prompt, Up: Controlling GDB
  17035. 22.2 Command Editing
  17036. ====================
  17037. GDB reads its input commands via the "Readline" interface. This GNU
  17038. library provides consistent behavior for programs which provide a
  17039. command line interface to the user. Advantages are GNU Emacs-style or
  17040. "vi"-style inline editing of commands, 'csh'-like history substitution,
  17041. and a storage and recall of command history across debugging sessions.
  17042. You may control the behavior of command line editing in GDB with the
  17043. command 'set'.
  17044. 'set editing'
  17045. 'set editing on'
  17046. Enable command line editing (enabled by default).
  17047. 'set editing off'
  17048. Disable command line editing.
  17049. 'show editing'
  17050. Show whether command line editing is enabled.
  17051. *Note Command Line Editing::, for more details about the Readline
  17052. interface. Users unfamiliar with GNU Emacs or 'vi' are encouraged to
  17053. read that chapter.
  17054. GDB sets the Readline application name to 'gdb'. This is useful for
  17055. conditions in '.inputrc'.
  17056. GDB defines a bindable Readline command, 'operate-and-get-next'.
  17057. This is bound to 'C-o' by default. This command accepts the current
  17058. line for execution and fetches the next line relative to the current
  17059. line from the history for editing. Any argument is ignored.
  17060. 
  17061. File: gdb.info, Node: Command History, Next: Screen Size, Prev: Editing, Up: Controlling GDB
  17062. 22.3 Command History
  17063. ====================
  17064. GDB can keep track of the commands you type during your debugging
  17065. sessions, so that you can be certain of precisely what happened. Use
  17066. these commands to manage the GDB command history facility.
  17067. GDB uses the GNU History library, a part of the Readline package, to
  17068. provide the history facility. *Note Using History Interactively::, for
  17069. the detailed description of the History library.
  17070. To issue a command to GDB without affecting certain aspects of the
  17071. state which is seen by users, prefix it with 'server ' (*note Server
  17072. Prefix::). This means that this command will not affect the command
  17073. history, nor will it affect GDB's notion of which command to repeat if
  17074. <RET> is pressed on a line by itself.
  17075. The server prefix does not affect the recording of values into the
  17076. value history; to print a value without recording it into the value
  17077. history, use the 'output' command instead of the 'print' command.
  17078. Here is the description of GDB commands related to command history.
  17079. 'set history filename [FNAME]'
  17080. Set the name of the GDB command history file to FNAME. This is the
  17081. file where GDB reads an initial command history list, and where it
  17082. writes the command history from this session when it exits. You
  17083. can access this list through history expansion or through the
  17084. history command editing characters listed below. This file
  17085. defaults to the value of the environment variable 'GDBHISTFILE', or
  17086. to './.gdb_history' ('./_gdb_history' on MS-DOS) if this variable
  17087. is not set.
  17088. The 'GDBHISTFILE' environment variable is read after processing any
  17089. GDB initialization files (*note Startup::) and after processing any
  17090. commands passed using command line options (for example, '-ex').
  17091. If the FNAME argument is not given, or if the 'GDBHISTFILE' is the
  17092. empty string then GDB will neither try to load an existing history
  17093. file, nor will it try to save the history on exit.
  17094. 'set history save'
  17095. 'set history save on'
  17096. Record command history in a file, whose name may be specified with
  17097. the 'set history filename' command. By default, this option is
  17098. disabled. The command history will be recorded when GDB exits. If
  17099. 'set history filename' is set to the empty string then history
  17100. saving is disabled, even when 'set history save' is 'on'.
  17101. 'set history save off'
  17102. Don't record the command history into the file specified by 'set
  17103. history filename' when GDB exits.
  17104. 'set history size SIZE'
  17105. 'set history size unlimited'
  17106. Set the number of commands which GDB keeps in its history list.
  17107. This defaults to the value of the environment variable
  17108. 'GDBHISTSIZE', or to 256 if this variable is not set. Non-numeric
  17109. values of 'GDBHISTSIZE' are ignored. If SIZE is 'unlimited' or if
  17110. 'GDBHISTSIZE' is either a negative number or the empty string, then
  17111. the number of commands GDB keeps in the history list is unlimited.
  17112. The 'GDBHISTSIZE' environment variable is read after processing any
  17113. GDB initialization files (*note Startup::) and after processing any
  17114. commands passed using command line options (for example, '-ex').
  17115. 'set history remove-duplicates COUNT'
  17116. 'set history remove-duplicates unlimited'
  17117. Control the removal of duplicate history entries in the command
  17118. history list. If COUNT is non-zero, GDB will look back at the last
  17119. COUNT history entries and remove the first entry that is a
  17120. duplicate of the current entry being added to the command history
  17121. list. If COUNT is 'unlimited' then this lookbehind is unbounded.
  17122. If COUNT is 0, then removal of duplicate history entries is
  17123. disabled.
  17124. Only history entries added during the current session are
  17125. considered for removal. This option is set to 0 by default.
  17126. History expansion assigns special meaning to the character '!'.
  17127. *Note Event Designators::, for more details.
  17128. Since '!' is also the logical not operator in C, history expansion is
  17129. off by default. If you decide to enable history expansion with the 'set
  17130. history expansion on' command, you may sometimes need to follow '!'
  17131. (when it is used as logical not, in an expression) with a space or a tab
  17132. to prevent it from being expanded. The readline history facilities do
  17133. not attempt substitution on the strings '!=' and '!(', even when history
  17134. expansion is enabled.
  17135. The commands to control history expansion are:
  17136. 'set history expansion on'
  17137. 'set history expansion'
  17138. Enable history expansion. History expansion is off by default.
  17139. 'set history expansion off'
  17140. Disable history expansion.
  17141. 'show history'
  17142. 'show history filename'
  17143. 'show history save'
  17144. 'show history size'
  17145. 'show history expansion'
  17146. These commands display the state of the GDB history parameters.
  17147. 'show history' by itself displays all four states.
  17148. 'show commands'
  17149. Display the last ten commands in the command history.
  17150. 'show commands N'
  17151. Print ten commands centered on command number N.
  17152. 'show commands +'
  17153. Print ten commands just after the commands last printed.
  17154. 
  17155. File: gdb.info, Node: Screen Size, Next: Output Styling, Prev: Command History, Up: Controlling GDB
  17156. 22.4 Screen Size
  17157. ================
  17158. Certain commands to GDB may produce large amounts of information output
  17159. to the screen. To help you read all of it, GDB pauses and asks you for
  17160. input at the end of each page of output. Type <RET> when you want to
  17161. see one more page of output, 'q' to discard the remaining output, or 'c'
  17162. to continue without paging for the rest of the current command. Also,
  17163. the screen width setting determines when to wrap lines of output.
  17164. Depending on what is being printed, GDB tries to break the line at a
  17165. readable place, rather than simply letting it overflow onto the
  17166. following line.
  17167. Normally GDB knows the size of the screen from the terminal driver
  17168. software. For example, on Unix GDB uses the termcap data base together
  17169. with the value of the 'TERM' environment variable and the 'stty rows'
  17170. and 'stty cols' settings. If this is not correct, you can override it
  17171. with the 'set height' and 'set width' commands:
  17172. 'set height LPP'
  17173. 'set height unlimited'
  17174. 'show height'
  17175. 'set width CPL'
  17176. 'set width unlimited'
  17177. 'show width'
  17178. These 'set' commands specify a screen height of LPP lines and a
  17179. screen width of CPL characters. The associated 'show' commands
  17180. display the current settings.
  17181. If you specify a height of either 'unlimited' or zero lines, GDB
  17182. does not pause during output no matter how long the output is.
  17183. This is useful if output is to a file or to an editor buffer.
  17184. Likewise, you can specify 'set width unlimited' or 'set width 0' to
  17185. prevent GDB from wrapping its output.
  17186. 'set pagination on'
  17187. 'set pagination off'
  17188. Turn the output pagination on or off; the default is on. Turning
  17189. pagination off is the alternative to 'set height unlimited'. Note
  17190. that running GDB with the '--batch' option (*note -batch: Mode
  17191. Options.) also automatically disables pagination.
  17192. 'show pagination'
  17193. Show the current pagination mode.
  17194. 
  17195. File: gdb.info, Node: Output Styling, Next: Numbers, Prev: Screen Size, Up: Controlling GDB
  17196. 22.5 Output Styling
  17197. ===================
  17198. GDB can style its output on a capable terminal. This is enabled by
  17199. default on most systems, but disabled by default when in batch mode
  17200. (*note Mode Options::). Various style settings are available; and
  17201. styles can also be disabled entirely.
  17202. 'set style enabled 'on|off''
  17203. Enable or disable all styling. The default is host-dependent, with
  17204. most hosts defaulting to 'on'.
  17205. 'show style enabled'
  17206. Show the current state of styling.
  17207. 'set style sources 'on|off''
  17208. Enable or disable source code styling. This affects whether source
  17209. code, such as the output of the 'list' command, is styled. Note
  17210. that source styling only works if styling in general is enabled,
  17211. and if GDB was linked with the GNU Source Highlight library. The
  17212. default is 'on'.
  17213. 'show style sources'
  17214. Show the current state of source code styling.
  17215. Subcommands of 'set style' control specific forms of styling. These
  17216. subcommands all follow the same pattern: each style-able object can be
  17217. styled with a foreground color, a background color, and an intensity.
  17218. For example, the style of file names can be controlled using the 'set
  17219. style filename' group of commands:
  17220. 'set style filename background COLOR'
  17221. Set the background to COLOR. Valid colors are 'none' (meaning the
  17222. terminal's default color), 'black', 'red', 'green', 'yellow',
  17223. 'blue', 'magenta', 'cyan', and'white'.
  17224. 'set style filename foreground COLOR'
  17225. Set the foreground to COLOR. Valid colors are 'none' (meaning the
  17226. terminal's default color), 'black', 'red', 'green', 'yellow',
  17227. 'blue', 'magenta', 'cyan', and'white'.
  17228. 'set style filename intensity VALUE'
  17229. Set the intensity to VALUE. Valid intensities are 'normal' (the
  17230. default), 'bold', and 'dim'.
  17231. The 'show style' command and its subcommands are styling a style name
  17232. in their output using its own style. So, use 'show style' to see the
  17233. complete list of styles, their characteristics and the visual aspect of
  17234. each style.
  17235. The style-able objects are:
  17236. 'filename'
  17237. Control the styling of file names. By default, this style's
  17238. foreground color is green.
  17239. 'function'
  17240. Control the styling of function names. These are managed with the
  17241. 'set style function' family of commands. By default, this style's
  17242. foreground color is yellow.
  17243. 'variable'
  17244. Control the styling of variable names. These are managed with the
  17245. 'set style variable' family of commands. By default, this style's
  17246. foreground color is cyan.
  17247. 'address'
  17248. Control the styling of addresses. These are managed with the 'set
  17249. style address' family of commands. By default, this style's
  17250. foreground color is blue.
  17251. 'title'
  17252. Control the styling of titles. These are managed with the 'set
  17253. style title' family of commands. By default, this style's
  17254. intensity is bold. Commands are using the title style to improve
  17255. the readability of large output. For example, the commands
  17256. 'apropos' and 'help' are using the title style for the command
  17257. names.
  17258. 'highlight'
  17259. Control the styling of highlightings. These are managed with the
  17260. 'set style highlight' family of commands. By default, this style's
  17261. foreground color is red. Commands are using the highlight style to
  17262. draw the user attention to some specific parts of their output.
  17263. For example, the command 'apropos -v REGEXP' uses the highlight
  17264. style to mark the documentation parts matching REGEXP.
  17265. 'tui-border'
  17266. Control the styling of the TUI border. Note that, unlike other
  17267. styling options, only the color of the border can be controlled via
  17268. 'set style'. This was done for compatibility reasons, as TUI
  17269. controls to set the border's intensity predated the addition of
  17270. general styling to GDB. *Note TUI Configuration::.
  17271. 'tui-active-border'
  17272. Control the styling of the active TUI border; that is, the TUI
  17273. window that has the focus.
  17274. 
  17275. File: gdb.info, Node: Numbers, Next: ABI, Prev: Output Styling, Up: Controlling GDB
  17276. 22.6 Numbers
  17277. ============
  17278. You can always enter numbers in octal, decimal, or hexadecimal in GDB by
  17279. the usual conventions: octal numbers begin with '0', decimal numbers end
  17280. with '.', and hexadecimal numbers begin with '0x'. Numbers that neither
  17281. begin with '0' or '0x', nor end with a '.' are, by default, entered in
  17282. base 10; likewise, the default display for numbers--when no particular
  17283. format is specified--is base 10. You can change the default base for
  17284. both input and output with the commands described below.
  17285. 'set input-radix BASE'
  17286. Set the default base for numeric input. Supported choices for BASE
  17287. are decimal 8, 10, or 16. The base must itself be specified either
  17288. unambiguously or using the current input radix; for example, any of
  17289. set input-radix 012
  17290. set input-radix 10.
  17291. set input-radix 0xa
  17292. sets the input base to decimal. On the other hand, 'set
  17293. input-radix 10' leaves the input radix unchanged, no matter what it
  17294. was, since '10', being without any leading or trailing signs of its
  17295. base, is interpreted in the current radix. Thus, if the current
  17296. radix is 16, '10' is interpreted in hex, i.e. as 16 decimal, which
  17297. doesn't change the radix.
  17298. 'set output-radix BASE'
  17299. Set the default base for numeric display. Supported choices for
  17300. BASE are decimal 8, 10, or 16. The base must itself be specified
  17301. either unambiguously or using the current input radix.
  17302. 'show input-radix'
  17303. Display the current default base for numeric input.
  17304. 'show output-radix'
  17305. Display the current default base for numeric display.
  17306. 'set radix [BASE]'
  17307. 'show radix'
  17308. These commands set and show the default base for both input and
  17309. output of numbers. 'set radix' sets the radix of input and output
  17310. to the same base; without an argument, it resets the radix back to
  17311. its default value of 10.
  17312. 
  17313. File: gdb.info, Node: ABI, Next: Auto-loading, Prev: Numbers, Up: Controlling GDB
  17314. 22.7 Configuring the Current ABI
  17315. ================================
  17316. GDB can determine the "ABI" (Application Binary Interface) of your
  17317. application automatically. However, sometimes you need to override its
  17318. conclusions. Use these commands to manage GDB's view of the current
  17319. ABI.
  17320. One GDB configuration can debug binaries for multiple operating
  17321. system targets, either via remote debugging or native emulation. GDB
  17322. will autodetect the "OS ABI" (Operating System ABI) in use, but you can
  17323. override its conclusion using the 'set osabi' command. One example
  17324. where this is useful is in debugging of binaries which use an alternate
  17325. C library (e.g. UCLIBC for GNU/Linux) which does not have the same
  17326. identifying marks that the standard C library for your platform
  17327. provides.
  17328. When GDB is debugging the AArch64 architecture, it provides a
  17329. "Newlib" OS ABI. This is useful for handling 'setjmp' and 'longjmp' when
  17330. debugging binaries that use the NEWLIB C library. The "Newlib" OS ABI
  17331. can be selected by 'set osabi Newlib'.
  17332. 'show osabi'
  17333. Show the OS ABI currently in use.
  17334. 'set osabi'
  17335. With no argument, show the list of registered available OS ABI's.
  17336. 'set osabi ABI'
  17337. Set the current OS ABI to ABI.
  17338. Generally, the way that an argument of type 'float' is passed to a
  17339. function depends on whether the function is prototyped. For a
  17340. prototyped (i.e. ANSI/ISO style) function, 'float' arguments are passed
  17341. unchanged, according to the architecture's convention for 'float'. For
  17342. unprototyped (i.e. K&R style) functions, 'float' arguments are first
  17343. promoted to type 'double' and then passed.
  17344. Unfortunately, some forms of debug information do not reliably
  17345. indicate whether a function is prototyped. If GDB calls a function that
  17346. is not marked as prototyped, it consults 'set coerce-float-to-double'.
  17347. 'set coerce-float-to-double'
  17348. 'set coerce-float-to-double on'
  17349. Arguments of type 'float' will be promoted to 'double' when passed
  17350. to an unprototyped function. This is the default setting.
  17351. 'set coerce-float-to-double off'
  17352. Arguments of type 'float' will be passed directly to unprototyped
  17353. functions.
  17354. 'show coerce-float-to-double'
  17355. Show the current setting of promoting 'float' to 'double'.
  17356. GDB needs to know the ABI used for your program's C++ objects. The
  17357. correct C++ ABI depends on which C++ compiler was used to build your
  17358. application. GDB only fully supports programs with a single C++ ABI; if
  17359. your program contains code using multiple C++ ABI's or if GDB can not
  17360. identify your program's ABI correctly, you can tell GDB which ABI to
  17361. use. Currently supported ABI's include "gnu-v2", for 'g++' versions
  17362. before 3.0, "gnu-v3", for 'g++' versions 3.0 and later, and "hpaCC" for
  17363. the HP ANSI C++ compiler. Other C++ compilers may use the "gnu-v2" or
  17364. "gnu-v3" ABI's as well. The default setting is "auto".
  17365. 'show cp-abi'
  17366. Show the C++ ABI currently in use.
  17367. 'set cp-abi'
  17368. With no argument, show the list of supported C++ ABI's.
  17369. 'set cp-abi ABI'
  17370. 'set cp-abi auto'
  17371. Set the current C++ ABI to ABI, or return to automatic detection.
  17372. 
  17373. File: gdb.info, Node: Auto-loading, Next: Messages/Warnings, Prev: ABI, Up: Controlling GDB
  17374. 22.8 Automatically loading associated files
  17375. ===========================================
  17376. GDB sometimes reads files with commands and settings automatically,
  17377. without being explicitly told so by the user. We call this feature
  17378. "auto-loading". While auto-loading is useful for automatically adapting
  17379. GDB to the needs of your project, it can sometimes produce unexpected
  17380. results or introduce security risks (e.g., if the file comes from
  17381. untrusted sources).
  17382. * Menu:
  17383. * Init File in the Current Directory:: 'set/show/info auto-load local-gdbinit'
  17384. * libthread_db.so.1 file:: 'set/show/info auto-load libthread-db'
  17385. * Auto-loading safe path:: 'set/show/info auto-load safe-path'
  17386. * Auto-loading verbose mode:: 'set/show debug auto-load'
  17387. There are various kinds of files GDB can automatically load. In
  17388. addition to these files, GDB supports auto-loading code written in
  17389. various extension languages. *Note Auto-loading extensions::.
  17390. Note that loading of these associated files (including the local
  17391. '.gdbinit' file) requires accordingly configured 'auto-load safe-path'
  17392. (*note Auto-loading safe path::).
  17393. For these reasons, GDB includes commands and options to let you
  17394. control when to auto-load files and which files should be auto-loaded.
  17395. 'set auto-load off'
  17396. Globally disable loading of all auto-loaded files. You may want to
  17397. use this command with the '-iex' option (*note Option
  17398. -init-eval-command::) such as:
  17399. $ gdb -iex "set auto-load off" untrusted-executable corefile
  17400. Be aware that system init file (*note System-wide configuration::)
  17401. and init files from your home directory (*note Home Directory Init
  17402. File::) still get read (as they come from generally trusted
  17403. directories). To prevent GDB from auto-loading even those init
  17404. files, use the '-nx' option (*note Mode Options::), in addition to
  17405. 'set auto-load no'.
  17406. 'show auto-load'
  17407. Show whether auto-loading of each specific 'auto-load' file(s) is
  17408. enabled or disabled.
  17409. (gdb) show auto-load
  17410. gdb-scripts: Auto-loading of canned sequences of commands scripts is on.
  17411. libthread-db: Auto-loading of inferior specific libthread_db is on.
  17412. local-gdbinit: Auto-loading of .gdbinit script from current directory
  17413. is on.
  17414. python-scripts: Auto-loading of Python scripts is on.
  17415. safe-path: List of directories from which it is safe to auto-load files
  17416. is $debugdir:$datadir/auto-load.
  17417. scripts-directory: List of directories from which to load auto-loaded scripts
  17418. is $debugdir:$datadir/auto-load.
  17419. 'info auto-load'
  17420. Print whether each specific 'auto-load' file(s) have been
  17421. auto-loaded or not.
  17422. (gdb) info auto-load
  17423. gdb-scripts:
  17424. Loaded Script
  17425. Yes /home/user/gdb/gdb-gdb.gdb
  17426. libthread-db: No auto-loaded libthread-db.
  17427. local-gdbinit: Local .gdbinit file "/home/user/gdb/.gdbinit" has been
  17428. loaded.
  17429. python-scripts:
  17430. Loaded Script
  17431. Yes /home/user/gdb/gdb-gdb.py
  17432. These are GDB control commands for the auto-loading:
  17433. *Note set auto-load off::. Disable auto-loading globally.
  17434. *Note show auto-load::. Show setting of all kinds of
  17435. files.
  17436. *Note info auto-load::. Show state of all kinds of files.
  17437. *Note set auto-load gdb-scripts::. Control for GDB command scripts.
  17438. *Note show auto-load gdb-scripts::. Show setting of GDB command
  17439. scripts.
  17440. *Note info auto-load gdb-scripts::. Show state of GDB command scripts.
  17441. *Note set auto-load python-scripts::.Control for GDB Python scripts.
  17442. *Note show auto-load python-scripts::.Show setting of GDB Python
  17443. scripts.
  17444. *Note info auto-load python-scripts::.Show state of GDB Python scripts.
  17445. *Note set auto-load guile-scripts::. Control for GDB Guile scripts.
  17446. *Note show auto-load guile-scripts::.Show setting of GDB Guile scripts.
  17447. *Note info auto-load guile-scripts::.Show state of GDB Guile scripts.
  17448. *Note set auto-load scripts-directory::.Control for GDB auto-loaded
  17449. scripts location.
  17450. *Note show auto-load scripts-directory::.Show GDB auto-loaded scripts
  17451. location.
  17452. *Note add-auto-load-scripts-directory::.Add directory for auto-loaded
  17453. scripts location list.
  17454. *Note set auto-load local-gdbinit::. Control for init file in the
  17455. current directory.
  17456. *Note show auto-load local-gdbinit::.Show setting of init file in the
  17457. current directory.
  17458. *Note info auto-load local-gdbinit::.Show state of init file in the
  17459. current directory.
  17460. *Note set auto-load libthread-db::. Control for thread debugging
  17461. library.
  17462. *Note show auto-load libthread-db::. Show setting of thread debugging
  17463. library.
  17464. *Note info auto-load libthread-db::. Show state of thread debugging
  17465. library.
  17466. *Note set auto-load safe-path::. Control directories trusted for
  17467. automatic loading.
  17468. *Note show auto-load safe-path::. Show directories trusted for
  17469. automatic loading.
  17470. *Note add-auto-load-safe-path::. Add directory trusted for
  17471. automatic loading.
  17472. 
  17473. File: gdb.info, Node: Init File in the Current Directory, Next: libthread_db.so.1 file, Up: Auto-loading
  17474. 22.8.1 Automatically loading init file in the current directory
  17475. ---------------------------------------------------------------
  17476. By default, GDB reads and executes the canned sequences of commands from
  17477. init file (if any) in the current working directory, see *note Init File
  17478. in the Current Directory during Startup::.
  17479. Note that loading of this local '.gdbinit' file also requires
  17480. accordingly configured 'auto-load safe-path' (*note Auto-loading safe
  17481. path::).
  17482. 'set auto-load local-gdbinit [on|off]'
  17483. Enable or disable the auto-loading of canned sequences of commands
  17484. (*note Sequences::) found in init file in the current directory.
  17485. 'show auto-load local-gdbinit'
  17486. Show whether auto-loading of canned sequences of commands from init
  17487. file in the current directory is enabled or disabled.
  17488. 'info auto-load local-gdbinit'
  17489. Print whether canned sequences of commands from init file in the
  17490. current directory have been auto-loaded.
  17491. 
  17492. File: gdb.info, Node: libthread_db.so.1 file, Next: Auto-loading safe path, Prev: Init File in the Current Directory, Up: Auto-loading
  17493. 22.8.2 Automatically loading thread debugging library
  17494. -----------------------------------------------------
  17495. This feature is currently present only on GNU/Linux native hosts.
  17496. GDB reads in some cases thread debugging library from places specific
  17497. to the inferior (*note set libthread-db-search-path::).
  17498. The special 'libthread-db-search-path' entry '$sdir' is processed
  17499. without checking this 'set auto-load libthread-db' switch as system
  17500. libraries have to be trusted in general. In all other cases of
  17501. 'libthread-db-search-path' entries GDB checks first if 'set auto-load
  17502. libthread-db' is enabled before trying to open such thread debugging
  17503. library.
  17504. Note that loading of this debugging library also requires accordingly
  17505. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  17506. 'set auto-load libthread-db [on|off]'
  17507. Enable or disable the auto-loading of inferior specific thread
  17508. debugging library.
  17509. 'show auto-load libthread-db'
  17510. Show whether auto-loading of inferior specific thread debugging
  17511. library is enabled or disabled.
  17512. 'info auto-load libthread-db'
  17513. Print the list of all loaded inferior specific thread debugging
  17514. libraries and for each such library print list of inferior PIDs
  17515. using it.
  17516. 
  17517. File: gdb.info, Node: Auto-loading safe path, Next: Auto-loading verbose mode, Prev: libthread_db.so.1 file, Up: Auto-loading
  17518. 22.8.3 Security restriction for auto-loading
  17519. --------------------------------------------
  17520. As the files of inferior can come from untrusted source (such as
  17521. submitted by an application user) GDB does not always load any files
  17522. automatically. GDB provides the 'set auto-load safe-path' setting to
  17523. list directories trusted for loading files not explicitly requested by
  17524. user. Each directory can also be a shell wildcard pattern.
  17525. If the path is not set properly you will see a warning and the file
  17526. will not get loaded:
  17527. $ ./gdb -q ./gdb
  17528. Reading symbols from /home/user/gdb/gdb...
  17529. warning: File "/home/user/gdb/gdb-gdb.gdb" auto-loading has been
  17530. declined by your `auto-load safe-path' set
  17531. to "$debugdir:$datadir/auto-load".
  17532. warning: File "/home/user/gdb/gdb-gdb.py" auto-loading has been
  17533. declined by your `auto-load safe-path' set
  17534. to "$debugdir:$datadir/auto-load".
  17535. To instruct GDB to go ahead and use the init files anyway, invoke GDB
  17536. like this:
  17537. $ gdb -q -iex "set auto-load safe-path /home/user/gdb" ./gdb
  17538. The list of trusted directories is controlled by the following
  17539. commands:
  17540. 'set auto-load safe-path [DIRECTORIES]'
  17541. Set the list of directories (and their subdirectories) trusted for
  17542. automatic loading and execution of scripts. You can also enter a
  17543. specific trusted file. Each directory can also be a shell wildcard
  17544. pattern; wildcards do not match directory separator - see
  17545. 'FNM_PATHNAME' for system function 'fnmatch' (*note fnmatch:
  17546. (libc)Wildcard Matching.). If you omit DIRECTORIES, 'auto-load
  17547. safe-path' will be reset to its default value as specified during
  17548. GDB compilation.
  17549. The list of directories uses path separator (':' on GNU and Unix
  17550. systems, ';' on MS-Windows and MS-DOS) to separate directories,
  17551. similarly to the 'PATH' environment variable.
  17552. 'show auto-load safe-path'
  17553. Show the list of directories trusted for automatic loading and
  17554. execution of scripts.
  17555. 'add-auto-load-safe-path'
  17556. Add an entry (or list of entries) to the list of directories
  17557. trusted for automatic loading and execution of scripts. Multiple
  17558. entries may be delimited by the host platform path separator in
  17559. use.
  17560. This variable defaults to what '--with-auto-load-dir' has been
  17561. configured to (*note with-auto-load-dir::). '$debugdir' and '$datadir'
  17562. substitution applies the same as for *note set auto-load
  17563. scripts-directory::. The default 'set auto-load safe-path' value can be
  17564. also overriden by GDB configuration option '--with-auto-load-safe-path'.
  17565. Setting this variable to '/' disables this security protection,
  17566. corresponding GDB configuration option is
  17567. '--without-auto-load-safe-path'. This variable is supposed to be set to
  17568. the system directories writable by the system superuser only. Users can
  17569. add their source directories in init files in their home directories
  17570. (*note Home Directory Init File::). See also deprecated init file in
  17571. the current directory (*note Init File in the Current Directory during
  17572. Startup::).
  17573. To force GDB to load the files it declined to load in the previous
  17574. example, you could use one of the following ways:
  17575. '~/.gdbinit': 'add-auto-load-safe-path ~/src/gdb'
  17576. Specify this trusted directory (or a file) as additional component
  17577. of the list. You have to specify also any existing directories
  17578. displayed by by 'show auto-load safe-path' (such as '/usr:/bin' in
  17579. this example).
  17580. 'gdb -iex "set auto-load safe-path /usr:/bin:~/src/gdb" ...'
  17581. Specify this directory as in the previous case but just for a
  17582. single GDB session.
  17583. 'gdb -iex "set auto-load safe-path /" ...'
  17584. Disable auto-loading safety for a single GDB session. This assumes
  17585. all the files you debug during this GDB session will come from
  17586. trusted sources.
  17587. './configure --without-auto-load-safe-path'
  17588. During compilation of GDB you may disable any auto-loading safety.
  17589. This assumes all the files you will ever debug with this GDB come
  17590. from trusted sources.
  17591. On the other hand you can also explicitly forbid automatic files
  17592. loading which also suppresses any such warning messages:
  17593. 'gdb -iex "set auto-load no" ...'
  17594. You can use GDB command-line option for a single GDB session.
  17595. '~/.gdbinit': 'set auto-load no'
  17596. Disable auto-loading globally for the user (*note Home Directory
  17597. Init File::). While it is improbable, you could also use system
  17598. init file instead (*note System-wide configuration::).
  17599. This setting applies to the file names as entered by user. If no
  17600. entry matches GDB tries as a last resort to also resolve all the file
  17601. names into their canonical form (typically resolving symbolic links) and
  17602. compare the entries again. GDB already canonicalizes most of the
  17603. filenames on its own before starting the comparison so a canonical form
  17604. of directories is recommended to be entered.
  17605. 
  17606. File: gdb.info, Node: Auto-loading verbose mode, Prev: Auto-loading safe path, Up: Auto-loading
  17607. 22.8.4 Displaying files tried for auto-load
  17608. -------------------------------------------
  17609. For better visibility of all the file locations where you can place
  17610. scripts to be auto-loaded with inferior -- or to protect yourself
  17611. against accidental execution of untrusted scripts -- GDB provides a
  17612. feature for printing all the files attempted to be loaded. Both
  17613. existing and non-existing files may be printed.
  17614. For example the list of directories from which it is safe to
  17615. auto-load files (*note Auto-loading safe path::) applies also to
  17616. canonicalized filenames which may not be too obvious while setting it
  17617. up.
  17618. (gdb) set debug auto-load on
  17619. (gdb) file ~/src/t/true
  17620. auto-load: Loading canned sequences of commands script "/tmp/true-gdb.gdb"
  17621. for objfile "/tmp/true".
  17622. auto-load: Updating directories of "/usr:/opt".
  17623. auto-load: Using directory "/usr".
  17624. auto-load: Using directory "/opt".
  17625. warning: File "/tmp/true-gdb.gdb" auto-loading has been declined
  17626. by your `auto-load safe-path' set to "/usr:/opt".
  17627. 'set debug auto-load [on|off]'
  17628. Set whether to print the filenames attempted to be auto-loaded.
  17629. 'show debug auto-load'
  17630. Show whether printing of the filenames attempted to be auto-loaded
  17631. is turned on or off.
  17632. 
  17633. File: gdb.info, Node: Messages/Warnings, Next: Debugging Output, Prev: Auto-loading, Up: Controlling GDB
  17634. 22.9 Optional Warnings and Messages
  17635. ===================================
  17636. By default, GDB is silent about its inner workings. If you are running
  17637. on a slow machine, you may want to use the 'set verbose' command. This
  17638. makes GDB tell you when it does a lengthy internal operation, so you
  17639. will not think it has crashed.
  17640. Currently, the messages controlled by 'set verbose' are those which
  17641. announce that the symbol table for a source file is being read; see
  17642. 'symbol-file' in *note Commands to Specify Files: Files.
  17643. 'set verbose on'
  17644. Enables GDB output of certain informational messages.
  17645. 'set verbose off'
  17646. Disables GDB output of certain informational messages.
  17647. 'show verbose'
  17648. Displays whether 'set verbose' is on or off.
  17649. By default, if GDB encounters bugs in the symbol table of an object
  17650. file, it is silent; but if you are debugging a compiler, you may find
  17651. this information useful (*note Errors Reading Symbol Files: Symbol
  17652. Errors.).
  17653. 'set complaints LIMIT'
  17654. Permits GDB to output LIMIT complaints about each type of unusual
  17655. symbols before becoming silent about the problem. Set LIMIT to
  17656. zero to suppress all complaints; set it to a large number to
  17657. prevent complaints from being suppressed.
  17658. 'show complaints'
  17659. Displays how many symbol complaints GDB is permitted to produce.
  17660. By default, GDB is cautious, and asks what sometimes seems to be a
  17661. lot of stupid questions to confirm certain commands. For example, if
  17662. you try to run a program which is already running:
  17663. (gdb) run
  17664. The program being debugged has been started already.
  17665. Start it from the beginning? (y or n)
  17666. If you are willing to unflinchingly face the consequences of your own
  17667. commands, you can disable this "feature":
  17668. 'set confirm off'
  17669. Disables confirmation requests. Note that running GDB with the
  17670. '--batch' option (*note -batch: Mode Options.) also automatically
  17671. disables confirmation requests.
  17672. 'set confirm on'
  17673. Enables confirmation requests (the default).
  17674. 'show confirm'
  17675. Displays state of confirmation requests.
  17676. If you need to debug user-defined commands or sourced files you may
  17677. find it useful to enable "command tracing". In this mode each command
  17678. will be printed as it is executed, prefixed with one or more '+'
  17679. symbols, the quantity denoting the call depth of each command.
  17680. 'set trace-commands on'
  17681. Enable command tracing.
  17682. 'set trace-commands off'
  17683. Disable command tracing.
  17684. 'show trace-commands'
  17685. Display the current state of command tracing.
  17686. 
  17687. File: gdb.info, Node: Debugging Output, Next: Other Misc Settings, Prev: Messages/Warnings, Up: Controlling GDB
  17688. 22.10 Optional Messages about Internal Happenings
  17689. =================================================
  17690. GDB has commands that enable optional debugging messages from various
  17691. GDB subsystems; normally these commands are of interest to GDB
  17692. maintainers, or when reporting a bug. This section documents those
  17693. commands.
  17694. 'set exec-done-display'
  17695. Turns on or off the notification of asynchronous commands'
  17696. completion. When on, GDB will print a message when an asynchronous
  17697. command finishes its execution. The default is off.
  17698. 'show exec-done-display'
  17699. Displays the current setting of asynchronous command completion
  17700. notification.
  17701. 'set debug aarch64'
  17702. Turns on or off display of debugging messages related to ARM
  17703. AArch64. The default is off.
  17704. 'show debug aarch64'
  17705. Displays the current state of displaying debugging messages related
  17706. to ARM AArch64.
  17707. 'set debug arch'
  17708. Turns on or off display of gdbarch debugging info. The default is
  17709. off
  17710. 'show debug arch'
  17711. Displays the current state of displaying gdbarch debugging info.
  17712. 'set debug aix-solib'
  17713. Control display of debugging messages from the AIX shared library
  17714. support module. The default is off.
  17715. 'show debug aix-thread'
  17716. Show the current state of displaying AIX shared library debugging
  17717. messages.
  17718. 'set debug aix-thread'
  17719. Display debugging messages about inner workings of the AIX thread
  17720. module.
  17721. 'show debug aix-thread'
  17722. Show the current state of AIX thread debugging info display.
  17723. 'set debug check-physname'
  17724. Check the results of the "physname" computation. When reading
  17725. DWARF debugging information for C++, GDB attempts to compute each
  17726. entity's name. GDB can do this computation in two different ways,
  17727. depending on exactly what information is present. When enabled,
  17728. this setting causes GDB to compute the names both ways and display
  17729. any discrepancies.
  17730. 'show debug check-physname'
  17731. Show the current state of "physname" checking.
  17732. 'set debug coff-pe-read'
  17733. Control display of debugging messages related to reading of COFF/PE
  17734. exported symbols. The default is off.
  17735. 'show debug coff-pe-read'
  17736. Displays the current state of displaying debugging messages related
  17737. to reading of COFF/PE exported symbols.
  17738. 'set debug dwarf-die'
  17739. Dump DWARF DIEs after they are read in. The value is the number of
  17740. nesting levels to print. A value of zero turns off the display.
  17741. 'show debug dwarf-die'
  17742. Show the current state of DWARF DIE debugging.
  17743. 'set debug dwarf-line'
  17744. Turns on or off display of debugging messages related to reading
  17745. DWARF line tables. The default is 0 (off). A value of 1 provides
  17746. basic information. A value greater than 1 provides more verbose
  17747. information.
  17748. 'show debug dwarf-line'
  17749. Show the current state of DWARF line table debugging.
  17750. 'set debug dwarf-read'
  17751. Turns on or off display of debugging messages related to reading
  17752. DWARF debug info. The default is 0 (off). A value of 1 provides
  17753. basic information. A value greater than 1 provides more verbose
  17754. information.
  17755. 'show debug dwarf-read'
  17756. Show the current state of DWARF reader debugging.
  17757. 'set debug displaced'
  17758. Turns on or off display of GDB debugging info for the displaced
  17759. stepping support. The default is off.
  17760. 'show debug displaced'
  17761. Displays the current state of displaying GDB debugging info related
  17762. to displaced stepping.
  17763. 'set debug event'
  17764. Turns on or off display of GDB event debugging info. The default
  17765. is off.
  17766. 'show debug event'
  17767. Displays the current state of displaying GDB event debugging info.
  17768. 'set debug expression'
  17769. Turns on or off display of debugging info about GDB expression
  17770. parsing. The default is off.
  17771. 'show debug expression'
  17772. Displays the current state of displaying debugging info about GDB
  17773. expression parsing.
  17774. 'set debug fbsd-lwp'
  17775. Turns on or off debugging messages from the FreeBSD LWP debug
  17776. support.
  17777. 'show debug fbsd-lwp'
  17778. Show the current state of FreeBSD LWP debugging messages.
  17779. 'set debug fbsd-nat'
  17780. Turns on or off debugging messages from the FreeBSD native target.
  17781. 'show debug fbsd-nat'
  17782. Show the current state of FreeBSD native target debugging messages.
  17783. 'set debug frame'
  17784. Turns on or off display of GDB frame debugging info. The default
  17785. is off.
  17786. 'show debug frame'
  17787. Displays the current state of displaying GDB frame debugging info.
  17788. 'set debug gnu-nat'
  17789. Turn on or off debugging messages from the GNU/Hurd debug support.
  17790. 'show debug gnu-nat'
  17791. Show the current state of GNU/Hurd debugging messages.
  17792. 'set debug infrun'
  17793. Turns on or off display of GDB debugging info for running the
  17794. inferior. The default is off. 'infrun.c' contains GDB's runtime
  17795. state machine used for implementing operations such as
  17796. single-stepping the inferior.
  17797. 'show debug infrun'
  17798. Displays the current state of GDB inferior debugging.
  17799. 'set debug jit'
  17800. Turn on or off debugging messages from JIT debug support.
  17801. 'show debug jit'
  17802. Displays the current state of GDB JIT debugging.
  17803. 'set debug lin-lwp'
  17804. Turn on or off debugging messages from the Linux LWP debug support.
  17805. 'show debug lin-lwp'
  17806. Show the current state of Linux LWP debugging messages.
  17807. 'set debug linux-namespaces'
  17808. Turn on or off debugging messages from the Linux namespaces debug
  17809. support.
  17810. 'show debug linux-namespaces'
  17811. Show the current state of Linux namespaces debugging messages.
  17812. 'set debug mach-o'
  17813. Control display of debugging messages related to Mach-O symbols
  17814. processing. The default is off.
  17815. 'show debug mach-o'
  17816. Displays the current state of displaying debugging messages related
  17817. to reading of COFF/PE exported symbols.
  17818. 'set debug notification'
  17819. Turn on or off debugging messages about remote async notification.
  17820. The default is off.
  17821. 'show debug notification'
  17822. Displays the current state of remote async notification debugging
  17823. messages.
  17824. 'set debug observer'
  17825. Turns on or off display of GDB observer debugging. This includes
  17826. info such as the notification of observable events.
  17827. 'show debug observer'
  17828. Displays the current state of observer debugging.
  17829. 'set debug overload'
  17830. Turns on or off display of GDB C++ overload debugging info. This
  17831. includes info such as ranking of functions, etc. The default is
  17832. off.
  17833. 'show debug overload'
  17834. Displays the current state of displaying GDB C++ overload debugging
  17835. info.
  17836. 'set debug parser'
  17837. Turns on or off the display of expression parser debugging output.
  17838. Internally, this sets the 'yydebug' variable in the expression
  17839. parser. *Note Tracing Your Parser: (bison)Tracing, for details.
  17840. The default is off.
  17841. 'show debug parser'
  17842. Show the current state of expression parser debugging.
  17843. 'set debug remote'
  17844. Turns on or off display of reports on all packets sent back and
  17845. forth across the serial line to the remote machine. The info is
  17846. printed on the GDB standard output stream. The default is off.
  17847. 'show debug remote'
  17848. Displays the state of display of remote packets.
  17849. 'set debug remote-packet-max-chars'
  17850. Sets the maximum number of characters to display for each remote
  17851. packet when 'set debug remote' is on. This is useful to prevent
  17852. GDB from displaying lengthy remote packets and polluting the
  17853. console.
  17854. The default value is '512', which means GDB will truncate each
  17855. remote packet after 512 bytes.
  17856. Setting this option to 'unlimited' will disable truncation and will
  17857. output the full length of the remote packets.
  17858. 'show debug remote-packet-max-chars'
  17859. Displays the number of bytes to output for remote packet debugging.
  17860. 'set debug separate-debug-file'
  17861. Turns on or off display of debug output about separate debug file
  17862. search.
  17863. 'show debug separate-debug-file'
  17864. Displays the state of separate debug file search debug output.
  17865. 'set debug serial'
  17866. Turns on or off display of GDB serial debugging info. The default
  17867. is off.
  17868. 'show debug serial'
  17869. Displays the current state of displaying GDB serial debugging info.
  17870. 'set debug solib-frv'
  17871. Turn on or off debugging messages for FR-V shared-library code.
  17872. 'show debug solib-frv'
  17873. Display the current state of FR-V shared-library code debugging
  17874. messages.
  17875. 'set debug symbol-lookup'
  17876. Turns on or off display of debugging messages related to symbol
  17877. lookup. The default is 0 (off). A value of 1 provides basic
  17878. information. A value greater than 1 provides more verbose
  17879. information.
  17880. 'show debug symbol-lookup'
  17881. Show the current state of symbol lookup debugging messages.
  17882. 'set debug symfile'
  17883. Turns on or off display of debugging messages related to symbol
  17884. file functions. The default is off. *Note Files::.
  17885. 'show debug symfile'
  17886. Show the current state of symbol file debugging messages.
  17887. 'set debug symtab-create'
  17888. Turns on or off display of debugging messages related to symbol
  17889. table creation. The default is 0 (off). A value of 1 provides
  17890. basic information. A value greater than 1 provides more verbose
  17891. information.
  17892. 'show debug symtab-create'
  17893. Show the current state of symbol table creation debugging.
  17894. 'set debug target'
  17895. Turns on or off display of GDB target debugging info. This info
  17896. includes what is going on at the target level of GDB, as it
  17897. happens. The default is 0. Set it to 1 to track events, and to 2
  17898. to also track the value of large memory transfers.
  17899. 'show debug target'
  17900. Displays the current state of displaying GDB target debugging info.
  17901. 'set debug timestamp'
  17902. Turns on or off display of timestamps with GDB debugging info.
  17903. When enabled, seconds and microseconds are displayed before each
  17904. debugging message.
  17905. 'show debug timestamp'
  17906. Displays the current state of displaying timestamps with GDB
  17907. debugging info.
  17908. 'set debug varobj'
  17909. Turns on or off display of GDB variable object debugging info. The
  17910. default is off.
  17911. 'show debug varobj'
  17912. Displays the current state of displaying GDB variable object
  17913. debugging info.
  17914. 'set debug xml'
  17915. Turn on or off debugging messages for built-in XML parsers.
  17916. 'show debug xml'
  17917. Displays the current state of XML debugging messages.
  17918. 
  17919. File: gdb.info, Node: Other Misc Settings, Prev: Debugging Output, Up: Controlling GDB
  17920. 22.11 Other Miscellaneous Settings
  17921. ==================================
  17922. 'set interactive-mode'
  17923. If 'on', forces GDB to assume that GDB was started in a terminal.
  17924. In practice, this means that GDB should wait for the user to answer
  17925. queries generated by commands entered at the command prompt. If
  17926. 'off', forces GDB to operate in the opposite mode, and it uses the
  17927. default answers to all queries. If 'auto' (the default), GDB tries
  17928. to determine whether its standard input is a terminal, and works in
  17929. interactive-mode if it is, non-interactively otherwise.
  17930. In the vast majority of cases, the debugger should be able to guess
  17931. correctly which mode should be used. But this setting can be
  17932. useful in certain specific cases, such as running a MinGW GDB
  17933. inside a cygwin window.
  17934. 'show interactive-mode'
  17935. Displays whether the debugger is operating in interactive mode or
  17936. not.
  17937. 
  17938. File: gdb.info, Node: Extending GDB, Next: Interpreters, Prev: Controlling GDB, Up: Top
  17939. 23 Extending GDB
  17940. ****************
  17941. GDB provides several mechanisms for extension. GDB also provides the
  17942. ability to automatically load extensions when it reads a file for
  17943. debugging. This allows the user to automatically customize GDB for the
  17944. program being debugged.
  17945. * Menu:
  17946. * Sequences:: Canned Sequences of GDB Commands
  17947. * Python:: Extending GDB using Python
  17948. * Guile:: Extending GDB using Guile
  17949. * Auto-loading extensions:: Automatically loading extensions
  17950. * Multiple Extension Languages:: Working with multiple extension languages
  17951. * Aliases:: Creating new spellings of existing commands
  17952. To facilitate the use of extension languages, GDB is capable of
  17953. evaluating the contents of a file. When doing so, GDB can recognize
  17954. which extension language is being used by looking at the filename
  17955. extension. Files with an unrecognized filename extension are always
  17956. treated as a GDB Command Files. *Note Command files: Command Files.
  17957. You can control how GDB evaluates these files with the following
  17958. setting:
  17959. 'set script-extension off'
  17960. All scripts are always evaluated as GDB Command Files.
  17961. 'set script-extension soft'
  17962. The debugger determines the scripting language based on filename
  17963. extension. If this scripting language is supported, GDB evaluates
  17964. the script using that language. Otherwise, it evaluates the file
  17965. as a GDB Command File.
  17966. 'set script-extension strict'
  17967. The debugger determines the scripting language based on filename
  17968. extension, and evaluates the script using that language. If the
  17969. language is not supported, then the evaluation fails.
  17970. 'show script-extension'
  17971. Display the current value of the 'script-extension' option.
  17972. 
  17973. File: gdb.info, Node: Sequences, Next: Python, Up: Extending GDB
  17974. 23.1 Canned Sequences of Commands
  17975. =================================
  17976. Aside from breakpoint commands (*note Breakpoint Command Lists: Break
  17977. Commands.), GDB provides two ways to store sequences of commands for
  17978. execution as a unit: user-defined commands and command files.
  17979. * Menu:
  17980. * Define:: How to define your own commands
  17981. * Hooks:: Hooks for user-defined commands
  17982. * Command Files:: How to write scripts of commands to be stored in a file
  17983. * Output:: Commands for controlled output
  17984. * Auto-loading sequences:: Controlling auto-loaded command files
  17985. 
  17986. File: gdb.info, Node: Define, Next: Hooks, Up: Sequences
  17987. 23.1.1 User-defined Commands
  17988. ----------------------------
  17989. A "user-defined command" is a sequence of GDB commands to which you
  17990. assign a new name as a command. This is done with the 'define' command.
  17991. User commands may accept an unlimited number of arguments separated by
  17992. whitespace. Arguments are accessed within the user command via
  17993. '$arg0...$argN'. A trivial example:
  17994. define adder
  17995. print $arg0 + $arg1 + $arg2
  17996. end
  17997. To execute the command use:
  17998. adder 1 2 3
  17999. This defines the command 'adder', which prints the sum of its three
  18000. arguments. Note the arguments are text substitutions, so they may
  18001. reference variables, use complex expressions, or even perform inferior
  18002. functions calls.
  18003. In addition, '$argc' may be used to find out how many arguments have
  18004. been passed.
  18005. define adder
  18006. if $argc == 2
  18007. print $arg0 + $arg1
  18008. end
  18009. if $argc == 3
  18010. print $arg0 + $arg1 + $arg2
  18011. end
  18012. end
  18013. Combining with the 'eval' command (*note eval::) makes it easier to
  18014. process a variable number of arguments:
  18015. define adder
  18016. set $i = 0
  18017. set $sum = 0
  18018. while $i < $argc
  18019. eval "set $sum = $sum + $arg%d", $i
  18020. set $i = $i + 1
  18021. end
  18022. print $sum
  18023. end
  18024. 'define COMMANDNAME'
  18025. Define a command named COMMANDNAME. If there is already a command
  18026. by that name, you are asked to confirm that you want to redefine
  18027. it. The argument COMMANDNAME may be a bare command name consisting
  18028. of letters, numbers, dashes, dots, and underscores. It may also
  18029. start with any predefined or user-defined prefix command. For
  18030. example, 'define target my-target' creates a user-defined 'target
  18031. my-target' command.
  18032. The definition of the command is made up of other GDB command
  18033. lines, which are given following the 'define' command. The end of
  18034. these commands is marked by a line containing 'end'.
  18035. 'document COMMANDNAME'
  18036. Document the user-defined command COMMANDNAME, so that it can be
  18037. accessed by 'help'. The command COMMANDNAME must already be
  18038. defined. This command reads lines of documentation just as
  18039. 'define' reads the lines of the command definition, ending with
  18040. 'end'. After the 'document' command is finished, 'help' on command
  18041. COMMANDNAME displays the documentation you have written.
  18042. You may use the 'document' command again to change the
  18043. documentation of a command. Redefining the command with 'define'
  18044. does not change the documentation.
  18045. 'define-prefix COMMANDNAME'
  18046. Define or mark the command COMMANDNAME as a user-defined prefix
  18047. command. Once marked, COMMANDNAME can be used as prefix command by
  18048. the 'define' command. Note that 'define-prefix' can be used with a
  18049. not yet defined COMMANDNAME. In such a case, COMMANDNAME is
  18050. defined as an empty user-defined command. In case you redefine a
  18051. command that was marked as a user-defined prefix command, the
  18052. subcommands of the redefined command are kept (and GDB indicates so
  18053. to the user).
  18054. Example:
  18055. (gdb) define-prefix abc
  18056. (gdb) define-prefix abc def
  18057. (gdb) define abc def
  18058. Type commands for definition of "abc def".
  18059. End with a line saying just "end".
  18060. >echo command initial def\n
  18061. >end
  18062. (gdb) define abc def ghi
  18063. Type commands for definition of "abc def ghi".
  18064. End with a line saying just "end".
  18065. >echo command ghi\n
  18066. >end
  18067. (gdb) define abc def
  18068. Keeping subcommands of prefix command "def".
  18069. Redefine command "def"? (y or n) y
  18070. Type commands for definition of "abc def".
  18071. End with a line saying just "end".
  18072. >echo command def\n
  18073. >end
  18074. (gdb) abc def ghi
  18075. command ghi
  18076. (gdb) abc def
  18077. command def
  18078. (gdb)
  18079. 'dont-repeat'
  18080. Used inside a user-defined command, this tells GDB that this
  18081. command should not be repeated when the user hits <RET> (*note
  18082. repeat last command: Command Syntax.).
  18083. 'help user-defined'
  18084. List all user-defined commands and all python commands defined in
  18085. class COMMAND_USER. The first line of the documentation or
  18086. docstring is included (if any).
  18087. 'show user'
  18088. 'show user COMMANDNAME'
  18089. Display the GDB commands used to define COMMANDNAME (but not its
  18090. documentation). If no COMMANDNAME is given, display the
  18091. definitions for all user-defined commands. This does not work for
  18092. user-defined python commands.
  18093. 'show max-user-call-depth'
  18094. 'set max-user-call-depth'
  18095. The value of 'max-user-call-depth' controls how many recursion
  18096. levels are allowed in user-defined commands before GDB suspects an
  18097. infinite recursion and aborts the command. This does not apply to
  18098. user-defined python commands.
  18099. In addition to the above commands, user-defined commands frequently
  18100. use control flow commands, described in *note Command Files::.
  18101. When user-defined commands are executed, the commands of the
  18102. definition are not printed. An error in any command stops execution of
  18103. the user-defined command.
  18104. If used interactively, commands that would ask for confirmation
  18105. proceed without asking when used inside a user-defined command. Many
  18106. GDB commands that normally print messages to say what they are doing
  18107. omit the messages when used in a user-defined command.
  18108. 
  18109. File: gdb.info, Node: Hooks, Next: Command Files, Prev: Define, Up: Sequences
  18110. 23.1.2 User-defined Command Hooks
  18111. ---------------------------------
  18112. You may define "hooks", which are a special kind of user-defined
  18113. command. Whenever you run the command 'foo', if the user-defined
  18114. command 'hook-foo' exists, it is executed (with no arguments) before
  18115. that command.
  18116. A hook may also be defined which is run after the command you
  18117. executed. Whenever you run the command 'foo', if the user-defined
  18118. command 'hookpost-foo' exists, it is executed (with no arguments) after
  18119. that command. Post-execution hooks may exist simultaneously with
  18120. pre-execution hooks, for the same command.
  18121. It is valid for a hook to call the command which it hooks. If this
  18122. occurs, the hook is not re-executed, thereby avoiding infinite
  18123. recursion.
  18124. In addition, a pseudo-command, 'stop' exists. Defining ('hook-stop')
  18125. makes the associated commands execute every time execution stops in your
  18126. program: before breakpoint commands are run, displays are printed, or
  18127. the stack frame is printed.
  18128. For example, to ignore 'SIGALRM' signals while single-stepping, but
  18129. treat them normally during normal execution, you could define:
  18130. define hook-stop
  18131. handle SIGALRM nopass
  18132. end
  18133. define hook-run
  18134. handle SIGALRM pass
  18135. end
  18136. define hook-continue
  18137. handle SIGALRM pass
  18138. end
  18139. As a further example, to hook at the beginning and end of the 'echo'
  18140. command, and to add extra text to the beginning and end of the message,
  18141. you could define:
  18142. define hook-echo
  18143. echo <<<---
  18144. end
  18145. define hookpost-echo
  18146. echo --->>>\n
  18147. end
  18148. (gdb) echo Hello World
  18149. <<<---Hello World--->>>
  18150. (gdb)
  18151. You can define a hook for any single-word command in GDB, but not for
  18152. command aliases; you should define a hook for the basic command name,
  18153. e.g. 'backtrace' rather than 'bt'. You can hook a multi-word command by
  18154. adding 'hook-' or 'hookpost-' to the last word of the command, e.g.
  18155. 'define target hook-remote' to add a hook to 'target remote'.
  18156. If an error occurs during the execution of your hook, execution of
  18157. GDB commands stops and GDB issues a prompt (before the command that you
  18158. actually typed had a chance to run).
  18159. If you try to define a hook which does not match any known command,
  18160. you get a warning from the 'define' command.
  18161. 
  18162. File: gdb.info, Node: Command Files, Next: Output, Prev: Hooks, Up: Sequences
  18163. 23.1.3 Command Files
  18164. --------------------
  18165. A command file for GDB is a text file made of lines that are GDB
  18166. commands. Comments (lines starting with '#') may also be included. An
  18167. empty line in a command file does nothing; it does not mean to repeat
  18168. the last command, as it would from the terminal.
  18169. You can request the execution of a command file with the 'source'
  18170. command. Note that the 'source' command is also used to evaluate
  18171. scripts that are not Command Files. The exact behavior can be
  18172. configured using the 'script-extension' setting. *Note Extending GDB:
  18173. Extending GDB.
  18174. 'source [-s] [-v] FILENAME'
  18175. Execute the command file FILENAME.
  18176. The lines in a command file are generally executed sequentially,
  18177. unless the order of execution is changed by one of the _flow-control
  18178. commands_ described below. The commands are not printed as they are
  18179. executed. An error in any command terminates execution of the command
  18180. file and control is returned to the console.
  18181. GDB first searches for FILENAME in the current directory. If the
  18182. file is not found there, and FILENAME does not specify a directory, then
  18183. GDB also looks for the file on the source search path (specified with
  18184. the 'directory' command); except that '$cdir' is not searched because
  18185. the compilation directory is not relevant to scripts.
  18186. If '-s' is specified, then GDB searches for FILENAME on the search
  18187. path even if FILENAME specifies a directory. The search is done by
  18188. appending FILENAME to each element of the search path. So, for example,
  18189. if FILENAME is 'mylib/myscript' and the search path contains
  18190. '/home/user' then GDB will look for the script
  18191. '/home/user/mylib/myscript'. The search is also done if FILENAME is an
  18192. absolute path. For example, if FILENAME is '/tmp/myscript' and the
  18193. search path contains '/home/user' then GDB will look for the script
  18194. '/home/user/tmp/myscript'. For DOS-like systems, if FILENAME contains a
  18195. drive specification, it is stripped before concatenation. For example,
  18196. if FILENAME is 'd:myscript' and the search path contains 'c:/tmp' then
  18197. GDB will look for the script 'c:/tmp/myscript'.
  18198. If '-v', for verbose mode, is given then GDB displays each command as
  18199. it is executed. The option must be given before FILENAME, and is
  18200. interpreted as part of the filename anywhere else.
  18201. Commands that would ask for confirmation if used interactively
  18202. proceed without asking when used in a command file. Many GDB commands
  18203. that normally print messages to say what they are doing omit the
  18204. messages when called from command files.
  18205. GDB also accepts command input from standard input. In this mode,
  18206. normal output goes to standard output and error output goes to standard
  18207. error. Errors in a command file supplied on standard input do not
  18208. terminate execution of the command file--execution continues with the
  18209. next command.
  18210. gdb < cmds > log 2>&1
  18211. (The syntax above will vary depending on the shell used.) This
  18212. example will execute commands from the file 'cmds'. All output and
  18213. errors would be directed to 'log'.
  18214. Since commands stored on command files tend to be more general than
  18215. commands typed interactively, they frequently need to deal with
  18216. complicated situations, such as different or unexpected values of
  18217. variables and symbols, changes in how the program being debugged is
  18218. built, etc. GDB provides a set of flow-control commands to deal with
  18219. these complexities. Using these commands, you can write complex scripts
  18220. that loop over data structures, execute commands conditionally, etc.
  18221. 'if'
  18222. 'else'
  18223. This command allows to include in your script conditionally
  18224. executed commands. The 'if' command takes a single argument, which
  18225. is an expression to evaluate. It is followed by a series of
  18226. commands that are executed only if the expression is true (its
  18227. value is nonzero). There can then optionally be an 'else' line,
  18228. followed by a series of commands that are only executed if the
  18229. expression was false. The end of the list is marked by a line
  18230. containing 'end'.
  18231. 'while'
  18232. This command allows to write loops. Its syntax is similar to 'if':
  18233. the command takes a single argument, which is an expression to
  18234. evaluate, and must be followed by the commands to execute, one per
  18235. line, terminated by an 'end'. These commands are called the "body"
  18236. of the loop. The commands in the body of 'while' are executed
  18237. repeatedly as long as the expression evaluates to true.
  18238. 'loop_break'
  18239. This command exits the 'while' loop in whose body it is included.
  18240. Execution of the script continues after that 'while's 'end' line.
  18241. 'loop_continue'
  18242. This command skips the execution of the rest of the body of
  18243. commands in the 'while' loop in whose body it is included.
  18244. Execution branches to the beginning of the 'while' loop, where it
  18245. evaluates the controlling expression.
  18246. 'end'
  18247. Terminate the block of commands that are the body of 'if', 'else',
  18248. or 'while' flow-control commands.
  18249. 
  18250. File: gdb.info, Node: Output, Next: Auto-loading sequences, Prev: Command Files, Up: Sequences
  18251. 23.1.4 Commands for Controlled Output
  18252. -------------------------------------
  18253. During the execution of a command file or a user-defined command, normal
  18254. GDB output is suppressed; the only output that appears is what is
  18255. explicitly printed by the commands in the definition. This section
  18256. describes three commands useful for generating exactly the output you
  18257. want.
  18258. 'echo TEXT'
  18259. Print TEXT. Nonprinting characters can be included in TEXT using C
  18260. escape sequences, such as '\n' to print a newline. *No newline is
  18261. printed unless you specify one.* In addition to the standard C
  18262. escape sequences, a backslash followed by a space stands for a
  18263. space. This is useful for displaying a string with spaces at the
  18264. beginning or the end, since leading and trailing spaces are
  18265. otherwise trimmed from all arguments. To print ' and foo = ', use
  18266. the command 'echo \ and foo = \ '.
  18267. A backslash at the end of TEXT can be used, as in C, to continue
  18268. the command onto subsequent lines. For example,
  18269. echo This is some text\n\
  18270. which is continued\n\
  18271. onto several lines.\n
  18272. produces the same output as
  18273. echo This is some text\n
  18274. echo which is continued\n
  18275. echo onto several lines.\n
  18276. 'output EXPRESSION'
  18277. Print the value of EXPRESSION and nothing but that value: no
  18278. newlines, no '$NN = '. The value is not entered in the value
  18279. history either. *Note Expressions: Expressions, for more
  18280. information on expressions.
  18281. 'output/FMT EXPRESSION'
  18282. Print the value of EXPRESSION in format FMT. You can use the same
  18283. formats as for 'print'. *Note Output Formats: Output Formats, for
  18284. more information.
  18285. 'printf TEMPLATE, EXPRESSIONS...'
  18286. Print the values of one or more EXPRESSIONS under the control of
  18287. the string TEMPLATE. To print several values, make EXPRESSIONS be
  18288. a comma-separated list of individual expressions, which may be
  18289. either numbers or pointers. Their values are printed as specified
  18290. by TEMPLATE, exactly as a C program would do by executing the code
  18291. below:
  18292. printf (TEMPLATE, EXPRESSIONS...);
  18293. As in 'C' 'printf', ordinary characters in TEMPLATE are printed
  18294. verbatim, while "conversion specification" introduced by the '%'
  18295. character cause subsequent EXPRESSIONS to be evaluated, their
  18296. values converted and formatted according to type and style
  18297. information encoded in the conversion specifications, and then
  18298. printed.
  18299. For example, you can print two values in hex like this:
  18300. printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
  18301. 'printf' supports all the standard 'C' conversion specifications,
  18302. including the flags and modifiers between the '%' character and the
  18303. conversion letter, with the following exceptions:
  18304. * The argument-ordering modifiers, such as '2$', are not
  18305. supported.
  18306. * The modifier '*' is not supported for specifying precision or
  18307. width.
  18308. * The ''' flag (for separation of digits into groups according
  18309. to 'LC_NUMERIC'') is not supported.
  18310. * The type modifiers 'hh', 'j', 't', and 'z' are not supported.
  18311. * The conversion letter 'n' (as in '%n') is not supported.
  18312. * The conversion letters 'a' and 'A' are not supported.
  18313. Note that the 'll' type modifier is supported only if the
  18314. underlying 'C' implementation used to build GDB supports the 'long
  18315. long int' type, and the 'L' type modifier is supported only if
  18316. 'long double' type is available.
  18317. As in 'C', 'printf' supports simple backslash-escape sequences,
  18318. such as '\n', '\t', '\\', '\"', '\a', and '\f', that consist of
  18319. backslash followed by a single character. Octal and hexadecimal
  18320. escape sequences are not supported.
  18321. Additionally, 'printf' supports conversion specifications for DFP
  18322. ("Decimal Floating Point") types using the following length
  18323. modifiers together with a floating point specifier. letters:
  18324. * 'H' for printing 'Decimal32' types.
  18325. * 'D' for printing 'Decimal64' types.
  18326. * 'DD' for printing 'Decimal128' types.
  18327. If the underlying 'C' implementation used to build GDB has support
  18328. for the three length modifiers for DFP types, other modifiers such
  18329. as width and precision will also be available for GDB to use.
  18330. In case there is no such 'C' support, no additional modifiers will
  18331. be available and the value will be printed in the standard way.
  18332. Here's an example of printing DFP types using the above conversion
  18333. letters:
  18334. printf "D32: %Hf - D64: %Df - D128: %DDf\n",1.2345df,1.2E10dd,1.2E1dl
  18335. 'eval TEMPLATE, EXPRESSIONS...'
  18336. Convert the values of one or more EXPRESSIONS under the control of
  18337. the string TEMPLATE to a command line, and call it.
  18338. 
  18339. File: gdb.info, Node: Auto-loading sequences, Prev: Output, Up: Sequences
  18340. 23.1.5 Controlling auto-loading native GDB scripts
  18341. --------------------------------------------------
  18342. When a new object file is read (for example, due to the 'file' command,
  18343. or because the inferior has loaded a shared library), GDB will look for
  18344. the command file 'OBJFILE-gdb.gdb'. *Note Auto-loading extensions::.
  18345. Auto-loading can be enabled or disabled, and the list of auto-loaded
  18346. scripts can be printed.
  18347. 'set auto-load gdb-scripts [on|off]'
  18348. Enable or disable the auto-loading of canned sequences of commands
  18349. scripts.
  18350. 'show auto-load gdb-scripts'
  18351. Show whether auto-loading of canned sequences of commands scripts
  18352. is enabled or disabled.
  18353. 'info auto-load gdb-scripts [REGEXP]'
  18354. Print the list of all canned sequences of commands scripts that GDB
  18355. auto-loaded.
  18356. If REGEXP is supplied only canned sequences of commands scripts with
  18357. matching names are printed.
  18358. 
  18359. File: gdb.info, Node: Python, Next: Guile, Prev: Sequences, Up: Extending GDB
  18360. 23.2 Extending GDB using Python
  18361. ===============================
  18362. You can extend GDB using the Python programming language
  18363. (http://www.python.org/). This feature is available only if GDB was
  18364. configured using '--with-python'. GDB can be built against either
  18365. Python 2 or Python 3; which one you have depends on this configure-time
  18366. option.
  18367. Python scripts used by GDB should be installed in
  18368. 'DATA-DIRECTORY/python', where DATA-DIRECTORY is the data directory as
  18369. determined at GDB startup (*note Data Files::). This directory, known
  18370. as the "python directory", is automatically added to the Python Search
  18371. Path in order to allow the Python interpreter to locate all scripts
  18372. installed at this location.
  18373. Additionally, GDB commands and convenience functions which are
  18374. written in Python and are located in the
  18375. 'DATA-DIRECTORY/python/gdb/command' or
  18376. 'DATA-DIRECTORY/python/gdb/function' directories are automatically
  18377. imported when GDB starts.
  18378. * Menu:
  18379. * Python Commands:: Accessing Python from GDB.
  18380. * Python API:: Accessing GDB from Python.
  18381. * Python Auto-loading:: Automatically loading Python code.
  18382. * Python modules:: Python modules provided by GDB.
  18383. 
  18384. File: gdb.info, Node: Python Commands, Next: Python API, Up: Python
  18385. 23.2.1 Python Commands
  18386. ----------------------
  18387. GDB provides two commands for accessing the Python interpreter, and one
  18388. related setting:
  18389. 'python-interactive [COMMAND]'
  18390. 'pi [COMMAND]'
  18391. Without an argument, the 'python-interactive' command can be used
  18392. to start an interactive Python prompt. To return to GDB, type the
  18393. 'EOF' character (e.g., 'Ctrl-D' on an empty prompt).
  18394. Alternatively, a single-line Python command can be given as an
  18395. argument and evaluated. If the command is an expression, the
  18396. result will be printed; otherwise, nothing will be printed. For
  18397. example:
  18398. (gdb) python-interactive 2 + 3
  18399. 5
  18400. 'python [COMMAND]'
  18401. 'py [COMMAND]'
  18402. The 'python' command can be used to evaluate Python code.
  18403. If given an argument, the 'python' command will evaluate the
  18404. argument as a Python command. For example:
  18405. (gdb) python print 23
  18406. 23
  18407. If you do not provide an argument to 'python', it will act as a
  18408. multi-line command, like 'define'. In this case, the Python script
  18409. is made up of subsequent command lines, given after the 'python'
  18410. command. This command list is terminated using a line containing
  18411. 'end'. For example:
  18412. (gdb) python
  18413. >print 23
  18414. >end
  18415. 23
  18416. 'set python print-stack'
  18417. By default, GDB will print only the message component of a Python
  18418. exception when an error occurs in a Python script. This can be
  18419. controlled using 'set python print-stack': if 'full', then full
  18420. Python stack printing is enabled; if 'none', then Python stack and
  18421. message printing is disabled; if 'message', the default, only the
  18422. message component of the error is printed.
  18423. It is also possible to execute a Python script from the GDB
  18424. interpreter:
  18425. 'source script-name'
  18426. The script name must end with '.py' and GDB must be configured to
  18427. recognize the script language based on filename extension using the
  18428. 'script-extension' setting. *Note Extending GDB: Extending GDB.
  18429. 
  18430. File: gdb.info, Node: Python API, Next: Python Auto-loading, Prev: Python Commands, Up: Python
  18431. 23.2.2 Python API
  18432. -----------------
  18433. You can get quick online help for GDB's Python API by issuing the
  18434. command 'python help (gdb)'.
  18435. Functions and methods which have two or more optional arguments allow
  18436. them to be specified using keyword syntax. This allows passing some
  18437. optional arguments while skipping others. Example:
  18438. 'gdb.some_function ('foo', bar = 1, baz = 2)'.
  18439. * Menu:
  18440. * Basic Python:: Basic Python Functions.
  18441. * Exception Handling:: How Python exceptions are translated.
  18442. * Values From Inferior:: Python representation of values.
  18443. * Types In Python:: Python representation of types.
  18444. * Pretty Printing API:: Pretty-printing values.
  18445. * Selecting Pretty-Printers:: How GDB chooses a pretty-printer.
  18446. * Writing a Pretty-Printer:: Writing a Pretty-Printer.
  18447. * Type Printing API:: Pretty-printing types.
  18448. * Frame Filter API:: Filtering Frames.
  18449. * Frame Decorator API:: Decorating Frames.
  18450. * Writing a Frame Filter:: Writing a Frame Filter.
  18451. * Unwinding Frames in Python:: Writing frame unwinder.
  18452. * Xmethods In Python:: Adding and replacing methods of C++ classes.
  18453. * Xmethod API:: Xmethod types.
  18454. * Writing an Xmethod:: Writing an xmethod.
  18455. * Inferiors In Python:: Python representation of inferiors (processes)
  18456. * Events In Python:: Listening for events from GDB.
  18457. * Threads In Python:: Accessing inferior threads from Python.
  18458. * Recordings In Python:: Accessing recordings from Python.
  18459. * Commands In Python:: Implementing new commands in Python.
  18460. * Parameters In Python:: Adding new GDB parameters.
  18461. * Functions In Python:: Writing new convenience functions.
  18462. * Progspaces In Python:: Program spaces.
  18463. * Objfiles In Python:: Object files.
  18464. * Frames In Python:: Accessing inferior stack frames from Python.
  18465. * Blocks In Python:: Accessing blocks from Python.
  18466. * Symbols In Python:: Python representation of symbols.
  18467. * Symbol Tables In Python:: Python representation of symbol tables.
  18468. * Line Tables In Python:: Python representation of line tables.
  18469. * Breakpoints In Python:: Manipulating breakpoints using Python.
  18470. * Finish Breakpoints in Python:: Setting Breakpoints on function return
  18471. using Python.
  18472. * Lazy Strings In Python:: Python representation of lazy strings.
  18473. * Architectures In Python:: Python representation of architectures.
  18474. * Registers In Python:: Python representation of registers.
  18475. * TUI Windows In Python:: Implementing new TUI windows.
  18476. 
  18477. File: gdb.info, Node: Basic Python, Next: Exception Handling, Up: Python API
  18478. 23.2.2.1 Basic Python
  18479. .....................
  18480. At startup, GDB overrides Python's 'sys.stdout' and 'sys.stderr' to
  18481. print using GDB's output-paging streams. A Python program which outputs
  18482. to one of these streams may have its output interrupted by the user
  18483. (*note Screen Size::). In this situation, a Python 'KeyboardInterrupt'
  18484. exception is thrown.
  18485. Some care must be taken when writing Python code to run in GDB. Two
  18486. things worth noting in particular:
  18487. * GDB install handlers for 'SIGCHLD' and 'SIGINT'. Python code must
  18488. not override these, or even change the options using 'sigaction'.
  18489. If your program changes the handling of these signals, GDB will
  18490. most likely stop working correctly. Note that it is unfortunately
  18491. common for GUI toolkits to install a 'SIGCHLD' handler.
  18492. * GDB takes care to mark its internal file descriptors as
  18493. close-on-exec. However, this cannot be done in a thread-safe way
  18494. on all platforms. Your Python programs should be aware of this and
  18495. should both create new file descriptors with the close-on-exec flag
  18496. set and arrange to close unneeded file descriptors before starting
  18497. a child process.
  18498. GDB introduces a new Python module, named 'gdb'. All methods and
  18499. classes added by GDB are placed in this module. GDB automatically
  18500. 'import's the 'gdb' module for use in all scripts evaluated by the
  18501. 'python' command.
  18502. Some types of the 'gdb' module come with a textual representation
  18503. (accessible through the 'repr' or 'str' functions). These are offered
  18504. for debugging purposes only, expect them to change over time.
  18505. -- Variable: gdb.PYTHONDIR
  18506. A string containing the python directory (*note Python::).
  18507. -- Function: gdb.execute (command [, from_tty [, to_string]])
  18508. Evaluate COMMAND, a string, as a GDB CLI command. If a GDB
  18509. exception happens while COMMAND runs, it is translated as described
  18510. in *note Exception Handling: Exception Handling.
  18511. The FROM_TTY flag specifies whether GDB ought to consider this
  18512. command as having originated from the user invoking it
  18513. interactively. It must be a boolean value. If omitted, it
  18514. defaults to 'False'.
  18515. By default, any output produced by COMMAND is sent to GDB's
  18516. standard output (and to the log output if logging is turned on).
  18517. If the TO_STRING parameter is 'True', then output will be collected
  18518. by 'gdb.execute' and returned as a string. The default is 'False',
  18519. in which case the return value is 'None'. If TO_STRING is 'True',
  18520. the GDB virtual terminal will be temporarily set to unlimited width
  18521. and height, and its pagination will be disabled; *note Screen
  18522. Size::.
  18523. -- Function: gdb.breakpoints ()
  18524. Return a sequence holding all of GDB's breakpoints. *Note
  18525. Breakpoints In Python::, for more information. In GDB version 7.11
  18526. and earlier, this function returned 'None' if there were no
  18527. breakpoints. This peculiarity was subsequently fixed, and now
  18528. 'gdb.breakpoints' returns an empty sequence in this case.
  18529. -- Function: gdb.rbreak (regex [, minsyms [, throttle, [, symtabs ]]])
  18530. Return a Python list holding a collection of newly set
  18531. 'gdb.Breakpoint' objects matching function names defined by the
  18532. REGEX pattern. If the MINSYMS keyword is 'True', all system
  18533. functions (those not explicitly defined in the inferior) will also
  18534. be included in the match. The THROTTLE keyword takes an integer
  18535. that defines the maximum number of pattern matches for functions
  18536. matched by the REGEX pattern. If the number of matches exceeds the
  18537. integer value of THROTTLE, a 'RuntimeError' will be raised and no
  18538. breakpoints will be created. If THROTTLE is not defined then there
  18539. is no imposed limit on the maximum number of matches and
  18540. breakpoints to be created. The SYMTABS keyword takes a Python
  18541. iterable that yields a collection of 'gdb.Symtab' objects and will
  18542. restrict the search to those functions only contained within the
  18543. 'gdb.Symtab' objects.
  18544. -- Function: gdb.parameter (parameter)
  18545. Return the value of a GDB PARAMETER given by its name, a string;
  18546. the parameter name string may contain spaces if the parameter has a
  18547. multi-part name. For example, 'print object' is a valid parameter
  18548. name.
  18549. If the named parameter does not exist, this function throws a
  18550. 'gdb.error' (*note Exception Handling::). Otherwise, the
  18551. parameter's value is converted to a Python value of the appropriate
  18552. type, and returned.
  18553. -- Function: gdb.history (number)
  18554. Return a value from GDB's value history (*note Value History::).
  18555. The NUMBER argument indicates which history element to return. If
  18556. NUMBER is negative, then GDB will take its absolute value and count
  18557. backward from the last element (i.e., the most recent element) to
  18558. find the value to return. If NUMBER is zero, then GDB will return
  18559. the most recent element. If the element specified by NUMBER
  18560. doesn't exist in the value history, a 'gdb.error' exception will be
  18561. raised.
  18562. If no exception is raised, the return value is always an instance
  18563. of 'gdb.Value' (*note Values From Inferior::).
  18564. -- Function: gdb.convenience_variable (name)
  18565. Return the value of the convenience variable (*note Convenience
  18566. Vars::) named NAME. NAME must be a string. The name should not
  18567. include the '$' that is used to mark a convenience variable in an
  18568. expression. If the convenience variable does not exist, then
  18569. 'None' is returned.
  18570. -- Function: gdb.set_convenience_variable (name, value)
  18571. Set the value of the convenience variable (*note Convenience
  18572. Vars::) named NAME. NAME must be a string. The name should not
  18573. include the '$' that is used to mark a convenience variable in an
  18574. expression. If VALUE is 'None', then the convenience variable is
  18575. removed. Otherwise, if VALUE is not a 'gdb.Value' (*note Values
  18576. From Inferior::), it is is converted using the 'gdb.Value'
  18577. constructor.
  18578. -- Function: gdb.parse_and_eval (expression)
  18579. Parse EXPRESSION, which must be a string, as an expression in the
  18580. current language, evaluate it, and return the result as a
  18581. 'gdb.Value'.
  18582. This function can be useful when implementing a new command (*note
  18583. Commands In Python::), as it provides a way to parse the command's
  18584. argument as an expression. It is also useful simply to compute
  18585. values.
  18586. -- Function: gdb.find_pc_line (pc)
  18587. Return the 'gdb.Symtab_and_line' object corresponding to the PC
  18588. value. *Note Symbol Tables In Python::. If an invalid value of PC
  18589. is passed as an argument, then the 'symtab' and 'line' attributes
  18590. of the returned 'gdb.Symtab_and_line' object will be 'None' and 0
  18591. respectively. This is identical to
  18592. 'gdb.current_progspace().find_pc_line(pc)' and is included for
  18593. historical compatibility.
  18594. -- Function: gdb.post_event (event)
  18595. Put EVENT, a callable object taking no arguments, into GDB's
  18596. internal event queue. This callable will be invoked at some later
  18597. point, during GDB's event processing. Events posted using
  18598. 'post_event' will be run in the order in which they were posted;
  18599. however, there is no way to know when they will be processed
  18600. relative to other events inside GDB.
  18601. GDB is not thread-safe. If your Python program uses multiple
  18602. threads, you must be careful to only call GDB-specific functions in
  18603. the GDB thread. 'post_event' ensures this. For example:
  18604. (gdb) python
  18605. >import threading
  18606. >
  18607. >class Writer():
  18608. > def __init__(self, message):
  18609. > self.message = message;
  18610. > def __call__(self):
  18611. > gdb.write(self.message)
  18612. >
  18613. >class MyThread1 (threading.Thread):
  18614. > def run (self):
  18615. > gdb.post_event(Writer("Hello "))
  18616. >
  18617. >class MyThread2 (threading.Thread):
  18618. > def run (self):
  18619. > gdb.post_event(Writer("World\n"))
  18620. >
  18621. >MyThread1().start()
  18622. >MyThread2().start()
  18623. >end
  18624. (gdb) Hello World
  18625. -- Function: gdb.write (string [, stream])
  18626. Print a string to GDB's paginated output stream. The optional
  18627. STREAM determines the stream to print to. The default stream is
  18628. GDB's standard output stream. Possible stream values are:
  18629. 'gdb.STDOUT'
  18630. GDB's standard output stream.
  18631. 'gdb.STDERR'
  18632. GDB's standard error stream.
  18633. 'gdb.STDLOG'
  18634. GDB's log stream (*note Logging Output::).
  18635. Writing to 'sys.stdout' or 'sys.stderr' will automatically call
  18636. this function and will automatically direct the output to the
  18637. relevant stream.
  18638. -- Function: gdb.flush ()
  18639. Flush the buffer of a GDB paginated stream so that the contents are
  18640. displayed immediately. GDB will flush the contents of a stream
  18641. automatically when it encounters a newline in the buffer. The
  18642. optional STREAM determines the stream to flush. The default stream
  18643. is GDB's standard output stream. Possible stream values are:
  18644. 'gdb.STDOUT'
  18645. GDB's standard output stream.
  18646. 'gdb.STDERR'
  18647. GDB's standard error stream.
  18648. 'gdb.STDLOG'
  18649. GDB's log stream (*note Logging Output::).
  18650. Flushing 'sys.stdout' or 'sys.stderr' will automatically call this
  18651. function for the relevant stream.
  18652. -- Function: gdb.target_charset ()
  18653. Return the name of the current target character set (*note
  18654. Character Sets::). This differs from
  18655. 'gdb.parameter('target-charset')' in that 'auto' is never returned.
  18656. -- Function: gdb.target_wide_charset ()
  18657. Return the name of the current target wide character set (*note
  18658. Character Sets::). This differs from
  18659. 'gdb.parameter('target-wide-charset')' in that 'auto' is never
  18660. returned.
  18661. -- Function: gdb.solib_name (address)
  18662. Return the name of the shared library holding the given ADDRESS as
  18663. a string, or 'None'. This is identical to
  18664. 'gdb.current_progspace().solib_name(address)' and is included for
  18665. historical compatibility.
  18666. -- Function: gdb.decode_line ([expression])
  18667. Return locations of the line specified by EXPRESSION, or of the
  18668. current line if no argument was given. This function returns a
  18669. Python tuple containing two elements. The first element contains a
  18670. string holding any unparsed section of EXPRESSION (or 'None' if the
  18671. expression has been fully parsed). The second element contains
  18672. either 'None' or another tuple that contains all the locations that
  18673. match the expression represented as 'gdb.Symtab_and_line' objects
  18674. (*note Symbol Tables In Python::). If EXPRESSION is provided, it
  18675. is decoded the way that GDB's inbuilt 'break' or 'edit' commands do
  18676. (*note Specify Location::).
  18677. -- Function: gdb.prompt_hook (current_prompt)
  18678. If PROMPT_HOOK is callable, GDB will call the method assigned to
  18679. this operation before a prompt is displayed by GDB.
  18680. The parameter 'current_prompt' contains the current GDB prompt.
  18681. This method must return a Python string, or 'None'. If a string is
  18682. returned, the GDB prompt will be set to that string. If 'None' is
  18683. returned, GDB will continue to use the current prompt.
  18684. Some prompts cannot be substituted in GDB. Secondary prompts such
  18685. as those used by readline for command input, and annotation related
  18686. prompts are prohibited from being changed.
  18687. 
  18688. File: gdb.info, Node: Exception Handling, Next: Values From Inferior, Prev: Basic Python, Up: Python API
  18689. 23.2.2.2 Exception Handling
  18690. ...........................
  18691. When executing the 'python' command, Python exceptions uncaught within
  18692. the Python code are translated to calls to GDB error-reporting
  18693. mechanism. If the command that called 'python' does not handle the
  18694. error, GDB will terminate it and print an error message containing the
  18695. Python exception name, the associated value, and the Python call stack
  18696. backtrace at the point where the exception was raised. Example:
  18697. (gdb) python print foo
  18698. Traceback (most recent call last):
  18699. File "<string>", line 1, in <module>
  18700. NameError: name 'foo' is not defined
  18701. GDB errors that happen in GDB commands invoked by Python code are
  18702. converted to Python exceptions. The type of the Python exception
  18703. depends on the error.
  18704. 'gdb.error'
  18705. This is the base class for most exceptions generated by GDB. It is
  18706. derived from 'RuntimeError', for compatibility with earlier
  18707. versions of GDB.
  18708. If an error occurring in GDB does not fit into some more specific
  18709. category, then the generated exception will have this type.
  18710. 'gdb.MemoryError'
  18711. This is a subclass of 'gdb.error' which is thrown when an operation
  18712. tried to access invalid memory in the inferior.
  18713. 'KeyboardInterrupt'
  18714. User interrupt (via 'C-c' or by typing 'q' at a pagination prompt)
  18715. is translated to a Python 'KeyboardInterrupt' exception.
  18716. In all cases, your exception handler will see the GDB error message
  18717. as its value and the Python call stack backtrace at the Python statement
  18718. closest to where the GDB error occured as the traceback.
  18719. When implementing GDB commands in Python via 'gdb.Command', or
  18720. functions via 'gdb.Function', it is useful to be able to throw an
  18721. exception that doesn't cause a traceback to be printed. For example,
  18722. the user may have invoked the command incorrectly. GDB provides a
  18723. special exception class that can be used for this purpose.
  18724. 'gdb.GdbError'
  18725. When thrown from a command or function, this exception will cause
  18726. the command or function to fail, but the Python stack will not be
  18727. displayed. GDB does not throw this exception itself, but rather
  18728. recognizes it when thrown from user Python code. Example:
  18729. (gdb) python
  18730. >class HelloWorld (gdb.Command):
  18731. > """Greet the whole world."""
  18732. > def __init__ (self):
  18733. > super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
  18734. > def invoke (self, args, from_tty):
  18735. > argv = gdb.string_to_argv (args)
  18736. > if len (argv) != 0:
  18737. > raise gdb.GdbError ("hello-world takes no arguments")
  18738. > print "Hello, World!"
  18739. >HelloWorld ()
  18740. >end
  18741. (gdb) hello-world 42
  18742. hello-world takes no arguments
  18743. 
  18744. File: gdb.info, Node: Values From Inferior, Next: Types In Python, Prev: Exception Handling, Up: Python API
  18745. 23.2.2.3 Values From Inferior
  18746. .............................
  18747. GDB provides values it obtains from the inferior program in an object of
  18748. type 'gdb.Value'. GDB uses this object for its internal bookkeeping of
  18749. the inferior's values, and for fetching values when necessary.
  18750. Inferior values that are simple scalars can be used directly in
  18751. Python expressions that are valid for the value's data type. Here's an
  18752. example for an integer or floating-point value 'some_val':
  18753. bar = some_val + 2
  18754. As result of this, 'bar' will also be a 'gdb.Value' object whose values
  18755. are of the same type as those of 'some_val'. Valid Python operations
  18756. can also be performed on 'gdb.Value' objects representing a 'struct' or
  18757. 'class' object. For such cases, the overloaded operator (if present),
  18758. is used to perform the operation. For example, if 'val1' and 'val2' are
  18759. 'gdb.Value' objects representing instances of a 'class' which overloads
  18760. the '+' operator, then one can use the '+' operator in their Python
  18761. script as follows:
  18762. val3 = val1 + val2
  18763. The result of the operation 'val3' is also a 'gdb.Value' object
  18764. corresponding to the value returned by the overloaded '+' operator. In
  18765. general, overloaded operators are invoked for the following operations:
  18766. '+' (binary addition), '-' (binary subtraction), '*' (multiplication),
  18767. '/', '%', '<<', '>>', '|', '&', '^'.
  18768. Inferior values that are structures or instances of some class can be
  18769. accessed using the Python "dictionary syntax". For example, if
  18770. 'some_val' is a 'gdb.Value' instance holding a structure, you can access
  18771. its 'foo' element with:
  18772. bar = some_val['foo']
  18773. Again, 'bar' will also be a 'gdb.Value' object. Structure elements
  18774. can also be accessed by using 'gdb.Field' objects as subscripts (*note
  18775. Types In Python::, for more information on 'gdb.Field' objects). For
  18776. example, if 'foo_field' is a 'gdb.Field' object corresponding to element
  18777. 'foo' of the above structure, then 'bar' can also be accessed as
  18778. follows:
  18779. bar = some_val[foo_field]
  18780. A 'gdb.Value' that represents a function can be executed via inferior
  18781. function call. Any arguments provided to the call must match the
  18782. function's prototype, and must be provided in the order specified by
  18783. that prototype.
  18784. For example, 'some_val' is a 'gdb.Value' instance representing a
  18785. function that takes two integers as arguments. To execute this
  18786. function, call it like so:
  18787. result = some_val (10,20)
  18788. Any values returned from a function call will be stored as a
  18789. 'gdb.Value'.
  18790. The following attributes are provided:
  18791. -- Variable: Value.address
  18792. If this object is addressable, this read-only attribute holds a
  18793. 'gdb.Value' object representing the address. Otherwise, this
  18794. attribute holds 'None'.
  18795. -- Variable: Value.is_optimized_out
  18796. This read-only boolean attribute is true if the compiler optimized
  18797. out this value, thus it is not available for fetching from the
  18798. inferior.
  18799. -- Variable: Value.type
  18800. The type of this 'gdb.Value'. The value of this attribute is a
  18801. 'gdb.Type' object (*note Types In Python::).
  18802. -- Variable: Value.dynamic_type
  18803. The dynamic type of this 'gdb.Value'. This uses the object's
  18804. virtual table and the C++ run-time type information (RTTI) to
  18805. determine the dynamic type of the value. If this value is of class
  18806. type, it will return the class in which the value is embedded, if
  18807. any. If this value is of pointer or reference to a class type, it
  18808. will compute the dynamic type of the referenced object, and return
  18809. a pointer or reference to that type, respectively. In all other
  18810. cases, it will return the value's static type.
  18811. Note that this feature will only work when debugging a C++ program
  18812. that includes RTTI for the object in question. Otherwise, it will
  18813. just return the static type of the value as in 'ptype foo' (*note
  18814. ptype: Symbols.).
  18815. -- Variable: Value.is_lazy
  18816. The value of this read-only boolean attribute is 'True' if this
  18817. 'gdb.Value' has not yet been fetched from the inferior. GDB does
  18818. not fetch values until necessary, for efficiency. For example:
  18819. myval = gdb.parse_and_eval ('somevar')
  18820. The value of 'somevar' is not fetched at this time. It will be
  18821. fetched when the value is needed, or when the 'fetch_lazy' method
  18822. is invoked.
  18823. The following methods are provided:
  18824. -- Function: Value.__init__ (VAL)
  18825. Many Python values can be converted directly to a 'gdb.Value' via
  18826. this object initializer. Specifically:
  18827. Python boolean
  18828. A Python boolean is converted to the boolean type from the
  18829. current language.
  18830. Python integer
  18831. A Python integer is converted to the C 'long' type for the
  18832. current architecture.
  18833. Python long
  18834. A Python long is converted to the C 'long long' type for the
  18835. current architecture.
  18836. Python float
  18837. A Python float is converted to the C 'double' type for the
  18838. current architecture.
  18839. Python string
  18840. A Python string is converted to a target string in the current
  18841. target language using the current target encoding. If a
  18842. character cannot be represented in the current target
  18843. encoding, then an exception is thrown.
  18844. 'gdb.Value'
  18845. If 'val' is a 'gdb.Value', then a copy of the value is made.
  18846. 'gdb.LazyString'
  18847. If 'val' is a 'gdb.LazyString' (*note Lazy Strings In
  18848. Python::), then the lazy string's 'value' method is called,
  18849. and its result is used.
  18850. -- Function: Value.__init__ (VAL, TYPE)
  18851. This second form of the 'gdb.Value' constructor returns a
  18852. 'gdb.Value' of type TYPE where the value contents are taken from
  18853. the Python buffer object specified by VAL. The number of bytes in
  18854. the Python buffer object must be greater than or equal to the size
  18855. of TYPE.
  18856. -- Function: Value.cast (type)
  18857. Return a new instance of 'gdb.Value' that is the result of casting
  18858. this instance to the type described by TYPE, which must be a
  18859. 'gdb.Type' object. If the cast cannot be performed for some
  18860. reason, this method throws an exception.
  18861. -- Function: Value.dereference ()
  18862. For pointer data types, this method returns a new 'gdb.Value'
  18863. object whose contents is the object pointed to by the pointer. For
  18864. example, if 'foo' is a C pointer to an 'int', declared in your C
  18865. program as
  18866. int *foo;
  18867. then you can use the corresponding 'gdb.Value' to access what 'foo'
  18868. points to like this:
  18869. bar = foo.dereference ()
  18870. The result 'bar' will be a 'gdb.Value' object holding the value
  18871. pointed to by 'foo'.
  18872. A similar function 'Value.referenced_value' exists which also
  18873. returns 'gdb.Value' objects corresponding to the values pointed to
  18874. by pointer values (and additionally, values referenced by reference
  18875. values). However, the behavior of 'Value.dereference' differs from
  18876. 'Value.referenced_value' by the fact that the behavior of
  18877. 'Value.dereference' is identical to applying the C unary operator
  18878. '*' on a given value. For example, consider a reference to a
  18879. pointer 'ptrref', declared in your C++ program as
  18880. typedef int *intptr;
  18881. ...
  18882. int val = 10;
  18883. intptr ptr = &val;
  18884. intptr &ptrref = ptr;
  18885. Though 'ptrref' is a reference value, one can apply the method
  18886. 'Value.dereference' to the 'gdb.Value' object corresponding to it
  18887. and obtain a 'gdb.Value' which is identical to that corresponding
  18888. to 'val'. However, if you apply the method
  18889. 'Value.referenced_value', the result would be a 'gdb.Value' object
  18890. identical to that corresponding to 'ptr'.
  18891. py_ptrref = gdb.parse_and_eval ("ptrref")
  18892. py_val = py_ptrref.dereference ()
  18893. py_ptr = py_ptrref.referenced_value ()
  18894. The 'gdb.Value' object 'py_val' is identical to that corresponding
  18895. to 'val', and 'py_ptr' is identical to that corresponding to 'ptr'.
  18896. In general, 'Value.dereference' can be applied whenever the C unary
  18897. operator '*' can be applied to the corresponding C value. For
  18898. those cases where applying both 'Value.dereference' and
  18899. 'Value.referenced_value' is allowed, the results obtained need not
  18900. be identical (as we have seen in the above example). The results
  18901. are however identical when applied on 'gdb.Value' objects
  18902. corresponding to pointers ('gdb.Value' objects with type code
  18903. 'TYPE_CODE_PTR') in a C/C++ program.
  18904. -- Function: Value.referenced_value ()
  18905. For pointer or reference data types, this method returns a new
  18906. 'gdb.Value' object corresponding to the value referenced by the
  18907. pointer/reference value. For pointer data types,
  18908. 'Value.dereference' and 'Value.referenced_value' produce identical
  18909. results. The difference between these methods is that
  18910. 'Value.dereference' cannot get the values referenced by reference
  18911. values. For example, consider a reference to an 'int', declared in
  18912. your C++ program as
  18913. int val = 10;
  18914. int &ref = val;
  18915. then applying 'Value.dereference' to the 'gdb.Value' object
  18916. corresponding to 'ref' will result in an error, while applying
  18917. 'Value.referenced_value' will result in a 'gdb.Value' object
  18918. identical to that corresponding to 'val'.
  18919. py_ref = gdb.parse_and_eval ("ref")
  18920. er_ref = py_ref.dereference () # Results in error
  18921. py_val = py_ref.referenced_value () # Returns the referenced value
  18922. The 'gdb.Value' object 'py_val' is identical to that corresponding
  18923. to 'val'.
  18924. -- Function: Value.reference_value ()
  18925. Return a 'gdb.Value' object which is a reference to the value
  18926. encapsulated by this instance.
  18927. -- Function: Value.const_value ()
  18928. Return a 'gdb.Value' object which is a 'const' version of the value
  18929. encapsulated by this instance.
  18930. -- Function: Value.dynamic_cast (type)
  18931. Like 'Value.cast', but works as if the C++ 'dynamic_cast' operator
  18932. were used. Consult a C++ reference for details.
  18933. -- Function: Value.reinterpret_cast (type)
  18934. Like 'Value.cast', but works as if the C++ 'reinterpret_cast'
  18935. operator were used. Consult a C++ reference for details.
  18936. -- Function: Value.format_string (...)
  18937. Convert a 'gdb.Value' to a string, similarly to what the 'print'
  18938. command does. Invoked with no arguments, this is equivalent to
  18939. calling the 'str' function on the 'gdb.Value'. The representation
  18940. of the same value may change across different versions of GDB, so
  18941. you shouldn't, for instance, parse the strings returned by this
  18942. method.
  18943. All the arguments are keyword only. If an argument is not
  18944. specified, the current global default setting is used.
  18945. 'raw'
  18946. 'True' if pretty-printers (*note Pretty Printing::) should not
  18947. be used to format the value. 'False' if enabled
  18948. pretty-printers matching the type represented by the
  18949. 'gdb.Value' should be used to format it.
  18950. 'pretty_arrays'
  18951. 'True' if arrays should be pretty printed to be more
  18952. convenient to read, 'False' if they shouldn't (see 'set print
  18953. array' in *note Print Settings::).
  18954. 'pretty_structs'
  18955. 'True' if structs should be pretty printed to be more
  18956. convenient to read, 'False' if they shouldn't (see 'set print
  18957. pretty' in *note Print Settings::).
  18958. 'array_indexes'
  18959. 'True' if array indexes should be included in the string
  18960. representation of arrays, 'False' if they shouldn't (see 'set
  18961. print array-indexes' in *note Print Settings::).
  18962. 'symbols'
  18963. 'True' if the string representation of a pointer should
  18964. include the corresponding symbol name (if one exists), 'False'
  18965. if it shouldn't (see 'set print symbol' in *note Print
  18966. Settings::).
  18967. 'unions'
  18968. 'True' if unions which are contained in other structures or
  18969. unions should be expanded, 'False' if they shouldn't (see 'set
  18970. print union' in *note Print Settings::).
  18971. 'deref_refs'
  18972. 'True' if C++ references should be resolved to the value they
  18973. refer to, 'False' (the default) if they shouldn't. Note that,
  18974. unlike for the 'print' command, references are not
  18975. automatically expanded when using the 'format_string' method
  18976. or the 'str' function. There is no global 'print' setting to
  18977. change the default behaviour.
  18978. 'actual_objects'
  18979. 'True' if the representation of a pointer to an object should
  18980. identify the _actual_ (derived) type of the object rather than
  18981. the _declared_ type, using the virtual function table.
  18982. 'False' if the _declared_ type should be used. (See 'set
  18983. print object' in *note Print Settings::).
  18984. 'static_fields'
  18985. 'True' if static members should be included in the string
  18986. representation of a C++ object, 'False' if they shouldn't (see
  18987. 'set print static-members' in *note Print Settings::).
  18988. 'max_elements'
  18989. Number of array elements to print, or '0' to print an
  18990. unlimited number of elements (see 'set print elements' in
  18991. *note Print Settings::).
  18992. 'max_depth'
  18993. The maximum depth to print for nested structs and unions, or
  18994. '-1' to print an unlimited number of elements (see 'set print
  18995. max-depth' in *note Print Settings::).
  18996. 'repeat_threshold'
  18997. Set the threshold for suppressing display of repeated array
  18998. elements, or '0' to represent all elements, even if repeated.
  18999. (See 'set print repeats' in *note Print Settings::).
  19000. 'format'
  19001. A string containing a single character representing the format
  19002. to use for the returned string. For instance, ''x'' is
  19003. equivalent to using the GDB command 'print' with the '/x'
  19004. option and formats the value as a hexadecimal number.
  19005. -- Function: Value.string ([encoding[, errors[, length]]])
  19006. If this 'gdb.Value' represents a string, then this method converts
  19007. the contents to a Python string. Otherwise, this method will throw
  19008. an exception.
  19009. Values are interpreted as strings according to the rules of the
  19010. current language. If the optional length argument is given, the
  19011. string will be converted to that length, and will include any
  19012. embedded zeroes that the string may contain. Otherwise, for
  19013. languages where the string is zero-terminated, the entire string
  19014. will be converted.
  19015. For example, in C-like languages, a value is a string if it is a
  19016. pointer to or an array of characters or ints of type 'wchar_t',
  19017. 'char16_t', or 'char32_t'.
  19018. If the optional ENCODING argument is given, it must be a string
  19019. naming the encoding of the string in the 'gdb.Value', such as
  19020. '"ascii"', '"iso-8859-6"' or '"utf-8"'. It accepts the same
  19021. encodings as the corresponding argument to Python's 'string.decode'
  19022. method, and the Python codec machinery will be used to convert the
  19023. string. If ENCODING is not given, or if ENCODING is the empty
  19024. string, then either the 'target-charset' (*note Character Sets::)
  19025. will be used, or a language-specific encoding will be used, if the
  19026. current language is able to supply one.
  19027. The optional ERRORS argument is the same as the corresponding
  19028. argument to Python's 'string.decode' method.
  19029. If the optional LENGTH argument is given, the string will be
  19030. fetched and converted to the given length.
  19031. -- Function: Value.lazy_string ([encoding [, length]])
  19032. If this 'gdb.Value' represents a string, then this method converts
  19033. the contents to a 'gdb.LazyString' (*note Lazy Strings In
  19034. Python::). Otherwise, this method will throw an exception.
  19035. If the optional ENCODING argument is given, it must be a string
  19036. naming the encoding of the 'gdb.LazyString'. Some examples are:
  19037. 'ascii', 'iso-8859-6' or 'utf-8'. If the ENCODING argument is an
  19038. encoding that GDB does recognize, GDB will raise an error.
  19039. When a lazy string is printed, the GDB encoding machinery is used
  19040. to convert the string during printing. If the optional ENCODING
  19041. argument is not provided, or is an empty string, GDB will
  19042. automatically select the encoding most suitable for the string
  19043. type. For further information on encoding in GDB please see *note
  19044. Character Sets::.
  19045. If the optional LENGTH argument is given, the string will be
  19046. fetched and encoded to the length of characters specified. If the
  19047. LENGTH argument is not provided, the string will be fetched and
  19048. encoded until a null of appropriate width is found.
  19049. -- Function: Value.fetch_lazy ()
  19050. If the 'gdb.Value' object is currently a lazy value
  19051. ('gdb.Value.is_lazy' is 'True'), then the value is fetched from the
  19052. inferior. Any errors that occur in the process will produce a
  19053. Python exception.
  19054. If the 'gdb.Value' object is not a lazy value, this method has no
  19055. effect.
  19056. This method does not return a value.
  19057. 
  19058. File: gdb.info, Node: Types In Python, Next: Pretty Printing API, Prev: Values From Inferior, Up: Python API
  19059. 23.2.2.4 Types In Python
  19060. ........................
  19061. GDB represents types from the inferior using the class 'gdb.Type'.
  19062. The following type-related functions are available in the 'gdb'
  19063. module:
  19064. -- Function: gdb.lookup_type (name [, block])
  19065. This function looks up a type by its NAME, which must be a string.
  19066. If BLOCK is given, then NAME is looked up in that scope.
  19067. Otherwise, it is searched for globally.
  19068. Ordinarily, this function will return an instance of 'gdb.Type'.
  19069. If the named type cannot be found, it will throw an exception.
  19070. If the type is a structure or class type, or an enum type, the fields
  19071. of that type can be accessed using the Python "dictionary syntax". For
  19072. example, if 'some_type' is a 'gdb.Type' instance holding a structure
  19073. type, you can access its 'foo' field with:
  19074. bar = some_type['foo']
  19075. 'bar' will be a 'gdb.Field' object; see below under the description
  19076. of the 'Type.fields' method for a description of the 'gdb.Field' class.
  19077. An instance of 'Type' has the following attributes:
  19078. -- Variable: Type.alignof
  19079. The alignment of this type, in bytes. Type alignment comes from
  19080. the debugging information; if it was not specified, then GDB will
  19081. use the relevant ABI to try to determine the alignment. In some
  19082. cases, even this is not possible, and zero will be returned.
  19083. -- Variable: Type.code
  19084. The type code for this type. The type code will be one of the
  19085. 'TYPE_CODE_' constants defined below.
  19086. -- Variable: Type.dynamic
  19087. A boolean indicating whether this type is dynamic. In some
  19088. situations, such as Rust 'enum' types or Ada variant records, the
  19089. concrete type of a value may vary depending on its contents. That
  19090. is, the declared type of a variable, or the type returned by
  19091. 'gdb.lookup_type' may be dynamic; while the type of the variable's
  19092. value will be a concrete instance of that dynamic type.
  19093. For example, consider this code:
  19094. int n;
  19095. int array[n];
  19096. Here, at least conceptually (whether your compiler actually does
  19097. this is a separate issue), examining
  19098. 'gdb.lookup_symbol("array", ...).type' could yield a 'gdb.Type'
  19099. which reports a size of 'None'. This is the dynamic type.
  19100. However, examining 'gdb.parse_and_eval("array").type' would yield a
  19101. concrete type, whose length would be known.
  19102. -- Variable: Type.name
  19103. The name of this type. If this type has no name, then 'None' is
  19104. returned.
  19105. -- Variable: Type.sizeof
  19106. The size of this type, in target 'char' units. Usually, a target's
  19107. 'char' type will be an 8-bit byte. However, on some unusual
  19108. platforms, this type may have a different size. A dynamic type may
  19109. not have a fixed size; in this case, this attribute's value will be
  19110. 'None'.
  19111. -- Variable: Type.tag
  19112. The tag name for this type. The tag name is the name after
  19113. 'struct', 'union', or 'enum' in C and C++; not all languages have
  19114. this concept. If this type has no tag name, then 'None' is
  19115. returned.
  19116. -- Variable: Type.objfile
  19117. The 'gdb.Objfile' that this type was defined in, or 'None' if there
  19118. is no associated objfile.
  19119. The following methods are provided:
  19120. -- Function: Type.fields ()
  19121. For structure and union types, this method returns the fields.
  19122. Range types have two fields, the minimum and maximum values. Enum
  19123. types have one field per enum constant. Function and method types
  19124. have one field per parameter. The base types of C++ classes are
  19125. also represented as fields. If the type has no fields, or does not
  19126. fit into one of these categories, an empty sequence will be
  19127. returned.
  19128. Each field is a 'gdb.Field' object, with some pre-defined
  19129. attributes:
  19130. 'bitpos'
  19131. This attribute is not available for 'enum' or 'static' (as in
  19132. C++) fields. The value is the position, counting in bits,
  19133. from the start of the containing type. Note that, in a
  19134. dynamic type, the position of a field may not be constant. In
  19135. this case, the value will be 'None'. Also, a dynamic type may
  19136. have fields that do not appear in a corresponding concrete
  19137. type.
  19138. 'enumval'
  19139. This attribute is only available for 'enum' fields, and its
  19140. value is the enumeration member's integer representation.
  19141. 'name'
  19142. The name of the field, or 'None' for anonymous fields.
  19143. 'artificial'
  19144. This is 'True' if the field is artificial, usually meaning
  19145. that it was provided by the compiler and not the user. This
  19146. attribute is always provided, and is 'False' if the field is
  19147. not artificial.
  19148. 'is_base_class'
  19149. This is 'True' if the field represents a base class of a C++
  19150. structure. This attribute is always provided, and is 'False'
  19151. if the field is not a base class of the type that is the
  19152. argument of 'fields', or if that type was not a C++ class.
  19153. 'bitsize'
  19154. If the field is packed, or is a bitfield, then this will have
  19155. a non-zero value, which is the size of the field in bits.
  19156. Otherwise, this will be zero; in this case the field's size is
  19157. given by its type.
  19158. 'type'
  19159. The type of the field. This is usually an instance of 'Type',
  19160. but it can be 'None' in some situations.
  19161. 'parent_type'
  19162. The type which contains this field. This is an instance of
  19163. 'gdb.Type'.
  19164. -- Function: Type.array (N1 [, N2])
  19165. Return a new 'gdb.Type' object which represents an array of this
  19166. type. If one argument is given, it is the inclusive upper bound of
  19167. the array; in this case the lower bound is zero. If two arguments
  19168. are given, the first argument is the lower bound of the array, and
  19169. the second argument is the upper bound of the array. An array's
  19170. length must not be negative, but the bounds can be.
  19171. -- Function: Type.vector (N1 [, N2])
  19172. Return a new 'gdb.Type' object which represents a vector of this
  19173. type. If one argument is given, it is the inclusive upper bound of
  19174. the vector; in this case the lower bound is zero. If two arguments
  19175. are given, the first argument is the lower bound of the vector, and
  19176. the second argument is the upper bound of the vector. A vector's
  19177. length must not be negative, but the bounds can be.
  19178. The difference between an 'array' and a 'vector' is that arrays
  19179. behave like in C: when used in expressions they decay to a pointer
  19180. to the first element whereas vectors are treated as first class
  19181. values.
  19182. -- Function: Type.const ()
  19183. Return a new 'gdb.Type' object which represents a 'const'-qualified
  19184. variant of this type.
  19185. -- Function: Type.volatile ()
  19186. Return a new 'gdb.Type' object which represents a
  19187. 'volatile'-qualified variant of this type.
  19188. -- Function: Type.unqualified ()
  19189. Return a new 'gdb.Type' object which represents an unqualified
  19190. variant of this type. That is, the result is neither 'const' nor
  19191. 'volatile'.
  19192. -- Function: Type.range ()
  19193. Return a Python 'Tuple' object that contains two elements: the low
  19194. bound of the argument type and the high bound of that type. If the
  19195. type does not have a range, GDB will raise a 'gdb.error' exception
  19196. (*note Exception Handling::).
  19197. -- Function: Type.reference ()
  19198. Return a new 'gdb.Type' object which represents a reference to this
  19199. type.
  19200. -- Function: Type.pointer ()
  19201. Return a new 'gdb.Type' object which represents a pointer to this
  19202. type.
  19203. -- Function: Type.strip_typedefs ()
  19204. Return a new 'gdb.Type' that represents the real type, after
  19205. removing all layers of typedefs.
  19206. -- Function: Type.target ()
  19207. Return a new 'gdb.Type' object which represents the target type of
  19208. this type.
  19209. For a pointer type, the target type is the type of the pointed-to
  19210. object. For an array type (meaning C-like arrays), the target type
  19211. is the type of the elements of the array. For a function or method
  19212. type, the target type is the type of the return value. For a
  19213. complex type, the target type is the type of the elements. For a
  19214. typedef, the target type is the aliased type.
  19215. If the type does not have a target, this method will throw an
  19216. exception.
  19217. -- Function: Type.template_argument (n [, block])
  19218. If this 'gdb.Type' is an instantiation of a template, this will
  19219. return a new 'gdb.Value' or 'gdb.Type' which represents the value
  19220. of the Nth template argument (indexed starting at 0).
  19221. If this 'gdb.Type' is not a template type, or if the type has fewer
  19222. than N template arguments, this will throw an exception.
  19223. Ordinarily, only C++ code will have template types.
  19224. If BLOCK is given, then NAME is looked up in that scope.
  19225. Otherwise, it is searched for globally.
  19226. -- Function: Type.optimized_out ()
  19227. Return 'gdb.Value' instance of this type whose value is optimized
  19228. out. This allows a frame decorator to indicate that the value of
  19229. an argument or a local variable is not known.
  19230. Each type has a code, which indicates what category this type falls
  19231. into. The available type categories are represented by constants
  19232. defined in the 'gdb' module:
  19233. 'gdb.TYPE_CODE_PTR'
  19234. The type is a pointer.
  19235. 'gdb.TYPE_CODE_ARRAY'
  19236. The type is an array.
  19237. 'gdb.TYPE_CODE_STRUCT'
  19238. The type is a structure.
  19239. 'gdb.TYPE_CODE_UNION'
  19240. The type is a union.
  19241. 'gdb.TYPE_CODE_ENUM'
  19242. The type is an enum.
  19243. 'gdb.TYPE_CODE_FLAGS'
  19244. A bit flags type, used for things such as status registers.
  19245. 'gdb.TYPE_CODE_FUNC'
  19246. The type is a function.
  19247. 'gdb.TYPE_CODE_INT'
  19248. The type is an integer type.
  19249. 'gdb.TYPE_CODE_FLT'
  19250. A floating point type.
  19251. 'gdb.TYPE_CODE_VOID'
  19252. The special type 'void'.
  19253. 'gdb.TYPE_CODE_SET'
  19254. A Pascal set type.
  19255. 'gdb.TYPE_CODE_RANGE'
  19256. A range type, that is, an integer type with bounds.
  19257. 'gdb.TYPE_CODE_STRING'
  19258. A string type. Note that this is only used for certain languages
  19259. with language-defined string types; C strings are not represented
  19260. this way.
  19261. 'gdb.TYPE_CODE_BITSTRING'
  19262. A string of bits. It is deprecated.
  19263. 'gdb.TYPE_CODE_ERROR'
  19264. An unknown or erroneous type.
  19265. 'gdb.TYPE_CODE_METHOD'
  19266. A method type, as found in C++.
  19267. 'gdb.TYPE_CODE_METHODPTR'
  19268. A pointer-to-member-function.
  19269. 'gdb.TYPE_CODE_MEMBERPTR'
  19270. A pointer-to-member.
  19271. 'gdb.TYPE_CODE_REF'
  19272. A reference type.
  19273. 'gdb.TYPE_CODE_RVALUE_REF'
  19274. A C++11 rvalue reference type.
  19275. 'gdb.TYPE_CODE_CHAR'
  19276. A character type.
  19277. 'gdb.TYPE_CODE_BOOL'
  19278. A boolean type.
  19279. 'gdb.TYPE_CODE_COMPLEX'
  19280. A complex float type.
  19281. 'gdb.TYPE_CODE_TYPEDEF'
  19282. A typedef to some other type.
  19283. 'gdb.TYPE_CODE_NAMESPACE'
  19284. A C++ namespace.
  19285. 'gdb.TYPE_CODE_DECFLOAT'
  19286. A decimal floating point type.
  19287. 'gdb.TYPE_CODE_INTERNAL_FUNCTION'
  19288. A function internal to GDB. This is the type used to represent
  19289. convenience functions.
  19290. Further support for types is provided in the 'gdb.types' Python
  19291. module (*note gdb.types::).
  19292. 
  19293. File: gdb.info, Node: Pretty Printing API, Next: Selecting Pretty-Printers, Prev: Types In Python, Up: Python API
  19294. 23.2.2.5 Pretty Printing API
  19295. ............................
  19296. A pretty-printer is just an object that holds a value and implements a
  19297. specific interface, defined here. An example output is provided (*note
  19298. Pretty Printing::).
  19299. -- Function: pretty_printer.children (self)
  19300. GDB will call this method on a pretty-printer to compute the
  19301. children of the pretty-printer's value.
  19302. This method must return an object conforming to the Python iterator
  19303. protocol. Each item returned by the iterator must be a tuple
  19304. holding two elements. The first element is the "name" of the
  19305. child; the second element is the child's value. The value can be
  19306. any Python object which is convertible to a GDB value.
  19307. This method is optional. If it does not exist, GDB will act as
  19308. though the value has no children.
  19309. For efficiency, the 'children' method should lazily compute its
  19310. results. This will let GDB read as few elements as necessary, for
  19311. example when various print settings (*note Print Settings::) or
  19312. '-var-list-children' (*note GDB/MI Variable Objects::) limit the
  19313. number of elements to be displayed.
  19314. Children may be hidden from display based on the value of 'set
  19315. print max-depth' (*note Print Settings::).
  19316. -- Function: pretty_printer.display_hint (self)
  19317. The CLI may call this method and use its result to change the
  19318. formatting of a value. The result will also be supplied to an MI
  19319. consumer as a 'displayhint' attribute of the variable being
  19320. printed.
  19321. This method is optional. If it does exist, this method must return
  19322. a string or the special value 'None'.
  19323. Some display hints are predefined by GDB:
  19324. 'array'
  19325. Indicate that the object being printed is "array-like". The
  19326. CLI uses this to respect parameters such as 'set print
  19327. elements' and 'set print array'.
  19328. 'map'
  19329. Indicate that the object being printed is "map-like", and that
  19330. the children of this value can be assumed to alternate between
  19331. keys and values.
  19332. 'string'
  19333. Indicate that the object being printed is "string-like". If
  19334. the printer's 'to_string' method returns a Python string of
  19335. some kind, then GDB will call its internal language-specific
  19336. string-printing function to format the string. For the CLI
  19337. this means adding quotation marks, possibly escaping some
  19338. characters, respecting 'set print elements', and the like.
  19339. The special value 'None' causes GDB to apply the default display
  19340. rules.
  19341. -- Function: pretty_printer.to_string (self)
  19342. GDB will call this method to display the string representation of
  19343. the value passed to the object's constructor.
  19344. When printing from the CLI, if the 'to_string' method exists, then
  19345. GDB will prepend its result to the values returned by 'children'.
  19346. Exactly how this formatting is done is dependent on the display
  19347. hint, and may change as more hints are added. Also, depending on
  19348. the print settings (*note Print Settings::), the CLI may print just
  19349. the result of 'to_string' in a stack trace, omitting the result of
  19350. 'children'.
  19351. If this method returns a string, it is printed verbatim.
  19352. Otherwise, if this method returns an instance of 'gdb.Value', then
  19353. GDB prints this value. This may result in a call to another
  19354. pretty-printer.
  19355. If instead the method returns a Python value which is convertible
  19356. to a 'gdb.Value', then GDB performs the conversion and prints the
  19357. resulting value. Again, this may result in a call to another
  19358. pretty-printer. Python scalars (integers, floats, and booleans)
  19359. and strings are convertible to 'gdb.Value'; other types are not.
  19360. Finally, if this method returns 'None' then no further operations
  19361. are peformed in this method and nothing is printed.
  19362. If the result is not one of these types, an exception is raised.
  19363. GDB provides a function which can be used to look up the default
  19364. pretty-printer for a 'gdb.Value':
  19365. -- Function: gdb.default_visualizer (value)
  19366. This function takes a 'gdb.Value' object as an argument. If a
  19367. pretty-printer for this value exists, then it is returned. If no
  19368. such printer exists, then this returns 'None'.
  19369. 
  19370. File: gdb.info, Node: Selecting Pretty-Printers, Next: Writing a Pretty-Printer, Prev: Pretty Printing API, Up: Python API
  19371. 23.2.2.6 Selecting Pretty-Printers
  19372. ..................................
  19373. GDB provides several ways to register a pretty-printer: globally, per
  19374. program space, and per objfile. When choosing how to register your
  19375. pretty-printer, a good rule is to register it with the smallest scope
  19376. possible: that is prefer a specific objfile first, then a program space,
  19377. and only register a printer globally as a last resort.
  19378. -- Variable: gdb.pretty_printers
  19379. The Python list 'gdb.pretty_printers' contains an array of
  19380. functions or callable objects that have been registered via
  19381. addition as a pretty-printer. Printers in this list are called
  19382. 'global' printers, they're available when debugging all inferiors.
  19383. Each 'gdb.Progspace' contains a 'pretty_printers' attribute. Each
  19384. 'gdb.Objfile' also contains a 'pretty_printers' attribute.
  19385. Each function on these lists is passed a single 'gdb.Value' argument
  19386. and should return a pretty-printer object conforming to the interface
  19387. definition above (*note Pretty Printing API::). If a function cannot
  19388. create a pretty-printer for the value, it should return 'None'.
  19389. GDB first checks the 'pretty_printers' attribute of each
  19390. 'gdb.Objfile' in the current program space and iteratively calls each
  19391. enabled lookup routine in the list for that 'gdb.Objfile' until it
  19392. receives a pretty-printer object. If no pretty-printer is found in the
  19393. objfile lists, GDB then searches the pretty-printer list of the current
  19394. program space, calling each enabled function until an object is
  19395. returned. After these lists have been exhausted, it tries the global
  19396. 'gdb.pretty_printers' list, again calling each enabled function until an
  19397. object is returned.
  19398. The order in which the objfiles are searched is not specified. For a
  19399. given list, functions are always invoked from the head of the list, and
  19400. iterated over sequentially until the end of the list, or a printer
  19401. object is returned.
  19402. For various reasons a pretty-printer may not work. For example, the
  19403. underlying data structure may have changed and the pretty-printer is out
  19404. of date.
  19405. The consequences of a broken pretty-printer are severe enough that
  19406. GDB provides support for enabling and disabling individual printers.
  19407. For example, if 'print frame-arguments' is on, a backtrace can become
  19408. highly illegible if any argument is printed with a broken printer.
  19409. Pretty-printers are enabled and disabled by attaching an 'enabled'
  19410. attribute to the registered function or callable object. If this
  19411. attribute is present and its value is 'False', the printer is disabled,
  19412. otherwise the printer is enabled.
  19413. 
  19414. File: gdb.info, Node: Writing a Pretty-Printer, Next: Type Printing API, Prev: Selecting Pretty-Printers, Up: Python API
  19415. 23.2.2.7 Writing a Pretty-Printer
  19416. .................................
  19417. A pretty-printer consists of two parts: a lookup function to detect if
  19418. the type is supported, and the printer itself.
  19419. Here is an example showing how a 'std::string' printer might be
  19420. written. *Note Pretty Printing API::, for details on the API this class
  19421. must provide.
  19422. class StdStringPrinter(object):
  19423. "Print a std::string"
  19424. def __init__(self, val):
  19425. self.val = val
  19426. def to_string(self):
  19427. return self.val['_M_dataplus']['_M_p']
  19428. def display_hint(self):
  19429. return 'string'
  19430. And here is an example showing how a lookup function for the printer
  19431. example above might be written.
  19432. def str_lookup_function(val):
  19433. lookup_tag = val.type.tag
  19434. if lookup_tag == None:
  19435. return None
  19436. regex = re.compile("^std::basic_string<char,.*>$")
  19437. if regex.match(lookup_tag):
  19438. return StdStringPrinter(val)
  19439. return None
  19440. The example lookup function extracts the value's type, and attempts
  19441. to match it to a type that it can pretty-print. If it is a type the
  19442. printer can pretty-print, it will return a printer object. If not, it
  19443. returns 'None'.
  19444. We recommend that you put your core pretty-printers into a Python
  19445. package. If your pretty-printers are for use with a library, we further
  19446. recommend embedding a version number into the package name. This
  19447. practice will enable GDB to load multiple versions of your
  19448. pretty-printers at the same time, because they will have different
  19449. names.
  19450. You should write auto-loaded code (*note Python Auto-loading::) such
  19451. that it can be evaluated multiple times without changing its meaning.
  19452. An ideal auto-load file will consist solely of 'import's of your printer
  19453. modules, followed by a call to a register pretty-printers with the
  19454. current objfile.
  19455. Taken as a whole, this approach will scale nicely to multiple
  19456. inferiors, each potentially using a different library version.
  19457. Embedding a version number in the Python package name will ensure that
  19458. GDB is able to load both sets of printers simultaneously. Then, because
  19459. the search for pretty-printers is done by objfile, and because your
  19460. auto-loaded code took care to register your library's printers with a
  19461. specific objfile, GDB will find the correct printers for the specific
  19462. version of the library used by each inferior.
  19463. To continue the 'std::string' example (*note Pretty Printing API::),
  19464. this code might appear in 'gdb.libstdcxx.v6':
  19465. def register_printers(objfile):
  19466. objfile.pretty_printers.append(str_lookup_function)
  19467. And then the corresponding contents of the auto-load file would be:
  19468. import gdb.libstdcxx.v6
  19469. gdb.libstdcxx.v6.register_printers(gdb.current_objfile())
  19470. The previous example illustrates a basic pretty-printer. There are a
  19471. few things that can be improved on. The printer doesn't have a name,
  19472. making it hard to identify in a list of installed printers. The lookup
  19473. function has a name, but lookup functions can have arbitrary, even
  19474. identical, names.
  19475. Second, the printer only handles one type, whereas a library
  19476. typically has several types. One could install a lookup function for
  19477. each desired type in the library, but one could also have a single
  19478. lookup function recognize several types. The latter is the conventional
  19479. way this is handled. If a pretty-printer can handle multiple data
  19480. types, then its "subprinters" are the printers for the individual data
  19481. types.
  19482. The 'gdb.printing' module provides a formal way of solving these
  19483. problems (*note gdb.printing::). Here is another example that handles
  19484. multiple types.
  19485. These are the types we are going to pretty-print:
  19486. struct foo { int a, b; };
  19487. struct bar { struct foo x, y; };
  19488. Here are the printers:
  19489. class fooPrinter:
  19490. """Print a foo object."""
  19491. def __init__(self, val):
  19492. self.val = val
  19493. def to_string(self):
  19494. return ("a=<" + str(self.val["a"]) +
  19495. "> b=<" + str(self.val["b"]) + ">")
  19496. class barPrinter:
  19497. """Print a bar object."""
  19498. def __init__(self, val):
  19499. self.val = val
  19500. def to_string(self):
  19501. return ("x=<" + str(self.val["x"]) +
  19502. "> y=<" + str(self.val["y"]) + ">")
  19503. This example doesn't need a lookup function, that is handled by the
  19504. 'gdb.printing' module. Instead a function is provided to build up the
  19505. object that handles the lookup.
  19506. import gdb.printing
  19507. def build_pretty_printer():
  19508. pp = gdb.printing.RegexpCollectionPrettyPrinter(
  19509. "my_library")
  19510. pp.add_printer('foo', '^foo$', fooPrinter)
  19511. pp.add_printer('bar', '^bar$', barPrinter)
  19512. return pp
  19513. And here is the autoload support:
  19514. import gdb.printing
  19515. import my_library
  19516. gdb.printing.register_pretty_printer(
  19517. gdb.current_objfile(),
  19518. my_library.build_pretty_printer())
  19519. Finally, when this printer is loaded into GDB, here is the
  19520. corresponding output of 'info pretty-printer':
  19521. (gdb) info pretty-printer
  19522. my_library.so:
  19523. my_library
  19524. foo
  19525. bar
  19526. 
  19527. File: gdb.info, Node: Type Printing API, Next: Frame Filter API, Prev: Writing a Pretty-Printer, Up: Python API
  19528. 23.2.2.8 Type Printing API
  19529. ..........................
  19530. GDB provides a way for Python code to customize type display. This is
  19531. mainly useful for substituting canonical typedef names for types.
  19532. A "type printer" is just a Python object conforming to a certain
  19533. protocol. A simple base class implementing the protocol is provided;
  19534. see *note gdb.types::. A type printer must supply at least:
  19535. -- Instance Variable of type_printer: enabled
  19536. A boolean which is True if the printer is enabled, and False
  19537. otherwise. This is manipulated by the 'enable type-printer' and
  19538. 'disable type-printer' commands.
  19539. -- Instance Variable of type_printer: name
  19540. The name of the type printer. This must be a string. This is used
  19541. by the 'enable type-printer' and 'disable type-printer' commands.
  19542. -- Method on type_printer: instantiate (self)
  19543. This is called by GDB at the start of type-printing. It is only
  19544. called if the type printer is enabled. This method must return a
  19545. new object that supplies a 'recognize' method, as described below.
  19546. When displaying a type, say via the 'ptype' command, GDB will compute
  19547. a list of type recognizers. This is done by iterating first over the
  19548. per-objfile type printers (*note Objfiles In Python::), followed by the
  19549. per-progspace type printers (*note Progspaces In Python::), and finally
  19550. the global type printers.
  19551. GDB will call the 'instantiate' method of each enabled type printer.
  19552. If this method returns 'None', then the result is ignored; otherwise, it
  19553. is appended to the list of recognizers.
  19554. Then, when GDB is going to display a type name, it iterates over the
  19555. list of recognizers. For each one, it calls the recognition function,
  19556. stopping if the function returns a non-'None' value. The recognition
  19557. function is defined as:
  19558. -- Method on type_recognizer: recognize (self, type)
  19559. If TYPE is not recognized, return 'None'. Otherwise, return a
  19560. string which is to be printed as the name of TYPE. The TYPE
  19561. argument will be an instance of 'gdb.Type' (*note Types In
  19562. Python::).
  19563. GDB uses this two-pass approach so that type printers can efficiently
  19564. cache information without holding on to it too long. For example, it
  19565. can be convenient to look up type information in a type printer and hold
  19566. it for a recognizer's lifetime; if a single pass were done then type
  19567. printers would have to make use of the event system in order to avoid
  19568. holding information that could become stale as the inferior changed.
  19569. 
  19570. File: gdb.info, Node: Frame Filter API, Next: Frame Decorator API, Prev: Type Printing API, Up: Python API
  19571. 23.2.2.9 Filtering Frames
  19572. .........................
  19573. Frame filters are Python objects that manipulate the visibility of a
  19574. frame or frames when a backtrace (*note Backtrace::) is printed by GDB.
  19575. Only commands that print a backtrace, or, in the case of GDB/MI
  19576. commands (*note GDB/MI::), those that return a collection of frames are
  19577. affected. The commands that work with frame filters are:
  19578. 'backtrace' (*note The backtrace command: backtrace-command.),
  19579. '-stack-list-frames' (*note The -stack-list-frames command:
  19580. -stack-list-frames.), '-stack-list-variables' (*note The
  19581. -stack-list-variables command: -stack-list-variables.),
  19582. '-stack-list-arguments' *note The -stack-list-arguments command:
  19583. -stack-list-arguments.) and '-stack-list-locals' (*note The
  19584. -stack-list-locals command: -stack-list-locals.).
  19585. A frame filter works by taking an iterator as an argument, applying
  19586. actions to the contents of that iterator, and returning another iterator
  19587. (or, possibly, the same iterator it was provided in the case where the
  19588. filter does not perform any operations). Typically, frame filters
  19589. utilize tools such as the Python's 'itertools' module to work with and
  19590. create new iterators from the source iterator. Regardless of how a
  19591. filter chooses to apply actions, it must not alter the underlying GDB
  19592. frame or frames, or attempt to alter the call-stack within GDB. This
  19593. preserves data integrity within GDB. Frame filters are executed on a
  19594. priority basis and care should be taken that some frame filters may have
  19595. been executed before, and that some frame filters will be executed
  19596. after.
  19597. An important consideration when designing frame filters, and well
  19598. worth reflecting upon, is that frame filters should avoid unwinding the
  19599. call stack if possible. Some stacks can run very deep, into the tens of
  19600. thousands in some cases. To search every frame when a frame filter
  19601. executes may be too expensive at that step. The frame filter cannot
  19602. know how many frames it has to iterate over, and it may have to iterate
  19603. through them all. This ends up duplicating effort as GDB performs this
  19604. iteration when it prints the frames. If the filter can defer unwinding
  19605. frames until frame decorators are executed, after the last filter has
  19606. executed, it should. *Note Frame Decorator API::, for more information
  19607. on decorators. Also, there are examples for both frame decorators and
  19608. filters in later chapters. *Note Writing a Frame Filter::, for more
  19609. information.
  19610. The Python dictionary 'gdb.frame_filters' contains key/object
  19611. pairings that comprise a frame filter. Frame filters in this dictionary
  19612. are called 'global' frame filters, and they are available when debugging
  19613. all inferiors. These frame filters must register with the dictionary
  19614. directly. In addition to the 'global' dictionary, there are other
  19615. dictionaries that are loaded with different inferiors via auto-loading
  19616. (*note Python Auto-loading::). The two other areas where frame filter
  19617. dictionaries can be found are: 'gdb.Progspace' which contains a
  19618. 'frame_filters' dictionary attribute, and each 'gdb.Objfile' object
  19619. which also contains a 'frame_filters' dictionary attribute.
  19620. When a command is executed from GDB that is compatible with frame
  19621. filters, GDB combines the 'global', 'gdb.Progspace' and all
  19622. 'gdb.Objfile' dictionaries currently loaded. All of the 'gdb.Objfile'
  19623. dictionaries are combined, as several frames, and thus several object
  19624. files, might be in use. GDB then prunes any frame filter whose
  19625. 'enabled' attribute is 'False'. This pruned list is then sorted
  19626. according to the 'priority' attribute in each filter.
  19627. Once the dictionaries are combined, pruned and sorted, GDB creates an
  19628. iterator which wraps each frame in the call stack in a 'FrameDecorator'
  19629. object, and calls each filter in order. The output from the previous
  19630. filter will always be the input to the next filter, and so on.
  19631. Frame filters have a mandatory interface which each frame filter must
  19632. implement, defined here:
  19633. -- Function: FrameFilter.filter (iterator)
  19634. GDB will call this method on a frame filter when it has reached the
  19635. order in the priority list for that filter.
  19636. For example, if there are four frame filters:
  19637. Name Priority
  19638. Filter1 5
  19639. Filter2 10
  19640. Filter3 100
  19641. Filter4 1
  19642. The order that the frame filters will be called is:
  19643. Filter3 -> Filter2 -> Filter1 -> Filter4
  19644. Note that the output from 'Filter3' is passed to the input of
  19645. 'Filter2', and so on.
  19646. This 'filter' method is passed a Python iterator. This iterator
  19647. contains a sequence of frame decorators that wrap each 'gdb.Frame',
  19648. or a frame decorator that wraps another frame decorator. The first
  19649. filter that is executed in the sequence of frame filters will
  19650. receive an iterator entirely comprised of default 'FrameDecorator'
  19651. objects. However, after each frame filter is executed, the
  19652. previous frame filter may have wrapped some or all of the frame
  19653. decorators with their own frame decorator. As frame decorators
  19654. must also conform to a mandatory interface, these decorators can be
  19655. assumed to act in a uniform manner (*note Frame Decorator API::).
  19656. This method must return an object conforming to the Python iterator
  19657. protocol. Each item in the iterator must be an object conforming
  19658. to the frame decorator interface. If a frame filter does not wish
  19659. to perform any operations on this iterator, it should return that
  19660. iterator untouched.
  19661. This method is not optional. If it does not exist, GDB will raise
  19662. and print an error.
  19663. -- Variable: FrameFilter.name
  19664. The 'name' attribute must be Python string which contains the name
  19665. of the filter displayed by GDB (*note Frame Filter Management::).
  19666. This attribute may contain any combination of letters or numbers.
  19667. Care should be taken to ensure that it is unique. This attribute
  19668. is mandatory.
  19669. -- Variable: FrameFilter.enabled
  19670. The 'enabled' attribute must be Python boolean. This attribute
  19671. indicates to GDB whether the frame filter is enabled, and should be
  19672. considered when frame filters are executed. If 'enabled' is
  19673. 'True', then the frame filter will be executed when any of the
  19674. backtrace commands detailed earlier in this chapter are executed.
  19675. If 'enabled' is 'False', then the frame filter will not be
  19676. executed. This attribute is mandatory.
  19677. -- Variable: FrameFilter.priority
  19678. The 'priority' attribute must be Python integer. This attribute
  19679. controls the order of execution in relation to other frame filters.
  19680. There are no imposed limits on the range of 'priority' other than
  19681. it must be a valid integer. The higher the 'priority' attribute,
  19682. the sooner the frame filter will be executed in relation to other
  19683. frame filters. Although 'priority' can be negative, it is
  19684. recommended practice to assume zero is the lowest priority that a
  19685. frame filter can be assigned. Frame filters that have the same
  19686. priority are executed in unsorted order in that priority slot.
  19687. This attribute is mandatory. 100 is a good default priority.
  19688. 
  19689. File: gdb.info, Node: Frame Decorator API, Next: Writing a Frame Filter, Prev: Frame Filter API, Up: Python API
  19690. 23.2.2.10 Decorating Frames
  19691. ...........................
  19692. Frame decorators are sister objects to frame filters (*note Frame Filter
  19693. API::). Frame decorators are applied by a frame filter and can only be
  19694. used in conjunction with frame filters.
  19695. The purpose of a frame decorator is to customize the printed content
  19696. of each 'gdb.Frame' in commands where frame filters are executed. This
  19697. concept is called decorating a frame. Frame decorators decorate a
  19698. 'gdb.Frame' with Python code contained within each API call. This
  19699. separates the actual data contained in a 'gdb.Frame' from the decorated
  19700. data produced by a frame decorator. This abstraction is necessary to
  19701. maintain integrity of the data contained in each 'gdb.Frame'.
  19702. Frame decorators have a mandatory interface, defined below.
  19703. GDB already contains a frame decorator called 'FrameDecorator'. This
  19704. contains substantial amounts of boilerplate code to decorate the content
  19705. of a 'gdb.Frame'. It is recommended that other frame decorators inherit
  19706. and extend this object, and only to override the methods needed.
  19707. 'FrameDecorator' is defined in the Python module
  19708. 'gdb.FrameDecorator', so your code can import it like:
  19709. from gdb.FrameDecorator import FrameDecorator
  19710. -- Function: FrameDecorator.elided (self)
  19711. The 'elided' method groups frames together in a hierarchical
  19712. system. An example would be an interpreter, where multiple
  19713. low-level frames make up a single call in the interpreted language.
  19714. In this example, the frame filter would elide the low-level frames
  19715. and present a single high-level frame, representing the call in the
  19716. interpreted language, to the user.
  19717. The 'elided' function must return an iterable and this iterable
  19718. must contain the frames that are being elided wrapped in a suitable
  19719. frame decorator. If no frames are being elided this function may
  19720. return an empty iterable, or 'None'. Elided frames are indented
  19721. from normal frames in a 'CLI' backtrace, or in the case of
  19722. 'GDB/MI', are placed in the 'children' field of the eliding frame.
  19723. It is the frame filter's task to also filter out the elided frames
  19724. from the source iterator. This will avoid printing the frame
  19725. twice.
  19726. -- Function: FrameDecorator.function (self)
  19727. This method returns the name of the function in the frame that is
  19728. to be printed.
  19729. This method must return a Python string describing the function, or
  19730. 'None'.
  19731. If this function returns 'None', GDB will not print any data for
  19732. this field.
  19733. -- Function: FrameDecorator.address (self)
  19734. This method returns the address of the frame that is to be printed.
  19735. This method must return a Python numeric integer type of sufficient
  19736. size to describe the address of the frame, or 'None'.
  19737. If this function returns a 'None', GDB will not print any data for
  19738. this field.
  19739. -- Function: FrameDecorator.filename (self)
  19740. This method returns the filename and path associated with this
  19741. frame.
  19742. This method must return a Python string containing the filename and
  19743. the path to the object file backing the frame, or 'None'.
  19744. If this function returns a 'None', GDB will not print any data for
  19745. this field.
  19746. -- Function: FrameDecorator.line (self):
  19747. This method returns the line number associated with the current
  19748. position within the function addressed by this frame.
  19749. This method must return a Python integer type, or 'None'.
  19750. If this function returns a 'None', GDB will not print any data for
  19751. this field.
  19752. -- Function: FrameDecorator.frame_args (self)
  19753. This method must return an iterable, or 'None'. Returning an empty
  19754. iterable, or 'None' means frame arguments will not be printed for
  19755. this frame. This iterable must contain objects that implement two
  19756. methods, described here.
  19757. This object must implement a 'argument' method which takes a single
  19758. 'self' parameter and must return a 'gdb.Symbol' (*note Symbols In
  19759. Python::), or a Python string. The object must also implement a
  19760. 'value' method which takes a single 'self' parameter and must
  19761. return a 'gdb.Value' (*note Values From Inferior::), a Python
  19762. value, or 'None'. If the 'value' method returns 'None', and the
  19763. 'argument' method returns a 'gdb.Symbol', GDB will look-up and
  19764. print the value of the 'gdb.Symbol' automatically.
  19765. A brief example:
  19766. class SymValueWrapper():
  19767. def __init__(self, symbol, value):
  19768. self.sym = symbol
  19769. self.val = value
  19770. def value(self):
  19771. return self.val
  19772. def symbol(self):
  19773. return self.sym
  19774. class SomeFrameDecorator()
  19775. ...
  19776. ...
  19777. def frame_args(self):
  19778. args = []
  19779. try:
  19780. block = self.inferior_frame.block()
  19781. except:
  19782. return None
  19783. # Iterate over all symbols in a block. Only add
  19784. # symbols that are arguments.
  19785. for sym in block:
  19786. if not sym.is_argument:
  19787. continue
  19788. args.append(SymValueWrapper(sym,None))
  19789. # Add example synthetic argument.
  19790. args.append(SymValueWrapper(``foo'', 42))
  19791. return args
  19792. -- Function: FrameDecorator.frame_locals (self)
  19793. This method must return an iterable or 'None'. Returning an empty
  19794. iterable, or 'None' means frame local arguments will not be printed
  19795. for this frame.
  19796. The object interface, the description of the various strategies for
  19797. reading frame locals, and the example are largely similar to those
  19798. described in the 'frame_args' function, (*note The frame filter
  19799. frame_args function: frame_args.). Below is a modified example:
  19800. class SomeFrameDecorator()
  19801. ...
  19802. ...
  19803. def frame_locals(self):
  19804. vars = []
  19805. try:
  19806. block = self.inferior_frame.block()
  19807. except:
  19808. return None
  19809. # Iterate over all symbols in a block. Add all
  19810. # symbols, except arguments.
  19811. for sym in block:
  19812. if sym.is_argument:
  19813. continue
  19814. vars.append(SymValueWrapper(sym,None))
  19815. # Add an example of a synthetic local variable.
  19816. vars.append(SymValueWrapper(``bar'', 99))
  19817. return vars
  19818. -- Function: FrameDecorator.inferior_frame (self):
  19819. This method must return the underlying 'gdb.Frame' that this frame
  19820. decorator is decorating. GDB requires the underlying frame for
  19821. internal frame information to determine how to print certain values
  19822. when printing a frame.
  19823. 
  19824. File: gdb.info, Node: Writing a Frame Filter, Next: Unwinding Frames in Python, Prev: Frame Decorator API, Up: Python API
  19825. 23.2.2.11 Writing a Frame Filter
  19826. ................................
  19827. There are three basic elements that a frame filter must implement: it
  19828. must correctly implement the documented interface (*note Frame Filter
  19829. API::), it must register itself with GDB, and finally, it must decide if
  19830. it is to work on the data provided by GDB. In all cases, whether it
  19831. works on the iterator or not, each frame filter must return an iterator.
  19832. A bare-bones frame filter follows the pattern in the following example.
  19833. import gdb
  19834. class FrameFilter():
  19835. def __init__(self):
  19836. # Frame filter attribute creation.
  19837. #
  19838. # 'name' is the name of the filter that GDB will display.
  19839. #
  19840. # 'priority' is the priority of the filter relative to other
  19841. # filters.
  19842. #
  19843. # 'enabled' is a boolean that indicates whether this filter is
  19844. # enabled and should be executed.
  19845. self.name = "Foo"
  19846. self.priority = 100
  19847. self.enabled = True
  19848. # Register this frame filter with the global frame_filters
  19849. # dictionary.
  19850. gdb.frame_filters[self.name] = self
  19851. def filter(self, frame_iter):
  19852. # Just return the iterator.
  19853. return frame_iter
  19854. The frame filter in the example above implements the three
  19855. requirements for all frame filters. It implements the API, self
  19856. registers, and makes a decision on the iterator (in this case, it just
  19857. returns the iterator untouched).
  19858. The first step is attribute creation and assignment, and as shown in
  19859. the comments the filter assigns the following attributes: 'name',
  19860. 'priority' and whether the filter should be enabled with the 'enabled'
  19861. attribute.
  19862. The second step is registering the frame filter with the dictionary
  19863. or dictionaries that the frame filter has interest in. As shown in the
  19864. comments, this filter just registers itself with the global dictionary
  19865. 'gdb.frame_filters'. As noted earlier, 'gdb.frame_filters' is a
  19866. dictionary that is initialized in the 'gdb' module when GDB starts.
  19867. What dictionary a filter registers with is an important consideration.
  19868. Generally, if a filter is specific to a set of code, it should be
  19869. registered either in the 'objfile' or 'progspace' dictionaries as they
  19870. are specific to the program currently loaded in GDB. The global
  19871. dictionary is always present in GDB and is never unloaded. Any filters
  19872. registered with the global dictionary will exist until GDB exits. To
  19873. avoid filters that may conflict, it is generally better to register
  19874. frame filters against the dictionaries that more closely align with the
  19875. usage of the filter currently in question. *Note Python Auto-loading::,
  19876. for further information on auto-loading Python scripts.
  19877. GDB takes a hands-off approach to frame filter registration,
  19878. therefore it is the frame filter's responsibility to ensure registration
  19879. has occurred, and that any exceptions are handled appropriately. In
  19880. particular, you may wish to handle exceptions relating to Python
  19881. dictionary key uniqueness. It is mandatory that the dictionary key is
  19882. the same as frame filter's 'name' attribute. When a user manages frame
  19883. filters (*note Frame Filter Management::), the names GDB will display
  19884. are those contained in the 'name' attribute.
  19885. The final step of this example is the implementation of the 'filter'
  19886. method. As shown in the example comments, we define the 'filter' method
  19887. and note that the method must take an iterator, and also must return an
  19888. iterator. In this bare-bones example, the frame filter is not very
  19889. useful as it just returns the iterator untouched. However this is a
  19890. valid operation for frame filters that have the 'enabled' attribute set,
  19891. but decide not to operate on any frames.
  19892. In the next example, the frame filter operates on all frames and
  19893. utilizes a frame decorator to perform some work on the frames. *Note
  19894. Frame Decorator API::, for further information on the frame decorator
  19895. interface.
  19896. This example works on inlined frames. It highlights frames which are
  19897. inlined by tagging them with an "[inlined]" tag. By applying a frame
  19898. decorator to all frames with the Python 'itertools imap' method, the
  19899. example defers actions to the frame decorator. Frame decorators are
  19900. only processed when GDB prints the backtrace.
  19901. This introduces a new decision making topic: whether to perform
  19902. decision making operations at the filtering step, or at the printing
  19903. step. In this example's approach, it does not perform any filtering
  19904. decisions at the filtering step beyond mapping a frame decorator to each
  19905. frame. This allows the actual decision making to be performed when each
  19906. frame is printed. This is an important consideration, and well worth
  19907. reflecting upon when designing a frame filter. An issue that frame
  19908. filters should avoid is unwinding the stack if possible. Some stacks
  19909. can run very deep, into the tens of thousands in some cases. To search
  19910. every frame to determine if it is inlined ahead of time may be too
  19911. expensive at the filtering step. The frame filter cannot know how many
  19912. frames it has to iterate over, and it would have to iterate through them
  19913. all. This ends up duplicating effort as GDB performs this iteration
  19914. when it prints the frames.
  19915. In this example decision making can be deferred to the printing step.
  19916. As each frame is printed, the frame decorator can examine each frame in
  19917. turn when GDB iterates. From a performance viewpoint, this is the most
  19918. appropriate decision to make as it avoids duplicating the effort that
  19919. the printing step would undertake anyway. Also, if there are many frame
  19920. filters unwinding the stack during filtering, it can substantially delay
  19921. the printing of the backtrace which will result in large memory usage,
  19922. and a poor user experience.
  19923. class InlineFilter():
  19924. def __init__(self):
  19925. self.name = "InlinedFrameFilter"
  19926. self.priority = 100
  19927. self.enabled = True
  19928. gdb.frame_filters[self.name] = self
  19929. def filter(self, frame_iter):
  19930. frame_iter = itertools.imap(InlinedFrameDecorator,
  19931. frame_iter)
  19932. return frame_iter
  19933. This frame filter is somewhat similar to the earlier example, except
  19934. that the 'filter' method applies a frame decorator object called
  19935. 'InlinedFrameDecorator' to each element in the iterator. The 'imap'
  19936. Python method is light-weight. It does not proactively iterate over the
  19937. iterator, but rather creates a new iterator which wraps the existing
  19938. one.
  19939. Below is the frame decorator for this example.
  19940. class InlinedFrameDecorator(FrameDecorator):
  19941. def __init__(self, fobj):
  19942. super(InlinedFrameDecorator, self).__init__(fobj)
  19943. def function(self):
  19944. frame = fobj.inferior_frame()
  19945. name = str(frame.name())
  19946. if frame.type() == gdb.INLINE_FRAME:
  19947. name = name + " [inlined]"
  19948. return name
  19949. This frame decorator only defines and overrides the 'function'
  19950. method. It lets the supplied 'FrameDecorator', which is shipped with
  19951. GDB, perform the other work associated with printing this frame.
  19952. The combination of these two objects create this output from a
  19953. backtrace:
  19954. #0 0x004004e0 in bar () at inline.c:11
  19955. #1 0x00400566 in max [inlined] (b=6, a=12) at inline.c:21
  19956. #2 0x00400566 in main () at inline.c:31
  19957. So in the case of this example, a frame decorator is applied to all
  19958. frames, regardless of whether they may be inlined or not. As GDB
  19959. iterates over the iterator produced by the frame filters, GDB executes
  19960. each frame decorator which then makes a decision on what to print in the
  19961. 'function' callback. Using a strategy like this is a way to defer
  19962. decisions on the frame content to printing time.
  19963. Eliding Frames
  19964. --------------
  19965. It might be that the above example is not desirable for representing
  19966. inlined frames, and a hierarchical approach may be preferred. If we
  19967. want to hierarchically represent frames, the 'elided' frame decorator
  19968. interface might be preferable.
  19969. This example approaches the issue with the 'elided' method. This
  19970. example is quite long, but very simplistic. It is out-of-scope for this
  19971. section to write a complete example that comprehensively covers all
  19972. approaches of finding and printing inlined frames. However, this
  19973. example illustrates the approach an author might use.
  19974. This example comprises of three sections.
  19975. class InlineFrameFilter():
  19976. def __init__(self):
  19977. self.name = "InlinedFrameFilter"
  19978. self.priority = 100
  19979. self.enabled = True
  19980. gdb.frame_filters[self.name] = self
  19981. def filter(self, frame_iter):
  19982. return ElidingInlineIterator(frame_iter)
  19983. This frame filter is very similar to the other examples. The only
  19984. difference is this frame filter is wrapping the iterator provided to it
  19985. ('frame_iter') with a custom iterator called 'ElidingInlineIterator'.
  19986. This again defers actions to when GDB prints the backtrace, as the
  19987. iterator is not traversed until printing.
  19988. The iterator for this example is as follows. It is in this section
  19989. of the example where decisions are made on the content of the backtrace.
  19990. class ElidingInlineIterator:
  19991. def __init__(self, ii):
  19992. self.input_iterator = ii
  19993. def __iter__(self):
  19994. return self
  19995. def next(self):
  19996. frame = next(self.input_iterator)
  19997. if frame.inferior_frame().type() != gdb.INLINE_FRAME:
  19998. return frame
  19999. try:
  20000. eliding_frame = next(self.input_iterator)
  20001. except StopIteration:
  20002. return frame
  20003. return ElidingFrameDecorator(eliding_frame, [frame])
  20004. This iterator implements the Python iterator protocol. When the
  20005. 'next' function is called (when GDB prints each frame), the iterator
  20006. checks if this frame decorator, 'frame', is wrapping an inlined frame.
  20007. If it is not, it returns the existing frame decorator untouched. If it
  20008. is wrapping an inlined frame, it assumes that the inlined frame was
  20009. contained within the next oldest frame, 'eliding_frame', which it
  20010. fetches. It then creates and returns a frame decorator,
  20011. 'ElidingFrameDecorator', which contains both the elided frame, and the
  20012. eliding frame.
  20013. class ElidingInlineDecorator(FrameDecorator):
  20014. def __init__(self, frame, elided_frames):
  20015. super(ElidingInlineDecorator, self).__init__(frame)
  20016. self.frame = frame
  20017. self.elided_frames = elided_frames
  20018. def elided(self):
  20019. return iter(self.elided_frames)
  20020. This frame decorator overrides one function and returns the inlined
  20021. frame in the 'elided' method. As before it lets 'FrameDecorator' do the
  20022. rest of the work involved in printing this frame. This produces the
  20023. following output.
  20024. #0 0x004004e0 in bar () at inline.c:11
  20025. #2 0x00400529 in main () at inline.c:25
  20026. #1 0x00400529 in max (b=6, a=12) at inline.c:15
  20027. In that output, 'max' which has been inlined into 'main' is printed
  20028. hierarchically. Another approach would be to combine the 'function'
  20029. method, and the 'elided' method to both print a marker in the inlined
  20030. frame, and also show the hierarchical relationship.
  20031. 
  20032. File: gdb.info, Node: Unwinding Frames in Python, Next: Xmethods In Python, Prev: Writing a Frame Filter, Up: Python API
  20033. 23.2.2.12 Unwinding Frames in Python
  20034. ....................................
  20035. In GDB terminology "unwinding" is the process of finding the previous
  20036. frame (that is, caller's) from the current one. An unwinder has three
  20037. methods. The first one checks if it can handle given frame ("sniff"
  20038. it). For the frames it can sniff an unwinder provides two additional
  20039. methods: it can return frame's ID, and it can fetch registers from the
  20040. previous frame. A running GDB mantains a list of the unwinders and
  20041. calls each unwinder's sniffer in turn until it finds the one that
  20042. recognizes the current frame. There is an API to register an unwinder.
  20043. The unwinders that come with GDB handle standard frames. However,
  20044. mixed language applications (for example, an application running Java
  20045. Virtual Machine) sometimes use frame layouts that cannot be handled by
  20046. the GDB unwinders. You can write Python code that can handle such
  20047. custom frames.
  20048. You implement a frame unwinder in Python as a class with which has
  20049. two attributes, 'name' and 'enabled', with obvious meanings, and a
  20050. single method '__call__', which examines a given frame and returns an
  20051. object (an instance of 'gdb.UnwindInfo class)' describing it. If an
  20052. unwinder does not recognize a frame, it should return 'None'. The code
  20053. in GDB that enables writing unwinders in Python uses this object to
  20054. return frame's ID and previous frame registers when GDB core asks for
  20055. them.
  20056. An unwinder should do as little work as possible. Some otherwise
  20057. innocuous operations can cause problems (even crashes, as this code is
  20058. not not well-hardened yet). For example, making an inferior call from
  20059. an unwinder is unadvisable, as an inferior call will reset GDB's stack
  20060. unwinding process, potentially causing re-entrant unwinding.
  20061. Unwinder Input
  20062. --------------
  20063. An object passed to an unwinder (a 'gdb.PendingFrame' instance) provides
  20064. a method to read frame's registers:
  20065. -- Function: PendingFrame.read_register (reg)
  20066. This method returns the contents of the register REG in the frame
  20067. as a 'gdb.Value' object. For a description of the acceptable
  20068. values of REG see *note Frame.read_register:
  20069. gdbpy_frame_read_register. If REG does not name a register for the
  20070. current architecture, this method will throw an exception.
  20071. Note that this method will always return a 'gdb.Value' for a valid
  20072. register name. This does not mean that the value will be valid.
  20073. For example, you may request a register that an earlier unwinder
  20074. could not unwind--the value will be unavailable. Instead, the
  20075. 'gdb.Value' returned from this method will be lazy; that is, its
  20076. underlying bits will not be fetched until it is first used. So,
  20077. attempting to use such a value will cause an exception at the point
  20078. of use.
  20079. The type of the returned 'gdb.Value' depends on the register and
  20080. the architecture. It is common for registers to have a scalar
  20081. type, like 'long long'; but many other types are possible, such as
  20082. pointer, pointer-to-function, floating point or vector types.
  20083. It also provides a factory method to create a 'gdb.UnwindInfo'
  20084. instance to be returned to GDB:
  20085. -- Function: PendingFrame.create_unwind_info (frame_id)
  20086. Returns a new 'gdb.UnwindInfo' instance identified by given
  20087. FRAME_ID. The argument is used to build GDB's frame ID using one
  20088. of functions provided by GDB. FRAME_ID's attributes determine
  20089. which function will be used, as follows:
  20090. 'sp, pc'
  20091. The frame is identified by the given stack address and PC. The
  20092. stack address must be chosen so that it is constant throughout
  20093. the lifetime of the frame, so a typical choice is the value of
  20094. the stack pointer at the start of the function--in the DWARF
  20095. standard, this would be the "Call Frame Address".
  20096. This is the most common case by far. The other cases are
  20097. documented for completeness but are only useful in specialized
  20098. situations.
  20099. 'sp, pc, special'
  20100. The frame is identified by the stack address, the PC, and a
  20101. "special" address. The special address is used on
  20102. architectures that can have frames that do not change the
  20103. stack, but which are still distinct, for example the IA-64,
  20104. which has a second stack for registers. Both SP and SPECIAL
  20105. must be constant throughout the lifetime of the frame.
  20106. 'sp'
  20107. The frame is identified by the stack address only. Any other
  20108. stack frame with a matching SP will be considered to match
  20109. this frame. Inside gdb, this is called a "wild frame". You
  20110. will never need this.
  20111. Each attribute value should be an instance of 'gdb.Value'.
  20112. -- Function: PendingFrame.architecture ()
  20113. Return the 'gdb.Architecture' (*note Architectures In Python::) for
  20114. this 'gdb.PendingFrame'. This represents the architecture of the
  20115. particular frame being unwound.
  20116. Unwinder Output: UnwindInfo
  20117. ---------------------------
  20118. Use 'PendingFrame.create_unwind_info' method described above to create a
  20119. 'gdb.UnwindInfo' instance. Use the following method to specify caller
  20120. registers that have been saved in this frame:
  20121. -- Function: gdb.UnwindInfo.add_saved_register (reg, value)
  20122. REG identifies the register, for a description of the acceptable
  20123. values see *note Frame.read_register: gdbpy_frame_read_register.
  20124. VALUE is a register value (a 'gdb.Value' object).
  20125. Unwinder Skeleton Code
  20126. ----------------------
  20127. GDB comes with the module containing the base 'Unwinder' class. Derive
  20128. your unwinder class from it and structure the code as follows:
  20129. from gdb.unwinders import Unwinder
  20130. class FrameId(object):
  20131. def __init__(self, sp, pc):
  20132. self.sp = sp
  20133. self.pc = pc
  20134. class MyUnwinder(Unwinder):
  20135. def __init__(....):
  20136. super(MyUnwinder, self).__init___(<expects unwinder name argument>)
  20137. def __call__(pending_frame):
  20138. if not <we recognize frame>:
  20139. return None
  20140. # Create UnwindInfo. Usually the frame is identified by the stack
  20141. # pointer and the program counter.
  20142. sp = pending_frame.read_register(<SP number>)
  20143. pc = pending_frame.read_register(<PC number>)
  20144. unwind_info = pending_frame.create_unwind_info(FrameId(sp, pc))
  20145. # Find the values of the registers in the caller's frame and
  20146. # save them in the result:
  20147. unwind_info.add_saved_register(<register>, <value>)
  20148. ....
  20149. # Return the result:
  20150. return unwind_info
  20151. Registering a Unwinder
  20152. ----------------------
  20153. An object file, a program space, and the GDB proper can have unwinders
  20154. registered with it.
  20155. The 'gdb.unwinders' module provides the function to register a
  20156. unwinder:
  20157. -- Function: gdb.unwinder.register_unwinder (locus, unwinder,
  20158. replace=False)
  20159. LOCUS is specifies an object file or a program space to which
  20160. UNWINDER is added. Passing 'None' or 'gdb' adds UNWINDER to the
  20161. GDB's global unwinder list. The newly added UNWINDER will be
  20162. called before any other unwinder from the same locus. Two
  20163. unwinders in the same locus cannot have the same name. An attempt
  20164. to add a unwinder with already existing name raises an exception
  20165. unless REPLACE is 'True', in which case the old unwinder is
  20166. deleted.
  20167. Unwinder Precedence
  20168. -------------------
  20169. GDB first calls the unwinders from all the object files in no particular
  20170. order, then the unwinders from the current program space, and finally
  20171. the unwinders from GDB.
  20172. 
  20173. File: gdb.info, Node: Xmethods In Python, Next: Xmethod API, Prev: Unwinding Frames in Python, Up: Python API
  20174. 23.2.2.13 Xmethods In Python
  20175. ............................
  20176. "Xmethods" are additional methods or replacements for existing methods
  20177. of a C++ class. This feature is useful for those cases where a method
  20178. defined in C++ source code could be inlined or optimized out by the
  20179. compiler, making it unavailable to GDB. For such cases, one can define
  20180. an xmethod to serve as a replacement for the method defined in the C++
  20181. source code. GDB will then invoke the xmethod, instead of the C++
  20182. method, to evaluate expressions. One can also use xmethods when
  20183. debugging with core files. Moreover, when debugging live programs,
  20184. invoking an xmethod need not involve running the inferior (which can
  20185. potentially perturb its state). Hence, even if the C++ method is
  20186. available, it is better to use its replacement xmethod if one is
  20187. defined.
  20188. The xmethods feature in Python is available via the concepts of an
  20189. "xmethod matcher" and an "xmethod worker". To implement an xmethod, one
  20190. has to implement a matcher and a corresponding worker for it (more than
  20191. one worker can be implemented, each catering to a different overloaded
  20192. instance of the method). Internally, GDB invokes the 'match' method of
  20193. a matcher to match the class type and method name. On a match, the
  20194. 'match' method returns a list of matching _worker_ objects. Each worker
  20195. object typically corresponds to an overloaded instance of the xmethod.
  20196. They implement a 'get_arg_types' method which returns a sequence of
  20197. types corresponding to the arguments the xmethod requires. GDB uses
  20198. this sequence of types to perform overload resolution and picks a
  20199. winning xmethod worker. A winner is also selected from among the
  20200. methods GDB finds in the C++ source code. Next, the winning xmethod
  20201. worker and the winning C++ method are compared to select an overall
  20202. winner. In case of a tie between a xmethod worker and a C++ method, the
  20203. xmethod worker is selected as the winner. That is, if a winning xmethod
  20204. worker is found to be equivalent to the winning C++ method, then the
  20205. xmethod worker is treated as a replacement for the C++ method. GDB uses
  20206. the overall winner to invoke the method. If the winning xmethod worker
  20207. is the overall winner, then the corresponding xmethod is invoked via the
  20208. '__call__' method of the worker object.
  20209. If one wants to implement an xmethod as a replacement for an existing
  20210. C++ method, then they have to implement an equivalent xmethod which has
  20211. exactly the same name and takes arguments of exactly the same type as
  20212. the C++ method. If the user wants to invoke the C++ method even though
  20213. a replacement xmethod is available for that method, then they can
  20214. disable the xmethod.
  20215. *Note Xmethod API::, for API to implement xmethods in Python. *Note
  20216. Writing an Xmethod::, for implementing xmethods in Python.
  20217. 
  20218. File: gdb.info, Node: Xmethod API, Next: Writing an Xmethod, Prev: Xmethods In Python, Up: Python API
  20219. 23.2.2.14 Xmethod API
  20220. .....................
  20221. The GDB Python API provides classes, interfaces and functions to
  20222. implement, register and manipulate xmethods. *Note Xmethods In
  20223. Python::.
  20224. An xmethod matcher should be an instance of a class derived from
  20225. 'XMethodMatcher' defined in the module 'gdb.xmethod', or an object with
  20226. similar interface and attributes. An instance of 'XMethodMatcher' has
  20227. the following attributes:
  20228. -- Variable: name
  20229. The name of the matcher.
  20230. -- Variable: enabled
  20231. A boolean value indicating whether the matcher is enabled or
  20232. disabled.
  20233. -- Variable: methods
  20234. A list of named methods managed by the matcher. Each object in the
  20235. list is an instance of the class 'XMethod' defined in the module
  20236. 'gdb.xmethod', or any object with the following attributes:
  20237. 'name'
  20238. Name of the xmethod which should be unique for each xmethod
  20239. managed by the matcher.
  20240. 'enabled'
  20241. A boolean value indicating whether the xmethod is enabled or
  20242. disabled.
  20243. The class 'XMethod' is a convenience class with same attributes as
  20244. above along with the following constructor:
  20245. -- Function: XMethod.__init__ (self, name)
  20246. Constructs an enabled xmethod with name NAME.
  20247. The 'XMethodMatcher' class has the following methods:
  20248. -- Function: XMethodMatcher.__init__ (self, name)
  20249. Constructs an enabled xmethod matcher with name NAME. The
  20250. 'methods' attribute is initialized to 'None'.
  20251. -- Function: XMethodMatcher.match (self, class_type, method_name)
  20252. Derived classes should override this method. It should return a
  20253. xmethod worker object (or a sequence of xmethod worker objects)
  20254. matching the CLASS_TYPE and METHOD_NAME. CLASS_TYPE is a
  20255. 'gdb.Type' object, and METHOD_NAME is a string value. If the
  20256. matcher manages named methods as listed in its 'methods' attribute,
  20257. then only those worker objects whose corresponding entries in the
  20258. 'methods' list are enabled should be returned.
  20259. An xmethod worker should be an instance of a class derived from
  20260. 'XMethodWorker' defined in the module 'gdb.xmethod', or support the
  20261. following interface:
  20262. -- Function: XMethodWorker.get_arg_types (self)
  20263. This method returns a sequence of 'gdb.Type' objects corresponding
  20264. to the arguments that the xmethod takes. It can return an empty
  20265. sequence or 'None' if the xmethod does not take any arguments. If
  20266. the xmethod takes a single argument, then a single 'gdb.Type'
  20267. object corresponding to it can be returned.
  20268. -- Function: XMethodWorker.get_result_type (self, *args)
  20269. This method returns a 'gdb.Type' object representing the type of
  20270. the result of invoking this xmethod. The ARGS argument is the same
  20271. tuple of arguments that would be passed to the '__call__' method of
  20272. this worker.
  20273. -- Function: XMethodWorker.__call__ (self, *args)
  20274. This is the method which does the _work_ of the xmethod. The ARGS
  20275. arguments is the tuple of arguments to the xmethod. Each element
  20276. in this tuple is a gdb.Value object. The first element is always
  20277. the 'this' pointer value.
  20278. For GDB to lookup xmethods, the xmethod matchers should be registered
  20279. using the following function defined in the module 'gdb.xmethod':
  20280. -- Function: register_xmethod_matcher (locus, matcher, replace=False)
  20281. The 'matcher' is registered with 'locus', replacing an existing
  20282. matcher with the same name as 'matcher' if 'replace' is 'True'.
  20283. 'locus' can be a 'gdb.Objfile' object (*note Objfiles In Python::),
  20284. or a 'gdb.Progspace' object (*note Progspaces In Python::), or
  20285. 'None'. If it is 'None', then 'matcher' is registered globally.
  20286. 
  20287. File: gdb.info, Node: Writing an Xmethod, Next: Inferiors In Python, Prev: Xmethod API, Up: Python API
  20288. 23.2.2.15 Writing an Xmethod
  20289. ............................
  20290. Implementing xmethods in Python will require implementing xmethod
  20291. matchers and xmethod workers (*note Xmethods In Python::). Consider the
  20292. following C++ class:
  20293. class MyClass
  20294. {
  20295. public:
  20296. MyClass (int a) : a_(a) { }
  20297. int geta (void) { return a_; }
  20298. int operator+ (int b);
  20299. private:
  20300. int a_;
  20301. };
  20302. int
  20303. MyClass::operator+ (int b)
  20304. {
  20305. return a_ + b;
  20306. }
  20307. Let us define two xmethods for the class 'MyClass', one replacing the
  20308. method 'geta', and another adding an overloaded flavor of 'operator+'
  20309. which takes a 'MyClass' argument (the C++ code above already has an
  20310. overloaded 'operator+' which takes an 'int' argument). The xmethod
  20311. matcher can be defined as follows:
  20312. class MyClass_geta(gdb.xmethod.XMethod):
  20313. def __init__(self):
  20314. gdb.xmethod.XMethod.__init__(self, 'geta')
  20315. def get_worker(self, method_name):
  20316. if method_name == 'geta':
  20317. return MyClassWorker_geta()
  20318. class MyClass_sum(gdb.xmethod.XMethod):
  20319. def __init__(self):
  20320. gdb.xmethod.XMethod.__init__(self, 'sum')
  20321. def get_worker(self, method_name):
  20322. if method_name == 'operator+':
  20323. return MyClassWorker_plus()
  20324. class MyClassMatcher(gdb.xmethod.XMethodMatcher):
  20325. def __init__(self):
  20326. gdb.xmethod.XMethodMatcher.__init__(self, 'MyClassMatcher')
  20327. # List of methods 'managed' by this matcher
  20328. self.methods = [MyClass_geta(), MyClass_sum()]
  20329. def match(self, class_type, method_name):
  20330. if class_type.tag != 'MyClass':
  20331. return None
  20332. workers = []
  20333. for method in self.methods:
  20334. if method.enabled:
  20335. worker = method.get_worker(method_name)
  20336. if worker:
  20337. workers.append(worker)
  20338. return workers
  20339. Notice that the 'match' method of 'MyClassMatcher' returns a worker
  20340. object of type 'MyClassWorker_geta' for the 'geta' method, and a worker
  20341. object of type 'MyClassWorker_plus' for the 'operator+' method. This is
  20342. done indirectly via helper classes derived from 'gdb.xmethod.XMethod'.
  20343. One does not need to use the 'methods' attribute in a matcher as it is
  20344. optional. However, if a matcher manages more than one xmethod, it is a
  20345. good practice to list the xmethods in the 'methods' attribute of the
  20346. matcher. This will then facilitate enabling and disabling individual
  20347. xmethods via the 'enable/disable' commands. Notice also that a worker
  20348. object is returned only if the corresponding entry in the 'methods'
  20349. attribute of the matcher is enabled.
  20350. The implementation of the worker classes returned by the matcher
  20351. setup above is as follows:
  20352. class MyClassWorker_geta(gdb.xmethod.XMethodWorker):
  20353. def get_arg_types(self):
  20354. return None
  20355. def get_result_type(self, obj):
  20356. return gdb.lookup_type('int')
  20357. def __call__(self, obj):
  20358. return obj['a_']
  20359. class MyClassWorker_plus(gdb.xmethod.XMethodWorker):
  20360. def get_arg_types(self):
  20361. return gdb.lookup_type('MyClass')
  20362. def get_result_type(self, obj):
  20363. return gdb.lookup_type('int')
  20364. def __call__(self, obj, other):
  20365. return obj['a_'] + other['a_']
  20366. For GDB to actually lookup a xmethod, it has to be registered with
  20367. it. The matcher defined above is registered with GDB globally as
  20368. follows:
  20369. gdb.xmethod.register_xmethod_matcher(None, MyClassMatcher())
  20370. If an object 'obj' of type 'MyClass' is initialized in C++ code as
  20371. follows:
  20372. MyClass obj(5);
  20373. then, after loading the Python script defining the xmethod matchers and
  20374. workers into 'GDBN', invoking the method 'geta' or using the operator
  20375. '+' on 'obj' will invoke the xmethods defined above:
  20376. (gdb) p obj.geta()
  20377. $1 = 5
  20378. (gdb) p obj + obj
  20379. $2 = 10
  20380. Consider another example with a C++ template class:
  20381. template <class T>
  20382. class MyTemplate
  20383. {
  20384. public:
  20385. MyTemplate () : dsize_(10), data_ (new T [10]) { }
  20386. ~MyTemplate () { delete [] data_; }
  20387. int footprint (void)
  20388. {
  20389. return sizeof (T) * dsize_ + sizeof (MyTemplate<T>);
  20390. }
  20391. private:
  20392. int dsize_;
  20393. T *data_;
  20394. };
  20395. Let us implement an xmethod for the above class which serves as a
  20396. replacement for the 'footprint' method. The full code listing of the
  20397. xmethod workers and xmethod matchers is as follows:
  20398. class MyTemplateWorker_footprint(gdb.xmethod.XMethodWorker):
  20399. def __init__(self, class_type):
  20400. self.class_type = class_type
  20401. def get_arg_types(self):
  20402. return None
  20403. def get_result_type(self):
  20404. return gdb.lookup_type('int')
  20405. def __call__(self, obj):
  20406. return (self.class_type.sizeof +
  20407. obj['dsize_'] *
  20408. self.class_type.template_argument(0).sizeof)
  20409. class MyTemplateMatcher_footprint(gdb.xmethod.XMethodMatcher):
  20410. def __init__(self):
  20411. gdb.xmethod.XMethodMatcher.__init__(self, 'MyTemplateMatcher')
  20412. def match(self, class_type, method_name):
  20413. if (re.match('MyTemplate<[ \t\n]*[_a-zA-Z][ _a-zA-Z0-9]*>',
  20414. class_type.tag) and
  20415. method_name == 'footprint'):
  20416. return MyTemplateWorker_footprint(class_type)
  20417. Notice that, in this example, we have not used the 'methods'
  20418. attribute of the matcher as the matcher manages only one xmethod. The
  20419. user can enable/disable this xmethod by enabling/disabling the matcher
  20420. itself.
  20421. 
  20422. File: gdb.info, Node: Inferiors In Python, Next: Events In Python, Prev: Writing an Xmethod, Up: Python API
  20423. 23.2.2.16 Inferiors In Python
  20424. .............................
  20425. Programs which are being run under GDB are called inferiors (*note
  20426. Inferiors Connections and Programs::). Python scripts can access
  20427. information about and manipulate inferiors controlled by GDB via objects
  20428. of the 'gdb.Inferior' class.
  20429. The following inferior-related functions are available in the 'gdb'
  20430. module:
  20431. -- Function: gdb.inferiors ()
  20432. Return a tuple containing all inferior objects.
  20433. -- Function: gdb.selected_inferior ()
  20434. Return an object representing the current inferior.
  20435. A 'gdb.Inferior' object has the following attributes:
  20436. -- Variable: Inferior.num
  20437. ID of inferior, as assigned by GDB.
  20438. -- Variable: Inferior.pid
  20439. Process ID of the inferior, as assigned by the underlying operating
  20440. system.
  20441. -- Variable: Inferior.was_attached
  20442. Boolean signaling whether the inferior was created using 'attach',
  20443. or started by GDB itself.
  20444. -- Variable: Inferior.progspace
  20445. The inferior's program space. *Note Progspaces In Python::.
  20446. A 'gdb.Inferior' object has the following methods:
  20447. -- Function: Inferior.is_valid ()
  20448. Returns 'True' if the 'gdb.Inferior' object is valid, 'False' if
  20449. not. A 'gdb.Inferior' object will become invalid if the inferior
  20450. no longer exists within GDB. All other 'gdb.Inferior' methods will
  20451. throw an exception if it is invalid at the time the method is
  20452. called.
  20453. -- Function: Inferior.threads ()
  20454. This method returns a tuple holding all the threads which are valid
  20455. when it is called. If there are no valid threads, the method will
  20456. return an empty tuple.
  20457. -- Function: Inferior.architecture ()
  20458. Return the 'gdb.Architecture' (*note Architectures In Python::) for
  20459. this inferior. This represents the architecture of the inferior as
  20460. a whole. Some platforms can have multiple architectures in a
  20461. single address space, so this may not match the architecture of a
  20462. particular frame (*note Frames In Python::).
  20463. -- Function: Inferior.read_memory (address, length)
  20464. Read LENGTH addressable memory units from the inferior, starting at
  20465. ADDRESS. Returns a buffer object, which behaves much like an array
  20466. or a string. It can be modified and given to the
  20467. 'Inferior.write_memory' function. In Python 3, the return value is
  20468. a 'memoryview' object.
  20469. -- Function: Inferior.write_memory (address, buffer [, length])
  20470. Write the contents of BUFFER to the inferior, starting at ADDRESS.
  20471. The BUFFER parameter must be a Python object which supports the
  20472. buffer protocol, i.e., a string, an array or the object returned
  20473. from 'Inferior.read_memory'. If given, LENGTH determines the
  20474. number of addressable memory units from BUFFER to be written.
  20475. -- Function: Inferior.search_memory (address, length, pattern)
  20476. Search a region of the inferior memory starting at ADDRESS with the
  20477. given LENGTH using the search pattern supplied in PATTERN. The
  20478. PATTERN parameter must be a Python object which supports the buffer
  20479. protocol, i.e., a string, an array or the object returned from
  20480. 'gdb.read_memory'. Returns a Python 'Long' containing the address
  20481. where the pattern was found, or 'None' if the pattern could not be
  20482. found.
  20483. -- Function: Inferior.thread_from_handle (handle)
  20484. Return the thread object corresponding to HANDLE, a thread library
  20485. specific data structure such as 'pthread_t' for pthreads library
  20486. implementations.
  20487. The function 'Inferior.thread_from_thread_handle' provides the same
  20488. functionality, but use of 'Inferior.thread_from_thread_handle' is
  20489. deprecated.
  20490. 
  20491. File: gdb.info, Node: Events In Python, Next: Threads In Python, Prev: Inferiors In Python, Up: Python API
  20492. 23.2.2.17 Events In Python
  20493. ..........................
  20494. GDB provides a general event facility so that Python code can be
  20495. notified of various state changes, particularly changes that occur in
  20496. the inferior.
  20497. An "event" is just an object that describes some state change. The
  20498. type of the object and its attributes will vary depending on the details
  20499. of the change. All the existing events are described below.
  20500. In order to be notified of an event, you must register an event
  20501. handler with an "event registry". An event registry is an object in the
  20502. 'gdb.events' module which dispatches particular events. A registry
  20503. provides methods to register and unregister event handlers:
  20504. -- Function: EventRegistry.connect (object)
  20505. Add the given callable OBJECT to the registry. This object will be
  20506. called when an event corresponding to this registry occurs.
  20507. -- Function: EventRegistry.disconnect (object)
  20508. Remove the given OBJECT from the registry. Once removed, the
  20509. object will no longer receive notifications of events.
  20510. Here is an example:
  20511. def exit_handler (event):
  20512. print "event type: exit"
  20513. print "exit code: %d" % (event.exit_code)
  20514. gdb.events.exited.connect (exit_handler)
  20515. In the above example we connect our handler 'exit_handler' to the
  20516. registry 'events.exited'. Once connected, 'exit_handler' gets called
  20517. when the inferior exits. The argument "event" in this example is of
  20518. type 'gdb.ExitedEvent'. As you can see in the example the 'ExitedEvent'
  20519. object has an attribute which indicates the exit code of the inferior.
  20520. The following is a listing of the event registries that are available
  20521. and details of the events they emit:
  20522. 'events.cont'
  20523. Emits 'gdb.ThreadEvent'.
  20524. Some events can be thread specific when GDB is running in non-stop
  20525. mode. When represented in Python, these events all extend
  20526. 'gdb.ThreadEvent'. Note, this event is not emitted directly;
  20527. instead, events which are emitted by this or other modules might
  20528. extend this event. Examples of these events are
  20529. 'gdb.BreakpointEvent' and 'gdb.ContinueEvent'.
  20530. -- Variable: ThreadEvent.inferior_thread
  20531. In non-stop mode this attribute will be set to the specific
  20532. thread which was involved in the emitted event. Otherwise, it
  20533. will be set to 'None'.
  20534. Emits 'gdb.ContinueEvent' which extends 'gdb.ThreadEvent'.
  20535. This event indicates that the inferior has been continued after a
  20536. stop. For inherited attribute refer to 'gdb.ThreadEvent' above.
  20537. 'events.exited'
  20538. Emits 'events.ExitedEvent' which indicates that the inferior has
  20539. exited. 'events.ExitedEvent' has two attributes:
  20540. -- Variable: ExitedEvent.exit_code
  20541. An integer representing the exit code, if available, which the
  20542. inferior has returned. (The exit code could be unavailable
  20543. if, for example, GDB detaches from the inferior.) If the exit
  20544. code is unavailable, the attribute does not exist.
  20545. -- Variable: ExitedEvent.inferior
  20546. A reference to the inferior which triggered the 'exited'
  20547. event.
  20548. 'events.stop'
  20549. Emits 'gdb.StopEvent' which extends 'gdb.ThreadEvent'.
  20550. Indicates that the inferior has stopped. All events emitted by
  20551. this registry extend StopEvent. As a child of 'gdb.ThreadEvent',
  20552. 'gdb.StopEvent' will indicate the stopped thread when GDB is
  20553. running in non-stop mode. Refer to 'gdb.ThreadEvent' above for
  20554. more details.
  20555. Emits 'gdb.SignalEvent' which extends 'gdb.StopEvent'.
  20556. This event indicates that the inferior or one of its threads has
  20557. received as signal. 'gdb.SignalEvent' has the following
  20558. attributes:
  20559. -- Variable: SignalEvent.stop_signal
  20560. A string representing the signal received by the inferior. A
  20561. list of possible signal values can be obtained by running the
  20562. command 'info signals' in the GDB command prompt.
  20563. Also emits 'gdb.BreakpointEvent' which extends 'gdb.StopEvent'.
  20564. 'gdb.BreakpointEvent' event indicates that one or more breakpoints
  20565. have been hit, and has the following attributes:
  20566. -- Variable: BreakpointEvent.breakpoints
  20567. A sequence containing references to all the breakpoints (type
  20568. 'gdb.Breakpoint') that were hit. *Note Breakpoints In
  20569. Python::, for details of the 'gdb.Breakpoint' object.
  20570. -- Variable: BreakpointEvent.breakpoint
  20571. A reference to the first breakpoint that was hit. This
  20572. function is maintained for backward compatibility and is now
  20573. deprecated in favor of the 'gdb.BreakpointEvent.breakpoints'
  20574. attribute.
  20575. 'events.new_objfile'
  20576. Emits 'gdb.NewObjFileEvent' which indicates that a new object file
  20577. has been loaded by GDB. 'gdb.NewObjFileEvent' has one attribute:
  20578. -- Variable: NewObjFileEvent.new_objfile
  20579. A reference to the object file ('gdb.Objfile') which has been
  20580. loaded. *Note Objfiles In Python::, for details of the
  20581. 'gdb.Objfile' object.
  20582. 'events.clear_objfiles'
  20583. Emits 'gdb.ClearObjFilesEvent' which indicates that the list of
  20584. object files for a program space has been reset.
  20585. 'gdb.ClearObjFilesEvent' has one attribute:
  20586. -- Variable: ClearObjFilesEvent.progspace
  20587. A reference to the program space ('gdb.Progspace') whose
  20588. objfile list has been cleared. *Note Progspaces In Python::.
  20589. 'events.inferior_call'
  20590. Emits events just before and after a function in the inferior is
  20591. called by GDB. Before an inferior call, this emits an event of
  20592. type 'gdb.InferiorCallPreEvent', and after an inferior call, this
  20593. emits an event of type 'gdb.InferiorCallPostEvent'.
  20594. 'gdb.InferiorCallPreEvent'
  20595. Indicates that a function in the inferior is about to be
  20596. called.
  20597. -- Variable: InferiorCallPreEvent.ptid
  20598. The thread in which the call will be run.
  20599. -- Variable: InferiorCallPreEvent.address
  20600. The location of the function to be called.
  20601. 'gdb.InferiorCallPostEvent'
  20602. Indicates that a function in the inferior has just been
  20603. called.
  20604. -- Variable: InferiorCallPostEvent.ptid
  20605. The thread in which the call was run.
  20606. -- Variable: InferiorCallPostEvent.address
  20607. The location of the function that was called.
  20608. 'events.memory_changed'
  20609. Emits 'gdb.MemoryChangedEvent' which indicates that the memory of
  20610. the inferior has been modified by the GDB user, for instance via a
  20611. command like 'set *addr = value'. The event has the following
  20612. attributes:
  20613. -- Variable: MemoryChangedEvent.address
  20614. The start address of the changed region.
  20615. -- Variable: MemoryChangedEvent.length
  20616. Length in bytes of the changed region.
  20617. 'events.register_changed'
  20618. Emits 'gdb.RegisterChangedEvent' which indicates that a register in
  20619. the inferior has been modified by the GDB user.
  20620. -- Variable: RegisterChangedEvent.frame
  20621. A gdb.Frame object representing the frame in which the
  20622. register was modified.
  20623. -- Variable: RegisterChangedEvent.regnum
  20624. Denotes which register was modified.
  20625. 'events.breakpoint_created'
  20626. This is emitted when a new breakpoint has been created. The
  20627. argument that is passed is the new 'gdb.Breakpoint' object.
  20628. 'events.breakpoint_modified'
  20629. This is emitted when a breakpoint has been modified in some way.
  20630. The argument that is passed is the new 'gdb.Breakpoint' object.
  20631. 'events.breakpoint_deleted'
  20632. This is emitted when a breakpoint has been deleted. The argument
  20633. that is passed is the 'gdb.Breakpoint' object. When this event is
  20634. emitted, the 'gdb.Breakpoint' object will already be in its invalid
  20635. state; that is, the 'is_valid' method will return 'False'.
  20636. 'events.before_prompt'
  20637. This event carries no payload. It is emitted each time GDB
  20638. presents a prompt to the user.
  20639. 'events.new_inferior'
  20640. This is emitted when a new inferior is created. Note that the
  20641. inferior is not necessarily running; in fact, it may not even have
  20642. an associated executable.
  20643. The event is of type 'gdb.NewInferiorEvent'. This has a single
  20644. attribute:
  20645. -- Variable: NewInferiorEvent.inferior
  20646. The new inferior, a 'gdb.Inferior' object.
  20647. 'events.inferior_deleted'
  20648. This is emitted when an inferior has been deleted. Note that this
  20649. is not the same as process exit; it is notified when the inferior
  20650. itself is removed, say via 'remove-inferiors'.
  20651. The event is of type 'gdb.InferiorDeletedEvent'. This has a single
  20652. attribute:
  20653. -- Variable: NewInferiorEvent.inferior
  20654. The inferior that is being removed, a 'gdb.Inferior' object.
  20655. 'events.new_thread'
  20656. This is emitted when GDB notices a new thread. The event is of
  20657. type 'gdb.NewThreadEvent', which extends 'gdb.ThreadEvent'. This
  20658. has a single attribute:
  20659. -- Variable: NewThreadEvent.inferior_thread
  20660. The new thread.
  20661. 
  20662. File: gdb.info, Node: Threads In Python, Next: Recordings In Python, Prev: Events In Python, Up: Python API
  20663. 23.2.2.18 Threads In Python
  20664. ...........................
  20665. Python scripts can access information about, and manipulate inferior
  20666. threads controlled by GDB, via objects of the 'gdb.InferiorThread'
  20667. class.
  20668. The following thread-related functions are available in the 'gdb'
  20669. module:
  20670. -- Function: gdb.selected_thread ()
  20671. This function returns the thread object for the selected thread.
  20672. If there is no selected thread, this will return 'None'.
  20673. To get the list of threads for an inferior, use the
  20674. 'Inferior.threads()' method. *Note Inferiors In Python::.
  20675. A 'gdb.InferiorThread' object has the following attributes:
  20676. -- Variable: InferiorThread.name
  20677. The name of the thread. If the user specified a name using 'thread
  20678. name', then this returns that name. Otherwise, if an OS-supplied
  20679. name is available, then it is returned. Otherwise, this returns
  20680. 'None'.
  20681. This attribute can be assigned to. The new value must be a string
  20682. object, which sets the new name, or 'None', which removes any
  20683. user-specified thread name.
  20684. -- Variable: InferiorThread.num
  20685. The per-inferior number of the thread, as assigned by GDB.
  20686. -- Variable: InferiorThread.global_num
  20687. The global ID of the thread, as assigned by GDB. You can use this
  20688. to make Python breakpoints thread-specific, for example (*note The
  20689. Breakpoint.thread attribute: python_breakpoint_thread.).
  20690. -- Variable: InferiorThread.ptid
  20691. ID of the thread, as assigned by the operating system. This
  20692. attribute is a tuple containing three integers. The first is the
  20693. Process ID (PID); the second is the Lightweight Process ID (LWPID),
  20694. and the third is the Thread ID (TID). Either the LWPID or TID may
  20695. be 0, which indicates that the operating system does not use that
  20696. identifier.
  20697. -- Variable: InferiorThread.inferior
  20698. The inferior this thread belongs to. This attribute is represented
  20699. as a 'gdb.Inferior' object. This attribute is not writable.
  20700. A 'gdb.InferiorThread' object has the following methods:
  20701. -- Function: InferiorThread.is_valid ()
  20702. Returns 'True' if the 'gdb.InferiorThread' object is valid, 'False'
  20703. if not. A 'gdb.InferiorThread' object will become invalid if the
  20704. thread exits, or the inferior that the thread belongs is deleted.
  20705. All other 'gdb.InferiorThread' methods will throw an exception if
  20706. it is invalid at the time the method is called.
  20707. -- Function: InferiorThread.switch ()
  20708. This changes GDB's currently selected thread to the one represented
  20709. by this object.
  20710. -- Function: InferiorThread.is_stopped ()
  20711. Return a Boolean indicating whether the thread is stopped.
  20712. -- Function: InferiorThread.is_running ()
  20713. Return a Boolean indicating whether the thread is running.
  20714. -- Function: InferiorThread.is_exited ()
  20715. Return a Boolean indicating whether the thread is exited.
  20716. -- Function: InferiorThread.handle ()
  20717. Return the thread object's handle, represented as a Python 'bytes'
  20718. object. A 'gdb.Value' representation of the handle may be
  20719. constructed via 'gdb.Value(bufobj, type)' where BUFOBJ is the
  20720. Python 'bytes' representation of the handle and TYPE is a
  20721. 'gdb.Type' for the handle type.
  20722. 
  20723. File: gdb.info, Node: Recordings In Python, Next: Commands In Python, Prev: Threads In Python, Up: Python API
  20724. 23.2.2.19 Recordings In Python
  20725. ..............................
  20726. The following recordings-related functions (*note Process Record and
  20727. Replay::) are available in the 'gdb' module:
  20728. -- Function: gdb.start_recording ([method], [format])
  20729. Start a recording using the given METHOD and FORMAT. If no FORMAT
  20730. is given, the default format for the recording method is used. If
  20731. no METHOD is given, the default method will be used. Returns a
  20732. 'gdb.Record' object on success. Throw an exception on failure.
  20733. The following strings can be passed as METHOD:
  20734. * '"full"'
  20735. * '"btrace"': Possible values for FORMAT: '"pt"', '"bts"' or
  20736. leave out for default format.
  20737. -- Function: gdb.current_recording ()
  20738. Access a currently running recording. Return a 'gdb.Record' object
  20739. on success. Return 'None' if no recording is currently active.
  20740. -- Function: gdb.stop_recording ()
  20741. Stop the current recording. Throw an exception if no recording is
  20742. currently active. All record objects become invalid after this
  20743. call.
  20744. A 'gdb.Record' object has the following attributes:
  20745. -- Variable: Record.method
  20746. A string with the current recording method, e.g. 'full' or
  20747. 'btrace'.
  20748. -- Variable: Record.format
  20749. A string with the current recording format, e.g. 'bt', 'pts' or
  20750. 'None'.
  20751. -- Variable: Record.begin
  20752. A method specific instruction object representing the first
  20753. instruction in this recording.
  20754. -- Variable: Record.end
  20755. A method specific instruction object representing the current
  20756. instruction, that is not actually part of the recording.
  20757. -- Variable: Record.replay_position
  20758. The instruction representing the current replay position. If there
  20759. is no replay active, this will be 'None'.
  20760. -- Variable: Record.instruction_history
  20761. A list with all recorded instructions.
  20762. -- Variable: Record.function_call_history
  20763. A list with all recorded function call segments.
  20764. A 'gdb.Record' object has the following methods:
  20765. -- Function: Record.goto (instruction)
  20766. Move the replay position to the given INSTRUCTION.
  20767. The common 'gdb.Instruction' class that recording method specific
  20768. instruction objects inherit from, has the following attributes:
  20769. -- Variable: Instruction.pc
  20770. An integer representing this instruction's address.
  20771. -- Variable: Instruction.data
  20772. A buffer with the raw instruction data. In Python 3, the return
  20773. value is a 'memoryview' object.
  20774. -- Variable: Instruction.decoded
  20775. A human readable string with the disassembled instruction.
  20776. -- Variable: Instruction.size
  20777. The size of the instruction in bytes.
  20778. Additionally 'gdb.RecordInstruction' has the following attributes:
  20779. -- Variable: RecordInstruction.number
  20780. An integer identifying this instruction. 'number' corresponds to
  20781. the numbers seen in 'record instruction-history' (*note Process
  20782. Record and Replay::).
  20783. -- Variable: RecordInstruction.sal
  20784. A 'gdb.Symtab_and_line' object representing the associated symtab
  20785. and line of this instruction. May be 'None' if no debug
  20786. information is available.
  20787. -- Variable: RecordInstruction.is_speculative
  20788. A boolean indicating whether the instruction was executed
  20789. speculatively.
  20790. If an error occured during recording or decoding a recording, this
  20791. error is represented by a 'gdb.RecordGap' object in the instruction
  20792. list. It has the following attributes:
  20793. -- Variable: RecordGap.number
  20794. An integer identifying this gap. 'number' corresponds to the
  20795. numbers seen in 'record instruction-history' (*note Process Record
  20796. and Replay::).
  20797. -- Variable: RecordGap.error_code
  20798. A numerical representation of the reason for the gap. The value is
  20799. specific to the current recording method.
  20800. -- Variable: RecordGap.error_string
  20801. A human readable string with the reason for the gap.
  20802. A 'gdb.RecordFunctionSegment' object has the following attributes:
  20803. -- Variable: RecordFunctionSegment.number
  20804. An integer identifying this function segment. 'number' corresponds
  20805. to the numbers seen in 'record function-call-history' (*note
  20806. Process Record and Replay::).
  20807. -- Variable: RecordFunctionSegment.symbol
  20808. A 'gdb.Symbol' object representing the associated symbol. May be
  20809. 'None' if no debug information is available.
  20810. -- Variable: RecordFunctionSegment.level
  20811. An integer representing the function call's stack level. May be
  20812. 'None' if the function call is a gap.
  20813. -- Variable: RecordFunctionSegment.instructions
  20814. A list of 'gdb.RecordInstruction' or 'gdb.RecordGap' objects
  20815. associated with this function call.
  20816. -- Variable: RecordFunctionSegment.up
  20817. A 'gdb.RecordFunctionSegment' object representing the caller's
  20818. function segment. If the call has not been recorded, this will be
  20819. the function segment to which control returns. If neither the call
  20820. nor the return have been recorded, this will be 'None'.
  20821. -- Variable: RecordFunctionSegment.prev
  20822. A 'gdb.RecordFunctionSegment' object representing the previous
  20823. segment of this function call. May be 'None'.
  20824. -- Variable: RecordFunctionSegment.next
  20825. A 'gdb.RecordFunctionSegment' object representing the next segment
  20826. of this function call. May be 'None'.
  20827. The following example demonstrates the usage of these objects and
  20828. functions to create a function that will rewind a record to the last
  20829. time a function in a different file was executed. This would typically
  20830. be used to track the execution of user provided callback functions in a
  20831. library which typically are not visible in a back trace.
  20832. def bringback ():
  20833. rec = gdb.current_recording ()
  20834. if not rec:
  20835. return
  20836. insn = rec.instruction_history
  20837. if len (insn) == 0:
  20838. return
  20839. try:
  20840. position = insn.index (rec.replay_position)
  20841. except:
  20842. position = -1
  20843. try:
  20844. filename = insn[position].sal.symtab.fullname ()
  20845. except:
  20846. filename = None
  20847. for i in reversed (insn[:position]):
  20848. try:
  20849. current = i.sal.symtab.fullname ()
  20850. except:
  20851. current = None
  20852. if filename == current:
  20853. continue
  20854. rec.goto (i)
  20855. return
  20856. Another possible application is to write a function that counts the
  20857. number of code executions in a given line range. This line range can
  20858. contain parts of functions or span across several functions and is not
  20859. limited to be contiguous.
  20860. def countrange (filename, linerange):
  20861. count = 0
  20862. def filter_only (file_name):
  20863. for call in gdb.current_recording ().function_call_history:
  20864. try:
  20865. if file_name in call.symbol.symtab.fullname ():
  20866. yield call
  20867. except:
  20868. pass
  20869. for c in filter_only (filename):
  20870. for i in c.instructions:
  20871. try:
  20872. if i.sal.line in linerange:
  20873. count += 1
  20874. break;
  20875. except:
  20876. pass
  20877. return count
  20878. 
  20879. File: gdb.info, Node: Commands In Python, Next: Parameters In Python, Prev: Recordings In Python, Up: Python API
  20880. 23.2.2.20 Commands In Python
  20881. ............................
  20882. You can implement new GDB CLI commands in Python. A CLI command is
  20883. implemented using an instance of the 'gdb.Command' class, most commonly
  20884. using a subclass.
  20885. -- Function: Command.__init__ (name, COMMAND_CLASS [, COMPLETER_CLASS
  20886. [, PREFIX]])
  20887. The object initializer for 'Command' registers the new command with
  20888. GDB. This initializer is normally invoked from the subclass' own
  20889. '__init__' method.
  20890. NAME is the name of the command. If NAME consists of multiple
  20891. words, then the initial words are looked for as prefix commands.
  20892. In this case, if one of the prefix commands does not exist, an
  20893. exception is raised.
  20894. There is no support for multi-line commands.
  20895. COMMAND_CLASS should be one of the 'COMMAND_' constants defined
  20896. below. This argument tells GDB how to categorize the new command
  20897. in the help system.
  20898. COMPLETER_CLASS is an optional argument. If given, it should be
  20899. one of the 'COMPLETE_' constants defined below. This argument
  20900. tells GDB how to perform completion for this command. If not
  20901. given, GDB will attempt to complete using the object's 'complete'
  20902. method (see below); if no such method is found, an error will occur
  20903. when completion is attempted.
  20904. PREFIX is an optional argument. If 'True', then the new command is
  20905. a prefix command; sub-commands of this command may be registered.
  20906. The help text for the new command is taken from the Python
  20907. documentation string for the command's class, if there is one. If
  20908. no documentation string is provided, the default value "This
  20909. command is not documented." is used.
  20910. -- Function: Command.dont_repeat ()
  20911. By default, a GDB command is repeated when the user enters a blank
  20912. line at the command prompt. A command can suppress this behavior
  20913. by invoking the 'dont_repeat' method. This is similar to the user
  20914. command 'dont-repeat', see *note dont-repeat: Define.
  20915. -- Function: Command.invoke (argument, from_tty)
  20916. This method is called by GDB when this command is invoked.
  20917. ARGUMENT is a string. It is the argument to the command, after
  20918. leading and trailing whitespace has been stripped.
  20919. FROM_TTY is a boolean argument. When true, this means that the
  20920. command was entered by the user at the terminal; when false it
  20921. means that the command came from elsewhere.
  20922. If this method throws an exception, it is turned into a GDB 'error'
  20923. call. Otherwise, the return value is ignored.
  20924. To break ARGUMENT up into an argv-like string use
  20925. 'gdb.string_to_argv'. This function behaves identically to GDB's
  20926. internal argument lexer 'buildargv'. It is recommended to use this
  20927. for consistency. Arguments are separated by spaces and may be
  20928. quoted. Example:
  20929. print gdb.string_to_argv ("1 2\ \\\"3 '4 \"5' \"6 '7\"")
  20930. ['1', '2 "3', '4 "5', "6 '7"]
  20931. -- Function: Command.complete (text, word)
  20932. This method is called by GDB when the user attempts completion on
  20933. this command. All forms of completion are handled by this method,
  20934. that is, the <TAB> and <M-?> key bindings (*note Completion::), and
  20935. the 'complete' command (*note complete: Help.).
  20936. The arguments TEXT and WORD are both strings; TEXT holds the
  20937. complete command line up to the cursor's location, while WORD holds
  20938. the last word of the command line; this is computed using a
  20939. word-breaking heuristic.
  20940. The 'complete' method can return several values:
  20941. * If the return value is a sequence, the contents of the
  20942. sequence are used as the completions. It is up to 'complete'
  20943. to ensure that the contents actually do complete the word. A
  20944. zero-length sequence is allowed, it means that there were no
  20945. completions available. Only string elements of the sequence
  20946. are used; other elements in the sequence are ignored.
  20947. * If the return value is one of the 'COMPLETE_' constants
  20948. defined below, then the corresponding GDB-internal completion
  20949. function is invoked, and its result is used.
  20950. * All other results are treated as though there were no
  20951. available completions.
  20952. When a new command is registered, it must be declared as a member of
  20953. some general class of commands. This is used to classify top-level
  20954. commands in the on-line help system; note that prefix commands are not
  20955. listed under their own category but rather that of their top-level
  20956. command. The available classifications are represented by constants
  20957. defined in the 'gdb' module:
  20958. 'gdb.COMMAND_NONE'
  20959. The command does not belong to any particular class. A command in
  20960. this category will not be displayed in any of the help categories.
  20961. 'gdb.COMMAND_RUNNING'
  20962. The command is related to running the inferior. For example,
  20963. 'start', 'step', and 'continue' are in this category. Type 'help
  20964. running' at the GDB prompt to see a list of commands in this
  20965. category.
  20966. 'gdb.COMMAND_DATA'
  20967. The command is related to data or variables. For example, 'call',
  20968. 'find', and 'print' are in this category. Type 'help data' at the
  20969. GDB prompt to see a list of commands in this category.
  20970. 'gdb.COMMAND_STACK'
  20971. The command has to do with manipulation of the stack. For example,
  20972. 'backtrace', 'frame', and 'return' are in this category. Type
  20973. 'help stack' at the GDB prompt to see a list of commands in this
  20974. category.
  20975. 'gdb.COMMAND_FILES'
  20976. This class is used for file-related commands. For example, 'file',
  20977. 'list' and 'section' are in this category. Type 'help files' at
  20978. the GDB prompt to see a list of commands in this category.
  20979. 'gdb.COMMAND_SUPPORT'
  20980. This should be used for "support facilities", generally meaning
  20981. things that are useful to the user when interacting with GDB, but
  20982. not related to the state of the inferior. For example, 'help',
  20983. 'make', and 'shell' are in this category. Type 'help support' at
  20984. the GDB prompt to see a list of commands in this category.
  20985. 'gdb.COMMAND_STATUS'
  20986. The command is an 'info'-related command, that is, related to the
  20987. state of GDB itself. For example, 'info', 'macro', and 'show' are
  20988. in this category. Type 'help status' at the GDB prompt to see a
  20989. list of commands in this category.
  20990. 'gdb.COMMAND_BREAKPOINTS'
  20991. The command has to do with breakpoints. For example, 'break',
  20992. 'clear', and 'delete' are in this category. Type 'help
  20993. breakpoints' at the GDB prompt to see a list of commands in this
  20994. category.
  20995. 'gdb.COMMAND_TRACEPOINTS'
  20996. The command has to do with tracepoints. For example, 'trace',
  20997. 'actions', and 'tfind' are in this category. Type 'help
  20998. tracepoints' at the GDB prompt to see a list of commands in this
  20999. category.
  21000. 'gdb.COMMAND_TUI'
  21001. The command has to do with the text user interface (*note TUI::).
  21002. Type 'help tui' at the GDB prompt to see a list of commands in this
  21003. category.
  21004. 'gdb.COMMAND_USER'
  21005. The command is a general purpose command for the user, and
  21006. typically does not fit in one of the other categories. Type 'help
  21007. user-defined' at the GDB prompt to see a list of commands in this
  21008. category, as well as the list of gdb macros (*note Sequences::).
  21009. 'gdb.COMMAND_OBSCURE'
  21010. The command is only used in unusual circumstances, or is not of
  21011. general interest to users. For example, 'checkpoint', 'fork', and
  21012. 'stop' are in this category. Type 'help obscure' at the GDB prompt
  21013. to see a list of commands in this category.
  21014. 'gdb.COMMAND_MAINTENANCE'
  21015. The command is only useful to GDB maintainers. The 'maintenance'
  21016. and 'flushregs' commands are in this category. Type 'help
  21017. internals' at the GDB prompt to see a list of commands in this
  21018. category.
  21019. A new command can use a predefined completion function, either by
  21020. specifying it via an argument at initialization, or by returning it from
  21021. the 'complete' method. These predefined completion constants are all
  21022. defined in the 'gdb' module:
  21023. 'gdb.COMPLETE_NONE'
  21024. This constant means that no completion should be done.
  21025. 'gdb.COMPLETE_FILENAME'
  21026. This constant means that filename completion should be performed.
  21027. 'gdb.COMPLETE_LOCATION'
  21028. This constant means that location completion should be done. *Note
  21029. Specify Location::.
  21030. 'gdb.COMPLETE_COMMAND'
  21031. This constant means that completion should examine GDB command
  21032. names.
  21033. 'gdb.COMPLETE_SYMBOL'
  21034. This constant means that completion should be done using symbol
  21035. names as the source.
  21036. 'gdb.COMPLETE_EXPRESSION'
  21037. This constant means that completion should be done on expressions.
  21038. Often this means completing on symbol names, but some language
  21039. parsers also have support for completing on field names.
  21040. The following code snippet shows how a trivial CLI command can be
  21041. implemented in Python:
  21042. class HelloWorld (gdb.Command):
  21043. """Greet the whole world."""
  21044. def __init__ (self):
  21045. super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
  21046. def invoke (self, arg, from_tty):
  21047. print "Hello, World!"
  21048. HelloWorld ()
  21049. The last line instantiates the class, and is necessary to trigger the
  21050. registration of the command with GDB. Depending on how the Python code
  21051. is read into GDB, you may need to import the 'gdb' module explicitly.
  21052. 
  21053. File: gdb.info, Node: Parameters In Python, Next: Functions In Python, Prev: Commands In Python, Up: Python API
  21054. 23.2.2.21 Parameters In Python
  21055. ..............................
  21056. You can implement new GDB parameters using Python. A new parameter is
  21057. implemented as an instance of the 'gdb.Parameter' class.
  21058. Parameters are exposed to the user via the 'set' and 'show' commands.
  21059. *Note Help::.
  21060. There are many parameters that already exist and can be set in GDB.
  21061. Two examples are: 'set follow fork' and 'set charset'. Setting these
  21062. parameters influences certain behavior in GDB. Similarly, you can
  21063. define parameters that can be used to influence behavior in custom
  21064. Python scripts and commands.
  21065. -- Function: Parameter.__init__ (name, COMMAND-CLASS, PARAMETER-CLASS
  21066. [, ENUM-SEQUENCE])
  21067. The object initializer for 'Parameter' registers the new parameter
  21068. with GDB. This initializer is normally invoked from the subclass'
  21069. own '__init__' method.
  21070. NAME is the name of the new parameter. If NAME consists of
  21071. multiple words, then the initial words are looked for as prefix
  21072. parameters. An example of this can be illustrated with the 'set
  21073. print' set of parameters. If NAME is 'print foo', then 'print'
  21074. will be searched as the prefix parameter. In this case the
  21075. parameter can subsequently be accessed in GDB as 'set print foo'.
  21076. If NAME consists of multiple words, and no prefix parameter group
  21077. can be found, an exception is raised.
  21078. COMMAND-CLASS should be one of the 'COMMAND_' constants (*note
  21079. Commands In Python::). This argument tells GDB how to categorize
  21080. the new parameter in the help system.
  21081. PARAMETER-CLASS should be one of the 'PARAM_' constants defined
  21082. below. This argument tells GDB the type of the new parameter; this
  21083. information is used for input validation and completion.
  21084. If PARAMETER-CLASS is 'PARAM_ENUM', then ENUM-SEQUENCE must be a
  21085. sequence of strings. These strings represent the possible values
  21086. for the parameter.
  21087. If PARAMETER-CLASS is not 'PARAM_ENUM', then the presence of a
  21088. fourth argument will cause an exception to be thrown.
  21089. The help text for the new parameter is taken from the Python
  21090. documentation string for the parameter's class, if there is one.
  21091. If there is no documentation string, a default value is used.
  21092. -- Variable: Parameter.set_doc
  21093. If this attribute exists, and is a string, then its value is used
  21094. as the help text for this parameter's 'set' command. The value is
  21095. examined when 'Parameter.__init__' is invoked; subsequent changes
  21096. have no effect.
  21097. -- Variable: Parameter.show_doc
  21098. If this attribute exists, and is a string, then its value is used
  21099. as the help text for this parameter's 'show' command. The value is
  21100. examined when 'Parameter.__init__' is invoked; subsequent changes
  21101. have no effect.
  21102. -- Variable: Parameter.value
  21103. The 'value' attribute holds the underlying value of the parameter.
  21104. It can be read and assigned to just as any other attribute. GDB
  21105. does validation when assignments are made.
  21106. There are two methods that may be implemented in any 'Parameter'
  21107. class. These are:
  21108. -- Function: Parameter.get_set_string (self)
  21109. If this method exists, GDB will call it when a PARAMETER's value
  21110. has been changed via the 'set' API (for example, 'set foo off').
  21111. The 'value' attribute has already been populated with the new value
  21112. and may be used in output. This method must return a string. If
  21113. the returned string is not empty, GDB will present it to the user.
  21114. If this method raises the 'gdb.GdbError' exception (*note Exception
  21115. Handling::), then GDB will print the exception's string and the
  21116. 'set' command will fail. Note, however, that the 'value' attribute
  21117. will not be reset in this case. So, if your parameter must
  21118. validate values, it should store the old value internally and reset
  21119. the exposed value, like so:
  21120. class ExampleParam (gdb.Parameter):
  21121. def __init__ (self, name):
  21122. super (ExampleParam, self).__init__ (name,
  21123. gdb.COMMAND_DATA,
  21124. gdb.PARAM_BOOLEAN)
  21125. self.value = True
  21126. self.saved_value = True
  21127. def validate(self):
  21128. return False
  21129. def get_set_string (self):
  21130. if not self.validate():
  21131. self.value = self.saved_value
  21132. raise gdb.GdbError('Failed to validate')
  21133. self.saved_value = self.value
  21134. -- Function: Parameter.get_show_string (self, svalue)
  21135. GDB will call this method when a PARAMETER's 'show' API has been
  21136. invoked (for example, 'show foo'). The argument 'svalue' receives
  21137. the string representation of the current value. This method must
  21138. return a string.
  21139. When a new parameter is defined, its type must be specified. The
  21140. available types are represented by constants defined in the 'gdb'
  21141. module:
  21142. 'gdb.PARAM_BOOLEAN'
  21143. The value is a plain boolean. The Python boolean values, 'True'
  21144. and 'False' are the only valid values.
  21145. 'gdb.PARAM_AUTO_BOOLEAN'
  21146. The value has three possible states: true, false, and 'auto'. In
  21147. Python, true and false are represented using boolean constants, and
  21148. 'auto' is represented using 'None'.
  21149. 'gdb.PARAM_UINTEGER'
  21150. The value is an unsigned integer. The value of 0 should be
  21151. interpreted to mean "unlimited".
  21152. 'gdb.PARAM_INTEGER'
  21153. The value is a signed integer. The value of 0 should be
  21154. interpreted to mean "unlimited".
  21155. 'gdb.PARAM_STRING'
  21156. The value is a string. When the user modifies the string, any
  21157. escape sequences, such as '\t', '\f', and octal escapes, are
  21158. translated into corresponding characters and encoded into the
  21159. current host charset.
  21160. 'gdb.PARAM_STRING_NOESCAPE'
  21161. The value is a string. When the user modifies the string, escapes
  21162. are passed through untranslated.
  21163. 'gdb.PARAM_OPTIONAL_FILENAME'
  21164. The value is a either a filename (a string), or 'None'.
  21165. 'gdb.PARAM_FILENAME'
  21166. The value is a filename. This is just like
  21167. 'PARAM_STRING_NOESCAPE', but uses file names for completion.
  21168. 'gdb.PARAM_ZINTEGER'
  21169. The value is an integer. This is like 'PARAM_INTEGER', except 0 is
  21170. interpreted as itself.
  21171. 'gdb.PARAM_ZUINTEGER'
  21172. The value is an unsigned integer. This is like 'PARAM_INTEGER',
  21173. except 0 is interpreted as itself, and the value cannot be
  21174. negative.
  21175. 'gdb.PARAM_ZUINTEGER_UNLIMITED'
  21176. The value is a signed integer. This is like 'PARAM_ZUINTEGER',
  21177. except the special value -1 should be interpreted to mean
  21178. "unlimited". Other negative values are not allowed.
  21179. 'gdb.PARAM_ENUM'
  21180. The value is a string, which must be one of a collection string
  21181. constants provided when the parameter is created.
  21182. 
  21183. File: gdb.info, Node: Functions In Python, Next: Progspaces In Python, Prev: Parameters In Python, Up: Python API
  21184. 23.2.2.22 Writing new convenience functions
  21185. ...........................................
  21186. You can implement new convenience functions (*note Convenience Vars::)
  21187. in Python. A convenience function is an instance of a subclass of the
  21188. class 'gdb.Function'.
  21189. -- Function: Function.__init__ (name)
  21190. The initializer for 'Function' registers the new function with GDB.
  21191. The argument NAME is the name of the function, a string. The
  21192. function will be visible to the user as a convenience variable of
  21193. type 'internal function', whose name is the same as the given NAME.
  21194. The documentation for the new function is taken from the
  21195. documentation string for the new class.
  21196. -- Function: Function.invoke (*ARGS)
  21197. When a convenience function is evaluated, its arguments are
  21198. converted to instances of 'gdb.Value', and then the function's
  21199. 'invoke' method is called. Note that GDB does not predetermine the
  21200. arity of convenience functions. Instead, all available arguments
  21201. are passed to 'invoke', following the standard Python calling
  21202. convention. In particular, a convenience function can have default
  21203. values for parameters without ill effect.
  21204. The return value of this method is used as its value in the
  21205. enclosing expression. If an ordinary Python value is returned, it
  21206. is converted to a 'gdb.Value' following the usual rules.
  21207. The following code snippet shows how a trivial convenience function
  21208. can be implemented in Python:
  21209. class Greet (gdb.Function):
  21210. """Return string to greet someone.
  21211. Takes a name as argument."""
  21212. def __init__ (self):
  21213. super (Greet, self).__init__ ("greet")
  21214. def invoke (self, name):
  21215. return "Hello, %s!" % name.string ()
  21216. Greet ()
  21217. The last line instantiates the class, and is necessary to trigger the
  21218. registration of the function with GDB. Depending on how the Python code
  21219. is read into GDB, you may need to import the 'gdb' module explicitly.
  21220. Now you can use the function in an expression:
  21221. (gdb) print $greet("Bob")
  21222. $1 = "Hello, Bob!"
  21223. 
  21224. File: gdb.info, Node: Progspaces In Python, Next: Objfiles In Python, Prev: Functions In Python, Up: Python API
  21225. 23.2.2.23 Program Spaces In Python
  21226. ..................................
  21227. A program space, or "progspace", represents a symbolic view of an
  21228. address space. It consists of all of the objfiles of the program.
  21229. *Note Objfiles In Python::. *Note program spaces: Inferiors Connections
  21230. and Programs, for more details about program spaces.
  21231. The following progspace-related functions are available in the 'gdb'
  21232. module:
  21233. -- Function: gdb.current_progspace ()
  21234. This function returns the program space of the currently selected
  21235. inferior. *Note Inferiors Connections and Programs::. This is
  21236. identical to 'gdb.selected_inferior().progspace' (*note Inferiors
  21237. In Python::) and is included for historical compatibility.
  21238. -- Function: gdb.progspaces ()
  21239. Return a sequence of all the progspaces currently known to GDB.
  21240. Each progspace is represented by an instance of the 'gdb.Progspace'
  21241. class.
  21242. -- Variable: Progspace.filename
  21243. The file name of the progspace as a string.
  21244. -- Variable: Progspace.pretty_printers
  21245. The 'pretty_printers' attribute is a list of functions. It is used
  21246. to look up pretty-printers. A 'Value' is passed to each function
  21247. in order; if the function returns 'None', then the search
  21248. continues. Otherwise, the return value should be an object which
  21249. is used to format the value. *Note Pretty Printing API::, for more
  21250. information.
  21251. -- Variable: Progspace.type_printers
  21252. The 'type_printers' attribute is a list of type printer objects.
  21253. *Note Type Printing API::, for more information.
  21254. -- Variable: Progspace.frame_filters
  21255. The 'frame_filters' attribute is a dictionary of frame filter
  21256. objects. *Note Frame Filter API::, for more information.
  21257. A program space has the following methods:
  21258. -- Function: Progspace.block_for_pc (pc)
  21259. Return the innermost 'gdb.Block' containing the given PC value. If
  21260. the block cannot be found for the PC value specified, the function
  21261. will return 'None'.
  21262. -- Function: Progspace.find_pc_line (pc)
  21263. Return the 'gdb.Symtab_and_line' object corresponding to the PC
  21264. value. *Note Symbol Tables In Python::. If an invalid value of PC
  21265. is passed as an argument, then the 'symtab' and 'line' attributes
  21266. of the returned 'gdb.Symtab_and_line' object will be 'None' and 0
  21267. respectively.
  21268. -- Function: Progspace.is_valid ()
  21269. Returns 'True' if the 'gdb.Progspace' object is valid, 'False' if
  21270. not. A 'gdb.Progspace' object can become invalid if the program
  21271. space file it refers to is not referenced by any inferior. All
  21272. other 'gdb.Progspace' methods will throw an exception if it is
  21273. invalid at the time the method is called.
  21274. -- Function: Progspace.objfiles ()
  21275. Return a sequence of all the objfiles referenced by this program
  21276. space. *Note Objfiles In Python::.
  21277. -- Function: Progspace.solib_name (address)
  21278. Return the name of the shared library holding the given ADDRESS as
  21279. a string, or 'None'.
  21280. One may add arbitrary attributes to 'gdb.Progspace' objects in the
  21281. usual Python way. This is useful if, for example, one needs to do some
  21282. extra record keeping associated with the program space.
  21283. In this contrived example, we want to perform some processing when an
  21284. objfile with a certain symbol is loaded, but we only want to do this
  21285. once because it is expensive. To achieve this we record the results
  21286. with the program space because we can't predict when the desired objfile
  21287. will be loaded.
  21288. (gdb) python
  21289. def clear_objfiles_handler(event):
  21290. event.progspace.expensive_computation = None
  21291. def expensive(symbol):
  21292. """A mock routine to perform an "expensive" computation on symbol."""
  21293. print "Computing the answer to the ultimate question ..."
  21294. return 42
  21295. def new_objfile_handler(event):
  21296. objfile = event.new_objfile
  21297. progspace = objfile.progspace
  21298. if not hasattr(progspace, 'expensive_computation') or \
  21299. progspace.expensive_computation is None:
  21300. # We use 'main' for the symbol to keep the example simple.
  21301. # Note: There's no current way to constrain the lookup
  21302. # to one objfile.
  21303. symbol = gdb.lookup_global_symbol('main')
  21304. if symbol is not None:
  21305. progspace.expensive_computation = expensive(symbol)
  21306. gdb.events.clear_objfiles.connect(clear_objfiles_handler)
  21307. gdb.events.new_objfile.connect(new_objfile_handler)
  21308. end
  21309. (gdb) file /tmp/hello
  21310. Reading symbols from /tmp/hello...
  21311. Computing the answer to the ultimate question ...
  21312. (gdb) python print gdb.current_progspace().expensive_computation
  21313. 42
  21314. (gdb) run
  21315. Starting program: /tmp/hello
  21316. Hello.
  21317. [Inferior 1 (process 4242) exited normally]
  21318. 
  21319. File: gdb.info, Node: Objfiles In Python, Next: Frames In Python, Prev: Progspaces In Python, Up: Python API
  21320. 23.2.2.24 Objfiles In Python
  21321. ............................
  21322. GDB loads symbols for an inferior from various symbol-containing files
  21323. (*note Files::). These include the primary executable file, any shared
  21324. libraries used by the inferior, and any separate debug info files (*note
  21325. Separate Debug Files::). GDB calls these symbol-containing files
  21326. "objfiles".
  21327. The following objfile-related functions are available in the 'gdb'
  21328. module:
  21329. -- Function: gdb.current_objfile ()
  21330. When auto-loading a Python script (*note Python Auto-loading::),
  21331. GDB sets the "current objfile" to the corresponding objfile. This
  21332. function returns the current objfile. If there is no current
  21333. objfile, this function returns 'None'.
  21334. -- Function: gdb.objfiles ()
  21335. Return a sequence of objfiles referenced by the current program
  21336. space. *Note Objfiles In Python::, and *note Progspaces In
  21337. Python::. This is identical to
  21338. 'gdb.selected_inferior().progspace.objfiles()' and is included for
  21339. historical compatibility.
  21340. -- Function: gdb.lookup_objfile (name [, by_build_id])
  21341. Look up NAME, a file name or build ID, in the list of objfiles for
  21342. the current program space (*note Progspaces In Python::). If the
  21343. objfile is not found throw the Python 'ValueError' exception.
  21344. If NAME is a relative file name, then it will match any source file
  21345. name with the same trailing components. For example, if NAME is
  21346. 'gcc/expr.c', then it will match source file name of
  21347. '/build/trunk/gcc/expr.c', but not '/build/trunk/libcpp/expr.c' or
  21348. '/build/trunk/gcc/x-expr.c'.
  21349. If BY_BUILD_ID is provided and is 'True' then NAME is the build ID
  21350. of the objfile. Otherwise, NAME is a file name. This is supported
  21351. only on some operating systems, notably those which use the ELF
  21352. format for binary files and the GNU Binutils. For more details
  21353. about this feature, see the description of the '--build-id'
  21354. command-line option in *note Command Line Options: (ld)Options.
  21355. Each objfile is represented by an instance of the 'gdb.Objfile'
  21356. class.
  21357. -- Variable: Objfile.filename
  21358. The file name of the objfile as a string, with symbolic links
  21359. resolved.
  21360. The value is 'None' if the objfile is no longer valid. See the
  21361. 'gdb.Objfile.is_valid' method, described below.
  21362. -- Variable: Objfile.username
  21363. The file name of the objfile as specified by the user as a string.
  21364. The value is 'None' if the objfile is no longer valid. See the
  21365. 'gdb.Objfile.is_valid' method, described below.
  21366. -- Variable: Objfile.owner
  21367. For separate debug info objfiles this is the corresponding
  21368. 'gdb.Objfile' object that debug info is being provided for.
  21369. Otherwise this is 'None'. Separate debug info objfiles are added
  21370. with the 'gdb.Objfile.add_separate_debug_file' method, described
  21371. below.
  21372. -- Variable: Objfile.build_id
  21373. The build ID of the objfile as a string. If the objfile does not
  21374. have a build ID then the value is 'None'.
  21375. This is supported only on some operating systems, notably those
  21376. which use the ELF format for binary files and the GNU Binutils.
  21377. For more details about this feature, see the description of the
  21378. '--build-id' command-line option in *note Command Line Options:
  21379. (ld)Options.
  21380. -- Variable: Objfile.progspace
  21381. The containing program space of the objfile as a 'gdb.Progspace'
  21382. object. *Note Progspaces In Python::.
  21383. -- Variable: Objfile.pretty_printers
  21384. The 'pretty_printers' attribute is a list of functions. It is used
  21385. to look up pretty-printers. A 'Value' is passed to each function
  21386. in order; if the function returns 'None', then the search
  21387. continues. Otherwise, the return value should be an object which
  21388. is used to format the value. *Note Pretty Printing API::, for more
  21389. information.
  21390. -- Variable: Objfile.type_printers
  21391. The 'type_printers' attribute is a list of type printer objects.
  21392. *Note Type Printing API::, for more information.
  21393. -- Variable: Objfile.frame_filters
  21394. The 'frame_filters' attribute is a dictionary of frame filter
  21395. objects. *Note Frame Filter API::, for more information.
  21396. One may add arbitrary attributes to 'gdb.Objfile' objects in the
  21397. usual Python way. This is useful if, for example, one needs to do some
  21398. extra record keeping associated with the objfile.
  21399. In this contrived example we record the time when GDB loaded the
  21400. objfile.
  21401. (gdb) python
  21402. import datetime
  21403. def new_objfile_handler(event):
  21404. # Set the time_loaded attribute of the new objfile.
  21405. event.new_objfile.time_loaded = datetime.datetime.today()
  21406. gdb.events.new_objfile.connect(new_objfile_handler)
  21407. end
  21408. (gdb) file ./hello
  21409. Reading symbols from ./hello...
  21410. (gdb) python print gdb.objfiles()[0].time_loaded
  21411. 2014-10-09 11:41:36.770345
  21412. A 'gdb.Objfile' object has the following methods:
  21413. -- Function: Objfile.is_valid ()
  21414. Returns 'True' if the 'gdb.Objfile' object is valid, 'False' if
  21415. not. A 'gdb.Objfile' object can become invalid if the object file
  21416. it refers to is not loaded in GDB any longer. All other
  21417. 'gdb.Objfile' methods will throw an exception if it is invalid at
  21418. the time the method is called.
  21419. -- Function: Objfile.add_separate_debug_file (file)
  21420. Add FILE to the list of files that GDB will search for debug
  21421. information for the objfile. This is useful when the debug info
  21422. has been removed from the program and stored in a separate file.
  21423. GDB has built-in support for finding separate debug info files
  21424. (*note Separate Debug Files::), but if the file doesn't live in one
  21425. of the standard places that GDB searches then this function can be
  21426. used to add a debug info file from a different place.
  21427. -- Function: Objfile.lookup_global_symbol (name [, domain])
  21428. Search for a global symbol named NAME in this objfile. Optionally,
  21429. the search scope can be restricted with the DOMAIN argument. The
  21430. DOMAIN argument must be a domain constant defined in the 'gdb'
  21431. module and described in *note Symbols In Python::. This function
  21432. is similar to 'gdb.lookup_global_symbol', except that the search is
  21433. limited to this objfile.
  21434. The result is a 'gdb.Symbol' object or 'None' if the symbol is not
  21435. found.
  21436. -- Function: Objfile.lookup_static_symbol (name [, domain])
  21437. Like 'Objfile.lookup_global_symbol', but searches for a global
  21438. symbol with static linkage named NAME in this objfile.
  21439. 
  21440. File: gdb.info, Node: Frames In Python, Next: Blocks In Python, Prev: Objfiles In Python, Up: Python API
  21441. 23.2.2.25 Accessing inferior stack frames from Python
  21442. .....................................................
  21443. When the debugged program stops, GDB is able to analyze its call stack
  21444. (*note Stack frames: Frames.). The 'gdb.Frame' class represents a frame
  21445. in the stack. A 'gdb.Frame' object is only valid while its
  21446. corresponding frame exists in the inferior's stack. If you try to use
  21447. an invalid frame object, GDB will throw a 'gdb.error' exception (*note
  21448. Exception Handling::).
  21449. Two 'gdb.Frame' objects can be compared for equality with the '=='
  21450. operator, like:
  21451. (gdb) python print gdb.newest_frame() == gdb.selected_frame ()
  21452. True
  21453. The following frame-related functions are available in the 'gdb'
  21454. module:
  21455. -- Function: gdb.selected_frame ()
  21456. Return the selected frame object. (*note Selecting a Frame:
  21457. Selection.).
  21458. -- Function: gdb.newest_frame ()
  21459. Return the newest frame object for the selected thread.
  21460. -- Function: gdb.frame_stop_reason_string (reason)
  21461. Return a string explaining the reason why GDB stopped unwinding
  21462. frames, as expressed by the given REASON code (an integer, see the
  21463. 'unwind_stop_reason' method further down in this section).
  21464. -- Function: gdb.invalidate_cached_frames
  21465. GDB internally keeps a cache of the frames that have been unwound.
  21466. This function invalidates this cache.
  21467. This function should not generally be called by ordinary Python
  21468. code. It is documented for the sake of completeness.
  21469. A 'gdb.Frame' object has the following methods:
  21470. -- Function: Frame.is_valid ()
  21471. Returns true if the 'gdb.Frame' object is valid, false if not. A
  21472. frame object can become invalid if the frame it refers to doesn't
  21473. exist anymore in the inferior. All 'gdb.Frame' methods will throw
  21474. an exception if it is invalid at the time the method is called.
  21475. -- Function: Frame.name ()
  21476. Returns the function name of the frame, or 'None' if it can't be
  21477. obtained.
  21478. -- Function: Frame.architecture ()
  21479. Returns the 'gdb.Architecture' object corresponding to the frame's
  21480. architecture. *Note Architectures In Python::.
  21481. -- Function: Frame.type ()
  21482. Returns the type of the frame. The value can be one of:
  21483. 'gdb.NORMAL_FRAME'
  21484. An ordinary stack frame.
  21485. 'gdb.DUMMY_FRAME'
  21486. A fake stack frame that was created by GDB when performing an
  21487. inferior function call.
  21488. 'gdb.INLINE_FRAME'
  21489. A frame representing an inlined function. The function was
  21490. inlined into a 'gdb.NORMAL_FRAME' that is older than this one.
  21491. 'gdb.TAILCALL_FRAME'
  21492. A frame representing a tail call. *Note Tail Call Frames::.
  21493. 'gdb.SIGTRAMP_FRAME'
  21494. A signal trampoline frame. This is the frame created by the
  21495. OS when it calls into a signal handler.
  21496. 'gdb.ARCH_FRAME'
  21497. A fake stack frame representing a cross-architecture call.
  21498. 'gdb.SENTINEL_FRAME'
  21499. This is like 'gdb.NORMAL_FRAME', but it is only used for the
  21500. newest frame.
  21501. -- Function: Frame.unwind_stop_reason ()
  21502. Return an integer representing the reason why it's not possible to
  21503. find more frames toward the outermost frame. Use
  21504. 'gdb.frame_stop_reason_string' to convert the value returned by
  21505. this function to a string. The value can be one of:
  21506. 'gdb.FRAME_UNWIND_NO_REASON'
  21507. No particular reason (older frames should be available).
  21508. 'gdb.FRAME_UNWIND_NULL_ID'
  21509. The previous frame's analyzer returns an invalid result. This
  21510. is no longer used by GDB, and is kept only for backward
  21511. compatibility.
  21512. 'gdb.FRAME_UNWIND_OUTERMOST'
  21513. This frame is the outermost.
  21514. 'gdb.FRAME_UNWIND_UNAVAILABLE'
  21515. Cannot unwind further, because that would require knowing the
  21516. values of registers or memory that have not been collected.
  21517. 'gdb.FRAME_UNWIND_INNER_ID'
  21518. This frame ID looks like it ought to belong to a NEXT frame,
  21519. but we got it for a PREV frame. Normally, this is a sign of
  21520. unwinder failure. It could also indicate stack corruption.
  21521. 'gdb.FRAME_UNWIND_SAME_ID'
  21522. This frame has the same ID as the previous one. That means
  21523. that unwinding further would almost certainly give us another
  21524. frame with exactly the same ID, so break the chain. Normally,
  21525. this is a sign of unwinder failure. It could also indicate
  21526. stack corruption.
  21527. 'gdb.FRAME_UNWIND_NO_SAVED_PC'
  21528. The frame unwinder did not find any saved PC, but we needed
  21529. one to unwind further.
  21530. 'gdb.FRAME_UNWIND_MEMORY_ERROR'
  21531. The frame unwinder caused an error while trying to access
  21532. memory.
  21533. 'gdb.FRAME_UNWIND_FIRST_ERROR'
  21534. Any stop reason greater or equal to this value indicates some
  21535. kind of error. This special value facilitates writing code
  21536. that tests for errors in unwinding in a way that will work
  21537. correctly even if the list of the other values is modified in
  21538. future GDB versions. Using it, you could write:
  21539. reason = gdb.selected_frame().unwind_stop_reason ()
  21540. reason_str = gdb.frame_stop_reason_string (reason)
  21541. if reason >= gdb.FRAME_UNWIND_FIRST_ERROR:
  21542. print "An error occured: %s" % reason_str
  21543. -- Function: Frame.pc ()
  21544. Returns the frame's resume address.
  21545. -- Function: Frame.block ()
  21546. Return the frame's code block. *Note Blocks In Python::. If the
  21547. frame does not have a block - for example, if there is no debugging
  21548. information for the code in question - then this will throw an
  21549. exception.
  21550. -- Function: Frame.function ()
  21551. Return the symbol for the function corresponding to this frame.
  21552. *Note Symbols In Python::.
  21553. -- Function: Frame.older ()
  21554. Return the frame that called this frame.
  21555. -- Function: Frame.newer ()
  21556. Return the frame called by this frame.
  21557. -- Function: Frame.find_sal ()
  21558. Return the frame's symtab and line object. *Note Symbol Tables In
  21559. Python::.
  21560. -- Function: Frame.read_register (register)
  21561. Return the value of REGISTER in this frame. Returns a 'Gdb.Value'
  21562. object. Throws an exception if REGISTER does not exist. The
  21563. REGISTER argument must be one of the following:
  21564. 1. A string that is the name of a valid register (e.g., ''sp'' or
  21565. ''rax'').
  21566. 2. A 'gdb.RegisterDescriptor' object (*note Registers In
  21567. Python::).
  21568. 3. A GDB internal, platform specific number. Using these numbers
  21569. is supported for historic reasons, but is not recommended as
  21570. future changes to GDB could change the mapping between numbers
  21571. and the registers they represent, breaking any Python code
  21572. that uses the platform-specific numbers. The numbers are
  21573. usually found in the corresponding 'PLATFORM-tdep.h' file in
  21574. the GDB source tree.
  21575. Using a string to access registers will be slightly slower than the
  21576. other two methods as GDB must look up the mapping between name and
  21577. internal register number. If performance is critical consider
  21578. looking up and caching a 'gdb.RegisterDescriptor' object.
  21579. -- Function: Frame.read_var (variable [, block])
  21580. Return the value of VARIABLE in this frame. If the optional
  21581. argument BLOCK is provided, search for the variable from that
  21582. block; otherwise start at the frame's current block (which is
  21583. determined by the frame's current program counter). The VARIABLE
  21584. argument must be a string or a 'gdb.Symbol' object; BLOCK must be a
  21585. 'gdb.Block' object.
  21586. -- Function: Frame.select ()
  21587. Set this frame to be the selected frame. *Note Examining the
  21588. Stack: Stack.
  21589. 
  21590. File: gdb.info, Node: Blocks In Python, Next: Symbols In Python, Prev: Frames In Python, Up: Python API
  21591. 23.2.2.26 Accessing blocks from Python
  21592. ......................................
  21593. In GDB, symbols are stored in blocks. A block corresponds roughly to a
  21594. scope in the source code. Blocks are organized hierarchically, and are
  21595. represented individually in Python as a 'gdb.Block'. Blocks rely on
  21596. debugging information being available.
  21597. A frame has a block. Please see *note Frames In Python::, for a more
  21598. in-depth discussion of frames.
  21599. The outermost block is known as the "global block". The global block
  21600. typically holds public global variables and functions.
  21601. The block nested just inside the global block is the "static block".
  21602. The static block typically holds file-scoped variables and functions.
  21603. GDB provides a method to get a block's superblock, but there is
  21604. currently no way to examine the sub-blocks of a block, or to iterate
  21605. over all the blocks in a symbol table (*note Symbol Tables In Python::).
  21606. Here is a short example that should help explain blocks:
  21607. /* This is in the global block. */
  21608. int global;
  21609. /* This is in the static block. */
  21610. static int file_scope;
  21611. /* 'function' is in the global block, and 'argument' is
  21612. in a block nested inside of 'function'. */
  21613. int function (int argument)
  21614. {
  21615. /* 'local' is in a block inside 'function'. It may or may
  21616. not be in the same block as 'argument'. */
  21617. int local;
  21618. {
  21619. /* 'inner' is in a block whose superblock is the one holding
  21620. 'local'. */
  21621. int inner;
  21622. /* If this call is expanded by the compiler, you may see
  21623. a nested block here whose function is 'inline_function'
  21624. and whose superblock is the one holding 'inner'. */
  21625. inline_function ();
  21626. }
  21627. }
  21628. A 'gdb.Block' is iterable. The iterator returns the symbols (*note
  21629. Symbols In Python::) local to the block. Python programs should not
  21630. assume that a specific block object will always contain a given symbol,
  21631. since changes in GDB features and infrastructure may cause symbols move
  21632. across blocks in a symbol table. You can also use Python's "dictionary
  21633. syntax" to access variables in this block, e.g.:
  21634. symbol = some_block['variable'] # symbol is of type gdb.Symbol
  21635. The following block-related functions are available in the 'gdb'
  21636. module:
  21637. -- Function: gdb.block_for_pc (pc)
  21638. Return the innermost 'gdb.Block' containing the given PC value. If
  21639. the block cannot be found for the PC value specified, the function
  21640. will return 'None'. This is identical to
  21641. 'gdb.current_progspace().block_for_pc(pc)' and is included for
  21642. historical compatibility.
  21643. A 'gdb.Block' object has the following methods:
  21644. -- Function: Block.is_valid ()
  21645. Returns 'True' if the 'gdb.Block' object is valid, 'False' if not.
  21646. A block object can become invalid if the block it refers to doesn't
  21647. exist anymore in the inferior. All other 'gdb.Block' methods will
  21648. throw an exception if it is invalid at the time the method is
  21649. called. The block's validity is also checked during iteration over
  21650. symbols of the block.
  21651. A 'gdb.Block' object has the following attributes:
  21652. -- Variable: Block.start
  21653. The start address of the block. This attribute is not writable.
  21654. -- Variable: Block.end
  21655. One past the last address that appears in the block. This
  21656. attribute is not writable.
  21657. -- Variable: Block.function
  21658. The name of the block represented as a 'gdb.Symbol'. If the block
  21659. is not named, then this attribute holds 'None'. This attribute is
  21660. not writable.
  21661. For ordinary function blocks, the superblock is the static block.
  21662. However, you should note that it is possible for a function block
  21663. to have a superblock that is not the static block - for instance
  21664. this happens for an inlined function.
  21665. -- Variable: Block.superblock
  21666. The block containing this block. If this parent block does not
  21667. exist, this attribute holds 'None'. This attribute is not
  21668. writable.
  21669. -- Variable: Block.global_block
  21670. The global block associated with this block. This attribute is not
  21671. writable.
  21672. -- Variable: Block.static_block
  21673. The static block associated with this block. This attribute is not
  21674. writable.
  21675. -- Variable: Block.is_global
  21676. 'True' if the 'gdb.Block' object is a global block, 'False' if not.
  21677. This attribute is not writable.
  21678. -- Variable: Block.is_static
  21679. 'True' if the 'gdb.Block' object is a static block, 'False' if not.
  21680. This attribute is not writable.
  21681. 
  21682. File: gdb.info, Node: Symbols In Python, Next: Symbol Tables In Python, Prev: Blocks In Python, Up: Python API
  21683. 23.2.2.27 Python representation of Symbols
  21684. ..........................................
  21685. GDB represents every variable, function and type as an entry in a symbol
  21686. table. *Note Examining the Symbol Table: Symbols. Similarly, Python
  21687. represents these symbols in GDB with the 'gdb.Symbol' object.
  21688. The following symbol-related functions are available in the 'gdb'
  21689. module:
  21690. -- Function: gdb.lookup_symbol (name [, block [, domain]])
  21691. This function searches for a symbol by name. The search scope can
  21692. be restricted to the parameters defined in the optional domain and
  21693. block arguments.
  21694. NAME is the name of the symbol. It must be a string. The optional
  21695. BLOCK argument restricts the search to symbols visible in that
  21696. BLOCK. The BLOCK argument must be a 'gdb.Block' object. If
  21697. omitted, the block for the current frame is used. The optional
  21698. DOMAIN argument restricts the search to the domain type. The
  21699. DOMAIN argument must be a domain constant defined in the 'gdb'
  21700. module and described later in this chapter.
  21701. The result is a tuple of two elements. The first element is a
  21702. 'gdb.Symbol' object or 'None' if the symbol is not found. If the
  21703. symbol is found, the second element is 'True' if the symbol is a
  21704. field of a method's object (e.g., 'this' in C++), otherwise it is
  21705. 'False'. If the symbol is not found, the second element is
  21706. 'False'.
  21707. -- Function: gdb.lookup_global_symbol (name [, domain])
  21708. This function searches for a global symbol by name. The search
  21709. scope can be restricted to by the domain argument.
  21710. NAME is the name of the symbol. It must be a string. The optional
  21711. DOMAIN argument restricts the search to the domain type. The
  21712. DOMAIN argument must be a domain constant defined in the 'gdb'
  21713. module and described later in this chapter.
  21714. The result is a 'gdb.Symbol' object or 'None' if the symbol is not
  21715. found.
  21716. -- Function: gdb.lookup_static_symbol (name [, domain])
  21717. This function searches for a global symbol with static linkage by
  21718. name. The search scope can be restricted to by the domain
  21719. argument.
  21720. NAME is the name of the symbol. It must be a string. The optional
  21721. DOMAIN argument restricts the search to the domain type. The
  21722. DOMAIN argument must be a domain constant defined in the 'gdb'
  21723. module and described later in this chapter.
  21724. The result is a 'gdb.Symbol' object or 'None' if the symbol is not
  21725. found.
  21726. Note that this function will not find function-scoped static
  21727. variables. To look up such variables, iterate over the variables
  21728. of the function's 'gdb.Block' and check that 'block.addr_class' is
  21729. 'gdb.SYMBOL_LOC_STATIC'.
  21730. There can be multiple global symbols with static linkage with the
  21731. same name. This function will only return the first matching
  21732. symbol that it finds. Which symbol is found depends on where GDB
  21733. is currently stopped, as GDB will first search for matching symbols
  21734. in the current object file, and then search all other object files.
  21735. If the application is not yet running then GDB will search all
  21736. object files in the order they appear in the debug information.
  21737. -- Function: gdb.lookup_static_symbols (name [, domain])
  21738. Similar to 'gdb.lookup_static_symbol', this function searches for
  21739. global symbols with static linkage by name, and optionally
  21740. restricted by the domain argument. However, this function returns
  21741. a list of all matching symbols found, not just the first one.
  21742. NAME is the name of the symbol. It must be a string. The optional
  21743. DOMAIN argument restricts the search to the domain type. The
  21744. DOMAIN argument must be a domain constant defined in the 'gdb'
  21745. module and described later in this chapter.
  21746. The result is a list of 'gdb.Symbol' objects which could be empty
  21747. if no matching symbols were found.
  21748. Note that this function will not find function-scoped static
  21749. variables. To look up such variables, iterate over the variables
  21750. of the function's 'gdb.Block' and check that 'block.addr_class' is
  21751. 'gdb.SYMBOL_LOC_STATIC'.
  21752. A 'gdb.Symbol' object has the following attributes:
  21753. -- Variable: Symbol.type
  21754. The type of the symbol or 'None' if no type is recorded. This
  21755. attribute is represented as a 'gdb.Type' object. *Note Types In
  21756. Python::. This attribute is not writable.
  21757. -- Variable: Symbol.symtab
  21758. The symbol table in which the symbol appears. This attribute is
  21759. represented as a 'gdb.Symtab' object. *Note Symbol Tables In
  21760. Python::. This attribute is not writable.
  21761. -- Variable: Symbol.line
  21762. The line number in the source code at which the symbol was defined.
  21763. This is an integer.
  21764. -- Variable: Symbol.name
  21765. The name of the symbol as a string. This attribute is not
  21766. writable.
  21767. -- Variable: Symbol.linkage_name
  21768. The name of the symbol, as used by the linker (i.e., may be
  21769. mangled). This attribute is not writable.
  21770. -- Variable: Symbol.print_name
  21771. The name of the symbol in a form suitable for output. This is
  21772. either 'name' or 'linkage_name', depending on whether the user
  21773. asked GDB to display demangled or mangled names.
  21774. -- Variable: Symbol.addr_class
  21775. The address class of the symbol. This classifies how to find the
  21776. value of a symbol. Each address class is a constant defined in the
  21777. 'gdb' module and described later in this chapter.
  21778. -- Variable: Symbol.needs_frame
  21779. This is 'True' if evaluating this symbol's value requires a frame
  21780. (*note Frames In Python::) and 'False' otherwise. Typically, local
  21781. variables will require a frame, but other symbols will not.
  21782. -- Variable: Symbol.is_argument
  21783. 'True' if the symbol is an argument of a function.
  21784. -- Variable: Symbol.is_constant
  21785. 'True' if the symbol is a constant.
  21786. -- Variable: Symbol.is_function
  21787. 'True' if the symbol is a function or a method.
  21788. -- Variable: Symbol.is_variable
  21789. 'True' if the symbol is a variable.
  21790. A 'gdb.Symbol' object has the following methods:
  21791. -- Function: Symbol.is_valid ()
  21792. Returns 'True' if the 'gdb.Symbol' object is valid, 'False' if not.
  21793. A 'gdb.Symbol' object can become invalid if the symbol it refers to
  21794. does not exist in GDB any longer. All other 'gdb.Symbol' methods
  21795. will throw an exception if it is invalid at the time the method is
  21796. called.
  21797. -- Function: Symbol.value ([frame])
  21798. Compute the value of the symbol, as a 'gdb.Value'. For functions,
  21799. this computes the address of the function, cast to the appropriate
  21800. type. If the symbol requires a frame in order to compute its
  21801. value, then FRAME must be given. If FRAME is not given, or if
  21802. FRAME is invalid, then this method will throw an exception.
  21803. The available domain categories in 'gdb.Symbol' are represented as
  21804. constants in the 'gdb' module:
  21805. 'gdb.SYMBOL_UNDEF_DOMAIN'
  21806. This is used when a domain has not been discovered or none of the
  21807. following domains apply. This usually indicates an error either in
  21808. the symbol information or in GDB's handling of symbols.
  21809. 'gdb.SYMBOL_VAR_DOMAIN'
  21810. This domain contains variables, function names, typedef names and
  21811. enum type values.
  21812. 'gdb.SYMBOL_STRUCT_DOMAIN'
  21813. This domain holds struct, union and enum type names.
  21814. 'gdb.SYMBOL_LABEL_DOMAIN'
  21815. This domain contains names of labels (for gotos).
  21816. 'gdb.SYMBOL_MODULE_DOMAIN'
  21817. This domain contains names of Fortran module types.
  21818. 'gdb.SYMBOL_COMMON_BLOCK_DOMAIN'
  21819. This domain contains names of Fortran common blocks.
  21820. The available address class categories in 'gdb.Symbol' are
  21821. represented as constants in the 'gdb' module:
  21822. 'gdb.SYMBOL_LOC_UNDEF'
  21823. If this is returned by address class, it indicates an error either
  21824. in the symbol information or in GDB's handling of symbols.
  21825. 'gdb.SYMBOL_LOC_CONST'
  21826. Value is constant int.
  21827. 'gdb.SYMBOL_LOC_STATIC'
  21828. Value is at a fixed address.
  21829. 'gdb.SYMBOL_LOC_REGISTER'
  21830. Value is in a register.
  21831. 'gdb.SYMBOL_LOC_ARG'
  21832. Value is an argument. This value is at the offset stored within
  21833. the symbol inside the frame's argument list.
  21834. 'gdb.SYMBOL_LOC_REF_ARG'
  21835. Value address is stored in the frame's argument list. Just like
  21836. 'LOC_ARG' except that the value's address is stored at the offset,
  21837. not the value itself.
  21838. 'gdb.SYMBOL_LOC_REGPARM_ADDR'
  21839. Value is a specified register. Just like 'LOC_REGISTER' except the
  21840. register holds the address of the argument instead of the argument
  21841. itself.
  21842. 'gdb.SYMBOL_LOC_LOCAL'
  21843. Value is a local variable.
  21844. 'gdb.SYMBOL_LOC_TYPEDEF'
  21845. Value not used. Symbols in the domain 'SYMBOL_STRUCT_DOMAIN' all
  21846. have this class.
  21847. 'gdb.SYMBOL_LOC_BLOCK'
  21848. Value is a block.
  21849. 'gdb.SYMBOL_LOC_CONST_BYTES'
  21850. Value is a byte-sequence.
  21851. 'gdb.SYMBOL_LOC_UNRESOLVED'
  21852. Value is at a fixed address, but the address of the variable has to
  21853. be determined from the minimal symbol table whenever the variable
  21854. is referenced.
  21855. 'gdb.SYMBOL_LOC_OPTIMIZED_OUT'
  21856. The value does not actually exist in the program.
  21857. 'gdb.SYMBOL_LOC_COMPUTED'
  21858. The value's address is a computed location.
  21859. 'gdb.SYMBOL_LOC_COMPUTED'
  21860. The value's address is a symbol. This is only used for Fortran
  21861. common blocks.
  21862. 
  21863. File: gdb.info, Node: Symbol Tables In Python, Next: Line Tables In Python, Prev: Symbols In Python, Up: Python API
  21864. 23.2.2.28 Symbol table representation in Python
  21865. ...............................................
  21866. Access to symbol table data maintained by GDB on the inferior is exposed
  21867. to Python via two objects: 'gdb.Symtab_and_line' and 'gdb.Symtab'.
  21868. Symbol table and line data for a frame is returned from the 'find_sal'
  21869. method in 'gdb.Frame' object. *Note Frames In Python::.
  21870. For more information on GDB's symbol table management, see *note
  21871. Examining the Symbol Table: Symbols, for more information.
  21872. A 'gdb.Symtab_and_line' object has the following attributes:
  21873. -- Variable: Symtab_and_line.symtab
  21874. The symbol table object ('gdb.Symtab') for this frame. This
  21875. attribute is not writable.
  21876. -- Variable: Symtab_and_line.pc
  21877. Indicates the start of the address range occupied by code for the
  21878. current source line. This attribute is not writable.
  21879. -- Variable: Symtab_and_line.last
  21880. Indicates the end of the address range occupied by code for the
  21881. current source line. This attribute is not writable.
  21882. -- Variable: Symtab_and_line.line
  21883. Indicates the current line number for this object. This attribute
  21884. is not writable.
  21885. A 'gdb.Symtab_and_line' object has the following methods:
  21886. -- Function: Symtab_and_line.is_valid ()
  21887. Returns 'True' if the 'gdb.Symtab_and_line' object is valid,
  21888. 'False' if not. A 'gdb.Symtab_and_line' object can become invalid
  21889. if the Symbol table and line object it refers to does not exist in
  21890. GDB any longer. All other 'gdb.Symtab_and_line' methods will throw
  21891. an exception if it is invalid at the time the method is called.
  21892. A 'gdb.Symtab' object has the following attributes:
  21893. -- Variable: Symtab.filename
  21894. The symbol table's source filename. This attribute is not
  21895. writable.
  21896. -- Variable: Symtab.objfile
  21897. The symbol table's backing object file. *Note Objfiles In
  21898. Python::. This attribute is not writable.
  21899. -- Variable: Symtab.producer
  21900. The name and possibly version number of the program that compiled
  21901. the code in the symbol table. The contents of this string is up to
  21902. the compiler. If no producer information is available then 'None'
  21903. is returned. This attribute is not writable.
  21904. A 'gdb.Symtab' object has the following methods:
  21905. -- Function: Symtab.is_valid ()
  21906. Returns 'True' if the 'gdb.Symtab' object is valid, 'False' if not.
  21907. A 'gdb.Symtab' object can become invalid if the symbol table it
  21908. refers to does not exist in GDB any longer. All other 'gdb.Symtab'
  21909. methods will throw an exception if it is invalid at the time the
  21910. method is called.
  21911. -- Function: Symtab.fullname ()
  21912. Return the symbol table's source absolute file name.
  21913. -- Function: Symtab.global_block ()
  21914. Return the global block of the underlying symbol table. *Note
  21915. Blocks In Python::.
  21916. -- Function: Symtab.static_block ()
  21917. Return the static block of the underlying symbol table. *Note
  21918. Blocks In Python::.
  21919. -- Function: Symtab.linetable ()
  21920. Return the line table associated with the symbol table. *Note Line
  21921. Tables In Python::.
  21922. 
  21923. File: gdb.info, Node: Line Tables In Python, Next: Breakpoints In Python, Prev: Symbol Tables In Python, Up: Python API
  21924. 23.2.2.29 Manipulating line tables using Python
  21925. ...............................................
  21926. Python code can request and inspect line table information from a symbol
  21927. table that is loaded in GDB. A line table is a mapping of source lines
  21928. to their executable locations in memory. To acquire the line table
  21929. information for a particular symbol table, use the 'linetable' function
  21930. (*note Symbol Tables In Python::).
  21931. A 'gdb.LineTable' is iterable. The iterator returns 'LineTableEntry'
  21932. objects that correspond to the source line and address for each line
  21933. table entry. 'LineTableEntry' objects have the following attributes:
  21934. -- Variable: LineTableEntry.line
  21935. The source line number for this line table entry. This number
  21936. corresponds to the actual line of source. This attribute is not
  21937. writable.
  21938. -- Variable: LineTableEntry.pc
  21939. The address that is associated with the line table entry where the
  21940. executable code for that source line resides in memory. This
  21941. attribute is not writable.
  21942. As there can be multiple addresses for a single source line, you may
  21943. receive multiple 'LineTableEntry' objects with matching 'line'
  21944. attributes, but with different 'pc' attributes. The iterator is sorted
  21945. in ascending 'pc' order. Here is a small example illustrating iterating
  21946. over a line table.
  21947. symtab = gdb.selected_frame().find_sal().symtab
  21948. linetable = symtab.linetable()
  21949. for line in linetable:
  21950. print "Line: "+str(line.line)+" Address: "+hex(line.pc)
  21951. This will have the following output:
  21952. Line: 33 Address: 0x4005c8L
  21953. Line: 37 Address: 0x4005caL
  21954. Line: 39 Address: 0x4005d2L
  21955. Line: 40 Address: 0x4005f8L
  21956. Line: 42 Address: 0x4005ffL
  21957. Line: 44 Address: 0x400608L
  21958. Line: 42 Address: 0x40060cL
  21959. Line: 45 Address: 0x400615L
  21960. In addition to being able to iterate over a 'LineTable', it also has
  21961. the following direct access methods:
  21962. -- Function: LineTable.line (line)
  21963. Return a Python 'Tuple' of 'LineTableEntry' objects for any entries
  21964. in the line table for the given LINE, which specifies the source
  21965. code line. If there are no entries for that source code LINE, the
  21966. Python 'None' is returned.
  21967. -- Function: LineTable.has_line (line)
  21968. Return a Python 'Boolean' indicating whether there is an entry in
  21969. the line table for this source line. Return 'True' if an entry is
  21970. found, or 'False' if not.
  21971. -- Function: LineTable.source_lines ()
  21972. Return a Python 'List' of the source line numbers in the symbol
  21973. table. Only lines with executable code locations are returned.
  21974. The contents of the 'List' will just be the source line entries
  21975. represented as Python 'Long' values.
  21976. 
  21977. File: gdb.info, Node: Breakpoints In Python, Next: Finish Breakpoints in Python, Prev: Line Tables In Python, Up: Python API
  21978. 23.2.2.30 Manipulating breakpoints using Python
  21979. ...............................................
  21980. Python code can manipulate breakpoints via the 'gdb.Breakpoint' class.
  21981. A breakpoint can be created using one of the two forms of the
  21982. 'gdb.Breakpoint' constructor. The first one accepts a string like one
  21983. would pass to the 'break' (*note Setting Breakpoints: Set Breaks.) and
  21984. 'watch' (*note Setting Watchpoints: Set Watchpoints.) commands, and can
  21985. be used to create both breakpoints and watchpoints. The second accepts
  21986. separate Python arguments similar to *note Explicit Locations::, and can
  21987. only be used to create breakpoints.
  21988. -- Function: Breakpoint.__init__ (spec [, type ][, wp_class ][,
  21989. internal ][, temporary ][, qualified ])
  21990. Create a new breakpoint according to SPEC, which is a string naming
  21991. the location of a breakpoint, or an expression that defines a
  21992. watchpoint. The string should describe a location in a format
  21993. recognized by the 'break' command (*note Setting Breakpoints: Set
  21994. Breaks.) or, in the case of a watchpoint, by the 'watch' command
  21995. (*note Setting Watchpoints: Set Watchpoints.).
  21996. The optional TYPE argument specifies the type of the breakpoint to
  21997. create, as defined below.
  21998. The optional WP_CLASS argument defines the class of watchpoint to
  21999. create, if TYPE is 'gdb.BP_WATCHPOINT'. If WP_CLASS is omitted, it
  22000. defaults to 'gdb.WP_WRITE'.
  22001. The optional INTERNAL argument allows the breakpoint to become
  22002. invisible to the user. The breakpoint will neither be reported
  22003. when created, nor will it be listed in the output from 'info
  22004. breakpoints' (but will be listed with the 'maint info breakpoints'
  22005. command).
  22006. The optional TEMPORARY argument makes the breakpoint a temporary
  22007. breakpoint. Temporary breakpoints are deleted after they have been
  22008. hit. Any further access to the Python breakpoint after it has been
  22009. hit will result in a runtime error (as that breakpoint has now been
  22010. automatically deleted).
  22011. The optional QUALIFIED argument is a boolean that allows
  22012. interpreting the function passed in 'spec' as a fully-qualified
  22013. name. It is equivalent to 'break''s '-qualified' flag (*note
  22014. Linespec Locations:: and *note Explicit Locations::).
  22015. -- Function: Breakpoint.__init__ ([ source ][, function ][, label ][,
  22016. line ], ][ internal ][, temporary ][, qualified ])
  22017. This second form of creating a new breakpoint specifies the
  22018. explicit location (*note Explicit Locations::) using keywords. The
  22019. new breakpoint will be created in the specified source file SOURCE,
  22020. at the specified FUNCTION, LABEL and LINE.
  22021. INTERNAL, TEMPORARY and QUALIFIED have the same usage as explained
  22022. previously.
  22023. The available types are represented by constants defined in the 'gdb'
  22024. module:
  22025. 'gdb.BP_BREAKPOINT'
  22026. Normal code breakpoint.
  22027. 'gdb.BP_WATCHPOINT'
  22028. Watchpoint breakpoint.
  22029. 'gdb.BP_HARDWARE_WATCHPOINT'
  22030. Hardware assisted watchpoint.
  22031. 'gdb.BP_READ_WATCHPOINT'
  22032. Hardware assisted read watchpoint.
  22033. 'gdb.BP_ACCESS_WATCHPOINT'
  22034. Hardware assisted access watchpoint.
  22035. The available watchpoint types represented by constants are defined
  22036. in the 'gdb' module:
  22037. 'gdb.WP_READ'
  22038. Read only watchpoint.
  22039. 'gdb.WP_WRITE'
  22040. Write only watchpoint.
  22041. 'gdb.WP_ACCESS'
  22042. Read/Write watchpoint.
  22043. -- Function: Breakpoint.stop (self)
  22044. The 'gdb.Breakpoint' class can be sub-classed and, in particular,
  22045. you may choose to implement the 'stop' method. If this method is
  22046. defined in a sub-class of 'gdb.Breakpoint', it will be called when
  22047. the inferior reaches any location of a breakpoint which
  22048. instantiates that sub-class. If the method returns 'True', the
  22049. inferior will be stopped at the location of the breakpoint,
  22050. otherwise the inferior will continue.
  22051. If there are multiple breakpoints at the same location with a
  22052. 'stop' method, each one will be called regardless of the return
  22053. status of the previous. This ensures that all 'stop' methods have
  22054. a chance to execute at that location. In this scenario if one of
  22055. the methods returns 'True' but the others return 'False', the
  22056. inferior will still be stopped.
  22057. You should not alter the execution state of the inferior (i.e.,
  22058. step, next, etc.), alter the current frame context (i.e., change
  22059. the current active frame), or alter, add or delete any breakpoint.
  22060. As a general rule, you should not alter any data within GDB or the
  22061. inferior at this time.
  22062. Example 'stop' implementation:
  22063. class MyBreakpoint (gdb.Breakpoint):
  22064. def stop (self):
  22065. inf_val = gdb.parse_and_eval("foo")
  22066. if inf_val == 3:
  22067. return True
  22068. return False
  22069. -- Function: Breakpoint.is_valid ()
  22070. Return 'True' if this 'Breakpoint' object is valid, 'False'
  22071. otherwise. A 'Breakpoint' object can become invalid if the user
  22072. deletes the breakpoint. In this case, the object still exists, but
  22073. the underlying breakpoint does not. In the cases of watchpoint
  22074. scope, the watchpoint remains valid even if execution of the
  22075. inferior leaves the scope of that watchpoint.
  22076. -- Function: Breakpoint.delete ()
  22077. Permanently deletes the GDB breakpoint. This also invalidates the
  22078. Python 'Breakpoint' object. Any further access to this object's
  22079. attributes or methods will raise an error.
  22080. -- Variable: Breakpoint.enabled
  22081. This attribute is 'True' if the breakpoint is enabled, and 'False'
  22082. otherwise. This attribute is writable. You can use it to enable
  22083. or disable the breakpoint.
  22084. -- Variable: Breakpoint.silent
  22085. This attribute is 'True' if the breakpoint is silent, and 'False'
  22086. otherwise. This attribute is writable.
  22087. Note that a breakpoint can also be silent if it has commands and
  22088. the first command is 'silent'. This is not reported by the
  22089. 'silent' attribute.
  22090. -- Variable: Breakpoint.pending
  22091. This attribute is 'True' if the breakpoint is pending, and 'False'
  22092. otherwise. *Note Set Breaks::. This attribute is read-only.
  22093. -- Variable: Breakpoint.thread
  22094. If the breakpoint is thread-specific, this attribute holds the
  22095. thread's global id. If the breakpoint is not thread-specific, this
  22096. attribute is 'None'. This attribute is writable.
  22097. -- Variable: Breakpoint.task
  22098. If the breakpoint is Ada task-specific, this attribute holds the
  22099. Ada task id. If the breakpoint is not task-specific (or the
  22100. underlying language is not Ada), this attribute is 'None'. This
  22101. attribute is writable.
  22102. -- Variable: Breakpoint.ignore_count
  22103. This attribute holds the ignore count for the breakpoint, an
  22104. integer. This attribute is writable.
  22105. -- Variable: Breakpoint.number
  22106. This attribute holds the breakpoint's number -- the identifier used
  22107. by the user to manipulate the breakpoint. This attribute is not
  22108. writable.
  22109. -- Variable: Breakpoint.type
  22110. This attribute holds the breakpoint's type -- the identifier used
  22111. to determine the actual breakpoint type or use-case. This
  22112. attribute is not writable.
  22113. -- Variable: Breakpoint.visible
  22114. This attribute tells whether the breakpoint is visible to the user
  22115. when set, or when the 'info breakpoints' command is run. This
  22116. attribute is not writable.
  22117. -- Variable: Breakpoint.temporary
  22118. This attribute indicates whether the breakpoint was created as a
  22119. temporary breakpoint. Temporary breakpoints are automatically
  22120. deleted after that breakpoint has been hit. Access to this
  22121. attribute, and all other attributes and functions other than the
  22122. 'is_valid' function, will result in an error after the breakpoint
  22123. has been hit (as it has been automatically deleted). This
  22124. attribute is not writable.
  22125. -- Variable: Breakpoint.hit_count
  22126. This attribute holds the hit count for the breakpoint, an integer.
  22127. This attribute is writable, but currently it can only be set to
  22128. zero.
  22129. -- Variable: Breakpoint.location
  22130. This attribute holds the location of the breakpoint, as specified
  22131. by the user. It is a string. If the breakpoint does not have a
  22132. location (that is, it is a watchpoint) the attribute's value is
  22133. 'None'. This attribute is not writable.
  22134. -- Variable: Breakpoint.expression
  22135. This attribute holds a breakpoint expression, as specified by the
  22136. user. It is a string. If the breakpoint does not have an
  22137. expression (the breakpoint is not a watchpoint) the attribute's
  22138. value is 'None'. This attribute is not writable.
  22139. -- Variable: Breakpoint.condition
  22140. This attribute holds the condition of the breakpoint, as specified
  22141. by the user. It is a string. If there is no condition, this
  22142. attribute's value is 'None'. This attribute is writable.
  22143. -- Variable: Breakpoint.commands
  22144. This attribute holds the commands attached to the breakpoint. If
  22145. there are commands, this attribute's value is a string holding all
  22146. the commands, separated by newlines. If there are no commands,
  22147. this attribute is 'None'. This attribute is writable.
  22148. 
  22149. File: gdb.info, Node: Finish Breakpoints in Python, Next: Lazy Strings In Python, Prev: Breakpoints In Python, Up: Python API
  22150. 23.2.2.31 Finish Breakpoints
  22151. ............................
  22152. A finish breakpoint is a temporary breakpoint set at the return address
  22153. of a frame, based on the 'finish' command. 'gdb.FinishBreakpoint'
  22154. extends 'gdb.Breakpoint'. The underlying breakpoint will be disabled
  22155. and deleted when the execution will run out of the breakpoint scope
  22156. (i.e. 'Breakpoint.stop' or 'FinishBreakpoint.out_of_scope' triggered).
  22157. Finish breakpoints are thread specific and must be create with the right
  22158. thread selected.
  22159. -- Function: FinishBreakpoint.__init__ ([frame] [, internal])
  22160. Create a finish breakpoint at the return address of the 'gdb.Frame'
  22161. object FRAME. If FRAME is not provided, this defaults to the
  22162. newest frame. The optional INTERNAL argument allows the breakpoint
  22163. to become invisible to the user. *Note Breakpoints In Python::,
  22164. for further details about this argument.
  22165. -- Function: FinishBreakpoint.out_of_scope (self)
  22166. In some circumstances (e.g. 'longjmp', C++ exceptions, GDB 'return'
  22167. command, ...), a function may not properly terminate, and thus
  22168. never hit the finish breakpoint. When GDB notices such a
  22169. situation, the 'out_of_scope' callback will be triggered.
  22170. You may want to sub-class 'gdb.FinishBreakpoint' and override this
  22171. method:
  22172. class MyFinishBreakpoint (gdb.FinishBreakpoint)
  22173. def stop (self):
  22174. print "normal finish"
  22175. return True
  22176. def out_of_scope ():
  22177. print "abnormal finish"
  22178. -- Variable: FinishBreakpoint.return_value
  22179. When GDB is stopped at a finish breakpoint and the frame used to
  22180. build the 'gdb.FinishBreakpoint' object had debug symbols, this
  22181. attribute will contain a 'gdb.Value' object corresponding to the
  22182. return value of the function. The value will be 'None' if the
  22183. function return type is 'void' or if the return value was not
  22184. computable. This attribute is not writable.
  22185. 
  22186. File: gdb.info, Node: Lazy Strings In Python, Next: Architectures In Python, Prev: Finish Breakpoints in Python, Up: Python API
  22187. 23.2.2.32 Python representation of lazy strings
  22188. ...............................................
  22189. A "lazy string" is a string whose contents is not retrieved or encoded
  22190. until it is needed.
  22191. A 'gdb.LazyString' is represented in GDB as an 'address' that points
  22192. to a region of memory, an 'encoding' that will be used to encode that
  22193. region of memory, and a 'length' to delimit the region of memory that
  22194. represents the string. The difference between a 'gdb.LazyString' and a
  22195. string wrapped within a 'gdb.Value' is that a 'gdb.LazyString' will be
  22196. treated differently by GDB when printing. A 'gdb.LazyString' is
  22197. retrieved and encoded during printing, while a 'gdb.Value' wrapping a
  22198. string is immediately retrieved and encoded on creation.
  22199. A 'gdb.LazyString' object has the following functions:
  22200. -- Function: LazyString.value ()
  22201. Convert the 'gdb.LazyString' to a 'gdb.Value'. This value will
  22202. point to the string in memory, but will lose all the delayed
  22203. retrieval, encoding and handling that GDB applies to a
  22204. 'gdb.LazyString'.
  22205. -- Variable: LazyString.address
  22206. This attribute holds the address of the string. This attribute is
  22207. not writable.
  22208. -- Variable: LazyString.length
  22209. This attribute holds the length of the string in characters. If
  22210. the length is -1, then the string will be fetched and encoded up to
  22211. the first null of appropriate width. This attribute is not
  22212. writable.
  22213. -- Variable: LazyString.encoding
  22214. This attribute holds the encoding that will be applied to the
  22215. string when the string is printed by GDB. If the encoding is not
  22216. set, or contains an empty string, then GDB will select the most
  22217. appropriate encoding when the string is printed. This attribute is
  22218. not writable.
  22219. -- Variable: LazyString.type
  22220. This attribute holds the type that is represented by the lazy
  22221. string's type. For a lazy string this is a pointer or array type.
  22222. To resolve this to the lazy string's character type, use the type's
  22223. 'target' method. *Note Types In Python::. This attribute is not
  22224. writable.
  22225. 
  22226. File: gdb.info, Node: Architectures In Python, Next: Registers In Python, Prev: Lazy Strings In Python, Up: Python API
  22227. 23.2.2.33 Python representation of architectures
  22228. ................................................
  22229. GDB uses architecture specific parameters and artifacts in a number of
  22230. its various computations. An architecture is represented by an instance
  22231. of the 'gdb.Architecture' class.
  22232. A 'gdb.Architecture' class has the following methods:
  22233. -- Function: Architecture.name ()
  22234. Return the name (string value) of the architecture.
  22235. -- Function: Architecture.disassemble (START_PC [, END_PC [, COUNT]])
  22236. Return a list of disassembled instructions starting from the memory
  22237. address START_PC. The optional arguments END_PC and COUNT
  22238. determine the number of instructions in the returned list. If both
  22239. the optional arguments END_PC and COUNT are specified, then a list
  22240. of at most COUNT disassembled instructions whose start address
  22241. falls in the closed memory address interval from START_PC to END_PC
  22242. are returned. If END_PC is not specified, but COUNT is specified,
  22243. then COUNT number of instructions starting from the address
  22244. START_PC are returned. If COUNT is not specified but END_PC is
  22245. specified, then all instructions whose start address falls in the
  22246. closed memory address interval from START_PC to END_PC are
  22247. returned. If neither END_PC nor COUNT are specified, then a single
  22248. instruction at START_PC is returned. For all of these cases, each
  22249. element of the returned list is a Python 'dict' with the following
  22250. string keys:
  22251. 'addr'
  22252. The value corresponding to this key is a Python long integer
  22253. capturing the memory address of the instruction.
  22254. 'asm'
  22255. The value corresponding to this key is a string value which
  22256. represents the instruction with assembly language mnemonics.
  22257. The assembly language flavor used is the same as that
  22258. specified by the current CLI variable 'disassembly-flavor'.
  22259. *Note Machine Code::.
  22260. 'length'
  22261. The value corresponding to this key is the length (integer
  22262. value) of the instruction in bytes.
  22263. -- Function: Architecture.registers ([ REGGROUP ])
  22264. Return a 'gdb.RegisterDescriptorIterator' (*note Registers In
  22265. Python::) for all of the registers in REGGROUP, a string that is
  22266. the name of a register group. If REGGROUP is omitted, or is the
  22267. empty string, then the register group 'all' is assumed.
  22268. -- Function: Architecture.register_groups ()
  22269. Return a 'gdb.RegisterGroupsIterator' (*note Registers In Python::)
  22270. for all of the register groups available for the
  22271. 'gdb.Architecture'.
  22272. 
  22273. File: gdb.info, Node: Registers In Python, Next: TUI Windows In Python, Prev: Architectures In Python, Up: Python API
  22274. 23.2.2.34 Registers In Python
  22275. .............................
  22276. Python code can request from a 'gdb.Architecture' information about the
  22277. set of registers available (*note 'Architecture.registers':
  22278. gdbpy_architecture_registers.). The register information is returned as
  22279. a 'gdb.RegisterDescriptorIterator', which is an iterator that in turn
  22280. returns 'gdb.RegisterDescriptor' objects.
  22281. A 'gdb.RegisterDescriptor' does not provide the value of a register
  22282. (*note 'Frame.read_register': gdbpy_frame_read_register. for reading a
  22283. register's value), instead the 'RegisterDescriptor' is a way to discover
  22284. which registers are available for a particular architecture.
  22285. A 'gdb.RegisterDescriptor' has the following read-only properties:
  22286. -- Variable: RegisterDescriptor.name
  22287. The name of this register.
  22288. It is also possible to lookup a register descriptor based on its name
  22289. using the following 'gdb.RegisterDescriptorIterator' function:
  22290. -- Function: RegisterDescriptorIterator.find (NAME)
  22291. Takes NAME as an argument, which must be a string, and returns a
  22292. 'gdb.RegisterDescriptor' for the register with that name, or 'None'
  22293. if there is no register with that name.
  22294. Python code can also request from a 'gdb.Architecture' information
  22295. about the set of register groups available on a given architecture
  22296. (*note 'Architecture.register_groups': gdbpy_architecture_reggroups.).
  22297. Every register can be a member of zero or more register groups. Some
  22298. register groups are used internally within GDB to control things like
  22299. which registers must be saved when calling into the program being
  22300. debugged (*note Calling Program Functions: Calling.). Other register
  22301. groups exist to allow users to easily see related sets of registers in
  22302. commands like 'info registers' (*note 'info registers REGGROUP':
  22303. info_registers_reggroup.).
  22304. The register groups information is returned as a
  22305. 'gdb.RegisterGroupsIterator', which is an iterator that in turn returns
  22306. 'gdb.RegisterGroup' objects.
  22307. A 'gdb.RegisterGroup' object has the following read-only properties:
  22308. -- Variable: RegisterGroup.name
  22309. A string that is the name of this register group.
  22310. 
  22311. File: gdb.info, Node: TUI Windows In Python, Prev: Registers In Python, Up: Python API
  22312. 23.2.2.35 Implementing new TUI windows
  22313. ......................................
  22314. New TUI (*note TUI::) windows can be implemented in Python.
  22315. -- Function: gdb.register_window_type (NAME, FACTORY)
  22316. Because TUI windows are created and destroyed depending on the
  22317. layout the user chooses, new window types are implemented by
  22318. registering a factory function with GDB.
  22319. NAME is the name of the new window. It's an error to try to
  22320. replace one of the built-in windows, but other window types can be
  22321. replaced.
  22322. FUNCTION is a factory function that is called to create the TUI
  22323. window. This is called with a single argument of type
  22324. 'gdb.TuiWindow', described below. It should return an object that
  22325. implements the TUI window protocol, also described below.
  22326. As mentioned above, when a factory function is called, it is passed a
  22327. an object of type 'gdb.TuiWindow'. This object has these methods and
  22328. attributes:
  22329. -- Function: TuiWindow.is_valid ()
  22330. This method returns 'True' when this window is valid. When the
  22331. user changes the TUI layout, windows no longer visible in the new
  22332. layout will be destroyed. At this point, the 'gdb.TuiWindow' will
  22333. no longer be valid, and methods (and attributes) other than
  22334. 'is_valid' will throw an exception.
  22335. -- Variable: TuiWindow.width
  22336. This attribute holds the width of the window. It is not writable.
  22337. -- Variable: TuiWindow.height
  22338. This attribute holds the height of the window. It is not writable.
  22339. -- Variable: TuiWindow.title
  22340. This attribute holds the window's title, a string. This is
  22341. normally displayed above the window. This attribute can be
  22342. modified.
  22343. -- Function: TuiWindow.erase ()
  22344. Remove all the contents of the window.
  22345. -- Function: TuiWindow.write (STRING)
  22346. Write STRING to the window. STRING can contain ANSI terminal
  22347. escape styling sequences; GDB will translate these as appropriate
  22348. for the terminal.
  22349. The factory function that you supply should return an object
  22350. conforming to the TUI window protocol. These are the method that can be
  22351. called on this object, which is referred to below as the "window
  22352. object". The methods documented below are optional; if the object does
  22353. not implement one of these methods, GDB will not attempt to call it.
  22354. Additional new methods may be added to the window protocol in the
  22355. future. GDB guarantees that they will begin with a lower-case letter,
  22356. so you can start implementation methods with upper-case letters or
  22357. underscore to avoid any future conflicts.
  22358. -- Function: Window.close ()
  22359. When the TUI window is closed, the 'gdb.TuiWindow' object will be
  22360. put into an invalid state. At this time, GDB will call 'close'
  22361. method on the window object.
  22362. After this method is called, GDB will discard any references it
  22363. holds on this window object, and will no longer call methods on
  22364. this object.
  22365. -- Function: Window.render ()
  22366. In some situations, a TUI window can change size. For example,
  22367. this can happen if the user resizes the terminal, or changes the
  22368. layout. When this happens, GDB will call the 'render' method on
  22369. the window object.
  22370. If your window is intended to update in response to changes in the
  22371. inferior, you will probably also want to register event listeners
  22372. and send output to the 'gdb.TuiWindow'.
  22373. -- Function: Window.hscroll (NUM)
  22374. This is a request to scroll the window horizontally. NUM is the
  22375. amount by which to scroll, with negative numbers meaning to scroll
  22376. right. In the TUI model, it is the viewport that moves, not the
  22377. contents. A positive argument should cause the viewport to move
  22378. right, and so the content should appear to move to the left.
  22379. -- Function: Window.vscroll (NUM)
  22380. This is a request to scroll the window vertically. NUM is the
  22381. amount by which to scroll, with negative numbers meaning to scroll
  22382. backward. In the TUI model, it is the viewport that moves, not the
  22383. contents. A positive argument should cause the viewport to move
  22384. down, and so the content should appear to move up.
  22385. 
  22386. File: gdb.info, Node: Python Auto-loading, Next: Python modules, Prev: Python API, Up: Python
  22387. 23.2.3 Python Auto-loading
  22388. --------------------------
  22389. When a new object file is read (for example, due to the 'file' command,
  22390. or because the inferior has loaded a shared library), GDB will look for
  22391. Python support scripts in several ways: 'OBJFILE-gdb.py' and
  22392. '.debug_gdb_scripts' section. *Note Auto-loading extensions::.
  22393. The auto-loading feature is useful for supplying application-specific
  22394. debugging commands and scripts.
  22395. Auto-loading can be enabled or disabled, and the list of auto-loaded
  22396. scripts can be printed.
  22397. 'set auto-load python-scripts [on|off]'
  22398. Enable or disable the auto-loading of Python scripts.
  22399. 'show auto-load python-scripts'
  22400. Show whether auto-loading of Python scripts is enabled or disabled.
  22401. 'info auto-load python-scripts [REGEXP]'
  22402. Print the list of all Python scripts that GDB auto-loaded.
  22403. Also printed is the list of Python scripts that were mentioned in
  22404. the '.debug_gdb_scripts' section and were either not found (*note
  22405. dotdebug_gdb_scripts section::) or were not auto-loaded due to
  22406. 'auto-load safe-path' rejection (*note Auto-loading::). This is
  22407. useful because their names are not printed when GDB tries to load
  22408. them and fails. There may be many of them, and printing an error
  22409. message for each one is problematic.
  22410. If REGEXP is supplied only Python scripts with matching names are
  22411. printed.
  22412. Example:
  22413. (gdb) info auto-load python-scripts
  22414. Loaded Script
  22415. Yes py-section-script.py
  22416. full name: /tmp/py-section-script.py
  22417. No my-foo-pretty-printers.py
  22418. When reading an auto-loaded file or script, GDB sets the "current
  22419. objfile". This is available via the 'gdb.current_objfile' function
  22420. (*note Objfiles In Python::). This can be useful for registering
  22421. objfile-specific pretty-printers and frame-filters.
  22422. 
  22423. File: gdb.info, Node: Python modules, Prev: Python Auto-loading, Up: Python
  22424. 23.2.4 Python modules
  22425. ---------------------
  22426. GDB comes with several modules to assist writing Python code.
  22427. * Menu:
  22428. * gdb.printing:: Building and registering pretty-printers.
  22429. * gdb.types:: Utilities for working with types.
  22430. * gdb.prompt:: Utilities for prompt value substitution.
  22431. 
  22432. File: gdb.info, Node: gdb.printing, Next: gdb.types, Up: Python modules
  22433. 23.2.4.1 gdb.printing
  22434. .....................
  22435. This module provides a collection of utilities for working with
  22436. pretty-printers.
  22437. 'PrettyPrinter (NAME, SUBPRINTERS=None)'
  22438. This class specifies the API that makes 'info pretty-printer',
  22439. 'enable pretty-printer' and 'disable pretty-printer' work.
  22440. Pretty-printers should generally inherit from this class.
  22441. 'SubPrettyPrinter (NAME)'
  22442. For printers that handle multiple types, this class specifies the
  22443. corresponding API for the subprinters.
  22444. 'RegexpCollectionPrettyPrinter (NAME)'
  22445. Utility class for handling multiple printers, all recognized via
  22446. regular expressions. *Note Writing a Pretty-Printer::, for an
  22447. example.
  22448. 'FlagEnumerationPrinter (NAME)'
  22449. A pretty-printer which handles printing of 'enum' values. Unlike
  22450. GDB's built-in 'enum' printing, this printer attempts to work
  22451. properly when there is some overlap between the enumeration
  22452. constants. The argument NAME is the name of the printer and also
  22453. the name of the 'enum' type to look up.
  22454. 'register_pretty_printer (OBJ, PRINTER, REPLACE=False)'
  22455. Register PRINTER with the pretty-printer list of OBJ. If REPLACE
  22456. is 'True' then any existing copy of the printer is replaced.
  22457. Otherwise a 'RuntimeError' exception is raised if a printer with
  22458. the same name already exists.
  22459. 
  22460. File: gdb.info, Node: gdb.types, Next: gdb.prompt, Prev: gdb.printing, Up: Python modules
  22461. 23.2.4.2 gdb.types
  22462. ..................
  22463. This module provides a collection of utilities for working with
  22464. 'gdb.Type' objects.
  22465. 'get_basic_type (TYPE)'
  22466. Return TYPE with const and volatile qualifiers stripped, and with
  22467. typedefs and C++ references converted to the underlying type.
  22468. C++ example:
  22469. typedef const int const_int;
  22470. const_int foo (3);
  22471. const_int& foo_ref (foo);
  22472. int main () { return 0; }
  22473. Then in gdb:
  22474. (gdb) start
  22475. (gdb) python import gdb.types
  22476. (gdb) python foo_ref = gdb.parse_and_eval("foo_ref")
  22477. (gdb) python print gdb.types.get_basic_type(foo_ref.type)
  22478. int
  22479. 'has_field (TYPE, FIELD)'
  22480. Return 'True' if TYPE, assumed to be a type with fields (e.g., a
  22481. structure or union), has field FIELD.
  22482. 'make_enum_dict (ENUM_TYPE)'
  22483. Return a Python 'dictionary' type produced from ENUM_TYPE.
  22484. 'deep_items (TYPE)'
  22485. Returns a Python iterator similar to the standard
  22486. 'gdb.Type.iteritems' method, except that the iterator returned by
  22487. 'deep_items' will recursively traverse anonymous struct or union
  22488. fields. For example:
  22489. struct A
  22490. {
  22491. int a;
  22492. union {
  22493. int b0;
  22494. int b1;
  22495. };
  22496. };
  22497. Then in GDB:
  22498. (gdb) python import gdb.types
  22499. (gdb) python struct_a = gdb.lookup_type("struct A")
  22500. (gdb) python print struct_a.keys ()
  22501. {['a', '']}
  22502. (gdb) python print [k for k,v in gdb.types.deep_items(struct_a)]
  22503. {['a', 'b0', 'b1']}
  22504. 'get_type_recognizers ()'
  22505. Return a list of the enabled type recognizers for the current
  22506. context. This is called by GDB during the type-printing process
  22507. (*note Type Printing API::).
  22508. 'apply_type_recognizers (recognizers, type_obj)'
  22509. Apply the type recognizers, RECOGNIZERS, to the type object
  22510. TYPE_OBJ. If any recognizer returns a string, return that string.
  22511. Otherwise, return 'None'. This is called by GDB during the
  22512. type-printing process (*note Type Printing API::).
  22513. 'register_type_printer (locus, printer)'
  22514. This is a convenience function to register a type printer PRINTER.
  22515. The printer must implement the type printer protocol. The LOCUS
  22516. argument is either a 'gdb.Objfile', in which case the printer is
  22517. registered with that objfile; a 'gdb.Progspace', in which case the
  22518. printer is registered with that progspace; or 'None', in which case
  22519. the printer is registered globally.
  22520. 'TypePrinter'
  22521. This is a base class that implements the type printer protocol.
  22522. Type printers are encouraged, but not required, to derive from this
  22523. class. It defines a constructor:
  22524. -- Method on TypePrinter: __init__ (self, name)
  22525. Initialize the type printer with the given name. The new
  22526. printer starts in the enabled state.
  22527. 
  22528. File: gdb.info, Node: gdb.prompt, Prev: gdb.types, Up: Python modules
  22529. 23.2.4.3 gdb.prompt
  22530. ...................
  22531. This module provides a method for prompt value-substitution.
  22532. 'substitute_prompt (STRING)'
  22533. Return STRING with escape sequences substituted by values. Some
  22534. escape sequences take arguments. You can specify arguments inside
  22535. "{}" immediately following the escape sequence.
  22536. The escape sequences you can pass to this function are:
  22537. '\\'
  22538. Substitute a backslash.
  22539. '\e'
  22540. Substitute an ESC character.
  22541. '\f'
  22542. Substitute the selected frame; an argument names a frame
  22543. parameter.
  22544. '\n'
  22545. Substitute a newline.
  22546. '\p'
  22547. Substitute a parameter's value; the argument names the
  22548. parameter.
  22549. '\r'
  22550. Substitute a carriage return.
  22551. '\t'
  22552. Substitute the selected thread; an argument names a thread
  22553. parameter.
  22554. '\v'
  22555. Substitute the version of GDB.
  22556. '\w'
  22557. Substitute the current working directory.
  22558. '\['
  22559. Begin a sequence of non-printing characters. These sequences
  22560. are typically used with the ESC character, and are not counted
  22561. in the string length. Example: "\[\e[0;34m\](gdb)\[\e[0m\]"
  22562. will return a blue-colored "(gdb)" prompt where the length is
  22563. five.
  22564. '\]'
  22565. End a sequence of non-printing characters.
  22566. For example:
  22567. substitute_prompt ("frame: \f, args: \p{print frame-arguments}")
  22568. will return the string:
  22569. "frame: main, args: scalars"
  22570. 
  22571. File: gdb.info, Node: Guile, Next: Auto-loading extensions, Prev: Python, Up: Extending GDB
  22572. 23.3 Extending GDB using Guile
  22573. ==============================
  22574. You can extend GDB using the Guile implementation of the Scheme
  22575. programming language (http://www.gnu.org/software/guile/). This feature
  22576. is available only if GDB was configured using '--with-guile'.
  22577. * Menu:
  22578. * Guile Introduction:: Introduction to Guile scripting in GDB
  22579. * Guile Commands:: Accessing Guile from GDB
  22580. * Guile API:: Accessing GDB from Guile
  22581. * Guile Auto-loading:: Automatically loading Guile code
  22582. * Guile Modules:: Guile modules provided by GDB
  22583. 
  22584. File: gdb.info, Node: Guile Introduction, Next: Guile Commands, Up: Guile
  22585. 23.3.1 Guile Introduction
  22586. -------------------------
  22587. Guile is an implementation of the Scheme programming language and is the
  22588. GNU project's official extension language.
  22589. Guile support in GDB follows the Python support in GDB reasonably
  22590. closely, so concepts there should carry over. However, some things are
  22591. done differently where it makes sense.
  22592. GDB requires Guile version 3.0, 2.2, or 2.0.
  22593. Guile scripts used by GDB should be installed in
  22594. 'DATA-DIRECTORY/guile', where DATA-DIRECTORY is the data directory as
  22595. determined at GDB startup (*note Data Files::). This directory, known
  22596. as the "guile directory", is automatically added to the Guile Search
  22597. Path in order to allow the Guile interpreter to locate all scripts
  22598. installed at this location.
  22599. 
  22600. File: gdb.info, Node: Guile Commands, Next: Guile API, Prev: Guile Introduction, Up: Guile
  22601. 23.3.2 Guile Commands
  22602. ---------------------
  22603. GDB provides two commands for accessing the Guile interpreter:
  22604. 'guile-repl'
  22605. 'gr'
  22606. The 'guile-repl' command can be used to start an interactive Guile
  22607. prompt or "repl". To return to GDB, type ',q' or the 'EOF'
  22608. character (e.g., 'Ctrl-D' on an empty prompt). These commands do
  22609. not take any arguments.
  22610. 'guile [SCHEME-EXPRESSION]'
  22611. 'gu [SCHEME-EXPRESSION]'
  22612. The 'guile' command can be used to evaluate a Scheme expression.
  22613. If given an argument, GDB will pass the argument to the Guile
  22614. interpreter for evaluation.
  22615. (gdb) guile (display (+ 20 3)) (newline)
  22616. 23
  22617. The result of the Scheme expression is displayed using normal Guile
  22618. rules.
  22619. (gdb) guile (+ 20 3)
  22620. 23
  22621. If you do not provide an argument to 'guile', it will act as a
  22622. multi-line command, like 'define'. In this case, the Guile script
  22623. is made up of subsequent command lines, given after the 'guile'
  22624. command. This command list is terminated using a line containing
  22625. 'end'. For example:
  22626. (gdb) guile
  22627. >(display 23)
  22628. >(newline)
  22629. >end
  22630. 23
  22631. It is also possible to execute a Guile script from the GDB
  22632. interpreter:
  22633. 'source script-name'
  22634. The script name must end with '.scm' and GDB must be configured to
  22635. recognize the script language based on filename extension using the
  22636. 'script-extension' setting. *Note Extending GDB: Extending GDB.
  22637. 'guile (load "script-name")'
  22638. This method uses the 'load' Guile function. It takes a string
  22639. argument that is the name of the script to load. See the Guile
  22640. documentation for a description of this function. (*note
  22641. (guile)Loading::).
  22642. 
  22643. File: gdb.info, Node: Guile API, Next: Guile Auto-loading, Prev: Guile Commands, Up: Guile
  22644. 23.3.3 Guile API
  22645. ----------------
  22646. You can get quick online help for GDB's Guile API by issuing the command
  22647. 'help guile', or by issuing the command ',help' from an interactive
  22648. Guile session. Furthermore, most Guile procedures provided by GDB have
  22649. doc strings which can be obtained with ',describe PROCEDURE-NAME' or ',d
  22650. PROCEDURE-NAME' from the Guile interactive prompt.
  22651. * Menu:
  22652. * Basic Guile:: Basic Guile Functions
  22653. * Guile Configuration:: Guile configuration variables
  22654. * GDB Scheme Data Types:: Scheme representations of GDB objects
  22655. * Guile Exception Handling:: How Guile exceptions are translated
  22656. * Values From Inferior In Guile:: Guile representation of values
  22657. * Arithmetic In Guile:: Arithmetic in Guile
  22658. * Types In Guile:: Guile representation of types
  22659. * Guile Pretty Printing API:: Pretty-printing values with Guile
  22660. * Selecting Guile Pretty-Printers:: How GDB chooses a pretty-printer
  22661. * Writing a Guile Pretty-Printer:: Writing a pretty-printer
  22662. * Commands In Guile:: Implementing new commands in Guile
  22663. * Parameters In Guile:: Adding new GDB parameters
  22664. * Progspaces In Guile:: Program spaces
  22665. * Objfiles In Guile:: Object files in Guile
  22666. * Frames In Guile:: Accessing inferior stack frames from Guile
  22667. * Blocks In Guile:: Accessing blocks from Guile
  22668. * Symbols In Guile:: Guile representation of symbols
  22669. * Symbol Tables In Guile:: Guile representation of symbol tables
  22670. * Breakpoints In Guile:: Manipulating breakpoints using Guile
  22671. * Lazy Strings In Guile:: Guile representation of lazy strings
  22672. * Architectures In Guile:: Guile representation of architectures
  22673. * Disassembly In Guile:: Disassembling instructions from Guile
  22674. * I/O Ports in Guile:: GDB I/O ports
  22675. * Memory Ports in Guile:: Accessing memory through ports and bytevectors
  22676. * Iterators In Guile:: Basic iterator support
  22677. 
  22678. File: gdb.info, Node: Basic Guile, Next: Guile Configuration, Up: Guile API
  22679. 23.3.3.1 Basic Guile
  22680. ....................
  22681. At startup, GDB overrides Guile's 'current-output-port' and
  22682. 'current-error-port' to print using GDB's output-paging streams. A
  22683. Guile program which outputs to one of these streams may have its output
  22684. interrupted by the user (*note Screen Size::). In this situation, a
  22685. Guile 'signal' exception is thrown with value 'SIGINT'.
  22686. Guile's history mechanism uses the same naming as GDB's, namely the
  22687. user of dollar-variables (e.g., $1, $2, etc.). The results of
  22688. evaluations in Guile and in GDB are counted separately, '$1' in Guile is
  22689. not the same value as '$1' in GDB.
  22690. GDB is not thread-safe. If your Guile program uses multiple threads,
  22691. you must be careful to only call GDB-specific functions in the GDB
  22692. thread.
  22693. Some care must be taken when writing Guile code to run in GDB. Two
  22694. things are worth noting in particular:
  22695. * GDB installs handlers for 'SIGCHLD' and 'SIGINT'. Guile code must
  22696. not override these, or even change the options using 'sigaction'.
  22697. If your program changes the handling of these signals, GDB will
  22698. most likely stop working correctly. Note that it is unfortunately
  22699. common for GUI toolkits to install a 'SIGCHLD' handler.
  22700. * GDB takes care to mark its internal file descriptors as
  22701. close-on-exec. However, this cannot be done in a thread-safe way
  22702. on all platforms. Your Guile programs should be aware of this and
  22703. should both create new file descriptors with the close-on-exec flag
  22704. set and arrange to close unneeded file descriptors before starting
  22705. a child process.
  22706. GDB introduces a new Guile module, named 'gdb'. All methods and
  22707. classes added by GDB are placed in this module. GDB does not
  22708. automatically 'import' the 'gdb' module, scripts must do this
  22709. themselves. There are various options for how to import a module, so
  22710. GDB leaves the choice of how the 'gdb' module is imported to the user.
  22711. To simplify interactive use, it is recommended to add one of the
  22712. following to your ~/.gdbinit.
  22713. guile (use-modules (gdb))
  22714. guile (use-modules ((gdb) #:renamer (symbol-prefix-proc 'gdb:)))
  22715. Which one to choose depends on your preference. The second one adds
  22716. 'gdb:' as a prefix to all module functions and variables.
  22717. The rest of this manual assumes the 'gdb' module has been imported
  22718. without any prefix. See the Guile documentation for 'use-modules' for
  22719. more information (*note (guile)Using Guile Modules::).
  22720. Example:
  22721. (gdb) guile (value-type (make-value 1))
  22722. ERROR: Unbound variable: value-type
  22723. Error while executing Scheme code.
  22724. (gdb) guile (use-modules (gdb))
  22725. (gdb) guile (value-type (make-value 1))
  22726. int
  22727. (gdb)
  22728. The '(gdb)' module provides these basic Guile functions.
  22729. -- Scheme Procedure: execute command [#:from-tty boolean] [#:to-string
  22730. boolean]
  22731. Evaluate COMMAND, a string, as a GDB CLI command. If a GDB
  22732. exception happens while COMMAND runs, it is translated as described
  22733. in *note Guile Exception Handling: Guile Exception Handling.
  22734. FROM-TTY specifies whether GDB ought to consider this command as
  22735. having originated from the user invoking it interactively. It must
  22736. be a boolean value. If omitted, it defaults to '#f'.
  22737. By default, any output produced by COMMAND is sent to GDB's
  22738. standard output (and to the log output if logging is turned on).
  22739. If the TO-STRING parameter is '#t', then output will be collected
  22740. by 'execute' and returned as a string. The default is '#f', in
  22741. which case the return value is unspecified. If TO-STRING is '#t',
  22742. the GDB virtual terminal will be temporarily set to unlimited width
  22743. and height, and its pagination will be disabled; *note Screen
  22744. Size::.
  22745. -- Scheme Procedure: history-ref number
  22746. Return a value from GDB's value history (*note Value History::).
  22747. The NUMBER argument indicates which history element to return. If
  22748. NUMBER is negative, then GDB will take its absolute value and count
  22749. backward from the last element (i.e., the most recent element) to
  22750. find the value to return. If NUMBER is zero, then GDB will return
  22751. the most recent element. If the element specified by NUMBER
  22752. doesn't exist in the value history, a 'gdb:error' exception will be
  22753. raised.
  22754. If no exception is raised, the return value is always an instance
  22755. of '<gdb:value>' (*note Values From Inferior In Guile::).
  22756. _Note:_ GDB's value history is independent of Guile's. '$1' in
  22757. GDB's value history contains the result of evaluating an expression
  22758. from GDB's command line and '$1' from Guile's history contains the
  22759. result of evaluating an expression from Guile's command line.
  22760. -- Scheme Procedure: history-append! value
  22761. Append VALUE, an instance of '<gdb:value>', to GDB's value history.
  22762. Return its index in the history.
  22763. Putting into history values returned by Guile extensions will allow
  22764. the user convenient access to those values via CLI history
  22765. facilities.
  22766. -- Scheme Procedure: parse-and-eval expression
  22767. Parse EXPRESSION as an expression in the current language, evaluate
  22768. it, and return the result as a '<gdb:value>'. The EXPRESSION must
  22769. be a string.
  22770. This function can be useful when implementing a new command (*note
  22771. Commands In Guile::), as it provides a way to parse the command's
  22772. arguments as an expression. It is also is useful when computing
  22773. values. For example, it is the only way to get the value of a
  22774. convenience variable (*note Convenience Vars::) as a '<gdb:value>'.
  22775. 
  22776. File: gdb.info, Node: Guile Configuration, Next: GDB Scheme Data Types, Prev: Basic Guile, Up: Guile API
  22777. 23.3.3.2 Guile Configuration
  22778. ............................
  22779. GDB provides these Scheme functions to access various configuration
  22780. parameters.
  22781. -- Scheme Procedure: data-directory
  22782. Return a string containing GDB's data directory. This directory
  22783. contains GDB's ancillary files.
  22784. -- Scheme Procedure: guile-data-directory
  22785. Return a string containing GDB's Guile data directory. This
  22786. directory contains the Guile modules provided by GDB.
  22787. -- Scheme Procedure: gdb-version
  22788. Return a string containing the GDB version.
  22789. -- Scheme Procedure: host-config
  22790. Return a string containing the host configuration. This is the
  22791. string passed to '--host' when GDB was configured.
  22792. -- Scheme Procedure: target-config
  22793. Return a string containing the target configuration. This is the
  22794. string passed to '--target' when GDB was configured.
  22795. 
  22796. File: gdb.info, Node: GDB Scheme Data Types, Next: Guile Exception Handling, Prev: Guile Configuration, Up: Guile API
  22797. 23.3.3.3 GDB Scheme Data Types
  22798. ..............................
  22799. The values exposed by GDB to Guile are known as "GDB objects". There
  22800. are several kinds of GDB object, and each is disjoint from all other
  22801. types known to Guile.
  22802. -- Scheme Procedure: gdb-object-kind object
  22803. Return the kind of the GDB object, e.g., '<gdb:breakpoint>', as a
  22804. symbol.
  22805. GDB defines the following object types:
  22806. '<gdb:arch>'
  22807. *Note Architectures In Guile::.
  22808. '<gdb:block>'
  22809. *Note Blocks In Guile::.
  22810. '<gdb:block-symbols-iterator>'
  22811. *Note Blocks In Guile::.
  22812. '<gdb:breakpoint>'
  22813. *Note Breakpoints In Guile::.
  22814. '<gdb:command>'
  22815. *Note Commands In Guile::.
  22816. '<gdb:exception>'
  22817. *Note Guile Exception Handling::.
  22818. '<gdb:frame>'
  22819. *Note Frames In Guile::.
  22820. '<gdb:iterator>'
  22821. *Note Iterators In Guile::.
  22822. '<gdb:lazy-string>'
  22823. *Note Lazy Strings In Guile::.
  22824. '<gdb:objfile>'
  22825. *Note Objfiles In Guile::.
  22826. '<gdb:parameter>'
  22827. *Note Parameters In Guile::.
  22828. '<gdb:pretty-printer>'
  22829. *Note Guile Pretty Printing API::.
  22830. '<gdb:pretty-printer-worker>'
  22831. *Note Guile Pretty Printing API::.
  22832. '<gdb:progspace>'
  22833. *Note Progspaces In Guile::.
  22834. '<gdb:symbol>'
  22835. *Note Symbols In Guile::.
  22836. '<gdb:symtab>'
  22837. *Note Symbol Tables In Guile::.
  22838. '<gdb:sal>'
  22839. *Note Symbol Tables In Guile::.
  22840. '<gdb:type>'
  22841. *Note Types In Guile::.
  22842. '<gdb:field>'
  22843. *Note Types In Guile::.
  22844. '<gdb:value>'
  22845. *Note Values From Inferior In Guile::.
  22846. The following GDB objects are managed internally so that the Scheme
  22847. function 'eq?' may be applied to them.
  22848. '<gdb:arch>'
  22849. '<gdb:block>'
  22850. '<gdb:breakpoint>'
  22851. '<gdb:frame>'
  22852. '<gdb:objfile>'
  22853. '<gdb:progspace>'
  22854. '<gdb:symbol>'
  22855. '<gdb:symtab>'
  22856. '<gdb:type>'
  22857. 
  22858. File: gdb.info, Node: Guile Exception Handling, Next: Values From Inferior In Guile, Prev: GDB Scheme Data Types, Up: Guile API
  22859. 23.3.3.4 Guile Exception Handling
  22860. .................................
  22861. When executing the 'guile' command, Guile exceptions uncaught within the
  22862. Guile code are translated to calls to the GDB error-reporting mechanism.
  22863. If the command that called 'guile' does not handle the error, GDB will
  22864. terminate it and report the error according to the setting of the 'guile
  22865. print-stack' parameter.
  22866. The 'guile print-stack' parameter has three settings:
  22867. 'none'
  22868. Nothing is printed.
  22869. 'message'
  22870. An error message is printed containing the Guile exception name,
  22871. the associated value, and the Guile call stack backtrace at the
  22872. point where the exception was raised. Example:
  22873. (gdb) guile (display foo)
  22874. ERROR: In procedure memoize-variable-access!:
  22875. ERROR: Unbound variable: foo
  22876. Error while executing Scheme code.
  22877. 'full'
  22878. In addition to an error message a full backtrace is printed.
  22879. (gdb) set guile print-stack full
  22880. (gdb) guile (display foo)
  22881. Guile Backtrace:
  22882. In ice-9/boot-9.scm:
  22883. 157: 10 [catch #t #<catch-closure 2c76e20> ...]
  22884. In unknown file:
  22885. ?: 9 [apply-smob/1 #<catch-closure 2c76e20>]
  22886. In ice-9/boot-9.scm:
  22887. 157: 8 [catch #t #<catch-closure 2c76d20> ...]
  22888. In unknown file:
  22889. ?: 7 [apply-smob/1 #<catch-closure 2c76d20>]
  22890. ?: 6 [call-with-input-string "(display foo)" ...]
  22891. In ice-9/boot-9.scm:
  22892. 2320: 5 [save-module-excursion #<procedure 2c2dc30 ... ()>]
  22893. In ice-9/eval-string.scm:
  22894. 44: 4 [read-and-eval #<input: string 27cb410> #:lang ...]
  22895. 37: 3 [lp (display foo)]
  22896. In ice-9/eval.scm:
  22897. 387: 2 [eval # ()]
  22898. 393: 1 [eval #<memoized foo> ()]
  22899. In unknown file:
  22900. ?: 0 [memoize-variable-access! #<memoized foo> ...]
  22901. ERROR: In procedure memoize-variable-access!:
  22902. ERROR: Unbound variable: foo
  22903. Error while executing Scheme code.
  22904. GDB errors that happen in GDB commands invoked by Guile code are
  22905. converted to Guile exceptions. The type of the Guile exception depends
  22906. on the error.
  22907. Guile procedures provided by GDB can throw the standard Guile
  22908. exceptions like 'wrong-type-arg' and 'out-of-range'.
  22909. User interrupt (via 'C-c' or by typing 'q' at a pagination prompt) is
  22910. translated to a Guile 'signal' exception with value 'SIGINT'.
  22911. GDB Guile procedures can also throw these exceptions:
  22912. 'gdb:error'
  22913. This exception is a catch-all for errors generated from within GDB.
  22914. 'gdb:invalid-object'
  22915. This exception is thrown when accessing Guile objects that wrap
  22916. underlying GDB objects have become invalid. For example, a
  22917. '<gdb:breakpoint>' object becomes invalid if the user deletes it
  22918. from the command line. The object still exists in Guile, but the
  22919. object it represents is gone. Further operations on this
  22920. breakpoint will throw this exception.
  22921. 'gdb:memory-error'
  22922. This exception is thrown when an operation tried to access invalid
  22923. memory in the inferior.
  22924. 'gdb:pp-type-error'
  22925. This exception is thrown when a Guile pretty-printer passes a bad
  22926. object to GDB.
  22927. The following exception-related procedures are provided by the
  22928. '(gdb)' module.
  22929. -- Scheme Procedure: make-exception key args
  22930. Return a '<gdb:exception>' object given by its KEY and ARGS, which
  22931. are the standard Guile parameters of an exception. See the Guile
  22932. documentation for more information (*note (guile)Exceptions::).
  22933. -- Scheme Procedure: exception? object
  22934. Return '#t' if OBJECT is a '<gdb:exception>' object. Otherwise
  22935. return '#f'.
  22936. -- Scheme Procedure: exception-key exception
  22937. Return the ARGS field of a '<gdb:exception>' object.
  22938. -- Scheme Procedure: exception-args exception
  22939. Return the ARGS field of a '<gdb:exception>' object.
  22940. 
  22941. File: gdb.info, Node: Values From Inferior In Guile, Next: Arithmetic In Guile, Prev: Guile Exception Handling, Up: Guile API
  22942. 23.3.3.5 Values From Inferior In Guile
  22943. ......................................
  22944. GDB provides values it obtains from the inferior program in an object of
  22945. type '<gdb:value>'. GDB uses this object for its internal bookkeeping
  22946. of the inferior's values, and for fetching values when necessary.
  22947. GDB does not memoize '<gdb:value>' objects. 'make-value' always
  22948. returns a fresh object.
  22949. (gdb) guile (eq? (make-value 1) (make-value 1))
  22950. $1 = #f
  22951. (gdb) guile (equal? (make-value 1) (make-value 1))
  22952. $1 = #t
  22953. A '<gdb:value>' that represents a function can be executed via
  22954. inferior function call with 'value-call'. Any arguments provided to the
  22955. call must match the function's prototype, and must be provided in the
  22956. order specified by that prototype.
  22957. For example, 'some-val' is a '<gdb:value>' instance representing a
  22958. function that takes two integers as arguments. To execute this
  22959. function, call it like so:
  22960. (define result (value-call some-val 10 20))
  22961. Any values returned from a function call are '<gdb:value>' objects.
  22962. Note: Unlike Python scripting in GDB, inferior values that are simple
  22963. scalars cannot be used directly in Scheme expressions that are valid for
  22964. the value's data type. For example, '(+ (parse-and-eval "int_variable")
  22965. 2)' does not work. And inferior values that are structures or instances
  22966. of some class cannot be accessed using any special syntax, instead
  22967. 'value-field' must be used.
  22968. The following value-related procedures are provided by the '(gdb)'
  22969. module.
  22970. -- Scheme Procedure: value? object
  22971. Return '#t' if OBJECT is a '<gdb:value>' object. Otherwise return
  22972. '#f'.
  22973. -- Scheme Procedure: make-value value [#:type type]
  22974. Many Scheme values can be converted directly to a '<gdb:value>'
  22975. with this procedure. If TYPE is specified, the result is a value
  22976. of this type, and if VALUE can't be represented with this type an
  22977. exception is thrown. Otherwise the type of the result is
  22978. determined from VALUE as described below.
  22979. *Note Architectures In Guile::, for a list of the builtin types for
  22980. an architecture.
  22981. Here's how Scheme values are converted when TYPE argument to
  22982. 'make-value' is not specified:
  22983. Scheme boolean
  22984. A Scheme boolean is converted the boolean type for the current
  22985. language.
  22986. Scheme integer
  22987. A Scheme integer is converted to the first of a C 'int',
  22988. 'unsigned int', 'long', 'unsigned long', 'long long' or
  22989. 'unsigned long long' type for the current architecture that
  22990. can represent the value.
  22991. If the Scheme integer cannot be represented as a target
  22992. integer an 'out-of-range' exception is thrown.
  22993. Scheme real
  22994. A Scheme real is converted to the C 'double' type for the
  22995. current architecture.
  22996. Scheme string
  22997. A Scheme string is converted to a string in the current target
  22998. language using the current target encoding. Characters that
  22999. cannot be represented in the current target encoding are
  23000. replaced with the corresponding escape sequence. This is
  23001. Guile's 'SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE' conversion
  23002. strategy (*note (guile)Strings::).
  23003. Passing TYPE is not supported in this case, if it is provided
  23004. a 'wrong-type-arg' exception is thrown.
  23005. '<gdb:lazy-string>'
  23006. If VALUE is a '<gdb:lazy-string>' object (*note Lazy Strings
  23007. In Guile::), then the 'lazy-string->value' procedure is
  23008. called, and its result is used.
  23009. Passing TYPE is not supported in this case, if it is provided
  23010. a 'wrong-type-arg' exception is thrown.
  23011. Scheme bytevector
  23012. If VALUE is a Scheme bytevector and TYPE is provided, VALUE
  23013. must be the same size, in bytes, of values of type TYPE, and
  23014. the result is essentially created by using 'memcpy'.
  23015. If VALUE is a Scheme bytevector and TYPE is not provided, the
  23016. result is an array of type 'uint8' of the same length.
  23017. -- Scheme Procedure: value-optimized-out? value
  23018. Return '#t' if the compiler optimized out VALUE, thus it is not
  23019. available for fetching from the inferior. Otherwise return '#f'.
  23020. -- Scheme Procedure: value-address value
  23021. If VALUE is addressable, returns a '<gdb:value>' object
  23022. representing the address. Otherwise, '#f' is returned.
  23023. -- Scheme Procedure: value-type value
  23024. Return the type of VALUE as a '<gdb:type>' object (*note Types In
  23025. Guile::).
  23026. -- Scheme Procedure: value-dynamic-type value
  23027. Return the dynamic type of VALUE. This uses C++ run-time type
  23028. information (RTTI) to determine the dynamic type of the value. If
  23029. the value is of class type, it will return the class in which the
  23030. value is embedded, if any. If the value is of pointer or reference
  23031. to a class type, it will compute the dynamic type of the referenced
  23032. object, and return a pointer or reference to that type,
  23033. respectively. In all other cases, it will return the value's
  23034. static type.
  23035. Note that this feature will only work when debugging a C++ program
  23036. that includes RTTI for the object in question. Otherwise, it will
  23037. just return the static type of the value as in 'ptype foo'. *Note
  23038. ptype: Symbols.
  23039. -- Scheme Procedure: value-cast value type
  23040. Return a new instance of '<gdb:value>' that is the result of
  23041. casting VALUE to the type described by TYPE, which must be a
  23042. '<gdb:type>' object. If the cast cannot be performed for some
  23043. reason, this method throws an exception.
  23044. -- Scheme Procedure: value-dynamic-cast value type
  23045. Like 'value-cast', but works as if the C++ 'dynamic_cast' operator
  23046. were used. Consult a C++ reference for details.
  23047. -- Scheme Procedure: value-reinterpret-cast value type
  23048. Like 'value-cast', but works as if the C++ 'reinterpret_cast'
  23049. operator were used. Consult a C++ reference for details.
  23050. -- Scheme Procedure: value-dereference value
  23051. For pointer data types, this method returns a new '<gdb:value>'
  23052. object whose contents is the object pointed to by VALUE. For
  23053. example, if 'foo' is a C pointer to an 'int', declared in your C
  23054. program as
  23055. int *foo;
  23056. then you can use the corresponding '<gdb:value>' to access what
  23057. 'foo' points to like this:
  23058. (define bar (value-dereference foo))
  23059. The result 'bar' will be a '<gdb:value>' object holding the value
  23060. pointed to by 'foo'.
  23061. A similar function 'value-referenced-value' exists which also
  23062. returns '<gdb:value>' objects corresponding to the values pointed
  23063. to by pointer values (and additionally, values referenced by
  23064. reference values). However, the behavior of 'value-dereference'
  23065. differs from 'value-referenced-value' by the fact that the behavior
  23066. of 'value-dereference' is identical to applying the C unary
  23067. operator '*' on a given value. For example, consider a reference
  23068. to a pointer 'ptrref', declared in your C++ program as
  23069. typedef int *intptr;
  23070. ...
  23071. int val = 10;
  23072. intptr ptr = &val;
  23073. intptr &ptrref = ptr;
  23074. Though 'ptrref' is a reference value, one can apply the method
  23075. 'value-dereference' to the '<gdb:value>' object corresponding to it
  23076. and obtain a '<gdb:value>' which is identical to that corresponding
  23077. to 'val'. However, if you apply the method
  23078. 'value-referenced-value', the result would be a '<gdb:value>'
  23079. object identical to that corresponding to 'ptr'.
  23080. (define scm-ptrref (parse-and-eval "ptrref"))
  23081. (define scm-val (value-dereference scm-ptrref))
  23082. (define scm-ptr (value-referenced-value scm-ptrref))
  23083. The '<gdb:value>' object 'scm-val' is identical to that
  23084. corresponding to 'val', and 'scm-ptr' is identical to that
  23085. corresponding to 'ptr'. In general, 'value-dereference' can be
  23086. applied whenever the C unary operator '*' can be applied to the
  23087. corresponding C value. For those cases where applying both
  23088. 'value-dereference' and 'value-referenced-value' is allowed, the
  23089. results obtained need not be identical (as we have seen in the
  23090. above example). The results are however identical when applied on
  23091. '<gdb:value>' objects corresponding to pointers ('<gdb:value>'
  23092. objects with type code 'TYPE_CODE_PTR') in a C/C++ program.
  23093. -- Scheme Procedure: value-referenced-value value
  23094. For pointer or reference data types, this method returns a new
  23095. '<gdb:value>' object corresponding to the value referenced by the
  23096. pointer/reference value. For pointer data types,
  23097. 'value-dereference' and 'value-referenced-value' produce identical
  23098. results. The difference between these methods is that
  23099. 'value-dereference' cannot get the values referenced by reference
  23100. values. For example, consider a reference to an 'int', declared in
  23101. your C++ program as
  23102. int val = 10;
  23103. int &ref = val;
  23104. then applying 'value-dereference' to the '<gdb:value>' object
  23105. corresponding to 'ref' will result in an error, while applying
  23106. 'value-referenced-value' will result in a '<gdb:value>' object
  23107. identical to that corresponding to 'val'.
  23108. (define scm-ref (parse-and-eval "ref"))
  23109. (define err-ref (value-dereference scm-ref)) ;; error
  23110. (define scm-val (value-referenced-value scm-ref)) ;; ok
  23111. The '<gdb:value>' object 'scm-val' is identical to that
  23112. corresponding to 'val'.
  23113. -- Scheme Procedure: value-field value field-name
  23114. Return field FIELD-NAME from '<gdb:value>' object VALUE.
  23115. -- Scheme Procedure: value-subscript value index
  23116. Return the value of array VALUE at index INDEX. The VALUE argument
  23117. must be a subscriptable '<gdb:value>' object.
  23118. -- Scheme Procedure: value-call value arg-list
  23119. Perform an inferior function call, taking VALUE as a pointer to the
  23120. function to call. Each element of list ARG-LIST must be a
  23121. <gdb:value> object or an object that can be converted to a value.
  23122. The result is the value returned by the function.
  23123. -- Scheme Procedure: value->bool value
  23124. Return the Scheme boolean representing '<gdb:value>' VALUE. The
  23125. value must be "integer like". Pointers are ok.
  23126. -- Scheme Procedure: value->integer
  23127. Return the Scheme integer representing '<gdb:value>' VALUE. The
  23128. value must be "integer like". Pointers are ok.
  23129. -- Scheme Procedure: value->real
  23130. Return the Scheme real number representing '<gdb:value>' VALUE.
  23131. The value must be a number.
  23132. -- Scheme Procedure: value->bytevector
  23133. Return a Scheme bytevector with the raw contents of '<gdb:value>'
  23134. VALUE. No transformation, endian or otherwise, is performed.
  23135. -- Scheme Procedure: value->string value [#:encoding encoding]
  23136. [#:errors errors] [#:length length]
  23137. If VALUE> represents a string, then this method converts the
  23138. contents to a Guile string. Otherwise, this method will throw an
  23139. exception.
  23140. Values are interpreted as strings according to the rules of the
  23141. current language. If the optional length argument is given, the
  23142. string will be converted to that length, and will include any
  23143. embedded zeroes that the string may contain. Otherwise, for
  23144. languages where the string is zero-terminated, the entire string
  23145. will be converted.
  23146. For example, in C-like languages, a value is a string if it is a
  23147. pointer to or an array of characters or ints of type 'wchar_t',
  23148. 'char16_t', or 'char32_t'.
  23149. If the optional ENCODING argument is given, it must be a string
  23150. naming the encoding of the string in the '<gdb:value>', such as
  23151. '"ascii"', '"iso-8859-6"' or '"utf-8"'. It accepts the same
  23152. encodings as the corresponding argument to Guile's
  23153. 'scm_from_stringn' function, and the Guile codec machinery will be
  23154. used to convert the string. If ENCODING is not given, or if
  23155. ENCODING is the empty string, then either the 'target-charset'
  23156. (*note Character Sets::) will be used, or a language-specific
  23157. encoding will be used, if the current language is able to supply
  23158. one.
  23159. The optional ERRORS argument is one of '#f', 'error' or
  23160. 'substitute'. 'error' and 'substitute' must be symbols. If ERRORS
  23161. is not specified, or if its value is '#f', then the default
  23162. conversion strategy is used, which is set with the Scheme function
  23163. 'set-port-conversion-strategy!'. If the value is ''error' then an
  23164. exception is thrown if there is any conversion error. If the value
  23165. is ''substitute' then any conversion error is replaced with
  23166. question marks. *Note (guile)Strings::.
  23167. If the optional LENGTH argument is given, the string will be
  23168. fetched and converted to the given length. The length must be a
  23169. Scheme integer and not a '<gdb:value>' integer.
  23170. -- Scheme Procedure: value->lazy-string value [#:encoding encoding]
  23171. [#:length length]
  23172. If this '<gdb:value>' represents a string, then this method
  23173. converts VALUE to a '<gdb:lazy-string' (*note Lazy Strings In
  23174. Guile::). Otherwise, this method will throw an exception.
  23175. If the optional ENCODING argument is given, it must be a string
  23176. naming the encoding of the '<gdb:lazy-string'. Some examples are:
  23177. '"ascii"', '"iso-8859-6"' or '"utf-8"'. If the ENCODING argument
  23178. is an encoding that GDB does not recognize, GDB will raise an
  23179. error.
  23180. When a lazy string is printed, the GDB encoding machinery is used
  23181. to convert the string during printing. If the optional ENCODING
  23182. argument is not provided, or is an empty string, GDB will
  23183. automatically select the encoding most suitable for the string
  23184. type. For further information on encoding in GDB please see *note
  23185. Character Sets::.
  23186. If the optional LENGTH argument is given, the string will be
  23187. fetched and encoded to the length of characters specified. If the
  23188. LENGTH argument is not provided, the string will be fetched and
  23189. encoded until a null of appropriate width is found. The length
  23190. must be a Scheme integer and not a '<gdb:value>' integer.
  23191. -- Scheme Procedure: value-lazy? value
  23192. Return '#t' if VALUE has not yet been fetched from the inferior.
  23193. Otherwise return '#f'. GDB does not fetch values until necessary,
  23194. for efficiency. For example:
  23195. (define myval (parse-and-eval "somevar"))
  23196. The value of 'somevar' is not fetched at this time. It will be
  23197. fetched when the value is needed, or when the 'fetch-lazy'
  23198. procedure is invoked.
  23199. -- Scheme Procedure: make-lazy-value type address
  23200. Return a '<gdb:value>' that will be lazily fetched from the target.
  23201. The object of type '<gdb:type>' whose value to fetch is specified
  23202. by its TYPE and its target memory ADDRESS, which is a Scheme
  23203. integer.
  23204. -- Scheme Procedure: value-fetch-lazy! value
  23205. If VALUE is a lazy value ('(value-lazy? value)' is '#t'), then the
  23206. value is fetched from the inferior. Any errors that occur in the
  23207. process will produce a Guile exception.
  23208. If VALUE is not a lazy value, this method has no effect.
  23209. The result of this function is unspecified.
  23210. -- Scheme Procedure: value-print value
  23211. Return the string representation (print form) of '<gdb:value>'
  23212. VALUE.
  23213. 
  23214. File: gdb.info, Node: Arithmetic In Guile, Next: Types In Guile, Prev: Values From Inferior In Guile, Up: Guile API
  23215. 23.3.3.6 Arithmetic In Guile
  23216. ............................
  23217. The '(gdb)' module provides several functions for performing arithmetic
  23218. on '<gdb:value>' objects. The arithmetic is performed as if it were
  23219. done by the target, and therefore has target semantics which are not
  23220. necessarily those of Scheme. For example operations work with a fixed
  23221. precision, not the arbitrary precision of Scheme.
  23222. Wherever a function takes an integer or pointer as an operand, GDB
  23223. will convert appropriate Scheme values to perform the operation.
  23224. -- Scheme Procedure: value-add a b
  23225. -- Scheme Procedure: value-sub a b
  23226. -- Scheme Procedure: value-mul a b
  23227. -- Scheme Procedure: value-div a b
  23228. -- Scheme Procedure: value-rem a b
  23229. -- Scheme Procedure: value-mod a b
  23230. -- Scheme Procedure: value-pow a b
  23231. -- Scheme Procedure: value-not a
  23232. -- Scheme Procedure: value-neg a
  23233. -- Scheme Procedure: value-pos a
  23234. -- Scheme Procedure: value-abs a
  23235. -- Scheme Procedure: value-lsh a b
  23236. -- Scheme Procedure: value-rsh a b
  23237. -- Scheme Procedure: value-min a b
  23238. -- Scheme Procedure: value-max a b
  23239. -- Scheme Procedure: value-lognot a
  23240. -- Scheme Procedure: value-logand a b
  23241. -- Scheme Procedure: value-logior a b
  23242. -- Scheme Procedure: value-logxor a b
  23243. -- Scheme Procedure: value=? a b
  23244. -- Scheme Procedure: value<? a b
  23245. -- Scheme Procedure: value<=? a b
  23246. -- Scheme Procedure: value>? a b
  23247. -- Scheme Procedure: value>=? a b
  23248. Scheme does not provide a 'not-equal' function, and thus Guile
  23249. support in GDB does not either.
  23250. 
  23251. File: gdb.info, Node: Types In Guile, Next: Guile Pretty Printing API, Prev: Arithmetic In Guile, Up: Guile API
  23252. 23.3.3.7 Types In Guile
  23253. .......................
  23254. GDB represents types from the inferior in objects of type '<gdb:type>'.
  23255. The following type-related procedures are provided by the '(gdb)'
  23256. module.
  23257. -- Scheme Procedure: type? object
  23258. Return '#t' if OBJECT is an object of type '<gdb:type>'. Otherwise
  23259. return '#f'.
  23260. -- Scheme Procedure: lookup-type name [#:block block]
  23261. This function looks up a type by its NAME, which must be a string.
  23262. If BLOCK is given, it is an object of type '<gdb:block>', and NAME
  23263. is looked up in that scope. Otherwise, it is searched for
  23264. globally.
  23265. Ordinarily, this function will return an instance of '<gdb:type>'.
  23266. If the named type cannot be found, it will throw an exception.
  23267. -- Scheme Procedure: type-code type
  23268. Return the type code of TYPE. The type code will be one of the
  23269. 'TYPE_CODE_' constants defined below.
  23270. -- Scheme Procedure: type-tag type
  23271. Return the tag name of TYPE. The tag name is the name after
  23272. 'struct', 'union', or 'enum' in C and C++; not all languages have
  23273. this concept. If this type has no tag name, then '#f' is returned.
  23274. -- Scheme Procedure: type-name type
  23275. Return the name of TYPE. If this type has no name, then '#f' is
  23276. returned.
  23277. -- Scheme Procedure: type-print-name type
  23278. Return the print name of TYPE. This returns something even for
  23279. anonymous types. For example, for an anonymous C struct '"struct
  23280. {...}"' is returned.
  23281. -- Scheme Procedure: type-sizeof type
  23282. Return the size of this type, in target 'char' units. Usually, a
  23283. target's 'char' type will be an 8-bit byte. However, on some
  23284. unusual platforms, this type may have a different size.
  23285. -- Scheme Procedure: type-strip-typedefs type
  23286. Return a new '<gdb:type>' that represents the real type of TYPE,
  23287. after removing all layers of typedefs.
  23288. -- Scheme Procedure: type-array type n1 [n2]
  23289. Return a new '<gdb:type>' object which represents an array of this
  23290. type. If one argument is given, it is the inclusive upper bound of
  23291. the array; in this case the lower bound is zero. If two arguments
  23292. are given, the first argument is the lower bound of the array, and
  23293. the second argument is the upper bound of the array. An array's
  23294. length must not be negative, but the bounds can be.
  23295. -- Scheme Procedure: type-vector type n1 [n2]
  23296. Return a new '<gdb:type>' object which represents a vector of this
  23297. type. If one argument is given, it is the inclusive upper bound of
  23298. the vector; in this case the lower bound is zero. If two arguments
  23299. are given, the first argument is the lower bound of the vector, and
  23300. the second argument is the upper bound of the vector. A vector's
  23301. length must not be negative, but the bounds can be.
  23302. The difference between an 'array' and a 'vector' is that arrays
  23303. behave like in C: when used in expressions they decay to a pointer
  23304. to the first element whereas vectors are treated as first class
  23305. values.
  23306. -- Scheme Procedure: type-pointer type
  23307. Return a new '<gdb:type>' object which represents a pointer to
  23308. TYPE.
  23309. -- Scheme Procedure: type-range type
  23310. Return a list of two elements: the low bound and high bound of
  23311. TYPE. If TYPE does not have a range, an exception is thrown.
  23312. -- Scheme Procedure: type-reference type
  23313. Return a new '<gdb:type>' object which represents a reference to
  23314. TYPE.
  23315. -- Scheme Procedure: type-target type
  23316. Return a new '<gdb:type>' object which represents the target type
  23317. of TYPE.
  23318. For a pointer type, the target type is the type of the pointed-to
  23319. object. For an array type (meaning C-like arrays), the target type
  23320. is the type of the elements of the array. For a function or method
  23321. type, the target type is the type of the return value. For a
  23322. complex type, the target type is the type of the elements. For a
  23323. typedef, the target type is the aliased type.
  23324. If the type does not have a target, this method will throw an
  23325. exception.
  23326. -- Scheme Procedure: type-const type
  23327. Return a new '<gdb:type>' object which represents a
  23328. 'const'-qualified variant of TYPE.
  23329. -- Scheme Procedure: type-volatile type
  23330. Return a new '<gdb:type>' object which represents a
  23331. 'volatile'-qualified variant of TYPE.
  23332. -- Scheme Procedure: type-unqualified type
  23333. Return a new '<gdb:type>' object which represents an unqualified
  23334. variant of TYPE. That is, the result is neither 'const' nor
  23335. 'volatile'.
  23336. -- Scheme Procedure: type-num-fields
  23337. Return the number of fields of '<gdb:type>' TYPE.
  23338. -- Scheme Procedure: type-fields type
  23339. Return the fields of TYPE as a list. For structure and union
  23340. types, 'fields' has the usual meaning. Range types have two
  23341. fields, the minimum and maximum values. Enum types have one field
  23342. per enum constant. Function and method types have one field per
  23343. parameter. The base types of C++ classes are also represented as
  23344. fields. If the type has no fields, or does not fit into one of
  23345. these categories, an empty list will be returned. *Note Fields of
  23346. a type in Guile::.
  23347. -- Scheme Procedure: make-field-iterator type
  23348. Return the fields of TYPE as a <gdb:iterator> object. *Note
  23349. Iterators In Guile::.
  23350. -- Scheme Procedure: type-field type field-name
  23351. Return field named FIELD-NAME in TYPE. The result is an object of
  23352. type '<gdb:field>'. *Note Fields of a type in Guile::. If the
  23353. type does not have fields, or FIELD-NAME is not a field of TYPE, an
  23354. exception is thrown.
  23355. For example, if 'some-type' is a '<gdb:type>' instance holding a
  23356. structure type, you can access its 'foo' field with:
  23357. (define bar (type-field some-type "foo"))
  23358. 'bar' will be a '<gdb:field>' object.
  23359. -- Scheme Procedure: type-has-field? type name
  23360. Return '#t' if '<gdb:type>' TYPE has field named NAME. Otherwise
  23361. return '#f'.
  23362. Each type has a code, which indicates what category this type falls
  23363. into. The available type categories are represented by constants
  23364. defined in the '(gdb)' module:
  23365. 'TYPE_CODE_PTR'
  23366. The type is a pointer.
  23367. 'TYPE_CODE_ARRAY'
  23368. The type is an array.
  23369. 'TYPE_CODE_STRUCT'
  23370. The type is a structure.
  23371. 'TYPE_CODE_UNION'
  23372. The type is a union.
  23373. 'TYPE_CODE_ENUM'
  23374. The type is an enum.
  23375. 'TYPE_CODE_FLAGS'
  23376. A bit flags type, used for things such as status registers.
  23377. 'TYPE_CODE_FUNC'
  23378. The type is a function.
  23379. 'TYPE_CODE_INT'
  23380. The type is an integer type.
  23381. 'TYPE_CODE_FLT'
  23382. A floating point type.
  23383. 'TYPE_CODE_VOID'
  23384. The special type 'void'.
  23385. 'TYPE_CODE_SET'
  23386. A Pascal set type.
  23387. 'TYPE_CODE_RANGE'
  23388. A range type, that is, an integer type with bounds.
  23389. 'TYPE_CODE_STRING'
  23390. A string type. Note that this is only used for certain languages
  23391. with language-defined string types; C strings are not represented
  23392. this way.
  23393. 'TYPE_CODE_BITSTRING'
  23394. A string of bits. It is deprecated.
  23395. 'TYPE_CODE_ERROR'
  23396. An unknown or erroneous type.
  23397. 'TYPE_CODE_METHOD'
  23398. A method type, as found in C++.
  23399. 'TYPE_CODE_METHODPTR'
  23400. A pointer-to-member-function.
  23401. 'TYPE_CODE_MEMBERPTR'
  23402. A pointer-to-member.
  23403. 'TYPE_CODE_REF'
  23404. A reference type.
  23405. 'TYPE_CODE_CHAR'
  23406. A character type.
  23407. 'TYPE_CODE_BOOL'
  23408. A boolean type.
  23409. 'TYPE_CODE_COMPLEX'
  23410. A complex float type.
  23411. 'TYPE_CODE_TYPEDEF'
  23412. A typedef to some other type.
  23413. 'TYPE_CODE_NAMESPACE'
  23414. A C++ namespace.
  23415. 'TYPE_CODE_DECFLOAT'
  23416. A decimal floating point type.
  23417. 'TYPE_CODE_INTERNAL_FUNCTION'
  23418. A function internal to GDB. This is the type used to represent
  23419. convenience functions (*note Convenience Funs::).
  23420. Further support for types is provided in the '(gdb types)' Guile
  23421. module (*note Guile Types Module::).
  23422. Each field is represented as an object of type '<gdb:field>'.
  23423. The following field-related procedures are provided by the '(gdb)'
  23424. module:
  23425. -- Scheme Procedure: field? object
  23426. Return '#t' if OBJECT is an object of type '<gdb:field>'.
  23427. Otherwise return '#f'.
  23428. -- Scheme Procedure: field-name field
  23429. Return the name of the field, or '#f' for anonymous fields.
  23430. -- Scheme Procedure: field-type field
  23431. Return the type of the field. This is usually an instance of
  23432. '<gdb:type>', but it can be '#f' in some situations.
  23433. -- Scheme Procedure: field-enumval field
  23434. Return the enum value represented by '<gdb:field>' FIELD.
  23435. -- Scheme Procedure: field-bitpos field
  23436. Return the bit position of '<gdb:field>' FIELD. This attribute is
  23437. not available for 'static' fields (as in C++).
  23438. -- Scheme Procedure: field-bitsize field
  23439. If the field is packed, or is a bitfield, return the size of
  23440. '<gdb:field>' FIELD in bits. Otherwise, zero is returned; in which
  23441. case the field's size is given by its type.
  23442. -- Scheme Procedure: field-artificial? field
  23443. Return '#t' if the field is artificial, usually meaning that it was
  23444. provided by the compiler and not the user. Otherwise return '#f'.
  23445. -- Scheme Procedure: field-base-class? field
  23446. Return '#t' if the field represents a base class of a C++
  23447. structure. Otherwise return '#f'.
  23448. 
  23449. File: gdb.info, Node: Guile Pretty Printing API, Next: Selecting Guile Pretty-Printers, Prev: Types In Guile, Up: Guile API
  23450. 23.3.3.8 Guile Pretty Printing API
  23451. ..................................
  23452. An example output is provided (*note Pretty Printing::).
  23453. A pretty-printer is represented by an object of type
  23454. <gdb:pretty-printer>. Pretty-printer objects are created with
  23455. 'make-pretty-printer'.
  23456. The following pretty-printer-related procedures are provided by the
  23457. '(gdb)' module:
  23458. -- Scheme Procedure: make-pretty-printer name lookup-function
  23459. Return a '<gdb:pretty-printer>' object named NAME.
  23460. LOOKUP-FUNCTION is a function of one parameter: the value to be
  23461. printed. If the value is handled by this pretty-printer, then
  23462. LOOKUP-FUNCTION returns an object of type
  23463. <gdb:pretty-printer-worker> to perform the actual pretty-printing.
  23464. Otherwise LOOKUP-FUNCTION returns '#f'.
  23465. -- Scheme Procedure: pretty-printer? object
  23466. Return '#t' if OBJECT is a '<gdb:pretty-printer>' object.
  23467. Otherwise return '#f'.
  23468. -- Scheme Procedure: pretty-printer-enabled? pretty-printer
  23469. Return '#t' if PRETTY-PRINTER is enabled. Otherwise return '#f'.
  23470. -- Scheme Procedure: set-pretty-printer-enabled! pretty-printer flag
  23471. Set the enabled flag of PRETTY-PRINTER to FLAG. The value returned
  23472. is unspecified.
  23473. -- Scheme Procedure: pretty-printers
  23474. Return the list of global pretty-printers.
  23475. -- Scheme Procedure: set-pretty-printers! pretty-printers
  23476. Set the list of global pretty-printers to PRETTY-PRINTERS. The
  23477. value returned is unspecified.
  23478. -- Scheme Procedure: make-pretty-printer-worker display-hint to-string
  23479. children
  23480. Return an object of type '<gdb:pretty-printer-worker>'.
  23481. This function takes three parameters:
  23482. 'display-hint'
  23483. DISPLAY-HINT provides a hint to GDB or GDB front end via MI to
  23484. change the formatting of the value being printed. The value
  23485. must be a string or '#f' (meaning there is no hint). Several
  23486. values for DISPLAY-HINT are predefined by GDB:
  23487. 'array'
  23488. Indicate that the object being printed is "array-like".
  23489. The CLI uses this to respect parameters such as 'set
  23490. print elements' and 'set print array'.
  23491. 'map'
  23492. Indicate that the object being printed is "map-like", and
  23493. that the children of this value can be assumed to
  23494. alternate between keys and values.
  23495. 'string'
  23496. Indicate that the object being printed is "string-like".
  23497. If the printer's 'to-string' function returns a Guile
  23498. string of some kind, then GDB will call its internal
  23499. language-specific string-printing function to format the
  23500. string. For the CLI this means adding quotation marks,
  23501. possibly escaping some characters, respecting 'set print
  23502. elements', and the like.
  23503. 'to-string'
  23504. TO-STRING is either a function of one parameter, the
  23505. '<gdb:pretty-printer-worker>' object, or '#f'.
  23506. When printing from the CLI, if the 'to-string' method exists,
  23507. then GDB will prepend its result to the values returned by
  23508. 'children'. Exactly how this formatting is done is dependent
  23509. on the display hint, and may change as more hints are added.
  23510. Also, depending on the print settings (*note Print
  23511. Settings::), the CLI may print just the result of 'to-string'
  23512. in a stack trace, omitting the result of 'children'.
  23513. If this method returns a string, it is printed verbatim.
  23514. Otherwise, if this method returns an instance of
  23515. '<gdb:value>', then GDB prints this value. This may result in
  23516. a call to another pretty-printer.
  23517. If instead the method returns a Guile value which is
  23518. convertible to a '<gdb:value>', then GDB performs the
  23519. conversion and prints the resulting value. Again, this may
  23520. result in a call to another pretty-printer. Guile scalars
  23521. (integers, floats, and booleans) and strings are convertible
  23522. to '<gdb:value>'; other types are not.
  23523. Finally, if this method returns '#f' then no further
  23524. operations are peformed in this method and nothing is printed.
  23525. If the result is not one of these types, an exception is
  23526. raised.
  23527. TO-STRING may also be '#f' in which case it is left to
  23528. CHILDREN to print the value.
  23529. 'children'
  23530. CHILDREN is either a function of one parameter, the
  23531. '<gdb:pretty-printer-worker>' object, or '#f'.
  23532. GDB will call this function on a pretty-printer to compute the
  23533. children of the pretty-printer's value.
  23534. This function must return a <gdb:iterator> object. Each item
  23535. returned by the iterator must be a tuple holding two elements.
  23536. The first element is the "name" of the child; the second
  23537. element is the child's value. The value can be any Guile
  23538. object which is convertible to a GDB value.
  23539. If CHILDREN is '#f', GDB will act as though the value has no
  23540. children.
  23541. Children may be hidden from display based on the value of 'set
  23542. print max-depth' (*note Print Settings::).
  23543. GDB provides a function which can be used to look up the default
  23544. pretty-printer for a '<gdb:value>':
  23545. -- Scheme Procedure: default-visualizer value
  23546. This function takes a '<gdb:value>' object as an argument. If a
  23547. pretty-printer for this value exists, then it is returned. If no
  23548. such printer exists, then this returns '#f'.
  23549. 
  23550. File: gdb.info, Node: Selecting Guile Pretty-Printers, Next: Writing a Guile Pretty-Printer, Prev: Guile Pretty Printing API, Up: Guile API
  23551. 23.3.3.9 Selecting Guile Pretty-Printers
  23552. ........................................
  23553. There are three sets of pretty-printers that GDB searches:
  23554. * Per-objfile list of pretty-printers (*note Objfiles In Guile::).
  23555. * Per-progspace list of pretty-printers (*note Progspaces In
  23556. Guile::).
  23557. * The global list of pretty-printers (*note Guile Pretty Printing
  23558. API::). These printers are available when debugging any inferior.
  23559. Pretty-printer lookup is done by passing the value to be printed to
  23560. the lookup function of each enabled object in turn. Lookup stops when a
  23561. lookup function returns a non-'#f' value or when the list is exhausted.
  23562. Lookup functions must return either a '<gdb:pretty-printer-worker>'
  23563. object or '#f'. Otherwise an exception is thrown.
  23564. GDB first checks the result of 'objfile-pretty-printers' of each
  23565. '<gdb:objfile>' in the current program space and iteratively calls each
  23566. enabled lookup function in the list for that '<gdb:objfile>' until a
  23567. non-'#f' object is returned. If no pretty-printer is found in the
  23568. objfile lists, GDB then searches the result of
  23569. 'progspace-pretty-printers' of the current program space, calling each
  23570. enabled function until a non-'#f' object is returned. After these lists
  23571. have been exhausted, it tries the global pretty-printers list, obtained
  23572. with 'pretty-printers', again calling each enabled function until a
  23573. non-'#f' object is returned.
  23574. The order in which the objfiles are searched is not specified. For a
  23575. given list, functions are always invoked from the head of the list, and
  23576. iterated over sequentially until the end of the list, or a
  23577. '<gdb:pretty-printer-worker>' object is returned.
  23578. For various reasons a pretty-printer may not work. For example, the
  23579. underlying data structure may have changed and the pretty-printer is out
  23580. of date.
  23581. The consequences of a broken pretty-printer are severe enough that
  23582. GDB provides support for enabling and disabling individual printers.
  23583. For example, if 'print frame-arguments' is on, a backtrace can become
  23584. highly illegible if any argument is printed with a broken printer.
  23585. Pretty-printers are enabled and disabled from Scheme by calling
  23586. 'set-pretty-printer-enabled!'. *Note Guile Pretty Printing API::.
  23587. 
  23588. File: gdb.info, Node: Writing a Guile Pretty-Printer, Next: Commands In Guile, Prev: Selecting Guile Pretty-Printers, Up: Guile API
  23589. 23.3.3.10 Writing a Guile Pretty-Printer
  23590. ........................................
  23591. A pretty-printer consists of two basic parts: a lookup function to
  23592. determine if the type is supported, and the printer itself.
  23593. Here is an example showing how a 'std::string' printer might be
  23594. written. *Note Guile Pretty Printing API::, for details.
  23595. (define (make-my-string-printer value)
  23596. "Print a my::string string"
  23597. (make-pretty-printer-worker
  23598. "string"
  23599. (lambda (printer)
  23600. (value-field value "_data"))
  23601. #f))
  23602. And here is an example showing how a lookup function for the printer
  23603. example above might be written.
  23604. (define (str-lookup-function pretty-printer value)
  23605. (let ((tag (type-tag (value-type value))))
  23606. (and tag
  23607. (string-prefix? "std::string<" tag)
  23608. (make-my-string-printer value))))
  23609. Then to register this printer in the global printer list:
  23610. (append-pretty-printer!
  23611. (make-pretty-printer "my-string" str-lookup-function))
  23612. The example lookup function extracts the value's type, and attempts
  23613. to match it to a type that it can pretty-print. If it is a type the
  23614. printer can pretty-print, it will return a <gdb:pretty-printer-worker>
  23615. object. If not, it returns '#f'.
  23616. We recommend that you put your core pretty-printers into a Guile
  23617. package. If your pretty-printers are for use with a library, we further
  23618. recommend embedding a version number into the package name. This
  23619. practice will enable GDB to load multiple versions of your
  23620. pretty-printers at the same time, because they will have different
  23621. names.
  23622. You should write auto-loaded code (*note Guile Auto-loading::) such
  23623. that it can be evaluated multiple times without changing its meaning.
  23624. An ideal auto-load file will consist solely of 'import's of your printer
  23625. modules, followed by a call to a register pretty-printers with the
  23626. current objfile.
  23627. Taken as a whole, this approach will scale nicely to multiple
  23628. inferiors, each potentially using a different library version.
  23629. Embedding a version number in the Guile package name will ensure that
  23630. GDB is able to load both sets of printers simultaneously. Then, because
  23631. the search for pretty-printers is done by objfile, and because your
  23632. auto-loaded code took care to register your library's printers with a
  23633. specific objfile, GDB will find the correct printers for the specific
  23634. version of the library used by each inferior.
  23635. To continue the 'my::string' example, this code might appear in
  23636. '(my-project my-library v1)':
  23637. (use-modules (gdb))
  23638. (define (register-printers objfile)
  23639. (append-objfile-pretty-printer!
  23640. (make-pretty-printer "my-string" str-lookup-function)))
  23641. And then the corresponding contents of the auto-load file would be:
  23642. (use-modules (gdb) (my-project my-library v1))
  23643. (register-printers (current-objfile))
  23644. The previous example illustrates a basic pretty-printer. There are a
  23645. few things that can be improved on. The printer only handles one type,
  23646. whereas a library typically has several types. One could install a
  23647. lookup function for each desired type in the library, but one could also
  23648. have a single lookup function recognize several types. The latter is
  23649. the conventional way this is handled. If a pretty-printer can handle
  23650. multiple data types, then its "subprinters" are the printers for the
  23651. individual data types.
  23652. The '(gdb printing)' module provides a formal way of solving this
  23653. problem (*note Guile Printing Module::). Here is another example that
  23654. handles multiple types.
  23655. These are the types we are going to pretty-print:
  23656. struct foo { int a, b; };
  23657. struct bar { struct foo x, y; };
  23658. Here are the printers:
  23659. (define (make-foo-printer value)
  23660. "Print a foo object"
  23661. (make-pretty-printer-worker
  23662. "foo"
  23663. (lambda (printer)
  23664. (format #f "a=<~a> b=<~a>"
  23665. (value-field value "a") (value-field value "a")))
  23666. #f))
  23667. (define (make-bar-printer value)
  23668. "Print a bar object"
  23669. (make-pretty-printer-worker
  23670. "foo"
  23671. (lambda (printer)
  23672. (format #f "x=<~a> y=<~a>"
  23673. (value-field value "x") (value-field value "y")))
  23674. #f))
  23675. This example doesn't need a lookup function, that is handled by the
  23676. '(gdb printing)' module. Instead a function is provided to build up the
  23677. object that handles the lookup.
  23678. (use-modules (gdb printing))
  23679. (define (build-pretty-printer)
  23680. (let ((pp (make-pretty-printer-collection "my-library")))
  23681. (pp-collection-add-tag-printer "foo" make-foo-printer)
  23682. (pp-collection-add-tag-printer "bar" make-bar-printer)
  23683. pp))
  23684. And here is the autoload support:
  23685. (use-modules (gdb) (my-library))
  23686. (append-objfile-pretty-printer! (current-objfile) (build-pretty-printer))
  23687. Finally, when this printer is loaded into GDB, here is the
  23688. corresponding output of 'info pretty-printer':
  23689. (gdb) info pretty-printer
  23690. my_library.so:
  23691. my-library
  23692. foo
  23693. bar
  23694. 
  23695. File: gdb.info, Node: Commands In Guile, Next: Parameters In Guile, Prev: Writing a Guile Pretty-Printer, Up: Guile API
  23696. 23.3.3.11 Commands In Guile
  23697. ...........................
  23698. You can implement new GDB CLI commands in Guile. A CLI command object
  23699. is created with the 'make-command' Guile function, and added to GDB with
  23700. the 'register-command!' Guile function. This two-step approach is taken
  23701. to separate out the side-effect of adding the command to GDB from
  23702. 'make-command'.
  23703. There is no support for multi-line commands, that is commands that
  23704. consist of multiple lines and are terminated with 'end'.
  23705. -- Scheme Procedure: (make-command name [#:invoke invoke]
  23706. [#:command-class command-class] [#:completer-class completer]
  23707. [#:prefix? prefix] [#:doc doc-string])
  23708. The argument NAME is the name of the command. If NAME consists of
  23709. multiple words, then the initial words are looked for as prefix
  23710. commands. In this case, if one of the prefix commands does not
  23711. exist, an exception is raised.
  23712. The result is the '<gdb:command>' object representing the command.
  23713. The command is not usable until it has been registered with GDB
  23714. with 'register-command!'.
  23715. The rest of the arguments are optional.
  23716. The argument INVOKE is a procedure of three arguments: SELF, ARGS
  23717. and FROM-TTY. The argument SELF is the '<gdb:command>' object
  23718. representing the command. The argument ARGS is a string
  23719. representing the arguments passed to the command, after leading and
  23720. trailing whitespace has been stripped. The argument FROM-TTY is a
  23721. boolean flag and specifies whether the command should consider
  23722. itself to have been originated from the user invoking it
  23723. interactively. If this function throws an exception, it is turned
  23724. into a GDB 'error' call. Otherwise, the return value is ignored.
  23725. The argument COMMAND-CLASS is one of the 'COMMAND_' constants
  23726. defined below. This argument tells GDB how to categorize the new
  23727. command in the help system. The default is 'COMMAND_NONE'.
  23728. The argument COMPLETER is either '#f', one of the 'COMPLETE_'
  23729. constants defined below, or a procedure, also defined below. This
  23730. argument tells GDB how to perform completion for this command. If
  23731. not provided or if the value is '#f', then no completion is
  23732. performed on the command.
  23733. The argument PREFIX is a boolean flag indicating whether the new
  23734. command is a prefix command; sub-commands of this command may be
  23735. registered.
  23736. The argument DOC-STRING is help text for the new command. If no
  23737. documentation string is provided, the default value "This command
  23738. is not documented." is used.
  23739. -- Scheme Procedure: register-command! command
  23740. Add COMMAND, a '<gdb:command>' object, to GDB's list of commands.
  23741. It is an error to register a command more than once. The result is
  23742. unspecified.
  23743. -- Scheme Procedure: command? object
  23744. Return '#t' if OBJECT is a '<gdb:command>' object. Otherwise
  23745. return '#f'.
  23746. -- Scheme Procedure: dont-repeat
  23747. By default, a GDB command is repeated when the user enters a blank
  23748. line at the command prompt. A command can suppress this behavior
  23749. by invoking the 'dont-repeat' function. This is similar to the
  23750. user command 'dont-repeat', see *note dont-repeat: Define.
  23751. -- Scheme Procedure: string->argv string
  23752. Convert a string to a list of strings split up according to GDB's
  23753. argv parsing rules. It is recommended to use this for consistency.
  23754. Arguments are separated by spaces and may be quoted. Example:
  23755. scheme@(guile-user)> (string->argv "1 2\\ \\\"3 '4 \"5' \"6 '7\"")
  23756. $1 = ("1" "2 \"3" "4 \"5" "6 '7")
  23757. -- Scheme Procedure: throw-user-error message . args
  23758. Throw a 'gdb:user-error' exception. The argument MESSAGE is the
  23759. error message as a format string, like the FMT argument to the
  23760. 'format' Scheme function. *Note (guile)Formatted Output::. The
  23761. argument ARGS is a list of the optional arguments of MESSAGE.
  23762. This is used when the command detects a user error of some kind,
  23763. say a bad command argument.
  23764. (gdb) guile (use-modules (gdb))
  23765. (gdb) guile
  23766. (register-command! (make-command "test-user-error"
  23767. #:command-class COMMAND_OBSCURE
  23768. #:invoke (lambda (self arg from-tty)
  23769. (throw-user-error "Bad argument ~a" arg))))
  23770. end
  23771. (gdb) test-user-error ugh
  23772. ERROR: Bad argument ugh
  23773. -- completer: self text word
  23774. If the COMPLETER option to 'make-command' is a procedure, it takes
  23775. three arguments: SELF which is the '<gdb:command>' object, and TEXT
  23776. and WORD which are both strings. The argument TEXT holds the
  23777. complete command line up to the cursor's location. The argument
  23778. WORD holds the last word of the command line; this is computed
  23779. using a word-breaking heuristic.
  23780. All forms of completion are handled by this function, that is, the
  23781. <TAB> and <M-?> key bindings (*note Completion::), and the
  23782. 'complete' command (*note complete: Help.).
  23783. This procedure can return several kinds of values:
  23784. * If the return value is a list, the contents of the list are
  23785. used as the completions. It is up to COMPLETER to ensure that
  23786. the contents actually do complete the word. An empty list is
  23787. allowed, it means that there were no completions available.
  23788. Only string elements of the list are used; other elements in
  23789. the list are ignored.
  23790. * If the return value is a '<gdb:iterator>' object, it is
  23791. iterated over to obtain the completions. It is up to
  23792. 'completer-procedure' to ensure that the results actually do
  23793. complete the word. Only string elements of the result are
  23794. used; other elements in the sequence are ignored.
  23795. * All other results are treated as though there were no
  23796. available completions.
  23797. When a new command is registered, it will have been declared as a
  23798. member of some general class of commands. This is used to classify
  23799. top-level commands in the on-line help system; note that prefix commands
  23800. are not listed under their own category but rather that of their
  23801. top-level command. The available classifications are represented by
  23802. constants defined in the 'gdb' module:
  23803. 'COMMAND_NONE'
  23804. The command does not belong to any particular class. A command in
  23805. this category will not be displayed in any of the help categories.
  23806. This is the default.
  23807. 'COMMAND_RUNNING'
  23808. The command is related to running the inferior. For example,
  23809. 'start', 'step', and 'continue' are in this category. Type 'help
  23810. running' at the GDB prompt to see a list of commands in this
  23811. category.
  23812. 'COMMAND_DATA'
  23813. The command is related to data or variables. For example, 'call',
  23814. 'find', and 'print' are in this category. Type 'help data' at the
  23815. GDB prompt to see a list of commands in this category.
  23816. 'COMMAND_STACK'
  23817. The command has to do with manipulation of the stack. For example,
  23818. 'backtrace', 'frame', and 'return' are in this category. Type
  23819. 'help stack' at the GDB prompt to see a list of commands in this
  23820. category.
  23821. 'COMMAND_FILES'
  23822. This class is used for file-related commands. For example, 'file',
  23823. 'list' and 'section' are in this category. Type 'help files' at
  23824. the GDB prompt to see a list of commands in this category.
  23825. 'COMMAND_SUPPORT'
  23826. This should be used for "support facilities", generally meaning
  23827. things that are useful to the user when interacting with GDB, but
  23828. not related to the state of the inferior. For example, 'help',
  23829. 'make', and 'shell' are in this category. Type 'help support' at
  23830. the GDB prompt to see a list of commands in this category.
  23831. 'COMMAND_STATUS'
  23832. The command is an 'info'-related command, that is, related to the
  23833. state of GDB itself. For example, 'info', 'macro', and 'show' are
  23834. in this category. Type 'help status' at the GDB prompt to see a
  23835. list of commands in this category.
  23836. 'COMMAND_BREAKPOINTS'
  23837. The command has to do with breakpoints. For example, 'break',
  23838. 'clear', and 'delete' are in this category. Type 'help
  23839. breakpoints' at the GDB prompt to see a list of commands in this
  23840. category.
  23841. 'COMMAND_TRACEPOINTS'
  23842. The command has to do with tracepoints. For example, 'trace',
  23843. 'actions', and 'tfind' are in this category. Type 'help
  23844. tracepoints' at the GDB prompt to see a list of commands in this
  23845. category.
  23846. 'COMMAND_USER'
  23847. The command is a general purpose command for the user, and
  23848. typically does not fit in one of the other categories. Type 'help
  23849. user-defined' at the GDB prompt to see a list of commands in this
  23850. category, as well as the list of gdb macros (*note Sequences::).
  23851. 'COMMAND_OBSCURE'
  23852. The command is only used in unusual circumstances, or is not of
  23853. general interest to users. For example, 'checkpoint', 'fork', and
  23854. 'stop' are in this category. Type 'help obscure' at the GDB prompt
  23855. to see a list of commands in this category.
  23856. 'COMMAND_MAINTENANCE'
  23857. The command is only useful to GDB maintainers. The 'maintenance'
  23858. and 'flushregs' commands are in this category. Type 'help
  23859. internals' at the GDB prompt to see a list of commands in this
  23860. category.
  23861. A new command can use a predefined completion function, either by
  23862. specifying it via an argument at initialization, or by returning it from
  23863. the 'completer' procedure. These predefined completion constants are
  23864. all defined in the 'gdb' module:
  23865. 'COMPLETE_NONE'
  23866. This constant means that no completion should be done.
  23867. 'COMPLETE_FILENAME'
  23868. This constant means that filename completion should be performed.
  23869. 'COMPLETE_LOCATION'
  23870. This constant means that location completion should be done. *Note
  23871. Specify Location::.
  23872. 'COMPLETE_COMMAND'
  23873. This constant means that completion should examine GDB command
  23874. names.
  23875. 'COMPLETE_SYMBOL'
  23876. This constant means that completion should be done using symbol
  23877. names as the source.
  23878. 'COMPLETE_EXPRESSION'
  23879. This constant means that completion should be done on expressions.
  23880. Often this means completing on symbol names, but some language
  23881. parsers also have support for completing on field names.
  23882. The following code snippet shows how a trivial CLI command can be
  23883. implemented in Guile:
  23884. (gdb) guile
  23885. (register-command! (make-command "hello-world"
  23886. #:command-class COMMAND_USER
  23887. #:doc "Greet the whole world."
  23888. #:invoke (lambda (self args from-tty) (display "Hello, World!\n"))))
  23889. end
  23890. (gdb) hello-world
  23891. Hello, World!
  23892. 
  23893. File: gdb.info, Node: Parameters In Guile, Next: Progspaces In Guile, Prev: Commands In Guile, Up: Guile API
  23894. 23.3.3.12 Parameters In Guile
  23895. .............................
  23896. You can implement new GDB "parameters" using Guile (1).
  23897. There are many parameters that already exist and can be set in GDB.
  23898. Two examples are: 'set follow-fork' and 'set charset'. Setting these
  23899. parameters influences certain behavior in GDB. Similarly, you can
  23900. define parameters that can be used to influence behavior in custom Guile
  23901. scripts and commands.
  23902. A new parameter is defined with the 'make-parameter' Guile function,
  23903. and added to GDB with the 'register-parameter!' Guile function. This
  23904. two-step approach is taken to separate out the side-effect of adding the
  23905. parameter to GDB from 'make-parameter'.
  23906. Parameters are exposed to the user via the 'set' and 'show' commands.
  23907. *Note Help::.
  23908. -- Scheme Procedure: (make-parameter name [#:command-class
  23909. command-class] [#:parameter-type parameter-type] [#:enum-list
  23910. enum-list] [#:set-func set-func] [#:show-func show-func]
  23911. [#:doc doc] [#:set-doc set-doc] [#:show-doc show-doc]
  23912. [#:initial-value initial-value])
  23913. The argument NAME is the name of the new parameter. If NAME
  23914. consists of multiple words, then the initial words are looked for
  23915. as prefix parameters. An example of this can be illustrated with
  23916. the 'set print' set of parameters. If NAME is 'print foo', then
  23917. 'print' will be searched as the prefix parameter. In this case the
  23918. parameter can subsequently be accessed in GDB as 'set print foo'.
  23919. If NAME consists of multiple words, and no prefix parameter group
  23920. can be found, an exception is raised.
  23921. The result is the '<gdb:parameter>' object representing the
  23922. parameter. The parameter is not usable until it has been
  23923. registered with GDB with 'register-parameter!'.
  23924. The rest of the arguments are optional.
  23925. The argument COMMAND-CLASS should be one of the 'COMMAND_'
  23926. constants (*note Commands In Guile::). This argument tells GDB how
  23927. to categorize the new parameter in the help system. The default is
  23928. 'COMMAND_NONE'.
  23929. The argument PARAMETER-TYPE should be one of the 'PARAM_' constants
  23930. defined below. This argument tells GDB the type of the new
  23931. parameter; this information is used for input validation and
  23932. completion. The default is 'PARAM_BOOLEAN'.
  23933. If PARAMETER-TYPE is 'PARAM_ENUM', then ENUM-LIST must be a list of
  23934. strings. These strings represent the possible values for the
  23935. parameter.
  23936. If PARAMETER-TYPE is not 'PARAM_ENUM', then the presence of
  23937. ENUM-LIST will cause an exception to be thrown.
  23938. The argument SET-FUNC is a function of one argument: SELF which is
  23939. the '<gdb:parameter>' object representing the parameter. GDB will
  23940. call this function when a PARAMETER's value has been changed via
  23941. the 'set' API (for example, 'set foo off'). The value of the
  23942. parameter has already been set to the new value. This function
  23943. must return a string to be displayed to the user. GDB will add a
  23944. trailing newline if the string is non-empty. GDB generally doesn't
  23945. print anything when a parameter is set, thus typically this
  23946. function should return '""'. A non-empty string result should
  23947. typically be used for displaying warnings and errors.
  23948. The argument SHOW-FUNC is a function of two arguments: SELF which
  23949. is the '<gdb:parameter>' object representing the parameter, and
  23950. SVALUE which is the string representation of the current value.
  23951. GDB will call this function when a PARAMETER's 'show' API has been
  23952. invoked (for example, 'show foo'). This function must return a
  23953. string, and will be displayed to the user. GDB will add a trailing
  23954. newline.
  23955. The argument DOC is the help text for the new parameter. If there
  23956. is no documentation string, a default value is used.
  23957. The argument SET-DOC is the help text for this parameter's 'set'
  23958. command.
  23959. The argument SHOW-DOC is the help text for this parameter's 'show'
  23960. command.
  23961. The argument INITIAL-VALUE specifies the initial value of the
  23962. parameter. If it is a function, it takes one parameter, the
  23963. '<gdb:parameter>' object and its result is used as the initial
  23964. value of the parameter. The initial value must be valid for the
  23965. parameter type, otherwise an exception is thrown.
  23966. -- Scheme Procedure: register-parameter! parameter
  23967. Add PARAMETER, a '<gdb:parameter>' object, to GDB's list of
  23968. parameters. It is an error to register a parameter more than once.
  23969. The result is unspecified.
  23970. -- Scheme Procedure: parameter? object
  23971. Return '#t' if OBJECT is a '<gdb:parameter>' object. Otherwise
  23972. return '#f'.
  23973. -- Scheme Procedure: parameter-value parameter
  23974. Return the value of PARAMETER which may either be a
  23975. '<gdb:parameter>' object or a string naming the parameter.
  23976. -- Scheme Procedure: set-parameter-value! parameter new-value
  23977. Assign PARAMETER the value of NEW-VALUE. The argument PARAMETER
  23978. must be an object of type '<gdb:parameter>'. GDB does validation
  23979. when assignments are made.
  23980. When a new parameter is defined, its type must be specified. The
  23981. available types are represented by constants defined in the 'gdb'
  23982. module:
  23983. 'PARAM_BOOLEAN'
  23984. The value is a plain boolean. The Guile boolean values, '#t' and
  23985. '#f' are the only valid values.
  23986. 'PARAM_AUTO_BOOLEAN'
  23987. The value has three possible states: true, false, and 'auto'. In
  23988. Guile, true and false are represented using boolean constants, and
  23989. 'auto' is represented using '#:auto'.
  23990. 'PARAM_UINTEGER'
  23991. The value is an unsigned integer. The value of 0 should be
  23992. interpreted to mean "unlimited".
  23993. 'PARAM_ZINTEGER'
  23994. The value is an integer.
  23995. 'PARAM_ZUINTEGER'
  23996. The value is an unsigned integer.
  23997. 'PARAM_ZUINTEGER_UNLIMITED'
  23998. The value is an integer in the range '[0, INT_MAX]'. A value of
  23999. '-1' means "unlimited", and other negative numbers are not allowed.
  24000. 'PARAM_STRING'
  24001. The value is a string. When the user modifies the string, any
  24002. escape sequences, such as '\t', '\f', and octal escapes, are
  24003. translated into corresponding characters and encoded into the
  24004. current host charset.
  24005. 'PARAM_STRING_NOESCAPE'
  24006. The value is a string. When the user modifies the string, escapes
  24007. are passed through untranslated.
  24008. 'PARAM_OPTIONAL_FILENAME'
  24009. The value is a either a filename (a string), or '#f'.
  24010. 'PARAM_FILENAME'
  24011. The value is a filename. This is just like
  24012. 'PARAM_STRING_NOESCAPE', but uses file names for completion.
  24013. 'PARAM_ENUM'
  24014. The value is a string, which must be one of a collection of string
  24015. constants provided when the parameter is created.
  24016. ---------- Footnotes ----------
  24017. (1) Note that GDB parameters must not be confused with Guile’s
  24018. parameter objects (*note (guile)Parameters::).
  24019. 
  24020. File: gdb.info, Node: Progspaces In Guile, Next: Objfiles In Guile, Prev: Parameters In Guile, Up: Guile API
  24021. 23.3.3.13 Program Spaces In Guile
  24022. .................................
  24023. A program space, or "progspace", represents a symbolic view of an
  24024. address space. It consists of all of the objfiles of the program.
  24025. *Note Objfiles In Guile::. *Note program spaces: Inferiors Connections
  24026. and Programs, for more details about program spaces.
  24027. Each progspace is represented by an instance of the '<gdb:progspace>'
  24028. smob. *Note GDB Scheme Data Types::.
  24029. The following progspace-related functions are available in the
  24030. '(gdb)' module:
  24031. -- Scheme Procedure: progspace? object
  24032. Return '#t' if OBJECT is a '<gdb:progspace>' object. Otherwise
  24033. return '#f'.
  24034. -- Scheme Procedure: progspace-valid? progspace
  24035. Return '#t' if PROGSPACE is valid, '#f' if not. A
  24036. '<gdb:progspace>' object can become invalid if the program it
  24037. refers to is not loaded in GDB any longer.
  24038. -- Scheme Procedure: current-progspace
  24039. This function returns the program space of the currently selected
  24040. inferior. There is always a current progspace, this never returns
  24041. '#f'. *Note Inferiors Connections and Programs::.
  24042. -- Scheme Procedure: progspaces
  24043. Return a list of all the progspaces currently known to GDB.
  24044. -- Scheme Procedure: progspace-filename progspace
  24045. Return the absolute file name of PROGSPACE as a string. This is
  24046. the name of the file passed as the argument to the 'file' or
  24047. 'symbol-file' commands. If the program space does not have an
  24048. associated file name, then '#f' is returned. This occurs, for
  24049. example, when GDB is started without a program to debug.
  24050. A 'gdb:invalid-object-error' exception is thrown if PROGSPACE is
  24051. invalid.
  24052. -- Scheme Procedure: progspace-objfiles progspace
  24053. Return the list of objfiles of PROGSPACE. The order of objfiles in
  24054. the result is arbitrary. Each element is an object of type
  24055. '<gdb:objfile>'. *Note Objfiles In Guile::.
  24056. A 'gdb:invalid-object-error' exception is thrown if PROGSPACE is
  24057. invalid.
  24058. -- Scheme Procedure: progspace-pretty-printers progspace
  24059. Return the list of pretty-printers of PROGSPACE. Each element is
  24060. an object of type '<gdb:pretty-printer>'. *Note Guile Pretty
  24061. Printing API::, for more information.
  24062. -- Scheme Procedure: set-progspace-pretty-printers! progspace
  24063. printer-list
  24064. Set the list of registered '<gdb:pretty-printer>' objects for
  24065. PROGSPACE to PRINTER-LIST. *Note Guile Pretty Printing API::, for
  24066. more information.
  24067. 
  24068. File: gdb.info, Node: Objfiles In Guile, Next: Frames In Guile, Prev: Progspaces In Guile, Up: Guile API
  24069. 23.3.3.14 Objfiles In Guile
  24070. ...........................
  24071. GDB loads symbols for an inferior from various symbol-containing files
  24072. (*note Files::). These include the primary executable file, any shared
  24073. libraries used by the inferior, and any separate debug info files (*note
  24074. Separate Debug Files::). GDB calls these symbol-containing files
  24075. "objfiles".
  24076. Each objfile is represented as an object of type '<gdb:objfile>'.
  24077. The following objfile-related procedures are provided by the '(gdb)'
  24078. module:
  24079. -- Scheme Procedure: objfile? object
  24080. Return '#t' if OBJECT is a '<gdb:objfile>' object. Otherwise
  24081. return '#f'.
  24082. -- Scheme Procedure: objfile-valid? objfile
  24083. Return '#t' if OBJFILE is valid, '#f' if not. A '<gdb:objfile>'
  24084. object can become invalid if the object file it refers to is not
  24085. loaded in GDB any longer. All other '<gdb:objfile>' procedures
  24086. will throw an exception if it is invalid at the time the procedure
  24087. is called.
  24088. -- Scheme Procedure: objfile-filename objfile
  24089. Return the file name of OBJFILE as a string, with symbolic links
  24090. resolved.
  24091. -- Scheme Procedure: objfile-progspace objfile
  24092. Return the '<gdb:progspace>' that this object file lives in. *Note
  24093. Progspaces In Guile::, for more on progspaces.
  24094. -- Scheme Procedure: objfile-pretty-printers objfile
  24095. Return the list of registered '<gdb:pretty-printer>' objects for
  24096. OBJFILE. *Note Guile Pretty Printing API::, for more information.
  24097. -- Scheme Procedure: set-objfile-pretty-printers! objfile printer-list
  24098. Set the list of registered '<gdb:pretty-printer>' objects for
  24099. OBJFILE to PRINTER-LIST. The PRINTER-LIST must be a list of
  24100. '<gdb:pretty-printer>' objects. *Note Guile Pretty Printing API::,
  24101. for more information.
  24102. -- Scheme Procedure: current-objfile
  24103. When auto-loading a Guile script (*note Guile Auto-loading::), GDB
  24104. sets the "current objfile" to the corresponding objfile. This
  24105. function returns the current objfile. If there is no current
  24106. objfile, this function returns '#f'.
  24107. -- Scheme Procedure: objfiles
  24108. Return a list of all the objfiles in the current program space.
  24109. 
  24110. File: gdb.info, Node: Frames In Guile, Next: Blocks In Guile, Prev: Objfiles In Guile, Up: Guile API
  24111. 23.3.3.15 Accessing inferior stack frames from Guile.
  24112. .....................................................
  24113. When the debugged program stops, GDB is able to analyze its call stack
  24114. (*note Stack frames: Frames.). The '<gdb:frame>' class represents a
  24115. frame in the stack. A '<gdb:frame>' object is only valid while its
  24116. corresponding frame exists in the inferior's stack. If you try to use
  24117. an invalid frame object, GDB will throw a 'gdb:invalid-object' exception
  24118. (*note Guile Exception Handling::).
  24119. Two '<gdb:frame>' objects can be compared for equality with the
  24120. 'equal?' function, like:
  24121. (gdb) guile (equal? (newest-frame) (selected-frame))
  24122. #t
  24123. The following frame-related procedures are provided by the '(gdb)'
  24124. module:
  24125. -- Scheme Procedure: frame? object
  24126. Return '#t' if OBJECT is a '<gdb:frame>' object. Otherwise return
  24127. '#f'.
  24128. -- Scheme Procedure: frame-valid? frame
  24129. Returns '#t' if FRAME is valid, '#f' if not. A frame object can
  24130. become invalid if the frame it refers to doesn't exist anymore in
  24131. the inferior. All '<gdb:frame>' procedures will throw an exception
  24132. if the frame is invalid at the time the procedure is called.
  24133. -- Scheme Procedure: frame-name frame
  24134. Return the function name of FRAME, or '#f' if it can't be obtained.
  24135. -- Scheme Procedure: frame-arch frame
  24136. Return the '<gdb:architecture>' object corresponding to FRAME's
  24137. architecture. *Note Architectures In Guile::.
  24138. -- Scheme Procedure: frame-type frame
  24139. Return the type of FRAME. The value can be one of:
  24140. 'NORMAL_FRAME'
  24141. An ordinary stack frame.
  24142. 'DUMMY_FRAME'
  24143. A fake stack frame that was created by GDB when performing an
  24144. inferior function call.
  24145. 'INLINE_FRAME'
  24146. A frame representing an inlined function. The function was
  24147. inlined into a 'NORMAL_FRAME' that is older than this one.
  24148. 'TAILCALL_FRAME'
  24149. A frame representing a tail call. *Note Tail Call Frames::.
  24150. 'SIGTRAMP_FRAME'
  24151. A signal trampoline frame. This is the frame created by the
  24152. OS when it calls into a signal handler.
  24153. 'ARCH_FRAME'
  24154. A fake stack frame representing a cross-architecture call.
  24155. 'SENTINEL_FRAME'
  24156. This is like 'NORMAL_FRAME', but it is only used for the
  24157. newest frame.
  24158. -- Scheme Procedure: frame-unwind-stop-reason frame
  24159. Return an integer representing the reason why it's not possible to
  24160. find more frames toward the outermost frame. Use
  24161. 'unwind-stop-reason-string' to convert the value returned by this
  24162. function to a string. The value can be one of:
  24163. 'FRAME_UNWIND_NO_REASON'
  24164. No particular reason (older frames should be available).
  24165. 'FRAME_UNWIND_NULL_ID'
  24166. The previous frame's analyzer returns an invalid result.
  24167. 'FRAME_UNWIND_OUTERMOST'
  24168. This frame is the outermost.
  24169. 'FRAME_UNWIND_UNAVAILABLE'
  24170. Cannot unwind further, because that would require knowing the
  24171. values of registers or memory that have not been collected.
  24172. 'FRAME_UNWIND_INNER_ID'
  24173. This frame ID looks like it ought to belong to a NEXT frame,
  24174. but we got it for a PREV frame. Normally, this is a sign of
  24175. unwinder failure. It could also indicate stack corruption.
  24176. 'FRAME_UNWIND_SAME_ID'
  24177. This frame has the same ID as the previous one. That means
  24178. that unwinding further would almost certainly give us another
  24179. frame with exactly the same ID, so break the chain. Normally,
  24180. this is a sign of unwinder failure. It could also indicate
  24181. stack corruption.
  24182. 'FRAME_UNWIND_NO_SAVED_PC'
  24183. The frame unwinder did not find any saved PC, but we needed
  24184. one to unwind further.
  24185. 'FRAME_UNWIND_MEMORY_ERROR'
  24186. The frame unwinder caused an error while trying to access
  24187. memory.
  24188. 'FRAME_UNWIND_FIRST_ERROR'
  24189. Any stop reason greater or equal to this value indicates some
  24190. kind of error. This special value facilitates writing code
  24191. that tests for errors in unwinding in a way that will work
  24192. correctly even if the list of the other values is modified in
  24193. future GDB versions. Using it, you could write:
  24194. (define reason (frame-unwind-stop-readon (selected-frame)))
  24195. (define reason-str (unwind-stop-reason-string reason))
  24196. (if (>= reason FRAME_UNWIND_FIRST_ERROR)
  24197. (format #t "An error occured: ~s\n" reason-str))
  24198. -- Scheme Procedure: frame-pc frame
  24199. Return the frame's resume address.
  24200. -- Scheme Procedure: frame-block frame
  24201. Return the frame's code block as a '<gdb:block>' object. *Note
  24202. Blocks In Guile::.
  24203. -- Scheme Procedure: frame-function frame
  24204. Return the symbol for the function corresponding to this frame as a
  24205. '<gdb:symbol>' object, or '#f' if there isn't one. *Note Symbols
  24206. In Guile::.
  24207. -- Scheme Procedure: frame-older frame
  24208. Return the frame that called FRAME.
  24209. -- Scheme Procedure: frame-newer frame
  24210. Return the frame called by FRAME.
  24211. -- Scheme Procedure: frame-sal frame
  24212. Return the frame's '<gdb:sal>' (symtab and line) object. *Note
  24213. Symbol Tables In Guile::.
  24214. -- Scheme Procedure: frame-read-register frame register
  24215. Return the value of REGISTER in FRAME. REGISTER should be a
  24216. string, like 'pc'.
  24217. -- Scheme Procedure: frame-read-var frame variable [#:block block]
  24218. Return the value of VARIABLE in FRAME. If the optional argument
  24219. BLOCK is provided, search for the variable from that block;
  24220. otherwise start at the frame's current block (which is determined
  24221. by the frame's current program counter). The VARIABLE must be
  24222. given as a string or a '<gdb:symbol>' object, and BLOCK must be a
  24223. '<gdb:block>' object.
  24224. -- Scheme Procedure: frame-select frame
  24225. Set FRAME to be the selected frame. *Note Examining the Stack:
  24226. Stack.
  24227. -- Scheme Procedure: selected-frame
  24228. Return the selected frame object. *Note Selecting a Frame:
  24229. Selection.
  24230. -- Scheme Procedure: newest-frame
  24231. Return the newest frame object for the selected thread.
  24232. -- Scheme Procedure: unwind-stop-reason-string reason
  24233. Return a string explaining the reason why GDB stopped unwinding
  24234. frames, as expressed by the given REASON code (an integer, see the
  24235. 'frame-unwind-stop-reason' procedure above in this section).
  24236. 
  24237. File: gdb.info, Node: Blocks In Guile, Next: Symbols In Guile, Prev: Frames In Guile, Up: Guile API
  24238. 23.3.3.16 Accessing blocks from Guile.
  24239. ......................................
  24240. In GDB, symbols are stored in blocks. A block corresponds roughly to a
  24241. scope in the source code. Blocks are organized hierarchically, and are
  24242. represented individually in Guile as an object of type '<gdb:block>'.
  24243. Blocks rely on debugging information being available.
  24244. A frame has a block. Please see *note Frames In Guile::, for a more
  24245. in-depth discussion of frames.
  24246. The outermost block is known as the "global block". The global block
  24247. typically holds public global variables and functions.
  24248. The block nested just inside the global block is the "static block".
  24249. The static block typically holds file-scoped variables and functions.
  24250. GDB provides a method to get a block's superblock, but there is
  24251. currently no way to examine the sub-blocks of a block, or to iterate
  24252. over all the blocks in a symbol table (*note Symbol Tables In Guile::).
  24253. Here is a short example that should help explain blocks:
  24254. /* This is in the global block. */
  24255. int global;
  24256. /* This is in the static block. */
  24257. static int file_scope;
  24258. /* 'function' is in the global block, and 'argument' is
  24259. in a block nested inside of 'function'. */
  24260. int function (int argument)
  24261. {
  24262. /* 'local' is in a block inside 'function'. It may or may
  24263. not be in the same block as 'argument'. */
  24264. int local;
  24265. {
  24266. /* 'inner' is in a block whose superblock is the one holding
  24267. 'local'. */
  24268. int inner;
  24269. /* If this call is expanded by the compiler, you may see
  24270. a nested block here whose function is 'inline_function'
  24271. and whose superblock is the one holding 'inner'. */
  24272. inline_function ();
  24273. }
  24274. }
  24275. The following block-related procedures are provided by the '(gdb)'
  24276. module:
  24277. -- Scheme Procedure: block? object
  24278. Return '#t' if OBJECT is a '<gdb:block>' object. Otherwise return
  24279. '#f'.
  24280. -- Scheme Procedure: block-valid? block
  24281. Returns '#t' if '<gdb:block>' BLOCK is valid, '#f' if not. A block
  24282. object can become invalid if the block it refers to doesn't exist
  24283. anymore in the inferior. All other '<gdb:block>' methods will
  24284. throw an exception if it is invalid at the time the procedure is
  24285. called. The block's validity is also checked during iteration over
  24286. symbols of the block.
  24287. -- Scheme Procedure: block-start block
  24288. Return the start address of '<gdb:block>' BLOCK.
  24289. -- Scheme Procedure: block-end block
  24290. Return the end address of '<gdb:block>' BLOCK.
  24291. -- Scheme Procedure: block-function block
  24292. Return the name of '<gdb:block>' BLOCK represented as a
  24293. '<gdb:symbol>' object. If the block is not named, then '#f' is
  24294. returned.
  24295. For ordinary function blocks, the superblock is the static block.
  24296. However, you should note that it is possible for a function block
  24297. to have a superblock that is not the static block - for instance
  24298. this happens for an inlined function.
  24299. -- Scheme Procedure: block-superblock block
  24300. Return the block containing '<gdb:block>' BLOCK. If the parent
  24301. block does not exist, then '#f' is returned.
  24302. -- Scheme Procedure: block-global-block block
  24303. Return the global block associated with '<gdb:block>' BLOCK.
  24304. -- Scheme Procedure: block-static-block block
  24305. Return the static block associated with '<gdb:block>' BLOCK.
  24306. -- Scheme Procedure: block-global? block
  24307. Return '#t' if '<gdb:block>' BLOCK is a global block. Otherwise
  24308. return '#f'.
  24309. -- Scheme Procedure: block-static? block
  24310. Return '#t' if '<gdb:block>' BLOCK is a static block. Otherwise
  24311. return '#f'.
  24312. -- Scheme Procedure: block-symbols
  24313. Return a list of all symbols (as <gdb:symbol> objects) in
  24314. '<gdb:block>' BLOCK.
  24315. -- Scheme Procedure: make-block-symbols-iterator block
  24316. Return an object of type '<gdb:iterator>' that will iterate over
  24317. all symbols of the block. Guile programs should not assume that a
  24318. specific block object will always contain a given symbol, since
  24319. changes in GDB features and infrastructure may cause symbols move
  24320. across blocks in a symbol table. *Note Iterators In Guile::.
  24321. -- Scheme Procedure: block-symbols-progress?
  24322. Return #t if the object is a <gdb:block-symbols-progress> object.
  24323. This object would be obtained from the 'progress' element of the
  24324. '<gdb:iterator>' object returned by 'make-block-symbols-iterator'.
  24325. -- Scheme Procedure: lookup-block pc
  24326. Return the innermost '<gdb:block>' containing the given PC value.
  24327. If the block cannot be found for the PC value specified, the
  24328. function will return '#f'.
  24329. 
  24330. File: gdb.info, Node: Symbols In Guile, Next: Symbol Tables In Guile, Prev: Blocks In Guile, Up: Guile API
  24331. 23.3.3.17 Guile representation of Symbols.
  24332. ..........................................
  24333. GDB represents every variable, function and type as an entry in a symbol
  24334. table. *Note Examining the Symbol Table: Symbols. Guile represents
  24335. these symbols in GDB with the '<gdb:symbol>' object.
  24336. The following symbol-related procedures are provided by the '(gdb)'
  24337. module:
  24338. -- Scheme Procedure: symbol? object
  24339. Return '#t' if OBJECT is an object of type '<gdb:symbol>'.
  24340. Otherwise return '#f'.
  24341. -- Scheme Procedure: symbol-valid? symbol
  24342. Return '#t' if the '<gdb:symbol>' object is valid, '#f' if not. A
  24343. '<gdb:symbol>' object can become invalid if the symbol it refers to
  24344. does not exist in GDB any longer. All other '<gdb:symbol>'
  24345. procedures will throw an exception if it is invalid at the time the
  24346. procedure is called.
  24347. -- Scheme Procedure: symbol-type symbol
  24348. Return the type of SYMBOL or '#f' if no type is recorded. The
  24349. result is an object of type '<gdb:type>'. *Note Types In Guile::.
  24350. -- Scheme Procedure: symbol-symtab symbol
  24351. Return the symbol table in which SYMBOL appears. The result is an
  24352. object of type '<gdb:symtab>'. *Note Symbol Tables In Guile::.
  24353. -- Scheme Procedure: symbol-line symbol
  24354. Return the line number in the source code at which SYMBOL was
  24355. defined. This is an integer.
  24356. -- Scheme Procedure: symbol-name symbol
  24357. Return the name of SYMBOL as a string.
  24358. -- Scheme Procedure: symbol-linkage-name symbol
  24359. Return the name of SYMBOL, as used by the linker (i.e., may be
  24360. mangled).
  24361. -- Scheme Procedure: symbol-print-name symbol
  24362. Return the name of SYMBOL in a form suitable for output. This is
  24363. either 'name' or 'linkage_name', depending on whether the user
  24364. asked GDB to display demangled or mangled names.
  24365. -- Scheme Procedure: symbol-addr-class symbol
  24366. Return the address class of the symbol. This classifies how to
  24367. find the value of a symbol. Each address class is a constant
  24368. defined in the '(gdb)' module and described later in this chapter.
  24369. -- Scheme Procedure: symbol-needs-frame? symbol
  24370. Return '#t' if evaluating SYMBOL's value requires a frame (*note
  24371. Frames In Guile::) and '#f' otherwise. Typically, local variables
  24372. will require a frame, but other symbols will not.
  24373. -- Scheme Procedure: symbol-argument? symbol
  24374. Return '#t' if SYMBOL is an argument of a function. Otherwise
  24375. return '#f'.
  24376. -- Scheme Procedure: symbol-constant? symbol
  24377. Return '#t' if SYMBOL is a constant. Otherwise return '#f'.
  24378. -- Scheme Procedure: symbol-function? symbol
  24379. Return '#t' if SYMBOL is a function or a method. Otherwise return
  24380. '#f'.
  24381. -- Scheme Procedure: symbol-variable? symbol
  24382. Return '#t' if SYMBOL is a variable. Otherwise return '#f'.
  24383. -- Scheme Procedure: symbol-value symbol [#:frame frame]
  24384. Compute the value of SYMBOL, as a '<gdb:value>'. For functions,
  24385. this computes the address of the function, cast to the appropriate
  24386. type. If the symbol requires a frame in order to compute its
  24387. value, then FRAME must be given. If FRAME is not given, or if
  24388. FRAME is invalid, then an exception is thrown.
  24389. -- Scheme Procedure: lookup-symbol name [#:block block] [#:domain
  24390. domain]
  24391. This function searches for a symbol by name. The search scope can
  24392. be restricted to the parameters defined in the optional domain and
  24393. block arguments.
  24394. NAME is the name of the symbol. It must be a string. The optional
  24395. BLOCK argument restricts the search to symbols visible in that
  24396. BLOCK. The BLOCK argument must be a '<gdb:block>' object. If
  24397. omitted, the block for the current frame is used. The optional
  24398. DOMAIN argument restricts the search to the domain type. The
  24399. DOMAIN argument must be a domain constant defined in the '(gdb)'
  24400. module and described later in this chapter.
  24401. The result is a list of two elements. The first element is a
  24402. '<gdb:symbol>' object or '#f' if the symbol is not found. If the
  24403. symbol is found, the second element is '#t' if the symbol is a
  24404. field of a method's object (e.g., 'this' in C++), otherwise it is
  24405. '#f'. If the symbol is not found, the second element is '#f'.
  24406. -- Scheme Procedure: lookup-global-symbol name [#:domain domain]
  24407. This function searches for a global symbol by name. The search
  24408. scope can be restricted by the domain argument.
  24409. NAME is the name of the symbol. It must be a string. The optional
  24410. DOMAIN argument restricts the search to the domain type. The
  24411. DOMAIN argument must be a domain constant defined in the '(gdb)'
  24412. module and described later in this chapter.
  24413. The result is a '<gdb:symbol>' object or '#f' if the symbol is not
  24414. found.
  24415. The available domain categories in '<gdb:symbol>' are represented as
  24416. constants in the '(gdb)' module:
  24417. 'SYMBOL_UNDEF_DOMAIN'
  24418. This is used when a domain has not been discovered or none of the
  24419. following domains apply. This usually indicates an error either in
  24420. the symbol information or in GDB's handling of symbols.
  24421. 'SYMBOL_VAR_DOMAIN'
  24422. This domain contains variables, function names, typedef names and
  24423. enum type values.
  24424. 'SYMBOL_STRUCT_DOMAIN'
  24425. This domain holds struct, union and enum type names.
  24426. 'SYMBOL_LABEL_DOMAIN'
  24427. This domain contains names of labels (for gotos).
  24428. 'SYMBOL_VARIABLES_DOMAIN'
  24429. This domain holds a subset of the 'SYMBOLS_VAR_DOMAIN'; it contains
  24430. everything minus functions and types.
  24431. 'SYMBOL_FUNCTIONS_DOMAIN'
  24432. This domain contains all functions.
  24433. 'SYMBOL_TYPES_DOMAIN'
  24434. This domain contains all types.
  24435. The available address class categories in '<gdb:symbol>' are
  24436. represented as constants in the 'gdb' module:
  24437. 'SYMBOL_LOC_UNDEF'
  24438. If this is returned by address class, it indicates an error either
  24439. in the symbol information or in GDB's handling of symbols.
  24440. 'SYMBOL_LOC_CONST'
  24441. Value is constant int.
  24442. 'SYMBOL_LOC_STATIC'
  24443. Value is at a fixed address.
  24444. 'SYMBOL_LOC_REGISTER'
  24445. Value is in a register.
  24446. 'SYMBOL_LOC_ARG'
  24447. Value is an argument. This value is at the offset stored within
  24448. the symbol inside the frame's argument list.
  24449. 'SYMBOL_LOC_REF_ARG'
  24450. Value address is stored in the frame's argument list. Just like
  24451. 'LOC_ARG' except that the value's address is stored at the offset,
  24452. not the value itself.
  24453. 'SYMBOL_LOC_REGPARM_ADDR'
  24454. Value is a specified register. Just like 'LOC_REGISTER' except the
  24455. register holds the address of the argument instead of the argument
  24456. itself.
  24457. 'SYMBOL_LOC_LOCAL'
  24458. Value is a local variable.
  24459. 'SYMBOL_LOC_TYPEDEF'
  24460. Value not used. Symbols in the domain 'SYMBOL_STRUCT_DOMAIN' all
  24461. have this class.
  24462. 'SYMBOL_LOC_BLOCK'
  24463. Value is a block.
  24464. 'SYMBOL_LOC_CONST_BYTES'
  24465. Value is a byte-sequence.
  24466. 'SYMBOL_LOC_UNRESOLVED'
  24467. Value is at a fixed address, but the address of the variable has to
  24468. be determined from the minimal symbol table whenever the variable
  24469. is referenced.
  24470. 'SYMBOL_LOC_OPTIMIZED_OUT'
  24471. The value does not actually exist in the program.
  24472. 'SYMBOL_LOC_COMPUTED'
  24473. The value's address is a computed location.
  24474. 
  24475. File: gdb.info, Node: Symbol Tables In Guile, Next: Breakpoints In Guile, Prev: Symbols In Guile, Up: Guile API
  24476. 23.3.3.18 Symbol table representation in Guile.
  24477. ...............................................
  24478. Access to symbol table data maintained by GDB on the inferior is exposed
  24479. to Guile via two objects: '<gdb:sal>' (symtab-and-line) and
  24480. '<gdb:symtab>'. Symbol table and line data for a frame is returned from
  24481. the 'frame-find-sal' '<gdb:frame>' procedure. *Note Frames In Guile::.
  24482. For more information on GDB's symbol table management, see *note
  24483. Examining the Symbol Table: Symbols.
  24484. The following symtab-related procedures are provided by the '(gdb)'
  24485. module:
  24486. -- Scheme Procedure: symtab? object
  24487. Return '#t' if OBJECT is an object of type '<gdb:symtab>'.
  24488. Otherwise return '#f'.
  24489. -- Scheme Procedure: symtab-valid? symtab
  24490. Return '#t' if the '<gdb:symtab>' object is valid, '#f' if not. A
  24491. '<gdb:symtab>' object becomes invalid when the symbol table it
  24492. refers to no longer exists in GDB. All other '<gdb:symtab>'
  24493. procedures will throw an exception if it is invalid at the time the
  24494. procedure is called.
  24495. -- Scheme Procedure: symtab-filename symtab
  24496. Return the symbol table's source filename.
  24497. -- Scheme Procedure: symtab-fullname symtab
  24498. Return the symbol table's source absolute file name.
  24499. -- Scheme Procedure: symtab-objfile symtab
  24500. Return the symbol table's backing object file. *Note Objfiles In
  24501. Guile::.
  24502. -- Scheme Procedure: symtab-global-block symtab
  24503. Return the global block of the underlying symbol table. *Note
  24504. Blocks In Guile::.
  24505. -- Scheme Procedure: symtab-static-block symtab
  24506. Return the static block of the underlying symbol table. *Note
  24507. Blocks In Guile::.
  24508. The following symtab-and-line-related procedures are provided by the
  24509. '(gdb)' module:
  24510. -- Scheme Procedure: sal? object
  24511. Return '#t' if OBJECT is an object of type '<gdb:sal>'. Otherwise
  24512. return '#f'.
  24513. -- Scheme Procedure: sal-valid? sal
  24514. Return '#t' if SAL is valid, '#f' if not. A '<gdb:sal>' object
  24515. becomes invalid when the Symbol table object it refers to no longer
  24516. exists in GDB. All other '<gdb:sal>' procedures will throw an
  24517. exception if it is invalid at the time the procedure is called.
  24518. -- Scheme Procedure: sal-symtab sal
  24519. Return the symbol table object ('<gdb:symtab>') for SAL.
  24520. -- Scheme Procedure: sal-line sal
  24521. Return the line number for SAL.
  24522. -- Scheme Procedure: sal-pc sal
  24523. Return the start of the address range occupied by code for SAL.
  24524. -- Scheme Procedure: sal-last sal
  24525. Return the end of the address range occupied by code for SAL.
  24526. -- Scheme Procedure: find-pc-line pc
  24527. Return the '<gdb:sal>' object corresponding to the PC value. If an
  24528. invalid value of PC is passed as an argument, then the 'symtab' and
  24529. 'line' attributes of the returned '<gdb:sal>' object will be '#f'
  24530. and 0 respectively.
  24531. 
  24532. File: gdb.info, Node: Breakpoints In Guile, Next: Lazy Strings In Guile, Prev: Symbol Tables In Guile, Up: Guile API
  24533. 23.3.3.19 Manipulating breakpoints using Guile
  24534. ..............................................
  24535. Breakpoints in Guile are represented by objects of type
  24536. '<gdb:breakpoint>'. New breakpoints can be created with the
  24537. 'make-breakpoint' Guile function, and then added to GDB with the
  24538. 'register-breakpoint!' Guile function. This two-step approach is taken
  24539. to separate out the side-effect of adding the breakpoint to GDB from
  24540. 'make-breakpoint'.
  24541. Support is also provided to view and manipulate breakpoints created
  24542. outside of Guile.
  24543. The following breakpoint-related procedures are provided by the
  24544. '(gdb)' module:
  24545. -- Scheme Procedure: make-breakpoint location [#:type type] [#:wp-class
  24546. wp-class] [#:internal internal]
  24547. Create a new breakpoint at LOCATION, a string naming the location
  24548. of the breakpoint, or an expression that defines a watchpoint. The
  24549. contents can be any location recognized by the 'break' command, or
  24550. in the case of a watchpoint, by the 'watch' command.
  24551. The breakpoint is initially marked as 'invalid'. The breakpoint is
  24552. not usable until it has been registered with GDB with
  24553. 'register-breakpoint!', at which point it becomes 'valid'. The
  24554. result is the '<gdb:breakpoint>' object representing the
  24555. breakpoint.
  24556. The optional TYPE denotes the breakpoint to create. This argument
  24557. can be either 'BP_BREAKPOINT' or 'BP_WATCHPOINT', and defaults to
  24558. 'BP_BREAKPOINT'.
  24559. The optional WP-CLASS argument defines the class of watchpoint to
  24560. create, if TYPE is 'BP_WATCHPOINT'. If a watchpoint class is not
  24561. provided, it is assumed to be a 'WP_WRITE' class.
  24562. The optional INTERNAL argument allows the breakpoint to become
  24563. invisible to the user. The breakpoint will neither be reported
  24564. when registered, nor will it be listed in the output from 'info
  24565. breakpoints' (but will be listed with the 'maint info breakpoints'
  24566. command). If an internal flag is not provided, the breakpoint is
  24567. visible (non-internal).
  24568. When a watchpoint is created, GDB will try to create a hardware
  24569. assisted watchpoint. If successful, the type of the watchpoint is
  24570. changed from 'BP_WATCHPOINT' to 'BP_HARDWARE_WATCHPOINT' for
  24571. 'WP_WRITE', 'BP_READ_WATCHPOINT' for 'WP_READ', and
  24572. 'BP_ACCESS_WATCHPOINT' for 'WP_ACCESS'. If not successful, the
  24573. type of the watchpoint is left as 'WP_WATCHPOINT'.
  24574. The available types are represented by constants defined in the
  24575. 'gdb' module:
  24576. 'BP_BREAKPOINT'
  24577. Normal code breakpoint.
  24578. 'BP_WATCHPOINT'
  24579. Watchpoint breakpoint.
  24580. 'BP_HARDWARE_WATCHPOINT'
  24581. Hardware assisted watchpoint. This value cannot be specified
  24582. when creating the breakpoint.
  24583. 'BP_READ_WATCHPOINT'
  24584. Hardware assisted read watchpoint. This value cannot be
  24585. specified when creating the breakpoint.
  24586. 'BP_ACCESS_WATCHPOINT'
  24587. Hardware assisted access watchpoint. This value cannot be
  24588. specified when creating the breakpoint.
  24589. The available watchpoint types represented by constants are defined
  24590. in the '(gdb)' module:
  24591. 'WP_READ'
  24592. Read only watchpoint.
  24593. 'WP_WRITE'
  24594. Write only watchpoint.
  24595. 'WP_ACCESS'
  24596. Read/Write watchpoint.
  24597. -- Scheme Procedure: register-breakpoint! breakpoint
  24598. Add BREAKPOINT, a '<gdb:breakpoint>' object, to GDB's list of
  24599. breakpoints. The breakpoint must have been created with
  24600. 'make-breakpoint'. One cannot register breakpoints that have been
  24601. created outside of Guile. Once a breakpoint is registered it
  24602. becomes 'valid'. It is an error to register an already registered
  24603. breakpoint. The result is unspecified.
  24604. -- Scheme Procedure: delete-breakpoint! breakpoint
  24605. Remove BREAKPOINT from GDB's list of breakpoints. This also
  24606. invalidates the Guile BREAKPOINT object. Any further attempt to
  24607. access the object will throw an exception.
  24608. If BREAKPOINT was created from Guile with 'make-breakpoint' it may
  24609. be re-registered with GDB, in which case the breakpoint becomes
  24610. valid again.
  24611. -- Scheme Procedure: breakpoints
  24612. Return a list of all breakpoints. Each element of the list is a
  24613. '<gdb:breakpoint>' object.
  24614. -- Scheme Procedure: breakpoint? object
  24615. Return '#t' if OBJECT is a '<gdb:breakpoint>' object, and '#f'
  24616. otherwise.
  24617. -- Scheme Procedure: breakpoint-valid? breakpoint
  24618. Return '#t' if BREAKPOINT is valid, '#f' otherwise. Breakpoints
  24619. created with 'make-breakpoint' are marked as invalid until they are
  24620. registered with GDB with 'register-breakpoint!'. A
  24621. '<gdb:breakpoint>' object can become invalid if the user deletes
  24622. the breakpoint. In this case, the object still exists, but the
  24623. underlying breakpoint does not. In the cases of watchpoint scope,
  24624. the watchpoint remains valid even if execution of the inferior
  24625. leaves the scope of that watchpoint.
  24626. -- Scheme Procedure: breakpoint-number breakpoint
  24627. Return the breakpoint's number -- the identifier used by the user
  24628. to manipulate the breakpoint.
  24629. -- Scheme Procedure: breakpoint-type breakpoint
  24630. Return the breakpoint's type -- the identifier used to determine
  24631. the actual breakpoint type or use-case.
  24632. -- Scheme Procedure: breakpoint-visible? breakpoint
  24633. Return '#t' if the breakpoint is visible to the user when hit, or
  24634. when the 'info breakpoints' command is run. Otherwise return '#f'.
  24635. -- Scheme Procedure: breakpoint-location breakpoint
  24636. Return the location of the breakpoint, as specified by the user.
  24637. It is a string. If the breakpoint does not have a location (that
  24638. is, it is a watchpoint) return '#f'.
  24639. -- Scheme Procedure: breakpoint-expression breakpoint
  24640. Return the breakpoint expression, as specified by the user. It is
  24641. a string. If the breakpoint does not have an expression (the
  24642. breakpoint is not a watchpoint) return '#f'.
  24643. -- Scheme Procedure: breakpoint-enabled? breakpoint
  24644. Return '#t' if the breakpoint is enabled, and '#f' otherwise.
  24645. -- Scheme Procedure: set-breakpoint-enabled! breakpoint flag
  24646. Set the enabled state of BREAKPOINT to FLAG. If flag is '#f' it is
  24647. disabled, otherwise it is enabled.
  24648. -- Scheme Procedure: breakpoint-silent? breakpoint
  24649. Return '#t' if the breakpoint is silent, and '#f' otherwise.
  24650. Note that a breakpoint can also be silent if it has commands and
  24651. the first command is 'silent'. This is not reported by the
  24652. 'silent' attribute.
  24653. -- Scheme Procedure: set-breakpoint-silent! breakpoint flag
  24654. Set the silent state of BREAKPOINT to FLAG. If flag is '#f' the
  24655. breakpoint is made silent, otherwise it is made non-silent (or
  24656. noisy).
  24657. -- Scheme Procedure: breakpoint-ignore-count breakpoint
  24658. Return the ignore count for BREAKPOINT.
  24659. -- Scheme Procedure: set-breakpoint-ignore-count! breakpoint count
  24660. Set the ignore count for BREAKPOINT to COUNT.
  24661. -- Scheme Procedure: breakpoint-hit-count breakpoint
  24662. Return hit count of BREAKPOINT.
  24663. -- Scheme Procedure: set-breakpoint-hit-count! breakpoint count
  24664. Set the hit count of BREAKPOINT to COUNT. At present, COUNT must
  24665. be zero.
  24666. -- Scheme Procedure: breakpoint-thread breakpoint
  24667. Return the global-thread-id for thread-specific breakpoint
  24668. BREAKPOINT. Return #f if BREAKPOINT is not thread-specific.
  24669. -- Scheme Procedure: set-breakpoint-thread! breakpoint
  24670. global-thread-id|#f
  24671. Set the thread-id for BREAKPOINT to GLOBAL-THREAD-ID If set to
  24672. '#f', the breakpoint is no longer thread-specific.
  24673. -- Scheme Procedure: breakpoint-task breakpoint
  24674. If the breakpoint is Ada task-specific, return the Ada task id. If
  24675. the breakpoint is not task-specific (or the underlying language is
  24676. not Ada), return '#f'.
  24677. -- Scheme Procedure: set-breakpoint-task! breakpoint task
  24678. Set the Ada task of BREAKPOINT to TASK. If set to '#f', the
  24679. breakpoint is no longer task-specific.
  24680. -- Scheme Procedure: breakpoint-condition breakpoint
  24681. Return the condition of BREAKPOINT, as specified by the user. It
  24682. is a string. If there is no condition, return '#f'.
  24683. -- Scheme Procedure: set-breakpoint-condition! breakpoint condition
  24684. Set the condition of BREAKPOINT to CONDITION, which must be a
  24685. string. If set to '#f' then the breakpoint becomes unconditional.
  24686. -- Scheme Procedure: breakpoint-stop breakpoint
  24687. Return the stop predicate of BREAKPOINT. See
  24688. 'set-breakpoint-stop!' below in this section.
  24689. -- Scheme Procedure: set-breakpoint-stop! breakpoint procedure|#f
  24690. Set the stop predicate of BREAKPOINT. The predicate PROCEDURE
  24691. takes one argument: the <gdb:breakpoint> object. If this predicate
  24692. is set to a procedure then it is invoked whenever the inferior
  24693. reaches this breakpoint. If it returns '#t', or any non-'#f'
  24694. value, then the inferior is stopped, otherwise the inferior will
  24695. continue.
  24696. If there are multiple breakpoints at the same location with a
  24697. 'stop' predicate, each one will be called regardless of the return
  24698. status of the previous. This ensures that all 'stop' predicates
  24699. have a chance to execute at that location. In this scenario if one
  24700. of the methods returns '#t' but the others return '#f', the
  24701. inferior will still be stopped.
  24702. You should not alter the execution state of the inferior (i.e.,
  24703. step, next, etc.), alter the current frame context (i.e., change
  24704. the current active frame), or alter, add or delete any breakpoint.
  24705. As a general rule, you should not alter any data within GDB or the
  24706. inferior at this time.
  24707. Example 'stop' implementation:
  24708. (define (my-stop? bkpt)
  24709. (let ((int-val (parse-and-eval "foo")))
  24710. (value=? int-val 3)))
  24711. (define bkpt (make-breakpoint "main.c:42"))
  24712. (register-breakpoint! bkpt)
  24713. (set-breakpoint-stop! bkpt my-stop?)
  24714. -- Scheme Procedure: breakpoint-commands breakpoint
  24715. Return the commands attached to BREAKPOINT as a string, or '#f' if
  24716. there are none.
  24717. 
  24718. File: gdb.info, Node: Lazy Strings In Guile, Next: Architectures In Guile, Prev: Breakpoints In Guile, Up: Guile API
  24719. 23.3.3.20 Guile representation of lazy strings.
  24720. ...............................................
  24721. A "lazy string" is a string whose contents is not retrieved or encoded
  24722. until it is needed.
  24723. A '<gdb:lazy-string>' is represented in GDB as an 'address' that
  24724. points to a region of memory, an 'encoding' that will be used to encode
  24725. that region of memory, and a 'length' to delimit the region of memory
  24726. that represents the string. The difference between a
  24727. '<gdb:lazy-string>' and a string wrapped within a '<gdb:value>' is that
  24728. a '<gdb:lazy-string>' will be treated differently by GDB when printing.
  24729. A '<gdb:lazy-string>' is retrieved and encoded during printing, while a
  24730. '<gdb:value>' wrapping a string is immediately retrieved and encoded on
  24731. creation.
  24732. The following lazy-string-related procedures are provided by the
  24733. '(gdb)' module:
  24734. -- Scheme Procedure: lazy-string? object
  24735. Return '#t' if OBJECT is an object of type '<gdb:lazy-string>'.
  24736. Otherwise return '#f'.
  24737. -- Scheme Procedure: lazy-string-address lazy-sring
  24738. Return the address of LAZY-STRING.
  24739. -- Scheme Procedure: lazy-string-length lazy-string
  24740. Return the length of LAZY-STRING in characters. If the length is
  24741. -1, then the string will be fetched and encoded up to the first
  24742. null of appropriate width.
  24743. -- Scheme Procedure: lazy-string-encoding lazy-string
  24744. Return the encoding that will be applied to LAZY-STRING when the
  24745. string is printed by GDB. If the encoding is not set, or contains
  24746. an empty string, then GDB will select the most appropriate encoding
  24747. when the string is printed.
  24748. -- Scheme Procedure: lazy-string-type lazy-string
  24749. Return the type that is represented by LAZY-STRING's type. For a
  24750. lazy string this is a pointer or array type. To resolve this to
  24751. the lazy string's character type, use 'type-target-type'. *Note
  24752. Types In Guile::.
  24753. -- Scheme Procedure: lazy-string->value lazy-string
  24754. Convert the '<gdb:lazy-string>' to a '<gdb:value>'. This value
  24755. will point to the string in memory, but will lose all the delayed
  24756. retrieval, encoding and handling that GDB applies to a
  24757. '<gdb:lazy-string>'.
  24758. 
  24759. File: gdb.info, Node: Architectures In Guile, Next: Disassembly In Guile, Prev: Lazy Strings In Guile, Up: Guile API
  24760. 23.3.3.21 Guile representation of architectures
  24761. ...............................................
  24762. GDB uses architecture specific parameters and artifacts in a number of
  24763. its various computations. An architecture is represented by an instance
  24764. of the '<gdb:arch>' class.
  24765. The following architecture-related procedures are provided by the
  24766. '(gdb)' module:
  24767. -- Scheme Procedure: arch? object
  24768. Return '#t' if OBJECT is an object of type '<gdb:arch>'. Otherwise
  24769. return '#f'.
  24770. -- Scheme Procedure: current-arch
  24771. Return the current architecture as a '<gdb:arch>' object.
  24772. -- Scheme Procedure: arch-name arch
  24773. Return the name (string value) of '<gdb:arch>' ARCH.
  24774. -- Scheme Procedure: arch-charset arch
  24775. Return name of target character set of '<gdb:arch>' ARCH.
  24776. -- Scheme Procedure: arch-wide-charset
  24777. Return name of target wide character set of '<gdb:arch>' ARCH.
  24778. Each architecture provides a set of predefined types, obtained by the
  24779. following functions.
  24780. -- Scheme Procedure: arch-void-type arch
  24781. Return the '<gdb:type>' object for a 'void' type of architecture
  24782. ARCH.
  24783. -- Scheme Procedure: arch-char-type arch
  24784. Return the '<gdb:type>' object for a 'char' type of architecture
  24785. ARCH.
  24786. -- Scheme Procedure: arch-short-type arch
  24787. Return the '<gdb:type>' object for a 'short' type of architecture
  24788. ARCH.
  24789. -- Scheme Procedure: arch-int-type arch
  24790. Return the '<gdb:type>' object for an 'int' type of architecture
  24791. ARCH.
  24792. -- Scheme Procedure: arch-long-type arch
  24793. Return the '<gdb:type>' object for a 'long' type of architecture
  24794. ARCH.
  24795. -- Scheme Procedure: arch-schar-type arch
  24796. Return the '<gdb:type>' object for a 'signed char' type of
  24797. architecture ARCH.
  24798. -- Scheme Procedure: arch-uchar-type arch
  24799. Return the '<gdb:type>' object for an 'unsigned char' type of
  24800. architecture ARCH.
  24801. -- Scheme Procedure: arch-ushort-type arch
  24802. Return the '<gdb:type>' object for an 'unsigned short' type of
  24803. architecture ARCH.
  24804. -- Scheme Procedure: arch-uint-type arch
  24805. Return the '<gdb:type>' object for an 'unsigned int' type of
  24806. architecture ARCH.
  24807. -- Scheme Procedure: arch-ulong-type arch
  24808. Return the '<gdb:type>' object for an 'unsigned long' type of
  24809. architecture ARCH.
  24810. -- Scheme Procedure: arch-float-type arch
  24811. Return the '<gdb:type>' object for a 'float' type of architecture
  24812. ARCH.
  24813. -- Scheme Procedure: arch-double-type arch
  24814. Return the '<gdb:type>' object for a 'double' type of architecture
  24815. ARCH.
  24816. -- Scheme Procedure: arch-longdouble-type arch
  24817. Return the '<gdb:type>' object for a 'long double' type of
  24818. architecture ARCH.
  24819. -- Scheme Procedure: arch-bool-type arch
  24820. Return the '<gdb:type>' object for a 'bool' type of architecture
  24821. ARCH.
  24822. -- Scheme Procedure: arch-longlong-type arch
  24823. Return the '<gdb:type>' object for a 'long long' type of
  24824. architecture ARCH.
  24825. -- Scheme Procedure: arch-ulonglong-type arch
  24826. Return the '<gdb:type>' object for an 'unsigned long long' type of
  24827. architecture ARCH.
  24828. -- Scheme Procedure: arch-int8-type arch
  24829. Return the '<gdb:type>' object for an 'int8' type of architecture
  24830. ARCH.
  24831. -- Scheme Procedure: arch-uint8-type arch
  24832. Return the '<gdb:type>' object for a 'uint8' type of architecture
  24833. ARCH.
  24834. -- Scheme Procedure: arch-int16-type arch
  24835. Return the '<gdb:type>' object for an 'int16' type of architecture
  24836. ARCH.
  24837. -- Scheme Procedure: arch-uint16-type arch
  24838. Return the '<gdb:type>' object for a 'uint16' type of architecture
  24839. ARCH.
  24840. -- Scheme Procedure: arch-int32-type arch
  24841. Return the '<gdb:type>' object for an 'int32' type of architecture
  24842. ARCH.
  24843. -- Scheme Procedure: arch-uint32-type arch
  24844. Return the '<gdb:type>' object for a 'uint32' type of architecture
  24845. ARCH.
  24846. -- Scheme Procedure: arch-int64-type arch
  24847. Return the '<gdb:type>' object for an 'int64' type of architecture
  24848. ARCH.
  24849. -- Scheme Procedure: arch-uint64-type arch
  24850. Return the '<gdb:type>' object for a 'uint64' type of architecture
  24851. ARCH.
  24852. Example:
  24853. (gdb) guile (type-name (arch-uchar-type (current-arch)))
  24854. "unsigned char"
  24855. 
  24856. File: gdb.info, Node: Disassembly In Guile, Next: I/O Ports in Guile, Prev: Architectures In Guile, Up: Guile API
  24857. 23.3.3.22 Disassembly In Guile
  24858. ..............................
  24859. The disassembler can be invoked from Scheme code. Furthermore, the
  24860. disassembler can take a Guile port as input, allowing one to disassemble
  24861. from any source, and not just target memory.
  24862. -- Scheme Procedure: arch-disassemble arch start-pc [#:port port]
  24863. [#:offset offset] [#:size size] [#:count count]
  24864. Return a list of disassembled instructions starting from the memory
  24865. address START-PC.
  24866. The optional argument PORT specifies the input port to read bytes
  24867. from. If PORT is '#f' then bytes are read from target memory.
  24868. The optional argument OFFSET specifies the address offset of the
  24869. first byte in PORT. This is useful, for example, when PORT
  24870. specifies a 'bytevector' and you want the bytevector to be
  24871. disassembled as if it came from that address. The START-PC passed
  24872. to the reader for PORT is offset by the same amount.
  24873. Example:
  24874. (gdb) guile (use-modules (rnrs io ports))
  24875. (gdb) guile (define pc (value->integer (parse-and-eval "$pc")))
  24876. (gdb) guile (define mem (open-memory #:start pc))
  24877. (gdb) guile (define bv (get-bytevector-n mem 10))
  24878. (gdb) guile (define bv-port (open-bytevector-input-port bv))
  24879. (gdb) guile (define arch (current-arch))
  24880. (gdb) guile (arch-disassemble arch pc #:port bv-port #:offset pc)
  24881. (((address . 4195516) (asm . "mov $0x4005c8,%edi") (length . 5)))
  24882. The optional arguments SIZE and COUNT determine the number of
  24883. instructions in the returned list. If either SIZE or COUNT is
  24884. specified as zero, then no instructions are disassembled and an
  24885. empty list is returned. If both the optional arguments SIZE and
  24886. COUNT are specified, then a list of at most COUNT disassembled
  24887. instructions whose start address falls in the closed memory address
  24888. interval from START-PC to (START-PC + SIZE - 1) are returned. If
  24889. SIZE is not specified, but COUNT is specified, then COUNT number of
  24890. instructions starting from the address START-PC are returned. If
  24891. COUNT is not specified but SIZE is specified, then all instructions
  24892. whose start address falls in the closed memory address interval
  24893. from START-PC to (START-PC + SIZE - 1) are returned. If neither
  24894. SIZE nor COUNT are specified, then a single instruction at START-PC
  24895. is returned.
  24896. Each element of the returned list is an alist (associative list)
  24897. with the following keys:
  24898. 'address'
  24899. The value corresponding to this key is a Guile integer of the
  24900. memory address of the instruction.
  24901. 'asm'
  24902. The value corresponding to this key is a string value which
  24903. represents the instruction with assembly language mnemonics.
  24904. The assembly language flavor used is the same as that
  24905. specified by the current CLI variable 'disassembly-flavor'.
  24906. *Note Machine Code::.
  24907. 'length'
  24908. The value corresponding to this key is the length of the
  24909. instruction in bytes.
  24910. 
  24911. File: gdb.info, Node: I/O Ports in Guile, Next: Memory Ports in Guile, Prev: Disassembly In Guile, Up: Guile API
  24912. 23.3.3.23 I/O Ports in Guile
  24913. ............................
  24914. -- Scheme Procedure: input-port
  24915. Return GDB's input port as a Guile port object.
  24916. -- Scheme Procedure: output-port
  24917. Return GDB's output port as a Guile port object.
  24918. -- Scheme Procedure: error-port
  24919. Return GDB's error port as a Guile port object.
  24920. -- Scheme Procedure: stdio-port? object
  24921. Return '#t' if OBJECT is a GDB stdio port. Otherwise return '#f'.
  24922. 
  24923. File: gdb.info, Node: Memory Ports in Guile, Next: Iterators In Guile, Prev: I/O Ports in Guile, Up: Guile API
  24924. 23.3.3.24 Memory Ports in Guile
  24925. ...............................
  24926. GDB provides a 'port' interface to target memory. This allows Guile
  24927. code to read/write target memory using Guile's port and bytevector
  24928. functionality. The main routine is 'open-memory' which returns a port
  24929. object. One can then read/write memory using that object.
  24930. -- Scheme Procedure: open-memory [#:mode mode] [#:start address]
  24931. [#:size size]
  24932. Return a port object that can be used for reading and writing
  24933. memory. The port will be open according to MODE, which is the
  24934. standard mode argument to Guile port open routines, except that the
  24935. '"a"' and '"l"' modes are not supported. *Note (guile)File
  24936. Ports::. The '"b"' (binary) character may be present, but is
  24937. ignored: memory ports are binary only. If '"0"' is appended then
  24938. the port is marked as unbuffered. The default is '"r"', read-only
  24939. and buffered.
  24940. The chunk of memory that can be accessed can be bounded. If both
  24941. START and SIZE are unspecified, all of memory can be accessed. If
  24942. only START is specified, all of memory from that point on can be
  24943. accessed. If only SIZE if specified, all memory in the range
  24944. [0,SIZE) can be accessed. If both are specified, all memory in the
  24945. rane [START,START+SIZE) can be accessed.
  24946. -- Scheme Procedure: memory-port?
  24947. Return '#t' if OBJECT is an object of type '<gdb:memory-port>'.
  24948. Otherwise return '#f'.
  24949. -- Scheme Procedure: memory-port-range memory-port
  24950. Return the range of '<gdb:memory-port>' MEMORY-PORT as a list of
  24951. two elements: '(start end)'. The range is START to END inclusive.
  24952. -- Scheme Procedure: memory-port-read-buffer-size memory-port
  24953. Return the size of the read buffer of '<gdb:memory-port>'
  24954. MEMORY-PORT.
  24955. This procedure is deprecated and will be removed in GDB 11. It
  24956. returns 0 when using Guile 2.2 or later.
  24957. -- Scheme Procedure: set-memory-port-read-buffer-size! memory-port size
  24958. Set the size of the read buffer of '<gdb:memory-port>' MEMORY-PORT
  24959. to SIZE. The result is unspecified.
  24960. This procedure is deprecated and will be removed in GDB 11. When
  24961. GDB is built with Guile 2.2 or later, you can call 'setvbuf'
  24962. instead (*note 'setvbuf': (guile)Buffering.).
  24963. -- Scheme Procedure: memory-port-write-buffer-size memory-port
  24964. Return the size of the write buffer of '<gdb:memory-port>'
  24965. MEMORY-PORT.
  24966. This procedure is deprecated and will be removed in GDB 11. It
  24967. returns 0 when GDB is built with Guile 2.2 or later.
  24968. -- Scheme Procedure: set-memory-port-write-buffer-size! memory-port
  24969. size
  24970. Set the size of the write buffer of '<gdb:memory-port>' MEMORY-PORT
  24971. to SIZE. The result is unspecified.
  24972. This procedure is deprecated and will be removed in GDB 11. When
  24973. GDB is built with Guile 2.2 or later, you can call 'setvbuf'
  24974. instead.
  24975. A memory port is closed like any other port, with 'close-port'.
  24976. Combined with Guile's 'bytevectors', memory ports provide a lot of
  24977. utility. For example, to fill a buffer of 10 integers in memory, one
  24978. can do something like the following.
  24979. ;; In the program: int buffer[10];
  24980. (use-modules (rnrs bytevectors))
  24981. (use-modules (rnrs io ports))
  24982. (define addr (parse-and-eval "buffer"))
  24983. (define n 10)
  24984. (define byte-size (* n 4))
  24985. (define mem-port (open-memory #:mode "r+" #:start
  24986. (value->integer addr) #:size byte-size))
  24987. (define byte-vec (make-bytevector byte-size))
  24988. (do ((i 0 (+ i 1)))
  24989. ((>= i n))
  24990. (bytevector-s32-native-set! byte-vec (* i 4) (* i 42)))
  24991. (put-bytevector mem-port byte-vec)
  24992. (close-port mem-port)
  24993. 
  24994. File: gdb.info, Node: Iterators In Guile, Prev: Memory Ports in Guile, Up: Guile API
  24995. 23.3.3.25 Iterators In Guile
  24996. ............................
  24997. A simple iterator facility is provided to allow, for example, iterating
  24998. over the set of program symbols without having to first construct a list
  24999. of all of them. A useful contribution would be to add support for SRFI
  25000. 41 and SRFI 45.
  25001. -- Scheme Procedure: make-iterator object progress next!
  25002. A '<gdb:iterator>' object is constructed with the 'make-iterator'
  25003. procedure. It takes three arguments: the object to be iterated
  25004. over, an object to record the progress of the iteration, and a
  25005. procedure to return the next element in the iteration, or an
  25006. implementation chosen value to denote the end of iteration.
  25007. By convention, end of iteration is marked with
  25008. '(end-of-iteration)', and may be tested with the
  25009. 'end-of-iteration?' predicate. The result of '(end-of-iteration)'
  25010. is chosen so that it is not otherwise used by the '(gdb)' module.
  25011. If you are using '<gdb:iterator>' in your own code it is your
  25012. responsibility to maintain this invariant.
  25013. A trivial example for illustration's sake:
  25014. (use-modules (gdb iterator))
  25015. (define my-list (list 1 2 3))
  25016. (define iter
  25017. (make-iterator my-list my-list
  25018. (lambda (iter)
  25019. (let ((l (iterator-progress iter)))
  25020. (if (eq? l '())
  25021. (end-of-iteration)
  25022. (begin
  25023. (set-iterator-progress! iter (cdr l))
  25024. (car l)))))))
  25025. Here is a slightly more realistic example, which computes a list of
  25026. all the functions in 'my-global-block'.
  25027. (use-modules (gdb iterator))
  25028. (define this-sal (find-pc-line (frame-pc (selected-frame))))
  25029. (define this-symtab (sal-symtab this-sal))
  25030. (define this-global-block (symtab-global-block this-symtab))
  25031. (define syms-iter (make-block-symbols-iterator this-global-block))
  25032. (define functions (iterator-filter symbol-function? syms-iter))
  25033. -- Scheme Procedure: iterator? object
  25034. Return '#t' if OBJECT is a '<gdb:iterator>' object. Otherwise
  25035. return '#f'.
  25036. -- Scheme Procedure: iterator-object iterator
  25037. Return the first argument that was passed to 'make-iterator'. This
  25038. is the object being iterated over.
  25039. -- Scheme Procedure: iterator-progress iterator
  25040. Return the object tracking iteration progress.
  25041. -- Scheme Procedure: set-iterator-progress! iterator new-value
  25042. Set the object tracking iteration progress.
  25043. -- Scheme Procedure: iterator-next! iterator
  25044. Invoke the procedure that was the third argument to
  25045. 'make-iterator', passing it one argument, the '<gdb:iterator>'
  25046. object. The result is either the next element in the iteration, or
  25047. an end marker as implemented by the 'next!' procedure. By
  25048. convention the end marker is the result of '(end-of-iteration)'.
  25049. -- Scheme Procedure: end-of-iteration
  25050. Return the Scheme object that denotes end of iteration.
  25051. -- Scheme Procedure: end-of-iteration? object
  25052. Return '#t' if OBJECT is the end of iteration marker. Otherwise
  25053. return '#f'.
  25054. These functions are provided by the '(gdb iterator)' module to assist
  25055. in using iterators.
  25056. -- Scheme Procedure: make-list-iterator list
  25057. Return a '<gdb:iterator>' object that will iterate over LIST.
  25058. -- Scheme Procedure: iterator->list iterator
  25059. Return the elements pointed to by ITERATOR as a list.
  25060. -- Scheme Procedure: iterator-map proc iterator
  25061. Return the list of objects obtained by applying PROC to the object
  25062. pointed to by ITERATOR and to each subsequent object.
  25063. -- Scheme Procedure: iterator-for-each proc iterator
  25064. Apply PROC to each element pointed to by ITERATOR. The result is
  25065. unspecified.
  25066. -- Scheme Procedure: iterator-filter pred iterator
  25067. Return the list of elements pointed to by ITERATOR that satisfy
  25068. PRED.
  25069. -- Scheme Procedure: iterator-until pred iterator
  25070. Run ITERATOR until the result of '(pred element)' is true and
  25071. return that as the result. Otherwise return '#f'.
  25072. 
  25073. File: gdb.info, Node: Guile Auto-loading, Next: Guile Modules, Prev: Guile API, Up: Guile
  25074. 23.3.4 Guile Auto-loading
  25075. -------------------------
  25076. When a new object file is read (for example, due to the 'file' command,
  25077. or because the inferior has loaded a shared library), GDB will look for
  25078. Guile support scripts in two ways: 'OBJFILE-gdb.scm' and the
  25079. '.debug_gdb_scripts' section. *Note Auto-loading extensions::.
  25080. The auto-loading feature is useful for supplying application-specific
  25081. debugging commands and scripts.
  25082. Auto-loading can be enabled or disabled, and the list of auto-loaded
  25083. scripts can be printed.
  25084. 'set auto-load guile-scripts [on|off]'
  25085. Enable or disable the auto-loading of Guile scripts.
  25086. 'show auto-load guile-scripts'
  25087. Show whether auto-loading of Guile scripts is enabled or disabled.
  25088. 'info auto-load guile-scripts [REGEXP]'
  25089. Print the list of all Guile scripts that GDB auto-loaded.
  25090. Also printed is the list of Guile scripts that were mentioned in
  25091. the '.debug_gdb_scripts' section and were not found. This is
  25092. useful because their names are not printed when GDB tries to load
  25093. them and fails. There may be many of them, and printing an error
  25094. message for each one is problematic.
  25095. If REGEXP is supplied only Guile scripts with matching names are
  25096. printed.
  25097. Example:
  25098. (gdb) info auto-load guile-scripts
  25099. Loaded Script
  25100. Yes scm-section-script.scm
  25101. full name: /tmp/scm-section-script.scm
  25102. No my-foo-pretty-printers.scm
  25103. When reading an auto-loaded file, GDB sets the "current objfile".
  25104. This is available via the 'current-objfile' procedure (*note Objfiles In
  25105. Guile::). This can be useful for registering objfile-specific
  25106. pretty-printers.
  25107. 
  25108. File: gdb.info, Node: Guile Modules, Prev: Guile Auto-loading, Up: Guile
  25109. 23.3.5 Guile Modules
  25110. --------------------
  25111. GDB comes with several modules to assist writing Guile code.
  25112. * Menu:
  25113. * Guile Printing Module:: Building and registering pretty-printers
  25114. * Guile Types Module:: Utilities for working with types
  25115. 
  25116. File: gdb.info, Node: Guile Printing Module, Next: Guile Types Module, Up: Guile Modules
  25117. 23.3.5.1 Guile Printing Module
  25118. ..............................
  25119. This module provides a collection of utilities for working with
  25120. pretty-printers.
  25121. Usage:
  25122. (use-modules (gdb printing))
  25123. -- Scheme Procedure: prepend-pretty-printer! object printer
  25124. Add PRINTER to the front of the list of pretty-printers for OBJECT.
  25125. The OBJECT must either be a '<gdb:objfile>' object, or '#f' in
  25126. which case PRINTER is added to the global list of printers.
  25127. -- Scheme Procecure: append-pretty-printer! object printer
  25128. Add PRINTER to the end of the list of pretty-printers for OBJECT.
  25129. The OBJECT must either be a '<gdb:objfile>' object, or '#f' in
  25130. which case PRINTER is added to the global list of printers.
  25131. 
  25132. File: gdb.info, Node: Guile Types Module, Prev: Guile Printing Module, Up: Guile Modules
  25133. 23.3.5.2 Guile Types Module
  25134. ...........................
  25135. This module provides a collection of utilities for working with
  25136. '<gdb:type>' objects.
  25137. Usage:
  25138. (use-modules (gdb types))
  25139. -- Scheme Procedure: get-basic-type type
  25140. Return TYPE with const and volatile qualifiers stripped, and with
  25141. typedefs and C++ references converted to the underlying type.
  25142. C++ example:
  25143. typedef const int const_int;
  25144. const_int foo (3);
  25145. const_int& foo_ref (foo);
  25146. int main () { return 0; }
  25147. Then in gdb:
  25148. (gdb) start
  25149. (gdb) guile (use-modules (gdb) (gdb types))
  25150. (gdb) guile (define foo-ref (parse-and-eval "foo_ref"))
  25151. (gdb) guile (get-basic-type (value-type foo-ref))
  25152. int
  25153. -- Scheme Procedure: type-has-field-deep? type field
  25154. Return '#t' if TYPE, assumed to be a type with fields (e.g., a
  25155. structure or union), has field FIELD. Otherwise return '#f'. This
  25156. searches baseclasses, whereas 'type-has-field?' does not.
  25157. -- Scheme Procedure: make-enum-hashtable enum-type
  25158. Return a Guile hash table produced from ENUM-TYPE. Elements in the
  25159. hash table are referenced with 'hashq-ref'.
  25160. 
  25161. File: gdb.info, Node: Auto-loading extensions, Next: Multiple Extension Languages, Prev: Guile, Up: Extending GDB
  25162. 23.4 Auto-loading extensions
  25163. ============================
  25164. GDB provides two mechanisms for automatically loading extensions when a
  25165. new object file is read (for example, due to the 'file' command, or
  25166. because the inferior has loaded a shared library): 'OBJFILE-gdb.EXT' and
  25167. the '.debug_gdb_scripts' section of modern file formats like ELF.
  25168. * Menu:
  25169. * objfile-gdb.ext file: objfile-gdbdotext file. The 'OBJFILE-gdb.EXT' file
  25170. * .debug_gdb_scripts section: dotdebug_gdb_scripts section. The '.debug_gdb_scripts' section
  25171. * Which flavor to choose?::
  25172. The auto-loading feature is useful for supplying application-specific
  25173. debugging commands and features.
  25174. Auto-loading can be enabled or disabled, and the list of auto-loaded
  25175. scripts can be printed. See the 'auto-loading' section of each
  25176. extension language for more information. For GDB command files see
  25177. *note Auto-loading sequences::. For Python files see *note Python
  25178. Auto-loading::.
  25179. Note that loading of this script file also requires accordingly
  25180. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  25181. 
  25182. File: gdb.info, Node: objfile-gdbdotext file, Next: dotdebug_gdb_scripts section, Up: Auto-loading extensions
  25183. 23.4.1 The 'OBJFILE-gdb.EXT' file
  25184. ---------------------------------
  25185. When a new object file is read, GDB looks for a file named
  25186. 'OBJFILE-gdb.EXT' (we call it SCRIPT-NAME below), where OBJFILE is the
  25187. object file's name and where EXT is the file extension for the extension
  25188. language:
  25189. 'OBJFILE-gdb.gdb'
  25190. GDB's own command language
  25191. 'OBJFILE-gdb.py'
  25192. Python
  25193. 'OBJFILE-gdb.scm'
  25194. Guile
  25195. SCRIPT-NAME is formed by ensuring that the file name of OBJFILE is
  25196. absolute, following all symlinks, and resolving '.' and '..' components,
  25197. and appending the '-gdb.EXT' suffix. If this file exists and is
  25198. readable, GDB will evaluate it as a script in the specified extension
  25199. language.
  25200. If this file does not exist, then GDB will look for SCRIPT-NAME file
  25201. in all of the directories as specified below. (On MS-Windows/MS-DOS,
  25202. the drive letter of the executable's leading directories is converted to
  25203. a one-letter subdirectory, i.e. 'd:/usr/bin/' is converted to
  25204. '/d/usr/bin/', because Windows filesystems disallow colons in file
  25205. names.)
  25206. Note that loading of these files requires an accordingly configured
  25207. 'auto-load safe-path' (*note Auto-loading safe path::).
  25208. For object files using '.exe' suffix GDB tries to load first the
  25209. scripts normally according to its '.exe' filename. But if no scripts
  25210. are found GDB also tries script filenames matching the object file
  25211. without its '.exe' suffix. This '.exe' stripping is case insensitive
  25212. and it is attempted on any platform. This makes the script filenames
  25213. compatible between Unix and MS-Windows hosts.
  25214. 'set auto-load scripts-directory [DIRECTORIES]'
  25215. Control GDB auto-loaded scripts location. Multiple directory
  25216. entries may be delimited by the host platform path separator in use
  25217. (':' on Unix, ';' on MS-Windows and MS-DOS).
  25218. Each entry here needs to be covered also by the security setting
  25219. 'set auto-load safe-path' (*note set auto-load safe-path::).
  25220. This variable defaults to '$debugdir:$datadir/auto-load'. The
  25221. default 'set auto-load safe-path' value can be also overriden by
  25222. GDB configuration option '--with-auto-load-dir'.
  25223. Any reference to '$debugdir' will get replaced by
  25224. DEBUG-FILE-DIRECTORY value (*note Separate Debug Files::) and any
  25225. reference to '$datadir' will get replaced by DATA-DIRECTORY which
  25226. is determined at GDB startup (*note Data Files::). '$debugdir' and
  25227. '$datadir' must be placed as a directory component -- either alone
  25228. or delimited by '/' or '\' directory separators, depending on the
  25229. host platform.
  25230. The list of directories uses path separator (':' on GNU and Unix
  25231. systems, ';' on MS-Windows and MS-DOS) to separate directories,
  25232. similarly to the 'PATH' environment variable.
  25233. 'show auto-load scripts-directory'
  25234. Show GDB auto-loaded scripts location.
  25235. 'add-auto-load-scripts-directory [DIRECTORIES...]'
  25236. Add an entry (or list of entries) to the list of auto-loaded
  25237. scripts locations. Multiple entries may be delimited by the host
  25238. platform path separator in use.
  25239. GDB does not track which files it has already auto-loaded this way.
  25240. GDB will load the associated script every time the corresponding OBJFILE
  25241. is opened. So your '-gdb.EXT' file should be careful to avoid errors if
  25242. it is evaluated more than once.
  25243. 
  25244. File: gdb.info, Node: dotdebug_gdb_scripts section, Next: Which flavor to choose?, Prev: objfile-gdbdotext file, Up: Auto-loading extensions
  25245. 23.4.2 The '.debug_gdb_scripts' section
  25246. ---------------------------------------
  25247. For systems using file formats like ELF and COFF, when GDB loads a new
  25248. object file it will look for a special section named
  25249. '.debug_gdb_scripts'. If this section exists, its contents is a list of
  25250. null-terminated entries specifying scripts to load. Each entry begins
  25251. with a non-null prefix byte that specifies the kind of entry, typically
  25252. the extension language and whether the script is in a file or inlined in
  25253. '.debug_gdb_scripts'.
  25254. The following entries are supported:
  25255. 'SECTION_SCRIPT_ID_PYTHON_FILE = 1'
  25256. 'SECTION_SCRIPT_ID_SCHEME_FILE = 3'
  25257. 'SECTION_SCRIPT_ID_PYTHON_TEXT = 4'
  25258. 'SECTION_SCRIPT_ID_SCHEME_TEXT = 6'
  25259. 23.4.2.1 Script File Entries
  25260. ............................
  25261. If the entry specifies a file, GDB will look for the file first in the
  25262. current directory and then along the source search path (*note
  25263. Specifying Source Directories: Source Path.), except that '$cdir' is not
  25264. searched, since the compilation directory is not relevant to scripts.
  25265. File entries can be placed in section '.debug_gdb_scripts' with, for
  25266. example, this GCC macro for Python scripts.
  25267. /* Note: The "MS" section flags are to remove duplicates. */
  25268. #define DEFINE_GDB_PY_SCRIPT(script_name) \
  25269. asm("\
  25270. .pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n\
  25271. .byte 1 /* Python */\n\
  25272. .asciz \"" script_name "\"\n\
  25273. .popsection \n\
  25274. ");
  25275. For Guile scripts, replace '.byte 1' with '.byte 3'. Then one can
  25276. reference the macro in a header or source file like this:
  25277. DEFINE_GDB_PY_SCRIPT ("my-app-scripts.py")
  25278. The script name may include directories if desired.
  25279. Note that loading of this script file also requires accordingly
  25280. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  25281. If the macro invocation is put in a header, any application or
  25282. library using this header will get a reference to the specified script,
  25283. and with the use of '"MS"' attributes on the section, the linker will
  25284. remove duplicates.
  25285. 23.4.2.2 Script Text Entries
  25286. ............................
  25287. Script text entries allow to put the executable script in the entry
  25288. itself instead of loading it from a file. The first line of the entry,
  25289. everything after the prefix byte and up to the first newline ('0xa')
  25290. character, is the script name, and must not contain any kind of space
  25291. character, e.g., spaces or tabs. The rest of the entry, up to the
  25292. trailing null byte, is the script to execute in the specified language.
  25293. The name needs to be unique among all script names, as GDB executes each
  25294. script only once based on its name.
  25295. Here is an example from file 'py-section-script.c' in the GDB
  25296. testsuite.
  25297. #include "symcat.h"
  25298. #include "gdb/section-scripts.h"
  25299. asm(
  25300. ".pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n"
  25301. ".byte " XSTRING (SECTION_SCRIPT_ID_PYTHON_TEXT) "\n"
  25302. ".ascii \"gdb.inlined-script\\n\"\n"
  25303. ".ascii \"class test_cmd (gdb.Command):\\n\"\n"
  25304. ".ascii \" def __init__ (self):\\n\"\n"
  25305. ".ascii \" super (test_cmd, self).__init__ ("
  25306. "\\\"test-cmd\\\", gdb.COMMAND_OBSCURE)\\n\"\n"
  25307. ".ascii \" def invoke (self, arg, from_tty):\\n\"\n"
  25308. ".ascii \" print (\\\"test-cmd output, arg = %s\\\" % arg)\\n\"\n"
  25309. ".ascii \"test_cmd ()\\n\"\n"
  25310. ".byte 0\n"
  25311. ".popsection\n"
  25312. );
  25313. Loading of inlined scripts requires a properly configured 'auto-load
  25314. safe-path' (*note Auto-loading safe path::). The path to specify in
  25315. 'auto-load safe-path' is the path of the file containing the
  25316. '.debug_gdb_scripts' section.
  25317. 
  25318. File: gdb.info, Node: Which flavor to choose?, Prev: dotdebug_gdb_scripts section, Up: Auto-loading extensions
  25319. 23.4.3 Which flavor to choose?
  25320. ------------------------------
  25321. Given the multiple ways of auto-loading extensions, it might not always
  25322. be clear which one to choose. This section provides some guidance.
  25323. Benefits of the '-gdb.EXT' way:
  25324. * Can be used with file formats that don't support multiple sections.
  25325. * Ease of finding scripts for public libraries.
  25326. Scripts specified in the '.debug_gdb_scripts' section are searched
  25327. for in the source search path. For publicly installed libraries,
  25328. e.g., 'libstdc++', there typically isn't a source directory in
  25329. which to find the script.
  25330. * Doesn't require source code additions.
  25331. Benefits of the '.debug_gdb_scripts' way:
  25332. * Works with static linking.
  25333. Scripts for libraries done the '-gdb.EXT' way require an objfile to
  25334. trigger their loading. When an application is statically linked
  25335. the only objfile available is the executable, and it is cumbersome
  25336. to attach all the scripts from all the input libraries to the
  25337. executable's '-gdb.EXT' script.
  25338. * Works with classes that are entirely inlined.
  25339. Some classes can be entirely inlined, and thus there may not be an
  25340. associated shared library to attach a '-gdb.EXT' script to.
  25341. * Scripts needn't be copied out of the source tree.
  25342. In some circumstances, apps can be built out of large collections
  25343. of internal libraries, and the build infrastructure necessary to
  25344. install the '-gdb.EXT' scripts in a place where GDB can find them
  25345. is cumbersome. It may be easier to specify the scripts in the
  25346. '.debug_gdb_scripts' section as relative paths, and add a path to
  25347. the top of the source tree to the source search path.
  25348. 
  25349. File: gdb.info, Node: Multiple Extension Languages, Next: Aliases, Prev: Auto-loading extensions, Up: Extending GDB
  25350. 23.5 Multiple Extension Languages
  25351. =================================
  25352. The Guile and Python extension languages do not share any state, and
  25353. generally do not interfere with each other. There are some things to be
  25354. aware of, however.
  25355. 23.5.1 Python comes first
  25356. -------------------------
  25357. Python was GDB's first extension language, and to avoid breaking
  25358. existing behaviour Python comes first. This is generally solved by the
  25359. "first one wins" principle. GDB maintains a list of enabled extension
  25360. languages, and when it makes a call to an extension language, (say to
  25361. pretty-print a value), it tries each in turn until an extension language
  25362. indicates it has performed the request (e.g., has returned the
  25363. pretty-printed form of a value). This extends to errors while
  25364. performing such requests: If an error happens while, for example, trying
  25365. to pretty-print an object then the error is reported and any following
  25366. extension languages are not tried.
  25367. 
  25368. File: gdb.info, Node: Aliases, Prev: Multiple Extension Languages, Up: Extending GDB
  25369. 23.6 Creating new spellings of existing commands
  25370. ================================================
  25371. It is often useful to define alternate spellings of existing commands.
  25372. For example, if a new GDB command defined in Python has a long name to
  25373. type, it is handy to have an abbreviated version of it that involves
  25374. less typing.
  25375. GDB itself uses aliases. For example 's' is an alias of the 'step'
  25376. command even though it is otherwise an ambiguous abbreviation of other
  25377. commands like 'set' and 'show'.
  25378. Aliases are also used to provide shortened or more common versions of
  25379. multi-word commands. For example, GDB provides the 'tty' alias of the
  25380. 'set inferior-tty' command.
  25381. You can define a new alias with the 'alias' command.
  25382. 'alias [-a] [--] ALIAS = COMMAND [DEFAULT-ARGS...]'
  25383. ALIAS specifies the name of the new alias. Each word of ALIAS must
  25384. consist of letters, numbers, dashes and underscores.
  25385. COMMAND specifies the name of an existing command that is being
  25386. aliased.
  25387. COMMAND can also be the name of an existing alias. In this case,
  25388. COMMAND cannot be an alias that has default arguments.
  25389. The '-a' option specifies that the new alias is an abbreviation of
  25390. the command. Abbreviations are not used in command completion.
  25391. The '--' option specifies the end of options, and is useful when
  25392. ALIAS begins with a dash.
  25393. You can specify DEFAULT-ARGS for your alias. These DEFAULT-ARGS will
  25394. be automatically added before the alias arguments typed explicitly on
  25395. the command line.
  25396. For example, the below defines an alias 'btfullall' that shows all
  25397. local variables and all frame arguments:
  25398. (gdb) alias btfullall = backtrace -full -frame-arguments all
  25399. For more information about DEFAULT-ARGS, see *note Automatically
  25400. prepend default arguments to user-defined aliases: Command aliases
  25401. default args.
  25402. Here is a simple example showing how to make an abbreviation of a
  25403. command so that there is less to type. Suppose you were tired of typing
  25404. 'disas', the current shortest unambiguous abbreviation of the
  25405. 'disassemble' command and you wanted an even shorter version named 'di'.
  25406. The following will accomplish this.
  25407. (gdb) alias -a di = disas
  25408. Note that aliases are different from user-defined commands. With a
  25409. user-defined command, you also need to write documentation for it with
  25410. the 'document' command. An alias automatically picks up the
  25411. documentation of the existing command.
  25412. Here is an example where we make 'elms' an abbreviation of 'elements'
  25413. in the 'set print elements' command. This is to show that you can make
  25414. an abbreviation of any part of a command.
  25415. (gdb) alias -a set print elms = set print elements
  25416. (gdb) alias -a show print elms = show print elements
  25417. (gdb) set p elms 20
  25418. (gdb) show p elms
  25419. Limit on string chars or array elements to print is 200.
  25420. Note that if you are defining an alias of a 'set' command, and you
  25421. want to have an alias for the corresponding 'show' command, then you
  25422. need to define the latter separately.
  25423. Unambiguously abbreviated commands are allowed in COMMAND and ALIAS,
  25424. just as they are normally.
  25425. (gdb) alias -a set pr elms = set p ele
  25426. Finally, here is an example showing the creation of a one word alias
  25427. for a more complex command. This creates alias 'spe' of the command
  25428. 'set print elements'.
  25429. (gdb) alias spe = set print elements
  25430. (gdb) spe 20
  25431. 
  25432. File: gdb.info, Node: Interpreters, Next: TUI, Prev: Extending GDB, Up: Top
  25433. 24 Command Interpreters
  25434. ***********************
  25435. GDB supports multiple command interpreters, and some command
  25436. infrastructure to allow users or user interface writers to switch
  25437. between interpreters or run commands in other interpreters.
  25438. GDB currently supports two command interpreters, the console
  25439. interpreter (sometimes called the command-line interpreter or CLI) and
  25440. the machine interface interpreter (or GDB/MI). This manual describes
  25441. both of these interfaces in great detail.
  25442. By default, GDB will start with the console interpreter. However,
  25443. the user may choose to start GDB with another interpreter by specifying
  25444. the '-i' or '--interpreter' startup options. Defined interpreters
  25445. include:
  25446. 'console'
  25447. The traditional console or command-line interpreter. This is the
  25448. most often used interpreter with GDB. With no interpreter
  25449. specified at runtime, GDB will use this interpreter.
  25450. 'mi'
  25451. The newest GDB/MI interface (currently 'mi3'). Used primarily by
  25452. programs wishing to use GDB as a backend for a debugger GUI or an
  25453. IDE. For more information, see *note The GDB/MI Interface: GDB/MI.
  25454. 'mi3'
  25455. The GDB/MI interface introduced in GDB 9.1.
  25456. 'mi2'
  25457. The GDB/MI interface introduced in GDB 6.0.
  25458. 'mi1'
  25459. The GDB/MI interface introduced in GDB 5.1.
  25460. You may execute commands in any interpreter from the current
  25461. interpreter using the appropriate command. If you are running the
  25462. console interpreter, simply use the 'interpreter-exec' command:
  25463. interpreter-exec mi "-data-list-register-names"
  25464. GDB/MI has a similar command, although it is only available in
  25465. versions of GDB which support GDB/MI version 2 (or greater).
  25466. Note that 'interpreter-exec' only changes the interpreter for the
  25467. duration of the specified command. It does not change the interpreter
  25468. permanently.
  25469. Although you may only choose a single interpreter at startup, it is
  25470. possible to run an independent interpreter on a specified input/output
  25471. device (usually a tty).
  25472. For example, consider a debugger GUI or IDE that wants to provide a
  25473. GDB console view. It may do so by embedding a terminal emulator widget
  25474. in its GUI, starting GDB in the traditional command-line mode with
  25475. stdin/stdout/stderr redirected to that terminal, and then creating an MI
  25476. interpreter running on a specified input/output device. The console
  25477. interpreter created by GDB at startup handles commands the user types in
  25478. the terminal widget, while the GUI controls and synchronizes state with
  25479. GDB using the separate MI interpreter.
  25480. To start a new secondary "user interface" running MI, use the
  25481. 'new-ui' command:
  25482. new-ui INTERPRETER TTY
  25483. The INTERPRETER parameter specifies the interpreter to run. This
  25484. accepts the same values as the 'interpreter-exec' command. For example,
  25485. 'console', 'mi', 'mi2', etc. The TTY parameter specifies the name of
  25486. the bidirectional file the interpreter uses for input/output, usually
  25487. the name of a pseudoterminal slave on Unix systems. For example:
  25488. (gdb) new-ui mi /dev/pts/9
  25489. runs an MI interpreter on '/dev/pts/9'.
  25490. 
  25491. File: gdb.info, Node: TUI, Next: Emacs, Prev: Interpreters, Up: Top
  25492. 25 GDB Text User Interface
  25493. **************************
  25494. * Menu:
  25495. * TUI Overview:: TUI overview
  25496. * TUI Keys:: TUI key bindings
  25497. * TUI Single Key Mode:: TUI single key mode
  25498. * TUI Commands:: TUI-specific commands
  25499. * TUI Configuration:: TUI configuration variables
  25500. The GDB Text User Interface (TUI) is a terminal interface which uses the
  25501. 'curses' library to show the source file, the assembly output, the
  25502. program registers and GDB commands in separate text windows. The TUI
  25503. mode is supported only on platforms where a suitable version of the
  25504. 'curses' library is available.
  25505. The TUI mode is enabled by default when you invoke GDB as 'gdb -tui'.
  25506. You can also switch in and out of TUI mode while GDB runs by using
  25507. various TUI commands and key bindings, such as 'tui enable' or 'C-x
  25508. C-a'. *Note TUI Commands: TUI Commands, and *note TUI Key Bindings: TUI
  25509. Keys.
  25510. 
  25511. File: gdb.info, Node: TUI Overview, Next: TUI Keys, Up: TUI
  25512. 25.1 TUI Overview
  25513. =================
  25514. In TUI mode, GDB can display several text windows:
  25515. _command_
  25516. This window is the GDB command window with the GDB prompt and the
  25517. GDB output. The GDB input is still managed using readline.
  25518. _source_
  25519. The source window shows the source file of the program. The
  25520. current line and active breakpoints are displayed in this window.
  25521. _assembly_
  25522. The assembly window shows the disassembly output of the program.
  25523. _register_
  25524. This window shows the processor registers. Registers are
  25525. highlighted when their values change.
  25526. The source and assembly windows show the current program position by
  25527. highlighting the current line and marking it with a '>' marker.
  25528. Breakpoints are indicated with two markers. The first marker indicates
  25529. the breakpoint type:
  25530. 'B'
  25531. Breakpoint which was hit at least once.
  25532. 'b'
  25533. Breakpoint which was never hit.
  25534. 'H'
  25535. Hardware breakpoint which was hit at least once.
  25536. 'h'
  25537. Hardware breakpoint which was never hit.
  25538. The second marker indicates whether the breakpoint is enabled or not:
  25539. '+'
  25540. Breakpoint is enabled.
  25541. '-'
  25542. Breakpoint is disabled.
  25543. The source, assembly and register windows are updated when the
  25544. current thread changes, when the frame changes, or when the program
  25545. counter changes.
  25546. These windows are not all visible at the same time. The command
  25547. window is always visible. The others can be arranged in several
  25548. layouts:
  25549. * source only,
  25550. * assembly only,
  25551. * source and assembly,
  25552. * source and registers, or
  25553. * assembly and registers.
  25554. These are the standard layouts, but other layouts can be defined.
  25555. A status line above the command window shows the following
  25556. information:
  25557. _target_
  25558. Indicates the current GDB target. (*note Specifying a Debugging
  25559. Target: Targets.).
  25560. _process_
  25561. Gives the current process or thread number. When no process is
  25562. being debugged, this field is set to 'No process'.
  25563. _function_
  25564. Gives the current function name for the selected frame. The name
  25565. is demangled if demangling is turned on (*note Print Settings::).
  25566. When there is no symbol corresponding to the current program
  25567. counter, the string '??' is displayed.
  25568. _line_
  25569. Indicates the current line number for the selected frame. When the
  25570. current line number is not known, the string '??' is displayed.
  25571. _pc_
  25572. Indicates the current program counter address.
  25573. 
  25574. File: gdb.info, Node: TUI Keys, Next: TUI Single Key Mode, Prev: TUI Overview, Up: TUI
  25575. 25.2 TUI Key Bindings
  25576. =====================
  25577. The TUI installs several key bindings in the readline keymaps (*note
  25578. Command Line Editing::). The following key bindings are installed for
  25579. both TUI mode and the GDB standard mode.
  25580. 'C-x C-a'
  25581. 'C-x a'
  25582. 'C-x A'
  25583. Enter or leave the TUI mode. When leaving the TUI mode, the curses
  25584. window management stops and GDB operates using its standard mode,
  25585. writing on the terminal directly. When reentering the TUI mode,
  25586. control is given back to the curses windows. The screen is then
  25587. refreshed.
  25588. This key binding uses the bindable Readline function
  25589. 'tui-switch-mode'.
  25590. 'C-x 1'
  25591. Use a TUI layout with only one window. The layout will either be
  25592. 'source' or 'assembly'. When the TUI mode is not active, it will
  25593. switch to the TUI mode.
  25594. Think of this key binding as the Emacs 'C-x 1' binding.
  25595. This key binding uses the bindable Readline function
  25596. 'tui-delete-other-windows'.
  25597. 'C-x 2'
  25598. Use a TUI layout with at least two windows. When the current
  25599. layout already has two windows, the next layout with two windows is
  25600. used. When a new layout is chosen, one window will always be
  25601. common to the previous layout and the new one.
  25602. Think of it as the Emacs 'C-x 2' binding.
  25603. This key binding uses the bindable Readline function
  25604. 'tui-change-windows'.
  25605. 'C-x o'
  25606. Change the active window. The TUI associates several key bindings
  25607. (like scrolling and arrow keys) with the active window. This
  25608. command gives the focus to the next TUI window.
  25609. Think of it as the Emacs 'C-x o' binding.
  25610. This key binding uses the bindable Readline function
  25611. 'tui-other-window'.
  25612. 'C-x s'
  25613. Switch in and out of the TUI SingleKey mode that binds single keys
  25614. to GDB commands (*note TUI Single Key Mode::).
  25615. This key binding uses the bindable Readline function 'next-keymap'.
  25616. The following key bindings only work in the TUI mode:
  25617. <PgUp>
  25618. Scroll the active window one page up.
  25619. <PgDn>
  25620. Scroll the active window one page down.
  25621. <Up>
  25622. Scroll the active window one line up.
  25623. <Down>
  25624. Scroll the active window one line down.
  25625. <Left>
  25626. Scroll the active window one column left.
  25627. <Right>
  25628. Scroll the active window one column right.
  25629. 'C-L'
  25630. Refresh the screen.
  25631. Because the arrow keys scroll the active window in the TUI mode, they
  25632. are not available for their normal use by readline unless the command
  25633. window has the focus. When another window is active, you must use other
  25634. readline key bindings such as 'C-p', 'C-n', 'C-b' and 'C-f' to control
  25635. the command window.
  25636. 
  25637. File: gdb.info, Node: TUI Single Key Mode, Next: TUI Commands, Prev: TUI Keys, Up: TUI
  25638. 25.3 TUI Single Key Mode
  25639. ========================
  25640. The TUI also provides a "SingleKey" mode, which binds several frequently
  25641. used GDB commands to single keys. Type 'C-x s' to switch into this
  25642. mode, where the following key bindings are used:
  25643. 'c'
  25644. continue
  25645. 'd'
  25646. down
  25647. 'f'
  25648. finish
  25649. 'n'
  25650. next
  25651. 'o'
  25652. nexti. The shortcut letter 'o' stands for "step Over".
  25653. 'q'
  25654. exit the SingleKey mode.
  25655. 'r'
  25656. run
  25657. 's'
  25658. step
  25659. 'i'
  25660. stepi. The shortcut letter 'i' stands for "step Into".
  25661. 'u'
  25662. up
  25663. 'v'
  25664. info locals
  25665. 'w'
  25666. where
  25667. Other keys temporarily switch to the GDB command prompt. The key
  25668. that was pressed is inserted in the editing buffer so that it is
  25669. possible to type most GDB commands without interaction with the TUI
  25670. SingleKey mode. Once the command is entered the TUI SingleKey mode is
  25671. restored. The only way to permanently leave this mode is by typing 'q'
  25672. or 'C-x s'.
  25673. If GDB was built with Readline 8.0 or later, the TUI SingleKey keymap
  25674. will be named 'SingleKey'. This can be used in '.inputrc' to add
  25675. additional bindings to this keymap.
  25676. 
  25677. File: gdb.info, Node: TUI Commands, Next: TUI Configuration, Prev: TUI Single Key Mode, Up: TUI
  25678. 25.4 TUI-specific Commands
  25679. ==========================
  25680. The TUI has specific commands to control the text windows. These
  25681. commands are always available, even when GDB is not in the TUI mode.
  25682. When GDB is in the standard mode, most of these commands will
  25683. automatically switch to the TUI mode.
  25684. Note that if GDB's 'stdout' is not connected to a terminal, or GDB
  25685. has been started with the machine interface interpreter (*note The
  25686. GDB/MI Interface: GDB/MI.), most of these commands will fail with an
  25687. error, because it would not be possible or desirable to enable curses
  25688. window management.
  25689. 'tui enable'
  25690. Activate TUI mode. The last active TUI window layout will be used
  25691. if TUI mode has previously been used in the current debugging
  25692. session, otherwise a default layout is used.
  25693. 'tui disable'
  25694. Disable TUI mode, returning to the console interpreter.
  25695. 'info win'
  25696. List and give the size of all displayed windows.
  25697. 'tui new-layout NAME WINDOW WEIGHT [WINDOW WEIGHT...]'
  25698. Create a new TUI layout. The new layout will be named NAME, and
  25699. can be accessed using the 'layout' command (see below).
  25700. Each WINDOW parameter is either the name of a window to display, or
  25701. a window description. The windows will be displayed from top to
  25702. bottom in the order listed.
  25703. The names of the windows are the same as the ones given to the
  25704. 'focus' command (see below); additional, the 'status' window can be
  25705. specified. Note that, because it is of fixed height, the weight
  25706. assigned to the status window is of no importance. It is
  25707. conventional to use '0' here.
  25708. A window description looks a bit like an invocation of 'tui
  25709. new-layout', and is of the form {['-horizontal']WINDOW WEIGHT
  25710. [WINDOW WEIGHT...]}.
  25711. This specifies a sub-layout. If '-horizontal' is given, the
  25712. windows in this description will be arranged side-by-side, rather
  25713. than top-to-bottom.
  25714. Each WEIGHT is an integer. It is the weight of this window
  25715. relative to all the other windows in the layout. These numbers are
  25716. used to calculate how much of the screen is given to each window.
  25717. For example:
  25718. (gdb) tui new-layout example src 1 regs 1 status 0 cmd 1
  25719. Here, the new layout is called 'example'. It shows the source and
  25720. register windows, followed by the status window, and then finally
  25721. the command window. The non-status windows all have the same
  25722. weight, so the terminal will be split into three roughly equal
  25723. sections.
  25724. Here is a more complex example, showing a horizontal layout:
  25725. (gdb) tui new-layout example {-horizontal src 1 asm 1} 2 status 0 cmd 1
  25726. This will result in side-by-side source and assembly windows; with
  25727. the status and command window being beneath these, filling the
  25728. entire width of the terminal. Because they have weight 2, the
  25729. source and assembly windows will be twice the height of the command
  25730. window.
  25731. 'layout NAME'
  25732. Changes which TUI windows are displayed. The NAME parameter
  25733. controls which layout is shown. It can be either one of the
  25734. built-in layout names, or the name of a layout defined by the user
  25735. using 'tui new-layout'.
  25736. The built-in layouts are as follows:
  25737. 'next'
  25738. Display the next layout.
  25739. 'prev'
  25740. Display the previous layout.
  25741. 'src'
  25742. Display the source and command windows.
  25743. 'asm'
  25744. Display the assembly and command windows.
  25745. 'split'
  25746. Display the source, assembly, and command windows.
  25747. 'regs'
  25748. When in 'src' layout display the register, source, and command
  25749. windows. When in 'asm' or 'split' layout display the
  25750. register, assembler, and command windows.
  25751. 'focus NAME'
  25752. Changes which TUI window is currently active for scrolling. The
  25753. NAME parameter can be any of the following:
  25754. 'next'
  25755. Make the next window active for scrolling.
  25756. 'prev'
  25757. Make the previous window active for scrolling.
  25758. 'src'
  25759. Make the source window active for scrolling.
  25760. 'asm'
  25761. Make the assembly window active for scrolling.
  25762. 'regs'
  25763. Make the register window active for scrolling.
  25764. 'cmd'
  25765. Make the command window active for scrolling.
  25766. 'refresh'
  25767. Refresh the screen. This is similar to typing 'C-L'.
  25768. 'tui reg GROUP'
  25769. Changes the register group displayed in the tui register window to
  25770. GROUP. If the register window is not currently displayed this
  25771. command will cause the register window to be displayed. The list
  25772. of register groups, as well as their order is target specific. The
  25773. following groups are available on most targets:
  25774. 'next'
  25775. Repeatedly selecting this group will cause the display to
  25776. cycle through all of the available register groups.
  25777. 'prev'
  25778. Repeatedly selecting this group will cause the display to
  25779. cycle through all of the available register groups in the
  25780. reverse order to NEXT.
  25781. 'general'
  25782. Display the general registers.
  25783. 'float'
  25784. Display the floating point registers.
  25785. 'system'
  25786. Display the system registers.
  25787. 'vector'
  25788. Display the vector registers.
  25789. 'all'
  25790. Display all registers.
  25791. 'update'
  25792. Update the source window and the current execution point.
  25793. 'winheight NAME +COUNT'
  25794. 'winheight NAME -COUNT'
  25795. Change the height of the window NAME by COUNT lines. Positive
  25796. counts increase the height, while negative counts decrease it. The
  25797. NAME parameter can be one of 'src' (the source window), 'cmd' (the
  25798. command window), 'asm' (the disassembly window), or 'regs' (the
  25799. register display window).
  25800. 
  25801. File: gdb.info, Node: TUI Configuration, Prev: TUI Commands, Up: TUI
  25802. 25.5 TUI Configuration Variables
  25803. ================================
  25804. Several configuration variables control the appearance of TUI windows.
  25805. 'set tui border-kind KIND'
  25806. Select the border appearance for the source, assembly and register
  25807. windows. The possible values are the following:
  25808. 'space'
  25809. Use a space character to draw the border.
  25810. 'ascii'
  25811. Use ASCII characters '+', '-' and '|' to draw the border.
  25812. 'acs'
  25813. Use the Alternate Character Set to draw the border. The
  25814. border is drawn using character line graphics if the terminal
  25815. supports them.
  25816. 'set tui border-mode MODE'
  25817. 'set tui active-border-mode MODE'
  25818. Select the display attributes for the borders of the inactive
  25819. windows or the active window. The MODE can be one of the
  25820. following:
  25821. 'normal'
  25822. Use normal attributes to display the border.
  25823. 'standout'
  25824. Use standout mode.
  25825. 'reverse'
  25826. Use reverse video mode.
  25827. 'half'
  25828. Use half bright mode.
  25829. 'half-standout'
  25830. Use half bright and standout mode.
  25831. 'bold'
  25832. Use extra bright or bold mode.
  25833. 'bold-standout'
  25834. Use extra bright or bold and standout mode.
  25835. 'set tui tab-width NCHARS'
  25836. Set the width of tab stops to be NCHARS characters. This setting
  25837. affects the display of TAB characters in the source and assembly
  25838. windows.
  25839. 'set tui compact-source [on|off]'
  25840. Set whether the TUI source window is displayed in "compact" form.
  25841. The default display uses more space for line numbers and starts the
  25842. source text at the next tab stop; the compact display uses only as
  25843. much space as is needed for the line numbers in the current file,
  25844. and only a single space to separate the line numbers from the
  25845. source.
  25846. Note that the colors of the TUI borders can be controlled using the
  25847. appropriate 'set style' commands. *Note Output Styling::.
  25848. 
  25849. File: gdb.info, Node: Emacs, Next: GDB/MI, Prev: TUI, Up: Top
  25850. 26 Using GDB under GNU Emacs
  25851. ****************************
  25852. A special interface allows you to use GNU Emacs to view (and edit) the
  25853. source files for the program you are debugging with GDB.
  25854. To use this interface, use the command 'M-x gdb' in Emacs. Give the
  25855. executable file you want to debug as an argument. This command starts
  25856. GDB as a subprocess of Emacs, with input and output through a newly
  25857. created Emacs buffer.
  25858. Running GDB under Emacs can be just like running GDB normally except
  25859. for two things:
  25860. * All "terminal" input and output goes through an Emacs buffer,
  25861. called the GUD buffer.
  25862. This applies both to GDB commands and their output, and to the
  25863. input and output done by the program you are debugging.
  25864. This is useful because it means that you can copy the text of
  25865. previous commands and input them again; you can even use parts of
  25866. the output in this way.
  25867. All the facilities of Emacs' Shell mode are available for
  25868. interacting with your program. In particular, you can send signals
  25869. the usual way--for example, 'C-c C-c' for an interrupt, 'C-c C-z'
  25870. for a stop.
  25871. * GDB displays source code through Emacs.
  25872. Each time GDB displays a stack frame, Emacs automatically finds the
  25873. source file for that frame and puts an arrow ('=>') at the left
  25874. margin of the current line. Emacs uses a separate buffer for
  25875. source display, and splits the screen to show both your GDB session
  25876. and the source.
  25877. Explicit GDB 'list' or search commands still produce output as
  25878. usual, but you probably have no reason to use them from Emacs.
  25879. We call this "text command mode". Emacs 22.1, and later, also uses a
  25880. graphical mode, enabled by default, which provides further buffers that
  25881. can control the execution and describe the state of your program. *Note
  25882. (Emacs)GDB Graphical Interface::.
  25883. If you specify an absolute file name when prompted for the 'M-x gdb'
  25884. argument, then Emacs sets your current working directory to where your
  25885. program resides. If you only specify the file name, then Emacs sets
  25886. your current working directory to the directory associated with the
  25887. previous buffer. In this case, GDB may find your program by searching
  25888. your environment's 'PATH' variable, but on some operating systems it
  25889. might not find the source. So, although the GDB input and output
  25890. session proceeds normally, the auxiliary buffer does not display the
  25891. current source and line of execution.
  25892. The initial working directory of GDB is printed on the top line of
  25893. the GUD buffer and this serves as a default for the commands that
  25894. specify files for GDB to operate on. *Note Commands to Specify Files:
  25895. Files.
  25896. By default, 'M-x gdb' calls the program called 'gdb'. If you need to
  25897. call GDB by a different name (for example, if you keep several
  25898. configurations around, with different names) you can customize the Emacs
  25899. variable 'gud-gdb-command-name' to run the one you want.
  25900. In the GUD buffer, you can use these special Emacs commands in
  25901. addition to the standard Shell mode commands:
  25902. 'C-h m'
  25903. Describe the features of Emacs' GUD Mode.
  25904. 'C-c C-s'
  25905. Execute to another source line, like the GDB 'step' command; also
  25906. update the display window to show the current file and location.
  25907. 'C-c C-n'
  25908. Execute to next source line in this function, skipping all function
  25909. calls, like the GDB 'next' command. Then update the display window
  25910. to show the current file and location.
  25911. 'C-c C-i'
  25912. Execute one instruction, like the GDB 'stepi' command; update
  25913. display window accordingly.
  25914. 'C-c C-f'
  25915. Execute until exit from the selected stack frame, like the GDB
  25916. 'finish' command.
  25917. 'C-c C-r'
  25918. Continue execution of your program, like the GDB 'continue'
  25919. command.
  25920. 'C-c <'
  25921. Go up the number of frames indicated by the numeric argument (*note
  25922. Numeric Arguments: (Emacs)Arguments.), like the GDB 'up' command.
  25923. 'C-c >'
  25924. Go down the number of frames indicated by the numeric argument,
  25925. like the GDB 'down' command.
  25926. In any source file, the Emacs command 'C-x <SPC>' ('gud-break') tells
  25927. GDB to set a breakpoint on the source line point is on.
  25928. In text command mode, if you type 'M-x speedbar', Emacs displays a
  25929. separate frame which shows a backtrace when the GUD buffer is current.
  25930. Move point to any frame in the stack and type <RET> to make it become
  25931. the current frame and display the associated source in the source
  25932. buffer. Alternatively, click 'Mouse-2' to make the selected frame
  25933. become the current one. In graphical mode, the speedbar displays watch
  25934. expressions.
  25935. If you accidentally delete the source-display buffer, an easy way to
  25936. get it back is to type the command 'f' in the GDB buffer, to request a
  25937. frame display; when you run under Emacs, this recreates the source
  25938. buffer if necessary to show you the context of the current frame.
  25939. The source files displayed in Emacs are in ordinary Emacs buffers
  25940. which are visiting the source files in the usual way. You can edit the
  25941. files with these buffers if you wish; but keep in mind that GDB
  25942. communicates with Emacs in terms of line numbers. If you add or delete
  25943. lines from the text, the line numbers that GDB knows cease to correspond
  25944. properly with the code.
  25945. A more detailed description of Emacs' interaction with GDB is given
  25946. in the Emacs manual (*note (Emacs)Debuggers::).
  25947. 
  25948. File: gdb.info, Node: GDB/MI, Next: Annotations, Prev: Emacs, Up: Top
  25949. 27 The GDB/MI Interface
  25950. ***********************
  25951. * Menu:
  25952. * GDB/MI General Design::
  25953. * GDB/MI Command Syntax::
  25954. * GDB/MI Compatibility with CLI::
  25955. * GDB/MI Development and Front Ends::
  25956. * GDB/MI Output Records::
  25957. * GDB/MI Simple Examples::
  25958. * GDB/MI Command Description Format::
  25959. * GDB/MI Breakpoint Commands::
  25960. * GDB/MI Catchpoint Commands::
  25961. * GDB/MI Program Context::
  25962. * GDB/MI Thread Commands::
  25963. * GDB/MI Ada Tasking Commands::
  25964. * GDB/MI Program Execution::
  25965. * GDB/MI Stack Manipulation::
  25966. * GDB/MI Variable Objects::
  25967. * GDB/MI Data Manipulation::
  25968. * GDB/MI Tracepoint Commands::
  25969. * GDB/MI Symbol Query::
  25970. * GDB/MI File Commands::
  25971. * GDB/MI Target Manipulation::
  25972. * GDB/MI File Transfer Commands::
  25973. * GDB/MI Ada Exceptions Commands::
  25974. * GDB/MI Support Commands::
  25975. * GDB/MI Miscellaneous Commands::
  25976. Function and Purpose
  25977. ====================
  25978. GDB/MI is a line based machine oriented text interface to GDB and is
  25979. activated by specifying using the '--interpreter' command line option
  25980. (*note Mode Options::). It is specifically intended to support the
  25981. development of systems which use the debugger as just one small
  25982. component of a larger system.
  25983. This chapter is a specification of the GDB/MI interface. It is
  25984. written in the form of a reference manual.
  25985. Note that GDB/MI is still under construction, so some of the features
  25986. described below are incomplete and subject to change (*note GDB/MI
  25987. Development and Front Ends: GDB/MI Development and Front Ends.).
  25988. Notation and Terminology
  25989. ========================
  25990. This chapter uses the following notation:
  25991. * '|' separates two alternatives.
  25992. * '[ SOMETHING ]' indicates that SOMETHING is optional: it may or may
  25993. not be given.
  25994. * '( GROUP )*' means that GROUP inside the parentheses may repeat
  25995. zero or more times.
  25996. * '( GROUP )+' means that GROUP inside the parentheses may repeat one
  25997. or more times.
  25998. * '"STRING"' means a literal STRING.
  25999. * Menu:
  26000. * GDB/MI General Design::
  26001. * GDB/MI Command Syntax::
  26002. * GDB/MI Compatibility with CLI::
  26003. * GDB/MI Development and Front Ends::
  26004. * GDB/MI Output Records::
  26005. * GDB/MI Simple Examples::
  26006. * GDB/MI Command Description Format::
  26007. * GDB/MI Breakpoint Commands::
  26008. * GDB/MI Catchpoint Commands::
  26009. * GDB/MI Program Context::
  26010. * GDB/MI Thread Commands::
  26011. * GDB/MI Ada Tasking Commands::
  26012. * GDB/MI Program Execution::
  26013. * GDB/MI Stack Manipulation::
  26014. * GDB/MI Variable Objects::
  26015. * GDB/MI Data Manipulation::
  26016. * GDB/MI Tracepoint Commands::
  26017. * GDB/MI Symbol Query::
  26018. * GDB/MI File Commands::
  26019. * GDB/MI Target Manipulation::
  26020. * GDB/MI File Transfer Commands::
  26021. * GDB/MI Ada Exceptions Commands::
  26022. * GDB/MI Support Commands::
  26023. * GDB/MI Miscellaneous Commands::
  26024. 
  26025. File: gdb.info, Node: GDB/MI General Design, Next: GDB/MI Command Syntax, Up: GDB/MI
  26026. 27.1 GDB/MI General Design
  26027. ==========================
  26028. Interaction of a GDB/MI frontend with GDB involves three parts--commands
  26029. sent to GDB, responses to those commands and notifications. Each
  26030. command results in exactly one response, indicating either successful
  26031. completion of the command, or an error. For the commands that do not
  26032. resume the target, the response contains the requested information. For
  26033. the commands that resume the target, the response only indicates whether
  26034. the target was successfully resumed. Notifications is the mechanism for
  26035. reporting changes in the state of the target, or in GDB state, that
  26036. cannot conveniently be associated with a command and reported as part of
  26037. that command response.
  26038. The important examples of notifications are:
  26039. * Exec notifications. These are used to report changes in target
  26040. state--when a target is resumed, or stopped. It would not be
  26041. feasible to include this information in response of resuming
  26042. commands, because one resume commands can result in multiple events
  26043. in different threads. Also, quite some time may pass before any
  26044. event happens in the target, while a frontend needs to know whether
  26045. the resuming command itself was successfully executed.
  26046. * Console output, and status notifications. Console output
  26047. notifications are used to report output of CLI commands, as well as
  26048. diagnostics for other commands. Status notifications are used to
  26049. report the progress of a long-running operation. Naturally,
  26050. including this information in command response would mean no output
  26051. is produced until the command is finished, which is undesirable.
  26052. * General notifications. Commands may have various side effects on
  26053. the GDB or target state beyond their official purpose. For
  26054. example, a command may change the selected thread. Although such
  26055. changes can be included in command response, using notification
  26056. allows for more orthogonal frontend design.
  26057. There's no guarantee that whenever an MI command reports an error,
  26058. GDB or the target are in any specific state, and especially, the state
  26059. is not reverted to the state before the MI command was processed.
  26060. Therefore, whenever an MI command results in an error, we recommend that
  26061. the frontend refreshes all the information shown in the user interface.
  26062. * Menu:
  26063. * Context management::
  26064. * Asynchronous and non-stop modes::
  26065. * Thread groups::
  26066. 
  26067. File: gdb.info, Node: Context management, Next: Asynchronous and non-stop modes, Up: GDB/MI General Design
  26068. 27.1.1 Context management
  26069. -------------------------
  26070. 27.1.1.1 Threads and Frames
  26071. ...........................
  26072. In most cases when GDB accesses the target, this access is done in
  26073. context of a specific thread and frame (*note Frames::). Often, even
  26074. when accessing global data, the target requires that a thread be
  26075. specified. The CLI interface maintains the selected thread and frame,
  26076. and supplies them to target on each command. This is convenient,
  26077. because a command line user would not want to specify that information
  26078. explicitly on each command, and because user interacts with GDB via a
  26079. single terminal, so no confusion is possible as to what thread and frame
  26080. are the current ones.
  26081. In the case of MI, the concept of selected thread and frame is less
  26082. useful. First, a frontend can easily remember this information itself.
  26083. Second, a graphical frontend can have more than one window, each one
  26084. used for debugging a different thread, and the frontend might want to
  26085. access additional threads for internal purposes. This increases the
  26086. risk that by relying on implicitly selected thread, the frontend may be
  26087. operating on a wrong one. Therefore, each MI command should explicitly
  26088. specify which thread and frame to operate on. To make it possible, each
  26089. MI command accepts the '--thread' and '--frame' options, the value to
  26090. each is GDB global identifier for thread and frame to operate on.
  26091. Usually, each top-level window in a frontend allows the user to
  26092. select a thread and a frame, and remembers the user selection for
  26093. further operations. However, in some cases GDB may suggest that the
  26094. current thread or frame be changed. For example, when stopping on a
  26095. breakpoint it is reasonable to switch to the thread where breakpoint is
  26096. hit. For another example, if the user issues the CLI 'thread' or
  26097. 'frame' commands via the frontend, it is desirable to change the
  26098. frontend's selection to the one specified by user. GDB communicates the
  26099. suggestion to change current thread and frame using the
  26100. '=thread-selected' notification.
  26101. Note that historically, MI shares the selected thread with CLI, so
  26102. frontends used the '-thread-select' to execute commands in the right
  26103. context. However, getting this to work right is cumbersome. The
  26104. simplest way is for frontend to emit '-thread-select' command before
  26105. every command. This doubles the number of commands that need to be
  26106. sent. The alternative approach is to suppress '-thread-select' if the
  26107. selected thread in GDB is supposed to be identical to the thread the
  26108. frontend wants to operate on. However, getting this optimization right
  26109. can be tricky. In particular, if the frontend sends several commands to
  26110. GDB, and one of the commands changes the selected thread, then the
  26111. behaviour of subsequent commands will change. So, a frontend should
  26112. either wait for response from such problematic commands, or explicitly
  26113. add '-thread-select' for all subsequent commands. No frontend is known
  26114. to do this exactly right, so it is suggested to just always pass the
  26115. '--thread' and '--frame' options.
  26116. 27.1.1.2 Language
  26117. .................
  26118. The execution of several commands depends on which language is selected.
  26119. By default, the current language (*note show language::) is used. But
  26120. for commands known to be language-sensitive, it is recommended to use
  26121. the '--language' option. This option takes one argument, which is the
  26122. name of the language to use while executing the command. For instance:
  26123. -data-evaluate-expression --language c "sizeof (void*)"
  26124. ^done,value="4"
  26125. (gdb)
  26126. The valid language names are the same names accepted by the 'set
  26127. language' command (*note Manually::), excluding 'auto', 'local' or
  26128. 'unknown'.
  26129. 
  26130. File: gdb.info, Node: Asynchronous and non-stop modes, Next: Thread groups, Prev: Context management, Up: GDB/MI General Design
  26131. 27.1.2 Asynchronous command execution and non-stop mode
  26132. -------------------------------------------------------
  26133. On some targets, GDB is capable of processing MI commands even while the
  26134. target is running. This is called "asynchronous command execution"
  26135. (*note Background Execution::). The frontend may specify a preference
  26136. for asynchronous execution using the '-gdb-set mi-async 1' command,
  26137. which should be emitted before either running the executable or
  26138. attaching to the target. After the frontend has started the executable
  26139. or attached to the target, it can find if asynchronous execution is
  26140. enabled using the '-list-target-features' command.
  26141. '-gdb-set mi-async on'
  26142. '-gdb-set mi-async off'
  26143. Set whether MI is in asynchronous mode.
  26144. When 'off', which is the default, MI execution commands (e.g.,
  26145. '-exec-continue') are foreground commands, and GDB waits for the
  26146. program to stop before processing further commands.
  26147. When 'on', MI execution commands are background execution commands
  26148. (e.g., '-exec-continue' becomes the equivalent of the 'c&' CLI
  26149. command), and so GDB is capable of processing MI commands even
  26150. while the target is running.
  26151. '-gdb-show mi-async'
  26152. Show whether MI asynchronous mode is enabled.
  26153. Note: In GDB version 7.7 and earlier, this option was called
  26154. 'target-async' instead of 'mi-async', and it had the effect of both
  26155. putting MI in asynchronous mode and making CLI background commands
  26156. possible. CLI background commands are now always possible "out of the
  26157. box" if the target supports them. The old spelling is kept as a
  26158. deprecated alias for backwards compatibility.
  26159. Even if GDB can accept a command while target is running, many
  26160. commands that access the target do not work when the target is running.
  26161. Therefore, asynchronous command execution is most useful when combined
  26162. with non-stop mode (*note Non-Stop Mode::). Then, it is possible to
  26163. examine the state of one thread, while other threads are running.
  26164. When a given thread is running, MI commands that try to access the
  26165. target in the context of that thread may not work, or may work only on
  26166. some targets. In particular, commands that try to operate on thread's
  26167. stack will not work, on any target. Commands that read memory, or
  26168. modify breakpoints, may work or not work, depending on the target. Note
  26169. that even commands that operate on global state, such as 'print', 'set',
  26170. and breakpoint commands, still access the target in the context of a
  26171. specific thread, so frontend should try to find a stopped thread and
  26172. perform the operation on that thread (using the '--thread' option).
  26173. Which commands will work in the context of a running thread is highly
  26174. target dependent. However, the two commands '-exec-interrupt', to stop
  26175. a thread, and '-thread-info', to find the state of a thread, will always
  26176. work.
  26177. 
  26178. File: gdb.info, Node: Thread groups, Prev: Asynchronous and non-stop modes, Up: GDB/MI General Design
  26179. 27.1.3 Thread groups
  26180. --------------------
  26181. GDB may be used to debug several processes at the same time. On some
  26182. platforms, GDB may support debugging of several hardware systems, each
  26183. one having several cores with several different processes running on
  26184. each core. This section describes the MI mechanism to support such
  26185. debugging scenarios.
  26186. The key observation is that regardless of the structure of the
  26187. target, MI can have a global list of threads, because most commands that
  26188. accept the '--thread' option do not need to know what process that
  26189. thread belongs to. Therefore, it is not necessary to introduce neither
  26190. additional '--process' option, nor an notion of the current process in
  26191. the MI interface. The only strictly new feature that is required is the
  26192. ability to find how the threads are grouped into processes.
  26193. To allow the user to discover such grouping, and to support arbitrary
  26194. hierarchy of machines/cores/processes, MI introduces the concept of a
  26195. "thread group". Thread group is a collection of threads and other
  26196. thread groups. A thread group always has a string identifier, a type,
  26197. and may have additional attributes specific to the type. A new command,
  26198. '-list-thread-groups', returns the list of top-level thread groups,
  26199. which correspond to processes that GDB is debugging at the moment. By
  26200. passing an identifier of a thread group to the '-list-thread-groups'
  26201. command, it is possible to obtain the members of specific thread group.
  26202. To allow the user to easily discover processes, and other objects, he
  26203. wishes to debug, a concept of "available thread group" is introduced.
  26204. Available thread group is an thread group that GDB is not debugging, but
  26205. that can be attached to, using the '-target-attach' command. The list
  26206. of available top-level thread groups can be obtained using
  26207. '-list-thread-groups --available'. In general, the content of a thread
  26208. group may be only retrieved only after attaching to that thread group.
  26209. Thread groups are related to inferiors (*note Inferiors Connections
  26210. and Programs::). Each inferior corresponds to a thread group of a
  26211. special type 'process', and some additional operations are permitted on
  26212. such thread groups.
  26213. 
  26214. File: gdb.info, Node: GDB/MI Command Syntax, Next: GDB/MI Compatibility with CLI, Prev: GDB/MI General Design, Up: GDB/MI
  26215. 27.2 GDB/MI Command Syntax
  26216. ==========================
  26217. * Menu:
  26218. * GDB/MI Input Syntax::
  26219. * GDB/MI Output Syntax::
  26220. 
  26221. File: gdb.info, Node: GDB/MI Input Syntax, Next: GDB/MI Output Syntax, Up: GDB/MI Command Syntax
  26222. 27.2.1 GDB/MI Input Syntax
  26223. --------------------------
  26224. 'COMMAND ==>'
  26225. 'CLI-COMMAND | MI-COMMAND'
  26226. 'CLI-COMMAND ==>'
  26227. '[ TOKEN ] CLI-COMMAND NL', where CLI-COMMAND is any existing GDB
  26228. CLI command.
  26229. 'MI-COMMAND ==>'
  26230. '[ TOKEN ] "-" OPERATION ( " " OPTION )* [ " --" ] ( " " PARAMETER
  26231. )* NL'
  26232. 'TOKEN ==>'
  26233. "any sequence of digits"
  26234. 'OPTION ==>'
  26235. '"-" PARAMETER [ " " PARAMETER ]'
  26236. 'PARAMETER ==>'
  26237. 'NON-BLANK-SEQUENCE | C-STRING'
  26238. 'OPERATION ==>'
  26239. _any of the operations described in this chapter_
  26240. 'NON-BLANK-SEQUENCE ==>'
  26241. _anything, provided it doesn't contain special characters such as
  26242. "-", NL, """ and of course " "_
  26243. 'C-STRING ==>'
  26244. '""" SEVEN-BIT-ISO-C-STRING-CONTENT """'
  26245. 'NL ==>'
  26246. 'CR | CR-LF'
  26247. Notes:
  26248. * The CLI commands are still handled by the MI interpreter; their
  26249. output is described below.
  26250. * The 'TOKEN', when present, is passed back when the command
  26251. finishes.
  26252. * Some MI commands accept optional arguments as part of the parameter
  26253. list. Each option is identified by a leading '-' (dash) and may be
  26254. followed by an optional argument parameter. Options occur first in
  26255. the parameter list and can be delimited from normal parameters
  26256. using '--' (this is useful when some parameters begin with a dash).
  26257. Pragmatics:
  26258. * We want easy access to the existing CLI syntax (for debugging).
  26259. * We want it to be easy to spot a MI operation.
  26260. 
  26261. File: gdb.info, Node: GDB/MI Output Syntax, Prev: GDB/MI Input Syntax, Up: GDB/MI Command Syntax
  26262. 27.2.2 GDB/MI Output Syntax
  26263. ---------------------------
  26264. The output from GDB/MI consists of zero or more out-of-band records
  26265. followed, optionally, by a single result record. This result record is
  26266. for the most recent command. The sequence of output records is
  26267. terminated by '(gdb)'.
  26268. If an input command was prefixed with a 'TOKEN' then the
  26269. corresponding output for that command will also be prefixed by that same
  26270. TOKEN.
  26271. 'OUTPUT ==>'
  26272. '( OUT-OF-BAND-RECORD )* [ RESULT-RECORD ] "(gdb)" NL'
  26273. 'RESULT-RECORD ==>'
  26274. ' [ TOKEN ] "^" RESULT-CLASS ( "," RESULT )* NL'
  26275. 'OUT-OF-BAND-RECORD ==>'
  26276. 'ASYNC-RECORD | STREAM-RECORD'
  26277. 'ASYNC-RECORD ==>'
  26278. 'EXEC-ASYNC-OUTPUT | STATUS-ASYNC-OUTPUT | NOTIFY-ASYNC-OUTPUT'
  26279. 'EXEC-ASYNC-OUTPUT ==>'
  26280. '[ TOKEN ] "*" ASYNC-OUTPUT NL'
  26281. 'STATUS-ASYNC-OUTPUT ==>'
  26282. '[ TOKEN ] "+" ASYNC-OUTPUT NL'
  26283. 'NOTIFY-ASYNC-OUTPUT ==>'
  26284. '[ TOKEN ] "=" ASYNC-OUTPUT NL'
  26285. 'ASYNC-OUTPUT ==>'
  26286. 'ASYNC-CLASS ( "," RESULT )*'
  26287. 'RESULT-CLASS ==>'
  26288. '"done" | "running" | "connected" | "error" | "exit"'
  26289. 'ASYNC-CLASS ==>'
  26290. '"stopped" | OTHERS' (where OTHERS will be added depending on the
  26291. needs--this is still in development).
  26292. 'RESULT ==>'
  26293. ' VARIABLE "=" VALUE'
  26294. 'VARIABLE ==>'
  26295. ' STRING '
  26296. 'VALUE ==>'
  26297. ' CONST | TUPLE | LIST '
  26298. 'CONST ==>'
  26299. 'C-STRING'
  26300. 'TUPLE ==>'
  26301. ' "{}" | "{" RESULT ( "," RESULT )* "}" '
  26302. 'LIST ==>'
  26303. ' "[]" | "[" VALUE ( "," VALUE )* "]" | "[" RESULT ( "," RESULT )*
  26304. "]" '
  26305. 'STREAM-RECORD ==>'
  26306. 'CONSOLE-STREAM-OUTPUT | TARGET-STREAM-OUTPUT | LOG-STREAM-OUTPUT'
  26307. 'CONSOLE-STREAM-OUTPUT ==>'
  26308. '"~" C-STRING NL'
  26309. 'TARGET-STREAM-OUTPUT ==>'
  26310. '"@" C-STRING NL'
  26311. 'LOG-STREAM-OUTPUT ==>'
  26312. '"&" C-STRING NL'
  26313. 'NL ==>'
  26314. 'CR | CR-LF'
  26315. 'TOKEN ==>'
  26316. _any sequence of digits_.
  26317. Notes:
  26318. * All output sequences end in a single line containing a period.
  26319. * The 'TOKEN' is from the corresponding request. Note that for all
  26320. async output, while the token is allowed by the grammar and may be
  26321. output by future versions of GDB for select async output messages,
  26322. it is generally omitted. Frontends should treat all async output
  26323. as reporting general changes in the state of the target and there
  26324. should be no need to associate async output to any prior command.
  26325. * STATUS-ASYNC-OUTPUT contains on-going status information about the
  26326. progress of a slow operation. It can be discarded. All status
  26327. output is prefixed by '+'.
  26328. * EXEC-ASYNC-OUTPUT contains asynchronous state change on the target
  26329. (stopped, started, disappeared). All async output is prefixed by
  26330. '*'.
  26331. * NOTIFY-ASYNC-OUTPUT contains supplementary information that the
  26332. client should handle (e.g., a new breakpoint information). All
  26333. notify output is prefixed by '='.
  26334. * CONSOLE-STREAM-OUTPUT is output that should be displayed as is in
  26335. the console. It is the textual response to a CLI command. All the
  26336. console output is prefixed by '~'.
  26337. * TARGET-STREAM-OUTPUT is the output produced by the target program.
  26338. All the target output is prefixed by '@'.
  26339. * LOG-STREAM-OUTPUT is output text coming from GDB's internals, for
  26340. instance messages that should be displayed as part of an error log.
  26341. All the log output is prefixed by '&'.
  26342. * New GDB/MI commands should only output LISTS containing VALUES.
  26343. *Note GDB/MI Stream Records: GDB/MI Stream Records, for more details
  26344. about the various output records.
  26345. 
  26346. File: gdb.info, Node: GDB/MI Compatibility with CLI, Next: GDB/MI Development and Front Ends, Prev: GDB/MI Command Syntax, Up: GDB/MI
  26347. 27.3 GDB/MI Compatibility with CLI
  26348. ==================================
  26349. For the developers convenience CLI commands can be entered directly, but
  26350. there may be some unexpected behaviour. For example, commands that
  26351. query the user will behave as if the user replied yes, breakpoint
  26352. command lists are not executed and some CLI commands, such as 'if',
  26353. 'when' and 'define', prompt for further input with '>', which is not
  26354. valid MI output.
  26355. This feature may be removed at some stage in the future and it is
  26356. recommended that front ends use the '-interpreter-exec' command (*note
  26357. -interpreter-exec::).
  26358. 
  26359. File: gdb.info, Node: GDB/MI Development and Front Ends, Next: GDB/MI Output Records, Prev: GDB/MI Compatibility with CLI, Up: GDB/MI
  26360. 27.4 GDB/MI Development and Front Ends
  26361. ======================================
  26362. The application which takes the MI output and presents the state of the
  26363. program being debugged to the user is called a "front end".
  26364. Since GDB/MI is used by a variety of front ends to GDB, changes to
  26365. the MI interface may break existing usage. This section describes how
  26366. the protocol changes and how to request previous version of the protocol
  26367. when it does.
  26368. Some changes in MI need not break a carefully designed front end, and
  26369. for these the MI version will remain unchanged. The following is a list
  26370. of changes that may occur within one level, so front ends should parse
  26371. MI output in a way that can handle them:
  26372. * New MI commands may be added.
  26373. * New fields may be added to the output of any MI command.
  26374. * The range of values for fields with specified values, e.g.,
  26375. 'in_scope' (*note -var-update::) may be extended.
  26376. If the changes are likely to break front ends, the MI version level
  26377. will be increased by one. The new versions of the MI protocol are not
  26378. compatible with the old versions. Old versions of MI remain available,
  26379. allowing front ends to keep using them until they are modified to use
  26380. the latest MI version.
  26381. Since '--interpreter=mi' always points to the latest MI version, it
  26382. is recommended that front ends request a specific version of MI when
  26383. launching GDB (e.g. '--interpreter=mi2') to make sure they get an
  26384. interpreter with the MI version they expect.
  26385. The following table gives a summary of the released versions of the
  26386. MI interface: the version number, the version of GDB in which it first
  26387. appeared and the breaking changes compared to the previous version.
  26388. MI GDB Breaking changes
  26389. versionversion
  26390. ----------------------------------------------------------------------------
  26391. 1 5.1 None
  26392. 2 6.0
  26393. * The '-environment-pwd', '-environment-directory' and
  26394. '-environment-path' commands now returns values using the
  26395. MI output syntax, rather than CLI output syntax.
  26396. * '-var-list-children''s 'children' result field is now a
  26397. list, rather than a tuple.
  26398. * '-var-update''s 'changelist' result field is now a list,
  26399. rather than a tuple.
  26400. 3 9.1
  26401. * The output of information about multi-location breakpoints
  26402. has changed in the responses to the '-break-insert' and
  26403. '-break-info' commands, as well as in the
  26404. '=breakpoint-created' and '=breakpoint-modified' events.
  26405. The multiple locations are now placed in a 'locations'
  26406. field, whose value is a list.
  26407. If your front end cannot yet migrate to a more recent version of the
  26408. MI protocol, you can nevertheless selectively enable specific features
  26409. available in those recent MI versions, using the following commands:
  26410. '-fix-multi-location-breakpoint-output'
  26411. Use the output for multi-location breakpoints which was introduced
  26412. by MI 3, even when using MI versions 2 or 1. This command has no
  26413. effect when using MI version 3 or later.
  26414. The best way to avoid unexpected changes in MI that might break your
  26415. front end is to make your project known to GDB developers and follow
  26416. development on <gdb@sourceware.org> and <gdb-patches@sourceware.org>.
  26417. 
  26418. File: gdb.info, Node: GDB/MI Output Records, Next: GDB/MI Simple Examples, Prev: GDB/MI Development and Front Ends, Up: GDB/MI
  26419. 27.5 GDB/MI Output Records
  26420. ==========================
  26421. * Menu:
  26422. * GDB/MI Result Records::
  26423. * GDB/MI Stream Records::
  26424. * GDB/MI Async Records::
  26425. * GDB/MI Breakpoint Information::
  26426. * GDB/MI Frame Information::
  26427. * GDB/MI Thread Information::
  26428. * GDB/MI Ada Exception Information::
  26429. 
  26430. File: gdb.info, Node: GDB/MI Result Records, Next: GDB/MI Stream Records, Up: GDB/MI Output Records
  26431. 27.5.1 GDB/MI Result Records
  26432. ----------------------------
  26433. In addition to a number of out-of-band notifications, the response to a
  26434. GDB/MI command includes one of the following result indications:
  26435. '"^done" [ "," RESULTS ]'
  26436. The synchronous operation was successful, 'RESULTS' are the return
  26437. values.
  26438. '"^running"'
  26439. This result record is equivalent to '^done'. Historically, it was
  26440. output instead of '^done' if the command has resumed the target.
  26441. This behaviour is maintained for backward compatibility, but all
  26442. frontends should treat '^done' and '^running' identically and rely
  26443. on the '*running' output record to determine which threads are
  26444. resumed.
  26445. '"^connected"'
  26446. GDB has connected to a remote target.
  26447. '"^error" "," "msg=" C-STRING [ "," "code=" C-STRING ]'
  26448. The operation failed. The 'msg=C-STRING' variable contains the
  26449. corresponding error message.
  26450. If present, the 'code=C-STRING' variable provides an error code on
  26451. which consumers can rely on to detect the corresponding error
  26452. condition. At present, only one error code is defined:
  26453. '"undefined-command"'
  26454. Indicates that the command causing the error does not exist.
  26455. '"^exit"'
  26456. GDB has terminated.
  26457. 
  26458. File: gdb.info, Node: GDB/MI Stream Records, Next: GDB/MI Async Records, Prev: GDB/MI Result Records, Up: GDB/MI Output Records
  26459. 27.5.2 GDB/MI Stream Records
  26460. ----------------------------
  26461. GDB internally maintains a number of output streams: the console, the
  26462. target, and the log. The output intended for each of these streams is
  26463. funneled through the GDB/MI interface using "stream records".
  26464. Each stream record begins with a unique "prefix character" which
  26465. identifies its stream (*note GDB/MI Output Syntax: GDB/MI Output
  26466. Syntax.). In addition to the prefix, each stream record contains a
  26467. 'STRING-OUTPUT'. This is either raw text (with an implicit new line) or
  26468. a quoted C string (which does not contain an implicit newline).
  26469. '"~" STRING-OUTPUT'
  26470. The console output stream contains text that should be displayed in
  26471. the CLI console window. It contains the textual responses to CLI
  26472. commands.
  26473. '"@" STRING-OUTPUT'
  26474. The target output stream contains any textual output from the
  26475. running target. This is only present when GDB's event loop is
  26476. truly asynchronous, which is currently only the case for remote
  26477. targets.
  26478. '"&" STRING-OUTPUT'
  26479. The log stream contains debugging messages being produced by GDB's
  26480. internals.
  26481. 
  26482. File: gdb.info, Node: GDB/MI Async Records, Next: GDB/MI Breakpoint Information, Prev: GDB/MI Stream Records, Up: GDB/MI Output Records
  26483. 27.5.3 GDB/MI Async Records
  26484. ---------------------------
  26485. "Async" records are used to notify the GDB/MI client of additional
  26486. changes that have occurred. Those changes can either be a consequence
  26487. of GDB/MI commands (e.g., a breakpoint modified) or a result of target
  26488. activity (e.g., target stopped).
  26489. The following is the list of possible async records:
  26490. '*running,thread-id="THREAD"'
  26491. The target is now running. The THREAD field can be the global
  26492. thread ID of the thread that is now running, and it can be 'all' if
  26493. all threads are running. The frontend should assume that no
  26494. interaction with a running thread is possible after this
  26495. notification is produced. The frontend should not assume that this
  26496. notification is output only once for any command. GDB may emit
  26497. this notification several times, either for different threads,
  26498. because it cannot resume all threads together, or even for a single
  26499. thread, if the thread must be stepped though some code before
  26500. letting it run freely.
  26501. '*stopped,reason="REASON",thread-id="ID",stopped-threads="STOPPED",core="CORE"'
  26502. The target has stopped. The REASON field can have one of the
  26503. following values:
  26504. 'breakpoint-hit'
  26505. A breakpoint was reached.
  26506. 'watchpoint-trigger'
  26507. A watchpoint was triggered.
  26508. 'read-watchpoint-trigger'
  26509. A read watchpoint was triggered.
  26510. 'access-watchpoint-trigger'
  26511. An access watchpoint was triggered.
  26512. 'function-finished'
  26513. An -exec-finish or similar CLI command was accomplished.
  26514. 'location-reached'
  26515. An -exec-until or similar CLI command was accomplished.
  26516. 'watchpoint-scope'
  26517. A watchpoint has gone out of scope.
  26518. 'end-stepping-range'
  26519. An -exec-next, -exec-next-instruction, -exec-step,
  26520. -exec-step-instruction or similar CLI command was
  26521. accomplished.
  26522. 'exited-signalled'
  26523. The inferior exited because of a signal.
  26524. 'exited'
  26525. The inferior exited.
  26526. 'exited-normally'
  26527. The inferior exited normally.
  26528. 'signal-received'
  26529. A signal was received by the inferior.
  26530. 'solib-event'
  26531. The inferior has stopped due to a library being loaded or
  26532. unloaded. This can happen when 'stop-on-solib-events' (*note
  26533. Files::) is set or when a 'catch load' or 'catch unload'
  26534. catchpoint is in use (*note Set Catchpoints::).
  26535. 'fork'
  26536. The inferior has forked. This is reported when 'catch fork'
  26537. (*note Set Catchpoints::) has been used.
  26538. 'vfork'
  26539. The inferior has vforked. This is reported in when 'catch
  26540. vfork' (*note Set Catchpoints::) has been used.
  26541. 'syscall-entry'
  26542. The inferior entered a system call. This is reported when
  26543. 'catch syscall' (*note Set Catchpoints::) has been used.
  26544. 'syscall-return'
  26545. The inferior returned from a system call. This is reported
  26546. when 'catch syscall' (*note Set Catchpoints::) has been used.
  26547. 'exec'
  26548. The inferior called 'exec'. This is reported when 'catch
  26549. exec' (*note Set Catchpoints::) has been used.
  26550. The ID field identifies the global thread ID of the thread that
  26551. directly caused the stop - for example by hitting a breakpoint.
  26552. Depending on whether all-stop mode is in effect (*note All-Stop
  26553. Mode::), GDB may either stop all threads, or only the thread that
  26554. directly triggered the stop. If all threads are stopped, the
  26555. STOPPED field will have the value of '"all"'. Otherwise, the value
  26556. of the STOPPED field will be a list of thread identifiers.
  26557. Presently, this list will always include a single thread, but
  26558. frontend should be prepared to see several threads in the list.
  26559. The CORE field reports the processor core on which the stop event
  26560. has happened. This field may be absent if such information is not
  26561. available.
  26562. '=thread-group-added,id="ID"'
  26563. '=thread-group-removed,id="ID"'
  26564. A thread group was either added or removed. The ID field contains
  26565. the GDB identifier of the thread group. When a thread group is
  26566. added, it generally might not be associated with a running process.
  26567. When a thread group is removed, its id becomes invalid and cannot
  26568. be used in any way.
  26569. '=thread-group-started,id="ID",pid="PID"'
  26570. A thread group became associated with a running program, either
  26571. because the program was just started or the thread group was
  26572. attached to a program. The ID field contains the GDB identifier of
  26573. the thread group. The PID field contains process identifier,
  26574. specific to the operating system.
  26575. '=thread-group-exited,id="ID"[,exit-code="CODE"]'
  26576. A thread group is no longer associated with a running program,
  26577. either because the program has exited, or because it was detached
  26578. from. The ID field contains the GDB identifier of the thread
  26579. group. The CODE field is the exit code of the inferior; it exists
  26580. only when the inferior exited with some code.
  26581. '=thread-created,id="ID",group-id="GID"'
  26582. '=thread-exited,id="ID",group-id="GID"'
  26583. A thread either was created, or has exited. The ID field contains
  26584. the global GDB identifier of the thread. The GID field identifies
  26585. the thread group this thread belongs to.
  26586. '=thread-selected,id="ID"[,frame="FRAME"]'
  26587. Informs that the selected thread or frame were changed. This
  26588. notification is not emitted as result of the '-thread-select' or
  26589. '-stack-select-frame' commands, but is emitted whenever an MI
  26590. command that is not documented to change the selected thread and
  26591. frame actually changes them. In particular, invoking, directly or
  26592. indirectly (via user-defined command), the CLI 'thread' or 'frame'
  26593. commands, will generate this notification. Changing the thread or
  26594. frame from another user interface (see *note Interpreters::) will
  26595. also generate this notification.
  26596. The FRAME field is only present if the newly selected thread is
  26597. stopped. See *note GDB/MI Frame Information:: for the format of
  26598. its value.
  26599. We suggest that in response to this notification, front ends
  26600. highlight the selected thread and cause subsequent commands to
  26601. apply to that thread.
  26602. '=library-loaded,...'
  26603. Reports that a new library file was loaded by the program. This
  26604. notification has 5 fields--ID, TARGET-NAME, HOST-NAME,
  26605. SYMBOLS-LOADED and RANGES. The ID field is an opaque identifier of
  26606. the library. For remote debugging case, TARGET-NAME and HOST-NAME
  26607. fields give the name of the library file on the target, and on the
  26608. host respectively. For native debugging, both those fields have
  26609. the same value. The SYMBOLS-LOADED field is emitted only for
  26610. backward compatibility and should not be relied on to convey any
  26611. useful information. The THREAD-GROUP field, if present, specifies
  26612. the id of the thread group in whose context the library was loaded.
  26613. If the field is absent, it means the library was loaded in the
  26614. context of all present thread groups. The RANGES field specifies
  26615. the ranges of addresses belonging to this library.
  26616. '=library-unloaded,...'
  26617. Reports that a library was unloaded by the program. This
  26618. notification has 3 fields--ID, TARGET-NAME and HOST-NAME with the
  26619. same meaning as for the '=library-loaded' notification. The
  26620. THREAD-GROUP field, if present, specifies the id of the thread
  26621. group in whose context the library was unloaded. If the field is
  26622. absent, it means the library was unloaded in the context of all
  26623. present thread groups.
  26624. '=traceframe-changed,num=TFNUM,tracepoint=TPNUM'
  26625. '=traceframe-changed,end'
  26626. Reports that the trace frame was changed and its new number is
  26627. TFNUM. The number of the tracepoint associated with this trace
  26628. frame is TPNUM.
  26629. '=tsv-created,name=NAME,initial=INITIAL'
  26630. Reports that the new trace state variable NAME is created with
  26631. initial value INITIAL.
  26632. '=tsv-deleted,name=NAME'
  26633. '=tsv-deleted'
  26634. Reports that the trace state variable NAME is deleted or all trace
  26635. state variables are deleted.
  26636. '=tsv-modified,name=NAME,initial=INITIAL[,current=CURRENT]'
  26637. Reports that the trace state variable NAME is modified with the
  26638. initial value INITIAL. The current value CURRENT of trace state
  26639. variable is optional and is reported if the current value of trace
  26640. state variable is known.
  26641. '=breakpoint-created,bkpt={...}'
  26642. '=breakpoint-modified,bkpt={...}'
  26643. '=breakpoint-deleted,id=NUMBER'
  26644. Reports that a breakpoint was created, modified, or deleted,
  26645. respectively. Only user-visible breakpoints are reported to the MI
  26646. user.
  26647. The BKPT argument is of the same form as returned by the various
  26648. breakpoint commands; *Note GDB/MI Breakpoint Commands::. The
  26649. NUMBER is the ordinal number of the breakpoint.
  26650. Note that if a breakpoint is emitted in the result record of a
  26651. command, then it will not also be emitted in an async record.
  26652. '=record-started,thread-group="ID",method="METHOD"[,format="FORMAT"]'
  26653. '=record-stopped,thread-group="ID"'
  26654. Execution log recording was either started or stopped on an
  26655. inferior. The ID is the GDB identifier of the thread group
  26656. corresponding to the affected inferior.
  26657. The METHOD field indicates the method used to record execution. If
  26658. the method in use supports multiple recording formats, FORMAT will
  26659. be present and contain the currently used format. *Note Process
  26660. Record and Replay::, for existing method and format values.
  26661. '=cmd-param-changed,param=PARAM,value=VALUE'
  26662. Reports that a parameter of the command 'set PARAM' is changed to
  26663. VALUE. In the multi-word 'set' command, the PARAM is the whole
  26664. parameter list to 'set' command. For example, In command 'set
  26665. check type on', PARAM is 'check type' and VALUE is 'on'.
  26666. '=memory-changed,thread-group=ID,addr=ADDR,len=LEN[,type="code"]'
  26667. Reports that bytes from ADDR to DATA + LEN were written in an
  26668. inferior. The ID is the identifier of the thread group
  26669. corresponding to the affected inferior. The optional 'type="code"'
  26670. part is reported if the memory written to holds executable code.
  26671. 
  26672. File: gdb.info, Node: GDB/MI Breakpoint Information, Next: GDB/MI Frame Information, Prev: GDB/MI Async Records, Up: GDB/MI Output Records
  26673. 27.5.4 GDB/MI Breakpoint Information
  26674. ------------------------------------
  26675. When GDB reports information about a breakpoint, a tracepoint, a
  26676. watchpoint, or a catchpoint, it uses a tuple with the following fields:
  26677. 'number'
  26678. The breakpoint number.
  26679. 'type'
  26680. The type of the breakpoint. For ordinary breakpoints this will be
  26681. 'breakpoint', but many values are possible.
  26682. 'catch-type'
  26683. If the type of the breakpoint is 'catchpoint', then this indicates
  26684. the exact type of catchpoint.
  26685. 'disp'
  26686. This is the breakpoint disposition--either 'del', meaning that the
  26687. breakpoint will be deleted at the next stop, or 'keep', meaning
  26688. that the breakpoint will not be deleted.
  26689. 'enabled'
  26690. This indicates whether the breakpoint is enabled, in which case the
  26691. value is 'y', or disabled, in which case the value is 'n'. Note
  26692. that this is not the same as the field 'enable'.
  26693. 'addr'
  26694. The address of the breakpoint. This may be a hexidecimal number,
  26695. giving the address; or the string '<PENDING>', for a pending
  26696. breakpoint; or the string '<MULTIPLE>', for a breakpoint with
  26697. multiple locations. This field will not be present if no address
  26698. can be determined. For example, a watchpoint does not have an
  26699. address.
  26700. 'addr_flags'
  26701. Optional field containing any flags related to the address. These
  26702. flags are architecture-dependent; see *note Architectures:: for
  26703. their meaning for a particular CPU.
  26704. 'func'
  26705. If known, the function in which the breakpoint appears. If not
  26706. known, this field is not present.
  26707. 'filename'
  26708. The name of the source file which contains this function, if known.
  26709. If not known, this field is not present.
  26710. 'fullname'
  26711. The full file name of the source file which contains this function,
  26712. if known. If not known, this field is not present.
  26713. 'line'
  26714. The line number at which this breakpoint appears, if known. If not
  26715. known, this field is not present.
  26716. 'at'
  26717. If the source file is not known, this field may be provided. If
  26718. provided, this holds the address of the breakpoint, possibly
  26719. followed by a symbol name.
  26720. 'pending'
  26721. If this breakpoint is pending, this field is present and holds the
  26722. text used to set the breakpoint, as entered by the user.
  26723. 'evaluated-by'
  26724. Where this breakpoint's condition is evaluated, either 'host' or
  26725. 'target'.
  26726. 'thread'
  26727. If this is a thread-specific breakpoint, then this identifies the
  26728. thread in which the breakpoint can trigger.
  26729. 'task'
  26730. If this breakpoint is restricted to a particular Ada task, then
  26731. this field will hold the task identifier.
  26732. 'cond'
  26733. If the breakpoint is conditional, this is the condition expression.
  26734. 'ignore'
  26735. The ignore count of the breakpoint.
  26736. 'enable'
  26737. The enable count of the breakpoint.
  26738. 'traceframe-usage'
  26739. FIXME.
  26740. 'static-tracepoint-marker-string-id'
  26741. For a static tracepoint, the name of the static tracepoint marker.
  26742. 'mask'
  26743. For a masked watchpoint, this is the mask.
  26744. 'pass'
  26745. A tracepoint's pass count.
  26746. 'original-location'
  26747. The location of the breakpoint as originally specified by the user.
  26748. This field is optional.
  26749. 'times'
  26750. The number of times the breakpoint has been hit.
  26751. 'installed'
  26752. This field is only given for tracepoints. This is either 'y',
  26753. meaning that the tracepoint is installed, or 'n', meaning that it
  26754. is not.
  26755. 'what'
  26756. Some extra data, the exact contents of which are type-dependent.
  26757. 'locations'
  26758. This field is present if the breakpoint has multiple locations. It
  26759. is also exceptionally present if the breakpoint is enabled and has
  26760. a single, disabled location.
  26761. The value is a list of locations. The format of a location is
  26762. described below.
  26763. A location in a multi-location breakpoint is represented as a tuple
  26764. with the following fields:
  26765. 'number'
  26766. The location number as a dotted pair, like '1.2'. The first digit
  26767. is the number of the parent breakpoint. The second digit is the
  26768. number of the location within that breakpoint.
  26769. 'enabled'
  26770. This indicates whether the location is enabled, in which case the
  26771. value is 'y', or disabled, in which case the value is 'n'. Note
  26772. that this is not the same as the field 'enable'.
  26773. 'addr'
  26774. The address of this location as an hexidecimal number.
  26775. 'addr_flags'
  26776. Optional field containing any flags related to the address. These
  26777. flags are architecture-dependent; see *note Architectures:: for
  26778. their meaning for a particular CPU.
  26779. 'func'
  26780. If known, the function in which the location appears. If not
  26781. known, this field is not present.
  26782. 'file'
  26783. The name of the source file which contains this location, if known.
  26784. If not known, this field is not present.
  26785. 'fullname'
  26786. The full file name of the source file which contains this location,
  26787. if known. If not known, this field is not present.
  26788. 'line'
  26789. The line number at which this location appears, if known. If not
  26790. known, this field is not present.
  26791. 'thread-groups'
  26792. The thread groups this location is in.
  26793. For example, here is what the output of '-break-insert' (*note GDB/MI
  26794. Breakpoint Commands::) might be:
  26795. -> -break-insert main
  26796. <- ^done,bkpt={number="1",type="breakpoint",disp="keep",
  26797. enabled="y",addr="0x08048564",func="main",file="myprog.c",
  26798. fullname="/home/nickrob/myprog.c",line="68",thread-groups=["i1"],
  26799. times="0"}
  26800. <- (gdb)
  26801. 
  26802. File: gdb.info, Node: GDB/MI Frame Information, Next: GDB/MI Thread Information, Prev: GDB/MI Breakpoint Information, Up: GDB/MI Output Records
  26803. 27.5.5 GDB/MI Frame Information
  26804. -------------------------------
  26805. Response from many MI commands includes an information about stack
  26806. frame. This information is a tuple that may have the following fields:
  26807. 'level'
  26808. The level of the stack frame. The innermost frame has the level of
  26809. zero. This field is always present.
  26810. 'func'
  26811. The name of the function corresponding to the frame. This field
  26812. may be absent if GDB is unable to determine the function name.
  26813. 'addr'
  26814. The code address for the frame. This field is always present.
  26815. 'addr_flags'
  26816. Optional field containing any flags related to the address. These
  26817. flags are architecture-dependent; see *note Architectures:: for
  26818. their meaning for a particular CPU.
  26819. 'file'
  26820. The name of the source files that correspond to the frame's code
  26821. address. This field may be absent.
  26822. 'line'
  26823. The source line corresponding to the frames' code address. This
  26824. field may be absent.
  26825. 'from'
  26826. The name of the binary file (either executable or shared library)
  26827. the corresponds to the frame's code address. This field may be
  26828. absent.
  26829. 
  26830. File: gdb.info, Node: GDB/MI Thread Information, Next: GDB/MI Ada Exception Information, Prev: GDB/MI Frame Information, Up: GDB/MI Output Records
  26831. 27.5.6 GDB/MI Thread Information
  26832. --------------------------------
  26833. Whenever GDB has to report an information about a thread, it uses a
  26834. tuple with the following fields. The fields are always present unless
  26835. stated otherwise.
  26836. 'id'
  26837. The global numeric id assigned to the thread by GDB.
  26838. 'target-id'
  26839. The target-specific string identifying the thread.
  26840. 'details'
  26841. Additional information about the thread provided by the target. It
  26842. is supposed to be human-readable and not interpreted by the
  26843. frontend. This field is optional.
  26844. 'name'
  26845. The name of the thread. If the user specified a name using the
  26846. 'thread name' command, then this name is given. Otherwise, if GDB
  26847. can extract the thread name from the target, then that name is
  26848. given. If GDB cannot find the thread name, then this field is
  26849. omitted.
  26850. 'state'
  26851. The execution state of the thread, either 'stopped' or 'running',
  26852. depending on whether the thread is presently running.
  26853. 'frame'
  26854. The stack frame currently executing in the thread. This field is
  26855. only present if the thread is stopped. Its format is documented in
  26856. *note GDB/MI Frame Information::.
  26857. 'core'
  26858. The value of this field is an integer number of the processor core
  26859. the thread was last seen on. This field is optional.
  26860. 
  26861. File: gdb.info, Node: GDB/MI Ada Exception Information, Prev: GDB/MI Thread Information, Up: GDB/MI Output Records
  26862. 27.5.7 GDB/MI Ada Exception Information
  26863. ---------------------------------------
  26864. Whenever a '*stopped' record is emitted because the program stopped
  26865. after hitting an exception catchpoint (*note Set Catchpoints::), GDB
  26866. provides the name of the exception that was raised via the
  26867. 'exception-name' field. Also, for exceptions that were raised with an
  26868. exception message, GDB provides that message via the 'exception-message'
  26869. field.
  26870. 
  26871. File: gdb.info, Node: GDB/MI Simple Examples, Next: GDB/MI Command Description Format, Prev: GDB/MI Output Records, Up: GDB/MI
  26872. 27.6 Simple Examples of GDB/MI Interaction
  26873. ==========================================
  26874. This subsection presents several simple examples of interaction using
  26875. the GDB/MI interface. In these examples, '->' means that the following
  26876. line is passed to GDB/MI as input, while '<-' means the output received
  26877. from GDB/MI.
  26878. Note the line breaks shown in the examples are here only for
  26879. readability, they don't appear in the real output.
  26880. Setting a Breakpoint
  26881. --------------------
  26882. Setting a breakpoint generates synchronous output which contains
  26883. detailed information of the breakpoint.
  26884. -> -break-insert main
  26885. <- ^done,bkpt={number="1",type="breakpoint",disp="keep",
  26886. enabled="y",addr="0x08048564",func="main",file="myprog.c",
  26887. fullname="/home/nickrob/myprog.c",line="68",thread-groups=["i1"],
  26888. times="0"}
  26889. <- (gdb)
  26890. Program Execution
  26891. -----------------
  26892. Program execution generates asynchronous records and MI gives the reason
  26893. that execution stopped.
  26894. -> -exec-run
  26895. <- ^running
  26896. <- (gdb)
  26897. <- *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
  26898. frame={addr="0x08048564",func="main",
  26899. args=[{name="argc",value="1"},{name="argv",value="0xbfc4d4d4"}],
  26900. file="myprog.c",fullname="/home/nickrob/myprog.c",line="68",
  26901. arch="i386:x86_64"}
  26902. <- (gdb)
  26903. -> -exec-continue
  26904. <- ^running
  26905. <- (gdb)
  26906. <- *stopped,reason="exited-normally"
  26907. <- (gdb)
  26908. Quitting GDB
  26909. ------------
  26910. Quitting GDB just prints the result class '^exit'.
  26911. -> (gdb)
  26912. <- -gdb-exit
  26913. <- ^exit
  26914. Please note that '^exit' is printed immediately, but it might take
  26915. some time for GDB to actually exit. During that time, GDB performs
  26916. necessary cleanups, including killing programs being debugged or
  26917. disconnecting from debug hardware, so the frontend should wait till GDB
  26918. exits and should only forcibly kill GDB if it fails to exit in
  26919. reasonable time.
  26920. A Bad Command
  26921. -------------
  26922. Here's what happens if you pass a non-existent command:
  26923. -> -rubbish
  26924. <- ^error,msg="Undefined MI command: rubbish"
  26925. <- (gdb)
  26926. 
  26927. File: gdb.info, Node: GDB/MI Command Description Format, Next: GDB/MI Breakpoint Commands, Prev: GDB/MI Simple Examples, Up: GDB/MI
  26928. 27.7 GDB/MI Command Description Format
  26929. ======================================
  26930. The remaining sections describe blocks of commands. Each block of
  26931. commands is laid out in a fashion similar to this section.
  26932. Motivation
  26933. ----------
  26934. The motivation for this collection of commands.
  26935. Introduction
  26936. ------------
  26937. A brief introduction to this collection of commands as a whole.
  26938. Commands
  26939. --------
  26940. For each command in the block, the following is described:
  26941. Synopsis
  26942. ........
  26943. -command ARGS...
  26944. Result
  26945. ......
  26946. GDB Command
  26947. ...........
  26948. The corresponding GDB CLI command(s), if any.
  26949. Example
  26950. .......
  26951. Example(s) formatted for readability. Some of the described commands
  26952. have not been implemented yet and these are labeled N.A. (not
  26953. available).
  26954. 
  26955. File: gdb.info, Node: GDB/MI Breakpoint Commands, Next: GDB/MI Catchpoint Commands, Prev: GDB/MI Command Description Format, Up: GDB/MI
  26956. 27.8 GDB/MI Breakpoint Commands
  26957. ===============================
  26958. This section documents GDB/MI commands for manipulating breakpoints.
  26959. The '-break-after' Command
  26960. --------------------------
  26961. Synopsis
  26962. ........
  26963. -break-after NUMBER COUNT
  26964. The breakpoint number NUMBER is not in effect until it has been hit
  26965. COUNT times. To see how this is reflected in the output of the
  26966. '-break-list' command, see the description of the '-break-list' command
  26967. below.
  26968. GDB Command
  26969. ...........
  26970. The corresponding GDB command is 'ignore'.
  26971. Example
  26972. .......
  26973. (gdb)
  26974. -break-insert main
  26975. ^done,bkpt={number="1",type="breakpoint",disp="keep",
  26976. enabled="y",addr="0x000100d0",func="main",file="hello.c",
  26977. fullname="/home/foo/hello.c",line="5",thread-groups=["i1"],
  26978. times="0"}
  26979. (gdb)
  26980. -break-after 1 3
  26981. ~
  26982. ^done
  26983. (gdb)
  26984. -break-list
  26985. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  26986. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26987. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26988. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26989. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26990. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26991. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26992. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  26993. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  26994. line="5",thread-groups=["i1"],times="0",ignore="3"}]}
  26995. (gdb)
  26996. The '-break-commands' Command
  26997. -----------------------------
  26998. Synopsis
  26999. ........
  27000. -break-commands NUMBER [ COMMAND1 ... COMMANDN ]
  27001. Specifies the CLI commands that should be executed when breakpoint
  27002. NUMBER is hit. The parameters COMMAND1 to COMMANDN are the commands.
  27003. If no command is specified, any previously-set commands are cleared.
  27004. *Note Break Commands::. Typical use of this functionality is tracing a
  27005. program, that is, printing of values of some variables whenever
  27006. breakpoint is hit and then continuing.
  27007. GDB Command
  27008. ...........
  27009. The corresponding GDB command is 'commands'.
  27010. Example
  27011. .......
  27012. (gdb)
  27013. -break-insert main
  27014. ^done,bkpt={number="1",type="breakpoint",disp="keep",
  27015. enabled="y",addr="0x000100d0",func="main",file="hello.c",
  27016. fullname="/home/foo/hello.c",line="5",thread-groups=["i1"],
  27017. times="0"}
  27018. (gdb)
  27019. -break-commands 1 "print v" "continue"
  27020. ^done
  27021. (gdb)
  27022. The '-break-condition' Command
  27023. ------------------------------
  27024. Synopsis
  27025. ........
  27026. -break-condition NUMBER EXPR
  27027. Breakpoint NUMBER will stop the program only if the condition in EXPR
  27028. is true. The condition becomes part of the '-break-list' output (see
  27029. the description of the '-break-list' command below).
  27030. GDB Command
  27031. ...........
  27032. The corresponding GDB command is 'condition'.
  27033. Example
  27034. .......
  27035. (gdb)
  27036. -break-condition 1 1
  27037. ^done
  27038. (gdb)
  27039. -break-list
  27040. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  27041. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27042. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27043. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27044. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27045. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27046. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27047. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27048. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  27049. line="5",cond="1",thread-groups=["i1"],times="0",ignore="3"}]}
  27050. (gdb)
  27051. The '-break-delete' Command
  27052. ---------------------------
  27053. Synopsis
  27054. ........
  27055. -break-delete ( BREAKPOINT )+
  27056. Delete the breakpoint(s) whose number(s) are specified in the
  27057. argument list. This is obviously reflected in the breakpoint list.
  27058. GDB Command
  27059. ...........
  27060. The corresponding GDB command is 'delete'.
  27061. Example
  27062. .......
  27063. (gdb)
  27064. -break-delete 1
  27065. ^done
  27066. (gdb)
  27067. -break-list
  27068. ^done,BreakpointTable={nr_rows="0",nr_cols="6",
  27069. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27070. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27071. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27072. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27073. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27074. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27075. body=[]}
  27076. (gdb)
  27077. The '-break-disable' Command
  27078. ----------------------------
  27079. Synopsis
  27080. ........
  27081. -break-disable ( BREAKPOINT )+
  27082. Disable the named BREAKPOINT(s). The field 'enabled' in the break
  27083. list is now set to 'n' for the named BREAKPOINT(s).
  27084. GDB Command
  27085. ...........
  27086. The corresponding GDB command is 'disable'.
  27087. Example
  27088. .......
  27089. (gdb)
  27090. -break-disable 2
  27091. ^done
  27092. (gdb)
  27093. -break-list
  27094. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  27095. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27096. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27097. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27098. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27099. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27100. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27101. body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="n",
  27102. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  27103. line="5",thread-groups=["i1"],times="0"}]}
  27104. (gdb)
  27105. The '-break-enable' Command
  27106. ---------------------------
  27107. Synopsis
  27108. ........
  27109. -break-enable ( BREAKPOINT )+
  27110. Enable (previously disabled) BREAKPOINT(s).
  27111. GDB Command
  27112. ...........
  27113. The corresponding GDB command is 'enable'.
  27114. Example
  27115. .......
  27116. (gdb)
  27117. -break-enable 2
  27118. ^done
  27119. (gdb)
  27120. -break-list
  27121. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  27122. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27123. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27124. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27125. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27126. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27127. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27128. body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
  27129. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  27130. line="5",thread-groups=["i1"],times="0"}]}
  27131. (gdb)
  27132. The '-break-info' Command
  27133. -------------------------
  27134. Synopsis
  27135. ........
  27136. -break-info BREAKPOINT
  27137. Get information about a single breakpoint.
  27138. The result is a table of breakpoints. *Note GDB/MI Breakpoint
  27139. Information::, for details on the format of each breakpoint in the
  27140. table.
  27141. GDB Command
  27142. ...........
  27143. The corresponding GDB command is 'info break BREAKPOINT'.
  27144. Example
  27145. .......
  27146. N.A.
  27147. The '-break-insert' Command
  27148. ---------------------------
  27149. Synopsis
  27150. ........
  27151. -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -a ]
  27152. [ -c CONDITION ] [ -i IGNORE-COUNT ]
  27153. [ -p THREAD-ID ] [ LOCATION ]
  27154. If specified, LOCATION, can be one of:
  27155. LINESPEC LOCATION
  27156. A linespec location. *Note Linespec Locations::.
  27157. EXPLICIT LOCATION
  27158. An explicit location. GDB/MI explicit locations are analogous to
  27159. the CLI's explicit locations using the option names listed below.
  27160. *Note Explicit Locations::.
  27161. '--source FILENAME'
  27162. The source file name of the location. This option requires
  27163. the use of either '--function' or '--line'.
  27164. '--function FUNCTION'
  27165. The name of a function or method.
  27166. '--label LABEL'
  27167. The name of a label.
  27168. '--line LINEOFFSET'
  27169. An absolute or relative line offset from the start of the
  27170. location.
  27171. ADDRESS LOCATION
  27172. An address location, *ADDRESS. *Note Address Locations::.
  27173. The possible optional parameters of this command are:
  27174. '-t'
  27175. Insert a temporary breakpoint.
  27176. '-h'
  27177. Insert a hardware breakpoint.
  27178. '-f'
  27179. If LOCATION cannot be parsed (for example if it refers to unknown
  27180. files or functions), create a pending breakpoint. Without this
  27181. flag, GDB will report an error, and won't create a breakpoint, if
  27182. LOCATION cannot be parsed.
  27183. '-d'
  27184. Create a disabled breakpoint.
  27185. '-a'
  27186. Create a tracepoint. *Note Tracepoints::. When this parameter is
  27187. used together with '-h', a fast tracepoint is created.
  27188. '-c CONDITION'
  27189. Make the breakpoint conditional on CONDITION.
  27190. '-i IGNORE-COUNT'
  27191. Initialize the IGNORE-COUNT.
  27192. '-p THREAD-ID'
  27193. Restrict the breakpoint to the thread with the specified global
  27194. THREAD-ID.
  27195. Result
  27196. ......
  27197. *Note GDB/MI Breakpoint Information::, for details on the format of the
  27198. resulting breakpoint.
  27199. Note: this format is open to change.
  27200. GDB Command
  27201. ...........
  27202. The corresponding GDB commands are 'break', 'tbreak', 'hbreak', and
  27203. 'thbreak'.
  27204. Example
  27205. .......
  27206. (gdb)
  27207. -break-insert main
  27208. ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",
  27209. fullname="/home/foo/recursive2.c,line="4",thread-groups=["i1"],
  27210. times="0"}
  27211. (gdb)
  27212. -break-insert -t foo
  27213. ^done,bkpt={number="2",addr="0x00010774",file="recursive2.c",
  27214. fullname="/home/foo/recursive2.c,line="11",thread-groups=["i1"],
  27215. times="0"}
  27216. (gdb)
  27217. -break-list
  27218. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  27219. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27220. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27221. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27222. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27223. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27224. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27225. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27226. addr="0x0001072c", func="main",file="recursive2.c",
  27227. fullname="/home/foo/recursive2.c,"line="4",thread-groups=["i1"],
  27228. times="0"},
  27229. bkpt={number="2",type="breakpoint",disp="del",enabled="y",
  27230. addr="0x00010774",func="foo",file="recursive2.c",
  27231. fullname="/home/foo/recursive2.c",line="11",thread-groups=["i1"],
  27232. times="0"}]}
  27233. (gdb)
  27234. The '-dprintf-insert' Command
  27235. -----------------------------
  27236. Synopsis
  27237. ........
  27238. -dprintf-insert [ -t ] [ -f ] [ -d ]
  27239. [ -c CONDITION ] [ -i IGNORE-COUNT ]
  27240. [ -p THREAD-ID ] [ LOCATION ] [ FORMAT ]
  27241. [ ARGUMENT ]
  27242. If supplied, LOCATION may be specified the same way as for the
  27243. '-break-insert' command. *Note -break-insert::.
  27244. The possible optional parameters of this command are:
  27245. '-t'
  27246. Insert a temporary breakpoint.
  27247. '-f'
  27248. If LOCATION cannot be parsed (for example, if it refers to unknown
  27249. files or functions), create a pending breakpoint. Without this
  27250. flag, GDB will report an error, and won't create a breakpoint, if
  27251. LOCATION cannot be parsed.
  27252. '-d'
  27253. Create a disabled breakpoint.
  27254. '-c CONDITION'
  27255. Make the breakpoint conditional on CONDITION.
  27256. '-i IGNORE-COUNT'
  27257. Set the ignore count of the breakpoint (*note ignore count:
  27258. Conditions.) to IGNORE-COUNT.
  27259. '-p THREAD-ID'
  27260. Restrict the breakpoint to the thread with the specified global
  27261. THREAD-ID.
  27262. Result
  27263. ......
  27264. *Note GDB/MI Breakpoint Information::, for details on the format of the
  27265. resulting breakpoint.
  27266. GDB Command
  27267. ...........
  27268. The corresponding GDB command is 'dprintf'.
  27269. Example
  27270. .......
  27271. (gdb)
  27272. 4-dprintf-insert foo "At foo entry\n"
  27273. 4^done,bkpt={number="1",type="dprintf",disp="keep",enabled="y",
  27274. addr="0x000000000040061b",func="foo",file="mi-dprintf.c",
  27275. fullname="mi-dprintf.c",line="25",thread-groups=["i1"],
  27276. times="0",script={"printf \"At foo entry\\n\"","continue"},
  27277. original-location="foo"}
  27278. (gdb)
  27279. 5-dprintf-insert 26 "arg=%d, g=%d\n" arg g
  27280. 5^done,bkpt={number="2",type="dprintf",disp="keep",enabled="y",
  27281. addr="0x000000000040062a",func="foo",file="mi-dprintf.c",
  27282. fullname="mi-dprintf.c",line="26",thread-groups=["i1"],
  27283. times="0",script={"printf \"arg=%d, g=%d\\n\", arg, g","continue"},
  27284. original-location="mi-dprintf.c:26"}
  27285. (gdb)
  27286. The '-break-list' Command
  27287. -------------------------
  27288. Synopsis
  27289. ........
  27290. -break-list
  27291. Displays the list of inserted breakpoints, showing the following
  27292. fields:
  27293. 'Number'
  27294. number of the breakpoint
  27295. 'Type'
  27296. type of the breakpoint: 'breakpoint' or 'watchpoint'
  27297. 'Disposition'
  27298. should the breakpoint be deleted or disabled when it is hit: 'keep'
  27299. or 'nokeep'
  27300. 'Enabled'
  27301. is the breakpoint enabled or no: 'y' or 'n'
  27302. 'Address'
  27303. memory location at which the breakpoint is set
  27304. 'What'
  27305. logical location of the breakpoint, expressed by function name,
  27306. file name, line number
  27307. 'Thread-groups'
  27308. list of thread groups to which this breakpoint applies
  27309. 'Times'
  27310. number of times the breakpoint has been hit
  27311. If there are no breakpoints or watchpoints, the 'BreakpointTable'
  27312. 'body' field is an empty list.
  27313. GDB Command
  27314. ...........
  27315. The corresponding GDB command is 'info break'.
  27316. Example
  27317. .......
  27318. (gdb)
  27319. -break-list
  27320. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  27321. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27322. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27323. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27324. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27325. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27326. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27327. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27328. addr="0x000100d0",func="main",file="hello.c",line="5",thread-groups=["i1"],
  27329. times="0"},
  27330. bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
  27331. addr="0x00010114",func="foo",file="hello.c",fullname="/home/foo/hello.c",
  27332. line="13",thread-groups=["i1"],times="0"}]}
  27333. (gdb)
  27334. Here's an example of the result when there are no breakpoints:
  27335. (gdb)
  27336. -break-list
  27337. ^done,BreakpointTable={nr_rows="0",nr_cols="6",
  27338. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27339. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27340. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27341. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27342. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27343. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27344. body=[]}
  27345. (gdb)
  27346. The '-break-passcount' Command
  27347. ------------------------------
  27348. Synopsis
  27349. ........
  27350. -break-passcount TRACEPOINT-NUMBER PASSCOUNT
  27351. Set the passcount for tracepoint TRACEPOINT-NUMBER to PASSCOUNT. If
  27352. the breakpoint referred to by TRACEPOINT-NUMBER is not a tracepoint,
  27353. error is emitted. This corresponds to CLI command 'passcount'.
  27354. The '-break-watch' Command
  27355. --------------------------
  27356. Synopsis
  27357. ........
  27358. -break-watch [ -a | -r ]
  27359. Create a watchpoint. With the '-a' option it will create an "access"
  27360. watchpoint, i.e., a watchpoint that triggers either on a read from or on
  27361. a write to the memory location. With the '-r' option, the watchpoint
  27362. created is a "read" watchpoint, i.e., it will trigger only when the
  27363. memory location is accessed for reading. Without either of the options,
  27364. the watchpoint created is a regular watchpoint, i.e., it will trigger
  27365. when the memory location is accessed for writing. *Note Setting
  27366. Watchpoints: Set Watchpoints.
  27367. Note that '-break-list' will report a single list of watchpoints and
  27368. breakpoints inserted.
  27369. GDB Command
  27370. ...........
  27371. The corresponding GDB commands are 'watch', 'awatch', and 'rwatch'.
  27372. Example
  27373. .......
  27374. Setting a watchpoint on a variable in the 'main' function:
  27375. (gdb)
  27376. -break-watch x
  27377. ^done,wpt={number="2",exp="x"}
  27378. (gdb)
  27379. -exec-continue
  27380. ^running
  27381. (gdb)
  27382. *stopped,reason="watchpoint-trigger",wpt={number="2",exp="x"},
  27383. value={old="-268439212",new="55"},
  27384. frame={func="main",args=[],file="recursive2.c",
  27385. fullname="/home/foo/bar/recursive2.c",line="5",arch="i386:x86_64"}
  27386. (gdb)
  27387. Setting a watchpoint on a variable local to a function. GDB will
  27388. stop the program execution twice: first for the variable changing value,
  27389. then for the watchpoint going out of scope.
  27390. (gdb)
  27391. -break-watch C
  27392. ^done,wpt={number="5",exp="C"}
  27393. (gdb)
  27394. -exec-continue
  27395. ^running
  27396. (gdb)
  27397. *stopped,reason="watchpoint-trigger",
  27398. wpt={number="5",exp="C"},value={old="-276895068",new="3"},
  27399. frame={func="callee4",args=[],
  27400. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27401. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",
  27402. arch="i386:x86_64"}
  27403. (gdb)
  27404. -exec-continue
  27405. ^running
  27406. (gdb)
  27407. *stopped,reason="watchpoint-scope",wpnum="5",
  27408. frame={func="callee3",args=[{name="strarg",
  27409. value="0x11940 \"A string argument.\""}],
  27410. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27411. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  27412. arch="i386:x86_64"}
  27413. (gdb)
  27414. Listing breakpoints and watchpoints, at different points in the
  27415. program execution. Note that once the watchpoint goes out of scope, it
  27416. is deleted.
  27417. (gdb)
  27418. -break-watch C
  27419. ^done,wpt={number="2",exp="C"}
  27420. (gdb)
  27421. -break-list
  27422. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  27423. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27424. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27425. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27426. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27427. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27428. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27429. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27430. addr="0x00010734",func="callee4",
  27431. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27432. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c"line="8",thread-groups=["i1"],
  27433. times="1"},
  27434. bkpt={number="2",type="watchpoint",disp="keep",
  27435. enabled="y",addr="",what="C",thread-groups=["i1"],times="0"}]}
  27436. (gdb)
  27437. -exec-continue
  27438. ^running
  27439. (gdb)
  27440. *stopped,reason="watchpoint-trigger",wpt={number="2",exp="C"},
  27441. value={old="-276895068",new="3"},
  27442. frame={func="callee4",args=[],
  27443. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27444. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",
  27445. arch="i386:x86_64"}
  27446. (gdb)
  27447. -break-list
  27448. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  27449. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27450. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27451. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27452. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27453. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27454. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27455. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27456. addr="0x00010734",func="callee4",
  27457. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27458. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",thread-groups=["i1"],
  27459. times="1"},
  27460. bkpt={number="2",type="watchpoint",disp="keep",
  27461. enabled="y",addr="",what="C",thread-groups=["i1"],times="-5"}]}
  27462. (gdb)
  27463. -exec-continue
  27464. ^running
  27465. ^done,reason="watchpoint-scope",wpnum="2",
  27466. frame={func="callee3",args=[{name="strarg",
  27467. value="0x11940 \"A string argument.\""}],
  27468. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27469. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  27470. arch="i386:x86_64"}
  27471. (gdb)
  27472. -break-list
  27473. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  27474. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27475. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27476. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27477. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27478. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27479. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27480. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27481. addr="0x00010734",func="callee4",
  27482. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27483. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  27484. thread-groups=["i1"],times="1"}]}
  27485. (gdb)
  27486. 
  27487. File: gdb.info, Node: GDB/MI Catchpoint Commands, Next: GDB/MI Program Context, Prev: GDB/MI Breakpoint Commands, Up: GDB/MI
  27488. 27.9 GDB/MI Catchpoint Commands
  27489. ===============================
  27490. This section documents GDB/MI commands for manipulating catchpoints.
  27491. * Menu:
  27492. * Shared Library GDB/MI Catchpoint Commands::
  27493. * Ada Exception GDB/MI Catchpoint Commands::
  27494. * C++ Exception GDB/MI Catchpoint Commands::
  27495. 
  27496. File: gdb.info, Node: Shared Library GDB/MI Catchpoint Commands, Next: Ada Exception GDB/MI Catchpoint Commands, Up: GDB/MI Catchpoint Commands
  27497. 27.9.1 Shared Library GDB/MI Catchpoints
  27498. ----------------------------------------
  27499. The '-catch-load' Command
  27500. -------------------------
  27501. Synopsis
  27502. ........
  27503. -catch-load [ -t ] [ -d ] REGEXP
  27504. Add a catchpoint for library load events. If the '-t' option is
  27505. used, the catchpoint is a temporary one (*note Setting Breakpoints: Set
  27506. Breaks.). If the '-d' option is used, the catchpoint is created in a
  27507. disabled state. The 'regexp' argument is a regular expression used to
  27508. match the name of the loaded library.
  27509. GDB Command
  27510. ...........
  27511. The corresponding GDB command is 'catch load'.
  27512. Example
  27513. .......
  27514. -catch-load -t foo.so
  27515. ^done,bkpt={number="1",type="catchpoint",disp="del",enabled="y",
  27516. what="load of library matching foo.so",catch-type="load",times="0"}
  27517. (gdb)
  27518. The '-catch-unload' Command
  27519. ---------------------------
  27520. Synopsis
  27521. ........
  27522. -catch-unload [ -t ] [ -d ] REGEXP
  27523. Add a catchpoint for library unload events. If the '-t' option is
  27524. used, the catchpoint is a temporary one (*note Setting Breakpoints: Set
  27525. Breaks.). If the '-d' option is used, the catchpoint is created in a
  27526. disabled state. The 'regexp' argument is a regular expression used to
  27527. match the name of the unloaded library.
  27528. GDB Command
  27529. ...........
  27530. The corresponding GDB command is 'catch unload'.
  27531. Example
  27532. .......
  27533. -catch-unload -d bar.so
  27534. ^done,bkpt={number="2",type="catchpoint",disp="keep",enabled="n",
  27535. what="load of library matching bar.so",catch-type="unload",times="0"}
  27536. (gdb)
  27537. 
  27538. 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
  27539. 27.9.2 Ada Exception GDB/MI Catchpoints
  27540. ---------------------------------------
  27541. The following GDB/MI commands can be used to create catchpoints that
  27542. stop the execution when Ada exceptions are being raised.
  27543. The '-catch-assert' Command
  27544. ---------------------------
  27545. Synopsis
  27546. ........
  27547. -catch-assert [ -c CONDITION] [ -d ] [ -t ]
  27548. Add a catchpoint for failed Ada assertions.
  27549. The possible optional parameters for this command are:
  27550. '-c CONDITION'
  27551. Make the catchpoint conditional on CONDITION.
  27552. '-d'
  27553. Create a disabled catchpoint.
  27554. '-t'
  27555. Create a temporary catchpoint.
  27556. GDB Command
  27557. ...........
  27558. The corresponding GDB command is 'catch assert'.
  27559. Example
  27560. .......
  27561. -catch-assert
  27562. ^done,bkptno="5",bkpt={number="5",type="breakpoint",disp="keep",
  27563. enabled="y",addr="0x0000000000404888",what="failed Ada assertions",
  27564. thread-groups=["i1"],times="0",
  27565. original-location="__gnat_debug_raise_assert_failure"}
  27566. (gdb)
  27567. The '-catch-exception' Command
  27568. ------------------------------
  27569. Synopsis
  27570. ........
  27571. -catch-exception [ -c CONDITION] [ -d ] [ -e EXCEPTION-NAME ]
  27572. [ -t ] [ -u ]
  27573. Add a catchpoint stopping when Ada exceptions are raised. By
  27574. default, the command stops the program when any Ada exception gets
  27575. raised. But it is also possible, by using some of the optional
  27576. parameters described below, to create more selective catchpoints.
  27577. The possible optional parameters for this command are:
  27578. '-c CONDITION'
  27579. Make the catchpoint conditional on CONDITION.
  27580. '-d'
  27581. Create a disabled catchpoint.
  27582. '-e EXCEPTION-NAME'
  27583. Only stop when EXCEPTION-NAME is raised. This option cannot be
  27584. used combined with '-u'.
  27585. '-t'
  27586. Create a temporary catchpoint.
  27587. '-u'
  27588. Stop only when an unhandled exception gets raised. This option
  27589. cannot be used combined with '-e'.
  27590. GDB Command
  27591. ...........
  27592. The corresponding GDB commands are 'catch exception' and 'catch
  27593. exception unhandled'.
  27594. Example
  27595. .......
  27596. -catch-exception -e Program_Error
  27597. ^done,bkptno="4",bkpt={number="4",type="breakpoint",disp="keep",
  27598. enabled="y",addr="0x0000000000404874",
  27599. what="`Program_Error' Ada exception", thread-groups=["i1"],
  27600. times="0",original-location="__gnat_debug_raise_exception"}
  27601. (gdb)
  27602. The '-catch-handlers' Command
  27603. -----------------------------
  27604. Synopsis
  27605. ........
  27606. -catch-handlers [ -c CONDITION] [ -d ] [ -e EXCEPTION-NAME ]
  27607. [ -t ]
  27608. Add a catchpoint stopping when Ada exceptions are handled. By
  27609. default, the command stops the program when any Ada exception gets
  27610. handled. But it is also possible, by using some of the optional
  27611. parameters described below, to create more selective catchpoints.
  27612. The possible optional parameters for this command are:
  27613. '-c CONDITION'
  27614. Make the catchpoint conditional on CONDITION.
  27615. '-d'
  27616. Create a disabled catchpoint.
  27617. '-e EXCEPTION-NAME'
  27618. Only stop when EXCEPTION-NAME is handled.
  27619. '-t'
  27620. Create a temporary catchpoint.
  27621. GDB Command
  27622. ...........
  27623. The corresponding GDB command is 'catch handlers'.
  27624. Example
  27625. .......
  27626. -catch-handlers -e Constraint_Error
  27627. ^done,bkptno="4",bkpt={number="4",type="breakpoint",disp="keep",
  27628. enabled="y",addr="0x0000000000402f68",
  27629. what="`Constraint_Error' Ada exception handlers",thread-groups=["i1"],
  27630. times="0",original-location="__gnat_begin_handler"}
  27631. (gdb)
  27632. 
  27633. File: gdb.info, Node: C++ Exception GDB/MI Catchpoint Commands, Prev: Ada Exception GDB/MI Catchpoint Commands, Up: GDB/MI Catchpoint Commands
  27634. 27.9.3 C++ Exception GDB/MI Catchpoints
  27635. ---------------------------------------
  27636. The following GDB/MI commands can be used to create catchpoints that
  27637. stop the execution when C++ exceptions are being throw, rethrown, or
  27638. caught.
  27639. The '-catch-throw' Command
  27640. --------------------------
  27641. Synopsis
  27642. ........
  27643. -catch-throw [ -t ] [ -r REGEXP]
  27644. Stop when the debuggee throws a C++ exception. If REGEXP is given,
  27645. then only exceptions whose type matches the regular expression will be
  27646. caught.
  27647. If '-t' is given, then the catchpoint is enabled only for one stop,
  27648. the catchpoint is automatically deleted after stopping once for the
  27649. event.
  27650. GDB Command
  27651. ...........
  27652. The corresponding GDB commands are 'catch throw' and 'tcatch throw'
  27653. (*note Set Catchpoints::).
  27654. Example
  27655. .......
  27656. -catch-throw -r exception_type
  27657. ^done,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",
  27658. what="exception throw",catch-type="throw",
  27659. thread-groups=["i1"],
  27660. regexp="exception_type",times="0"}
  27661. (gdb)
  27662. -exec-run
  27663. ^running
  27664. (gdb)
  27665. ~"\n"
  27666. ~"Catchpoint 1 (exception thrown), 0x00007ffff7ae00ed
  27667. in __cxa_throw () from /lib64/libstdc++.so.6\n"
  27668. *stopped,bkptno="1",reason="breakpoint-hit",disp="keep",
  27669. frame={addr="0x00007ffff7ae00ed",func="__cxa_throw",
  27670. args=[],from="/lib64/libstdc++.so.6",arch="i386:x86-64"},
  27671. thread-id="1",stopped-threads="all",core="6"
  27672. (gdb)
  27673. The '-catch-rethrow' Command
  27674. ----------------------------
  27675. Synopsis
  27676. ........
  27677. -catch-rethrow [ -t ] [ -r REGEXP]
  27678. Stop when a C++ exception is re-thrown. If REGEXP is given, then
  27679. only exceptions whose type matches the regular expression will be
  27680. caught.
  27681. If '-t' is given, then the catchpoint is enabled only for one stop,
  27682. the catchpoint is automatically deleted after the first event is caught.
  27683. GDB Command
  27684. ...........
  27685. The corresponding GDB commands are 'catch rethrow' and 'tcatch rethrow'
  27686. (*note Set Catchpoints::).
  27687. Example
  27688. .......
  27689. -catch-rethrow -r exception_type
  27690. ^done,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",
  27691. what="exception rethrow",catch-type="rethrow",
  27692. thread-groups=["i1"],
  27693. regexp="exception_type",times="0"}
  27694. (gdb)
  27695. -exec-run
  27696. ^running
  27697. (gdb)
  27698. ~"\n"
  27699. ~"Catchpoint 1 (exception rethrown), 0x00007ffff7ae00ed
  27700. in __cxa_rethrow () from /lib64/libstdc++.so.6\n"
  27701. *stopped,bkptno="1",reason="breakpoint-hit",disp="keep",
  27702. frame={addr="0x00007ffff7ae00ed",func="__cxa_rethrow",
  27703. args=[],from="/lib64/libstdc++.so.6",arch="i386:x86-64"},
  27704. thread-id="1",stopped-threads="all",core="6"
  27705. (gdb)
  27706. The '-catch-catch' Command
  27707. --------------------------
  27708. Synopsis
  27709. ........
  27710. -catch-catch [ -t ] [ -r REGEXP]
  27711. Stop when the debuggee catches a C++ exception. If REGEXP is given,
  27712. then only exceptions whose type matches the regular expression will be
  27713. caught.
  27714. If '-t' is given, then the catchpoint is enabled only for one stop,
  27715. the catchpoint is automatically deleted after the first event is caught.
  27716. GDB Command
  27717. ...........
  27718. The corresponding GDB commands are 'catch catch' and 'tcatch catch'
  27719. (*note Set Catchpoints::).
  27720. Example
  27721. .......
  27722. -catch-catch -r exception_type
  27723. ^done,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",
  27724. what="exception catch",catch-type="catch",
  27725. thread-groups=["i1"],
  27726. regexp="exception_type",times="0"}
  27727. (gdb)
  27728. -exec-run
  27729. ^running
  27730. (gdb)
  27731. ~"\n"
  27732. ~"Catchpoint 1 (exception caught), 0x00007ffff7ae00ed
  27733. in __cxa_begin_catch () from /lib64/libstdc++.so.6\n"
  27734. *stopped,bkptno="1",reason="breakpoint-hit",disp="keep",
  27735. frame={addr="0x00007ffff7ae00ed",func="__cxa_begin_catch",
  27736. args=[],from="/lib64/libstdc++.so.6",arch="i386:x86-64"},
  27737. thread-id="1",stopped-threads="all",core="6"
  27738. (gdb)
  27739. 
  27740. File: gdb.info, Node: GDB/MI Program Context, Next: GDB/MI Thread Commands, Prev: GDB/MI Catchpoint Commands, Up: GDB/MI
  27741. 27.10 GDB/MI Program Context
  27742. ============================
  27743. The '-exec-arguments' Command
  27744. -----------------------------
  27745. Synopsis
  27746. ........
  27747. -exec-arguments ARGS
  27748. Set the inferior program arguments, to be used in the next
  27749. '-exec-run'.
  27750. GDB Command
  27751. ...........
  27752. The corresponding GDB command is 'set args'.
  27753. Example
  27754. .......
  27755. (gdb)
  27756. -exec-arguments -v word
  27757. ^done
  27758. (gdb)
  27759. The '-environment-cd' Command
  27760. -----------------------------
  27761. Synopsis
  27762. ........
  27763. -environment-cd PATHDIR
  27764. Set GDB's working directory.
  27765. GDB Command
  27766. ...........
  27767. The corresponding GDB command is 'cd'.
  27768. Example
  27769. .......
  27770. (gdb)
  27771. -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
  27772. ^done
  27773. (gdb)
  27774. The '-environment-directory' Command
  27775. ------------------------------------
  27776. Synopsis
  27777. ........
  27778. -environment-directory [ -r ] [ PATHDIR ]+
  27779. Add directories PATHDIR to beginning of search path for source files.
  27780. If the '-r' option is used, the search path is reset to the default
  27781. search path. If directories PATHDIR are supplied in addition to the
  27782. '-r' option, the search path is first reset and then addition occurs as
  27783. normal. Multiple directories may be specified, separated by blanks.
  27784. Specifying multiple directories in a single command results in the
  27785. directories added to the beginning of the search path in the same order
  27786. they were presented in the command. If blanks are needed as part of a
  27787. directory name, double-quotes should be used around the name. In the
  27788. command output, the path will show up separated by the system
  27789. directory-separator character. The directory-separator character must
  27790. not be used in any directory name. If no directories are specified, the
  27791. current search path is displayed.
  27792. GDB Command
  27793. ...........
  27794. The corresponding GDB command is 'dir'.
  27795. Example
  27796. .......
  27797. (gdb)
  27798. -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
  27799. ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
  27800. (gdb)
  27801. -environment-directory ""
  27802. ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
  27803. (gdb)
  27804. -environment-directory -r /home/jjohnstn/src/gdb /usr/src
  27805. ^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
  27806. (gdb)
  27807. -environment-directory -r
  27808. ^done,source-path="$cdir:$cwd"
  27809. (gdb)
  27810. The '-environment-path' Command
  27811. -------------------------------
  27812. Synopsis
  27813. ........
  27814. -environment-path [ -r ] [ PATHDIR ]+
  27815. Add directories PATHDIR to beginning of search path for object files.
  27816. If the '-r' option is used, the search path is reset to the original
  27817. search path that existed at gdb start-up. If directories PATHDIR are
  27818. supplied in addition to the '-r' option, the search path is first reset
  27819. and then addition occurs as normal. Multiple directories may be
  27820. specified, separated by blanks. Specifying multiple directories in a
  27821. single command results in the directories added to the beginning of the
  27822. search path in the same order they were presented in the command. If
  27823. blanks are needed as part of a directory name, double-quotes should be
  27824. used around the name. In the command output, the path will show up
  27825. separated by the system directory-separator character. The
  27826. directory-separator character must not be used in any directory name.
  27827. If no directories are specified, the current path is displayed.
  27828. GDB Command
  27829. ...........
  27830. The corresponding GDB command is 'path'.
  27831. Example
  27832. .......
  27833. (gdb)
  27834. -environment-path
  27835. ^done,path="/usr/bin"
  27836. (gdb)
  27837. -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
  27838. ^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
  27839. (gdb)
  27840. -environment-path -r /usr/local/bin
  27841. ^done,path="/usr/local/bin:/usr/bin"
  27842. (gdb)
  27843. The '-environment-pwd' Command
  27844. ------------------------------
  27845. Synopsis
  27846. ........
  27847. -environment-pwd
  27848. Show the current working directory.
  27849. GDB Command
  27850. ...........
  27851. The corresponding GDB command is 'pwd'.
  27852. Example
  27853. .......
  27854. (gdb)
  27855. -environment-pwd
  27856. ^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
  27857. (gdb)
  27858. 
  27859. File: gdb.info, Node: GDB/MI Thread Commands, Next: GDB/MI Ada Tasking Commands, Prev: GDB/MI Program Context, Up: GDB/MI
  27860. 27.11 GDB/MI Thread Commands
  27861. ============================
  27862. The '-thread-info' Command
  27863. --------------------------
  27864. Synopsis
  27865. ........
  27866. -thread-info [ THREAD-ID ]
  27867. Reports information about either a specific thread, if the THREAD-ID
  27868. parameter is present, or about all threads. THREAD-ID is the thread's
  27869. global thread ID. When printing information about all threads, also
  27870. reports the global ID of the current thread.
  27871. GDB Command
  27872. ...........
  27873. The 'info thread' command prints the same information about all threads.
  27874. Result
  27875. ......
  27876. The result contains the following attributes:
  27877. 'threads'
  27878. A list of threads. The format of the elements of the list is
  27879. described in *note GDB/MI Thread Information::.
  27880. 'current-thread-id'
  27881. The global id of the currently selected thread. This field is
  27882. omitted if there is no selected thread (for example, when the
  27883. selected inferior is not running, and therefore has no threads) or
  27884. if a THREAD-ID argument was passed to the command.
  27885. Example
  27886. .......
  27887. -thread-info
  27888. ^done,threads=[
  27889. {id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
  27890. frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",
  27891. args=[]},state="running"},
  27892. {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
  27893. frame={level="0",addr="0x0804891f",func="foo",
  27894. args=[{name="i",value="10"}],
  27895. file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"},
  27896. state="running"}],
  27897. current-thread-id="1"
  27898. (gdb)
  27899. The '-thread-list-ids' Command
  27900. ------------------------------
  27901. Synopsis
  27902. ........
  27903. -thread-list-ids
  27904. Produces a list of the currently known global GDB thread ids. At the
  27905. end of the list it also prints the total number of such threads.
  27906. This command is retained for historical reasons, the '-thread-info'
  27907. command should be used instead.
  27908. GDB Command
  27909. ...........
  27910. Part of 'info threads' supplies the same information.
  27911. Example
  27912. .......
  27913. (gdb)
  27914. -thread-list-ids
  27915. ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},
  27916. current-thread-id="1",number-of-threads="3"
  27917. (gdb)
  27918. The '-thread-select' Command
  27919. ----------------------------
  27920. Synopsis
  27921. ........
  27922. -thread-select THREAD-ID
  27923. Make thread with global thread number THREAD-ID the current thread.
  27924. It prints the number of the new current thread, and the topmost frame
  27925. for that thread.
  27926. This command is deprecated in favor of explicitly using the
  27927. '--thread' option to each command.
  27928. GDB Command
  27929. ...........
  27930. The corresponding GDB command is 'thread'.
  27931. Example
  27932. .......
  27933. (gdb)
  27934. -exec-next
  27935. ^running
  27936. (gdb)
  27937. *stopped,reason="end-stepping-range",thread-id="2",line="187",
  27938. file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
  27939. (gdb)
  27940. -thread-list-ids
  27941. ^done,
  27942. thread-ids={thread-id="3",thread-id="2",thread-id="1"},
  27943. number-of-threads="3"
  27944. (gdb)
  27945. -thread-select 3
  27946. ^done,new-thread-id="3",
  27947. frame={level="0",func="vprintf",
  27948. args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""},
  27949. {name="arg",value="0x2"}],file="vprintf.c",line="31",arch="i386:x86_64"}
  27950. (gdb)
  27951. 
  27952. File: gdb.info, Node: GDB/MI Ada Tasking Commands, Next: GDB/MI Program Execution, Prev: GDB/MI Thread Commands, Up: GDB/MI
  27953. 27.12 GDB/MI Ada Tasking Commands
  27954. =================================
  27955. The '-ada-task-info' Command
  27956. ----------------------------
  27957. Synopsis
  27958. ........
  27959. -ada-task-info [ TASK-ID ]
  27960. Reports information about either a specific Ada task, if the TASK-ID
  27961. parameter is present, or about all Ada tasks.
  27962. GDB Command
  27963. ...........
  27964. The 'info tasks' command prints the same information about all Ada tasks
  27965. (*note Ada Tasks::).
  27966. Result
  27967. ......
  27968. The result is a table of Ada tasks. The following columns are defined
  27969. for each Ada task:
  27970. 'current'
  27971. This field exists only for the current thread. It has the value
  27972. '*'.
  27973. 'id'
  27974. The identifier that GDB uses to refer to the Ada task.
  27975. 'task-id'
  27976. The identifier that the target uses to refer to the Ada task.
  27977. 'thread-id'
  27978. The global thread identifier of the thread corresponding to the Ada
  27979. task.
  27980. This field should always exist, as Ada tasks are always implemented
  27981. on top of a thread. But if GDB cannot find this corresponding
  27982. thread for any reason, the field is omitted.
  27983. 'parent-id'
  27984. This field exists only when the task was created by another task.
  27985. In this case, it provides the ID of the parent task.
  27986. 'priority'
  27987. The base priority of the task.
  27988. 'state'
  27989. The current state of the task. For a detailed description of the
  27990. possible states, see *note Ada Tasks::.
  27991. 'name'
  27992. The name of the task.
  27993. Example
  27994. .......
  27995. -ada-task-info
  27996. ^done,tasks={nr_rows="3",nr_cols="8",
  27997. hdr=[{width="1",alignment="-1",col_name="current",colhdr=""},
  27998. {width="3",alignment="1",col_name="id",colhdr="ID"},
  27999. {width="9",alignment="1",col_name="task-id",colhdr="TID"},
  28000. {width="4",alignment="1",col_name="thread-id",colhdr=""},
  28001. {width="4",alignment="1",col_name="parent-id",colhdr="P-ID"},
  28002. {width="3",alignment="1",col_name="priority",colhdr="Pri"},
  28003. {width="22",alignment="-1",col_name="state",colhdr="State"},
  28004. {width="1",alignment="2",col_name="name",colhdr="Name"}],
  28005. body=[{current="*",id="1",task-id=" 644010",thread-id="1",priority="48",
  28006. state="Child Termination Wait",name="main_task"}]}
  28007. (gdb)
  28008. 
  28009. File: gdb.info, Node: GDB/MI Program Execution, Next: GDB/MI Stack Manipulation, Prev: GDB/MI Ada Tasking Commands, Up: GDB/MI
  28010. 27.13 GDB/MI Program Execution
  28011. ==============================
  28012. These are the asynchronous commands which generate the out-of-band
  28013. record '*stopped'. Currently GDB only really executes asynchronously
  28014. with remote targets and this interaction is mimicked in other cases.
  28015. The '-exec-continue' Command
  28016. ----------------------------
  28017. Synopsis
  28018. ........
  28019. -exec-continue [--reverse] [--all|--thread-group N]
  28020. Resumes the execution of the inferior program, which will continue to
  28021. execute until it reaches a debugger stop event. If the '--reverse'
  28022. option is specified, execution resumes in reverse until it reaches a
  28023. stop event. Stop events may include
  28024. * breakpoints or watchpoints
  28025. * signals or exceptions
  28026. * the end of the process (or its beginning under '--reverse')
  28027. * the end or beginning of a replay log if one is being used.
  28028. In all-stop mode (*note All-Stop Mode::), may resume only one thread,
  28029. or all threads, depending on the value of the 'scheduler-locking'
  28030. variable. If '--all' is specified, all threads (in all inferiors) will
  28031. be resumed. The '--all' option is ignored in all-stop mode. If the
  28032. '--thread-group' options is specified, then all threads in that thread
  28033. group are resumed.
  28034. GDB Command
  28035. ...........
  28036. The corresponding GDB corresponding is 'continue'.
  28037. Example
  28038. .......
  28039. -exec-continue
  28040. ^running
  28041. (gdb)
  28042. @Hello world
  28043. *stopped,reason="breakpoint-hit",disp="keep",bkptno="2",frame={
  28044. func="foo",args=[],file="hello.c",fullname="/home/foo/bar/hello.c",
  28045. line="13",arch="i386:x86_64"}
  28046. (gdb)
  28047. The '-exec-finish' Command
  28048. --------------------------
  28049. Synopsis
  28050. ........
  28051. -exec-finish [--reverse]
  28052. Resumes the execution of the inferior program until the current
  28053. function is exited. Displays the results returned by the function. If
  28054. the '--reverse' option is specified, resumes the reverse execution of
  28055. the inferior program until the point where current function was called.
  28056. GDB Command
  28057. ...........
  28058. The corresponding GDB command is 'finish'.
  28059. Example
  28060. .......
  28061. Function returning 'void'.
  28062. -exec-finish
  28063. ^running
  28064. (gdb)
  28065. @hello from foo
  28066. *stopped,reason="function-finished",frame={func="main",args=[],
  28067. file="hello.c",fullname="/home/foo/bar/hello.c",line="7",arch="i386:x86_64"}
  28068. (gdb)
  28069. Function returning other than 'void'. The name of the internal GDB
  28070. variable storing the result is printed, together with the value itself.
  28071. -exec-finish
  28072. ^running
  28073. (gdb)
  28074. *stopped,reason="function-finished",frame={addr="0x000107b0",func="foo",
  28075. args=[{name="a",value="1"],{name="b",value="9"}},
  28076. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28077. arch="i386:x86_64"},
  28078. gdb-result-var="$1",return-value="0"
  28079. (gdb)
  28080. The '-exec-interrupt' Command
  28081. -----------------------------
  28082. Synopsis
  28083. ........
  28084. -exec-interrupt [--all|--thread-group N]
  28085. Interrupts the background execution of the target. Note how the
  28086. token associated with the stop message is the one for the execution
  28087. command that has been interrupted. The token for the interrupt itself
  28088. only appears in the '^done' output. If the user is trying to interrupt
  28089. a non-running program, an error message will be printed.
  28090. Note that when asynchronous execution is enabled, this command is
  28091. asynchronous just like other execution commands. That is, first the
  28092. '^done' response will be printed, and the target stop will be reported
  28093. after that using the '*stopped' notification.
  28094. In non-stop mode, only the context thread is interrupted by default.
  28095. All threads (in all inferiors) will be interrupted if the '--all' option
  28096. is specified. If the '--thread-group' option is specified, all threads
  28097. in that group will be interrupted.
  28098. GDB Command
  28099. ...........
  28100. The corresponding GDB command is 'interrupt'.
  28101. Example
  28102. .......
  28103. (gdb)
  28104. 111-exec-continue
  28105. 111^running
  28106. (gdb)
  28107. 222-exec-interrupt
  28108. 222^done
  28109. (gdb)
  28110. 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
  28111. frame={addr="0x00010140",func="foo",args=[],file="try.c",
  28112. fullname="/home/foo/bar/try.c",line="13",arch="i386:x86_64"}
  28113. (gdb)
  28114. (gdb)
  28115. -exec-interrupt
  28116. ^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
  28117. (gdb)
  28118. The '-exec-jump' Command
  28119. ------------------------
  28120. Synopsis
  28121. ........
  28122. -exec-jump LOCATION
  28123. Resumes execution of the inferior program at the location specified
  28124. by parameter. *Note Specify Location::, for a description of the
  28125. different forms of LOCATION.
  28126. GDB Command
  28127. ...........
  28128. The corresponding GDB command is 'jump'.
  28129. Example
  28130. .......
  28131. -exec-jump foo.c:10
  28132. *running,thread-id="all"
  28133. ^running
  28134. The '-exec-next' Command
  28135. ------------------------
  28136. Synopsis
  28137. ........
  28138. -exec-next [--reverse]
  28139. Resumes execution of the inferior program, stopping when the
  28140. beginning of the next source line is reached.
  28141. If the '--reverse' option is specified, resumes reverse execution of
  28142. the inferior program, stopping at the beginning of the previous source
  28143. line. If you issue this command on the first line of a function, it
  28144. will take you back to the caller of that function, to the source line
  28145. where the function was called.
  28146. GDB Command
  28147. ...........
  28148. The corresponding GDB command is 'next'.
  28149. Example
  28150. .......
  28151. -exec-next
  28152. ^running
  28153. (gdb)
  28154. *stopped,reason="end-stepping-range",line="8",file="hello.c"
  28155. (gdb)
  28156. The '-exec-next-instruction' Command
  28157. ------------------------------------
  28158. Synopsis
  28159. ........
  28160. -exec-next-instruction [--reverse]
  28161. Executes one machine instruction. If the instruction is a function
  28162. call, continues until the function returns. If the program stops at an
  28163. instruction in the middle of a source line, the address will be printed
  28164. as well.
  28165. If the '--reverse' option is specified, resumes reverse execution of
  28166. the inferior program, stopping at the previous instruction. If the
  28167. previously executed instruction was a return from another function, it
  28168. will continue to execute in reverse until the call to that function
  28169. (from the current stack frame) is reached.
  28170. GDB Command
  28171. ...........
  28172. The corresponding GDB command is 'nexti'.
  28173. Example
  28174. .......
  28175. (gdb)
  28176. -exec-next-instruction
  28177. ^running
  28178. (gdb)
  28179. *stopped,reason="end-stepping-range",
  28180. addr="0x000100d4",line="5",file="hello.c"
  28181. (gdb)
  28182. The '-exec-return' Command
  28183. --------------------------
  28184. Synopsis
  28185. ........
  28186. -exec-return
  28187. Makes current function return immediately. Doesn't execute the
  28188. inferior. Displays the new current frame.
  28189. GDB Command
  28190. ...........
  28191. The corresponding GDB command is 'return'.
  28192. Example
  28193. .......
  28194. (gdb)
  28195. 200-break-insert callee4
  28196. 200^done,bkpt={number="1",addr="0x00010734",
  28197. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
  28198. (gdb)
  28199. 000-exec-run
  28200. 000^running
  28201. (gdb)
  28202. 000*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
  28203. frame={func="callee4",args=[],
  28204. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28205. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  28206. arch="i386:x86_64"}
  28207. (gdb)
  28208. 205-break-delete
  28209. 205^done
  28210. (gdb)
  28211. 111-exec-return
  28212. 111^done,frame={level="0",func="callee3",
  28213. args=[{name="strarg",
  28214. value="0x11940 \"A string argument.\""}],
  28215. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28216. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  28217. arch="i386:x86_64"}
  28218. (gdb)
  28219. The '-exec-run' Command
  28220. -----------------------
  28221. Synopsis
  28222. ........
  28223. -exec-run [ --all | --thread-group N ] [ --start ]
  28224. Starts execution of the inferior from the beginning. The inferior
  28225. executes until either a breakpoint is encountered or the program exits.
  28226. In the latter case the output will include an exit code, if the program
  28227. has exited exceptionally.
  28228. When neither the '--all' nor the '--thread-group' option is
  28229. specified, the current inferior is started. If the '--thread-group'
  28230. option is specified, it should refer to a thread group of type
  28231. 'process', and that thread group will be started. If the '--all' option
  28232. is specified, then all inferiors will be started.
  28233. Using the '--start' option instructs the debugger to stop the
  28234. execution at the start of the inferior's main subprogram, following the
  28235. same behavior as the 'start' command (*note Starting::).
  28236. GDB Command
  28237. ...........
  28238. The corresponding GDB command is 'run'.
  28239. Examples
  28240. ........
  28241. (gdb)
  28242. -break-insert main
  28243. ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"}
  28244. (gdb)
  28245. -exec-run
  28246. ^running
  28247. (gdb)
  28248. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
  28249. frame={func="main",args=[],file="recursive2.c",
  28250. fullname="/home/foo/bar/recursive2.c",line="4",arch="i386:x86_64"}
  28251. (gdb)
  28252. Program exited normally:
  28253. (gdb)
  28254. -exec-run
  28255. ^running
  28256. (gdb)
  28257. x = 55
  28258. *stopped,reason="exited-normally"
  28259. (gdb)
  28260. Program exited exceptionally:
  28261. (gdb)
  28262. -exec-run
  28263. ^running
  28264. (gdb)
  28265. x = 55
  28266. *stopped,reason="exited",exit-code="01"
  28267. (gdb)
  28268. Another way the program can terminate is if it receives a signal such
  28269. as 'SIGINT'. In this case, GDB/MI displays this:
  28270. (gdb)
  28271. *stopped,reason="exited-signalled",signal-name="SIGINT",
  28272. signal-meaning="Interrupt"
  28273. The '-exec-step' Command
  28274. ------------------------
  28275. Synopsis
  28276. ........
  28277. -exec-step [--reverse]
  28278. Resumes execution of the inferior program, stopping when the
  28279. beginning of the next source line is reached, if the next source line is
  28280. not a function call. If it is, stop at the first instruction of the
  28281. called function. If the '--reverse' option is specified, resumes
  28282. reverse execution of the inferior program, stopping at the beginning of
  28283. the previously executed source line.
  28284. GDB Command
  28285. ...........
  28286. The corresponding GDB command is 'step'.
  28287. Example
  28288. .......
  28289. Stepping into a function:
  28290. -exec-step
  28291. ^running
  28292. (gdb)
  28293. *stopped,reason="end-stepping-range",
  28294. frame={func="foo",args=[{name="a",value="10"},
  28295. {name="b",value="0"}],file="recursive2.c",
  28296. fullname="/home/foo/bar/recursive2.c",line="11",arch="i386:x86_64"}
  28297. (gdb)
  28298. Regular stepping:
  28299. -exec-step
  28300. ^running
  28301. (gdb)
  28302. *stopped,reason="end-stepping-range",line="14",file="recursive2.c"
  28303. (gdb)
  28304. The '-exec-step-instruction' Command
  28305. ------------------------------------
  28306. Synopsis
  28307. ........
  28308. -exec-step-instruction [--reverse]
  28309. Resumes the inferior which executes one machine instruction. If the
  28310. '--reverse' option is specified, resumes reverse execution of the
  28311. inferior program, stopping at the previously executed instruction. The
  28312. output, once GDB has stopped, will vary depending on whether we have
  28313. stopped in the middle of a source line or not. In the former case, the
  28314. address at which the program stopped will be printed as well.
  28315. GDB Command
  28316. ...........
  28317. The corresponding GDB command is 'stepi'.
  28318. Example
  28319. .......
  28320. (gdb)
  28321. -exec-step-instruction
  28322. ^running
  28323. (gdb)
  28324. *stopped,reason="end-stepping-range",
  28325. frame={func="foo",args=[],file="try.c",
  28326. fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"}
  28327. (gdb)
  28328. -exec-step-instruction
  28329. ^running
  28330. (gdb)
  28331. *stopped,reason="end-stepping-range",
  28332. frame={addr="0x000100f4",func="foo",args=[],file="try.c",
  28333. fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"}
  28334. (gdb)
  28335. The '-exec-until' Command
  28336. -------------------------
  28337. Synopsis
  28338. ........
  28339. -exec-until [ LOCATION ]
  28340. Executes the inferior until the LOCATION specified in the argument is
  28341. reached. If there is no argument, the inferior executes until a source
  28342. line greater than the current one is reached. The reason for stopping
  28343. in this case will be 'location-reached'.
  28344. GDB Command
  28345. ...........
  28346. The corresponding GDB command is 'until'.
  28347. Example
  28348. .......
  28349. (gdb)
  28350. -exec-until recursive2.c:6
  28351. ^running
  28352. (gdb)
  28353. x = 55
  28354. *stopped,reason="location-reached",frame={func="main",args=[],
  28355. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6",
  28356. arch="i386:x86_64"}
  28357. (gdb)
  28358. 
  28359. File: gdb.info, Node: GDB/MI Stack Manipulation, Next: GDB/MI Variable Objects, Prev: GDB/MI Program Execution, Up: GDB/MI
  28360. 27.14 GDB/MI Stack Manipulation Commands
  28361. ========================================
  28362. The '-enable-frame-filters' Command
  28363. -----------------------------------
  28364. -enable-frame-filters
  28365. GDB allows Python-based frame filters to affect the output of the MI
  28366. commands relating to stack traces. As there is no way to implement this
  28367. in a fully backward-compatible way, a front end must request that this
  28368. functionality be enabled.
  28369. Once enabled, this feature cannot be disabled.
  28370. Note that if Python support has not been compiled into GDB, this
  28371. command will still succeed (and do nothing).
  28372. The '-stack-info-frame' Command
  28373. -------------------------------
  28374. Synopsis
  28375. ........
  28376. -stack-info-frame
  28377. Get info on the selected frame.
  28378. GDB Command
  28379. ...........
  28380. The corresponding GDB command is 'info frame' or 'frame' (without
  28381. arguments).
  28382. Example
  28383. .......
  28384. (gdb)
  28385. -stack-info-frame
  28386. ^done,frame={level="1",addr="0x0001076c",func="callee3",
  28387. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28388. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",
  28389. arch="i386:x86_64"}
  28390. (gdb)
  28391. The '-stack-info-depth' Command
  28392. -------------------------------
  28393. Synopsis
  28394. ........
  28395. -stack-info-depth [ MAX-DEPTH ]
  28396. Return the depth of the stack. If the integer argument MAX-DEPTH is
  28397. specified, do not count beyond MAX-DEPTH frames.
  28398. GDB Command
  28399. ...........
  28400. There's no equivalent GDB command.
  28401. Example
  28402. .......
  28403. For a stack with frame levels 0 through 11:
  28404. (gdb)
  28405. -stack-info-depth
  28406. ^done,depth="12"
  28407. (gdb)
  28408. -stack-info-depth 4
  28409. ^done,depth="4"
  28410. (gdb)
  28411. -stack-info-depth 12
  28412. ^done,depth="12"
  28413. (gdb)
  28414. -stack-info-depth 11
  28415. ^done,depth="11"
  28416. (gdb)
  28417. -stack-info-depth 13
  28418. ^done,depth="12"
  28419. (gdb)
  28420. The '-stack-list-arguments' Command
  28421. -----------------------------------
  28422. Synopsis
  28423. ........
  28424. -stack-list-arguments [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  28425. [ LOW-FRAME HIGH-FRAME ]
  28426. Display a list of the arguments for the frames between LOW-FRAME and
  28427. HIGH-FRAME (inclusive). If LOW-FRAME and HIGH-FRAME are not provided,
  28428. list the arguments for the whole call stack. If the two arguments are
  28429. equal, show the single frame at the corresponding level. It is an error
  28430. if LOW-FRAME is larger than the actual number of frames. On the other
  28431. hand, HIGH-FRAME may be larger than the actual number of frames, in
  28432. which case only existing frames will be returned.
  28433. If PRINT-VALUES is 0 or '--no-values', print only the names of the
  28434. variables; if it is 1 or '--all-values', print also their values; and if
  28435. it is 2 or '--simple-values', print the name, type and value for simple
  28436. data types, and the name and type for arrays, structures and unions. If
  28437. the option '--no-frame-filters' is supplied, then Python frame filters
  28438. will not be executed.
  28439. If the '--skip-unavailable' option is specified, arguments that are
  28440. not available are not listed. Partially available arguments are still
  28441. displayed, however.
  28442. Use of this command to obtain arguments in a single frame is
  28443. deprecated in favor of the '-stack-list-variables' command.
  28444. GDB Command
  28445. ...........
  28446. GDB does not have an equivalent command. 'gdbtk' has a 'gdb_get_args'
  28447. command which partially overlaps with the functionality of
  28448. '-stack-list-arguments'.
  28449. Example
  28450. .......
  28451. (gdb)
  28452. -stack-list-frames
  28453. ^done,
  28454. stack=[
  28455. frame={level="0",addr="0x00010734",func="callee4",
  28456. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28457. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  28458. arch="i386:x86_64"},
  28459. frame={level="1",addr="0x0001076c",func="callee3",
  28460. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28461. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",
  28462. arch="i386:x86_64"},
  28463. frame={level="2",addr="0x0001078c",func="callee2",
  28464. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28465. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22",
  28466. arch="i386:x86_64"},
  28467. frame={level="3",addr="0x000107b4",func="callee1",
  28468. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28469. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27",
  28470. arch="i386:x86_64"},
  28471. frame={level="4",addr="0x000107e0",func="main",
  28472. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28473. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32",
  28474. arch="i386:x86_64"}]
  28475. (gdb)
  28476. -stack-list-arguments 0
  28477. ^done,
  28478. stack-args=[
  28479. frame={level="0",args=[]},
  28480. frame={level="1",args=[name="strarg"]},
  28481. frame={level="2",args=[name="intarg",name="strarg"]},
  28482. frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]},
  28483. frame={level="4",args=[]}]
  28484. (gdb)
  28485. -stack-list-arguments 1
  28486. ^done,
  28487. stack-args=[
  28488. frame={level="0",args=[]},
  28489. frame={level="1",
  28490. args=[{name="strarg",value="0x11940 \"A string argument.\""}]},
  28491. frame={level="2",args=[
  28492. {name="intarg",value="2"},
  28493. {name="strarg",value="0x11940 \"A string argument.\""}]},
  28494. {frame={level="3",args=[
  28495. {name="intarg",value="2"},
  28496. {name="strarg",value="0x11940 \"A string argument.\""},
  28497. {name="fltarg",value="3.5"}]},
  28498. frame={level="4",args=[]}]
  28499. (gdb)
  28500. -stack-list-arguments 0 2 2
  28501. ^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}]
  28502. (gdb)
  28503. -stack-list-arguments 1 2 2
  28504. ^done,stack-args=[frame={level="2",
  28505. args=[{name="intarg",value="2"},
  28506. {name="strarg",value="0x11940 \"A string argument.\""}]}]
  28507. (gdb)
  28508. The '-stack-list-frames' Command
  28509. --------------------------------
  28510. Synopsis
  28511. ........
  28512. -stack-list-frames [ --no-frame-filters LOW-FRAME HIGH-FRAME ]
  28513. List the frames currently on the stack. For each frame it displays
  28514. the following info:
  28515. 'LEVEL'
  28516. The frame number, 0 being the topmost frame, i.e., the innermost
  28517. function.
  28518. 'ADDR'
  28519. The '$pc' value for that frame.
  28520. 'FUNC'
  28521. Function name.
  28522. 'FILE'
  28523. File name of the source file where the function lives.
  28524. 'FULLNAME'
  28525. The full file name of the source file where the function lives.
  28526. 'LINE'
  28527. Line number corresponding to the '$pc'.
  28528. 'FROM'
  28529. The shared library where this function is defined. This is only
  28530. given if the frame's function is not known.
  28531. 'ARCH'
  28532. Frame's architecture.
  28533. If invoked without arguments, this command prints a backtrace for the
  28534. whole stack. If given two integer arguments, it shows the frames whose
  28535. levels are between the two arguments (inclusive). If the two arguments
  28536. are equal, it shows the single frame at the corresponding level. It is
  28537. an error if LOW-FRAME is larger than the actual number of frames. On
  28538. the other hand, HIGH-FRAME may be larger than the actual number of
  28539. frames, in which case only existing frames will be returned. If the
  28540. option '--no-frame-filters' is supplied, then Python frame filters will
  28541. not be executed.
  28542. GDB Command
  28543. ...........
  28544. The corresponding GDB commands are 'backtrace' and 'where'.
  28545. Example
  28546. .......
  28547. Full stack backtrace:
  28548. (gdb)
  28549. -stack-list-frames
  28550. ^done,stack=
  28551. [frame={level="0",addr="0x0001076c",func="foo",
  28552. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11",
  28553. arch="i386:x86_64"},
  28554. frame={level="1",addr="0x000107a4",func="foo",
  28555. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28556. arch="i386:x86_64"},
  28557. frame={level="2",addr="0x000107a4",func="foo",
  28558. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28559. arch="i386:x86_64"},
  28560. frame={level="3",addr="0x000107a4",func="foo",
  28561. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28562. arch="i386:x86_64"},
  28563. frame={level="4",addr="0x000107a4",func="foo",
  28564. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28565. arch="i386:x86_64"},
  28566. frame={level="5",addr="0x000107a4",func="foo",
  28567. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28568. arch="i386:x86_64"},
  28569. frame={level="6",addr="0x000107a4",func="foo",
  28570. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28571. arch="i386:x86_64"},
  28572. frame={level="7",addr="0x000107a4",func="foo",
  28573. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28574. arch="i386:x86_64"},
  28575. frame={level="8",addr="0x000107a4",func="foo",
  28576. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28577. arch="i386:x86_64"},
  28578. frame={level="9",addr="0x000107a4",func="foo",
  28579. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28580. arch="i386:x86_64"},
  28581. frame={level="10",addr="0x000107a4",func="foo",
  28582. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28583. arch="i386:x86_64"},
  28584. frame={level="11",addr="0x00010738",func="main",
  28585. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4",
  28586. arch="i386:x86_64"}]
  28587. (gdb)
  28588. Show frames between LOW_FRAME and HIGH_FRAME:
  28589. (gdb)
  28590. -stack-list-frames 3 5
  28591. ^done,stack=
  28592. [frame={level="3",addr="0x000107a4",func="foo",
  28593. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28594. arch="i386:x86_64"},
  28595. frame={level="4",addr="0x000107a4",func="foo",
  28596. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28597. arch="i386:x86_64"},
  28598. frame={level="5",addr="0x000107a4",func="foo",
  28599. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28600. arch="i386:x86_64"}]
  28601. (gdb)
  28602. Show a single frame:
  28603. (gdb)
  28604. -stack-list-frames 3 3
  28605. ^done,stack=
  28606. [frame={level="3",addr="0x000107a4",func="foo",
  28607. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28608. arch="i386:x86_64"}]
  28609. (gdb)
  28610. The '-stack-list-locals' Command
  28611. --------------------------------
  28612. Synopsis
  28613. ........
  28614. -stack-list-locals [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  28615. Display the local variable names for the selected frame. If
  28616. PRINT-VALUES is 0 or '--no-values', print only the names of the
  28617. variables; if it is 1 or '--all-values', print also their values; and if
  28618. it is 2 or '--simple-values', print the name, type and value for simple
  28619. data types, and the name and type for arrays, structures and unions. In
  28620. this last case, a frontend can immediately display the value of simple
  28621. data types and create variable objects for other data types when the
  28622. user wishes to explore their values in more detail. If the option
  28623. '--no-frame-filters' is supplied, then Python frame filters will not be
  28624. executed.
  28625. If the '--skip-unavailable' option is specified, local variables that
  28626. are not available are not listed. Partially available local variables
  28627. are still displayed, however.
  28628. This command is deprecated in favor of the '-stack-list-variables'
  28629. command.
  28630. GDB Command
  28631. ...........
  28632. 'info locals' in GDB, 'gdb_get_locals' in 'gdbtk'.
  28633. Example
  28634. .......
  28635. (gdb)
  28636. -stack-list-locals 0
  28637. ^done,locals=[name="A",name="B",name="C"]
  28638. (gdb)
  28639. -stack-list-locals --all-values
  28640. ^done,locals=[{name="A",value="1"},{name="B",value="2"},
  28641. {name="C",value="{1, 2, 3}"}]
  28642. -stack-list-locals --simple-values
  28643. ^done,locals=[{name="A",type="int",value="1"},
  28644. {name="B",type="int",value="2"},{name="C",type="int [3]"}]
  28645. (gdb)
  28646. The '-stack-list-variables' Command
  28647. -----------------------------------
  28648. Synopsis
  28649. ........
  28650. -stack-list-variables [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  28651. Display the names of local variables and function arguments for the
  28652. selected frame. If PRINT-VALUES is 0 or '--no-values', print only the
  28653. names of the variables; if it is 1 or '--all-values', print also their
  28654. values; and if it is 2 or '--simple-values', print the name, type and
  28655. value for simple data types, and the name and type for arrays,
  28656. structures and unions. If the option '--no-frame-filters' is supplied,
  28657. then Python frame filters will not be executed.
  28658. If the '--skip-unavailable' option is specified, local variables and
  28659. arguments that are not available are not listed. Partially available
  28660. arguments and local variables are still displayed, however.
  28661. Example
  28662. .......
  28663. (gdb)
  28664. -stack-list-variables --thread 1 --frame 0 --all-values
  28665. ^done,variables=[{name="x",value="11"},{name="s",value="{a = 1, b = 2}"}]
  28666. (gdb)
  28667. The '-stack-select-frame' Command
  28668. ---------------------------------
  28669. Synopsis
  28670. ........
  28671. -stack-select-frame FRAMENUM
  28672. Change the selected frame. Select a different frame FRAMENUM on the
  28673. stack.
  28674. This command in deprecated in favor of passing the '--frame' option
  28675. to every command.
  28676. GDB Command
  28677. ...........
  28678. The corresponding GDB commands are 'frame', 'up', 'down',
  28679. 'select-frame', 'up-silent', and 'down-silent'.
  28680. Example
  28681. .......
  28682. (gdb)
  28683. -stack-select-frame 2
  28684. ^done
  28685. (gdb)
  28686. 
  28687. File: gdb.info, Node: GDB/MI Variable Objects, Next: GDB/MI Data Manipulation, Prev: GDB/MI Stack Manipulation, Up: GDB/MI
  28688. 27.15 GDB/MI Variable Objects
  28689. =============================
  28690. Introduction to Variable Objects
  28691. --------------------------------
  28692. Variable objects are "object-oriented" MI interface for examining and
  28693. changing values of expressions. Unlike some other MI interfaces that
  28694. work with expressions, variable objects are specifically designed for
  28695. simple and efficient presentation in the frontend. A variable object is
  28696. identified by string name. When a variable object is created, the
  28697. frontend specifies the expression for that variable object. The
  28698. expression can be a simple variable, or it can be an arbitrary complex
  28699. expression, and can even involve CPU registers. After creating a
  28700. variable object, the frontend can invoke other variable object
  28701. operations--for example to obtain or change the value of a variable
  28702. object, or to change display format.
  28703. Variable objects have hierarchical tree structure. Any variable
  28704. object that corresponds to a composite type, such as structure in C, has
  28705. a number of child variable objects, for example corresponding to each
  28706. element of a structure. A child variable object can itself have
  28707. children, recursively. Recursion ends when we reach leaf variable
  28708. objects, which always have built-in types. Child variable objects are
  28709. created only by explicit request, so if a frontend is not interested in
  28710. the children of a particular variable object, no child will be created.
  28711. For a leaf variable object it is possible to obtain its value as a
  28712. string, or set the value from a string. String value can be also
  28713. obtained for a non-leaf variable object, but it's generally a string
  28714. that only indicates the type of the object, and does not list its
  28715. contents. Assignment to a non-leaf variable object is not allowed.
  28716. A frontend does not need to read the values of all variable objects
  28717. each time the program stops. Instead, MI provides an update command
  28718. that lists all variable objects whose values has changed since the last
  28719. update operation. This considerably reduces the amount of data that
  28720. must be transferred to the frontend. As noted above, children variable
  28721. objects are created on demand, and only leaf variable objects have a
  28722. real value. As result, gdb will read target memory only for leaf
  28723. variables that frontend has created.
  28724. The automatic update is not always desirable. For example, a
  28725. frontend might want to keep a value of some expression for future
  28726. reference, and never update it. For another example, fetching memory is
  28727. relatively slow for embedded targets, so a frontend might want to
  28728. disable automatic update for the variables that are either not visible
  28729. on the screen, or "closed". This is possible using so called "frozen
  28730. variable objects". Such variable objects are never implicitly updated.
  28731. Variable objects can be either "fixed" or "floating". For the fixed
  28732. variable object, the expression is parsed when the variable object is
  28733. created, including associating identifiers to specific variables. The
  28734. meaning of expression never changes. For a floating variable object the
  28735. values of variables whose names appear in the expressions are
  28736. re-evaluated every time in the context of the current frame. Consider
  28737. this example:
  28738. void do_work(...)
  28739. {
  28740. struct work_state state;
  28741. if (...)
  28742. do_work(...);
  28743. }
  28744. If a fixed variable object for the 'state' variable is created in
  28745. this function, and we enter the recursive call, the variable object will
  28746. report the value of 'state' in the top-level 'do_work' invocation. On
  28747. the other hand, a floating variable object will report the value of
  28748. 'state' in the current frame.
  28749. If an expression specified when creating a fixed variable object
  28750. refers to a local variable, the variable object becomes bound to the
  28751. thread and frame in which the variable object is created. When such
  28752. variable object is updated, GDB makes sure that the thread/frame
  28753. combination the variable object is bound to still exists, and
  28754. re-evaluates the variable object in context of that thread/frame.
  28755. The following is the complete set of GDB/MI operations defined to
  28756. access this functionality:
  28757. *Operation* *Description*
  28758. '-enable-pretty-printing' enable Python-based pretty-printing
  28759. '-var-create' create a variable object
  28760. '-var-delete' delete the variable object and/or its
  28761. children
  28762. '-var-set-format' set the display format of this variable
  28763. '-var-show-format' show the display format of this variable
  28764. '-var-info-num-children' tells how many children this object has
  28765. '-var-list-children' return a list of the object's children
  28766. '-var-info-type' show the type of this variable object
  28767. '-var-info-expression' print parent-relative expression that
  28768. this variable object represents
  28769. '-var-info-path-expression' print full expression that this variable
  28770. object represents
  28771. '-var-show-attributes' is this variable editable? does it exist
  28772. here?
  28773. '-var-evaluate-expression' get the value of this variable
  28774. '-var-assign' set the value of this variable
  28775. '-var-update' update the variable and its children
  28776. '-var-set-frozen' set frozenness attribute
  28777. '-var-set-update-range' set range of children to display on
  28778. update
  28779. In the next subsection we describe each operation in detail and
  28780. suggest how it can be used.
  28781. Description And Use of Operations on Variable Objects
  28782. -----------------------------------------------------
  28783. The '-enable-pretty-printing' Command
  28784. -------------------------------------
  28785. -enable-pretty-printing
  28786. GDB allows Python-based visualizers to affect the output of the MI
  28787. variable object commands. However, because there was no way to
  28788. implement this in a fully backward-compatible way, a front end must
  28789. request that this functionality be enabled.
  28790. Once enabled, this feature cannot be disabled.
  28791. Note that if Python support has not been compiled into GDB, this
  28792. command will still succeed (and do nothing).
  28793. This feature is currently (as of GDB 7.0) experimental, and may work
  28794. differently in future versions of GDB.
  28795. The '-var-create' Command
  28796. -------------------------
  28797. Synopsis
  28798. ........
  28799. -var-create {NAME | "-"}
  28800. {FRAME-ADDR | "*" | "@"} EXPRESSION
  28801. This operation creates a variable object, which allows the monitoring
  28802. of a variable, the result of an expression, a memory cell or a CPU
  28803. register.
  28804. The NAME parameter is the string by which the object can be
  28805. referenced. It must be unique. If '-' is specified, the varobj system
  28806. will generate a string "varNNNNNN" automatically. It will be unique
  28807. provided that one does not specify NAME of that format. The command
  28808. fails if a duplicate name is found.
  28809. The frame under which the expression should be evaluated can be
  28810. specified by FRAME-ADDR. A '*' indicates that the current frame should
  28811. be used. A '@' indicates that a floating variable object must be
  28812. created.
  28813. EXPRESSION is any expression valid on the current language set (must
  28814. not begin with a '*'), or one of the following:
  28815. * '*ADDR', where ADDR is the address of a memory cell
  28816. * '*ADDR-ADDR' -- a memory address range (TBD)
  28817. * '$REGNAME' -- a CPU register name
  28818. A varobj's contents may be provided by a Python-based pretty-printer.
  28819. In this case the varobj is known as a "dynamic varobj". Dynamic varobjs
  28820. have slightly different semantics in some cases. If the
  28821. '-enable-pretty-printing' command is not sent, then GDB will never
  28822. create a dynamic varobj. This ensures backward compatibility for
  28823. existing clients.
  28824. Result
  28825. ......
  28826. This operation returns attributes of the newly-created varobj. These
  28827. are:
  28828. 'name'
  28829. The name of the varobj.
  28830. 'numchild'
  28831. The number of children of the varobj. This number is not
  28832. necessarily reliable for a dynamic varobj. Instead, you must
  28833. examine the 'has_more' attribute.
  28834. 'value'
  28835. The varobj's scalar value. For a varobj whose type is some sort of
  28836. aggregate (e.g., a 'struct'), or for a dynamic varobj, this value
  28837. will not be interesting.
  28838. 'type'
  28839. The varobj's type. This is a string representation of the type, as
  28840. would be printed by the GDB CLI. If 'print object' (*note set print
  28841. object: Print Settings.) is set to 'on', the _actual_ (derived)
  28842. type of the object is shown rather than the _declared_ one.
  28843. 'thread-id'
  28844. If a variable object is bound to a specific thread, then this is
  28845. the thread's global identifier.
  28846. 'has_more'
  28847. For a dynamic varobj, this indicates whether there appear to be any
  28848. children available. For a non-dynamic varobj, this will be 0.
  28849. 'dynamic'
  28850. This attribute will be present and have the value '1' if the varobj
  28851. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  28852. this attribute will not be present.
  28853. 'displayhint'
  28854. A dynamic varobj can supply a display hint to the front end. The
  28855. value comes directly from the Python pretty-printer object's
  28856. 'display_hint' method. *Note Pretty Printing API::.
  28857. Typical output will look like this:
  28858. name="NAME",numchild="N",type="TYPE",thread-id="M",
  28859. has_more="HAS_MORE"
  28860. The '-var-delete' Command
  28861. -------------------------
  28862. Synopsis
  28863. ........
  28864. -var-delete [ -c ] NAME
  28865. Deletes a previously created variable object and all of its children.
  28866. With the '-c' option, just deletes the children.
  28867. Returns an error if the object NAME is not found.
  28868. The '-var-set-format' Command
  28869. -----------------------------
  28870. Synopsis
  28871. ........
  28872. -var-set-format NAME FORMAT-SPEC
  28873. Sets the output format for the value of the object NAME to be
  28874. FORMAT-SPEC.
  28875. The syntax for the FORMAT-SPEC is as follows:
  28876. FORMAT-SPEC ==>
  28877. {binary | decimal | hexadecimal | octal | natural | zero-hexadecimal}
  28878. The natural format is the default format choosen automatically based
  28879. on the variable type (like decimal for an 'int', hex for pointers,
  28880. etc.).
  28881. The zero-hexadecimal format has a representation similar to
  28882. hexadecimal but with padding zeroes to the left of the value. For
  28883. example, a 32-bit hexadecimal value of 0x1234 would be represented as
  28884. 0x00001234 in the zero-hexadecimal format.
  28885. For a variable with children, the format is set only on the variable
  28886. itself, and the children are not affected.
  28887. The '-var-show-format' Command
  28888. ------------------------------
  28889. Synopsis
  28890. ........
  28891. -var-show-format NAME
  28892. Returns the format used to display the value of the object NAME.
  28893. FORMAT ==>
  28894. FORMAT-SPEC
  28895. The '-var-info-num-children' Command
  28896. ------------------------------------
  28897. Synopsis
  28898. ........
  28899. -var-info-num-children NAME
  28900. Returns the number of children of a variable object NAME:
  28901. numchild=N
  28902. Note that this number is not completely reliable for a dynamic
  28903. varobj. It will return the current number of children, but more
  28904. children may be available.
  28905. The '-var-list-children' Command
  28906. --------------------------------
  28907. Synopsis
  28908. ........
  28909. -var-list-children [PRINT-VALUES] NAME [FROM TO]
  28910. Return a list of the children of the specified variable object and
  28911. create variable objects for them, if they do not already exist. With a
  28912. single argument or if PRINT-VALUES has a value of 0 or '--no-values',
  28913. print only the names of the variables; if PRINT-VALUES is 1 or
  28914. '--all-values', also print their values; and if it is 2 or
  28915. '--simple-values' print the name and value for simple data types and
  28916. just the name for arrays, structures and unions.
  28917. FROM and TO, if specified, indicate the range of children to report.
  28918. If FROM or TO is less than zero, the range is reset and all children
  28919. will be reported. Otherwise, children starting at FROM (zero-based) and
  28920. up to and excluding TO will be reported.
  28921. If a child range is requested, it will only affect the current call
  28922. to '-var-list-children', but not future calls to '-var-update'. For
  28923. this, you must instead use '-var-set-update-range'. The intent of this
  28924. approach is to enable a front end to implement any update approach it
  28925. likes; for example, scrolling a view may cause the front end to request
  28926. more children with '-var-list-children', and then the front end could
  28927. call '-var-set-update-range' with a different range to ensure that
  28928. future updates are restricted to just the visible items.
  28929. For each child the following results are returned:
  28930. NAME
  28931. Name of the variable object created for this child.
  28932. EXP
  28933. The expression to be shown to the user by the front end to
  28934. designate this child. For example this may be the name of a
  28935. structure member.
  28936. For a dynamic varobj, this value cannot be used to form an
  28937. expression. There is no way to do this at all with a dynamic
  28938. varobj.
  28939. For C/C++ structures there are several pseudo children returned to
  28940. designate access qualifiers. For these pseudo children EXP is
  28941. 'public', 'private', or 'protected'. In this case the type and
  28942. value are not present.
  28943. A dynamic varobj will not report the access qualifying
  28944. pseudo-children, regardless of the language. This information is
  28945. not available at all with a dynamic varobj.
  28946. NUMCHILD
  28947. Number of children this child has. For a dynamic varobj, this will
  28948. be 0.
  28949. TYPE
  28950. The type of the child. If 'print object' (*note set print object:
  28951. Print Settings.) is set to 'on', the _actual_ (derived) type of the
  28952. object is shown rather than the _declared_ one.
  28953. VALUE
  28954. If values were requested, this is the value.
  28955. THREAD-ID
  28956. If this variable object is associated with a thread, this is the
  28957. thread's global thread id. Otherwise this result is not present.
  28958. FROZEN
  28959. If the variable object is frozen, this variable will be present
  28960. with a value of 1.
  28961. DISPLAYHINT
  28962. A dynamic varobj can supply a display hint to the front end. The
  28963. value comes directly from the Python pretty-printer object's
  28964. 'display_hint' method. *Note Pretty Printing API::.
  28965. DYNAMIC
  28966. This attribute will be present and have the value '1' if the varobj
  28967. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  28968. this attribute will not be present.
  28969. The result may have its own attributes:
  28970. 'displayhint'
  28971. A dynamic varobj can supply a display hint to the front end. The
  28972. value comes directly from the Python pretty-printer object's
  28973. 'display_hint' method. *Note Pretty Printing API::.
  28974. 'has_more'
  28975. This is an integer attribute which is nonzero if there are children
  28976. remaining after the end of the selected range.
  28977. Example
  28978. .......
  28979. (gdb)
  28980. -var-list-children n
  28981. ^done,numchild=N,children=[child={name=NAME,exp=EXP,
  28982. numchild=N,type=TYPE},(repeats N times)]
  28983. (gdb)
  28984. -var-list-children --all-values n
  28985. ^done,numchild=N,children=[child={name=NAME,exp=EXP,
  28986. numchild=N,value=VALUE,type=TYPE},(repeats N times)]
  28987. The '-var-info-type' Command
  28988. ----------------------------
  28989. Synopsis
  28990. ........
  28991. -var-info-type NAME
  28992. Returns the type of the specified variable NAME. The type is
  28993. returned as a string in the same format as it is output by the GDB CLI:
  28994. type=TYPENAME
  28995. The '-var-info-expression' Command
  28996. ----------------------------------
  28997. Synopsis
  28998. ........
  28999. -var-info-expression NAME
  29000. Returns a string that is suitable for presenting this variable object
  29001. in user interface. The string is generally not valid expression in the
  29002. current language, and cannot be evaluated.
  29003. For example, if 'a' is an array, and variable object 'A' was created
  29004. for 'a', then we'll get this output:
  29005. (gdb) -var-info-expression A.1
  29006. ^done,lang="C",exp="1"
  29007. Here, the value of 'lang' is the language name, which can be found in
  29008. *note Supported Languages::.
  29009. Note that the output of the '-var-list-children' command also
  29010. includes those expressions, so the '-var-info-expression' command is of
  29011. limited use.
  29012. The '-var-info-path-expression' Command
  29013. ---------------------------------------
  29014. Synopsis
  29015. ........
  29016. -var-info-path-expression NAME
  29017. Returns an expression that can be evaluated in the current context
  29018. and will yield the same value that a variable object has. Compare this
  29019. with the '-var-info-expression' command, which result can be used only
  29020. for UI presentation. Typical use of the '-var-info-path-expression'
  29021. command is creating a watchpoint from a variable object.
  29022. This command is currently not valid for children of a dynamic varobj,
  29023. and will give an error when invoked on one.
  29024. For example, suppose 'C' is a C++ class, derived from class 'Base',
  29025. and that the 'Base' class has a member called 'm_size'. Assume a
  29026. variable 'c' is has the type of 'C' and a variable object 'C' was
  29027. created for variable 'c'. Then, we'll get this output:
  29028. (gdb) -var-info-path-expression C.Base.public.m_size
  29029. ^done,path_expr=((Base)c).m_size)
  29030. The '-var-show-attributes' Command
  29031. ----------------------------------
  29032. Synopsis
  29033. ........
  29034. -var-show-attributes NAME
  29035. List attributes of the specified variable object NAME:
  29036. status=ATTR [ ( ,ATTR )* ]
  29037. where ATTR is '{ { editable | noneditable } | TBD }'.
  29038. The '-var-evaluate-expression' Command
  29039. --------------------------------------
  29040. Synopsis
  29041. ........
  29042. -var-evaluate-expression [-f FORMAT-SPEC] NAME
  29043. Evaluates the expression that is represented by the specified
  29044. variable object and returns its value as a string. The format of the
  29045. string can be specified with the '-f' option. The possible values of
  29046. this option are the same as for '-var-set-format' (*note
  29047. -var-set-format::). If the '-f' option is not specified, the current
  29048. display format will be used. The current display format can be changed
  29049. using the '-var-set-format' command.
  29050. value=VALUE
  29051. Note that one must invoke '-var-list-children' for a variable before
  29052. the value of a child variable can be evaluated.
  29053. The '-var-assign' Command
  29054. -------------------------
  29055. Synopsis
  29056. ........
  29057. -var-assign NAME EXPRESSION
  29058. Assigns the value of EXPRESSION to the variable object specified by
  29059. NAME. The object must be 'editable'. If the variable's value is
  29060. altered by the assign, the variable will show up in any subsequent
  29061. '-var-update' list.
  29062. Example
  29063. .......
  29064. (gdb)
  29065. -var-assign var1 3
  29066. ^done,value="3"
  29067. (gdb)
  29068. -var-update *
  29069. ^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
  29070. (gdb)
  29071. The '-var-update' Command
  29072. -------------------------
  29073. Synopsis
  29074. ........
  29075. -var-update [PRINT-VALUES] {NAME | "*"}
  29076. Reevaluate the expressions corresponding to the variable object NAME
  29077. and all its direct and indirect children, and return the list of
  29078. variable objects whose values have changed; NAME must be a root variable
  29079. object. Here, "changed" means that the result of
  29080. '-var-evaluate-expression' before and after the '-var-update' is
  29081. different. If '*' is used as the variable object names, all existing
  29082. variable objects are updated, except for frozen ones (*note
  29083. -var-set-frozen::). The option PRINT-VALUES determines whether both
  29084. names and values, or just names are printed. The possible values of
  29085. this option are the same as for '-var-list-children' (*note
  29086. -var-list-children::). It is recommended to use the '--all-values'
  29087. option, to reduce the number of MI commands needed on each program stop.
  29088. With the '*' parameter, if a variable object is bound to a currently
  29089. running thread, it will not be updated, without any diagnostic.
  29090. If '-var-set-update-range' was previously used on a varobj, then only
  29091. the selected range of children will be reported.
  29092. '-var-update' reports all the changed varobjs in a tuple named
  29093. 'changelist'.
  29094. Each item in the change list is itself a tuple holding:
  29095. 'name'
  29096. The name of the varobj.
  29097. 'value'
  29098. If values were requested for this update, then this field will be
  29099. present and will hold the value of the varobj.
  29100. 'in_scope'
  29101. This field is a string which may take one of three values:
  29102. '"true"'
  29103. The variable object's current value is valid.
  29104. '"false"'
  29105. The variable object does not currently hold a valid value but
  29106. it may hold one in the future if its associated expression
  29107. comes back into scope.
  29108. '"invalid"'
  29109. The variable object no longer holds a valid value. This can
  29110. occur when the executable file being debugged has changed,
  29111. either through recompilation or by using the GDB 'file'
  29112. command. The front end should normally choose to delete these
  29113. variable objects.
  29114. In the future new values may be added to this list so the front
  29115. should be prepared for this possibility. *Note GDB/MI Development
  29116. and Front Ends: GDB/MI Development and Front Ends.
  29117. 'type_changed'
  29118. This is only present if the varobj is still valid. If the type
  29119. changed, then this will be the string 'true'; otherwise it will be
  29120. 'false'.
  29121. When a varobj's type changes, its children are also likely to have
  29122. become incorrect. Therefore, the varobj's children are
  29123. automatically deleted when this attribute is 'true'. Also, the
  29124. varobj's update range, when set using the '-var-set-update-range'
  29125. command, is unset.
  29126. 'new_type'
  29127. If the varobj's type changed, then this field will be present and
  29128. will hold the new type.
  29129. 'new_num_children'
  29130. For a dynamic varobj, if the number of children changed, or if the
  29131. type changed, this will be the new number of children.
  29132. The 'numchild' field in other varobj responses is generally not
  29133. valid for a dynamic varobj - it will show the number of children
  29134. that GDB knows about, but because dynamic varobjs lazily
  29135. instantiate their children, this will not reflect the number of
  29136. children which may be available.
  29137. The 'new_num_children' attribute only reports changes to the number
  29138. of children known by GDB. This is the only way to detect whether
  29139. an update has removed children (which necessarily can only happen
  29140. at the end of the update range).
  29141. 'displayhint'
  29142. The display hint, if any.
  29143. 'has_more'
  29144. This is an integer value, which will be 1 if there are more
  29145. children available outside the varobj's update range.
  29146. 'dynamic'
  29147. This attribute will be present and have the value '1' if the varobj
  29148. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  29149. this attribute will not be present.
  29150. 'new_children'
  29151. If new children were added to a dynamic varobj within the selected
  29152. update range (as set by '-var-set-update-range'), then they will be
  29153. listed in this attribute.
  29154. Example
  29155. .......
  29156. (gdb)
  29157. -var-assign var1 3
  29158. ^done,value="3"
  29159. (gdb)
  29160. -var-update --all-values var1
  29161. ^done,changelist=[{name="var1",value="3",in_scope="true",
  29162. type_changed="false"}]
  29163. (gdb)
  29164. The '-var-set-frozen' Command
  29165. -----------------------------
  29166. Synopsis
  29167. ........
  29168. -var-set-frozen NAME FLAG
  29169. Set the frozenness flag on the variable object NAME. The FLAG
  29170. parameter should be either '1' to make the variable frozen or '0' to
  29171. make it unfrozen. If a variable object is frozen, then neither itself,
  29172. nor any of its children, are implicitly updated by '-var-update' of a
  29173. parent variable or by '-var-update *'. Only '-var-update' of the
  29174. variable itself will update its value and values of its children. After
  29175. a variable object is unfrozen, it is implicitly updated by all
  29176. subsequent '-var-update' operations. Unfreezing a variable does not
  29177. update it, only subsequent '-var-update' does.
  29178. Example
  29179. .......
  29180. (gdb)
  29181. -var-set-frozen V 1
  29182. ^done
  29183. (gdb)
  29184. The '-var-set-update-range' command
  29185. -----------------------------------
  29186. Synopsis
  29187. ........
  29188. -var-set-update-range NAME FROM TO
  29189. Set the range of children to be returned by future invocations of
  29190. '-var-update'.
  29191. FROM and TO indicate the range of children to report. If FROM or TO
  29192. is less than zero, the range is reset and all children will be reported.
  29193. Otherwise, children starting at FROM (zero-based) and up to and
  29194. excluding TO will be reported.
  29195. Example
  29196. .......
  29197. (gdb)
  29198. -var-set-update-range V 1 2
  29199. ^done
  29200. The '-var-set-visualizer' command
  29201. ---------------------------------
  29202. Synopsis
  29203. ........
  29204. -var-set-visualizer NAME VISUALIZER
  29205. Set a visualizer for the variable object NAME.
  29206. VISUALIZER is the visualizer to use. The special value 'None' means
  29207. to disable any visualizer in use.
  29208. If not 'None', VISUALIZER must be a Python expression. This
  29209. expression must evaluate to a callable object which accepts a single
  29210. argument. GDB will call this object with the value of the varobj NAME
  29211. as an argument (this is done so that the same Python pretty-printing
  29212. code can be used for both the CLI and MI). When called, this object must
  29213. return an object which conforms to the pretty-printing interface (*note
  29214. Pretty Printing API::).
  29215. The pre-defined function 'gdb.default_visualizer' may be used to
  29216. select a visualizer by following the built-in process (*note Selecting
  29217. Pretty-Printers::). This is done automatically when a varobj is
  29218. created, and so ordinarily is not needed.
  29219. This feature is only available if Python support is enabled. The MI
  29220. command '-list-features' (*note GDB/MI Support Commands::) can be used
  29221. to check this.
  29222. Example
  29223. .......
  29224. Resetting the visualizer:
  29225. (gdb)
  29226. -var-set-visualizer V None
  29227. ^done
  29228. Reselecting the default (type-based) visualizer:
  29229. (gdb)
  29230. -var-set-visualizer V gdb.default_visualizer
  29231. ^done
  29232. Suppose 'SomeClass' is a visualizer class. A lambda expression can
  29233. be used to instantiate this class for a varobj:
  29234. (gdb)
  29235. -var-set-visualizer V "lambda val: SomeClass()"
  29236. ^done
  29237. 
  29238. File: gdb.info, Node: GDB/MI Data Manipulation, Next: GDB/MI Tracepoint Commands, Prev: GDB/MI Variable Objects, Up: GDB/MI
  29239. 27.16 GDB/MI Data Manipulation
  29240. ==============================
  29241. This section describes the GDB/MI commands that manipulate data: examine
  29242. memory and registers, evaluate expressions, etc.
  29243. For details about what an addressable memory unit is, *note
  29244. addressable memory unit::.
  29245. The '-data-disassemble' Command
  29246. -------------------------------
  29247. Synopsis
  29248. ........
  29249. -data-disassemble
  29250. [ -s START-ADDR -e END-ADDR ]
  29251. | [ -a ADDR ]
  29252. | [ -f FILENAME -l LINENUM [ -n LINES ] ]
  29253. -- MODE
  29254. Where:
  29255. 'START-ADDR'
  29256. is the beginning address (or '$pc')
  29257. 'END-ADDR'
  29258. is the end address
  29259. 'ADDR'
  29260. is an address anywhere within (or the name of) the function to
  29261. disassemble. If an address is specified, the whole function
  29262. surrounding that address will be disassembled. If a name is
  29263. specified, the whole function with that name will be disassembled.
  29264. 'FILENAME'
  29265. is the name of the file to disassemble
  29266. 'LINENUM'
  29267. is the line number to disassemble around
  29268. 'LINES'
  29269. is the number of disassembly lines to be produced. If it is -1,
  29270. the whole function will be disassembled, in case no END-ADDR is
  29271. specified. If END-ADDR is specified as a non-zero value, and LINES
  29272. is lower than the number of disassembly lines between START-ADDR
  29273. and END-ADDR, only LINES lines are displayed; if LINES is higher
  29274. than the number of lines between START-ADDR and END-ADDR, only the
  29275. lines up to END-ADDR are displayed.
  29276. 'MODE'
  29277. is one of:
  29278. * 0 disassembly only
  29279. * 1 mixed source and disassembly (deprecated)
  29280. * 2 disassembly with raw opcodes
  29281. * 3 mixed source and disassembly with raw opcodes (deprecated)
  29282. * 4 mixed source and disassembly
  29283. * 5 mixed source and disassembly with raw opcodes
  29284. Modes 1 and 3 are deprecated. The output is "source centric" which
  29285. hasn't proved useful in practice. *Note Machine Code::, for a
  29286. discussion of the difference between '/m' and '/s' output of the
  29287. 'disassemble' command.
  29288. Result
  29289. ......
  29290. The result of the '-data-disassemble' command will be a list named
  29291. 'asm_insns', the contents of this list depend on the MODE used with the
  29292. '-data-disassemble' command.
  29293. For modes 0 and 2 the 'asm_insns' list contains tuples with the
  29294. following fields:
  29295. 'address'
  29296. The address at which this instruction was disassembled.
  29297. 'func-name'
  29298. The name of the function this instruction is within.
  29299. 'offset'
  29300. The decimal offset in bytes from the start of 'func-name'.
  29301. 'inst'
  29302. The text disassembly for this 'address'.
  29303. 'opcodes'
  29304. This field is only present for modes 2, 3 and 5. This contains the
  29305. raw opcode bytes for the 'inst' field.
  29306. For modes 1, 3, 4 and 5 the 'asm_insns' list contains tuples named
  29307. 'src_and_asm_line', each of which has the following fields:
  29308. 'line'
  29309. The line number within 'file'.
  29310. 'file'
  29311. The file name from the compilation unit. This might be an absolute
  29312. file name or a relative file name depending on the compile command
  29313. used.
  29314. 'fullname'
  29315. Absolute file name of 'file'. It is converted to a canonical form
  29316. using the source file search path (*note Specifying Source
  29317. Directories: Source Path.) and after resolving all the symbolic
  29318. links.
  29319. If the source file is not found this field will contain the path as
  29320. present in the debug information.
  29321. 'line_asm_insn'
  29322. This is a list of tuples containing the disassembly for 'line' in
  29323. 'file'. The fields of each tuple are the same as for
  29324. '-data-disassemble' in MODE 0 and 2, so 'address', 'func-name',
  29325. 'offset', 'inst', and optionally 'opcodes'.
  29326. Note that whatever included in the 'inst' field, is not manipulated
  29327. directly by GDB/MI, i.e., it is not possible to adjust its format.
  29328. GDB Command
  29329. ...........
  29330. The corresponding GDB command is 'disassemble'.
  29331. Example
  29332. .......
  29333. Disassemble from the current value of '$pc' to '$pc + 20':
  29334. (gdb)
  29335. -data-disassemble -s $pc -e "$pc + 20" -- 0
  29336. ^done,
  29337. asm_insns=[
  29338. {address="0x000107c0",func-name="main",offset="4",
  29339. inst="mov 2, %o0"},
  29340. {address="0x000107c4",func-name="main",offset="8",
  29341. inst="sethi %hi(0x11800), %o2"},
  29342. {address="0x000107c8",func-name="main",offset="12",
  29343. inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"},
  29344. {address="0x000107cc",func-name="main",offset="16",
  29345. inst="sethi %hi(0x11800), %o2"},
  29346. {address="0x000107d0",func-name="main",offset="20",
  29347. inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}]
  29348. (gdb)
  29349. Disassemble the whole 'main' function. Line 32 is part of 'main'.
  29350. -data-disassemble -f basics.c -l 32 -- 0
  29351. ^done,asm_insns=[
  29352. {address="0x000107bc",func-name="main",offset="0",
  29353. inst="save %sp, -112, %sp"},
  29354. {address="0x000107c0",func-name="main",offset="4",
  29355. inst="mov 2, %o0"},
  29356. {address="0x000107c4",func-name="main",offset="8",
  29357. inst="sethi %hi(0x11800), %o2"},
  29358. [...]
  29359. {address="0x0001081c",func-name="main",offset="96",inst="ret "},
  29360. {address="0x00010820",func-name="main",offset="100",inst="restore "}]
  29361. (gdb)
  29362. Disassemble 3 instructions from the start of 'main':
  29363. (gdb)
  29364. -data-disassemble -f basics.c -l 32 -n 3 -- 0
  29365. ^done,asm_insns=[
  29366. {address="0x000107bc",func-name="main",offset="0",
  29367. inst="save %sp, -112, %sp"},
  29368. {address="0x000107c0",func-name="main",offset="4",
  29369. inst="mov 2, %o0"},
  29370. {address="0x000107c4",func-name="main",offset="8",
  29371. inst="sethi %hi(0x11800), %o2"}]
  29372. (gdb)
  29373. Disassemble 3 instructions from the start of 'main' in mixed mode:
  29374. (gdb)
  29375. -data-disassemble -f basics.c -l 32 -n 3 -- 1
  29376. ^done,asm_insns=[
  29377. src_and_asm_line={line="31",
  29378. file="../../../src/gdb/testsuite/gdb.mi/basics.c",
  29379. fullname="/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c",
  29380. line_asm_insn=[{address="0x000107bc",
  29381. func-name="main",offset="0",inst="save %sp, -112, %sp"}]},
  29382. src_and_asm_line={line="32",
  29383. file="../../../src/gdb/testsuite/gdb.mi/basics.c",
  29384. fullname="/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c",
  29385. line_asm_insn=[{address="0x000107c0",
  29386. func-name="main",offset="4",inst="mov 2, %o0"},
  29387. {address="0x000107c4",func-name="main",offset="8",
  29388. inst="sethi %hi(0x11800), %o2"}]}]
  29389. (gdb)
  29390. The '-data-evaluate-expression' Command
  29391. ---------------------------------------
  29392. Synopsis
  29393. ........
  29394. -data-evaluate-expression EXPR
  29395. Evaluate EXPR as an expression. The expression could contain an
  29396. inferior function call. The function call will execute synchronously.
  29397. If the expression contains spaces, it must be enclosed in double quotes.
  29398. GDB Command
  29399. ...........
  29400. The corresponding GDB commands are 'print', 'output', and 'call'. In
  29401. 'gdbtk' only, there's a corresponding 'gdb_eval' command.
  29402. Example
  29403. .......
  29404. In the following example, the numbers that precede the commands are the
  29405. "tokens" described in *note GDB/MI Command Syntax: GDB/MI Command
  29406. Syntax. Notice how GDB/MI returns the same tokens in its output.
  29407. 211-data-evaluate-expression A
  29408. 211^done,value="1"
  29409. (gdb)
  29410. 311-data-evaluate-expression &A
  29411. 311^done,value="0xefffeb7c"
  29412. (gdb)
  29413. 411-data-evaluate-expression A+3
  29414. 411^done,value="4"
  29415. (gdb)
  29416. 511-data-evaluate-expression "A + 3"
  29417. 511^done,value="4"
  29418. (gdb)
  29419. The '-data-list-changed-registers' Command
  29420. ------------------------------------------
  29421. Synopsis
  29422. ........
  29423. -data-list-changed-registers
  29424. Display a list of the registers that have changed.
  29425. GDB Command
  29426. ...........
  29427. GDB doesn't have a direct analog for this command; 'gdbtk' has the
  29428. corresponding command 'gdb_changed_register_list'.
  29429. Example
  29430. .......
  29431. On a PPC MBX board:
  29432. (gdb)
  29433. -exec-continue
  29434. ^running
  29435. (gdb)
  29436. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={
  29437. func="main",args=[],file="try.c",fullname="/home/foo/bar/try.c",
  29438. line="5",arch="powerpc"}
  29439. (gdb)
  29440. -data-list-changed-registers
  29441. ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
  29442. "10","11","13","14","15","16","17","18","19","20","21","22","23",
  29443. "24","25","26","27","28","30","31","64","65","66","67","69"]
  29444. (gdb)
  29445. The '-data-list-register-names' Command
  29446. ---------------------------------------
  29447. Synopsis
  29448. ........
  29449. -data-list-register-names [ ( REGNO )+ ]
  29450. Show a list of register names for the current target. If no
  29451. arguments are given, it shows a list of the names of all the registers.
  29452. If integer numbers are given as arguments, it will print a list of the
  29453. names of the registers corresponding to the arguments. To ensure
  29454. consistency between a register name and its number, the output list may
  29455. include empty register names.
  29456. GDB Command
  29457. ...........
  29458. GDB does not have a command which corresponds to
  29459. '-data-list-register-names'. In 'gdbtk' there is a corresponding
  29460. command 'gdb_regnames'.
  29461. Example
  29462. .......
  29463. For the PPC MBX board:
  29464. (gdb)
  29465. -data-list-register-names
  29466. ^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
  29467. "r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
  29468. "r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
  29469. "r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
  29470. "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
  29471. "f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
  29472. "", "pc","ps","cr","lr","ctr","xer"]
  29473. (gdb)
  29474. -data-list-register-names 1 2 3
  29475. ^done,register-names=["r1","r2","r3"]
  29476. (gdb)
  29477. The '-data-list-register-values' Command
  29478. ----------------------------------------
  29479. Synopsis
  29480. ........
  29481. -data-list-register-values
  29482. [ --skip-unavailable ] FMT [ ( REGNO )*]
  29483. Display the registers' contents. The format according to which the
  29484. registers' contents are to be returned is given by FMT, followed by an
  29485. optional list of numbers specifying the registers to display. A missing
  29486. list of numbers indicates that the contents of all the registers must be
  29487. returned. The '--skip-unavailable' option indicates that only the
  29488. available registers are to be returned.
  29489. Allowed formats for FMT are:
  29490. 'x'
  29491. Hexadecimal
  29492. 'o'
  29493. Octal
  29494. 't'
  29495. Binary
  29496. 'd'
  29497. Decimal
  29498. 'r'
  29499. Raw
  29500. 'N'
  29501. Natural
  29502. GDB Command
  29503. ...........
  29504. The corresponding GDB commands are 'info reg', 'info all-reg', and (in
  29505. 'gdbtk') 'gdb_fetch_registers'.
  29506. Example
  29507. .......
  29508. For a PPC MBX board (note: line breaks are for readability only, they
  29509. don't appear in the actual output):
  29510. (gdb)
  29511. -data-list-register-values r 64 65
  29512. ^done,register-values=[{number="64",value="0xfe00a300"},
  29513. {number="65",value="0x00029002"}]
  29514. (gdb)
  29515. -data-list-register-values x
  29516. ^done,register-values=[{number="0",value="0xfe0043c8"},
  29517. {number="1",value="0x3fff88"},{number="2",value="0xfffffffe"},
  29518. {number="3",value="0x0"},{number="4",value="0xa"},
  29519. {number="5",value="0x3fff68"},{number="6",value="0x3fff58"},
  29520. {number="7",value="0xfe011e98"},{number="8",value="0x2"},
  29521. {number="9",value="0xfa202820"},{number="10",value="0xfa202808"},
  29522. {number="11",value="0x1"},{number="12",value="0x0"},
  29523. {number="13",value="0x4544"},{number="14",value="0xffdfffff"},
  29524. {number="15",value="0xffffffff"},{number="16",value="0xfffffeff"},
  29525. {number="17",value="0xefffffed"},{number="18",value="0xfffffffe"},
  29526. {number="19",value="0xffffffff"},{number="20",value="0xffffffff"},
  29527. {number="21",value="0xffffffff"},{number="22",value="0xfffffff7"},
  29528. {number="23",value="0xffffffff"},{number="24",value="0xffffffff"},
  29529. {number="25",value="0xffffffff"},{number="26",value="0xfffffffb"},
  29530. {number="27",value="0xffffffff"},{number="28",value="0xf7bfffff"},
  29531. {number="29",value="0x0"},{number="30",value="0xfe010000"},
  29532. {number="31",value="0x0"},{number="32",value="0x0"},
  29533. {number="33",value="0x0"},{number="34",value="0x0"},
  29534. {number="35",value="0x0"},{number="36",value="0x0"},
  29535. {number="37",value="0x0"},{number="38",value="0x0"},
  29536. {number="39",value="0x0"},{number="40",value="0x0"},
  29537. {number="41",value="0x0"},{number="42",value="0x0"},
  29538. {number="43",value="0x0"},{number="44",value="0x0"},
  29539. {number="45",value="0x0"},{number="46",value="0x0"},
  29540. {number="47",value="0x0"},{number="48",value="0x0"},
  29541. {number="49",value="0x0"},{number="50",value="0x0"},
  29542. {number="51",value="0x0"},{number="52",value="0x0"},
  29543. {number="53",value="0x0"},{number="54",value="0x0"},
  29544. {number="55",value="0x0"},{number="56",value="0x0"},
  29545. {number="57",value="0x0"},{number="58",value="0x0"},
  29546. {number="59",value="0x0"},{number="60",value="0x0"},
  29547. {number="61",value="0x0"},{number="62",value="0x0"},
  29548. {number="63",value="0x0"},{number="64",value="0xfe00a300"},
  29549. {number="65",value="0x29002"},{number="66",value="0x202f04b5"},
  29550. {number="67",value="0xfe0043b0"},{number="68",value="0xfe00b3e4"},
  29551. {number="69",value="0x20002b03"}]
  29552. (gdb)
  29553. The '-data-read-memory' Command
  29554. -------------------------------
  29555. This command is deprecated, use '-data-read-memory-bytes' instead.
  29556. Synopsis
  29557. ........
  29558. -data-read-memory [ -o BYTE-OFFSET ]
  29559. ADDRESS WORD-FORMAT WORD-SIZE
  29560. NR-ROWS NR-COLS [ ASCHAR ]
  29561. where:
  29562. 'ADDRESS'
  29563. An expression specifying the address of the first memory word to be
  29564. read. Complex expressions containing embedded white space should
  29565. be quoted using the C convention.
  29566. 'WORD-FORMAT'
  29567. The format to be used to print the memory words. The notation is
  29568. the same as for GDB's 'print' command (*note Output Formats: Output
  29569. Formats.).
  29570. 'WORD-SIZE'
  29571. The size of each memory word in bytes.
  29572. 'NR-ROWS'
  29573. The number of rows in the output table.
  29574. 'NR-COLS'
  29575. The number of columns in the output table.
  29576. 'ASCHAR'
  29577. If present, indicates that each row should include an ASCII dump.
  29578. The value of ASCHAR is used as a padding character when a byte is
  29579. not a member of the printable ASCII character set (printable ASCII
  29580. characters are those whose code is between 32 and 126,
  29581. inclusively).
  29582. 'BYTE-OFFSET'
  29583. An offset to add to the ADDRESS before fetching memory.
  29584. This command displays memory contents as a table of NR-ROWS by
  29585. NR-COLS words, each word being WORD-SIZE bytes. In total, 'NR-ROWS *
  29586. NR-COLS * WORD-SIZE' bytes are read (returned as 'total-bytes'). Should
  29587. less than the requested number of bytes be returned by the target, the
  29588. missing words are identified using 'N/A'. The number of bytes read from
  29589. the target is returned in 'nr-bytes' and the starting address used to
  29590. read memory in 'addr'.
  29591. The address of the next/previous row or page is available in
  29592. 'next-row' and 'prev-row', 'next-page' and 'prev-page'.
  29593. GDB Command
  29594. ...........
  29595. The corresponding GDB command is 'x'. 'gdbtk' has 'gdb_get_mem' memory
  29596. read command.
  29597. Example
  29598. .......
  29599. Read six bytes of memory starting at 'bytes+6' but then offset by '-6'
  29600. bytes. Format as three rows of two columns. One byte per word.
  29601. Display each word in hex.
  29602. (gdb)
  29603. 9-data-read-memory -o -6 -- bytes+6 x 1 3 2
  29604. 9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
  29605. next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
  29606. prev-page="0x0000138a",memory=[
  29607. {addr="0x00001390",data=["0x00","0x01"]},
  29608. {addr="0x00001392",data=["0x02","0x03"]},
  29609. {addr="0x00001394",data=["0x04","0x05"]}]
  29610. (gdb)
  29611. Read two bytes of memory starting at address 'shorts + 64' and
  29612. display as a single word formatted in decimal.
  29613. (gdb)
  29614. 5-data-read-memory shorts+64 d 2 1 1
  29615. 5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
  29616. next-row="0x00001512",prev-row="0x0000150e",
  29617. next-page="0x00001512",prev-page="0x0000150e",memory=[
  29618. {addr="0x00001510",data=["128"]}]
  29619. (gdb)
  29620. Read thirty two bytes of memory starting at 'bytes+16' and format as
  29621. eight rows of four columns. Include a string encoding with 'x' used as
  29622. the non-printable character.
  29623. (gdb)
  29624. 4-data-read-memory bytes+16 x 1 8 4 x
  29625. 4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
  29626. next-row="0x000013c0",prev-row="0x0000139c",
  29627. next-page="0x000013c0",prev-page="0x00001380",memory=[
  29628. {addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"},
  29629. {addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"},
  29630. {addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"},
  29631. {addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"},
  29632. {addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"},
  29633. {addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"},
  29634. {addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"},
  29635. {addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"}]
  29636. (gdb)
  29637. The '-data-read-memory-bytes' Command
  29638. -------------------------------------
  29639. Synopsis
  29640. ........
  29641. -data-read-memory-bytes [ -o OFFSET ]
  29642. ADDRESS COUNT
  29643. where:
  29644. 'ADDRESS'
  29645. An expression specifying the address of the first addressable
  29646. memory unit to be read. Complex expressions containing embedded
  29647. white space should be quoted using the C convention.
  29648. 'COUNT'
  29649. The number of addressable memory units to read. This should be an
  29650. integer literal.
  29651. 'OFFSET'
  29652. The offset relative to ADDRESS at which to start reading. This
  29653. should be an integer literal. This option is provided so that a
  29654. frontend is not required to first evaluate address and then perform
  29655. address arithmetics itself.
  29656. This command attempts to read all accessible memory regions in the
  29657. specified range. First, all regions marked as unreadable in the memory
  29658. map (if one is defined) will be skipped. *Note Memory Region
  29659. Attributes::. Second, GDB will attempt to read the remaining regions.
  29660. For each one, if reading full region results in an errors, GDB will try
  29661. to read a subset of the region.
  29662. In general, every single memory unit in the region may be readable or
  29663. not, and the only way to read every readable unit is to try a read at
  29664. every address, which is not practical. Therefore, GDB will attempt to
  29665. read all accessible memory units at either beginning or the end of the
  29666. region, using a binary division scheme. This heuristic works well for
  29667. reading across a memory map boundary. Note that if a region has a
  29668. readable range that is neither at the beginning or the end, GDB will not
  29669. read it.
  29670. The result record (*note GDB/MI Result Records::) that is output of
  29671. the command includes a field named 'memory' whose content is a list of
  29672. tuples. Each tuple represent a successfully read memory block and has
  29673. the following fields:
  29674. 'begin'
  29675. The start address of the memory block, as hexadecimal literal.
  29676. 'end'
  29677. The end address of the memory block, as hexadecimal literal.
  29678. 'offset'
  29679. The offset of the memory block, as hexadecimal literal, relative to
  29680. the start address passed to '-data-read-memory-bytes'.
  29681. 'contents'
  29682. The contents of the memory block, in hex.
  29683. GDB Command
  29684. ...........
  29685. The corresponding GDB command is 'x'.
  29686. Example
  29687. .......
  29688. (gdb)
  29689. -data-read-memory-bytes &a 10
  29690. ^done,memory=[{begin="0xbffff154",offset="0x00000000",
  29691. end="0xbffff15e",
  29692. contents="01000000020000000300"}]
  29693. (gdb)
  29694. The '-data-write-memory-bytes' Command
  29695. --------------------------------------
  29696. Synopsis
  29697. ........
  29698. -data-write-memory-bytes ADDRESS CONTENTS
  29699. -data-write-memory-bytes ADDRESS CONTENTS [COUNT]
  29700. where:
  29701. 'ADDRESS'
  29702. An expression specifying the address of the first addressable
  29703. memory unit to be written. Complex expressions containing embedded
  29704. white space should be quoted using the C convention.
  29705. 'CONTENTS'
  29706. The hex-encoded data to write. It is an error if CONTENTS does not
  29707. represent an integral number of addressable memory units.
  29708. 'COUNT'
  29709. Optional argument indicating the number of addressable memory units
  29710. to be written. If COUNT is greater than CONTENTS' length, GDB will
  29711. repeatedly write CONTENTS until it fills COUNT memory units.
  29712. GDB Command
  29713. ...........
  29714. There's no corresponding GDB command.
  29715. Example
  29716. .......
  29717. (gdb)
  29718. -data-write-memory-bytes &a "aabbccdd"
  29719. ^done
  29720. (gdb)
  29721. (gdb)
  29722. -data-write-memory-bytes &a "aabbccdd" 16e
  29723. ^done
  29724. (gdb)
  29725. 
  29726. File: gdb.info, Node: GDB/MI Tracepoint Commands, Next: GDB/MI Symbol Query, Prev: GDB/MI Data Manipulation, Up: GDB/MI
  29727. 27.17 GDB/MI Tracepoint Commands
  29728. ================================
  29729. The commands defined in this section implement MI support for
  29730. tracepoints. For detailed introduction, see *note Tracepoints::.
  29731. The '-trace-find' Command
  29732. -------------------------
  29733. Synopsis
  29734. ........
  29735. -trace-find MODE [PARAMETERS...]
  29736. Find a trace frame using criteria defined by MODE and PARAMETERS.
  29737. The following table lists permissible modes and their parameters. For
  29738. details of operation, see *note tfind::.
  29739. 'none'
  29740. No parameters are required. Stops examining trace frames.
  29741. 'frame-number'
  29742. An integer is required as parameter. Selects tracepoint frame with
  29743. that index.
  29744. 'tracepoint-number'
  29745. An integer is required as parameter. Finds next trace frame that
  29746. corresponds to tracepoint with the specified number.
  29747. 'pc'
  29748. An address is required as parameter. Finds next trace frame that
  29749. corresponds to any tracepoint at the specified address.
  29750. 'pc-inside-range'
  29751. Two addresses are required as parameters. Finds next trace frame
  29752. that corresponds to a tracepoint at an address inside the specified
  29753. range. Both bounds are considered to be inside the range.
  29754. 'pc-outside-range'
  29755. Two addresses are required as parameters. Finds next trace frame
  29756. that corresponds to a tracepoint at an address outside the
  29757. specified range. Both bounds are considered to be inside the
  29758. range.
  29759. 'line'
  29760. Line specification is required as parameter. *Note Specify
  29761. Location::. Finds next trace frame that corresponds to a
  29762. tracepoint at the specified location.
  29763. If 'none' was passed as MODE, the response does not have fields.
  29764. Otherwise, the response may have the following fields:
  29765. 'found'
  29766. This field has either '0' or '1' as the value, depending on whether
  29767. a matching tracepoint was found.
  29768. 'traceframe'
  29769. The index of the found traceframe. This field is present iff the
  29770. 'found' field has value of '1'.
  29771. 'tracepoint'
  29772. The index of the found tracepoint. This field is present iff the
  29773. 'found' field has value of '1'.
  29774. 'frame'
  29775. The information about the frame corresponding to the found trace
  29776. frame. This field is present only if a trace frame was found.
  29777. *Note GDB/MI Frame Information::, for description of this field.
  29778. GDB Command
  29779. ...........
  29780. The corresponding GDB command is 'tfind'.
  29781. -trace-define-variable
  29782. ----------------------
  29783. Synopsis
  29784. ........
  29785. -trace-define-variable NAME [ VALUE ]
  29786. Create trace variable NAME if it does not exist. If VALUE is
  29787. specified, sets the initial value of the specified trace variable to
  29788. that value. Note that the NAME should start with the '$' character.
  29789. GDB Command
  29790. ...........
  29791. The corresponding GDB command is 'tvariable'.
  29792. The '-trace-frame-collected' Command
  29793. ------------------------------------
  29794. Synopsis
  29795. ........
  29796. -trace-frame-collected
  29797. [--var-print-values VAR_PVAL]
  29798. [--comp-print-values COMP_PVAL]
  29799. [--registers-format REGFORMAT]
  29800. [--memory-contents]
  29801. This command returns the set of collected objects, register names,
  29802. trace state variable names, memory ranges and computed expressions that
  29803. have been collected at a particular trace frame. The optional
  29804. parameters to the command affect the output format in different ways.
  29805. See the output description table below for more details.
  29806. The reported names can be used in the normal manner to create varobjs
  29807. and inspect the objects themselves. The items returned by this command
  29808. are categorized so that it is clear which is a variable, which is a
  29809. register, which is a trace state variable, which is a memory range and
  29810. which is a computed expression.
  29811. For instance, if the actions were
  29812. collect myVar, myArray[myIndex], myObj.field, myPtr->field, myCount + 2
  29813. collect *(int*)0xaf02bef0@40
  29814. the object collected in its entirety would be 'myVar'. The object
  29815. 'myArray' would be partially collected, because only the element at
  29816. index 'myIndex' would be collected. The remaining objects would be
  29817. computed expressions.
  29818. An example output would be:
  29819. (gdb)
  29820. -trace-frame-collected
  29821. ^done,
  29822. explicit-variables=[{name="myVar",value="1"}],
  29823. computed-expressions=[{name="myArray[myIndex]",value="0"},
  29824. {name="myObj.field",value="0"},
  29825. {name="myPtr->field",value="1"},
  29826. {name="myCount + 2",value="3"},
  29827. {name="$tvar1 + 1",value="43970027"}],
  29828. registers=[{number="0",value="0x7fe2c6e79ec8"},
  29829. {number="1",value="0x0"},
  29830. {number="2",value="0x4"},
  29831. ...
  29832. {number="125",value="0x0"}],
  29833. tvars=[{name="$tvar1",current="43970026"}],
  29834. memory=[{address="0x0000000000602264",length="4"},
  29835. {address="0x0000000000615bc0",length="4"}]
  29836. (gdb)
  29837. Where:
  29838. 'explicit-variables'
  29839. The set of objects that have been collected in their entirety (as
  29840. opposed to collecting just a few elements of an array or a few
  29841. struct members). For each object, its name and value are printed.
  29842. The '--var-print-values' option affects how or whether the value
  29843. field is output. If VAR_PVAL is 0, then print only the names; if
  29844. it is 1, print also their values; and if it is 2, print the name,
  29845. type and value for simple data types, and the name and type for
  29846. arrays, structures and unions.
  29847. 'computed-expressions'
  29848. The set of computed expressions that have been collected at the
  29849. current trace frame. The '--comp-print-values' option affects this
  29850. set like the '--var-print-values' option affects the
  29851. 'explicit-variables' set. See above.
  29852. 'registers'
  29853. The registers that have been collected at the current trace frame.
  29854. For each register collected, the name and current value are
  29855. returned. The value is formatted according to the
  29856. '--registers-format' option. See the '-data-list-register-values'
  29857. command for a list of the allowed formats. The default is 'x'.
  29858. 'tvars'
  29859. The trace state variables that have been collected at the current
  29860. trace frame. For each trace state variable collected, the name and
  29861. current value are returned.
  29862. 'memory'
  29863. The set of memory ranges that have been collected at the current
  29864. trace frame. Its content is a list of tuples. Each tuple
  29865. represents a collected memory range and has the following fields:
  29866. 'address'
  29867. The start address of the memory range, as hexadecimal literal.
  29868. 'length'
  29869. The length of the memory range, as decimal literal.
  29870. 'contents'
  29871. The contents of the memory block, in hex. This field is only
  29872. present if the '--memory-contents' option is specified.
  29873. GDB Command
  29874. ...........
  29875. There is no corresponding GDB command.
  29876. Example
  29877. .......
  29878. -trace-list-variables
  29879. ---------------------
  29880. Synopsis
  29881. ........
  29882. -trace-list-variables
  29883. Return a table of all defined trace variables. Each element of the
  29884. table has the following fields:
  29885. 'name'
  29886. The name of the trace variable. This field is always present.
  29887. 'initial'
  29888. The initial value. This is a 64-bit signed integer. This field is
  29889. always present.
  29890. 'current'
  29891. The value the trace variable has at the moment. This is a 64-bit
  29892. signed integer. This field is absent iff current value is not
  29893. defined, for example if the trace was never run, or is presently
  29894. running.
  29895. GDB Command
  29896. ...........
  29897. The corresponding GDB command is 'tvariables'.
  29898. Example
  29899. .......
  29900. (gdb)
  29901. -trace-list-variables
  29902. ^done,trace-variables={nr_rows="1",nr_cols="3",
  29903. hdr=[{width="15",alignment="-1",col_name="name",colhdr="Name"},
  29904. {width="11",alignment="-1",col_name="initial",colhdr="Initial"},
  29905. {width="11",alignment="-1",col_name="current",colhdr="Current"}],
  29906. body=[variable={name="$trace_timestamp",initial="0"}
  29907. variable={name="$foo",initial="10",current="15"}]}
  29908. (gdb)
  29909. -trace-save
  29910. -----------
  29911. Synopsis
  29912. ........
  29913. -trace-save [ -r ] [ -ctf ] FILENAME
  29914. Saves the collected trace data to FILENAME. Without the '-r' option,
  29915. the data is downloaded from the target and saved in a local file. With
  29916. the '-r' option the target is asked to perform the save.
  29917. By default, this command will save the trace in the tfile format.
  29918. You can supply the optional '-ctf' argument to save it the CTF format.
  29919. See *note Trace Files:: for more information about CTF.
  29920. GDB Command
  29921. ...........
  29922. The corresponding GDB command is 'tsave'.
  29923. -trace-start
  29924. ------------
  29925. Synopsis
  29926. ........
  29927. -trace-start
  29928. Starts a tracing experiment. The result of this command does not
  29929. have any fields.
  29930. GDB Command
  29931. ...........
  29932. The corresponding GDB command is 'tstart'.
  29933. -trace-status
  29934. -------------
  29935. Synopsis
  29936. ........
  29937. -trace-status
  29938. Obtains the status of a tracing experiment. The result may include
  29939. the following fields:
  29940. 'supported'
  29941. May have a value of either '0', when no tracing operations are
  29942. supported, '1', when all tracing operations are supported, or
  29943. 'file' when examining trace file. In the latter case, examining of
  29944. trace frame is possible but new tracing experiement cannot be
  29945. started. This field is always present.
  29946. 'running'
  29947. May have a value of either '0' or '1' depending on whether tracing
  29948. experiement is in progress on target. This field is present if
  29949. 'supported' field is not '0'.
  29950. 'stop-reason'
  29951. Report the reason why the tracing was stopped last time. This
  29952. field may be absent iff tracing was never stopped on target yet.
  29953. The value of 'request' means the tracing was stopped as result of
  29954. the '-trace-stop' command. The value of 'overflow' means the
  29955. tracing buffer is full. The value of 'disconnection' means tracing
  29956. was automatically stopped when GDB has disconnected. The value of
  29957. 'passcount' means tracing was stopped when a tracepoint was passed
  29958. a maximal number of times for that tracepoint. This field is
  29959. present if 'supported' field is not '0'.
  29960. 'stopping-tracepoint'
  29961. The number of tracepoint whose passcount as exceeded. This field
  29962. is present iff the 'stop-reason' field has the value of
  29963. 'passcount'.
  29964. 'frames'
  29965. 'frames-created'
  29966. The 'frames' field is a count of the total number of trace frames
  29967. in the trace buffer, while 'frames-created' is the total created
  29968. during the run, including ones that were discarded, such as when a
  29969. circular trace buffer filled up. Both fields are optional.
  29970. 'buffer-size'
  29971. 'buffer-free'
  29972. These fields tell the current size of the tracing buffer and the
  29973. remaining space. These fields are optional.
  29974. 'circular'
  29975. The value of the circular trace buffer flag. '1' means that the
  29976. trace buffer is circular and old trace frames will be discarded if
  29977. necessary to make room, '0' means that the trace buffer is linear
  29978. and may fill up.
  29979. 'disconnected'
  29980. The value of the disconnected tracing flag. '1' means that tracing
  29981. will continue after GDB disconnects, '0' means that the trace run
  29982. will stop.
  29983. 'trace-file'
  29984. The filename of the trace file being examined. This field is
  29985. optional, and only present when examining a trace file.
  29986. GDB Command
  29987. ...........
  29988. The corresponding GDB command is 'tstatus'.
  29989. -trace-stop
  29990. -----------
  29991. Synopsis
  29992. ........
  29993. -trace-stop
  29994. Stops a tracing experiment. The result of this command has the same
  29995. fields as '-trace-status', except that the 'supported' and 'running'
  29996. fields are not output.
  29997. GDB Command
  29998. ...........
  29999. The corresponding GDB command is 'tstop'.
  30000. 
  30001. File: gdb.info, Node: GDB/MI Symbol Query, Next: GDB/MI File Commands, Prev: GDB/MI Tracepoint Commands, Up: GDB/MI
  30002. 27.18 GDB/MI Symbol Query Commands
  30003. ==================================
  30004. The '-symbol-info-functions' Command
  30005. ------------------------------------
  30006. Synopsis
  30007. ........
  30008. -symbol-info-functions [--include-nondebug]
  30009. [--type TYPE_REGEXP]
  30010. [--name NAME_REGEXP]
  30011. [--max-results LIMIT]
  30012. Return a list containing the names and types for all global functions
  30013. taken from the debug information. The functions are grouped by source
  30014. file, and shown with the line number on which each function is defined.
  30015. The '--include-nondebug' option causes the output to include code
  30016. symbols from the symbol table.
  30017. The options '--type' and '--name' allow the symbols returned to be
  30018. filtered based on either the name of the function, or the type signature
  30019. of the function.
  30020. The option '--max-results' restricts the command to return no more
  30021. than LIMIT results. If exactly LIMIT results are returned then there
  30022. might be additional results available if a higher limit is used.
  30023. GDB Command
  30024. ...........
  30025. The corresponding GDB command is 'info functions'.
  30026. Example
  30027. .......
  30028. (gdb)
  30029. -symbol-info-functions
  30030. ^done,symbols=
  30031. {debug=
  30032. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30033. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30034. symbols=[{line="36", name="f4", type="void (int *)",
  30035. description="void f4(int *);"},
  30036. {line="42", name="main", type="int ()",
  30037. description="int main();"},
  30038. {line="30", name="f1", type="my_int_t (int, int)",
  30039. description="static my_int_t f1(int, int);"}]},
  30040. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30041. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30042. symbols=[{line="33", name="f2", type="float (another_float_t)",
  30043. description="float f2(another_float_t);"},
  30044. {line="39", name="f3", type="int (another_int_t)",
  30045. description="int f3(another_int_t);"},
  30046. {line="27", name="f1", type="another_float_t (int)",
  30047. description="static another_float_t f1(int);"}]}]}
  30048. (gdb)
  30049. -symbol-info-functions --name f1
  30050. ^done,symbols=
  30051. {debug=
  30052. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30053. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30054. symbols=[{line="30", name="f1", type="my_int_t (int, int)",
  30055. description="static my_int_t f1(int, int);"}]},
  30056. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30057. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30058. symbols=[{line="27", name="f1", type="another_float_t (int)",
  30059. description="static another_float_t f1(int);"}]}]}
  30060. (gdb)
  30061. -symbol-info-functions --type void
  30062. ^done,symbols=
  30063. {debug=
  30064. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30065. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30066. symbols=[{line="36", name="f4", type="void (int *)",
  30067. description="void f4(int *);"}]}]}
  30068. (gdb)
  30069. -symbol-info-functions --include-nondebug
  30070. ^done,symbols=
  30071. {debug=
  30072. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30073. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30074. symbols=[{line="36", name="f4", type="void (int *)",
  30075. description="void f4(int *);"},
  30076. {line="42", name="main", type="int ()",
  30077. description="int main();"},
  30078. {line="30", name="f1", type="my_int_t (int, int)",
  30079. description="static my_int_t f1(int, int);"}]},
  30080. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30081. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30082. symbols=[{line="33", name="f2", type="float (another_float_t)",
  30083. description="float f2(another_float_t);"},
  30084. {line="39", name="f3", type="int (another_int_t)",
  30085. description="int f3(another_int_t);"},
  30086. {line="27", name="f1", type="another_float_t (int)",
  30087. description="static another_float_t f1(int);"}]}],
  30088. nondebug=
  30089. [{address="0x0000000000400398",name="_init"},
  30090. {address="0x00000000004003b0",name="_start"},
  30091. ...
  30092. ]}
  30093. The '-symbol-info-module-functions' Command
  30094. -------------------------------------------
  30095. Synopsis
  30096. ........
  30097. -symbol-info-module-functions [--module MODULE_REGEXP]
  30098. [--name NAME_REGEXP]
  30099. [--type TYPE_REGEXP]
  30100. Return a list containing the names of all known functions within all
  30101. know Fortran modules. The functions are grouped by source file and
  30102. containing module, and shown with the line number on which each function
  30103. is defined.
  30104. The option '--module' only returns results for modules matching
  30105. MODULE_REGEXP. The option '--name' only returns functions whose name
  30106. matches NAME_REGEXP, and '--type' only returns functions whose type
  30107. matches TYPE_REGEXP.
  30108. GDB Command
  30109. ...........
  30110. The corresponding GDB command is 'info module functions'.
  30111. Example
  30112. .......
  30113. (gdb)
  30114. -symbol-info-module-functions
  30115. ^done,symbols=
  30116. [{module="mod1",
  30117. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30118. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30119. symbols=[{line="21",name="mod1::check_all",type="void (void)",
  30120. description="void mod1::check_all(void);"}]}]},
  30121. {module="mod2",
  30122. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30123. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30124. symbols=[{line="30",name="mod2::check_var_i",type="void (void)",
  30125. description="void mod2::check_var_i(void);"}]}]},
  30126. {module="mod3",
  30127. files=[{filename="/projec/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30128. fullname="/projec/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30129. symbols=[{line="21",name="mod3::check_all",type="void (void)",
  30130. description="void mod3::check_all(void);"},
  30131. {line="27",name="mod3::check_mod2",type="void (void)",
  30132. description="void mod3::check_mod2(void);"}]}]},
  30133. {module="modmany",
  30134. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30135. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30136. symbols=[{line="35",name="modmany::check_some",type="void (void)",
  30137. description="void modmany::check_some(void);"}]}]},
  30138. {module="moduse",
  30139. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30140. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30141. symbols=[{line="44",name="moduse::check_all",type="void (void)",
  30142. description="void moduse::check_all(void);"},
  30143. {line="49",name="moduse::check_var_x",type="void (void)",
  30144. description="void moduse::check_var_x(void);"}]}]}]
  30145. The '-symbol-info-module-variables' Command
  30146. -------------------------------------------
  30147. Synopsis
  30148. ........
  30149. -symbol-info-module-variables [--module MODULE_REGEXP]
  30150. [--name NAME_REGEXP]
  30151. [--type TYPE_REGEXP]
  30152. Return a list containing the names of all known variables within all
  30153. know Fortran modules. The variables are grouped by source file and
  30154. containing module, and shown with the line number on which each variable
  30155. is defined.
  30156. The option '--module' only returns results for modules matching
  30157. MODULE_REGEXP. The option '--name' only returns variables whose name
  30158. matches NAME_REGEXP, and '--type' only returns variables whose type
  30159. matches TYPE_REGEXP.
  30160. GDB Command
  30161. ...........
  30162. The corresponding GDB command is 'info module variables'.
  30163. Example
  30164. .......
  30165. (gdb)
  30166. -symbol-info-module-variables
  30167. ^done,symbols=
  30168. [{module="mod1",
  30169. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30170. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30171. symbols=[{line="18",name="mod1::var_const",type="integer(kind=4)",
  30172. description="integer(kind=4) mod1::var_const;"},
  30173. {line="17",name="mod1::var_i",type="integer(kind=4)",
  30174. description="integer(kind=4) mod1::var_i;"}]}]},
  30175. {module="mod2",
  30176. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30177. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30178. symbols=[{line="28",name="mod2::var_i",type="integer(kind=4)",
  30179. description="integer(kind=4) mod2::var_i;"}]}]},
  30180. {module="mod3",
  30181. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30182. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30183. symbols=[{line="18",name="mod3::mod1",type="integer(kind=4)",
  30184. description="integer(kind=4) mod3::mod1;"},
  30185. {line="17",name="mod3::mod2",type="integer(kind=4)",
  30186. description="integer(kind=4) mod3::mod2;"},
  30187. {line="19",name="mod3::var_i",type="integer(kind=4)",
  30188. description="integer(kind=4) mod3::var_i;"}]}]},
  30189. {module="modmany",
  30190. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30191. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30192. symbols=[{line="33",name="modmany::var_a",type="integer(kind=4)",
  30193. description="integer(kind=4) modmany::var_a;"},
  30194. {line="33",name="modmany::var_b",type="integer(kind=4)",
  30195. description="integer(kind=4) modmany::var_b;"},
  30196. {line="33",name="modmany::var_c",type="integer(kind=4)",
  30197. description="integer(kind=4) modmany::var_c;"},
  30198. {line="33",name="modmany::var_i",type="integer(kind=4)",
  30199. description="integer(kind=4) modmany::var_i;"}]}]},
  30200. {module="moduse",
  30201. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30202. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30203. symbols=[{line="42",name="moduse::var_x",type="integer(kind=4)",
  30204. description="integer(kind=4) moduse::var_x;"},
  30205. {line="42",name="moduse::var_y",type="integer(kind=4)",
  30206. description="integer(kind=4) moduse::var_y;"}]}]}]
  30207. The '-symbol-info-modules' Command
  30208. ----------------------------------
  30209. Synopsis
  30210. ........
  30211. -symbol-info-modules [--name NAME_REGEXP]
  30212. [--max-results LIMIT]
  30213. Return a list containing the names of all known Fortran modules. The
  30214. modules are grouped by source file, and shown with the line number on
  30215. which each modules is defined.
  30216. The option '--name' allows the modules returned to be filtered based
  30217. the name of the module.
  30218. The option '--max-results' restricts the command to return no more
  30219. than LIMIT results. If exactly LIMIT results are returned then there
  30220. might be additional results available if a higher limit is used.
  30221. GDB Command
  30222. ...........
  30223. The corresponding GDB command is 'info modules'.
  30224. Example
  30225. .......
  30226. (gdb)
  30227. -symbol-info-modules
  30228. ^done,symbols=
  30229. {debug=
  30230. [{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30231. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30232. symbols=[{line="16",name="mod1"},
  30233. {line="22",name="mod2"}]},
  30234. {filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30235. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30236. symbols=[{line="16",name="mod3"},
  30237. {line="22",name="modmany"},
  30238. {line="26",name="moduse"}]}]}
  30239. (gdb)
  30240. -symbol-info-modules --name mod[123]
  30241. ^done,symbols=
  30242. {debug=
  30243. [{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30244. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  30245. symbols=[{line="16",name="mod1"},
  30246. {line="22",name="mod2"}]},
  30247. {filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30248. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  30249. symbols=[{line="16",name="mod3"}]}]}
  30250. The '-symbol-info-types' Command
  30251. --------------------------------
  30252. Synopsis
  30253. ........
  30254. -symbol-info-types [--name NAME_REGEXP]
  30255. [--max-results LIMIT]
  30256. Return a list of all defined types. The types are grouped by source
  30257. file, and shown with the line number on which each user defined type is
  30258. defined. Some base types are not defined in the source code but are
  30259. added to the debug information by the compiler, for example 'int',
  30260. 'float', etc.; these types do not have an associated line number.
  30261. The option '--name' allows the list of types returned to be filtered
  30262. by name.
  30263. The option '--max-results' restricts the command to return no more
  30264. than LIMIT results. If exactly LIMIT results are returned then there
  30265. might be additional results available if a higher limit is used.
  30266. GDB Command
  30267. ...........
  30268. The corresponding GDB command is 'info types'.
  30269. Example
  30270. .......
  30271. (gdb)
  30272. -symbol-info-types
  30273. ^done,symbols=
  30274. {debug=
  30275. [{filename="gdb.mi/mi-sym-info-1.c",
  30276. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30277. symbols=[{name="float"},
  30278. {name="int"},
  30279. {line="27",name="typedef int my_int_t;"}]},
  30280. {filename="gdb.mi/mi-sym-info-2.c",
  30281. fullname="/project/gdb.mi/mi-sym-info-2.c",
  30282. symbols=[{line="24",name="typedef float another_float_t;"},
  30283. {line="23",name="typedef int another_int_t;"},
  30284. {name="float"},
  30285. {name="int"}]}]}
  30286. (gdb)
  30287. -symbol-info-types --name _int_
  30288. ^done,symbols=
  30289. {debug=
  30290. [{filename="gdb.mi/mi-sym-info-1.c",
  30291. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30292. symbols=[{line="27",name="typedef int my_int_t;"}]},
  30293. {filename="gdb.mi/mi-sym-info-2.c",
  30294. fullname="/project/gdb.mi/mi-sym-info-2.c",
  30295. symbols=[{line="23",name="typedef int another_int_t;"}]}]}
  30296. The '-symbol-info-variables' Command
  30297. ------------------------------------
  30298. Synopsis
  30299. ........
  30300. -symbol-info-variables [--include-nondebug]
  30301. [--type TYPE_REGEXP]
  30302. [--name NAME_REGEXP]
  30303. [--max-results LIMIT]
  30304. Return a list containing the names and types for all global variables
  30305. taken from the debug information. The variables are grouped by source
  30306. file, and shown with the line number on which each variable is defined.
  30307. The '--include-nondebug' option causes the output to include data
  30308. symbols from the symbol table.
  30309. The options '--type' and '--name' allow the symbols returned to be
  30310. filtered based on either the name of the variable, or the type of the
  30311. variable.
  30312. The option '--max-results' restricts the command to return no more
  30313. than LIMIT results. If exactly LIMIT results are returned then there
  30314. might be additional results available if a higher limit is used.
  30315. GDB Command
  30316. ...........
  30317. The corresponding GDB command is 'info variables'.
  30318. Example
  30319. .......
  30320. (gdb)
  30321. -symbol-info-variables
  30322. ^done,symbols=
  30323. {debug=
  30324. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30325. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30326. symbols=[{line="25",name="global_f1",type="float",
  30327. description="static float global_f1;"},
  30328. {line="24",name="global_i1",type="int",
  30329. description="static int global_i1;"}]},
  30330. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30331. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30332. symbols=[{line="21",name="global_f2",type="int",
  30333. description="int global_f2;"},
  30334. {line="20",name="global_i2",type="int",
  30335. description="int global_i2;"},
  30336. {line="19",name="global_f1",type="float",
  30337. description="static float global_f1;"},
  30338. {line="18",name="global_i1",type="int",
  30339. description="static int global_i1;"}]}]}
  30340. (gdb)
  30341. -symbol-info-variables --name f1
  30342. ^done,symbols=
  30343. {debug=
  30344. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30345. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30346. symbols=[{line="25",name="global_f1",type="float",
  30347. description="static float global_f1;"}]},
  30348. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30349. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30350. symbols=[{line="19",name="global_f1",type="float",
  30351. description="static float global_f1;"}]}]}
  30352. (gdb)
  30353. -symbol-info-variables --type float
  30354. ^done,symbols=
  30355. {debug=
  30356. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30357. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30358. symbols=[{line="25",name="global_f1",type="float",
  30359. description="static float global_f1;"}]},
  30360. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30361. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30362. symbols=[{line="19",name="global_f1",type="float",
  30363. description="static float global_f1;"}]}]}
  30364. (gdb)
  30365. -symbol-info-variables --include-nondebug
  30366. ^done,symbols=
  30367. {debug=
  30368. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30369. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  30370. symbols=[{line="25",name="global_f1",type="float",
  30371. description="static float global_f1;"},
  30372. {line="24",name="global_i1",type="int",
  30373. description="static int global_i1;"}]},
  30374. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30375. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  30376. symbols=[{line="21",name="global_f2",type="int",
  30377. description="int global_f2;"},
  30378. {line="20",name="global_i2",type="int",
  30379. description="int global_i2;"},
  30380. {line="19",name="global_f1",type="float",
  30381. description="static float global_f1;"},
  30382. {line="18",name="global_i1",type="int",
  30383. description="static int global_i1;"}]}],
  30384. nondebug=
  30385. [{address="0x00000000004005d0",name="_IO_stdin_used"},
  30386. {address="0x00000000004005d8",name="__dso_handle"}
  30387. ...
  30388. ]}
  30389. The '-symbol-list-lines' Command
  30390. --------------------------------
  30391. Synopsis
  30392. ........
  30393. -symbol-list-lines FILENAME
  30394. Print the list of lines that contain code and their associated
  30395. program addresses for the given source filename. The entries are sorted
  30396. in ascending PC order.
  30397. GDB Command
  30398. ...........
  30399. There is no corresponding GDB command.
  30400. Example
  30401. .......
  30402. (gdb)
  30403. -symbol-list-lines basics.c
  30404. ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
  30405. (gdb)
  30406. 
  30407. File: gdb.info, Node: GDB/MI File Commands, Next: GDB/MI Target Manipulation, Prev: GDB/MI Symbol Query, Up: GDB/MI
  30408. 27.19 GDB/MI File Commands
  30409. ==========================
  30410. This section describes the GDB/MI commands to specify executable file
  30411. names and to read in and obtain symbol table information.
  30412. The '-file-exec-and-symbols' Command
  30413. ------------------------------------
  30414. Synopsis
  30415. ........
  30416. -file-exec-and-symbols FILE
  30417. Specify the executable file to be debugged. This file is the one
  30418. from which the symbol table is also read. If no file is specified, the
  30419. command clears the executable and symbol information. If breakpoints
  30420. are set when using this command with no arguments, GDB will produce
  30421. error messages. Otherwise, no output is produced, except a completion
  30422. notification.
  30423. GDB Command
  30424. ...........
  30425. The corresponding GDB command is 'file'.
  30426. Example
  30427. .......
  30428. (gdb)
  30429. -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  30430. ^done
  30431. (gdb)
  30432. The '-file-exec-file' Command
  30433. -----------------------------
  30434. Synopsis
  30435. ........
  30436. -file-exec-file FILE
  30437. Specify the executable file to be debugged. Unlike
  30438. '-file-exec-and-symbols', the symbol table is _not_ read from this file.
  30439. If used without argument, GDB clears the information about the
  30440. executable file. No output is produced, except a completion
  30441. notification.
  30442. GDB Command
  30443. ...........
  30444. The corresponding GDB command is 'exec-file'.
  30445. Example
  30446. .......
  30447. (gdb)
  30448. -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  30449. ^done
  30450. (gdb)
  30451. The '-file-list-exec-source-file' Command
  30452. -----------------------------------------
  30453. Synopsis
  30454. ........
  30455. -file-list-exec-source-file
  30456. List the line number, the current source file, and the absolute path
  30457. to the current source file for the current executable. The macro
  30458. information field has a value of '1' or '0' depending on whether or not
  30459. the file includes preprocessor macro information.
  30460. GDB Command
  30461. ...........
  30462. The GDB equivalent is 'info source'
  30463. Example
  30464. .......
  30465. (gdb)
  30466. 123-file-list-exec-source-file
  30467. 123^done,line="1",file="foo.c",fullname="/home/bar/foo.c,macro-info="1"
  30468. (gdb)
  30469. The '-file-list-exec-source-files' Command
  30470. ------------------------------------------
  30471. Synopsis
  30472. ........
  30473. -file-list-exec-source-files
  30474. List the source files for the current executable.
  30475. It will always output both the filename and fullname (absolute file
  30476. name) of a source file.
  30477. GDB Command
  30478. ...........
  30479. The GDB equivalent is 'info sources'. 'gdbtk' has an analogous command
  30480. 'gdb_listfiles'.
  30481. Example
  30482. .......
  30483. (gdb)
  30484. -file-list-exec-source-files
  30485. ^done,files=[
  30486. {file=foo.c,fullname=/home/foo.c},
  30487. {file=/home/bar.c,fullname=/home/bar.c},
  30488. {file=gdb_could_not_find_fullpath.c}]
  30489. (gdb)
  30490. The '-file-list-shared-libraries' Command
  30491. -----------------------------------------
  30492. Synopsis
  30493. ........
  30494. -file-list-shared-libraries [ REGEXP ]
  30495. List the shared libraries in the program. With a regular expression
  30496. REGEXP, only those libraries whose names match REGEXP are listed.
  30497. GDB Command
  30498. ...........
  30499. The corresponding GDB command is 'info shared'. The fields have a
  30500. similar meaning to the '=library-loaded' notification. The 'ranges'
  30501. field specifies the multiple segments belonging to this library. Each
  30502. range has the following fields:
  30503. 'from'
  30504. The address defining the inclusive lower bound of the segment.
  30505. 'to'
  30506. The address defining the exclusive upper bound of the segment.
  30507. Example
  30508. .......
  30509. (gdb)
  30510. -file-list-exec-source-files
  30511. ^done,shared-libraries=[
  30512. {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"}]},
  30513. {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"}]}]
  30514. (gdb)
  30515. The '-file-symbol-file' Command
  30516. -------------------------------
  30517. Synopsis
  30518. ........
  30519. -file-symbol-file FILE
  30520. Read symbol table info from the specified FILE argument. When used
  30521. without arguments, clears GDB's symbol table info. No output is
  30522. produced, except for a completion notification.
  30523. GDB Command
  30524. ...........
  30525. The corresponding GDB command is 'symbol-file'.
  30526. Example
  30527. .......
  30528. (gdb)
  30529. -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  30530. ^done
  30531. (gdb)
  30532. 
  30533. File: gdb.info, Node: GDB/MI Target Manipulation, Next: GDB/MI File Transfer Commands, Prev: GDB/MI File Commands, Up: GDB/MI
  30534. 27.20 GDB/MI Target Manipulation Commands
  30535. =========================================
  30536. The '-target-attach' Command
  30537. ----------------------------
  30538. Synopsis
  30539. ........
  30540. -target-attach PID | GID | FILE
  30541. Attach to a process PID or a file FILE outside of GDB, or a thread
  30542. group GID. If attaching to a thread group, the id previously returned
  30543. by '-list-thread-groups --available' must be used.
  30544. GDB Command
  30545. ...........
  30546. The corresponding GDB command is 'attach'.
  30547. Example
  30548. .......
  30549. (gdb)
  30550. -target-attach 34
  30551. =thread-created,id="1"
  30552. *stopped,thread-id="1",frame={addr="0xb7f7e410",func="bar",args=[]}
  30553. ^done
  30554. (gdb)
  30555. The '-target-detach' Command
  30556. ----------------------------
  30557. Synopsis
  30558. ........
  30559. -target-detach [ PID | GID ]
  30560. Detach from the remote target which normally resumes its execution.
  30561. If either PID or GID is specified, detaches from either the specified
  30562. process, or specified thread group. There's no output.
  30563. GDB Command
  30564. ...........
  30565. The corresponding GDB command is 'detach'.
  30566. Example
  30567. .......
  30568. (gdb)
  30569. -target-detach
  30570. ^done
  30571. (gdb)
  30572. The '-target-disconnect' Command
  30573. --------------------------------
  30574. Synopsis
  30575. ........
  30576. -target-disconnect
  30577. Disconnect from the remote target. There's no output and the target
  30578. is generally not resumed.
  30579. GDB Command
  30580. ...........
  30581. The corresponding GDB command is 'disconnect'.
  30582. Example
  30583. .......
  30584. (gdb)
  30585. -target-disconnect
  30586. ^done
  30587. (gdb)
  30588. The '-target-download' Command
  30589. ------------------------------
  30590. Synopsis
  30591. ........
  30592. -target-download
  30593. Loads the executable onto the remote target. It prints out an update
  30594. message every half second, which includes the fields:
  30595. 'section'
  30596. The name of the section.
  30597. 'section-sent'
  30598. The size of what has been sent so far for that section.
  30599. 'section-size'
  30600. The size of the section.
  30601. 'total-sent'
  30602. The total size of what was sent so far (the current and the
  30603. previous sections).
  30604. 'total-size'
  30605. The size of the overall executable to download.
  30606. Each message is sent as status record (*note GDB/MI Output Syntax:
  30607. GDB/MI Output Syntax.).
  30608. In addition, it prints the name and size of the sections, as they are
  30609. downloaded. These messages include the following fields:
  30610. 'section'
  30611. The name of the section.
  30612. 'section-size'
  30613. The size of the section.
  30614. 'total-size'
  30615. The size of the overall executable to download.
  30616. At the end, a summary is printed.
  30617. GDB Command
  30618. ...........
  30619. The corresponding GDB command is 'load'.
  30620. Example
  30621. .......
  30622. Note: each status message appears on a single line. Here the messages
  30623. have been broken down so that they can fit onto a page.
  30624. (gdb)
  30625. -target-download
  30626. +download,{section=".text",section-size="6668",total-size="9880"}
  30627. +download,{section=".text",section-sent="512",section-size="6668",
  30628. total-sent="512",total-size="9880"}
  30629. +download,{section=".text",section-sent="1024",section-size="6668",
  30630. total-sent="1024",total-size="9880"}
  30631. +download,{section=".text",section-sent="1536",section-size="6668",
  30632. total-sent="1536",total-size="9880"}
  30633. +download,{section=".text",section-sent="2048",section-size="6668",
  30634. total-sent="2048",total-size="9880"}
  30635. +download,{section=".text",section-sent="2560",section-size="6668",
  30636. total-sent="2560",total-size="9880"}
  30637. +download,{section=".text",section-sent="3072",section-size="6668",
  30638. total-sent="3072",total-size="9880"}
  30639. +download,{section=".text",section-sent="3584",section-size="6668",
  30640. total-sent="3584",total-size="9880"}
  30641. +download,{section=".text",section-sent="4096",section-size="6668",
  30642. total-sent="4096",total-size="9880"}
  30643. +download,{section=".text",section-sent="4608",section-size="6668",
  30644. total-sent="4608",total-size="9880"}
  30645. +download,{section=".text",section-sent="5120",section-size="6668",
  30646. total-sent="5120",total-size="9880"}
  30647. +download,{section=".text",section-sent="5632",section-size="6668",
  30648. total-sent="5632",total-size="9880"}
  30649. +download,{section=".text",section-sent="6144",section-size="6668",
  30650. total-sent="6144",total-size="9880"}
  30651. +download,{section=".text",section-sent="6656",section-size="6668",
  30652. total-sent="6656",total-size="9880"}
  30653. +download,{section=".init",section-size="28",total-size="9880"}
  30654. +download,{section=".fini",section-size="28",total-size="9880"}
  30655. +download,{section=".data",section-size="3156",total-size="9880"}
  30656. +download,{section=".data",section-sent="512",section-size="3156",
  30657. total-sent="7236",total-size="9880"}
  30658. +download,{section=".data",section-sent="1024",section-size="3156",
  30659. total-sent="7748",total-size="9880"}
  30660. +download,{section=".data",section-sent="1536",section-size="3156",
  30661. total-sent="8260",total-size="9880"}
  30662. +download,{section=".data",section-sent="2048",section-size="3156",
  30663. total-sent="8772",total-size="9880"}
  30664. +download,{section=".data",section-sent="2560",section-size="3156",
  30665. total-sent="9284",total-size="9880"}
  30666. +download,{section=".data",section-sent="3072",section-size="3156",
  30667. total-sent="9796",total-size="9880"}
  30668. ^done,address="0x10004",load-size="9880",transfer-rate="6586",
  30669. write-rate="429"
  30670. (gdb)
  30671. GDB Command
  30672. ...........
  30673. No equivalent.
  30674. Example
  30675. .......
  30676. N.A.
  30677. The '-target-flash-erase' Command
  30678. ---------------------------------
  30679. Synopsis
  30680. ........
  30681. -target-flash-erase
  30682. Erases all known flash memory regions on the target.
  30683. The corresponding GDB command is 'flash-erase'.
  30684. The output is a list of flash regions that have been erased, with
  30685. starting addresses and memory region sizes.
  30686. (gdb)
  30687. -target-flash-erase
  30688. ^done,erased-regions={address="0x0",size="0x40000"}
  30689. (gdb)
  30690. The '-target-select' Command
  30691. ----------------------------
  30692. Synopsis
  30693. ........
  30694. -target-select TYPE PARAMETERS ...
  30695. Connect GDB to the remote target. This command takes two args:
  30696. 'TYPE'
  30697. The type of target, for instance 'remote', etc.
  30698. 'PARAMETERS'
  30699. Device names, host names and the like. *Note Commands for Managing
  30700. Targets: Target Commands, for more details.
  30701. The output is a connection notification, followed by the address at
  30702. which the target program is, in the following form:
  30703. ^connected,addr="ADDRESS",func="FUNCTION NAME",
  30704. args=[ARG LIST]
  30705. GDB Command
  30706. ...........
  30707. The corresponding GDB command is 'target'.
  30708. Example
  30709. .......
  30710. (gdb)
  30711. -target-select remote /dev/ttya
  30712. ^connected,addr="0xfe00a300",func="??",args=[]
  30713. (gdb)
  30714. 
  30715. File: gdb.info, Node: GDB/MI File Transfer Commands, Next: GDB/MI Ada Exceptions Commands, Prev: GDB/MI Target Manipulation, Up: GDB/MI
  30716. 27.21 GDB/MI File Transfer Commands
  30717. ===================================
  30718. The '-target-file-put' Command
  30719. ------------------------------
  30720. Synopsis
  30721. ........
  30722. -target-file-put HOSTFILE TARGETFILE
  30723. Copy file HOSTFILE from the host system (the machine running GDB) to
  30724. TARGETFILE on the target system.
  30725. GDB Command
  30726. ...........
  30727. The corresponding GDB command is 'remote put'.
  30728. Example
  30729. .......
  30730. (gdb)
  30731. -target-file-put localfile remotefile
  30732. ^done
  30733. (gdb)
  30734. The '-target-file-get' Command
  30735. ------------------------------
  30736. Synopsis
  30737. ........
  30738. -target-file-get TARGETFILE HOSTFILE
  30739. Copy file TARGETFILE from the target system to HOSTFILE on the host
  30740. system.
  30741. GDB Command
  30742. ...........
  30743. The corresponding GDB command is 'remote get'.
  30744. Example
  30745. .......
  30746. (gdb)
  30747. -target-file-get remotefile localfile
  30748. ^done
  30749. (gdb)
  30750. The '-target-file-delete' Command
  30751. ---------------------------------
  30752. Synopsis
  30753. ........
  30754. -target-file-delete TARGETFILE
  30755. Delete TARGETFILE from the target system.
  30756. GDB Command
  30757. ...........
  30758. The corresponding GDB command is 'remote delete'.
  30759. Example
  30760. .......
  30761. (gdb)
  30762. -target-file-delete remotefile
  30763. ^done
  30764. (gdb)
  30765. 
  30766. File: gdb.info, Node: GDB/MI Ada Exceptions Commands, Next: GDB/MI Support Commands, Prev: GDB/MI File Transfer Commands, Up: GDB/MI
  30767. 27.22 Ada Exceptions GDB/MI Commands
  30768. ====================================
  30769. The '-info-ada-exceptions' Command
  30770. ----------------------------------
  30771. Synopsis
  30772. ........
  30773. -info-ada-exceptions [ REGEXP]
  30774. List all Ada exceptions defined within the program being debugged.
  30775. With a regular expression REGEXP, only those exceptions whose names
  30776. match REGEXP are listed.
  30777. GDB Command
  30778. ...........
  30779. The corresponding GDB command is 'info exceptions'.
  30780. Result
  30781. ......
  30782. The result is a table of Ada exceptions. The following columns are
  30783. defined for each exception:
  30784. 'name'
  30785. The name of the exception.
  30786. 'address'
  30787. The address of the exception.
  30788. Example
  30789. .......
  30790. -info-ada-exceptions aint
  30791. ^done,ada-exceptions={nr_rows="2",nr_cols="2",
  30792. hdr=[{width="1",alignment="-1",col_name="name",colhdr="Name"},
  30793. {width="1",alignment="-1",col_name="address",colhdr="Address"}],
  30794. body=[{name="constraint_error",address="0x0000000000613da0"},
  30795. {name="const.aint_global_e",address="0x0000000000613b00"}]}
  30796. Catching Ada Exceptions
  30797. -----------------------
  30798. The commands describing how to ask GDB to stop when a program raises an
  30799. exception are described at *note Ada Exception GDB/MI Catchpoint
  30800. Commands::.
  30801. 
  30802. File: gdb.info, Node: GDB/MI Support Commands, Next: GDB/MI Miscellaneous Commands, Prev: GDB/MI Ada Exceptions Commands, Up: GDB/MI
  30803. 27.23 GDB/MI Support Commands
  30804. =============================
  30805. Since new commands and features get regularly added to GDB/MI, some
  30806. commands are available to help front-ends query the debugger about
  30807. support for these capabilities. Similarly, it is also possible to query
  30808. GDB about target support of certain features.
  30809. The '-info-gdb-mi-command' Command
  30810. ----------------------------------
  30811. Synopsis
  30812. ........
  30813. -info-gdb-mi-command CMD_NAME
  30814. Query support for the GDB/MI command named CMD_NAME.
  30815. Note that the dash ('-') starting all GDB/MI commands is technically
  30816. not part of the command name (*note GDB/MI Input Syntax::), and thus
  30817. should be omitted in CMD_NAME. However, for ease of use, this command
  30818. also accepts the form with the leading dash.
  30819. GDB Command
  30820. ...........
  30821. There is no corresponding GDB command.
  30822. Result
  30823. ......
  30824. The result is a tuple. There is currently only one field:
  30825. 'exists'
  30826. This field is equal to '"true"' if the GDB/MI command exists,
  30827. '"false"' otherwise.
  30828. Example
  30829. .......
  30830. Here is an example where the GDB/MI command does not exist:
  30831. -info-gdb-mi-command unsupported-command
  30832. ^done,command={exists="false"}
  30833. And here is an example where the GDB/MI command is known to the
  30834. debugger:
  30835. -info-gdb-mi-command symbol-list-lines
  30836. ^done,command={exists="true"}
  30837. The '-list-features' Command
  30838. ----------------------------
  30839. Returns a list of particular features of the MI protocol that this
  30840. version of gdb implements. A feature can be a command, or a new field
  30841. in an output of some command, or even an important bugfix. While a
  30842. frontend can sometimes detect presence of a feature at runtime, it is
  30843. easier to perform detection at debugger startup.
  30844. The command returns a list of strings, with each string naming an
  30845. available feature. Each returned string is just a name, it does not
  30846. have any internal structure. The list of possible feature names is
  30847. given below.
  30848. Example output:
  30849. (gdb) -list-features
  30850. ^done,result=["feature1","feature2"]
  30851. The current list of features is:
  30852. 'frozen-varobjs'
  30853. Indicates support for the '-var-set-frozen' command, as well as
  30854. possible presence of the 'frozen' field in the output of
  30855. '-varobj-create'.
  30856. 'pending-breakpoints'
  30857. Indicates support for the '-f' option to the '-break-insert'
  30858. command.
  30859. 'python'
  30860. Indicates Python scripting support, Python-based pretty-printing
  30861. commands, and possible presence of the 'display_hint' field in the
  30862. output of '-var-list-children'
  30863. 'thread-info'
  30864. Indicates support for the '-thread-info' command.
  30865. 'data-read-memory-bytes'
  30866. Indicates support for the '-data-read-memory-bytes' and the
  30867. '-data-write-memory-bytes' commands.
  30868. 'breakpoint-notifications'
  30869. Indicates that changes to breakpoints and breakpoints created via
  30870. the CLI will be announced via async records.
  30871. 'ada-task-info'
  30872. Indicates support for the '-ada-task-info' command.
  30873. 'language-option'
  30874. Indicates that all GDB/MI commands accept the '--language' option
  30875. (*note Context management::).
  30876. 'info-gdb-mi-command'
  30877. Indicates support for the '-info-gdb-mi-command' command.
  30878. 'undefined-command-error-code'
  30879. Indicates support for the "undefined-command" error code in error
  30880. result records, produced when trying to execute an undefined GDB/MI
  30881. command (*note GDB/MI Result Records::).
  30882. 'exec-run-start-option'
  30883. Indicates that the '-exec-run' command supports the '--start'
  30884. option (*note GDB/MI Program Execution::).
  30885. 'data-disassemble-a-option'
  30886. Indicates that the '-data-disassemble' command supports the '-a'
  30887. option (*note GDB/MI Data Manipulation::).
  30888. The '-list-target-features' Command
  30889. -----------------------------------
  30890. Returns a list of particular features that are supported by the target.
  30891. Those features affect the permitted MI commands, but unlike the features
  30892. reported by the '-list-features' command, the features depend on which
  30893. target GDB is using at the moment. Whenever a target can change, due to
  30894. commands such as '-target-select', '-target-attach' or '-exec-run', the
  30895. list of target features may change, and the frontend should obtain it
  30896. again. Example output:
  30897. (gdb) -list-target-features
  30898. ^done,result=["async"]
  30899. The current list of features is:
  30900. 'async'
  30901. Indicates that the target is capable of asynchronous command
  30902. execution, which means that GDB will accept further commands while
  30903. the target is running.
  30904. 'reverse'
  30905. Indicates that the target is capable of reverse execution. *Note
  30906. Reverse Execution::, for more information.
  30907. 
  30908. File: gdb.info, Node: GDB/MI Miscellaneous Commands, Prev: GDB/MI Support Commands, Up: GDB/MI
  30909. 27.24 Miscellaneous GDB/MI Commands
  30910. ===================================
  30911. The '-gdb-exit' Command
  30912. -----------------------
  30913. Synopsis
  30914. ........
  30915. -gdb-exit
  30916. Exit GDB immediately.
  30917. GDB Command
  30918. ...........
  30919. Approximately corresponds to 'quit'.
  30920. Example
  30921. .......
  30922. (gdb)
  30923. -gdb-exit
  30924. ^exit
  30925. The '-gdb-set' Command
  30926. ----------------------
  30927. Synopsis
  30928. ........
  30929. -gdb-set
  30930. Set an internal GDB variable.
  30931. GDB Command
  30932. ...........
  30933. The corresponding GDB command is 'set'.
  30934. Example
  30935. .......
  30936. (gdb)
  30937. -gdb-set $foo=3
  30938. ^done
  30939. (gdb)
  30940. The '-gdb-show' Command
  30941. -----------------------
  30942. Synopsis
  30943. ........
  30944. -gdb-show
  30945. Show the current value of a GDB variable.
  30946. GDB Command
  30947. ...........
  30948. The corresponding GDB command is 'show'.
  30949. Example
  30950. .......
  30951. (gdb)
  30952. -gdb-show annotate
  30953. ^done,value="0"
  30954. (gdb)
  30955. The '-gdb-version' Command
  30956. --------------------------
  30957. Synopsis
  30958. ........
  30959. -gdb-version
  30960. Show version information for GDB. Used mostly in testing.
  30961. GDB Command
  30962. ...........
  30963. The GDB equivalent is 'show version'. GDB by default shows this
  30964. information when you start an interactive session.
  30965. Example
  30966. .......
  30967. (gdb)
  30968. -gdb-version
  30969. ~GNU gdb 5.2.1
  30970. ~Copyright 2000 Free Software Foundation, Inc.
  30971. ~GDB is free software, covered by the GNU General Public License, and
  30972. ~you are welcome to change it and/or distribute copies of it under
  30973. ~ certain conditions.
  30974. ~Type "show copying" to see the conditions.
  30975. ~There is absolutely no warranty for GDB. Type "show warranty" for
  30976. ~ details.
  30977. ~This GDB was configured as
  30978. "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
  30979. ^done
  30980. (gdb)
  30981. The '-list-thread-groups' Command
  30982. ---------------------------------
  30983. Synopsis
  30984. --------
  30985. -list-thread-groups [ --available ] [ --recurse 1 ] [ GROUP ... ]
  30986. Lists thread groups (*note Thread groups::). When a single thread
  30987. group is passed as the argument, lists the children of that group. When
  30988. several thread group are passed, lists information about those thread
  30989. groups. Without any parameters, lists information about all top-level
  30990. thread groups.
  30991. Normally, thread groups that are being debugged are reported. With
  30992. the '--available' option, GDB reports thread groups available on the
  30993. target.
  30994. The output of this command may have either a 'threads' result or a
  30995. 'groups' result. The 'thread' result has a list of tuples as value,
  30996. with each tuple describing a thread (*note GDB/MI Thread Information::).
  30997. The 'groups' result has a list of tuples as value, each tuple describing
  30998. a thread group. If top-level groups are requested (that is, no
  30999. parameter is passed), or when several groups are passed, the output
  31000. always has a 'groups' result. The format of the 'group' result is
  31001. described below.
  31002. To reduce the number of roundtrips it's possible to list thread
  31003. groups together with their children, by passing the '--recurse' option
  31004. and the recursion depth. Presently, only recursion depth of 1 is
  31005. permitted. If this option is present, then every reported thread group
  31006. will also include its children, either as 'group' or 'threads' field.
  31007. In general, any combination of option and parameters is permitted,
  31008. with the following caveats:
  31009. * When a single thread group is passed, the output will typically be
  31010. the 'threads' result. Because threads may not contain anything,
  31011. the 'recurse' option will be ignored.
  31012. * When the '--available' option is passed, limited information may be
  31013. available. In particular, the list of threads of a process might
  31014. be inaccessible. Further, specifying specific thread groups might
  31015. not give any performance advantage over listing all thread groups.
  31016. The frontend should assume that '-list-thread-groups --available'
  31017. is always an expensive operation and cache the results.
  31018. The 'groups' result is a list of tuples, where each tuple may have
  31019. the following fields:
  31020. 'id'
  31021. Identifier of the thread group. This field is always present. The
  31022. identifier is an opaque string; frontends should not try to convert
  31023. it to an integer, even though it might look like one.
  31024. 'type'
  31025. The type of the thread group. At present, only 'process' is a
  31026. valid type.
  31027. 'pid'
  31028. The target-specific process identifier. This field is only present
  31029. for thread groups of type 'process' and only if the process exists.
  31030. 'exit-code'
  31031. The exit code of this group's last exited thread, formatted in
  31032. octal. This field is only present for thread groups of type
  31033. 'process' and only if the process is not running.
  31034. 'num_children'
  31035. The number of children this thread group has. This field may be
  31036. absent for an available thread group.
  31037. 'threads'
  31038. This field has a list of tuples as value, each tuple describing a
  31039. thread. It may be present if the '--recurse' option is specified,
  31040. and it's actually possible to obtain the threads.
  31041. 'cores'
  31042. This field is a list of integers, each identifying a core that one
  31043. thread of the group is running on. This field may be absent if
  31044. such information is not available.
  31045. 'executable'
  31046. The name of the executable file that corresponds to this thread
  31047. group. The field is only present for thread groups of type
  31048. 'process', and only if there is a corresponding executable file.
  31049. Example
  31050. -------
  31051. gdb
  31052. -list-thread-groups
  31053. ^done,groups=[{id="17",type="process",pid="yyy",num_children="2"}]
  31054. -list-thread-groups 17
  31055. ^done,threads=[{id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
  31056. frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",args=[]},state="running"},
  31057. {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
  31058. frame={level="0",addr="0x0804891f",func="foo",args=[{name="i",value="10"}],
  31059. file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"},state="running"}]]
  31060. -list-thread-groups --available
  31061. ^done,groups=[{id="17",type="process",pid="yyy",num_children="2",cores=[1,2]}]
  31062. -list-thread-groups --available --recurse 1
  31063. ^done,groups=[{id="17", types="process",pid="yyy",num_children="2",cores=[1,2],
  31064. threads=[{id="1",target-id="Thread 0xb7e14b90",cores=[1]},
  31065. {id="2",target-id="Thread 0xb7e14b90",cores=[2]}]},..]
  31066. -list-thread-groups --available --recurse 1 17 18
  31067. ^done,groups=[{id="17", types="process",pid="yyy",num_children="2",cores=[1,2],
  31068. threads=[{id="1",target-id="Thread 0xb7e14b90",cores=[1]},
  31069. {id="2",target-id="Thread 0xb7e14b90",cores=[2]}]},...]
  31070. The '-info-os' Command
  31071. ----------------------
  31072. Synopsis
  31073. ........
  31074. -info-os [ TYPE ]
  31075. If no argument is supplied, the command returns a table of available
  31076. operating-system-specific information types. If one of these types is
  31077. supplied as an argument TYPE, then the command returns a table of data
  31078. of that type.
  31079. The types of information available depend on the target operating
  31080. system.
  31081. GDB Command
  31082. ...........
  31083. The corresponding GDB command is 'info os'.
  31084. Example
  31085. .......
  31086. When run on a GNU/Linux system, the output will look something like
  31087. this:
  31088. gdb
  31089. -info-os
  31090. ^done,OSDataTable={nr_rows="10",nr_cols="3",
  31091. hdr=[{width="10",alignment="-1",col_name="col0",colhdr="Type"},
  31092. {width="10",alignment="-1",col_name="col1",colhdr="Description"},
  31093. {width="10",alignment="-1",col_name="col2",colhdr="Title"}],
  31094. body=[item={col0="cpus",col1="Listing of all cpus/cores on the system",
  31095. col2="CPUs"},
  31096. item={col0="files",col1="Listing of all file descriptors",
  31097. col2="File descriptors"},
  31098. item={col0="modules",col1="Listing of all loaded kernel modules",
  31099. col2="Kernel modules"},
  31100. item={col0="msg",col1="Listing of all message queues",
  31101. col2="Message queues"},
  31102. item={col0="processes",col1="Listing of all processes",
  31103. col2="Processes"},
  31104. item={col0="procgroups",col1="Listing of all process groups",
  31105. col2="Process groups"},
  31106. item={col0="semaphores",col1="Listing of all semaphores",
  31107. col2="Semaphores"},
  31108. item={col0="shm",col1="Listing of all shared-memory regions",
  31109. col2="Shared-memory regions"},
  31110. item={col0="sockets",col1="Listing of all internet-domain sockets",
  31111. col2="Sockets"},
  31112. item={col0="threads",col1="Listing of all threads",
  31113. col2="Threads"}]
  31114. gdb
  31115. -info-os processes
  31116. ^done,OSDataTable={nr_rows="190",nr_cols="4",
  31117. hdr=[{width="10",alignment="-1",col_name="col0",colhdr="pid"},
  31118. {width="10",alignment="-1",col_name="col1",colhdr="user"},
  31119. {width="10",alignment="-1",col_name="col2",colhdr="command"},
  31120. {width="10",alignment="-1",col_name="col3",colhdr="cores"}],
  31121. body=[item={col0="1",col1="root",col2="/sbin/init",col3="0"},
  31122. item={col0="2",col1="root",col2="[kthreadd]",col3="1"},
  31123. item={col0="3",col1="root",col2="[ksoftirqd/0]",col3="0"},
  31124. ...
  31125. item={col0="26446",col1="stan",col2="bash",col3="0"},
  31126. item={col0="28152",col1="stan",col2="bash",col3="1"}]}
  31127. (gdb)
  31128. (Note that the MI output here includes a '"Title"' column that does
  31129. not appear in command-line 'info os'; this column is useful for MI
  31130. clients that want to enumerate the types of data, such as in a popup
  31131. menu, but is needless clutter on the command line, and 'info os' omits
  31132. it.)
  31133. The '-add-inferior' Command
  31134. ---------------------------
  31135. Synopsis
  31136. --------
  31137. -add-inferior
  31138. Creates a new inferior (*note Inferiors Connections and Programs::).
  31139. The created inferior is not associated with any executable. Such
  31140. association may be established with the '-file-exec-and-symbols' command
  31141. (*note GDB/MI File Commands::). The command response has a single
  31142. field, 'inferior', whose value is the identifier of the thread group
  31143. corresponding to the new inferior.
  31144. Example
  31145. -------
  31146. gdb
  31147. -add-inferior
  31148. ^done,inferior="i3"
  31149. The '-interpreter-exec' Command
  31150. -------------------------------
  31151. Synopsis
  31152. --------
  31153. -interpreter-exec INTERPRETER COMMAND
  31154. Execute the specified COMMAND in the given INTERPRETER.
  31155. GDB Command
  31156. -----------
  31157. The corresponding GDB command is 'interpreter-exec'.
  31158. Example
  31159. -------
  31160. (gdb)
  31161. -interpreter-exec console "break main"
  31162. &"During symbol reading, couldn't parse type; debugger out of date?.\n"
  31163. &"During symbol reading, bad structure-type format.\n"
  31164. ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
  31165. ^done
  31166. (gdb)
  31167. The '-inferior-tty-set' Command
  31168. -------------------------------
  31169. Synopsis
  31170. --------
  31171. -inferior-tty-set /dev/pts/1
  31172. Set terminal for future runs of the program being debugged.
  31173. GDB Command
  31174. -----------
  31175. The corresponding GDB command is 'set inferior-tty' /dev/pts/1.
  31176. Example
  31177. -------
  31178. (gdb)
  31179. -inferior-tty-set /dev/pts/1
  31180. ^done
  31181. (gdb)
  31182. The '-inferior-tty-show' Command
  31183. --------------------------------
  31184. Synopsis
  31185. --------
  31186. -inferior-tty-show
  31187. Show terminal for future runs of program being debugged.
  31188. GDB Command
  31189. -----------
  31190. The corresponding GDB command is 'show inferior-tty'.
  31191. Example
  31192. -------
  31193. (gdb)
  31194. -inferior-tty-set /dev/pts/1
  31195. ^done
  31196. (gdb)
  31197. -inferior-tty-show
  31198. ^done,inferior_tty_terminal="/dev/pts/1"
  31199. (gdb)
  31200. The '-enable-timings' Command
  31201. -----------------------------
  31202. Synopsis
  31203. --------
  31204. -enable-timings [yes | no]
  31205. Toggle the printing of the wallclock, user and system times for an MI
  31206. command as a field in its output. This command is to help frontend
  31207. developers optimize the performance of their code. No argument is
  31208. equivalent to 'yes'.
  31209. GDB Command
  31210. -----------
  31211. No equivalent.
  31212. Example
  31213. -------
  31214. (gdb)
  31215. -enable-timings
  31216. ^done
  31217. (gdb)
  31218. -break-insert main
  31219. ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  31220. addr="0x080484ed",func="main",file="myprog.c",
  31221. fullname="/home/nickrob/myprog.c",line="73",thread-groups=["i1"],
  31222. times="0"},
  31223. time={wallclock="0.05185",user="0.00800",system="0.00000"}
  31224. (gdb)
  31225. -enable-timings no
  31226. ^done
  31227. (gdb)
  31228. -exec-run
  31229. ^running
  31230. (gdb)
  31231. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
  31232. frame={addr="0x080484ed",func="main",args=[{name="argc",value="1"},
  31233. {name="argv",value="0xbfb60364"}],file="myprog.c",
  31234. fullname="/home/nickrob/myprog.c",line="73",arch="i386:x86_64"}
  31235. (gdb)
  31236. The '-complete' Command
  31237. -----------------------
  31238. Synopsis
  31239. --------
  31240. -complete COMMAND
  31241. Show a list of completions for partially typed CLI COMMAND.
  31242. This command is intended for GDB/MI frontends that cannot use two
  31243. separate CLI and MI channels -- for example: because of lack of PTYs
  31244. like on Windows or because GDB is used remotely via a SSH connection.
  31245. Result
  31246. ------
  31247. The result consists of two or three fields:
  31248. 'completion'
  31249. This field contains the completed COMMAND. If COMMAND has no known
  31250. completions, this field is omitted.
  31251. 'matches'
  31252. This field contains a (possibly empty) array of matches. It is
  31253. always present.
  31254. 'max_completions_reached'
  31255. This field contains '1' if number of known completions is above
  31256. 'max-completions' limit (*note Completion::), otherwise it contains
  31257. '0'. It is always present.
  31258. GDB Command
  31259. -----------
  31260. The corresponding GDB command is 'complete'.
  31261. Example
  31262. -------
  31263. (gdb)
  31264. -complete br
  31265. ^done,completion="break",
  31266. matches=["break","break-range"],
  31267. max_completions_reached="0"
  31268. (gdb)
  31269. -complete "b ma"
  31270. ^done,completion="b ma",
  31271. matches=["b madvise","b main"],max_completions_reached="0"
  31272. (gdb)
  31273. -complete "b push_b"
  31274. ^done,completion="b push_back(",
  31275. matches=[
  31276. "b A::push_back(void*)",
  31277. "b std::string::push_back(char)",
  31278. "b std::vector<int, std::allocator<int> >::push_back(int&&)"],
  31279. max_completions_reached="0"
  31280. (gdb)
  31281. -complete "nonexist"
  31282. ^done,matches=[],max_completions_reached="0"
  31283. (gdb)
  31284. 
  31285. File: gdb.info, Node: Annotations, Next: JIT Interface, Prev: GDB/MI, Up: Top
  31286. 28 GDB Annotations
  31287. ******************
  31288. This chapter describes annotations in GDB. Annotations were designed to
  31289. interface GDB to graphical user interfaces or other similar programs
  31290. which want to interact with GDB at a relatively high level.
  31291. The annotation mechanism has largely been superseded by GDB/MI (*note
  31292. GDB/MI::).
  31293. * Menu:
  31294. * Annotations Overview:: What annotations are; the general syntax.
  31295. * Server Prefix:: Issuing a command without affecting user state.
  31296. * Prompting:: Annotations marking GDB's need for input.
  31297. * Errors:: Annotations for error messages.
  31298. * Invalidation:: Some annotations describe things now invalid.
  31299. * Annotations for Running::
  31300. Whether the program is running, how it stopped, etc.
  31301. * Source Annotations:: Annotations describing source code.
  31302. 
  31303. File: gdb.info, Node: Annotations Overview, Next: Server Prefix, Up: Annotations
  31304. 28.1 What is an Annotation?
  31305. ===========================
  31306. Annotations start with a newline character, two 'control-z' characters,
  31307. and the name of the annotation. If there is no additional information
  31308. associated with this annotation, the name of the annotation is followed
  31309. immediately by a newline. If there is additional information, the name
  31310. of the annotation is followed by a space, the additional information,
  31311. and a newline. The additional information cannot contain newline
  31312. characters.
  31313. Any output not beginning with a newline and two 'control-z'
  31314. characters denotes literal output from GDB. Currently there is no need
  31315. for GDB to output a newline followed by two 'control-z' characters, but
  31316. if there was such a need, the annotations could be extended with an
  31317. 'escape' annotation which means those three characters as output.
  31318. The annotation LEVEL, which is specified using the '--annotate'
  31319. command line option (*note Mode Options::), controls how much
  31320. information GDB prints together with its prompt, values of expressions,
  31321. source lines, and other types of output. Level 0 is for no annotations,
  31322. level 1 is for use when GDB is run as a subprocess of GNU Emacs, level 3
  31323. is the maximum annotation suitable for programs that control GDB, and
  31324. level 2 annotations have been made obsolete (*note Limitations of the
  31325. Annotation Interface: (annotate)Limitations.).
  31326. 'set annotate LEVEL'
  31327. The GDB command 'set annotate' sets the level of annotations to the
  31328. specified LEVEL.
  31329. 'show annotate'
  31330. Show the current annotation level.
  31331. This chapter describes level 3 annotations.
  31332. A simple example of starting up GDB with annotations is:
  31333. $ gdb --annotate=3
  31334. GNU gdb 6.0
  31335. Copyright 2003 Free Software Foundation, Inc.
  31336. GDB is free software, covered by the GNU General Public License,
  31337. and you are welcome to change it and/or distribute copies of it
  31338. under certain conditions.
  31339. Type "show copying" to see the conditions.
  31340. There is absolutely no warranty for GDB. Type "show warranty"
  31341. for details.
  31342. This GDB was configured as "i386-pc-linux-gnu"
  31343. ^Z^Zpre-prompt
  31344. (gdb)
  31345. ^Z^Zprompt
  31346. quit
  31347. ^Z^Zpost-prompt
  31348. $
  31349. Here 'quit' is input to GDB; the rest is output from GDB. The three
  31350. lines beginning '^Z^Z' (where '^Z' denotes a 'control-z' character) are
  31351. annotations; the rest is output from GDB.
  31352. 
  31353. File: gdb.info, Node: Server Prefix, Next: Prompting, Prev: Annotations Overview, Up: Annotations
  31354. 28.2 The Server Prefix
  31355. ======================
  31356. If you prefix a command with 'server ' then it will not affect the
  31357. command history, nor will it affect GDB's notion of which command to
  31358. repeat if <RET> is pressed on a line by itself. This means that
  31359. commands can be run behind a user's back by a front-end in a transparent
  31360. manner.
  31361. The 'server ' prefix does not affect the recording of values into the
  31362. value history; to print a value without recording it into the value
  31363. history, use the 'output' command instead of the 'print' command.
  31364. Using this prefix also disables confirmation requests (*note
  31365. confirmation requests::).
  31366. 
  31367. File: gdb.info, Node: Prompting, Next: Errors, Prev: Server Prefix, Up: Annotations
  31368. 28.3 Annotation for GDB Input
  31369. =============================
  31370. When GDB prompts for input, it annotates this fact so it is possible to
  31371. know when to send output, when the output from a given command is over,
  31372. etc.
  31373. Different kinds of input each have a different "input type". Each
  31374. input type has three annotations: a 'pre-' annotation, which denotes the
  31375. beginning of any prompt which is being output, a plain annotation, which
  31376. denotes the end of the prompt, and then a 'post-' annotation which
  31377. denotes the end of any echo which may (or may not) be associated with
  31378. the input. For example, the 'prompt' input type features the following
  31379. annotations:
  31380. ^Z^Zpre-prompt
  31381. ^Z^Zprompt
  31382. ^Z^Zpost-prompt
  31383. The input types are
  31384. 'prompt'
  31385. When GDB is prompting for a command (the main GDB prompt).
  31386. 'commands'
  31387. When GDB prompts for a set of commands, like in the 'commands'
  31388. command. The annotations are repeated for each command which is
  31389. input.
  31390. 'overload-choice'
  31391. When GDB wants the user to select between various overloaded
  31392. functions.
  31393. 'query'
  31394. When GDB wants the user to confirm a potentially dangerous
  31395. operation.
  31396. 'prompt-for-continue'
  31397. When GDB is asking the user to press return to continue. Note:
  31398. Don't expect this to work well; instead use 'set height 0' to
  31399. disable prompting. This is because the counting of lines is buggy
  31400. in the presence of annotations.
  31401. 
  31402. File: gdb.info, Node: Errors, Next: Invalidation, Prev: Prompting, Up: Annotations
  31403. 28.4 Errors
  31404. ===========
  31405. ^Z^Zquit
  31406. This annotation occurs right before GDB responds to an interrupt.
  31407. ^Z^Zerror
  31408. This annotation occurs right before GDB responds to an error.
  31409. Quit and error annotations indicate that any annotations which GDB
  31410. was in the middle of may end abruptly. For example, if a
  31411. 'value-history-begin' annotation is followed by a 'error', one cannot
  31412. expect to receive the matching 'value-history-end'. One cannot expect
  31413. not to receive it either, however; an error annotation does not
  31414. necessarily mean that GDB is immediately returning all the way to the
  31415. top level.
  31416. A quit or error annotation may be preceded by
  31417. ^Z^Zerror-begin
  31418. Any output between that and the quit or error annotation is the error
  31419. message.
  31420. Warning messages are not yet annotated.
  31421. 
  31422. File: gdb.info, Node: Invalidation, Next: Annotations for Running, Prev: Errors, Up: Annotations
  31423. 28.5 Invalidation Notices
  31424. =========================
  31425. The following annotations say that certain pieces of state may have
  31426. changed.
  31427. '^Z^Zframes-invalid'
  31428. The frames (for example, output from the 'backtrace' command) may
  31429. have changed.
  31430. '^Z^Zbreakpoints-invalid'
  31431. The breakpoints may have changed. For example, the user just added
  31432. or deleted a breakpoint.
  31433. 
  31434. File: gdb.info, Node: Annotations for Running, Next: Source Annotations, Prev: Invalidation, Up: Annotations
  31435. 28.6 Running the Program
  31436. ========================
  31437. When the program starts executing due to a GDB command such as 'step' or
  31438. 'continue',
  31439. ^Z^Zstarting
  31440. is output. When the program stops,
  31441. ^Z^Zstopped
  31442. is output. Before the 'stopped' annotation, a variety of annotations
  31443. describe how the program stopped.
  31444. '^Z^Zexited EXIT-STATUS'
  31445. The program exited, and EXIT-STATUS is the exit status (zero for
  31446. successful exit, otherwise nonzero).
  31447. '^Z^Zsignalled'
  31448. The program exited with a signal. After the '^Z^Zsignalled', the
  31449. annotation continues:
  31450. INTRO-TEXT
  31451. ^Z^Zsignal-name
  31452. NAME
  31453. ^Z^Zsignal-name-end
  31454. MIDDLE-TEXT
  31455. ^Z^Zsignal-string
  31456. STRING
  31457. ^Z^Zsignal-string-end
  31458. END-TEXT
  31459. where NAME is the name of the signal, such as 'SIGILL' or
  31460. 'SIGSEGV', and STRING is the explanation of the signal, such as
  31461. 'Illegal Instruction' or 'Segmentation fault'. The arguments
  31462. INTRO-TEXT, MIDDLE-TEXT, and END-TEXT are for the user's benefit
  31463. and have no particular format.
  31464. '^Z^Zsignal'
  31465. The syntax of this annotation is just like 'signalled', but GDB is
  31466. just saying that the program received the signal, not that it was
  31467. terminated with it.
  31468. '^Z^Zbreakpoint NUMBER'
  31469. The program hit breakpoint number NUMBER.
  31470. '^Z^Zwatchpoint NUMBER'
  31471. The program hit watchpoint number NUMBER.
  31472. 
  31473. File: gdb.info, Node: Source Annotations, Prev: Annotations for Running, Up: Annotations
  31474. 28.7 Displaying Source
  31475. ======================
  31476. The following annotation is used instead of displaying source code:
  31477. ^Z^Zsource FILENAME:LINE:CHARACTER:MIDDLE:ADDR
  31478. where FILENAME is an absolute file name indicating which source file,
  31479. LINE is the line number within that file (where 1 is the first line in
  31480. the file), CHARACTER is the character position within the file (where 0
  31481. is the first character in the file) (for most debug formats this will
  31482. necessarily point to the beginning of a line), MIDDLE is 'middle' if
  31483. ADDR is in the middle of the line, or 'beg' if ADDR is at the beginning
  31484. of the line, and ADDR is the address in the target program associated
  31485. with the source which is being displayed. The ADDR is in the form '0x'
  31486. followed by one or more lowercase hex digits (note that this does not
  31487. depend on the language).
  31488. 
  31489. File: gdb.info, Node: JIT Interface, Next: In-Process Agent, Prev: Annotations, Up: Top
  31490. 29 JIT Compilation Interface
  31491. ****************************
  31492. This chapter documents GDB's "just-in-time" (JIT) compilation interface.
  31493. A JIT compiler is a program or library that generates native executable
  31494. code at runtime and executes it, usually in order to achieve good
  31495. performance while maintaining platform independence.
  31496. Programs that use JIT compilation are normally difficult to debug
  31497. because portions of their code are generated at runtime, instead of
  31498. being loaded from object files, which is where GDB normally finds the
  31499. program's symbols and debug information. In order to debug programs
  31500. that use JIT compilation, GDB has an interface that allows the program
  31501. to register in-memory symbol files with GDB at runtime.
  31502. If you are using GDB to debug a program that uses this interface,
  31503. then it should work transparently so long as you have not stripped the
  31504. binary. If you are developing a JIT compiler, then the interface is
  31505. documented in the rest of this chapter. At this time, the only known
  31506. client of this interface is the LLVM JIT.
  31507. Broadly speaking, the JIT interface mirrors the dynamic loader
  31508. interface. The JIT compiler communicates with GDB by writing data into
  31509. a global variable and calling a function at a well-known symbol. When
  31510. GDB attaches, it reads a linked list of symbol files from the global
  31511. variable to find existing code, and puts a breakpoint in the function so
  31512. that it can find out about additional code.
  31513. * Menu:
  31514. * Declarations:: Relevant C struct declarations
  31515. * Registering Code:: Steps to register code
  31516. * Unregistering Code:: Steps to unregister code
  31517. * Custom Debug Info:: Emit debug information in a custom format
  31518. 
  31519. File: gdb.info, Node: Declarations, Next: Registering Code, Up: JIT Interface
  31520. 29.1 JIT Declarations
  31521. =====================
  31522. These are the relevant struct declarations that a C program should
  31523. include to implement the interface:
  31524. typedef enum
  31525. {
  31526. JIT_NOACTION = 0,
  31527. JIT_REGISTER_FN,
  31528. JIT_UNREGISTER_FN
  31529. } jit_actions_t;
  31530. struct jit_code_entry
  31531. {
  31532. struct jit_code_entry *next_entry;
  31533. struct jit_code_entry *prev_entry;
  31534. const char *symfile_addr;
  31535. uint64_t symfile_size;
  31536. };
  31537. struct jit_descriptor
  31538. {
  31539. uint32_t version;
  31540. /* This type should be jit_actions_t, but we use uint32_t
  31541. to be explicit about the bitwidth. */
  31542. uint32_t action_flag;
  31543. struct jit_code_entry *relevant_entry;
  31544. struct jit_code_entry *first_entry;
  31545. };
  31546. /* GDB puts a breakpoint in this function. */
  31547. void __attribute__((noinline)) __jit_debug_register_code() { };
  31548. /* Make sure to specify the version statically, because the
  31549. debugger may check the version before we can set it. */
  31550. struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
  31551. If the JIT is multi-threaded, then it is important that the JIT
  31552. synchronize any modifications to this global data properly, which can
  31553. easily be done by putting a global mutex around modifications to these
  31554. structures.
  31555. 
  31556. File: gdb.info, Node: Registering Code, Next: Unregistering Code, Prev: Declarations, Up: JIT Interface
  31557. 29.2 Registering Code
  31558. =====================
  31559. To register code with GDB, the JIT should follow this protocol:
  31560. * Generate an object file in memory with symbols and other desired
  31561. debug information. The file must include the virtual addresses of
  31562. the sections.
  31563. * Create a code entry for the file, which gives the start and size of
  31564. the symbol file.
  31565. * Add it to the linked list in the JIT descriptor.
  31566. * Point the relevant_entry field of the descriptor at the entry.
  31567. * Set 'action_flag' to 'JIT_REGISTER' and call
  31568. '__jit_debug_register_code'.
  31569. When GDB is attached and the breakpoint fires, GDB uses the
  31570. 'relevant_entry' pointer so it doesn't have to walk the list looking for
  31571. new code. However, the linked list must still be maintained in order to
  31572. allow GDB to attach to a running process and still find the symbol
  31573. files.
  31574. 
  31575. File: gdb.info, Node: Unregistering Code, Next: Custom Debug Info, Prev: Registering Code, Up: JIT Interface
  31576. 29.3 Unregistering Code
  31577. =======================
  31578. If code is freed, then the JIT should use the following protocol:
  31579. * Remove the code entry corresponding to the code from the linked
  31580. list.
  31581. * Point the 'relevant_entry' field of the descriptor at the code
  31582. entry.
  31583. * Set 'action_flag' to 'JIT_UNREGISTER' and call
  31584. '__jit_debug_register_code'.
  31585. If the JIT frees or recompiles code without unregistering it, then
  31586. GDB and the JIT will leak the memory used for the associated symbol
  31587. files.
  31588. 
  31589. File: gdb.info, Node: Custom Debug Info, Prev: Unregistering Code, Up: JIT Interface
  31590. 29.4 Custom Debug Info
  31591. ======================
  31592. Generating debug information in platform-native file formats (like ELF
  31593. or COFF) may be an overkill for JIT compilers; especially if all the
  31594. debug info is used for is displaying a meaningful backtrace. The issue
  31595. can be resolved by having the JIT writers decide on a debug info format
  31596. and also provide a reader that parses the debug info generated by the
  31597. JIT compiler. This section gives a brief overview on writing such a
  31598. parser. More specific details can be found in the source file
  31599. 'gdb/jit-reader.in', which is also installed as a header at
  31600. 'INCLUDEDIR/gdb/jit-reader.h' for easy inclusion.
  31601. The reader is implemented as a shared object (so this functionality
  31602. is not available on platforms which don't allow loading shared objects
  31603. at runtime). Two GDB commands, 'jit-reader-load' and
  31604. 'jit-reader-unload' are provided, to be used to load and unload the
  31605. readers from a preconfigured directory. Once loaded, the shared object
  31606. is used the parse the debug information emitted by the JIT compiler.
  31607. * Menu:
  31608. * Using JIT Debug Info Readers:: How to use supplied readers correctly
  31609. * Writing JIT Debug Info Readers:: Creating a debug-info reader
  31610. 
  31611. File: gdb.info, Node: Using JIT Debug Info Readers, Next: Writing JIT Debug Info Readers, Up: Custom Debug Info
  31612. 29.4.1 Using JIT Debug Info Readers
  31613. -----------------------------------
  31614. Readers can be loaded and unloaded using the 'jit-reader-load' and
  31615. 'jit-reader-unload' commands.
  31616. 'jit-reader-load READER'
  31617. Load the JIT reader named READER, which is a shared object
  31618. specified as either an absolute or a relative file name. In the
  31619. latter case, GDB will try to load the reader from a pre-configured
  31620. directory, usually 'LIBDIR/gdb/' on a UNIX system (here LIBDIR is
  31621. the system library directory, often '/usr/local/lib').
  31622. Only one reader can be active at a time; trying to load a second
  31623. reader when one is already loaded will result in GDB reporting an
  31624. error. A new JIT reader can be loaded by first unloading the
  31625. current one using 'jit-reader-unload' and then invoking
  31626. 'jit-reader-load'.
  31627. 'jit-reader-unload'
  31628. Unload the currently loaded JIT reader.
  31629. 
  31630. File: gdb.info, Node: Writing JIT Debug Info Readers, Prev: Using JIT Debug Info Readers, Up: Custom Debug Info
  31631. 29.4.2 Writing JIT Debug Info Readers
  31632. -------------------------------------
  31633. As mentioned, a reader is essentially a shared object conforming to a
  31634. certain ABI. This ABI is described in 'jit-reader.h'.
  31635. 'jit-reader.h' defines the structures, macros and functions required
  31636. to write a reader. It is installed (along with GDB), in
  31637. 'INCLUDEDIR/gdb' where INCLUDEDIR is the system include directory.
  31638. Readers need to be released under a GPL compatible license. A reader
  31639. can be declared as released under such a license by placing the macro
  31640. 'GDB_DECLARE_GPL_COMPATIBLE_READER' in a source file.
  31641. The entry point for readers is the symbol 'gdb_init_reader', which is
  31642. expected to be a function with the prototype
  31643. extern struct gdb_reader_funcs *gdb_init_reader (void);
  31644. 'struct gdb_reader_funcs' contains a set of pointers to callback
  31645. functions. These functions are executed to read the debug info
  31646. generated by the JIT compiler ('read'), to unwind stack frames
  31647. ('unwind') and to create canonical frame IDs ('get_frame_id'). It also
  31648. has a callback that is called when the reader is being unloaded
  31649. ('destroy'). The struct looks like this
  31650. struct gdb_reader_funcs
  31651. {
  31652. /* Must be set to GDB_READER_INTERFACE_VERSION. */
  31653. int reader_version;
  31654. /* For use by the reader. */
  31655. void *priv_data;
  31656. gdb_read_debug_info *read;
  31657. gdb_unwind_frame *unwind;
  31658. gdb_get_frame_id *get_frame_id;
  31659. gdb_destroy_reader *destroy;
  31660. };
  31661. The callbacks are provided with another set of callbacks by GDB to do
  31662. their job. For 'read', these callbacks are passed in a 'struct
  31663. gdb_symbol_callbacks' and for 'unwind' and 'get_frame_id', in a 'struct
  31664. gdb_unwind_callbacks'. 'struct gdb_symbol_callbacks' has callbacks to
  31665. create new object files and new symbol tables inside those object files.
  31666. 'struct gdb_unwind_callbacks' has callbacks to read registers off the
  31667. current frame and to write out the values of the registers in the
  31668. previous frame. Both have a callback ('target_read') to read bytes off
  31669. the target's address space.
  31670. 
  31671. File: gdb.info, Node: In-Process Agent, Next: GDB Bugs, Prev: JIT Interface, Up: Top
  31672. 30 In-Process Agent
  31673. *******************
  31674. The traditional debugging model is conceptually low-speed, but works
  31675. fine, because most bugs can be reproduced in debugging-mode execution.
  31676. However, as multi-core or many-core processors are becoming mainstream,
  31677. and multi-threaded programs become more and more popular, there should
  31678. be more and more bugs that only manifest themselves at normal-mode
  31679. execution, for example, thread races, because debugger's interference
  31680. with the program's timing may conceal the bugs. On the other hand, in
  31681. some applications, it is not feasible for the debugger to interrupt the
  31682. program's execution long enough for the developer to learn anything
  31683. helpful about its behavior. If the program's correctness depends on its
  31684. real-time behavior, delays introduced by a debugger might cause the
  31685. program to fail, even when the code itself is correct. It is useful to
  31686. be able to observe the program's behavior without interrupting it.
  31687. Therefore, traditional debugging model is too intrusive to reproduce
  31688. some bugs. In order to reduce the interference with the program, we can
  31689. reduce the number of operations performed by debugger. The "In-Process
  31690. Agent", a shared library, is running within the same process with
  31691. inferior, and is able to perform some debugging operations itself. As a
  31692. result, debugger is only involved when necessary, and performance of
  31693. debugging can be improved accordingly. Note that interference with
  31694. program can be reduced but can't be removed completely, because the
  31695. in-process agent will still stop or slow down the program.
  31696. The in-process agent can interpret and execute Agent Expressions
  31697. (*note Agent Expressions::) during performing debugging operations. The
  31698. agent expressions can be used for different purposes, such as collecting
  31699. data in tracepoints, and condition evaluation in breakpoints.
  31700. You can control whether the in-process agent is used as an aid for
  31701. debugging with the following commands:
  31702. 'set agent on'
  31703. Causes the in-process agent to perform some operations on behalf of
  31704. the debugger. Just which operations requested by the user will be
  31705. done by the in-process agent depends on the its capabilities. For
  31706. example, if you request to evaluate breakpoint conditions in the
  31707. in-process agent, and the in-process agent has such capability as
  31708. well, then breakpoint conditions will be evaluated in the
  31709. in-process agent.
  31710. 'set agent off'
  31711. Disables execution of debugging operations by the in-process agent.
  31712. All of the operations will be performed by GDB.
  31713. 'show agent'
  31714. Display the current setting of execution of debugging operations by
  31715. the in-process agent.
  31716. * Menu:
  31717. * In-Process Agent Protocol::
  31718. 
  31719. File: gdb.info, Node: In-Process Agent Protocol, Up: In-Process Agent
  31720. 30.1 In-Process Agent Protocol
  31721. ==============================
  31722. The in-process agent is able to communicate with both GDB and GDBserver
  31723. (*note In-Process Agent::). This section documents the protocol used
  31724. for communications between GDB or GDBserver and the IPA. In general, GDB
  31725. or GDBserver sends commands (*note IPA Protocol Commands::) and data to
  31726. in-process agent, and then in-process agent replies back with the return
  31727. result of the command, or some other information. The data sent to
  31728. in-process agent is composed of primitive data types, such as 4-byte or
  31729. 8-byte type, and composite types, which are called objects (*note IPA
  31730. Protocol Objects::).
  31731. * Menu:
  31732. * IPA Protocol Objects::
  31733. * IPA Protocol Commands::
  31734. 
  31735. File: gdb.info, Node: IPA Protocol Objects, Next: IPA Protocol Commands, Up: In-Process Agent Protocol
  31736. 30.1.1 IPA Protocol Objects
  31737. ---------------------------
  31738. The commands sent to and results received from agent may contain some
  31739. complex data types called "objects".
  31740. The in-process agent is running on the same machine with GDB or
  31741. GDBserver, so it doesn't have to handle as much differences between two
  31742. ends as remote protocol (*note Remote Protocol::) tries to handle.
  31743. However, there are still some differences of two ends in two processes:
  31744. 1. word size. On some 64-bit machines, GDB or GDBserver can be
  31745. compiled as a 64-bit executable, while in-process agent is a 32-bit
  31746. one.
  31747. 2. ABI. Some machines may have multiple types of ABI, GDB or GDBserver
  31748. is compiled with one, and in-process agent is compiled with the
  31749. other one.
  31750. Here are the IPA Protocol Objects:
  31751. 1. agent expression object. It represents an agent expression (*note
  31752. Agent Expressions::).
  31753. 2. tracepoint action object. It represents a tracepoint action (*note
  31754. Tracepoint Action Lists: Tracepoint Actions.) to collect registers,
  31755. memory, static trace data and to evaluate expression.
  31756. 3. tracepoint object. It represents a tracepoint (*note
  31757. Tracepoints::).
  31758. The following table describes important attributes of each IPA
  31759. protocol object:
  31760. Name Size Description
  31761. ---------------------------------------------------------------------------
  31762. _agent expression
  31763. object_
  31764. length 4 length of bytes code
  31765. byte code LENGTH contents of byte code
  31766. _tracepoint action
  31767. for collecting
  31768. memory_
  31769. 'M' 1 type of tracepoint action
  31770. addr 8 if BASEREG is '-1', ADDR is the
  31771. address of the lowest byte to
  31772. collect, otherwise ADDR is the
  31773. offset of BASEREG for memory
  31774. collecting.
  31775. len 8 length of memory for collecting
  31776. basereg 4 the register number containing the
  31777. starting memory address for
  31778. collecting.
  31779. _tracepoint action
  31780. for collecting
  31781. registers_
  31782. 'R' 1 type of tracepoint action
  31783. _tracepoint action
  31784. for collecting
  31785. static trace data_
  31786. 'L' 1 type of tracepoint action
  31787. _tracepoint action
  31788. for expression
  31789. evaluation_
  31790. 'X' 1 type of tracepoint action
  31791. agent expression length of *note agent expression object::
  31792. _tracepoint object_
  31793. number 4 number of tracepoint
  31794. address 8 address of tracepoint inserted on
  31795. type 4 type of tracepoint
  31796. enabled 1 enable or disable of tracepoint
  31797. step_count 8 step
  31798. pass_count 8 pass
  31799. numactions 4 number of tracepoint actions
  31800. hit count 8 hit count
  31801. trace frame usage 8 trace frame usage
  31802. compiled_cond 8 compiled condition
  31803. orig_size 8 orig size
  31804. condition 4 if zero if condition is NULL,
  31805. condition is otherwise is
  31806. NULL *note agent expression object::
  31807. otherwise
  31808. length of
  31809. *note agent expression object::
  31810. actions variable numactions number of
  31811. *note tracepoint action object::
  31812. 
  31813. File: gdb.info, Node: IPA Protocol Commands, Prev: IPA Protocol Objects, Up: In-Process Agent Protocol
  31814. 30.1.2 IPA Protocol Commands
  31815. ----------------------------
  31816. The spaces in each command are delimiters to ease reading this commands
  31817. specification. They don't exist in real commands.
  31818. 'FastTrace:TRACEPOINT_OBJECT GDB_JUMP_PAD_HEAD'
  31819. Installs a new fast tracepoint described by TRACEPOINT_OBJECT
  31820. (*note tracepoint object::). The GDB_JUMP_PAD_HEAD, 8-byte long,
  31821. is the head of "jumppad", which is used to jump to data collection
  31822. routine in IPA finally.
  31823. Replies:
  31824. 'OK TARGET_ADDRESS GDB_JUMP_PAD_HEAD FJUMP_SIZE FJUMP'
  31825. TARGET_ADDRESS is address of tracepoint in the inferior. The
  31826. GDB_JUMP_PAD_HEAD is updated head of jumppad. Both of
  31827. TARGET_ADDRESS and GDB_JUMP_PAD_HEAD are 8-byte long. The
  31828. FJUMP contains a sequence of instructions jump to jumppad
  31829. entry. The FJUMP_SIZE, 4-byte long, is the size of FJUMP.
  31830. 'E NN'
  31831. for an error
  31832. 'close'
  31833. Closes the in-process agent. This command is sent when GDB or
  31834. GDBserver is about to kill inferiors.
  31835. 'qTfSTM'
  31836. *Note qTfSTM::.
  31837. 'qTsSTM'
  31838. *Note qTsSTM::.
  31839. 'qTSTMat'
  31840. *Note qTSTMat::.
  31841. 'probe_marker_at:ADDRESS'
  31842. Asks in-process agent to probe the marker at ADDRESS.
  31843. Replies:
  31844. 'E NN'
  31845. for an error
  31846. 'unprobe_marker_at:ADDRESS'
  31847. Asks in-process agent to unprobe the marker at ADDRESS.
  31848. 
  31849. File: gdb.info, Node: GDB Bugs, Next: Command Line Editing, Prev: In-Process Agent, Up: Top
  31850. 31 Reporting Bugs in GDB
  31851. ************************
  31852. Your bug reports play an essential role in making GDB reliable.
  31853. Reporting a bug may help you by bringing a solution to your problem,
  31854. or it may not. But in any case the principal function of a bug report
  31855. is to help the entire community by making the next version of GDB work
  31856. better. Bug reports are your contribution to the maintenance of GDB.
  31857. In order for a bug report to serve its purpose, you must include the
  31858. information that enables us to fix the bug.
  31859. * Menu:
  31860. * Bug Criteria:: Have you found a bug?
  31861. * Bug Reporting:: How to report bugs
  31862. 
  31863. File: gdb.info, Node: Bug Criteria, Next: Bug Reporting, Up: GDB Bugs
  31864. 31.1 Have You Found a Bug?
  31865. ==========================
  31866. If you are not sure whether you have found a bug, here are some
  31867. guidelines:
  31868. * If the debugger gets a fatal signal, for any input whatever, that
  31869. is a GDB bug. Reliable debuggers never crash.
  31870. * If GDB produces an error message for valid input, that is a bug.
  31871. (Note that if you're cross debugging, the problem may also be
  31872. somewhere in the connection to the target.)
  31873. * If GDB does not produce an error message for invalid input, that is
  31874. a bug. However, you should note that your idea of "invalid input"
  31875. might be our idea of "an extension" or "support for traditional
  31876. practice".
  31877. * If you are an experienced user of debugging tools, your suggestions
  31878. for improvement of GDB are welcome in any case.
  31879. 
  31880. File: gdb.info, Node: Bug Reporting, Prev: Bug Criteria, Up: GDB Bugs
  31881. 31.2 How to Report Bugs
  31882. =======================
  31883. A number of companies and individuals offer support for GNU products.
  31884. If you obtained GDB from a support organization, we recommend you
  31885. contact that organization first.
  31886. You can find contact information for many support companies and
  31887. individuals in the file 'etc/SERVICE' in the GNU Emacs distribution.
  31888. In any event, we also recommend that you submit bug reports for GDB
  31889. to <https://www.gnu.org/software/gdb/bugs/>.
  31890. The fundamental principle of reporting bugs usefully is this: *report
  31891. all the facts*. If you are not sure whether to state a fact or leave it
  31892. out, state it!
  31893. Often people omit facts because they think they know what causes the
  31894. problem and assume that some details do not matter. Thus, you might
  31895. assume that the name of the variable you use in an example does not
  31896. matter. Well, probably it does not, but one cannot be sure. Perhaps
  31897. the bug is a stray memory reference which happens to fetch from the
  31898. location where that name is stored in memory; perhaps, if the name were
  31899. different, the contents of that location would fool the debugger into
  31900. doing the right thing despite the bug. Play it safe and give a
  31901. specific, complete example. That is the easiest thing for you to do,
  31902. and the most helpful.
  31903. Keep in mind that the purpose of a bug report is to enable us to fix
  31904. the bug. It may be that the bug has been reported previously, but
  31905. neither you nor we can know that unless your bug report is complete and
  31906. self-contained.
  31907. Sometimes people give a few sketchy facts and ask, "Does this ring a
  31908. bell?" Those bug reports are useless, and we urge everyone to _refuse
  31909. to respond to them_ except to chide the sender to report bugs properly.
  31910. To enable us to fix the bug, you should include all these things:
  31911. * The version of GDB. GDB announces it if you start with no
  31912. arguments; you can also print it at any time using 'show version'.
  31913. Without this, we will not know whether there is any point in
  31914. looking for the bug in the current version of GDB.
  31915. * The type of machine you are using, and the operating system name
  31916. and version number.
  31917. * The details of the GDB build-time configuration. GDB shows these
  31918. details if you invoke it with the '--configuration' command-line
  31919. option, or if you type 'show configuration' at GDB's prompt.
  31920. * What compiler (and its version) was used to compile GDB--e.g.
  31921. "gcc-2.8.1".
  31922. * What compiler (and its version) was used to compile the program you
  31923. are debugging--e.g. "gcc-2.8.1", or "HP92453-01 A.10.32.03 HP C
  31924. Compiler". For GCC, you can say 'gcc --version' to get this
  31925. information; for other compilers, see the documentation for those
  31926. compilers.
  31927. * The command arguments you gave the compiler to compile your example
  31928. and observe the bug. For example, did you use '-O'? To guarantee
  31929. you will not omit something important, list them all. A copy of
  31930. the Makefile (or the output from make) is sufficient.
  31931. If we were to try to guess the arguments, we would probably guess
  31932. wrong and then we might not encounter the bug.
  31933. * A complete input script, and all necessary source files, that will
  31934. reproduce the bug.
  31935. * A description of what behavior you observe that you believe is
  31936. incorrect. For example, "It gets a fatal signal."
  31937. Of course, if the bug is that GDB gets a fatal signal, then we will
  31938. certainly notice it. But if the bug is incorrect output, we might
  31939. not notice unless it is glaringly wrong. You might as well not
  31940. give us a chance to make a mistake.
  31941. Even if the problem you experience is a fatal signal, you should
  31942. still say so explicitly. Suppose something strange is going on,
  31943. such as, your copy of GDB is out of synch, or you have encountered
  31944. a bug in the C library on your system. (This has happened!) Your
  31945. copy might crash and ours would not. If you told us to expect a
  31946. crash, then when ours fails to crash, we would know that the bug
  31947. was not happening for us. If you had not told us to expect a
  31948. crash, then we would not be able to draw any conclusion from our
  31949. observations.
  31950. To collect all this information, you can use a session recording
  31951. program such as 'script', which is available on many Unix systems.
  31952. Just run your GDB session inside 'script' and then include the
  31953. 'typescript' file with your bug report.
  31954. Another way to record a GDB session is to run GDB inside Emacs and
  31955. then save the entire buffer to a file.
  31956. * If you wish to suggest changes to the GDB source, send us context
  31957. diffs. If you even discuss something in the GDB source, refer to
  31958. it by context, not by line number.
  31959. The line numbers in our development sources will not match those in
  31960. your sources. Your line numbers would convey no useful information
  31961. to us.
  31962. Here are some things that are not necessary:
  31963. * A description of the envelope of the bug.
  31964. Often people who encounter a bug spend a lot of time investigating
  31965. which changes to the input file will make the bug go away and which
  31966. changes will not affect it.
  31967. This is often time consuming and not very useful, because the way
  31968. we will find the bug is by running a single example under the
  31969. debugger with breakpoints, not by pure deduction from a series of
  31970. examples. We recommend that you save your time for something else.
  31971. Of course, if you can find a simpler example to report _instead_ of
  31972. the original one, that is a convenience for us. Errors in the
  31973. output will be easier to spot, running under the debugger will take
  31974. less time, and so on.
  31975. However, simplification is not vital; if you do not want to do
  31976. this, report the bug anyway and send us the entire test case you
  31977. used.
  31978. * A patch for the bug.
  31979. A patch for the bug does help us if it is a good one. But do not
  31980. omit the necessary information, such as the test case, on the
  31981. assumption that a patch is all we need. We might see problems with
  31982. your patch and decide to fix the problem another way, or we might
  31983. not understand it at all.
  31984. Sometimes with a program as complicated as GDB it is very hard to
  31985. construct an example that will make the program follow a certain
  31986. path through the code. If you do not send us the example, we will
  31987. not be able to construct one, so we will not be able to verify that
  31988. the bug is fixed.
  31989. And if we cannot understand what bug you are trying to fix, or why
  31990. your patch should be an improvement, we will not install it. A
  31991. test case will help us to understand.
  31992. * A guess about what the bug is or what it depends on.
  31993. Such guesses are usually wrong. Even we cannot guess right about
  31994. such things without first using the debugger to find the facts.
  31995. 
  31996. File: gdb.info, Node: Command Line Editing, Next: Using History Interactively, Prev: GDB Bugs, Up: Top
  31997. 32 Command Line Editing
  31998. ***********************
  31999. This chapter describes the basic features of the GNU command line
  32000. editing interface.
  32001. * Menu:
  32002. * Introduction and Notation:: Notation used in this text.
  32003. * Readline Interaction:: The minimum set of commands for editing a line.
  32004. * Readline Init File:: Customizing Readline from a user's view.
  32005. * Bindable Readline Commands:: A description of most of the Readline commands
  32006. available for binding
  32007. * Readline vi Mode:: A short description of how to make Readline
  32008. behave like the vi editor.
  32009. 
  32010. File: gdb.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
  32011. 32.1 Introduction to Line Editing
  32012. =================================
  32013. The following paragraphs describe the notation used to represent
  32014. keystrokes.
  32015. The text 'C-k' is read as 'Control-K' and describes the character
  32016. produced when the <k> key is pressed while the Control key is depressed.
  32017. The text 'M-k' is read as 'Meta-K' and describes the character
  32018. produced when the Meta key (if you have one) is depressed, and the <k>
  32019. key is pressed. The Meta key is labeled <ALT> on many keyboards. On
  32020. keyboards with two keys labeled <ALT> (usually to either side of the
  32021. space bar), the <ALT> on the left side is generally set to work as a
  32022. Meta key. The <ALT> key on the right may also be configured to work as
  32023. a Meta key or may be configured as some other modifier, such as a
  32024. Compose key for typing accented characters.
  32025. If you do not have a Meta or <ALT> key, or another key working as a
  32026. Meta key, the identical keystroke can be generated by typing <ESC>
  32027. _first_, and then typing <k>. Either process is known as "metafying"
  32028. the <k> key.
  32029. The text 'M-C-k' is read as 'Meta-Control-k' and describes the
  32030. character produced by "metafying" 'C-k'.
  32031. In addition, several keys have their own names. Specifically, <DEL>,
  32032. <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves when seen
  32033. in this text, or in an init file (*note Readline Init File::). If your
  32034. keyboard lacks a <LFD> key, typing <C-j> will produce the desired
  32035. character. The <RET> key may be labeled <Return> or <Enter> on some
  32036. keyboards.
  32037. 
  32038. File: gdb.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
  32039. 32.2 Readline Interaction
  32040. =========================
  32041. Often during an interactive session you type in a long line of text,
  32042. only to notice that the first word on the line is misspelled. The
  32043. Readline library gives you a set of commands for manipulating the text
  32044. as you type it in, allowing you to just fix your typo, and not forcing
  32045. you to retype the majority of the line. Using these editing commands,
  32046. you move the cursor to the place that needs correction, and delete or
  32047. insert the text of the corrections. Then, when you are satisfied with
  32048. the line, you simply press <RET>. You do not have to be at the end of
  32049. the line to press <RET>; the entire line is accepted regardless of the
  32050. location of the cursor within the line.
  32051. * Menu:
  32052. * Readline Bare Essentials:: The least you need to know about Readline.
  32053. * Readline Movement Commands:: Moving about the input line.
  32054. * Readline Killing Commands:: How to delete text, and how to get it back!
  32055. * Readline Arguments:: Giving numeric arguments to commands.
  32056. * Searching:: Searching through previous lines.
  32057. 
  32058. File: gdb.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
  32059. 32.2.1 Readline Bare Essentials
  32060. -------------------------------
  32061. In order to enter characters into the line, simply type them. The typed
  32062. character appears where the cursor was, and then the cursor moves one
  32063. space to the right. If you mistype a character, you can use your erase
  32064. character to back up and delete the mistyped character.
  32065. Sometimes you may mistype a character, and not notice the error until
  32066. you have typed several other characters. In that case, you can type
  32067. 'C-b' to move the cursor to the left, and then correct your mistake.
  32068. Afterwards, you can move the cursor to the right with 'C-f'.
  32069. When you add text in the middle of a line, you will notice that
  32070. characters to the right of the cursor are 'pushed over' to make room for
  32071. the text that you have inserted. Likewise, when you delete text behind
  32072. the cursor, characters to the right of the cursor are 'pulled back' to
  32073. fill in the blank space created by the removal of the text. A list of
  32074. the bare essentials for editing the text of an input line follows.
  32075. 'C-b'
  32076. Move back one character.
  32077. 'C-f'
  32078. Move forward one character.
  32079. <DEL> or <Backspace>
  32080. Delete the character to the left of the cursor.
  32081. 'C-d'
  32082. Delete the character underneath the cursor.
  32083. Printing characters
  32084. Insert the character into the line at the cursor.
  32085. 'C-_' or 'C-x C-u'
  32086. Undo the last editing command. You can undo all the way back to an
  32087. empty line.
  32088. (Depending on your configuration, the <Backspace> key be set to delete
  32089. the character to the left of the cursor and the <DEL> key set to delete
  32090. the character underneath the cursor, like 'C-d', rather than the
  32091. character to the left of the cursor.)
  32092. 
  32093. File: gdb.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
  32094. 32.2.2 Readline Movement Commands
  32095. ---------------------------------
  32096. The above table describes the most basic keystrokes that you need in
  32097. order to do editing of the input line. For your convenience, many other
  32098. commands have been added in addition to 'C-b', 'C-f', 'C-d', and <DEL>.
  32099. Here are some commands for moving more rapidly about the line.
  32100. 'C-a'
  32101. Move to the start of the line.
  32102. 'C-e'
  32103. Move to the end of the line.
  32104. 'M-f'
  32105. Move forward a word, where a word is composed of letters and
  32106. digits.
  32107. 'M-b'
  32108. Move backward a word.
  32109. 'C-l'
  32110. Clear the screen, reprinting the current line at the top.
  32111. Notice how 'C-f' moves forward a character, while 'M-f' moves forward
  32112. a word. It is a loose convention that control keystrokes operate on
  32113. characters while meta keystrokes operate on words.
  32114. 
  32115. File: gdb.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
  32116. 32.2.3 Readline Killing Commands
  32117. --------------------------------
  32118. "Killing" text means to delete the text from the line, but to save it
  32119. away for later use, usually by "yanking" (re-inserting) it back into the
  32120. line. ('Cut' and 'paste' are more recent jargon for 'kill' and 'yank'.)
  32121. If the description for a command says that it 'kills' text, then you
  32122. can be sure that you can get the text back in a different (or the same)
  32123. place later.
  32124. When you use a kill command, the text is saved in a "kill-ring". Any
  32125. number of consecutive kills save all of the killed text together, so
  32126. that when you yank it back, you get it all. The kill ring is not line
  32127. specific; the text that you killed on a previously typed line is
  32128. available to be yanked back later, when you are typing another line.
  32129. Here is the list of commands for killing text.
  32130. 'C-k'
  32131. Kill the text from the current cursor position to the end of the
  32132. line.
  32133. 'M-d'
  32134. Kill from the cursor to the end of the current word, or, if between
  32135. words, to the end of the next word. Word boundaries are the same
  32136. as those used by 'M-f'.
  32137. 'M-<DEL>'
  32138. Kill from the cursor the start of the current word, or, if between
  32139. words, to the start of the previous word. Word boundaries are the
  32140. same as those used by 'M-b'.
  32141. 'C-w'
  32142. Kill from the cursor to the previous whitespace. This is different
  32143. than 'M-<DEL>' because the word boundaries differ.
  32144. Here is how to "yank" the text back into the line. Yanking means to
  32145. copy the most-recently-killed text from the kill buffer.
  32146. 'C-y'
  32147. Yank the most recently killed text back into the buffer at the
  32148. cursor.
  32149. 'M-y'
  32150. Rotate the kill-ring, and yank the new top. You can only do this
  32151. if the prior command is 'C-y' or 'M-y'.
  32152. 
  32153. File: gdb.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction
  32154. 32.2.4 Readline Arguments
  32155. -------------------------
  32156. You can pass numeric arguments to Readline commands. Sometimes the
  32157. argument acts as a repeat count, other times it is the sign of the
  32158. argument that is significant. If you pass a negative argument to a
  32159. command which normally acts in a forward direction, that command will
  32160. act in a backward direction. For example, to kill text back to the
  32161. start of the line, you might type 'M-- C-k'.
  32162. The general way to pass numeric arguments to a command is to type
  32163. meta digits before the command. If the first 'digit' typed is a minus
  32164. sign ('-'), then the sign of the argument will be negative. Once you
  32165. have typed one meta digit to get the argument started, you can type the
  32166. remainder of the digits, and then the command. For example, to give the
  32167. 'C-d' command an argument of 10, you could type 'M-1 0 C-d', which will
  32168. delete the next ten characters on the input line.
  32169. 
  32170. File: gdb.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction
  32171. 32.2.5 Searching for Commands in the History
  32172. --------------------------------------------
  32173. Readline provides commands for searching through the command history for
  32174. lines containing a specified string. There are two search modes:
  32175. "incremental" and "non-incremental".
  32176. Incremental searches begin before the user has finished typing the
  32177. search string. As each character of the search string is typed,
  32178. Readline displays the next entry from the history matching the string
  32179. typed so far. An incremental search requires only as many characters as
  32180. needed to find the desired history entry. To search backward in the
  32181. history for a particular string, type 'C-r'. Typing 'C-s' searches
  32182. forward through the history. The characters present in the value of the
  32183. 'isearch-terminators' variable are used to terminate an incremental
  32184. search. If that variable has not been assigned a value, the <ESC> and
  32185. 'C-J' characters will terminate an incremental search. 'C-g' will abort
  32186. an incremental search and restore the original line. When the search is
  32187. terminated, the history entry containing the search string becomes the
  32188. current line.
  32189. To find other matching entries in the history list, type 'C-r' or
  32190. 'C-s' as appropriate. This will search backward or forward in the
  32191. history for the next entry matching the search string typed so far. Any
  32192. other key sequence bound to a Readline command will terminate the search
  32193. and execute that command. For instance, a <RET> will terminate the
  32194. search and accept the line, thereby executing the command from the
  32195. history list. A movement command will terminate the search, make the
  32196. last line found the current line, and begin editing.
  32197. Readline remembers the last incremental search string. If two 'C-r's
  32198. are typed without any intervening characters defining a new search
  32199. string, any remembered search string is used.
  32200. Non-incremental searches read the entire search string before
  32201. starting to search for matching history lines. The search string may be
  32202. typed by the user or be part of the contents of the current line.
  32203. 
  32204. File: gdb.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
  32205. 32.3 Readline Init File
  32206. =======================
  32207. Although the Readline library comes with a set of Emacs-like keybindings
  32208. installed by default, it is possible to use a different set of
  32209. keybindings. Any user can customize programs that use Readline by
  32210. putting commands in an "inputrc" file, conventionally in his home
  32211. directory. The name of this file is taken from the value of the
  32212. environment variable 'INPUTRC'. If that variable is unset, the default
  32213. is '~/.inputrc'. If that file does not exist or cannot be read, the
  32214. ultimate default is '/etc/inputrc'.
  32215. When a program which uses the Readline library starts up, the init
  32216. file is read, and the key bindings are set.
  32217. In addition, the 'C-x C-r' command re-reads this init file, thus
  32218. incorporating any changes that you might have made to it.
  32219. * Menu:
  32220. * Readline Init File Syntax:: Syntax for the commands in the inputrc file.
  32221. * Conditional Init Constructs:: Conditional key bindings in the inputrc file.
  32222. * Sample Init File:: An example inputrc file.
  32223. 
  32224. File: gdb.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File
  32225. 32.3.1 Readline Init File Syntax
  32226. --------------------------------
  32227. There are only a few basic constructs allowed in the Readline init file.
  32228. Blank lines are ignored. Lines beginning with a '#' are comments.
  32229. Lines beginning with a '$' indicate conditional constructs (*note
  32230. Conditional Init Constructs::). Other lines denote variable settings
  32231. and key bindings.
  32232. Variable Settings
  32233. You can modify the run-time behavior of Readline by altering the
  32234. values of variables in Readline using the 'set' command within the
  32235. init file. The syntax is simple:
  32236. set VARIABLE VALUE
  32237. Here, for example, is how to change from the default Emacs-like key
  32238. binding to use 'vi' line editing commands:
  32239. set editing-mode vi
  32240. Variable names and values, where appropriate, are recognized
  32241. without regard to case. Unrecognized variable names are ignored.
  32242. Boolean variables (those that can be set to on or off) are set to
  32243. on if the value is null or empty, ON (case-insensitive), or 1. Any
  32244. other value results in the variable being set to off.
  32245. A great deal of run-time behavior is changeable with the following
  32246. variables.
  32247. 'bell-style'
  32248. Controls what happens when Readline wants to ring the terminal
  32249. bell. If set to 'none', Readline never rings the bell. If
  32250. set to 'visible', Readline uses a visible bell if one is
  32251. available. If set to 'audible' (the default), Readline
  32252. attempts to ring the terminal's bell.
  32253. 'bind-tty-special-chars'
  32254. If set to 'on' (the default), Readline attempts to bind the
  32255. control characters treated specially by the kernel's terminal
  32256. driver to their Readline equivalents.
  32257. 'blink-matching-paren'
  32258. If set to 'on', Readline attempts to briefly move the cursor
  32259. to an opening parenthesis when a closing parenthesis is
  32260. inserted. The default is 'off'.
  32261. 'colored-completion-prefix'
  32262. If set to 'on', when listing completions, Readline displays
  32263. the common prefix of the set of possible completions using a
  32264. different color. The color definitions are taken from the
  32265. value of the 'LS_COLORS' environment variable. The default is
  32266. 'off'.
  32267. 'colored-stats'
  32268. If set to 'on', Readline displays possible completions using
  32269. different colors to indicate their file type. The color
  32270. definitions are taken from the value of the 'LS_COLORS'
  32271. environment variable. The default is 'off'.
  32272. 'comment-begin'
  32273. The string to insert at the beginning of the line when the
  32274. 'insert-comment' command is executed. The default value is
  32275. '"#"'.
  32276. 'completion-display-width'
  32277. The number of screen columns used to display possible matches
  32278. when performing completion. The value is ignored if it is
  32279. less than 0 or greater than the terminal screen width. A
  32280. value of 0 will cause matches to be displayed one per line.
  32281. The default value is -1.
  32282. 'completion-ignore-case'
  32283. If set to 'on', Readline performs filename matching and
  32284. completion in a case-insensitive fashion. The default value
  32285. is 'off'.
  32286. 'completion-map-case'
  32287. If set to 'on', and COMPLETION-IGNORE-CASE is enabled,
  32288. Readline treats hyphens ('-') and underscores ('_') as
  32289. equivalent when performing case-insensitive filename matching
  32290. and completion. The default value is 'off'.
  32291. 'completion-prefix-display-length'
  32292. The length in characters of the common prefix of a list of
  32293. possible completions that is displayed without modification.
  32294. When set to a value greater than zero, common prefixes longer
  32295. than this value are replaced with an ellipsis when displaying
  32296. possible completions.
  32297. 'completion-query-items'
  32298. The number of possible completions that determines when the
  32299. user is asked whether the list of possibilities should be
  32300. displayed. If the number of possible completions is greater
  32301. than this value, Readline will ask the user whether or not he
  32302. wishes to view them; otherwise, they are simply listed. This
  32303. variable must be set to an integer value greater than or equal
  32304. to 0. A negative value means Readline should never ask. The
  32305. default limit is '100'.
  32306. 'convert-meta'
  32307. If set to 'on', Readline will convert characters with the
  32308. eighth bit set to an ASCII key sequence by stripping the
  32309. eighth bit and prefixing an <ESC> character, converting them
  32310. to a meta-prefixed key sequence. The default value is 'on',
  32311. but will be set to 'off' if the locale is one that contains
  32312. eight-bit characters.
  32313. 'disable-completion'
  32314. If set to 'On', Readline will inhibit word completion.
  32315. Completion characters will be inserted into the line as if
  32316. they had been mapped to 'self-insert'. The default is 'off'.
  32317. 'echo-control-characters'
  32318. When set to 'on', on operating systems that indicate they
  32319. support it, readline echoes a character corresponding to a
  32320. signal generated from the keyboard. The default is 'on'.
  32321. 'editing-mode'
  32322. The 'editing-mode' variable controls which default set of key
  32323. bindings is used. By default, Readline starts up in Emacs
  32324. editing mode, where the keystrokes are most similar to Emacs.
  32325. This variable can be set to either 'emacs' or 'vi'.
  32326. 'emacs-mode-string'
  32327. If the SHOW-MODE-IN-PROMPT variable is enabled, this string is
  32328. displayed immediately before the last line of the primary
  32329. prompt when emacs editing mode is active. The value is
  32330. expanded like a key binding, so the standard set of meta- and
  32331. control prefixes and backslash escape sequences is available.
  32332. Use the '\1' and '\2' escapes to begin and end sequences of
  32333. non-printing characters, which can be used to embed a terminal
  32334. control sequence into the mode string. The default is '@'.
  32335. 'enable-bracketed-paste'
  32336. When set to 'On', Readline will configure the terminal in a
  32337. way that will enable it to insert each paste into the editing
  32338. buffer as a single string of characters, instead of treating
  32339. each character as if it had been read from the keyboard. This
  32340. can prevent pasted characters from being interpreted as
  32341. editing commands. The default is 'off'.
  32342. 'enable-keypad'
  32343. When set to 'on', Readline will try to enable the application
  32344. keypad when it is called. Some systems need this to enable
  32345. the arrow keys. The default is 'off'.
  32346. 'enable-meta-key'
  32347. When set to 'on', Readline will try to enable any meta
  32348. modifier key the terminal claims to support when it is called.
  32349. On many terminals, the meta key is used to send eight-bit
  32350. characters. The default is 'on'.
  32351. 'expand-tilde'
  32352. If set to 'on', tilde expansion is performed when Readline
  32353. attempts word completion. The default is 'off'.
  32354. 'history-preserve-point'
  32355. If set to 'on', the history code attempts to place the point
  32356. (the current cursor position) at the same location on each
  32357. history line retrieved with 'previous-history' or
  32358. 'next-history'. The default is 'off'.
  32359. 'history-size'
  32360. Set the maximum number of history entries saved in the history
  32361. list. If set to zero, any existing history entries are
  32362. deleted and no new entries are saved. If set to a value less
  32363. than zero, the number of history entries is not limited. By
  32364. default, the number of history entries is not limited. If an
  32365. attempt is made to set HISTORY-SIZE to a non-numeric value,
  32366. the maximum number of history entries will be set to 500.
  32367. 'horizontal-scroll-mode'
  32368. This variable can be set to either 'on' or 'off'. Setting it
  32369. to 'on' means that the text of the lines being edited will
  32370. scroll horizontally on a single screen line when they are
  32371. longer than the width of the screen, instead of wrapping onto
  32372. a new screen line. By default, this variable is set to 'off'.
  32373. 'input-meta'
  32374. If set to 'on', Readline will enable eight-bit input (it will
  32375. not clear the eighth bit in the characters it reads),
  32376. regardless of what the terminal claims it can support. The
  32377. default value is 'off', but Readline will set it to 'on' if
  32378. the locale contains eight-bit characters. The name
  32379. 'meta-flag' is a synonym for this variable.
  32380. 'isearch-terminators'
  32381. The string of characters that should terminate an incremental
  32382. search without subsequently executing the character as a
  32383. command (*note Searching::). If this variable has not been
  32384. given a value, the characters <ESC> and 'C-J' will terminate
  32385. an incremental search.
  32386. 'keymap'
  32387. Sets Readline's idea of the current keymap for key binding
  32388. commands. Built-in 'keymap' names are 'emacs',
  32389. 'emacs-standard', 'emacs-meta', 'emacs-ctlx', 'vi', 'vi-move',
  32390. 'vi-command', and 'vi-insert'. 'vi' is equivalent to
  32391. 'vi-command' ('vi-move' is also a synonym); 'emacs' is
  32392. equivalent to 'emacs-standard'. Applications may add
  32393. additional names. The default value is 'emacs'. The value of
  32394. the 'editing-mode' variable also affects the default keymap.
  32395. 'keyseq-timeout'
  32396. Specifies the duration Readline will wait for a character when
  32397. reading an ambiguous key sequence (one that can form a
  32398. complete key sequence using the input read so far, or can take
  32399. additional input to complete a longer key sequence). If no
  32400. input is received within the timeout, Readline will use the
  32401. shorter but complete key sequence. Readline uses this value
  32402. to determine whether or not input is available on the current
  32403. input source ('rl_instream' by default). The value is
  32404. specified in milliseconds, so a value of 1000 means that
  32405. Readline will wait one second for additional input. If this
  32406. variable is set to a value less than or equal to zero, or to a
  32407. non-numeric value, Readline will wait until another key is
  32408. pressed to decide which key sequence to complete. The default
  32409. value is '500'.
  32410. 'mark-directories'
  32411. If set to 'on', completed directory names have a slash
  32412. appended. The default is 'on'.
  32413. 'mark-modified-lines'
  32414. This variable, when set to 'on', causes Readline to display an
  32415. asterisk ('*') at the start of history lines which have been
  32416. modified. This variable is 'off' by default.
  32417. 'mark-symlinked-directories'
  32418. If set to 'on', completed names which are symbolic links to
  32419. directories have a slash appended (subject to the value of
  32420. 'mark-directories'). The default is 'off'.
  32421. 'match-hidden-files'
  32422. This variable, when set to 'on', causes Readline to match
  32423. files whose names begin with a '.' (hidden files) when
  32424. performing filename completion. If set to 'off', the leading
  32425. '.' must be supplied by the user in the filename to be
  32426. completed. This variable is 'on' by default.
  32427. 'menu-complete-display-prefix'
  32428. If set to 'on', menu completion displays the common prefix of
  32429. the list of possible completions (which may be empty) before
  32430. cycling through the list. The default is 'off'.
  32431. 'output-meta'
  32432. If set to 'on', Readline will display characters with the
  32433. eighth bit set directly rather than as a meta-prefixed escape
  32434. sequence. The default is 'off', but Readline will set it to
  32435. 'on' if the locale contains eight-bit characters.
  32436. 'page-completions'
  32437. If set to 'on', Readline uses an internal 'more'-like pager to
  32438. display a screenful of possible completions at a time. This
  32439. variable is 'on' by default.
  32440. 'print-completions-horizontally'
  32441. If set to 'on', Readline will display completions with matches
  32442. sorted horizontally in alphabetical order, rather than down
  32443. the screen. The default is 'off'.
  32444. 'revert-all-at-newline'
  32445. If set to 'on', Readline will undo all changes to history
  32446. lines before returning when 'accept-line' is executed. By
  32447. default, history lines may be modified and retain individual
  32448. undo lists across calls to 'readline'. The default is 'off'.
  32449. 'show-all-if-ambiguous'
  32450. This alters the default behavior of the completion functions.
  32451. If set to 'on', words which have more than one possible
  32452. completion cause the matches to be listed immediately instead
  32453. of ringing the bell. The default value is 'off'.
  32454. 'show-all-if-unmodified'
  32455. This alters the default behavior of the completion functions
  32456. in a fashion similar to SHOW-ALL-IF-AMBIGUOUS. If set to
  32457. 'on', words which have more than one possible completion
  32458. without any possible partial completion (the possible
  32459. completions don't share a common prefix) cause the matches to
  32460. be listed immediately instead of ringing the bell. The
  32461. default value is 'off'.
  32462. 'show-mode-in-prompt'
  32463. If set to 'on', add a string to the beginning of the prompt
  32464. indicating the editing mode: emacs, vi command, or vi
  32465. insertion. The mode strings are user-settable (e.g.,
  32466. EMACS-MODE-STRING). The default value is 'off'.
  32467. 'skip-completed-text'
  32468. If set to 'on', this alters the default completion behavior
  32469. when inserting a single match into the line. It's only active
  32470. when performing completion in the middle of a word. If
  32471. enabled, readline does not insert characters from the
  32472. completion that match characters after point in the word being
  32473. completed, so portions of the word following the cursor are
  32474. not duplicated. For instance, if this is enabled, attempting
  32475. completion when the cursor is after the 'e' in 'Makefile' will
  32476. result in 'Makefile' rather than 'Makefilefile', assuming
  32477. there is a single possible completion. The default value is
  32478. 'off'.
  32479. 'vi-cmd-mode-string'
  32480. If the SHOW-MODE-IN-PROMPT variable is enabled, this string is
  32481. displayed immediately before the last line of the primary
  32482. prompt when vi editing mode is active and in command mode.
  32483. The value is expanded like a key binding, so the standard set
  32484. of meta- and control prefixes and backslash escape sequences
  32485. is available. Use the '\1' and '\2' escapes to begin and end
  32486. sequences of non-printing characters, which can be used to
  32487. embed a terminal control sequence into the mode string. The
  32488. default is '(cmd)'.
  32489. 'vi-ins-mode-string'
  32490. If the SHOW-MODE-IN-PROMPT variable is enabled, this string is
  32491. displayed immediately before the last line of the primary
  32492. prompt when vi editing mode is active and in insertion mode.
  32493. The value is expanded like a key binding, so the standard set
  32494. of meta- and control prefixes and backslash escape sequences
  32495. is available. Use the '\1' and '\2' escapes to begin and end
  32496. sequences of non-printing characters, which can be used to
  32497. embed a terminal control sequence into the mode string. The
  32498. default is '(ins)'.
  32499. 'visible-stats'
  32500. If set to 'on', a character denoting a file's type is appended
  32501. to the filename when listing possible completions. The
  32502. default is 'off'.
  32503. Key Bindings
  32504. The syntax for controlling key bindings in the init file is simple.
  32505. First you need to find the name of the command that you want to
  32506. change. The following sections contain tables of the command name,
  32507. the default keybinding, if any, and a short description of what the
  32508. command does.
  32509. Once you know the name of the command, simply place on a line in
  32510. the init file the name of the key you wish to bind the command to,
  32511. a colon, and then the name of the command. There can be no space
  32512. between the key name and the colon - that will be interpreted as
  32513. part of the key name. The name of the key can be expressed in
  32514. different ways, depending on what you find most comfortable.
  32515. In addition to command names, readline allows keys to be bound to a
  32516. string that is inserted when the key is pressed (a MACRO).
  32517. KEYNAME: FUNCTION-NAME or MACRO
  32518. KEYNAME is the name of a key spelled out in English. For
  32519. example:
  32520. Control-u: universal-argument
  32521. Meta-Rubout: backward-kill-word
  32522. Control-o: "> output"
  32523. In the example above, 'C-u' is bound to the function
  32524. 'universal-argument', 'M-DEL' is bound to the function
  32525. 'backward-kill-word', and 'C-o' is bound to run the macro
  32526. expressed on the right hand side (that is, to insert the text
  32527. '> output' into the line).
  32528. A number of symbolic character names are recognized while
  32529. processing this key binding syntax: DEL, ESC, ESCAPE, LFD,
  32530. NEWLINE, RET, RETURN, RUBOUT, SPACE, SPC, and TAB.
  32531. "KEYSEQ": FUNCTION-NAME or MACRO
  32532. KEYSEQ differs from KEYNAME above in that strings denoting an
  32533. entire key sequence can be specified, by placing the key
  32534. sequence in double quotes. Some GNU Emacs style key escapes
  32535. can be used, as in the following example, but the special
  32536. character names are not recognized.
  32537. "\C-u": universal-argument
  32538. "\C-x\C-r": re-read-init-file
  32539. "\e[11~": "Function Key 1"
  32540. In the above example, 'C-u' is again bound to the function
  32541. 'universal-argument' (just as it was in the first example),
  32542. ''C-x' 'C-r'' is bound to the function 're-read-init-file',
  32543. and '<ESC> <[> <1> <1> <~>' is bound to insert the text
  32544. 'Function Key 1'.
  32545. The following GNU Emacs style escape sequences are available when
  32546. specifying key sequences:
  32547. '\C-'
  32548. control prefix
  32549. '\M-'
  32550. meta prefix
  32551. '\e'
  32552. an escape character
  32553. '\\'
  32554. backslash
  32555. '\"'
  32556. <">, a double quotation mark
  32557. '\''
  32558. <'>, a single quote or apostrophe
  32559. In addition to the GNU Emacs style escape sequences, a second set
  32560. of backslash escapes is available:
  32561. '\a'
  32562. alert (bell)
  32563. '\b'
  32564. backspace
  32565. '\d'
  32566. delete
  32567. '\f'
  32568. form feed
  32569. '\n'
  32570. newline
  32571. '\r'
  32572. carriage return
  32573. '\t'
  32574. horizontal tab
  32575. '\v'
  32576. vertical tab
  32577. '\NNN'
  32578. the eight-bit character whose value is the octal value NNN
  32579. (one to three digits)
  32580. '\xHH'
  32581. the eight-bit character whose value is the hexadecimal value
  32582. HH (one or two hex digits)
  32583. When entering the text of a macro, single or double quotes must be
  32584. used to indicate a macro definition. Unquoted text is assumed to
  32585. be a function name. In the macro body, the backslash escapes
  32586. described above are expanded. Backslash will quote any other
  32587. character in the macro text, including '"' and '''. For example,
  32588. the following binding will make ''C-x' \' insert a single '\' into
  32589. the line:
  32590. "\C-x\\": "\\"
  32591. 
  32592. File: gdb.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File
  32593. 32.3.2 Conditional Init Constructs
  32594. ----------------------------------
  32595. Readline implements a facility similar in spirit to the conditional
  32596. compilation features of the C preprocessor which allows key bindings and
  32597. variable settings to be performed as the result of tests. There are
  32598. four parser directives used.
  32599. '$if'
  32600. The '$if' construct allows bindings to be made based on the editing
  32601. mode, the terminal being used, or the application using Readline.
  32602. The text of the test, after any comparison operator, extends to the
  32603. end of the line; unless otherwise noted, no characters are required
  32604. to isolate it.
  32605. 'mode'
  32606. The 'mode=' form of the '$if' directive is used to test
  32607. whether Readline is in 'emacs' or 'vi' mode. This may be used
  32608. in conjunction with the 'set keymap' command, for instance, to
  32609. set bindings in the 'emacs-standard' and 'emacs-ctlx' keymaps
  32610. only if Readline is starting out in 'emacs' mode.
  32611. 'term'
  32612. The 'term=' form may be used to include terminal-specific key
  32613. bindings, perhaps to bind the key sequences output by the
  32614. terminal's function keys. The word on the right side of the
  32615. '=' is tested against both the full name of the terminal and
  32616. the portion of the terminal name before the first '-'. This
  32617. allows 'sun' to match both 'sun' and 'sun-cmd', for instance.
  32618. 'version'
  32619. The 'version' test may be used to perform comparisons against
  32620. specific Readline versions. The 'version' expands to the
  32621. current Readline version. The set of comparison operators
  32622. includes '=' (and '=='), '!=', '<=', '>=', '<', and '>'. The
  32623. version number supplied on the right side of the operator
  32624. consists of a major version number, an optional decimal point,
  32625. and an optional minor version (e.g., '7.1'). If the minor
  32626. version is omitted, it is assumed to be '0'. The operator may
  32627. be separated from the string 'version' and from the version
  32628. number argument by whitespace. The following example sets a
  32629. variable if the Readline version being used is 7.0 or newer:
  32630. $if version >= 7.0
  32631. set show-mode-in-prompt on
  32632. $endif
  32633. 'application'
  32634. The APPLICATION construct is used to include
  32635. application-specific settings. Each program using the
  32636. Readline library sets the APPLICATION NAME, and you can test
  32637. for a particular value. This could be used to bind key
  32638. sequences to functions useful for a specific program. For
  32639. instance, the following command adds a key sequence that
  32640. quotes the current or previous word in Bash:
  32641. $if Bash
  32642. # Quote the current or previous word
  32643. "\C-xq": "\eb\"\ef\""
  32644. $endif
  32645. 'variable'
  32646. The VARIABLE construct provides simple equality tests for
  32647. Readline variables and values. The permitted comparison
  32648. operators are '=', '==', and '!='. The variable name must be
  32649. separated from the comparison operator by whitespace; the
  32650. operator may be separated from the value on the right hand
  32651. side by whitespace. Both string and boolean variables may be
  32652. tested. Boolean variables must be tested against the values
  32653. ON and OFF. The following example is equivalent to the
  32654. 'mode=emacs' test described above:
  32655. $if editing-mode == emacs
  32656. set show-mode-in-prompt on
  32657. $endif
  32658. '$endif'
  32659. This command, as seen in the previous example, terminates an '$if'
  32660. command.
  32661. '$else'
  32662. Commands in this branch of the '$if' directive are executed if the
  32663. test fails.
  32664. '$include'
  32665. This directive takes a single filename as an argument and reads
  32666. commands and bindings from that file. For example, the following
  32667. directive reads from '/etc/inputrc':
  32668. $include /etc/inputrc
  32669. 
  32670. File: gdb.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File
  32671. 32.3.3 Sample Init File
  32672. -----------------------
  32673. Here is an example of an INPUTRC file. This illustrates key binding,
  32674. variable assignment, and conditional syntax.
  32675. # This file controls the behaviour of line input editing for
  32676. # programs that use the GNU Readline library. Existing
  32677. # programs include FTP, Bash, and GDB.
  32678. #
  32679. # You can re-read the inputrc file with C-x C-r.
  32680. # Lines beginning with '#' are comments.
  32681. #
  32682. # First, include any system-wide bindings and variable
  32683. # assignments from /etc/Inputrc
  32684. $include /etc/Inputrc
  32685. #
  32686. # Set various bindings for emacs mode.
  32687. set editing-mode emacs
  32688. $if mode=emacs
  32689. Meta-Control-h: backward-kill-word Text after the function name is ignored
  32690. #
  32691. # Arrow keys in keypad mode
  32692. #
  32693. #"\M-OD": backward-char
  32694. #"\M-OC": forward-char
  32695. #"\M-OA": previous-history
  32696. #"\M-OB": next-history
  32697. #
  32698. # Arrow keys in ANSI mode
  32699. #
  32700. "\M-[D": backward-char
  32701. "\M-[C": forward-char
  32702. "\M-[A": previous-history
  32703. "\M-[B": next-history
  32704. #
  32705. # Arrow keys in 8 bit keypad mode
  32706. #
  32707. #"\M-\C-OD": backward-char
  32708. #"\M-\C-OC": forward-char
  32709. #"\M-\C-OA": previous-history
  32710. #"\M-\C-OB": next-history
  32711. #
  32712. # Arrow keys in 8 bit ANSI mode
  32713. #
  32714. #"\M-\C-[D": backward-char
  32715. #"\M-\C-[C": forward-char
  32716. #"\M-\C-[A": previous-history
  32717. #"\M-\C-[B": next-history
  32718. C-q: quoted-insert
  32719. $endif
  32720. # An old-style binding. This happens to be the default.
  32721. TAB: complete
  32722. # Macros that are convenient for shell interaction
  32723. $if Bash
  32724. # edit the path
  32725. "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
  32726. # prepare to type a quoted word --
  32727. # insert open and close double quotes
  32728. # and move to just after the open quote
  32729. "\C-x\"": "\"\"\C-b"
  32730. # insert a backslash (testing backslash escapes
  32731. # in sequences and macros)
  32732. "\C-x\\": "\\"
  32733. # Quote the current or previous word
  32734. "\C-xq": "\eb\"\ef\""
  32735. # Add a binding to refresh the line, which is unbound
  32736. "\C-xr": redraw-current-line
  32737. # Edit variable on current line.
  32738. "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
  32739. $endif
  32740. # use a visible bell if one is available
  32741. set bell-style visible
  32742. # don't strip characters to 7 bits when reading
  32743. set input-meta on
  32744. # allow iso-latin1 characters to be inserted rather
  32745. # than converted to prefix-meta sequences
  32746. set convert-meta off
  32747. # display characters with the eighth bit set directly
  32748. # rather than as meta-prefixed characters
  32749. set output-meta on
  32750. # if there are more than 150 possible completions for
  32751. # a word, ask the user if he wants to see all of them
  32752. set completion-query-items 150
  32753. # For FTP
  32754. $if Ftp
  32755. "\C-xg": "get \M-?"
  32756. "\C-xt": "put \M-?"
  32757. "\M-.": yank-last-arg
  32758. $endif
  32759. 
  32760. File: gdb.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing
  32761. 32.4 Bindable Readline Commands
  32762. ===============================
  32763. * Menu:
  32764. * Commands For Moving:: Moving about the line.
  32765. * Commands For History:: Getting at previous lines.
  32766. * Commands For Text:: Commands for changing text.
  32767. * Commands For Killing:: Commands for killing and yanking.
  32768. * Numeric Arguments:: Specifying numeric arguments, repeat counts.
  32769. * Commands For Completion:: Getting Readline to do the typing for you.
  32770. * Keyboard Macros:: Saving and re-executing typed characters
  32771. * Miscellaneous Commands:: Other miscellaneous commands.
  32772. This section describes Readline commands that may be bound to key
  32773. sequences. Command names without an accompanying key sequence are
  32774. unbound by default.
  32775. In the following descriptions, "point" refers to the current cursor
  32776. position, and "mark" refers to a cursor position saved by the 'set-mark'
  32777. command. The text between the point and mark is referred to as the
  32778. "region".
  32779. 
  32780. File: gdb.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
  32781. 32.4.1 Commands For Moving
  32782. --------------------------
  32783. 'beginning-of-line (C-a)'
  32784. Move to the start of the current line.
  32785. 'end-of-line (C-e)'
  32786. Move to the end of the line.
  32787. 'forward-char (C-f)'
  32788. Move forward a character.
  32789. 'backward-char (C-b)'
  32790. Move back a character.
  32791. 'forward-word (M-f)'
  32792. Move forward to the end of the next word. Words are composed of
  32793. letters and digits.
  32794. 'backward-word (M-b)'
  32795. Move back to the start of the current or previous word. Words are
  32796. composed of letters and digits.
  32797. 'previous-screen-line ()'
  32798. Attempt to move point to the same physical screen column on the
  32799. previous physical screen line. This will not have the desired
  32800. effect if the current Readline line does not take up more than one
  32801. physical line or if point is not greater than the length of the
  32802. prompt plus the screen width.
  32803. 'next-screen-line ()'
  32804. Attempt to move point to the same physical screen column on the
  32805. next physical screen line. This will not have the desired effect
  32806. if the current Readline line does not take up more than one
  32807. physical line or if the length of the current Readline line is not
  32808. greater than the length of the prompt plus the screen width.
  32809. 'clear-screen (C-l)'
  32810. Clear the screen and redraw the current line, leaving the current
  32811. line at the top of the screen.
  32812. 'redraw-current-line ()'
  32813. Refresh the current line. By default, this is unbound.
  32814. 
  32815. File: gdb.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands
  32816. 32.4.2 Commands For Manipulating The History
  32817. --------------------------------------------
  32818. 'accept-line (Newline or Return)'
  32819. Accept the line regardless of where the cursor is. If this line is
  32820. non-empty, it may be added to the history list for future recall
  32821. with 'add_history()'. If this line is a modified history line, the
  32822. history line is restored to its original state.
  32823. 'previous-history (C-p)'
  32824. Move 'back' through the history list, fetching the previous
  32825. command.
  32826. 'next-history (C-n)'
  32827. Move 'forward' through the history list, fetching the next command.
  32828. 'beginning-of-history (M-<)'
  32829. Move to the first line in the history.
  32830. 'end-of-history (M->)'
  32831. Move to the end of the input history, i.e., the line currently
  32832. being entered.
  32833. 'reverse-search-history (C-r)'
  32834. Search backward starting at the current line and moving 'up'
  32835. through the history as necessary. This is an incremental search.
  32836. 'forward-search-history (C-s)'
  32837. Search forward starting at the current line and moving 'down'
  32838. through the history as necessary. This is an incremental search.
  32839. 'non-incremental-reverse-search-history (M-p)'
  32840. Search backward starting at the current line and moving 'up'
  32841. through the history as necessary using a non-incremental search for
  32842. a string supplied by the user. The search string may match
  32843. anywhere in a history line.
  32844. 'non-incremental-forward-search-history (M-n)'
  32845. Search forward starting at the current line and moving 'down'
  32846. through the history as necessary using a non-incremental search for
  32847. a string supplied by the user. The search string may match
  32848. anywhere in a history line.
  32849. 'history-search-forward ()'
  32850. Search forward through the history for the string of characters
  32851. between the start of the current line and the point. The search
  32852. string must match at the beginning of a history line. This is a
  32853. non-incremental search. By default, this command is unbound.
  32854. 'history-search-backward ()'
  32855. Search backward through the history for the string of characters
  32856. between the start of the current line and the point. The search
  32857. string must match at the beginning of a history line. This is a
  32858. non-incremental search. By default, this command is unbound.
  32859. 'history-substring-search-forward ()'
  32860. Search forward through the history for the string of characters
  32861. between the start of the current line and the point. The search
  32862. string may match anywhere in a history line. This is a
  32863. non-incremental search. By default, this command is unbound.
  32864. 'history-substring-search-backward ()'
  32865. Search backward through the history for the string of characters
  32866. between the start of the current line and the point. The search
  32867. string may match anywhere in a history line. This is a
  32868. non-incremental search. By default, this command is unbound.
  32869. 'yank-nth-arg (M-C-y)'
  32870. Insert the first argument to the previous command (usually the
  32871. second word on the previous line) at point. With an argument N,
  32872. insert the Nth word from the previous command (the words in the
  32873. previous command begin with word 0). A negative argument inserts
  32874. the Nth word from the end of the previous command. Once the
  32875. argument N is computed, the argument is extracted as if the '!N'
  32876. history expansion had been specified.
  32877. 'yank-last-arg (M-. or M-_)'
  32878. Insert last argument to the previous command (the last word of the
  32879. previous history entry). With a numeric argument, behave exactly
  32880. like 'yank-nth-arg'. Successive calls to 'yank-last-arg' move back
  32881. through the history list, inserting the last word (or the word
  32882. specified by the argument to the first call) of each line in turn.
  32883. Any numeric argument supplied to these successive calls determines
  32884. the direction to move through the history. A negative argument
  32885. switches the direction through the history (back or forward). The
  32886. history expansion facilities are used to extract the last argument,
  32887. as if the '!$' history expansion had been specified.
  32888. 
  32889. File: gdb.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands
  32890. 32.4.3 Commands For Changing Text
  32891. ---------------------------------
  32892. 'end-of-file (usually C-d)'
  32893. The character indicating end-of-file as set, for example, by
  32894. 'stty'. If this character is read when there are no characters on
  32895. the line, and point is at the beginning of the line, Readline
  32896. interprets it as the end of input and returns EOF.
  32897. 'delete-char (C-d)'
  32898. Delete the character at point. If this function is bound to the
  32899. same character as the tty EOF character, as 'C-d' commonly is, see
  32900. above for the effects.
  32901. 'backward-delete-char (Rubout)'
  32902. Delete the character behind the cursor. A numeric argument means
  32903. to kill the characters instead of deleting them.
  32904. 'forward-backward-delete-char ()'
  32905. Delete the character under the cursor, unless the cursor is at the
  32906. end of the line, in which case the character behind the cursor is
  32907. deleted. By default, this is not bound to a key.
  32908. 'quoted-insert (C-q or C-v)'
  32909. Add the next character typed to the line verbatim. This is how to
  32910. insert key sequences like 'C-q', for example.
  32911. 'tab-insert (M-<TAB>)'
  32912. Insert a tab character.
  32913. 'self-insert (a, b, A, 1, !, ...)'
  32914. Insert yourself.
  32915. 'bracketed-paste-begin ()'
  32916. This function is intended to be bound to the "bracketed paste"
  32917. escape sequence sent by some terminals, and such a binding is
  32918. assigned by default. It allows Readline to insert the pasted text
  32919. as a single unit without treating each character as if it had been
  32920. read from the keyboard. The characters are inserted as if each one
  32921. was bound to 'self-insert' instead of executing any editing
  32922. commands.
  32923. 'transpose-chars (C-t)'
  32924. Drag the character before the cursor forward over the character at
  32925. the cursor, moving the cursor forward as well. If the insertion
  32926. point is at the end of the line, then this transposes the last two
  32927. characters of the line. Negative arguments have no effect.
  32928. 'transpose-words (M-t)'
  32929. Drag the word before point past the word after point, moving point
  32930. past that word as well. If the insertion point is at the end of
  32931. the line, this transposes the last two words on the line.
  32932. 'upcase-word (M-u)'
  32933. Uppercase the current (or following) word. With a negative
  32934. argument, uppercase the previous word, but do not move the cursor.
  32935. 'downcase-word (M-l)'
  32936. Lowercase the current (or following) word. With a negative
  32937. argument, lowercase the previous word, but do not move the cursor.
  32938. 'capitalize-word (M-c)'
  32939. Capitalize the current (or following) word. With a negative
  32940. argument, capitalize the previous word, but do not move the cursor.
  32941. 'overwrite-mode ()'
  32942. Toggle overwrite mode. With an explicit positive numeric argument,
  32943. switches to overwrite mode. With an explicit non-positive numeric
  32944. argument, switches to insert mode. This command affects only
  32945. 'emacs' mode; 'vi' mode does overwrite differently. Each call to
  32946. 'readline()' starts in insert mode.
  32947. In overwrite mode, characters bound to 'self-insert' replace the
  32948. text at point rather than pushing the text to the right.
  32949. Characters bound to 'backward-delete-char' replace the character
  32950. before point with a space.
  32951. By default, this command is unbound.
  32952. 
  32953. File: gdb.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
  32954. 32.4.4 Killing And Yanking
  32955. --------------------------
  32956. 'kill-line (C-k)'
  32957. Kill the text from point to the end of the line.
  32958. 'backward-kill-line (C-x Rubout)'
  32959. Kill backward from the cursor to the beginning of the current line.
  32960. 'unix-line-discard (C-u)'
  32961. Kill backward from the cursor to the beginning of the current line.
  32962. 'kill-whole-line ()'
  32963. Kill all characters on the current line, no matter where point is.
  32964. By default, this is unbound.
  32965. 'kill-word (M-d)'
  32966. Kill from point to the end of the current word, or if between
  32967. words, to the end of the next word. Word boundaries are the same
  32968. as 'forward-word'.
  32969. 'backward-kill-word (M-<DEL>)'
  32970. Kill the word behind point. Word boundaries are the same as
  32971. 'backward-word'.
  32972. 'unix-word-rubout (C-w)'
  32973. Kill the word behind point, using white space as a word boundary.
  32974. The killed text is saved on the kill-ring.
  32975. 'unix-filename-rubout ()'
  32976. Kill the word behind point, using white space and the slash
  32977. character as the word boundaries. The killed text is saved on the
  32978. kill-ring.
  32979. 'delete-horizontal-space ()'
  32980. Delete all spaces and tabs around point. By default, this is
  32981. unbound.
  32982. 'kill-region ()'
  32983. Kill the text in the current region. By default, this command is
  32984. unbound.
  32985. 'copy-region-as-kill ()'
  32986. Copy the text in the region to the kill buffer, so it can be yanked
  32987. right away. By default, this command is unbound.
  32988. 'copy-backward-word ()'
  32989. Copy the word before point to the kill buffer. The word boundaries
  32990. are the same as 'backward-word'. By default, this command is
  32991. unbound.
  32992. 'copy-forward-word ()'
  32993. Copy the word following point to the kill buffer. The word
  32994. boundaries are the same as 'forward-word'. By default, this
  32995. command is unbound.
  32996. 'yank (C-y)'
  32997. Yank the top of the kill ring into the buffer at point.
  32998. 'yank-pop (M-y)'
  32999. Rotate the kill-ring, and yank the new top. You can only do this
  33000. if the prior command is 'yank' or 'yank-pop'.
  33001. 
  33002. File: gdb.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands
  33003. 32.4.5 Specifying Numeric Arguments
  33004. -----------------------------------
  33005. 'digit-argument (M-0, M-1, ... M--)'
  33006. Add this digit to the argument already accumulating, or start a new
  33007. argument. 'M--' starts a negative argument.
  33008. 'universal-argument ()'
  33009. This is another way to specify an argument. If this command is
  33010. followed by one or more digits, optionally with a leading minus
  33011. sign, those digits define the argument. If the command is followed
  33012. by digits, executing 'universal-argument' again ends the numeric
  33013. argument, but is otherwise ignored. As a special case, if this
  33014. command is immediately followed by a character that is neither a
  33015. digit nor minus sign, the argument count for the next command is
  33016. multiplied by four. The argument count is initially one, so
  33017. executing this function the first time makes the argument count
  33018. four, a second time makes the argument count sixteen, and so on.
  33019. By default, this is not bound to a key.
  33020. 
  33021. File: gdb.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands
  33022. 32.4.6 Letting Readline Type For You
  33023. ------------------------------------
  33024. 'complete (<TAB>)'
  33025. Attempt to perform completion on the text before point. The actual
  33026. completion performed is application-specific. The default is
  33027. filename completion.
  33028. 'possible-completions (M-?)'
  33029. List the possible completions of the text before point. When
  33030. displaying completions, Readline sets the number of columns used
  33031. for display to the value of 'completion-display-width', the value
  33032. of the environment variable 'COLUMNS', or the screen width, in that
  33033. order.
  33034. 'insert-completions (M-*)'
  33035. Insert all completions of the text before point that would have
  33036. been generated by 'possible-completions'.
  33037. 'menu-complete ()'
  33038. Similar to 'complete', but replaces the word to be completed with a
  33039. single match from the list of possible completions. Repeated
  33040. execution of 'menu-complete' steps through the list of possible
  33041. completions, inserting each match in turn. At the end of the list
  33042. of completions, the bell is rung (subject to the setting of
  33043. 'bell-style') and the original text is restored. An argument of N
  33044. moves N positions forward in the list of matches; a negative
  33045. argument may be used to move backward through the list. This
  33046. command is intended to be bound to <TAB>, but is unbound by
  33047. default.
  33048. 'menu-complete-backward ()'
  33049. Identical to 'menu-complete', but moves backward through the list
  33050. of possible completions, as if 'menu-complete' had been given a
  33051. negative argument.
  33052. 'delete-char-or-list ()'
  33053. Deletes the character under the cursor if not at the beginning or
  33054. end of the line (like 'delete-char'). If at the end of the line,
  33055. behaves identically to 'possible-completions'. This command is
  33056. unbound by default.
  33057. 
  33058. File: gdb.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands
  33059. 32.4.7 Keyboard Macros
  33060. ----------------------
  33061. 'start-kbd-macro (C-x ()'
  33062. Begin saving the characters typed into the current keyboard macro.
  33063. 'end-kbd-macro (C-x ))'
  33064. Stop saving the characters typed into the current keyboard macro
  33065. and save the definition.
  33066. 'call-last-kbd-macro (C-x e)'
  33067. Re-execute the last keyboard macro defined, by making the
  33068. characters in the macro appear as if typed at the keyboard.
  33069. 'print-last-kbd-macro ()'
  33070. Print the last keboard macro defined in a format suitable for the
  33071. INPUTRC file.
  33072. 
  33073. File: gdb.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands
  33074. 32.4.8 Some Miscellaneous Commands
  33075. ----------------------------------
  33076. 're-read-init-file (C-x C-r)'
  33077. Read in the contents of the INPUTRC file, and incorporate any
  33078. bindings or variable assignments found there.
  33079. 'abort (C-g)'
  33080. Abort the current editing command and ring the terminal's bell
  33081. (subject to the setting of 'bell-style').
  33082. 'do-lowercase-version (M-A, M-B, M-X, ...)'
  33083. If the metafied character X is upper case, run the command that is
  33084. bound to the corresponding metafied lower case character. The
  33085. behavior is undefined if X is already lower case.
  33086. 'prefix-meta (<ESC>)'
  33087. Metafy the next character typed. This is for keyboards without a
  33088. meta key. Typing '<ESC> f' is equivalent to typing 'M-f'.
  33089. 'undo (C-_ or C-x C-u)'
  33090. Incremental undo, separately remembered for each line.
  33091. 'revert-line (M-r)'
  33092. Undo all changes made to this line. This is like executing the
  33093. 'undo' command enough times to get back to the beginning.
  33094. 'tilde-expand (M-~)'
  33095. Perform tilde expansion on the current word.
  33096. 'set-mark (C-@)'
  33097. Set the mark to the point. If a numeric argument is supplied, the
  33098. mark is set to that position.
  33099. 'exchange-point-and-mark (C-x C-x)'
  33100. Swap the point with the mark. The current cursor position is set
  33101. to the saved position, and the old cursor position is saved as the
  33102. mark.
  33103. 'character-search (C-])'
  33104. A character is read and point is moved to the next occurrence of
  33105. that character. A negative count searches for previous
  33106. occurrences.
  33107. 'character-search-backward (M-C-])'
  33108. A character is read and point is moved to the previous occurrence
  33109. of that character. A negative count searches for subsequent
  33110. occurrences.
  33111. 'skip-csi-sequence ()'
  33112. Read enough characters to consume a multi-key sequence such as
  33113. those defined for keys like Home and End. Such sequences begin
  33114. with a Control Sequence Indicator (CSI), usually ESC-[. If this
  33115. sequence is bound to "\e[", keys producing such sequences will have
  33116. no effect unless explicitly bound to a readline command, instead of
  33117. inserting stray characters into the editing buffer. This is
  33118. unbound by default, but usually bound to ESC-[.
  33119. 'insert-comment (M-#)'
  33120. Without a numeric argument, the value of the 'comment-begin'
  33121. variable is inserted at the beginning of the current line. If a
  33122. numeric argument is supplied, this command acts as a toggle: if the
  33123. characters at the beginning of the line do not match the value of
  33124. 'comment-begin', the value is inserted, otherwise the characters in
  33125. 'comment-begin' are deleted from the beginning of the line. In
  33126. either case, the line is accepted as if a newline had been typed.
  33127. 'dump-functions ()'
  33128. Print all of the functions and their key bindings to the Readline
  33129. output stream. If a numeric argument is supplied, the output is
  33130. formatted in such a way that it can be made part of an INPUTRC
  33131. file. This command is unbound by default.
  33132. 'dump-variables ()'
  33133. Print all of the settable variables and their values to the
  33134. Readline output stream. If a numeric argument is supplied, the
  33135. output is formatted in such a way that it can be made part of an
  33136. INPUTRC file. This command is unbound by default.
  33137. 'dump-macros ()'
  33138. Print all of the Readline key sequences bound to macros and the
  33139. strings they output. If a numeric argument is supplied, the output
  33140. is formatted in such a way that it can be made part of an INPUTRC
  33141. file. This command is unbound by default.
  33142. 'emacs-editing-mode (C-e)'
  33143. When in 'vi' command mode, this causes a switch to 'emacs' editing
  33144. mode.
  33145. 'vi-editing-mode (M-C-j)'
  33146. When in 'emacs' editing mode, this causes a switch to 'vi' editing
  33147. mode.
  33148. 
  33149. File: gdb.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing
  33150. 32.5 Readline vi Mode
  33151. =====================
  33152. While the Readline library does not have a full set of 'vi' editing
  33153. functions, it does contain enough to allow simple editing of the line.
  33154. The Readline 'vi' mode behaves as specified in the POSIX standard.
  33155. In order to switch interactively between 'emacs' and 'vi' editing
  33156. modes, use the command 'M-C-j' (bound to emacs-editing-mode when in 'vi'
  33157. mode and to vi-editing-mode in 'emacs' mode). The Readline default is
  33158. 'emacs' mode.
  33159. When you enter a line in 'vi' mode, you are already placed in
  33160. 'insertion' mode, as if you had typed an 'i'. Pressing <ESC> switches
  33161. you into 'command' mode, where you can edit the text of the line with
  33162. the standard 'vi' movement keys, move to previous history lines with 'k'
  33163. and subsequent lines with 'j', and so forth.
  33164. 
  33165. File: gdb.info, Node: Using History Interactively, Next: In Memoriam, Prev: Command Line Editing, Up: Top
  33166. 33 Using History Interactively
  33167. ******************************
  33168. This chapter describes how to use the GNU History Library interactively,
  33169. from a user's standpoint. It should be considered a user's guide. For
  33170. information on using the GNU History Library in your own programs, *note
  33171. (history)Programming with GNU History::.
  33172. * Menu:
  33173. * History Interaction:: What it feels like using History as a user.
  33174. 
  33175. File: gdb.info, Node: History Interaction, Up: Using History Interactively
  33176. 33.1 History Expansion
  33177. ======================
  33178. The History library provides a history expansion feature that is similar
  33179. to the history expansion provided by 'csh'. This section describes the
  33180. syntax used to manipulate the history information.
  33181. History expansions introduce words from the history list into the
  33182. input stream, making it easy to repeat commands, insert the arguments to
  33183. a previous command into the current input line, or fix errors in
  33184. previous commands quickly.
  33185. History expansion takes place in two parts. The first is to
  33186. determine which line from the history list should be used during
  33187. substitution. The second is to select portions of that line for
  33188. inclusion into the current one. The line selected from the history is
  33189. called the "event", and the portions of that line that are acted upon
  33190. are called "words". Various "modifiers" are available to manipulate the
  33191. selected words. The line is broken into words in the same fashion that
  33192. Bash does, so that several words surrounded by quotes are considered one
  33193. word. History expansions are introduced by the appearance of the
  33194. history expansion character, which is '!' by default.
  33195. History expansion implements shell-like quoting conventions: a
  33196. backslash can be used to remove the special handling for the next
  33197. character; single quotes enclose verbatim sequences of characters, and
  33198. can be used to inhibit history expansion; and characters enclosed within
  33199. double quotes may be subject to history expansion, since backslash can
  33200. escape the history expansion character, but single quotes may not, since
  33201. they are not treated specially within double quotes.
  33202. * Menu:
  33203. * Event Designators:: How to specify which history line to use.
  33204. * Word Designators:: Specifying which words are of interest.
  33205. * Modifiers:: Modifying the results of substitution.
  33206. 
  33207. File: gdb.info, Node: Event Designators, Next: Word Designators, Up: History Interaction
  33208. 33.1.1 Event Designators
  33209. ------------------------
  33210. An event designator is a reference to a command line entry in the
  33211. history list. Unless the reference is absolute, events are relative to
  33212. the current position in the history list.
  33213. '!'
  33214. Start a history substitution, except when followed by a space, tab,
  33215. the end of the line, or '='.
  33216. '!N'
  33217. Refer to command line N.
  33218. '!-N'
  33219. Refer to the command N lines back.
  33220. '!!'
  33221. Refer to the previous command. This is a synonym for '!-1'.
  33222. '!STRING'
  33223. Refer to the most recent command preceding the current position in
  33224. the history list starting with STRING.
  33225. '!?STRING[?]'
  33226. Refer to the most recent command preceding the current position in
  33227. the history list containing STRING. The trailing '?' may be
  33228. omitted if the STRING is followed immediately by a newline.
  33229. '^STRING1^STRING2^'
  33230. Quick Substitution. Repeat the last command, replacing STRING1
  33231. with STRING2. Equivalent to '!!:s/STRING1/STRING2/'.
  33232. '!#'
  33233. The entire command line typed so far.
  33234. 
  33235. File: gdb.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction
  33236. 33.1.2 Word Designators
  33237. -----------------------
  33238. Word designators are used to select desired words from the event. A ':'
  33239. separates the event specification from the word designator. It may be
  33240. omitted if the word designator begins with a '^', '$', '*', '-', or '%'.
  33241. Words are numbered from the beginning of the line, with the first word
  33242. being denoted by 0 (zero). Words are inserted into the current line
  33243. separated by single spaces.
  33244. For example,
  33245. '!!'
  33246. designates the preceding command. When you type this, the
  33247. preceding command is repeated in toto.
  33248. '!!:$'
  33249. designates the last argument of the preceding command. This may be
  33250. shortened to '!$'.
  33251. '!fi:2'
  33252. designates the second argument of the most recent command starting
  33253. with the letters 'fi'.
  33254. Here are the word designators:
  33255. '0 (zero)'
  33256. The '0'th word. For many applications, this is the command word.
  33257. 'N'
  33258. The Nth word.
  33259. '^'
  33260. The first argument; that is, word 1.
  33261. '$'
  33262. The last argument.
  33263. '%'
  33264. The word matched by the most recent '?STRING?' search.
  33265. 'X-Y'
  33266. A range of words; '-Y' abbreviates '0-Y'.
  33267. '*'
  33268. All of the words, except the '0'th. This is a synonym for '1-$'.
  33269. It is not an error to use '*' if there is just one word in the
  33270. event; the empty string is returned in that case.
  33271. 'X*'
  33272. Abbreviates 'X-$'
  33273. 'X-'
  33274. Abbreviates 'X-$' like 'X*', but omits the last word.
  33275. If a word designator is supplied without an event specification, the
  33276. previous command is used as the event.
  33277. 
  33278. File: gdb.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
  33279. 33.1.3 Modifiers
  33280. ----------------
  33281. After the optional word designator, you can add a sequence of one or
  33282. more of the following modifiers, each preceded by a ':'.
  33283. 'h'
  33284. Remove a trailing pathname component, leaving only the head.
  33285. 't'
  33286. Remove all leading pathname components, leaving the tail.
  33287. 'r'
  33288. Remove a trailing suffix of the form '.SUFFIX', leaving the
  33289. basename.
  33290. 'e'
  33291. Remove all but the trailing suffix.
  33292. 'p'
  33293. Print the new command but do not execute it.
  33294. 's/OLD/NEW/'
  33295. Substitute NEW for the first occurrence of OLD in the event line.
  33296. Any delimiter may be used in place of '/'. The delimiter may be
  33297. quoted in OLD and NEW with a single backslash. If '&' appears in
  33298. NEW, it is replaced by OLD. A single backslash will quote the '&'.
  33299. The final delimiter is optional if it is the last character on the
  33300. input line.
  33301. '&'
  33302. Repeat the previous substitution.
  33303. 'g'
  33304. 'a'
  33305. Cause changes to be applied over the entire event line. Used in
  33306. conjunction with 's', as in 'gs/OLD/NEW/', or with '&'.
  33307. 'G'
  33308. Apply the following 's' modifier once to each word in the event.
  33309. 
  33310. File: gdb.info, Node: In Memoriam, Next: Formatting Documentation, Prev: Using History Interactively, Up: Top
  33311. Appendix A In Memoriam
  33312. **********************
  33313. The GDB project mourns the loss of the following long-time contributors:
  33314. 'Fred Fish'
  33315. Fred was a long-standing contributor to GDB (1991-2006), and to
  33316. Free Software in general. Outside of GDB, he was known in the
  33317. Amiga world for his series of Fish Disks, and the GeekGadget
  33318. project.
  33319. 'Michael Snyder'
  33320. Michael was one of the Global Maintainers of the GDB project, with
  33321. contributions recorded as early as 1996, until 2011. In addition
  33322. to his day to day participation, he was a large driving force
  33323. behind adding Reverse Debugging to GDB.
  33324. Beyond their technical contributions to the project, they were also
  33325. enjoyable members of the Free Software Community. We will miss them.
  33326. 
  33327. File: gdb.info, Node: Formatting Documentation, Next: Installing GDB, Prev: In Memoriam, Up: Top
  33328. Appendix B Formatting Documentation
  33329. ***********************************
  33330. The GDB 4 release includes an already-formatted reference card, ready
  33331. for printing with PostScript or Ghostscript, in the 'gdb' subdirectory
  33332. of the main source directory(1). If you can use PostScript or
  33333. Ghostscript with your printer, you can print the reference card
  33334. immediately with 'refcard.ps'.
  33335. The release also includes the source for the reference card. You can
  33336. format it, using TeX, by typing:
  33337. make refcard.dvi
  33338. The GDB reference card is designed to print in "landscape" mode on US
  33339. "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
  33340. high. You will need to specify this form of printing as an option to
  33341. your DVI output program.
  33342. All the documentation for GDB comes as part of the machine-readable
  33343. distribution. The documentation is written in Texinfo format, which is
  33344. a documentation system that uses a single source file to produce both
  33345. on-line information and a printed manual. You can use one of the Info
  33346. formatting commands to create the on-line version of the documentation
  33347. and TeX (or 'texi2roff') to typeset the printed version.
  33348. GDB includes an already formatted copy of the on-line Info version of
  33349. this manual in the 'gdb' subdirectory. The main Info file is
  33350. 'gdb-10.1/gdb/gdb.info', and it refers to subordinate files matching
  33351. 'gdb.info*' in the same directory. If necessary, you can print out
  33352. these files, or read them with any editor; but they are easier to read
  33353. using the 'info' subsystem in GNU Emacs or the standalone 'info'
  33354. program, available as part of the GNU Texinfo distribution.
  33355. If you want to format these Info files yourself, you need one of the
  33356. Info formatting programs, such as 'texinfo-format-buffer' or 'makeinfo'.
  33357. If you have 'makeinfo' installed, and are in the top level GDB source
  33358. directory ('gdb-10.1', in the case of version 10.1), you can make the
  33359. Info file by typing:
  33360. cd gdb
  33361. make gdb.info
  33362. If you want to typeset and print copies of this manual, you need TeX,
  33363. a program to print its DVI output files, and 'texinfo.tex', the Texinfo
  33364. definitions file.
  33365. TeX is a typesetting program; it does not print files directly, but
  33366. produces output files called DVI files. To print a typeset document,
  33367. you need a program to print DVI files. If your system has TeX
  33368. installed, chances are it has such a program. The precise command to
  33369. use depends on your system; 'lpr -d' is common; another (for PostScript
  33370. devices) is 'dvips'. The DVI print command may require a file name
  33371. without any extension or a '.dvi' extension.
  33372. TeX also requires a macro definitions file called 'texinfo.tex'.
  33373. This file tells TeX how to typeset a document written in Texinfo format.
  33374. On its own, TeX cannot either read or typeset a Texinfo file.
  33375. 'texinfo.tex' is distributed with GDB and is located in the
  33376. 'gdb-VERSION-NUMBER/texinfo' directory.
  33377. If you have TeX and a DVI printer program installed, you can typeset
  33378. and print this manual. First switch to the 'gdb' subdirectory of the
  33379. main source directory (for example, to 'gdb-10.1/gdb') and type:
  33380. make gdb.dvi
  33381. Then give 'gdb.dvi' to your DVI printing program.
  33382. ---------- Footnotes ----------
  33383. (1) In 'gdb-10.1/gdb/refcard.ps' of the version 10.1 release.
  33384. 
  33385. File: gdb.info, Node: Installing GDB, Next: Maintenance Commands, Prev: Formatting Documentation, Up: Top
  33386. Appendix C Installing GDB
  33387. *************************
  33388. * Menu:
  33389. * Requirements:: Requirements for building GDB
  33390. * Running Configure:: Invoking the GDB 'configure' script
  33391. * Separate Objdir:: Compiling GDB in another directory
  33392. * Config Names:: Specifying names for hosts and targets
  33393. * Configure Options:: Summary of options for configure
  33394. * System-wide configuration:: Having a system-wide init file
  33395. 
  33396. File: gdb.info, Node: Requirements, Next: Running Configure, Up: Installing GDB
  33397. C.1 Requirements for Building GDB
  33398. =================================
  33399. Building GDB requires various tools and packages to be available. Other
  33400. packages will be used only if they are found.
  33401. Tools/Packages Necessary for Building GDB
  33402. =========================================
  33403. C++11 compiler
  33404. GDB is written in C++11. It should be buildable with any recent
  33405. C++11 compiler, e.g. GCC.
  33406. GNU make
  33407. GDB's build system relies on features only found in the GNU make
  33408. program. Other variants of 'make' will not work.
  33409. Tools/Packages Optional for Building GDB
  33410. ========================================
  33411. Expat
  33412. GDB can use the Expat XML parsing library. This library may be
  33413. included with your operating system distribution; if it is not, you
  33414. can get the latest version from <http://expat.sourceforge.net>.
  33415. The 'configure' script will search for this library in several
  33416. standard locations; if it is installed in an unusual path, you can
  33417. use the '--with-libexpat-prefix' option to specify its location.
  33418. Expat is used for:
  33419. * Remote protocol memory maps (*note Memory Map Format::)
  33420. * Target descriptions (*note Target Descriptions::)
  33421. * Remote shared library lists (*Note Library List Format::, or
  33422. alternatively *note Library List Format for SVR4 Targets::)
  33423. * MS-Windows shared libraries (*note Shared Libraries::)
  33424. * Traceframe info (*note Traceframe Info Format::)
  33425. * Branch trace (*note Branch Trace Format::, *note Branch Trace
  33426. Configuration Format::)
  33427. Guile
  33428. GDB can be scripted using GNU Guile. *Note Guile::. By default,
  33429. GDB will be compiled if the Guile libraries are installed and are
  33430. found by 'configure'. You can use the '--with-guile' option to
  33431. request Guile, and pass either the Guile version number or the file
  33432. name of the relevant 'pkg-config' program to choose a particular
  33433. version of Guile.
  33434. iconv
  33435. GDB's features related to character sets (*note Character Sets::)
  33436. require a functioning 'iconv' implementation. If you are on a GNU
  33437. system, then this is provided by the GNU C Library. Some other
  33438. systems also provide a working 'iconv'.
  33439. If GDB is using the 'iconv' program which is installed in a
  33440. non-standard place, you will need to tell GDB where to find it.
  33441. This is done with '--with-iconv-bin' which specifies the directory
  33442. that contains the 'iconv' program. This program is run in order to
  33443. make a list of the available character sets.
  33444. On systems without 'iconv', you can install GNU Libiconv. If
  33445. Libiconv is installed in a standard place, GDB will automatically
  33446. use it if it is needed. If you have previously installed Libiconv
  33447. in a non-standard place, you can use the '--with-libiconv-prefix'
  33448. option to 'configure'.
  33449. GDB's top-level 'configure' and 'Makefile' will arrange to build
  33450. Libiconv if a directory named 'libiconv' appears in the top-most
  33451. source directory. If Libiconv is built this way, and if the
  33452. operating system does not provide a suitable 'iconv'
  33453. implementation, then the just-built library will automatically be
  33454. used by GDB. One easy way to set this up is to download GNU
  33455. Libiconv, unpack it inside the top-level directory of the GDB
  33456. source tree, and then rename the directory holding the Libiconv
  33457. source code to 'libiconv'.
  33458. lzma
  33459. GDB can support debugging sections that are compressed with the
  33460. LZMA library. *Note MiniDebugInfo::. If this library is not
  33461. included with your operating system, you can find it in the xz
  33462. package at <http://tukaani.org/xz/>. If the LZMA library is
  33463. available in the usual place, then the 'configure' script will use
  33464. it automatically. If it is installed in an unusual path, you can
  33465. use the '--with-lzma-prefix' option to specify its location.
  33466. MPFR
  33467. GDB can use the GNU MPFR multiple-precision floating-point library.
  33468. This library may be included with your operating system
  33469. distribution; if it is not, you can get the latest version from
  33470. <http://www.mpfr.org>. The 'configure' script will search for this
  33471. library in several standard locations; if it is installed in an
  33472. unusual path, you can use the '--with-libmpfr-prefix' option to
  33473. specify its location.
  33474. GNU MPFR is used to emulate target floating-point arithmetic during
  33475. expression evaluation when the target uses different floating-point
  33476. formats than the host. If GNU MPFR it is not available, GDB will
  33477. fall back to using host floating-point arithmetic.
  33478. Python
  33479. GDB can be scripted using Python language. *Note Python::. By
  33480. default, GDB will be compiled if the Python libraries are installed
  33481. and are found by 'configure'. You can use the '--with-python'
  33482. option to request Python, and pass either the file name of the
  33483. relevant 'python' executable, or the name of the directory in which
  33484. Python is installed, to choose a particular installation of Python.
  33485. zlib
  33486. GDB will use the 'zlib' library, if available, to read compressed
  33487. debug sections. Some linkers, such as GNU gold, are capable of
  33488. producing binaries with compressed debug sections. If GDB is
  33489. compiled with 'zlib', it will be able to read the debug information
  33490. in such binaries.
  33491. The 'zlib' library is likely included with your operating system
  33492. distribution; if it is not, you can get the latest version from
  33493. <http://zlib.net>.
  33494. 
  33495. File: gdb.info, Node: Running Configure, Next: Separate Objdir, Prev: Requirements, Up: Installing GDB
  33496. C.2 Invoking the GDB 'configure' Script
  33497. =======================================
  33498. GDB comes with a 'configure' script that automates the process of
  33499. preparing GDB for installation; you can then use 'make' to build the
  33500. 'gdb' program.
  33501. The GDB distribution includes all the source code you need for GDB in
  33502. a single directory, whose name is usually composed by appending the
  33503. version number to 'gdb'.
  33504. For example, the GDB version 10.1 distribution is in the 'gdb-10.1'
  33505. directory. That directory contains:
  33506. 'gdb-10.1/configure (and supporting files)'
  33507. script for configuring GDB and all its supporting libraries
  33508. 'gdb-10.1/gdb'
  33509. the source specific to GDB itself
  33510. 'gdb-10.1/bfd'
  33511. source for the Binary File Descriptor library
  33512. 'gdb-10.1/include'
  33513. GNU include files
  33514. 'gdb-10.1/libiberty'
  33515. source for the '-liberty' free software library
  33516. 'gdb-10.1/opcodes'
  33517. source for the library of opcode tables and disassemblers
  33518. 'gdb-10.1/readline'
  33519. source for the GNU command-line interface
  33520. There may be other subdirectories as well.
  33521. The simplest way to configure and build GDB is to run 'configure'
  33522. from the 'gdb-VERSION-NUMBER' source directory, which in this example is
  33523. the 'gdb-10.1' directory.
  33524. First switch to the 'gdb-VERSION-NUMBER' source directory if you are
  33525. not already in it; then run 'configure'. Pass the identifier for the
  33526. platform on which GDB will run as an argument.
  33527. For example:
  33528. cd gdb-10.1
  33529. ./configure
  33530. make
  33531. Running 'configure' and then running 'make' builds the included
  33532. supporting libraries, then 'gdb' itself. The configured source files,
  33533. and the binaries, are left in the corresponding source directories.
  33534. 'configure' is a Bourne-shell ('/bin/sh') script; if your system does
  33535. not recognize this automatically when you run a different shell, you may
  33536. need to run 'sh' on it explicitly:
  33537. sh configure
  33538. You should run the 'configure' script from the top directory in the
  33539. source tree, the 'gdb-VERSION-NUMBER' directory. If you run 'configure'
  33540. from one of the subdirectories, you will configure only that
  33541. subdirectory. That is usually not what you want. In particular, if you
  33542. run the first 'configure' from the 'gdb' subdirectory of the
  33543. 'gdb-VERSION-NUMBER' directory, you will omit the configuration of
  33544. 'bfd', 'readline', and other sibling directories of the 'gdb'
  33545. subdirectory. This leads to build errors about missing include files
  33546. such as 'bfd/bfd.h'.
  33547. You can install 'GDB' anywhere. The best way to do this is to pass
  33548. the '--prefix' option to 'configure', and then install it with 'make
  33549. install'.
  33550. 
  33551. File: gdb.info, Node: Separate Objdir, Next: Config Names, Prev: Running Configure, Up: Installing GDB
  33552. C.3 Compiling GDB in Another Directory
  33553. ======================================
  33554. If you want to run GDB versions for several host or target machines, you
  33555. need a different 'gdb' compiled for each combination of host and target.
  33556. 'configure' is designed to make this easy by allowing you to generate
  33557. each configuration in a separate subdirectory, rather than in the source
  33558. directory. If your 'make' program handles the 'VPATH' feature (GNU
  33559. 'make' does), running 'make' in each of these directories builds the
  33560. 'gdb' program specified there.
  33561. To build 'gdb' in a separate directory, run 'configure' with the
  33562. '--srcdir' option to specify where to find the source. (You also need
  33563. to specify a path to find 'configure' itself from your working
  33564. directory. If the path to 'configure' would be the same as the argument
  33565. to '--srcdir', you can leave out the '--srcdir' option; it is assumed.)
  33566. For example, with version 10.1, you can build GDB in a separate
  33567. directory for a Sun 4 like this:
  33568. cd gdb-10.1
  33569. mkdir ../gdb-sun4
  33570. cd ../gdb-sun4
  33571. ../gdb-10.1/configure
  33572. make
  33573. When 'configure' builds a configuration using a remote source
  33574. directory, it creates a tree for the binaries with the same structure
  33575. (and using the same names) as the tree under the source directory. In
  33576. the example, you'd find the Sun 4 library 'libiberty.a' in the directory
  33577. 'gdb-sun4/libiberty', and GDB itself in 'gdb-sun4/gdb'.
  33578. Make sure that your path to the 'configure' script has just one
  33579. instance of 'gdb' in it. If your path to 'configure' looks like
  33580. '../gdb-10.1/gdb/configure', you are configuring only one subdirectory
  33581. of GDB, not the whole package. This leads to build errors about missing
  33582. include files such as 'bfd/bfd.h'.
  33583. One popular reason to build several GDB configurations in separate
  33584. directories is to configure GDB for cross-compiling (where GDB runs on
  33585. one machine--the "host"--while debugging programs that run on another
  33586. machine--the "target"). You specify a cross-debugging target by giving
  33587. the '--target=TARGET' option to 'configure'.
  33588. When you run 'make' to build a program or library, you must run it in
  33589. a configured directory--whatever directory you were in when you called
  33590. 'configure' (or one of its subdirectories).
  33591. The 'Makefile' that 'configure' generates in each source directory
  33592. also runs recursively. If you type 'make' in a source directory such as
  33593. 'gdb-10.1' (or in a separate configured directory configured with
  33594. '--srcdir=DIRNAME/gdb-10.1'), you will build all the required libraries,
  33595. and then build GDB.
  33596. When you have multiple hosts or targets configured in separate
  33597. directories, you can run 'make' on them in parallel (for example, if
  33598. they are NFS-mounted on each of the hosts); they will not interfere with
  33599. each other.
  33600. 
  33601. File: gdb.info, Node: Config Names, Next: Configure Options, Prev: Separate Objdir, Up: Installing GDB
  33602. C.4 Specifying Names for Hosts and Targets
  33603. ==========================================
  33604. The specifications used for hosts and targets in the 'configure' script
  33605. are based on a three-part naming scheme, but some short predefined
  33606. aliases are also supported. The full naming scheme encodes three pieces
  33607. of information in the following pattern:
  33608. ARCHITECTURE-VENDOR-OS
  33609. For example, you can use the alias 'sun4' as a HOST argument, or as
  33610. the value for TARGET in a '--target=TARGET' option. The equivalent full
  33611. name is 'sparc-sun-sunos4'.
  33612. The 'configure' script accompanying GDB does not provide any query
  33613. facility to list all supported host and target names or aliases.
  33614. 'configure' calls the Bourne shell script 'config.sub' to map
  33615. abbreviations to full names; you can read the script, if you wish, or
  33616. you can use it to test your guesses on abbreviations--for example:
  33617. % sh config.sub i386-linux
  33618. i386-pc-linux-gnu
  33619. % sh config.sub alpha-linux
  33620. alpha-unknown-linux-gnu
  33621. % sh config.sub hp9k700
  33622. hppa1.1-hp-hpux
  33623. % sh config.sub sun4
  33624. sparc-sun-sunos4.1.1
  33625. % sh config.sub sun3
  33626. m68k-sun-sunos4.1.1
  33627. % sh config.sub i986v
  33628. Invalid configuration `i986v': machine `i986v' not recognized
  33629. 'config.sub' is also distributed in the GDB source directory
  33630. ('gdb-10.1', for version 10.1).
  33631. 
  33632. File: gdb.info, Node: Configure Options, Next: System-wide configuration, Prev: Config Names, Up: Installing GDB
  33633. C.5 'configure' Options
  33634. =======================
  33635. Here is a summary of the 'configure' options and arguments that are most
  33636. often useful for building GDB. 'configure' also has several other
  33637. options not listed here. *note (autoconf.info)Running configure
  33638. scripts::, for a full explanation of 'configure'.
  33639. configure [--help]
  33640. [--prefix=DIR]
  33641. [--exec-prefix=DIR]
  33642. [--srcdir=DIRNAME]
  33643. [--target=TARGET]
  33644. You may introduce options with a single '-' rather than '--' if you
  33645. prefer; but you may abbreviate option names if you use '--'.
  33646. '--help'
  33647. Display a quick summary of how to invoke 'configure'.
  33648. '--prefix=DIR'
  33649. Configure the source to install programs and files under directory
  33650. 'DIR'.
  33651. '--exec-prefix=DIR'
  33652. Configure the source to install programs under directory 'DIR'.
  33653. '--srcdir=DIRNAME'
  33654. Use this option to make configurations in directories separate from
  33655. the GDB source directories. Among other things, you can use this
  33656. to build (or maintain) several configurations simultaneously, in
  33657. separate directories. 'configure' writes configuration-specific
  33658. files in the current directory, but arranges for them to use the
  33659. source in the directory DIRNAME. 'configure' creates directories
  33660. under the working directory in parallel to the source directories
  33661. below DIRNAME.
  33662. '--target=TARGET'
  33663. Configure GDB for cross-debugging programs running on the specified
  33664. TARGET. Without this option, GDB is configured to debug programs
  33665. that run on the same machine (HOST) as GDB itself.
  33666. There is no convenient way to generate a list of all available
  33667. targets. Also see the '--enable-targets' option, below.
  33668. There are many other options that are specific to GDB. This lists
  33669. just the most common ones; there are some very specialized options not
  33670. described here.
  33671. '--enable-targets=[TARGET]...'
  33672. '--enable-targets=all'
  33673. Configure GDB for cross-debugging programs running on the specified
  33674. list of targets. The special value 'all' configures GDB for
  33675. debugging programs running on any target it supports.
  33676. '--with-gdb-datadir=PATH'
  33677. Set the GDB-specific data directory. GDB will look here for
  33678. certain supporting files or scripts. This defaults to the 'gdb'
  33679. subdirectory of 'datadir' (which can be set using '--datadir').
  33680. '--with-relocated-sources=DIR'
  33681. Sets up the default source path substitution rule so that directory
  33682. names recorded in debug information will be automatically adjusted
  33683. for any directory under DIR. DIR should be a subdirectory of GDB's
  33684. configured prefix, the one mentioned in the '--prefix' or
  33685. '--exec-prefix' options to configure. This option is useful if GDB
  33686. is supposed to be moved to a different place after it is built.
  33687. '--enable-64-bit-bfd'
  33688. Enable 64-bit support in BFD on 32-bit hosts.
  33689. '--disable-gdbmi'
  33690. Build GDB without the GDB/MI machine interface (*note GDB/MI::).
  33691. '--enable-tui'
  33692. Build GDB with the text-mode full-screen user interface (TUI).
  33693. Requires a curses library (ncurses and cursesX are also supported).
  33694. '--with-curses'
  33695. Use the curses library instead of the termcap library, for
  33696. text-mode terminal operations.
  33697. '--with-debuginfod'
  33698. Build GDB with libdebuginfod, the debuginfod client library. Used
  33699. to automatically fetch source files and separate debug files from
  33700. debuginfod servers using the associated executable's build ID.
  33701. Enabled by default if libdebuginfod is installed and found at
  33702. configure time. debuginfod is packaged with elfutils, starting
  33703. with version 0.178. You can get the latest version from
  33704. 'https://sourceware.org/elfutils/'.
  33705. '--with-libunwind-ia64'
  33706. Use the libunwind library for unwinding function call stack on ia64
  33707. target platforms. See http://www.nongnu.org/libunwind/index.html
  33708. for details.
  33709. '--with-system-readline'
  33710. Use the readline library installed on the host, rather than the
  33711. library supplied as part of GDB. Readline 7 or newer is required;
  33712. this is enforced by the build system.
  33713. '--with-system-zlib'
  33714. Use the zlib library installed on the host, rather than the library
  33715. supplied as part of GDB.
  33716. '--with-expat'
  33717. Build GDB with Expat, a library for XML parsing. (Done by default
  33718. if libexpat is installed and found at configure time.) This
  33719. library is used to read XML files supplied with GDB. If it is
  33720. unavailable, some features, such as remote protocol memory maps,
  33721. target descriptions, and shared library lists, that are based on
  33722. XML files, will not be available in GDB. If your host does not
  33723. have libexpat installed, you can get the latest version from
  33724. 'http://expat.sourceforge.net'.
  33725. '--with-libiconv-prefix[=DIR]'
  33726. Build GDB with GNU libiconv, a character set encoding conversion
  33727. library. This is not done by default, as on GNU systems the
  33728. 'iconv' that is built in to the C library is sufficient. If your
  33729. host does not have a working 'iconv', you can get the latest
  33730. version of GNU iconv from 'https://www.gnu.org/software/libiconv/'.
  33731. GDB's build system also supports building GNU libiconv as part of
  33732. the overall build. *Note Requirements::.
  33733. '--with-lzma'
  33734. Build GDB with LZMA, a compression library. (Done by default if
  33735. liblzma is installed and found at configure time.) LZMA is used by
  33736. GDB's "mini debuginfo" feature, which is only useful on platforms
  33737. using the ELF object file format. If your host does not have
  33738. liblzma installed, you can get the latest version from
  33739. 'https://tukaani.org/xz/'.
  33740. '--with-mpfr'
  33741. Build GDB with GNU MPFR, a library for multiple-precision
  33742. floating-point computation with correct rounding. (Done by default
  33743. if GNU MPFR is installed and found at configure time.) This
  33744. library is used to emulate target floating-point arithmetic during
  33745. expression evaluation when the target uses different floating-point
  33746. formats than the host. If GNU MPFR is not available, GDB will fall
  33747. back to using host floating-point arithmetic. If your host does
  33748. not have GNU MPFR installed, you can get the latest version from
  33749. 'http://www.mpfr.org'.
  33750. '--with-python[=PYTHON]'
  33751. Build GDB with Python scripting support. (Done by default if
  33752. libpython is present and found at configure time.) Python makes
  33753. GDB scripting much more powerful than the restricted CLI scripting
  33754. language. If your host does not have Python installed, you can
  33755. find it on 'http://www.python.org/download/'. The oldest version
  33756. of Python supported by GDB is 2.6. The optional argument PYTHON is
  33757. used to find the Python headers and libraries. It can be either
  33758. the name of a Python executable, or the name of the directory in
  33759. which Python is installed.
  33760. '--with-guile[=GUILE]''
  33761. Build GDB with GNU Guile scripting support. (Done by default if
  33762. libguile is present and found at configure time.) If your host
  33763. does not have Guile installed, you can find it at
  33764. 'https://www.gnu.org/software/guile/'. The optional argument GUILE
  33765. can be a version number, which will cause 'configure' to try to use
  33766. that version of Guile; or the file name of a 'pkg-config'
  33767. executable, which will be queried to find the information needed to
  33768. compile and link against Guile.
  33769. '--without-included-regex'
  33770. Don't use the regex library included with GDB (as part of the
  33771. libiberty library). This is the default on hosts with version 2 of
  33772. the GNU C library.
  33773. '--with-sysroot=DIR'
  33774. Use DIR as the default system root directory for libraries whose
  33775. file names begin with '/lib'' or '/usr/lib''. (The value of DIR
  33776. can be modified at run time by using the 'set sysroot' command.)
  33777. If DIR is under the GDB configured prefix (set with '--prefix' or
  33778. '--exec-prefix options', the default system root will be
  33779. automatically adjusted if and when GDB is moved to a different
  33780. location.
  33781. '--with-system-gdbinit=FILE'
  33782. Configure GDB to automatically load a system-wide init file. FILE
  33783. should be an absolute file name. If FILE is in a directory under
  33784. the configured prefix, and GDB is moved to another location after
  33785. being built, the location of the system-wide init file will be
  33786. adjusted accordingly.
  33787. '--with-system-gdbinit-dir=DIRECTORY'
  33788. Configure GDB to automatically load init files from a system-wide
  33789. directory. DIRECTORY should be an absolute directory name. If
  33790. DIRECTORY is in a directory under the configured prefix, and GDB is
  33791. moved to another location after being built, the location of the
  33792. system-wide init directory will be adjusted accordingly.
  33793. '--enable-build-warnings'
  33794. When building the GDB sources, ask the compiler to warn about any
  33795. code which looks even vaguely suspicious. It passes many different
  33796. warning flags, depending on the exact version of the compiler you
  33797. are using.
  33798. '--enable-werror'
  33799. Treat compiler warnings as werrors. It adds the '-Werror' flag to
  33800. the compiler, which will fail the compilation if the compiler
  33801. outputs any warning messages.
  33802. '--enable-ubsan'
  33803. Enable the GCC undefined behavior sanitizer. This is disabled by
  33804. default, but passing '--enable-ubsan=yes' or '--enable-ubsan=auto'
  33805. to 'configure' will enable it. The undefined behavior sanitizer
  33806. checks for C++ undefined behavior. It has a performance cost, so
  33807. if you are looking at GDB's performance, you should disable it.
  33808. The undefined behavior sanitizer was first introduced in GCC 4.9.
  33809. 
  33810. File: gdb.info, Node: System-wide configuration, Prev: Configure Options, Up: Installing GDB
  33811. C.6 System-wide configuration and settings
  33812. ==========================================
  33813. GDB can be configured to have a system-wide init file and a system-wide
  33814. init file directory; this file and files in that directory (if they have
  33815. a recognized file extension) will be read and executed at startup (*note
  33816. What GDB does during startup: Startup.).
  33817. Here are the corresponding configure options:
  33818. '--with-system-gdbinit=FILE'
  33819. Specify that the default location of the system-wide init file is
  33820. FILE.
  33821. '--with-system-gdbinit-dir=DIRECTORY'
  33822. Specify that the default location of the system-wide init file
  33823. directory is DIRECTORY.
  33824. If GDB has been configured with the option '--prefix=$prefix', they
  33825. may be subject to relocation. Two possible cases:
  33826. * If the default location of this init file/directory contains
  33827. '$prefix', it will be subject to relocation. Suppose that the
  33828. configure options are '--prefix=$prefix
  33829. --with-system-gdbinit=$prefix/etc/gdbinit'; if GDB is moved from
  33830. '$prefix' to '$install', the system init file is looked for as
  33831. '$install/etc/gdbinit' instead of '$prefix/etc/gdbinit'.
  33832. * By contrast, if the default location does not contain the prefix,
  33833. it will not be relocated. E.g. if GDB has been configured with
  33834. '--prefix=/usr/local --with-system-gdbinit=/usr/share/gdb/gdbinit',
  33835. then GDB will always look for '/usr/share/gdb/gdbinit', wherever
  33836. GDB is installed.
  33837. If the configured location of the system-wide init file (as given by
  33838. the '--with-system-gdbinit' option at configure time) is in the
  33839. data-directory (as specified by '--with-gdb-datadir' at configure time)
  33840. or in one of its subdirectories, then GDB will look for the system-wide
  33841. init file in the directory specified by the '--data-directory'
  33842. command-line option. Note that the system-wide init file is only read
  33843. once, during GDB initialization. If the data-directory is changed after
  33844. GDB has started with the 'set data-directory' command, the file will not
  33845. be reread.
  33846. This applies similarly to the system-wide directory specified in
  33847. '--with-system-gdbinit-dir'.
  33848. Any supported scripting language can be used for these init files, as
  33849. long as the file extension matches the scripting language. To be
  33850. interpreted as regular GDB commands, the files needs to have a '.gdb'
  33851. extension.
  33852. * Menu:
  33853. * System-wide Configuration Scripts:: Installed System-wide Configuration Scripts
  33854. 
  33855. File: gdb.info, Node: System-wide Configuration Scripts, Up: System-wide configuration
  33856. C.6.1 Installed System-wide Configuration Scripts
  33857. -------------------------------------------------
  33858. The 'system-gdbinit' directory, located inside the data-directory (as
  33859. specified by '--with-gdb-datadir' at configure time) contains a number
  33860. of scripts which can be used as system-wide init files. To
  33861. automatically source those scripts at startup, GDB should be configured
  33862. with '--with-system-gdbinit'. Otherwise, any user should be able to
  33863. source them by hand as needed.
  33864. The following scripts are currently available:
  33865. * 'elinos.py' This script is useful when debugging a program on an
  33866. ELinOS target. It takes advantage of the environment variables
  33867. defined in a standard ELinOS environment in order to determine the
  33868. location of the system shared libraries, and then sets the
  33869. 'solib-absolute-prefix' and 'solib-search-path' variables
  33870. appropriately.
  33871. * 'wrs-linux.py' This script is useful when debugging a program on a
  33872. target running Wind River Linux. It expects the 'ENV_PREFIX' to be
  33873. set to the host-side sysroot used by the target system.
  33874. 
  33875. File: gdb.info, Node: Maintenance Commands, Next: Remote Protocol, Prev: Installing GDB, Up: Top
  33876. Appendix D Maintenance Commands
  33877. *******************************
  33878. In addition to commands intended for GDB users, GDB includes a number of
  33879. commands intended for GDB developers, that are not documented elsewhere
  33880. in this manual. These commands are provided here for reference. (For
  33881. commands that turn on debugging messages, see *note Debugging Output::.)
  33882. 'maint agent [-at LOCATION,] EXPRESSION'
  33883. 'maint agent-eval [-at LOCATION,] EXPRESSION'
  33884. Translate the given EXPRESSION into remote agent bytecodes. This
  33885. command is useful for debugging the Agent Expression mechanism
  33886. (*note Agent Expressions::). The 'agent' version produces an
  33887. expression useful for data collection, such as by tracepoints,
  33888. while 'maint agent-eval' produces an expression that evaluates
  33889. directly to a result. For instance, a collection expression for
  33890. 'globa + globb' will include bytecodes to record four bytes of
  33891. memory at each of the addresses of 'globa' and 'globb', while
  33892. discarding the result of the addition, while an evaluation
  33893. expression will do the addition and return the sum. If '-at' is
  33894. given, generate remote agent bytecode for LOCATION. If not,
  33895. generate remote agent bytecode for current frame PC address.
  33896. 'maint agent-printf FORMAT,EXPR,...'
  33897. Translate the given format string and list of argument expressions
  33898. into remote agent bytecodes and display them as a disassembled
  33899. list. This command is useful for debugging the agent version of
  33900. dynamic printf (*note Dynamic Printf::).
  33901. 'maint info breakpoints'
  33902. Using the same format as 'info breakpoints', display both the
  33903. breakpoints you've set explicitly, and those GDB is using for
  33904. internal purposes. Internal breakpoints are shown with negative
  33905. breakpoint numbers. The type column identifies what kind of
  33906. breakpoint is shown:
  33907. 'breakpoint'
  33908. Normal, explicitly set breakpoint.
  33909. 'watchpoint'
  33910. Normal, explicitly set watchpoint.
  33911. 'longjmp'
  33912. Internal breakpoint, used to handle correctly stepping through
  33913. 'longjmp' calls.
  33914. 'longjmp resume'
  33915. Internal breakpoint at the target of a 'longjmp'.
  33916. 'until'
  33917. Temporary internal breakpoint used by the GDB 'until' command.
  33918. 'finish'
  33919. Temporary internal breakpoint used by the GDB 'finish'
  33920. command.
  33921. 'shlib events'
  33922. Shared library events.
  33923. 'maint info btrace'
  33924. Pint information about raw branch tracing data.
  33925. 'maint btrace packet-history'
  33926. Print the raw branch trace packets that are used to compute the
  33927. execution history for the 'record btrace' command. Both the
  33928. information and the format in which it is printed depend on the
  33929. btrace recording format.
  33930. 'bts'
  33931. For the BTS recording format, print a list of blocks of
  33932. sequential code. For each block, the following information is
  33933. printed:
  33934. Block number
  33935. Newer blocks have higher numbers. The oldest block has
  33936. number zero.
  33937. Lowest 'PC'
  33938. Highest 'PC'
  33939. 'pt'
  33940. For the Intel Processor Trace recording format, print a list
  33941. of Intel Processor Trace packets. For each packet, the
  33942. following information is printed:
  33943. Packet number
  33944. Newer packets have higher numbers. The oldest packet has
  33945. number zero.
  33946. Trace offset
  33947. The packet's offset in the trace stream.
  33948. Packet opcode and payload
  33949. 'maint btrace clear-packet-history'
  33950. Discards the cached packet history printed by the 'maint btrace
  33951. packet-history' command. The history will be computed again when
  33952. needed.
  33953. 'maint btrace clear'
  33954. Discard the branch trace data. The data will be fetched anew and
  33955. the branch trace will be recomputed when needed.
  33956. This implicitly truncates the branch trace to a single branch trace
  33957. buffer. When updating branch trace incrementally, the branch trace
  33958. available to GDB may be bigger than a single branch trace buffer.
  33959. 'maint set btrace pt skip-pad'
  33960. 'maint show btrace pt skip-pad'
  33961. Control whether GDB will skip PAD packets when computing the packet
  33962. history.
  33963. 'set displaced-stepping'
  33964. 'show displaced-stepping'
  33965. Control whether or not GDB will do "displaced stepping" if the
  33966. target supports it. Displaced stepping is a way to single-step
  33967. over breakpoints without removing them from the inferior, by
  33968. executing an out-of-line copy of the instruction that was
  33969. originally at the breakpoint location. It is also known as
  33970. out-of-line single-stepping.
  33971. 'set displaced-stepping on'
  33972. If the target architecture supports it, GDB will use displaced
  33973. stepping to step over breakpoints.
  33974. 'set displaced-stepping off'
  33975. GDB will not use displaced stepping to step over breakpoints,
  33976. even if such is supported by the target architecture.
  33977. 'set displaced-stepping auto'
  33978. This is the default mode. GDB will use displaced stepping
  33979. only if non-stop mode is active (*note Non-Stop Mode::) and
  33980. the target architecture supports displaced stepping.
  33981. 'maint check-psymtabs'
  33982. Check the consistency of currently expanded psymtabs versus
  33983. symtabs. Use this to check, for example, whether a symbol is in
  33984. one but not the other.
  33985. 'maint check-symtabs'
  33986. Check the consistency of currently expanded symtabs.
  33987. 'maint expand-symtabs [REGEXP]'
  33988. Expand symbol tables. If REGEXP is specified, only expand symbol
  33989. tables for file names matching REGEXP.
  33990. 'maint set catch-demangler-crashes [on|off]'
  33991. 'maint show catch-demangler-crashes'
  33992. Control whether GDB should attempt to catch crashes in the symbol
  33993. name demangler. The default is to attempt to catch crashes. If
  33994. enabled, the first time a crash is caught, a core file is created,
  33995. the offending symbol is displayed and the user is presented with
  33996. the option to terminate the current session.
  33997. 'maint cplus first_component NAME'
  33998. Print the first C++ class/namespace component of NAME.
  33999. 'maint cplus namespace'
  34000. Print the list of possible C++ namespaces.
  34001. 'maint deprecate COMMAND [REPLACEMENT]'
  34002. 'maint undeprecate COMMAND'
  34003. Deprecate or undeprecate the named COMMAND. Deprecated commands
  34004. cause GDB to issue a warning when you use them. The optional
  34005. argument REPLACEMENT says which newer command should be used in
  34006. favor of the deprecated one; if it is given, GDB will mention the
  34007. replacement as part of the warning.
  34008. 'maint dump-me'
  34009. Cause a fatal signal in the debugger and force it to dump its core.
  34010. This is supported only on systems which support aborting a program
  34011. with the 'SIGQUIT' signal.
  34012. 'maint internal-error [MESSAGE-TEXT]'
  34013. 'maint internal-warning [MESSAGE-TEXT]'
  34014. 'maint demangler-warning [MESSAGE-TEXT]'
  34015. Cause GDB to call the internal function 'internal_error',
  34016. 'internal_warning' or 'demangler_warning' and hence behave as
  34017. though an internal problem has been detected. In addition to
  34018. reporting the internal problem, these functions give the user the
  34019. opportunity to either quit GDB or (for 'internal_error' and
  34020. 'internal_warning') create a core file of the current GDB session.
  34021. These commands take an optional parameter MESSAGE-TEXT that is used
  34022. as the text of the error or warning message.
  34023. Here's an example of using 'internal-error':
  34024. (gdb) maint internal-error testing, 1, 2
  34025. .../maint.c:121: internal-error: testing, 1, 2
  34026. A problem internal to GDB has been detected. Further
  34027. debugging may prove unreliable.
  34028. Quit this debugging session? (y or n) n
  34029. Create a core file? (y or n) n
  34030. (gdb)
  34031. 'maint set internal-error ACTION [ask|yes|no]'
  34032. 'maint show internal-error ACTION'
  34033. 'maint set internal-warning ACTION [ask|yes|no]'
  34034. 'maint show internal-warning ACTION'
  34035. 'maint set demangler-warning ACTION [ask|yes|no]'
  34036. 'maint show demangler-warning ACTION'
  34037. When GDB reports an internal problem (error or warning) it gives
  34038. the user the opportunity to both quit GDB and create a core file of
  34039. the current GDB session. These commands let you override the
  34040. default behaviour for each particular ACTION, described in the
  34041. table below.
  34042. 'quit'
  34043. You can specify that GDB should always (yes) or never (no)
  34044. quit. The default is to ask the user what to do.
  34045. 'corefile'
  34046. You can specify that GDB should always (yes) or never (no)
  34047. create a core file. The default is to ask the user what to
  34048. do. Note that there is no 'corefile' option for
  34049. 'demangler-warning': demangler warnings always create a core
  34050. file and this cannot be disabled.
  34051. 'maint packet TEXT'
  34052. If GDB is talking to an inferior via the serial protocol, then this
  34053. command sends the string TEXT to the inferior, and displays the
  34054. response packet. GDB supplies the initial '$' character, the
  34055. terminating '#' character, and the checksum.
  34056. 'maint print architecture [FILE]'
  34057. Print the entire architecture configuration. The optional argument
  34058. FILE names the file where the output goes.
  34059. 'maint print c-tdesc'
  34060. Print the target description (*note Target Descriptions::) as a C
  34061. source file. By default, the target description is for the current
  34062. target, but if the optional argument FILE is provided, that file is
  34063. used to produce the description. The FILE should be an XML
  34064. document, of the form described in *note Target Description
  34065. Format::. The created source file is built into GDB when GDB is
  34066. built again. This command is used by developers after they add or
  34067. modify XML target descriptions.
  34068. 'maint print xml-tdesc [FILE]'
  34069. Print the target description (*note Target Descriptions::) as an
  34070. XML file. By default print the target description for the current
  34071. target, but if the optional argument FILE is provided, then that
  34072. file is read in by GDB and then used to produce the description.
  34073. The FILE should be an XML document, of the form described in *note
  34074. Target Description Format::.
  34075. 'maint check xml-descriptions DIR'
  34076. Check that the target descriptions dynamically created by GDB equal
  34077. the descriptions created from XML files found in DIR.
  34078. 'maint check libthread-db'
  34079. Run integrity checks on the current inferior's thread debugging
  34080. library. This exercises all 'libthread_db' functionality used by
  34081. GDB on GNU/Linux systems, and by extension also exercises the
  34082. 'proc_service' functions provided by GDB that 'libthread_db' uses.
  34083. Note that parts of the test may be skipped on some platforms when
  34084. debugging core files.
  34085. 'maint print core-file-backed-mappings'
  34086. Print the file-backed mappings which were loaded from a core file
  34087. note. This output represents state internal to GDB and should be
  34088. similar to the mappings displayed by the 'info proc mappings'
  34089. command.
  34090. 'maint print dummy-frames'
  34091. Prints the contents of GDB's internal dummy-frame stack.
  34092. (gdb) b add
  34093. ...
  34094. (gdb) print add(2,3)
  34095. Breakpoint 2, add (a=2, b=3) at ...
  34096. 58 return (a + b);
  34097. The program being debugged stopped while in a function called from GDB.
  34098. ...
  34099. (gdb) maint print dummy-frames
  34100. 0xa8206d8: id={stack=0xbfffe734,code=0xbfffe73f,!special}, ptid=process 9353
  34101. (gdb)
  34102. Takes an optional file parameter.
  34103. 'maint print registers [FILE]'
  34104. 'maint print raw-registers [FILE]'
  34105. 'maint print cooked-registers [FILE]'
  34106. 'maint print register-groups [FILE]'
  34107. 'maint print remote-registers [FILE]'
  34108. Print GDB's internal register data structures.
  34109. The command 'maint print raw-registers' includes the contents of
  34110. the raw register cache; the command 'maint print cooked-registers'
  34111. includes the (cooked) value of all registers, including registers
  34112. which aren't available on the target nor visible to user; the
  34113. command 'maint print register-groups' includes the groups that each
  34114. register is a member of; and the command 'maint print
  34115. remote-registers' includes the remote target's register numbers and
  34116. offsets in the 'G' packets.
  34117. These commands take an optional parameter, a file name to which to
  34118. write the information.
  34119. 'maint print reggroups [FILE]'
  34120. Print GDB's internal register group data structures. The optional
  34121. argument FILE tells to what file to write the information.
  34122. The register groups info looks like this:
  34123. (gdb) maint print reggroups
  34124. Group Type
  34125. general user
  34126. float user
  34127. all user
  34128. vector user
  34129. system user
  34130. save internal
  34131. restore internal
  34132. 'flushregs'
  34133. This command forces GDB to flush its internal register cache.
  34134. 'maint print objfiles [REGEXP]'
  34135. Print a dump of all known object files. If REGEXP is specified,
  34136. only print object files whose names match REGEXP. For each object
  34137. file, this command prints its name, address in memory, and all of
  34138. its psymtabs and symtabs.
  34139. 'maint print user-registers'
  34140. List all currently available "user registers". User registers
  34141. typically provide alternate names for actual hardware registers.
  34142. They include the four "standard" registers '$fp', '$pc', '$sp', and
  34143. '$ps'. *Note standard registers::. User registers can be used in
  34144. expressions in the same way as the canonical register names, but
  34145. only the latter are listed by the 'info registers' and 'maint print
  34146. registers' commands.
  34147. 'maint print section-scripts [REGEXP]'
  34148. Print a dump of scripts specified in the '.debug_gdb_section'
  34149. section. If REGEXP is specified, only print scripts loaded by
  34150. object files matching REGEXP. For each script, this command prints
  34151. its name as specified in the objfile, and the full path if known.
  34152. *Note dotdebug_gdb_scripts section::.
  34153. 'maint print statistics'
  34154. This command prints, for each object file in the program, various
  34155. data about that object file followed by the byte cache ("bcache")
  34156. statistics for the object file. The objfile data includes the
  34157. number of minimal, partial, full, and stabs symbols, the number of
  34158. types defined by the objfile, the number of as yet unexpanded psym
  34159. tables, the number of line tables and string tables, and the amount
  34160. of memory used by the various tables. The bcache statistics
  34161. include the counts, sizes, and counts of duplicates of all and
  34162. unique objects, max, average, and median entry size, total memory
  34163. used and its overhead and savings, and various measures of the hash
  34164. table size and chain lengths.
  34165. 'maint print target-stack'
  34166. A "target" is an interface between the debugger and a particular
  34167. kind of file or process. Targets can be stacked in "strata", so
  34168. that more than one target can potentially respond to a request. In
  34169. particular, memory accesses will walk down the stack of targets
  34170. until they find a target that is interested in handling that
  34171. particular address.
  34172. This command prints a short description of each layer that was
  34173. pushed on the "target stack", starting from the top layer down to
  34174. the bottom one.
  34175. 'maint print type EXPR'
  34176. Print the type chain for a type specified by EXPR. The argument
  34177. can be either a type name or a symbol. If it is a symbol, the type
  34178. of that symbol is described. The type chain produced by this
  34179. command is a recursive definition of the data type as stored in
  34180. GDB's data structures, including its flags and contained types.
  34181. 'maint selftest [FILTER]'
  34182. Run any self tests that were compiled in to GDB. This will print a
  34183. message showing how many tests were run, and how many failed. If a
  34184. FILTER is passed, only the tests with FILTER in their name will by
  34185. ran.
  34186. 'maint info selftests'
  34187. List the selftests compiled in to GDB.
  34188. 'maint set dwarf always-disassemble'
  34189. 'maint show dwarf always-disassemble'
  34190. Control the behavior of 'info address' when using DWARF debugging
  34191. information.
  34192. The default is 'off', which means that GDB should try to describe a
  34193. variable's location in an easily readable format. When 'on', GDB
  34194. will instead display the DWARF location expression in an
  34195. assembly-like format. Note that some locations are too complex for
  34196. GDB to describe simply; in this case you will always see the
  34197. disassembly form.
  34198. Here is an example of the resulting disassembly:
  34199. (gdb) info addr argc
  34200. Symbol "argc" is a complex DWARF expression:
  34201. 1: DW_OP_fbreg 0
  34202. For more information on these expressions, see the DWARF standard
  34203. (http://www.dwarfstd.org/).
  34204. 'maint set dwarf max-cache-age'
  34205. 'maint show dwarf max-cache-age'
  34206. Control the DWARF compilation unit cache.
  34207. In object files with inter-compilation-unit references, such as
  34208. those produced by the GCC option '-feliminate-dwarf2-dups', the
  34209. DWARF reader needs to frequently refer to previously read
  34210. compilation units. This setting controls how long a compilation
  34211. unit will remain in the cache if it is not referenced. A higher
  34212. limit means that cached compilation units will be stored in memory
  34213. longer, and more total memory will be used. Setting it to zero
  34214. disables caching, which will slow down GDB startup, but reduce
  34215. memory consumption.
  34216. 'maint set dwarf unwinders'
  34217. 'maint show dwarf unwinders'
  34218. Control use of the DWARF frame unwinders.
  34219. Many targets that support DWARF debugging use GDB's DWARF frame
  34220. unwinders to build the backtrace. Many of these targets will also
  34221. have a second mechanism for building the backtrace for use in cases
  34222. where DWARF information is not available, this second mechanism is
  34223. often an analysis of a function's prologue.
  34224. In order to extend testing coverage of the second level stack
  34225. unwinding mechanisms it is helpful to be able to disable the DWARF
  34226. stack unwinders, this can be done with this switch.
  34227. In normal use of GDB disabling the DWARF unwinders is not
  34228. advisable, there are cases that are better handled through DWARF
  34229. than prologue analysis, and the debug experience is likely to be
  34230. better with the DWARF frame unwinders enabled.
  34231. If DWARF frame unwinders are not supported for a particular target
  34232. architecture, then enabling this flag does not cause them to be
  34233. used.
  34234. 'maint set worker-threads'
  34235. 'maint show worker-threads'
  34236. Control the number of worker threads that may be used by GDB. On
  34237. capable hosts, GDB may use multiple threads to speed up certain
  34238. CPU-intensive operations, such as demangling symbol names. While
  34239. the number of threads used by GDB may vary, this command can be
  34240. used to set an upper bound on this number. The default is
  34241. 'unlimited', which lets GDB choose a reasonable number. Note that
  34242. this only controls worker threads started by GDB itself; libraries
  34243. used by GDB may start threads of their own.
  34244. 'maint set profile'
  34245. 'maint show profile'
  34246. Control profiling of GDB.
  34247. Profiling will be disabled until you use the 'maint set profile'
  34248. command to enable it. When you enable profiling, the system will
  34249. begin collecting timing and execution count data; when you disable
  34250. profiling or exit GDB, the results will be written to a log file.
  34251. Remember that if you use profiling, GDB will overwrite the
  34252. profiling log file (often called 'gmon.out'). If you have a record
  34253. of important profiling data in a 'gmon.out' file, be sure to move
  34254. it to a safe location.
  34255. Configuring with '--enable-profiling' arranges for GDB to be
  34256. compiled with the '-pg' compiler option.
  34257. 'maint set show-debug-regs'
  34258. 'maint show show-debug-regs'
  34259. Control whether to show variables that mirror the hardware debug
  34260. registers. Use 'on' to enable, 'off' to disable. If enabled, the
  34261. debug registers values are shown when GDB inserts or removes a
  34262. hardware breakpoint or watchpoint, and when the inferior triggers a
  34263. hardware-assisted breakpoint or watchpoint.
  34264. 'maint set show-all-tib'
  34265. 'maint show show-all-tib'
  34266. Control whether to show all non zero areas within a 1k block
  34267. starting at thread local base, when using the 'info w32
  34268. thread-information-block' command.
  34269. 'maint set target-async'
  34270. 'maint show target-async'
  34271. This controls whether GDB targets operate in synchronous or
  34272. asynchronous mode (*note Background Execution::). Normally the
  34273. default is asynchronous, if it is available; but this can be
  34274. changed to more easily debug problems occurring only in synchronous
  34275. mode.
  34276. 'maint set target-non-stop'
  34277. 'maint show target-non-stop'
  34278. This controls whether GDB targets always operate in non-stop mode
  34279. even if 'set non-stop' is 'off' (*note Non-Stop Mode::). The
  34280. default is 'auto', meaning non-stop mode is enabled if supported by
  34281. the target.
  34282. 'maint set target-non-stop auto'
  34283. This is the default mode. GDB controls the target in non-stop
  34284. mode if the target supports it.
  34285. 'maint set target-non-stop on'
  34286. GDB controls the target in non-stop mode even if the target
  34287. does not indicate support.
  34288. 'maint set target-non-stop off'
  34289. GDB does not control the target in non-stop mode even if the
  34290. target supports it.
  34291. 'maint set tui-resize-message'
  34292. 'maint show tui-resize-message'
  34293. Control whether GDB displays a message each time the terminal is
  34294. resized when in TUI mode. The default is 'off', which means that
  34295. GDB is silent during resizes. When 'on', GDB will display a
  34296. message after a resize is completed; the message will include a
  34297. number indicating how many times the terminal has been resized.
  34298. This setting is intended for use by the test suite, where it would
  34299. otherwise be difficult to determine when a resize and refresh has
  34300. been completed.
  34301. 'maint set per-command'
  34302. 'maint show per-command'
  34303. GDB can display the resources used by each command. This is useful
  34304. in debugging performance problems.
  34305. 'maint set per-command space [on|off]'
  34306. 'maint show per-command space'
  34307. Enable or disable the printing of the memory used by GDB for
  34308. each command. If enabled, GDB will display how much memory
  34309. each command took, following the command's own output. This
  34310. can also be requested by invoking GDB with the '--statistics'
  34311. command-line switch (*note Mode Options::).
  34312. 'maint set per-command time [on|off]'
  34313. 'maint show per-command time'
  34314. Enable or disable the printing of the execution time of GDB
  34315. for each command. If enabled, GDB will display how much time
  34316. it took to execute each command, following the command's own
  34317. output. Both CPU time and wallclock time are printed.
  34318. Printing both is useful when trying to determine whether the
  34319. cost is CPU or, e.g., disk/network latency. Note that the CPU
  34320. time printed is for GDB only, it does not include the
  34321. execution time of the inferior because there's no mechanism
  34322. currently to compute how much time was spent by GDB and how
  34323. much time was spent by the program been debugged. This can
  34324. also be requested by invoking GDB with the '--statistics'
  34325. command-line switch (*note Mode Options::).
  34326. 'maint set per-command symtab [on|off]'
  34327. 'maint show per-command symtab'
  34328. Enable or disable the printing of basic symbol table
  34329. statistics for each command. If enabled, GDB will display the
  34330. following information:
  34331. a. number of symbol tables
  34332. b. number of primary symbol tables
  34333. c. number of blocks in the blockvector
  34334. 'maint set check-libthread-db [on|off]'
  34335. 'maint show check-libthread-db'
  34336. Control whether GDB should run integrity checks on inferior
  34337. specific thread debugging libraries as they are loaded. The
  34338. default is not to perform such checks. If any check fails GDB will
  34339. unload the library and continue searching for a suitable candidate
  34340. as described in *note set libthread-db-search-path::. For more
  34341. information about the tests, see *note maint check libthread-db::.
  34342. 'maint space VALUE'
  34343. An alias for 'maint set per-command space'. A non-zero value
  34344. enables it, zero disables it.
  34345. 'maint time VALUE'
  34346. An alias for 'maint set per-command time'. A non-zero value
  34347. enables it, zero disables it.
  34348. 'maint translate-address [SECTION] ADDR'
  34349. Find the symbol stored at the location specified by the address
  34350. ADDR and an optional section name SECTION. If found, GDB prints
  34351. the name of the closest symbol and an offset from the symbol's
  34352. location to the specified address. This is similar to the 'info
  34353. address' command (*note Symbols::), except that this command also
  34354. allows to find symbols in other sections.
  34355. If section was not specified, the section in which the symbol was
  34356. found is also printed. For dynamically linked executables, the
  34357. name of executable or shared library containing the symbol is
  34358. printed as well.
  34359. 'maint test-options require-delimiter'
  34360. 'maint test-options unknown-is-error'
  34361. 'maint test-options unknown-is-operand'
  34362. These commands are used by the testsuite to validate the command
  34363. options framework. The 'require-delimiter' variant requires a
  34364. double-dash delimiter to indicate end of options. The
  34365. 'unknown-is-error' and 'unknown-is-operand' do not. The
  34366. 'unknown-is-error' variant throws an error on unknown option, while
  34367. 'unknown-is-operand' treats unknown options as the start of the
  34368. command's operands. When run, the commands output the result of
  34369. the processed options. When completed, the commands store the
  34370. internal result of completion in a variable exposed by the 'maint
  34371. show test-options-completion-result' command.
  34372. 'maint show test-options-completion-result'
  34373. Shows the result of completing the 'maint test-options'
  34374. subcommands. This is used by the testsuite to validate completion
  34375. support in the command options framework.
  34376. 'maint set test-settings KIND'
  34377. 'maint show test-settings KIND'
  34378. These are representative commands for each KIND of setting type GDB
  34379. supports. They are used by the testsuite for exercising the
  34380. settings infrastructure.
  34381. 'maint with SETTING [VALUE] [-- COMMAND]'
  34382. Like the 'with' command, but works with 'maintenance set'
  34383. variables. This is used by the testsuite to exercise the 'with'
  34384. command's infrastructure.
  34385. The following command is useful for non-interactive invocations of
  34386. GDB, such as in the test suite.
  34387. 'set watchdog NSEC'
  34388. Set the maximum number of seconds GDB will wait for the target
  34389. operation to finish. If this time expires, GDB reports and error
  34390. and the command is aborted.
  34391. 'show watchdog'
  34392. Show the current setting of the target wait timeout.
  34393. 
  34394. File: gdb.info, Node: Remote Protocol, Next: Agent Expressions, Prev: Maintenance Commands, Up: Top
  34395. Appendix E GDB Remote Serial Protocol
  34396. *************************************
  34397. * Menu:
  34398. * Overview::
  34399. * Packets::
  34400. * Stop Reply Packets::
  34401. * General Query Packets::
  34402. * Architecture-Specific Protocol Details::
  34403. * Tracepoint Packets::
  34404. * Host I/O Packets::
  34405. * Interrupts::
  34406. * Notification Packets::
  34407. * Remote Non-Stop::
  34408. * Packet Acknowledgment::
  34409. * Examples::
  34410. * File-I/O Remote Protocol Extension::
  34411. * Library List Format::
  34412. * Library List Format for SVR4 Targets::
  34413. * Memory Map Format::
  34414. * Thread List Format::
  34415. * Traceframe Info Format::
  34416. * Branch Trace Format::
  34417. * Branch Trace Configuration Format::
  34418. 
  34419. File: gdb.info, Node: Overview, Next: Packets, Up: Remote Protocol
  34420. E.1 Overview
  34421. ============
  34422. There may be occasions when you need to know something about the
  34423. protocol--for example, if there is only one serial port to your target
  34424. machine, you might want your program to do something special if it
  34425. recognizes a packet meant for GDB.
  34426. In the examples below, '->' and '<-' are used to indicate transmitted
  34427. and received data, respectively.
  34428. All GDB commands and responses (other than acknowledgments and
  34429. notifications, see *note Notification Packets::) are sent as a PACKET.
  34430. A PACKET is introduced with the character '$', the actual PACKET-DATA,
  34431. and the terminating character '#' followed by a two-digit CHECKSUM:
  34432. $PACKET-DATA#CHECKSUM
  34433. The two-digit CHECKSUM is computed as the modulo 256 sum of all
  34434. characters between the leading '$' and the trailing '#' (an eight bit
  34435. unsigned checksum).
  34436. Implementors should note that prior to GDB 5.0 the protocol
  34437. specification also included an optional two-digit SEQUENCE-ID:
  34438. $SEQUENCE-ID:PACKET-DATA#CHECKSUM
  34439. That SEQUENCE-ID was appended to the acknowledgment. GDB has never
  34440. output SEQUENCE-IDs. Stubs that handle packets added since GDB 5.0 must
  34441. not accept SEQUENCE-ID.
  34442. When either the host or the target machine receives a packet, the
  34443. first response expected is an acknowledgment: either '+' (to indicate
  34444. the package was received correctly) or '-' (to request retransmission):
  34445. -> $PACKET-DATA#CHECKSUM
  34446. <- +
  34447. The '+'/'-' acknowledgments can be disabled once a connection is
  34448. established. *Note Packet Acknowledgment::, for details.
  34449. The host (GDB) sends COMMANDs, and the target (the debugging stub
  34450. incorporated in your program) sends a RESPONSE. In the case of step and
  34451. continue COMMANDs, the response is only sent when the operation has
  34452. completed, and the target has again stopped all threads in all attached
  34453. processes. This is the default all-stop mode behavior, but the remote
  34454. protocol also supports GDB's non-stop execution mode; see *note Remote
  34455. Non-Stop::, for details.
  34456. PACKET-DATA consists of a sequence of characters with the exception
  34457. of '#' and '$' (see 'X' packet for additional exceptions).
  34458. Fields within the packet should be separated using ',' ';' or ':'.
  34459. Except where otherwise noted all numbers are represented in HEX with
  34460. leading zeros suppressed.
  34461. Implementors should note that prior to GDB 5.0, the character ':'
  34462. could not appear as the third character in a packet (as it would
  34463. potentially conflict with the SEQUENCE-ID).
  34464. Binary data in most packets is encoded either as two hexadecimal
  34465. digits per byte of binary data. This allowed the traditional remote
  34466. protocol to work over connections which were only seven-bit clean. Some
  34467. packets designed more recently assume an eight-bit clean connection, and
  34468. use a more efficient encoding to send and receive binary data.
  34469. The binary data representation uses '7d' (ASCII '}') as an escape
  34470. character. Any escaped byte is transmitted as the escape character
  34471. followed by the original character XORed with '0x20'. For example, the
  34472. byte '0x7d' would be transmitted as the two bytes '0x7d 0x5d'. The
  34473. bytes '0x23' (ASCII '#'), '0x24' (ASCII '$'), and '0x7d' (ASCII '}')
  34474. must always be escaped. Responses sent by the stub must also escape
  34475. '0x2a' (ASCII '*'), so that it is not interpreted as the start of a
  34476. run-length encoded sequence (described next).
  34477. Response DATA can be run-length encoded to save space. Run-length
  34478. encoding replaces runs of identical characters with one instance of the
  34479. repeated character, followed by a '*' and a repeat count. The repeat
  34480. count is itself sent encoded, to avoid binary characters in DATA: a
  34481. value of N is sent as 'N+29'. For a repeat count greater or equal to 3,
  34482. this produces a printable ASCII character, e.g. a space (ASCII code 32)
  34483. for a repeat count of 3. (This is because run-length encoding starts to
  34484. win for counts 3 or more.) Thus, for example, '0* ' is a run-length
  34485. encoding of "0000": the space character after '*' means repeat the
  34486. leading '0' '32 - 29 = 3' more times.
  34487. The printable characters '#' and '$' or with a numeric value greater
  34488. than 126 must not be used. Runs of six repeats ('#') or seven repeats
  34489. ('$') can be expanded using a repeat count of only five ('"'). For
  34490. example, '00000000' can be encoded as '0*"00'.
  34491. The error response returned for some packets includes a two character
  34492. error number. That number is not well defined.
  34493. For any COMMAND not supported by the stub, an empty response ('$#00')
  34494. should be returned. That way it is possible to extend the protocol. A
  34495. newer GDB can tell if a packet is supported based on that response.
  34496. At a minimum, a stub is required to support the '?' command to tell
  34497. GDB the reason for halting, 'g' and 'G' commands for register access,
  34498. and the 'm' and 'M' commands for memory access. Stubs that only control
  34499. single-threaded targets can implement run control with the 'c'
  34500. (continue) command, and if the target architecture supports
  34501. hardware-assisted single-stepping, the 's' (step) command. Stubs that
  34502. support multi-threading targets should support the 'vCont' command. All
  34503. other commands are optional.
  34504. 
  34505. File: gdb.info, Node: Packets, Next: Stop Reply Packets, Prev: Overview, Up: Remote Protocol
  34506. E.2 Packets
  34507. ===========
  34508. The following table provides a complete list of all currently defined
  34509. COMMANDs and their corresponding response DATA. *Note File-I/O Remote
  34510. Protocol Extension::, for details about the File I/O extension of the
  34511. remote protocol.
  34512. Each packet's description has a template showing the packet's overall
  34513. syntax, followed by an explanation of the packet's meaning. We include
  34514. spaces in some of the templates for clarity; these are not part of the
  34515. packet's syntax. No GDB packet uses spaces to separate its components.
  34516. For example, a template like 'foo BAR BAZ' describes a packet beginning
  34517. with the three ASCII bytes 'foo', followed by a BAR, followed directly
  34518. by a BAZ. GDB does not transmit a space character between the 'foo' and
  34519. the BAR, or between the BAR and the BAZ.
  34520. Several packets and replies include a THREAD-ID field to identify a
  34521. thread. Normally these are positive numbers with a target-specific
  34522. interpretation, formatted as big-endian hex strings. A THREAD-ID can
  34523. also be a literal '-1' to indicate all threads, or '0' to pick any
  34524. thread.
  34525. In addition, the remote protocol supports a multiprocess feature in
  34526. which the THREAD-ID syntax is extended to optionally include both
  34527. process and thread ID fields, as 'pPID.TID'. The PID (process) and TID
  34528. (thread) components each have the format described above: a positive
  34529. number with target-specific interpretation formatted as a big-endian hex
  34530. string, literal '-1' to indicate all processes or threads
  34531. (respectively), or '0' to indicate an arbitrary process or thread.
  34532. Specifying just a process, as 'pPID', is equivalent to 'pPID.-1'. It is
  34533. an error to specify all processes but a specific thread, such as
  34534. 'p-1.TID'. Note that the 'p' prefix is _not_ used for those packets and
  34535. replies explicitly documented to include a process ID, rather than a
  34536. THREAD-ID.
  34537. The multiprocess THREAD-ID syntax extensions are only used if both
  34538. GDB and the stub report support for the 'multiprocess' feature using
  34539. 'qSupported'. *Note multiprocess extensions::, for more information.
  34540. Note that all packet forms beginning with an upper- or lower-case
  34541. letter, other than those described here, are reserved for future use.
  34542. Here are the packet descriptions.
  34543. '!'
  34544. Enable extended mode. In extended mode, the remote server is made
  34545. persistent. The 'R' packet is used to restart the program being
  34546. debugged.
  34547. Reply:
  34548. 'OK'
  34549. The remote target both supports and has enabled extended mode.
  34550. '?'
  34551. Indicate the reason the target halted. The reply is the same as
  34552. for step and continue. This packet has a special interpretation
  34553. when the target is in non-stop mode; see *note Remote Non-Stop::.
  34554. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34555. 'A ARGLEN,ARGNUM,ARG,...'
  34556. Initialized 'argv[]' array passed into program. ARGLEN specifies
  34557. the number of bytes in the hex encoded byte stream ARG. See
  34558. 'gdbserver' for more details.
  34559. Reply:
  34560. 'OK'
  34561. The arguments were set.
  34562. 'E NN'
  34563. An error occurred.
  34564. 'b BAUD'
  34565. (Don't use this packet; its behavior is not well-defined.) Change
  34566. the serial line speed to BAUD.
  34567. JTC: _When does the transport layer state change? When it's
  34568. received, or after the ACK is transmitted. In either case, there
  34569. are problems if the command or the acknowledgment packet is
  34570. dropped._
  34571. Stan: _If people really wanted to add something like this, and get
  34572. it working for the first time, they ought to modify ser-unix.c to
  34573. send some kind of out-of-band message to a specially-setup stub and
  34574. have the switch happen "in between" packets, so that from remote
  34575. protocol's point of view, nothing actually happened._
  34576. 'B ADDR,MODE'
  34577. Set (MODE is 'S') or clear (MODE is 'C') a breakpoint at ADDR.
  34578. Don't use this packet. Use the 'Z' and 'z' packets instead (*note
  34579. insert breakpoint or watchpoint packet::).
  34580. 'bc'
  34581. Backward continue. Execute the target system in reverse. No
  34582. parameter. *Note Reverse Execution::, for more information.
  34583. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34584. 'bs'
  34585. Backward single step. Execute one instruction in reverse. No
  34586. parameter. *Note Reverse Execution::, for more information.
  34587. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34588. 'c [ADDR]'
  34589. Continue at ADDR, which is the address to resume. If ADDR is
  34590. omitted, resume at current address.
  34591. This packet is deprecated for multi-threading support. *Note vCont
  34592. packet::.
  34593. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34594. 'C SIG[;ADDR]'
  34595. Continue with signal SIG (hex signal number). If ';ADDR' is
  34596. omitted, resume at same address.
  34597. This packet is deprecated for multi-threading support. *Note vCont
  34598. packet::.
  34599. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34600. 'd'
  34601. Toggle debug flag.
  34602. Don't use this packet; instead, define a general set packet (*note
  34603. General Query Packets::).
  34604. 'D'
  34605. 'D;PID'
  34606. The first form of the packet is used to detach GDB from the remote
  34607. system. It is sent to the remote target before GDB disconnects via
  34608. the 'detach' command.
  34609. The second form, including a process ID, is used when multiprocess
  34610. protocol extensions are enabled (*note multiprocess extensions::),
  34611. to detach only a specific process. The PID is specified as a
  34612. big-endian hex string.
  34613. Reply:
  34614. 'OK'
  34615. for success
  34616. 'E NN'
  34617. for an error
  34618. 'F RC,EE,CF;XX'
  34619. A reply from GDB to an 'F' packet sent by the target. This is part
  34620. of the File-I/O protocol extension. *Note File-I/O Remote Protocol
  34621. Extension::, for the specification.
  34622. 'g'
  34623. Read general registers.
  34624. Reply:
  34625. 'XX...'
  34626. Each byte of register data is described by two hex digits.
  34627. The bytes with the register are transmitted in target byte
  34628. order. The size of each register and their position within
  34629. the 'g' packet are determined by the GDB internal gdbarch
  34630. functions 'DEPRECATED_REGISTER_RAW_SIZE' and
  34631. 'gdbarch_register_name'.
  34632. When reading registers from a trace frame (*note Using the
  34633. Collected Data: Analyze Collected Data.), the stub may also
  34634. return a string of literal 'x''s in place of the register data
  34635. digits, to indicate that the corresponding register has not
  34636. been collected, thus its value is unavailable. For example,
  34637. for an architecture with 4 registers of 4 bytes each, the
  34638. following reply indicates to GDB that registers 0 and 2 have
  34639. not been collected, while registers 1 and 3 have been
  34640. collected, and both have zero value:
  34641. -> g
  34642. <- xxxxxxxx00000000xxxxxxxx00000000
  34643. 'E NN'
  34644. for an error.
  34645. 'G XX...'
  34646. Write general registers. *Note read registers packet::, for a
  34647. description of the XX... data.
  34648. Reply:
  34649. 'OK'
  34650. for success
  34651. 'E NN'
  34652. for an error
  34653. 'H OP THREAD-ID'
  34654. Set thread for subsequent operations ('m', 'M', 'g', 'G', et.al.).
  34655. Depending on the operation to be performed, OP should be 'c' for
  34656. step and continue operations (note that this is deprecated,
  34657. supporting the 'vCont' command is a better option), and 'g' for
  34658. other operations. The thread designator THREAD-ID has the format
  34659. and interpretation described in *note thread-id syntax::.
  34660. Reply:
  34661. 'OK'
  34662. for success
  34663. 'E NN'
  34664. for an error
  34665. 'i [ADDR[,NNN]]'
  34666. Step the remote target by a single clock cycle. If ',NNN' is
  34667. present, cycle step NNN cycles. If ADDR is present, cycle step
  34668. starting at that address.
  34669. 'I'
  34670. Signal, then cycle step. *Note step with signal packet::. *Note
  34671. cycle step packet::.
  34672. 'k'
  34673. Kill request.
  34674. The exact effect of this packet is not specified.
  34675. For a bare-metal target, it may power cycle or reset the target
  34676. system. For that reason, the 'k' packet has no reply.
  34677. For a single-process target, it may kill that process if possible.
  34678. A multiple-process target may choose to kill just one process, or
  34679. all that are under GDB's control. For more precise control, use
  34680. the vKill packet (*note vKill packet::).
  34681. If the target system immediately closes the connection in response
  34682. to 'k', GDB does not consider the lack of packet acknowledgment to
  34683. be an error, and assumes the kill was successful.
  34684. If connected using 'target extended-remote', and the target does
  34685. not close the connection in response to a kill request, GDB probes
  34686. the target state as if a new connection was opened (*note ?
  34687. packet::).
  34688. 'm ADDR,LENGTH'
  34689. Read LENGTH addressable memory units starting at address ADDR
  34690. (*note addressable memory unit::). Note that ADDR may not be
  34691. aligned to any particular boundary.
  34692. The stub need not use any particular size or alignment when
  34693. gathering data from memory for the response; even if ADDR is
  34694. word-aligned and LENGTH is a multiple of the word size, the stub is
  34695. free to use byte accesses, or not. For this reason, this packet
  34696. may not be suitable for accessing memory-mapped I/O devices.
  34697. Reply:
  34698. 'XX...'
  34699. Memory contents; each byte is transmitted as a two-digit
  34700. hexadecimal number. The reply may contain fewer addressable
  34701. memory units than requested if the server was able to read
  34702. only part of the region of memory.
  34703. 'E NN'
  34704. NN is errno
  34705. 'M ADDR,LENGTH:XX...'
  34706. Write LENGTH addressable memory units starting at address ADDR
  34707. (*note addressable memory unit::). The data is given by XX...;
  34708. each byte is transmitted as a two-digit hexadecimal number.
  34709. Reply:
  34710. 'OK'
  34711. for success
  34712. 'E NN'
  34713. for an error (this includes the case where only part of the
  34714. data was written).
  34715. 'p N'
  34716. Read the value of register N; N is in hex. *Note read registers
  34717. packet::, for a description of how the returned register value is
  34718. encoded.
  34719. Reply:
  34720. 'XX...'
  34721. the register's value
  34722. 'E NN'
  34723. for an error
  34724. ''
  34725. Indicating an unrecognized QUERY.
  34726. 'P N...=R...'
  34727. Write register N... with value R.... The register number N is in
  34728. hexadecimal, and R... contains two hex digits for each byte in the
  34729. register (target byte order).
  34730. Reply:
  34731. 'OK'
  34732. for success
  34733. 'E NN'
  34734. for an error
  34735. 'q NAME PARAMS...'
  34736. 'Q NAME PARAMS...'
  34737. General query ('q') and set ('Q'). These packets are described
  34738. fully in *note General Query Packets::.
  34739. 'r'
  34740. Reset the entire system.
  34741. Don't use this packet; use the 'R' packet instead.
  34742. 'R XX'
  34743. Restart the program being debugged. The XX, while needed, is
  34744. ignored. This packet is only available in extended mode (*note
  34745. extended mode::).
  34746. The 'R' packet has no reply.
  34747. 's [ADDR]'
  34748. Single step, resuming at ADDR. If ADDR is omitted, resume at same
  34749. address.
  34750. This packet is deprecated for multi-threading support. *Note vCont
  34751. packet::.
  34752. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34753. 'S SIG[;ADDR]'
  34754. Step with signal. This is analogous to the 'C' packet, but
  34755. requests a single-step, rather than a normal resumption of
  34756. execution.
  34757. This packet is deprecated for multi-threading support. *Note vCont
  34758. packet::.
  34759. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34760. 't ADDR:PP,MM'
  34761. Search backwards starting at address ADDR for a match with pattern
  34762. PP and mask MM, both of which are are 4 byte long. There must be
  34763. at least 3 digits in ADDR.
  34764. 'T THREAD-ID'
  34765. Find out if the thread THREAD-ID is alive. *Note thread-id
  34766. syntax::.
  34767. Reply:
  34768. 'OK'
  34769. thread is still alive
  34770. 'E NN'
  34771. thread is dead
  34772. 'v'
  34773. Packets starting with 'v' are identified by a multi-letter name, up
  34774. to the first ';' or '?' (or the end of the packet).
  34775. 'vAttach;PID'
  34776. Attach to a new process with the specified process ID PID. The
  34777. process ID is a hexadecimal integer identifying the process. In
  34778. all-stop mode, all threads in the attached process are stopped; in
  34779. non-stop mode, it may be attached without being stopped if that is
  34780. supported by the target.
  34781. This packet is only available in extended mode (*note extended
  34782. mode::).
  34783. Reply:
  34784. 'E NN'
  34785. for an error
  34786. 'Any stop packet'
  34787. for success in all-stop mode (*note Stop Reply Packets::)
  34788. 'OK'
  34789. for success in non-stop mode (*note Remote Non-Stop::)
  34790. 'vCont[;ACTION[:THREAD-ID]]...'
  34791. Resume the inferior, specifying different actions for each thread.
  34792. For each inferior thread, the leftmost action with a matching
  34793. THREAD-ID is applied. Threads that don't match any action remain
  34794. in their current state. Thread IDs are specified using the syntax
  34795. described in *note thread-id syntax::. If multiprocess extensions
  34796. (*note multiprocess extensions::) are supported, actions can be
  34797. specified to match all threads in a process by using the 'pPID.-1'
  34798. form of the THREAD-ID. An action with no THREAD-ID matches all
  34799. threads. Specifying no actions is an error.
  34800. Currently supported actions are:
  34801. 'c'
  34802. Continue.
  34803. 'C SIG'
  34804. Continue with signal SIG. The signal SIG should be two hex
  34805. digits.
  34806. 's'
  34807. Step.
  34808. 'S SIG'
  34809. Step with signal SIG. The signal SIG should be two hex
  34810. digits.
  34811. 't'
  34812. Stop.
  34813. 'r START,END'
  34814. Step once, and then keep stepping as long as the thread stops
  34815. at addresses between START (inclusive) and END (exclusive).
  34816. The remote stub reports a stop reply when either the thread
  34817. goes out of the range or is stopped due to an unrelated
  34818. reason, such as hitting a breakpoint. *Note range stepping::.
  34819. If the range is empty (START == END), then the action becomes
  34820. equivalent to the 's' action. In other words, single-step
  34821. once, and report the stop (even if the stepped instruction
  34822. jumps to START).
  34823. (A stop reply may be sent at any point even if the PC is still
  34824. within the stepping range; for example, it is valid to
  34825. implement this packet in a degenerate way as a single
  34826. instruction step operation.)
  34827. The optional argument ADDR normally associated with the 'c', 'C',
  34828. 's', and 'S' packets is not supported in 'vCont'.
  34829. The 't' action is only relevant in non-stop mode (*note Remote
  34830. Non-Stop::) and may be ignored by the stub otherwise. A stop reply
  34831. should be generated for any affected thread not already stopped.
  34832. When a thread is stopped by means of a 't' action, the
  34833. corresponding stop reply should indicate that the thread has
  34834. stopped with signal '0', regardless of whether the target uses some
  34835. other signal as an implementation detail.
  34836. The server must ignore 'c', 'C', 's', 'S', and 'r' actions for
  34837. threads that are already running. Conversely, the server must
  34838. ignore 't' actions for threads that are already stopped.
  34839. _Note:_ In non-stop mode, a thread is considered running until GDB
  34840. acknowledges an asynchronous stop notification for it with the
  34841. 'vStopped' packet (*note Remote Non-Stop::).
  34842. The stub must support 'vCont' if it reports support for
  34843. multiprocess extensions (*note multiprocess extensions::).
  34844. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34845. 'vCont?'
  34846. Request a list of actions supported by the 'vCont' packet.
  34847. Reply:
  34848. 'vCont[;ACTION...]'
  34849. The 'vCont' packet is supported. Each ACTION is a supported
  34850. command in the 'vCont' packet.
  34851. ''
  34852. The 'vCont' packet is not supported.
  34853. 'vCtrlC'
  34854. Interrupt remote target as if a control-C was pressed on the remote
  34855. terminal. This is the equivalent to reacting to the '^C' ('\003',
  34856. the control-C character) character in all-stop mode while the
  34857. target is running, except this works in non-stop mode. *Note
  34858. interrupting remote targets::, for more info on the all-stop
  34859. variant.
  34860. Reply:
  34861. 'E NN'
  34862. for an error
  34863. 'OK'
  34864. for success
  34865. 'vFile:OPERATION:PARAMETER...'
  34866. Perform a file operation on the target system. For details, see
  34867. *note Host I/O Packets::.
  34868. 'vFlashErase:ADDR,LENGTH'
  34869. Direct the stub to erase LENGTH bytes of flash starting at ADDR.
  34870. The region may enclose any number of flash blocks, but its start
  34871. and end must fall on block boundaries, as indicated by the flash
  34872. block size appearing in the memory map (*note Memory Map Format::).
  34873. GDB groups flash memory programming operations together, and sends
  34874. a 'vFlashDone' request after each group; the stub is allowed to
  34875. delay erase operation until the 'vFlashDone' packet is received.
  34876. Reply:
  34877. 'OK'
  34878. for success
  34879. 'E NN'
  34880. for an error
  34881. 'vFlashWrite:ADDR:XX...'
  34882. Direct the stub to write data to flash address ADDR. The data is
  34883. passed in binary form using the same encoding as for the 'X' packet
  34884. (*note Binary Data::). The memory ranges specified by
  34885. 'vFlashWrite' packets preceding a 'vFlashDone' packet must not
  34886. overlap, and must appear in order of increasing addresses (although
  34887. 'vFlashErase' packets for higher addresses may already have been
  34888. received; the ordering is guaranteed only between 'vFlashWrite'
  34889. packets). If a packet writes to an address that was neither erased
  34890. by a preceding 'vFlashErase' packet nor by some other
  34891. target-specific method, the results are unpredictable.
  34892. Reply:
  34893. 'OK'
  34894. for success
  34895. 'E.memtype'
  34896. for vFlashWrite addressing non-flash memory
  34897. 'E NN'
  34898. for an error
  34899. 'vFlashDone'
  34900. Indicate to the stub that flash programming operation is finished.
  34901. The stub is permitted to delay or batch the effects of a group of
  34902. 'vFlashErase' and 'vFlashWrite' packets until a 'vFlashDone' packet
  34903. is received. The contents of the affected regions of flash memory
  34904. are unpredictable until the 'vFlashDone' request is completed.
  34905. 'vKill;PID'
  34906. Kill the process with the specified process ID PID, which is a
  34907. hexadecimal integer identifying the process. This packet is used
  34908. in preference to 'k' when multiprocess protocol extensions are
  34909. supported; see *note multiprocess extensions::.
  34910. Reply:
  34911. 'E NN'
  34912. for an error
  34913. 'OK'
  34914. for success
  34915. 'vMustReplyEmpty'
  34916. The correct reply to an unknown 'v' packet is to return the empty
  34917. string, however, some older versions of 'gdbserver' would
  34918. incorrectly return 'OK' for unknown 'v' packets.
  34919. The 'vMustReplyEmpty' is used as a feature test to check how
  34920. 'gdbserver' handles unknown packets, it is important that this
  34921. packet be handled in the same way as other unknown 'v' packets. If
  34922. this packet is handled differently to other unknown 'v' packets
  34923. then it is possible that GDB may run into problems in other areas,
  34924. specifically around use of 'vFile:setfs:'.
  34925. 'vRun;FILENAME[;ARGUMENT]...'
  34926. Run the program FILENAME, passing it each ARGUMENT on its command
  34927. line. The file and arguments are hex-encoded strings. If FILENAME
  34928. is an empty string, the stub may use a default program (e.g. the
  34929. last program run). The program is created in the stopped state.
  34930. This packet is only available in extended mode (*note extended
  34931. mode::).
  34932. Reply:
  34933. 'E NN'
  34934. for an error
  34935. 'Any stop packet'
  34936. for success (*note Stop Reply Packets::)
  34937. 'vStopped'
  34938. *Note Notification Packets::.
  34939. 'X ADDR,LENGTH:XX...'
  34940. Write data to memory, where the data is transmitted in binary.
  34941. Memory is specified by its address ADDR and number of addressable
  34942. memory units LENGTH (*note addressable memory unit::); 'XX...' is
  34943. binary data (*note Binary Data::).
  34944. Reply:
  34945. 'OK'
  34946. for success
  34947. 'E NN'
  34948. for an error
  34949. 'z TYPE,ADDR,KIND'
  34950. 'Z TYPE,ADDR,KIND'
  34951. Insert ('Z') or remove ('z') a TYPE breakpoint or watchpoint
  34952. starting at address ADDRESS of kind KIND.
  34953. Each breakpoint and watchpoint packet TYPE is documented
  34954. separately.
  34955. _Implementation notes: A remote target shall return an empty string
  34956. for an unrecognized breakpoint or watchpoint packet TYPE. A remote
  34957. target shall support either both or neither of a given 'ZTYPE...'
  34958. and 'zTYPE...' packet pair. To avoid potential problems with
  34959. duplicate packets, the operations should be implemented in an
  34960. idempotent way._
  34961. 'z0,ADDR,KIND'
  34962. 'Z0,ADDR,KIND[;COND_LIST...][;cmds:PERSIST,CMD_LIST...]'
  34963. Insert ('Z0') or remove ('z0') a software breakpoint at address
  34964. ADDR of type KIND.
  34965. A software breakpoint is implemented by replacing the instruction
  34966. at ADDR with a software breakpoint or trap instruction. The KIND
  34967. is target-specific and typically indicates the size of the
  34968. breakpoint in bytes that should be inserted. E.g., the ARM and
  34969. MIPS can insert either a 2 or 4 byte breakpoint. Some
  34970. architectures have additional meanings for KIND (*note
  34971. Architecture-Specific Protocol Details::); if no
  34972. architecture-specific value is being used, it should be '0'. KIND
  34973. is hex-encoded. COND_LIST is an optional list of conditional
  34974. expressions in bytecode form that should be evaluated on the
  34975. target's side. These are the conditions that should be taken into
  34976. consideration when deciding if the breakpoint trigger should be
  34977. reported back to GDB.
  34978. See also the 'swbreak' stop reason (*note swbreak stop reason::)
  34979. for how to best report a software breakpoint event to GDB.
  34980. The COND_LIST parameter is comprised of a series of expressions,
  34981. concatenated without separators. Each expression has the following
  34982. form:
  34983. 'X LEN,EXPR'
  34984. LEN is the length of the bytecode expression and EXPR is the
  34985. actual conditional expression in bytecode form.
  34986. The optional CMD_LIST parameter introduces commands that may be run
  34987. on the target, rather than being reported back to GDB. The
  34988. parameter starts with a numeric flag PERSIST; if the flag is
  34989. nonzero, then the breakpoint may remain active and the commands
  34990. continue to be run even when GDB disconnects from the target.
  34991. Following this flag is a series of expressions concatenated with no
  34992. separators. Each expression has the following form:
  34993. 'X LEN,EXPR'
  34994. LEN is the length of the bytecode expression and EXPR is the
  34995. actual commands expression in bytecode form.
  34996. _Implementation note: It is possible for a target to copy or move
  34997. code that contains software breakpoints (e.g., when implementing
  34998. overlays). The behavior of this packet, in the presence of such a
  34999. target, is not defined._
  35000. Reply:
  35001. 'OK'
  35002. success
  35003. ''
  35004. not supported
  35005. 'E NN'
  35006. for an error
  35007. 'z1,ADDR,KIND'
  35008. 'Z1,ADDR,KIND[;COND_LIST...][;cmds:PERSIST,CMD_LIST...]'
  35009. Insert ('Z1') or remove ('z1') a hardware breakpoint at address
  35010. ADDR.
  35011. A hardware breakpoint is implemented using a mechanism that is not
  35012. dependent on being able to modify the target's memory. The KIND,
  35013. COND_LIST, and CMD_LIST arguments have the same meaning as in 'Z0'
  35014. packets.
  35015. _Implementation note: A hardware breakpoint is not affected by code
  35016. movement._
  35017. Reply:
  35018. 'OK'
  35019. success
  35020. ''
  35021. not supported
  35022. 'E NN'
  35023. for an error
  35024. 'z2,ADDR,KIND'
  35025. 'Z2,ADDR,KIND'
  35026. Insert ('Z2') or remove ('z2') a write watchpoint at ADDR. The
  35027. number of bytes to watch is specified by KIND.
  35028. Reply:
  35029. 'OK'
  35030. success
  35031. ''
  35032. not supported
  35033. 'E NN'
  35034. for an error
  35035. 'z3,ADDR,KIND'
  35036. 'Z3,ADDR,KIND'
  35037. Insert ('Z3') or remove ('z3') a read watchpoint at ADDR. The
  35038. number of bytes to watch is specified by KIND.
  35039. Reply:
  35040. 'OK'
  35041. success
  35042. ''
  35043. not supported
  35044. 'E NN'
  35045. for an error
  35046. 'z4,ADDR,KIND'
  35047. 'Z4,ADDR,KIND'
  35048. Insert ('Z4') or remove ('z4') an access watchpoint at ADDR. The
  35049. number of bytes to watch is specified by KIND.
  35050. Reply:
  35051. 'OK'
  35052. success
  35053. ''
  35054. not supported
  35055. 'E NN'
  35056. for an error
  35057. 
  35058. File: gdb.info, Node: Stop Reply Packets, Next: General Query Packets, Prev: Packets, Up: Remote Protocol
  35059. E.3 Stop Reply Packets
  35060. ======================
  35061. The 'C', 'c', 'S', 's', 'vCont', 'vAttach', 'vRun', 'vStopped', and '?'
  35062. packets can receive any of the below as a reply. Except for '?' and
  35063. 'vStopped', that reply is only returned when the target halts. In the
  35064. below the exact meaning of "signal number" is defined by the header
  35065. 'include/gdb/signals.h' in the GDB source code.
  35066. In non-stop mode, the server will simply reply 'OK' to commands such
  35067. as 'vCont'; any stop will be the subject of a future notification.
  35068. *Note Remote Non-Stop::.
  35069. As in the description of request packets, we include spaces in the
  35070. reply templates for clarity; these are not part of the reply packet's
  35071. syntax. No GDB stop reply packet uses spaces to separate its
  35072. components.
  35073. 'S AA'
  35074. The program received signal number AA (a two-digit hexadecimal
  35075. number). This is equivalent to a 'T' response with no N:R pairs.
  35076. 'T AA N1:R1;N2:R2;...'
  35077. The program received signal number AA (a two-digit hexadecimal
  35078. number). This is equivalent to an 'S' response, except that the
  35079. 'N:R' pairs can carry values of important registers and other
  35080. information directly in the stop reply packet, reducing round-trip
  35081. latency. Single-step and breakpoint traps are reported this way.
  35082. Each 'N:R' pair is interpreted as follows:
  35083. * If N is a hexadecimal number, it is a register number, and the
  35084. corresponding R gives that register's value. The data R is a
  35085. series of bytes in target byte order, with each byte given by
  35086. a two-digit hex number.
  35087. * If N is 'thread', then R is the THREAD-ID of the stopped
  35088. thread, as specified in *note thread-id syntax::.
  35089. * If N is 'core', then R is the hexadecimal number of the core
  35090. on which the stop event was detected.
  35091. * If N is a recognized "stop reason", it describes a more
  35092. specific event that stopped the target. The currently defined
  35093. stop reasons are listed below. The AA should be '05', the
  35094. trap signal. At most one stop reason should be present.
  35095. * Otherwise, GDB should ignore this 'N:R' pair and go on to the
  35096. next; this allows us to extend the protocol in the future.
  35097. The currently defined stop reasons are:
  35098. 'watch'
  35099. 'rwatch'
  35100. 'awatch'
  35101. The packet indicates a watchpoint hit, and R is the data
  35102. address, in hex.
  35103. 'syscall_entry'
  35104. 'syscall_return'
  35105. The packet indicates a syscall entry or return, and R is the
  35106. syscall number, in hex.
  35107. 'library'
  35108. The packet indicates that the loaded libraries have changed.
  35109. GDB should use 'qXfer:libraries:read' to fetch a new list of
  35110. loaded libraries. The R part is ignored.
  35111. 'replaylog'
  35112. The packet indicates that the target cannot continue replaying
  35113. logged execution events, because it has reached the end (or
  35114. the beginning when executing backward) of the log. The value
  35115. of R will be either 'begin' or 'end'. *Note Reverse
  35116. Execution::, for more information.
  35117. 'swbreak'
  35118. The packet indicates a software breakpoint instruction was
  35119. executed, irrespective of whether it was GDB that planted the
  35120. breakpoint or the breakpoint is hardcoded in the program. The
  35121. R part must be left empty.
  35122. On some architectures, such as x86, at the architecture level,
  35123. when a breakpoint instruction executes the program counter
  35124. points at the breakpoint address plus an offset. On such
  35125. targets, the stub is responsible for adjusting the PC to point
  35126. back at the breakpoint address.
  35127. This packet should not be sent by default; older GDB versions
  35128. did not support it. GDB requests it, by supplying an
  35129. appropriate 'qSupported' feature (*note qSupported::). The
  35130. remote stub must also supply the appropriate 'qSupported'
  35131. feature indicating support.
  35132. This packet is required for correct non-stop mode operation.
  35133. 'hwbreak'
  35134. The packet indicates the target stopped for a hardware
  35135. breakpoint. The R part must be left empty.
  35136. The same remarks about 'qSupported' and non-stop mode above
  35137. apply.
  35138. 'fork'
  35139. The packet indicates that 'fork' was called, and R is the
  35140. thread ID of the new child process. Refer to *note thread-id
  35141. syntax:: for the format of the THREAD-ID field. This packet
  35142. is only applicable to targets that support fork events.
  35143. This packet should not be sent by default; older GDB versions
  35144. did not support it. GDB requests it, by supplying an
  35145. appropriate 'qSupported' feature (*note qSupported::). The
  35146. remote stub must also supply the appropriate 'qSupported'
  35147. feature indicating support.
  35148. 'vfork'
  35149. The packet indicates that 'vfork' was called, and R is the
  35150. thread ID of the new child process. Refer to *note thread-id
  35151. syntax:: for the format of the THREAD-ID field. This packet
  35152. is only applicable to targets that support vfork events.
  35153. This packet should not be sent by default; older GDB versions
  35154. did not support it. GDB requests it, by supplying an
  35155. appropriate 'qSupported' feature (*note qSupported::). The
  35156. remote stub must also supply the appropriate 'qSupported'
  35157. feature indicating support.
  35158. 'vforkdone'
  35159. The packet indicates that a child process created by a vfork
  35160. has either called 'exec' or terminated, so that the address
  35161. spaces of the parent and child process are no longer shared.
  35162. The R part is ignored. This packet is only applicable to
  35163. targets that support vforkdone events.
  35164. This packet should not be sent by default; older GDB versions
  35165. did not support it. GDB requests it, by supplying an
  35166. appropriate 'qSupported' feature (*note qSupported::). The
  35167. remote stub must also supply the appropriate 'qSupported'
  35168. feature indicating support.
  35169. 'exec'
  35170. The packet indicates that 'execve' was called, and R is the
  35171. absolute pathname of the file that was executed, in hex. This
  35172. packet is only applicable to targets that support exec events.
  35173. This packet should not be sent by default; older GDB versions
  35174. did not support it. GDB requests it, by supplying an
  35175. appropriate 'qSupported' feature (*note qSupported::). The
  35176. remote stub must also supply the appropriate 'qSupported'
  35177. feature indicating support.
  35178. 'create'
  35179. The packet indicates that the thread was just created. The
  35180. new thread is stopped until GDB sets it running with a
  35181. resumption packet (*note vCont packet::). This packet should
  35182. not be sent by default; GDB requests it with the *note
  35183. QThreadEvents:: packet. See also the 'w' (*note thread exit
  35184. event::) remote reply below. The R part is ignored.
  35185. 'W AA'
  35186. 'W AA ; process:PID'
  35187. The process exited, and AA is the exit status. This is only
  35188. applicable to certain targets.
  35189. The second form of the response, including the process ID of the
  35190. exited process, can be used only when GDB has reported support for
  35191. multiprocess protocol extensions; see *note multiprocess
  35192. extensions::. Both AA and PID are formatted as big-endian hex
  35193. strings.
  35194. 'X AA'
  35195. 'X AA ; process:PID'
  35196. The process terminated with signal AA.
  35197. The second form of the response, including the process ID of the
  35198. terminated process, can be used only when GDB has reported support
  35199. for multiprocess protocol extensions; see *note multiprocess
  35200. extensions::. Both AA and PID are formatted as big-endian hex
  35201. strings.
  35202. 'w AA ; TID'
  35203. The thread exited, and AA is the exit status. This response should
  35204. not be sent by default; GDB requests it with the *note
  35205. QThreadEvents:: packet. See also *note thread create event::
  35206. above. AA is formatted as a big-endian hex string.
  35207. 'N'
  35208. There are no resumed threads left in the target. In other words,
  35209. even though the process is alive, the last resumed thread has
  35210. exited. For example, say the target process has two threads:
  35211. thread 1 and thread 2. The client leaves thread 1 stopped, and
  35212. resumes thread 2, which subsequently exits. At this point, even
  35213. though the process is still alive, and thus no 'W' stop reply is
  35214. sent, no thread is actually executing either. The 'N' stop reply
  35215. thus informs the client that it can stop waiting for stop replies.
  35216. This packet should not be sent by default; older GDB versions did
  35217. not support it. GDB requests it, by supplying an appropriate
  35218. 'qSupported' feature (*note qSupported::). The remote stub must
  35219. also supply the appropriate 'qSupported' feature indicating
  35220. support.
  35221. 'O XX...'
  35222. 'XX...' is hex encoding of ASCII data, to be written as the
  35223. program's console output. This can happen at any time while the
  35224. program is running and the debugger should continue to wait for
  35225. 'W', 'T', etc. This reply is not permitted in non-stop mode.
  35226. 'F CALL-ID,PARAMETER...'
  35227. CALL-ID is the identifier which says which host system call should
  35228. be called. This is just the name of the function. Translation
  35229. into the correct system call is only applicable as it's defined in
  35230. GDB. *Note File-I/O Remote Protocol Extension::, for a list of
  35231. implemented system calls.
  35232. 'PARAMETER...' is a list of parameters as defined for this very
  35233. system call.
  35234. The target replies with this packet when it expects GDB to call a
  35235. host system call on behalf of the target. GDB replies with an
  35236. appropriate 'F' packet and keeps up waiting for the next reply
  35237. packet from the target. The latest 'C', 'c', 'S' or 's' action is
  35238. expected to be continued. *Note File-I/O Remote Protocol
  35239. Extension::, for more details.
  35240. 
  35241. File: gdb.info, Node: General Query Packets, Next: Architecture-Specific Protocol Details, Prev: Stop Reply Packets, Up: Remote Protocol
  35242. E.4 General Query Packets
  35243. =========================
  35244. Packets starting with 'q' are "general query packets"; packets starting
  35245. with 'Q' are "general set packets". General query and set packets are a
  35246. semi-unified form for retrieving and sending information to and from the
  35247. stub.
  35248. The initial letter of a query or set packet is followed by a name
  35249. indicating what sort of thing the packet applies to. For example, GDB
  35250. may use a 'qSymbol' packet to exchange symbol definitions with the stub.
  35251. These packet names follow some conventions:
  35252. * The name must not contain commas, colons or semicolons.
  35253. * Most GDB query and set packets have a leading upper case letter.
  35254. * The names of custom vendor packets should use a company prefix, in
  35255. lower case, followed by a period. For example, packets designed at
  35256. the Acme Corporation might begin with 'qacme.foo' (for querying
  35257. foos) or 'Qacme.bar' (for setting bars).
  35258. The name of a query or set packet should be separated from any
  35259. parameters by a ':'; the parameters themselves should be separated by
  35260. ',' or ';'. Stubs must be careful to match the full packet name, and
  35261. check for a separator or the end of the packet, in case two packet names
  35262. share a common prefix. New packets should not begin with 'qC', 'qP', or
  35263. 'qL'(1).
  35264. Like the descriptions of the other packets, each description here has
  35265. a template showing the packet's overall syntax, followed by an
  35266. explanation of the packet's meaning. We include spaces in some of the
  35267. templates for clarity; these are not part of the packet's syntax. No
  35268. GDB packet uses spaces to separate its components.
  35269. Here are the currently defined query and set packets:
  35270. 'QAgent:1'
  35271. 'QAgent:0'
  35272. Turn on or off the agent as a helper to perform some debugging
  35273. operations delegated from GDB (*note Control Agent::).
  35274. 'QAllow:OP:VAL...'
  35275. Specify which operations GDB expects to request of the target, as a
  35276. semicolon-separated list of operation name and value pairs.
  35277. Possible values for OP include 'WriteReg', 'WriteMem',
  35278. 'InsertBreak', 'InsertTrace', 'InsertFastTrace', and 'Stop'. VAL
  35279. is either 0, indicating that GDB will not request the operation, or
  35280. 1, indicating that it may. (The target can then use this to set up
  35281. its own internals optimally, for instance if the debugger never
  35282. expects to insert breakpoints, it may not need to install its own
  35283. trap handler.)
  35284. 'qC'
  35285. Return the current thread ID.
  35286. Reply:
  35287. 'QC THREAD-ID'
  35288. Where THREAD-ID is a thread ID as documented in *note
  35289. thread-id syntax::.
  35290. '(anything else)'
  35291. Any other reply implies the old thread ID.
  35292. 'qCRC:ADDR,LENGTH'
  35293. Compute the CRC checksum of a block of memory using CRC-32 defined
  35294. in IEEE 802.3. The CRC is computed byte at a time, taking the most
  35295. significant bit of each byte first. The initial pattern code
  35296. '0xffffffff' is used to ensure leading zeros affect the CRC.
  35297. _Note:_ This is the same CRC used in validating separate debug
  35298. files (*note Debugging Information in Separate Files: Separate
  35299. Debug Files.). However the algorithm is slightly different. When
  35300. validating separate debug files, the CRC is computed taking the
  35301. _least_ significant bit of each byte first, and the final result is
  35302. inverted to detect trailing zeros.
  35303. Reply:
  35304. 'E NN'
  35305. An error (such as memory fault)
  35306. 'C CRC32'
  35307. The specified memory region's checksum is CRC32.
  35308. 'QDisableRandomization:VALUE'
  35309. Some target operating systems will randomize the virtual address
  35310. space of the inferior process as a security feature, but provide a
  35311. feature to disable such randomization, e.g. to allow for a more
  35312. deterministic debugging experience. On such systems, this packet
  35313. with a VALUE of 1 directs the target to disable address space
  35314. randomization for processes subsequently started via 'vRun'
  35315. packets, while a packet with a VALUE of 0 tells the target to
  35316. enable address space randomization.
  35317. This packet is only available in extended mode (*note extended
  35318. mode::).
  35319. Reply:
  35320. 'OK'
  35321. The request succeeded.
  35322. 'E NN'
  35323. An error occurred. The error number NN is given as hex
  35324. digits.
  35325. ''
  35326. An empty reply indicates that 'QDisableRandomization' is not
  35327. supported by the stub.
  35328. This packet is not probed by default; the remote stub must request
  35329. it, by supplying an appropriate 'qSupported' response (*note
  35330. qSupported::). This should only be done on targets that actually
  35331. support disabling address space randomization.
  35332. 'QStartupWithShell:VALUE'
  35333. On UNIX-like targets, it is possible to start the inferior using a
  35334. shell program. This is the default behavior on both GDB and
  35335. 'gdbserver' (*note set startup-with-shell::). This packet is used
  35336. to inform 'gdbserver' whether it should start the inferior using a
  35337. shell or not.
  35338. If VALUE is '0', 'gdbserver' will not use a shell to start the
  35339. inferior. If VALUE is '1', 'gdbserver' will use a shell to start
  35340. the inferior. All other values are considered an error.
  35341. This packet is only available in extended mode (*note extended
  35342. mode::).
  35343. Reply:
  35344. 'OK'
  35345. The request succeeded.
  35346. 'E NN'
  35347. An error occurred. The error number NN is given as hex
  35348. digits.
  35349. This packet is not probed by default; the remote stub must request
  35350. it, by supplying an appropriate 'qSupported' response (*note
  35351. qSupported::). This should only be done on targets that actually
  35352. support starting the inferior using a shell.
  35353. Use of this packet is controlled by the 'set startup-with-shell'
  35354. command; *note set startup-with-shell::.
  35355. 'QEnvironmentHexEncoded:HEX-VALUE'
  35356. On UNIX-like targets, it is possible to set environment variables
  35357. that will be passed to the inferior during the startup process.
  35358. This packet is used to inform 'gdbserver' of an environment
  35359. variable that has been defined by the user on GDB (*note set
  35360. environment::).
  35361. The packet is composed by HEX-VALUE, an hex encoded representation
  35362. of the NAME=VALUE format representing an environment variable. The
  35363. name of the environment variable is represented by NAME, and the
  35364. value to be assigned to the environment variable is represented by
  35365. VALUE. If the variable has no value (i.e., the value is 'null'),
  35366. then VALUE will not be present.
  35367. This packet is only available in extended mode (*note extended
  35368. mode::).
  35369. Reply:
  35370. 'OK'
  35371. The request succeeded.
  35372. This packet is not probed by default; the remote stub must request
  35373. it, by supplying an appropriate 'qSupported' response (*note
  35374. qSupported::). This should only be done on targets that actually
  35375. support passing environment variables to the starting inferior.
  35376. This packet is related to the 'set environment' command; *note set
  35377. environment::.
  35378. 'QEnvironmentUnset:HEX-VALUE'
  35379. On UNIX-like targets, it is possible to unset environment variables
  35380. before starting the inferior in the remote target. This packet is
  35381. used to inform 'gdbserver' of an environment variable that has been
  35382. unset by the user on GDB (*note unset environment::).
  35383. The packet is composed by HEX-VALUE, an hex encoded representation
  35384. of the name of the environment variable to be unset.
  35385. This packet is only available in extended mode (*note extended
  35386. mode::).
  35387. Reply:
  35388. 'OK'
  35389. The request succeeded.
  35390. This packet is not probed by default; the remote stub must request
  35391. it, by supplying an appropriate 'qSupported' response (*note
  35392. qSupported::). This should only be done on targets that actually
  35393. support passing environment variables to the starting inferior.
  35394. This packet is related to the 'unset environment' command; *note
  35395. unset environment::.
  35396. 'QEnvironmentReset'
  35397. On UNIX-like targets, this packet is used to reset the state of
  35398. environment variables in the remote target before starting the
  35399. inferior. In this context, reset means unsetting all environment
  35400. variables that were previously set by the user (i.e., were not
  35401. initially present in the environment). It is sent to 'gdbserver'
  35402. before the 'QEnvironmentHexEncoded' (*note
  35403. QEnvironmentHexEncoded::) and the 'QEnvironmentUnset' (*note
  35404. QEnvironmentUnset::) packets.
  35405. This packet is only available in extended mode (*note extended
  35406. mode::).
  35407. Reply:
  35408. 'OK'
  35409. The request succeeded.
  35410. This packet is not probed by default; the remote stub must request
  35411. it, by supplying an appropriate 'qSupported' response (*note
  35412. qSupported::). This should only be done on targets that actually
  35413. support passing environment variables to the starting inferior.
  35414. 'QSetWorkingDir:[DIRECTORY]'
  35415. This packet is used to inform the remote server of the intended
  35416. current working directory for programs that are going to be
  35417. executed.
  35418. The packet is composed by DIRECTORY, an hex encoded representation
  35419. of the directory that the remote inferior will use as its current
  35420. working directory. If DIRECTORY is an empty string, the remote
  35421. server should reset the inferior's current working directory to its
  35422. original, empty value.
  35423. This packet is only available in extended mode (*note extended
  35424. mode::).
  35425. Reply:
  35426. 'OK'
  35427. The request succeeded.
  35428. 'qfThreadInfo'
  35429. 'qsThreadInfo'
  35430. Obtain a list of all active thread IDs from the target (OS). Since
  35431. there may be too many active threads to fit into one reply packet,
  35432. this query works iteratively: it may require more than one
  35433. query/reply sequence to obtain the entire list of threads. The
  35434. first query of the sequence will be the 'qfThreadInfo' query;
  35435. subsequent queries in the sequence will be the 'qsThreadInfo'
  35436. query.
  35437. NOTE: This packet replaces the 'qL' query (see below).
  35438. Reply:
  35439. 'm THREAD-ID'
  35440. A single thread ID
  35441. 'm THREAD-ID,THREAD-ID...'
  35442. a comma-separated list of thread IDs
  35443. 'l'
  35444. (lower case letter 'L') denotes end of list.
  35445. In response to each query, the target will reply with a list of one
  35446. or more thread IDs, separated by commas. GDB will respond to each
  35447. reply with a request for more thread ids (using the 'qs' form of
  35448. the query), until the target responds with 'l' (lower-case ell, for
  35449. "last"). Refer to *note thread-id syntax::, for the format of the
  35450. THREAD-ID fields.
  35451. _Note: GDB will send the 'qfThreadInfo' query during the initial
  35452. connection with the remote target, and the very first thread ID
  35453. mentioned in the reply will be stopped by GDB in a subsequent
  35454. message. Therefore, the stub should ensure that the first thread
  35455. ID in the 'qfThreadInfo' reply is suitable for being stopped by
  35456. GDB._
  35457. 'qGetTLSAddr:THREAD-ID,OFFSET,LM'
  35458. Fetch the address associated with thread local storage specified by
  35459. THREAD-ID, OFFSET, and LM.
  35460. THREAD-ID is the thread ID associated with the thread for which to
  35461. fetch the TLS address. *Note thread-id syntax::.
  35462. OFFSET is the (big endian, hex encoded) offset associated with the
  35463. thread local variable. (This offset is obtained from the debug
  35464. information associated with the variable.)
  35465. LM is the (big endian, hex encoded) OS/ABI-specific encoding of the
  35466. load module associated with the thread local storage. For example,
  35467. a GNU/Linux system will pass the link map address of the shared
  35468. object associated with the thread local storage under
  35469. consideration. Other operating environments may choose to
  35470. represent the load module differently, so the precise meaning of
  35471. this parameter will vary.
  35472. Reply:
  35473. 'XX...'
  35474. Hex encoded (big endian) bytes representing the address of the
  35475. thread local storage requested.
  35476. 'E NN'
  35477. An error occurred. The error number NN is given as hex
  35478. digits.
  35479. ''
  35480. An empty reply indicates that 'qGetTLSAddr' is not supported
  35481. by the stub.
  35482. 'qGetTIBAddr:THREAD-ID'
  35483. Fetch address of the Windows OS specific Thread Information Block.
  35484. THREAD-ID is the thread ID associated with the thread.
  35485. Reply:
  35486. 'XX...'
  35487. Hex encoded (big endian) bytes representing the linear address
  35488. of the thread information block.
  35489. 'E NN'
  35490. An error occured. This means that either the thread was not
  35491. found, or the address could not be retrieved.
  35492. ''
  35493. An empty reply indicates that 'qGetTIBAddr' is not supported
  35494. by the stub.
  35495. 'qL STARTFLAG THREADCOUNT NEXTTHREAD'
  35496. Obtain thread information from RTOS. Where: STARTFLAG (one hex
  35497. digit) is one to indicate the first query and zero to indicate a
  35498. subsequent query; THREADCOUNT (two hex digits) is the maximum
  35499. number of threads the response packet can contain; and NEXTTHREAD
  35500. (eight hex digits), for subsequent queries (STARTFLAG is zero), is
  35501. returned in the response as ARGTHREAD.
  35502. Don't use this packet; use the 'qfThreadInfo' query instead (see
  35503. above).
  35504. Reply:
  35505. 'qM COUNT DONE ARGTHREAD THREAD...'
  35506. Where: COUNT (two hex digits) is the number of threads being
  35507. returned; DONE (one hex digit) is zero to indicate more
  35508. threads and one indicates no further threads; ARGTHREADID
  35509. (eight hex digits) is NEXTTHREAD from the request packet;
  35510. THREAD... is a sequence of thread IDs, THREADID (eight hex
  35511. digits), from the target. See
  35512. 'remote.c:parse_threadlist_response()'.
  35513. 'qOffsets'
  35514. Get section offsets that the target used when relocating the
  35515. downloaded image.
  35516. Reply:
  35517. 'Text=XXX;Data=YYY[;Bss=ZZZ]'
  35518. Relocate the 'Text' section by XXX from its original address.
  35519. Relocate the 'Data' section by YYY from its original address.
  35520. If the object file format provides segment information (e.g.
  35521. ELF 'PT_LOAD' program headers), GDB will relocate entire
  35522. segments by the supplied offsets.
  35523. _Note: while a 'Bss' offset may be included in the response,
  35524. GDB ignores this and instead applies the 'Data' offset to the
  35525. 'Bss' section._
  35526. 'TextSeg=XXX[;DataSeg=YYY]'
  35527. Relocate the first segment of the object file, which
  35528. conventionally contains program code, to a starting address of
  35529. XXX. If 'DataSeg' is specified, relocate the second segment,
  35530. which conventionally contains modifiable data, to a starting
  35531. address of YYY. GDB will report an error if the object file
  35532. does not contain segment information, or does not contain at
  35533. least as many segments as mentioned in the reply. Extra
  35534. segments are kept at fixed offsets relative to the last
  35535. relocated segment.
  35536. 'qP MODE THREAD-ID'
  35537. Returns information on THREAD-ID. Where: MODE is a hex encoded 32
  35538. bit mode; THREAD-ID is a thread ID (*note thread-id syntax::).
  35539. Don't use this packet; use the 'qThreadExtraInfo' query instead
  35540. (see below).
  35541. Reply: see 'remote.c:remote_unpack_thread_info_response()'.
  35542. 'QNonStop:1'
  35543. 'QNonStop:0'
  35544. Enter non-stop ('QNonStop:1') or all-stop ('QNonStop:0') mode.
  35545. *Note Remote Non-Stop::, for more information.
  35546. Reply:
  35547. 'OK'
  35548. The request succeeded.
  35549. 'E NN'
  35550. An error occurred. The error number NN is given as hex
  35551. digits.
  35552. ''
  35553. An empty reply indicates that 'QNonStop' is not supported by
  35554. the stub.
  35555. This packet is not probed by default; the remote stub must request
  35556. it, by supplying an appropriate 'qSupported' response (*note
  35557. qSupported::). Use of this packet is controlled by the 'set
  35558. non-stop' command; *note Non-Stop Mode::.
  35559. 'QCatchSyscalls:1 [;SYSNO]...'
  35560. 'QCatchSyscalls:0'
  35561. Enable ('QCatchSyscalls:1') or disable ('QCatchSyscalls:0')
  35562. catching syscalls from the inferior process.
  35563. For 'QCatchSyscalls:1', each listed syscall SYSNO (encoded in hex)
  35564. should be reported to GDB. If no syscall SYSNO is listed, every
  35565. system call should be reported.
  35566. Note that if a syscall not in the list is reported, GDB will still
  35567. filter the event according to its own list from all corresponding
  35568. 'catch syscall' commands. However, it is more efficient to only
  35569. report the requested syscalls.
  35570. Multiple 'QCatchSyscalls:1' packets do not combine; any earlier
  35571. 'QCatchSyscalls:1' list is completely replaced by the new list.
  35572. If the inferior process execs, the state of 'QCatchSyscalls' is
  35573. kept for the new process too. On targets where exec may affect
  35574. syscall numbers, for example with exec between 32 and 64-bit
  35575. processes, the client should send a new packet with the new syscall
  35576. list.
  35577. Reply:
  35578. 'OK'
  35579. The request succeeded.
  35580. 'E NN'
  35581. An error occurred. NN are hex digits.
  35582. ''
  35583. An empty reply indicates that 'QCatchSyscalls' is not
  35584. supported by the stub.
  35585. Use of this packet is controlled by the 'set remote catch-syscalls'
  35586. command (*note set remote catch-syscalls: Remote Configuration.).
  35587. This packet is not probed by default; the remote stub must request
  35588. it, by supplying an appropriate 'qSupported' response (*note
  35589. qSupported::).
  35590. 'QPassSignals: SIGNAL [;SIGNAL]...'
  35591. Each listed SIGNAL should be passed directly to the inferior
  35592. process. Signals are numbered identically to continue packets and
  35593. stop replies (*note Stop Reply Packets::). Each SIGNAL list item
  35594. should be strictly greater than the previous item. These signals
  35595. do not need to stop the inferior, or be reported to GDB. All other
  35596. signals should be reported to GDB. Multiple 'QPassSignals' packets
  35597. do not combine; any earlier 'QPassSignals' list is completely
  35598. replaced by the new list. This packet improves performance when
  35599. using 'handle SIGNAL nostop noprint pass'.
  35600. Reply:
  35601. 'OK'
  35602. The request succeeded.
  35603. 'E NN'
  35604. An error occurred. The error number NN is given as hex
  35605. digits.
  35606. ''
  35607. An empty reply indicates that 'QPassSignals' is not supported
  35608. by the stub.
  35609. Use of this packet is controlled by the 'set remote pass-signals'
  35610. command (*note set remote pass-signals: Remote Configuration.).
  35611. This packet is not probed by default; the remote stub must request
  35612. it, by supplying an appropriate 'qSupported' response (*note
  35613. qSupported::).
  35614. 'QProgramSignals: SIGNAL [;SIGNAL]...'
  35615. Each listed SIGNAL may be delivered to the inferior process.
  35616. Others should be silently discarded.
  35617. In some cases, the remote stub may need to decide whether to
  35618. deliver a signal to the program or not without GDB involvement.
  35619. One example of that is while detaching -- the program's threads may
  35620. have stopped for signals that haven't yet had a chance of being
  35621. reported to GDB, and so the remote stub can use the signal list
  35622. specified by this packet to know whether to deliver or ignore those
  35623. pending signals.
  35624. This does not influence whether to deliver a signal as requested by
  35625. a resumption packet (*note vCont packet::).
  35626. Signals are numbered identically to continue packets and stop
  35627. replies (*note Stop Reply Packets::). Each SIGNAL list item should
  35628. be strictly greater than the previous item. Multiple
  35629. 'QProgramSignals' packets do not combine; any earlier
  35630. 'QProgramSignals' list is completely replaced by the new list.
  35631. Reply:
  35632. 'OK'
  35633. The request succeeded.
  35634. 'E NN'
  35635. An error occurred. The error number NN is given as hex
  35636. digits.
  35637. ''
  35638. An empty reply indicates that 'QProgramSignals' is not
  35639. supported by the stub.
  35640. Use of this packet is controlled by the 'set remote
  35641. program-signals' command (*note set remote program-signals: Remote
  35642. Configuration.). This packet is not probed by default; the remote
  35643. stub must request it, by supplying an appropriate 'qSupported'
  35644. response (*note qSupported::).
  35645. 'QThreadEvents:1'
  35646. 'QThreadEvents:0'
  35647. Enable ('QThreadEvents:1') or disable ('QThreadEvents:0') reporting
  35648. of thread create and exit events. *Note thread create event::, for
  35649. the reply specifications. For example, this is used in non-stop
  35650. mode when GDB stops a set of threads and synchronously waits for
  35651. the their corresponding stop replies. Without exit events, if one
  35652. of the threads exits, GDB would hang forever not knowing that it
  35653. should no longer expect a stop for that same thread. GDB does not
  35654. enable this feature unless the stub reports that it supports it by
  35655. including 'QThreadEvents+' in its 'qSupported' reply.
  35656. Reply:
  35657. 'OK'
  35658. The request succeeded.
  35659. 'E NN'
  35660. An error occurred. The error number NN is given as hex
  35661. digits.
  35662. ''
  35663. An empty reply indicates that 'QThreadEvents' is not supported
  35664. by the stub.
  35665. Use of this packet is controlled by the 'set remote thread-events'
  35666. command (*note set remote thread-events: Remote Configuration.).
  35667. 'qRcmd,COMMAND'
  35668. COMMAND (hex encoded) is passed to the local interpreter for
  35669. execution. Invalid commands should be reported using the output
  35670. string. Before the final result packet, the target may also
  35671. respond with a number of intermediate 'OOUTPUT' console output
  35672. packets. _Implementors should note that providing access to a
  35673. stubs's interpreter may have security implications_.
  35674. Reply:
  35675. 'OK'
  35676. A command response with no output.
  35677. 'OUTPUT'
  35678. A command response with the hex encoded output string OUTPUT.
  35679. 'E NN'
  35680. Indicate a badly formed request.
  35681. ''
  35682. An empty reply indicates that 'qRcmd' is not recognized.
  35683. (Note that the 'qRcmd' packet's name is separated from the command
  35684. by a ',', not a ':', contrary to the naming conventions above.
  35685. Please don't use this packet as a model for new packets.)
  35686. 'qSearch:memory:ADDRESS;LENGTH;SEARCH-PATTERN'
  35687. Search LENGTH bytes at ADDRESS for SEARCH-PATTERN. Both ADDRESS
  35688. and LENGTH are encoded in hex; SEARCH-PATTERN is a sequence of
  35689. bytes, also hex encoded.
  35690. Reply:
  35691. '0'
  35692. The pattern was not found.
  35693. '1,address'
  35694. The pattern was found at ADDRESS.
  35695. 'E NN'
  35696. A badly formed request or an error was encountered while
  35697. searching memory.
  35698. ''
  35699. An empty reply indicates that 'qSearch:memory' is not
  35700. recognized.
  35701. 'QStartNoAckMode'
  35702. Request that the remote stub disable the normal '+'/'-' protocol
  35703. acknowledgments (*note Packet Acknowledgment::).
  35704. Reply:
  35705. 'OK'
  35706. The stub has switched to no-acknowledgment mode. GDB
  35707. acknowledges this response, but neither the stub nor GDB shall
  35708. send or expect further '+'/'-' acknowledgments in the current
  35709. connection.
  35710. ''
  35711. An empty reply indicates that the stub does not support
  35712. no-acknowledgment mode.
  35713. 'qSupported [:GDBFEATURE [;GDBFEATURE]... ]'
  35714. Tell the remote stub about features supported by GDB, and query the
  35715. stub for features it supports. This packet allows GDB and the
  35716. remote stub to take advantage of each others' features.
  35717. 'qSupported' also consolidates multiple feature probes at startup,
  35718. to improve GDB performance--a single larger packet performs better
  35719. than multiple smaller probe packets on high-latency links. Some
  35720. features may enable behavior which must not be on by default, e.g.
  35721. because it would confuse older clients or stubs. Other features
  35722. may describe packets which could be automatically probed for, but
  35723. are not. These features must be reported before GDB will use them.
  35724. This "default unsupported" behavior is not appropriate for all
  35725. packets, but it helps to keep the initial connection time under
  35726. control with new versions of GDB which support increasing numbers
  35727. of packets.
  35728. Reply:
  35729. 'STUBFEATURE [;STUBFEATURE]...'
  35730. The stub supports or does not support each returned
  35731. STUBFEATURE, depending on the form of each STUBFEATURE (see
  35732. below for the possible forms).
  35733. ''
  35734. An empty reply indicates that 'qSupported' is not recognized,
  35735. or that no features needed to be reported to GDB.
  35736. The allowed forms for each feature (either a GDBFEATURE in the
  35737. 'qSupported' packet, or a STUBFEATURE in the response) are:
  35738. 'NAME=VALUE'
  35739. The remote protocol feature NAME is supported, and associated
  35740. with the specified VALUE. The format of VALUE depends on the
  35741. feature, but it must not include a semicolon.
  35742. 'NAME+'
  35743. The remote protocol feature NAME is supported, and does not
  35744. need an associated value.
  35745. 'NAME-'
  35746. The remote protocol feature NAME is not supported.
  35747. 'NAME?'
  35748. The remote protocol feature NAME may be supported, and GDB
  35749. should auto-detect support in some other way when it is
  35750. needed. This form will not be used for GDBFEATURE
  35751. notifications, but may be used for STUBFEATURE responses.
  35752. Whenever the stub receives a 'qSupported' request, the supplied set
  35753. of GDB features should override any previous request. This allows
  35754. GDB to put the stub in a known state, even if the stub had
  35755. previously been communicating with a different version of GDB.
  35756. The following values of GDBFEATURE (for the packet sent by GDB) are
  35757. defined:
  35758. 'multiprocess'
  35759. This feature indicates whether GDB supports multiprocess
  35760. extensions to the remote protocol. GDB does not use such
  35761. extensions unless the stub also reports that it supports them
  35762. by including 'multiprocess+' in its 'qSupported' reply. *Note
  35763. multiprocess extensions::, for details.
  35764. 'xmlRegisters'
  35765. This feature indicates that GDB supports the XML target
  35766. description. If the stub sees 'xmlRegisters=' with target
  35767. specific strings separated by a comma, it will report register
  35768. description.
  35769. 'qRelocInsn'
  35770. This feature indicates whether GDB supports the 'qRelocInsn'
  35771. packet (*note Relocate instruction reply packet: Tracepoint
  35772. Packets.).
  35773. 'swbreak'
  35774. This feature indicates whether GDB supports the swbreak stop
  35775. reason in stop replies. *Note swbreak stop reason::, for
  35776. details.
  35777. 'hwbreak'
  35778. This feature indicates whether GDB supports the hwbreak stop
  35779. reason in stop replies. *Note swbreak stop reason::, for
  35780. details.
  35781. 'fork-events'
  35782. This feature indicates whether GDB supports fork event
  35783. extensions to the remote protocol. GDB does not use such
  35784. extensions unless the stub also reports that it supports them
  35785. by including 'fork-events+' in its 'qSupported' reply.
  35786. 'vfork-events'
  35787. This feature indicates whether GDB supports vfork event
  35788. extensions to the remote protocol. GDB does not use such
  35789. extensions unless the stub also reports that it supports them
  35790. by including 'vfork-events+' in its 'qSupported' reply.
  35791. 'exec-events'
  35792. This feature indicates whether GDB supports exec event
  35793. extensions to the remote protocol. GDB does not use such
  35794. extensions unless the stub also reports that it supports them
  35795. by including 'exec-events+' in its 'qSupported' reply.
  35796. 'vContSupported'
  35797. This feature indicates whether GDB wants to know the supported
  35798. actions in the reply to 'vCont?' packet.
  35799. Stubs should ignore any unknown values for GDBFEATURE. Any GDB
  35800. which sends a 'qSupported' packet supports receiving packets of
  35801. unlimited length (earlier versions of GDB may reject overly long
  35802. responses). Additional values for GDBFEATURE may be defined in the
  35803. future to let the stub take advantage of new features in GDB, e.g.
  35804. incompatible improvements in the remote protocol--the
  35805. 'multiprocess' feature is an example of such a feature. The stub's
  35806. reply should be independent of the GDBFEATURE entries sent by GDB;
  35807. first GDB describes all the features it supports, and then the stub
  35808. replies with all the features it supports.
  35809. Similarly, GDB will silently ignore unrecognized stub feature
  35810. responses, as long as each response uses one of the standard forms.
  35811. Some features are flags. A stub which supports a flag feature
  35812. should respond with a '+' form response. Other features require
  35813. values, and the stub should respond with an '=' form response.
  35814. Each feature has a default value, which GDB will use if
  35815. 'qSupported' is not available or if the feature is not mentioned in
  35816. the 'qSupported' response. The default values are fixed; a stub is
  35817. free to omit any feature responses that match the defaults.
  35818. Not all features can be probed, but for those which can, the
  35819. probing mechanism is useful: in some cases, a stub's internal
  35820. architecture may not allow the protocol layer to know some
  35821. information about the underlying target in advance. This is
  35822. especially common in stubs which may be configured for multiple
  35823. targets.
  35824. These are the currently defined stub features and their properties:
  35825. Feature Name Value Default Probe
  35826. Required Allowed
  35827. 'PacketSize' Yes '-' No
  35828. 'qXfer:auxv:read' No '-' Yes
  35829. 'qXfer:btrace:read' No '-' Yes
  35830. 'qXfer:btrace-conf:read' No '-' Yes
  35831. 'qXfer:exec-file:read' No '-' Yes
  35832. 'qXfer:features:read' No '-' Yes
  35833. 'qXfer:libraries:read' No '-' Yes
  35834. 'qXfer:libraries-svr4:read'No '-' Yes
  35835. 'augmented-libraries-svr4-read'No '-' No
  35836. 'qXfer:memory-map:read' No '-' Yes
  35837. 'qXfer:sdata:read' No '-' Yes
  35838. 'qXfer:siginfo:read' No '-' Yes
  35839. 'qXfer:siginfo:write' No '-' Yes
  35840. 'qXfer:threads:read' No '-' Yes
  35841. 'qXfer:traceframe-info:read'No '-' Yes
  35842. 'qXfer:uib:read' No '-' Yes
  35843. 'qXfer:fdpic:read' No '-' Yes
  35844. 'Qbtrace:off' Yes '-' Yes
  35845. 'Qbtrace:bts' Yes '-' Yes
  35846. 'Qbtrace:pt' Yes '-' Yes
  35847. 'Qbtrace-conf:bts:size' Yes '-' Yes
  35848. 'Qbtrace-conf:pt:size' Yes '-' Yes
  35849. 'QNonStop' No '-' Yes
  35850. 'QCatchSyscalls' No '-' Yes
  35851. 'QPassSignals' No '-' Yes
  35852. 'QStartNoAckMode' No '-' Yes
  35853. 'multiprocess' No '-' No
  35854. 'ConditionalBreakpoints' No '-' No
  35855. 'ConditionalTracepoints' No '-' No
  35856. 'ReverseContinue' No '-' No
  35857. 'ReverseStep' No '-' No
  35858. 'TracepointSource' No '-' No
  35859. 'QAgent' No '-' No
  35860. 'QAllow' No '-' No
  35861. 'QDisableRandomization' No '-' No
  35862. 'EnableDisableTracepoints'No '-' No
  35863. 'QTBuffer:size' No '-' No
  35864. 'tracenz' No '-' No
  35865. 'BreakpointCommands' No '-' No
  35866. 'swbreak' No '-' No
  35867. 'hwbreak' No '-' No
  35868. 'fork-events' No '-' No
  35869. 'vfork-events' No '-' No
  35870. 'exec-events' No '-' No
  35871. 'QThreadEvents' No '-' No
  35872. 'no-resumed' No '-' No
  35873. These are the currently defined stub features, in more detail:
  35874. 'PacketSize=BYTES'
  35875. The remote stub can accept packets up to at least BYTES in
  35876. length. GDB will send packets up to this size for bulk
  35877. transfers, and will never send larger packets. This is a
  35878. limit on the data characters in the packet, including the
  35879. frame and checksum. There is no trailing NUL byte in a remote
  35880. protocol packet; if the stub stores packets in a
  35881. NUL-terminated format, it should allow an extra byte in its
  35882. buffer for the NUL. If this stub feature is not supported, GDB
  35883. guesses based on the size of the 'g' packet response.
  35884. 'qXfer:auxv:read'
  35885. The remote stub understands the 'qXfer:auxv:read' packet
  35886. (*note qXfer auxiliary vector read::).
  35887. 'qXfer:btrace:read'
  35888. The remote stub understands the 'qXfer:btrace:read' packet
  35889. (*note qXfer btrace read::).
  35890. 'qXfer:btrace-conf:read'
  35891. The remote stub understands the 'qXfer:btrace-conf:read'
  35892. packet (*note qXfer btrace-conf read::).
  35893. 'qXfer:exec-file:read'
  35894. The remote stub understands the 'qXfer:exec-file:read' packet
  35895. (*note qXfer executable filename read::).
  35896. 'qXfer:features:read'
  35897. The remote stub understands the 'qXfer:features:read' packet
  35898. (*note qXfer target description read::).
  35899. 'qXfer:libraries:read'
  35900. The remote stub understands the 'qXfer:libraries:read' packet
  35901. (*note qXfer library list read::).
  35902. 'qXfer:libraries-svr4:read'
  35903. The remote stub understands the 'qXfer:libraries-svr4:read'
  35904. packet (*note qXfer svr4 library list read::).
  35905. 'augmented-libraries-svr4-read'
  35906. The remote stub understands the augmented form of the
  35907. 'qXfer:libraries-svr4:read' packet (*note qXfer svr4 library
  35908. list read::).
  35909. 'qXfer:memory-map:read'
  35910. The remote stub understands the 'qXfer:memory-map:read' packet
  35911. (*note qXfer memory map read::).
  35912. 'qXfer:sdata:read'
  35913. The remote stub understands the 'qXfer:sdata:read' packet
  35914. (*note qXfer sdata read::).
  35915. 'qXfer:siginfo:read'
  35916. The remote stub understands the 'qXfer:siginfo:read' packet
  35917. (*note qXfer siginfo read::).
  35918. 'qXfer:siginfo:write'
  35919. The remote stub understands the 'qXfer:siginfo:write' packet
  35920. (*note qXfer siginfo write::).
  35921. 'qXfer:threads:read'
  35922. The remote stub understands the 'qXfer:threads:read' packet
  35923. (*note qXfer threads read::).
  35924. 'qXfer:traceframe-info:read'
  35925. The remote stub understands the 'qXfer:traceframe-info:read'
  35926. packet (*note qXfer traceframe info read::).
  35927. 'qXfer:uib:read'
  35928. The remote stub understands the 'qXfer:uib:read' packet (*note
  35929. qXfer unwind info block::).
  35930. 'qXfer:fdpic:read'
  35931. The remote stub understands the 'qXfer:fdpic:read' packet
  35932. (*note qXfer fdpic loadmap read::).
  35933. 'QNonStop'
  35934. The remote stub understands the 'QNonStop' packet (*note
  35935. QNonStop::).
  35936. 'QCatchSyscalls'
  35937. The remote stub understands the 'QCatchSyscalls' packet (*note
  35938. QCatchSyscalls::).
  35939. 'QPassSignals'
  35940. The remote stub understands the 'QPassSignals' packet (*note
  35941. QPassSignals::).
  35942. 'QStartNoAckMode'
  35943. The remote stub understands the 'QStartNoAckMode' packet and
  35944. prefers to operate in no-acknowledgment mode. *Note Packet
  35945. Acknowledgment::.
  35946. 'multiprocess'
  35947. The remote stub understands the multiprocess extensions to the
  35948. remote protocol syntax. The multiprocess extensions affect
  35949. the syntax of thread IDs in both packets and replies (*note
  35950. thread-id syntax::), and add process IDs to the 'D' packet and
  35951. 'W' and 'X' replies. Note that reporting this feature
  35952. indicates support for the syntactic extensions only, not that
  35953. the stub necessarily supports debugging of more than one
  35954. process at a time. The stub must not use multiprocess
  35955. extensions in packet replies unless GDB has also indicated it
  35956. supports them in its 'qSupported' request.
  35957. 'qXfer:osdata:read'
  35958. The remote stub understands the 'qXfer:osdata:read' packet
  35959. ((*note qXfer osdata read::).
  35960. 'ConditionalBreakpoints'
  35961. The target accepts and implements evaluation of conditional
  35962. expressions defined for breakpoints. The target will only
  35963. report breakpoint triggers when such conditions are true
  35964. (*note Break Conditions: Conditions.).
  35965. 'ConditionalTracepoints'
  35966. The remote stub accepts and implements conditional expressions
  35967. defined for tracepoints (*note Tracepoint Conditions::).
  35968. 'ReverseContinue'
  35969. The remote stub accepts and implements the reverse continue
  35970. packet (*note bc::).
  35971. 'ReverseStep'
  35972. The remote stub accepts and implements the reverse step packet
  35973. (*note bs::).
  35974. 'TracepointSource'
  35975. The remote stub understands the 'QTDPsrc' packet that supplies
  35976. the source form of tracepoint definitions.
  35977. 'QAgent'
  35978. The remote stub understands the 'QAgent' packet.
  35979. 'QAllow'
  35980. The remote stub understands the 'QAllow' packet.
  35981. 'QDisableRandomization'
  35982. The remote stub understands the 'QDisableRandomization'
  35983. packet.
  35984. 'StaticTracepoint'
  35985. The remote stub supports static tracepoints.
  35986. 'InstallInTrace'
  35987. The remote stub supports installing tracepoint in tracing.
  35988. 'EnableDisableTracepoints'
  35989. The remote stub supports the 'QTEnable' (*note QTEnable::) and
  35990. 'QTDisable' (*note QTDisable::) packets that allow tracepoints
  35991. to be enabled and disabled while a trace experiment is
  35992. running.
  35993. 'QTBuffer:size'
  35994. The remote stub supports the 'QTBuffer:size' (*note
  35995. QTBuffer-size::) packet that allows to change the size of the
  35996. trace buffer.
  35997. 'tracenz'
  35998. The remote stub supports the 'tracenz' bytecode for collecting
  35999. strings. See *note Bytecode Descriptions:: for details about
  36000. the bytecode.
  36001. 'BreakpointCommands'
  36002. The remote stub supports running a breakpoint's command list
  36003. itself, rather than reporting the hit to GDB.
  36004. 'Qbtrace:off'
  36005. The remote stub understands the 'Qbtrace:off' packet.
  36006. 'Qbtrace:bts'
  36007. The remote stub understands the 'Qbtrace:bts' packet.
  36008. 'Qbtrace:pt'
  36009. The remote stub understands the 'Qbtrace:pt' packet.
  36010. 'Qbtrace-conf:bts:size'
  36011. The remote stub understands the 'Qbtrace-conf:bts:size'
  36012. packet.
  36013. 'Qbtrace-conf:pt:size'
  36014. The remote stub understands the 'Qbtrace-conf:pt:size' packet.
  36015. 'swbreak'
  36016. The remote stub reports the 'swbreak' stop reason for memory
  36017. breakpoints.
  36018. 'hwbreak'
  36019. The remote stub reports the 'hwbreak' stop reason for hardware
  36020. breakpoints.
  36021. 'fork-events'
  36022. The remote stub reports the 'fork' stop reason for fork
  36023. events.
  36024. 'vfork-events'
  36025. The remote stub reports the 'vfork' stop reason for vfork
  36026. events and vforkdone events.
  36027. 'exec-events'
  36028. The remote stub reports the 'exec' stop reason for exec
  36029. events.
  36030. 'vContSupported'
  36031. The remote stub reports the supported actions in the reply to
  36032. 'vCont?' packet.
  36033. 'QThreadEvents'
  36034. The remote stub understands the 'QThreadEvents' packet.
  36035. 'no-resumed'
  36036. The remote stub reports the 'N' stop reply.
  36037. 'qSymbol::'
  36038. Notify the target that GDB is prepared to serve symbol lookup
  36039. requests. Accept requests from the target for the values of
  36040. symbols.
  36041. Reply:
  36042. 'OK'
  36043. The target does not need to look up any (more) symbols.
  36044. 'qSymbol:SYM_NAME'
  36045. The target requests the value of symbol SYM_NAME (hex
  36046. encoded). GDB may provide the value by using the
  36047. 'qSymbol:SYM_VALUE:SYM_NAME' message, described below.
  36048. 'qSymbol:SYM_VALUE:SYM_NAME'
  36049. Set the value of SYM_NAME to SYM_VALUE.
  36050. SYM_NAME (hex encoded) is the name of a symbol whose value the
  36051. target has previously requested.
  36052. SYM_VALUE (hex) is the value for symbol SYM_NAME. If GDB cannot
  36053. supply a value for SYM_NAME, then this field will be empty.
  36054. Reply:
  36055. 'OK'
  36056. The target does not need to look up any (more) symbols.
  36057. 'qSymbol:SYM_NAME'
  36058. The target requests the value of a new symbol SYM_NAME (hex
  36059. encoded). GDB will continue to supply the values of symbols
  36060. (if available), until the target ceases to request them.
  36061. 'qTBuffer'
  36062. 'QTBuffer'
  36063. 'QTDisconnected'
  36064. 'QTDP'
  36065. 'QTDPsrc'
  36066. 'QTDV'
  36067. 'qTfP'
  36068. 'qTfV'
  36069. 'QTFrame'
  36070. 'qTMinFTPILen'
  36071. *Note Tracepoint Packets::.
  36072. 'qThreadExtraInfo,THREAD-ID'
  36073. Obtain from the target OS a printable string description of thread
  36074. attributes for the thread THREAD-ID; see *note thread-id syntax::,
  36075. for the forms of THREAD-ID. This string may contain anything that
  36076. the target OS thinks is interesting for GDB to tell the user about
  36077. the thread. The string is displayed in GDB's 'info threads'
  36078. display. Some examples of possible thread extra info strings are
  36079. 'Runnable', or 'Blocked on Mutex'.
  36080. Reply:
  36081. 'XX...'
  36082. Where 'XX...' is a hex encoding of ASCII data, comprising the
  36083. printable string containing the extra information about the
  36084. thread's attributes.
  36085. (Note that the 'qThreadExtraInfo' packet's name is separated from
  36086. the command by a ',', not a ':', contrary to the naming conventions
  36087. above. Please don't use this packet as a model for new packets.)
  36088. 'QTNotes'
  36089. 'qTP'
  36090. 'QTSave'
  36091. 'qTsP'
  36092. 'qTsV'
  36093. 'QTStart'
  36094. 'QTStop'
  36095. 'QTEnable'
  36096. 'QTDisable'
  36097. 'QTinit'
  36098. 'QTro'
  36099. 'qTStatus'
  36100. 'qTV'
  36101. 'qTfSTM'
  36102. 'qTsSTM'
  36103. 'qTSTMat'
  36104. *Note Tracepoint Packets::.
  36105. 'qXfer:OBJECT:read:ANNEX:OFFSET,LENGTH'
  36106. Read uninterpreted bytes from the target's special data area
  36107. identified by the keyword OBJECT. Request LENGTH bytes starting at
  36108. OFFSET bytes into the data. The content and encoding of ANNEX is
  36109. specific to OBJECT; it can supply additional details about what
  36110. data to access.
  36111. Reply:
  36112. 'm DATA'
  36113. Data DATA (*note Binary Data::) has been read from the target.
  36114. There may be more data at a higher address (although it is
  36115. permitted to return 'm' even for the last valid block of data,
  36116. as long as at least one byte of data was read). It is
  36117. possible for DATA to have fewer bytes than the LENGTH in the
  36118. request.
  36119. 'l DATA'
  36120. Data DATA (*note Binary Data::) has been read from the target.
  36121. There is no more data to be read. It is possible for DATA to
  36122. have fewer bytes than the LENGTH in the request.
  36123. 'l'
  36124. The OFFSET in the request is at the end of the data. There is
  36125. no more data to be read.
  36126. 'E00'
  36127. The request was malformed, or ANNEX was invalid.
  36128. 'E NN'
  36129. The offset was invalid, or there was an error encountered
  36130. reading the data. The NN part is a hex-encoded 'errno' value.
  36131. ''
  36132. An empty reply indicates the OBJECT string was not recognized
  36133. by the stub, or that the object does not support reading.
  36134. Here are the specific requests of this form defined so far. All
  36135. the 'qXfer:OBJECT:read:...' requests use the same reply formats,
  36136. listed above.
  36137. 'qXfer:auxv:read::OFFSET,LENGTH'
  36138. Access the target's "auxiliary vector". *Note auxiliary
  36139. vector: OS Information. Note ANNEX must be empty.
  36140. This packet is not probed by default; the remote stub must
  36141. request it, by supplying an appropriate 'qSupported' response
  36142. (*note qSupported::).
  36143. 'qXfer:btrace:read:ANNEX:OFFSET,LENGTH'
  36144. Return a description of the current branch trace. *Note
  36145. Branch Trace Format::. The annex part of the generic 'qXfer'
  36146. packet may have one of the following values:
  36147. 'all'
  36148. Returns all available branch trace.
  36149. 'new'
  36150. Returns all available branch trace if the branch trace
  36151. changed since the last read request.
  36152. 'delta'
  36153. Returns the new branch trace since the last read request.
  36154. Adds a new block to the end of the trace that begins at
  36155. zero and ends at the source location of the first branch
  36156. in the trace buffer. This extra block is used to stitch
  36157. traces together.
  36158. If the trace buffer overflowed, returns an error
  36159. indicating the overflow.
  36160. This packet is not probed by default; the remote stub must
  36161. request it by supplying an appropriate 'qSupported' response
  36162. (*note qSupported::).
  36163. 'qXfer:btrace-conf:read::OFFSET,LENGTH'
  36164. Return a description of the current branch trace
  36165. configuration. *Note Branch Trace Configuration Format::.
  36166. This packet is not probed by default; the remote stub must
  36167. request it by supplying an appropriate 'qSupported' response
  36168. (*note qSupported::).
  36169. 'qXfer:exec-file:read:ANNEX:OFFSET,LENGTH'
  36170. Return the full absolute name of the file that was executed to
  36171. create a process running on the remote system. The annex
  36172. specifies the numeric process ID of the process to query,
  36173. encoded as a hexadecimal number. If the annex part is empty
  36174. the remote stub should return the filename corresponding to
  36175. the currently executing process.
  36176. This packet is not probed by default; the remote stub must
  36177. request it, by supplying an appropriate 'qSupported' response
  36178. (*note qSupported::).
  36179. 'qXfer:features:read:ANNEX:OFFSET,LENGTH'
  36180. Access the "target description". *Note Target Descriptions::.
  36181. The annex specifies which XML document to access. The main
  36182. description is always loaded from the 'target.xml' annex.
  36183. This packet is not probed by default; the remote stub must
  36184. request it, by supplying an appropriate 'qSupported' response
  36185. (*note qSupported::).
  36186. 'qXfer:libraries:read:ANNEX:OFFSET,LENGTH'
  36187. Access the target's list of loaded libraries. *Note Library
  36188. List Format::. The annex part of the generic 'qXfer' packet
  36189. must be empty (*note qXfer read::).
  36190. Targets which maintain a list of libraries in the program's
  36191. memory do not need to implement this packet; it is designed
  36192. for platforms where the operating system manages the list of
  36193. loaded libraries.
  36194. This packet is not probed by default; the remote stub must
  36195. request it, by supplying an appropriate 'qSupported' response
  36196. (*note qSupported::).
  36197. 'qXfer:libraries-svr4:read:ANNEX:OFFSET,LENGTH'
  36198. Access the target's list of loaded libraries when the target
  36199. is an SVR4 platform. *Note Library List Format for SVR4
  36200. Targets::. The annex part of the generic 'qXfer' packet must
  36201. be empty unless the remote stub indicated it supports the
  36202. augmented form of this packet by supplying an appropriate
  36203. 'qSupported' response (*note qXfer read::, *note
  36204. qSupported::).
  36205. This packet is optional for better performance on SVR4
  36206. targets. GDB uses memory read packets to read the SVR4
  36207. library list otherwise.
  36208. This packet is not probed by default; the remote stub must
  36209. request it, by supplying an appropriate 'qSupported' response
  36210. (*note qSupported::).
  36211. If the remote stub indicates it supports the augmented form of
  36212. this packet then the annex part of the generic 'qXfer' packet
  36213. may contain a semicolon-separated list of 'NAME=VALUE'
  36214. arguments. The currently supported arguments are:
  36215. 'start=ADDRESS'
  36216. A hexadecimal number specifying the address of the
  36217. 'struct link_map' to start reading the library list from.
  36218. If unset or zero then the first 'struct link_map' in the
  36219. library list will be chosen as the starting point.
  36220. 'prev=ADDRESS'
  36221. A hexadecimal number specifying the address of the
  36222. 'struct link_map' immediately preceding the 'struct
  36223. link_map' specified by the 'start' argument. If unset or
  36224. zero then the remote stub will expect that no 'struct
  36225. link_map' exists prior to the starting point.
  36226. Arguments that are not understood by the remote stub will be
  36227. silently ignored.
  36228. 'qXfer:memory-map:read::OFFSET,LENGTH'
  36229. Access the target's "memory-map". *Note Memory Map Format::.
  36230. The annex part of the generic 'qXfer' packet must be empty
  36231. (*note qXfer read::).
  36232. This packet is not probed by default; the remote stub must
  36233. request it, by supplying an appropriate 'qSupported' response
  36234. (*note qSupported::).
  36235. 'qXfer:sdata:read::OFFSET,LENGTH'
  36236. Read contents of the extra collected static tracepoint marker
  36237. information. The annex part of the generic 'qXfer' packet
  36238. must be empty (*note qXfer read::). *Note Tracepoint Action
  36239. Lists: Tracepoint Actions.
  36240. This packet is not probed by default; the remote stub must
  36241. request it, by supplying an appropriate 'qSupported' response
  36242. (*note qSupported::).
  36243. 'qXfer:siginfo:read::OFFSET,LENGTH'
  36244. Read contents of the extra signal information on the target
  36245. system. The annex part of the generic 'qXfer' packet must be
  36246. empty (*note qXfer read::).
  36247. This packet is not probed by default; the remote stub must
  36248. request it, by supplying an appropriate 'qSupported' response
  36249. (*note qSupported::).
  36250. 'qXfer:threads:read::OFFSET,LENGTH'
  36251. Access the list of threads on target. *Note Thread List
  36252. Format::. The annex part of the generic 'qXfer' packet must
  36253. be empty (*note qXfer read::).
  36254. This packet is not probed by default; the remote stub must
  36255. request it, by supplying an appropriate 'qSupported' response
  36256. (*note qSupported::).
  36257. 'qXfer:traceframe-info:read::OFFSET,LENGTH'
  36258. Return a description of the current traceframe's contents.
  36259. *Note Traceframe Info Format::. The annex part of the generic
  36260. 'qXfer' packet must be empty (*note qXfer read::).
  36261. This packet is not probed by default; the remote stub must
  36262. request it, by supplying an appropriate 'qSupported' response
  36263. (*note qSupported::).
  36264. 'qXfer:uib:read:PC:OFFSET,LENGTH'
  36265. Return the unwind information block for PC. This packet is
  36266. used on OpenVMS/ia64 to ask the kernel unwind information.
  36267. This packet is not probed by default.
  36268. 'qXfer:fdpic:read:ANNEX:OFFSET,LENGTH'
  36269. Read contents of 'loadmap's on the target system. The annex,
  36270. either 'exec' or 'interp', specifies which 'loadmap',
  36271. executable 'loadmap' or interpreter 'loadmap' to read.
  36272. This packet is not probed by default; the remote stub must
  36273. request it, by supplying an appropriate 'qSupported' response
  36274. (*note qSupported::).
  36275. 'qXfer:osdata:read::OFFSET,LENGTH'
  36276. Access the target's "operating system information". *Note
  36277. Operating System Information::.
  36278. 'qXfer:OBJECT:write:ANNEX:OFFSET:DATA...'
  36279. Write uninterpreted bytes into the target's special data area
  36280. identified by the keyword OBJECT, starting at OFFSET bytes into the
  36281. data. The binary-encoded data (*note Binary Data::) to be written
  36282. is given by DATA.... The content and encoding of ANNEX is specific
  36283. to OBJECT; it can supply additional details about what data to
  36284. access.
  36285. Reply:
  36286. 'NN'
  36287. NN (hex encoded) is the number of bytes written. This may be
  36288. fewer bytes than supplied in the request.
  36289. 'E00'
  36290. The request was malformed, or ANNEX was invalid.
  36291. 'E NN'
  36292. The offset was invalid, or there was an error encountered
  36293. writing the data. The NN part is a hex-encoded 'errno' value.
  36294. ''
  36295. An empty reply indicates the OBJECT string was not recognized
  36296. by the stub, or that the object does not support writing.
  36297. Here are the specific requests of this form defined so far. All
  36298. the 'qXfer:OBJECT:write:...' requests use the same reply formats,
  36299. listed above.
  36300. 'qXfer:siginfo:write::OFFSET:DATA...'
  36301. Write DATA to the extra signal information on the target
  36302. system. The annex part of the generic 'qXfer' packet must be
  36303. empty (*note qXfer write::).
  36304. This packet is not probed by default; the remote stub must
  36305. request it, by supplying an appropriate 'qSupported' response
  36306. (*note qSupported::).
  36307. 'qXfer:OBJECT:OPERATION:...'
  36308. Requests of this form may be added in the future. When a stub does
  36309. not recognize the OBJECT keyword, or its support for OBJECT does
  36310. not recognize the OPERATION keyword, the stub must respond with an
  36311. empty packet.
  36312. 'qAttached:PID'
  36313. Return an indication of whether the remote server attached to an
  36314. existing process or created a new process. When the multiprocess
  36315. protocol extensions are supported (*note multiprocess
  36316. extensions::), PID is an integer in hexadecimal format identifying
  36317. the target process. Otherwise, GDB will omit the PID field and the
  36318. query packet will be simplified as 'qAttached'.
  36319. This query is used, for example, to know whether the remote process
  36320. should be detached or killed when a GDB session is ended with the
  36321. 'quit' command.
  36322. Reply:
  36323. '1'
  36324. The remote server attached to an existing process.
  36325. '0'
  36326. The remote server created a new process.
  36327. 'E NN'
  36328. A badly formed request or an error was encountered.
  36329. 'Qbtrace:bts'
  36330. Enable branch tracing for the current thread using Branch Trace
  36331. Store.
  36332. Reply:
  36333. 'OK'
  36334. Branch tracing has been enabled.
  36335. 'E.errtext'
  36336. A badly formed request or an error was encountered.
  36337. 'Qbtrace:pt'
  36338. Enable branch tracing for the current thread using Intel Processor
  36339. Trace.
  36340. Reply:
  36341. 'OK'
  36342. Branch tracing has been enabled.
  36343. 'E.errtext'
  36344. A badly formed request or an error was encountered.
  36345. 'Qbtrace:off'
  36346. Disable branch tracing for the current thread.
  36347. Reply:
  36348. 'OK'
  36349. Branch tracing has been disabled.
  36350. 'E.errtext'
  36351. A badly formed request or an error was encountered.
  36352. 'Qbtrace-conf:bts:size=VALUE'
  36353. Set the requested ring buffer size for new threads that use the
  36354. btrace recording method in bts format.
  36355. Reply:
  36356. 'OK'
  36357. The ring buffer size has been set.
  36358. 'E.errtext'
  36359. A badly formed request or an error was encountered.
  36360. 'Qbtrace-conf:pt:size=VALUE'
  36361. Set the requested ring buffer size for new threads that use the
  36362. btrace recording method in pt format.
  36363. Reply:
  36364. 'OK'
  36365. The ring buffer size has been set.
  36366. 'E.errtext'
  36367. A badly formed request or an error was encountered.
  36368. ---------- Footnotes ----------
  36369. (1) The 'qP' and 'qL' packets predate these conventions, and have
  36370. arguments without any terminator for the packet name; we suspect they
  36371. are in widespread use in places that are difficult to upgrade. The 'qC'
  36372. packet has no arguments, but some existing stubs (e.g. RedBoot) are
  36373. known to not check for the end of the packet.
  36374. 
  36375. File: gdb.info, Node: Architecture-Specific Protocol Details, Next: Tracepoint Packets, Prev: General Query Packets, Up: Remote Protocol
  36376. E.5 Architecture-Specific Protocol Details
  36377. ==========================================
  36378. This section describes how the remote protocol is applied to specific
  36379. target architectures. Also see *note Standard Target Features::, for
  36380. details of XML target descriptions for each architecture.
  36381. * Menu:
  36382. * ARM-Specific Protocol Details::
  36383. * MIPS-Specific Protocol Details::
  36384. 
  36385. File: gdb.info, Node: ARM-Specific Protocol Details, Next: MIPS-Specific Protocol Details, Up: Architecture-Specific Protocol Details
  36386. E.5.1 ARM-specific Protocol Details
  36387. -----------------------------------
  36388. * Menu:
  36389. * ARM Breakpoint Kinds::
  36390. 
  36391. File: gdb.info, Node: ARM Breakpoint Kinds, Up: ARM-Specific Protocol Details
  36392. E.5.1.1 ARM Breakpoint Kinds
  36393. ............................
  36394. These breakpoint kinds are defined for the 'Z0' and 'Z1' packets.
  36395. 2
  36396. 16-bit Thumb mode breakpoint.
  36397. 3
  36398. 32-bit Thumb mode (Thumb-2) breakpoint.
  36399. 4
  36400. 32-bit ARM mode breakpoint.
  36401. 
  36402. File: gdb.info, Node: MIPS-Specific Protocol Details, Prev: ARM-Specific Protocol Details, Up: Architecture-Specific Protocol Details
  36403. E.5.2 MIPS-specific Protocol Details
  36404. ------------------------------------
  36405. * Menu:
  36406. * MIPS Register packet Format::
  36407. * MIPS Breakpoint Kinds::
  36408. 
  36409. File: gdb.info, Node: MIPS Register packet Format, Next: MIPS Breakpoint Kinds, Up: MIPS-Specific Protocol Details
  36410. E.5.2.1 MIPS Register Packet Format
  36411. ...................................
  36412. The following 'g'/'G' packets have previously been defined. In the
  36413. below, some thirty-two bit registers are transferred as sixty-four bits.
  36414. Those registers should be zero/sign extended (which?) to fill the space
  36415. allocated. Register bytes are transferred in target byte order. The
  36416. two nibbles within a register byte are transferred most-significant -
  36417. least-significant.
  36418. MIPS32
  36419. All registers are transferred as thirty-two bit quantities in the
  36420. order: 32 general-purpose; sr; lo; hi; bad; cause; pc; 32
  36421. floating-point registers; fsr; fir; fp.
  36422. MIPS64
  36423. All registers are transferred as sixty-four bit quantities
  36424. (including thirty-two bit registers such as 'sr'). The ordering is
  36425. the same as 'MIPS32'.
  36426. 
  36427. File: gdb.info, Node: MIPS Breakpoint Kinds, Prev: MIPS Register packet Format, Up: MIPS-Specific Protocol Details
  36428. E.5.2.2 MIPS Breakpoint Kinds
  36429. .............................
  36430. These breakpoint kinds are defined for the 'Z0' and 'Z1' packets.
  36431. 2
  36432. 16-bit MIPS16 mode breakpoint.
  36433. 3
  36434. 16-bit microMIPS mode breakpoint.
  36435. 4
  36436. 32-bit standard MIPS mode breakpoint.
  36437. 5
  36438. 32-bit microMIPS mode breakpoint.
  36439. 
  36440. File: gdb.info, Node: Tracepoint Packets, Next: Host I/O Packets, Prev: Architecture-Specific Protocol Details, Up: Remote Protocol
  36441. E.6 Tracepoint Packets
  36442. ======================
  36443. Here we describe the packets GDB uses to implement tracepoints (*note
  36444. Tracepoints::).
  36445. 'QTDP:N:ADDR:ENA:STEP:PASS[:FFLEN][:XLEN,BYTES][-]'
  36446. Create a new tracepoint, number N, at ADDR. If ENA is 'E', then
  36447. the tracepoint is enabled; if it is 'D', then the tracepoint is
  36448. disabled. The STEP gives the tracepoint's step count, and PASS
  36449. gives its pass count. If an 'F' is present, then the tracepoint is
  36450. to be a fast tracepoint, and the FLEN is the number of bytes that
  36451. the target should copy elsewhere to make room for the tracepoint.
  36452. If an 'X' is present, it introduces a tracepoint condition, which
  36453. consists of a hexadecimal length, followed by a comma and
  36454. hex-encoded bytes, in a manner similar to action encodings as
  36455. described below. If the trailing '-' is present, further 'QTDP'
  36456. packets will follow to specify this tracepoint's actions.
  36457. Replies:
  36458. 'OK'
  36459. The packet was understood and carried out.
  36460. 'qRelocInsn'
  36461. *Note Relocate instruction reply packet: Tracepoint Packets.
  36462. ''
  36463. The packet was not recognized.
  36464. 'QTDP:-N:ADDR:[S]ACTION...[-]'
  36465. Define actions to be taken when a tracepoint is hit. The N and
  36466. ADDR must be the same as in the initial 'QTDP' packet for this
  36467. tracepoint. This packet may only be sent immediately after another
  36468. 'QTDP' packet that ended with a '-'. If the trailing '-' is
  36469. present, further 'QTDP' packets will follow, specifying more
  36470. actions for this tracepoint.
  36471. In the series of action packets for a given tracepoint, at most one
  36472. can have an 'S' before its first ACTION. If such a packet is sent,
  36473. it and the following packets define "while-stepping" actions. Any
  36474. prior packets define ordinary actions -- that is, those taken when
  36475. the tracepoint is first hit. If no action packet has an 'S', then
  36476. all the packets in the series specify ordinary tracepoint actions.
  36477. The 'ACTION...' portion of the packet is a series of actions,
  36478. concatenated without separators. Each action has one of the
  36479. following forms:
  36480. 'R MASK'
  36481. Collect the registers whose bits are set in MASK, a
  36482. hexadecimal number whose I'th bit is set if register number I
  36483. should be collected. (The least significant bit is numbered
  36484. zero.) Note that MASK may be any number of digits long; it
  36485. may not fit in a 32-bit word.
  36486. 'M BASEREG,OFFSET,LEN'
  36487. Collect LEN bytes of memory starting at the address in
  36488. register number BASEREG, plus OFFSET. If BASEREG is '-1',
  36489. then the range has a fixed address: OFFSET is the address of
  36490. the lowest byte to collect. The BASEREG, OFFSET, and LEN
  36491. parameters are all unsigned hexadecimal values (the '-1' value
  36492. for BASEREG is a special case).
  36493. 'X LEN,EXPR'
  36494. Evaluate EXPR, whose length is LEN, and collect memory as it
  36495. directs. The agent expression EXPR is as described in *note
  36496. Agent Expressions::. Each byte of the expression is encoded
  36497. as a two-digit hex number in the packet; LEN is the number of
  36498. bytes in the expression (and thus one-half the number of hex
  36499. digits in the packet).
  36500. Any number of actions may be packed together in a single 'QTDP'
  36501. packet, as long as the packet does not exceed the maximum packet
  36502. length (400 bytes, for many stubs). There may be only one 'R'
  36503. action per tracepoint, and it must precede any 'M' or 'X' actions.
  36504. Any registers referred to by 'M' and 'X' actions must be collected
  36505. by a preceding 'R' action. (The "while-stepping" actions are
  36506. treated as if they were attached to a separate tracepoint, as far
  36507. as these restrictions are concerned.)
  36508. Replies:
  36509. 'OK'
  36510. The packet was understood and carried out.
  36511. 'qRelocInsn'
  36512. *Note Relocate instruction reply packet: Tracepoint Packets.
  36513. ''
  36514. The packet was not recognized.
  36515. 'QTDPsrc:N:ADDR:TYPE:START:SLEN:BYTES'
  36516. Specify a source string of tracepoint N at address ADDR. This is
  36517. useful to get accurate reproduction of the tracepoints originally
  36518. downloaded at the beginning of the trace run. The TYPE is the name
  36519. of the tracepoint part, such as 'cond' for the tracepoint's
  36520. conditional expression (see below for a list of types), while BYTES
  36521. is the string, encoded in hexadecimal.
  36522. START is the offset of the BYTES within the overall source string,
  36523. while SLEN is the total length of the source string. This is
  36524. intended for handling source strings that are longer than will fit
  36525. in a single packet.
  36526. The available string types are 'at' for the location, 'cond' for
  36527. the conditional, and 'cmd' for an action command. GDB sends a
  36528. separate packet for each command in the action list, in the same
  36529. order in which the commands are stored in the list.
  36530. The target does not need to do anything with source strings except
  36531. report them back as part of the replies to the 'qTfP'/'qTsP' query
  36532. packets.
  36533. Although this packet is optional, and GDB will only send it if the
  36534. target replies with 'TracepointSource' *Note General Query
  36535. Packets::, it makes both disconnected tracing and trace files much
  36536. easier to use. Otherwise the user must be careful that the
  36537. tracepoints in effect while looking at trace frames are identical
  36538. to the ones in effect during the trace run; even a small
  36539. discrepancy could cause 'tdump' not to work, or a particular trace
  36540. frame not be found.
  36541. 'QTDV:N:VALUE:BUILTIN:NAME'
  36542. Create a new trace state variable, number N, with an initial value
  36543. of VALUE, which is a 64-bit signed integer. Both N and VALUE are
  36544. encoded as hexadecimal values. GDB has the option of not using
  36545. this packet for initial values of zero; the target should simply
  36546. create the trace state variables as they are mentioned in
  36547. expressions. The value BUILTIN should be 1 (one) if the trace
  36548. state variable is builtin and 0 (zero) if it is not builtin. GDB
  36549. only sets BUILTIN to 1 if a previous 'qTfV' or 'qTsV' packet had it
  36550. set. The contents of NAME is the hex-encoded name (without the
  36551. leading '$') of the trace state variable.
  36552. 'QTFrame:N'
  36553. Select the N'th tracepoint frame from the buffer, and use the
  36554. register and memory contents recorded there to answer subsequent
  36555. request packets from GDB.
  36556. A successful reply from the stub indicates that the stub has found
  36557. the requested frame. The response is a series of parts,
  36558. concatenated without separators, describing the frame we selected.
  36559. Each part has one of the following forms:
  36560. 'F F'
  36561. The selected frame is number N in the trace frame buffer; F is
  36562. a hexadecimal number. If F is '-1', then there was no frame
  36563. matching the criteria in the request packet.
  36564. 'T T'
  36565. The selected trace frame records a hit of tracepoint number T;
  36566. T is a hexadecimal number.
  36567. 'QTFrame:pc:ADDR'
  36568. Like 'QTFrame:N', but select the first tracepoint frame after the
  36569. currently selected frame whose PC is ADDR; ADDR is a hexadecimal
  36570. number.
  36571. 'QTFrame:tdp:T'
  36572. Like 'QTFrame:N', but select the first tracepoint frame after the
  36573. currently selected frame that is a hit of tracepoint T; T is a
  36574. hexadecimal number.
  36575. 'QTFrame:range:START:END'
  36576. Like 'QTFrame:N', but select the first tracepoint frame after the
  36577. currently selected frame whose PC is between START (inclusive) and
  36578. END (inclusive); START and END are hexadecimal numbers.
  36579. 'QTFrame:outside:START:END'
  36580. Like 'QTFrame:range:START:END', but select the first frame
  36581. _outside_ the given range of addresses (exclusive).
  36582. 'qTMinFTPILen'
  36583. This packet requests the minimum length of instruction at which a
  36584. fast tracepoint (*note Set Tracepoints::) may be placed. For
  36585. instance, on the 32-bit x86 architecture, it is possible to use a
  36586. 4-byte jump, but it depends on the target system being able to
  36587. create trampolines in the first 64K of memory, which might or might
  36588. not be possible for that system. So the reply to this packet will
  36589. be 4 if it is able to arrange for that.
  36590. Replies:
  36591. '0'
  36592. The minimum instruction length is currently unknown.
  36593. 'LENGTH'
  36594. The minimum instruction length is LENGTH, where LENGTH is a
  36595. hexadecimal number greater or equal to 1. A reply of 1 means
  36596. that a fast tracepoint may be placed on any instruction
  36597. regardless of size.
  36598. 'E'
  36599. An error has occurred.
  36600. ''
  36601. An empty reply indicates that the request is not supported by
  36602. the stub.
  36603. 'QTStart'
  36604. Begin the tracepoint experiment. Begin collecting data from
  36605. tracepoint hits in the trace frame buffer. This packet supports
  36606. the 'qRelocInsn' reply (*note Relocate instruction reply packet:
  36607. Tracepoint Packets.).
  36608. 'QTStop'
  36609. End the tracepoint experiment. Stop collecting trace frames.
  36610. 'QTEnable:N:ADDR'
  36611. Enable tracepoint N at address ADDR in a started tracepoint
  36612. experiment. If the tracepoint was previously disabled, then
  36613. collection of data from it will resume.
  36614. 'QTDisable:N:ADDR'
  36615. Disable tracepoint N at address ADDR in a started tracepoint
  36616. experiment. No more data will be collected from the tracepoint
  36617. unless 'QTEnable:N:ADDR' is subsequently issued.
  36618. 'QTinit'
  36619. Clear the table of tracepoints, and empty the trace frame buffer.
  36620. 'QTro:START1,END1:START2,END2:...'
  36621. Establish the given ranges of memory as "transparent". The stub
  36622. will answer requests for these ranges from memory's current
  36623. contents, if they were not collected as part of the tracepoint hit.
  36624. GDB uses this to mark read-only regions of memory, like those
  36625. containing program code. Since these areas never change, they
  36626. should still have the same contents they did when the tracepoint
  36627. was hit, so there's no reason for the stub to refuse to provide
  36628. their contents.
  36629. 'QTDisconnected:VALUE'
  36630. Set the choice to what to do with the tracing run when GDB
  36631. disconnects from the target. A VALUE of 1 directs the target to
  36632. continue the tracing run, while 0 tells the target to stop tracing
  36633. if GDB is no longer in the picture.
  36634. 'qTStatus'
  36635. Ask the stub if there is a trace experiment running right now.
  36636. The reply has the form:
  36637. 'TRUNNING[;FIELD]...'
  36638. RUNNING is a single digit '1' if the trace is presently
  36639. running, or '0' if not. It is followed by semicolon-separated
  36640. optional fields that an agent may use to report additional
  36641. status.
  36642. If the trace is not running, the agent may report any of several
  36643. explanations as one of the optional fields:
  36644. 'tnotrun:0'
  36645. No trace has been run yet.
  36646. 'tstop[:TEXT]:0'
  36647. The trace was stopped by a user-originated stop command. The
  36648. optional TEXT field is a user-supplied string supplied as part
  36649. of the stop command (for instance, an explanation of why the
  36650. trace was stopped manually). It is hex-encoded.
  36651. 'tfull:0'
  36652. The trace stopped because the trace buffer filled up.
  36653. 'tdisconnected:0'
  36654. The trace stopped because GDB disconnected from the target.
  36655. 'tpasscount:TPNUM'
  36656. The trace stopped because tracepoint TPNUM exceeded its pass
  36657. count.
  36658. 'terror:TEXT:TPNUM'
  36659. The trace stopped because tracepoint TPNUM had an error. The
  36660. string TEXT is available to describe the nature of the error
  36661. (for instance, a divide by zero in the condition expression);
  36662. it is hex encoded.
  36663. 'tunknown:0'
  36664. The trace stopped for some other reason.
  36665. Additional optional fields supply statistical and other
  36666. information. Although not required, they are extremely useful for
  36667. users monitoring the progress of a trace run. If a trace has
  36668. stopped, and these numbers are reported, they must reflect the
  36669. state of the just-stopped trace.
  36670. 'tframes:N'
  36671. The number of trace frames in the buffer.
  36672. 'tcreated:N'
  36673. The total number of trace frames created during the run. This
  36674. may be larger than the trace frame count, if the buffer is
  36675. circular.
  36676. 'tsize:N'
  36677. The total size of the trace buffer, in bytes.
  36678. 'tfree:N'
  36679. The number of bytes still unused in the buffer.
  36680. 'circular:N'
  36681. The value of the circular trace buffer flag. '1' means that
  36682. the trace buffer is circular and old trace frames will be
  36683. discarded if necessary to make room, '0' means that the trace
  36684. buffer is linear and may fill up.
  36685. 'disconn:N'
  36686. The value of the disconnected tracing flag. '1' means that
  36687. tracing will continue after GDB disconnects, '0' means that
  36688. the trace run will stop.
  36689. 'qTP:TP:ADDR'
  36690. Ask the stub for the current state of tracepoint number TP at
  36691. address ADDR.
  36692. Replies:
  36693. 'VHITS:USAGE'
  36694. The tracepoint has been hit HITS times so far during the trace
  36695. run, and accounts for USAGE in the trace buffer. Note that
  36696. 'while-stepping' steps are not counted as separate hits, but
  36697. the steps' space consumption is added into the usage number.
  36698. 'qTV:VAR'
  36699. Ask the stub for the value of the trace state variable number VAR.
  36700. Replies:
  36701. 'VVALUE'
  36702. The value of the variable is VALUE. This will be the current
  36703. value of the variable if the user is examining a running
  36704. target, or a saved value if the variable was collected in the
  36705. trace frame that the user is looking at. Note that multiple
  36706. requests may result in different reply values, such as when
  36707. requesting values while the program is running.
  36708. 'U'
  36709. The value of the variable is unknown. This would occur, for
  36710. example, if the user is examining a trace frame in which the
  36711. requested variable was not collected.
  36712. 'qTfP'
  36713. 'qTsP'
  36714. These packets request data about tracepoints that are being used by
  36715. the target. GDB sends 'qTfP' to get the first piece of data, and
  36716. multiple 'qTsP' to get additional pieces. Replies to these packets
  36717. generally take the form of the 'QTDP' packets that define
  36718. tracepoints. (FIXME add detailed syntax)
  36719. 'qTfV'
  36720. 'qTsV'
  36721. These packets request data about trace state variables that are on
  36722. the target. GDB sends 'qTfV' to get the first vari of data, and
  36723. multiple 'qTsV' to get additional variables. Replies to these
  36724. packets follow the syntax of the 'QTDV' packets that define trace
  36725. state variables.
  36726. 'qTfSTM'
  36727. 'qTsSTM'
  36728. These packets request data about static tracepoint markers that
  36729. exist in the target program. GDB sends 'qTfSTM' to get the first
  36730. piece of data, and multiple 'qTsSTM' to get additional pieces.
  36731. Replies to these packets take the following form:
  36732. Reply:
  36733. 'm ADDRESS:ID:EXTRA'
  36734. A single marker
  36735. 'm ADDRESS:ID:EXTRA,ADDRESS:ID:EXTRA...'
  36736. a comma-separated list of markers
  36737. 'l'
  36738. (lower case letter 'L') denotes end of list.
  36739. 'E NN'
  36740. An error occurred. The error number NN is given as hex
  36741. digits.
  36742. ''
  36743. An empty reply indicates that the request is not supported by
  36744. the stub.
  36745. The ADDRESS is encoded in hex; ID and EXTRA are strings encoded in
  36746. hex.
  36747. In response to each query, the target will reply with a list of one
  36748. or more markers, separated by commas. GDB will respond to each
  36749. reply with a request for more markers (using the 'qs' form of the
  36750. query), until the target responds with 'l' (lower-case ell, for
  36751. "last").
  36752. 'qTSTMat:ADDRESS'
  36753. This packets requests data about static tracepoint markers in the
  36754. target program at ADDRESS. Replies to this packet follow the
  36755. syntax of the 'qTfSTM' and 'qTsSTM' packets that list static
  36756. tracepoint markers.
  36757. 'QTSave:FILENAME'
  36758. This packet directs the target to save trace data to the file name
  36759. FILENAME in the target's filesystem. The FILENAME is encoded as a
  36760. hex string; the interpretation of the file name (relative vs
  36761. absolute, wild cards, etc) is up to the target.
  36762. 'qTBuffer:OFFSET,LEN'
  36763. Return up to LEN bytes of the current contents of trace buffer,
  36764. starting at OFFSET. The trace buffer is treated as if it were a
  36765. contiguous collection of traceframes, as per the trace file format.
  36766. The reply consists as many hex-encoded bytes as the target can
  36767. deliver in a packet; it is not an error to return fewer than were
  36768. asked for. A reply consisting of just 'l' indicates that no bytes
  36769. are available.
  36770. 'QTBuffer:circular:VALUE'
  36771. This packet directs the target to use a circular trace buffer if
  36772. VALUE is 1, or a linear buffer if the value is 0.
  36773. 'QTBuffer:size:SIZE'
  36774. This packet directs the target to make the trace buffer be of size
  36775. SIZE if possible. A value of '-1' tells the target to use whatever
  36776. size it prefers.
  36777. 'QTNotes:[TYPE:TEXT][;TYPE:TEXT]...'
  36778. This packet adds optional textual notes to the trace run.
  36779. Allowable types include 'user', 'notes', and 'tstop', the TEXT
  36780. fields are arbitrary strings, hex-encoded.
  36781. E.6.1 Relocate instruction reply packet
  36782. ---------------------------------------
  36783. When installing fast tracepoints in memory, the target may need to
  36784. relocate the instruction currently at the tracepoint address to a
  36785. different address in memory. For most instructions, a simple copy is
  36786. enough, but, for example, call instructions that implicitly push the
  36787. return address on the stack, and relative branches or other PC-relative
  36788. instructions require offset adjustment, so that the effect of executing
  36789. the instruction at a different address is the same as if it had executed
  36790. in the original location.
  36791. In response to several of the tracepoint packets, the target may also
  36792. respond with a number of intermediate 'qRelocInsn' request packets
  36793. before the final result packet, to have GDB handle this relocation
  36794. operation. If a packet supports this mechanism, its documentation will
  36795. explicitly say so. See for example the above descriptions for the
  36796. 'QTStart' and 'QTDP' packets. The format of the request is:
  36797. 'qRelocInsn:FROM;TO'
  36798. This requests GDB to copy instruction at address FROM to address
  36799. TO, possibly adjusted so that executing the instruction at TO has
  36800. the same effect as executing it at FROM. GDB writes the adjusted
  36801. instruction to target memory starting at TO.
  36802. Replies:
  36803. 'qRelocInsn:ADJUSTED_SIZE'
  36804. Informs the stub the relocation is complete. The ADJUSTED_SIZE is
  36805. the length in bytes of resulting relocated instruction sequence.
  36806. 'E NN'
  36807. A badly formed request was detected, or an error was encountered
  36808. while relocating the instruction.
  36809. 
  36810. File: gdb.info, Node: Host I/O Packets, Next: Interrupts, Prev: Tracepoint Packets, Up: Remote Protocol
  36811. E.7 Host I/O Packets
  36812. ====================
  36813. The "Host I/O" packets allow GDB to perform I/O operations on the far
  36814. side of a remote link. For example, Host I/O is used to upload and
  36815. download files to a remote target with its own filesystem. Host I/O
  36816. uses the same constant values and data structure layout as the
  36817. target-initiated File-I/O protocol. However, the Host I/O packets are
  36818. structured differently. The target-initiated protocol relies on target
  36819. memory to store parameters and buffers. Host I/O requests are initiated
  36820. by GDB, and the target's memory is not involved. *Note File-I/O Remote
  36821. Protocol Extension::, for more details on the target-initiated protocol.
  36822. The Host I/O request packets all encode a single operation along with
  36823. its arguments. They have this format:
  36824. 'vFile:OPERATION: PARAMETER...'
  36825. OPERATION is the name of the particular request; the target should
  36826. compare the entire packet name up to the second colon when checking
  36827. for a supported operation. The format of PARAMETER depends on the
  36828. operation. Numbers are always passed in hexadecimal. Negative
  36829. numbers have an explicit minus sign (i.e. two's complement is not
  36830. used). Strings (e.g. filenames) are encoded as a series of
  36831. hexadecimal bytes. The last argument to a system call may be a
  36832. buffer of escaped binary data (*note Binary Data::).
  36833. The valid responses to Host I/O packets are:
  36834. 'F RESULT [, ERRNO] [; ATTACHMENT]'
  36835. RESULT is the integer value returned by this operation, usually
  36836. non-negative for success and -1 for errors. If an error has
  36837. occured, ERRNO will be included in the result specifying a value
  36838. defined by the File-I/O protocol (*note Errno Values::). For
  36839. operations which return data, ATTACHMENT supplies the data as a
  36840. binary buffer. Binary buffers in response packets are escaped in
  36841. the normal way (*note Binary Data::). See the individual packet
  36842. documentation for the interpretation of RESULT and ATTACHMENT.
  36843. ''
  36844. An empty response indicates that this operation is not recognized.
  36845. These are the supported Host I/O operations:
  36846. 'vFile:open: FILENAME, FLAGS, MODE'
  36847. Open a file at FILENAME and return a file descriptor for it, or
  36848. return -1 if an error occurs. The FILENAME is a string, FLAGS is
  36849. an integer indicating a mask of open flags (*note Open Flags::),
  36850. and MODE is an integer indicating a mask of mode bits to use if the
  36851. file is created (*note mode_t Values::). *Note open::, for details
  36852. of the open flags and mode values.
  36853. 'vFile:close: FD'
  36854. Close the open file corresponding to FD and return 0, or -1 if an
  36855. error occurs.
  36856. 'vFile:pread: FD, COUNT, OFFSET'
  36857. Read data from the open file corresponding to FD. Up to COUNT
  36858. bytes will be read from the file, starting at OFFSET relative to
  36859. the start of the file. The target may read fewer bytes; common
  36860. reasons include packet size limits and an end-of-file condition.
  36861. The number of bytes read is returned. Zero should only be returned
  36862. for a successful read at the end of the file, or if COUNT was zero.
  36863. The data read should be returned as a binary attachment on success.
  36864. If zero bytes were read, the response should include an empty
  36865. binary attachment (i.e. a trailing semicolon). The return value is
  36866. the number of target bytes read; the binary attachment may be
  36867. longer if some characters were escaped.
  36868. 'vFile:pwrite: FD, OFFSET, DATA'
  36869. Write DATA (a binary buffer) to the open file corresponding to FD.
  36870. Start the write at OFFSET from the start of the file. Unlike many
  36871. 'write' system calls, there is no separate COUNT argument; the
  36872. length of DATA in the packet is used. 'vFile:pwrite' returns the
  36873. number of bytes written, which may be shorter than the length of
  36874. DATA, or -1 if an error occurred.
  36875. 'vFile:fstat: FD'
  36876. Get information about the open file corresponding to FD. On
  36877. success the information is returned as a binary attachment and the
  36878. return value is the size of this attachment in bytes. If an error
  36879. occurs the return value is -1. The format of the returned binary
  36880. attachment is as described in *note struct stat::.
  36881. 'vFile:unlink: FILENAME'
  36882. Delete the file at FILENAME on the target. Return 0, or -1 if an
  36883. error occurs. The FILENAME is a string.
  36884. 'vFile:readlink: FILENAME'
  36885. Read value of symbolic link FILENAME on the target. Return the
  36886. number of bytes read, or -1 if an error occurs.
  36887. The data read should be returned as a binary attachment on success.
  36888. If zero bytes were read, the response should include an empty
  36889. binary attachment (i.e. a trailing semicolon). The return value is
  36890. the number of target bytes read; the binary attachment may be
  36891. longer if some characters were escaped.
  36892. 'vFile:setfs: PID'
  36893. Select the filesystem on which 'vFile' operations with FILENAME
  36894. arguments will operate. This is required for GDB to be able to
  36895. access files on remote targets where the remote stub does not share
  36896. a common filesystem with the inferior(s).
  36897. If PID is nonzero, select the filesystem as seen by process PID.
  36898. If PID is zero, select the filesystem as seen by the remote stub.
  36899. Return 0 on success, or -1 if an error occurs. If 'vFile:setfs:'
  36900. indicates success, the selected filesystem remains selected until
  36901. the next successful 'vFile:setfs:' operation.
  36902. 
  36903. File: gdb.info, Node: Interrupts, Next: Notification Packets, Prev: Host I/O Packets, Up: Remote Protocol
  36904. E.8 Interrupts
  36905. ==============
  36906. In all-stop mode, when a program on the remote target is running, GDB
  36907. may attempt to interrupt it by sending a 'Ctrl-C', 'BREAK' or a 'BREAK'
  36908. followed by 'g', control of which is specified via GDB's
  36909. 'interrupt-sequence'.
  36910. The precise meaning of 'BREAK' is defined by the transport mechanism
  36911. and may, in fact, be undefined. GDB does not currently define a 'BREAK'
  36912. mechanism for any of the network interfaces except for TCP, in which
  36913. case GDB sends the 'telnet' BREAK sequence.
  36914. 'Ctrl-C', on the other hand, is defined and implemented for all
  36915. transport mechanisms. It is represented by sending the single byte
  36916. '0x03' without any of the usual packet overhead described in the
  36917. Overview section (*note Overview::). When a '0x03' byte is transmitted
  36918. as part of a packet, it is considered to be packet data and does _not_
  36919. represent an interrupt. E.g., an 'X' packet (*note X packet::), used
  36920. for binary downloads, may include an unescaped '0x03' as part of its
  36921. packet.
  36922. 'BREAK' followed by 'g' is also known as Magic SysRq g. When Linux
  36923. kernel receives this sequence from serial port, it stops execution and
  36924. connects to gdb.
  36925. In non-stop mode, because packet resumptions are asynchronous (*note
  36926. vCont packet::), GDB is always free to send a remote command to the
  36927. remote stub, even when the target is running. For that reason, GDB
  36928. instead sends a regular packet (*note vCtrlC packet::) with the usual
  36929. packet framing instead of the single byte '0x03'.
  36930. Stubs are not required to recognize these interrupt mechanisms and
  36931. the precise meaning associated with receipt of the interrupt is
  36932. implementation defined. If the target supports debugging of multiple
  36933. threads and/or processes, it should attempt to interrupt all
  36934. currently-executing threads and processes. If the stub is successful at
  36935. interrupting the running program, it should send one of the stop reply
  36936. packets (*note Stop Reply Packets::) to GDB as a result of successfully
  36937. stopping the program in all-stop mode, and a stop reply for each stopped
  36938. thread in non-stop mode. Interrupts received while the program is
  36939. stopped are queued and the program will be interrupted when it is
  36940. resumed next time.
  36941. 
  36942. File: gdb.info, Node: Notification Packets, Next: Remote Non-Stop, Prev: Interrupts, Up: Remote Protocol
  36943. E.9 Notification Packets
  36944. ========================
  36945. The GDB remote serial protocol includes "notifications", packets that
  36946. require no acknowledgment. Both the GDB and the stub may send
  36947. notifications (although the only notifications defined at present are
  36948. sent by the stub). Notifications carry information without incurring
  36949. the round-trip latency of an acknowledgment, and so are useful for
  36950. low-impact communications where occasional packet loss is not a problem.
  36951. A notification packet has the form '% DATA # CHECKSUM', where DATA is
  36952. the content of the notification, and CHECKSUM is a checksum of DATA,
  36953. computed and formatted as for ordinary GDB packets. A notification's
  36954. DATA never contains '$', '%' or '#' characters. Upon receiving a
  36955. notification, the recipient sends no '+' or '-' to acknowledge the
  36956. notification's receipt or to report its corruption.
  36957. Every notification's DATA begins with a name, which contains no colon
  36958. characters, followed by a colon character.
  36959. Recipients should silently ignore corrupted notifications and
  36960. notifications they do not understand. Recipients should restart timeout
  36961. periods on receipt of a well-formed notification, whether or not they
  36962. understand it.
  36963. Senders should only send the notifications described here when this
  36964. protocol description specifies that they are permitted. In the future,
  36965. we may extend the protocol to permit existing notifications in new
  36966. contexts; this rule helps older senders avoid confusing newer
  36967. recipients.
  36968. (Older versions of GDB ignore bytes received until they see the '$'
  36969. byte that begins an ordinary packet, so new stubs may transmit
  36970. notifications without fear of confusing older clients. There are no
  36971. notifications defined for GDB to send at the moment, but we assume that
  36972. most older stubs would ignore them, as well.)
  36973. Each notification is comprised of three parts:
  36974. 'NAME:EVENT'
  36975. The notification packet is sent by the side that initiates the
  36976. exchange (currently, only the stub does that), with EVENT carrying
  36977. the specific information about the notification, and NAME
  36978. specifying the name of the notification.
  36979. 'ACK'
  36980. The acknowledge sent by the other side, usually GDB, to acknowledge
  36981. the exchange and request the event.
  36982. The purpose of an asynchronous notification mechanism is to report to
  36983. GDB that something interesting happened in the remote stub.
  36984. The remote stub may send notification NAME:EVENT at any time, but GDB
  36985. acknowledges the notification when appropriate. The notification event
  36986. is pending before GDB acknowledges. Only one notification at a time may
  36987. be pending; if additional events occur before GDB has acknowledged the
  36988. previous notification, they must be queued by the stub for later
  36989. synchronous transmission in response to ACK packets from GDB. Because
  36990. the notification mechanism is unreliable, the stub is permitted to
  36991. resend a notification if it believes GDB may not have received it.
  36992. Specifically, notifications may appear when GDB is not otherwise
  36993. reading input from the stub, or when GDB is expecting to read a normal
  36994. synchronous response or a '+'/'-' acknowledgment to a packet it has
  36995. sent. Notification packets are distinct from any other communication
  36996. from the stub so there is no ambiguity.
  36997. After receiving a notification, GDB shall acknowledge it by sending a
  36998. ACK packet as a regular, synchronous request to the stub. Such
  36999. acknowledgment is not required to happen immediately, as GDB is
  37000. permitted to send other, unrelated packets to the stub first, which the
  37001. stub should process normally.
  37002. Upon receiving a ACK packet, if the stub has other queued events to
  37003. report to GDB, it shall respond by sending a normal EVENT. GDB shall
  37004. then send another ACK packet to solicit further responses; again, it is
  37005. permitted to send other, unrelated packets as well which the stub should
  37006. process normally.
  37007. If the stub receives a ACK packet and there are no additional EVENT
  37008. to report, the stub shall return an 'OK' response. At this point, GDB
  37009. has finished processing a notification and the stub has completed
  37010. sending any queued events. GDB won't accept any new notifications until
  37011. the final 'OK' is received . If further notification events occur, the
  37012. stub shall send a new notification, GDB shall accept the notification,
  37013. and the process shall be repeated.
  37014. The process of asynchronous notification can be illustrated by the
  37015. following example:
  37016. <- %Stop:T0505:98e7ffbf;04:4ce6ffbf;08:b1b6e54c;thread:p7526.7526;core:0;
  37017. ...
  37018. -> vStopped
  37019. <- T0505:68f37db7;04:40f37db7;08:63850408;thread:p7526.7528;core:0;
  37020. -> vStopped
  37021. <- T0505:68e3fdb6;04:40e3fdb6;08:63850408;thread:p7526.7529;core:0;
  37022. -> vStopped
  37023. <- OK
  37024. The following notifications are defined:
  37025. NotificationAck Event Description
  37026. Stop vStopped REPLY. The REPLY has the Report an asynchronous
  37027. form of a stop reply, as stop event in non-stop
  37028. described in mode.
  37029. *note Stop Reply Packets::.
  37030. Refer to
  37031. *note Remote Non-Stop::,
  37032. for information on how
  37033. these notifications are
  37034. acknowledged by GDB.
  37035. 
  37036. File: gdb.info, Node: Remote Non-Stop, Next: Packet Acknowledgment, Prev: Notification Packets, Up: Remote Protocol
  37037. E.10 Remote Protocol Support for Non-Stop Mode
  37038. ==============================================
  37039. GDB's remote protocol supports non-stop debugging of multi-threaded
  37040. programs, as described in *note Non-Stop Mode::. If the stub supports
  37041. non-stop mode, it should report that to GDB by including 'QNonStop+' in
  37042. its 'qSupported' response (*note qSupported::).
  37043. GDB typically sends a 'QNonStop' packet only when establishing a new
  37044. connection with the stub. Entering non-stop mode does not alter the
  37045. state of any currently-running threads, but targets must stop all
  37046. threads in any already-attached processes when entering all-stop mode.
  37047. GDB uses the '?' packet as necessary to probe the target state after a
  37048. mode change.
  37049. In non-stop mode, when an attached process encounters an event that
  37050. would otherwise be reported with a stop reply, it uses the asynchronous
  37051. notification mechanism (*note Notification Packets::) to inform GDB. In
  37052. contrast to all-stop mode, where all threads in all processes are
  37053. stopped when a stop reply is sent, in non-stop mode only the thread
  37054. reporting the stop event is stopped. That is, when reporting a 'S' or
  37055. 'T' response to indicate completion of a step operation, hitting a
  37056. breakpoint, or a fault, only the affected thread is stopped; any other
  37057. still-running threads continue to run. When reporting a 'W' or 'X'
  37058. response, all running threads belonging to other attached processes
  37059. continue to run.
  37060. In non-stop mode, the target shall respond to the '?' packet as
  37061. follows. First, any incomplete stop reply notification/'vStopped'
  37062. sequence in progress is abandoned. The target must begin a new sequence
  37063. reporting stop events for all stopped threads, whether or not it has
  37064. previously reported those events to GDB. The first stop reply is sent
  37065. as a synchronous reply to the '?' packet, and subsequent stop replies
  37066. are sent as responses to 'vStopped' packets using the mechanism
  37067. described above. The target must not send asynchronous stop reply
  37068. notifications until the sequence is complete. If all threads are
  37069. running when the target receives the '?' packet, or if the target is not
  37070. attached to any process, it shall respond 'OK'.
  37071. If the stub supports non-stop mode, it should also support the
  37072. 'swbreak' stop reason if software breakpoints are supported, and the
  37073. 'hwbreak' stop reason if hardware breakpoints are supported (*note
  37074. swbreak stop reason::). This is because given the asynchronous nature
  37075. of non-stop mode, between the time a thread hits a breakpoint and the
  37076. time the event is finally processed by GDB, the breakpoint may have
  37077. already been removed from the target. Due to this, GDB needs to be able
  37078. to tell whether a trap stop was caused by a delayed breakpoint event,
  37079. which should be ignored, as opposed to a random trap signal, which
  37080. should be reported to the user. Note the 'swbreak' feature implies that
  37081. the target is responsible for adjusting the PC when a software
  37082. breakpoint triggers, if necessary, such as on the x86 architecture.
  37083. 
  37084. File: gdb.info, Node: Packet Acknowledgment, Next: Examples, Prev: Remote Non-Stop, Up: Remote Protocol
  37085. E.11 Packet Acknowledgment
  37086. ==========================
  37087. By default, when either the host or the target machine receives a
  37088. packet, the first response expected is an acknowledgment: either '+' (to
  37089. indicate the package was received correctly) or '-' (to request
  37090. retransmission). This mechanism allows the GDB remote protocol to
  37091. operate over unreliable transport mechanisms, such as a serial line.
  37092. In cases where the transport mechanism is itself reliable (such as a
  37093. pipe or TCP connection), the '+'/'-' acknowledgments are redundant. It
  37094. may be desirable to disable them in that case to reduce communication
  37095. overhead, or for other reasons. This can be accomplished by means of
  37096. the 'QStartNoAckMode' packet; *note QStartNoAckMode::.
  37097. When in no-acknowledgment mode, neither the stub nor GDB shall send
  37098. or expect '+'/'-' protocol acknowledgments. The packet and response
  37099. format still includes the normal checksum, as described in *note
  37100. Overview::, but the checksum may be ignored by the receiver.
  37101. If the stub supports 'QStartNoAckMode' and prefers to operate in
  37102. no-acknowledgment mode, it should report that to GDB by including
  37103. 'QStartNoAckMode+' in its response to 'qSupported'; *note qSupported::.
  37104. If GDB also supports 'QStartNoAckMode' and it has not been disabled via
  37105. the 'set remote noack-packet off' command (*note Remote
  37106. Configuration::), GDB may then send a 'QStartNoAckMode' packet to the
  37107. stub. Only then may the stub actually turn off packet acknowledgments.
  37108. GDB sends a final '+' acknowledgment of the stub's 'OK' response, which
  37109. can be safely ignored by the stub.
  37110. Note that 'set remote noack-packet' command only affects negotiation
  37111. between GDB and the stub when subsequent connections are made; it does
  37112. not affect the protocol acknowledgment state for any current connection.
  37113. Since '+'/'-' acknowledgments are enabled by default when a new
  37114. connection is established, there is also no protocol request to
  37115. re-enable the acknowledgments for the current connection, once disabled.
  37116. 
  37117. File: gdb.info, Node: Examples, Next: File-I/O Remote Protocol Extension, Prev: Packet Acknowledgment, Up: Remote Protocol
  37118. E.12 Examples
  37119. =============
  37120. Example sequence of a target being re-started. Notice how the restart
  37121. does not get any direct output:
  37122. -> R00
  37123. <- +
  37124. _target restarts_
  37125. -> ?
  37126. <- +
  37127. <- T001:1234123412341234
  37128. -> +
  37129. Example sequence of a target being stepped by a single instruction:
  37130. -> G1445...
  37131. <- +
  37132. -> s
  37133. <- +
  37134. _time passes_
  37135. <- T001:1234123412341234
  37136. -> +
  37137. -> g
  37138. <- +
  37139. <- 1455...
  37140. -> +
  37141. 
  37142. File: gdb.info, Node: File-I/O Remote Protocol Extension, Next: Library List Format, Prev: Examples, Up: Remote Protocol
  37143. E.13 File-I/O Remote Protocol Extension
  37144. =======================================
  37145. * Menu:
  37146. * File-I/O Overview::
  37147. * Protocol Basics::
  37148. * The F Request Packet::
  37149. * The F Reply Packet::
  37150. * The Ctrl-C Message::
  37151. * Console I/O::
  37152. * List of Supported Calls::
  37153. * Protocol-specific Representation of Datatypes::
  37154. * Constants::
  37155. * File-I/O Examples::
  37156. 
  37157. File: gdb.info, Node: File-I/O Overview, Next: Protocol Basics, Up: File-I/O Remote Protocol Extension
  37158. E.13.1 File-I/O Overview
  37159. ------------------------
  37160. The "File I/O remote protocol extension" (short: File-I/O) allows the
  37161. target to use the host's file system and console I/O to perform various
  37162. system calls. System calls on the target system are translated into a
  37163. remote protocol packet to the host system, which then performs the
  37164. needed actions and returns a response packet to the target system. This
  37165. simulates file system operations even on targets that lack file systems.
  37166. The protocol is defined to be independent of both the host and target
  37167. systems. It uses its own internal representation of datatypes and
  37168. values. Both GDB and the target's GDB stub are responsible for
  37169. translating the system-dependent value representations into the internal
  37170. protocol representations when data is transmitted.
  37171. The communication is synchronous. A system call is possible only
  37172. when GDB is waiting for a response from the 'C', 'c', 'S' or 's'
  37173. packets. While GDB handles the request for a system call, the target is
  37174. stopped to allow deterministic access to the target's memory. Therefore
  37175. File-I/O is not interruptible by target signals. On the other hand, it
  37176. is possible to interrupt File-I/O by a user interrupt ('Ctrl-C') within
  37177. GDB.
  37178. The target's request to perform a host system call does not finish
  37179. the latest 'C', 'c', 'S' or 's' action. That means, after finishing the
  37180. system call, the target returns to continuing the previous activity
  37181. (continue, step). No additional continue or step request from GDB is
  37182. required.
  37183. (gdb) continue
  37184. <- target requests 'system call X'
  37185. target is stopped, GDB executes system call
  37186. -> GDB returns result
  37187. ... target continues, GDB returns to wait for the target
  37188. <- target hits breakpoint and sends a Txx packet
  37189. The protocol only supports I/O on the console and to regular files on
  37190. the host file system. Character or block special devices, pipes, named
  37191. pipes, sockets or any other communication method on the host system are
  37192. not supported by this protocol.
  37193. File I/O is not supported in non-stop mode.
  37194. 
  37195. File: gdb.info, Node: Protocol Basics, Next: The F Request Packet, Prev: File-I/O Overview, Up: File-I/O Remote Protocol Extension
  37196. E.13.2 Protocol Basics
  37197. ----------------------
  37198. The File-I/O protocol uses the 'F' packet as the request as well as
  37199. reply packet. Since a File-I/O system call can only occur when GDB is
  37200. waiting for a response from the continuing or stepping target, the
  37201. File-I/O request is a reply that GDB has to expect as a result of a
  37202. previous 'C', 'c', 'S' or 's' packet. This 'F' packet contains all
  37203. information needed to allow GDB to call the appropriate host system
  37204. call:
  37205. * A unique identifier for the requested system call.
  37206. * All parameters to the system call. Pointers are given as addresses
  37207. in the target memory address space. Pointers to strings are given
  37208. as pointer/length pair. Numerical values are given as they are.
  37209. Numerical control flags are given in a protocol-specific
  37210. representation.
  37211. At this point, GDB has to perform the following actions.
  37212. * If the parameters include pointer values to data needed as input to
  37213. a system call, GDB requests this data from the target with a
  37214. standard 'm' packet request. This additional communication has to
  37215. be expected by the target implementation and is handled as any
  37216. other 'm' packet.
  37217. * GDB translates all value from protocol representation to host
  37218. representation as needed. Datatypes are coerced into the host
  37219. types.
  37220. * GDB calls the system call.
  37221. * It then coerces datatypes back to protocol representation.
  37222. * If the system call is expected to return data in buffer space
  37223. specified by pointer parameters to the call, the data is
  37224. transmitted to the target using a 'M' or 'X' packet. This packet
  37225. has to be expected by the target implementation and is handled as
  37226. any other 'M' or 'X' packet.
  37227. Eventually GDB replies with another 'F' packet which contains all
  37228. necessary information for the target to continue. This at least
  37229. contains
  37230. * Return value.
  37231. * 'errno', if has been changed by the system call.
  37232. * "Ctrl-C" flag.
  37233. After having done the needed type and value coercion, the target
  37234. continues the latest continue or step action.
  37235. 
  37236. File: gdb.info, Node: The F Request Packet, Next: The F Reply Packet, Prev: Protocol Basics, Up: File-I/O Remote Protocol Extension
  37237. E.13.3 The 'F' Request Packet
  37238. -----------------------------
  37239. The 'F' request packet has the following format:
  37240. 'FCALL-ID,PARAMETER...'
  37241. CALL-ID is the identifier to indicate the host system call to be
  37242. called. This is just the name of the function.
  37243. PARAMETER... are the parameters to the system call. Parameters are
  37244. hexadecimal integer values, either the actual values in case of
  37245. scalar datatypes, pointers to target buffer space in case of
  37246. compound datatypes and unspecified memory areas, or pointer/length
  37247. pairs in case of string parameters. These are appended to the
  37248. CALL-ID as a comma-delimited list. All values are transmitted in
  37249. ASCII string representation, pointer/length pairs separated by a
  37250. slash.
  37251. 
  37252. 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
  37253. E.13.4 The 'F' Reply Packet
  37254. ---------------------------
  37255. The 'F' reply packet has the following format:
  37256. 'FRETCODE,ERRNO,CTRL-C FLAG;CALL-SPECIFIC ATTACHMENT'
  37257. RETCODE is the return code of the system call as hexadecimal value.
  37258. ERRNO is the 'errno' set by the call, in protocol-specific
  37259. representation. This parameter can be omitted if the call was
  37260. successful.
  37261. CTRL-C FLAG is only sent if the user requested a break. In this
  37262. case, ERRNO must be sent as well, even if the call was successful.
  37263. The CTRL-C FLAG itself consists of the character 'C':
  37264. F0,0,C
  37265. or, if the call was interrupted before the host call has been
  37266. performed:
  37267. F-1,4,C
  37268. assuming 4 is the protocol-specific representation of 'EINTR'.
  37269. 
  37270. File: gdb.info, Node: The Ctrl-C Message, Next: Console I/O, Prev: The F Reply Packet, Up: File-I/O Remote Protocol Extension
  37271. E.13.5 The 'Ctrl-C' Message
  37272. ---------------------------
  37273. If the 'Ctrl-C' flag is set in the GDB reply packet (*note The F Reply
  37274. Packet::), the target should behave as if it had gotten a break message.
  37275. The meaning for the target is "system call interrupted by 'SIGINT'".
  37276. Consequentially, the target should actually stop (as with a break
  37277. message) and return to GDB with a 'T02' packet.
  37278. It's important for the target to know in which state the system call
  37279. was interrupted. There are two possible cases:
  37280. * The system call hasn't been performed on the host yet.
  37281. * The system call on the host has been finished.
  37282. These two states can be distinguished by the target by the value of
  37283. the returned 'errno'. If it's the protocol representation of 'EINTR',
  37284. the system call hasn't been performed. This is equivalent to the
  37285. 'EINTR' handling on POSIX systems. In any other case, the target may
  37286. presume that the system call has been finished -- successfully or not --
  37287. and should behave as if the break message arrived right after the system
  37288. call.
  37289. GDB must behave reliably. If the system call has not been called
  37290. yet, GDB may send the 'F' reply immediately, setting 'EINTR' as 'errno'
  37291. in the packet. If the system call on the host has been finished before
  37292. the user requests a break, the full action must be finished by GDB.
  37293. This requires sending 'M' or 'X' packets as necessary. The 'F' packet
  37294. may only be sent when either nothing has happened or the full action has
  37295. been completed.
  37296. 
  37297. File: gdb.info, Node: Console I/O, Next: List of Supported Calls, Prev: The Ctrl-C Message, Up: File-I/O Remote Protocol Extension
  37298. E.13.6 Console I/O
  37299. ------------------
  37300. By default and if not explicitly closed by the target system, the file
  37301. descriptors 0, 1 and 2 are connected to the GDB console. Output on the
  37302. GDB console is handled as any other file output operation ('write(1,
  37303. ...)' or 'write(2, ...)'). Console input is handled by GDB so that
  37304. after the target read request from file descriptor 0 all following
  37305. typing is buffered until either one of the following conditions is met:
  37306. * The user types 'Ctrl-c'. The behaviour is as explained above, and
  37307. the 'read' system call is treated as finished.
  37308. * The user presses <RET>. This is treated as end of input with a
  37309. trailing newline.
  37310. * The user types 'Ctrl-d'. This is treated as end of input. No
  37311. trailing character (neither newline nor 'Ctrl-D') is appended to
  37312. the input.
  37313. If the user has typed more characters than fit in the buffer given to
  37314. the 'read' call, the trailing characters are buffered in GDB until
  37315. either another 'read(0, ...)' is requested by the target, or debugging
  37316. is stopped at the user's request.
  37317. 
  37318. 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
  37319. E.13.7 List of Supported Calls
  37320. ------------------------------
  37321. * Menu:
  37322. * open::
  37323. * close::
  37324. * read::
  37325. * write::
  37326. * lseek::
  37327. * rename::
  37328. * unlink::
  37329. * stat/fstat::
  37330. * gettimeofday::
  37331. * isatty::
  37332. * system::
  37333. 
  37334. File: gdb.info, Node: open, Next: close, Up: List of Supported Calls
  37335. open
  37336. ....
  37337. Synopsis:
  37338. int open(const char *pathname, int flags);
  37339. int open(const char *pathname, int flags, mode_t mode);
  37340. Request:
  37341. 'Fopen,PATHPTR/LEN,FLAGS,MODE'
  37342. FLAGS is the bitwise 'OR' of the following values:
  37343. 'O_CREAT'
  37344. If the file does not exist it will be created. The host rules
  37345. apply as far as file ownership and time stamps are concerned.
  37346. 'O_EXCL'
  37347. When used with 'O_CREAT', if the file already exists it is an
  37348. error and open() fails.
  37349. 'O_TRUNC'
  37350. If the file already exists and the open mode allows writing
  37351. ('O_RDWR' or 'O_WRONLY' is given) it will be truncated to zero
  37352. length.
  37353. 'O_APPEND'
  37354. The file is opened in append mode.
  37355. 'O_RDONLY'
  37356. The file is opened for reading only.
  37357. 'O_WRONLY'
  37358. The file is opened for writing only.
  37359. 'O_RDWR'
  37360. The file is opened for reading and writing.
  37361. Other bits are silently ignored.
  37362. MODE is the bitwise 'OR' of the following values:
  37363. 'S_IRUSR'
  37364. User has read permission.
  37365. 'S_IWUSR'
  37366. User has write permission.
  37367. 'S_IRGRP'
  37368. Group has read permission.
  37369. 'S_IWGRP'
  37370. Group has write permission.
  37371. 'S_IROTH'
  37372. Others have read permission.
  37373. 'S_IWOTH'
  37374. Others have write permission.
  37375. Other bits are silently ignored.
  37376. Return value:
  37377. 'open' returns the new file descriptor or -1 if an error occurred.
  37378. Errors:
  37379. 'EEXIST'
  37380. PATHNAME already exists and 'O_CREAT' and 'O_EXCL' were used.
  37381. 'EISDIR'
  37382. PATHNAME refers to a directory.
  37383. 'EACCES'
  37384. The requested access is not allowed.
  37385. 'ENAMETOOLONG'
  37386. PATHNAME was too long.
  37387. 'ENOENT'
  37388. A directory component in PATHNAME does not exist.
  37389. 'ENODEV'
  37390. PATHNAME refers to a device, pipe, named pipe or socket.
  37391. 'EROFS'
  37392. PATHNAME refers to a file on a read-only filesystem and write
  37393. access was requested.
  37394. 'EFAULT'
  37395. PATHNAME is an invalid pointer value.
  37396. 'ENOSPC'
  37397. No space on device to create the file.
  37398. 'EMFILE'
  37399. The process already has the maximum number of files open.
  37400. 'ENFILE'
  37401. The limit on the total number of files open on the system has
  37402. been reached.
  37403. 'EINTR'
  37404. The call was interrupted by the user.
  37405. 
  37406. File: gdb.info, Node: close, Next: read, Prev: open, Up: List of Supported Calls
  37407. close
  37408. .....
  37409. Synopsis:
  37410. int close(int fd);
  37411. Request:
  37412. 'Fclose,FD'
  37413. Return value:
  37414. 'close' returns zero on success, or -1 if an error occurred.
  37415. Errors:
  37416. 'EBADF'
  37417. FD isn't a valid open file descriptor.
  37418. 'EINTR'
  37419. The call was interrupted by the user.
  37420. 
  37421. File: gdb.info, Node: read, Next: write, Prev: close, Up: List of Supported Calls
  37422. read
  37423. ....
  37424. Synopsis:
  37425. int read(int fd, void *buf, unsigned int count);
  37426. Request:
  37427. 'Fread,FD,BUFPTR,COUNT'
  37428. Return value:
  37429. On success, the number of bytes read is returned. Zero indicates
  37430. end of file. If count is zero, read returns zero as well. On
  37431. error, -1 is returned.
  37432. Errors:
  37433. 'EBADF'
  37434. FD is not a valid file descriptor or is not open for reading.
  37435. 'EFAULT'
  37436. BUFPTR is an invalid pointer value.
  37437. 'EINTR'
  37438. The call was interrupted by the user.
  37439. 
  37440. File: gdb.info, Node: write, Next: lseek, Prev: read, Up: List of Supported Calls
  37441. write
  37442. .....
  37443. Synopsis:
  37444. int write(int fd, const void *buf, unsigned int count);
  37445. Request:
  37446. 'Fwrite,FD,BUFPTR,COUNT'
  37447. Return value:
  37448. On success, the number of bytes written are returned. Zero
  37449. indicates nothing was written. On error, -1 is returned.
  37450. Errors:
  37451. 'EBADF'
  37452. FD is not a valid file descriptor or is not open for writing.
  37453. 'EFAULT'
  37454. BUFPTR is an invalid pointer value.
  37455. 'EFBIG'
  37456. An attempt was made to write a file that exceeds the
  37457. host-specific maximum file size allowed.
  37458. 'ENOSPC'
  37459. No space on device to write the data.
  37460. 'EINTR'
  37461. The call was interrupted by the user.
  37462. 
  37463. File: gdb.info, Node: lseek, Next: rename, Prev: write, Up: List of Supported Calls
  37464. lseek
  37465. .....
  37466. Synopsis:
  37467. long lseek (int fd, long offset, int flag);
  37468. Request:
  37469. 'Flseek,FD,OFFSET,FLAG'
  37470. FLAG is one of:
  37471. 'SEEK_SET'
  37472. The offset is set to OFFSET bytes.
  37473. 'SEEK_CUR'
  37474. The offset is set to its current location plus OFFSET bytes.
  37475. 'SEEK_END'
  37476. The offset is set to the size of the file plus OFFSET bytes.
  37477. Return value:
  37478. On success, the resulting unsigned offset in bytes from the
  37479. beginning of the file is returned. Otherwise, a value of -1 is
  37480. returned.
  37481. Errors:
  37482. 'EBADF'
  37483. FD is not a valid open file descriptor.
  37484. 'ESPIPE'
  37485. FD is associated with the GDB console.
  37486. 'EINVAL'
  37487. FLAG is not a proper value.
  37488. 'EINTR'
  37489. The call was interrupted by the user.
  37490. 
  37491. File: gdb.info, Node: rename, Next: unlink, Prev: lseek, Up: List of Supported Calls
  37492. rename
  37493. ......
  37494. Synopsis:
  37495. int rename(const char *oldpath, const char *newpath);
  37496. Request:
  37497. 'Frename,OLDPATHPTR/LEN,NEWPATHPTR/LEN'
  37498. Return value:
  37499. On success, zero is returned. On error, -1 is returned.
  37500. Errors:
  37501. 'EISDIR'
  37502. NEWPATH is an existing directory, but OLDPATH is not a
  37503. directory.
  37504. 'EEXIST'
  37505. NEWPATH is a non-empty directory.
  37506. 'EBUSY'
  37507. OLDPATH or NEWPATH is a directory that is in use by some
  37508. process.
  37509. 'EINVAL'
  37510. An attempt was made to make a directory a subdirectory of
  37511. itself.
  37512. 'ENOTDIR'
  37513. A component used as a directory in OLDPATH or new path is not
  37514. a directory. Or OLDPATH is a directory and NEWPATH exists but
  37515. is not a directory.
  37516. 'EFAULT'
  37517. OLDPATHPTR or NEWPATHPTR are invalid pointer values.
  37518. 'EACCES'
  37519. No access to the file or the path of the file.
  37520. 'ENAMETOOLONG'
  37521. OLDPATH or NEWPATH was too long.
  37522. 'ENOENT'
  37523. A directory component in OLDPATH or NEWPATH does not exist.
  37524. 'EROFS'
  37525. The file is on a read-only filesystem.
  37526. 'ENOSPC'
  37527. The device containing the file has no room for the new
  37528. directory entry.
  37529. 'EINTR'
  37530. The call was interrupted by the user.
  37531. 
  37532. File: gdb.info, Node: unlink, Next: stat/fstat, Prev: rename, Up: List of Supported Calls
  37533. unlink
  37534. ......
  37535. Synopsis:
  37536. int unlink(const char *pathname);
  37537. Request:
  37538. 'Funlink,PATHNAMEPTR/LEN'
  37539. Return value:
  37540. On success, zero is returned. On error, -1 is returned.
  37541. Errors:
  37542. 'EACCES'
  37543. No access to the file or the path of the file.
  37544. 'EPERM'
  37545. The system does not allow unlinking of directories.
  37546. 'EBUSY'
  37547. The file PATHNAME cannot be unlinked because it's being used
  37548. by another process.
  37549. 'EFAULT'
  37550. PATHNAMEPTR is an invalid pointer value.
  37551. 'ENAMETOOLONG'
  37552. PATHNAME was too long.
  37553. 'ENOENT'
  37554. A directory component in PATHNAME does not exist.
  37555. 'ENOTDIR'
  37556. A component of the path is not a directory.
  37557. 'EROFS'
  37558. The file is on a read-only filesystem.
  37559. 'EINTR'
  37560. The call was interrupted by the user.
  37561. 
  37562. File: gdb.info, Node: stat/fstat, Next: gettimeofday, Prev: unlink, Up: List of Supported Calls
  37563. stat/fstat
  37564. ..........
  37565. Synopsis:
  37566. int stat(const char *pathname, struct stat *buf);
  37567. int fstat(int fd, struct stat *buf);
  37568. Request:
  37569. 'Fstat,PATHNAMEPTR/LEN,BUFPTR'
  37570. 'Ffstat,FD,BUFPTR'
  37571. Return value:
  37572. On success, zero is returned. On error, -1 is returned.
  37573. Errors:
  37574. 'EBADF'
  37575. FD is not a valid open file.
  37576. 'ENOENT'
  37577. A directory component in PATHNAME does not exist or the path
  37578. is an empty string.
  37579. 'ENOTDIR'
  37580. A component of the path is not a directory.
  37581. 'EFAULT'
  37582. PATHNAMEPTR is an invalid pointer value.
  37583. 'EACCES'
  37584. No access to the file or the path of the file.
  37585. 'ENAMETOOLONG'
  37586. PATHNAME was too long.
  37587. 'EINTR'
  37588. The call was interrupted by the user.
  37589. 
  37590. File: gdb.info, Node: gettimeofday, Next: isatty, Prev: stat/fstat, Up: List of Supported Calls
  37591. gettimeofday
  37592. ............
  37593. Synopsis:
  37594. int gettimeofday(struct timeval *tv, void *tz);
  37595. Request:
  37596. 'Fgettimeofday,TVPTR,TZPTR'
  37597. Return value:
  37598. On success, 0 is returned, -1 otherwise.
  37599. Errors:
  37600. 'EINVAL'
  37601. TZ is a non-NULL pointer.
  37602. 'EFAULT'
  37603. TVPTR and/or TZPTR is an invalid pointer value.
  37604. 
  37605. File: gdb.info, Node: isatty, Next: system, Prev: gettimeofday, Up: List of Supported Calls
  37606. isatty
  37607. ......
  37608. Synopsis:
  37609. int isatty(int fd);
  37610. Request:
  37611. 'Fisatty,FD'
  37612. Return value:
  37613. Returns 1 if FD refers to the GDB console, 0 otherwise.
  37614. Errors:
  37615. 'EINTR'
  37616. The call was interrupted by the user.
  37617. Note that the 'isatty' call is treated as a special case: it returns
  37618. 1 to the target if the file descriptor is attached to the GDB console, 0
  37619. otherwise. Implementing through system calls would require implementing
  37620. 'ioctl' and would be more complex than needed.
  37621. 
  37622. File: gdb.info, Node: system, Prev: isatty, Up: List of Supported Calls
  37623. system
  37624. ......
  37625. Synopsis:
  37626. int system(const char *command);
  37627. Request:
  37628. 'Fsystem,COMMANDPTR/LEN'
  37629. Return value:
  37630. If LEN is zero, the return value indicates whether a shell is
  37631. available. A zero return value indicates a shell is not available.
  37632. For non-zero LEN, the value returned is -1 on error and the return
  37633. status of the command otherwise. Only the exit status of the
  37634. command is returned, which is extracted from the host's 'system'
  37635. return value by calling 'WEXITSTATUS(retval)'. In case '/bin/sh'
  37636. could not be executed, 127 is returned.
  37637. Errors:
  37638. 'EINTR'
  37639. The call was interrupted by the user.
  37640. GDB takes over the full task of calling the necessary host calls to
  37641. perform the 'system' call. The return value of 'system' on the host is
  37642. simplified before it's returned to the target. Any termination signal
  37643. information from the child process is discarded, and the return value
  37644. consists entirely of the exit status of the called command.
  37645. Due to security concerns, the 'system' call is by default refused by
  37646. GDB. The user has to allow this call explicitly with the 'set remote
  37647. system-call-allowed 1' command.
  37648. 'set remote system-call-allowed'
  37649. Control whether to allow the 'system' calls in the File I/O
  37650. protocol for the remote target. The default is zero (disabled).
  37651. 'show remote system-call-allowed'
  37652. Show whether the 'system' calls are allowed in the File I/O
  37653. protocol.
  37654. 
  37655. File: gdb.info, Node: Protocol-specific Representation of Datatypes, Next: Constants, Prev: List of Supported Calls, Up: File-I/O Remote Protocol Extension
  37656. E.13.8 Protocol-specific Representation of Datatypes
  37657. ----------------------------------------------------
  37658. * Menu:
  37659. * Integral Datatypes::
  37660. * Pointer Values::
  37661. * Memory Transfer::
  37662. * struct stat::
  37663. * struct timeval::
  37664. 
  37665. File: gdb.info, Node: Integral Datatypes, Next: Pointer Values, Up: Protocol-specific Representation of Datatypes
  37666. Integral Datatypes
  37667. ..................
  37668. The integral datatypes used in the system calls are 'int', 'unsigned
  37669. int', 'long', 'unsigned long', 'mode_t', and 'time_t'.
  37670. 'int', 'unsigned int', 'mode_t' and 'time_t' are implemented as 32
  37671. bit values in this protocol.
  37672. 'long' and 'unsigned long' are implemented as 64 bit types.
  37673. *Note Limits::, for corresponding MIN and MAX values (similar to
  37674. those in 'limits.h') to allow range checking on host and target.
  37675. 'time_t' datatypes are defined as seconds since the Epoch.
  37676. All integral datatypes transferred as part of a memory read or write
  37677. of a structured datatype e.g. a 'struct stat' have to be given in big
  37678. endian byte order.
  37679. 
  37680. File: gdb.info, Node: Pointer Values, Next: Memory Transfer, Prev: Integral Datatypes, Up: Protocol-specific Representation of Datatypes
  37681. Pointer Values
  37682. ..............
  37683. Pointers to target data are transmitted as they are. An exception is
  37684. made for pointers to buffers for which the length isn't transmitted as
  37685. part of the function call, namely strings. Strings are transmitted as a
  37686. pointer/length pair, both as hex values, e.g.
  37687. 1aaf/12
  37688. which is a pointer to data of length 18 bytes at position 0x1aaf. The
  37689. length is defined as the full string length in bytes, including the
  37690. trailing null byte. For example, the string '"hello world"' at address
  37691. 0x123456 is transmitted as
  37692. 123456/d
  37693. 
  37694. File: gdb.info, Node: Memory Transfer, Next: struct stat, Prev: Pointer Values, Up: Protocol-specific Representation of Datatypes
  37695. Memory Transfer
  37696. ...............
  37697. Structured data which is transferred using a memory read or write (for
  37698. example, a 'struct stat') is expected to be in a protocol-specific
  37699. format with all scalar multibyte datatypes being big endian.
  37700. Translation to this representation needs to be done both by the target
  37701. before the 'F' packet is sent, and by GDB before it transfers memory to
  37702. the target. Transferred pointers to structured data should point to the
  37703. already-coerced data at any time.
  37704. 
  37705. File: gdb.info, Node: struct stat, Next: struct timeval, Prev: Memory Transfer, Up: Protocol-specific Representation of Datatypes
  37706. struct stat
  37707. ...........
  37708. The buffer of type 'struct stat' used by the target and GDB is defined
  37709. as follows:
  37710. struct stat {
  37711. unsigned int st_dev; /* device */
  37712. unsigned int st_ino; /* inode */
  37713. mode_t st_mode; /* protection */
  37714. unsigned int st_nlink; /* number of hard links */
  37715. unsigned int st_uid; /* user ID of owner */
  37716. unsigned int st_gid; /* group ID of owner */
  37717. unsigned int st_rdev; /* device type (if inode device) */
  37718. unsigned long st_size; /* total size, in bytes */
  37719. unsigned long st_blksize; /* blocksize for filesystem I/O */
  37720. unsigned long st_blocks; /* number of blocks allocated */
  37721. time_t st_atime; /* time of last access */
  37722. time_t st_mtime; /* time of last modification */
  37723. time_t st_ctime; /* time of last change */
  37724. };
  37725. The integral datatypes conform to the definitions given in the
  37726. appropriate section (see *note Integral Datatypes::, for details) so
  37727. this structure is of size 64 bytes.
  37728. The values of several fields have a restricted meaning and/or range
  37729. of values.
  37730. 'st_dev'
  37731. A value of 0 represents a file, 1 the console.
  37732. 'st_ino'
  37733. No valid meaning for the target. Transmitted unchanged.
  37734. 'st_mode'
  37735. Valid mode bits are described in *note Constants::. Any other bits
  37736. have currently no meaning for the target.
  37737. 'st_uid'
  37738. 'st_gid'
  37739. 'st_rdev'
  37740. No valid meaning for the target. Transmitted unchanged.
  37741. 'st_atime'
  37742. 'st_mtime'
  37743. 'st_ctime'
  37744. These values have a host and file system dependent accuracy.
  37745. Especially on Windows hosts, the file system may not support exact
  37746. timing values.
  37747. The target gets a 'struct stat' of the above representation and is
  37748. responsible for coercing it to the target representation before
  37749. continuing.
  37750. Note that due to size differences between the host, target, and
  37751. protocol representations of 'struct stat' members, these members could
  37752. eventually get truncated on the target.
  37753. 
  37754. File: gdb.info, Node: struct timeval, Prev: struct stat, Up: Protocol-specific Representation of Datatypes
  37755. struct timeval
  37756. ..............
  37757. The buffer of type 'struct timeval' used by the File-I/O protocol is
  37758. defined as follows:
  37759. struct timeval {
  37760. time_t tv_sec; /* second */
  37761. long tv_usec; /* microsecond */
  37762. };
  37763. The integral datatypes conform to the definitions given in the
  37764. appropriate section (see *note Integral Datatypes::, for details) so
  37765. this structure is of size 8 bytes.
  37766. 
  37767. File: gdb.info, Node: Constants, Next: File-I/O Examples, Prev: Protocol-specific Representation of Datatypes, Up: File-I/O Remote Protocol Extension
  37768. E.13.9 Constants
  37769. ----------------
  37770. The following values are used for the constants inside of the protocol.
  37771. GDB and target are responsible for translating these values before and
  37772. after the call as needed.
  37773. * Menu:
  37774. * Open Flags::
  37775. * mode_t Values::
  37776. * Errno Values::
  37777. * Lseek Flags::
  37778. * Limits::
  37779. 
  37780. File: gdb.info, Node: Open Flags, Next: mode_t Values, Up: Constants
  37781. Open Flags
  37782. ..........
  37783. All values are given in hexadecimal representation.
  37784. O_RDONLY 0x0
  37785. O_WRONLY 0x1
  37786. O_RDWR 0x2
  37787. O_APPEND 0x8
  37788. O_CREAT 0x200
  37789. O_TRUNC 0x400
  37790. O_EXCL 0x800
  37791. 
  37792. File: gdb.info, Node: mode_t Values, Next: Errno Values, Prev: Open Flags, Up: Constants
  37793. mode_t Values
  37794. .............
  37795. All values are given in octal representation.
  37796. S_IFREG 0100000
  37797. S_IFDIR 040000
  37798. S_IRUSR 0400
  37799. S_IWUSR 0200
  37800. S_IXUSR 0100
  37801. S_IRGRP 040
  37802. S_IWGRP 020
  37803. S_IXGRP 010
  37804. S_IROTH 04
  37805. S_IWOTH 02
  37806. S_IXOTH 01
  37807. 
  37808. File: gdb.info, Node: Errno Values, Next: Lseek Flags, Prev: mode_t Values, Up: Constants
  37809. Errno Values
  37810. ............
  37811. All values are given in decimal representation.
  37812. EPERM 1
  37813. ENOENT 2
  37814. EINTR 4
  37815. EBADF 9
  37816. EACCES 13
  37817. EFAULT 14
  37818. EBUSY 16
  37819. EEXIST 17
  37820. ENODEV 19
  37821. ENOTDIR 20
  37822. EISDIR 21
  37823. EINVAL 22
  37824. ENFILE 23
  37825. EMFILE 24
  37826. EFBIG 27
  37827. ENOSPC 28
  37828. ESPIPE 29
  37829. EROFS 30
  37830. ENAMETOOLONG 91
  37831. EUNKNOWN 9999
  37832. 'EUNKNOWN' is used as a fallback error value if a host system returns
  37833. any error value not in the list of supported error numbers.
  37834. 
  37835. File: gdb.info, Node: Lseek Flags, Next: Limits, Prev: Errno Values, Up: Constants
  37836. Lseek Flags
  37837. ...........
  37838. SEEK_SET 0
  37839. SEEK_CUR 1
  37840. SEEK_END 2
  37841. 
  37842. File: gdb.info, Node: Limits, Prev: Lseek Flags, Up: Constants
  37843. Limits
  37844. ......
  37845. All values are given in decimal representation.
  37846. INT_MIN -2147483648
  37847. INT_MAX 2147483647
  37848. UINT_MAX 4294967295
  37849. LONG_MIN -9223372036854775808
  37850. LONG_MAX 9223372036854775807
  37851. ULONG_MAX 18446744073709551615
  37852. 
  37853. File: gdb.info, Node: File-I/O Examples, Prev: Constants, Up: File-I/O Remote Protocol Extension
  37854. E.13.10 File-I/O Examples
  37855. -------------------------
  37856. Example sequence of a write call, file descriptor 3, buffer is at target
  37857. address 0x1234, 6 bytes should be written:
  37858. <- Fwrite,3,1234,6
  37859. _request memory read from target_
  37860. -> m1234,6
  37861. <- XXXXXX
  37862. _return "6 bytes written"_
  37863. -> F6
  37864. Example sequence of a read call, file descriptor 3, buffer is at
  37865. target address 0x1234, 6 bytes should be read:
  37866. <- Fread,3,1234,6
  37867. _request memory write to target_
  37868. -> X1234,6:XXXXXX
  37869. _return "6 bytes read"_
  37870. -> F6
  37871. Example sequence of a read call, call fails on the host due to
  37872. invalid file descriptor ('EBADF'):
  37873. <- Fread,3,1234,6
  37874. -> F-1,9
  37875. Example sequence of a read call, user presses 'Ctrl-c' before syscall
  37876. on host is called:
  37877. <- Fread,3,1234,6
  37878. -> F-1,4,C
  37879. <- T02
  37880. Example sequence of a read call, user presses 'Ctrl-c' after syscall
  37881. on host is called:
  37882. <- Fread,3,1234,6
  37883. -> X1234,6:XXXXXX
  37884. <- T02
  37885. 
  37886. File: gdb.info, Node: Library List Format, Next: Library List Format for SVR4 Targets, Prev: File-I/O Remote Protocol Extension, Up: Remote Protocol
  37887. E.14 Library List Format
  37888. ========================
  37889. On some platforms, a dynamic loader (e.g. 'ld.so') runs in the same
  37890. process as your application to manage libraries. In this case, GDB can
  37891. use the loader's symbol table and normal memory operations to maintain a
  37892. list of shared libraries. On other platforms, the operating system
  37893. manages loaded libraries. GDB can not retrieve the list of currently
  37894. loaded libraries through memory operations, so it uses the
  37895. 'qXfer:libraries:read' packet (*note qXfer library list read::) instead.
  37896. The remote stub queries the target's operating system and reports which
  37897. libraries are loaded.
  37898. The 'qXfer:libraries:read' packet returns an XML document which lists
  37899. loaded libraries and their offsets. Each library has an associated name
  37900. and one or more segment or section base addresses, which report where
  37901. the library was loaded in memory.
  37902. For the common case of libraries that are fully linked binaries, the
  37903. library should have a list of segments. If the target supports dynamic
  37904. linking of a relocatable object file, its library XML element should
  37905. instead include a list of allocated sections. The segment or section
  37906. bases are start addresses, not relocation offsets; they do not depend on
  37907. the library's link-time base addresses.
  37908. GDB must be linked with the Expat library to support XML library
  37909. lists. *Note Expat::.
  37910. A simple memory map, with one loaded library relocated by a single
  37911. offset, looks like this:
  37912. <library-list>
  37913. <library name="/lib/libc.so.6">
  37914. <segment address="0x10000000"/>
  37915. </library>
  37916. </library-list>
  37917. Another simple memory map, with one loaded library with three
  37918. allocated sections (.text, .data, .bss), looks like this:
  37919. <library-list>
  37920. <library name="sharedlib.o">
  37921. <section address="0x10000000"/>
  37922. <section address="0x20000000"/>
  37923. <section address="0x30000000"/>
  37924. </library>
  37925. </library-list>
  37926. The format of a library list is described by this DTD:
  37927. <!-- library-list: Root element with versioning -->
  37928. <!ELEMENT library-list (library)*>
  37929. <!ATTLIST library-list version CDATA #FIXED "1.0">
  37930. <!ELEMENT library (segment*, section*)>
  37931. <!ATTLIST library name CDATA #REQUIRED>
  37932. <!ELEMENT segment EMPTY>
  37933. <!ATTLIST segment address CDATA #REQUIRED>
  37934. <!ELEMENT section EMPTY>
  37935. <!ATTLIST section address CDATA #REQUIRED>
  37936. In addition, segments and section descriptors cannot be mixed within
  37937. a single library element, and you must supply at least one segment or
  37938. section for each library.
  37939. 
  37940. File: gdb.info, Node: Library List Format for SVR4 Targets, Next: Memory Map Format, Prev: Library List Format, Up: Remote Protocol
  37941. E.15 Library List Format for SVR4 Targets
  37942. =========================================
  37943. On SVR4 platforms GDB can use the symbol table of a dynamic loader (e.g.
  37944. 'ld.so') and normal memory operations to maintain a list of shared
  37945. libraries. Still a special library list provided by this packet is more
  37946. efficient for the GDB remote protocol.
  37947. The 'qXfer:libraries-svr4:read' packet returns an XML document which
  37948. lists loaded libraries and their SVR4 linker parameters. For each
  37949. library on SVR4 target, the following parameters are reported:
  37950. - 'name', the absolute file name from the 'l_name' field of 'struct
  37951. link_map'.
  37952. - 'lm' with address of 'struct link_map' used for TLS (Thread Local
  37953. Storage) access.
  37954. - 'l_addr', the displacement as read from the field 'l_addr' of
  37955. 'struct link_map'. For prelinked libraries this is not an absolute
  37956. memory address. It is a displacement of absolute memory address
  37957. against address the file was prelinked to during the library load.
  37958. - 'l_ld', which is memory address of the 'PT_DYNAMIC' segment
  37959. Additionally the single 'main-lm' attribute specifies address of
  37960. 'struct link_map' used for the main executable. This parameter is used
  37961. for TLS access and its presence is optional.
  37962. GDB must be linked with the Expat library to support XML SVR4 library
  37963. lists. *Note Expat::.
  37964. A simple memory map, with two loaded libraries (which do not use
  37965. prelink), looks like this:
  37966. <library-list-svr4 version="1.0" main-lm="0xe4f8f8">
  37967. <library name="/lib/ld-linux.so.2" lm="0xe4f51c" l_addr="0xe2d000"
  37968. l_ld="0xe4eefc"/>
  37969. <library name="/lib/libc.so.6" lm="0xe4fbe8" l_addr="0x154000"
  37970. l_ld="0x152350"/>
  37971. </library-list-svr>
  37972. The format of an SVR4 library list is described by this DTD:
  37973. <!-- library-list-svr4: Root element with versioning -->
  37974. <!ELEMENT library-list-svr4 (library)*>
  37975. <!ATTLIST library-list-svr4 version CDATA #FIXED "1.0">
  37976. <!ATTLIST library-list-svr4 main-lm CDATA #IMPLIED>
  37977. <!ELEMENT library EMPTY>
  37978. <!ATTLIST library name CDATA #REQUIRED>
  37979. <!ATTLIST library lm CDATA #REQUIRED>
  37980. <!ATTLIST library l_addr CDATA #REQUIRED>
  37981. <!ATTLIST library l_ld CDATA #REQUIRED>
  37982. 
  37983. File: gdb.info, Node: Memory Map Format, Next: Thread List Format, Prev: Library List Format for SVR4 Targets, Up: Remote Protocol
  37984. E.16 Memory Map Format
  37985. ======================
  37986. To be able to write into flash memory, GDB needs to obtain a memory map
  37987. from the target. This section describes the format of the memory map.
  37988. The memory map is obtained using the 'qXfer:memory-map:read' (*note
  37989. qXfer memory map read::) packet and is an XML document that lists memory
  37990. regions.
  37991. GDB must be linked with the Expat library to support XML memory maps.
  37992. *Note Expat::.
  37993. The top-level structure of the document is shown below:
  37994. <?xml version="1.0"?>
  37995. <!DOCTYPE memory-map
  37996. PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
  37997. "http://sourceware.org/gdb/gdb-memory-map.dtd">
  37998. <memory-map>
  37999. region...
  38000. </memory-map>
  38001. Each region can be either:
  38002. * A region of RAM starting at ADDR and extending for LENGTH bytes
  38003. from there:
  38004. <memory type="ram" start="ADDR" length="LENGTH"/>
  38005. * A region of read-only memory:
  38006. <memory type="rom" start="ADDR" length="LENGTH"/>
  38007. * A region of flash memory, with erasure blocks BLOCKSIZE bytes in
  38008. length:
  38009. <memory type="flash" start="ADDR" length="LENGTH">
  38010. <property name="blocksize">BLOCKSIZE</property>
  38011. </memory>
  38012. Regions must not overlap. GDB assumes that areas of memory not
  38013. covered by the memory map are RAM, and uses the ordinary 'M' and 'X'
  38014. packets to write to addresses in such ranges.
  38015. The formal DTD for memory map format is given below:
  38016. <!-- ................................................... -->
  38017. <!-- Memory Map XML DTD ................................ -->
  38018. <!-- File: memory-map.dtd .............................. -->
  38019. <!-- .................................... .............. -->
  38020. <!-- memory-map.dtd -->
  38021. <!-- memory-map: Root element with versioning -->
  38022. <!ELEMENT memory-map (memory)*>
  38023. <!ATTLIST memory-map version CDATA #FIXED "1.0.0">
  38024. <!ELEMENT memory (property)*>
  38025. <!-- memory: Specifies a memory region,
  38026. and its type, or device. -->
  38027. <!ATTLIST memory type (ram|rom|flash) #REQUIRED
  38028. start CDATA #REQUIRED
  38029. length CDATA #REQUIRED>
  38030. <!-- property: Generic attribute tag -->
  38031. <!ELEMENT property (#PCDATA | property)*>
  38032. <!ATTLIST property name (blocksize) #REQUIRED>
  38033. 
  38034. File: gdb.info, Node: Thread List Format, Next: Traceframe Info Format, Prev: Memory Map Format, Up: Remote Protocol
  38035. E.17 Thread List Format
  38036. =======================
  38037. To efficiently update the list of threads and their attributes, GDB
  38038. issues the 'qXfer:threads:read' packet (*note qXfer threads read::) and
  38039. obtains the XML document with the following structure:
  38040. <?xml version="1.0"?>
  38041. <threads>
  38042. <thread id="id" core="0" name="name">
  38043. ... description ...
  38044. </thread>
  38045. </threads>
  38046. Each 'thread' element must have the 'id' attribute that identifies
  38047. the thread (*note thread-id syntax::). The 'core' attribute, if
  38048. present, specifies which processor core the thread was last executing
  38049. on. The 'name' attribute, if present, specifies the human-readable name
  38050. of the thread. The content of the of 'thread' element is interpreted as
  38051. human-readable auxiliary information. The 'handle' attribute, if
  38052. present, is a hex encoded representation of the thread handle.
  38053. 
  38054. File: gdb.info, Node: Traceframe Info Format, Next: Branch Trace Format, Prev: Thread List Format, Up: Remote Protocol
  38055. E.18 Traceframe Info Format
  38056. ===========================
  38057. To be able to know which objects in the inferior can be examined when
  38058. inspecting a tracepoint hit, GDB needs to obtain the list of memory
  38059. ranges, registers and trace state variables that have been collected in
  38060. a traceframe.
  38061. This list is obtained using the 'qXfer:traceframe-info:read' (*note
  38062. qXfer traceframe info read::) packet and is an XML document.
  38063. GDB must be linked with the Expat library to support XML traceframe
  38064. info discovery. *Note Expat::.
  38065. The top-level structure of the document is shown below:
  38066. <?xml version="1.0"?>
  38067. <!DOCTYPE traceframe-info
  38068. PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
  38069. "http://sourceware.org/gdb/gdb-traceframe-info.dtd">
  38070. <traceframe-info>
  38071. block...
  38072. </traceframe-info>
  38073. Each traceframe block can be either:
  38074. * A region of collected memory starting at ADDR and extending for
  38075. LENGTH bytes from there:
  38076. <memory start="ADDR" length="LENGTH"/>
  38077. * A block indicating trace state variable numbered NUMBER has been
  38078. collected:
  38079. <tvar id="NUMBER"/>
  38080. The formal DTD for the traceframe info format is given below:
  38081. <!ELEMENT traceframe-info (memory | tvar)* >
  38082. <!ATTLIST traceframe-info version CDATA #FIXED "1.0">
  38083. <!ELEMENT memory EMPTY>
  38084. <!ATTLIST memory start CDATA #REQUIRED
  38085. length CDATA #REQUIRED>
  38086. <!ELEMENT tvar>
  38087. <!ATTLIST tvar id CDATA #REQUIRED>
  38088. 
  38089. File: gdb.info, Node: Branch Trace Format, Next: Branch Trace Configuration Format, Prev: Traceframe Info Format, Up: Remote Protocol
  38090. E.19 Branch Trace Format
  38091. ========================
  38092. In order to display the branch trace of an inferior thread, GDB needs to
  38093. obtain the list of branches. This list is represented as list of
  38094. sequential code blocks that are connected via branches. The code in
  38095. each block has been executed sequentially.
  38096. This list is obtained using the 'qXfer:btrace:read' (*note qXfer
  38097. btrace read::) packet and is an XML document.
  38098. GDB must be linked with the Expat library to support XML traceframe
  38099. info discovery. *Note Expat::.
  38100. The top-level structure of the document is shown below:
  38101. <?xml version="1.0"?>
  38102. <!DOCTYPE btrace
  38103. PUBLIC "+//IDN gnu.org//DTD GDB Branch Trace V1.0//EN"
  38104. "http://sourceware.org/gdb/gdb-btrace.dtd">
  38105. <btrace>
  38106. block...
  38107. </btrace>
  38108. * A block of sequentially executed instructions starting at BEGIN and
  38109. ending at END:
  38110. <block begin="BEGIN" end="END"/>
  38111. The formal DTD for the branch trace format is given below:
  38112. <!ELEMENT btrace (block* | pt) >
  38113. <!ATTLIST btrace version CDATA #FIXED "1.0">
  38114. <!ELEMENT block EMPTY>
  38115. <!ATTLIST block begin CDATA #REQUIRED
  38116. end CDATA #REQUIRED>
  38117. <!ELEMENT pt (pt-config?, raw?)>
  38118. <!ELEMENT pt-config (cpu?)>
  38119. <!ELEMENT cpu EMPTY>
  38120. <!ATTLIST cpu vendor CDATA #REQUIRED
  38121. family CDATA #REQUIRED
  38122. model CDATA #REQUIRED
  38123. stepping CDATA #REQUIRED>
  38124. <!ELEMENT raw (#PCDATA)>
  38125. 
  38126. File: gdb.info, Node: Branch Trace Configuration Format, Prev: Branch Trace Format, Up: Remote Protocol
  38127. E.20 Branch Trace Configuration Format
  38128. ======================================
  38129. For each inferior thread, GDB can obtain the branch trace configuration
  38130. using the 'qXfer:btrace-conf:read' (*note qXfer btrace-conf read::)
  38131. packet.
  38132. The configuration describes the branch trace format and configuration
  38133. settings for that format. The following information is described:
  38134. 'bts'
  38135. This thread uses the "Branch Trace Store" (BTS) format.
  38136. 'size'
  38137. The size of the BTS ring buffer in bytes.
  38138. 'pt'
  38139. This thread uses the "Intel Processor Trace" (Intel PT) format.
  38140. 'size'
  38141. The size of the Intel PT ring buffer in bytes.
  38142. GDB must be linked with the Expat library to support XML branch trace
  38143. configuration discovery. *Note Expat::.
  38144. The formal DTD for the branch trace configuration format is given
  38145. below:
  38146. <!ELEMENT btrace-conf (bts?, pt?)>
  38147. <!ATTLIST btrace-conf version CDATA #FIXED "1.0">
  38148. <!ELEMENT bts EMPTY>
  38149. <!ATTLIST bts size CDATA #IMPLIED>
  38150. <!ELEMENT pt EMPTY>
  38151. <!ATTLIST pt size CDATA #IMPLIED>
  38152. 
  38153. File: gdb.info, Node: Agent Expressions, Next: Target Descriptions, Prev: Remote Protocol, Up: Top
  38154. Appendix F The GDB Agent Expression Mechanism
  38155. *********************************************
  38156. In some applications, it is not feasible for the debugger to interrupt
  38157. the program's execution long enough for the developer to learn anything
  38158. helpful about its behavior. If the program's correctness depends on its
  38159. real-time behavior, delays introduced by a debugger might cause the
  38160. program to fail, even when the code itself is correct. It is useful to
  38161. be able to observe the program's behavior without interrupting it.
  38162. Using GDB's 'trace' and 'collect' commands, the user can specify
  38163. locations in the program, and arbitrary expressions to evaluate when
  38164. those locations are reached. Later, using the 'tfind' command, she can
  38165. examine the values those expressions had when the program hit the trace
  38166. points. The expressions may also denote objects in memory -- structures
  38167. or arrays, for example -- whose values GDB should record; while visiting
  38168. a particular tracepoint, the user may inspect those objects as if they
  38169. were in memory at that moment. However, because GDB records these
  38170. values without interacting with the user, it can do so quickly and
  38171. unobtrusively, hopefully not disturbing the program's behavior.
  38172. When GDB is debugging a remote target, the GDB "agent" code running
  38173. on the target computes the values of the expressions itself. To avoid
  38174. having a full symbolic expression evaluator on the agent, GDB translates
  38175. expressions in the source language into a simpler bytecode language, and
  38176. then sends the bytecode to the agent; the agent then executes the
  38177. bytecode, and records the values for GDB to retrieve later.
  38178. The bytecode language is simple; there are forty-odd opcodes, the
  38179. bulk of which are the usual vocabulary of C operands (addition,
  38180. subtraction, shifts, and so on) and various sizes of literals and memory
  38181. reference operations. The bytecode interpreter operates strictly on
  38182. machine-level values -- various sizes of integers and floating point
  38183. numbers -- and requires no information about types or symbols; thus, the
  38184. interpreter's internal data structures are simple, and each bytecode
  38185. requires only a few native machine instructions to implement it. The
  38186. interpreter is small, and strict limits on the memory and time required
  38187. to evaluate an expression are easy to determine, making it suitable for
  38188. use by the debugging agent in real-time applications.
  38189. * Menu:
  38190. * General Bytecode Design:: Overview of the interpreter.
  38191. * Bytecode Descriptions:: What each one does.
  38192. * Using Agent Expressions:: How agent expressions fit into the big picture.
  38193. * Varying Target Capabilities:: How to discover what the target can do.
  38194. * Rationale:: Why we did it this way.
  38195. 
  38196. File: gdb.info, Node: General Bytecode Design, Next: Bytecode Descriptions, Up: Agent Expressions
  38197. F.1 General Bytecode Design
  38198. ===========================
  38199. The agent represents bytecode expressions as an array of bytes. Each
  38200. instruction is one byte long (thus the term "bytecode"). Some
  38201. instructions are followed by operand bytes; for example, the 'goto'
  38202. instruction is followed by a destination for the jump.
  38203. The bytecode interpreter is a stack-based machine; most instructions
  38204. pop their operands off the stack, perform some operation, and push the
  38205. result back on the stack for the next instruction to consume. Each
  38206. element of the stack may contain either a integer or a floating point
  38207. value; these values are as many bits wide as the largest integer that
  38208. can be directly manipulated in the source language. Stack elements
  38209. carry no record of their type; bytecode could push a value as an
  38210. integer, then pop it as a floating point value. However, GDB will not
  38211. generate code which does this. In C, one might define the type of a
  38212. stack element as follows:
  38213. union agent_val {
  38214. LONGEST l;
  38215. DOUBLEST d;
  38216. };
  38217. where 'LONGEST' and 'DOUBLEST' are 'typedef' names for the largest
  38218. integer and floating point types on the machine.
  38219. By the time the bytecode interpreter reaches the end of the
  38220. expression, the value of the expression should be the only value left on
  38221. the stack. For tracing applications, 'trace' bytecodes in the
  38222. expression will have recorded the necessary data, and the value on the
  38223. stack may be discarded. For other applications, like conditional
  38224. breakpoints, the value may be useful.
  38225. Separate from the stack, the interpreter has two registers:
  38226. 'pc'
  38227. The address of the next bytecode to execute.
  38228. 'start'
  38229. The address of the start of the bytecode expression, necessary for
  38230. interpreting the 'goto' and 'if_goto' instructions.
  38231. Neither of these registers is directly visible to the bytecode language
  38232. itself, but they are useful for defining the meanings of the bytecode
  38233. operations.
  38234. There are no instructions to perform side effects on the running
  38235. program, or call the program's functions; we assume that these
  38236. expressions are only used for unobtrusive debugging, not for patching
  38237. the running code.
  38238. Most bytecode instructions do not distinguish between the various
  38239. sizes of values, and operate on full-width values; the upper bits of the
  38240. values are simply ignored, since they do not usually make a difference
  38241. to the value computed. The exceptions to this rule are:
  38242. memory reference instructions ('ref'N)
  38243. There are distinct instructions to fetch different word sizes from
  38244. memory. Once on the stack, however, the values are treated as
  38245. full-size integers. They may need to be sign-extended; the 'ext'
  38246. instruction exists for this purpose.
  38247. the sign-extension instruction ('ext' N)
  38248. These clearly need to know which portion of their operand is to be
  38249. extended to occupy the full length of the word.
  38250. If the interpreter is unable to evaluate an expression completely for
  38251. some reason (a memory location is inaccessible, or a divisor is zero,
  38252. for example), we say that interpretation "terminates with an error".
  38253. This means that the problem is reported back to the interpreter's caller
  38254. in some helpful way. In general, code using agent expressions should
  38255. assume that they may attempt to divide by zero, fetch arbitrary memory
  38256. locations, and misbehave in other ways.
  38257. Even complicated C expressions compile to a few bytecode
  38258. instructions; for example, the expression 'x + y * z' would typically
  38259. produce code like the following, assuming that 'x' and 'y' live in
  38260. registers, and 'z' is a global variable holding a 32-bit 'int':
  38261. reg 1
  38262. reg 2
  38263. const32 address of z
  38264. ref32
  38265. ext 32
  38266. mul
  38267. add
  38268. end
  38269. In detail, these mean:
  38270. 'reg 1'
  38271. Push the value of register 1 (presumably holding 'x') onto the
  38272. stack.
  38273. 'reg 2'
  38274. Push the value of register 2 (holding 'y').
  38275. 'const32 address of z'
  38276. Push the address of 'z' onto the stack.
  38277. 'ref32'
  38278. Fetch a 32-bit word from the address at the top of the stack;
  38279. replace the address on the stack with the value. Thus, we replace
  38280. the address of 'z' with 'z''s value.
  38281. 'ext 32'
  38282. Sign-extend the value on the top of the stack from 32 bits to full
  38283. length. This is necessary because 'z' is a signed integer.
  38284. 'mul'
  38285. Pop the top two numbers on the stack, multiply them, and push their
  38286. product. Now the top of the stack contains the value of the
  38287. expression 'y * z'.
  38288. 'add'
  38289. Pop the top two numbers, add them, and push the sum. Now the top
  38290. of the stack contains the value of 'x + y * z'.
  38291. 'end'
  38292. Stop executing; the value left on the stack top is the value to be
  38293. recorded.
  38294. 
  38295. File: gdb.info, Node: Bytecode Descriptions, Next: Using Agent Expressions, Prev: General Bytecode Design, Up: Agent Expressions
  38296. F.2 Bytecode Descriptions
  38297. =========================
  38298. Each bytecode description has the following form:
  38299. 'add' (0x02): A B => A+B
  38300. Pop the top two stack items, A and B, as integers; push their sum,
  38301. as an integer.
  38302. In this example, 'add' is the name of the bytecode, and '(0x02)' is
  38303. the one-byte value used to encode the bytecode, in hexadecimal. The
  38304. phrase "A B => A+B" shows the stack before and after the bytecode
  38305. executes. Beforehand, the stack must contain at least two values, A and
  38306. B; since the top of the stack is to the right, B is on the top of the
  38307. stack, and A is underneath it. After execution, the bytecode will have
  38308. popped A and B from the stack, and replaced them with a single value,
  38309. A+B. There may be other values on the stack below those shown, but the
  38310. bytecode affects only those shown.
  38311. Here is another example:
  38312. 'const8' (0x22) N: => N
  38313. Push the 8-bit integer constant N on the stack, without sign
  38314. extension.
  38315. In this example, the bytecode 'const8' takes an operand N directly
  38316. from the bytecode stream; the operand follows the 'const8' bytecode
  38317. itself. We write any such operands immediately after the name of the
  38318. bytecode, before the colon, and describe the exact encoding of the
  38319. operand in the bytecode stream in the body of the bytecode description.
  38320. For the 'const8' bytecode, there are no stack items given before the
  38321. =>; this simply means that the bytecode consumes no values from the
  38322. stack. If a bytecode consumes no values, or produces no values, the
  38323. list on either side of the => may be empty.
  38324. If a value is written as A, B, or N, then the bytecode treats it as
  38325. an integer. If a value is written is ADDR, then the bytecode treats it
  38326. as an address.
  38327. We do not fully describe the floating point operations here; although
  38328. this design can be extended in a clean way to handle floating point
  38329. values, they are not of immediate interest to the customer, so we avoid
  38330. describing them, to save time.
  38331. 'float' (0x01): =>
  38332. Prefix for floating-point bytecodes. Not implemented yet.
  38333. 'add' (0x02): A B => A+B
  38334. Pop two integers from the stack, and push their sum, as an integer.
  38335. 'sub' (0x03): A B => A-B
  38336. Pop two integers from the stack, subtract the top value from the
  38337. next-to-top value, and push the difference.
  38338. 'mul' (0x04): A B => A*B
  38339. Pop two integers from the stack, multiply them, and push the
  38340. product on the stack. Note that, when one multiplies two N-bit
  38341. numbers yielding another N-bit number, it is irrelevant whether the
  38342. numbers are signed or not; the results are the same.
  38343. 'div_signed' (0x05): A B => A/B
  38344. Pop two signed integers from the stack; divide the next-to-top
  38345. value by the top value, and push the quotient. If the divisor is
  38346. zero, terminate with an error.
  38347. 'div_unsigned' (0x06): A B => A/B
  38348. Pop two unsigned 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. 'rem_signed' (0x07): A B => A MODULO B
  38352. Pop two signed integers from the stack; divide the next-to-top
  38353. value by the top value, and push the remainder. If the divisor is
  38354. zero, terminate with an error.
  38355. 'rem_unsigned' (0x08): A B => A MODULO B
  38356. Pop two unsigned 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. 'lsh' (0x09): A B => A<<B
  38360. Pop two integers from the stack; let A be the next-to-top value,
  38361. and B be the top value. Shift A left by B bits, and push the
  38362. result.
  38363. 'rsh_signed' (0x0a): A B => '(signed)'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 right by B bits, inserting copies
  38366. of the top bit at the high end, and push the result.
  38367. 'rsh_unsigned' (0x0b): A B => 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 zero
  38370. bits at the high end, and push the result.
  38371. 'log_not' (0x0e): A => !A
  38372. Pop an integer from the stack; if it is zero, push the value one;
  38373. otherwise, push the value zero.
  38374. 'bit_and' (0x0f): A B => A&B
  38375. Pop two integers from the stack, and push their bitwise 'and'.
  38376. 'bit_or' (0x10): A B => A|B
  38377. Pop two integers from the stack, and push their bitwise 'or'.
  38378. 'bit_xor' (0x11): A B => A^B
  38379. Pop two integers from the stack, and push their bitwise
  38380. exclusive-'or'.
  38381. 'bit_not' (0x12): A => ~A
  38382. Pop an integer from the stack, and push its bitwise complement.
  38383. 'equal' (0x13): A B => A=B
  38384. Pop two integers from the stack; if they are equal, push the value
  38385. one; otherwise, push the value zero.
  38386. 'less_signed' (0x14): A B => A<B
  38387. Pop two signed integers from the stack; if the next-to-top value is
  38388. less than the top value, push the value one; otherwise, push the
  38389. value zero.
  38390. 'less_unsigned' (0x15): A B => A<B
  38391. Pop two unsigned integers from the stack; if the next-to-top value
  38392. is less than the top value, push the value one; otherwise, push the
  38393. value zero.
  38394. 'ext' (0x16) N: A => A, sign-extended from N bits
  38395. Pop an unsigned value from the stack; treating it as an N-bit
  38396. twos-complement value, extend it to full length. This means that
  38397. all bits to the left of bit N-1 (where the least significant bit is
  38398. bit 0) are set to the value of bit N-1. Note that N may be larger
  38399. than or equal to the width of the stack elements of the bytecode
  38400. engine; in this case, the bytecode should have no effect.
  38401. The number of source bits to preserve, N, is encoded as a single
  38402. byte unsigned integer following the 'ext' bytecode.
  38403. 'zero_ext' (0x2a) N: A => A, zero-extended from N bits
  38404. Pop an unsigned value from the stack; zero all but the bottom N
  38405. bits.
  38406. The number of source bits to preserve, N, is encoded as a single
  38407. byte unsigned integer following the 'zero_ext' bytecode.
  38408. 'ref8' (0x17): ADDR => A
  38409. 'ref16' (0x18): ADDR => A
  38410. 'ref32' (0x19): ADDR => A
  38411. 'ref64' (0x1a): ADDR => A
  38412. Pop an address ADDR from the stack. For bytecode 'ref'N, fetch an
  38413. N-bit value from ADDR, using the natural target endianness. Push
  38414. the fetched value as an unsigned integer.
  38415. Note that ADDR may not be aligned in any particular way; the 'refN'
  38416. bytecodes should operate correctly for any address.
  38417. If attempting to access memory at ADDR would cause a processor
  38418. exception of some sort, terminate with an error.
  38419. 'ref_float' (0x1b): ADDR => D
  38420. 'ref_double' (0x1c): ADDR => D
  38421. 'ref_long_double' (0x1d): ADDR => D
  38422. 'l_to_d' (0x1e): A => D
  38423. 'd_to_l' (0x1f): D => A
  38424. Not implemented yet.
  38425. 'dup' (0x28): A => A A
  38426. Push another copy of the stack's top element.
  38427. 'swap' (0x2b): A B => B A
  38428. Exchange the top two items on the stack.
  38429. 'pop' (0x29): A =>
  38430. Discard the top value on the stack.
  38431. 'pick' (0x32) N: A ... B => A ... B A
  38432. Duplicate an item from the stack and push it on the top of the
  38433. stack. N, a single byte, indicates the stack item to copy. If N
  38434. is zero, this is the same as 'dup'; if N is one, it copies the item
  38435. under the top item, etc. If N exceeds the number of items on the
  38436. stack, terminate with an error.
  38437. 'rot' (0x33): A B C => C A B
  38438. Rotate the top three items on the stack. The top item (c) becomes
  38439. the third item, the next-to-top item (b) becomes the top item and
  38440. the third item (a) from the top becomes the next-to-top item.
  38441. 'if_goto' (0x20) OFFSET: A =>
  38442. Pop an integer off the stack; if it is non-zero, branch to the
  38443. given offset in the bytecode string. Otherwise, continue to the
  38444. next instruction in the bytecode stream. In other words, if A is
  38445. non-zero, set the 'pc' register to 'start' + OFFSET. Thus, an
  38446. offset of zero denotes the beginning of the expression.
  38447. The OFFSET is stored as a sixteen-bit unsigned value, stored
  38448. immediately following the 'if_goto' bytecode. It is always stored
  38449. most significant byte first, regardless of the target's normal
  38450. endianness. The offset is not guaranteed to fall at any particular
  38451. alignment within the bytecode stream; thus, on machines where
  38452. fetching a 16-bit on an unaligned address raises an exception, you
  38453. should fetch the offset one byte at a time.
  38454. 'goto' (0x21) OFFSET: =>
  38455. Branch unconditionally to OFFSET; in other words, set the 'pc'
  38456. register to 'start' + OFFSET.
  38457. The offset is stored in the same way as for the 'if_goto' bytecode.
  38458. 'const8' (0x22) N: => N
  38459. 'const16' (0x23) N: => N
  38460. 'const32' (0x24) N: => N
  38461. 'const64' (0x25) N: => N
  38462. Push the integer constant N on the stack, without sign extension.
  38463. To produce a small negative value, push a small twos-complement
  38464. value, and then sign-extend it using the 'ext' bytecode.
  38465. The constant N is stored in the appropriate number of bytes
  38466. following the 'const'B bytecode. The constant N is always stored
  38467. most significant byte first, regardless of the target's normal
  38468. endianness. The constant is not guaranteed to fall at any
  38469. particular alignment within the bytecode stream; thus, on machines
  38470. where fetching a 16-bit on an unaligned address raises an
  38471. exception, you should fetch N one byte at a time.
  38472. 'reg' (0x26) N: => A
  38473. Push the value of register number N, without sign extension. The
  38474. registers are numbered following GDB's conventions.
  38475. The register number N is encoded as a 16-bit unsigned integer
  38476. immediately following the 'reg' bytecode. It is always stored most
  38477. significant byte first, regardless of the target's normal
  38478. endianness. The register number is not guaranteed to fall at any
  38479. particular alignment within the bytecode stream; thus, on machines
  38480. where fetching a 16-bit on an unaligned address raises an
  38481. exception, you should fetch the register number one byte at a time.
  38482. 'getv' (0x2c) N: => V
  38483. Push the value of trace state variable number N, without sign
  38484. extension.
  38485. The variable number N is encoded as a 16-bit unsigned integer
  38486. immediately following the 'getv' bytecode. It is always stored
  38487. most significant byte first, regardless of the target's normal
  38488. endianness. The variable number is not guaranteed to fall at any
  38489. particular alignment within the bytecode stream; thus, on machines
  38490. where fetching a 16-bit on an unaligned address raises an
  38491. exception, you should fetch the register number one byte at a time.
  38492. 'setv' (0x2d) N: V => V
  38493. Set trace state variable number N to the value found on the top of
  38494. the stack. The stack is unchanged, so that the value is readily
  38495. available if the assignment is part of a larger expression. The
  38496. handling of N is as described for 'getv'.
  38497. 'trace' (0x0c): ADDR SIZE =>
  38498. Record the contents of the SIZE bytes at ADDR in a trace buffer,
  38499. for later retrieval by GDB.
  38500. 'trace_quick' (0x0d) SIZE: ADDR => ADDR
  38501. Record the contents of the SIZE bytes at ADDR in a trace buffer,
  38502. for later retrieval by GDB. SIZE is a single byte unsigned integer
  38503. following the 'trace' opcode.
  38504. This bytecode is equivalent to the sequence 'dup const8 SIZE
  38505. trace', but we provide it anyway to save space in bytecode strings.
  38506. 'trace16' (0x30) SIZE: ADDR => ADDR
  38507. Identical to trace_quick, except that SIZE is a 16-bit big-endian
  38508. unsigned integer, not a single byte. This should probably have
  38509. been named 'trace_quick16', for consistency.
  38510. 'tracev' (0x2e) N: => A
  38511. Record the value of trace state variable number N in the trace
  38512. buffer. The handling of N is as described for 'getv'.
  38513. 'tracenz' (0x2f) ADDR SIZE =>
  38514. Record the bytes at ADDR in a trace buffer, for later retrieval by
  38515. GDB. Stop at either the first zero byte, or when SIZE bytes have
  38516. been recorded, whichever occurs first.
  38517. 'printf' (0x34) NUMARGS STRING =>
  38518. Do a formatted print, in the style of the C function 'printf').
  38519. The value of NUMARGS is the number of arguments to expect on the
  38520. stack, while STRING is the format string, prefixed with a two-byte
  38521. length. The last byte of the string must be zero, and is included
  38522. in the length. The format string includes escaped sequences just
  38523. as it appears in C source, so for instance the format string
  38524. '"\t%d\n"' is six characters long, and the output will consist of a
  38525. tab character, a decimal number, and a newline. At the top of the
  38526. stack, above the values to be printed, this bytecode will pop a
  38527. "function" and "channel". If the function is nonzero, then the
  38528. target may treat it as a function and call it, passing the channel
  38529. as a first argument, as with the C function 'fprintf'. If the
  38530. function is zero, then the target may simply call a standard
  38531. formatted print function of its choice. In all, this bytecode pops
  38532. 2 + NUMARGS stack elements, and pushes nothing.
  38533. 'end' (0x27): =>
  38534. Stop executing bytecode; the result should be the top element of
  38535. the stack. If the purpose of the expression was to compute an
  38536. lvalue or a range of memory, then the next-to-top of the stack is
  38537. the lvalue's address, and the top of the stack is the lvalue's
  38538. size, in bytes.
  38539. 
  38540. File: gdb.info, Node: Using Agent Expressions, Next: Varying Target Capabilities, Prev: Bytecode Descriptions, Up: Agent Expressions
  38541. F.3 Using Agent Expressions
  38542. ===========================
  38543. Agent expressions can be used in several different ways by GDB, and the
  38544. debugger can generate different bytecode sequences as appropriate.
  38545. One possibility is to do expression evaluation on the target rather
  38546. than the host, such as for the conditional of a conditional tracepoint.
  38547. In such a case, GDB compiles the source expression into a bytecode
  38548. sequence that simply gets values from registers or memory, does
  38549. arithmetic, and returns a result.
  38550. Another way to use agent expressions is for tracepoint data
  38551. collection. GDB generates a different bytecode sequence for collection;
  38552. in addition to bytecodes that do the calculation, GDB adds 'trace'
  38553. bytecodes to save the pieces of memory that were used.
  38554. * The user selects trace points in the program's code at which GDB
  38555. should collect data.
  38556. * The user specifies expressions to evaluate at each trace point.
  38557. These expressions may denote objects in memory, in which case those
  38558. objects' contents are recorded as the program runs, or computed
  38559. values, in which case the values themselves are recorded.
  38560. * GDB transmits the tracepoints and their associated expressions to
  38561. the GDB agent, running on the debugging target.
  38562. * The agent arranges to be notified when a trace point is hit.
  38563. * When execution on the target reaches a trace point, the agent
  38564. evaluates the expressions associated with that trace point, and
  38565. records the resulting values and memory ranges.
  38566. * Later, when the user selects a given trace event and inspects the
  38567. objects and expression values recorded, GDB talks to the agent to
  38568. retrieve recorded data as necessary to meet the user's requests.
  38569. If the user asks to see an object whose contents have not been
  38570. recorded, GDB reports an error.
  38571. 
  38572. File: gdb.info, Node: Varying Target Capabilities, Next: Rationale, Prev: Using Agent Expressions, Up: Agent Expressions
  38573. F.4 Varying Target Capabilities
  38574. ===============================
  38575. Some targets don't support floating-point, and some would rather not
  38576. have to deal with 'long long' operations. Also, different targets will
  38577. have different stack sizes, and different bytecode buffer lengths.
  38578. Thus, GDB needs a way to ask the target about itself. We haven't
  38579. worked out the details yet, but in general, GDB should be able to send
  38580. the target a packet asking it to describe itself. The reply should be a
  38581. packet whose length is explicit, so we can add new information to the
  38582. packet in future revisions of the agent, without confusing old versions
  38583. of GDB, and it should contain a version number. It should contain at
  38584. least the following information:
  38585. * whether floating point is supported
  38586. * whether 'long long' is supported
  38587. * maximum acceptable size of bytecode stack
  38588. * maximum acceptable length of bytecode expressions
  38589. * which registers are actually available for collection
  38590. * whether the target supports disabled tracepoints
  38591. 
  38592. File: gdb.info, Node: Rationale, Prev: Varying Target Capabilities, Up: Agent Expressions
  38593. F.5 Rationale
  38594. =============
  38595. Some of the design decisions apparent above are arguable.
  38596. What about stack overflow/underflow?
  38597. GDB should be able to query the target to discover its stack size.
  38598. Given that information, GDB can determine at translation time
  38599. whether a given expression will overflow the stack. But this spec
  38600. isn't about what kinds of error-checking GDB ought to do.
  38601. Why are you doing everything in LONGEST?
  38602. Speed isn't important, but agent code size is; using LONGEST brings
  38603. in a bunch of support code to do things like division, etc. So
  38604. this is a serious concern.
  38605. First, note that you don't need different bytecodes for different
  38606. operand sizes. You can generate code without _knowing_ how big the
  38607. stack elements actually are on the target. If the target only
  38608. supports 32-bit ints, and you don't send any 64-bit bytecodes,
  38609. everything just works. The observation here is that the MIPS and
  38610. the Alpha have only fixed-size registers, and you can still get C's
  38611. semantics even though most instructions only operate on full-sized
  38612. words. You just need to make sure everything is properly
  38613. sign-extended at the right times. So there is no need for 32- and
  38614. 64-bit variants of the bytecodes. Just implement everything using
  38615. the largest size you support.
  38616. GDB should certainly check to see what sizes the target supports,
  38617. so the user can get an error earlier, rather than later. But this
  38618. information is not necessary for correctness.
  38619. Why don't you have '>' or '<=' operators?
  38620. I want to keep the interpreter small, and we don't need them. We
  38621. can combine the 'less_' opcodes with 'log_not', and swap the order
  38622. of the operands, yielding all four asymmetrical comparison
  38623. operators. For example, '(x <= y)' is '! (x > y)', which is '! (y
  38624. < x)'.
  38625. Why do you have 'log_not'?
  38626. Why do you have 'ext'?
  38627. Why do you have 'zero_ext'?
  38628. These are all easily synthesized from other instructions, but I
  38629. expect them to be used frequently, and they're simple, so I include
  38630. them to keep bytecode strings short.
  38631. 'log_not' is equivalent to 'const8 0 equal'; it's used in half the
  38632. relational operators.
  38633. 'ext N' is equivalent to 'const8 S-N lsh const8 S-N rsh_signed',
  38634. where S is the size of the stack elements; it follows 'refM' and
  38635. REG bytecodes when the value should be signed. See the next
  38636. bulleted item.
  38637. 'zero_ext N' is equivalent to 'constM MASK log_and'; it's used
  38638. whenever we push the value of a register, because we can't assume
  38639. the upper bits of the register aren't garbage.
  38640. Why not have sign-extending variants of the 'ref' operators?
  38641. Because that would double the number of 'ref' operators, and we
  38642. need the 'ext' bytecode anyway for accessing bitfields.
  38643. Why not have constant-address variants of the 'ref' operators?
  38644. Because that would double the number of 'ref' operators again, and
  38645. 'const32 ADDRESS ref32' is only one byte longer.
  38646. Why do the 'refN' operators have to support unaligned fetches?
  38647. GDB will generate bytecode that fetches multi-byte values at
  38648. unaligned addresses whenever the executable's debugging information
  38649. tells it to. Furthermore, GDB does not know the value the pointer
  38650. will have when GDB generates the bytecode, so it cannot determine
  38651. whether a particular fetch will be aligned or not.
  38652. In particular, structure bitfields may be several bytes long, but
  38653. follow no alignment rules; members of packed structures are not
  38654. necessarily aligned either.
  38655. In general, there are many cases where unaligned references occur
  38656. in correct C code, either at the programmer's explicit request, or
  38657. at the compiler's discretion. Thus, it is simpler to make the GDB
  38658. agent bytecodes work correctly in all circumstances than to make
  38659. GDB guess in each case whether the compiler did the usual thing.
  38660. Why are there no side-effecting operators?
  38661. Because our current client doesn't want them? That's a cheap
  38662. answer. I think the real answer is that I'm afraid of implementing
  38663. function calls. We should re-visit this issue after the present
  38664. contract is delivered.
  38665. Why aren't the 'goto' ops PC-relative?
  38666. The interpreter has the base address around anyway for PC bounds
  38667. checking, and it seemed simpler.
  38668. Why is there only one offset size for the 'goto' ops?
  38669. Offsets are currently sixteen bits. I'm not happy with this
  38670. situation either:
  38671. Suppose we have multiple branch ops with different offset sizes.
  38672. As I generate code left-to-right, all my jumps are forward jumps
  38673. (there are no loops in expressions), so I never know the target
  38674. when I emit the jump opcode. Thus, I have to either always assume
  38675. the largest offset size, or do jump relaxation on the code after I
  38676. generate it, which seems like a big waste of time.
  38677. I can imagine a reasonable expression being longer than 256 bytes.
  38678. I can't imagine one being longer than 64k. Thus, we need 16-bit
  38679. offsets. This kind of reasoning is so bogus, but relaxation is
  38680. pathetic.
  38681. The other approach would be to generate code right-to-left. Then
  38682. I'd always know my offset size. That might be fun.
  38683. Where is the function call bytecode?
  38684. When we add side-effects, we should add this.
  38685. Why does the 'reg' bytecode take a 16-bit register number?
  38686. Intel's IA-64 architecture has 128 general-purpose registers, and
  38687. 128 floating-point registers, and I'm sure it has some random
  38688. control registers.
  38689. Why do we need 'trace' and 'trace_quick'?
  38690. Because GDB needs to record all the memory contents and registers
  38691. an expression touches. If the user wants to evaluate an expression
  38692. 'x->y->z', the agent must record the values of 'x' and 'x->y' as
  38693. well as the value of 'x->y->z'.
  38694. Don't the 'trace' bytecodes make the interpreter less general?
  38695. They do mean that the interpreter contains special-purpose code,
  38696. but that doesn't mean the interpreter can only be used for that
  38697. purpose. If an expression doesn't use the 'trace' bytecodes, they
  38698. don't get in its way.
  38699. Why doesn't 'trace_quick' consume its arguments the way everything else does?
  38700. In general, you do want your operators to consume their arguments;
  38701. it's consistent, and generally reduces the amount of stack
  38702. rearrangement necessary. However, 'trace_quick' is a kludge to
  38703. save space; it only exists so we needn't write 'dup const8 SIZE
  38704. trace' before every memory reference. Therefore, it's okay for it
  38705. not to consume its arguments; it's meant for a specific context in
  38706. which we know exactly what it should do with the stack. If we're
  38707. going to have a kludge, it should be an effective kludge.
  38708. Why does 'trace16' exist?
  38709. That opcode was added by the customer that contracted Cygnus for
  38710. the data tracing work. I personally think it is unnecessary;
  38711. objects that large will be quite rare, so it is okay to use 'dup
  38712. const16 SIZE trace' in those cases.
  38713. Whatever we decide to do with 'trace16', we should at least leave
  38714. opcode 0x30 reserved, to remain compatible with the customer who
  38715. added it.
  38716. 
  38717. File: gdb.info, Node: Target Descriptions, Next: Operating System Information, Prev: Agent Expressions, Up: Top
  38718. Appendix G Target Descriptions
  38719. ******************************
  38720. One of the challenges of using GDB to debug embedded systems is that
  38721. there are so many minor variants of each processor architecture in use.
  38722. It is common practice for vendors to start with a standard processor
  38723. core -- ARM, PowerPC, or MIPS, for example -- and then make changes to
  38724. adapt it to a particular market niche. Some architectures have hundreds
  38725. of variants, available from dozens of vendors. This leads to a number
  38726. of problems:
  38727. * With so many different customized processors, it is difficult for
  38728. the GDB maintainers to keep up with the changes.
  38729. * Since individual variants may have short lifetimes or limited
  38730. audiences, it may not be worthwhile to carry information about
  38731. every variant in the GDB source tree.
  38732. * When GDB does support the architecture of the embedded system at
  38733. hand, the task of finding the correct architecture name to give the
  38734. 'set architecture' command can be error-prone.
  38735. To address these problems, the GDB remote protocol allows a target
  38736. system to not only identify itself to GDB, but to actually describe its
  38737. own features. This lets GDB support processor variants it has never
  38738. seen before -- to the extent that the descriptions are accurate, and
  38739. that GDB understands them.
  38740. GDB must be linked with the Expat library to support XML target
  38741. descriptions. *Note Expat::.
  38742. * Menu:
  38743. * Retrieving Descriptions:: How descriptions are fetched from a target.
  38744. * Target Description Format:: The contents of a target description.
  38745. * Predefined Target Types:: Standard types available for target
  38746. descriptions.
  38747. * Enum Target Types:: How to define enum target types.
  38748. * Standard Target Features:: Features GDB knows about.
  38749. 
  38750. File: gdb.info, Node: Retrieving Descriptions, Next: Target Description Format, Up: Target Descriptions
  38751. G.1 Retrieving Descriptions
  38752. ===========================
  38753. Target descriptions can be read from the target automatically, or
  38754. specified by the user manually. The default behavior is to read the
  38755. description from the target. GDB retrieves it via the remote protocol
  38756. using 'qXfer' requests (*note qXfer: General Query Packets.). The ANNEX
  38757. in the 'qXfer' packet will be 'target.xml'. The contents of the
  38758. 'target.xml' annex are an XML document, of the form described in *note
  38759. Target Description Format::.
  38760. Alternatively, you can specify a file to read for the target
  38761. description. If a file is set, the target will not be queried. The
  38762. commands to specify a file are:
  38763. 'set tdesc filename PATH'
  38764. Read the target description from PATH.
  38765. 'unset tdesc filename'
  38766. Do not read the XML target description from a file. GDB will use
  38767. the description supplied by the current target.
  38768. 'show tdesc filename'
  38769. Show the filename to read for a target description, if any.
  38770. 
  38771. File: gdb.info, Node: Target Description Format, Next: Predefined Target Types, Prev: Retrieving Descriptions, Up: Target Descriptions
  38772. G.2 Target Description Format
  38773. =============================
  38774. A target description annex is an XML (http://www.w3.org/XML/) document
  38775. which complies with the Document Type Definition provided in the GDB
  38776. sources in 'gdb/features/gdb-target.dtd'. This means you can use
  38777. generally available tools like 'xmllint' to check that your feature
  38778. descriptions are well-formed and valid. However, to help people
  38779. unfamiliar with XML write descriptions for their targets, we also
  38780. describe the grammar here.
  38781. Target descriptions can identify the architecture of the remote
  38782. target and (for some architectures) provide information about custom
  38783. register sets. They can also identify the OS ABI of the remote target.
  38784. GDB can use this information to autoconfigure for your target, or to
  38785. warn you if you connect to an unsupported target.
  38786. Here is a simple target description:
  38787. <target version="1.0">
  38788. <architecture>i386:x86-64</architecture>
  38789. </target>
  38790. This minimal description only says that the target uses the x86-64
  38791. architecture.
  38792. A target description has the following overall form, with [ ] marking
  38793. optional elements and ... marking repeatable elements. The elements are
  38794. explained further below.
  38795. <?xml version="1.0"?>
  38796. <!DOCTYPE target SYSTEM "gdb-target.dtd">
  38797. <target version="1.0">
  38798. [ARCHITECTURE]
  38799. [OSABI]
  38800. [COMPATIBLE]
  38801. [FEATURE...]
  38802. </target>
  38803. The description is generally insensitive to whitespace and line breaks,
  38804. under the usual common-sense rules. The XML version declaration and
  38805. document type declaration can generally be omitted (GDB does not require
  38806. them), but specifying them may be useful for XML validation tools. The
  38807. 'version' attribute for '<target>' may also be omitted, but we recommend
  38808. including it; if future versions of GDB use an incompatible revision of
  38809. 'gdb-target.dtd', they will detect and report the version mismatch.
  38810. G.2.1 Inclusion
  38811. ---------------
  38812. It can sometimes be valuable to split a target description up into
  38813. several different annexes, either for organizational purposes, or to
  38814. share files between different possible target descriptions. You can
  38815. divide a description into multiple files by replacing any element of the
  38816. target description with an inclusion directive of the form:
  38817. <xi:include href="DOCUMENT"/>
  38818. When GDB encounters an element of this form, it will retrieve the named
  38819. XML DOCUMENT, and replace the inclusion directive with the contents of
  38820. that document. If the current description was read using 'qXfer', then
  38821. so will be the included document; DOCUMENT will be interpreted as the
  38822. name of an annex. If the current description was read from a file, GDB
  38823. will look for DOCUMENT as a file in the same directory where it found
  38824. the original description.
  38825. G.2.2 Architecture
  38826. ------------------
  38827. An '<architecture>' element has this form:
  38828. <architecture>ARCH</architecture>
  38829. ARCH is one of the architectures from the set accepted by 'set
  38830. architecture' (*note Specifying a Debugging Target: Targets.).
  38831. G.2.3 OS ABI
  38832. ------------
  38833. This optional field was introduced in GDB version 7.0. Previous
  38834. versions of GDB ignore it.
  38835. An '<osabi>' element has this form:
  38836. <osabi>ABI-NAME</osabi>
  38837. ABI-NAME is an OS ABI name from the same selection accepted by
  38838. 'set osabi' (*note Configuring the Current ABI: ABI.).
  38839. G.2.4 Compatible Architecture
  38840. -----------------------------
  38841. This optional field was introduced in GDB version 7.0. Previous
  38842. versions of GDB ignore it.
  38843. A '<compatible>' element has this form:
  38844. <compatible>ARCH</compatible>
  38845. ARCH is one of the architectures from the set accepted by 'set
  38846. architecture' (*note Specifying a Debugging Target: Targets.).
  38847. A '<compatible>' element is used to specify that the target is able
  38848. to run binaries in some other than the main target architecture given by
  38849. the '<architecture>' element. For example, on the Cell Broadband
  38850. Engine, the main architecture is 'powerpc:common' or 'powerpc:common64',
  38851. but the system is able to run binaries in the 'spu' architecture as
  38852. well. The way to describe this capability with '<compatible>' is as
  38853. follows:
  38854. <architecture>powerpc:common</architecture>
  38855. <compatible>spu</compatible>
  38856. G.2.5 Features
  38857. --------------
  38858. Each '<feature>' describes some logical portion of the target system.
  38859. Features are currently used to describe available CPU registers and the
  38860. types of their contents. A '<feature>' element has this form:
  38861. <feature name="NAME">
  38862. [TYPE...]
  38863. REG...
  38864. </feature>
  38865. Each feature's name should be unique within the description. The name
  38866. of a feature does not matter unless GDB has some special knowledge of
  38867. the contents of that feature; if it does, the feature should have its
  38868. standard name. *Note Standard Target Features::.
  38869. G.2.6 Types
  38870. -----------
  38871. Any register's value is a collection of bits which GDB must interpret.
  38872. The default interpretation is a two's complement integer, but other
  38873. types can be requested by name in the register description. Some
  38874. predefined types are provided by GDB (*note Predefined Target Types::),
  38875. and the description can define additional composite and enum types.
  38876. Each type element must have an 'id' attribute, which gives a unique
  38877. (within the containing '<feature>') name to the type. Types must be
  38878. defined before they are used.
  38879. Some targets offer vector registers, which can be treated as arrays
  38880. of scalar elements. These types are written as '<vector>' elements,
  38881. specifying the array element type, TYPE, and the number of elements,
  38882. COUNT:
  38883. <vector id="ID" type="TYPE" count="COUNT"/>
  38884. If a register's value is usefully viewed in multiple ways, define it
  38885. with a union type containing the useful representations. The '<union>'
  38886. element contains one or more '<field>' elements, each of which has a
  38887. NAME and a TYPE:
  38888. <union id="ID">
  38889. <field name="NAME" type="TYPE"/>
  38890. ...
  38891. </union>
  38892. If a register's value is composed from several separate values,
  38893. define it with either a structure type or a flags type. A flags type
  38894. may only contain bitfields. A structure type may either contain only
  38895. bitfields or contain no bitfields. If the value contains only
  38896. bitfields, its total size in bytes must be specified.
  38897. Non-bitfield values have a NAME and TYPE.
  38898. <struct id="ID">
  38899. <field name="NAME" type="TYPE"/>
  38900. ...
  38901. </struct>
  38902. Both NAME and TYPE values are required. No implicit padding is
  38903. added.
  38904. Bitfield values have a NAME, START, END and TYPE.
  38905. <struct id="ID" size="SIZE">
  38906. <field name="NAME" start="START" end="END" type="TYPE"/>
  38907. ...
  38908. </struct>
  38909. <flags id="ID" size="SIZE">
  38910. <field name="NAME" start="START" end="END" type="TYPE"/>
  38911. ...
  38912. </flags>
  38913. The NAME value is required. Bitfield values may be named with the
  38914. empty string, '""', in which case the field is "filler" and its value is
  38915. not printed. Not all bits need to be specified, so "filler" fields are
  38916. optional.
  38917. The START and END values are required, and TYPE is optional. The
  38918. field's START must be less than or equal to its END, and zero represents
  38919. the least significant bit.
  38920. The default value of TYPE is 'bool' for single bit fields, and an
  38921. unsigned integer otherwise.
  38922. Which to choose? Structures or flags?
  38923. Registers defined with 'flags' have these advantages over defining
  38924. them with 'struct':
  38925. * Arithmetic may be performed on them as if they were integers.
  38926. * They are printed in a more readable fashion.
  38927. Registers defined with 'struct' have one advantage over defining them
  38928. with 'flags':
  38929. * One can fetch individual fields like in 'C'.
  38930. (gdb) print $my_struct_reg.field3
  38931. $1 = 42
  38932. G.2.7 Registers
  38933. ---------------
  38934. Each register is represented as an element with this form:
  38935. <reg name="NAME"
  38936. bitsize="SIZE"
  38937. [regnum="NUM"]
  38938. [save-restore="SAVE-RESTORE"]
  38939. [type="TYPE"]
  38940. [group="GROUP"]/>
  38941. The components are as follows:
  38942. NAME
  38943. The register's name; it must be unique within the target
  38944. description.
  38945. BITSIZE
  38946. The register's size, in bits.
  38947. REGNUM
  38948. The register's number. If omitted, a register's number is one
  38949. greater than that of the previous register (either in the current
  38950. feature or in a preceding feature); the first register in the
  38951. target description defaults to zero. This register number is used
  38952. to read or write the register; e.g. it is used in the remote 'p'
  38953. and 'P' packets, and registers appear in the 'g' and 'G' packets in
  38954. order of increasing register number.
  38955. SAVE-RESTORE
  38956. Whether the register should be preserved across inferior function
  38957. calls; this must be either 'yes' or 'no'. The default is 'yes',
  38958. which is appropriate for most registers except for some system
  38959. control registers; this is not related to the target's ABI.
  38960. TYPE
  38961. The type of the register. It may be a predefined type, a type
  38962. defined in the current feature, or one of the special types 'int'
  38963. and 'float'. 'int' is an integer type of the correct size for
  38964. BITSIZE, and 'float' is a floating point type (in the
  38965. architecture's normal floating point format) of the correct size
  38966. for BITSIZE. The default is 'int'.
  38967. GROUP
  38968. The register group to which this register belongs. It can be one
  38969. of the standard register groups 'general', 'float', 'vector' or an
  38970. arbitrary string. Group names should be limited to alphanumeric
  38971. characters. If a group name is made up of multiple words the words
  38972. may be separated by hyphens; e.g. 'special-group' or
  38973. 'ultra-special-group'. If no GROUP is specified, GDB will not
  38974. display the register in 'info registers'.
  38975. 
  38976. File: gdb.info, Node: Predefined Target Types, Next: Enum Target Types, Prev: Target Description Format, Up: Target Descriptions
  38977. G.3 Predefined Target Types
  38978. ===========================
  38979. Type definitions in the self-description can build up composite types
  38980. from basic building blocks, but can not define fundamental types.
  38981. Instead, standard identifiers are provided by GDB for the fundamental
  38982. types. The currently supported types are:
  38983. 'bool'
  38984. Boolean type, occupying a single bit.
  38985. 'int8'
  38986. 'int16'
  38987. 'int24'
  38988. 'int32'
  38989. 'int64'
  38990. 'int128'
  38991. Signed integer types holding the specified number of bits.
  38992. 'uint8'
  38993. 'uint16'
  38994. 'uint24'
  38995. 'uint32'
  38996. 'uint64'
  38997. 'uint128'
  38998. Unsigned integer types holding the specified number of bits.
  38999. 'code_ptr'
  39000. 'data_ptr'
  39001. Pointers to unspecified code and data. The program counter and any
  39002. dedicated return address register may be marked as code pointers;
  39003. printing a code pointer converts it into a symbolic address. The
  39004. stack pointer and any dedicated address registers may be marked as
  39005. data pointers.
  39006. 'ieee_single'
  39007. Single precision IEEE floating point.
  39008. 'ieee_double'
  39009. Double precision IEEE floating point.
  39010. 'arm_fpa_ext'
  39011. The 12-byte extended precision format used by ARM FPA registers.
  39012. 'i387_ext'
  39013. The 10-byte extended precision format used by x87 registers.
  39014. 'i386_eflags'
  39015. 32bit EFLAGS register used by x86.
  39016. 'i386_mxcsr'
  39017. 32bit MXCSR register used by x86.
  39018. 
  39019. File: gdb.info, Node: Enum Target Types, Next: Standard Target Features, Prev: Predefined Target Types, Up: Target Descriptions
  39020. G.4 Enum Target Types
  39021. =====================
  39022. Enum target types are useful in 'struct' and 'flags' register
  39023. descriptions. *Note Target Description Format::.
  39024. Enum types have a name, size and a list of name/value pairs.
  39025. <enum id="ID" size="SIZE">
  39026. <evalue name="NAME" value="VALUE"/>
  39027. ...
  39028. </enum>
  39029. Enums must be defined before they are used.
  39030. <enum id="levels_type" size="4">
  39031. <evalue name="low" value="0"/>
  39032. <evalue name="high" value="1"/>
  39033. </enum>
  39034. <flags id="flags_type" size="4">
  39035. <field name="X" start="0"/>
  39036. <field name="LEVEL" start="1" end="1" type="levels_type"/>
  39037. </flags>
  39038. <reg name="flags" bitsize="32" type="flags_type"/>
  39039. Given that description, a value of 3 for the 'flags' register would
  39040. be printed as:
  39041. (gdb) info register flags
  39042. flags 0x3 [ X LEVEL=high ]
  39043. 
  39044. File: gdb.info, Node: Standard Target Features, Prev: Enum Target Types, Up: Target Descriptions
  39045. G.5 Standard Target Features
  39046. ============================
  39047. A target description must contain either no registers or all the
  39048. target's registers. If the description contains no registers, then GDB
  39049. will assume a default register layout, selected based on the
  39050. architecture. If the description contains any registers, the default
  39051. layout will not be used; the standard registers must be described in the
  39052. target description, in such a way that GDB can recognize them.
  39053. This is accomplished by giving specific names to feature elements
  39054. which contain standard registers. GDB will look for features with those
  39055. names and verify that they contain the expected registers; if any known
  39056. feature is missing required registers, or if any required feature is
  39057. missing, GDB will reject the target description. You can add additional
  39058. registers to any of the standard features -- GDB will display them just
  39059. as if they were added to an unrecognized feature.
  39060. This section lists the known features and their expected contents.
  39061. Sample XML documents for these features are included in the GDB source
  39062. tree, in the directory 'gdb/features'.
  39063. Names recognized by GDB should include the name of the company or
  39064. organization which selected the name, and the overall architecture to
  39065. which the feature applies; so e.g. the feature containing ARM core
  39066. registers is named 'org.gnu.gdb.arm.core'.
  39067. The names of registers are not case sensitive for the purpose of
  39068. recognizing standard features, but GDB will only display registers using
  39069. the capitalization used in the description.
  39070. * Menu:
  39071. * AArch64 Features::
  39072. * ARC Features::
  39073. * ARM Features::
  39074. * i386 Features::
  39075. * MicroBlaze Features::
  39076. * MIPS Features::
  39077. * M68K Features::
  39078. * NDS32 Features::
  39079. * Nios II Features::
  39080. * OpenRISC 1000 Features::
  39081. * PowerPC Features::
  39082. * RISC-V Features::
  39083. * RX Features::
  39084. * S/390 and System z Features::
  39085. * Sparc Features::
  39086. * TIC6x Features::
  39087. 
  39088. File: gdb.info, Node: AArch64 Features, Next: ARC Features, Up: Standard Target Features
  39089. G.5.1 AArch64 Features
  39090. ----------------------
  39091. The 'org.gnu.gdb.aarch64.core' feature is required for AArch64 targets.
  39092. It should contain registers 'x0' through 'x30', 'sp', 'pc', and 'cpsr'.
  39093. The 'org.gnu.gdb.aarch64.fpu' feature is optional. If present, it
  39094. should contain registers 'v0' through 'v31', 'fpsr', and 'fpcr'.
  39095. The 'org.gnu.gdb.aarch64.sve' feature is optional. If present, it
  39096. should contain registers 'z0' through 'z31', 'p0' through 'p15', 'ffr'
  39097. and 'vg'.
  39098. The 'org.gnu.gdb.aarch64.pauth' feature is optional. If present, it
  39099. should contain registers 'pauth_dmask' and 'pauth_cmask'.
  39100. 
  39101. File: gdb.info, Node: ARC Features, Next: ARM Features, Prev: AArch64 Features, Up: Standard Target Features
  39102. G.5.2 ARC Features
  39103. ------------------
  39104. ARC processors are so configurable that even core registers and their
  39105. numbers are not predetermined completely. Moreover, _flags_ and _PC_
  39106. registers, which are important to GDB, are not "core" registers in ARC.
  39107. Therefore, there are two features that their presence is mandatory:
  39108. 'org.gnu.gdb.arc.core' and 'org.gnu.gdb.arc.aux'.
  39109. The 'org.gnu.gdb.arc.core' feature is required for all targets. It
  39110. must contain registers:
  39111. - 'r0' through 'r25' for normal register file targets.
  39112. - 'r0' through 'r3', and 'r10' through 'r15' for reduced register
  39113. file targets.
  39114. - 'gp', 'fp', 'sp', 'r30'(1), 'blink', 'lp_count', 'pcl'.
  39115. In case of an ARCompact target (ARCv1 ISA), the
  39116. 'org.gnu.gdb.arc.core' feature may contain registers 'ilink1' and
  39117. 'ilink2'. While in case of ARC EM and ARC HS targets (ARCv2 ISA),
  39118. register 'ilink' may be present. The difference between ARCv1 and ARCv2
  39119. is the naming of registers _29th_ and _30th_. They are called 'ilink1'
  39120. and 'ilink2' for ARCv1 and are optional. For ARCv2, they are called
  39121. 'ilink' and 'r30' and only 'ilink' is optional. The optionality of
  39122. 'ilink*' registers is because of their inaccessibility during user space
  39123. debugging sessions.
  39124. Extension core registers 'r32' through 'r59' are optional and their
  39125. existence depends on the configuration. When debugging GNU/Linux
  39126. applications, i.e. user space debugging, these core registers are not
  39127. available.
  39128. The 'org.gnu.gdb.arc.aux' feature is required for all ARC targets.
  39129. Here is the list of registers pertinent to this feature:
  39130. - mandatory: 'pc' and 'status32'.
  39131. - optional: 'lp_start', 'lp_end', and 'bta'.
  39132. ---------- Footnotes ----------
  39133. (1) Not necessary for ARCv1.
  39134. 
  39135. File: gdb.info, Node: ARM Features, Next: i386 Features, Prev: ARC Features, Up: Standard Target Features
  39136. G.5.3 ARM Features
  39137. ------------------
  39138. The 'org.gnu.gdb.arm.core' feature is required for non-M-profile ARM
  39139. targets. It should contain registers 'r0' through 'r13', 'sp', 'lr',
  39140. 'pc', and 'cpsr'.
  39141. For M-profile targets (e.g. Cortex-M3), the 'org.gnu.gdb.arm.core'
  39142. feature is replaced by 'org.gnu.gdb.arm.m-profile'. It should contain
  39143. registers 'r0' through 'r13', 'sp', 'lr', 'pc', and 'xpsr'.
  39144. The 'org.gnu.gdb.arm.fpa' feature is optional. If present, it should
  39145. contain registers 'f0' through 'f7' and 'fps'.
  39146. The 'org.gnu.gdb.xscale.iwmmxt' feature is optional. If present, it
  39147. should contain at least registers 'wR0' through 'wR15' and 'wCGR0'
  39148. through 'wCGR3'. The 'wCID', 'wCon', 'wCSSF', and 'wCASF' registers are
  39149. optional.
  39150. The 'org.gnu.gdb.arm.vfp' feature is optional. If present, it should
  39151. contain at least registers 'd0' through 'd15'. If they are present,
  39152. 'd16' through 'd31' should also be included. GDB will synthesize the
  39153. single-precision registers from halves of the double-precision
  39154. registers.
  39155. The 'org.gnu.gdb.arm.neon' feature is optional. It does not need to
  39156. contain registers; it instructs GDB to display the VFP double-precision
  39157. registers as vectors and to synthesize the quad-precision registers from
  39158. pairs of double-precision registers. If this feature is present,
  39159. 'org.gnu.gdb.arm.vfp' must also be present and include 32
  39160. double-precision registers.
  39161. 
  39162. File: gdb.info, Node: i386 Features, Next: MicroBlaze Features, Prev: ARM Features, Up: Standard Target Features
  39163. G.5.4 i386 Features
  39164. -------------------
  39165. The 'org.gnu.gdb.i386.core' feature is required for i386/amd64 targets.
  39166. It should describe the following registers:
  39167. - 'eax' through 'edi' plus 'eip' for i386
  39168. - 'rax' through 'r15' plus 'rip' for amd64
  39169. - 'eflags', 'cs', 'ss', 'ds', 'es', 'fs', 'gs'
  39170. - 'st0' through 'st7'
  39171. - 'fctrl', 'fstat', 'ftag', 'fiseg', 'fioff', 'foseg', 'fooff' and
  39172. 'fop'
  39173. The register sets may be different, depending on the target.
  39174. The 'org.gnu.gdb.i386.sse' feature is optional. It should describe
  39175. registers:
  39176. - 'xmm0' through 'xmm7' for i386
  39177. - 'xmm0' through 'xmm15' for amd64
  39178. - 'mxcsr'
  39179. The 'org.gnu.gdb.i386.avx' feature is optional and requires the
  39180. 'org.gnu.gdb.i386.sse' feature. It should describe the upper 128 bits
  39181. of YMM registers:
  39182. - 'ymm0h' through 'ymm7h' for i386
  39183. - 'ymm0h' through 'ymm15h' for amd64
  39184. The 'org.gnu.gdb.i386.mpx' is an optional feature representing Intel
  39185. Memory Protection Extension (MPX). It should describe the following
  39186. registers:
  39187. - 'bnd0raw' through 'bnd3raw' for i386 and amd64.
  39188. - 'bndcfgu' and 'bndstatus' for i386 and amd64.
  39189. The 'org.gnu.gdb.i386.linux' feature is optional. It should describe
  39190. a single register, 'orig_eax'.
  39191. The 'org.gnu.gdb.i386.segments' feature is optional. It should
  39192. describe two system registers: 'fs_base' and 'gs_base'.
  39193. The 'org.gnu.gdb.i386.avx512' feature is optional and requires the
  39194. 'org.gnu.gdb.i386.avx' feature. It should describe additional XMM
  39195. registers:
  39196. - 'xmm16h' through 'xmm31h', only valid for amd64.
  39197. It should describe the upper 128 bits of additional YMM registers:
  39198. - 'ymm16h' through 'ymm31h', only valid for amd64.
  39199. It should describe the upper 256 bits of ZMM registers:
  39200. - 'zmm0h' through 'zmm7h' for i386.
  39201. - 'zmm0h' through 'zmm15h' for amd64.
  39202. It should describe the additional ZMM registers:
  39203. - 'zmm16h' through 'zmm31h', only valid for amd64.
  39204. The 'org.gnu.gdb.i386.pkeys' feature is optional. It should describe
  39205. a single register, 'pkru'. It is a 32-bit register valid for i386 and
  39206. amd64.
  39207. 
  39208. File: gdb.info, Node: MicroBlaze Features, Next: MIPS Features, Prev: i386 Features, Up: Standard Target Features
  39209. G.5.5 MicroBlaze Features
  39210. -------------------------
  39211. The 'org.gnu.gdb.microblaze.core' feature is required for MicroBlaze
  39212. targets. It should contain registers 'r0' through 'r31', 'rpc', 'rmsr',
  39213. 'rear', 'resr', 'rfsr', 'rbtr', 'rpvr', 'rpvr1' through 'rpvr11',
  39214. 'redr', 'rpid', 'rzpr', 'rtlbx', 'rtlbsx', 'rtlblo', and 'rtlbhi'.
  39215. The 'org.gnu.gdb.microblaze.stack-protect' feature is optional. If
  39216. present, it should contain registers 'rshr' and 'rslr'
  39217. 
  39218. File: gdb.info, Node: MIPS Features, Next: M68K Features, Prev: MicroBlaze Features, Up: Standard Target Features
  39219. G.5.6 MIPS Features
  39220. -------------------
  39221. The 'org.gnu.gdb.mips.cpu' feature is required for MIPS targets. It
  39222. should contain registers 'r0' through 'r31', 'lo', 'hi', and 'pc'. They
  39223. may be 32-bit or 64-bit depending on the target.
  39224. The 'org.gnu.gdb.mips.cp0' feature is also required. It should
  39225. contain at least the 'status', 'badvaddr', and 'cause' registers. They
  39226. may be 32-bit or 64-bit depending on the target.
  39227. The 'org.gnu.gdb.mips.fpu' feature is currently required, though it
  39228. may be optional in a future version of GDB. It should contain registers
  39229. 'f0' through 'f31', 'fcsr', and 'fir'. They may be 32-bit or 64-bit
  39230. depending on the target.
  39231. The 'org.gnu.gdb.mips.dsp' feature is optional. It should contain
  39232. registers 'hi1' through 'hi3', 'lo1' through 'lo3', and 'dspctl'. The
  39233. 'dspctl' register should be 32-bit and the rest may be 32-bit or 64-bit
  39234. depending on the target.
  39235. The 'org.gnu.gdb.mips.linux' feature is optional. It should contain
  39236. a single register, 'restart', which is used by the Linux kernel to
  39237. control restartable syscalls.
  39238. 
  39239. File: gdb.info, Node: M68K Features, Next: NDS32 Features, Prev: MIPS Features, Up: Standard Target Features
  39240. G.5.7 M68K Features
  39241. -------------------
  39242. ''org.gnu.gdb.m68k.core''
  39243. ''org.gnu.gdb.coldfire.core''
  39244. ''org.gnu.gdb.fido.core''
  39245. One of those features must be always present. The feature that is
  39246. present determines which flavor of m68k is used. The feature that
  39247. is present should contain registers 'd0' through 'd7', 'a0' through
  39248. 'a5', 'fp', 'sp', 'ps' and 'pc'.
  39249. ''org.gnu.gdb.coldfire.fp''
  39250. This feature is optional. If present, it should contain registers
  39251. 'fp0' through 'fp7', 'fpcontrol', 'fpstatus' and 'fpiaddr'.
  39252. Note that, despite the fact that this feature's name says
  39253. 'coldfire', it is used to describe any floating point registers.
  39254. The size of the registers must match the main m68k flavor; so, for
  39255. example, if the primary feature is reported as 'coldfire', then
  39256. 64-bit floating point registers are required.
  39257. 
  39258. File: gdb.info, Node: NDS32 Features, Next: Nios II Features, Prev: M68K Features, Up: Standard Target Features
  39259. G.5.8 NDS32 Features
  39260. --------------------
  39261. The 'org.gnu.gdb.nds32.core' feature is required for NDS32 targets. It
  39262. should contain at least registers 'r0' through 'r10', 'r15', 'fp', 'gp',
  39263. 'lp', 'sp', and 'pc'.
  39264. The 'org.gnu.gdb.nds32.fpu' feature is optional. If present, it
  39265. should contain 64-bit double-precision floating-point registers 'fd0'
  39266. through _fdN_, which should be 'fd3', 'fd7', 'fd15', or 'fd31' based on
  39267. the FPU configuration implemented.
  39268. _Note:_ The first sixteen 64-bit double-precision floating-point
  39269. registers are overlapped with the thirty-two 32-bit single-precision
  39270. floating-point registers. The 32-bit single-precision registers, if not
  39271. being listed explicitly, will be synthesized from halves of the
  39272. overlapping 64-bit double-precision registers. Listing 32-bit
  39273. single-precision registers explicitly is deprecated, and the support to
  39274. it could be totally removed some day.
  39275. 
  39276. File: gdb.info, Node: Nios II Features, Next: OpenRISC 1000 Features, Prev: NDS32 Features, Up: Standard Target Features
  39277. G.5.9 Nios II Features
  39278. ----------------------
  39279. The 'org.gnu.gdb.nios2.cpu' feature is required for Nios II targets. It
  39280. should contain the 32 core registers ('zero', 'at', 'r2' through 'r23',
  39281. 'et' through 'ra'), 'pc', and the 16 control registers ('status' through
  39282. 'mpuacc').
  39283. 
  39284. File: gdb.info, Node: OpenRISC 1000 Features, Next: PowerPC Features, Prev: Nios II Features, Up: Standard Target Features
  39285. G.5.10 Openrisc 1000 Features
  39286. -----------------------------
  39287. The 'org.gnu.gdb.or1k.group0' feature is required for OpenRISC 1000
  39288. targets. It should contain the 32 general purpose registers ('r0'
  39289. through 'r31'), 'ppc', 'npc' and 'sr'.
  39290. 
  39291. File: gdb.info, Node: PowerPC Features, Next: RISC-V Features, Prev: OpenRISC 1000 Features, Up: Standard Target Features
  39292. G.5.11 PowerPC Features
  39293. -----------------------
  39294. The 'org.gnu.gdb.power.core' feature is required for PowerPC targets.
  39295. It should contain registers 'r0' through 'r31', 'pc', 'msr', 'cr', 'lr',
  39296. 'ctr', and 'xer'. They may be 32-bit or 64-bit depending on the target.
  39297. The 'org.gnu.gdb.power.fpu' feature is optional. It should contain
  39298. registers 'f0' through 'f31' and 'fpscr'.
  39299. The 'org.gnu.gdb.power.altivec' feature is optional. It should
  39300. contain registers 'vr0' through 'vr31', 'vscr', and 'vrsave'. GDB will
  39301. define pseudo-registers 'v0' through 'v31' as aliases for the
  39302. corresponding 'vrX' registers.
  39303. The 'org.gnu.gdb.power.vsx' feature is optional. It should contain
  39304. registers 'vs0h' through 'vs31h'. GDB will combine these registers with
  39305. the floating point registers ('f0' through 'f31') and the altivec
  39306. registers ('vr0' through 'vr31') to present the 128-bit wide registers
  39307. 'vs0' through 'vs63', the set of vector-scalar registers for POWER7.
  39308. Therefore, this feature requires both 'org.gnu.gdb.power.fpu' and
  39309. 'org.gnu.gdb.power.altivec'.
  39310. The 'org.gnu.gdb.power.spe' feature is optional. It should contain
  39311. registers 'ev0h' through 'ev31h', 'acc', and 'spefscr'. SPE targets
  39312. should provide 32-bit registers in 'org.gnu.gdb.power.core' and provide
  39313. the upper halves in 'ev0h' through 'ev31h'. GDB will combine these to
  39314. present registers 'ev0' through 'ev31' to the user.
  39315. The 'org.gnu.gdb.power.ppr' feature is optional. It should contain
  39316. the 64-bit register 'ppr'.
  39317. The 'org.gnu.gdb.power.dscr' feature is optional. It should contain
  39318. the 64-bit register 'dscr'.
  39319. The 'org.gnu.gdb.power.tar' feature is optional. It should contain
  39320. the 64-bit register 'tar'.
  39321. The 'org.gnu.gdb.power.ebb' feature is optional. It should contain
  39322. registers 'bescr', 'ebbhr' and 'ebbrr', all 64-bit wide.
  39323. The 'org.gnu.gdb.power.linux.pmu' feature is optional. It should
  39324. contain registers 'mmcr0', 'mmcr2', 'siar', 'sdar' and 'sier', all
  39325. 64-bit wide. This is the subset of the isa 2.07 server PMU registers
  39326. provided by GNU/Linux.
  39327. The 'org.gnu.gdb.power.htm.spr' feature is optional. It should
  39328. contain registers 'tfhar', 'texasr' and 'tfiar', all 64-bit wide.
  39329. The 'org.gnu.gdb.power.htm.core' feature is optional. It should
  39330. contain the checkpointed general-purpose registers 'cr0' through 'cr31',
  39331. as well as the checkpointed registers 'clr' and 'cctr'. These registers
  39332. may all be either 32-bit or 64-bit depending on the target. It should
  39333. also contain the checkpointed registers 'ccr' and 'cxer', which should
  39334. both be 32-bit wide.
  39335. The 'org.gnu.gdb.power.htm.fpu' feature is optional. It should
  39336. contain the checkpointed 64-bit floating-point registers 'cf0' through
  39337. 'cf31', as well as the checkpointed 64-bit register 'cfpscr'.
  39338. The 'org.gnu.gdb.power.htm.altivec' feature is optional. It should
  39339. contain the checkpointed altivec registers 'cvr0' through 'cvr31', all
  39340. 128-bit wide. It should also contain the checkpointed registers 'cvscr'
  39341. and 'cvrsave', both 32-bit wide.
  39342. The 'org.gnu.gdb.power.htm.vsx' feature is optional. It should
  39343. contain registers 'cvs0h' through 'cvs31h'. GDB will combine these
  39344. registers with the checkpointed floating point registers ('cf0' through
  39345. 'cf31') and the checkpointed altivec registers ('cvr0' through 'cvr31')
  39346. to present the 128-bit wide checkpointed vector-scalar registers 'cvs0'
  39347. through 'cvs63'. Therefore, this feature requires both
  39348. 'org.gnu.gdb.power.htm.altivec' and 'org.gnu.gdb.power.htm.fpu'.
  39349. The 'org.gnu.gdb.power.htm.ppr' feature is optional. It should
  39350. contain the 64-bit checkpointed register 'cppr'.
  39351. The 'org.gnu.gdb.power.htm.dscr' feature is optional. It should
  39352. contain the 64-bit checkpointed register 'cdscr'.
  39353. The 'org.gnu.gdb.power.htm.tar' feature is optional. It should
  39354. contain the 64-bit checkpointed register 'ctar'.
  39355. 
  39356. File: gdb.info, Node: RISC-V Features, Next: RX Features, Prev: PowerPC Features, Up: Standard Target Features
  39357. G.5.12 RISC-V Features
  39358. ----------------------
  39359. The 'org.gnu.gdb.riscv.cpu' feature is required for RISC-V targets. It
  39360. should contain the registers 'x0' through 'x31', and 'pc'. Either the
  39361. architectural names ('x0', 'x1', etc) can be used, or the ABI names
  39362. ('zero', 'ra', etc).
  39363. The 'org.gnu.gdb.riscv.fpu' feature is optional. If present, it
  39364. should contain registers 'f0' through 'f31', 'fflags', 'frm', and
  39365. 'fcsr'. As with the cpu feature, either the architectural register
  39366. names, or the ABI names can be used.
  39367. The 'org.gnu.gdb.riscv.virtual' feature is optional. If present, it
  39368. should contain registers that are not backed by real registers on the
  39369. target, but are instead virtual, where the register value is derived
  39370. from other target state. In many ways these are like GDBs
  39371. pseudo-registers, except implemented by the target. Currently the only
  39372. register expected in this set is the one byte 'priv' register that
  39373. contains the target's privilege level in the least significant two bits.
  39374. The 'org.gnu.gdb.riscv.csr' feature is optional. If present, it
  39375. should contain all of the target's standard CSRs. Standard CSRs are
  39376. those defined in the RISC-V specification documents. There is some
  39377. overlap between this feature and the fpu feature; the 'fflags', 'frm',
  39378. and 'fcsr' registers could be in either feature. The expectation is
  39379. that these registers will be in the fpu feature if the target has
  39380. floating point hardware, but can be moved into the csr feature if the
  39381. target has the floating point control registers, but no other floating
  39382. point hardware.
  39383. 
  39384. File: gdb.info, Node: RX Features, Next: S/390 and System z Features, Prev: RISC-V Features, Up: Standard Target Features
  39385. G.5.13 RX Features
  39386. ------------------
  39387. The 'org.gnu.gdb.rx.core' feature is required for RX targets. It should
  39388. contain the registers 'r0' through 'r15', 'usp', 'isp', 'psw', 'pc',
  39389. 'intb', 'bpsw', 'bpc', 'fintv', 'fpsw', and 'acc'.
  39390. 
  39391. File: gdb.info, Node: S/390 and System z Features, Next: Sparc Features, Prev: RX Features, Up: Standard Target Features
  39392. G.5.14 S/390 and System z Features
  39393. ----------------------------------
  39394. The 'org.gnu.gdb.s390.core' feature is required for S/390 and System z
  39395. targets. It should contain the PSW and the 16 general registers. In
  39396. particular, System z targets should provide the 64-bit registers 'pswm',
  39397. 'pswa', and 'r0' through 'r15'. S/390 targets should provide the 32-bit
  39398. versions of these registers. A System z target that runs in 31-bit
  39399. addressing mode should provide 32-bit versions of 'pswm' and 'pswa', as
  39400. well as the general register's upper halves 'r0h' through 'r15h', and
  39401. their lower halves 'r0l' through 'r15l'.
  39402. The 'org.gnu.gdb.s390.fpr' feature is required. It should contain
  39403. the 64-bit registers 'f0' through 'f15', and 'fpc'.
  39404. The 'org.gnu.gdb.s390.acr' feature is required. It should contain
  39405. the 32-bit registers 'acr0' through 'acr15'.
  39406. The 'org.gnu.gdb.s390.linux' feature is optional. It should contain
  39407. the register 'orig_r2', which is 64-bit wide on System z targets and
  39408. 32-bit otherwise. In addition, the feature may contain the 'last_break'
  39409. register, whose width depends on the addressing mode, as well as the
  39410. 'system_call' register, which is always 32-bit wide.
  39411. The 'org.gnu.gdb.s390.tdb' feature is optional. It should contain
  39412. the 64-bit registers 'tdb0', 'tac', 'tct', 'atia', and 'tr0' through
  39413. 'tr15'.
  39414. The 'org.gnu.gdb.s390.vx' feature is optional. It should contain
  39415. 64-bit wide registers 'v0l' through 'v15l', which will be combined by
  39416. GDB with the floating point registers 'f0' through 'f15' to present the
  39417. 128-bit wide vector registers 'v0' through 'v15'. In addition, this
  39418. feature should contain the 128-bit wide vector registers 'v16' through
  39419. 'v31'.
  39420. The 'org.gnu.gdb.s390.gs' feature is optional. It should contain the
  39421. 64-bit wide guarded-storage-control registers 'gsd', 'gssm', and
  39422. 'gsepla'.
  39423. The 'org.gnu.gdb.s390.gsbc' feature is optional. It should contain
  39424. the 64-bit wide guarded-storage broadcast control registers 'bc_gsd',
  39425. 'bc_gssm', and 'bc_gsepla'.
  39426. 
  39427. File: gdb.info, Node: Sparc Features, Next: TIC6x Features, Prev: S/390 and System z Features, Up: Standard Target Features
  39428. G.5.15 Sparc Features
  39429. ---------------------
  39430. The 'org.gnu.gdb.sparc.cpu' feature is required for sparc32/sparc64
  39431. targets. It should describe the following registers:
  39432. - 'g0' through 'g7'
  39433. - 'o0' through 'o7'
  39434. - 'l0' through 'l7'
  39435. - 'i0' through 'i7'
  39436. They may be 32-bit or 64-bit depending on the target.
  39437. Also the 'org.gnu.gdb.sparc.fpu' feature is required for
  39438. sparc32/sparc64 targets. It should describe the following registers:
  39439. - 'f0' through 'f31'
  39440. - 'f32' through 'f62' for sparc64
  39441. The 'org.gnu.gdb.sparc.cp0' feature is required for sparc32/sparc64
  39442. targets. It should describe the following registers:
  39443. - 'y', 'psr', 'wim', 'tbr', 'pc', 'npc', 'fsr', and 'csr' for sparc32
  39444. - 'pc', 'npc', 'state', 'fsr', 'fprs', and 'y' for sparc64
  39445. 
  39446. File: gdb.info, Node: TIC6x Features, Prev: Sparc Features, Up: Standard Target Features
  39447. G.5.16 TMS320C6x Features
  39448. -------------------------
  39449. The 'org.gnu.gdb.tic6x.core' feature is required for TMS320C6x targets.
  39450. It should contain registers 'A0' through 'A15', registers 'B0' through
  39451. 'B15', 'CSR' and 'PC'.
  39452. The 'org.gnu.gdb.tic6x.gp' feature is optional. It should contain
  39453. registers 'A16' through 'A31' and 'B16' through 'B31'.
  39454. The 'org.gnu.gdb.tic6x.c6xp' feature is optional. It should contain
  39455. registers 'TSR', 'ILC' and 'RILC'.
  39456. 
  39457. File: gdb.info, Node: Operating System Information, Next: Trace File Format, Prev: Target Descriptions, Up: Top
  39458. Appendix H Operating System Information
  39459. ***************************************
  39460. * Menu:
  39461. * Process list::
  39462. Users of GDB often wish to obtain information about the state of the
  39463. operating system running on the target--for example the list of
  39464. processes, or the list of open files. This section describes the
  39465. mechanism that makes it possible. This mechanism is similar to the
  39466. target features mechanism (*note Target Descriptions::), but focuses on
  39467. a different aspect of target.
  39468. Operating system information is retrieved from the target via the
  39469. remote protocol, using 'qXfer' requests (*note qXfer osdata read::).
  39470. The object name in the request should be 'osdata', and the ANNEX
  39471. identifies the data to be fetched.
  39472. 
  39473. File: gdb.info, Node: Process list, Up: Operating System Information
  39474. H.1 Process list
  39475. ================
  39476. When requesting the process list, the ANNEX field in the 'qXfer' request
  39477. should be 'processes'. The returned data is an XML document. The
  39478. formal syntax of this document is defined in 'gdb/features/osdata.dtd'.
  39479. An example document is:
  39480. <?xml version="1.0"?>
  39481. <!DOCTYPE target SYSTEM "osdata.dtd">
  39482. <osdata type="processes">
  39483. <item>
  39484. <column name="pid">1</column>
  39485. <column name="user">root</column>
  39486. <column name="command">/sbin/init</column>
  39487. <column name="cores">1,2,3</column>
  39488. </item>
  39489. </osdata>
  39490. Each item should include a column whose name is 'pid'. The value of
  39491. that column should identify the process on the target. The 'user' and
  39492. 'command' columns are optional, and will be displayed by GDB. The
  39493. 'cores' column, if present, should contain a comma-separated list of
  39494. cores that this process is running on. Target may provide additional
  39495. columns, which GDB currently ignores.
  39496. 
  39497. File: gdb.info, Node: Trace File Format, Next: Index Section Format, Prev: Operating System Information, Up: Top
  39498. Appendix I Trace File Format
  39499. ****************************
  39500. The trace file comes in three parts: a header, a textual description
  39501. section, and a trace frame section with binary data.
  39502. The header has the form '\x7fTRACE0\n'. The first byte is '0x7f' so
  39503. as to indicate that the file contains binary data, while the '0' is a
  39504. version number that may have different values in the future.
  39505. The description section consists of multiple lines of ASCII text
  39506. separated by newline characters ('0xa'). The lines may include a
  39507. variety of optional descriptive or context-setting information, such as
  39508. tracepoint definitions or register set size. GDB will ignore any line
  39509. that it does not recognize. An empty line marks the end of this
  39510. section.
  39511. 'R SIZE'
  39512. Specifies the size of a register block in bytes. This is equal to
  39513. the size of a 'g' packet payload in the remote protocol. SIZE is
  39514. an ascii decimal number. There should be only one such line in a
  39515. single trace file.
  39516. 'status STATUS'
  39517. Trace status. STATUS has the same format as a 'qTStatus' remote
  39518. packet reply. There should be only one such line in a single trace
  39519. file.
  39520. 'tp PAYLOAD'
  39521. Tracepoint definition. The PAYLOAD has the same format as
  39522. 'qTfP'/'qTsP' remote packet reply payload. A single tracepoint may
  39523. take multiple lines of definition, corresponding to the multiple
  39524. reply packets.
  39525. 'tsv PAYLOAD'
  39526. Trace state variable definition. The PAYLOAD has the same format
  39527. as 'qTfV'/'qTsV' remote packet reply payload. A single variable
  39528. may take multiple lines of definition, corresponding to the
  39529. multiple reply packets.
  39530. 'tdesc PAYLOAD'
  39531. Target description in XML format. The PAYLOAD is a single line of
  39532. the XML file. All such lines should be concatenated together to
  39533. get the original XML file. This file is in the same format as
  39534. 'qXfer' 'features' payload, and corresponds to the main
  39535. 'target.xml' file. Includes are not allowed.
  39536. The trace frame section consists of a number of consecutive frames.
  39537. Each frame begins with a two-byte tracepoint number, followed by a
  39538. four-byte size giving the amount of data in the frame. The data in the
  39539. frame consists of a number of blocks, each introduced by a character
  39540. indicating its type (at least register, memory, and trace state
  39541. variable). The data in this section is raw binary, not a hexadecimal or
  39542. other encoding; its endianness matches the target's endianness.
  39543. 'R BYTES'
  39544. Register block. The number and ordering of bytes matches that of a
  39545. 'g' packet in the remote protocol. Note that these are the actual
  39546. bytes, in target order, not a hexadecimal encoding.
  39547. 'M ADDRESS LENGTH BYTES...'
  39548. Memory block. This is a contiguous block of memory, at the 8-byte
  39549. address ADDRESS, with a 2-byte length LENGTH, followed by LENGTH
  39550. bytes.
  39551. 'V NUMBER VALUE'
  39552. Trace state variable block. This records the 8-byte signed value
  39553. VALUE of trace state variable numbered NUMBER.
  39554. Future enhancements of the trace file format may include additional
  39555. types of blocks.
  39556. 
  39557. File: gdb.info, Node: Index Section Format, Next: Man Pages, Prev: Trace File Format, Up: Top
  39558. Appendix J '.gdb_index' section format
  39559. **************************************
  39560. This section documents the index section that is created by 'save
  39561. gdb-index' (*note Index Files::). The index section is DWARF-specific;
  39562. some knowledge of DWARF is assumed in this description.
  39563. The mapped index file format is designed to be directly 'mmap'able on
  39564. any architecture. In most cases, a datum is represented using a
  39565. little-endian 32-bit integer value, called an 'offset_type'. Big endian
  39566. machines must byte-swap the values before using them. Exceptions to
  39567. this rule are noted. The data is laid out such that alignment is always
  39568. respected.
  39569. A mapped index consists of several areas, laid out in order.
  39570. 1. The file header. This is a sequence of values, of 'offset_type'
  39571. unless otherwise noted:
  39572. 1. The version number, currently 8. Versions 1, 2 and 3 are
  39573. obsolete. Version 4 uses a different hashing function from
  39574. versions 5 and 6. Version 6 includes symbols for inlined
  39575. functions, whereas versions 4 and 5 do not. Version 7 adds
  39576. attributes to the CU indices in the symbol table. Version 8
  39577. specifies that symbols from DWARF type units
  39578. ('DW_TAG_type_unit') refer to the type unit's symbol table and
  39579. not the compilation unit ('DW_TAG_comp_unit') using the type.
  39580. GDB will only read version 4, 5, or 6 indices by specifying
  39581. 'set use-deprecated-index-sections on'. GDB has a workaround
  39582. for potentially broken version 7 indices so it is currently
  39583. not flagged as deprecated.
  39584. 2. The offset, from the start of the file, of the CU list.
  39585. 3. The offset, from the start of the file, of the types CU list.
  39586. Note that this area can be empty, in which case this offset
  39587. will be equal to the next offset.
  39588. 4. The offset, from the start of the file, of the address area.
  39589. 5. The offset, from the start of the file, of the symbol table.
  39590. 6. The offset, from the start of the file, of the constant pool.
  39591. 2. The CU list. This is a sequence of pairs of 64-bit little-endian
  39592. values, sorted by the CU offset. The first element in each pair is
  39593. the offset of a CU in the '.debug_info' section. The second
  39594. element in each pair is the length of that CU. References to a CU
  39595. elsewhere in the map are done using a CU index, which is just the
  39596. 0-based index into this table. Note that if there are type CUs,
  39597. then conceptually CUs and type CUs form a single list for the
  39598. purposes of CU indices.
  39599. 3. The types CU list. This is a sequence of triplets of 64-bit
  39600. little-endian values. In a triplet, the first value is the CU
  39601. offset, the second value is the type offset in the CU, and the
  39602. third value is the type signature. The types CU list is not
  39603. sorted.
  39604. 4. The address area. The address area consists of a sequence of
  39605. address entries. Each address entry has three elements:
  39606. 1. The low address. This is a 64-bit little-endian value.
  39607. 2. The high address. This is a 64-bit little-endian value. Like
  39608. 'DW_AT_high_pc', the value is one byte beyond the end.
  39609. 3. The CU index. This is an 'offset_type' value.
  39610. 5. The symbol table. This is an open-addressed hash table. The size
  39611. of the hash table is always a power of 2.
  39612. Each slot in the hash table consists of a pair of 'offset_type'
  39613. values. The first value is the offset of the symbol's name in the
  39614. constant pool. The second value is the offset of the CU vector in
  39615. the constant pool.
  39616. If both values are 0, then this slot in the hash table is empty.
  39617. This is ok because while 0 is a valid constant pool index, it
  39618. cannot be a valid index for both a string and a CU vector.
  39619. The hash value for a table entry is computed by applying an
  39620. iterative hash function to the symbol's name. Starting with an
  39621. initial value of 'r = 0', each (unsigned) character 'c' in the
  39622. string is incorporated into the hash using the formula depending on
  39623. the index version:
  39624. Version 4
  39625. The formula is 'r = r * 67 + c - 113'.
  39626. Versions 5 to 7
  39627. The formula is 'r = r * 67 + tolower (c) - 113'.
  39628. The terminating '\0' is not incorporated into the hash.
  39629. The step size used in the hash table is computed via '((hash * 17)
  39630. & (size - 1)) | 1', where 'hash' is the hash value, and 'size' is
  39631. the size of the hash table. The step size is used to find the next
  39632. candidate slot when handling a hash collision.
  39633. The names of C++ symbols in the hash table are canonicalized. We
  39634. don't currently have a simple description of the canonicalization
  39635. algorithm; if you intend to create new index sections, you must
  39636. read the code.
  39637. 6. The constant pool. This is simply a bunch of bytes. It is
  39638. organized so that alignment is correct: CU vectors are stored
  39639. first, followed by strings.
  39640. A CU vector in the constant pool is a sequence of 'offset_type'
  39641. values. The first value is the number of CU indices in the vector.
  39642. Each subsequent value is the index and symbol attributes of a CU in
  39643. the CU list. This element in the hash table is used to indicate
  39644. which CUs define the symbol and how the symbol is used. See below
  39645. for the format of each CU index+attributes entry.
  39646. A string in the constant pool is zero-terminated.
  39647. Attributes were added to CU index values in '.gdb_index' version 7.
  39648. If a symbol has multiple uses within a CU then there is one CU
  39649. index+attributes value for each use.
  39650. The format of each CU index+attributes entry is as follows (bit 0 =
  39651. LSB):
  39652. Bits 0-23
  39653. This is the index of the CU in the CU list.
  39654. Bits 24-27
  39655. These bits are reserved for future purposes and must be zero.
  39656. Bits 28-30
  39657. The kind of the symbol in the CU.
  39658. 0
  39659. This value is reserved and should not be used. By reserving
  39660. zero the full 'offset_type' value is backwards compatible with
  39661. previous versions of the index.
  39662. 1
  39663. The symbol is a type.
  39664. 2
  39665. The symbol is a variable or an enum value.
  39666. 3
  39667. The symbol is a function.
  39668. 4
  39669. Any other kind of symbol.
  39670. 5,6,7
  39671. These values are reserved.
  39672. Bit 31
  39673. This bit is zero if the value is global and one if it is static.
  39674. The determination of whether a symbol is global or static is
  39675. complicated. The authorative reference is the file 'dwarf2read.c'
  39676. in GDB sources.
  39677. This pseudo-code describes the computation of a symbol's kind and
  39678. global/static attributes in the index.
  39679. is_external = get_attribute (die, DW_AT_external);
  39680. language = get_attribute (cu_die, DW_AT_language);
  39681. switch (die->tag)
  39682. {
  39683. case DW_TAG_typedef:
  39684. case DW_TAG_base_type:
  39685. case DW_TAG_subrange_type:
  39686. kind = TYPE;
  39687. is_static = 1;
  39688. break;
  39689. case DW_TAG_enumerator:
  39690. kind = VARIABLE;
  39691. is_static = language != CPLUS;
  39692. break;
  39693. case DW_TAG_subprogram:
  39694. kind = FUNCTION;
  39695. is_static = ! (is_external || language == ADA);
  39696. break;
  39697. case DW_TAG_constant:
  39698. kind = VARIABLE;
  39699. is_static = ! is_external;
  39700. break;
  39701. case DW_TAG_variable:
  39702. kind = VARIABLE;
  39703. is_static = ! is_external;
  39704. break;
  39705. case DW_TAG_namespace:
  39706. kind = TYPE;
  39707. is_static = 0;
  39708. break;
  39709. case DW_TAG_class_type:
  39710. case DW_TAG_interface_type:
  39711. case DW_TAG_structure_type:
  39712. case DW_TAG_union_type:
  39713. case DW_TAG_enumeration_type:
  39714. kind = TYPE;
  39715. is_static = language != CPLUS;
  39716. break;
  39717. default:
  39718. assert (0);
  39719. }
  39720. 
  39721. File: gdb.info, Node: Man Pages, Next: Copying, Prev: Index Section Format, Up: Top
  39722. Appendix K Manual pages
  39723. ***********************
  39724. * Menu:
  39725. * gdb man:: The GNU Debugger man page
  39726. * gdbserver man:: Remote Server for the GNU Debugger man page
  39727. * gcore man:: Generate a core file of a running program
  39728. * gdbinit man:: gdbinit scripts
  39729. * gdb-add-index man:: Add index files to speed up GDB
  39730. 
  39731. File: gdb.info, Node: gdb man, Next: gdbserver man, Up: Man Pages
  39732. gdb man
  39733. =======
  39734. gdb ['-help'] ['-nh'] ['-nx'] ['-q'] ['-batch'] ['-cd='DIR] ['-f']
  39735. ['-b' BPS] ['-tty='DEV] ['-s' SYMFILE] ['-e' PROG] ['-se' PROG]
  39736. ['-c' CORE] ['-p' PROCID] ['-x' CMDS] ['-d' DIR] [PROG|PROG PROCID|PROG
  39737. CORE]
  39738. The purpose of a debugger such as GDB is to allow you to see what is
  39739. going on "inside" another program while it executes - or what another
  39740. program was doing at the moment it crashed.
  39741. GDB can do four main kinds of things (plus other things in support of
  39742. these) to help you catch bugs in the act:
  39743. * Start your program, specifying anything that might affect its
  39744. behavior.
  39745. * Make your program stop on specified conditions.
  39746. * Examine what has happened, when your program has stopped.
  39747. * Change things in your program, so you can experiment with
  39748. correcting the effects of one bug and go on to learn about another.
  39749. You can use GDB to debug programs written in C, C++, Fortran and
  39750. Modula-2.
  39751. GDB is invoked with the shell command 'gdb'. Once started, it reads
  39752. commands from the terminal until you tell it to exit with the GDB
  39753. command 'quit'. You can get online help from GDB itself by using the
  39754. command 'help'.
  39755. You can run 'gdb' with no arguments or options; but the most usual
  39756. way to start GDB is with one argument or two, specifying an executable
  39757. program as the argument:
  39758. gdb program
  39759. You can also start with both an executable program and a core file
  39760. specified:
  39761. gdb program core
  39762. You can, instead, specify a process ID as a second argument or use
  39763. option '-p', if you want to debug a running process:
  39764. gdb program 1234
  39765. gdb -p 1234
  39766. would attach GDB to process '1234'. With option '-p' you can omit the
  39767. PROGRAM filename.
  39768. Here are some of the most frequently needed GDB commands:
  39769. 'break [FILE:]FUNCTION'
  39770. Set a breakpoint at FUNCTION (in FILE).
  39771. 'run [ARGLIST]'
  39772. Start your program (with ARGLIST, if specified).
  39773. 'bt'
  39774. Backtrace: display the program stack.
  39775. 'print EXPR'
  39776. Display the value of an expression.
  39777. 'c'
  39778. Continue running your program (after stopping, e.g. at a
  39779. breakpoint).
  39780. 'next'
  39781. Execute next program line (after stopping); step _over_ any
  39782. function calls in the line.
  39783. 'edit [FILE:]FUNCTION'
  39784. look at the program line where it is presently stopped.
  39785. 'list [FILE:]FUNCTION'
  39786. type the text of the program in the vicinity of where it is
  39787. presently stopped.
  39788. 'step'
  39789. Execute next program line (after stopping); step _into_ any
  39790. function calls in the line.
  39791. 'help [NAME]'
  39792. Show information about GDB command NAME, or general information
  39793. about using GDB.
  39794. 'quit'
  39795. Exit from GDB.
  39796. Any arguments other than options specify an executable file and core
  39797. file (or process ID); that is, the first argument encountered with no
  39798. associated option flag is equivalent to a '-se' option, and the second,
  39799. if any, is equivalent to a '-c' option if it's the name of a file. Many
  39800. options have both long and short forms; both are shown here. The long
  39801. forms are also recognized if you truncate them, so long as enough of the
  39802. option is present to be unambiguous. (If you prefer, you can flag
  39803. option arguments with '+' rather than '-', though we illustrate the more
  39804. usual convention.)
  39805. All the options and command line arguments you give are processed in
  39806. sequential order. The order makes a difference when the '-x' option is
  39807. used.
  39808. '-help'
  39809. '-h'
  39810. List all options, with brief explanations.
  39811. '-symbols=FILE'
  39812. '-s FILE'
  39813. Read symbol table from file FILE.
  39814. '-write'
  39815. Enable writing into executable and core files.
  39816. '-exec=FILE'
  39817. '-e FILE'
  39818. Use file FILE as the executable file to execute when appropriate,
  39819. and for examining pure data in conjunction with a core dump.
  39820. '-se=FILE'
  39821. Read symbol table from file FILE and use it as the executable file.
  39822. '-core=FILE'
  39823. '-c FILE'
  39824. Use file FILE as a core dump to examine.
  39825. '-command=FILE'
  39826. '-x FILE'
  39827. Execute GDB commands from file FILE.
  39828. '-ex COMMAND'
  39829. Execute given GDB COMMAND.
  39830. '-directory=DIRECTORY'
  39831. '-d DIRECTORY'
  39832. Add DIRECTORY to the path to search for source files.
  39833. '-nh'
  39834. Do not execute commands from '~/.gdbinit'.
  39835. '-nx'
  39836. '-n'
  39837. Do not execute commands from any '.gdbinit' initialization files.
  39838. '-quiet'
  39839. '-q'
  39840. "Quiet". Do not print the introductory and copyright messages.
  39841. These messages are also suppressed in batch mode.
  39842. '-batch'
  39843. Run in batch mode. Exit with status '0' after processing all the
  39844. command files specified with '-x' (and '.gdbinit', if not
  39845. inhibited). Exit with nonzero status if an error occurs in
  39846. executing the GDB commands in the command files.
  39847. Batch mode may be useful for running GDB as a filter, for example
  39848. to download and run a program on another computer; in order to make
  39849. this more useful, the message
  39850. Program exited normally.
  39851. (which is ordinarily issued whenever a program running under GDB
  39852. control terminates) is not issued when running in batch mode.
  39853. '-cd=DIRECTORY'
  39854. Run GDB using DIRECTORY as its working directory, instead of the
  39855. current directory.
  39856. '-fullname'
  39857. '-f'
  39858. Emacs sets this option when it runs GDB as a subprocess. It tells
  39859. GDB to output the full file name and line number in a standard,
  39860. recognizable fashion each time a stack frame is displayed (which
  39861. includes each time the program stops). This recognizable format
  39862. looks like two '\032' characters, followed by the file name, line
  39863. number and character position separated by colons, and a newline.
  39864. The Emacs-to-GDB interface program uses the two '\032' characters
  39865. as a signal to display the source code for the frame.
  39866. '-b BPS'
  39867. Set the line speed (baud rate or bits per second) of any serial
  39868. interface used by GDB for remote debugging.
  39869. '-tty=DEVICE'
  39870. Run using DEVICE for your program's standard input and output.
  39871. 
  39872. File: gdb.info, Node: gdbserver man, Next: gcore man, Prev: gdb man, Up: Man Pages
  39873. gdbserver man
  39874. =============
  39875. gdbserver COMM PROG [ARGS...]
  39876. gdbserver -attach COMM PID
  39877. gdbserver -multi COMM
  39878. 'gdbserver' is a program that allows you to run GDB on a different
  39879. machine than the one which is running the program being debugged.
  39880. Usage (server (target) side)
  39881. ----------------------------
  39882. First, you need to have a copy of the program you want to debug put onto
  39883. the target system. The program can be stripped to save space if needed,
  39884. as 'gdbserver' doesn't care about symbols. All symbol handling is taken
  39885. care of by the GDB running on the host system.
  39886. To use the server, you log on to the target system, and run the
  39887. 'gdbserver' program. You must tell it (a) how to communicate with GDB,
  39888. (b) the name of your program, and (c) its arguments. The general syntax
  39889. is:
  39890. target> gdbserver COMM PROGRAM [ARGS ...]
  39891. For example, using a serial port, you might say:
  39892. target> gdbserver /dev/com1 emacs foo.txt
  39893. This tells 'gdbserver' to debug emacs with an argument of foo.txt,
  39894. and to communicate with GDB via '/dev/com1'. 'gdbserver' now waits
  39895. patiently for the host GDB to communicate with it.
  39896. To use a TCP connection, you could say:
  39897. target> gdbserver host:2345 emacs foo.txt
  39898. This says pretty much the same thing as the last example, except that
  39899. we are going to communicate with the 'host' GDB via TCP. The 'host:2345'
  39900. argument means that we are expecting to see a TCP connection from 'host'
  39901. to local TCP port 2345. (Currently, the 'host' part is ignored.) You
  39902. can choose any number you want for the port number as long as it does
  39903. not conflict with any existing TCP ports on the target system. This
  39904. same port number must be used in the host GDBs 'target remote' command,
  39905. which will be described shortly. Note that if you chose a port number
  39906. that conflicts with another service, 'gdbserver' will print an error
  39907. message and exit.
  39908. 'gdbserver' can also attach to running programs. This is
  39909. accomplished via the '--attach' argument. The syntax is:
  39910. target> gdbserver --attach COMM PID
  39911. PID is the process ID of a currently running process. It isn't
  39912. necessary to point 'gdbserver' at a binary for the running process.
  39913. To start 'gdbserver' without supplying an initial command to run or
  39914. process ID to attach, use the '--multi' command line option. In such
  39915. case you should connect using 'target extended-remote' to start the
  39916. program you want to debug.
  39917. target> gdbserver --multi COMM
  39918. Usage (host side)
  39919. -----------------
  39920. You need an unstripped copy of the target program on your host system,
  39921. since GDB needs to examine its symbol tables and such. Start up GDB as
  39922. you normally would, with the target program as the first argument. (You
  39923. may need to use the '--baud' option if the serial line is running at
  39924. anything except 9600 baud.) That is 'gdb TARGET-PROG', or 'gdb --baud
  39925. BAUD TARGET-PROG'. After that, the only new command you need to know
  39926. about is 'target remote' (or 'target extended-remote'). Its argument is
  39927. either a device name (usually a serial device, like '/dev/ttyb'), or a
  39928. 'HOST:PORT' descriptor. For example:
  39929. (gdb) target remote /dev/ttyb
  39930. communicates with the server via serial line '/dev/ttyb', and:
  39931. (gdb) target remote the-target:2345
  39932. communicates via a TCP connection to port 2345 on host 'the-target',
  39933. where you previously started up 'gdbserver' with the same port number.
  39934. Note that for TCP connections, you must start up 'gdbserver' prior to
  39935. using the 'target remote' command, otherwise you may get an error that
  39936. looks something like 'Connection refused'.
  39937. 'gdbserver' can also debug multiple inferiors at once, described in
  39938. *note Inferiors Connections and Programs::. In such case use the
  39939. 'extended-remote' GDB command variant:
  39940. (gdb) target extended-remote the-target:2345
  39941. The 'gdbserver' option '--multi' may or may not be used in such case.
  39942. There are three different modes for invoking 'gdbserver':
  39943. * Debug a specific program specified by its program name:
  39944. gdbserver COMM PROG [ARGS...]
  39945. The COMM parameter specifies how should the server communicate with
  39946. GDB; it is either a device name (to use a serial line), a TCP port
  39947. number (':1234'), or '-' or 'stdio' to use stdin/stdout of
  39948. 'gdbserver'. Specify the name of the program to debug in PROG.
  39949. Any remaining arguments will be passed to the program verbatim.
  39950. When the program exits, GDB will close the connection, and
  39951. 'gdbserver' will exit.
  39952. * Debug a specific program by specifying the process ID of a running
  39953. program:
  39954. gdbserver --attach COMM PID
  39955. The COMM parameter is as described above. Supply the process ID of
  39956. a running program in PID; GDB will do everything else. Like with
  39957. the previous mode, when the process PID exits, GDB will close the
  39958. connection, and 'gdbserver' will exit.
  39959. * Multi-process mode - debug more than one program/process:
  39960. gdbserver --multi COMM
  39961. In this mode, GDB can instruct 'gdbserver' which command(s) to run.
  39962. Unlike the other 2 modes, GDB will not close the connection when a
  39963. process being debugged exits, so you can debug several processes in
  39964. the same session.
  39965. In each of the modes you may specify these options:
  39966. '--help'
  39967. List all options, with brief explanations.
  39968. '--version'
  39969. This option causes 'gdbserver' to print its version number and
  39970. exit.
  39971. '--attach'
  39972. 'gdbserver' will attach to a running program. The syntax is:
  39973. target> gdbserver --attach COMM PID
  39974. PID is the process ID of a currently running process. It isn't
  39975. necessary to point 'gdbserver' at a binary for the running process.
  39976. '--multi'
  39977. To start 'gdbserver' without supplying an initial command to run or
  39978. process ID to attach, use this command line option. Then you can
  39979. connect using 'target extended-remote' and start the program you
  39980. want to debug. The syntax is:
  39981. target> gdbserver --multi COMM
  39982. '--debug'
  39983. Instruct 'gdbserver' to display extra status information about the
  39984. debugging process. This option is intended for 'gdbserver'
  39985. development and for bug reports to the developers.
  39986. '--remote-debug'
  39987. Instruct 'gdbserver' to display remote protocol debug output. This
  39988. option is intended for 'gdbserver' development and for bug reports
  39989. to the developers.
  39990. '--debug-file=FILENAME'
  39991. Instruct 'gdbserver' to send any debug output to the given
  39992. FILENAME. This option is intended for 'gdbserver' development and
  39993. for bug reports to the developers.
  39994. '--debug-format=option1[,option2,...]'
  39995. Instruct 'gdbserver' to include extra information in each line of
  39996. debugging output. *Note Other Command-Line Arguments for
  39997. gdbserver::.
  39998. '--wrapper'
  39999. Specify a wrapper to launch programs for debugging. The option
  40000. should be followed by the name of the wrapper, then any
  40001. command-line arguments to pass to the wrapper, then '--' indicating
  40002. the end of the wrapper arguments.
  40003. '--once'
  40004. By default, 'gdbserver' keeps the listening TCP port open, so that
  40005. additional connections are possible. However, if you start
  40006. 'gdbserver' with the '--once' option, it will stop listening for
  40007. any further connection attempts after connecting to the first GDB
  40008. session.
  40009. 
  40010. File: gdb.info, Node: gcore man, Next: gdbinit man, Prev: gdbserver man, Up: Man Pages
  40011. gcore
  40012. =====
  40013. gcore [-a] [-o PREFIX] PID1 [PID2...PIDN]
  40014. Generate core dumps of one or more running programs with process IDs
  40015. PID1, PID2, etc. A core file produced by 'gcore' is equivalent to one
  40016. produced by the kernel when the process crashes (and when 'ulimit -c'
  40017. was used to set up an appropriate core dump limit). However, unlike
  40018. after a crash, after 'gcore' finishes its job the program remains
  40019. running without any change.
  40020. '-a'
  40021. Dump all memory mappings. The actual effect of this option depends
  40022. on the Operating System. On GNU/Linux, it will disable
  40023. 'use-coredump-filter' (*note set use-coredump-filter::) and enable
  40024. 'dump-excluded-mappings' (*note set dump-excluded-mappings::).
  40025. '-o PREFIX'
  40026. The optional argument PREFIX specifies the prefix to be used when
  40027. composing the file names of the core dumps. The file name is
  40028. composed as 'PREFIX.PID', where PID is the process ID of the
  40029. running program being analyzed by 'gcore'. If not specified,
  40030. PREFIX defaults to GCORE.
  40031. 
  40032. File: gdb.info, Node: gdbinit man, Next: gdb-add-index man, Prev: gcore man, Up: Man Pages
  40033. gdbinit
  40034. =======
  40035. ~/.gdbinit
  40036. ./.gdbinit
  40037. These files contain GDB commands to automatically execute during GDB
  40038. startup. The lines of contents are canned sequences of commands,
  40039. described in *note Sequences::.
  40040. Please read more in *note Startup::.
  40041. '(not enabled with --with-system-gdbinit during compilation)'
  40042. System-wide initialization file. It is executed unless user
  40043. specified GDB option '-nx' or '-n'. See more in
  40044. '(not enabled with --with-system-gdbinit-dir during compilation)'
  40045. System-wide initialization directory. All files in this directory
  40046. are executed on startup unless user specified GDB option '-nx' or
  40047. '-n', as long as they have a recognized file extension. See more
  40048. in *note System-wide configuration::.
  40049. '~/.gdbinit'
  40050. User initialization file. It is executed unless user specified GDB
  40051. options '-nx', '-n' or '-nh'.
  40052. './.gdbinit'
  40053. Initialization file for current directory. It may need to be
  40054. enabled with GDB security command 'set auto-load local-gdbinit'.
  40055. See more in *note Init File in the Current Directory::.
  40056. 
  40057. File: gdb.info, Node: gdb-add-index man, Prev: gdbinit man, Up: Man Pages
  40058. gdb-add-index
  40059. =============
  40060. gdb-add-index FILENAME
  40061. When GDB finds a symbol file, it scans the symbols in the file in
  40062. order to construct an internal symbol table. This lets most GDB
  40063. operations work quickly-at the cost of a delay early on. For large
  40064. programs, this delay can be quite lengthy, so GDB provides a way to
  40065. build an index, which speeds up startup.
  40066. To determine whether a file contains such an index, use the command
  40067. 'readelf -S filename': the index is stored in a section named
  40068. '.gdb_index'. The index file can only be produced on systems which use
  40069. ELF binaries and DWARF debug information (i.e., sections named
  40070. '.debug_*').
  40071. 'gdb-add-index' uses GDB and 'objdump' found in the 'PATH'
  40072. environment variable. If you want to use different versions of these
  40073. programs, you can specify them through the 'GDB' and 'OBJDUMP'
  40074. environment variables.
  40075. See more in *note Index Files::.
  40076. 
  40077. File: gdb.info, Node: Copying, Next: GNU Free Documentation License, Prev: Man Pages, Up: Top
  40078. Appendix L GNU GENERAL PUBLIC LICENSE
  40079. *************************************
  40080. Version 3, 29 June 2007
  40081. Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
  40082. Everyone is permitted to copy and distribute verbatim copies of this
  40083. license document, but changing it is not allowed.
  40084. Preamble
  40085. ========
  40086. The GNU General Public License is a free, copyleft license for software
  40087. and other kinds of works.
  40088. The licenses for most software and other practical works are designed
  40089. to take away your freedom to share and change the works. By contrast,
  40090. the GNU General Public License is intended to guarantee your freedom to
  40091. share and change all versions of a program--to make sure it remains free
  40092. software for all its users. We, the Free Software Foundation, use the
  40093. GNU General Public License for most of our software; it applies also to
  40094. any other work released this way by its authors. You can apply it to
  40095. your programs, too.
  40096. When we speak of free software, we are referring to freedom, not
  40097. price. Our General Public Licenses are designed to make sure that you
  40098. have the freedom to distribute copies of free software (and charge for
  40099. them if you wish), that you receive source code or can get it if you
  40100. want it, that you can change the software or use pieces of it in new
  40101. free programs, and that you know you can do these things.
  40102. To protect your rights, we need to prevent others from denying you
  40103. these rights or asking you to surrender the rights. Therefore, you have
  40104. certain responsibilities if you distribute copies of the software, or if
  40105. you modify it: responsibilities to respect the freedom of others.
  40106. For example, if you distribute copies of such a program, whether
  40107. gratis or for a fee, you must pass on to the recipients the same
  40108. freedoms that you received. You must make sure that they, too, receive
  40109. or can get the source code. And you must show them these terms so they
  40110. know their rights.
  40111. Developers that use the GNU GPL protect your rights with two steps:
  40112. (1) assert copyright on the software, and (2) offer you this License
  40113. giving you legal permission to copy, distribute and/or modify it.
  40114. For the developers' and authors' protection, the GPL clearly explains
  40115. that there is no warranty for this free software. For both users' and
  40116. authors' sake, the GPL requires that modified versions be marked as
  40117. changed, so that their problems will not be attributed erroneously to
  40118. authors of previous versions.
  40119. Some devices are designed to deny users access to install or run
  40120. modified versions of the software inside them, although the manufacturer
  40121. can do so. This is fundamentally incompatible with the aim of
  40122. protecting users' freedom to change the software. The systematic
  40123. pattern of such abuse occurs in the area of products for individuals to
  40124. use, which is precisely where it is most unacceptable. Therefore, we
  40125. have designed this version of the GPL to prohibit the practice for those
  40126. products. If such problems arise substantially in other domains, we
  40127. stand ready to extend this provision to those domains in future versions
  40128. of the GPL, as needed to protect the freedom of users.
  40129. Finally, every program is threatened constantly by software patents.
  40130. States should not allow patents to restrict development and use of
  40131. software on general-purpose computers, but in those that do, we wish to
  40132. avoid the special danger that patents applied to a free program could
  40133. make it effectively proprietary. To prevent this, the GPL assures that
  40134. patents cannot be used to render the program non-free.
  40135. The precise terms and conditions for copying, distribution and
  40136. modification follow.
  40137. TERMS AND CONDITIONS
  40138. ====================
  40139. 0. Definitions.
  40140. "This License" refers to version 3 of the GNU General Public
  40141. License.
  40142. "Copyright" also means copyright-like laws that apply to other
  40143. kinds of works, such as semiconductor masks.
  40144. "The Program" refers to any copyrightable work licensed under this
  40145. License. Each licensee is addressed as "you". "Licensees" and
  40146. "recipients" may be individuals or organizations.
  40147. To "modify" a work means to copy from or adapt all or part of the
  40148. work in a fashion requiring copyright permission, other than the
  40149. making of an exact copy. The resulting work is called a "modified
  40150. version" of the earlier work or a work "based on" the earlier work.
  40151. A "covered work" means either the unmodified Program or a work
  40152. based on the Program.
  40153. To "propagate" a work means to do anything with it that, without
  40154. permission, would make you directly or secondarily liable for
  40155. infringement under applicable copyright law, except executing it on
  40156. a computer or modifying a private copy. Propagation includes
  40157. copying, distribution (with or without modification), making
  40158. available to the public, and in some countries other activities as
  40159. well.
  40160. To "convey" a work means any kind of propagation that enables other
  40161. parties to make or receive copies. Mere interaction with a user
  40162. through a computer network, with no transfer of a copy, is not
  40163. conveying.
  40164. An interactive user interface displays "Appropriate Legal Notices"
  40165. to the extent that it includes a convenient and prominently visible
  40166. feature that (1) displays an appropriate copyright notice, and (2)
  40167. tells the user that there is no warranty for the work (except to
  40168. the extent that warranties are provided), that licensees may convey
  40169. the work under this License, and how to view a copy of this
  40170. License. If the interface presents a list of user commands or
  40171. options, such as a menu, a prominent item in the list meets this
  40172. criterion.
  40173. 1. Source Code.
  40174. The "source code" for a work means the preferred form of the work
  40175. for making modifications to it. "Object code" means any non-source
  40176. form of a work.
  40177. A "Standard Interface" means an interface that either is an
  40178. official standard defined by a recognized standards body, or, in
  40179. the case of interfaces specified for a particular programming
  40180. language, one that is widely used among developers working in that
  40181. language.
  40182. The "System Libraries" of an executable work include anything,
  40183. other than the work as a whole, that (a) is included in the normal
  40184. form of packaging a Major Component, but which is not part of that
  40185. Major Component, and (b) serves only to enable use of the work with
  40186. that Major Component, or to implement a Standard Interface for
  40187. which an implementation is available to the public in source code
  40188. form. A "Major Component", in this context, means a major
  40189. essential component (kernel, window system, and so on) of the
  40190. specific operating system (if any) on which the executable work
  40191. runs, or a compiler used to produce the work, or an object code
  40192. interpreter used to run it.
  40193. The "Corresponding Source" for a work in object code form means all
  40194. the source code needed to generate, install, and (for an executable
  40195. work) run the object code and to modify the work, including scripts
  40196. to control those activities. However, it does not include the
  40197. work's System Libraries, or general-purpose tools or generally
  40198. available free programs which are used unmodified in performing
  40199. those activities but which are not part of the work. For example,
  40200. Corresponding Source includes interface definition files associated
  40201. with source files for the work, and the source code for shared
  40202. libraries and dynamically linked subprograms that the work is
  40203. specifically designed to require, such as by intimate data
  40204. communication or control flow between those subprograms and other
  40205. parts of the work.
  40206. The Corresponding Source need not include anything that users can
  40207. regenerate automatically from other parts of the Corresponding
  40208. Source.
  40209. The Corresponding Source for a work in source code form is that
  40210. same work.
  40211. 2. Basic Permissions.
  40212. All rights granted under this License are granted for the term of
  40213. copyright on the Program, and are irrevocable provided the stated
  40214. conditions are met. This License explicitly affirms your unlimited
  40215. permission to run the unmodified Program. The output from running
  40216. a covered work is covered by this License only if the output, given
  40217. its content, constitutes a covered work. This License acknowledges
  40218. your rights of fair use or other equivalent, as provided by
  40219. copyright law.
  40220. You may make, run and propagate covered works that you do not
  40221. convey, without conditions so long as your license otherwise
  40222. remains in force. You may convey covered works to others for the
  40223. sole purpose of having them make modifications exclusively for you,
  40224. or provide you with facilities for running those works, provided
  40225. that you comply with the terms of this License in conveying all
  40226. material for which you do not control copyright. Those thus making
  40227. or running the covered works for you must do so exclusively on your
  40228. behalf, under your direction and control, on terms that prohibit
  40229. them from making any copies of your copyrighted material outside
  40230. their relationship with you.
  40231. Conveying under any other circumstances is permitted solely under
  40232. the conditions stated below. Sublicensing is not allowed; section
  40233. 10 makes it unnecessary.
  40234. 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
  40235. No covered work shall be deemed part of an effective technological
  40236. measure under any applicable law fulfilling obligations under
  40237. article 11 of the WIPO copyright treaty adopted on 20 December
  40238. 1996, or similar laws prohibiting or restricting circumvention of
  40239. such measures.
  40240. When you convey a covered work, you waive any legal power to forbid
  40241. circumvention of technological measures to the extent such
  40242. circumvention is effected by exercising rights under this License
  40243. with respect to the covered work, and you disclaim any intention to
  40244. limit operation or modification of the work as a means of
  40245. enforcing, against the work's users, your or third parties' legal
  40246. rights to forbid circumvention of technological measures.
  40247. 4. Conveying Verbatim Copies.
  40248. You may convey verbatim copies of the Program's source code as you
  40249. receive it, in any medium, provided that you conspicuously and
  40250. appropriately publish on each copy an appropriate copyright notice;
  40251. keep intact all notices stating that this License and any
  40252. non-permissive terms added in accord with section 7 apply to the
  40253. code; keep intact all notices of the absence of any warranty; and
  40254. give all recipients a copy of this License along with the Program.
  40255. You may charge any price or no price for each copy that you convey,
  40256. and you may offer support or warranty protection for a fee.
  40257. 5. Conveying Modified Source Versions.
  40258. You may convey a work based on the Program, or the modifications to
  40259. produce it from the Program, in the form of source code under the
  40260. terms of section 4, provided that you also meet all of these
  40261. conditions:
  40262. a. The work must carry prominent notices stating that you
  40263. modified it, and giving a relevant date.
  40264. b. The work must carry prominent notices stating that it is
  40265. released under this License and any conditions added under
  40266. section 7. This requirement modifies the requirement in
  40267. section 4 to "keep intact all notices".
  40268. c. You must license the entire work, as a whole, under this
  40269. License to anyone who comes into possession of a copy. This
  40270. License will therefore apply, along with any applicable
  40271. section 7 additional terms, to the whole of the work, and all
  40272. its parts, regardless of how they are packaged. This License
  40273. gives no permission to license the work in any other way, but
  40274. it does not invalidate such permission if you have separately
  40275. received it.
  40276. d. If the work has interactive user interfaces, each must display
  40277. Appropriate Legal Notices; however, if the Program has
  40278. interactive interfaces that do not display Appropriate Legal
  40279. Notices, your work need not make them do so.
  40280. A compilation of a covered work with other separate and independent
  40281. works, which are not by their nature extensions of the covered
  40282. work, and which are not combined with it such as to form a larger
  40283. program, in or on a volume of a storage or distribution medium, is
  40284. called an "aggregate" if the compilation and its resulting
  40285. copyright are not used to limit the access or legal rights of the
  40286. compilation's users beyond what the individual works permit.
  40287. Inclusion of a covered work in an aggregate does not cause this
  40288. License to apply to the other parts of the aggregate.
  40289. 6. Conveying Non-Source Forms.
  40290. You may convey a covered work in object code form under the terms
  40291. of sections 4 and 5, provided that you also convey the
  40292. machine-readable Corresponding Source under the terms of this
  40293. License, in one of these ways:
  40294. a. Convey the object code in, or embodied in, a physical product
  40295. (including a physical distribution medium), accompanied by the
  40296. Corresponding Source fixed on a durable physical medium
  40297. customarily used for software interchange.
  40298. b. Convey the object code in, or embodied in, a physical product
  40299. (including a physical distribution medium), accompanied by a
  40300. written offer, valid for at least three years and valid for as
  40301. long as you offer spare parts or customer support for that
  40302. product model, to give anyone who possesses the object code
  40303. either (1) a copy of the Corresponding Source for all the
  40304. software in the product that is covered by this License, on a
  40305. durable physical medium customarily used for software
  40306. interchange, for a price no more than your reasonable cost of
  40307. physically performing this conveying of source, or (2) access
  40308. to copy the Corresponding Source from a network server at no
  40309. charge.
  40310. c. Convey individual copies of the object code with a copy of the
  40311. written offer to provide the Corresponding Source. This
  40312. alternative is allowed only occasionally and noncommercially,
  40313. and only if you received the object code with such an offer,
  40314. in accord with subsection 6b.
  40315. d. Convey the object code by offering access from a designated
  40316. place (gratis or for a charge), and offer equivalent access to
  40317. the Corresponding Source in the same way through the same
  40318. place at no further charge. You need not require recipients
  40319. to copy the Corresponding Source along with the object code.
  40320. If the place to copy the object code is a network server, the
  40321. Corresponding Source may be on a different server (operated by
  40322. you or a third party) that supports equivalent copying
  40323. facilities, provided you maintain clear directions next to the
  40324. object code saying where to find the Corresponding Source.
  40325. Regardless of what server hosts the Corresponding Source, you
  40326. remain obligated to ensure that it is available for as long as
  40327. needed to satisfy these requirements.
  40328. e. Convey the object code using peer-to-peer transmission,
  40329. provided you inform other peers where the object code and
  40330. Corresponding Source of the work are being offered to the
  40331. general public at no charge under subsection 6d.
  40332. A separable portion of the object code, whose source code is
  40333. excluded from the Corresponding Source as a System Library, need
  40334. not be included in conveying the object code work.
  40335. A "User Product" is either (1) a "consumer product", which means
  40336. any tangible personal property which is normally used for personal,
  40337. family, or household purposes, or (2) anything designed or sold for
  40338. incorporation into a dwelling. In determining whether a product is
  40339. a consumer product, doubtful cases shall be resolved in favor of
  40340. coverage. For a particular product received by a particular user,
  40341. "normally used" refers to a typical or common use of that class of
  40342. product, regardless of the status of the particular user or of the
  40343. way in which the particular user actually uses, or expects or is
  40344. expected to use, the product. A product is a consumer product
  40345. regardless of whether the product has substantial commercial,
  40346. industrial or non-consumer uses, unless such uses represent the
  40347. only significant mode of use of the product.
  40348. "Installation Information" for a User Product means any methods,
  40349. procedures, authorization keys, or other information required to
  40350. install and execute modified versions of a covered work in that
  40351. User Product from a modified version of its Corresponding Source.
  40352. The information must suffice to ensure that the continued
  40353. functioning of the modified object code is in no case prevented or
  40354. interfered with solely because modification has been made.
  40355. If you convey an object code work under this section in, or with,
  40356. or specifically for use in, a User Product, and the conveying
  40357. occurs as part of a transaction in which the right of possession
  40358. and use of the User Product is transferred to the recipient in
  40359. perpetuity or for a fixed term (regardless of how the transaction
  40360. is characterized), the Corresponding Source conveyed under this
  40361. section must be accompanied by the Installation Information. But
  40362. this requirement does not apply if neither you nor any third party
  40363. retains the ability to install modified object code on the User
  40364. Product (for example, the work has been installed in ROM).
  40365. The requirement to provide Installation Information does not
  40366. include a requirement to continue to provide support service,
  40367. warranty, or updates for a work that has been modified or installed
  40368. by the recipient, or for the User Product in which it has been
  40369. modified or installed. Access to a network may be denied when the
  40370. modification itself materially and adversely affects the operation
  40371. of the network or violates the rules and protocols for
  40372. communication across the network.
  40373. Corresponding Source conveyed, and Installation Information
  40374. provided, in accord with this section must be in a format that is
  40375. publicly documented (and with an implementation available to the
  40376. public in source code form), and must require no special password
  40377. or key for unpacking, reading or copying.
  40378. 7. Additional Terms.
  40379. "Additional permissions" are terms that supplement the terms of
  40380. this License by making exceptions from one or more of its
  40381. conditions. Additional permissions that are applicable to the
  40382. entire Program shall be treated as though they were included in
  40383. this License, to the extent that they are valid under applicable
  40384. law. If additional permissions apply only to part of the Program,
  40385. that part may be used separately under those permissions, but the
  40386. entire Program remains governed by this License without regard to
  40387. the additional permissions.
  40388. When you convey a copy of a covered work, you may at your option
  40389. remove any additional permissions from that copy, or from any part
  40390. of it. (Additional permissions may be written to require their own
  40391. removal in certain cases when you modify the work.) You may place
  40392. additional permissions on material, added by you to a covered work,
  40393. for which you have or can give appropriate copyright permission.
  40394. Notwithstanding any other provision of this License, for material
  40395. you add to a covered work, you may (if authorized by the copyright
  40396. holders of that material) supplement the terms of this License with
  40397. terms:
  40398. a. Disclaiming warranty or limiting liability differently from
  40399. the terms of sections 15 and 16 of this License; or
  40400. b. Requiring preservation of specified reasonable legal notices
  40401. or author attributions in that material or in the Appropriate
  40402. Legal Notices displayed by works containing it; or
  40403. c. Prohibiting misrepresentation of the origin of that material,
  40404. or requiring that modified versions of such material be marked
  40405. in reasonable ways as different from the original version; or
  40406. d. Limiting the use for publicity purposes of names of licensors
  40407. or authors of the material; or
  40408. e. Declining to grant rights under trademark law for use of some
  40409. trade names, trademarks, or service marks; or
  40410. f. Requiring indemnification of licensors and authors of that
  40411. material by anyone who conveys the material (or modified
  40412. versions of it) with contractual assumptions of liability to
  40413. the recipient, for any liability that these contractual
  40414. assumptions directly impose on those licensors and authors.
  40415. All other non-permissive additional terms are considered "further
  40416. restrictions" within the meaning of section 10. If the Program as
  40417. you received it, or any part of it, contains a notice stating that
  40418. it is governed by this License along with a term that is a further
  40419. restriction, you may remove that term. If a license document
  40420. contains a further restriction but permits relicensing or conveying
  40421. under this License, you may add to a covered work material governed
  40422. by the terms of that license document, provided that the further
  40423. restriction does not survive such relicensing or conveying.
  40424. If you add terms to a covered work in accord with this section, you
  40425. must place, in the relevant source files, a statement of the
  40426. additional terms that apply to those files, or a notice indicating
  40427. where to find the applicable terms.
  40428. Additional terms, permissive or non-permissive, may be stated in
  40429. the form of a separately written license, or stated as exceptions;
  40430. the above requirements apply either way.
  40431. 8. Termination.
  40432. You may not propagate or modify a covered work except as expressly
  40433. provided under this License. Any attempt otherwise to propagate or
  40434. modify it is void, and will automatically terminate your rights
  40435. under this License (including any patent licenses granted under the
  40436. third paragraph of section 11).
  40437. However, if you cease all violation of this License, then your
  40438. license from a particular copyright holder is reinstated (a)
  40439. provisionally, unless and until the copyright holder explicitly and
  40440. finally terminates your license, and (b) permanently, if the
  40441. copyright holder fails to notify you of the violation by some
  40442. reasonable means prior to 60 days after the cessation.
  40443. Moreover, your license from a particular copyright holder is
  40444. reinstated permanently if the copyright holder notifies you of the
  40445. violation by some reasonable means, this is the first time you have
  40446. received notice of violation of this License (for any work) from
  40447. that copyright holder, and you cure the violation prior to 30 days
  40448. after your receipt of the notice.
  40449. Termination of your rights under this section does not terminate
  40450. the licenses of parties who have received copies or rights from you
  40451. under this License. If your rights have been terminated and not
  40452. permanently reinstated, you do not qualify to receive new licenses
  40453. for the same material under section 10.
  40454. 9. Acceptance Not Required for Having Copies.
  40455. You are not required to accept this License in order to receive or
  40456. run a copy of the Program. Ancillary propagation of a covered work
  40457. occurring solely as a consequence of using peer-to-peer
  40458. transmission to receive a copy likewise does not require
  40459. acceptance. However, nothing other than this License grants you
  40460. permission to propagate or modify any covered work. These actions
  40461. infringe copyright if you do not accept this License. Therefore,
  40462. by modifying or propagating a covered work, you indicate your
  40463. acceptance of this License to do so.
  40464. 10. Automatic Licensing of Downstream Recipients.
  40465. Each time you convey a covered work, the recipient automatically
  40466. receives a license from the original licensors, to run, modify and
  40467. propagate that work, subject to this License. You are not
  40468. responsible for enforcing compliance by third parties with this
  40469. License.
  40470. An "entity transaction" is a transaction transferring control of an
  40471. organization, or substantially all assets of one, or subdividing an
  40472. organization, or merging organizations. If propagation of a
  40473. covered work results from an entity transaction, each party to that
  40474. transaction who receives a copy of the work also receives whatever
  40475. licenses to the work the party's predecessor in interest had or
  40476. could give under the previous paragraph, plus a right to possession
  40477. of the Corresponding Source of the work from the predecessor in
  40478. interest, if the predecessor has it or can get it with reasonable
  40479. efforts.
  40480. You may not impose any further restrictions on the exercise of the
  40481. rights granted or affirmed under this License. For example, you
  40482. may not impose a license fee, royalty, or other charge for exercise
  40483. of rights granted under this License, and you may not initiate
  40484. litigation (including a cross-claim or counterclaim in a lawsuit)
  40485. alleging that any patent claim is infringed by making, using,
  40486. selling, offering for sale, or importing the Program or any portion
  40487. of it.
  40488. 11. Patents.
  40489. A "contributor" is a copyright holder who authorizes use under this
  40490. License of the Program or a work on which the Program is based.
  40491. The work thus licensed is called the contributor's "contributor
  40492. version".
  40493. A contributor's "essential patent claims" are all patent claims
  40494. owned or controlled by the contributor, whether already acquired or
  40495. hereafter acquired, that would be infringed by some manner,
  40496. permitted by this License, of making, using, or selling its
  40497. contributor version, but do not include claims that would be
  40498. infringed only as a consequence of further modification of the
  40499. contributor version. For purposes of this definition, "control"
  40500. includes the right to grant patent sublicenses in a manner
  40501. consistent with the requirements of this License.
  40502. Each contributor grants you a non-exclusive, worldwide,
  40503. royalty-free patent license under the contributor's essential
  40504. patent claims, to make, use, sell, offer for sale, import and
  40505. otherwise run, modify and propagate the contents of its contributor
  40506. version.
  40507. In the following three paragraphs, a "patent license" is any
  40508. express agreement or commitment, however denominated, not to
  40509. enforce a patent (such as an express permission to practice a
  40510. patent or covenant not to sue for patent infringement). To "grant"
  40511. such a patent license to a party means to make such an agreement or
  40512. commitment not to enforce a patent against the party.
  40513. If you convey a covered work, knowingly relying on a patent
  40514. license, and the Corresponding Source of the work is not available
  40515. for anyone to copy, free of charge and under the terms of this
  40516. License, through a publicly available network server or other
  40517. readily accessible means, then you must either (1) cause the
  40518. Corresponding Source to be so available, or (2) arrange to deprive
  40519. yourself of the benefit of the patent license for this particular
  40520. work, or (3) arrange, in a manner consistent with the requirements
  40521. of this License, to extend the patent license to downstream
  40522. recipients. "Knowingly relying" means you have actual knowledge
  40523. that, but for the patent license, your conveying the covered work
  40524. in a country, or your recipient's use of the covered work in a
  40525. country, would infringe one or more identifiable patents in that
  40526. country that you have reason to believe are valid.
  40527. If, pursuant to or in connection with a single transaction or
  40528. arrangement, you convey, or propagate by procuring conveyance of, a
  40529. covered work, and grant a patent license to some of the parties
  40530. receiving the covered work authorizing them to use, propagate,
  40531. modify or convey a specific copy of the covered work, then the
  40532. patent license you grant is automatically extended to all
  40533. recipients of the covered work and works based on it.
  40534. A patent license is "discriminatory" if it does not include within
  40535. the scope of its coverage, prohibits the exercise of, or is
  40536. conditioned on the non-exercise of one or more of the rights that
  40537. are specifically granted under this License. You may not convey a
  40538. covered work if you are a party to an arrangement with a third
  40539. party that is in the business of distributing software, under which
  40540. you make payment to the third party based on the extent of your
  40541. activity of conveying the work, and under which the third party
  40542. grants, to any of the parties who would receive the covered work
  40543. from you, a discriminatory patent license (a) in connection with
  40544. copies of the covered work conveyed by you (or copies made from
  40545. those copies), or (b) primarily for and in connection with specific
  40546. products or compilations that contain the covered work, unless you
  40547. entered into that arrangement, or that patent license was granted,
  40548. prior to 28 March 2007.
  40549. Nothing in this License shall be construed as excluding or limiting
  40550. any implied license or other defenses to infringement that may
  40551. otherwise be available to you under applicable patent law.
  40552. 12. No Surrender of Others' Freedom.
  40553. If conditions are imposed on you (whether by court order, agreement
  40554. or otherwise) that contradict the conditions of this License, they
  40555. do not excuse you from the conditions of this License. If you
  40556. cannot convey a covered work so as to satisfy simultaneously your
  40557. obligations under this License and any other pertinent obligations,
  40558. then as a consequence you may not convey it at all. For example,
  40559. if you agree to terms that obligate you to collect a royalty for
  40560. further conveying from those to whom you convey the Program, the
  40561. only way you could satisfy both those terms and this License would
  40562. be to refrain entirely from conveying the Program.
  40563. 13. Use with the GNU Affero General Public License.
  40564. Notwithstanding any other provision of this License, you have
  40565. permission to link or combine any covered work with a work licensed
  40566. under version 3 of the GNU Affero General Public License into a
  40567. single combined work, and to convey the resulting work. The terms
  40568. of this License will continue to apply to the part which is the
  40569. covered work, but the special requirements of the GNU Affero
  40570. General Public License, section 13, concerning interaction through
  40571. a network will apply to the combination as such.
  40572. 14. Revised Versions of this License.
  40573. The Free Software Foundation may publish revised and/or new
  40574. versions of the GNU General Public License from time to time. Such
  40575. new versions will be similar in spirit to the present version, but
  40576. may differ in detail to address new problems or concerns.
  40577. Each version is given a distinguishing version number. If the
  40578. Program specifies that a certain numbered version of the GNU
  40579. General Public License "or any later version" applies to it, you
  40580. have the option of following the terms and conditions either of
  40581. that numbered version or of any later version published by the Free
  40582. Software Foundation. If the Program does not specify a version
  40583. number of the GNU General Public License, you may choose any
  40584. version ever published by the Free Software Foundation.
  40585. If the Program specifies that a proxy can decide which future
  40586. versions of the GNU General Public License can be used, that
  40587. proxy's public statement of acceptance of a version permanently
  40588. authorizes you to choose that version for the Program.
  40589. Later license versions may give you additional or different
  40590. permissions. However, no additional obligations are imposed on any
  40591. author or copyright holder as a result of your choosing to follow a
  40592. later version.
  40593. 15. Disclaimer of Warranty.
  40594. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
  40595. APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
  40596. COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
  40597. WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
  40598. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  40599. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
  40600. RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
  40601. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
  40602. NECESSARY SERVICING, REPAIR OR CORRECTION.
  40603. 16. Limitation of Liability.
  40604. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  40605. WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
  40606. AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
  40607. DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
  40608. CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
  40609. THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
  40610. BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
  40611. PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  40612. PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
  40613. THE POSSIBILITY OF SUCH DAMAGES.
  40614. 17. Interpretation of Sections 15 and 16.
  40615. If the disclaimer of warranty and limitation of liability provided
  40616. above cannot be given local legal effect according to their terms,
  40617. reviewing courts shall apply local law that most closely
  40618. approximates an absolute waiver of all civil liability in
  40619. connection with the Program, unless a warranty or assumption of
  40620. liability accompanies a copy of the Program in return for a fee.
  40621. END OF TERMS AND CONDITIONS
  40622. ===========================
  40623. How to Apply These Terms to Your New Programs
  40624. =============================================
  40625. If you develop a new program, and you want it to be of the greatest
  40626. possible use to the public, the best way to achieve this is to make it
  40627. free software which everyone can redistribute and change under these
  40628. terms.
  40629. To do so, attach the following notices to the program. It is safest
  40630. to attach them to the start of each source file to most effectively
  40631. state the exclusion of warranty; and each file should have at least the
  40632. "copyright" line and a pointer to where the full notice is found.
  40633. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
  40634. Copyright (C) YEAR NAME OF AUTHOR
  40635. This program is free software: you can redistribute it and/or modify
  40636. it under the terms of the GNU General Public License as published by
  40637. the Free Software Foundation, either version 3 of the License, or (at
  40638. your option) any later version.
  40639. This program is distributed in the hope that it will be useful, but
  40640. WITHOUT ANY WARRANTY; without even the implied warranty of
  40641. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  40642. General Public License for more details.
  40643. You should have received a copy of the GNU General Public License
  40644. along with this program. If not, see <http://www.gnu.org/licenses/>.
  40645. Also add information on how to contact you by electronic and paper
  40646. mail.
  40647. If the program does terminal interaction, make it output a short
  40648. notice like this when it starts in an interactive mode:
  40649. PROGRAM Copyright (C) YEAR NAME OF AUTHOR
  40650. This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
  40651. This is free software, and you are welcome to redistribute it
  40652. under certain conditions; type 'show c' for details.
  40653. The hypothetical commands 'show w' and 'show c' should show the
  40654. appropriate parts of the General Public License. Of course, your
  40655. program's commands might be different; for a GUI interface, you would
  40656. use an "about box".
  40657. You should also get your employer (if you work as a programmer) or
  40658. school, if any, to sign a "copyright disclaimer" for the program, if
  40659. necessary. For more information on this, and how to apply and follow
  40660. the GNU GPL, see <http://www.gnu.org/licenses/>.
  40661. The GNU General Public License does not permit incorporating your
  40662. program into proprietary programs. If your program is a subroutine
  40663. library, you may consider it more useful to permit linking proprietary
  40664. applications with the library. If this is what you want to do, use the
  40665. GNU Lesser General Public License instead of this License. But first,
  40666. please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
  40667. 
  40668. File: gdb.info, Node: GNU Free Documentation License, Next: Concept Index, Prev: Copying, Up: Top
  40669. Appendix M GNU Free Documentation License
  40670. *****************************************
  40671. Version 1.3, 3 November 2008
  40672. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  40673. <http://fsf.org/>
  40674. Everyone is permitted to copy and distribute verbatim copies
  40675. of this license document, but changing it is not allowed.
  40676. 0. PREAMBLE
  40677. The purpose of this License is to make a manual, textbook, or other
  40678. functional and useful document "free" in the sense of freedom: to
  40679. assure everyone the effective freedom to copy and redistribute it,
  40680. with or without modifying it, either commercially or
  40681. noncommercially. Secondarily, this License preserves for the
  40682. author and publisher a way to get credit for their work, while not
  40683. being considered responsible for modifications made by others.
  40684. This License is a kind of "copyleft", which means that derivative
  40685. works of the document must themselves be free in the same sense.
  40686. It complements the GNU General Public License, which is a copyleft
  40687. license designed for free software.
  40688. We have designed this License in order to use it for manuals for
  40689. free software, because free software needs free documentation: a
  40690. free program should come with manuals providing the same freedoms
  40691. that the software does. But this License is not limited to
  40692. software manuals; it can be used for any textual work, regardless
  40693. of subject matter or whether it is published as a printed book. We
  40694. recommend this License principally for works whose purpose is
  40695. instruction or reference.
  40696. 1. APPLICABILITY AND DEFINITIONS
  40697. This License applies to any manual or other work, in any medium,
  40698. that contains a notice placed by the copyright holder saying it can
  40699. be distributed under the terms of this License. Such a notice
  40700. grants a world-wide, royalty-free license, unlimited in duration,
  40701. to use that work under the conditions stated herein. The
  40702. "Document", below, refers to any such manual or work. Any member
  40703. of the public is a licensee, and is addressed as "you". You accept
  40704. the license if you copy, modify or distribute the work in a way
  40705. requiring permission under copyright law.
  40706. A "Modified Version" of the Document means any work containing the
  40707. Document or a portion of it, either copied verbatim, or with
  40708. modifications and/or translated into another language.
  40709. A "Secondary Section" is a named appendix or a front-matter section
  40710. of the Document that deals exclusively with the relationship of the
  40711. publishers or authors of the Document to the Document's overall
  40712. subject (or to related matters) and contains nothing that could
  40713. fall directly within that overall subject. (Thus, if the Document
  40714. is in part a textbook of mathematics, a Secondary Section may not
  40715. explain any mathematics.) The relationship could be a matter of
  40716. historical connection with the subject or with related matters, or
  40717. of legal, commercial, philosophical, ethical or political position
  40718. regarding them.
  40719. The "Invariant Sections" are certain Secondary Sections whose
  40720. titles are designated, as being those of Invariant Sections, in the
  40721. notice that says that the Document is released under this License.
  40722. If a section does not fit the above definition of Secondary then it
  40723. is not allowed to be designated as Invariant. The Document may
  40724. contain zero Invariant Sections. If the Document does not identify
  40725. any Invariant Sections then there are none.
  40726. The "Cover Texts" are certain short passages of text that are
  40727. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  40728. that says that the Document is released under this License. A
  40729. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  40730. be at most 25 words.
  40731. A "Transparent" copy of the Document means a machine-readable copy,
  40732. represented in a format whose specification is available to the
  40733. general public, that is suitable for revising the document
  40734. straightforwardly with generic text editors or (for images composed
  40735. of pixels) generic paint programs or (for drawings) some widely
  40736. available drawing editor, and that is suitable for input to text
  40737. formatters or for automatic translation to a variety of formats
  40738. suitable for input to text formatters. A copy made in an otherwise
  40739. Transparent file format whose markup, or absence of markup, has
  40740. been arranged to thwart or discourage subsequent modification by
  40741. readers is not Transparent. An image format is not Transparent if
  40742. used for any substantial amount of text. A copy that is not
  40743. "Transparent" is called "Opaque".
  40744. Examples of suitable formats for Transparent copies include plain
  40745. ASCII without markup, Texinfo input format, LaTeX input format,
  40746. SGML or XML using a publicly available DTD, and standard-conforming
  40747. simple HTML, PostScript or PDF designed for human modification.
  40748. Examples of transparent image formats include PNG, XCF and JPG.
  40749. Opaque formats include proprietary formats that can be read and
  40750. edited only by proprietary word processors, SGML or XML for which
  40751. the DTD and/or processing tools are not generally available, and
  40752. the machine-generated HTML, PostScript or PDF produced by some word
  40753. processors for output purposes only.
  40754. The "Title Page" means, for a printed book, the title page itself,
  40755. plus such following pages as are needed to hold, legibly, the
  40756. material this License requires to appear in the title page. For
  40757. works in formats which do not have any title page as such, "Title
  40758. Page" means the text near the most prominent appearance of the
  40759. work's title, preceding the beginning of the body of the text.
  40760. The "publisher" means any person or entity that distributes copies
  40761. of the Document to the public.
  40762. A section "Entitled XYZ" means a named subunit of the Document
  40763. whose title either is precisely XYZ or contains XYZ in parentheses
  40764. following text that translates XYZ in another language. (Here XYZ
  40765. stands for a specific section name mentioned below, such as
  40766. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  40767. To "Preserve the Title" of such a section when you modify the
  40768. Document means that it remains a section "Entitled XYZ" according
  40769. to this definition.
  40770. The Document may include Warranty Disclaimers next to the notice
  40771. which states that this License applies to the Document. These
  40772. Warranty Disclaimers are considered to be included by reference in
  40773. this License, but only as regards disclaiming warranties: any other
  40774. implication that these Warranty Disclaimers may have is void and
  40775. has no effect on the meaning of this License.
  40776. 2. VERBATIM COPYING
  40777. You may copy and distribute the Document in any medium, either
  40778. commercially or noncommercially, provided that this License, the
  40779. copyright notices, and the license notice saying this License
  40780. applies to the Document are reproduced in all copies, and that you
  40781. add no other conditions whatsoever to those of this License. You
  40782. may not use technical measures to obstruct or control the reading
  40783. or further copying of the copies you make or distribute. However,
  40784. you may accept compensation in exchange for copies. If you
  40785. distribute a large enough number of copies you must also follow the
  40786. conditions in section 3.
  40787. You may also lend copies, under the same conditions stated above,
  40788. and you may publicly display copies.
  40789. 3. COPYING IN QUANTITY
  40790. If you publish printed copies (or copies in media that commonly
  40791. have printed covers) of the Document, numbering more than 100, and
  40792. the Document's license notice requires Cover Texts, you must
  40793. enclose the copies in covers that carry, clearly and legibly, all
  40794. these Cover Texts: Front-Cover Texts on the front cover, and
  40795. Back-Cover Texts on the back cover. Both covers must also clearly
  40796. and legibly identify you as the publisher of these copies. The
  40797. front cover must present the full title with all words of the title
  40798. equally prominent and visible. You may add other material on the
  40799. covers in addition. Copying with changes limited to the covers, as
  40800. long as they preserve the title of the Document and satisfy these
  40801. conditions, can be treated as verbatim copying in other respects.
  40802. If the required texts for either cover are too voluminous to fit
  40803. legibly, you should put the first ones listed (as many as fit
  40804. reasonably) on the actual cover, and continue the rest onto
  40805. adjacent pages.
  40806. If you publish or distribute Opaque copies of the Document
  40807. numbering more than 100, you must either include a machine-readable
  40808. Transparent copy along with each Opaque copy, or state in or with
  40809. each Opaque copy a computer-network location from which the general
  40810. network-using public has access to download using public-standard
  40811. network protocols a complete Transparent copy of the Document, free
  40812. of added material. If you use the latter option, you must take
  40813. reasonably prudent steps, when you begin distribution of Opaque
  40814. copies in quantity, to ensure that this Transparent copy will
  40815. remain thus accessible at the stated location until at least one
  40816. year after the last time you distribute an Opaque copy (directly or
  40817. through your agents or retailers) of that edition to the public.
  40818. It is requested, but not required, that you contact the authors of
  40819. the Document well before redistributing any large number of copies,
  40820. to give them a chance to provide you with an updated version of the
  40821. Document.
  40822. 4. MODIFICATIONS
  40823. You may copy and distribute a Modified Version of the Document
  40824. under the conditions of sections 2 and 3 above, provided that you
  40825. release the Modified Version under precisely this License, with the
  40826. Modified Version filling the role of the Document, thus licensing
  40827. distribution and modification of the Modified Version to whoever
  40828. possesses a copy of it. In addition, you must do these things in
  40829. the Modified Version:
  40830. A. Use in the Title Page (and on the covers, if any) a title
  40831. distinct from that of the Document, and from those of previous
  40832. versions (which should, if there were any, be listed in the
  40833. History section of the Document). You may use the same title
  40834. as a previous version if the original publisher of that
  40835. version gives permission.
  40836. B. List on the Title Page, as authors, one or more persons or
  40837. entities responsible for authorship of the modifications in
  40838. the Modified Version, together with at least five of the
  40839. principal authors of the Document (all of its principal
  40840. authors, if it has fewer than five), unless they release you
  40841. from this requirement.
  40842. C. State on the Title page the name of the publisher of the
  40843. Modified Version, as the publisher.
  40844. D. Preserve all the copyright notices of the Document.
  40845. E. Add an appropriate copyright notice for your modifications
  40846. adjacent to the other copyright notices.
  40847. F. Include, immediately after the copyright notices, a license
  40848. notice giving the public permission to use the Modified
  40849. Version under the terms of this License, in the form shown in
  40850. the Addendum below.
  40851. G. Preserve in that license notice the full lists of Invariant
  40852. Sections and required Cover Texts given in the Document's
  40853. license notice.
  40854. H. Include an unaltered copy of this License.
  40855. I. Preserve the section Entitled "History", Preserve its Title,
  40856. and add to it an item stating at least the title, year, new
  40857. authors, and publisher of the Modified Version as given on the
  40858. Title Page. If there is no section Entitled "History" in the
  40859. Document, create one stating the title, year, authors, and
  40860. publisher of the Document as given on its Title Page, then add
  40861. an item describing the Modified Version as stated in the
  40862. previous sentence.
  40863. J. Preserve the network location, if any, given in the Document
  40864. for public access to a Transparent copy of the Document, and
  40865. likewise the network locations given in the Document for
  40866. previous versions it was based on. These may be placed in the
  40867. "History" section. You may omit a network location for a work
  40868. that was published at least four years before the Document
  40869. itself, or if the original publisher of the version it refers
  40870. to gives permission.
  40871. K. For any section Entitled "Acknowledgements" or "Dedications",
  40872. Preserve the Title of the section, and preserve in the section
  40873. all the substance and tone of each of the contributor
  40874. acknowledgements and/or dedications given therein.
  40875. L. Preserve all the Invariant Sections of the Document, unaltered
  40876. in their text and in their titles. Section numbers or the
  40877. equivalent are not considered part of the section titles.
  40878. M. Delete any section Entitled "Endorsements". Such a section
  40879. may not be included in the Modified Version.
  40880. N. Do not retitle any existing section to be Entitled
  40881. "Endorsements" or to conflict in title with any Invariant
  40882. Section.
  40883. O. Preserve any Warranty Disclaimers.
  40884. If the Modified Version includes new front-matter sections or
  40885. appendices that qualify as Secondary Sections and contain no
  40886. material copied from the Document, you may at your option designate
  40887. some or all of these sections as invariant. To do this, add their
  40888. titles to the list of Invariant Sections in the Modified Version's
  40889. license notice. These titles must be distinct from any other
  40890. section titles.
  40891. You may add a section Entitled "Endorsements", provided it contains
  40892. nothing but endorsements of your Modified Version by various
  40893. parties--for example, statements of peer review or that the text
  40894. has been approved by an organization as the authoritative
  40895. definition of a standard.
  40896. You may add a passage of up to five words as a Front-Cover Text,
  40897. and a passage of up to 25 words as a Back-Cover Text, to the end of
  40898. the list of Cover Texts in the Modified Version. Only one passage
  40899. of Front-Cover Text and one of Back-Cover Text may be added by (or
  40900. through arrangements made by) any one entity. If the Document
  40901. already includes a cover text for the same cover, previously added
  40902. by you or by arrangement made by the same entity you are acting on
  40903. behalf of, you may not add another; but you may replace the old
  40904. one, on explicit permission from the previous publisher that added
  40905. the old one.
  40906. The author(s) and publisher(s) of the Document do not by this
  40907. License give permission to use their names for publicity for or to
  40908. assert or imply endorsement of any Modified Version.
  40909. 5. COMBINING DOCUMENTS
  40910. You may combine the Document with other documents released under
  40911. this License, under the terms defined in section 4 above for
  40912. modified versions, provided that you include in the combination all
  40913. of the Invariant Sections of all of the original documents,
  40914. unmodified, and list them all as Invariant Sections of your
  40915. combined work in its license notice, and that you preserve all
  40916. their Warranty Disclaimers.
  40917. The combined work need only contain one copy of this License, and
  40918. multiple identical Invariant Sections may be replaced with a single
  40919. copy. If there are multiple Invariant Sections with the same name
  40920. but different contents, make the title of each such section unique
  40921. by adding at the end of it, in parentheses, the name of the
  40922. original author or publisher of that section if known, or else a
  40923. unique number. Make the same adjustment to the section titles in
  40924. the list of Invariant Sections in the license notice of the
  40925. combined work.
  40926. In the combination, you must combine any sections Entitled
  40927. "History" in the various original documents, forming one section
  40928. Entitled "History"; likewise combine any sections Entitled
  40929. "Acknowledgements", and any sections Entitled "Dedications". You
  40930. must delete all sections Entitled "Endorsements."
  40931. 6. COLLECTIONS OF DOCUMENTS
  40932. You may make a collection consisting of the Document and other
  40933. documents released under this License, and replace the individual
  40934. copies of this License in the various documents with a single copy
  40935. that is included in the collection, provided that you follow the
  40936. rules of this License for verbatim copying of each of the documents
  40937. in all other respects.
  40938. You may extract a single document from such a collection, and
  40939. distribute it individually under this License, provided you insert
  40940. a copy of this License into the extracted document, and follow this
  40941. License in all other respects regarding verbatim copying of that
  40942. document.
  40943. 7. AGGREGATION WITH INDEPENDENT WORKS
  40944. A compilation of the Document or its derivatives with other
  40945. separate and independent documents or works, in or on a volume of a
  40946. storage or distribution medium, is called an "aggregate" if the
  40947. copyright resulting from the compilation is not used to limit the
  40948. legal rights of the compilation's users beyond what the individual
  40949. works permit. When the Document is included in an aggregate, this
  40950. License does not apply to the other works in the aggregate which
  40951. are not themselves derivative works of the Document.
  40952. If the Cover Text requirement of section 3 is applicable to these
  40953. copies of the Document, then if the Document is less than one half
  40954. of the entire aggregate, the Document's Cover Texts may be placed
  40955. on covers that bracket the Document within the aggregate, or the
  40956. electronic equivalent of covers if the Document is in electronic
  40957. form. Otherwise they must appear on printed covers that bracket
  40958. the whole aggregate.
  40959. 8. TRANSLATION
  40960. Translation is considered a kind of modification, so you may
  40961. distribute translations of the Document under the terms of section
  40962. 4. Replacing Invariant Sections with translations requires special
  40963. permission from their copyright holders, but you may include
  40964. translations of some or all Invariant Sections in addition to the
  40965. original versions of these Invariant Sections. You may include a
  40966. translation of this License, and all the license notices in the
  40967. Document, and any Warranty Disclaimers, provided that you also
  40968. include the original English version of this License and the
  40969. original versions of those notices and disclaimers. In case of a
  40970. disagreement between the translation and the original version of
  40971. this License or a notice or disclaimer, the original version will
  40972. prevail.
  40973. If a section in the Document is Entitled "Acknowledgements",
  40974. "Dedications", or "History", the requirement (section 4) to
  40975. Preserve its Title (section 1) will typically require changing the
  40976. actual title.
  40977. 9. TERMINATION
  40978. You may not copy, modify, sublicense, or distribute the Document
  40979. except as expressly provided under this License. Any attempt
  40980. otherwise to copy, modify, sublicense, or distribute it is void,
  40981. and will automatically terminate your rights under this License.
  40982. However, if you cease all violation of this License, then your
  40983. license from a particular copyright holder is reinstated (a)
  40984. provisionally, unless and until the copyright holder explicitly and
  40985. finally terminates your license, and (b) permanently, if the
  40986. copyright holder fails to notify you of the violation by some
  40987. reasonable means prior to 60 days after the cessation.
  40988. Moreover, your license from a particular copyright holder is
  40989. reinstated permanently if the copyright holder notifies you of the
  40990. violation by some reasonable means, this is the first time you have
  40991. received notice of violation of this License (for any work) from
  40992. that copyright holder, and you cure the violation prior to 30 days
  40993. after your receipt of the notice.
  40994. Termination of your rights under this section does not terminate
  40995. the licenses of parties who have received copies or rights from you
  40996. under this License. If your rights have been terminated and not
  40997. permanently reinstated, receipt of a copy of some or all of the
  40998. same material does not give you any rights to use it.
  40999. 10. FUTURE REVISIONS OF THIS LICENSE
  41000. The Free Software Foundation may publish new, revised versions of
  41001. the GNU Free Documentation License from time to time. Such new
  41002. versions will be similar in spirit to the present version, but may
  41003. differ in detail to address new problems or concerns. See
  41004. <http://www.gnu.org/copyleft/>.
  41005. Each version of the License is given a distinguishing version
  41006. number. If the Document specifies that a particular numbered
  41007. version of this License "or any later version" applies to it, you
  41008. have the option of following the terms and conditions either of
  41009. that specified version or of any later version that has been
  41010. published (not as a draft) by the Free Software Foundation. If the
  41011. Document does not specify a version number of this License, you may
  41012. choose any version ever published (not as a draft) by the Free
  41013. Software Foundation. If the Document specifies that a proxy can
  41014. decide which future versions of this License can be used, that
  41015. proxy's public statement of acceptance of a version permanently
  41016. authorizes you to choose that version for the Document.
  41017. 11. RELICENSING
  41018. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  41019. World Wide Web server that publishes copyrightable works and also
  41020. provides prominent facilities for anybody to edit those works. A
  41021. public wiki that anybody can edit is an example of such a server.
  41022. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  41023. site means any set of copyrightable works thus published on the MMC
  41024. site.
  41025. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  41026. license published by Creative Commons Corporation, a not-for-profit
  41027. corporation with a principal place of business in San Francisco,
  41028. California, as well as future copyleft versions of that license
  41029. published by that same organization.
  41030. "Incorporate" means to publish or republish a Document, in whole or
  41031. in part, as part of another Document.
  41032. An MMC is "eligible for relicensing" if it is licensed under this
  41033. License, and if all works that were first published under this
  41034. License somewhere other than this MMC, and subsequently
  41035. incorporated in whole or in part into the MMC, (1) had no cover
  41036. texts or invariant sections, and (2) were thus incorporated prior
  41037. to November 1, 2008.
  41038. The operator of an MMC Site may republish an MMC contained in the
  41039. site under CC-BY-SA on the same site at any time before August 1,
  41040. 2009, provided the MMC is eligible for relicensing.
  41041. ADDENDUM: How to use this License for your documents
  41042. ====================================================
  41043. To use this License in a document you have written, include a copy of
  41044. the License in the document and put the following copyright and license
  41045. notices just after the title page:
  41046. Copyright (C) YEAR YOUR NAME.
  41047. Permission is granted to copy, distribute and/or modify this document
  41048. under the terms of the GNU Free Documentation License, Version 1.3
  41049. or any later version published by the Free Software Foundation;
  41050. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  41051. Texts. A copy of the license is included in the section entitled ``GNU
  41052. Free Documentation License''.
  41053. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  41054. Texts, replace the "with...Texts." line with this:
  41055. with the Invariant Sections being LIST THEIR TITLES, with
  41056. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  41057. being LIST.
  41058. If you have Invariant Sections without Cover Texts, or some other
  41059. combination of the three, merge those two alternatives to suit the
  41060. situation.
  41061. If your document contains nontrivial examples of program code, we
  41062. recommend releasing these examples in parallel under your choice of free
  41063. software license, such as the GNU General Public License, to permit
  41064. their use in free software.
  41065. 
  41066. File: gdb.info, Node: Concept Index, Next: Command and Variable Index, Prev: GNU Free Documentation License, Up: Top
  41067. Concept Index
  41068. *************
  41069. �[index�]
  41070. * Menu:
  41071. * ! packet: Packets. (line 49)
  41072. * "No symbol "foo" in current context": Variables. (line 122)
  41073. * # in Modula-2: GDB/M2. (line 18)
  41074. * $: Value History. (line 13)
  41075. * $$: Value History. (line 13)
  41076. * $_ and info breakpoints: Set Breaks. (line 133)
  41077. * $_ and info line: Machine Code. (line 34)
  41078. * $_, $__, and value history: Memory. (line 119)
  41079. * &, background execution of commands: Background Execution.
  41080. (line 16)
  41081. * --annotate: Mode Options. (line 132)
  41082. * --args: Mode Options. (line 145)
  41083. * --attach, gdbserver option: Server. (line 86)
  41084. * --batch: Mode Options. (line 55)
  41085. * --batch-silent: Mode Options. (line 73)
  41086. * --baud: Mode Options. (line 151)
  41087. * --cd: Mode Options. (line 112)
  41088. * --command: File Options. (line 51)
  41089. * --configuration: Mode Options. (line 195)
  41090. * --core: File Options. (line 43)
  41091. * --data-directory: Mode Options. (line 117)
  41092. * --debug, gdbserver option: Server. (line 146)
  41093. * --debug-file, gdbserver option: Server. (line 148)
  41094. * --debug-format, gdbserver option: Server. (line 153)
  41095. * --directory: File Options. (line 77)
  41096. * --eval-command: File Options. (line 57)
  41097. * --exec: File Options. (line 35)
  41098. * --fullname: Mode Options. (line 122)
  41099. * --init-command: File Options. (line 67)
  41100. * --init-eval-command: File Options. (line 72)
  41101. * --interpreter: Mode Options. (line 170)
  41102. * --multi, gdbserver option: Connecting. (line 45)
  41103. * --nh: Mode Options. (line 45)
  41104. * --nowindows: Mode Options. (line 102)
  41105. * --nx: Mode Options. (line 11)
  41106. * --once, gdbserver option: Server. (line 126)
  41107. * --pid: File Options. (line 47)
  41108. * --quiet: Mode Options. (line 51)
  41109. * --readnever, command-line option: File Options. (line 87)
  41110. * --readnow: File Options. (line 81)
  41111. * --remote-debug, gdbserver option: Server. (line 147)
  41112. * --return-child-result: Mode Options. (line 85)
  41113. * --se: File Options. (line 39)
  41114. * --selftest: Server. (line 187)
  41115. * --silent: Mode Options. (line 51)
  41116. * --statistics: Mode Options. (line 187)
  41117. * --symbols: File Options. (line 31)
  41118. * --tty: Mode Options. (line 160)
  41119. * --tui: Mode Options. (line 163)
  41120. * --version: Mode Options. (line 191)
  41121. * --windows: Mode Options. (line 108)
  41122. * --with-gdb-datadir: Data Files. (line 19)
  41123. * --with-relocated-sources: Source Path. (line 149)
  41124. * --with-sysroot: Files. (line 453)
  41125. * --wrapper, gdbserver option: Server. (line 166)
  41126. * --write: Mode Options. (line 182)
  41127. * -b: Mode Options. (line 151)
  41128. * -c: File Options. (line 43)
  41129. * -d: File Options. (line 77)
  41130. * -D: Mode Options. (line 117)
  41131. * -e: File Options. (line 35)
  41132. * -ex: File Options. (line 57)
  41133. * -f: Mode Options. (line 122)
  41134. * -iex: File Options. (line 72)
  41135. * -info-gdb-mi-command: GDB/MI Support Commands.
  41136. (line 14)
  41137. * -ix: File Options. (line 67)
  41138. * -l: Mode Options. (line 155)
  41139. * -n: Mode Options. (line 11)
  41140. * -nw: Mode Options. (line 102)
  41141. * -p: File Options. (line 47)
  41142. * -q: Mode Options. (line 51)
  41143. * -r: File Options. (line 81)
  41144. * -readnever, option for symbol-file command: Files. (line 101)
  41145. * -s: File Options. (line 31)
  41146. * -t: Mode Options. (line 160)
  41147. * -w: Mode Options. (line 108)
  41148. * -x: File Options. (line 51)
  41149. * ., Modula-2 scope operator: M2 Scope. (line 6)
  41150. * .build-id directory: Separate Debug Files.
  41151. (line 6)
  41152. * .debug subdirectories: Separate Debug Files.
  41153. (line 6)
  41154. * .debug_gdb_scripts section: dotdebug_gdb_scripts section.
  41155. (line 6)
  41156. * .gdbinit: Startup. (line 69)
  41157. * .gdb_index section: Index Files. (line 6)
  41158. * .gdb_index section format: Index Section Format.
  41159. (line 6)
  41160. * .gnu_debugdata section: MiniDebugInfo. (line 6)
  41161. * .gnu_debuglink sections: Separate Debug Files.
  41162. (line 79)
  41163. * .note.gnu.build-id sections: Separate Debug Files.
  41164. (line 95)
  41165. * .o files, reading symbols from: Files. (line 146)
  41166. * /proc: Process Information.
  41167. (line 6)
  41168. * <architecture>: Target Description Format.
  41169. (line 72)
  41170. * <compatible>: Target Description Format.
  41171. (line 95)
  41172. * <feature>: Target Description Format.
  41173. (line 119)
  41174. * <flags>: Target Description Format.
  41175. (line 163)
  41176. * <not saved> values: Registers. (line 106)
  41177. * <osabi>: Target Description Format.
  41178. (line 82)
  41179. * <reg>: Target Description Format.
  41180. (line 222)
  41181. * <struct>: Target Description Format.
  41182. (line 163)
  41183. * <union>: Target Description Format.
  41184. (line 153)
  41185. * <vector>: Target Description Format.
  41186. (line 146)
  41187. * ? packet: Packets. (line 58)
  41188. * _NSPrintForDebugger, and printing Objective-C objects: The Print Command with Objective-C.
  41189. (line 11)
  41190. * {TYPE}: Expressions. (line 41)
  41191. * A packet: Packets. (line 65)
  41192. * AArch64 Pointer Authentication.: AArch64. (line 34)
  41193. * AArch64 support: AArch64. (line 6)
  41194. * AArch64 SVE.: AArch64. (line 19)
  41195. * abbreviation: Command Syntax. (line 13)
  41196. * acknowledgment, for GDB remote: Packet Acknowledgment.
  41197. (line 6)
  41198. * active targets: Active Targets. (line 6)
  41199. * Ada: Ada. (line 6)
  41200. * Ada exception catching: Set Catchpoints. (line 66)
  41201. * Ada exception handlers catching: Set Catchpoints. (line 92)
  41202. * Ada mode, general: Ada Mode Intro. (line 6)
  41203. * Ada settings: Ada Settings. (line 6)
  41204. * Ada task switching: Ada Tasks. (line 115)
  41205. * Ada tasking and core file debugging: Ada Tasks and Core Files.
  41206. (line 6)
  41207. * Ada, deviations from: Additions to Ada. (line 6)
  41208. * Ada, omissions from: Omissions from Ada. (line 6)
  41209. * Ada, problems: Ada Glitches. (line 6)
  41210. * Ada, tasking: Ada Tasks. (line 6)
  41211. * add new commands for external monitor: Connecting. (line 279)
  41212. * address locations: Address Locations. (line 6)
  41213. * address of a symbol: Symbols. (line 85)
  41214. * address size for remote targets: Remote Configuration.
  41215. (line 12)
  41216. * addressable memory unit: Memory. (line 133)
  41217. * aggregates (Ada): Omissions from Ada. (line 44)
  41218. * AIX shared library debugging: Debugging Output. (line 30)
  41219. * AIX threads: Debugging Output. (line 36)
  41220. * aliases for commands: Aliases. (line 6)
  41221. * alignment of remote memory accesses: Packets. (line 247)
  41222. * all-stop mode: All-Stop Mode. (line 6)
  41223. * Alpha stack: MIPS. (line 6)
  41224. * ambiguous expressions: Ambiguous Expressions.
  41225. (line 6)
  41226. * annotations: Annotations Overview.
  41227. (line 6)
  41228. * annotations for errors, warnings and interrupts: Errors. (line 6)
  41229. * annotations for invalidation messages: Invalidation. (line 6)
  41230. * annotations for prompts: Prompting. (line 6)
  41231. * annotations for running programs: Annotations for Running.
  41232. (line 6)
  41233. * annotations for source display: Source Annotations. (line 6)
  41234. * append data to a file: Dump/Restore Files. (line 6)
  41235. * Application Data Integrity: Sparc64. (line 5)
  41236. * apply a command to all frames (ignoring errors and empty output): Frame Apply.
  41237. (line 96)
  41238. * apply a command to all frames of all threads (ignoring errors and empty output): Threads.
  41239. (line 229)
  41240. * apply command to all threads (ignoring errors and empty output): Threads.
  41241. (line 222)
  41242. * apply command to several frames: Frame Apply. (line 6)
  41243. * apply command to several threads: Threads. (line 187)
  41244. * ARC EM: ARC. (line 6)
  41245. * ARC HS: ARC. (line 6)
  41246. * ARC specific commands: ARC. (line 6)
  41247. * ARC600: ARC. (line 6)
  41248. * ARC700: ARC. (line 6)
  41249. * architecture debugging info: Debugging Output. (line 23)
  41250. * argument count in user-defined commands: Define. (line 25)
  41251. * arguments (to your program): Arguments. (line 6)
  41252. * arguments, to gdbserver: Server. (line 34)
  41253. * arguments, to user-defined commands: Define. (line 6)
  41254. * ARM 32-bit mode: ARM. (line 16)
  41255. * ARM AArch64: Debugging Output. (line 17)
  41256. * array aggregates (Ada): Omissions from Ada. (line 44)
  41257. * arrays: Arrays. (line 6)
  41258. * arrays in expressions: Expressions. (line 13)
  41259. * artificial array: Arrays. (line 6)
  41260. * assembly instructions: Machine Code. (line 43)
  41261. * assignment: Assignment. (line 6)
  41262. * async output in GDB/MI: GDB/MI Output Syntax.
  41263. (line 98)
  41264. * async records in GDB/MI: GDB/MI Async Records.
  41265. (line 6)
  41266. * asynchronous execution: Background Execution.
  41267. (line 6)
  41268. * asynchronous execution, and process record and replay: Process Record and Replay.
  41269. (line 101)
  41270. * AT&T disassembly flavor: Machine Code. (line 237)
  41271. * attach: Attach. (line 6)
  41272. * attach to a program, gdbserver: Server. (line 86)
  41273. * auto-loading: Auto-loading. (line 6)
  41274. * auto-loading extensions: Auto-loading extensions.
  41275. (line 6)
  41276. * auto-loading init file in the current directory: Init File in the Current Directory.
  41277. (line 6)
  41278. * auto-loading libthread_db.so.1: libthread_db.so.1 file.
  41279. (line 6)
  41280. * auto-loading safe-path: Auto-loading safe path.
  41281. (line 6)
  41282. * auto-loading verbose mode: Auto-loading verbose mode.
  41283. (line 6)
  41284. * auto-retry, for remote TCP target: Remote Configuration.
  41285. (line 131)
  41286. * automatic display: Auto Display. (line 6)
  41287. * automatic hardware breakpoints: Set Breaks. (line 296)
  41288. * automatic overlay debugging: Automatic Overlay Debugging.
  41289. (line 6)
  41290. * automatic symbol index cache: Index Files. (line 73)
  41291. * automatic thread selection: All-Stop Mode. (line 28)
  41292. * auxiliary vector: OS Information. (line 9)
  41293. * AVR: AVR. (line 6)
  41294. * b packet: Packets. (line 76)
  41295. * B packet: Packets. (line 91)
  41296. * background execution: Background Execution.
  41297. (line 6)
  41298. * backtrace beyond main function: Backtrace. (line 155)
  41299. * backtrace limit: Backtrace. (line 192)
  41300. * base name differences: Files. (line 520)
  41301. * baud rate for remote targets: Remote Configuration.
  41302. (line 21)
  41303. * bc packet: Packets. (line 96)
  41304. * bcache statistics: Maintenance Commands.
  41305. (line 342)
  41306. * bits in remote address: Remote Configuration.
  41307. (line 12)
  41308. * blocks in guile: Blocks In Guile. (line 6)
  41309. * blocks in python: Blocks In Python. (line 6)
  41310. * bookmark: Checkpoint/Restart. (line 6)
  41311. * boundary violations, Intel MPX: Signals. (line 197)
  41312. * branch trace configuration format: Branch Trace Configuration Format.
  41313. (line 6)
  41314. * branch trace format: Branch Trace Format.
  41315. (line 6)
  41316. * branch trace store: Process Record and Replay.
  41317. (line 70)
  41318. * break in overloaded functions: Debugging C Plus Plus.
  41319. (line 9)
  41320. * break on a system call.: Set Catchpoints. (line 120)
  41321. * break on fork/exec: Set Catchpoints. (line 116)
  41322. * BREAK signal instead of Ctrl-C: Remote Configuration.
  41323. (line 36)
  41324. * breakpoint address adjusted: Breakpoint-related Warnings.
  41325. (line 6)
  41326. * breakpoint at static probe point: Linespec Locations. (line 65)
  41327. * breakpoint commands: Break Commands. (line 6)
  41328. * breakpoint commands for GDB/MI: GDB/MI Breakpoint Commands.
  41329. (line 6)
  41330. * breakpoint commands, in remote protocol: General Query Packets.
  41331. (line 983)
  41332. * breakpoint conditions: Conditions. (line 6)
  41333. * breakpoint kinds, ARM: ARM Breakpoint Kinds.
  41334. (line 6)
  41335. * breakpoint kinds, MIPS: MIPS Breakpoint Kinds.
  41336. (line 6)
  41337. * breakpoint lists: Breakpoints. (line 45)
  41338. * breakpoint numbers: Breakpoints. (line 38)
  41339. * breakpoint on events: Breakpoints. (line 30)
  41340. * breakpoint on memory address: Breakpoints. (line 17)
  41341. * breakpoint on variable modification: Breakpoints. (line 17)
  41342. * breakpoint ranges: Breakpoints. (line 45)
  41343. * breakpoint subroutine, remote: Stub Contents. (line 31)
  41344. * breakpointing Ada elaboration code: Stopping Before Main Program.
  41345. (line 6)
  41346. * breakpoints: Breakpoints. (line 6)
  41347. * breakpoints and tasks, in Ada: Ada Tasks. (line 135)
  41348. * breakpoints and threads: Thread-Specific Breakpoints.
  41349. (line 10)
  41350. * breakpoints at functions matching a regexp: Set Breaks. (line 90)
  41351. * breakpoints in guile: Breakpoints In Guile.
  41352. (line 6)
  41353. * breakpoints in overlays: Overlay Commands. (line 91)
  41354. * breakpoints in python: Breakpoints In Python.
  41355. (line 6)
  41356. * breakpoints, multiple locations: Set Breaks. (line 200)
  41357. * bs packet: Packets. (line 102)
  41358. * bug criteria: Bug Criteria. (line 6)
  41359. * bug reports: Bug Reporting. (line 6)
  41360. * bugs in GDB: GDB Bugs. (line 6)
  41361. * build ID sections: Separate Debug Files.
  41362. (line 95)
  41363. * build ID, and separate debugging files: Separate Debug Files.
  41364. (line 6)
  41365. * building GDB, requirements for: Requirements. (line 6)
  41366. * built-in simulator target: Target Commands. (line 73)
  41367. * builtin Go functions: Go. (line 31)
  41368. * builtin Go types: Go. (line 28)
  41369. * C and C++: C. (line 6)
  41370. * C and C++ checks: C Checks. (line 6)
  41371. * C and C++ constants: C Constants. (line 6)
  41372. * C and C++ defaults: C Defaults. (line 6)
  41373. * C and C++ operators: C Operators. (line 6)
  41374. * c packet: Packets. (line 109)
  41375. * C packet: Packets. (line 118)
  41376. * C++: C. (line 10)
  41377. * C++ compilers: C Plus Plus Expressions.
  41378. (line 8)
  41379. * C++ demangling: Debugging C Plus Plus.
  41380. (line 36)
  41381. * C++ exception handling: Debugging C Plus Plus.
  41382. (line 20)
  41383. * C++ overload debugging info: Debugging Output. (line 147)
  41384. * C++ scope resolution: Variables. (line 90)
  41385. * C++ symbol decoding style: Print Settings. (line 529)
  41386. * C++ symbol display: Debugging C Plus Plus.
  41387. (line 40)
  41388. * caching data of targets: Caching Target Data.
  41389. (line 6)
  41390. * caching of bfd objects: File Caching. (line 6)
  41391. * caching of opened files: File Caching. (line 6)
  41392. * call dummy stack unwinding: Calling. (line 36)
  41393. * call dummy stack unwinding on unhandled exception.: Calling.
  41394. (line 47)
  41395. * call overloaded functions: C Plus Plus Expressions.
  41396. (line 26)
  41397. * call stack: Stack. (line 9)
  41398. * call stack traces: Backtrace. (line 6)
  41399. * call-clobbered registers: Registers. (line 106)
  41400. * caller-saved registers: Registers. (line 106)
  41401. * calling functions: Calling. (line 6)
  41402. * calling functions in the program, disabling: Calling. (line 59)
  41403. * calling make: Shell Commands. (line 22)
  41404. * case sensitivity in symbol names: Symbols. (line 27)
  41405. * case-insensitive symbol names: Symbols. (line 27)
  41406. * casts, in expressions: Expressions. (line 26)
  41407. * casts, to view memory: Expressions. (line 41)
  41408. * catch Ada exceptions: Set Catchpoints. (line 66)
  41409. * catch Ada exceptions when handled: Set Catchpoints. (line 92)
  41410. * catch syscalls from inferior, remote request: General Query Packets.
  41411. (line 401)
  41412. * catchpoints: Breakpoints. (line 30)
  41413. * catchpoints, setting: Set Catchpoints. (line 6)
  41414. * change GDB's working directory: Working Directory. (line 32)
  41415. * change inferior's working directory: Working Directory. (line 13)
  41416. * character sets: Character Sets. (line 6)
  41417. * charset: Character Sets. (line 6)
  41418. * checkpoint: Checkpoint/Restart. (line 6)
  41419. * checkpoints and process id: Checkpoint/Restart. (line 76)
  41420. * checks, range: Type Checking. (line 44)
  41421. * checks, type: Checks. (line 23)
  41422. * checksum, for GDB remote: Overview. (line 21)
  41423. * choosing target byte order: Byte Order. (line 6)
  41424. * circular trace buffer: Starting and Stopping Trace Experiments.
  41425. (line 80)
  41426. * clearing breakpoints, watchpoints, catchpoints: Delete Breaks.
  41427. (line 6)
  41428. * close, file-i/o system call: close. (line 6)
  41429. * closest symbol and offset for an address: Symbols. (line 95)
  41430. * code address and its source line: Machine Code. (line 28)
  41431. * code compression, MIPS: MIPS. (line 49)
  41432. * COFF/PE exported symbols: Debugging Output. (line 50)
  41433. * collected data discarded: Starting and Stopping Trace Experiments.
  41434. (line 6)
  41435. * colon, doubled as scope operator: M2 Scope. (line 6)
  41436. * colon-colon, context for variables/functions: Variables. (line 44)
  41437. * colors: Output Styling. (line 6)
  41438. * command editing: Readline Bare Essentials.
  41439. (line 6)
  41440. * command files: Command Files. (line 6)
  41441. * command history: Command History. (line 6)
  41442. * command hooks: Hooks. (line 6)
  41443. * command interpreters: Interpreters. (line 6)
  41444. * command line editing: Editing. (line 6)
  41445. * command options: Command Options. (line 6)
  41446. * command options, boolean: Command Options. (line 21)
  41447. * command options, raw input: Command Options. (line 13)
  41448. * command scripts, debugging: Messages/Warnings. (line 65)
  41449. * command tracing: Messages/Warnings. (line 60)
  41450. * commands for C++: Debugging C Plus Plus.
  41451. (line 6)
  41452. * commands in guile: Commands In Guile. (line 6)
  41453. * commands in python: Commands In Python. (line 6)
  41454. * commands to access guile: Guile Commands. (line 6)
  41455. * commands to access python: Python Commands. (line 6)
  41456. * comment: Command Syntax. (line 37)
  41457. * COMMON blocks, Fortran: Special Fortran Commands.
  41458. (line 9)
  41459. * common targets: Target Commands. (line 46)
  41460. * compatibility, GDB/MI and CLI: GDB/MI Compatibility with CLI.
  41461. (line 6)
  41462. * compilation directory: Source Path. (line 40)
  41463. * compile C++ type conversion: Compiling and Injecting Code.
  41464. (line 90)
  41465. * compile command debugging info: Compiling and Injecting Code.
  41466. (line 82)
  41467. * compile command driver filename override: Compiling and Injecting Code.
  41468. (line 300)
  41469. * compile command options override: Compiling and Injecting Code.
  41470. (line 125)
  41471. * compiling code: Compiling and Injecting Code.
  41472. (line 6)
  41473. * completion: Completion. (line 6)
  41474. * completion of Guile commands: Commands In Guile. (line 100)
  41475. * completion of Python commands: Commands In Python. (line 70)
  41476. * completion of quoted strings: Completion. (line 83)
  41477. * completion of structure field names: Completion. (line 135)
  41478. * completion of union field names: Completion. (line 135)
  41479. * compressed debug sections: Requirements. (line 110)
  41480. * conditional breakpoints: Conditions. (line 6)
  41481. * conditional tracepoints: Tracepoint Conditions.
  41482. (line 6)
  41483. * configuring GDB: Running Configure. (line 6)
  41484. * confirmation: Messages/Warnings. (line 49)
  41485. * connection timeout, for remote TCP target: Remote Configuration.
  41486. (line 147)
  41487. * console i/o as part of file-i/o: Console I/O. (line 6)
  41488. * console interpreter: Interpreters. (line 21)
  41489. * console output in GDB/MI: GDB/MI Output Syntax.
  41490. (line 106)
  41491. * constants, in file-i/o protocol: Constants. (line 6)
  41492. * continuing: Continuing and Stepping.
  41493. (line 6)
  41494. * continuing threads: Thread Stops. (line 6)
  41495. * control C, and remote debugging: Bootstrapping. (line 25)
  41496. * controlling terminal: Input/Output. (line 23)
  41497. * convenience functions: Convenience Funs. (line 6)
  41498. * convenience functions in python: Functions In Python.
  41499. (line 6)
  41500. * convenience variables: Convenience Vars. (line 6)
  41501. * convenience variables for tracepoints: Tracepoint Variables.
  41502. (line 6)
  41503. * convenience variables, and trace state variables: Trace State Variables.
  41504. (line 17)
  41505. * convenience variables, initializing: Convenience Vars. (line 42)
  41506. * core dump file: Files. (line 6)
  41507. * core dump file target: Target Commands. (line 54)
  41508. * crash of debugger: Bug Criteria. (line 9)
  41509. * CRC algorithm definition: Separate Debug Files.
  41510. (line 140)
  41511. * CRC of memory block, remote request: General Query Packets.
  41512. (line 65)
  41513. * CRIS: CRIS. (line 6)
  41514. * CRIS mode: CRIS. (line 26)
  41515. * CRIS version: CRIS. (line 10)
  41516. * Ctrl-BREAK, MS-Windows: Cygwin Native. (line 9)
  41517. * ctrl-c message, in file-i/o protocol: The Ctrl-C Message. (line 6)
  41518. * current Ada task ID: Ada Tasks. (line 105)
  41519. * current directory: Source Path. (line 40)
  41520. * current Go package: Go. (line 11)
  41521. * current thread: Threads. (line 29)
  41522. * current thread, remote request: General Query Packets.
  41523. (line 55)
  41524. * custom JIT debug info: Custom Debug Info. (line 6)
  41525. * Cygwin DLL, debugging: Cygwin Native. (line 60)
  41526. * Cygwin-specific commands: Cygwin Native. (line 6)
  41527. * D: D. (line 6)
  41528. * d packet: Packets. (line 127)
  41529. * D packet: Packets. (line 134)
  41530. * Darwin: Darwin. (line 6)
  41531. * data breakpoints: Breakpoints. (line 17)
  41532. * data manipulation, in GDB/MI: GDB/MI Data Manipulation.
  41533. (line 6)
  41534. * dcache line-size: Caching Target Data.
  41535. (line 60)
  41536. * dcache size: Caching Target Data.
  41537. (line 57)
  41538. * dead names, GNU Hurd: Hurd Native. (line 84)
  41539. * debug expression parser: Debugging Output. (line 152)
  41540. * debug formats and C++: C Plus Plus Expressions.
  41541. (line 8)
  41542. * debug link sections: Separate Debug Files.
  41543. (line 79)
  41544. * debug remote protocol: Debugging Output. (line 159)
  41545. * debugger crash: Bug Criteria. (line 9)
  41546. * debugging agent: In-Process Agent. (line 6)
  41547. * debugging C++ programs: C Plus Plus Expressions.
  41548. (line 8)
  41549. * debugging information directory, global: Separate Debug Files.
  41550. (line 6)
  41551. * debugging information in separate files: Separate Debug Files.
  41552. (line 6)
  41553. * debugging libthread_db: Threads. (line 331)
  41554. * debugging multiple processes: Forks. (line 55)
  41555. * debugging optimized code: Optimized Code. (line 6)
  41556. * debugging stub, example: Remote Stub. (line 6)
  41557. * debugging target: Targets. (line 6)
  41558. * debugging the Cygwin DLL: Cygwin Native. (line 60)
  41559. * decimal floating point format: Decimal Floating Point.
  41560. (line 6)
  41561. * default behavior of commands, changing: Command Settings. (line 6)
  41562. * default collection action: Tracepoint Actions. (line 142)
  41563. * default data directory: Data Files. (line 19)
  41564. * default settings, changing: Command Settings. (line 6)
  41565. * default source path substitution: Source Path. (line 149)
  41566. * default system root: Files. (line 453)
  41567. * define trace state variable, remote request: Tracepoint Packets.
  41568. (line 121)
  41569. * defining macros interactively: Macros. (line 59)
  41570. * definition of a macro, showing: Macros. (line 47)
  41571. * delete breakpoints: Delete Breaks. (line 41)
  41572. * deleting breakpoints, watchpoints, catchpoints: Delete Breaks.
  41573. (line 6)
  41574. * deliver a signal to a program: Signaling. (line 6)
  41575. * demangle: Symbols. (line 114)
  41576. * demangler crashes: Maintenance Commands.
  41577. (line 146)
  41578. * demangler crashes <1>: Maintenance Commands.
  41579. (line 173)
  41580. * demangler crashes <2>: Maintenance Commands.
  41581. (line 197)
  41582. * demangling C++ names: Print Settings. (line 510)
  41583. * deprecated commands: Maintenance Commands.
  41584. (line 160)
  41585. * derived type of an object, printing: Print Settings. (line 541)
  41586. * descriptor tables display: DJGPP Native. (line 24)
  41587. * detach from task, GNU Hurd: Hurd Native. (line 59)
  41588. * detach from thread, GNU Hurd: Hurd Native. (line 109)
  41589. * direct memory access (DMA) on MS-DOS: DJGPP Native. (line 74)
  41590. * directories for source files: Source Path. (line 6)
  41591. * directory, compilation: Source Path. (line 40)
  41592. * directory, current: Source Path. (line 40)
  41593. * disable address space randomization, remote request: General Query Packets.
  41594. (line 84)
  41595. * disabling calling functions in the program: Calling. (line 59)
  41596. * disassembler options: Machine Code. (line 222)
  41597. * disconnected tracing: Starting and Stopping Trace Experiments.
  41598. (line 45)
  41599. * displaced stepping debugging info: Debugging Output. (line 75)
  41600. * displaced stepping support: Maintenance Commands.
  41601. (line 112)
  41602. * displaced stepping, and process record and replay: Process Record and Replay.
  41603. (line 96)
  41604. * display command history: Command History. (line 110)
  41605. * display derived types: Print Settings. (line 541)
  41606. * display disabled out of scope: Auto Display. (line 86)
  41607. * display GDB copyright: Help. (line 166)
  41608. * display of expressions: Auto Display. (line 6)
  41609. * display remote monitor communications: Target Commands. (line 107)
  41610. * display remote packets: Debugging Output. (line 159)
  41611. * DJGPP debugging: DJGPP Native. (line 6)
  41612. * DLLs with no debugging symbols: Non-debug DLL Symbols.
  41613. (line 6)
  41614. * do not print frame arguments: Print Settings. (line 154)
  41615. * documentation: Formatting Documentation.
  41616. (line 22)
  41617. * don't repeat command: Define. (line 111)
  41618. * don't repeat Guile command: Commands In Guile. (line 67)
  41619. * don't repeat Python command: Commands In Python. (line 42)
  41620. * DOS file-name semantics of file names.: Files. (line 476)
  41621. * DOS serial data link, remote debugging: DJGPP Native. (line 118)
  41622. * DOS serial port status: DJGPP Native. (line 139)
  41623. * DPMI: DJGPP Native. (line 6)
  41624. * dprintf: Dynamic Printf. (line 6)
  41625. * dump all data collected at tracepoint: tdump. (line 6)
  41626. * dump core from inferior: Core File Generation.
  41627. (line 6)
  41628. * dump data to a file: Dump/Restore Files. (line 6)
  41629. * dump/restore files: Dump/Restore Files. (line 6)
  41630. * DVC register: PowerPC Embedded. (line 6)
  41631. * DWARF compilation units cache: Maintenance Commands.
  41632. (line 408)
  41633. * DWARF DIEs: Debugging Output. (line 56)
  41634. * DWARF frame unwinders: Maintenance Commands.
  41635. (line 422)
  41636. * DWARF Line Tables: Debugging Output. (line 61)
  41637. * DWARF Reading: Debugging Output. (line 68)
  41638. * DWARF-2 CFI and CRIS: CRIS. (line 18)
  41639. * dynamic linking: Files. (line 123)
  41640. * dynamic printf: Dynamic Printf. (line 6)
  41641. * dynamic varobj: GDB/MI Variable Objects.
  41642. (line 166)
  41643. * editing: Editing. (line 15)
  41644. * editing command lines: Readline Bare Essentials.
  41645. (line 6)
  41646. * editing source files: Edit. (line 6)
  41647. * eight-bit characters in strings: Print Settings. (line 455)
  41648. * elaboration phase: Starting. (line 92)
  41649. * ELinOS system-wide configuration script: System-wide Configuration Scripts.
  41650. (line 15)
  41651. * Emacs: Emacs. (line 6)
  41652. * empty response, for unsupported packets: Overview. (line 97)
  41653. * enable/disable a breakpoint: Disabling. (line 6)
  41654. * enabling and disabling probes: Static Probe Points.
  41655. (line 52)
  41656. * entering numbers: Numbers. (line 6)
  41657. * environment (of your program): Environment. (line 6)
  41658. * errno values, in file-i/o protocol: Errno Values. (line 6)
  41659. * error on valid input: Bug Criteria. (line 12)
  41660. * event debugging info: Debugging Output. (line 81)
  41661. * event designators: Event Designators. (line 6)
  41662. * event handling: Set Catchpoints. (line 6)
  41663. * examine process image: Process Information.
  41664. (line 6)
  41665. * examining data: Data. (line 6)
  41666. * examining memory: Memory. (line 9)
  41667. * exception handlers: Set Catchpoints. (line 6)
  41668. * exceptions, guile: Guile Exception Handling.
  41669. (line 6)
  41670. * exceptions, python: Exception Handling. (line 6)
  41671. * exec events, remote reply: Stop Reply Packets. (line 141)
  41672. * executable file: Files. (line 16)
  41673. * executable file target: Target Commands. (line 50)
  41674. * executable file, for remote target: Remote Configuration.
  41675. (line 102)
  41676. * execute commands from a file: Command Files. (line 17)
  41677. * execute forward or backward in time: Reverse Execution. (line 92)
  41678. * execute remote command, remote request: General Query Packets.
  41679. (line 536)
  41680. * execution, foreground, background and asynchronous: Background Execution.
  41681. (line 6)
  41682. * exit status of shell commands: Convenience Vars. (line 188)
  41683. * exiting GDB: Quitting GDB. (line 6)
  41684. * expand macro once: Macros. (line 38)
  41685. * expanding preprocessor macros: Macros. (line 29)
  41686. * explicit locations: Explicit Locations. (line 6)
  41687. * explore type: Data. (line 234)
  41688. * explore value: Data. (line 227)
  41689. * exploring hierarchical data structures: Data. (line 125)
  41690. * expression debugging info: Debugging Output. (line 86)
  41691. * expression parser, debugging info: Debugging Output. (line 152)
  41692. * expressions: Expressions. (line 6)
  41693. * expressions in Ada: Ada. (line 11)
  41694. * expressions in C or C++: C. (line 6)
  41695. * expressions in C++: C Plus Plus Expressions.
  41696. (line 6)
  41697. * expressions in Modula-2: Modula-2. (line 12)
  41698. * extend GDB for remote targets: Connecting. (line 279)
  41699. * extending GDB: Extending GDB. (line 6)
  41700. * extra signal information: Signals. (line 156)
  41701. * F packet: Packets. (line 150)
  41702. * F reply packet: The F Reply Packet. (line 6)
  41703. * F request packet: The F Request Packet.
  41704. (line 6)
  41705. * fast tracepoints: Set Tracepoints. (line 24)
  41706. * fast tracepoints, setting: Create and Delete Tracepoints.
  41707. (line 50)
  41708. * fatal signal: Bug Criteria. (line 9)
  41709. * fatal signals: Signals. (line 15)
  41710. * features of the remote protocol: General Query Packets.
  41711. (line 589)
  41712. * file name canonicalization: Files. (line 520)
  41713. * file transfer: File Transfer. (line 6)
  41714. * file transfer, remote protocol: Host I/O Packets. (line 6)
  41715. * file-i/o examples: File-I/O Examples. (line 6)
  41716. * file-i/o overview: File-I/O Overview. (line 6)
  41717. * File-I/O remote protocol extension: File-I/O Remote Protocol Extension.
  41718. (line 6)
  41719. * file-i/o reply packet: The F Reply Packet. (line 6)
  41720. * file-i/o request packet: The F Request Packet.
  41721. (line 6)
  41722. * filename-display: Backtrace. (line 202)
  41723. * find trace snapshot: tfind. (line 6)
  41724. * flinching: Messages/Warnings. (line 49)
  41725. * float promotion: ABI. (line 34)
  41726. * floating point: Floating Point Hardware.
  41727. (line 6)
  41728. * floating point registers: Registers. (line 15)
  41729. * floating point, MIPS remote: MIPS Embedded. (line 13)
  41730. * focus of debugging: Threads. (line 29)
  41731. * foo: Symbol Errors. (line 54)
  41732. * foreground execution: Background Execution.
  41733. (line 6)
  41734. * fork events, remote reply: Stop Reply Packets. (line 104)
  41735. * fork, debugging programs which call: Forks. (line 6)
  41736. * format options: Print Settings. (line 6)
  41737. * formatted output: Output Formats. (line 6)
  41738. * Fortran: Summary. (line 40)
  41739. * Fortran Defaults: Fortran Defaults. (line 6)
  41740. * Fortran modules, information about: Symbols. (line 555)
  41741. * Fortran operators and expressions: Fortran Operators. (line 6)
  41742. * Fortran-specific support in GDB: Fortran. (line 6)
  41743. * FR-V shared-library debugging: Debugging Output. (line 193)
  41744. * frame debugging info: Debugging Output. (line 101)
  41745. * frame decorator api: Frame Decorator API.
  41746. (line 6)
  41747. * frame filters api: Frame Filter API. (line 6)
  41748. * frame information, printing: Print Settings. (line 314)
  41749. * frame level: Frames. (line 28)
  41750. * frame number: Frames. (line 28)
  41751. * frame pointer: Frames. (line 21)
  41752. * frame pointer register: Registers. (line 31)
  41753. * frame, definition: Frames. (line 6)
  41754. * frameless execution: Frames. (line 34)
  41755. * frames in guile: Frames In Guile. (line 6)
  41756. * frames in python: Frames In Python. (line 6)
  41757. * free memory information (MS-DOS): DJGPP Native. (line 19)
  41758. * FreeBSD: FreeBSD. (line 6)
  41759. * FreeBSD LWP debug messages: Debugging Output. (line 92)
  41760. * FreeBSD native target debug messages: Debugging Output. (line 97)
  41761. * fstat, file-i/o system call: stat/fstat. (line 6)
  41762. * Fujitsu: Remote Stub. (line 68)
  41763. * full symbol tables, listing GDB's internal: Symbols. (line 645)
  41764. * function call arguments, optimized out: Backtrace. (line 133)
  41765. * function entry/exit, wrong values of variables: Variables. (line 106)
  41766. * functions and variables by Fortran module: Symbols. (line 555)
  41767. * functions without line info, and stepping: Continuing and Stepping.
  41768. (line 92)
  41769. * g packet: Packets. (line 155)
  41770. * G packet: Packets. (line 183)
  41771. * g++, GNU C++ compiler: C. (line 10)
  41772. * garbled pointers: DJGPP Native. (line 42)
  41773. * GCC and C++: C Plus Plus Expressions.
  41774. (line 8)
  41775. * GDB bugs, reporting: Bug Reporting. (line 6)
  41776. * GDB internal error: Maintenance Commands.
  41777. (line 197)
  41778. * gdb module: Basic Python. (line 28)
  41779. * gdb objects: GDB Scheme Data Types.
  41780. (line 6)
  41781. * GDB reference card: Formatting Documentation.
  41782. (line 6)
  41783. * GDB startup: Startup. (line 6)
  41784. * GDB version number: Help. (line 156)
  41785. * gdb.ini: Startup. (line 69)
  41786. * gdb.printing: gdb.printing. (line 6)
  41787. * gdb.prompt: gdb.prompt. (line 6)
  41788. * gdb.types: gdb.types. (line 6)
  41789. * gdb.Value: Values From Inferior.
  41790. (line 6)
  41791. * GDB/MI development: GDB/MI Development and Front Ends.
  41792. (line 6)
  41793. * GDB/MI General Design: GDB/MI General Design.
  41794. (line 6)
  41795. * GDB/MI, async records: GDB/MI Async Records.
  41796. (line 6)
  41797. * GDB/MI, breakpoint commands: GDB/MI Breakpoint Commands.
  41798. (line 6)
  41799. * GDB/MI, compatibility with CLI: GDB/MI Compatibility with CLI.
  41800. (line 6)
  41801. * GDB/MI, data manipulation: GDB/MI Data Manipulation.
  41802. (line 6)
  41803. * GDB/MI, input syntax: GDB/MI Input Syntax.
  41804. (line 6)
  41805. * GDB/MI, its purpose: GDB/MI. (line 36)
  41806. * GDB/MI, output syntax: GDB/MI Output Syntax.
  41807. (line 6)
  41808. * GDB/MI, result records: GDB/MI Result Records.
  41809. (line 6)
  41810. * GDB/MI, simple examples: GDB/MI Simple Examples.
  41811. (line 6)
  41812. * GDB/MI, stream records: GDB/MI Stream Records.
  41813. (line 6)
  41814. * gdbarch debugging info: Debugging Output. (line 23)
  41815. * GDBHISTFILE, environment variable: Command History. (line 26)
  41816. * GDBHISTSIZE, environment variable: Command History. (line 56)
  41817. * gdbserver, command-line arguments: Server. (line 34)
  41818. * gdbserver, connecting: Connecting. (line 6)
  41819. * gdbserver, search path for libthread_db: Server. (line 254)
  41820. * gdbserver, send all debug output to a single file: Server. (line 148)
  41821. * gdbserver, target extended-remote mode: Connecting. (line 6)
  41822. * gdbserver, target remote mode: Connecting. (line 6)
  41823. * gdbserver, types of connections: Connecting. (line 6)
  41824. * GDT: DJGPP Native. (line 24)
  41825. * get thread information block address: General Query Packets.
  41826. (line 303)
  41827. * get thread-local storage address, remote request: General Query Packets.
  41828. (line 271)
  41829. * gettimeofday, file-i/o system call: gettimeofday. (line 6)
  41830. * getting structure elements using gdb.Field objects as subscripts: Values From Inferior.
  41831. (line 40)
  41832. * global debugging information directories: Separate Debug Files.
  41833. (line 6)
  41834. * global thread identifier (GDB): Threads. (line 88)
  41835. * global thread number: Threads. (line 88)
  41836. * GNAT descriptive types: Ada Glitches. (line 57)
  41837. * GNAT encoding: Ada Glitches. (line 57)
  41838. * GNU C++: C. (line 10)
  41839. * GNU Emacs: Emacs. (line 6)
  41840. * GNU Hurd debugging: Hurd Native. (line 6)
  41841. * GNU/Hurd debug messages: Debugging Output. (line 106)
  41842. * GNU/Linux LWP debug messages: Debugging Output. (line 121)
  41843. * GNU/Linux namespaces debug messages: Debugging Output. (line 125)
  41844. * Go (programming language): Go. (line 6)
  41845. * guile api: Guile API. (line 6)
  41846. * guile architectures: Architectures In Guile.
  41847. (line 6)
  41848. * guile auto-loading: Guile Auto-loading. (line 6)
  41849. * guile commands: Guile Commands. (line 6)
  41850. * guile commands <1>: Commands In Guile. (line 6)
  41851. * guile configuration: Guile Configuration.
  41852. (line 6)
  41853. * guile exceptions: Guile Exception Handling.
  41854. (line 6)
  41855. * guile gdb module: Basic Guile. (line 37)
  41856. * guile iterators: Iterators In Guile. (line 6)
  41857. * guile modules: Guile Modules. (line 6)
  41858. * guile pagination: Basic Guile. (line 6)
  41859. * guile parameters: Parameters In Guile.
  41860. (line 6)
  41861. * guile pretty printing api: Guile Pretty Printing API.
  41862. (line 6)
  41863. * guile scripting: Guile. (line 6)
  41864. * guile scripts directory: Guile Introduction. (line 15)
  41865. * guile stdout: Basic Guile. (line 6)
  41866. * guile, working with types: Types In Guile. (line 6)
  41867. * guile, working with values from inferior: Values From Inferior In Guile.
  41868. (line 6)
  41869. * H packet: Packets. (line 193)
  41870. * handling signals: Signals. (line 27)
  41871. * hardware breakpoints: Set Breaks. (line 61)
  41872. * hardware debug registers: Maintenance Commands.
  41873. (line 468)
  41874. * hardware watchpoints: Set Watchpoints. (line 31)
  41875. * hash mark while downloading: Target Commands. (line 98)
  41876. * heuristic-fence-post (Alpha, MIPS): MIPS. (line 14)
  41877. * history events: Event Designators. (line 8)
  41878. * history expansion: History Interaction.
  41879. (line 6)
  41880. * history expansion, turn on/off: Command History. (line 85)
  41881. * history file: Command History. (line 26)
  41882. * history number: Value History. (line 13)
  41883. * history of values printed by GDB: Value History. (line 6)
  41884. * history size: Command History. (line 56)
  41885. * history substitution: Command History. (line 26)
  41886. * hooks, for commands: Hooks. (line 6)
  41887. * hooks, post-command: Hooks. (line 11)
  41888. * hooks, pre-command: Hooks. (line 6)
  41889. * host character set: Character Sets. (line 6)
  41890. * Host I/O, remote protocol: Host I/O Packets. (line 6)
  41891. * how many arguments (user-defined commands): Define. (line 25)
  41892. * HPPA support: HPPA. (line 6)
  41893. * i packet: Packets. (line 207)
  41894. * I packet: Packets. (line 212)
  41895. * i/o: Input/Output. (line 6)
  41896. * I/O registers (Atmel AVR): AVR. (line 10)
  41897. * i386: Remote Stub. (line 56)
  41898. * i386-stub.c: Remote Stub. (line 56)
  41899. * IDT: DJGPP Native. (line 24)
  41900. * ignore count (of breakpoint): Conditions. (line 79)
  41901. * in-process agent protocol: In-Process Agent Protocol.
  41902. (line 6)
  41903. * incomplete type: Symbols. (line 346)
  41904. * indentation in structure display: Print Settings. (line 417)
  41905. * index files: Index Files. (line 6)
  41906. * index section format: Index Section Format.
  41907. (line 6)
  41908. * inferior: Inferiors Connections and Programs.
  41909. (line 15)
  41910. * inferior debugging info: Debugging Output. (line 110)
  41911. * inferior events in Python: Events In Python. (line 6)
  41912. * inferior functions, calling: Calling. (line 6)
  41913. * inferior tty: Input/Output. (line 44)
  41914. * inferiors in Python: Inferiors In Python.
  41915. (line 6)
  41916. * infinite recursion in user-defined commands: Define. (line 128)
  41917. * info for known .debug_gdb_scripts-loaded scripts: Maintenance Commands.
  41918. (line 335)
  41919. * info for known object files: Maintenance Commands.
  41920. (line 320)
  41921. * info line, repeated calls: Machine Code. (line 40)
  41922. * info proc cmdline: Process Information.
  41923. (line 41)
  41924. * info proc cwd: Process Information.
  41925. (line 45)
  41926. * info proc exe: Process Information.
  41927. (line 49)
  41928. * info proc files: Process Information.
  41929. (line 53)
  41930. * information about static tracepoint markers: Listing Static Tracepoint Markers.
  41931. (line 6)
  41932. * information about tracepoints: Listing Tracepoints.
  41933. (line 6)
  41934. * inheritance: Debugging C Plus Plus.
  41935. (line 26)
  41936. * init file: Startup. (line 11)
  41937. * init file name: Startup. (line 69)
  41938. * initial frame: Frames. (line 12)
  41939. * initialization file, readline: Readline Init File. (line 6)
  41940. * injecting code: Compiling and Injecting Code.
  41941. (line 6)
  41942. * inline functions, debugging: Inline Functions. (line 6)
  41943. * innermost frame: Frames. (line 12)
  41944. * input syntax for GDB/MI: GDB/MI Input Syntax.
  41945. (line 6)
  41946. * installation: Installing GDB. (line 6)
  41947. * instructions, assembly: Machine Code. (line 43)
  41948. * integral datatypes, in file-i/o protocol: Integral Datatypes.
  41949. (line 6)
  41950. * Intel: Remote Stub. (line 56)
  41951. * Intel disassembly flavor: Machine Code. (line 237)
  41952. * Intel Memory Protection Extensions (MPX).: i386. (line 21)
  41953. * Intel MPX boundary violations: Signals. (line 197)
  41954. * Intel Processor Trace: Process Record and Replay.
  41955. (line 75)
  41956. * interaction, readline: Readline Interaction.
  41957. (line 6)
  41958. * internal commands: Maintenance Commands.
  41959. (line 6)
  41960. * internal errors, control of GDB behavior: Maintenance Commands.
  41961. (line 197)
  41962. * internal GDB breakpoints: Set Breaks. (line 374)
  41963. * interrupt: Quitting GDB. (line 13)
  41964. * interrupt debuggee on MS-Windows: Cygwin Native. (line 9)
  41965. * interrupt remote programs: Remote Configuration.
  41966. (line 36)
  41967. * interrupt remote programs <1>: Remote Configuration.
  41968. (line 108)
  41969. * interrupting remote programs: Connecting. (line 246)
  41970. * interrupting remote targets: Bootstrapping. (line 25)
  41971. * interrupts (remote protocol): Interrupts. (line 6)
  41972. * invalid input: Bug Criteria. (line 16)
  41973. * invoke another interpreter: Interpreters. (line 39)
  41974. * ipa protocol commands: IPA Protocol Commands.
  41975. (line 6)
  41976. * ipa protocol objects: IPA Protocol Objects.
  41977. (line 6)
  41978. * isatty, file-i/o system call: isatty. (line 6)
  41979. * JIT compilation interface: JIT Interface. (line 6)
  41980. * JIT debug info reader: Custom Debug Info. (line 6)
  41981. * just-in-time compilation: JIT Interface. (line 6)
  41982. * just-in-time compilation, debugging messages: Debugging Output.
  41983. (line 117)
  41984. * k packet: Packets. (line 216)
  41985. * kernel crash dump: BSD libkvm Interface.
  41986. (line 6)
  41987. * kernel memory image: BSD libkvm Interface.
  41988. (line 6)
  41989. * kill ring: Readline Killing Commands.
  41990. (line 18)
  41991. * killing text: Readline Killing Commands.
  41992. (line 6)
  41993. * languages: Languages. (line 6)
  41994. * last tracepoint number: Create and Delete Tracepoints.
  41995. (line 122)
  41996. * latest breakpoint: Set Breaks. (line 6)
  41997. * lazy strings in guile: Lazy Strings In Guile.
  41998. (line 6)
  41999. * lazy strings in python: Lazy Strings In Python.
  42000. (line 6)
  42001. * LDT: DJGPP Native. (line 24)
  42002. * leaving GDB: Quitting GDB. (line 6)
  42003. * libkvm: BSD libkvm Interface.
  42004. (line 6)
  42005. * library list format, remote protocol: Library List Format.
  42006. (line 6)
  42007. * library list format, remote protocol <1>: Library List Format for SVR4 Targets.
  42008. (line 6)
  42009. * limit hardware breakpoints and watchpoints: Remote Configuration.
  42010. (line 79)
  42011. * limit hardware watchpoints length: Remote Configuration.
  42012. (line 91)
  42013. * limit on number of printed array elements: Print Settings. (line 141)
  42014. * limits, in file-i/o protocol: Limits. (line 6)
  42015. * line tables in python: Line Tables In Python.
  42016. (line 6)
  42017. * line tables, listing GDB's internal: Symbols. (line 692)
  42018. * linespec locations: Linespec Locations. (line 6)
  42019. * Linux lightweight processes: Debugging Output. (line 121)
  42020. * list active threads, remote request: General Query Packets.
  42021. (line 238)
  42022. * list of supported file-i/o calls: List of Supported Calls.
  42023. (line 6)
  42024. * list output in GDB/MI: GDB/MI Output Syntax.
  42025. (line 117)
  42026. * list, how many lines to display: List. (line 30)
  42027. * listing GDB's internal line tables: Symbols. (line 692)
  42028. * listing GDB's internal symbol tables: Symbols. (line 645)
  42029. * listing machine instructions: Machine Code. (line 43)
  42030. * listing mapped overlays: Overlay Commands. (line 60)
  42031. * lists of breakpoints: Breakpoints. (line 45)
  42032. * load address, overlay's: How Overlays Work. (line 6)
  42033. * load shared library: Files. (line 327)
  42034. * load symbols from memory: Files. (line 193)
  42035. * local socket, target remote: Connecting. (line 147)
  42036. * local variables: Symbols. (line 415)
  42037. * locate address: Output Formats. (line 35)
  42038. * location: Specify Location. (line 6)
  42039. * lock scheduler: All-Stop Mode. (line 37)
  42040. * log output in GDB/MI: GDB/MI Output Syntax.
  42041. (line 113)
  42042. * logging file name: Logging Output. (line 12)
  42043. * logging GDB output: Logging Output. (line 6)
  42044. * lseek flags, in file-i/o protocol: Lseek Flags. (line 6)
  42045. * lseek, file-i/o system call: lseek. (line 6)
  42046. * m packet: Packets. (line 239)
  42047. * M packet: Packets. (line 259)
  42048. * m680x0: Remote Stub. (line 59)
  42049. * m68k-stub.c: Remote Stub. (line 59)
  42050. * Mach-O symbols processing: Debugging Output. (line 130)
  42051. * machine instructions: Machine Code. (line 43)
  42052. * macro definition, showing: Macros. (line 47)
  42053. * macro expansion, showing the results of preprocessor: Macros.
  42054. (line 29)
  42055. * macros, example of debugging with: Macros. (line 83)
  42056. * macros, from debug info: Macros. (line 47)
  42057. * macros, user-defined: Macros. (line 59)
  42058. * mailing lists: GDB/MI Development and Front Ends.
  42059. (line 77)
  42060. * maintenance commands: Maintenance Commands.
  42061. (line 6)
  42062. * Man pages: Man Pages. (line 6)
  42063. * managing frame filters: Frame Filter Management.
  42064. (line 6)
  42065. * manual overlay debugging: Overlay Commands. (line 23)
  42066. * map an overlay: Overlay Commands. (line 30)
  42067. * mapinfo list, QNX Neutrino: Process Information.
  42068. (line 131)
  42069. * mapped address: How Overlays Work. (line 6)
  42070. * mapped overlays: How Overlays Work. (line 6)
  42071. * markers, static tracepoints: Set Tracepoints. (line 28)
  42072. * maximum value for offset of closest symbol: Print Settings.
  42073. (line 70)
  42074. * member functions: C Plus Plus Expressions.
  42075. (line 16)
  42076. * memory address space mappings: Process Information.
  42077. (line 80)
  42078. * memory address space mappings <1>: Maintenance Commands.
  42079. (line 260)
  42080. * memory map format: Memory Map Format. (line 6)
  42081. * memory region attributes: Memory Region Attributes.
  42082. (line 6)
  42083. * memory tracing: Breakpoints. (line 17)
  42084. * memory transfer, in file-i/o protocol: Memory Transfer. (line 6)
  42085. * memory used by commands: Maintenance Commands.
  42086. (line 569)
  42087. * memory used for symbol tables: Files. (line 315)
  42088. * memory, alignment and size of remote accesses: Packets. (line 247)
  42089. * memory, viewing as typed object: Expressions. (line 41)
  42090. * mi interpreter: Interpreters. (line 26)
  42091. * mi1 interpreter: Interpreters. (line 37)
  42092. * mi2 interpreter: Interpreters. (line 34)
  42093. * mi3 interpreter: Interpreters. (line 31)
  42094. * minimal language: Unsupported Languages.
  42095. (line 6)
  42096. * minimal symbol dump: Symbols. (line 619)
  42097. * Minimal symbols and DLLs: Non-debug DLL Symbols.
  42098. (line 6)
  42099. * MIPS addresses, masking: MIPS. (line 80)
  42100. * MIPS remote floating point: MIPS Embedded. (line 13)
  42101. * MIPS stack: MIPS. (line 6)
  42102. * miscellaneous settings: Other Misc Settings.
  42103. (line 6)
  42104. * MMX registers (x86): Registers. (line 76)
  42105. * mode_t values, in file-i/o protocol: mode_t Values. (line 6)
  42106. * Modula-2: Summary. (line 29)
  42107. * Modula-2 built-ins: Built-In Func/Proc. (line 6)
  42108. * Modula-2 checks: M2 Checks. (line 6)
  42109. * Modula-2 constants: Built-In Func/Proc. (line 114)
  42110. * Modula-2 defaults: M2 Defaults. (line 6)
  42111. * Modula-2 operators: M2 Operators. (line 6)
  42112. * Modula-2 types: M2 Types. (line 6)
  42113. * Modula-2, deviations from: Deviations. (line 6)
  42114. * Modula-2, GDB support: Modula-2. (line 6)
  42115. * module functions and variables: Symbols. (line 555)
  42116. * modules: Symbols. (line 547)
  42117. * monitor commands, for gdbserver: Server. (line 218)
  42118. * Motorola 680x0: Remote Stub. (line 59)
  42119. * MS Windows debugging: Cygwin Native. (line 6)
  42120. * MS-DOS system info: DJGPP Native. (line 19)
  42121. * MS-DOS-specific commands: DJGPP Native. (line 6)
  42122. * multiple locations, breakpoints: Set Breaks. (line 200)
  42123. * multiple processes: Forks. (line 6)
  42124. * multiple targets: Active Targets. (line 6)
  42125. * multiple threads: Threads. (line 6)
  42126. * multiple threads, backtrace: Backtrace. (line 97)
  42127. * multiple-symbols menu: Ambiguous Expressions.
  42128. (line 51)
  42129. * multiprocess extensions, in remote protocol: General Query Packets.
  42130. (line 913)
  42131. * name a thread: Threads. (line 247)
  42132. * names of symbols: Symbols. (line 14)
  42133. * namespace in C++: C Plus Plus Expressions.
  42134. (line 20)
  42135. * native Cygwin debugging: Cygwin Native. (line 6)
  42136. * native DJGPP debugging: DJGPP Native. (line 6)
  42137. * native script auto-loading: Auto-loading sequences.
  42138. (line 6)
  42139. * native target: Target Commands. (line 85)
  42140. * negative breakpoint numbers: Set Breaks. (line 374)
  42141. * never read symbols: Files. (line 101)
  42142. * New SYSTAG message: Threads. (line 35)
  42143. * new user interface: Interpreters. (line 68)
  42144. * Newlib OS ABI and its influence on the longjmp handling: ABI.
  42145. (line 11)
  42146. * Nios II architecture: Nios II. (line 6)
  42147. * no debug info functions: Calling. (line 78)
  42148. * no debug info variables: Variables. (line 142)
  42149. * non-member C++ functions, set breakpoint in: Set Breaks. (line 113)
  42150. * non-stop mode: Non-Stop Mode. (line 6)
  42151. * non-stop mode, and process record and replay: Process Record and Replay.
  42152. (line 101)
  42153. * non-stop mode, and set displaced-stepping: Maintenance Commands.
  42154. (line 129)
  42155. * non-stop mode, remote request: General Query Packets.
  42156. (line 379)
  42157. * noninvasive task options: Hurd Native. (line 72)
  42158. * notation, readline: Readline Bare Essentials.
  42159. (line 6)
  42160. * notational conventions, for GDB/MI: GDB/MI. (line 52)
  42161. * notification packets: Notification Packets.
  42162. (line 6)
  42163. * notify output in GDB/MI: GDB/MI Output Syntax.
  42164. (line 102)
  42165. * NULL elements in arrays: Print Settings. (line 408)
  42166. * number of array elements to print: Print Settings. (line 141)
  42167. * number representation: Numbers. (line 6)
  42168. * numbers for breakpoints: Breakpoints. (line 38)
  42169. * object files, relocatable, reading symbols from: Files. (line 146)
  42170. * Objective-C: Objective-C. (line 6)
  42171. * Objective-C, classes and selectors: Symbols. (line 570)
  42172. * Objective-C, print objects: The Print Command with Objective-C.
  42173. (line 6)
  42174. * OBJFILE-gdb.gdb: objfile-gdbdotext file.
  42175. (line 6)
  42176. * OBJFILE-gdb.py: objfile-gdbdotext file.
  42177. (line 6)
  42178. * OBJFILE-gdb.scm: objfile-gdbdotext file.
  42179. (line 6)
  42180. * objfiles in guile: Objfiles In Guile. (line 6)
  42181. * objfiles in python: Objfiles In Python. (line 6)
  42182. * observer debugging info: Debugging Output. (line 142)
  42183. * octal escapes in strings: Print Settings. (line 455)
  42184. * online documentation: Help. (line 6)
  42185. * opaque data types: Symbols. (line 582)
  42186. * open flags, in file-i/o protocol: Open Flags. (line 6)
  42187. * open, file-i/o system call: open. (line 6)
  42188. * OpenCL C: OpenCL C. (line 6)
  42189. * OpenCL C Datatypes: OpenCL C Datatypes. (line 6)
  42190. * OpenCL C Expressions: OpenCL C Expressions.
  42191. (line 6)
  42192. * OpenCL C Operators: OpenCL C Operators. (line 6)
  42193. * OpenRISC 1000: OpenRISC 1000. (line 6)
  42194. * operate-and-get-next: Editing. (line 32)
  42195. * operating system information: Operating System Information.
  42196. (line 6)
  42197. * operating system information, process list: Process list. (line 6)
  42198. * optimized code, debugging: Optimized Code. (line 6)
  42199. * optimized code, wrong values of variables: Variables. (line 106)
  42200. * optimized out value in guile: Values From Inferior In Guile.
  42201. (line 102)
  42202. * optimized out value in Python: Values From Inferior.
  42203. (line 70)
  42204. * optimized out, in backtrace: Backtrace. (line 133)
  42205. * optional debugging messages: Debugging Output. (line 6)
  42206. * optional warnings: Messages/Warnings. (line 6)
  42207. * OS ABI: ABI. (line 11)
  42208. * OS information: OS Information. (line 6)
  42209. * out-of-line single-stepping: Maintenance Commands.
  42210. (line 112)
  42211. * outermost frame: Frames. (line 12)
  42212. * output formats: Output Formats. (line 6)
  42213. * output syntax of GDB/MI: GDB/MI Output Syntax.
  42214. (line 6)
  42215. * overlay area: How Overlays Work. (line 6)
  42216. * overlay example program: Overlay Sample Program.
  42217. (line 6)
  42218. * overlays: Overlays. (line 6)
  42219. * overlays, setting breakpoints in: Overlay Commands. (line 91)
  42220. * overloaded functions, calling: C Plus Plus Expressions.
  42221. (line 26)
  42222. * overloaded functions, overload resolution: Debugging C Plus Plus.
  42223. (line 59)
  42224. * overloading in C++: Debugging C Plus Plus.
  42225. (line 15)
  42226. * overloading, Ada: Overloading support for Ada.
  42227. (line 6)
  42228. * p packet: Packets. (line 271)
  42229. * P packet: Packets. (line 284)
  42230. * packet acknowledgment, for GDB remote: Packet Acknowledgment.
  42231. (line 6)
  42232. * packet size, remote protocol: General Query Packets.
  42233. (line 819)
  42234. * packets, notification: Notification Packets.
  42235. (line 6)
  42236. * packets, reporting on stdout: Debugging Output. (line 159)
  42237. * packets, tracepoint: Tracepoint Packets. (line 6)
  42238. * page size: Screen Size. (line 6)
  42239. * page tables display (MS-DOS): DJGPP Native. (line 55)
  42240. * pagination: Screen Size. (line 6)
  42241. * parameters in guile: Parameters In Guile.
  42242. (line 6)
  42243. * parameters in python: Parameters In Python.
  42244. (line 6)
  42245. * partial symbol dump: Symbols. (line 619)
  42246. * partial symbol tables, listing GDB's internal: Symbols. (line 645)
  42247. * Pascal: Summary. (line 35)
  42248. * Pascal objects, static members display: Print Settings. (line 570)
  42249. * Pascal support in GDB, limitations: Pascal. (line 6)
  42250. * pass signals to inferior, remote request: General Query Packets.
  42251. (line 440)
  42252. * patching binaries: Patching. (line 6)
  42253. * patching object files: Files. (line 26)
  42254. * pause current task (GNU Hurd): Hurd Native. (line 48)
  42255. * pause current thread (GNU Hurd): Hurd Native. (line 90)
  42256. * pauses in output: Screen Size. (line 6)
  42257. * pending breakpoints: Set Breaks. (line 245)
  42258. * physical address from linear address: DJGPP Native. (line 80)
  42259. * physname: Debugging Output. (line 41)
  42260. * pipe, target remote to: Connecting. (line 234)
  42261. * pipes: Starting. (line 64)
  42262. * pointer values, in file-i/o protocol: Pointer Values. (line 6)
  42263. * pointer, finding referent: Print Settings. (line 80)
  42264. * port rights, GNU Hurd: Hurd Native. (line 84)
  42265. * port sets, GNU Hurd: Hurd Native. (line 84)
  42266. * PowerPC architecture: PowerPC. (line 6)
  42267. * prefix for data files: Data Files. (line 6)
  42268. * prefix for executable and shared library file names: Files.
  42269. (line 386)
  42270. * premature return from system calls: Interrupted System Calls.
  42271. (line 6)
  42272. * preprocessor macro expansion, showing the results of: Macros.
  42273. (line 29)
  42274. * pretty print arrays: Print Settings. (line 115)
  42275. * pretty print C++ virtual function tables: Print Settings. (line 581)
  42276. * pretty-printer commands: Pretty-Printer Commands.
  42277. (line 6)
  42278. * print all frame argument values: Print Settings. (line 154)
  42279. * print an Objective-C object description: The Print Command with Objective-C.
  42280. (line 11)
  42281. * print array indexes: Print Settings. (line 125)
  42282. * print frame argument values for scalars only: Print Settings.
  42283. (line 154)
  42284. * print list of auto-loaded canned sequences of commands scripts: Auto-loading sequences.
  42285. (line 21)
  42286. * print list of auto-loaded Guile scripts: Guile Auto-loading.
  42287. (line 23)
  42288. * print list of auto-loaded Python scripts: Python Auto-loading.
  42289. (line 23)
  42290. * print messages on inferior start and exit: Inferiors Connections and Programs.
  42291. (line 167)
  42292. * print messages on thread start and exit: Threads. (line 272)
  42293. * print messages when symbols are loaded: Symbols. (line 600)
  42294. * print settings: Print Settings. (line 6)
  42295. * print structures in indented form: Print Settings. (line 417)
  42296. * print/don't print memory addresses: Print Settings. (line 13)
  42297. * printing byte arrays: Output Formats. (line 60)
  42298. * printing data: Data. (line 6)
  42299. * printing frame argument values: Print Settings. (line 154)
  42300. * printing frame information: Print Settings. (line 314)
  42301. * printing nested structures: Print Settings. (line 362)
  42302. * printing strings: Output Formats. (line 60)
  42303. * probe static tracepoint marker: Create and Delete Tracepoints.
  42304. (line 75)
  42305. * probing markers, static tracepoints: Set Tracepoints. (line 28)
  42306. * process detailed status information: Process Information.
  42307. (line 89)
  42308. * process ID: Process Information.
  42309. (line 25)
  42310. * process info via /proc: Process Information.
  42311. (line 6)
  42312. * process list, QNX Neutrino: Process Information.
  42313. (line 127)
  42314. * process record and replay: Process Record and Replay.
  42315. (line 6)
  42316. * process status register: Registers. (line 31)
  42317. * processes, multiple: Forks. (line 6)
  42318. * procfs API calls: Process Information.
  42319. (line 106)
  42320. * profiling GDB: Maintenance Commands.
  42321. (line 452)
  42322. * program counter register: Registers. (line 31)
  42323. * program entry point: Backtrace. (line 155)
  42324. * programming in guile: Guile API. (line 6)
  42325. * programming in python: Python API. (line 6)
  42326. * progspaces in guile: Progspaces In Guile.
  42327. (line 6)
  42328. * progspaces in python: Progspaces In Python.
  42329. (line 6)
  42330. * prompt: Prompt. (line 6)
  42331. * protocol basics, file-i/o: Protocol Basics. (line 6)
  42332. * protocol, GDB remote serial: Overview. (line 14)
  42333. * protocol-specific representation of datatypes, in file-i/o protocol: Protocol-specific Representation of Datatypes.
  42334. (line 6)
  42335. * python api: Python API. (line 6)
  42336. * Python architectures: Architectures In Python.
  42337. (line 6)
  42338. * Python auto-loading: Python Auto-loading.
  42339. (line 6)
  42340. * python commands: Python Commands. (line 6)
  42341. * python commands <1>: Commands In Python. (line 6)
  42342. * python convenience functions: Functions In Python.
  42343. (line 6)
  42344. * python directory: Python. (line 12)
  42345. * python exceptions: Exception Handling. (line 6)
  42346. * python finish breakpoints: Finish Breakpoints in Python.
  42347. (line 6)
  42348. * python functions: Basic Python. (line 28)
  42349. * python module: Basic Python. (line 28)
  42350. * python modules: Python modules. (line 6)
  42351. * python pagination: Basic Python. (line 6)
  42352. * python parameters: Parameters In Python.
  42353. (line 6)
  42354. * python pretty printing api: Pretty Printing API.
  42355. (line 6)
  42356. * python scripting: Python. (line 6)
  42357. * python stdout: Basic Python. (line 6)
  42358. * Python TUI Windows: TUI Windows In Python.
  42359. (line 6)
  42360. * Python, working with types: Types In Python. (line 6)
  42361. * python, working with values from inferior: Values From Inferior.
  42362. (line 6)
  42363. * q packet: Packets. (line 296)
  42364. * Q packet: Packets. (line 296)
  42365. * QAllow packet: General Query Packets.
  42366. (line 44)
  42367. * qAttached packet: General Query Packets.
  42368. (line 1381)
  42369. * qC packet: General Query Packets.
  42370. (line 55)
  42371. * QCatchSyscalls packet: General Query Packets.
  42372. (line 401)
  42373. * qCRC packet: General Query Packets.
  42374. (line 65)
  42375. * QDisableRandomization packet: General Query Packets.
  42376. (line 84)
  42377. * QEnvironmentHexEncoded packet: General Query Packets.
  42378. (line 144)
  42379. * QEnvironmentReset packet: General Query Packets.
  42380. (line 197)
  42381. * QEnvironmentUnset packet: General Query Packets.
  42382. (line 173)
  42383. * qfThreadInfo packet: General Query Packets.
  42384. (line 238)
  42385. * qGetTIBAddr packet: General Query Packets.
  42386. (line 303)
  42387. * qGetTLSAddr packet: General Query Packets.
  42388. (line 271)
  42389. * QNonStop packet: General Query Packets.
  42390. (line 379)
  42391. * qOffsets packet: General Query Packets.
  42392. (line 342)
  42393. * qP packet: General Query Packets.
  42394. (line 369)
  42395. * QPassSignals packet: General Query Packets.
  42396. (line 440)
  42397. * QProgramSignals packet: General Query Packets.
  42398. (line 469)
  42399. * qRcmd packet: General Query Packets.
  42400. (line 536)
  42401. * qSearch memory packet: General Query Packets.
  42402. (line 558)
  42403. * QSetWorkingDir packet: General Query Packets.
  42404. (line 219)
  42405. * QStartNoAckMode packet: General Query Packets.
  42406. (line 575)
  42407. * QStartupWithShell packet: General Query Packets.
  42408. (line 114)
  42409. * qsThreadInfo packet: General Query Packets.
  42410. (line 238)
  42411. * qSupported packet: General Query Packets.
  42412. (line 589)
  42413. * qSymbol packet: General Query Packets.
  42414. (line 1033)
  42415. * qTBuffer packet: Tracepoint Packets. (line 393)
  42416. * QTBuffer size packet: Tracepoint Packets. (line 406)
  42417. * QTDisable packet: Tracepoint Packets. (line 209)
  42418. * QTDisconnected packet: Tracepoint Packets. (line 228)
  42419. * QTDP packet: Tracepoint Packets. (line 10)
  42420. * QTDPsrc packet: Tracepoint Packets. (line 90)
  42421. * QTDV packet: Tracepoint Packets. (line 121)
  42422. * QTEnable packet: Tracepoint Packets. (line 204)
  42423. * qTfP packet: Tracepoint Packets. (line 335)
  42424. * QTFrame packet: Tracepoint Packets. (line 133)
  42425. * qTfSTM packet: Tracepoint Packets. (line 352)
  42426. * qTfV packet: Tracepoint Packets. (line 343)
  42427. * QThreadEvents packet: General Query Packets.
  42428. (line 509)
  42429. * qThreadExtraInfo packet: General Query Packets.
  42430. (line 1076)
  42431. * QTinit packet: Tracepoint Packets. (line 214)
  42432. * qTMinFTPILen packet: Tracepoint Packets. (line 171)
  42433. * QTNotes packet: Tracepoint Packets. (line 411)
  42434. * qTP packet: Tracepoint Packets. (line 307)
  42435. * QTro packet: Tracepoint Packets. (line 217)
  42436. * QTSave packet: Tracepoint Packets. (line 387)
  42437. * qTsP packet: Tracepoint Packets. (line 336)
  42438. * qTsSTM packet: Tracepoint Packets. (line 352)
  42439. * QTStart packet: Tracepoint Packets. (line 195)
  42440. * qTStatus packet: Tracepoint Packets. (line 234)
  42441. * qTSTMat packet: Tracepoint Packets. (line 381)
  42442. * QTStop packet: Tracepoint Packets. (line 201)
  42443. * qTsV packet: Tracepoint Packets. (line 344)
  42444. * qTV packet: Tracepoint Packets. (line 318)
  42445. * qualified thread ID: Threads. (line 52)
  42446. * query attached, remote request: General Query Packets.
  42447. (line 1381)
  42448. * quotes in commands: Completion. (line 83)
  42449. * quoting Ada internal identifiers: Additions to Ada. (line 76)
  42450. * quoting names: Symbols. (line 14)
  42451. * qXfer packet: General Query Packets.
  42452. (line 1113)
  42453. * r packet: Packets. (line 300)
  42454. * R packet: Packets. (line 305)
  42455. * range checking: Type Checking. (line 45)
  42456. * range stepping: Continuing and Stepping.
  42457. (line 217)
  42458. * ranged breakpoint: PowerPC Embedded. (line 33)
  42459. * ranges of breakpoints: Breakpoints. (line 45)
  42460. * Ravenscar Profile: Ravenscar Profile. (line 6)
  42461. * Ravenscar thread: Ravenscar Profile. (line 26)
  42462. * raw printing: Output Formats. (line 75)
  42463. * read special object, remote request: General Query Packets.
  42464. (line 1113)
  42465. * read, file-i/o system call: read. (line 6)
  42466. * read-only sections: Files. (line 265)
  42467. * reading symbols from relocatable object files: Files. (line 146)
  42468. * reading symbols immediately: Files. (line 94)
  42469. * readline: Editing. (line 6)
  42470. * Readline application name: Editing. (line 29)
  42471. * receive rights, GNU Hurd: Hurd Native. (line 84)
  42472. * recent tracepoint number: Create and Delete Tracepoints.
  42473. (line 122)
  42474. * record aggregates (Ada): Omissions from Ada. (line 44)
  42475. * record mode: Process Record and Replay.
  42476. (line 19)
  42477. * record serial communications on file: Remote Configuration.
  42478. (line 64)
  42479. * recording a session script: Bug Reporting. (line 93)
  42480. * recording inferior's execution and replaying it: Process Record and Replay.
  42481. (line 6)
  42482. * recordings in python: Recordings In Python.
  42483. (line 6)
  42484. * redirection: Input/Output. (line 6)
  42485. * reference card: Formatting Documentation.
  42486. (line 6)
  42487. * reference declarations: C Plus Plus Expressions.
  42488. (line 50)
  42489. * register packet format, MIPS: MIPS Register packet Format.
  42490. (line 6)
  42491. * registers: Registers. (line 6)
  42492. * Registers In Python: Registers In Python.
  42493. (line 6)
  42494. * regular expression: Set Breaks. (line 90)
  42495. * reloading the overlay table: Overlay Commands. (line 52)
  42496. * relocatable object files, reading symbols from: Files. (line 146)
  42497. * remote async notification debugging info: Debugging Output.
  42498. (line 136)
  42499. * remote connection commands: Connecting. (line 127)
  42500. * remote connection without stubs: Server. (line 6)
  42501. * remote debugging: Remote Debugging. (line 6)
  42502. * remote debugging, connecting: Connecting. (line 6)
  42503. * remote debugging, detach and program exit: Connecting. (line 19)
  42504. * remote debugging, symbol files: Connecting. (line 97)
  42505. * remote debugging, types of connections: Connecting. (line 6)
  42506. * remote memory comparison: Memory. (line 142)
  42507. * remote packets, enabling and disabling: Remote Configuration.
  42508. (line 159)
  42509. * remote programs, interrupting: Connecting. (line 246)
  42510. * remote protocol debugging: Debugging Output. (line 159)
  42511. * remote protocol, binary data: Overview. (line 63)
  42512. * remote protocol, field separator: Overview. (line 55)
  42513. * remote query requests: General Query Packets.
  42514. (line 6)
  42515. * remote serial debugging summary: Debug Session. (line 6)
  42516. * remote serial debugging, overview: Remote Stub. (line 14)
  42517. * remote serial protocol: Overview. (line 14)
  42518. * remote serial stub: Stub Contents. (line 6)
  42519. * remote serial stub list: Remote Stub. (line 53)
  42520. * remote serial stub, initialization: Stub Contents. (line 10)
  42521. * remote serial stub, main routine: Stub Contents. (line 15)
  42522. * remote stub, example: Remote Stub. (line 6)
  42523. * remote stub, support routines: Bootstrapping. (line 6)
  42524. * remote target: Target Commands. (line 58)
  42525. * remote target, file transfer: File Transfer. (line 6)
  42526. * remote target, limit break- and watchpoints: Remote Configuration.
  42527. (line 79)
  42528. * remote target, limit watchpoints length: Remote Configuration.
  42529. (line 91)
  42530. * remote timeout: Remote Configuration.
  42531. (line 72)
  42532. * remove actions from a tracepoint: Tracepoint Actions. (line 21)
  42533. * remove duplicate history: Command History. (line 69)
  42534. * rename, file-i/o system call: rename. (line 6)
  42535. * Renesas: Remote Stub. (line 62)
  42536. * repeated array elements: Print Settings. (line 348)
  42537. * repeating command sequences: Command Syntax. (line 41)
  42538. * repeating commands: Command Syntax. (line 21)
  42539. * replay log events, remote reply: Stop Reply Packets. (line 70)
  42540. * replay mode: Process Record and Replay.
  42541. (line 10)
  42542. * reporting bugs in GDB: GDB Bugs. (line 6)
  42543. * reprint the last value: Data. (line 112)
  42544. * reprint the last value <1>: Compiling and Injecting Code.
  42545. (line 74)
  42546. * reset environment, remote request: General Query Packets.
  42547. (line 197)
  42548. * resources used by commands: Maintenance Commands.
  42549. (line 523)
  42550. * response time, MIPS debugging: MIPS. (line 10)
  42551. * restart: Checkpoint/Restart. (line 6)
  42552. * restore data from a file: Dump/Restore Files. (line 6)
  42553. * restrictions on Go expressions: Go. (line 35)
  42554. * result records in GDB/MI: GDB/MI Result Records.
  42555. (line 6)
  42556. * resume threads of multiple processes simultaneously: All-Stop Mode.
  42557. (line 54)
  42558. * resuming execution: Continuing and Stepping.
  42559. (line 6)
  42560. * returning from a function: Returning. (line 6)
  42561. * reverse execution: Reverse Execution. (line 6)
  42562. * rewind program state: Checkpoint/Restart. (line 6)
  42563. * run to first instruction: Starting. (line 114)
  42564. * run to main procedure: Starting. (line 81)
  42565. * run until specified location: Continuing and Stepping.
  42566. (line 124)
  42567. * running: Starting. (line 6)
  42568. * running programs backward: Reverse Execution. (line 6)
  42569. * s packet: Packets. (line 312)
  42570. * S packet: Packets. (line 321)
  42571. * S12Z support: S12Z. (line 6)
  42572. * save breakpoints to a file for future sessions: Save Breakpoints.
  42573. (line 9)
  42574. * save command history: Command History. (line 44)
  42575. * save GDB output to a file: Logging Output. (line 6)
  42576. * save tracepoints for future sessions: save tracepoints. (line 6)
  42577. * scheduler locking mode: All-Stop Mode. (line 37)
  42578. * scope: M2 Scope. (line 6)
  42579. * screen size: Screen Size. (line 6)
  42580. * scripting commands: Command Files. (line 6)
  42581. * scripting with guile: Guile. (line 6)
  42582. * scripting with python: Python. (line 6)
  42583. * search for a thread: Threads. (line 258)
  42584. * search path for libthread_db: Threads. (line 293)
  42585. * searching memory: Searching Memory. (line 6)
  42586. * searching memory, in remote debugging: General Query Packets.
  42587. (line 558)
  42588. * searching source files: Search. (line 6)
  42589. * section offsets, remote request: General Query Packets.
  42590. (line 342)
  42591. * segment descriptor tables: DJGPP Native. (line 24)
  42592. * select Ctrl-C, BREAK or BREAK-g: Remote Configuration.
  42593. (line 108)
  42594. * select trace snapshot: tfind. (line 6)
  42595. * selected frame: Stack. (line 19)
  42596. * selecting guile pretty-printers: Selecting Guile Pretty-Printers.
  42597. (line 6)
  42598. * selecting python pretty-printers: Selecting Pretty-Printers.
  42599. (line 6)
  42600. * self tests: Maintenance Commands.
  42601. (line 374)
  42602. * self tests <1>: Maintenance Commands.
  42603. (line 380)
  42604. * semaphores on static probe points: Static Probe Points.
  42605. (line 20)
  42606. * send command to remote monitor: Connecting. (line 279)
  42607. * send command to simulator: Embedded Processors.
  42608. (line 9)
  42609. * send interrupt-sequence on start: Remote Configuration.
  42610. (line 121)
  42611. * send rights, GNU Hurd: Hurd Native. (line 84)
  42612. * send the output of a gdb command to a shell command: Shell Commands.
  42613. (line 26)
  42614. * sending files to remote systems: File Transfer. (line 6)
  42615. * separate debug sections: MiniDebugInfo. (line 6)
  42616. * separate debugging information files: Separate Debug Files.
  42617. (line 6)
  42618. * sequence-id, for GDB remote: Overview. (line 30)
  42619. * serial connections, debugging: Debugging Output. (line 159)
  42620. * serial line, target remote: Connecting. (line 136)
  42621. * serial protocol, GDB remote: Overview. (line 14)
  42622. * server prefix: Server Prefix. (line 6)
  42623. * server, command prefix: Command History. (line 20)
  42624. * set ABI for MIPS: MIPS. (line 32)
  42625. * set breakpoints in many functions: Set Breaks. (line 90)
  42626. * set breakpoints on all functions: Set Breaks. (line 117)
  42627. * set environment variable, remote request: General Query Packets.
  42628. (line 144)
  42629. * set exec-file-mismatch: Attach. (line 34)
  42630. * set fast tracepoint: Create and Delete Tracepoints.
  42631. (line 50)
  42632. * set inferior controlling terminal: Input/Output. (line 44)
  42633. * set static tracepoint: Create and Delete Tracepoints.
  42634. (line 75)
  42635. * set tdesc filename: Retrieving Descriptions.
  42636. (line 18)
  42637. * set tracepoint: Create and Delete Tracepoints.
  42638. (line 6)
  42639. * set working directory, remote request: General Query Packets.
  42640. (line 219)
  42641. * setting variables: Assignment. (line 6)
  42642. * setting watchpoints: Set Watchpoints. (line 6)
  42643. * settings: Command Settings. (line 39)
  42644. * SH: Remote Stub. (line 62)
  42645. * sh-stub.c: Remote Stub. (line 62)
  42646. * shared libraries: Files. (line 287)
  42647. * shared library events, remote reply: Stop Reply Packets. (line 65)
  42648. * shell command, exit code: Convenience Vars. (line 188)
  42649. * shell command, exit signal: Convenience Vars. (line 188)
  42650. * shell escape: Shell Commands. (line 10)
  42651. * show all convenience functions: Convenience Funs. (line 228)
  42652. * show all user variables and functions: Convenience Vars. (line 37)
  42653. * show exec-file-mismatch: Attach. (line 44)
  42654. * show inferior's working directory: Working Directory. (line 27)
  42655. * show last commands: Command History. (line 110)
  42656. * show tdesc filename: Retrieving Descriptions.
  42657. (line 25)
  42658. * signals: Signals. (line 6)
  42659. * signals the inferior may see, remote request: General Query Packets.
  42660. (line 469)
  42661. * SIGQUIT signal, dump core of GDB: Maintenance Commands.
  42662. (line 169)
  42663. * SingleKey keymap name: TUI Single Key Mode.
  42664. (line 53)
  42665. * size of remote memory accesses: Packets. (line 247)
  42666. * size of screen: Screen Size. (line 6)
  42667. * skipping over files via glob-style patterns: Skipping Over Functions and Files.
  42668. (line 55)
  42669. * skipping over functions and files: Skipping Over Functions and Files.
  42670. (line 6)
  42671. * skipping over functions via regular expressions: Skipping Over Functions and Files.
  42672. (line 68)
  42673. * snapshot of a process: Checkpoint/Restart. (line 6)
  42674. * software watchpoints: Set Watchpoints. (line 31)
  42675. * source file and line of a symbol: Print Settings. (line 50)
  42676. * source line and its code address: Machine Code. (line 6)
  42677. * source location: Specify Location. (line 6)
  42678. * source path: Source Path. (line 6)
  42679. * Sparc: Remote Stub. (line 65)
  42680. * sparc-stub.c: Remote Stub. (line 65)
  42681. * Sparc64 support: Sparc64. (line 6)
  42682. * sparcl-stub.c: Remote Stub. (line 68)
  42683. * SparcLite: Remote Stub. (line 68)
  42684. * Special Fortran commands: Special Fortran Commands.
  42685. (line 6)
  42686. * specifying location: Specify Location. (line 6)
  42687. * SSE registers (x86): Registers. (line 76)
  42688. * stack frame: Frames. (line 6)
  42689. * stack on Alpha: MIPS. (line 6)
  42690. * stack on MIPS: MIPS. (line 6)
  42691. * stack pointer register: Registers. (line 31)
  42692. * stacking targets: Active Targets. (line 6)
  42693. * standard registers: Registers. (line 31)
  42694. * start a new independent interpreter: Interpreters. (line 52)
  42695. * start a new trace experiment: Starting and Stopping Trace Experiments.
  42696. (line 6)
  42697. * starting: Starting. (line 6)
  42698. * startup code, and backtrace: Backtrace. (line 155)
  42699. * startup with shell, remote request: General Query Packets.
  42700. (line 114)
  42701. * stat, file-i/o system call: stat/fstat. (line 6)
  42702. * static members of C++ objects: Print Settings. (line 559)
  42703. * static members of Pascal objects: Print Settings. (line 570)
  42704. * static probe point, DTrace: Static Probe Points.
  42705. (line 6)
  42706. * static probe point, SystemTap: Static Probe Points.
  42707. (line 6)
  42708. * static tracepoints: Set Tracepoints. (line 28)
  42709. * static tracepoints, in remote protocol: General Query Packets.
  42710. (line 961)
  42711. * static tracepoints, setting: Create and Delete Tracepoints.
  42712. (line 75)
  42713. * status of trace data collection: Starting and Stopping Trace Experiments.
  42714. (line 27)
  42715. * status output in GDB/MI: GDB/MI Output Syntax.
  42716. (line 94)
  42717. * stepping: Continuing and Stepping.
  42718. (line 6)
  42719. * stepping and signal handlers: Signals. (line 106)
  42720. * stepping into functions with no line info: Continuing and Stepping.
  42721. (line 92)
  42722. * stop a running trace experiment: Starting and Stopping Trace Experiments.
  42723. (line 16)
  42724. * stop on C++ exceptions: Set Catchpoints. (line 16)
  42725. * stop reply packets: Stop Reply Packets. (line 6)
  42726. * stopped threads: Thread Stops. (line 6)
  42727. * stream records in GDB/MI: GDB/MI Stream Records.
  42728. (line 6)
  42729. * string tracing, in remote protocol: General Query Packets.
  42730. (line 978)
  42731. * struct gdb_reader_funcs: Writing JIT Debug Info Readers.
  42732. (line 22)
  42733. * struct gdb_symbol_callbacks: Writing JIT Debug Info Readers.
  42734. (line 43)
  42735. * struct gdb_unwind_callbacks: Writing JIT Debug Info Readers.
  42736. (line 43)
  42737. * struct return convention: i386. (line 7)
  42738. * struct stat, in file-i/o protocol: struct stat. (line 6)
  42739. * struct timeval, in file-i/o protocol: struct timeval. (line 6)
  42740. * struct/union returned in registers: i386. (line 7)
  42741. * structure field name completion: Completion. (line 135)
  42742. * stub example, remote debugging: Remote Stub. (line 6)
  42743. * stupid questions: Messages/Warnings. (line 49)
  42744. * styling: Output Styling. (line 6)
  42745. * Super-H: Super-H. (line 6)
  42746. * supported GDB/MI features, list: GDB/MI Support Commands.
  42747. (line 57)
  42748. * supported packets, remote query: General Query Packets.
  42749. (line 589)
  42750. * switching threads: Threads. (line 6)
  42751. * switching threads automatically: All-Stop Mode. (line 28)
  42752. * symbol cache size: Symbols. (line 698)
  42753. * symbol cache, flushing: Symbols. (line 714)
  42754. * symbol cache, printing its contents: Symbols. (line 706)
  42755. * symbol cache, printing usage statistics: Symbols. (line 710)
  42756. * symbol decoding style, C++: Print Settings. (line 529)
  42757. * symbol dump: Symbols. (line 619)
  42758. * symbol file functions: Debugging Output. (line 205)
  42759. * symbol files, remote debugging: Connecting. (line 97)
  42760. * symbol from address: Symbols. (line 95)
  42761. * symbol lookup: Debugging Output. (line 198)
  42762. * symbol lookup, remote request: General Query Packets.
  42763. (line 1033)
  42764. * symbol names: Symbols. (line 14)
  42765. * symbol table: Files. (line 6)
  42766. * symbol table creation: Debugging Output. (line 210)
  42767. * symbol tables in guile: Symbol Tables In Guile.
  42768. (line 6)
  42769. * symbol tables in python: Symbol Tables In Python.
  42770. (line 6)
  42771. * symbol tables, listing GDB's internal: Symbols. (line 645)
  42772. * symbol, source file and line: Print Settings. (line 50)
  42773. * symbols in guile: Symbols In Guile. (line 6)
  42774. * symbols in python: Symbols In Python. (line 6)
  42775. * symbols, never read: Files. (line 101)
  42776. * symbols, reading from relocatable object files: Files. (line 146)
  42777. * symbols, reading immediately: Files. (line 94)
  42778. * Synopsys ARC: ARC. (line 6)
  42779. * syscall DSO: Files. (line 193)
  42780. * system calls and thread breakpoints: Interrupted System Calls.
  42781. (line 6)
  42782. * system root, alternate: Files. (line 386)
  42783. * system, file-i/o system call: system. (line 6)
  42784. * system-wide configuration scripts: System-wide Configuration Scripts.
  42785. (line 6)
  42786. * system-wide init file: System-wide configuration.
  42787. (line 6)
  42788. * t packet: Packets. (line 331)
  42789. * T packet: Packets. (line 336)
  42790. * T packet reply: Stop Reply Packets. (line 26)
  42791. * tail call frames, debugging: Tail Call Frames. (line 6)
  42792. * target architecture: Targets. (line 17)
  42793. * target byte order: Byte Order. (line 6)
  42794. * target character set: Character Sets. (line 6)
  42795. * target debugging info: Debugging Output. (line 217)
  42796. * target descriptions: Target Descriptions.
  42797. (line 6)
  42798. * target descriptions, AArch64 features: AArch64 Features. (line 6)
  42799. * target descriptions, ARC Features: ARC Features. (line 6)
  42800. * target descriptions, ARM features: ARM Features. (line 6)
  42801. * target descriptions, enum types: Enum Target Types. (line 6)
  42802. * target descriptions, i386 features: i386 Features. (line 6)
  42803. * target descriptions, inclusion: Target Description Format.
  42804. (line 53)
  42805. * target descriptions, M68K features: M68K Features. (line 6)
  42806. * target descriptions, MicroBlaze features: MicroBlaze Features.
  42807. (line 6)
  42808. * target descriptions, MIPS features: MIPS Features. (line 6)
  42809. * target descriptions, NDS32 features: NDS32 Features. (line 6)
  42810. * target descriptions, Nios II features: Nios II Features. (line 6)
  42811. * target descriptions, OpenRISC 1000 features: OpenRISC 1000 Features.
  42812. (line 6)
  42813. * target descriptions, PowerPC features: PowerPC Features. (line 6)
  42814. * target descriptions, predefined types: Predefined Target Types.
  42815. (line 6)
  42816. * target descriptions, RISC-V Features: RISC-V Features. (line 6)
  42817. * target descriptions, RX Features: RX Features. (line 6)
  42818. * target descriptions, S/390 features: S/390 and System z Features.
  42819. (line 6)
  42820. * target descriptions, sparc32 features: Sparc Features. (line 6)
  42821. * target descriptions, sparc64 features: Sparc Features. (line 6)
  42822. * target descriptions, standard features: Standard Target Features.
  42823. (line 6)
  42824. * target descriptions, System z features: S/390 and System z Features.
  42825. (line 6)
  42826. * target descriptions, TIC6x features: TIC6x Features. (line 6)
  42827. * target descriptions, TMS320C6x features: TIC6x Features. (line 6)
  42828. * target descriptions, XML format: Target Description Format.
  42829. (line 6)
  42830. * target memory comparison: Memory. (line 142)
  42831. * target output in GDB/MI: GDB/MI Output Syntax.
  42832. (line 110)
  42833. * target stack description: Maintenance Commands.
  42834. (line 355)
  42835. * target-assisted range stepping: Continuing and Stepping.
  42836. (line 217)
  42837. * task attributes (GNU Hurd): Hurd Native. (line 48)
  42838. * task breakpoints, in Ada: Ada Tasks. (line 135)
  42839. * task exception port, GNU Hurd: Hurd Native. (line 67)
  42840. * task suspend count: Hurd Native. (line 59)
  42841. * task switching with program using Ravenscar Profile: Ravenscar Profile.
  42842. (line 10)
  42843. * TCP port, target remote: Connecting. (line 173)
  42844. * temporarily change settings: Command Settings. (line 39)
  42845. * terminal: Input/Output. (line 6)
  42846. * Text User Interface: TUI. (line 6)
  42847. * thread attributes info, remote request: General Query Packets.
  42848. (line 1076)
  42849. * thread breakpoints: Thread-Specific Breakpoints.
  42850. (line 10)
  42851. * thread breakpoints and system calls: Interrupted System Calls.
  42852. (line 6)
  42853. * thread create event, remote reply: Stop Reply Packets. (line 152)
  42854. * thread create/exit events, remote request: General Query Packets.
  42855. (line 509)
  42856. * thread default settings, GNU Hurd: Hurd Native. (line 130)
  42857. * thread exit event, remote reply: Stop Reply Packets. (line 181)
  42858. * thread ID lists: Threads. (line 65)
  42859. * thread identifier (GDB): Threads. (line 47)
  42860. * thread identifier (system): Threads. (line 35)
  42861. * thread info (Solaris): Threads. (line 167)
  42862. * thread information, remote request: General Query Packets.
  42863. (line 369)
  42864. * thread list format: Thread List Format. (line 6)
  42865. * thread number, per inferior: Threads. (line 47)
  42866. * thread properties, GNU Hurd: Hurd Native. (line 90)
  42867. * thread suspend count, GNU Hurd: Hurd Native. (line 109)
  42868. * THREAD-ID, in remote protocol: Packets. (line 20)
  42869. * threads and watchpoints: Set Watchpoints. (line 179)
  42870. * threads in python: Threads In Python. (line 6)
  42871. * threads of execution: Threads. (line 6)
  42872. * threads, automatic switching: All-Stop Mode. (line 28)
  42873. * threads, continuing: Thread Stops. (line 6)
  42874. * threads, stopped: Thread Stops. (line 6)
  42875. * time of command execution: Maintenance Commands.
  42876. (line 573)
  42877. * timeout for commands: Maintenance Commands.
  42878. (line 624)
  42879. * timeout for serial communications: Remote Configuration.
  42880. (line 72)
  42881. * timeout, for remote target connection: Remote Configuration.
  42882. (line 147)
  42883. * timestamping debugging info: Debugging Output. (line 224)
  42884. * trace experiment, status of: Starting and Stopping Trace Experiments.
  42885. (line 27)
  42886. * trace file format: Trace File Format. (line 6)
  42887. * trace files: Trace Files. (line 6)
  42888. * trace state variable value, remote request: Tracepoint Packets.
  42889. (line 318)
  42890. * trace state variables: Trace State Variables.
  42891. (line 6)
  42892. * traceback: Backtrace. (line 6)
  42893. * traceframe info format: Traceframe Info Format.
  42894. (line 6)
  42895. * tracepoint actions: Tracepoint Actions. (line 6)
  42896. * tracepoint conditions: Tracepoint Conditions.
  42897. (line 6)
  42898. * tracepoint data, display: tdump. (line 6)
  42899. * tracepoint deletion: Create and Delete Tracepoints.
  42900. (line 125)
  42901. * tracepoint number: Create and Delete Tracepoints.
  42902. (line 122)
  42903. * tracepoint packets: Tracepoint Packets. (line 6)
  42904. * tracepoint pass count: Tracepoint Passcounts.
  42905. (line 6)
  42906. * tracepoint restrictions: Tracepoint Restrictions.
  42907. (line 6)
  42908. * tracepoint status, remote request: Tracepoint Packets. (line 307)
  42909. * tracepoint variables: Tracepoint Variables.
  42910. (line 6)
  42911. * tracepoints: Tracepoints. (line 6)
  42912. * tracepoints support in gdbserver: Server. (line 272)
  42913. * trailing underscore, in Fortran symbols: Fortran. (line 9)
  42914. * translating between character sets: Character Sets. (line 6)
  42915. * TUI: TUI. (line 6)
  42916. * TUI commands: TUI Commands. (line 6)
  42917. * TUI configuration variables: TUI Configuration. (line 6)
  42918. * TUI key bindings: TUI Keys. (line 6)
  42919. * TUI single key mode: TUI Single Key Mode.
  42920. (line 6)
  42921. * type casting memory: Expressions. (line 41)
  42922. * type chain of a data type: Maintenance Commands.
  42923. (line 367)
  42924. * type checking: Checks. (line 24)
  42925. * type conversions in C++: C Plus Plus Expressions.
  42926. (line 26)
  42927. * type printer: Type Printing API. (line 9)
  42928. * type printing API for Python: Type Printing API. (line 6)
  42929. * types in guile: Types In Guile. (line 6)
  42930. * types in Python: Types In Python. (line 6)
  42931. * UDP port, target remote: Connecting. (line 222)
  42932. * union field name completion: Completion. (line 135)
  42933. * unions in structures, printing: Print Settings. (line 469)
  42934. * Unix domain socket: Connecting. (line 147)
  42935. * unknown address, locating: Output Formats. (line 35)
  42936. * unknown type: Symbols. (line 363)
  42937. * unlink, file-i/o system call: unlink. (line 6)
  42938. * unlinked object files: Files. (line 26)
  42939. * unload symbols from shared libraries: Files. (line 348)
  42940. * unmap an overlay: Overlay Commands. (line 39)
  42941. * unmapped overlays: How Overlays Work. (line 6)
  42942. * unset environment variable, remote request: General Query Packets.
  42943. (line 173)
  42944. * unset tdesc filename: Retrieving Descriptions.
  42945. (line 21)
  42946. * unsupported languages: Unsupported Languages.
  42947. (line 6)
  42948. * unwind stack in called functions: Calling. (line 36)
  42949. * unwind stack in called functions with unhandled exceptions: Calling.
  42950. (line 47)
  42951. * unwinding frames in Python: Unwinding Frames in Python.
  42952. (line 6)
  42953. * use only software watchpoints: Set Watchpoints. (line 108)
  42954. * user registers: Maintenance Commands.
  42955. (line 326)
  42956. * user-defined command: Define. (line 6)
  42957. * user-defined macros: Macros. (line 59)
  42958. * user-defined variables: Convenience Vars. (line 6)
  42959. * value history: Value History. (line 6)
  42960. * values from inferior, in guile: Values From Inferior In Guile.
  42961. (line 6)
  42962. * values from inferior, with Python: Values From Inferior.
  42963. (line 6)
  42964. * variable name conflict: Variables. (line 36)
  42965. * variable object debugging info: Debugging Output. (line 231)
  42966. * variable objects in GDB/MI: GDB/MI Variable Objects.
  42967. (line 9)
  42968. * variable values, wrong: Variables. (line 106)
  42969. * variables, readline: Readline Init File Syntax.
  42970. (line 34)
  42971. * variables, setting: Assignment. (line 16)
  42972. * vAttach packet: Packets. (line 350)
  42973. * vCont packet: Packets. (line 368)
  42974. * vCont? packet: Packets. (line 435)
  42975. * vCtrlC packet: Packets. (line 445)
  42976. * vector unit: Vector Unit. (line 6)
  42977. * vector, auxiliary: OS Information. (line 9)
  42978. * verbose operation: Messages/Warnings. (line 6)
  42979. * verify remote memory image: Memory. (line 142)
  42980. * verify target memory image: Memory. (line 142)
  42981. * vFile packet: Packets. (line 459)
  42982. * vFlashDone packet: Packets. (line 498)
  42983. * vFlashErase packet: Packets. (line 463)
  42984. * vFlashWrite packet: Packets. (line 478)
  42985. * vfork events, remote reply: Stop Reply Packets. (line 116)
  42986. * vforkdone events, remote reply: Stop Reply Packets. (line 128)
  42987. * virtual functions (C++) display: Print Settings. (line 581)
  42988. * vKill packet: Packets. (line 505)
  42989. * vMustReplyEmpty packet: Packets. (line 517)
  42990. * volatile registers: Registers. (line 106)
  42991. * vRun packet: Packets. (line 529)
  42992. * vStopped packet: Packets. (line 544)
  42993. * VTBL display: Print Settings. (line 581)
  42994. * watchdog timer: Maintenance Commands.
  42995. (line 624)
  42996. * watchpoints: Breakpoints. (line 17)
  42997. * watchpoints and threads: Set Watchpoints. (line 179)
  42998. * where to look for shared libraries: Files. (line 381)
  42999. * wild pointer, interpreting: Print Settings. (line 80)
  43000. * Wind River Linux system-wide configuration script: System-wide Configuration Scripts.
  43001. (line 22)
  43002. * word completion: Completion. (line 6)
  43003. * working directory: Source Path. (line 40)
  43004. * working directory (of your program): Working Directory. (line 6)
  43005. * working language: Languages. (line 13)
  43006. * write data into object, remote request: General Query Packets.
  43007. (line 1338)
  43008. * write, file-i/o system call: write. (line 6)
  43009. * writing a frame filter: Writing a Frame Filter.
  43010. (line 6)
  43011. * writing a Guile pretty-printer: Writing a Guile Pretty-Printer.
  43012. (line 6)
  43013. * writing a pretty-printer: Writing a Pretty-Printer.
  43014. (line 6)
  43015. * writing convenience functions: Functions In Python.
  43016. (line 6)
  43017. * writing into corefiles: Patching. (line 6)
  43018. * writing into executables: Patching. (line 6)
  43019. * writing into executables <1>: Compiling and Injecting Code.
  43020. (line 6)
  43021. * writing JIT debug info readers: Writing JIT Debug Info Readers.
  43022. (line 6)
  43023. * writing xmethods in Python: Writing an Xmethod. (line 6)
  43024. * wrong values: Variables. (line 106)
  43025. * x command, default address: Machine Code. (line 34)
  43026. * X packet: Packets. (line 547)
  43027. * Xilinx MicroBlaze: MicroBlaze. (line 6)
  43028. * XInclude: Target Description Format.
  43029. (line 53)
  43030. * XMD, Xilinx Microprocessor Debugger: MicroBlaze. (line 6)
  43031. * xmethod API: Xmethod API. (line 6)
  43032. * xmethods in Python: Xmethods In Python. (line 6)
  43033. * XML parser debugging: Debugging Output. (line 237)
  43034. * yanking text: Readline Killing Commands.
  43035. (line 6)
  43036. * z packet: Packets. (line 560)
  43037. * Z packets: Packets. (line 560)
  43038. * z0 packet: Packets. (line 575)
  43039. * Z0 packet: Packets. (line 575)
  43040. * z1 packet: Packets. (line 630)
  43041. * Z1 packet: Packets. (line 630)
  43042. * z2 packet: Packets. (line 651)
  43043. * Z2 packet: Packets. (line 651)
  43044. * z3 packet: Packets. (line 664)
  43045. * Z3 packet: Packets. (line 664)
  43046. * z4 packet: Packets. (line 677)
  43047. * Z4 packet: Packets. (line 677)
  43048. 
  43049. File: gdb.info, Node: Command and Variable Index, Prev: Concept Index, Up: Top
  43050. Command, Variable, and Function Index
  43051. *************************************
  43052. �[index�]
  43053. * Menu:
  43054. * !: Shell Commands. (line 10)
  43055. * # (a comment): Command Syntax. (line 37)
  43056. * $bpnum, convenience variable: Set Breaks. (line 6)
  43057. * $cdir, convenience variable: Source Path. (line 40)
  43058. * $cwd, convenience variable: Source Path. (line 40)
  43059. * $tpnum: Create and Delete Tracepoints.
  43060. (line 122)
  43061. * $tracepoint: Tracepoint Variables.
  43062. (line 10)
  43063. * $trace_file: Tracepoint Variables.
  43064. (line 16)
  43065. * $trace_frame: Tracepoint Variables.
  43066. (line 6)
  43067. * $trace_func: Tracepoint Variables.
  43068. (line 19)
  43069. * $trace_line: Tracepoint Variables.
  43070. (line 13)
  43071. * $_, convenience variable: Convenience Vars. (line 65)
  43072. * $_ada_exception, convenience variable: Set Catchpoints. (line 82)
  43073. * $_any_caller_is, convenience function: Convenience Funs. (line 182)
  43074. * $_any_caller_matches, convenience function: Convenience Funs.
  43075. (line 194)
  43076. * $_as_string, convenience function: Convenience Funs. (line 206)
  43077. * $_caller_is, convenience function: Convenience Funs. (line 152)
  43078. * $_caller_matches, convenience function: Convenience Funs. (line 175)
  43079. * $_cimag, convenience function: Convenience Funs. (line 217)
  43080. * $_creal, convenience function: Convenience Funs. (line 217)
  43081. * $_exception, convenience variable: Set Catchpoints. (line 21)
  43082. * $_exitcode, convenience variable: Convenience Vars. (line 80)
  43083. * $_exitsignal, convenience variable: Convenience Vars. (line 85)
  43084. * $_gdb_maint_setting, convenience function: Convenience Funs.
  43085. (line 129)
  43086. * $_gdb_maint_setting_str, convenience function: Convenience Funs.
  43087. (line 125)
  43088. * $_gdb_major, convenience variable: Convenience Vars. (line 179)
  43089. * $_gdb_minor, convenience variable: Convenience Vars. (line 179)
  43090. * $_gdb_setting, convenience function: Convenience Funs. (line 76)
  43091. * $_gdb_setting_str, convenience function: Convenience Funs. (line 63)
  43092. * $_gthread, convenience variable: Threads. (line 98)
  43093. * $_inferior, convenience variable: Inferiors Connections and Programs.
  43094. (line 90)
  43095. * $_isvoid, convenience function: Convenience Funs. (line 15)
  43096. * $_memeq, convenience function: Convenience Funs. (line 136)
  43097. * $_probe_arg, convenience variable: Static Probe Points. (line 77)
  43098. * $_regex, convenience function: Convenience Funs. (line 140)
  43099. * $_sdata, collect: Tracepoint Actions. (line 86)
  43100. * $_sdata, inspect, convenience variable: Convenience Vars. (line 147)
  43101. * $_shell_exitcode, convenience variable: Convenience Vars. (line 188)
  43102. * $_shell_exitsignal, convenience variable: Convenience Vars. (line 188)
  43103. * $_siginfo, convenience variable: Convenience Vars. (line 153)
  43104. * $_streq, convenience function: Convenience Funs. (line 145)
  43105. * $_strlen, convenience function: Convenience Funs. (line 149)
  43106. * $_thread, convenience variable: Threads. (line 98)
  43107. * $_tlb, convenience variable: Convenience Vars. (line 159)
  43108. * $__, convenience variable: Convenience Vars. (line 74)
  43109. * (make-command: Commands In Guile. (line 15)
  43110. * (make-parameter: Parameters In Guile. (line 22)
  43111. * -ada-task-info: GDB/MI Ada Tasking Commands.
  43112. (line 9)
  43113. * -add-inferior: GDB/MI Miscellaneous Commands.
  43114. (line 295)
  43115. * -break-after: GDB/MI Breakpoint Commands.
  43116. (line 11)
  43117. * -break-commands: GDB/MI Breakpoint Commands.
  43118. (line 56)
  43119. * -break-condition: GDB/MI Breakpoint Commands.
  43120. (line 90)
  43121. * -break-delete: GDB/MI Breakpoint Commands.
  43122. (line 127)
  43123. * -break-disable: GDB/MI Breakpoint Commands.
  43124. (line 161)
  43125. * -break-enable: GDB/MI Breakpoint Commands.
  43126. (line 197)
  43127. * -break-info: GDB/MI Breakpoint Commands.
  43128. (line 232)
  43129. * -break-insert: GDB/MI Breakpoint Commands.
  43130. (line 256)
  43131. * -break-list: GDB/MI Breakpoint Commands.
  43132. (line 427)
  43133. * -break-passcount: GDB/MI Breakpoint Commands.
  43134. (line 499)
  43135. * -break-watch: GDB/MI Breakpoint Commands.
  43136. (line 511)
  43137. * -catch-assert: Ada Exception GDB/MI Catchpoint Commands.
  43138. (line 12)
  43139. * -catch-catch: C++ Exception GDB/MI Catchpoint Commands.
  43140. (line 98)
  43141. * -catch-exception: Ada Exception GDB/MI Catchpoint Commands.
  43142. (line 46)
  43143. * -catch-handlers: Ada Exception GDB/MI Catchpoint Commands.
  43144. (line 91)
  43145. * -catch-load: Shared Library GDB/MI Catchpoint Commands.
  43146. (line 9)
  43147. * -catch-rethrow: C++ Exception GDB/MI Catchpoint Commands.
  43148. (line 56)
  43149. * -catch-throw: C++ Exception GDB/MI Catchpoint Commands.
  43150. (line 13)
  43151. * -catch-unload: Shared Library GDB/MI Catchpoint Commands.
  43152. (line 36)
  43153. * -complete: GDB/MI Miscellaneous Commands.
  43154. (line 436)
  43155. * -data-disassemble: GDB/MI Data Manipulation.
  43156. (line 15)
  43157. * -data-evaluate-expression: GDB/MI Data Manipulation.
  43158. (line 192)
  43159. * -data-list-changed-registers: GDB/MI Data Manipulation.
  43160. (line 230)
  43161. * -data-list-register-names: GDB/MI Data Manipulation.
  43162. (line 266)
  43163. * -data-list-register-values: GDB/MI Data Manipulation.
  43164. (line 306)
  43165. * -data-read-memory: GDB/MI Data Manipulation.
  43166. (line 393)
  43167. * -data-read-memory-bytes: GDB/MI Data Manipulation.
  43168. (line 500)
  43169. * -data-write-memory-bytes: GDB/MI Data Manipulation.
  43170. (line 575)
  43171. * -dprintf-insert: GDB/MI Breakpoint Commands.
  43172. (line 363)
  43173. * -enable-frame-filters: GDB/MI Stack Manipulation.
  43174. (line 9)
  43175. * -enable-pretty-printing: GDB/MI Variable Objects.
  43176. (line 118)
  43177. * -enable-timings: GDB/MI Miscellaneous Commands.
  43178. (line 392)
  43179. * -environment-cd: GDB/MI Program Context.
  43180. (line 33)
  43181. * -environment-directory: GDB/MI Program Context.
  43182. (line 56)
  43183. * -environment-path: GDB/MI Program Context.
  43184. (line 100)
  43185. * -environment-pwd: GDB/MI Program Context.
  43186. (line 141)
  43187. * -exec-arguments: GDB/MI Program Context.
  43188. (line 9)
  43189. * -exec-continue: GDB/MI Program Execution.
  43190. (line 13)
  43191. * -exec-finish: GDB/MI Program Execution.
  43192. (line 53)
  43193. * -exec-interrupt: GDB/MI Program Execution.
  43194. (line 97)
  43195. * -exec-jump: GDB/MI Program Execution.
  43196. (line 147)
  43197. * -exec-next: GDB/MI Program Execution.
  43198. (line 171)
  43199. * -exec-next-instruction: GDB/MI Program Execution.
  43200. (line 202)
  43201. * -exec-return: GDB/MI Program Execution.
  43202. (line 238)
  43203. * -exec-run: GDB/MI Program Execution.
  43204. (line 283)
  43205. * -exec-step: GDB/MI Program Execution.
  43206. (line 353)
  43207. * -exec-step-instruction: GDB/MI Program Execution.
  43208. (line 395)
  43209. * -exec-until: GDB/MI Program Execution.
  43210. (line 436)
  43211. * -file-exec-and-symbols: GDB/MI File Commands.
  43212. (line 12)
  43213. * -file-exec-file: GDB/MI File Commands.
  43214. (line 40)
  43215. * -file-list-exec-source-file: GDB/MI File Commands.
  43216. (line 67)
  43217. * -file-list-exec-source-files: GDB/MI File Commands.
  43218. (line 93)
  43219. * -file-list-shared-libraries: GDB/MI File Commands.
  43220. (line 123)
  43221. * -file-symbol-file: GDB/MI File Commands.
  43222. (line 157)
  43223. * -gdb-exit: GDB/MI Miscellaneous Commands.
  43224. (line 9)
  43225. * -gdb-set: GDB/MI Miscellaneous Commands.
  43226. (line 31)
  43227. * -gdb-show: GDB/MI Miscellaneous Commands.
  43228. (line 54)
  43229. * -gdb-version: GDB/MI Miscellaneous Commands.
  43230. (line 77)
  43231. * -inferior-tty-set: GDB/MI Miscellaneous Commands.
  43232. (line 343)
  43233. * -inferior-tty-show: GDB/MI Miscellaneous Commands.
  43234. (line 366)
  43235. * -info-ada-exceptions: GDB/MI Ada Exceptions Commands.
  43236. (line 9)
  43237. * -info-gdb-mi-command: GDB/MI Support Commands.
  43238. (line 14)
  43239. * -info-os: GDB/MI Miscellaneous Commands.
  43240. (line 221)
  43241. * -interpreter-exec: GDB/MI Miscellaneous Commands.
  43242. (line 317)
  43243. * -list-features: GDB/MI Support Commands.
  43244. (line 57)
  43245. * -list-target-features: GDB/MI Support Commands.
  43246. (line 115)
  43247. * -list-thread-groups: GDB/MI Miscellaneous Commands.
  43248. (line 111)
  43249. * -stack-info-depth: GDB/MI Stack Manipulation.
  43250. (line 51)
  43251. * -stack-info-frame: GDB/MI Stack Manipulation.
  43252. (line 24)
  43253. * -stack-list-arguments: GDB/MI Stack Manipulation.
  43254. (line 89)
  43255. * -stack-list-frames: GDB/MI Stack Manipulation.
  43256. (line 188)
  43257. * -stack-list-locals: GDB/MI Stack Manipulation.
  43258. (line 305)
  43259. * -stack-list-variables: GDB/MI Stack Manipulation.
  43260. (line 351)
  43261. * -stack-select-frame: GDB/MI Stack Manipulation.
  43262. (line 379)
  43263. * -symbol-info-functions: GDB/MI Symbol Query. (line 9)
  43264. * -symbol-info-module-functions: GDB/MI Symbol Query. (line 109)
  43265. * -symbol-info-module-variables: GDB/MI Symbol Query. (line 170)
  43266. * -symbol-info-modules: GDB/MI Symbol Query. (line 241)
  43267. * -symbol-info-types: GDB/MI Symbol Query. (line 295)
  43268. * -symbol-info-variables: GDB/MI Symbol Query. (line 352)
  43269. * -symbol-list-lines: GDB/MI Symbol Query. (line 457)
  43270. * -target-attach: GDB/MI Target Manipulation.
  43271. (line 9)
  43272. * -target-detach: GDB/MI Target Manipulation.
  43273. (line 36)
  43274. * -target-disconnect: GDB/MI Target Manipulation.
  43275. (line 61)
  43276. * -target-download: GDB/MI Target Manipulation.
  43277. (line 85)
  43278. * -target-file-delete: GDB/MI File Transfer Commands.
  43279. (line 57)
  43280. * -target-file-get: GDB/MI File Transfer Commands.
  43281. (line 33)
  43282. * -target-file-put: GDB/MI File Transfer Commands.
  43283. (line 9)
  43284. * -target-flash-erase: GDB/MI Target Manipulation.
  43285. (line 192)
  43286. * -target-select: GDB/MI Target Manipulation.
  43287. (line 212)
  43288. * -thread-info: GDB/MI Thread Commands.
  43289. (line 9)
  43290. * -thread-list-ids: GDB/MI Thread Commands.
  43291. (line 58)
  43292. * -thread-select: GDB/MI Thread Commands.
  43293. (line 86)
  43294. * -trace-define-variable: GDB/MI Tracepoint Commands.
  43295. (line 80)
  43296. * -trace-find: GDB/MI Tracepoint Commands.
  43297. (line 12)
  43298. * -trace-frame-collected: GDB/MI Tracepoint Commands.
  43299. (line 97)
  43300. * -trace-list-variables: GDB/MI Tracepoint Commands.
  43301. (line 204)
  43302. * -trace-save: GDB/MI Tracepoint Commands.
  43303. (line 246)
  43304. * -trace-start: GDB/MI Tracepoint Commands.
  43305. (line 267)
  43306. * -trace-status: GDB/MI Tracepoint Commands.
  43307. (line 283)
  43308. * -trace-stop: GDB/MI Tracepoint Commands.
  43309. (line 354)
  43310. * -var-assign: GDB/MI Variable Objects.
  43311. (line 497)
  43312. * -var-create: GDB/MI Variable Objects.
  43313. (line 136)
  43314. * -var-delete: GDB/MI Variable Objects.
  43315. (line 224)
  43316. * -var-evaluate-expression: GDB/MI Variable Objects.
  43317. (line 476)
  43318. * -var-info-expression: GDB/MI Variable Objects.
  43319. (line 413)
  43320. * -var-info-num-children: GDB/MI Variable Objects.
  43321. (line 278)
  43322. * -var-info-path-expression: GDB/MI Variable Objects.
  43323. (line 438)
  43324. * -var-info-type: GDB/MI Variable Objects.
  43325. (line 400)
  43326. * -var-list-children: GDB/MI Variable Objects.
  43327. (line 294)
  43328. * -var-set-format: GDB/MI Variable Objects.
  43329. (line 237)
  43330. * -var-set-frozen: GDB/MI Variable Objects.
  43331. (line 641)
  43332. * -var-set-update-range: GDB/MI Variable Objects.
  43333. (line 667)
  43334. * -var-set-visualizer: GDB/MI Variable Objects.
  43335. (line 690)
  43336. * -var-show-attributes: GDB/MI Variable Objects.
  43337. (line 462)
  43338. * -var-show-format: GDB/MI Variable Objects.
  43339. (line 265)
  43340. * -var-update: GDB/MI Variable Objects.
  43341. (line 521)
  43342. * <gdb:arch>: Architectures In Guile.
  43343. (line 6)
  43344. * <gdb:block>: Blocks In Guile. (line 6)
  43345. * <gdb:breakpoint>: Breakpoints In Guile.
  43346. (line 6)
  43347. * <gdb:iterator>: Iterators In Guile. (line 6)
  43348. * <gdb:lazy-string>: Lazy Strings In Guile.
  43349. (line 6)
  43350. * <gdb:objfile>: Objfiles In Guile. (line 6)
  43351. * <gdb:progspace>: Progspaces In Guile. (line 6)
  43352. * <gdb:sal>: Symbol Tables In Guile.
  43353. (line 6)
  43354. * <gdb:symbol>: Symbols In Guile. (line 6)
  43355. * <gdb:symtab>: Symbol Tables In Guile.
  43356. (line 6)
  43357. * <gdb:type>: Types In Guile. (line 6)
  43358. * <gdb:value>: Values From Inferior In Guile.
  43359. (line 6)
  43360. * @, referencing memory as an array: Arrays. (line 6)
  43361. * ^connected: GDB/MI Result Records.
  43362. (line 22)
  43363. * ^done: GDB/MI Result Records.
  43364. (line 9)
  43365. * ^error: GDB/MI Result Records.
  43366. (line 25)
  43367. * ^exit: GDB/MI Result Records.
  43368. (line 36)
  43369. * ^running: GDB/MI Result Records.
  43370. (line 14)
  43371. * __init__ on TypePrinter: gdb.types. (line 82)
  43372. * |: Shell Commands. (line 26)
  43373. * abort (C-g): Miscellaneous Commands.
  43374. (line 10)
  43375. * accept-line (Newline or Return): Commands For History.
  43376. (line 6)
  43377. * actions: Tracepoint Actions. (line 6)
  43378. * ada-task-info: GDB/MI Support Commands.
  43379. (line 94)
  43380. * add-auto-load-safe-path: Auto-loading safe path.
  43381. (line 50)
  43382. * add-auto-load-scripts-directory: objfile-gdbdotext file.
  43383. (line 68)
  43384. * add-inferior: Inferiors Connections and Programs.
  43385. (line 102)
  43386. * add-symbol-file: Files. (line 123)
  43387. * add-symbol-file-from-memory: Files. (line 193)
  43388. * adi assign: Sparc64. (line 45)
  43389. * adi examine: Sparc64. (line 27)
  43390. * advance LOCATION: Continuing and Stepping.
  43391. (line 187)
  43392. * alias: Aliases. (line 21)
  43393. * append: Dump/Restore Files. (line 34)
  43394. * append-pretty-printer!: Guile Printing Module.
  43395. (line 18)
  43396. * apropos: Help. (line 74)
  43397. * arch-bool-type: Architectures In Guile.
  43398. (line 84)
  43399. * arch-char-type: Architectures In Guile.
  43400. (line 36)
  43401. * arch-charset: Architectures In Guile.
  43402. (line 23)
  43403. * arch-disassemble: Disassembly In Guile.
  43404. (line 10)
  43405. * arch-double-type: Architectures In Guile.
  43406. (line 76)
  43407. * arch-float-type: Architectures In Guile.
  43408. (line 72)
  43409. * arch-int-type: Architectures In Guile.
  43410. (line 44)
  43411. * arch-int16-type: Architectures In Guile.
  43412. (line 104)
  43413. * arch-int32-type: Architectures In Guile.
  43414. (line 112)
  43415. * arch-int64-type: Architectures In Guile.
  43416. (line 120)
  43417. * arch-int8-type: Architectures In Guile.
  43418. (line 96)
  43419. * arch-long-type: Architectures In Guile.
  43420. (line 48)
  43421. * arch-longdouble-type: Architectures In Guile.
  43422. (line 80)
  43423. * arch-longlong-type: Architectures In Guile.
  43424. (line 88)
  43425. * arch-name: Architectures In Guile.
  43426. (line 20)
  43427. * arch-schar-type: Architectures In Guile.
  43428. (line 52)
  43429. * arch-short-type: Architectures In Guile.
  43430. (line 40)
  43431. * arch-uchar-type: Architectures In Guile.
  43432. (line 56)
  43433. * arch-uint-type: Architectures In Guile.
  43434. (line 64)
  43435. * arch-uint16-type: Architectures In Guile.
  43436. (line 108)
  43437. * arch-uint32-type: Architectures In Guile.
  43438. (line 116)
  43439. * arch-uint64-type: Architectures In Guile.
  43440. (line 124)
  43441. * arch-uint8-type: Architectures In Guile.
  43442. (line 100)
  43443. * arch-ulong-type: Architectures In Guile.
  43444. (line 68)
  43445. * arch-ulonglong-type: Architectures In Guile.
  43446. (line 92)
  43447. * arch-ushort-type: Architectures In Guile.
  43448. (line 60)
  43449. * arch-void-type: Architectures In Guile.
  43450. (line 32)
  43451. * arch-wide-charset: Architectures In Guile.
  43452. (line 26)
  43453. * arch?: Architectures In Guile.
  43454. (line 13)
  43455. * Architecture.disassemble: Architectures In Python.
  43456. (line 15)
  43457. * Architecture.name: Architectures In Python.
  43458. (line 12)
  43459. * Architecture.registers: Architectures In Python.
  43460. (line 47)
  43461. * Architecture.register_groups: Architectures In Python.
  43462. (line 53)
  43463. * attach: Attach. (line 6)
  43464. * attach&: Background Execution.
  43465. (line 25)
  43466. * awatch: Set Watchpoints. (line 83)
  43467. * b (break): Set Breaks. (line 6)
  43468. * backtrace: Backtrace. (line 11)
  43469. * backward-char (C-b): Commands For Moving. (line 15)
  43470. * backward-delete-char (Rubout): Commands For Text. (line 17)
  43471. * backward-kill-line (C-x Rubout): Commands For Killing.
  43472. (line 9)
  43473. * backward-kill-word (M-<DEL>): Commands For Killing.
  43474. (line 24)
  43475. * backward-word (M-b): Commands For Moving. (line 22)
  43476. * beginning-of-history (M-<): Commands For History.
  43477. (line 19)
  43478. * beginning-of-line (C-a): Commands For Moving. (line 6)
  43479. * bell-style: Readline Init File Syntax.
  43480. (line 35)
  43481. * bfd caching: File Caching. (line 14)
  43482. * bfd caching <1>: File Caching. (line 24)
  43483. * bfd caching <2>: File Caching. (line 27)
  43484. * bind-tty-special-chars: Readline Init File Syntax.
  43485. (line 42)
  43486. * blink-matching-paren: Readline Init File Syntax.
  43487. (line 47)
  43488. * block-end: Blocks In Guile. (line 70)
  43489. * block-function: Blocks In Guile. (line 73)
  43490. * block-global-block: Blocks In Guile. (line 87)
  43491. * block-global?: Blocks In Guile. (line 93)
  43492. * block-start: Blocks In Guile. (line 67)
  43493. * block-static-block: Blocks In Guile. (line 90)
  43494. * block-static?: Blocks In Guile. (line 97)
  43495. * block-superblock: Blocks In Guile. (line 83)
  43496. * block-symbols: Blocks In Guile. (line 101)
  43497. * block-symbols-progress?: Blocks In Guile. (line 112)
  43498. * block-valid?: Blocks In Guile. (line 59)
  43499. * Block.end: Blocks In Python. (line 86)
  43500. * Block.function: Blocks In Python. (line 90)
  43501. * Block.global_block: Blocks In Python. (line 105)
  43502. * Block.is_global: Blocks In Python. (line 113)
  43503. * Block.is_static: Blocks In Python. (line 117)
  43504. * Block.is_valid: Blocks In Python. (line 73)
  43505. * Block.start: Blocks In Python. (line 83)
  43506. * Block.static_block: Blocks In Python. (line 109)
  43507. * Block.superblock: Blocks In Python. (line 100)
  43508. * block?: Blocks In Guile. (line 55)
  43509. * BP_ACCESS_WATCHPOINT: Breakpoints In Python.
  43510. (line 74)
  43511. * BP_ACCESS_WATCHPOINT <1>: Breakpoints In Guile.
  43512. (line 71)
  43513. * BP_BREAKPOINT: Breakpoints In Python.
  43514. (line 62)
  43515. * BP_BREAKPOINT <1>: Breakpoints In Guile.
  43516. (line 57)
  43517. * BP_HARDWARE_WATCHPOINT: Breakpoints In Python.
  43518. (line 68)
  43519. * BP_HARDWARE_WATCHPOINT <1>: Breakpoints In Guile.
  43520. (line 63)
  43521. * BP_READ_WATCHPOINT: Breakpoints In Python.
  43522. (line 71)
  43523. * BP_READ_WATCHPOINT <1>: Breakpoints In Guile.
  43524. (line 67)
  43525. * BP_WATCHPOINT: Breakpoints In Python.
  43526. (line 65)
  43527. * BP_WATCHPOINT <1>: Breakpoints In Guile.
  43528. (line 60)
  43529. * bracketed-paste-begin (): Commands For Text. (line 36)
  43530. * break: Set Breaks. (line 6)
  43531. * break ... task TASKNO (Ada): Ada Tasks. (line 135)
  43532. * break ... thread THREAD-ID: Thread-Specific Breakpoints.
  43533. (line 10)
  43534. * break, and Objective-C: Method Names in Commands.
  43535. (line 9)
  43536. * break-range: PowerPC Embedded. (line 41)
  43537. * breakpoint annotation: Annotations for Running.
  43538. (line 47)
  43539. * breakpoint-commands: Breakpoints In Guile.
  43540. (line 236)
  43541. * breakpoint-condition: Breakpoints In Guile.
  43542. (line 194)
  43543. * breakpoint-enabled?: Breakpoints In Guile.
  43544. (line 144)
  43545. * breakpoint-expression: Breakpoints In Guile.
  43546. (line 139)
  43547. * breakpoint-hit-count: Breakpoints In Guile.
  43548. (line 169)
  43549. * breakpoint-ignore-count: Breakpoints In Guile.
  43550. (line 163)
  43551. * breakpoint-location: Breakpoints In Guile.
  43552. (line 134)
  43553. * breakpoint-notifications: GDB/MI Support Commands.
  43554. (line 91)
  43555. * breakpoint-number: Breakpoints In Guile.
  43556. (line 122)
  43557. * breakpoint-silent?: Breakpoints In Guile.
  43558. (line 151)
  43559. * breakpoint-stop: Breakpoints In Guile.
  43560. (line 202)
  43561. * breakpoint-task: Breakpoints In Guile.
  43562. (line 185)
  43563. * breakpoint-thread: Breakpoints In Guile.
  43564. (line 176)
  43565. * breakpoint-type: Breakpoints In Guile.
  43566. (line 126)
  43567. * breakpoint-valid?: Breakpoints In Guile.
  43568. (line 112)
  43569. * breakpoint-visible?: Breakpoints In Guile.
  43570. (line 130)
  43571. * Breakpoint.commands: Breakpoints In Python.
  43572. (line 211)
  43573. * Breakpoint.condition: Breakpoints In Python.
  43574. (line 206)
  43575. * Breakpoint.delete: Breakpoints In Python.
  43576. (line 128)
  43577. * Breakpoint.enabled: Breakpoints In Python.
  43578. (line 133)
  43579. * Breakpoint.expression: Breakpoints In Python.
  43580. (line 200)
  43581. * Breakpoint.hit_count: Breakpoints In Python.
  43582. (line 189)
  43583. * Breakpoint.ignore_count: Breakpoints In Python.
  43584. (line 161)
  43585. * Breakpoint.is_valid: Breakpoints In Python.
  43586. (line 120)
  43587. * Breakpoint.location: Breakpoints In Python.
  43588. (line 194)
  43589. * Breakpoint.number: Breakpoints In Python.
  43590. (line 165)
  43591. * Breakpoint.pending: Breakpoints In Python.
  43592. (line 146)
  43593. * Breakpoint.silent: Breakpoints In Python.
  43594. (line 138)
  43595. * Breakpoint.stop: Breakpoints In Python.
  43596. (line 89)
  43597. * Breakpoint.task: Breakpoints In Python.
  43598. (line 155)
  43599. * Breakpoint.temporary: Breakpoints In Python.
  43600. (line 180)
  43601. * Breakpoint.thread: Breakpoints In Python.
  43602. (line 150)
  43603. * Breakpoint.type: Breakpoints In Python.
  43604. (line 170)
  43605. * Breakpoint.visible: Breakpoints In Python.
  43606. (line 175)
  43607. * Breakpoint.__init__: Breakpoints In Python.
  43608. (line 16)
  43609. * Breakpoint.__init__ <1>: Breakpoints In Python.
  43610. (line 49)
  43611. * breakpoint?: Breakpoints In Guile.
  43612. (line 108)
  43613. * BreakpointEvent.breakpoint: Events In Python. (line 105)
  43614. * BreakpointEvent.breakpoints: Events In Python. (line 101)
  43615. * breakpoints: Breakpoints In Guile.
  43616. (line 104)
  43617. * breakpoints-invalid annotation: Invalidation. (line 14)
  43618. * bt (backtrace): Backtrace. (line 11)
  43619. * c (continue): Continuing and Stepping.
  43620. (line 16)
  43621. * c (SingleKey TUI key): TUI Single Key Mode. (line 10)
  43622. * C-L: TUI Keys. (line 79)
  43623. * C-x 1: TUI Keys. (line 22)
  43624. * C-x 2: TUI Keys. (line 32)
  43625. * C-x a: TUI Keys. (line 11)
  43626. * C-x A: TUI Keys. (line 12)
  43627. * C-x C-a: TUI Keys. (line 10)
  43628. * C-x o: TUI Keys. (line 43)
  43629. * C-x s: TUI Keys. (line 53)
  43630. * call: Calling. (line 11)
  43631. * call-last-kbd-macro (C-x e): Keyboard Macros. (line 13)
  43632. * capitalize-word (M-c): Commands For Text. (line 64)
  43633. * catch: Set Catchpoints. (line 10)
  43634. * catch assert: Set Catchpoints. (line 112)
  43635. * catch catch: Set Catchpoints. (line 16)
  43636. * catch exception: Set Catchpoints. (line 66)
  43637. * catch exception unhandled: Set Catchpoints. (line 87)
  43638. * catch exec: Set Catchpoints. (line 116)
  43639. * catch fork: Set Catchpoints. (line 261)
  43640. * catch handlers: Set Catchpoints. (line 92)
  43641. * catch load: Set Catchpoints. (line 268)
  43642. * catch rethrow: Set Catchpoints. (line 16)
  43643. * catch signal: Set Catchpoints. (line 273)
  43644. * catch syscall: Set Catchpoints. (line 120)
  43645. * catch throw: Set Catchpoints. (line 16)
  43646. * catch unload: Set Catchpoints. (line 268)
  43647. * catch vfork: Set Catchpoints. (line 264)
  43648. * cd: Working Directory. (line 32)
  43649. * cdir: Source Path. (line 40)
  43650. * character-search (C-]): Miscellaneous Commands.
  43651. (line 42)
  43652. * character-search-backward (M-C-]): Miscellaneous Commands.
  43653. (line 47)
  43654. * checkpoint: Checkpoint/Restart. (line 26)
  43655. * clear: Delete Breaks. (line 21)
  43656. * clear, and Objective-C: Method Names in Commands.
  43657. (line 9)
  43658. * clear-screen (C-l): Commands For Moving. (line 40)
  43659. * ClearObjFilesEvent.progspace: Events In Python. (line 125)
  43660. * clone-inferior: Inferiors Connections and Programs.
  43661. (line 118)
  43662. * collect (tracepoints): Tracepoint Actions. (line 49)
  43663. * colon-colon, in Modula-2: M2 Scope. (line 6)
  43664. * colored-completion-prefix: Readline Init File Syntax.
  43665. (line 52)
  43666. * colored-stats: Readline Init File Syntax.
  43667. (line 59)
  43668. * Command.complete: Commands In Python. (line 70)
  43669. * Command.dont_repeat: Commands In Python. (line 42)
  43670. * Command.invoke: Commands In Python. (line 48)
  43671. * Command.__init__: Commands In Python. (line 10)
  43672. * command?: Commands In Guile. (line 63)
  43673. * commands: Break Commands. (line 11)
  43674. * commands annotation: Prompting. (line 27)
  43675. * COMMAND_BREAKPOINTS: Commands In Python. (line 142)
  43676. * COMMAND_BREAKPOINTS <1>: Commands In Guile. (line 177)
  43677. * COMMAND_DATA: Commands In Python. (line 113)
  43678. * COMMAND_DATA <1>: Commands In Guile. (line 148)
  43679. * COMMAND_FILES: Commands In Python. (line 124)
  43680. * COMMAND_FILES <1>: Commands In Guile. (line 159)
  43681. * COMMAND_MAINTENANCE: Commands In Python. (line 171)
  43682. * COMMAND_MAINTENANCE <1>: Commands In Guile. (line 201)
  43683. * COMMAND_NONE: Commands In Python. (line 103)
  43684. * COMMAND_NONE <1>: Commands In Guile. (line 137)
  43685. * COMMAND_OBSCURE: Commands In Python. (line 165)
  43686. * COMMAND_OBSCURE <1>: Commands In Guile. (line 195)
  43687. * COMMAND_RUNNING: Commands In Python. (line 107)
  43688. * COMMAND_RUNNING <1>: Commands In Guile. (line 142)
  43689. * COMMAND_STACK: Commands In Python. (line 118)
  43690. * COMMAND_STACK <1>: Commands In Guile. (line 153)
  43691. * COMMAND_STATUS: Commands In Python. (line 136)
  43692. * COMMAND_STATUS <1>: Commands In Guile. (line 171)
  43693. * COMMAND_SUPPORT: Commands In Python. (line 129)
  43694. * COMMAND_SUPPORT <1>: Commands In Guile. (line 164)
  43695. * COMMAND_TRACEPOINTS: Commands In Python. (line 148)
  43696. * COMMAND_TRACEPOINTS <1>: Commands In Guile. (line 183)
  43697. * COMMAND_TUI: Commands In Python. (line 154)
  43698. * COMMAND_USER: Commands In Python. (line 159)
  43699. * COMMAND_USER <1>: Commands In Guile. (line 189)
  43700. * comment-begin: Readline Init File Syntax.
  43701. (line 65)
  43702. * compare-sections: Memory. (line 149)
  43703. * compile code: Compiling and Injecting Code.
  43704. (line 11)
  43705. * compile file: Compiling and Injecting Code.
  43706. (line 56)
  43707. * complete: Help. (line 106)
  43708. * complete (<TAB>): Commands For Completion.
  43709. (line 6)
  43710. * COMPLETE_COMMAND: Commands In Python. (line 192)
  43711. * COMPLETE_COMMAND <1>: Commands In Guile. (line 222)
  43712. * COMPLETE_EXPRESSION: Commands In Python. (line 200)
  43713. * COMPLETE_EXPRESSION <1>: Commands In Guile. (line 230)
  43714. * COMPLETE_FILENAME: Commands In Python. (line 185)
  43715. * COMPLETE_FILENAME <1>: Commands In Guile. (line 215)
  43716. * COMPLETE_LOCATION: Commands In Python. (line 188)
  43717. * COMPLETE_LOCATION <1>: Commands In Guile. (line 218)
  43718. * COMPLETE_NONE: Commands In Python. (line 182)
  43719. * COMPLETE_NONE <1>: Commands In Guile. (line 212)
  43720. * COMPLETE_SYMBOL: Commands In Python. (line 196)
  43721. * COMPLETE_SYMBOL <1>: Commands In Guile. (line 226)
  43722. * completion-display-width: Readline Init File Syntax.
  43723. (line 70)
  43724. * completion-ignore-case: Readline Init File Syntax.
  43725. (line 77)
  43726. * completion-map-case: Readline Init File Syntax.
  43727. (line 82)
  43728. * completion-prefix-display-length: Readline Init File Syntax.
  43729. (line 88)
  43730. * completion-query-items: Readline Init File Syntax.
  43731. (line 95)
  43732. * condition: Conditions. (line 58)
  43733. * continue: Continuing and Stepping.
  43734. (line 16)
  43735. * continue&: Background Execution.
  43736. (line 40)
  43737. * convert-meta: Readline Init File Syntax.
  43738. (line 105)
  43739. * copy-backward-word (): Commands For Killing.
  43740. (line 49)
  43741. * copy-forward-word (): Commands For Killing.
  43742. (line 54)
  43743. * copy-region-as-kill (): Commands For Killing.
  43744. (line 45)
  43745. * core-file: Files. (line 107)
  43746. * ctf: Trace Files. (line 28)
  43747. * Ctrl-o (operate-and-get-next): Command Syntax. (line 41)
  43748. * current-arch: Architectures In Guile.
  43749. (line 17)
  43750. * current-objfile: Objfiles In Guile. (line 46)
  43751. * current-progspace: Progspaces In Guile. (line 26)
  43752. * cwd: Source Path. (line 40)
  43753. * d (delete): Delete Breaks. (line 41)
  43754. * d (SingleKey TUI key): TUI Single Key Mode. (line 13)
  43755. * data-directory: Guile Configuration. (line 9)
  43756. * data-disassemble-a-option: GDB/MI Support Commands.
  43757. (line 108)
  43758. * data-read-memory-bytes: GDB/MI Support Commands.
  43759. (line 88)
  43760. * default-visualizer: Guile Pretty Printing API.
  43761. (line 129)
  43762. * define: Define. (line 50)
  43763. * define-prefix: Define. (line 75)
  43764. * delete: Delete Breaks. (line 41)
  43765. * delete checkpoint CHECKPOINT-ID: Checkpoint/Restart. (line 53)
  43766. * delete display: Auto Display. (line 45)
  43767. * delete mem: Memory Region Attributes.
  43768. (line 34)
  43769. * delete tracepoint: Create and Delete Tracepoints.
  43770. (line 125)
  43771. * delete tvariable: Trace State Variables.
  43772. (line 42)
  43773. * delete-breakpoint!: Breakpoints In Guile.
  43774. (line 95)
  43775. * delete-char (C-d): Commands For Text. (line 12)
  43776. * delete-char-or-list (): Commands For Completion.
  43777. (line 39)
  43778. * delete-horizontal-space (): Commands For Killing.
  43779. (line 37)
  43780. * demangle: Symbols. (line 114)
  43781. * detach: Attach. (line 55)
  43782. * detach (remote): Connecting. (line 263)
  43783. * detach inferiors INFNO...: Inferiors Connections and Programs.
  43784. (line 147)
  43785. * digit-argument (M-0, M-1, ... M--): Numeric Arguments. (line 6)
  43786. * dir: Source Path. (line 99)
  43787. * directory: Source Path. (line 99)
  43788. * dis (disable): Disabling. (line 37)
  43789. * disable: Disabling. (line 37)
  43790. * disable display: Auto Display. (line 56)
  43791. * disable frame-filter: Frame Filter Management.
  43792. (line 16)
  43793. * disable mem: Memory Region Attributes.
  43794. (line 38)
  43795. * disable pretty-printer: Pretty-Printer Commands.
  43796. (line 20)
  43797. * disable probes: Static Probe Points. (line 73)
  43798. * disable tracepoint: Enable and Disable Tracepoints.
  43799. (line 9)
  43800. * disable type-printer: Symbols. (line 411)
  43801. * disable-completion: Readline Init File Syntax.
  43802. (line 113)
  43803. * disassemble: Machine Code. (line 43)
  43804. * disconnect: Connecting. (line 272)
  43805. * display: Auto Display. (line 23)
  43806. * do (down): Selection. (line 74)
  43807. * do-lowercase-version (M-A, M-B, M-X, ...): Miscellaneous Commands.
  43808. (line 14)
  43809. * document: Define. (line 63)
  43810. * dont-repeat: Commands In Guile. (line 67)
  43811. * dont-repeat <1>: Define. (line 111)
  43812. * down: Selection. (line 74)
  43813. * Down: TUI Keys. (line 70)
  43814. * down-silently: Selection. (line 106)
  43815. * downcase-word (M-l): Commands For Text. (line 60)
  43816. * dprintf: Dynamic Printf. (line 26)
  43817. * dprintf-style agent: Dynamic Printf. (line 46)
  43818. * dprintf-style call: Dynamic Printf. (line 42)
  43819. * dprintf-style gdb: Dynamic Printf. (line 39)
  43820. * dump: Dump/Restore Files. (line 13)
  43821. * dump-functions (): Miscellaneous Commands.
  43822. (line 70)
  43823. * dump-macros (): Miscellaneous Commands.
  43824. (line 82)
  43825. * dump-variables (): Miscellaneous Commands.
  43826. (line 76)
  43827. * e (edit): Edit. (line 6)
  43828. * echo: Output. (line 12)
  43829. * echo-control-characters: Readline Init File Syntax.
  43830. (line 118)
  43831. * edit: Edit. (line 6)
  43832. * editing-mode: Readline Init File Syntax.
  43833. (line 123)
  43834. * else: Command Files. (line 74)
  43835. * emacs-editing-mode (C-e): Miscellaneous Commands.
  43836. (line 88)
  43837. * emacs-mode-string: Readline Init File Syntax.
  43838. (line 129)
  43839. * enable: Disabling. (line 44)
  43840. * enable display: Auto Display. (line 65)
  43841. * enable frame-filter: Frame Filter Management.
  43842. (line 26)
  43843. * enable mem: Memory Region Attributes.
  43844. (line 42)
  43845. * enable pretty-printer: Pretty-Printer Commands.
  43846. (line 25)
  43847. * enable probes: Static Probe Points. (line 60)
  43848. * enable tracepoint: Enable and Disable Tracepoints.
  43849. (line 19)
  43850. * enable type-printer: Symbols. (line 411)
  43851. * enable-bracketed-paste: Readline Init File Syntax.
  43852. (line 139)
  43853. * enable-keypad: Readline Init File Syntax.
  43854. (line 147)
  43855. * enabled: Xmethod API. (line 18)
  43856. * enabled of type_printer: Type Printing API. (line 13)
  43857. * end (breakpoint commands): Break Commands. (line 11)
  43858. * end (if/else/while commands): Command Files. (line 103)
  43859. * end (user-defined commands): Define. (line 63)
  43860. * end-kbd-macro (C-x )): Keyboard Macros. (line 9)
  43861. * end-of-file (usually C-d): Commands For Text. (line 6)
  43862. * end-of-history (M->): Commands For History.
  43863. (line 22)
  43864. * end-of-iteration: Iterators In Guile. (line 70)
  43865. * end-of-iteration?: Iterators In Guile. (line 73)
  43866. * end-of-line (C-e): Commands For Moving. (line 9)
  43867. * error annotation: Errors. (line 10)
  43868. * error-begin annotation: Errors. (line 22)
  43869. * error-port: I/O Ports in Guile. (line 12)
  43870. * eval: Output. (line 117)
  43871. * EventRegistry.connect: Events In Python. (line 19)
  43872. * EventRegistry.disconnect: Events In Python. (line 23)
  43873. * exception-args: Guile Exception Handling.
  43874. (line 103)
  43875. * exception-key: Guile Exception Handling.
  43876. (line 100)
  43877. * exception?: Guile Exception Handling.
  43878. (line 96)
  43879. * exceptionHandler: Bootstrapping. (line 38)
  43880. * exchange-point-and-mark (C-x C-x): Miscellaneous Commands.
  43881. (line 37)
  43882. * exec-file: Files. (line 39)
  43883. * exec-file-mismatch: Attach. (line 34)
  43884. * exec-run-start-option: GDB/MI Support Commands.
  43885. (line 105)
  43886. * execute: Basic Guile. (line 68)
  43887. * exited annotation: Annotations for Running.
  43888. (line 18)
  43889. * ExitedEvent.exit_code: Events In Python. (line 67)
  43890. * ExitedEvent.inferior: Events In Python. (line 72)
  43891. * expand-tilde: Readline Init File Syntax.
  43892. (line 158)
  43893. * explore: Data. (line 125)
  43894. * f (frame): Selection. (line 11)
  43895. * f (SingleKey TUI key): TUI Single Key Mode. (line 16)
  43896. * faas: Frame Apply. (line 96)
  43897. * fg (resume foreground execution): Continuing and Stepping.
  43898. (line 16)
  43899. * field-artificial?: Types In Guile. (line 262)
  43900. * field-base-class?: Types In Guile. (line 266)
  43901. * field-bitpos: Types In Guile. (line 253)
  43902. * field-bitsize: Types In Guile. (line 257)
  43903. * field-enumval: Types In Guile. (line 250)
  43904. * field-name: Types In Guile. (line 243)
  43905. * field-type: Types In Guile. (line 246)
  43906. * field?: Types In Guile. (line 239)
  43907. * file: Files. (line 16)
  43908. * fin (finish): Continuing and Stepping.
  43909. (line 109)
  43910. * find: Searching Memory. (line 9)
  43911. * find-pc-line: Symbol Tables In Guile.
  43912. (line 71)
  43913. * finish: Continuing and Stepping.
  43914. (line 109)
  43915. * finish&: Background Execution.
  43916. (line 43)
  43917. * FinishBreakpoint.out_of_scope: Finish Breakpoints in Python.
  43918. (line 21)
  43919. * FinishBreakpoint.return_value: Finish Breakpoints in Python.
  43920. (line 38)
  43921. * FinishBreakpoint.__init__: Finish Breakpoints in Python.
  43922. (line 14)
  43923. * flash-erase: Target Commands. (line 140)
  43924. * flushregs: Maintenance Commands.
  43925. (line 317)
  43926. * flush_i_cache: Bootstrapping. (line 60)
  43927. * fo (forward-search): Search. (line 9)
  43928. * focus: TUI Commands. (line 103)
  43929. * forward-backward-delete-char (): Commands For Text. (line 21)
  43930. * forward-char (C-f): Commands For Moving. (line 12)
  43931. * forward-search: Search. (line 9)
  43932. * forward-search-history (C-s): Commands For History.
  43933. (line 30)
  43934. * forward-word (M-f): Commands For Moving. (line 18)
  43935. * frame address: Selection. (line 30)
  43936. * frame apply: Frame Apply. (line 6)
  43937. * frame function: Selection. (line 48)
  43938. * frame level: Selection. (line 16)
  43939. * frame view: Selection. (line 53)
  43940. * frame, selecting: Selection. (line 11)
  43941. * frame-arch: Frames In Guile. (line 35)
  43942. * frame-block: Frames In Guile. (line 121)
  43943. * frame-function: Frames In Guile. (line 125)
  43944. * frame-name: Frames In Guile. (line 32)
  43945. * frame-newer: Frames In Guile. (line 133)
  43946. * frame-older: Frames In Guile. (line 130)
  43947. * frame-pc: Frames In Guile. (line 118)
  43948. * frame-read-register: Frames In Guile. (line 140)
  43949. * frame-read-var: Frames In Guile. (line 144)
  43950. * frame-sal: Frames In Guile. (line 136)
  43951. * frame-select: Frames In Guile. (line 152)
  43952. * frame-type: Frames In Guile. (line 39)
  43953. * frame-unwind-stop-reason: Frames In Guile. (line 67)
  43954. * frame-valid?: Frames In Guile. (line 26)
  43955. * Frame.architecture: Frames In Python. (line 53)
  43956. * Frame.block: Frames In Python. (line 139)
  43957. * Frame.find_sal: Frames In Python. (line 155)
  43958. * Frame.function: Frames In Python. (line 145)
  43959. * Frame.is_valid: Frames In Python. (line 43)
  43960. * Frame.name: Frames In Python. (line 49)
  43961. * Frame.newer: Frames In Python. (line 152)
  43962. * Frame.older: Frames In Python. (line 149)
  43963. * Frame.pc: Frames In Python. (line 136)
  43964. * Frame.read_register: Frames In Python. (line 159)
  43965. * Frame.read_var: Frames In Python. (line 179)
  43966. * Frame.select: Frames In Python. (line 187)
  43967. * Frame.type: Frames In Python. (line 57)
  43968. * Frame.unwind_stop_reason: Frames In Python. (line 84)
  43969. * frame?: Frames In Guile. (line 22)
  43970. * FrameDecorator.address: Frame Decorator API. (line 60)
  43971. * FrameDecorator.elided: Frame Decorator API. (line 29)
  43972. * FrameDecorator.filename: Frame Decorator API. (line 70)
  43973. * FrameDecorator.frame_args: Frame Decorator API. (line 91)
  43974. * FrameDecorator.frame_locals: Frame Decorator API. (line 143)
  43975. * FrameDecorator.function: Frame Decorator API. (line 49)
  43976. * FrameDecorator.inferior_frame: Frame Decorator API. (line 176)
  43977. * FrameDecorator.line: Frame Decorator API. (line 81)
  43978. * FrameFilter.enabled: Frame Filter API. (line 122)
  43979. * FrameFilter.filter: Frame Filter API. (line 75)
  43980. * FrameFilter.name: Frame Filter API. (line 115)
  43981. * FrameFilter.priority: Frame Filter API. (line 131)
  43982. * frames-invalid annotation: Invalidation. (line 9)
  43983. * frozen-varobjs: GDB/MI Support Commands.
  43984. (line 75)
  43985. * ftrace: Create and Delete Tracepoints.
  43986. (line 50)
  43987. * Function: Functions In Python. (line 6)
  43988. * Function.invoke: Functions In Python. (line 19)
  43989. * Function.__init__: Functions In Python. (line 10)
  43990. * gcore: Core File Generation.
  43991. (line 17)
  43992. * gdb-object-kind: GDB Scheme Data Types.
  43993. (line 10)
  43994. * gdb-version: Guile Configuration. (line 17)
  43995. * gdb.Block: Blocks In Python. (line 6)
  43996. * gdb.block_for_pc: Blocks In Python. (line 64)
  43997. * gdb.block_for_pc <1>: Blocks In Python. (line 64)
  43998. * gdb.BP_ACCESS_WATCHPOINT: Breakpoints In Python.
  43999. (line 74)
  44000. * gdb.BP_BREAKPOINT: Breakpoints In Python.
  44001. (line 62)
  44002. * gdb.BP_HARDWARE_WATCHPOINT: Breakpoints In Python.
  44003. (line 68)
  44004. * gdb.BP_READ_WATCHPOINT: Breakpoints In Python.
  44005. (line 71)
  44006. * gdb.BP_WATCHPOINT: Breakpoints In Python.
  44007. (line 65)
  44008. * gdb.Breakpoint: Breakpoints In Python.
  44009. (line 6)
  44010. * gdb.breakpoints: Basic Python. (line 59)
  44011. * gdb.breakpoints <1>: Basic Python. (line 59)
  44012. * gdb.COMMAND_BREAKPOINTS: Commands In Python. (line 142)
  44013. * gdb.COMMAND_DATA: Commands In Python. (line 113)
  44014. * gdb.COMMAND_FILES: Commands In Python. (line 124)
  44015. * gdb.COMMAND_MAINTENANCE: Commands In Python. (line 171)
  44016. * gdb.COMMAND_NONE: Commands In Python. (line 103)
  44017. * gdb.COMMAND_OBSCURE: Commands In Python. (line 165)
  44018. * gdb.COMMAND_RUNNING: Commands In Python. (line 107)
  44019. * gdb.COMMAND_STACK: Commands In Python. (line 118)
  44020. * gdb.COMMAND_STATUS: Commands In Python. (line 136)
  44021. * gdb.COMMAND_SUPPORT: Commands In Python. (line 129)
  44022. * gdb.COMMAND_TRACEPOINTS: Commands In Python. (line 148)
  44023. * gdb.COMMAND_TUI: Commands In Python. (line 154)
  44024. * gdb.COMMAND_USER: Commands In Python. (line 159)
  44025. * gdb.COMPLETE_COMMAND: Commands In Python. (line 192)
  44026. * gdb.COMPLETE_EXPRESSION: Commands In Python. (line 200)
  44027. * gdb.COMPLETE_FILENAME: Commands In Python. (line 185)
  44028. * gdb.COMPLETE_LOCATION: Commands In Python. (line 188)
  44029. * gdb.COMPLETE_NONE: Commands In Python. (line 182)
  44030. * gdb.COMPLETE_SYMBOL: Commands In Python. (line 196)
  44031. * gdb.convenience_variable: Basic Python. (line 106)
  44032. * gdb.convenience_variable <1>: Basic Python. (line 106)
  44033. * gdb.current_objfile: Objfiles In Python. (line 15)
  44034. * gdb.current_objfile <1>: Objfiles In Python. (line 15)
  44035. * gdb.current_progspace: Progspaces In Python.
  44036. (line 14)
  44037. * gdb.current_progspace <1>: Progspaces In Python.
  44038. (line 14)
  44039. * gdb.current_recording: Recordings In Python.
  44040. (line 21)
  44041. * gdb.decode_line: Basic Python. (line 229)
  44042. * gdb.decode_line <1>: Basic Python. (line 229)
  44043. * gdb.default_visualizer: Pretty Printing API. (line 96)
  44044. * gdb.default_visualizer <1>: Pretty Printing API. (line 96)
  44045. * gdb.error: Exception Handling. (line 22)
  44046. * gdb.execute: Basic Python. (line 40)
  44047. * gdb.execute <1>: Basic Python. (line 40)
  44048. * gdb.find_pc_line: Basic Python. (line 132)
  44049. * gdb.find_pc_line <1>: Basic Python. (line 132)
  44050. * gdb.FinishBreakpoint: Finish Breakpoints in Python.
  44051. (line 6)
  44052. * gdb.flush: Basic Python. (line 193)
  44053. * gdb.flush <1>: Basic Python. (line 193)
  44054. * gdb.FrameDecorator: Frame Decorator API. (line 25)
  44055. * gdb.frame_stop_reason_string: Frames In Python. (line 29)
  44056. * gdb.Function: Functions In Python. (line 6)
  44057. * gdb.GdbError: Exception Handling. (line 48)
  44058. * gdb.history: Basic Python. (line 93)
  44059. * gdb.history <1>: Basic Python. (line 93)
  44060. * gdb.Inferior: Inferiors In Python. (line 6)
  44061. * gdb.InferiorCallPostEvent: Events In Python. (line 145)
  44062. * gdb.InferiorCallPreEvent: Events In Python. (line 135)
  44063. * gdb.inferiors: Inferiors In Python. (line 14)
  44064. * gdb.InferiorThread: Threads In Python. (line 6)
  44065. * gdb.invalidate_cached_frames: Frames In Python. (line 34)
  44066. * gdb.invalidate_cached_frames <1>: Frames In Python. (line 34)
  44067. * gdb.LazyString: Lazy Strings In Python.
  44068. (line 6)
  44069. * gdb.LineTable: Line Tables In Python.
  44070. (line 6)
  44071. * gdb.lookup_global_symbol: Symbols In Python. (line 33)
  44072. * gdb.lookup_global_symbol <1>: Symbols In Python. (line 33)
  44073. * gdb.lookup_objfile: Objfiles In Python. (line 28)
  44074. * gdb.lookup_objfile <1>: Objfiles In Python. (line 28)
  44075. * gdb.lookup_static_symbol: Symbols In Python. (line 45)
  44076. * gdb.lookup_static_symbol <1>: Symbols In Python. (line 45)
  44077. * gdb.lookup_static_symbols: Symbols In Python. (line 71)
  44078. * gdb.lookup_static_symbols <1>: Symbols In Python. (line 71)
  44079. * gdb.lookup_symbol: Symbols In Python. (line 13)
  44080. * gdb.lookup_symbol <1>: Symbols In Python. (line 13)
  44081. * gdb.lookup_type: Types In Python. (line 11)
  44082. * gdb.lookup_type <1>: Types In Python. (line 11)
  44083. * gdb.MemoryError: Exception Handling. (line 30)
  44084. * gdb.newest_frame: Frames In Python. (line 26)
  44085. * gdb.newest_frame <1>: Frames In Python. (line 26)
  44086. * gdb.Objfile: Objfiles In Python. (line 6)
  44087. * gdb.objfiles: Objfiles In Python. (line 21)
  44088. * gdb.objfiles <1>: Objfiles In Python. (line 21)
  44089. * gdb.Parameter: Parameters In Python.
  44090. (line 6)
  44091. * gdb.parameter: Basic Python. (line 82)
  44092. * gdb.parameter <1>: Basic Python. (line 82)
  44093. * gdb.PARAM_AUTO_BOOLEAN: Parameters In Python.
  44094. (line 116)
  44095. * gdb.PARAM_BOOLEAN: Parameters In Python.
  44096. (line 112)
  44097. * gdb.PARAM_ENUM: Parameters In Python.
  44098. (line 160)
  44099. * gdb.PARAM_FILENAME: Parameters In Python.
  44100. (line 142)
  44101. * gdb.PARAM_INTEGER: Parameters In Python.
  44102. (line 125)
  44103. * gdb.PARAM_OPTIONAL_FILENAME: Parameters In Python.
  44104. (line 139)
  44105. * gdb.PARAM_STRING: Parameters In Python.
  44106. (line 129)
  44107. * gdb.PARAM_STRING_NOESCAPE: Parameters In Python.
  44108. (line 135)
  44109. * gdb.PARAM_UINTEGER: Parameters In Python.
  44110. (line 121)
  44111. * gdb.PARAM_ZINTEGER: Parameters In Python.
  44112. (line 146)
  44113. * gdb.PARAM_ZUINTEGER: Parameters In Python.
  44114. (line 150)
  44115. * gdb.PARAM_ZUINTEGER_UNLIMITED: Parameters In Python.
  44116. (line 155)
  44117. * gdb.parse_and_eval: Basic Python. (line 122)
  44118. * gdb.parse_and_eval <1>: Basic Python. (line 122)
  44119. * gdb.post_event: Basic Python. (line 141)
  44120. * gdb.post_event <1>: Basic Python. (line 141)
  44121. * gdb.pretty_printers: Selecting Pretty-Printers.
  44122. (line 12)
  44123. * gdb.pretty_printers <1>: Selecting Pretty-Printers.
  44124. (line 12)
  44125. * gdb.Progspace: Progspaces In Python.
  44126. (line 6)
  44127. * gdb.progspaces: Progspaces In Python.
  44128. (line 20)
  44129. * gdb.progspaces <1>: Progspaces In Python.
  44130. (line 20)
  44131. * gdb.prompt_hook: Basic Python. (line 241)
  44132. * gdb.PYTHONDIR: Basic Python. (line 37)
  44133. * gdb.PYTHONDIR <1>: Basic Python. (line 37)
  44134. * gdb.rbreak: Basic Python. (line 66)
  44135. * gdb.register_window_type: TUI Windows In Python.
  44136. (line 8)
  44137. * gdb.register_window_type <1>: TUI Windows In Python.
  44138. (line 8)
  44139. * gdb.search_memory: Inferiors In Python. (line 71)
  44140. * gdb.selected_frame: Frames In Python. (line 22)
  44141. * gdb.selected_frame <1>: Frames In Python. (line 22)
  44142. * gdb.selected_inferior: Inferiors In Python. (line 17)
  44143. * gdb.selected_thread: Threads In Python. (line 13)
  44144. * gdb.selected_thread <1>: Threads In Python. (line 13)
  44145. * gdb.set_convenience_variable: Basic Python. (line 113)
  44146. * gdb.set_convenience_variable <1>: Basic Python. (line 113)
  44147. * gdb.solib_name: Basic Python. (line 223)
  44148. * gdb.solib_name <1>: Basic Python. (line 223)
  44149. * gdb.start_recording: Recordings In Python.
  44150. (line 9)
  44151. * gdb.STDERR: Basic Python. (line 183)
  44152. * gdb.STDERR <1>: Basic Python. (line 203)
  44153. * gdb.STDLOG: Basic Python. (line 186)
  44154. * gdb.STDLOG <1>: Basic Python. (line 206)
  44155. * gdb.STDOUT: Basic Python. (line 180)
  44156. * gdb.STDOUT <1>: Basic Python. (line 200)
  44157. * gdb.stop_recording: Recordings In Python.
  44158. (line 25)
  44159. * gdb.string_to_argv: Commands In Python. (line 61)
  44160. * gdb.Symbol: Symbols In Python. (line 6)
  44161. * gdb.SYMBOL_COMMON_BLOCK_DOMAIN: Symbols In Python. (line 178)
  44162. * gdb.SYMBOL_LABEL_DOMAIN: Symbols In Python. (line 172)
  44163. * gdb.SYMBOL_LOC_ARG: Symbols In Python. (line 197)
  44164. * gdb.SYMBOL_LOC_BLOCK: Symbols In Python. (line 218)
  44165. * gdb.SYMBOL_LOC_COMPUTED: Symbols In Python. (line 232)
  44166. * gdb.SYMBOL_LOC_COMPUTED <1>: Symbols In Python. (line 235)
  44167. * gdb.SYMBOL_LOC_CONST: Symbols In Python. (line 188)
  44168. * gdb.SYMBOL_LOC_CONST_BYTES: Symbols In Python. (line 221)
  44169. * gdb.SYMBOL_LOC_LOCAL: Symbols In Python. (line 211)
  44170. * gdb.SYMBOL_LOC_OPTIMIZED_OUT: Symbols In Python. (line 229)
  44171. * gdb.SYMBOL_LOC_REF_ARG: Symbols In Python. (line 201)
  44172. * gdb.SYMBOL_LOC_REGISTER: Symbols In Python. (line 194)
  44173. * gdb.SYMBOL_LOC_REGPARM_ADDR: Symbols In Python. (line 206)
  44174. * gdb.SYMBOL_LOC_STATIC: Symbols In Python. (line 191)
  44175. * gdb.SYMBOL_LOC_TYPEDEF: Symbols In Python. (line 214)
  44176. * gdb.SYMBOL_LOC_UNDEF: Symbols In Python. (line 184)
  44177. * gdb.SYMBOL_LOC_UNRESOLVED: Symbols In Python. (line 224)
  44178. * gdb.SYMBOL_MODULE_DOMAIN: Symbols In Python. (line 175)
  44179. * gdb.SYMBOL_STRUCT_DOMAIN: Symbols In Python. (line 169)
  44180. * gdb.SYMBOL_UNDEF_DOMAIN: Symbols In Python. (line 160)
  44181. * gdb.SYMBOL_VAR_DOMAIN: Symbols In Python. (line 165)
  44182. * gdb.Symtab: Symbol Tables In Python.
  44183. (line 6)
  44184. * gdb.Symtab_and_line: Symbol Tables In Python.
  44185. (line 6)
  44186. * gdb.target_charset: Basic Python. (line 212)
  44187. * gdb.target_charset <1>: Basic Python. (line 212)
  44188. * gdb.target_wide_charset: Basic Python. (line 217)
  44189. * gdb.target_wide_charset <1>: Basic Python. (line 217)
  44190. * gdb.Type: Types In Python. (line 6)
  44191. * gdb.TYPE_CODE_ARRAY: Types In Python. (line 228)
  44192. * gdb.TYPE_CODE_BITSTRING: Types In Python. (line 266)
  44193. * gdb.TYPE_CODE_BOOL: Types In Python. (line 290)
  44194. * gdb.TYPE_CODE_CHAR: Types In Python. (line 287)
  44195. * gdb.TYPE_CODE_COMPLEX: Types In Python. (line 293)
  44196. * gdb.TYPE_CODE_DECFLOAT: Types In Python. (line 302)
  44197. * gdb.TYPE_CODE_ENUM: Types In Python. (line 237)
  44198. * gdb.TYPE_CODE_ERROR: Types In Python. (line 269)
  44199. * gdb.TYPE_CODE_FLAGS: Types In Python. (line 240)
  44200. * gdb.TYPE_CODE_FLT: Types In Python. (line 249)
  44201. * gdb.TYPE_CODE_FUNC: Types In Python. (line 243)
  44202. * gdb.TYPE_CODE_INT: Types In Python. (line 246)
  44203. * gdb.TYPE_CODE_INTERNAL_FUNCTION: Types In Python. (line 305)
  44204. * gdb.TYPE_CODE_MEMBERPTR: Types In Python. (line 278)
  44205. * gdb.TYPE_CODE_METHOD: Types In Python. (line 272)
  44206. * gdb.TYPE_CODE_METHODPTR: Types In Python. (line 275)
  44207. * gdb.TYPE_CODE_NAMESPACE: Types In Python. (line 299)
  44208. * gdb.TYPE_CODE_PTR: Types In Python. (line 225)
  44209. * gdb.TYPE_CODE_RANGE: Types In Python. (line 258)
  44210. * gdb.TYPE_CODE_REF: Types In Python. (line 281)
  44211. * gdb.TYPE_CODE_RVALUE_REF: Types In Python. (line 284)
  44212. * gdb.TYPE_CODE_SET: Types In Python. (line 255)
  44213. * gdb.TYPE_CODE_STRING: Types In Python. (line 261)
  44214. * gdb.TYPE_CODE_STRUCT: Types In Python. (line 231)
  44215. * gdb.TYPE_CODE_TYPEDEF: Types In Python. (line 296)
  44216. * gdb.TYPE_CODE_UNION: Types In Python. (line 234)
  44217. * gdb.TYPE_CODE_VOID: Types In Python. (line 252)
  44218. * gdb.unwinder.register_unwinder: Unwinding Frames in Python.
  44219. (line 161)
  44220. * gdb.UnwindInfo.add_saved_register: Unwinding Frames in Python.
  44221. (line 111)
  44222. * gdb.WP_ACCESS: Breakpoints In Python.
  44223. (line 86)
  44224. * gdb.WP_READ: Breakpoints In Python.
  44225. (line 80)
  44226. * gdb.WP_WRITE: Breakpoints In Python.
  44227. (line 83)
  44228. * gdb.write: Basic Python. (line 175)
  44229. * gdb.write <1>: Basic Python. (line 175)
  44230. * gdb:error: Guile Exception Handling.
  44231. (line 69)
  44232. * gdb:invalid-object: Guile Exception Handling.
  44233. (line 72)
  44234. * gdb:memory-error: Guile Exception Handling.
  44235. (line 80)
  44236. * gdb:pp-type-error: Guile Exception Handling.
  44237. (line 84)
  44238. * gdbserver: Server. (line 6)
  44239. * gdb_init_reader: Writing JIT Debug Info Readers.
  44240. (line 20)
  44241. * generate-core-file: Core File Generation.
  44242. (line 17)
  44243. * get-basic-type: Guile Types Module. (line 13)
  44244. * getDebugChar: Bootstrapping. (line 14)
  44245. * gnu_debuglink_crc32: Separate Debug Files.
  44246. (line 163)
  44247. * gr: Guile Commands. (line 8)
  44248. * gu: Guile Commands. (line 15)
  44249. * guile: Guile Commands. (line 15)
  44250. * guile-data-directory: Guile Configuration. (line 13)
  44251. * guile-repl: Guile Commands. (line 8)
  44252. * h (help): Help. (line 9)
  44253. * handle: Signals. (line 49)
  44254. * handle_exception: Stub Contents. (line 15)
  44255. * hbreak: Set Breaks. (line 61)
  44256. * help: Help. (line 6)
  44257. * help function: Convenience Funs. (line 228)
  44258. * help target: Target Commands. (line 19)
  44259. * help user-defined: Define. (line 116)
  44260. * history-append!: Basic Guile. (line 105)
  44261. * history-preserve-point: Readline Init File Syntax.
  44262. (line 162)
  44263. * history-ref: Basic Guile. (line 87)
  44264. * history-search-backward (): Commands For History.
  44265. (line 52)
  44266. * history-search-forward (): Commands For History.
  44267. (line 46)
  44268. * history-size: Readline Init File Syntax.
  44269. (line 168)
  44270. * history-substring-search-backward (): Commands For History.
  44271. (line 64)
  44272. * history-substring-search-forward (): Commands For History.
  44273. (line 58)
  44274. * hook: Hooks. (line 6)
  44275. * hookpost: Hooks. (line 11)
  44276. * horizontal-scroll-mode: Readline Init File Syntax.
  44277. (line 177)
  44278. * host-config: Guile Configuration. (line 20)
  44279. * i (info): Help. (line 129)
  44280. * i (SingleKey TUI key): TUI Single Key Mode. (line 34)
  44281. * if: Command Files. (line 74)
  44282. * ignore: Conditions. (line 90)
  44283. * inferior INFNO: Inferiors Connections and Programs.
  44284. (line 85)
  44285. * Inferior.architecture: Inferiors In Python. (line 50)
  44286. * Inferior.is_valid: Inferiors In Python. (line 38)
  44287. * Inferior.num: Inferiors In Python. (line 22)
  44288. * Inferior.pid: Inferiors In Python. (line 25)
  44289. * Inferior.progspace: Inferiors In Python. (line 33)
  44290. * Inferior.read_memory: Inferiors In Python. (line 57)
  44291. * Inferior.read_memory <1>: Inferiors In Python. (line 57)
  44292. * Inferior.search_memory: Inferiors In Python. (line 71)
  44293. * Inferior.threads: Inferiors In Python. (line 45)
  44294. * Inferior.thread_from_handle: Inferiors In Python. (line 80)
  44295. * Inferior.thread_from_handle <1>: Inferiors In Python. (line 80)
  44296. * Inferior.thread_from_thread_handle: Inferiors In Python. (line 80)
  44297. * Inferior.was_attached: Inferiors In Python. (line 29)
  44298. * Inferior.write_memory: Inferiors In Python. (line 64)
  44299. * Inferior.write_memory <1>: Inferiors In Python. (line 64)
  44300. * InferiorCallPostEvent.address: Events In Python. (line 152)
  44301. * InferiorCallPostEvent.ptid: Events In Python. (line 149)
  44302. * InferiorCallPreEvent.address: Events In Python. (line 142)
  44303. * InferiorCallPreEvent.ptid: Events In Python. (line 139)
  44304. * InferiorThread.global_num: Threads In Python. (line 35)
  44305. * InferiorThread.handle: Threads In Python. (line 74)
  44306. * InferiorThread.inferior: Threads In Python. (line 48)
  44307. * InferiorThread.is_exited: Threads In Python. (line 71)
  44308. * InferiorThread.is_running: Threads In Python. (line 68)
  44309. * InferiorThread.is_stopped: Threads In Python. (line 65)
  44310. * InferiorThread.is_valid: Threads In Python. (line 54)
  44311. * InferiorThread.name: Threads In Python. (line 22)
  44312. * InferiorThread.num: Threads In Python. (line 32)
  44313. * InferiorThread.ptid: Threads In Python. (line 40)
  44314. * InferiorThread.switch: Threads In Python. (line 61)
  44315. * info: Help. (line 129)
  44316. * info address: Symbols. (line 85)
  44317. * info all-registers: Registers. (line 15)
  44318. * info args: Frame Info. (line 43)
  44319. * info auto-load: Auto-loading. (line 60)
  44320. * info auto-load gdb-scripts: Auto-loading sequences.
  44321. (line 21)
  44322. * info auto-load guile-scripts: Guile Auto-loading. (line 23)
  44323. * info auto-load libthread-db: libthread_db.so.1 file.
  44324. (line 29)
  44325. * info auto-load local-gdbinit: Init File in the Current Directory.
  44326. (line 22)
  44327. * info auto-load python-scripts: Python Auto-loading. (line 23)
  44328. * info auxv: OS Information. (line 20)
  44329. * info breakpoints: Set Breaks. (line 133)
  44330. * info checkpoints: Checkpoint/Restart. (line 31)
  44331. * info classes: Symbols. (line 570)
  44332. * info common: Special Fortran Commands.
  44333. (line 9)
  44334. * info connections [ ID... ]: Inferiors Connections and Programs.
  44335. (line 58)
  44336. * info copying: Help. (line 166)
  44337. * info dcache: Caching Target Data. (line 46)
  44338. * info display: Auto Display. (line 78)
  44339. * info dll: Files. (line 336)
  44340. * info dos: DJGPP Native. (line 15)
  44341. * info exceptions: Ada Exceptions. (line 8)
  44342. * info extensions: Show. (line 34)
  44343. * info f (info frame): Frame Info. (line 17)
  44344. * info files: Files. (line 211)
  44345. * info float: Floating Point Hardware.
  44346. (line 9)
  44347. * info frame: Frame Info. (line 17)
  44348. * info frame, show the source language: Show. (line 15)
  44349. * info frame-filter: Frame Filter Management.
  44350. (line 12)
  44351. * info functions: Symbols. (line 467)
  44352. * info handle: Signals. (line 33)
  44353. * info inferiors [ ID... ]: Inferiors Connections and Programs.
  44354. (line 27)
  44355. * info io_registers, AVR: AVR. (line 10)
  44356. * info line: Machine Code. (line 14)
  44357. * info line, and Objective-C: Method Names in Commands.
  44358. (line 9)
  44359. * info locals: Frame Info. (line 67)
  44360. * info macro: Macros. (line 47)
  44361. * info macros: Macros. (line 54)
  44362. * info mem: Memory Region Attributes.
  44363. (line 45)
  44364. * info meminfo: Process Information. (line 131)
  44365. * info module: Symbols. (line 555)
  44366. * info modules: Symbols. (line 547)
  44367. * info os: OS Information. (line 37)
  44368. * info os cpus: OS Information. (line 43)
  44369. * info os files: OS Information. (line 51)
  44370. * info os modules: OS Information. (line 57)
  44371. * info os msg: OS Information. (line 64)
  44372. * info os processes: OS Information. (line 75)
  44373. * info os procgroups: OS Information. (line 84)
  44374. * info os semaphores: OS Information. (line 94)
  44375. * info os shm: OS Information. (line 102)
  44376. * info os sockets: OS Information. (line 112)
  44377. * info os threads: OS Information. (line 119)
  44378. * info pidlist: Process Information. (line 127)
  44379. * info pretty-printer: Pretty-Printer Commands.
  44380. (line 6)
  44381. * info probes: Static Probe Points. (line 32)
  44382. * info proc: Process Information. (line 25)
  44383. * info program: Stopping. (line 18)
  44384. * info record: Process Record and Replay.
  44385. (line 323)
  44386. * info registers: Registers. (line 11)
  44387. * info scope: Symbols. (line 415)
  44388. * info selectors: Symbols. (line 576)
  44389. * info serial: DJGPP Native. (line 139)
  44390. * info set: Help. (line 149)
  44391. * info share: Files. (line 330)
  44392. * info sharedlibrary: Files. (line 330)
  44393. * info signals: Signals. (line 33)
  44394. * info skip: Skipping Over Functions and Files.
  44395. (line 113)
  44396. * info source: Symbols. (line 436)
  44397. * info source, show the source language: Show. (line 21)
  44398. * info sources: Symbols. (line 452)
  44399. * info stack: Backtrace. (line 94)
  44400. * info static-tracepoint-markers: Listing Static Tracepoint Markers.
  44401. (line 6)
  44402. * info symbol: Symbols. (line 95)
  44403. * info target: Files. (line 211)
  44404. * info task TASKNO: Ada Tasks. (line 88)
  44405. * info tasks: Ada Tasks. (line 9)
  44406. * info terminal: Input/Output. (line 12)
  44407. * info threads: Threads. (line 115)
  44408. * info tp [N...]: Listing Tracepoints. (line 6)
  44409. * info tracepoints [N...]: Listing Tracepoints. (line 6)
  44410. * info tvariables: Trace State Variables.
  44411. (line 37)
  44412. * info type-printers: Symbols. (line 403)
  44413. * info types: Symbols. (line 378)
  44414. * info variables: Symbols. (line 512)
  44415. * info vector: Vector Unit. (line 9)
  44416. * info w32: Cygwin Native. (line 19)
  44417. * info warranty: Help. (line 170)
  44418. * info watchpoints [LIST...]: Set Watchpoints. (line 87)
  44419. * info win: TUI Commands. (line 26)
  44420. * info-gdb-mi-command: GDB/MI Support Commands.
  44421. (line 99)
  44422. * init-if-undefined: Convenience Vars. (line 42)
  44423. * input-meta: Readline Init File Syntax.
  44424. (line 184)
  44425. * input-port: I/O Ports in Guile. (line 6)
  44426. * insert-comment (M-#): Miscellaneous Commands.
  44427. (line 61)
  44428. * insert-completions (M-*): Commands For Completion.
  44429. (line 18)
  44430. * inspect: Data. (line 6)
  44431. * instantiate on type_printer: Type Printing API. (line 22)
  44432. * Instruction.data: Recordings In Python.
  44433. (line 69)
  44434. * Instruction.decoded: Recordings In Python.
  44435. (line 73)
  44436. * Instruction.pc: Recordings In Python.
  44437. (line 66)
  44438. * Instruction.size: Recordings In Python.
  44439. (line 76)
  44440. * interpreter-exec: Interpreters. (line 39)
  44441. * interrupt: Background Execution.
  44442. (line 59)
  44443. * isearch-terminators: Readline Init File Syntax.
  44444. (line 192)
  44445. * iterator->list: Iterators In Guile. (line 83)
  44446. * iterator-filter: Iterators In Guile. (line 94)
  44447. * iterator-for-each: Iterators In Guile. (line 90)
  44448. * iterator-map: Iterators In Guile. (line 86)
  44449. * iterator-next!: Iterators In Guile. (line 63)
  44450. * iterator-object: Iterators In Guile. (line 53)
  44451. * iterator-progress: Iterators In Guile. (line 57)
  44452. * iterator-until: Iterators In Guile. (line 98)
  44453. * iterator?: Iterators In Guile. (line 49)
  44454. * j (jump): Jumping. (line 10)
  44455. * jit-reader-load: Using JIT Debug Info Readers.
  44456. (line 6)
  44457. * jit-reader-unload: Using JIT Debug Info Readers.
  44458. (line 6)
  44459. * jump: Jumping. (line 10)
  44460. * jump, and Objective-C: Method Names in Commands.
  44461. (line 9)
  44462. * KeyboardInterrupt: Exception Handling. (line 34)
  44463. * keymap: Readline Init File Syntax.
  44464. (line 199)
  44465. * kill: Kill Process. (line 6)
  44466. * kill inferiors INFNO...: Inferiors Connections and Programs.
  44467. (line 153)
  44468. * kill-line (C-k): Commands For Killing.
  44469. (line 6)
  44470. * kill-region (): Commands For Killing.
  44471. (line 41)
  44472. * kill-whole-line (): Commands For Killing.
  44473. (line 15)
  44474. * kill-word (M-d): Commands For Killing.
  44475. (line 19)
  44476. * kvm: BSD libkvm Interface.
  44477. (line 24)
  44478. * l (list): List. (line 6)
  44479. * language-option: GDB/MI Support Commands.
  44480. (line 96)
  44481. * layout: TUI Commands. (line 75)
  44482. * lazy-string->value: Lazy Strings In Guile.
  44483. (line 46)
  44484. * lazy-string-address: Lazy Strings In Guile.
  44485. (line 26)
  44486. * lazy-string-encoding: Lazy Strings In Guile.
  44487. (line 34)
  44488. * lazy-string-length: Lazy Strings In Guile.
  44489. (line 29)
  44490. * lazy-string-type: Lazy Strings In Guile.
  44491. (line 40)
  44492. * lazy-string?: Lazy Strings In Guile.
  44493. (line 22)
  44494. * LazyString.address: Lazy Strings In Python.
  44495. (line 26)
  44496. * LazyString.encoding: Lazy Strings In Python.
  44497. (line 36)
  44498. * LazyString.length: Lazy Strings In Python.
  44499. (line 30)
  44500. * LazyString.type: Lazy Strings In Python.
  44501. (line 43)
  44502. * LazyString.value: Lazy Strings In Python.
  44503. (line 20)
  44504. * Left: TUI Keys. (line 73)
  44505. * LineTable.has_line: Line Tables In Python.
  44506. (line 57)
  44507. * LineTable.line: Line Tables In Python.
  44508. (line 51)
  44509. * LineTable.source_lines: Line Tables In Python.
  44510. (line 62)
  44511. * LineTableEntry.line: Line Tables In Python.
  44512. (line 16)
  44513. * LineTableEntry.pc: Line Tables In Python.
  44514. (line 21)
  44515. * list: List. (line 6)
  44516. * list, and Objective-C: Method Names in Commands.
  44517. (line 9)
  44518. * load FILENAME OFFSET: Target Commands. (line 114)
  44519. * lookup-block: Blocks In Guile. (line 117)
  44520. * lookup-global-symbol: Symbols In Guile. (line 99)
  44521. * lookup-symbol: Symbols In Guile. (line 79)
  44522. * lookup-type: Types In Guile. (line 15)
  44523. * loop_break: Command Files. (line 93)
  44524. * loop_continue: Command Files. (line 97)
  44525. * macro define: Macros. (line 59)
  44526. * macro exp1: Macros. (line 36)
  44527. * macro expand: Macros. (line 29)
  44528. * macro list: Macros. (line 80)
  44529. * macro undef: Macros. (line 74)
  44530. * maint ada set ignore-descriptive-types: Ada Glitches. (line 73)
  44531. * maint ada show ignore-descriptive-types: Ada Glitches. (line 77)
  44532. * maint agent: Maintenance Commands.
  44533. (line 11)
  44534. * maint agent-eval: Maintenance Commands.
  44535. (line 11)
  44536. * maint agent-printf: Maintenance Commands.
  44537. (line 26)
  44538. * maint btrace clear: Maintenance Commands.
  44539. (line 99)
  44540. * maint btrace clear-packet-history: Maintenance Commands.
  44541. (line 94)
  44542. * maint btrace packet-history: Maintenance Commands.
  44543. (line 65)
  44544. * maint check libthread-db: Maintenance Commands.
  44545. (line 252)
  44546. * maint check xml-descriptions: Maintenance Commands.
  44547. (line 248)
  44548. * maint check-psymtabs: Maintenance Commands.
  44549. (line 134)
  44550. * maint check-symtabs: Maintenance Commands.
  44551. (line 139)
  44552. * maint cplus first_component: Maintenance Commands.
  44553. (line 154)
  44554. * maint cplus namespace: Maintenance Commands.
  44555. (line 157)
  44556. * maint demangler-warning: Maintenance Commands.
  44557. (line 173)
  44558. * maint deprecate: Maintenance Commands.
  44559. (line 160)
  44560. * maint dump-me: Maintenance Commands.
  44561. (line 168)
  44562. * maint expand-symtabs: Maintenance Commands.
  44563. (line 142)
  44564. * maint flush-symbol-cache: Symbols. (line 714)
  44565. * maint info bdccsr, S12Z: S12Z. (line 10)
  44566. * maint info bfds: File Caching. (line 10)
  44567. * maint info breakpoints: Maintenance Commands.
  44568. (line 32)
  44569. * maint info btrace: Maintenance Commands.
  44570. (line 62)
  44571. * maint info line-table: Symbols. (line 692)
  44572. * maint info program-spaces: Inferiors Connections and Programs.
  44573. (line 188)
  44574. * maint info psymtabs: Symbols. (line 645)
  44575. * maint info sections: Files. (line 220)
  44576. * maint info selftests: Maintenance Commands.
  44577. (line 380)
  44578. * maint info sol-threads: Threads. (line 167)
  44579. * maint info symtabs: Symbols. (line 645)
  44580. * maint internal-error: Maintenance Commands.
  44581. (line 173)
  44582. * maint internal-warning: Maintenance Commands.
  44583. (line 173)
  44584. * maint packet: Maintenance Commands.
  44585. (line 220)
  44586. * maint print arc arc-instruction: ARC. (line 17)
  44587. * maint print architecture: Maintenance Commands.
  44588. (line 226)
  44589. * maint print c-tdesc [FILE]: Maintenance Commands.
  44590. (line 230)
  44591. * maint print cooked-registers: Maintenance Commands.
  44592. (line 282)
  44593. * maint print core-file-backed-mappings: Maintenance Commands.
  44594. (line 260)
  44595. * maint print dummy-frames: Maintenance Commands.
  44596. (line 266)
  44597. * maint print msymbols: Symbols. (line 619)
  44598. * maint print objfiles: Maintenance Commands.
  44599. (line 320)
  44600. * maint print psymbols: Symbols. (line 619)
  44601. * maint print raw-registers: Maintenance Commands.
  44602. (line 282)
  44603. * maint print reggroups: Maintenance Commands.
  44604. (line 301)
  44605. * maint print register-groups: Maintenance Commands.
  44606. (line 282)
  44607. * maint print registers: Maintenance Commands.
  44608. (line 282)
  44609. * maint print remote-registers: Maintenance Commands.
  44610. (line 282)
  44611. * maint print section-scripts: Maintenance Commands.
  44612. (line 335)
  44613. * maint print statistics: Maintenance Commands.
  44614. (line 342)
  44615. * maint print symbol-cache: Symbols. (line 706)
  44616. * maint print symbol-cache-statistics: Symbols. (line 710)
  44617. * maint print symbols: Symbols. (line 619)
  44618. * maint print target-stack: Maintenance Commands.
  44619. (line 355)
  44620. * maint print type: Maintenance Commands.
  44621. (line 367)
  44622. * maint print unwind, HPPA: HPPA. (line 17)
  44623. * maint print user-registers: Maintenance Commands.
  44624. (line 326)
  44625. * maint print xml-tdesc: Maintenance Commands.
  44626. (line 240)
  44627. * maint selftest: Maintenance Commands.
  44628. (line 374)
  44629. * maint set bfd-sharing: File Caching. (line 14)
  44630. * maint set btrace pt skip-pad: Maintenance Commands.
  44631. (line 107)
  44632. * maint set catch-demangler-crashes: Maintenance Commands.
  44633. (line 146)
  44634. * maint set check-libthread-db: Maintenance Commands.
  44635. (line 560)
  44636. * maint set demangler-warning: Maintenance Commands.
  44637. (line 197)
  44638. * maint set dwarf always-disassemble: Maintenance Commands.
  44639. (line 383)
  44640. * maint set dwarf max-cache-age: Maintenance Commands.
  44641. (line 404)
  44642. * maint set dwarf unwinders: Maintenance Commands.
  44643. (line 418)
  44644. * maint set internal-error: Maintenance Commands.
  44645. (line 197)
  44646. * maint set internal-warning: Maintenance Commands.
  44647. (line 197)
  44648. * maint set per-command: Maintenance Commands.
  44649. (line 521)
  44650. * maint set profile: Maintenance Commands.
  44651. (line 452)
  44652. * maint set show-all-tib: Maintenance Commands.
  44653. (line 476)
  44654. * maint set show-debug-regs: Maintenance Commands.
  44655. (line 468)
  44656. * maint set symbol-cache-size: Symbols. (line 698)
  44657. * maint set target-async: Maintenance Commands.
  44658. (line 482)
  44659. * maint set target-non-stop MODE [on|off|auto]: Maintenance Commands.
  44660. (line 490)
  44661. * maint set test-settings: Maintenance Commands.
  44662. (line 609)
  44663. * maint set tui-resize-message: Maintenance Commands.
  44664. (line 510)
  44665. * maint set worker-threads: Maintenance Commands.
  44666. (line 441)
  44667. * maint show bfd-sharing: File Caching. (line 14)
  44668. * maint show btrace pt skip-pad: Maintenance Commands.
  44669. (line 108)
  44670. * maint show catch-demangler-crashes: Maintenance Commands.
  44671. (line 146)
  44672. * maint show check-libthread-db: Maintenance Commands.
  44673. (line 560)
  44674. * maint show demangler-warning: Maintenance Commands.
  44675. (line 197)
  44676. * maint show dwarf always-disassemble: Maintenance Commands.
  44677. (line 383)
  44678. * maint show dwarf max-cache-age: Maintenance Commands.
  44679. (line 404)
  44680. * maint show dwarf unwinders: Maintenance Commands.
  44681. (line 418)
  44682. * maint show internal-error: Maintenance Commands.
  44683. (line 197)
  44684. * maint show internal-warning: Maintenance Commands.
  44685. (line 197)
  44686. * maint show per-command: Maintenance Commands.
  44687. (line 521)
  44688. * maint show profile: Maintenance Commands.
  44689. (line 452)
  44690. * maint show show-all-tib: Maintenance Commands.
  44691. (line 476)
  44692. * maint show show-debug-regs: Maintenance Commands.
  44693. (line 468)
  44694. * maint show symbol-cache-size: Symbols. (line 703)
  44695. * maint show target-async: Maintenance Commands.
  44696. (line 482)
  44697. * maint show target-non-stop: Maintenance Commands.
  44698. (line 490)
  44699. * maint show test-options-completion-result: Maintenance Commands.
  44700. (line 604)
  44701. * maint show test-settings: Maintenance Commands.
  44702. (line 609)
  44703. * maint show tui-resize-message: Maintenance Commands.
  44704. (line 510)
  44705. * maint show worker-threads: Maintenance Commands.
  44706. (line 441)
  44707. * maint space: Maintenance Commands.
  44708. (line 569)
  44709. * maint test-options: Maintenance Commands.
  44710. (line 590)
  44711. * maint time: Maintenance Commands.
  44712. (line 573)
  44713. * maint translate-address: Maintenance Commands.
  44714. (line 577)
  44715. * maint undeprecate: Maintenance Commands.
  44716. (line 160)
  44717. * maint with: Maintenance Commands.
  44718. (line 615)
  44719. * make: Shell Commands. (line 22)
  44720. * make-block-symbols-iterator: Blocks In Guile. (line 105)
  44721. * make-breakpoint: Breakpoints In Guile.
  44722. (line 19)
  44723. * make-enum-hashtable: Guile Types Module. (line 37)
  44724. * make-exception: Guile Exception Handling.
  44725. (line 91)
  44726. * make-field-iterator: Types In Guile. (line 125)
  44727. * make-iterator: Iterators In Guile. (line 11)
  44728. * make-lazy-value: Values From Inferior In Guile.
  44729. (line 327)
  44730. * make-list-iterator: Iterators In Guile. (line 80)
  44731. * make-pretty-printer: Guile Pretty Printing API.
  44732. (line 15)
  44733. * make-pretty-printer-worker: Guile Pretty Printing API.
  44734. (line 42)
  44735. * make-value: Values From Inferior In Guile.
  44736. (line 45)
  44737. * mark-modified-lines: Readline Init File Syntax.
  44738. (line 229)
  44739. * mark-symlinked-directories: Readline Init File Syntax.
  44740. (line 234)
  44741. * match-hidden-files: Readline Init File Syntax.
  44742. (line 239)
  44743. * may-insert-breakpoints: Observer Mode. (line 50)
  44744. * may-insert-fast-tracepoints: Observer Mode. (line 69)
  44745. * may-insert-tracepoints: Observer Mode. (line 59)
  44746. * may-interrupt: Observer Mode. (line 79)
  44747. * may-write-memory: Observer Mode. (line 41)
  44748. * may-write-registers: Observer Mode. (line 32)
  44749. * mem: Memory Region Attributes.
  44750. (line 22)
  44751. * memory-port-range: Memory Ports in Guile.
  44752. (line 33)
  44753. * memory-port-read-buffer-size: Memory Ports in Guile.
  44754. (line 37)
  44755. * memory-port-write-buffer-size: Memory Ports in Guile.
  44756. (line 52)
  44757. * memory-port?: Memory Ports in Guile.
  44758. (line 29)
  44759. * MemoryChangedEvent.address: Events In Python. (line 161)
  44760. * MemoryChangedEvent.length: Events In Python. (line 164)
  44761. * memset: Bootstrapping. (line 70)
  44762. * menu-complete (): Commands For Completion.
  44763. (line 22)
  44764. * menu-complete-backward (): Commands For Completion.
  44765. (line 34)
  44766. * menu-complete-display-prefix: Readline Init File Syntax.
  44767. (line 246)
  44768. * meta-flag: Readline Init File Syntax.
  44769. (line 184)
  44770. * methods: Xmethod API. (line 22)
  44771. * monitor: Connecting. (line 279)
  44772. * n (next): Continuing and Stepping.
  44773. (line 77)
  44774. * n (SingleKey TUI key): TUI Single Key Mode. (line 19)
  44775. * name: Xmethod API. (line 15)
  44776. * name of type_printer: Type Printing API. (line 18)
  44777. * new-ui: Interpreters. (line 68)
  44778. * newest-frame: Frames In Guile. (line 160)
  44779. * NewInferiorEvent.inferior: Events In Python. (line 203)
  44780. * NewInferiorEvent.inferior <1>: Events In Python. (line 214)
  44781. * NewObjFileEvent.new_objfile: Events In Python. (line 115)
  44782. * NewThreadEvent.inferior_thread: Events In Python. (line 222)
  44783. * next: Continuing and Stepping.
  44784. (line 77)
  44785. * next&: Background Execution.
  44786. (line 34)
  44787. * next-history (C-n): Commands For History.
  44788. (line 16)
  44789. * next-screen-line (): Commands For Moving. (line 33)
  44790. * nexti: Continuing and Stepping.
  44791. (line 209)
  44792. * nexti&: Background Execution.
  44793. (line 37)
  44794. * ni (nexti): Continuing and Stepping.
  44795. (line 209)
  44796. * non-incremental-forward-search-history (M-n): Commands For History.
  44797. (line 40)
  44798. * non-incremental-reverse-search-history (M-p): Commands For History.
  44799. (line 34)
  44800. * nosharedlibrary: Files. (line 348)
  44801. * o (SingleKey TUI key): TUI Single Key Mode. (line 22)
  44802. * Objfile: Objfiles In Python. (line 6)
  44803. * objfile-filename: Objfiles In Guile. (line 28)
  44804. * objfile-pretty-printers: Objfiles In Guile. (line 36)
  44805. * objfile-progspace: Objfiles In Guile. (line 32)
  44806. * objfile-valid?: Objfiles In Guile. (line 21)
  44807. * Objfile.add_separate_debug_file: Objfiles In Python. (line 127)
  44808. * Objfile.build_id: Objfiles In Python. (line 69)
  44809. * Objfile.filename: Objfiles In Python. (line 49)
  44810. * Objfile.frame_filters: Objfiles In Python. (line 95)
  44811. * Objfile.is_valid: Objfiles In Python. (line 120)
  44812. * Objfile.lookup_global_symbol: Objfiles In Python. (line 136)
  44813. * Objfile.lookup_static_symbol: Objfiles In Python. (line 147)
  44814. * Objfile.owner: Objfiles In Python. (line 62)
  44815. * Objfile.pretty_printers: Objfiles In Python. (line 83)
  44816. * Objfile.progspace: Objfiles In Python. (line 79)
  44817. * Objfile.type_printers: Objfiles In Python. (line 91)
  44818. * Objfile.username: Objfiles In Python. (line 56)
  44819. * objfile?: Objfiles In Guile. (line 17)
  44820. * objfiles: Objfiles In Guile. (line 52)
  44821. * observer: Observer Mode. (line 22)
  44822. * open-memory: Memory Ports in Guile.
  44823. (line 11)
  44824. * output: Output. (line 35)
  44825. * output-meta: Readline Init File Syntax.
  44826. (line 251)
  44827. * output-port: I/O Ports in Guile. (line 9)
  44828. * overlay: Overlay Commands. (line 17)
  44829. * overload-choice annotation: Prompting. (line 32)
  44830. * overwrite-mode (): Commands For Text. (line 68)
  44831. * page-completions: Readline Init File Syntax.
  44832. (line 257)
  44833. * Parameter: Parameters In Python.
  44834. (line 6)
  44835. * Parameter <1>: Parameters In Guile. (line 6)
  44836. * parameter-value: Parameters In Guile. (line 103)
  44837. * Parameter.get_set_string: Parameters In Python.
  44838. (line 73)
  44839. * Parameter.get_show_string: Parameters In Python.
  44840. (line 102)
  44841. * Parameter.set_doc: Parameters In Python.
  44842. (line 53)
  44843. * Parameter.show_doc: Parameters In Python.
  44844. (line 59)
  44845. * Parameter.value: Parameters In Python.
  44846. (line 65)
  44847. * Parameter.__init__: Parameters In Python.
  44848. (line 18)
  44849. * parameter?: Parameters In Guile. (line 99)
  44850. * PARAM_AUTO_BOOLEAN: Parameters In Python.
  44851. (line 116)
  44852. * PARAM_AUTO_BOOLEAN <1>: Parameters In Guile. (line 120)
  44853. * PARAM_BOOLEAN: Parameters In Python.
  44854. (line 112)
  44855. * PARAM_BOOLEAN <1>: Parameters In Guile. (line 116)
  44856. * PARAM_ENUM: Parameters In Python.
  44857. (line 160)
  44858. * PARAM_ENUM <1>: Parameters In Guile. (line 156)
  44859. * PARAM_FILENAME: Parameters In Python.
  44860. (line 142)
  44861. * PARAM_FILENAME <1>: Parameters In Guile. (line 152)
  44862. * PARAM_INTEGER: Parameters In Python.
  44863. (line 125)
  44864. * PARAM_OPTIONAL_FILENAME: Parameters In Python.
  44865. (line 139)
  44866. * PARAM_OPTIONAL_FILENAME <1>: Parameters In Guile. (line 149)
  44867. * PARAM_STRING: Parameters In Python.
  44868. (line 129)
  44869. * PARAM_STRING <1>: Parameters In Guile. (line 139)
  44870. * PARAM_STRING_NOESCAPE: Parameters In Python.
  44871. (line 135)
  44872. * PARAM_STRING_NOESCAPE <1>: Parameters In Guile. (line 145)
  44873. * PARAM_UINTEGER: Parameters In Python.
  44874. (line 121)
  44875. * PARAM_UINTEGER <1>: Parameters In Guile. (line 125)
  44876. * PARAM_ZINTEGER: Parameters In Python.
  44877. (line 146)
  44878. * PARAM_ZINTEGER <1>: Parameters In Guile. (line 129)
  44879. * PARAM_ZUINTEGER: Parameters In Python.
  44880. (line 150)
  44881. * PARAM_ZUINTEGER <1>: Parameters In Guile. (line 132)
  44882. * PARAM_ZUINTEGER_UNLIMITED: Parameters In Python.
  44883. (line 155)
  44884. * PARAM_ZUINTEGER_UNLIMITED <1>: Parameters In Guile. (line 135)
  44885. * parse-and-eval: Basic Guile. (line 113)
  44886. * passcount: Tracepoint Passcounts.
  44887. (line 6)
  44888. * path: Environment. (line 14)
  44889. * pending-breakpoints: GDB/MI Support Commands.
  44890. (line 79)
  44891. * PendingFrame.architecture: Unwinding Frames in Python.
  44892. (line 99)
  44893. * PendingFrame.create_unwind_info: Unwinding Frames in Python.
  44894. (line 66)
  44895. * PendingFrame.read_register: Unwinding Frames in Python.
  44896. (line 42)
  44897. * PgDn: TUI Keys. (line 64)
  44898. * PgUp: TUI Keys. (line 61)
  44899. * pi: Python Commands. (line 9)
  44900. * pipe: Shell Commands. (line 26)
  44901. * po (print-object): The Print Command with Objective-C.
  44902. (line 6)
  44903. * possible-completions (M-?): Commands For Completion.
  44904. (line 11)
  44905. * post-commands annotation: Prompting. (line 27)
  44906. * post-overload-choice annotation: Prompting. (line 32)
  44907. * post-prompt annotation: Prompting. (line 24)
  44908. * post-prompt-for-continue annotation: Prompting. (line 40)
  44909. * post-query annotation: Prompting. (line 36)
  44910. * pre-commands annotation: Prompting. (line 27)
  44911. * pre-overload-choice annotation: Prompting. (line 32)
  44912. * pre-prompt annotation: Prompting. (line 24)
  44913. * pre-prompt-for-continue annotation: Prompting. (line 40)
  44914. * pre-query annotation: Prompting. (line 36)
  44915. * prefix-meta (<ESC>): Miscellaneous Commands.
  44916. (line 19)
  44917. * prepend-pretty-printer!: Guile Printing Module.
  44918. (line 13)
  44919. * pretty-printer-enabled?: Guile Pretty Printing API.
  44920. (line 28)
  44921. * pretty-printer?: Guile Pretty Printing API.
  44922. (line 24)
  44923. * pretty-printers: Guile Pretty Printing API.
  44924. (line 35)
  44925. * pretty_printer.children: Pretty Printing API. (line 10)
  44926. * pretty_printer.display_hint: Pretty Printing API. (line 32)
  44927. * pretty_printer.to_string: Pretty Printing API. (line 64)
  44928. * previous-history (C-p): Commands For History.
  44929. (line 12)
  44930. * previous-screen-line (): Commands For Moving. (line 26)
  44931. * print: Data. (line 6)
  44932. * print-last-kbd-macro (): Keyboard Macros. (line 17)
  44933. * print-object: The Print Command with Objective-C.
  44934. (line 6)
  44935. * printf: Output. (line 46)
  44936. * proc-trace-entry: Process Information. (line 123)
  44937. * proc-trace-exit: Process Information. (line 123)
  44938. * proc-untrace-entry: Process Information. (line 123)
  44939. * proc-untrace-exit: Process Information. (line 123)
  44940. * Progspace: Progspaces In Python.
  44941. (line 6)
  44942. * progspace-filename: Progspaces In Guile. (line 34)
  44943. * progspace-objfiles: Progspaces In Guile. (line 44)
  44944. * progspace-pretty-printers: Progspaces In Guile. (line 52)
  44945. * progspace-valid?: Progspaces In Guile. (line 21)
  44946. * Progspace.block_for_pc: Progspaces In Python.
  44947. (line 47)
  44948. * Progspace.block_for_pc <1>: Progspaces In Python.
  44949. (line 47)
  44950. * Progspace.filename: Progspaces In Python.
  44951. (line 26)
  44952. * Progspace.find_pc_line: Progspaces In Python.
  44953. (line 52)
  44954. * Progspace.find_pc_line <1>: Progspaces In Python.
  44955. (line 52)
  44956. * Progspace.frame_filters: Progspaces In Python.
  44957. (line 41)
  44958. * Progspace.is_valid: Progspaces In Python.
  44959. (line 59)
  44960. * Progspace.is_valid <1>: Progspaces In Python.
  44961. (line 59)
  44962. * Progspace.objfiles: Progspaces In Python.
  44963. (line 66)
  44964. * Progspace.objfiles <1>: Progspaces In Python.
  44965. (line 66)
  44966. * Progspace.pretty_printers: Progspaces In Python.
  44967. (line 29)
  44968. * Progspace.solib_name: Progspaces In Python.
  44969. (line 70)
  44970. * Progspace.solib_name <1>: Progspaces In Python.
  44971. (line 70)
  44972. * Progspace.type_printers: Progspaces In Python.
  44973. (line 37)
  44974. * progspace?: Progspaces In Guile. (line 17)
  44975. * progspaces: Progspaces In Guile. (line 31)
  44976. * prompt annotation: Prompting. (line 24)
  44977. * prompt-for-continue annotation: Prompting. (line 40)
  44978. * ptype: Symbols. (line 298)
  44979. * putDebugChar: Bootstrapping. (line 20)
  44980. * pwd: Working Directory. (line 40)
  44981. * py: Python Commands. (line 23)
  44982. * python: GDB/MI Support Commands.
  44983. (line 82)
  44984. * python <1>: Python Commands. (line 23)
  44985. * python-interactive: Python Commands. (line 9)
  44986. * q (quit): Quitting GDB. (line 6)
  44987. * q (SingleKey TUI key): TUI Single Key Mode. (line 25)
  44988. * query annotation: Prompting. (line 36)
  44989. * queue-signal: Signaling. (line 36)
  44990. * quit annotation: Errors. (line 6)
  44991. * quit [EXPRESSION]: Quitting GDB. (line 6)
  44992. * quoted-insert (C-q or C-v): Commands For Text. (line 26)
  44993. * r (run): Starting. (line 6)
  44994. * r (SingleKey TUI key): TUI Single Key Mode. (line 28)
  44995. * rbreak: Set Breaks. (line 90)
  44996. * rc (reverse-continue): Reverse Execution. (line 36)
  44997. * re-read-init-file (C-x C-r): Miscellaneous Commands.
  44998. (line 6)
  44999. * readnow: Files. (line 94)
  45000. * rec: Process Record and Replay.
  45001. (line 43)
  45002. * rec btrace: Process Record and Replay.
  45003. (line 43)
  45004. * rec btrace bts: Process Record and Replay.
  45005. (line 43)
  45006. * rec btrace pt: Process Record and Replay.
  45007. (line 43)
  45008. * rec bts: Process Record and Replay.
  45009. (line 43)
  45010. * rec del: Process Record and Replay.
  45011. (line 357)
  45012. * rec full: Process Record and Replay.
  45013. (line 43)
  45014. * rec function-call-history: Process Record and Replay.
  45015. (line 423)
  45016. * rec instruction-history: Process Record and Replay.
  45017. (line 363)
  45018. * rec pt: Process Record and Replay.
  45019. (line 43)
  45020. * rec s: Process Record and Replay.
  45021. (line 106)
  45022. * recognize on type_recognizer: Type Printing API. (line 42)
  45023. * record: Process Record and Replay.
  45024. (line 43)
  45025. * record btrace: Process Record and Replay.
  45026. (line 43)
  45027. * record btrace bts: Process Record and Replay.
  45028. (line 43)
  45029. * record btrace pt: Process Record and Replay.
  45030. (line 43)
  45031. * record bts: Process Record and Replay.
  45032. (line 43)
  45033. * record delete: Process Record and Replay.
  45034. (line 357)
  45035. * record full: Process Record and Replay.
  45036. (line 43)
  45037. * record function-call-history: Process Record and Replay.
  45038. (line 423)
  45039. * record goto: Process Record and Replay.
  45040. (line 129)
  45041. * record instruction-history: Process Record and Replay.
  45042. (line 363)
  45043. * record pt: Process Record and Replay.
  45044. (line 43)
  45045. * record restore: Process Record and Replay.
  45046. (line 150)
  45047. * record save: Process Record and Replay.
  45048. (line 143)
  45049. * record stop: Process Record and Replay.
  45050. (line 106)
  45051. * Record.begin: Recordings In Python.
  45052. (line 40)
  45053. * Record.end: Recordings In Python.
  45054. (line 44)
  45055. * Record.format: Recordings In Python.
  45056. (line 36)
  45057. * Record.function_call_history: Recordings In Python.
  45058. (line 55)
  45059. * Record.goto: Recordings In Python.
  45060. (line 60)
  45061. * Record.instruction_history: Recordings In Python.
  45062. (line 52)
  45063. * Record.method: Recordings In Python.
  45064. (line 32)
  45065. * Record.replay_position: Recordings In Python.
  45066. (line 48)
  45067. * RecordFunctionSegment.instructions: Recordings In Python.
  45068. (line 126)
  45069. * RecordFunctionSegment.level: Recordings In Python.
  45070. (line 122)
  45071. * RecordFunctionSegment.next: Recordings In Python.
  45072. (line 140)
  45073. * RecordFunctionSegment.number: Recordings In Python.
  45074. (line 113)
  45075. * RecordFunctionSegment.prev: Recordings In Python.
  45076. (line 136)
  45077. * RecordFunctionSegment.symbol: Recordings In Python.
  45078. (line 118)
  45079. * RecordFunctionSegment.up: Recordings In Python.
  45080. (line 130)
  45081. * RecordGap.error_code: Recordings In Python.
  45082. (line 104)
  45083. * RecordGap.error_string: Recordings In Python.
  45084. (line 108)
  45085. * RecordGap.number: Recordings In Python.
  45086. (line 99)
  45087. * RecordInstruction.is_speculative: Recordings In Python.
  45088. (line 91)
  45089. * RecordInstruction.number: Recordings In Python.
  45090. (line 81)
  45091. * RecordInstruction.sal: Recordings In Python.
  45092. (line 86)
  45093. * redraw-current-line (): Commands For Moving. (line 44)
  45094. * refresh: TUI Commands. (line 125)
  45095. * register-breakpoint!: Breakpoints In Guile.
  45096. (line 87)
  45097. * register-command!: Commands In Guile. (line 58)
  45098. * register-parameter!: Parameters In Guile. (line 94)
  45099. * RegisterChangedEvent.frame: Events In Python. (line 171)
  45100. * RegisterChangedEvent.regnum: Events In Python. (line 174)
  45101. * RegisterDescriptor.name: Registers In Python. (line 19)
  45102. * RegisterDescriptorIterator.find: Registers In Python. (line 25)
  45103. * RegisterGroup.name: Registers In Python. (line 48)
  45104. * register_xmethod_matcher: Xmethod API. (line 82)
  45105. * remote delete: File Transfer. (line 23)
  45106. * remote get: File Transfer. (line 19)
  45107. * remote put: File Transfer. (line 15)
  45108. * remove-inferiors: Inferiors Connections and Programs.
  45109. (line 137)
  45110. * remove-symbol-file: Files. (line 174)
  45111. * restart CHECKPOINT-ID: Checkpoint/Restart. (line 41)
  45112. * restore: Dump/Restore Files. (line 40)
  45113. * RET (repeat last command): Command Syntax. (line 21)
  45114. * return: Returning. (line 6)
  45115. * reverse-continue: Reverse Execution. (line 36)
  45116. * reverse-finish: Reverse Execution. (line 83)
  45117. * reverse-next: Reverse Execution. (line 66)
  45118. * reverse-nexti: Reverse Execution. (line 75)
  45119. * reverse-search: Search. (line 16)
  45120. * reverse-search-history (C-r): Commands For History.
  45121. (line 26)
  45122. * reverse-step: Reverse Execution. (line 43)
  45123. * reverse-stepi: Reverse Execution. (line 58)
  45124. * revert-all-at-newline: Readline Init File Syntax.
  45125. (line 267)
  45126. * revert-line (M-r): Miscellaneous Commands.
  45127. (line 26)
  45128. * Right: TUI Keys. (line 76)
  45129. * rn (reverse-next): Reverse Execution. (line 66)
  45130. * rni (reverse-nexti): Reverse Execution. (line 75)
  45131. * rs (step): Reverse Execution. (line 43)
  45132. * rsi (reverse-stepi): Reverse Execution. (line 58)
  45133. * run: Starting. (line 6)
  45134. * run&: Background Execution.
  45135. (line 21)
  45136. * rwatch: Set Watchpoints. (line 79)
  45137. * s (SingleKey TUI key): TUI Single Key Mode. (line 31)
  45138. * s (step): Continuing and Stepping.
  45139. (line 45)
  45140. * sal-last: Symbol Tables In Guile.
  45141. (line 68)
  45142. * sal-line: Symbol Tables In Guile.
  45143. (line 62)
  45144. * sal-pc: Symbol Tables In Guile.
  45145. (line 65)
  45146. * sal-symtab: Symbol Tables In Guile.
  45147. (line 59)
  45148. * sal-valid?: Symbol Tables In Guile.
  45149. (line 53)
  45150. * sal?: Symbol Tables In Guile.
  45151. (line 49)
  45152. * save breakpoints: Save Breakpoints. (line 9)
  45153. * save gdb-index: Index Files. (line 30)
  45154. * save tracepoints: save tracepoints. (line 6)
  45155. * save-tracepoints: save tracepoints. (line 6)
  45156. * search: Search. (line 9)
  45157. * section: Files. (line 203)
  45158. * select-frame: Selection. (line 98)
  45159. * selected-frame: Frames In Guile. (line 156)
  45160. * self: Commands In Guile. (line 100)
  45161. * self-insert (a, b, A, 1, !, ...): Commands For Text. (line 33)
  45162. * set: Help. (line 137)
  45163. * set ada print-signatures: Overloading support for Ada.
  45164. (line 31)
  45165. * set ada trust-PAD-over-XVS: Ada Glitches. (line 42)
  45166. * set agent off: In-Process Agent. (line 47)
  45167. * set agent on: In-Process Agent. (line 38)
  45168. * set annotate: Annotations Overview.
  45169. (line 29)
  45170. * set architecture: Targets. (line 21)
  45171. * set args: Arguments. (line 21)
  45172. * set arm: ARM. (line 9)
  45173. * set auto-connect-native-target: Starting. (line 168)
  45174. * set auto-load gdb-scripts: Auto-loading sequences.
  45175. (line 13)
  45176. * set auto-load guile-scripts: Guile Auto-loading. (line 17)
  45177. * set auto-load libthread-db: libthread_db.so.1 file.
  45178. (line 21)
  45179. * set auto-load local-gdbinit: Init File in the Current Directory.
  45180. (line 14)
  45181. * set auto-load off: Auto-loading. (line 32)
  45182. * set auto-load python-scripts: Python Auto-loading. (line 17)
  45183. * set auto-load safe-path: Auto-loading safe path.
  45184. (line 32)
  45185. * set auto-load scripts-directory: objfile-gdbdotext file.
  45186. (line 41)
  45187. * set auto-solib-add: Files. (line 307)
  45188. * set backtrace: Backtrace. (line 166)
  45189. * set basenames-may-differ: Files. (line 536)
  45190. * set breakpoint always-inserted: Set Breaks. (line 325)
  45191. * set breakpoint auto-hw: Set Breaks. (line 305)
  45192. * set breakpoint condition-evaluation: Set Breaks. (line 346)
  45193. * set breakpoint pending: Set Breaks. (line 275)
  45194. * set can-use-hw-watchpoints: Set Watchpoints. (line 116)
  45195. * set case-sensitive: Symbols. (line 27)
  45196. * set charset: Character Sets. (line 46)
  45197. * set check range: Range Checking. (line 34)
  45198. * set check type: Type Checking. (line 35)
  45199. * set circular-trace-buffer: Starting and Stopping Trace Experiments.
  45200. (line 93)
  45201. * set code-cache: Caching Target Data. (line 36)
  45202. * set coerce-float-to-double: ABI. (line 45)
  45203. * set com1base: DJGPP Native. (line 122)
  45204. * set com1irq: DJGPP Native. (line 122)
  45205. * set com2base: DJGPP Native. (line 122)
  45206. * set com2irq: DJGPP Native. (line 122)
  45207. * set com3base: DJGPP Native. (line 122)
  45208. * set com3irq: DJGPP Native. (line 122)
  45209. * set com4base: DJGPP Native. (line 122)
  45210. * set com4irq: DJGPP Native. (line 122)
  45211. * set complaints: Messages/Warnings. (line 29)
  45212. * set confirm: Messages/Warnings. (line 49)
  45213. * set cp-abi: ABI. (line 57)
  45214. * set cwd: Working Directory. (line 13)
  45215. * set cygwin-exceptions: Cygwin Native. (line 60)
  45216. * set data-directory: Data Files. (line 12)
  45217. * set dcache line-size: Caching Target Data. (line 60)
  45218. * set dcache size: Caching Target Data. (line 57)
  45219. * set debug: Debugging Output. (line 17)
  45220. * set debug aarch64: AArch64. (line 10)
  45221. * set debug arc: ARC. (line 9)
  45222. * set debug auto-load: Auto-loading verbose mode.
  45223. (line 27)
  45224. * set debug bfd-cache LEVEL: File Caching. (line 24)
  45225. * set debug darwin: Darwin. (line 9)
  45226. * set debug entry-values: Tail Call Frames. (line 47)
  45227. * set debug hppa: HPPA. (line 10)
  45228. * set debug libthread-db: Threads. (line 331)
  45229. * set debug mach-o: Darwin. (line 16)
  45230. * set debug mips: MIPS. (line 100)
  45231. * set debug monitor: Target Commands. (line 107)
  45232. * set debug nios2: Nios II. (line 10)
  45233. * set debug skip: Skipping Over Functions and Files.
  45234. (line 149)
  45235. * set debug-file-directory: Separate Debug Files.
  45236. (line 70)
  45237. * set debugevents: Cygwin Native. (line 89)
  45238. * set debugexceptions: Cygwin Native. (line 100)
  45239. * set debugexec: Cygwin Native. (line 96)
  45240. * set debugmemory: Cygwin Native. (line 104)
  45241. * set default-collect: Tracepoint Actions. (line 142)
  45242. * set demangle-style: Print Settings. (line 529)
  45243. * set detach-on-fork: Forks. (line 58)
  45244. * set directories: Source Path. (line 178)
  45245. * set disable-randomization: Starting. (line 212)
  45246. * set disassemble-next-line: Machine Code. (line 249)
  45247. * set disassembler-options: Machine Code. (line 222)
  45248. * set disassembly-flavor: Machine Code. (line 237)
  45249. * set disconnected-dprintf: Dynamic Printf. (line 83)
  45250. * set disconnected-tracing: Starting and Stopping Trace Experiments.
  45251. (line 55)
  45252. * set displaced-stepping: Maintenance Commands.
  45253. (line 112)
  45254. * set dump-excluded-mappings: Core File Generation.
  45255. (line 60)
  45256. * set editing: Editing. (line 15)
  45257. * set endian: Byte Order. (line 13)
  45258. * set environment: Environment. (line 39)
  45259. * set exceptions, Hurd command: Hurd Native. (line 39)
  45260. * set exec-direction: Reverse Execution. (line 89)
  45261. * set exec-done-display: Debugging Output. (line 11)
  45262. * set exec-wrapper: Starting. (line 120)
  45263. * set extended-prompt: Prompt. (line 25)
  45264. * set extension-language: Show. (line 30)
  45265. * set follow-exec-mode: Forks. (line 104)
  45266. * set follow-fork-mode: Forks. (line 39)
  45267. * set frame-filter priority: Frame Filter Management.
  45268. (line 84)
  45269. * set gnutarget: Target Commands. (line 28)
  45270. * set guile print-stack: Guile Exception Handling.
  45271. (line 6)
  45272. * set hash, for remote monitors: Target Commands. (line 98)
  45273. * set height: Screen Size. (line 22)
  45274. * set history expansion: Command History. (line 97)
  45275. * set history filename: Command History. (line 26)
  45276. * set history remove-duplicates: Command History. (line 69)
  45277. * set history save: Command History. (line 44)
  45278. * set history size: Command History. (line 56)
  45279. * set host-charset: Character Sets. (line 33)
  45280. * set index-cache: Index Files. (line 79)
  45281. * set inferior-tty: Input/Output. (line 49)
  45282. * set input-radix: Numbers. (line 14)
  45283. * set interactive-mode: Other Misc Settings. (line 6)
  45284. * set language: Manually. (line 9)
  45285. * set libthread-db-search-path: Threads. (line 293)
  45286. * set listsize: List. (line 33)
  45287. * set logging: Logging Output. (line 9)
  45288. * set mach-exceptions: Darwin. (line 27)
  45289. * set max-completions: Completion. (line 70)
  45290. * set max-user-call-depth: Define. (line 128)
  45291. * set max-value-size: Value Sizes. (line 12)
  45292. * set may-call-functions: Calling. (line 59)
  45293. * set mem inaccessible-by-default: Memory Region Attributes.
  45294. (line 123)
  45295. * set mips abi: MIPS. (line 32)
  45296. * set mips compression: MIPS. (line 49)
  45297. * set mips mask-address: MIPS. (line 80)
  45298. * set mipsfpu: MIPS Embedded. (line 13)
  45299. * set mpx bound: i386. (line 60)
  45300. * set multiple-symbols: Ambiguous Expressions.
  45301. (line 50)
  45302. * set new-console: Cygwin Native. (line 72)
  45303. * set new-group: Cygwin Native. (line 81)
  45304. * set non-stop: Non-Stop Mode. (line 35)
  45305. * set opaque-type-resolution: Symbols. (line 582)
  45306. * set osabi: ABI. (line 11)
  45307. * set output-radix: Numbers. (line 30)
  45308. * set overload-resolution: Debugging C Plus Plus.
  45309. (line 59)
  45310. * set pagination: Screen Size. (line 41)
  45311. * set powerpc: PowerPC Embedded. (line 51)
  45312. * set print: Print Settings. (line 11)
  45313. * set print entry-values: Print Settings. (line 214)
  45314. * set print finish: Continuing and Stepping.
  45315. (line 117)
  45316. * set print frame-arguments: Print Settings. (line 154)
  45317. * set print frame-info: Print Settings. (line 314)
  45318. * set print inferior-events: Inferiors Connections and Programs.
  45319. (line 167)
  45320. * set print symbol-loading: Symbols. (line 600)
  45321. * set print thread-events: Threads. (line 272)
  45322. * set print type methods: Symbols. (line 44)
  45323. * set print type nested-type-limit: Symbols. (line 57)
  45324. * set print type typedefs: Symbols. (line 68)
  45325. * set processor: Targets. (line 31)
  45326. * set procfs-file: Process Information. (line 112)
  45327. * set procfs-trace: Process Information. (line 106)
  45328. * set prompt: Prompt. (line 16)
  45329. * set python print-stack: Python Commands. (line 44)
  45330. * set radix: Numbers. (line 43)
  45331. * set range-stepping: Continuing and Stepping.
  45332. (line 228)
  45333. * set ravenscar task-switching off: Ravenscar Profile. (line 14)
  45334. * set ravenscar task-switching on: Ravenscar Profile. (line 10)
  45335. * set record: Process Record and Replay.
  45336. (line 413)
  45337. * set record btrace: Process Record and Replay.
  45338. (line 204)
  45339. * set record btrace bts: Process Record and Replay.
  45340. (line 277)
  45341. * set record btrace pt: Process Record and Replay.
  45342. (line 300)
  45343. * set record full: Process Record and Replay.
  45344. (line 154)
  45345. * set remote: Remote Configuration.
  45346. (line 6)
  45347. * set remote system-call-allowed: system. (line 37)
  45348. * set remote-mips64-transfers-32bit-regs: MIPS. (line 90)
  45349. * set remotecache: Caching Target Data. (line 20)
  45350. * set remoteflow: Remote Configuration.
  45351. (line 48)
  45352. * set schedule-multiple: All-Stop Mode. (line 67)
  45353. * set script-extension: Extending GDB. (line 29)
  45354. * set sh calling-convention: Super-H. (line 9)
  45355. * set shell: Cygwin Native. (line 108)
  45356. * set signal-thread: Hurd Native. (line 21)
  45357. * set signals, Hurd command: Hurd Native. (line 11)
  45358. * set sigs, Hurd command: Hurd Native. (line 11)
  45359. * set sigthread: Hurd Native. (line 21)
  45360. * set solib-absolute-prefix: Files. (line 386)
  45361. * set solib-search-path: Files. (line 462)
  45362. * set stack-cache: Caching Target Data. (line 28)
  45363. * set startup-with-shell: Starting. (line 145)
  45364. * set step-mode: Continuing and Stepping.
  45365. (line 91)
  45366. * set stop-on-solib-events: Files. (line 363)
  45367. * set stopped, Hurd command: Hurd Native. (line 31)
  45368. * set struct-convention: i386. (line 7)
  45369. * set style: Output Styling. (line 6)
  45370. * set substitute-path: Source Path. (line 185)
  45371. * set sysroot: Files. (line 386)
  45372. * set target-charset: Character Sets. (line 28)
  45373. * set target-file-system-kind (unix|dos-based|auto): Files. (line 476)
  45374. * set target-wide-charset: Character Sets. (line 61)
  45375. * set task, Hurd commands: Hurd Native. (line 48)
  45376. * set tcp: Remote Configuration.
  45377. (line 130)
  45378. * set thread, Hurd command: Hurd Native. (line 90)
  45379. * set trace-buffer-size: Starting and Stopping Trace Experiments.
  45380. (line 107)
  45381. * set trace-commands: Messages/Warnings. (line 65)
  45382. * set trace-notes: Starting and Stopping Trace Experiments.
  45383. (line 126)
  45384. * set trace-stop-notes: Starting and Stopping Trace Experiments.
  45385. (line 132)
  45386. * set trace-user: Starting and Stopping Trace Experiments.
  45387. (line 122)
  45388. * set trust-readonly-sections: Files. (line 265)
  45389. * set tui active-border-mode: TUI Configuration. (line 24)
  45390. * set tui border-kind: TUI Configuration. (line 9)
  45391. * set tui border-mode: TUI Configuration. (line 23)
  45392. * set tui compact-source: TUI Configuration. (line 54)
  45393. * set tui tab-width: TUI Configuration. (line 49)
  45394. * set unwind-on-terminating-exception: Calling. (line 47)
  45395. * set unwindonsignal: Calling. (line 36)
  45396. * set use-coredump-filter: Core File Generation.
  45397. (line 33)
  45398. * set variable: Assignment. (line 16)
  45399. * set varsize-limit: Ada Settings. (line 6)
  45400. * set verbose: Messages/Warnings. (line 15)
  45401. * set watchdog: Maintenance Commands.
  45402. (line 624)
  45403. * set width: Screen Size. (line 22)
  45404. * set write: Patching. (line 15)
  45405. * set-breakpoint-condition!: Breakpoints In Guile.
  45406. (line 198)
  45407. * set-breakpoint-enabled!: Breakpoints In Guile.
  45408. (line 147)
  45409. * set-breakpoint-hit-count!: Breakpoints In Guile.
  45410. (line 172)
  45411. * set-breakpoint-ignore-count!: Breakpoints In Guile.
  45412. (line 166)
  45413. * set-breakpoint-silent!: Breakpoints In Guile.
  45414. (line 158)
  45415. * set-breakpoint-stop!: Breakpoints In Guile.
  45416. (line 206)
  45417. * set-breakpoint-task!: Breakpoints In Guile.
  45418. (line 190)
  45419. * set-breakpoint-thread!: Breakpoints In Guile.
  45420. (line 180)
  45421. * set-iterator-progress!: Iterators In Guile. (line 60)
  45422. * set-mark (C-@): Miscellaneous Commands.
  45423. (line 33)
  45424. * set-memory-port-read-buffer-size!: Memory Ports in Guile.
  45425. (line 44)
  45426. * set-memory-port-write-buffer-size!: Memory Ports in Guile.
  45427. (line 59)
  45428. * set-objfile-pretty-printers!: Objfiles In Guile. (line 40)
  45429. * set-parameter-value!: Parameters In Guile. (line 107)
  45430. * set-pretty-printer-enabled!: Guile Pretty Printing API.
  45431. (line 31)
  45432. * set-pretty-printers!: Guile Pretty Printing API.
  45433. (line 38)
  45434. * set-progspace-pretty-printers!: Progspaces In Guile. (line 57)
  45435. * set_debug_traps: Stub Contents. (line 10)
  45436. * share: Files. (line 339)
  45437. * sharedlibrary: Files. (line 339)
  45438. * shell: Shell Commands. (line 10)
  45439. * show: Help. (line 142)
  45440. * show ada print-signatures: Overloading support for Ada.
  45441. (line 36)
  45442. * show ada trust-PAD-over-XVS: Ada Glitches. (line 42)
  45443. * show agent: In-Process Agent. (line 51)
  45444. * show annotate: Annotations Overview.
  45445. (line 34)
  45446. * show architecture: Targets. (line 21)
  45447. * show args: Arguments. (line 28)
  45448. * show arm: ARM. (line 13)
  45449. * show auto-load: Auto-loading. (line 45)
  45450. * show auto-load gdb-scripts: Auto-loading sequences.
  45451. (line 17)
  45452. * show auto-load guile-scripts: Guile Auto-loading. (line 20)
  45453. * show auto-load libthread-db: libthread_db.so.1 file.
  45454. (line 25)
  45455. * show auto-load local-gdbinit: Init File in the Current Directory.
  45456. (line 18)
  45457. * show auto-load python-scripts: Python Auto-loading. (line 20)
  45458. * show auto-load safe-path: Auto-loading safe path.
  45459. (line 46)
  45460. * show auto-load scripts-directory: objfile-gdbdotext file.
  45461. (line 65)
  45462. * show auto-solib-add: Files. (line 324)
  45463. * show backtrace: Backtrace. (line 173)
  45464. * show basenames-may-differ: Files. (line 539)
  45465. * show breakpoint always-inserted: Set Breaks. (line 325)
  45466. * show breakpoint auto-hw: Set Breaks. (line 305)
  45467. * show breakpoint condition-evaluation: Set Breaks. (line 346)
  45468. * show breakpoint pending: Set Breaks. (line 275)
  45469. * show can-use-hw-watchpoints: Set Watchpoints. (line 119)
  45470. * show case-sensitive: Symbols. (line 40)
  45471. * show charset: Character Sets. (line 52)
  45472. * show check range: Range Checking. (line 34)
  45473. * show check type: Type Checking. (line 35)
  45474. * show circular-trace-buffer: Starting and Stopping Trace Experiments.
  45475. (line 100)
  45476. * show code-cache: Caching Target Data. (line 42)
  45477. * show coerce-float-to-double: ABI. (line 54)
  45478. * show com1base: DJGPP Native. (line 134)
  45479. * show com1irq: DJGPP Native. (line 134)
  45480. * show com2base: DJGPP Native. (line 134)
  45481. * show com2irq: DJGPP Native. (line 134)
  45482. * show com3base: DJGPP Native. (line 134)
  45483. * show com3irq: DJGPP Native. (line 134)
  45484. * show com4base: DJGPP Native. (line 134)
  45485. * show com4irq: DJGPP Native. (line 134)
  45486. * show commands: Command History. (line 110)
  45487. * show complaints: Messages/Warnings. (line 35)
  45488. * show configuration: Help. (line 175)
  45489. * show confirm: Messages/Warnings. (line 57)
  45490. * show convenience: Convenience Vars. (line 37)
  45491. * show copying: Help. (line 166)
  45492. * show cp-abi: ABI. (line 57)
  45493. * show cwd: Working Directory. (line 27)
  45494. * show cygwin-exceptions: Cygwin Native. (line 68)
  45495. * show data-directory: Data Files. (line 16)
  45496. * show dcache line-size: Caching Target Data. (line 68)
  45497. * show dcache size: Caching Target Data. (line 64)
  45498. * show debug: Debugging Output. (line 20)
  45499. * show debug arc: ARC. (line 14)
  45500. * show debug auto-load: Auto-loading verbose mode.
  45501. (line 30)
  45502. * show debug bfd-cache: File Caching. (line 27)
  45503. * show debug darwin: Darwin. (line 13)
  45504. * show debug entry-values: Tail Call Frames. (line 55)
  45505. * show debug libthread-db: Threads. (line 331)
  45506. * show debug mach-o: Darwin. (line 23)
  45507. * show debug mips: MIPS. (line 104)
  45508. * show debug monitor: Target Commands. (line 111)
  45509. * show debug nios2: Nios II. (line 14)
  45510. * show debug skip: Skipping Over Functions and Files.
  45511. (line 153)
  45512. * show debug-file-directory: Separate Debug Files.
  45513. (line 75)
  45514. * show default-collect: Tracepoint Actions. (line 150)
  45515. * show detach-on-fork: Forks. (line 73)
  45516. * show directories: Source Path. (line 182)
  45517. * show disassemble-next-line: Machine Code. (line 249)
  45518. * show disassembler-options: Machine Code. (line 234)
  45519. * show disassembly-flavor: Machine Code. (line 246)
  45520. * show disconnected-dprintf: Dynamic Printf. (line 88)
  45521. * show disconnected-tracing: Starting and Stopping Trace Experiments.
  45522. (line 62)
  45523. * show displaced-stepping: Maintenance Commands.
  45524. (line 112)
  45525. * show editing: Editing. (line 22)
  45526. * show environment: Environment. (line 33)
  45527. * show exceptions, Hurd command: Hurd Native. (line 45)
  45528. * show exec-done-display: Debugging Output. (line 14)
  45529. * show extended-prompt: Prompt. (line 39)
  45530. * show follow-fork-mode: Forks. (line 52)
  45531. * show frame-filter priority: Frame Filter Management.
  45532. (line 91)
  45533. * show gnutarget: Target Commands. (line 40)
  45534. * show hash, for remote monitors: Target Commands. (line 104)
  45535. * show height: Screen Size. (line 22)
  45536. * show history: Command History. (line 102)
  45537. * show host-charset: Character Sets. (line 55)
  45538. * show index-cache: Index Files. (line 84)
  45539. * show inferior-tty: Input/Output. (line 54)
  45540. * show input-radix: Numbers. (line 35)
  45541. * show interactive-mode: Other Misc Settings. (line 20)
  45542. * show language: Show. (line 10)
  45543. * show libthread-db-search-path: Threads. (line 328)
  45544. * show listsize: List. (line 39)
  45545. * show logging: Logging Output. (line 26)
  45546. * show mach-exceptions: Darwin. (line 34)
  45547. * show max-completions: Completion. (line 78)
  45548. * show max-user-call-depth: Define. (line 128)
  45549. * show max-value-size: Value Sizes. (line 36)
  45550. * show may-call-functions: Calling. (line 73)
  45551. * show mem inaccessible-by-default: Memory Region Attributes.
  45552. (line 129)
  45553. * show mips abi: MIPS. (line 46)
  45554. * show mips compression: MIPS. (line 72)
  45555. * show mips mask-address: MIPS. (line 86)
  45556. * show mipsfpu: MIPS Embedded. (line 13)
  45557. * show mpx bound: i386. (line 57)
  45558. * show multiple-symbols: Ambiguous Expressions.
  45559. (line 70)
  45560. * show new-console: Cygwin Native. (line 77)
  45561. * show new-group: Cygwin Native. (line 86)
  45562. * show non-stop: Non-Stop Mode. (line 38)
  45563. * show opaque-type-resolution: Symbols. (line 597)
  45564. * show osabi: ABI. (line 11)
  45565. * show output-radix: Numbers. (line 38)
  45566. * show overload-resolution: Debugging C Plus Plus.
  45567. (line 76)
  45568. * show pagination: Screen Size. (line 47)
  45569. * show paths: Environment. (line 29)
  45570. * show print: Print Settings. (line 39)
  45571. * show print finish: Continuing and Stepping.
  45572. (line 117)
  45573. * show print inferior-events: Inferiors Connections and Programs.
  45574. (line 175)
  45575. * show print symbol-loading: Symbols. (line 615)
  45576. * show print thread-events: Threads. (line 282)
  45577. * show print type methods: Symbols. (line 53)
  45578. * show print type nested-type-limit: Symbols. (line 64)
  45579. * show print type typedefs: Symbols. (line 81)
  45580. * show processor: Targets. (line 31)
  45581. * show procfs-file: Process Information. (line 117)
  45582. * show procfs-trace: Process Information. (line 109)
  45583. * show prompt: Prompt. (line 19)
  45584. * show radix: Numbers. (line 43)
  45585. * show range-stepping: Continuing and Stepping.
  45586. (line 228)
  45587. * show ravenscar task-switching: Ravenscar Profile. (line 22)
  45588. * show record: Process Record and Replay.
  45589. (line 419)
  45590. * show record btrace: Process Record and Replay.
  45591. (line 270)
  45592. * show record full: Process Record and Replay.
  45593. (line 172)
  45594. * show remote: Remote Configuration.
  45595. (line 6)
  45596. * show remote system-call-allowed: system. (line 41)
  45597. * show remote-mips64-transfers-32bit-regs: MIPS. (line 96)
  45598. * show remotecache: Caching Target Data. (line 25)
  45599. * show remoteflow: Remote Configuration.
  45600. (line 52)
  45601. * show script-extension: Extending GDB. (line 29)
  45602. * show sh calling-convention: Super-H. (line 22)
  45603. * show shell: Cygwin Native. (line 112)
  45604. * show signal-thread: Hurd Native. (line 27)
  45605. * show signals, Hurd command: Hurd Native. (line 17)
  45606. * show sigs, Hurd command: Hurd Native. (line 17)
  45607. * show sigthread: Hurd Native. (line 27)
  45608. * show solib-search-path: Files. (line 473)
  45609. * show stack-cache: Caching Target Data. (line 33)
  45610. * show stop-on-solib-events: Files. (line 369)
  45611. * show stopped, Hurd command: Hurd Native. (line 36)
  45612. * show struct-convention: i386. (line 15)
  45613. * show style: Output Styling. (line 6)
  45614. * show substitute-path: Source Path. (line 222)
  45615. * show sysroot: Files. (line 459)
  45616. * show target-charset: Character Sets. (line 58)
  45617. * show target-file-system-kind: Files. (line 476)
  45618. * show target-wide-charset: Character Sets. (line 67)
  45619. * show task, Hurd commands: Hurd Native. (line 56)
  45620. * show tcp: Remote Configuration.
  45621. (line 130)
  45622. * show thread, Hurd command: Hurd Native. (line 100)
  45623. * show trace-buffer-size: Starting and Stopping Trace Experiments.
  45624. (line 114)
  45625. * show trace-notes: Starting and Stopping Trace Experiments.
  45626. (line 129)
  45627. * show trace-stop-notes: Starting and Stopping Trace Experiments.
  45628. (line 137)
  45629. * show trace-user: Starting and Stopping Trace Experiments.
  45630. (line 124)
  45631. * show unwind-on-terminating-exception: Calling. (line 55)
  45632. * show unwindonsignal: Calling. (line 43)
  45633. * show user: Define. (line 121)
  45634. * show values: Value History. (line 47)
  45635. * show varsize-limit: Ada Settings. (line 26)
  45636. * show verbose: Messages/Warnings. (line 21)
  45637. * show version: Help. (line 156)
  45638. * show warranty: Help. (line 170)
  45639. * show width: Screen Size. (line 22)
  45640. * show write: Patching. (line 26)
  45641. * show-all-if-ambiguous: Readline Init File Syntax.
  45642. (line 273)
  45643. * show-all-if-unmodified: Readline Init File Syntax.
  45644. (line 279)
  45645. * show-mode-in-prompt: Readline Init File Syntax.
  45646. (line 288)
  45647. * si (stepi): Continuing and Stepping.
  45648. (line 196)
  45649. * signal: Signaling. (line 6)
  45650. * signal annotation: Annotations for Running.
  45651. (line 42)
  45652. * signal-event: Cygwin Native. (line 35)
  45653. * signal-name annotation: Annotations for Running.
  45654. (line 22)
  45655. * signal-name-end annotation: Annotations for Running.
  45656. (line 22)
  45657. * signal-string annotation: Annotations for Running.
  45658. (line 22)
  45659. * signal-string-end annotation: Annotations for Running.
  45660. (line 22)
  45661. * SignalEvent.stop_signal: Events In Python. (line 91)
  45662. * signalled annotation: Annotations for Running.
  45663. (line 22)
  45664. * silent: Break Commands. (line 43)
  45665. * sim, a command: Embedded Processors. (line 13)
  45666. * skip: Skipping Over Functions and Files.
  45667. (line 44)
  45668. * skip delete: Skipping Over Functions and Files.
  45669. (line 137)
  45670. * skip disable: Skipping Over Functions and Files.
  45671. (line 145)
  45672. * skip enable: Skipping Over Functions and Files.
  45673. (line 141)
  45674. * skip file: Skipping Over Functions and Files.
  45675. (line 100)
  45676. * skip function: Skipping Over Functions and Files.
  45677. (line 89)
  45678. * skip-completed-text: Readline Init File Syntax.
  45679. (line 294)
  45680. * skip-csi-sequence (): Miscellaneous Commands.
  45681. (line 52)
  45682. * source: Command Files. (line 17)
  45683. * source annotation: Source Annotations. (line 6)
  45684. * start: Starting. (line 80)
  45685. * start-kbd-macro (C-x (): Keyboard Macros. (line 6)
  45686. * starti: Starting. (line 113)
  45687. * starting annotation: Annotations for Running.
  45688. (line 6)
  45689. * STDERR: Basic Python. (line 183)
  45690. * STDERR <1>: Basic Python. (line 203)
  45691. * stdio-port?: I/O Ports in Guile. (line 15)
  45692. * STDLOG: Basic Python. (line 186)
  45693. * STDLOG <1>: Basic Python. (line 206)
  45694. * STDOUT: Basic Python. (line 180)
  45695. * STDOUT <1>: Basic Python. (line 200)
  45696. * step: Continuing and Stepping.
  45697. (line 45)
  45698. * step&: Background Execution.
  45699. (line 28)
  45700. * stepi: Continuing and Stepping.
  45701. (line 196)
  45702. * stepi&: Background Execution.
  45703. (line 31)
  45704. * stop, a pseudo-command: Hooks. (line 21)
  45705. * stopping annotation: Annotations for Running.
  45706. (line 6)
  45707. * strace: Create and Delete Tracepoints.
  45708. (line 75)
  45709. * string->argv: Commands In Guile. (line 73)
  45710. * symbol-addr-class: Symbols In Guile. (line 48)
  45711. * symbol-argument?: Symbols In Guile. (line 58)
  45712. * symbol-constant?: Symbols In Guile. (line 62)
  45713. * symbol-file: Files. (line 45)
  45714. * symbol-function?: Symbols In Guile. (line 65)
  45715. * symbol-line: Symbols In Guile. (line 32)
  45716. * symbol-linkage-name: Symbols In Guile. (line 39)
  45717. * symbol-name: Symbols In Guile. (line 36)
  45718. * symbol-needs-frame?: Symbols In Guile. (line 53)
  45719. * symbol-print-name: Symbols In Guile. (line 43)
  45720. * symbol-symtab: Symbols In Guile. (line 28)
  45721. * symbol-type: Symbols In Guile. (line 24)
  45722. * symbol-valid?: Symbols In Guile. (line 17)
  45723. * symbol-value: Symbols In Guile. (line 72)
  45724. * symbol-variable?: Symbols In Guile. (line 69)
  45725. * Symbol.addr_class: Symbols In Python. (line 119)
  45726. * Symbol.is_argument: Symbols In Python. (line 129)
  45727. * Symbol.is_constant: Symbols In Python. (line 132)
  45728. * Symbol.is_function: Symbols In Python. (line 135)
  45729. * Symbol.is_valid: Symbols In Python. (line 143)
  45730. * Symbol.is_variable: Symbols In Python. (line 138)
  45731. * Symbol.line: Symbols In Python. (line 102)
  45732. * Symbol.linkage_name: Symbols In Python. (line 110)
  45733. * Symbol.name: Symbols In Python. (line 106)
  45734. * Symbol.needs_frame: Symbols In Python. (line 124)
  45735. * Symbol.print_name: Symbols In Python. (line 114)
  45736. * Symbol.symtab: Symbols In Python. (line 97)
  45737. * Symbol.type: Symbols In Python. (line 92)
  45738. * Symbol.value: Symbols In Python. (line 150)
  45739. * symbol?: Symbols In Guile. (line 13)
  45740. * SYMBOL_COMMON_BLOCK_DOMAIN: Symbols In Python. (line 178)
  45741. * SYMBOL_FUNCTIONS_DOMAIN: Symbols In Guile. (line 133)
  45742. * SYMBOL_LABEL_DOMAIN: Symbols In Python. (line 172)
  45743. * SYMBOL_LABEL_DOMAIN <1>: Symbols In Guile. (line 126)
  45744. * SYMBOL_LOC_ARG: Symbols In Python. (line 197)
  45745. * SYMBOL_LOC_ARG <1>: Symbols In Guile. (line 155)
  45746. * SYMBOL_LOC_BLOCK: Symbols In Python. (line 218)
  45747. * SYMBOL_LOC_BLOCK <1>: Symbols In Guile. (line 176)
  45748. * SYMBOL_LOC_COMPUTED: Symbols In Python. (line 232)
  45749. * SYMBOL_LOC_COMPUTED <1>: Symbols In Python. (line 235)
  45750. * SYMBOL_LOC_COMPUTED <2>: Symbols In Guile. (line 190)
  45751. * SYMBOL_LOC_CONST: Symbols In Python. (line 188)
  45752. * SYMBOL_LOC_CONST <1>: Symbols In Guile. (line 146)
  45753. * SYMBOL_LOC_CONST_BYTES: Symbols In Python. (line 221)
  45754. * SYMBOL_LOC_CONST_BYTES <1>: Symbols In Guile. (line 179)
  45755. * SYMBOL_LOC_LOCAL: Symbols In Python. (line 211)
  45756. * SYMBOL_LOC_LOCAL <1>: Symbols In Guile. (line 169)
  45757. * SYMBOL_LOC_OPTIMIZED_OUT: Symbols In Python. (line 229)
  45758. * SYMBOL_LOC_OPTIMIZED_OUT <1>: Symbols In Guile. (line 187)
  45759. * SYMBOL_LOC_REF_ARG: Symbols In Python. (line 201)
  45760. * SYMBOL_LOC_REF_ARG <1>: Symbols In Guile. (line 159)
  45761. * SYMBOL_LOC_REGISTER: Symbols In Python. (line 194)
  45762. * SYMBOL_LOC_REGISTER <1>: Symbols In Guile. (line 152)
  45763. * SYMBOL_LOC_REGPARM_ADDR: Symbols In Python. (line 206)
  45764. * SYMBOL_LOC_REGPARM_ADDR <1>: Symbols In Guile. (line 164)
  45765. * SYMBOL_LOC_STATIC: Symbols In Python. (line 191)
  45766. * SYMBOL_LOC_STATIC <1>: Symbols In Guile. (line 149)
  45767. * SYMBOL_LOC_TYPEDEF: Symbols In Python. (line 214)
  45768. * SYMBOL_LOC_TYPEDEF <1>: Symbols In Guile. (line 172)
  45769. * SYMBOL_LOC_UNDEF: Symbols In Python. (line 184)
  45770. * SYMBOL_LOC_UNDEF <1>: Symbols In Guile. (line 142)
  45771. * SYMBOL_LOC_UNRESOLVED: Symbols In Python. (line 224)
  45772. * SYMBOL_LOC_UNRESOLVED <1>: Symbols In Guile. (line 182)
  45773. * SYMBOL_MODULE_DOMAIN: Symbols In Python. (line 175)
  45774. * SYMBOL_STRUCT_DOMAIN: Symbols In Python. (line 169)
  45775. * SYMBOL_STRUCT_DOMAIN <1>: Symbols In Guile. (line 123)
  45776. * SYMBOL_TYPES_DOMAIN: Symbols In Guile. (line 136)
  45777. * SYMBOL_UNDEF_DOMAIN: Symbols In Python. (line 160)
  45778. * SYMBOL_UNDEF_DOMAIN <1>: Symbols In Guile. (line 114)
  45779. * SYMBOL_VARIABLES_DOMAIN: Symbols In Guile. (line 129)
  45780. * SYMBOL_VAR_DOMAIN: Symbols In Python. (line 165)
  45781. * SYMBOL_VAR_DOMAIN <1>: Symbols In Guile. (line 119)
  45782. * symtab-filename: Symbol Tables In Guile.
  45783. (line 28)
  45784. * symtab-fullname: Symbol Tables In Guile.
  45785. (line 31)
  45786. * symtab-global-block: Symbol Tables In Guile.
  45787. (line 38)
  45788. * symtab-objfile: Symbol Tables In Guile.
  45789. (line 34)
  45790. * symtab-static-block: Symbol Tables In Guile.
  45791. (line 42)
  45792. * symtab-valid?: Symbol Tables In Guile.
  45793. (line 21)
  45794. * Symtab.filename: Symbol Tables In Python.
  45795. (line 43)
  45796. * Symtab.fullname: Symbol Tables In Python.
  45797. (line 66)
  45798. * Symtab.global_block: Symbol Tables In Python.
  45799. (line 69)
  45800. * Symtab.is_valid: Symbol Tables In Python.
  45801. (line 59)
  45802. * Symtab.linetable: Symbol Tables In Python.
  45803. (line 77)
  45804. * Symtab.objfile: Symbol Tables In Python.
  45805. (line 47)
  45806. * Symtab.producer: Symbol Tables In Python.
  45807. (line 51)
  45808. * Symtab.static_block: Symbol Tables In Python.
  45809. (line 73)
  45810. * symtab?: Symbol Tables In Guile.
  45811. (line 17)
  45812. * Symtab_and_line.is_valid: Symbol Tables In Python.
  45813. (line 34)
  45814. * Symtab_and_line.last: Symbol Tables In Python.
  45815. (line 24)
  45816. * Symtab_and_line.line: Symbol Tables In Python.
  45817. (line 28)
  45818. * Symtab_and_line.pc: Symbol Tables In Python.
  45819. (line 20)
  45820. * Symtab_and_line.symtab: Symbol Tables In Python.
  45821. (line 16)
  45822. * sysinfo: DJGPP Native. (line 19)
  45823. * taas: Threads. (line 222)
  45824. * tab-insert (M-<TAB>): Commands For Text. (line 30)
  45825. * tabset: TUI Configuration. (line 49)
  45826. * target: Target Commands. (line 49)
  45827. * target ctf: Trace Files. (line 28)
  45828. * target record: Process Record and Replay.
  45829. (line 43)
  45830. * target record-btrace: Process Record and Replay.
  45831. (line 43)
  45832. * target record-full: Process Record and Replay.
  45833. (line 43)
  45834. * target sim: OpenRISC 1000. (line 13)
  45835. * target tfile: Trace Files. (line 28)
  45836. * target-config: Guile Configuration. (line 24)
  45837. * task (Ada): Ada Tasks. (line 105)
  45838. * tbreak: Set Breaks. (line 54)
  45839. * tcatch: Set Catchpoints. (line 298)
  45840. * tdump: tdump. (line 6)
  45841. * teval (tracepoints): Tracepoint Actions. (line 118)
  45842. * tfaas: Threads. (line 229)
  45843. * tfile: Trace Files. (line 28)
  45844. * tfind: tfind. (line 6)
  45845. * thbreak: Set Breaks. (line 80)
  45846. * this, inside C++ member functions: C Plus Plus Expressions.
  45847. (line 20)
  45848. * thread apply: Threads. (line 187)
  45849. * thread find: Threads. (line 258)
  45850. * thread name: Threads. (line 247)
  45851. * thread THREAD-ID: Threads. (line 169)
  45852. * thread-info: GDB/MI Support Commands.
  45853. (line 86)
  45854. * ThreadEvent.inferior_thread: Events In Python. (line 54)
  45855. * throw-user-error: Commands In Guile. (line 81)
  45856. * tilde-expand (M-~): Miscellaneous Commands.
  45857. (line 30)
  45858. * trace: Create and Delete Tracepoints.
  45859. (line 6)
  45860. * transpose-chars (C-t): Commands For Text. (line 45)
  45861. * transpose-words (M-t): Commands For Text. (line 51)
  45862. * tsave: Trace Files. (line 12)
  45863. * tstart [ NOTES ]: Starting and Stopping Trace Experiments.
  45864. (line 6)
  45865. * tstatus: Starting and Stopping Trace Experiments.
  45866. (line 27)
  45867. * tstop [ NOTES ]: Starting and Stopping Trace Experiments.
  45868. (line 16)
  45869. * tty: Input/Output. (line 23)
  45870. * tui disable: TUI Commands. (line 23)
  45871. * tui enable: TUI Commands. (line 18)
  45872. * tui new-layout: TUI Commands. (line 29)
  45873. * tui reg: TUI Commands. (line 128)
  45874. * TuiWindow.erase: TUI Windows In Python.
  45875. (line 44)
  45876. * TuiWindow.height: TUI Windows In Python.
  45877. (line 36)
  45878. * TuiWindow.is_valid: TUI Windows In Python.
  45879. (line 26)
  45880. * TuiWindow.title: TUI Windows In Python.
  45881. (line 39)
  45882. * TuiWindow.width: TUI Windows In Python.
  45883. (line 33)
  45884. * TuiWindow.write: TUI Windows In Python.
  45885. (line 47)
  45886. * tvariable: Trace State Variables.
  45887. (line 26)
  45888. * type-array: Types In Guile. (line 52)
  45889. * type-code: Types In Guile. (line 25)
  45890. * type-const: Types In Guile. (line 99)
  45891. * type-field: Types In Guile. (line 129)
  45892. * type-fields: Types In Guile. (line 115)
  45893. * type-has-field-deep?: Guile Types Module. (line 32)
  45894. * type-has-field?: Types In Guile. (line 142)
  45895. * type-name: Types In Guile. (line 34)
  45896. * type-num-fields: Types In Guile. (line 112)
  45897. * type-pointer: Types In Guile. (line 73)
  45898. * type-print-name: Types In Guile. (line 38)
  45899. * type-range: Types In Guile. (line 77)
  45900. * type-reference: Types In Guile. (line 81)
  45901. * type-sizeof: Types In Guile. (line 43)
  45902. * type-strip-typedefs: Types In Guile. (line 48)
  45903. * type-tag: Types In Guile. (line 29)
  45904. * type-target: Types In Guile. (line 85)
  45905. * type-unqualified: Types In Guile. (line 107)
  45906. * type-vector: Types In Guile. (line 60)
  45907. * type-volatile: Types In Guile. (line 103)
  45908. * Type.alignof: Types In Python. (line 32)
  45909. * Type.array: Types In Python. (line 138)
  45910. * Type.code: Types In Python. (line 38)
  45911. * Type.const: Types In Python. (line 159)
  45912. * Type.dynamic: Types In Python. (line 42)
  45913. * Type.fields: Types In Python. (line 85)
  45914. * Type.name: Types In Python. (line 62)
  45915. * Type.objfile: Types In Python. (line 79)
  45916. * Type.optimized_out: Types In Python. (line 216)
  45917. * Type.pointer: Types In Python. (line 182)
  45918. * Type.range: Types In Python. (line 172)
  45919. * Type.reference: Types In Python. (line 178)
  45920. * Type.sizeof: Types In Python. (line 66)
  45921. * Type.strip_typedefs: Types In Python. (line 186)
  45922. * Type.tag: Types In Python. (line 73)
  45923. * Type.target: Types In Python. (line 190)
  45924. * Type.template_argument: Types In Python. (line 204)
  45925. * Type.unqualified: Types In Python. (line 167)
  45926. * Type.vector: Types In Python. (line 146)
  45927. * Type.volatile: Types In Python. (line 163)
  45928. * type?: Types In Guile. (line 11)
  45929. * TYPE_CODE_ARRAY: Types In Python. (line 228)
  45930. * TYPE_CODE_ARRAY <1>: Types In Guile. (line 153)
  45931. * TYPE_CODE_BITSTRING: Types In Python. (line 266)
  45932. * TYPE_CODE_BITSTRING <1>: Types In Guile. (line 191)
  45933. * TYPE_CODE_BOOL: Types In Python. (line 290)
  45934. * TYPE_CODE_BOOL <1>: Types In Guile. (line 212)
  45935. * TYPE_CODE_CHAR: Types In Python. (line 287)
  45936. * TYPE_CODE_CHAR <1>: Types In Guile. (line 209)
  45937. * TYPE_CODE_COMPLEX: Types In Python. (line 293)
  45938. * TYPE_CODE_COMPLEX <1>: Types In Guile. (line 215)
  45939. * TYPE_CODE_DECFLOAT: Types In Python. (line 302)
  45940. * TYPE_CODE_DECFLOAT <1>: Types In Guile. (line 224)
  45941. * TYPE_CODE_ENUM: Types In Python. (line 237)
  45942. * TYPE_CODE_ENUM <1>: Types In Guile. (line 162)
  45943. * TYPE_CODE_ERROR: Types In Python. (line 269)
  45944. * TYPE_CODE_ERROR <1>: Types In Guile. (line 194)
  45945. * TYPE_CODE_FLAGS: Types In Python. (line 240)
  45946. * TYPE_CODE_FLAGS <1>: Types In Guile. (line 165)
  45947. * TYPE_CODE_FLT: Types In Python. (line 249)
  45948. * TYPE_CODE_FLT <1>: Types In Guile. (line 174)
  45949. * TYPE_CODE_FUNC: Types In Python. (line 243)
  45950. * TYPE_CODE_FUNC <1>: Types In Guile. (line 168)
  45951. * TYPE_CODE_INT: Types In Python. (line 246)
  45952. * TYPE_CODE_INT <1>: Types In Guile. (line 171)
  45953. * TYPE_CODE_INTERNAL_FUNCTION: Types In Python. (line 305)
  45954. * TYPE_CODE_INTERNAL_FUNCTION <1>: Types In Guile. (line 227)
  45955. * TYPE_CODE_MEMBERPTR: Types In Python. (line 278)
  45956. * TYPE_CODE_MEMBERPTR <1>: Types In Guile. (line 203)
  45957. * TYPE_CODE_METHOD: Types In Python. (line 272)
  45958. * TYPE_CODE_METHOD <1>: Types In Guile. (line 197)
  45959. * TYPE_CODE_METHODPTR: Types In Python. (line 275)
  45960. * TYPE_CODE_METHODPTR <1>: Types In Guile. (line 200)
  45961. * TYPE_CODE_NAMESPACE: Types In Python. (line 299)
  45962. * TYPE_CODE_NAMESPACE <1>: Types In Guile. (line 221)
  45963. * TYPE_CODE_PTR: Types In Python. (line 225)
  45964. * TYPE_CODE_PTR <1>: Types In Guile. (line 150)
  45965. * TYPE_CODE_RANGE: Types In Python. (line 258)
  45966. * TYPE_CODE_RANGE <1>: Types In Guile. (line 183)
  45967. * TYPE_CODE_REF: Types In Python. (line 281)
  45968. * TYPE_CODE_REF <1>: Types In Guile. (line 206)
  45969. * TYPE_CODE_RVALUE_REF: Types In Python. (line 284)
  45970. * TYPE_CODE_SET: Types In Python. (line 255)
  45971. * TYPE_CODE_SET <1>: Types In Guile. (line 180)
  45972. * TYPE_CODE_STRING: Types In Python. (line 261)
  45973. * TYPE_CODE_STRING <1>: Types In Guile. (line 186)
  45974. * TYPE_CODE_STRUCT: Types In Python. (line 231)
  45975. * TYPE_CODE_STRUCT <1>: Types In Guile. (line 156)
  45976. * TYPE_CODE_TYPEDEF: Types In Python. (line 296)
  45977. * TYPE_CODE_TYPEDEF <1>: Types In Guile. (line 218)
  45978. * TYPE_CODE_UNION: Types In Python. (line 234)
  45979. * TYPE_CODE_UNION <1>: Types In Guile. (line 159)
  45980. * TYPE_CODE_VOID: Types In Python. (line 252)
  45981. * TYPE_CODE_VOID <1>: Types In Guile. (line 177)
  45982. * u (SingleKey TUI key): TUI Single Key Mode. (line 37)
  45983. * u (until): Continuing and Stepping.
  45984. (line 124)
  45985. * undefined-command-error-code: GDB/MI Support Commands.
  45986. (line 101)
  45987. * undisplay: Auto Display. (line 45)
  45988. * undo (C-_ or C-x C-u): Miscellaneous Commands.
  45989. (line 23)
  45990. * universal-argument (): Numeric Arguments. (line 10)
  45991. * unix-filename-rubout (): Commands For Killing.
  45992. (line 32)
  45993. * unix-line-discard (C-u): Commands For Killing.
  45994. (line 12)
  45995. * unix-word-rubout (C-w): Commands For Killing.
  45996. (line 28)
  45997. * unset environment: Environment. (line 65)
  45998. * unset substitute-path: Source Path. (line 214)
  45999. * until: Continuing and Stepping.
  46000. (line 124)
  46001. * until&: Background Execution.
  46002. (line 46)
  46003. * unwind-stop-reason-string: Frames In Guile. (line 163)
  46004. * up: Selection. (line 69)
  46005. * Up: TUI Keys. (line 67)
  46006. * up-silently: Selection. (line 106)
  46007. * upcase-word (M-u): Commands For Text. (line 56)
  46008. * update: TUI Commands. (line 154)
  46009. * v (SingleKey TUI key): TUI Single Key Mode. (line 40)
  46010. * value->bool: Values From Inferior In Guile.
  46011. (line 234)
  46012. * value->bytevector: Values From Inferior In Guile.
  46013. (line 246)
  46014. * value->integer: Values From Inferior In Guile.
  46015. (line 238)
  46016. * value->lazy-string: Values From Inferior In Guile.
  46017. (line 291)
  46018. * value->real: Values From Inferior In Guile.
  46019. (line 242)
  46020. * value->string: Values From Inferior In Guile.
  46021. (line 250)
  46022. * value-abs: Arithmetic In Guile. (line 35)
  46023. * value-add: Arithmetic In Guile. (line 15)
  46024. * value-address: Values From Inferior In Guile.
  46025. (line 106)
  46026. * value-call: Values From Inferior In Guile.
  46027. (line 228)
  46028. * value-cast: Values From Inferior In Guile.
  46029. (line 129)
  46030. * value-dereference: Values From Inferior In Guile.
  46031. (line 143)
  46032. * value-div: Arithmetic In Guile. (line 21)
  46033. * value-dynamic-cast: Values From Inferior In Guile.
  46034. (line 135)
  46035. * value-dynamic-type: Values From Inferior In Guile.
  46036. (line 114)
  46037. * value-fetch-lazy!: Values From Inferior In Guile.
  46038. (line 333)
  46039. * value-field: Values From Inferior In Guile.
  46040. (line 221)
  46041. * value-lazy?: Values From Inferior In Guile.
  46042. (line 316)
  46043. * value-logand: Arithmetic In Guile. (line 47)
  46044. * value-logior: Arithmetic In Guile. (line 49)
  46045. * value-lognot: Arithmetic In Guile. (line 45)
  46046. * value-logxor: Arithmetic In Guile. (line 51)
  46047. * value-lsh: Arithmetic In Guile. (line 37)
  46048. * value-max: Arithmetic In Guile. (line 43)
  46049. * value-min: Arithmetic In Guile. (line 41)
  46050. * value-mod: Arithmetic In Guile. (line 25)
  46051. * value-mul: Arithmetic In Guile. (line 19)
  46052. * value-neg: Arithmetic In Guile. (line 31)
  46053. * value-not: Arithmetic In Guile. (line 29)
  46054. * value-optimized-out?: Values From Inferior In Guile.
  46055. (line 102)
  46056. * value-pos: Arithmetic In Guile. (line 33)
  46057. * value-pow: Arithmetic In Guile. (line 27)
  46058. * value-print: Values From Inferior In Guile.
  46059. (line 342)
  46060. * value-referenced-value: Values From Inferior In Guile.
  46061. (line 196)
  46062. * value-reinterpret-cast: Values From Inferior In Guile.
  46063. (line 139)
  46064. * value-rem: Arithmetic In Guile. (line 23)
  46065. * value-rsh: Arithmetic In Guile. (line 39)
  46066. * value-sub: Arithmetic In Guile. (line 17)
  46067. * value-subscript: Values From Inferior In Guile.
  46068. (line 224)
  46069. * value-type: Values From Inferior In Guile.
  46070. (line 110)
  46071. * Value.address: Values From Inferior.
  46072. (line 65)
  46073. * Value.cast: Values From Inferior.
  46074. (line 148)
  46075. * Value.const_value: Values From Inferior.
  46076. (line 236)
  46077. * Value.dereference: Values From Inferior.
  46078. (line 154)
  46079. * Value.dynamic_cast: Values From Inferior.
  46080. (line 240)
  46081. * Value.dynamic_type: Values From Inferior.
  46082. (line 79)
  46083. * Value.fetch_lazy: Values From Inferior.
  46084. (line 386)
  46085. * Value.format_string: Values From Inferior.
  46086. (line 248)
  46087. * Value.is_lazy: Values From Inferior.
  46088. (line 94)
  46089. * Value.is_optimized_out: Values From Inferior.
  46090. (line 70)
  46091. * Value.lazy_string: Values From Inferior.
  46092. (line 364)
  46093. * Value.referenced_value: Values From Inferior.
  46094. (line 207)
  46095. * Value.reference_value: Values From Inferior.
  46096. (line 232)
  46097. * Value.reinterpret_cast: Values From Inferior.
  46098. (line 244)
  46099. * Value.string: Values From Inferior.
  46100. (line 332)
  46101. * Value.type: Values From Inferior.
  46102. (line 75)
  46103. * Value.__init__: Values From Inferior.
  46104. (line 107)
  46105. * Value.__init__ <1>: Values From Inferior.
  46106. (line 141)
  46107. * value<=?: Arithmetic In Guile. (line 57)
  46108. * value<?: Arithmetic In Guile. (line 55)
  46109. * value=?: Arithmetic In Guile. (line 53)
  46110. * value>=?: Arithmetic In Guile. (line 61)
  46111. * value>?: Arithmetic In Guile. (line 59)
  46112. * value?: Values From Inferior In Guile.
  46113. (line 41)
  46114. * vi-cmd-mode-string: Readline Init File Syntax.
  46115. (line 307)
  46116. * vi-editing-mode (M-C-j): Miscellaneous Commands.
  46117. (line 92)
  46118. * vi-ins-mode-string: Readline Init File Syntax.
  46119. (line 318)
  46120. * visible-stats: Readline Init File Syntax.
  46121. (line 329)
  46122. * w (SingleKey TUI key): TUI Single Key Mode. (line 43)
  46123. * w (with): Command Settings. (line 39)
  46124. * watch: Set Watchpoints. (line 42)
  46125. * watchpoint annotation: Annotations for Running.
  46126. (line 50)
  46127. * whatis: Symbols. (line 125)
  46128. * where: Backtrace. (line 94)
  46129. * while: Command Files. (line 85)
  46130. * while-stepping (tracepoints): Tracepoint Actions. (line 126)
  46131. * Window.close: TUI Windows In Python.
  46132. (line 62)
  46133. * Window.hscroll: TUI Windows In Python.
  46134. (line 81)
  46135. * Window.render: TUI Windows In Python.
  46136. (line 71)
  46137. * Window.vscroll: TUI Windows In Python.
  46138. (line 88)
  46139. * winheight: TUI Commands. (line 158)
  46140. * with command: Command Settings. (line 39)
  46141. * WP_ACCESS: Breakpoints In Python.
  46142. (line 86)
  46143. * WP_ACCESS <1>: Breakpoints In Guile.
  46144. (line 84)
  46145. * WP_READ: Breakpoints In Python.
  46146. (line 80)
  46147. * WP_READ <1>: Breakpoints In Guile.
  46148. (line 78)
  46149. * WP_WRITE: Breakpoints In Python.
  46150. (line 83)
  46151. * WP_WRITE <1>: Breakpoints In Guile.
  46152. (line 81)
  46153. * x (examine memory): Memory. (line 9)
  46154. * x(examine), and info line: Machine Code. (line 34)
  46155. * XMethod.__init__: Xmethod API. (line 38)
  46156. * XMethodMatcher.match: Xmethod API. (line 47)
  46157. * XMethodMatcher.__init__: Xmethod API. (line 43)
  46158. * XMethodWorker.get_arg_types: Xmethod API. (line 60)
  46159. * XMethodWorker.get_result_type: Xmethod API. (line 67)
  46160. * XMethodWorker.__call__: Xmethod API. (line 73)
  46161. * yank (C-y): Commands For Killing.
  46162. (line 59)
  46163. * yank-last-arg (M-. or M-_): Commands For History.
  46164. (line 79)
  46165. * yank-nth-arg (M-C-y): Commands For History.
  46166. (line 70)
  46167. * yank-pop (M-y): Commands For Killing.
  46168. (line 62)
  46169. 
  46170. Tag Table:
  46171. Node: Top1701
  46172. Node: Summary5144
  46173. Node: Free Software7005
  46174. Node: Free Documentation7745
  46175. Node: Contributors12679
  46176. Node: Sample Session21710
  46177. Node: Invocation28547
  46178. Node: Invoking GDB29090
  46179. Node: File Options31432
  46180. Ref: --readnever34503
  46181. Node: Mode Options34977
  46182. Ref: -nx35204
  46183. Ref: -nh36961
  46184. Node: Startup43285
  46185. Ref: Home Directory Init File44131
  46186. Ref: Option -init-eval-command44241
  46187. Ref: Init File in the Current Directory during Startup44581
  46188. Ref: Startup-Footnote-146777
  46189. Node: Quitting GDB46886
  46190. Node: Shell Commands47783
  46191. Ref: pipe48775
  46192. Node: Logging Output50289
  46193. Node: Commands51415
  46194. Node: Command Syntax52280
  46195. Node: Command Settings54452
  46196. Node: Completion57465
  46197. Ref: Completion-Footnote-164405
  46198. Node: Command Options64565
  46199. Node: Command aliases default args66941
  46200. Ref: Command aliases default args-Footnote-170394
  46201. Node: Help70548
  46202. Node: Running77622
  46203. Node: Compilation78875
  46204. Node: Starting80954
  46205. Ref: set exec-wrapper86744
  46206. Ref: set startup-with-shell87833
  46207. Ref: set auto-connect-native-target88894
  46208. Node: Arguments93365
  46209. Node: Environment94634
  46210. Ref: set environment96516
  46211. Ref: unset environment97698
  46212. Node: Working Directory98704
  46213. Ref: set cwd command99276
  46214. Ref: cd command100216
  46215. Node: Input/Output100910
  46216. Node: Attach102970
  46217. Ref: set exec-file-mismatch104187
  46218. Node: Kill Process106323
  46219. Node: Inferiors Connections and Programs107316
  46220. Node: Threads117138
  46221. Ref: thread numbers119261
  46222. Ref: thread ID lists120151
  46223. Ref: global thread numbers121191
  46224. Ref: thread apply all125047
  46225. Ref: set libthread-db-search-path129897
  46226. Node: Forks131951
  46227. Node: Checkpoint/Restart138517
  46228. Ref: Checkpoint/Restart-Footnote-1143045
  46229. Node: Stopping143080
  46230. Node: Breakpoints144343
  46231. Node: Set Breaks147600
  46232. Node: Set Watchpoints166559
  46233. Node: Set Catchpoints175941
  46234. Ref: catch syscall181439
  46235. Node: Delete Breaks189204
  46236. Node: Disabling191140
  46237. Node: Conditions194520
  46238. Node: Break Commands200167
  46239. Node: Dynamic Printf203387
  46240. Node: Save Breakpoints207691
  46241. Node: Static Probe Points208866
  46242. Ref: Static Probe Points-Footnote-1213044
  46243. Ref: Static Probe Points-Footnote-2213204
  46244. Node: Error in Breakpoints213344
  46245. Node: Breakpoint-related Warnings214080
  46246. Node: Continuing and Stepping216407
  46247. Ref: range stepping226187
  46248. Node: Skipping Over Functions and Files227267
  46249. Node: Signals233116
  46250. Ref: stepping and signal handlers237550
  46251. Ref: stepping into signal handlers238346
  46252. Ref: extra signal information239579
  46253. Node: Thread Stops242045
  46254. Node: All-Stop Mode243144
  46255. Node: Non-Stop Mode247111
  46256. Node: Background Execution250524
  46257. Node: Thread-Specific Breakpoints252740
  46258. Node: Interrupted System Calls254756
  46259. Node: Observer Mode256270
  46260. Node: Reverse Execution259706
  46261. Ref: Reverse Execution-Footnote-1264624
  46262. Ref: Reverse Execution-Footnote-2265251
  46263. Node: Process Record and Replay265301
  46264. Node: Stack286690
  46265. Node: Frames288307
  46266. Node: Backtrace290645
  46267. Ref: backtrace-command290982
  46268. Ref: set backtrace past-main297429
  46269. Ref: set backtrace past-entry297757
  46270. Ref: set backtrace limit298324
  46271. Ref: Backtrace-Footnote-1298948
  46272. Node: Selection299136
  46273. Node: Frame Info303919
  46274. Node: Frame Apply308341
  46275. Node: Frame Filter Management312771
  46276. Ref: disable frame-filter all313299
  46277. Node: Source317607
  46278. Node: List318673
  46279. Node: Specify Location321375
  46280. Node: Linespec Locations321996
  46281. Node: Explicit Locations325395
  46282. Node: Address Locations328607
  46283. Node: Edit330358
  46284. Ref: Edit-Footnote-1331834
  46285. Node: Search332069
  46286. Node: Source Path332877
  46287. Ref: set substitute-path341818
  46288. Node: Machine Code344038
  46289. Node: Data354382
  46290. Ref: print options355221
  46291. Node: Expressions365222
  46292. Node: Ambiguous Expressions367325
  46293. Node: Variables370555
  46294. Node: Arrays377153
  46295. Node: Output Formats379684
  46296. Ref: Output Formats-Footnote-1383057
  46297. Node: Memory383214
  46298. Ref: addressable memory unit389399
  46299. Node: Auto Display390893
  46300. Node: Print Settings395435
  46301. Ref: set print address395733
  46302. Ref: set print symbol399395
  46303. Ref: set print array399883
  46304. Ref: set print array-indexes400211
  46305. Ref: set print elements400697
  46306. Ref: set print frame-arguments401362
  46307. Ref: set print raw-frame-arguments403531
  46308. Ref: set print entry-values403947
  46309. Ref: set print frame-info408326
  46310. Ref: set print repeats409992
  46311. Ref: set print max-depth410634
  46312. Ref: set print null-stop412326
  46313. Ref: set print pretty412650
  46314. Ref: set print raw-values413237
  46315. Ref: set print union414254
  46316. Ref: set print object416560
  46317. Ref: set print static-members417354
  46318. Ref: set print vtbl418031
  46319. Node: Pretty Printing418415
  46320. Node: Pretty-Printer Introduction418929
  46321. Node: Pretty-Printer Example420684
  46322. Node: Pretty-Printer Commands421462
  46323. Node: Value History424393
  46324. Node: Convenience Vars426815
  46325. Node: Convenience Funs434486
  46326. Node: Registers443001
  46327. Ref: info_registers_reggroup443658
  46328. Ref: standard registers444209
  46329. Ref: Registers-Footnote-1449160
  46330. Node: Floating Point Hardware449555
  46331. Node: Vector Unit450087
  46332. Node: OS Information450474
  46333. Ref: linux info os infotypes452498
  46334. Node: Memory Region Attributes457089
  46335. Node: Dump/Restore Files461753
  46336. Node: Core File Generation464156
  46337. Ref: set use-coredump-filter465716
  46338. Ref: set dump-excluded-mappings467164
  46339. Node: Character Sets467446
  46340. Node: Caching Target Data473811
  46341. Ref: Caching Target Data-Footnote-1476551
  46342. Node: Searching Memory476789
  46343. Node: Value Sizes479932
  46344. Node: Optimized Code481584
  46345. Node: Inline Functions483261
  46346. Node: Tail Call Frames485888
  46347. Ref: set debug entry-values488025
  46348. Node: Macros492089
  46349. Ref: Macros-Footnote-1499665
  46350. Node: Tracepoints499818
  46351. Node: Set Tracepoints501880
  46352. Node: Create and Delete Tracepoints504818
  46353. Node: Enable and Disable Tracepoints511166
  46354. Node: Tracepoint Passcounts512406
  46355. Node: Tracepoint Conditions513817
  46356. Node: Trace State Variables515511
  46357. Node: Tracepoint Actions517706
  46358. Node: Listing Tracepoints524489
  46359. Node: Listing Static Tracepoint Markers526191
  46360. Node: Starting and Stopping Trace Experiments528039
  46361. Ref: disconnected tracing529784
  46362. Node: Tracepoint Restrictions534204
  46363. Node: Analyze Collected Data537973
  46364. Node: tfind539279
  46365. Node: tdump543761
  46366. Node: save tracepoints546276
  46367. Node: Tracepoint Variables546772
  46368. Node: Trace Files547900
  46369. Node: Overlays550276
  46370. Node: How Overlays Work550996
  46371. Ref: A code overlay553531
  46372. Node: Overlay Commands556964
  46373. Node: Automatic Overlay Debugging561146
  46374. Node: Overlay Sample Program563285
  46375. Node: Languages565022
  46376. Node: Setting566185
  46377. Node: Filenames567886
  46378. Node: Manually568697
  46379. Node: Automatically569906
  46380. Node: Show570967
  46381. Ref: show language571255
  46382. Node: Checks572289
  46383. Node: Type Checking573294
  46384. Node: Range Checking575123
  46385. Node: Supported Languages577524
  46386. Node: C578861
  46387. Node: C Operators579825
  46388. Node: C Constants584164
  46389. Node: C Plus Plus Expressions587043
  46390. Node: C Defaults590403
  46391. Node: C Checks591071
  46392. Node: Debugging C591631
  46393. Node: Debugging C Plus Plus592115
  46394. Node: Decimal Floating Point597002
  46395. Node: D598272
  46396. Node: Go598530
  46397. Node: Objective-C599624
  46398. Node: Method Names in Commands600087
  46399. Node: The Print Command with Objective-C601778
  46400. Node: OpenCL C602429
  46401. Node: OpenCL C Datatypes602704
  46402. Node: OpenCL C Expressions603079
  46403. Node: OpenCL C Operators603436
  46404. Node: Fortran603668
  46405. Node: Fortran Operators604389
  46406. Node: Fortran Defaults605434
  46407. Node: Special Fortran Commands605819
  46408. Node: Pascal606325
  46409. Node: Rust606836
  46410. Node: Modula-2609923
  46411. Node: M2 Operators610896
  46412. Node: Built-In Func/Proc613894
  46413. Node: M2 Constants616808
  46414. Node: M2 Types618409
  46415. Node: M2 Defaults621627
  46416. Node: Deviations622228
  46417. Node: M2 Checks623329
  46418. Node: M2 Scope624146
  46419. Node: GDB/M2625170
  46420. Node: Ada626083
  46421. Node: Ada Mode Intro627389
  46422. Node: Omissions from Ada628891
  46423. Node: Additions to Ada633246
  46424. Node: Overloading support for Ada637174
  46425. Node: Stopping Before Main Program638814
  46426. Node: Ada Exceptions639361
  46427. Node: Ada Tasks640560
  46428. Node: Ada Tasks and Core Files647051
  46429. Node: Ravenscar Profile647898
  46430. Node: Ada Settings650069
  46431. Node: Ada Glitches651491
  46432. Node: Unsupported Languages655499
  46433. Node: Symbols656189
  46434. Ref: quoting names656792
  46435. Node: Altering687707
  46436. Node: Assignment688745
  46437. Node: Jumping691851
  46438. Node: Signaling693925
  46439. Node: Returning696854
  46440. Node: Calling700205
  46441. Node: Patching705690
  46442. Node: Compiling and Injecting Code706804
  46443. Ref: set debug compile710431
  46444. Ref: set debug compile-cplus-types710681
  46445. Node: GDB Files720702
  46446. Node: Files721491
  46447. Ref: Shared Libraries735203
  46448. Ref: Files-Footnote-1747396
  46449. Node: File Caching747525
  46450. Node: Separate Debug Files748659
  46451. Ref: build ID749900
  46452. Ref: debug-file-directory752012
  46453. Node: MiniDebugInfo760627
  46454. Node: Index Files763078
  46455. Node: Symbol Errors767141
  46456. Node: Data Files770757
  46457. Node: Targets771713
  46458. Node: Active Targets773193
  46459. Node: Target Commands774267
  46460. Ref: load778656
  46461. Ref: flash-erase779849
  46462. Node: Byte Order779909
  46463. Node: Remote Debugging781348
  46464. Node: Connecting782610
  46465. Ref: --multi Option in Types of Remote Connnections784836
  46466. Ref: Attaching in Types of Remote Connections786251
  46467. Ref: Host and target files787131
  46468. Node: File Transfer795753
  46469. Node: Server796692
  46470. Ref: Running gdbserver798268
  46471. Ref: Attaching to a program800486
  46472. Ref: Other Command-Line Arguments for gdbserver803011
  46473. Ref: Monitor Commands for gdbserver806330
  46474. Ref: Server-Footnote-1811706
  46475. Node: Remote Configuration811826
  46476. Ref: set remotebreak813086
  46477. Ref: set remote hardware-watchpoint-limit814548
  46478. Ref: set remote hardware-breakpoint-limit814548
  46479. Ref: set remote hardware-watchpoint-length-limit815050
  46480. Ref: set remote exec-file815505
  46481. Node: Remote Stub827310
  46482. Node: Stub Contents830205
  46483. Node: Bootstrapping832312
  46484. Node: Debug Session836127
  46485. Node: Configurations838168
  46486. Node: Native838937
  46487. Node: BSD libkvm Interface839506
  46488. Node: Process Information840558
  46489. Node: DJGPP Native846182
  46490. Node: Cygwin Native852736
  46491. Node: Non-debug DLL Symbols857657
  46492. Node: Hurd Native861896
  46493. Node: Darwin867152
  46494. Node: FreeBSD868429
  46495. Node: Embedded OS869149
  46496. Node: Embedded Processors869560
  46497. Node: ARC870587
  46498. Node: ARM871134
  46499. Node: BPF873680
  46500. Node: M68K874160
  46501. Node: MicroBlaze874333
  46502. Node: MIPS Embedded875782
  46503. Node: OpenRISC 1000877079
  46504. Node: PowerPC Embedded877985
  46505. Node: AVR881214
  46506. Node: CRIS881586
  46507. Node: Super-H882564
  46508. Node: Architectures883623
  46509. Node: AArch64884019
  46510. Node: i386885592
  46511. Ref: i386-Footnote-1889802
  46512. Node: Alpha889888
  46513. Node: MIPS890021
  46514. Node: HPPA893915
  46515. Node: PowerPC894437
  46516. Node: Nios II895173
  46517. Node: Sparc64895578
  46518. Node: S12Z897946
  46519. Node: Controlling GDB898239
  46520. Node: Prompt899182
  46521. Node: Editing900900
  46522. Node: Command History902210
  46523. Node: Screen Size907404
  46524. Node: Output Styling909420
  46525. Node: Numbers913503
  46526. Node: ABI915485
  46527. Node: Auto-loading918658
  46528. Ref: set auto-load off920033
  46529. Ref: show auto-load920669
  46530. Ref: info auto-load921448
  46531. Node: Init File in the Current Directory924415
  46532. Ref: set auto-load local-gdbinit924990
  46533. Ref: show auto-load local-gdbinit925172
  46534. Ref: info auto-load local-gdbinit925336
  46535. Node: libthread_db.so.1 file925484
  46536. Ref: set auto-load libthread-db926423
  46537. Ref: show auto-load libthread-db926554
  46538. Ref: info auto-load libthread-db926691
  46539. Node: Auto-loading safe path926875
  46540. Ref: set auto-load safe-path928176
  46541. Ref: show auto-load safe-path928915
  46542. Ref: add-auto-load-safe-path929038
  46543. Node: Auto-loading verbose mode931940
  46544. Ref: set debug auto-load933103
  46545. Ref: show debug auto-load933204
  46546. Node: Messages/Warnings933326
  46547. Ref: confirmation requests934760
  46548. Node: Debugging Output935964
  46549. Node: Other Misc Settings946381
  46550. Node: Extending GDB947405
  46551. Node: Sequences949258
  46552. Node: Define949919
  46553. Node: Hooks955404
  46554. Node: Command Files957770
  46555. Node: Output962843
  46556. Ref: eval967645
  46557. Node: Auto-loading sequences967807
  46558. Ref: set auto-load gdb-scripts968302
  46559. Ref: show auto-load gdb-scripts968426
  46560. Ref: info auto-load gdb-scripts968556
  46561. Node: Python968787
  46562. Node: Python Commands970073
  46563. Node: Python API972187
  46564. Node: Basic Python974922
  46565. Ref: prompt_hook985959
  46566. Node: Exception Handling986557
  46567. Node: Values From Inferior989459
  46568. Node: Types In Python1006795
  46569. Node: Pretty Printing API1018025
  46570. Node: Selecting Pretty-Printers1022468
  46571. Node: Writing a Pretty-Printer1025195
  46572. Node: Type Printing API1030517
  46573. Node: Frame Filter API1033133
  46574. Node: Frame Decorator API1040445
  46575. Ref: frame_args1044186
  46576. Node: Writing a Frame Filter1047516
  46577. Node: Unwinding Frames in Python1058990
  46578. Node: Xmethods In Python1066785
  46579. Node: Xmethod API1069681
  46580. Node: Writing an Xmethod1073493
  46581. Node: Inferiors In Python1079328
  46582. Node: Events In Python1083099
  46583. Node: Threads In Python1092307
  46584. Node: Recordings In Python1095652
  46585. Node: Commands In Python1102986
  46586. Node: Parameters In Python1112577
  46587. Node: Functions In Python1119515
  46588. Node: Progspaces In Python1121732
  46589. Node: Objfiles In Python1126656
  46590. Node: Frames In Python1133313
  46591. Ref: gdbpy_frame_read_register1139530
  46592. Node: Blocks In Python1141215
  46593. Node: Symbols In Python1145882
  46594. Node: Symbol Tables In Python1155345
  46595. Node: Line Tables In Python1158566
  46596. Node: Breakpoints In Python1161403
  46597. Ref: python_breakpoint_thread1167726
  46598. Node: Finish Breakpoints in Python1170759
  46599. Node: Lazy Strings In Python1172865
  46600. Node: Architectures In Python1175093
  46601. Ref: gdbpy_architecture_registers1177310
  46602. Ref: gdbpy_architecture_reggroups1177631
  46603. Node: Registers In Python1177830
  46604. Node: TUI Windows In Python1180100
  46605. Node: Python Auto-loading1184327
  46606. Ref: set auto-load python-scripts1184956
  46607. Ref: show auto-load python-scripts1185056
  46608. Ref: info auto-load python-scripts1185162
  46609. Node: Python modules1186296
  46610. Node: gdb.printing1186682
  46611. Node: gdb.types1188109
  46612. Node: gdb.prompt1191121
  46613. Node: Guile1192717
  46614. Node: Guile Introduction1193376
  46615. Node: Guile Commands1194214
  46616. Node: Guile API1196068
  46617. Node: Basic Guile1198065
  46618. Node: Guile Configuration1203747
  46619. Node: GDB Scheme Data Types1204723
  46620. Node: Guile Exception Handling1206555
  46621. Node: Values From Inferior In Guile1210589
  46622. Node: Arithmetic In Guile1226125
  46623. Node: Types In Guile1227756
  46624. Ref: Fields of a type in Guile1235697
  46625. Node: Guile Pretty Printing API1237085
  46626. Node: Selecting Guile Pretty-Printers1242814
  46627. Node: Writing a Guile Pretty-Printer1245190
  46628. Node: Commands In Guile1250375
  46629. Node: Parameters In Guile1261155
  46630. Ref: Parameters In Guile-Footnote-11268036
  46631. Node: Progspaces In Guile1268152
  46632. Node: Objfiles In Guile1270764
  46633. Node: Frames In Guile1273045
  46634. Node: Blocks In Guile1279623
  46635. Node: Symbols In Guile1284431
  46636. Node: Symbol Tables In Guile1291766
  46637. Node: Breakpoints In Guile1294729
  46638. Node: Lazy Strings In Guile1304990
  46639. Node: Architectures In Guile1307281
  46640. Node: Disassembly In Guile1311588
  46641. Node: I/O Ports in Guile1314790
  46642. Node: Memory Ports in Guile1315346
  46643. Node: Iterators In Guile1319197
  46644. Node: Guile Auto-loading1323486
  46645. Ref: set auto-load guile-scripts1324109
  46646. Ref: show auto-load guile-scripts1324207
  46647. Ref: info auto-load guile-scripts1324311
  46648. Node: Guile Modules1325270
  46649. Node: Guile Printing Module1325592
  46650. Node: Guile Types Module1326411
  46651. Node: Auto-loading extensions1327704
  46652. Node: objfile-gdbdotext file1328902
  46653. Ref: set auto-load scripts-directory1330572
  46654. Ref: with-auto-load-dir1330948
  46655. Ref: show auto-load scripts-directory1331766
  46656. Ref: add-auto-load-scripts-directory1331846
  46657. Node: dotdebug_gdb_scripts section1332322
  46658. Node: Which flavor to choose?1336072
  46659. Node: Multiple Extension Languages1337893
  46660. Node: Aliases1338957
  46661. Node: Interpreters1342427
  46662. Node: TUI1345578
  46663. Node: TUI Overview1346576
  46664. Node: TUI Keys1349079
  46665. Node: TUI Single Key Mode1351802
  46666. Node: TUI Commands1352985
  46667. Node: TUI Configuration1358842
  46668. Node: Emacs1360864
  46669. Node: GDB/MI1366301
  46670. Node: GDB/MI General Design1369006
  46671. Node: Context management1371526
  46672. Node: Asynchronous and non-stop modes1375313
  46673. Node: Thread groups1378286
  46674. Node: GDB/MI Command Syntax1380576
  46675. Node: GDB/MI Input Syntax1380819
  46676. Node: GDB/MI Output Syntax1382369
  46677. Node: GDB/MI Compatibility with CLI1385954
  46678. Node: GDB/MI Development and Front Ends1386691
  46679. Node: GDB/MI Output Records1390206
  46680. Node: GDB/MI Result Records1390612
  46681. Node: GDB/MI Stream Records1391962
  46682. Node: GDB/MI Async Records1393227
  46683. Node: GDB/MI Breakpoint Information1403660
  46684. Node: GDB/MI Frame Information1409296
  46685. Node: GDB/MI Thread Information1410578
  46686. Node: GDB/MI Ada Exception Information1412048
  46687. Node: GDB/MI Simple Examples1412598
  46688. Node: GDB/MI Command Description Format1414834
  46689. Node: GDB/MI Breakpoint Commands1415714
  46690. Ref: -break-insert1422822
  46691. Node: GDB/MI Catchpoint Commands1436396
  46692. Node: Shared Library GDB/MI Catchpoint Commands1436809
  46693. Node: Ada Exception GDB/MI Catchpoint Commands1438467
  46694. Node: C++ Exception GDB/MI Catchpoint Commands1442017
  46695. Node: GDB/MI Program Context1446033
  46696. Node: GDB/MI Thread Commands1450301
  46697. Node: GDB/MI Ada Tasking Commands1453602
  46698. Node: GDB/MI Program Execution1455874
  46699. Node: GDB/MI Stack Manipulation1468141
  46700. Ref: -stack-list-arguments1470065
  46701. Ref: -stack-list-frames1473895
  46702. Ref: -stack-list-locals1478224
  46703. Ref: -stack-list-variables1479714
  46704. Node: GDB/MI Variable Objects1481248
  46705. Ref: -var-set-format1491214
  46706. Ref: -var-list-children1492595
  46707. Ref: -var-update1501403
  46708. Ref: -var-set-frozen1504401
  46709. Ref: -var-set-update-range1505198
  46710. Ref: -var-set-visualizer1505727
  46711. Node: GDB/MI Data Manipulation1507217
  46712. Node: GDB/MI Tracepoint Commands1527705
  46713. Node: GDB/MI Symbol Query1539496
  46714. Ref: -symbol-info-functions1539765
  46715. Ref: -symbol-info-module-functions1544278
  46716. Ref: -symbol-info-module-variables1547258
  46717. Ref: -symbol-info-modules1550975
  46718. Ref: -symbol-info-types1552879
  46719. Ref: -symbol-info-variables1554872
  46720. Node: GDB/MI File Commands1559896
  46721. Node: GDB/MI Target Manipulation1564330
  46722. Node: GDB/MI File Transfer Commands1570988
  46723. Node: GDB/MI Ada Exceptions Commands1572311
  46724. Node: GDB/MI Support Commands1573664
  46725. Node: GDB/MI Miscellaneous Commands1578383
  46726. Ref: -interpreter-exec1588747
  46727. Node: Annotations1592719
  46728. Node: Annotations Overview1593638
  46729. Node: Server Prefix1596101
  46730. Node: Prompting1596835
  46731. Node: Errors1598352
  46732. Node: Invalidation1599248
  46733. Node: Annotations for Running1599727
  46734. Node: Source Annotations1601261
  46735. Node: JIT Interface1602190
  46736. Node: Declarations1603990
  46737. Node: Registering Code1605377
  46738. Node: Unregistering Code1606349
  46739. Node: Custom Debug Info1606976
  46740. Node: Using JIT Debug Info Readers1608272
  46741. Node: Writing JIT Debug Info Readers1609284
  46742. Node: In-Process Agent1611479
  46743. Ref: Control Agent1613422
  46744. Node: In-Process Agent Protocol1614289
  46745. Node: IPA Protocol Objects1615080
  46746. Ref: agent expression object1616078
  46747. Ref: tracepoint action object1616283
  46748. Ref: tracepoint object1616363
  46749. Node: IPA Protocol Commands1618893
  46750. Node: GDB Bugs1620363
  46751. Node: Bug Criteria1621095
  46752. Node: Bug Reporting1621972
  46753. Node: Command Line Editing1628949
  46754. Node: Introduction and Notation1629601
  46755. Node: Readline Interaction1631222
  46756. Node: Readline Bare Essentials1632411
  46757. Node: Readline Movement Commands1634192
  46758. Node: Readline Killing Commands1635150
  46759. Node: Readline Arguments1637066
  46760. Node: Searching1638108
  46761. Node: Readline Init File1640258
  46762. Node: Readline Init File Syntax1641409
  46763. Node: Conditional Init Constructs1661565
  46764. Node: Sample Init File1665759
  46765. Node: Bindable Readline Commands1668874
  46766. Node: Commands For Moving1669926
  46767. Node: Commands For History1671490
  46768. Node: Commands For Text1675752
  46769. Node: Commands For Killing1679191
  46770. Node: Numeric Arguments1681355
  46771. Node: Commands For Completion1682492
  46772. Node: Keyboard Macros1684458
  46773. Node: Miscellaneous Commands1685143
  46774. Node: Readline vi Mode1689062
  46775. Node: Using History Interactively1689972
  46776. Node: History Interaction1690487
  46777. Node: Event Designators1692383
  46778. Node: Word Designators1693520
  46779. Node: Modifiers1695155
  46780. Node: In Memoriam1696376
  46781. Node: Formatting Documentation1697259
  46782. Ref: Formatting Documentation-Footnote-11700575
  46783. Node: Installing GDB1700641
  46784. Node: Requirements1701213
  46785. Ref: Expat1701914
  46786. Ref: MPFR1705207
  46787. Node: Running Configure1706828
  46788. Node: Separate Objdir1709534
  46789. Node: Config Names1712418
  46790. Node: Configure Options1713865
  46791. Node: System-wide configuration1723687
  46792. Node: System-wide Configuration Scripts1726224
  46793. Node: Maintenance Commands1727408
  46794. Ref: maint info breakpoints1729063
  46795. Ref: maint check libthread-db1737948
  46796. Node: Remote Protocol1754866
  46797. Node: Overview1755558
  46798. Ref: Binary Data1758103
  46799. Node: Packets1760759
  46800. Ref: thread-id syntax1761659
  46801. Ref: extended mode1763104
  46802. Ref: ? packet1763362
  46803. Ref: bc1764828
  46804. Ref: bs1765038
  46805. Ref: read registers packet1766655
  46806. Ref: cycle step packet1768510
  46807. Ref: write register packet1771221
  46808. Ref: step with signal packet1772200
  46809. Ref: vCont packet1773676
  46810. Ref: vCtrlC packet1776910
  46811. Ref: vKill packet1779328
  46812. Ref: X packet1780862
  46813. Ref: insert breakpoint or watchpoint packet1781231
  46814. Node: Stop Reply Packets1785557
  46815. Ref: swbreak stop reason1788808
  46816. Ref: thread create event1792405
  46817. Ref: thread exit event1793608
  46818. Node: General Query Packets1795817
  46819. Ref: qCRC packet1798647
  46820. Ref: QEnvironmentHexEncoded1801800
  46821. Ref: QEnvironmentUnset1803030
  46822. Ref: QEnvironmentReset1803974
  46823. Ref: QSetWorkingDir packet1804918
  46824. Ref: QNonStop1811369
  46825. Ref: QCatchSyscalls1812045
  46826. Ref: QPassSignals1813582
  46827. Ref: QProgramSignals1814789
  46828. Ref: QThreadEvents1816356
  46829. Ref: qSearch memory1818374
  46830. Ref: QStartNoAckMode1818882
  46831. Ref: qSupported1819414
  46832. Ref: multiprocess extensions1834934
  46833. Ref: install tracepoint in tracing1836964
  46834. Ref: qXfer read1841487
  46835. Ref: qXfer auxiliary vector read1843094
  46836. Ref: qXfer btrace read1843442
  46837. Ref: qXfer btrace-conf read1844507
  46838. Ref: qXfer executable filename read1844858
  46839. Ref: qXfer target description read1845473
  46840. Ref: qXfer library list read1845907
  46841. Ref: qXfer svr4 library list read1846563
  46842. Ref: qXfer memory map read1848416
  46843. Ref: qXfer sdata read1848803
  46844. Ref: qXfer siginfo read1849269
  46845. Ref: qXfer threads read1849665
  46846. Ref: qXfer traceframe info read1850068
  46847. Ref: qXfer unwind info block1850486
  46848. Ref: qXfer fdpic loadmap read1850720
  46849. Ref: qXfer osdata read1851136
  46850. Ref: qXfer write1851290
  46851. Ref: qXfer siginfo write1852382
  46852. Ref: General Query Packets-Footnote-11855110
  46853. Node: Architecture-Specific Protocol Details1855437
  46854. Node: ARM-Specific Protocol Details1855946
  46855. Node: ARM Breakpoint Kinds1856194
  46856. Node: MIPS-Specific Protocol Details1856525
  46857. Node: MIPS Register packet Format1856808
  46858. Node: MIPS Breakpoint Kinds1857735
  46859. Node: Tracepoint Packets1858153
  46860. Ref: QTEnable1867467
  46861. Ref: QTDisable1867663
  46862. Ref: qTfSTM1873200
  46863. Ref: qTsSTM1873200
  46864. Ref: qTSTMat1874277
  46865. Ref: QTBuffer-size1875428
  46866. Node: Host I/O Packets1877401
  46867. Node: Interrupts1882982
  46868. Ref: interrupting remote targets1883126
  46869. Node: Notification Packets1885294
  46870. Node: Remote Non-Stop1890719
  46871. Node: Packet Acknowledgment1893835
  46872. Node: Examples1895950
  46873. Node: File-I/O Remote Protocol Extension1896544
  46874. Node: File-I/O Overview1897006
  46875. Node: Protocol Basics1899205
  46876. Node: The F Request Packet1901434
  46877. Node: The F Reply Packet1902335
  46878. Node: The Ctrl-C Message1903253
  46879. Node: Console I/O1904879
  46880. Node: List of Supported Calls1906095
  46881. Node: open1906457
  46882. Node: close1908965
  46883. Node: read1909348
  46884. Node: write1909957
  46885. Node: lseek1910728
  46886. Node: rename1911612
  46887. Node: unlink1913019
  46888. Node: stat/fstat1913966
  46889. Node: gettimeofday1914859
  46890. Node: isatty1915295
  46891. Node: system1915891
  46892. Node: Protocol-specific Representation of Datatypes1917433
  46893. Node: Integral Datatypes1917810
  46894. Node: Pointer Values1918617
  46895. Node: Memory Transfer1919321
  46896. Node: struct stat1919941
  46897. Node: struct timeval1922143
  46898. Node: Constants1922660
  46899. Node: Open Flags1923109
  46900. Node: mode_t Values1923450
  46901. Node: Errno Values1923942
  46902. Node: Lseek Flags1924752
  46903. Node: Limits1924937
  46904. Node: File-I/O Examples1925297
  46905. Node: Library List Format1926385
  46906. Node: Library List Format for SVR4 Targets1929167
  46907. Node: Memory Map Format1931634
  46908. Node: Thread List Format1934158
  46909. Node: Traceframe Info Format1935162
  46910. Node: Branch Trace Format1936848
  46911. Node: Branch Trace Configuration Format1938548
  46912. Node: Agent Expressions1939722
  46913. Node: General Bytecode Design1942543
  46914. Node: Bytecode Descriptions1947337
  46915. Node: Using Agent Expressions1960804
  46916. Node: Varying Target Capabilities1962781
  46917. Node: Rationale1963942
  46918. Node: Target Descriptions1971331
  46919. Node: Retrieving Descriptions1973274
  46920. Node: Target Description Format1974359
  46921. Node: Predefined Target Types1984234
  46922. Node: Enum Target Types1985679
  46923. Node: Standard Target Features1986674
  46924. Node: AArch64 Features1988674
  46925. Node: ARC Features1989380
  46926. Ref: ARC Features-Footnote-11991199
  46927. Node: ARM Features1991232
  46928. Node: i386 Features1992746
  46929. Node: MicroBlaze Features1994961
  46930. Node: MIPS Features1995538
  46931. Node: M68K Features1996729
  46932. Node: NDS32 Features1997716
  46933. Node: Nios II Features1998740
  46934. Node: OpenRISC 1000 Features1999145
  46935. Node: PowerPC Features1999511
  46936. Node: RISC-V Features2003481
  46937. Node: RX Features2005171
  46938. Node: S/390 and System z Features2005533
  46939. Node: Sparc Features2007673
  46940. Node: TIC6x Features2008578
  46941. Node: Operating System Information2009127
  46942. Node: Process list2009963
  46943. Node: Trace File Format2011026
  46944. Node: Index Section Format2014240
  46945. Node: Man Pages2022166
  46946. Node: gdb man2022636
  46947. Node: gdbserver man2028610
  46948. Node: gcore man2036019
  46949. Node: gdbinit man2037141
  46950. Node: gdb-add-index man2038334
  46951. Ref: gdb-add-index2038443
  46952. Node: Copying2039317
  46953. Node: GNU Free Documentation License2076878
  46954. Node: Concept Index2102025
  46955. Node: Command and Variable Index2243807
  46956. 
  46957. End Tag Table
  46958. 
  46959. Local Variables:
  46960. coding: utf-8
  46961. End: