gdb.info 2.3 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681
  1. This is gdb.info, produced by makeinfo version 6.1 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 9.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, Prev: (dir), 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 9.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. 
  367. File: gdb.info, Node: Sample Session, Next: Invocation, Prev: Summary, Up: Top
  368. 1 A Sample GDB Session
  369. **********************
  370. You can use this manual at your leisure to read all about GDB. However,
  371. a handful of commands are enough to get started using the debugger.
  372. This chapter illustrates those commands.
  373. One of the preliminary versions of GNU 'm4' (a generic macro
  374. processor) exhibits the following bug: sometimes, when we change its
  375. quote strings from the default, the commands used to capture one macro
  376. definition within another stop working. In the following short 'm4'
  377. session, we define a macro 'foo' which expands to '0000'; we then use
  378. the 'm4' built-in 'defn' to define 'bar' as the same thing. However,
  379. when we change the open quote string to '<QUOTE>' and the close quote
  380. string to '<UNQUOTE>', the same procedure fails to define a new synonym
  381. 'baz':
  382. $ cd gnu/m4
  383. $ ./m4
  384. define(foo,0000)
  385. foo
  386. 0000
  387. define(bar,defn('foo'))
  388. bar
  389. 0000
  390. changequote(<QUOTE>,<UNQUOTE>)
  391. define(baz,defn(<QUOTE>foo<UNQUOTE>))
  392. baz
  393. Ctrl-d
  394. m4: End of input: 0: fatal error: EOF in string
  395. Let us use GDB to try to see what is going on.
  396. $ gdb m4
  397. GDB is free software and you are welcome to distribute copies
  398. of it under certain conditions; type "show copying" to see
  399. the conditions.
  400. There is absolutely no warranty for GDB; type "show warranty"
  401. for details.
  402. GDB 9.1, Copyright 1999 Free Software Foundation, Inc...
  403. (gdb)
  404. GDB reads only enough symbol data to know where to find the rest when
  405. needed; as a result, the first prompt comes up very quickly. We now
  406. tell GDB to use a narrower display width than usual, so that examples
  407. fit in this manual.
  408. (gdb) set width 70
  409. We need to see how the 'm4' built-in 'changequote' works. Having looked
  410. at the source, we know the relevant subroutine is 'm4_changequote', so
  411. we set a breakpoint there with the GDB 'break' command.
  412. (gdb) break m4_changequote
  413. Breakpoint 1 at 0x62f4: file builtin.c, line 879.
  414. Using the 'run' command, we start 'm4' running under GDB control; as
  415. long as control does not reach the 'm4_changequote' subroutine, the
  416. program runs as usual:
  417. (gdb) run
  418. Starting program: /work/Editorial/gdb/gnu/m4/m4
  419. define(foo,0000)
  420. foo
  421. 0000
  422. To trigger the breakpoint, we call 'changequote'. GDB suspends
  423. execution of 'm4', displaying information about the context where it
  424. stops.
  425. changequote(<QUOTE>,<UNQUOTE>)
  426. Breakpoint 1, m4_changequote (argc=3, argv=0x33c70)
  427. at builtin.c:879
  428. 879 if (bad_argc(TOKEN_DATA_TEXT(argv[0]),argc,1,3))
  429. Now we use the command 'n' ('next') to advance execution to the next
  430. line of the current function.
  431. (gdb) n
  432. 882 set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1])\
  433. : nil,
  434. 'set_quotes' looks like a promising subroutine. We can go into it by
  435. using the command 's' ('step') instead of 'next'. 'step' goes to the
  436. next line to be executed in _any_ subroutine, so it steps into
  437. 'set_quotes'.
  438. (gdb) s
  439. set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
  440. at input.c:530
  441. 530 if (lquote != def_lquote)
  442. The display that shows the subroutine where 'm4' is now suspended (and
  443. its arguments) is called a stack frame display. It shows a summary of
  444. the stack. We can use the 'backtrace' command (which can also be
  445. spelled 'bt'), to see where we are in the stack as a whole: the
  446. 'backtrace' command displays a stack frame for each active subroutine.
  447. (gdb) bt
  448. #0 set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
  449. at input.c:530
  450. #1 0x6344 in m4_changequote (argc=3, argv=0x33c70)
  451. at builtin.c:882
  452. #2 0x8174 in expand_macro (sym=0x33320) at macro.c:242
  453. #3 0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30)
  454. at macro.c:71
  455. #4 0x79dc in expand_input () at macro.c:40
  456. #5 0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195
  457. We step through a few more lines to see what happens. The first two
  458. times, we can use 's'; the next two times we use 'n' to avoid falling
  459. into the 'xstrdup' subroutine.
  460. (gdb) s
  461. 0x3b5c 532 if (rquote != def_rquote)
  462. (gdb) s
  463. 0x3b80 535 lquote = (lq == nil || *lq == '\0') ? \
  464. def_lquote : xstrdup(lq);
  465. (gdb) n
  466. 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
  467. : xstrdup(rq);
  468. (gdb) n
  469. 538 len_lquote = strlen(rquote);
  470. The last line displayed looks a little odd; we can examine the variables
  471. 'lquote' and 'rquote' to see if they are in fact the new left and right
  472. quotes we specified. We use the command 'p' ('print') to see their
  473. values.
  474. (gdb) p lquote
  475. $1 = 0x35d40 "<QUOTE>"
  476. (gdb) p rquote
  477. $2 = 0x35d50 "<UNQUOTE>"
  478. 'lquote' and 'rquote' are indeed the new left and right quotes. To look
  479. at some context, we can display ten lines of source surrounding the
  480. current line with the 'l' ('list') command.
  481. (gdb) l
  482. 533 xfree(rquote);
  483. 534
  484. 535 lquote = (lq == nil || *lq == '\0') ? def_lquote\
  485. : xstrdup (lq);
  486. 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
  487. : xstrdup (rq);
  488. 537
  489. 538 len_lquote = strlen(rquote);
  490. 539 len_rquote = strlen(lquote);
  491. 540 }
  492. 541
  493. 542 void
  494. Let us step past the two lines that set 'len_lquote' and 'len_rquote',
  495. and then examine the values of those variables.
  496. (gdb) n
  497. 539 len_rquote = strlen(lquote);
  498. (gdb) n
  499. 540 }
  500. (gdb) p len_lquote
  501. $3 = 9
  502. (gdb) p len_rquote
  503. $4 = 7
  504. That certainly looks wrong, assuming 'len_lquote' and 'len_rquote' are
  505. meant to be the lengths of 'lquote' and 'rquote' respectively. We can
  506. set them to better values using the 'p' command, since it can print the
  507. value of any expression--and that expression can include subroutine
  508. calls and assignments.
  509. (gdb) p len_lquote=strlen(lquote)
  510. $5 = 7
  511. (gdb) p len_rquote=strlen(rquote)
  512. $6 = 9
  513. Is that enough to fix the problem of using the new quotes with the 'm4'
  514. built-in 'defn'? We can allow 'm4' to continue executing with the 'c'
  515. ('continue') command, and then try the example that caused trouble
  516. initially:
  517. (gdb) c
  518. Continuing.
  519. define(baz,defn(<QUOTE>foo<UNQUOTE>))
  520. baz
  521. 0000
  522. Success! The new quotes now work just as well as the default ones. The
  523. problem seems to have been just the two typos defining the wrong
  524. lengths. We allow 'm4' exit by giving it an EOF as input:
  525. Ctrl-d
  526. Program exited normally.
  527. The message 'Program exited normally.' is from GDB; it indicates 'm4'
  528. has finished executing. We can end our GDB session with the GDB 'quit'
  529. command.
  530. (gdb) quit
  531. 
  532. File: gdb.info, Node: Invocation, Next: Commands, Prev: Sample Session, Up: Top
  533. 2 Getting In and Out of GDB
  534. ***************************
  535. This chapter discusses how to start GDB, and how to get out of it. The
  536. essentials are:
  537. * type 'gdb' to start GDB.
  538. * type 'quit' or 'Ctrl-d' to exit.
  539. * Menu:
  540. * Invoking GDB:: How to start GDB
  541. * Quitting GDB:: How to quit GDB
  542. * Shell Commands:: How to use shell commands inside GDB
  543. * Logging Output:: How to log GDB's output to a file
  544. 
  545. File: gdb.info, Node: Invoking GDB, Next: Quitting GDB, Up: Invocation
  546. 2.1 Invoking GDB
  547. ================
  548. Invoke GDB by running the program 'gdb'. Once started, GDB reads
  549. commands from the terminal until you tell it to exit.
  550. You can also run 'gdb' with a variety of arguments and options, to
  551. specify more of your debugging environment at the outset.
  552. The command-line options described here are designed to cover a
  553. variety of situations; in some environments, some of these options may
  554. effectively be unavailable.
  555. The most usual way to start GDB is with one argument, specifying an
  556. executable program:
  557. gdb PROGRAM
  558. You can also start with both an executable program and a core file
  559. specified:
  560. gdb PROGRAM CORE
  561. You can, instead, specify a process ID as a second argument or use
  562. option '-p', if you want to debug a running process:
  563. gdb PROGRAM 1234
  564. gdb -p 1234
  565. would attach GDB to process '1234'. With option '-p' you can omit the
  566. PROGRAM filename.
  567. Taking advantage of the second command-line argument requires a
  568. fairly complete operating system; when you use GDB as a remote debugger
  569. attached to a bare board, there may not be any notion of "process", and
  570. there is often no way to get a core dump. GDB will warn you if it is
  571. unable to attach or to read core dumps.
  572. You can optionally have 'gdb' pass any arguments after the executable
  573. file to the inferior using '--args'. This option stops option
  574. processing.
  575. gdb --args gcc -O2 -c foo.c
  576. This will cause 'gdb' to debug 'gcc', and to set 'gcc''s command-line
  577. arguments (*note Arguments::) to '-O2 -c foo.c'.
  578. You can run 'gdb' without printing the front material, which
  579. describes GDB's non-warranty, by specifying '--silent' (or
  580. '-q'/'--quiet'):
  581. gdb --silent
  582. You can further control how GDB starts up by using command-line options.
  583. GDB itself can remind you of the options available.
  584. Type
  585. gdb -help
  586. to display all available options and briefly describe their use ('gdb
  587. -h' is a shorter equivalent).
  588. All options and command line arguments you give are processed in
  589. sequential order. The order makes a difference when the '-x' option is
  590. used.
  591. * Menu:
  592. * File Options:: Choosing files
  593. * Mode Options:: Choosing modes
  594. * Startup:: What GDB does during startup
  595. 
  596. File: gdb.info, Node: File Options, Next: Mode Options, Up: Invoking GDB
  597. 2.1.1 Choosing Files
  598. --------------------
  599. When GDB starts, it reads any arguments other than options as specifying
  600. an executable file and core file (or process ID). This is the same as if
  601. the arguments were specified by the '-se' and '-c' (or '-p') options
  602. respectively. (GDB reads the first argument that does not have an
  603. associated option flag as equivalent to the '-se' option followed by
  604. that argument; and the second argument that does not have an associated
  605. option flag, if any, as equivalent to the '-c'/'-p' option followed by
  606. that argument.) If the second argument begins with a decimal digit, GDB
  607. will first attempt to attach to it as a process, and if that fails,
  608. attempt to open it as a corefile. If you have a corefile whose name
  609. begins with a digit, you can prevent GDB from treating it as a pid by
  610. prefixing it with './', e.g. './12345'.
  611. If GDB has not been configured to included core file support, such as
  612. for most embedded targets, then it will complain about a second argument
  613. and ignore it.
  614. Many options have both long and short forms; both are shown in the
  615. following list. GDB also recognizes the long forms if you truncate
  616. them, so long as enough of the option is present to be unambiguous. (If
  617. you prefer, you can flag option arguments with '--' rather than '-',
  618. though we illustrate the more usual convention.)
  619. '-symbols FILE'
  620. '-s FILE'
  621. Read symbol table from file FILE.
  622. '-exec FILE'
  623. '-e FILE'
  624. Use file FILE as the executable file to execute when appropriate,
  625. and for examining pure data in conjunction with a core dump.
  626. '-se FILE'
  627. Read symbol table from file FILE and use it as the executable file.
  628. '-core FILE'
  629. '-c FILE'
  630. Use file FILE as a core dump to examine.
  631. '-pid NUMBER'
  632. '-p NUMBER'
  633. Connect to process ID NUMBER, as with the 'attach' command.
  634. '-command FILE'
  635. '-x FILE'
  636. Execute commands from file FILE. The contents of this file is
  637. evaluated exactly as the 'source' command would. *Note Command
  638. files: Command Files.
  639. '-eval-command COMMAND'
  640. '-ex COMMAND'
  641. Execute a single GDB command.
  642. This option may be used multiple times to call multiple commands.
  643. It may also be interleaved with '-command' as required.
  644. gdb -ex 'target sim' -ex 'load' \
  645. -x setbreakpoints -ex 'run' a.out
  646. '-init-command FILE'
  647. '-ix FILE'
  648. Execute commands from file FILE before loading the inferior (but
  649. after loading gdbinit files). *Note Startup::.
  650. '-init-eval-command COMMAND'
  651. '-iex COMMAND'
  652. Execute a single GDB command before loading the inferior (but after
  653. loading gdbinit files). *Note Startup::.
  654. '-directory DIRECTORY'
  655. '-d DIRECTORY'
  656. Add DIRECTORY to the path to search for source and script files.
  657. '-r'
  658. '-readnow'
  659. Read each symbol file's entire symbol table immediately, rather
  660. than the default, which is to read it incrementally as it is
  661. needed. This makes startup slower, but makes future operations
  662. faster.
  663. '--readnever'
  664. Do not read each symbol file's symbolic debug information. This
  665. makes startup faster but at the expense of not being able to
  666. perform symbolic debugging. DWARF unwind information is also not
  667. read, meaning backtraces may become incomplete or inaccurate. One
  668. use of this is when a user simply wants to do the following
  669. sequence: attach, dump core, detach. Loading the debugging
  670. information in this case is an unnecessary cause of delay.
  671. 
  672. File: gdb.info, Node: Mode Options, Next: Startup, Prev: File Options, Up: Invoking GDB
  673. 2.1.2 Choosing Modes
  674. --------------------
  675. You can run GDB in various alternative modes--for example, in batch mode
  676. or quiet mode.
  677. '-nx'
  678. '-n'
  679. Do not execute commands found in any initialization file. There
  680. are three init files, loaded in the following order:
  681. 'system.gdbinit'
  682. This is the system-wide init file. Its location is specified
  683. with the '--with-system-gdbinit' configure option (*note
  684. System-wide configuration::). It is loaded first when GDB
  685. starts, before command line options have been processed.
  686. 'system.gdbinit.d'
  687. This is the system-wide init directory. Its location is
  688. specified with the '--with-system-gdbinit-dir' configure
  689. option (*note System-wide configuration::). Files in this
  690. directory are loaded in alphabetical order immediately after
  691. system.gdbinit (if enabled) when GDB starts, before command
  692. line options have been processed. Files need to have a
  693. recognized scripting language extension ('.py'/'.scm') or be
  694. named with a '.gdb' extension to be interpreted as regular GDB
  695. commands. GDB will not recurse into any subdirectories of
  696. this directory.
  697. '~/.gdbinit'
  698. This is the init file in your home directory. It is loaded
  699. next, after 'system.gdbinit', and before command options have
  700. been processed.
  701. './.gdbinit'
  702. This is the init file in the current directory. It is loaded
  703. last, after command line options other than '-x' and '-ex'
  704. have been processed. Command line options '-x' and '-ex' are
  705. processed last, after './.gdbinit' has been loaded.
  706. For further documentation on startup processing, *Note Startup::.
  707. For documentation on how to write command files, *Note Command
  708. Files: Command Files.
  709. '-nh'
  710. Do not execute commands found in '~/.gdbinit', the init file in
  711. your home directory. *Note Startup::.
  712. '-quiet'
  713. '-silent'
  714. '-q'
  715. "Quiet". Do not print the introductory and copyright messages.
  716. These messages are also suppressed in batch mode.
  717. '-batch'
  718. Run in batch mode. Exit with status '0' after processing all the
  719. command files specified with '-x' (and all commands from
  720. initialization files, if not inhibited with '-n'). Exit with
  721. nonzero status if an error occurs in executing the GDB commands in
  722. the command files. Batch mode also disables pagination, sets
  723. unlimited terminal width and height *note Screen Size::, and acts
  724. as if 'set confirm off' were in effect (*note Messages/Warnings::).
  725. Batch mode may be useful for running GDB as a filter, for example
  726. to download and run a program on another computer; in order to make
  727. this more useful, the message
  728. Program exited normally.
  729. (which is ordinarily issued whenever a program running under GDB
  730. control terminates) is not issued when running in batch mode.
  731. '-batch-silent'
  732. Run in batch mode exactly like '-batch', but totally silently. All
  733. GDB output to 'stdout' is prevented ('stderr' is unaffected). This
  734. is much quieter than '-silent' and would be useless for an
  735. interactive session.
  736. This is particularly useful when using targets that give 'Loading
  737. section' messages, for example.
  738. Note that targets that give their output via GDB, as opposed to
  739. writing directly to 'stdout', will also be made silent.
  740. '-return-child-result'
  741. The return code from GDB will be the return code from the child
  742. process (the process being debugged), with the following
  743. exceptions:
  744. * GDB exits abnormally. E.g., due to an incorrect argument or
  745. an internal error. In this case the exit code is the same as
  746. it would have been without '-return-child-result'.
  747. * The user quits with an explicit value. E.g., 'quit 1'.
  748. * The child process never runs, or is not allowed to terminate,
  749. in which case the exit code will be -1.
  750. This option is useful in conjunction with '-batch' or
  751. '-batch-silent', when GDB is being used as a remote program loader
  752. or simulator interface.
  753. '-nowindows'
  754. '-nw'
  755. "No windows". If GDB comes with a graphical user interface (GUI)
  756. built in, then this option tells GDB to only use the command-line
  757. interface. If no GUI is available, this option has no effect.
  758. '-windows'
  759. '-w'
  760. If GDB includes a GUI, then this option requires it to be used if
  761. possible.
  762. '-cd DIRECTORY'
  763. Run GDB using DIRECTORY as its working directory, instead of the
  764. current directory.
  765. '-data-directory DIRECTORY'
  766. '-D DIRECTORY'
  767. Run GDB using DIRECTORY as its data directory. The data directory
  768. is where GDB searches for its auxiliary files. *Note Data Files::.
  769. '-fullname'
  770. '-f'
  771. GNU Emacs sets this option when it runs GDB as a subprocess. It
  772. tells GDB to output the full file name and line number in a
  773. standard, recognizable fashion each time a stack frame is displayed
  774. (which includes each time your program stops). This recognizable
  775. format looks like two '\032' characters, followed by the file name,
  776. line number and character position separated by colons, and a
  777. newline. The Emacs-to-GDB interface program uses the two '\032'
  778. characters as a signal to display the source code for the frame.
  779. '-annotate LEVEL'
  780. This option sets the "annotation level" inside GDB. Its effect is
  781. identical to using 'set annotate LEVEL' (*note Annotations::). The
  782. annotation LEVEL controls how much information GDB prints together
  783. with its prompt, values of expressions, source lines, and other
  784. types of output. Level 0 is the normal, level 1 is for use when
  785. GDB is run as a subprocess of GNU Emacs, level 3 is the maximum
  786. annotation suitable for programs that control GDB, and level 2 has
  787. been deprecated.
  788. The annotation mechanism has largely been superseded by GDB/MI
  789. (*note GDB/MI::).
  790. '--args'
  791. Change interpretation of command line so that arguments following
  792. the executable file are passed as command line arguments to the
  793. inferior. This option stops option processing.
  794. '-baud BPS'
  795. '-b BPS'
  796. Set the line speed (baud rate or bits per second) of any serial
  797. interface used by GDB for remote debugging.
  798. '-l TIMEOUT'
  799. Set the timeout (in seconds) of any communication used by GDB for
  800. remote debugging.
  801. '-tty DEVICE'
  802. '-t DEVICE'
  803. Run using DEVICE for your program's standard input and output.
  804. '-tui'
  805. Activate the "Text User Interface" when starting. The Text User
  806. Interface manages several text windows on the terminal, showing
  807. source, assembly, registers and GDB command outputs (*note GDB Text
  808. User Interface: TUI.). Do not use this option if you run GDB from
  809. Emacs (*note Using GDB under GNU Emacs: Emacs.).
  810. '-interpreter INTERP'
  811. Use the interpreter INTERP for interface with the controlling
  812. program or device. This option is meant to be set by programs
  813. which communicate with GDB using it as a back end. *Note Command
  814. Interpreters: Interpreters.
  815. '--interpreter=mi' (or '--interpreter=mi3') causes GDB to use the
  816. "GDB/MI interface" version 3 (*note The GDB/MI Interface: GDB/MI.)
  817. included since GDB version 9.1. GDB/MI version 2 ('mi2'), included
  818. in GDB 6.0 and version 1 ('mi1'), included in GDB 5.3, are also
  819. available. Earlier GDB/MI interfaces are no longer supported.
  820. '-write'
  821. Open the executable and core files for both reading and writing.
  822. This is equivalent to the 'set write on' command inside GDB (*note
  823. Patching::).
  824. '-statistics'
  825. This option causes GDB to print statistics about time and memory
  826. usage after it completes each command and returns to the prompt.
  827. '-version'
  828. This option causes GDB to print its version number and no-warranty
  829. blurb, and exit.
  830. '-configuration'
  831. This option causes GDB to print details about its build-time
  832. configuration parameters, and then exit. These details can be
  833. important when reporting GDB bugs (*note GDB Bugs::).
  834. 
  835. File: gdb.info, Node: Startup, Prev: Mode Options, Up: Invoking GDB
  836. 2.1.3 What GDB Does During Startup
  837. ----------------------------------
  838. Here's the description of what GDB does during session startup:
  839. 1. Sets up the command interpreter as specified by the command line
  840. (*note interpreter: Mode Options.).
  841. 2. Reads the system-wide "init file" (if '--with-system-gdbinit' was
  842. used when building GDB; *note System-wide configuration and
  843. settings: System-wide configuration.) and the files in the
  844. system-wide gdbinit directory (if '--with-system-gdbinit-dir' was
  845. used) and executes all the commands in those files. The files need
  846. to be named with a '.gdb' extension to be interpreted as GDB
  847. commands, or they can be written in a supported scripting language
  848. with an appropriate file extension.
  849. 3. Reads the init file (if any) in your home directory(1) and executes
  850. all the commands in that file.
  851. 4. Executes commands and command files specified by the '-iex' and
  852. '-ix' options in their specified order. Usually you should use the
  853. '-ex' and '-x' options instead, but this way you can apply settings
  854. before GDB init files get executed and before inferior gets loaded.
  855. 5. Processes command line options and operands.
  856. 6. Reads and executes the commands from init file (if any) in the
  857. current working directory as long as 'set auto-load local-gdbinit'
  858. is set to 'on' (*note Init File in the Current Directory::). This
  859. is only done if the current directory is different from your home
  860. directory. Thus, you can have more than one init file, one generic
  861. in your home directory, and another, specific to the program you
  862. are debugging, in the directory where you invoke GDB.
  863. 7. If the command line specified a program to debug, or a process to
  864. attach to, or a core file, GDB loads any auto-loaded scripts
  865. provided for the program or for its loaded shared libraries. *Note
  866. Auto-loading::.
  867. If you wish to disable the auto-loading during startup, you must do
  868. something like the following:
  869. $ gdb -iex "set auto-load python-scripts off" myprogram
  870. Option '-ex' does not work because the auto-loading is then turned
  871. off too late.
  872. 8. Executes commands and command files specified by the '-ex' and '-x'
  873. options in their specified order. *Note Command Files::, for more
  874. details about GDB command files.
  875. 9. Reads the command history recorded in the "history file". *Note
  876. Command History::, for more details about the command history and
  877. the files where GDB records it.
  878. Init files use the same syntax as "command files" (*note Command
  879. Files::) and are processed by GDB in the same way. The init file in
  880. your home directory can set options (such as 'set complaints') that
  881. affect subsequent processing of command line options and operands. Init
  882. files are not executed if you use the '-nx' option (*note Choosing
  883. Modes: Mode Options.).
  884. To display the list of init files loaded by gdb at startup, you can
  885. use 'gdb --help'.
  886. The GDB init files are normally called '.gdbinit'. The DJGPP port of
  887. GDB uses the name 'gdb.ini', due to the limitations of file names
  888. imposed by DOS filesystems. The Windows port of GDB uses the standard
  889. name, but if it finds a 'gdb.ini' file in your home directory, it warns
  890. you about that and suggests to rename the file to the standard name.
  891. ---------- Footnotes ----------
  892. (1) On DOS/Windows systems, the home directory is the one pointed to
  893. by the 'HOME' environment variable.
  894. 
  895. File: gdb.info, Node: Quitting GDB, Next: Shell Commands, Prev: Invoking GDB, Up: Invocation
  896. 2.2 Quitting GDB
  897. ================
  898. 'quit [EXPRESSION]'
  899. 'q'
  900. To exit GDB, use the 'quit' command (abbreviated 'q'), or type an
  901. end-of-file character (usually 'Ctrl-d'). If you do not supply
  902. EXPRESSION, GDB will terminate normally; otherwise it will
  903. terminate using the result of EXPRESSION as the error code.
  904. An interrupt (often 'Ctrl-c') does not exit from GDB, but rather
  905. terminates the action of any GDB command that is in progress and returns
  906. to GDB command level. It is safe to type the interrupt character at any
  907. time because GDB does not allow it to take effect until a time when it
  908. is safe.
  909. If you have been using GDB to control an attached process or device,
  910. you can release it with the 'detach' command (*note Debugging an
  911. Already-running Process: Attach.).
  912. 
  913. File: gdb.info, Node: Shell Commands, Next: Logging Output, Prev: Quitting GDB, Up: Invocation
  914. 2.3 Shell Commands
  915. ==================
  916. If you need to execute occasional shell commands during your debugging
  917. session, there is no need to leave or suspend GDB; you can just use the
  918. 'shell' command.
  919. 'shell COMMAND-STRING'
  920. '!COMMAND-STRING'
  921. Invoke a standard shell to execute COMMAND-STRING. Note that no
  922. space is needed between '!' and COMMAND-STRING. If it exists, the
  923. environment variable 'SHELL' determines which shell to run.
  924. Otherwise GDB uses the default shell ('/bin/sh' on Unix systems,
  925. 'COMMAND.COM' on MS-DOS, etc.).
  926. The utility 'make' is often needed in development environments. You
  927. do not have to use the 'shell' command for this purpose in GDB:
  928. 'make MAKE-ARGS'
  929. Execute the 'make' program with the specified arguments. This is
  930. equivalent to 'shell make MAKE-ARGS'.
  931. 'pipe [COMMAND] | SHELL_COMMAND'
  932. '| [COMMAND] | SHELL_COMMAND'
  933. 'pipe -d DELIM COMMAND DELIM SHELL_COMMAND'
  934. '| -d DELIM COMMAND DELIM SHELL_COMMAND'
  935. Executes COMMAND and sends its output to SHELL_COMMAND. Note that
  936. no space is needed around '|'. If no COMMAND is provided, the last
  937. command executed is repeated.
  938. In case the COMMAND contains a '|', the option '-d DELIM' can be
  939. used to specify an alternate delimiter string DELIM that separates
  940. the COMMAND from the SHELL_COMMAND.
  941. Example:
  942. (gdb) p var
  943. $1 = {
  944. black = 144,
  945. red = 233,
  946. green = 377,
  947. blue = 610,
  948. white = 987
  949. }
  950. (gdb) pipe p var|wc
  951. 7 19 80
  952. (gdb) |p var|wc -l
  953. 7
  954. (gdb) p /x var
  955. $4 = {
  956. black = 0x90,
  957. red = 0xe9,
  958. green = 0x179,
  959. blue = 0x262,
  960. white = 0x3db
  961. }
  962. (gdb) ||grep red
  963. red => 0xe9,
  964. (gdb) | -d ! echo this contains a | char\n ! sed -e 's/|/PIPE/'
  965. this contains a PIPE char
  966. (gdb) | -d xxx echo this contains a | char!\n xxx sed -e 's/|/PIPE/'
  967. this contains a PIPE char!
  968. (gdb)
  969. The convenience variables '$_shell_exitcode' and '$_shell_exitsignal'
  970. can be used to examine the exit status of the last shell command
  971. launched by 'shell', 'make', 'pipe' and '|'. *Note Convenience
  972. Variables: Convenience Vars.
  973. 
  974. File: gdb.info, Node: Logging Output, Prev: Shell Commands, Up: Invocation
  975. 2.4 Logging Output
  976. ==================
  977. You may want to save the output of GDB commands to a file. There are
  978. several commands to control GDB's logging.
  979. 'set logging on'
  980. Enable logging.
  981. 'set logging off'
  982. Disable logging.
  983. 'set logging file FILE'
  984. Change the name of the current logfile. The default logfile is
  985. 'gdb.txt'.
  986. 'set logging overwrite [on|off]'
  987. By default, GDB will append to the logfile. Set 'overwrite' if you
  988. want 'set logging on' to overwrite the logfile instead.
  989. 'set logging redirect [on|off]'
  990. By default, GDB output will go to both the terminal and the
  991. logfile. Set 'redirect' if you want output to go only to the log
  992. file.
  993. 'set logging debugredirect [on|off]'
  994. By default, GDB debug output will go to both the terminal and the
  995. logfile. Set 'debugredirect' if you want debug output to go only
  996. to the log file.
  997. 'show logging'
  998. Show the current values of the logging settings.
  999. You can also redirect the output of a GDB command to a shell command.
  1000. *Note pipe::.
  1001. 
  1002. File: gdb.info, Node: Commands, Next: Running, Prev: Invocation, Up: Top
  1003. 3 GDB Commands
  1004. **************
  1005. You can abbreviate a GDB command to the first few letters of the command
  1006. name, if that abbreviation is unambiguous; and you can repeat certain
  1007. GDB commands by typing just <RET>. You can also use the <TAB> key to
  1008. get GDB to fill out the rest of a word in a command (or to show you the
  1009. alternatives available, if there is more than one possibility).
  1010. * Menu:
  1011. * Command Syntax:: How to give commands to GDB
  1012. * Command Settings:: How to change default behavior of commands
  1013. * Completion:: Command completion
  1014. * Command Options:: Command options
  1015. * Help:: How to ask GDB for help
  1016. 
  1017. File: gdb.info, Node: Command Syntax, Next: Command Settings, Up: Commands
  1018. 3.1 Command Syntax
  1019. ==================
  1020. A GDB command is a single line of input. There is no limit on how long
  1021. it can be. It starts with a command name, which is followed by
  1022. arguments whose meaning depends on the command name. For example, the
  1023. command 'step' accepts an argument which is the number of times to step,
  1024. as in 'step 5'. You can also use the 'step' command with no arguments.
  1025. Some commands do not allow any arguments.
  1026. GDB command names may always be truncated if that abbreviation is
  1027. unambiguous. Other possible command abbreviations are listed in the
  1028. documentation for individual commands. In some cases, even ambiguous
  1029. abbreviations are allowed; for example, 's' is specially defined as
  1030. equivalent to 'step' even though there are other commands whose names
  1031. start with 's'. You can test abbreviations by using them as arguments
  1032. to the 'help' command.
  1033. A blank line as input to GDB (typing just <RET>) means to repeat the
  1034. previous command. Certain commands (for example, 'run') will not repeat
  1035. this way; these are commands whose unintentional repetition might cause
  1036. trouble and which you are unlikely to want to repeat. User-defined
  1037. commands can disable this feature; see *note dont-repeat: Define.
  1038. The 'list' and 'x' commands, when you repeat them with <RET>,
  1039. construct new arguments rather than repeating exactly as typed. This
  1040. permits easy scanning of source or memory.
  1041. GDB can also use <RET> in another way: to partition lengthy output,
  1042. in a way similar to the common utility 'more' (*note Screen Size: Screen
  1043. Size.). Since it is easy to press one <RET> too many in this situation,
  1044. GDB disables command repetition after any command that generates this
  1045. sort of display.
  1046. Any text from a '#' to the end of the line is a comment; it does
  1047. nothing. This is useful mainly in command files (*note Command Files:
  1048. Command Files.).
  1049. The 'Ctrl-o' binding is useful for repeating a complex sequence of
  1050. commands. This command accepts the current line, like <RET>, and then
  1051. fetches the next line relative to the current line from the history for
  1052. editing.
  1053. 
  1054. File: gdb.info, Node: Command Settings, Next: Completion, Prev: Command Syntax, Up: Commands
  1055. 3.2 Command Settings
  1056. ====================
  1057. Many commands change their behavior according to command-specific
  1058. variables or settings. These settings can be changed with the 'set'
  1059. subcommands. For example, the 'print' command (*note Examining Data:
  1060. Data.) prints arrays differently depending on settings changeable with
  1061. the commands 'set print elements NUMBER-OF-ELEMENTS' and 'set print
  1062. array-indexes', among others.
  1063. You can change these settings to your preference in the gdbinit files
  1064. loaded at GDB startup. *Note Startup::.
  1065. The settings can also be changed interactively during the debugging
  1066. session. For example, to change the limit of array elements to print,
  1067. you can do the following:
  1068. (GDB) set print elements 10
  1069. (GDB) print some_array
  1070. $1 = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90...}
  1071. The above 'set print elements 10' command changes the number of
  1072. elements to print from the default of 200 to 10. If you only intend
  1073. this limit of 10 to be used for printing 'some_array', then you must
  1074. restore the limit back to 200, with 'set print elements 200'.
  1075. Some commands allow overriding settings with command options. For
  1076. example, the 'print' command supports a number of options that allow
  1077. overriding relevant global print settings as set by 'set print'
  1078. subcommands. *Note print options::. The example above could be
  1079. rewritten as:
  1080. (GDB) print -elements 10 -- some_array
  1081. $1 = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90...}
  1082. Alternatively, you can use the 'with' command to change a setting
  1083. temporarily, for the duration of a command invocation.
  1084. 'with SETTING [VALUE] [-- COMMAND]'
  1085. 'w SETTING [VALUE] [-- COMMAND]'
  1086. Temporarily set SETTING to VALUE for the duration of COMMAND.
  1087. SETTING is any setting you can change with the 'set' subcommands.
  1088. VALUE is the value to assign to 'setting' while running 'command'.
  1089. If no COMMAND is provided, the last command executed is repeated.
  1090. If a COMMAND is provided, it must be preceded by a double dash
  1091. ('--') separator. This is required because some settings accept
  1092. free-form arguments, such as expressions or filenames.
  1093. For example, the command
  1094. (GDB) with print array on -- print some_array
  1095. is equivalent to the following 3 commands:
  1096. (GDB) set print array on
  1097. (GDB) print some_array
  1098. (GDB) set print array off
  1099. The 'with' command is particularly useful when you want to override
  1100. a setting while running user-defined commands, or commands defined
  1101. in Python or Guile. *Note Extending GDB: Extending GDB.
  1102. (GDB) with print pretty on -- my_complex_command
  1103. To change several settings for the same command, you can nest
  1104. 'with' commands. For example, 'with language ada -- with print
  1105. elements 10' temporarily changes the language to Ada and sets a
  1106. limit of 10 elements to print for arrays and strings.
  1107. 
  1108. File: gdb.info, Node: Completion, Next: Command Options, Prev: Command Settings, Up: Commands
  1109. 3.3 Command Completion
  1110. ======================
  1111. GDB can fill in the rest of a word in a command for you, if there is
  1112. only one possibility; it can also show you what the valid possibilities
  1113. are for the next word in a command, at any time. This works for GDB
  1114. commands, GDB subcommands, command options, and the names of symbols in
  1115. your program.
  1116. Press the <TAB> key whenever you want GDB to fill out the rest of a
  1117. word. If there is only one possibility, GDB fills in the word, and
  1118. waits for you to finish the command (or press <RET> to enter it). For
  1119. example, if you type
  1120. (gdb) info bre <TAB>
  1121. GDB fills in the rest of the word 'breakpoints', since that is the only
  1122. 'info' subcommand beginning with 'bre':
  1123. (gdb) info breakpoints
  1124. You can either press <RET> at this point, to run the 'info breakpoints'
  1125. command, or backspace and enter something else, if 'breakpoints' does
  1126. not look like the command you expected. (If you were sure you wanted
  1127. 'info breakpoints' in the first place, you might as well just type <RET>
  1128. immediately after 'info bre', to exploit command abbreviations rather
  1129. than command completion).
  1130. If there is more than one possibility for the next word when you
  1131. press <TAB>, GDB sounds a bell. You can either supply more characters
  1132. and try again, or just press <TAB> a second time; GDB displays all the
  1133. possible completions for that word. For example, you might want to set
  1134. a breakpoint on a subroutine whose name begins with 'make_', but when
  1135. you type 'b make_<TAB>' GDB just sounds the bell. Typing <TAB> again
  1136. displays all the function names in your program that begin with those
  1137. characters, for example:
  1138. (gdb) b make_ <TAB>
  1139. GDB sounds bell; press <TAB> again, to see:
  1140. make_a_section_from_file make_environ
  1141. make_abs_section make_function_type
  1142. make_blockvector make_pointer_type
  1143. make_cleanup make_reference_type
  1144. make_command make_symbol_completion_list
  1145. (gdb) b make_
  1146. After displaying the available possibilities, GDB copies your partial
  1147. input ('b make_' in the example) so you can finish the command.
  1148. If you just want to see the list of alternatives in the first place,
  1149. you can press 'M-?' rather than pressing <TAB> twice. 'M-?' means
  1150. '<META> ?'. You can type this either by holding down a key designated
  1151. as the <META> shift on your keyboard (if there is one) while typing '?',
  1152. or as <ESC> followed by '?'.
  1153. If the number of possible completions is large, GDB will print as
  1154. much of the list as it has collected, as well as a message indicating
  1155. that the list may be truncated.
  1156. (gdb) b m<TAB><TAB>
  1157. main
  1158. <... the rest of the possible completions ...>
  1159. *** List may be truncated, max-completions reached. ***
  1160. (gdb) b m
  1161. This behavior can be controlled with the following commands:
  1162. 'set max-completions LIMIT'
  1163. 'set max-completions unlimited'
  1164. Set the maximum number of completion candidates. GDB will stop
  1165. looking for more completions once it collects this many candidates.
  1166. This is useful when completing on things like function names as
  1167. collecting all the possible candidates can be time consuming. The
  1168. default value is 200. A value of zero disables tab-completion.
  1169. Note that setting either no limit or a very large limit can make
  1170. completion slow.
  1171. 'show max-completions'
  1172. Show the maximum number of candidates that GDB will collect and
  1173. show during completion.
  1174. Sometimes the string you need, while logically a "word", may contain
  1175. parentheses or other characters that GDB normally excludes from its
  1176. notion of a word. To permit word completion to work in this situation,
  1177. you may enclose words in ''' (single quote marks) in GDB commands.
  1178. A likely situation where you might need this is in typing an
  1179. expression that involves a C++ symbol name with template parameters.
  1180. This is because when completing expressions, GDB treats the '<'
  1181. character as word delimiter, assuming that it's the less-than comparison
  1182. operator (*note C and C++ Operators: C Operators.).
  1183. For example, when you want to call a C++ template function
  1184. interactively using the 'print' or 'call' commands, you may need to
  1185. distinguish whether you mean the version of 'name' that was specialized
  1186. for 'int', 'name<int>()', or the version that was specialized for
  1187. 'float', 'name<float>()'. To use the word-completion facilities in this
  1188. situation, type a single quote ''' at the beginning of the function
  1189. name. This alerts GDB that it may need to consider more information
  1190. than usual when you press <TAB> or 'M-?' to request word completion:
  1191. (gdb) p 'func< M-?
  1192. func<int>() func<float>()
  1193. (gdb) p 'func<
  1194. When setting breakpoints however (*note Specify Location::), you
  1195. don't usually need to type a quote before the function name, because GDB
  1196. understands that you want to set a breakpoint on a function:
  1197. (gdb) b func< M-?
  1198. func<int>() func<float>()
  1199. (gdb) b func<
  1200. This is true even in the case of typing the name of C++ overloaded
  1201. functions (multiple definitions of the same function, distinguished by
  1202. argument type). For example, when you want to set a breakpoint you
  1203. don't need to distinguish whether you mean the version of 'name' that
  1204. takes an 'int' parameter, 'name(int)', or the version that takes a
  1205. 'float' parameter, 'name(float)'.
  1206. (gdb) b bubble( M-?
  1207. bubble(int) bubble(double)
  1208. (gdb) b bubble(dou M-?
  1209. bubble(double)
  1210. See *note quoting names:: for a description of other scenarios that
  1211. require quoting.
  1212. For more information about overloaded functions, see *note C++
  1213. Expressions: C Plus Plus Expressions. You can use the command 'set
  1214. overload-resolution off' to disable overload resolution; see *note GDB
  1215. Features for C++: Debugging C Plus Plus.
  1216. When completing in an expression which looks up a field in a
  1217. structure, GDB also tries(1) to limit completions to the field names
  1218. available in the type of the left-hand-side:
  1219. (gdb) p gdb_stdout.M-?
  1220. magic to_fputs to_rewind
  1221. to_data to_isatty to_write
  1222. to_delete to_put to_write_async_safe
  1223. to_flush to_read
  1224. This is because the 'gdb_stdout' is a variable of the type 'struct
  1225. ui_file' that is defined in GDB sources as follows:
  1226. struct ui_file
  1227. {
  1228. int *magic;
  1229. ui_file_flush_ftype *to_flush;
  1230. ui_file_write_ftype *to_write;
  1231. ui_file_write_async_safe_ftype *to_write_async_safe;
  1232. ui_file_fputs_ftype *to_fputs;
  1233. ui_file_read_ftype *to_read;
  1234. ui_file_delete_ftype *to_delete;
  1235. ui_file_isatty_ftype *to_isatty;
  1236. ui_file_rewind_ftype *to_rewind;
  1237. ui_file_put_ftype *to_put;
  1238. void *to_data;
  1239. }
  1240. ---------- Footnotes ----------
  1241. (1) The completer can be confused by certain kinds of invalid
  1242. expressions. Also, it only examines the static type of the expression,
  1243. not the dynamic type.
  1244. 
  1245. File: gdb.info, Node: Command Options, Next: Help, Prev: Completion, Up: Commands
  1246. 3.4 Command options
  1247. ===================
  1248. Some commands accept options starting with a leading dash. For example,
  1249. 'print -pretty'. Similarly to command names, you can abbreviate a GDB
  1250. option to the first few letters of the option name, if that abbreviation
  1251. is unambiguous, and you can also use the <TAB> key to get GDB to fill
  1252. out the rest of a word in an option (or to show you the alternatives
  1253. available, if there is more than one possibility).
  1254. Some commands take raw input as argument. For example, the print
  1255. command processes arbitrary expressions in any of the languages
  1256. supported by GDB. With such commands, because raw input may start with
  1257. a leading dash that would be confused with an option or any of its
  1258. abbreviations, e.g. 'print -p' (short for 'print -pretty' or printing
  1259. negative 'p'?), if you specify any command option, then you must use a
  1260. double-dash ('--') delimiter to indicate the end of options.
  1261. Some options are described as accepting an argument which can be
  1262. either 'on' or 'off'. These are known as "boolean options". Similarly
  1263. to boolean settings commands--'on' and 'off' are the typical values, but
  1264. any of '1', 'yes' and 'enable' can also be used as "true" value, and any
  1265. of '0', 'no' and 'disable' can also be used as "false" value. You can
  1266. also omit a "true" value, as it is implied by default.
  1267. For example, these are equivalent:
  1268. (gdb) print -object on -pretty off -element unlimited -- *myptr
  1269. (gdb) p -o -p 0 -e u -- *myptr
  1270. You can discover the set of options some command accepts by
  1271. completing on '-' after the command name. For example:
  1272. (gdb) print -<TAB><TAB>
  1273. -address -max-depth -raw-values -union
  1274. -array -null-stop -repeats -vtbl
  1275. -array-indexes -object -static-members
  1276. -elements -pretty -symbol
  1277. Completion will in some cases guide you with a suggestion of what
  1278. kind of argument an option expects. For example:
  1279. (gdb) print -elements <TAB><TAB>
  1280. NUMBER unlimited
  1281. Here, the option expects a number (e.g., '100'), not literal
  1282. 'NUMBER'. Such metasyntactical arguments are always presented in
  1283. uppercase.
  1284. (For more on using the 'print' command, see *note Examining Data:
  1285. Data.)
  1286. 
  1287. File: gdb.info, Node: Help, Prev: Command Options, Up: Commands
  1288. 3.5 Getting Help
  1289. ================
  1290. You can always ask GDB itself for information on its commands, using the
  1291. command 'help'.
  1292. 'help'
  1293. 'h'
  1294. You can use 'help' (abbreviated 'h') with no arguments to display a
  1295. short list of named classes of commands:
  1296. (gdb) help
  1297. List of classes of commands:
  1298. aliases -- Aliases of other commands
  1299. breakpoints -- Making program stop at certain points
  1300. data -- Examining data
  1301. files -- Specifying and examining files
  1302. internals -- Maintenance commands
  1303. obscure -- Obscure features
  1304. running -- Running the program
  1305. stack -- Examining the stack
  1306. status -- Status inquiries
  1307. support -- Support facilities
  1308. tracepoints -- Tracing of program execution without
  1309. stopping the program
  1310. user-defined -- User-defined commands
  1311. Type "help" followed by a class name for a list of
  1312. commands in that class.
  1313. Type "help" followed by command name for full
  1314. documentation.
  1315. Command name abbreviations are allowed if unambiguous.
  1316. (gdb)
  1317. 'help CLASS'
  1318. Using one of the general help classes as an argument, you can get a
  1319. list of the individual commands in that class. For example, here
  1320. is the help display for the class 'status':
  1321. (gdb) help status
  1322. Status inquiries.
  1323. List of commands:
  1324. info -- Generic command for showing things
  1325. about the program being debugged
  1326. show -- Generic command for showing things
  1327. about the debugger
  1328. Type "help" followed by command name for full
  1329. documentation.
  1330. Command name abbreviations are allowed if unambiguous.
  1331. (gdb)
  1332. 'help COMMAND'
  1333. With a command name as 'help' argument, GDB displays a short
  1334. paragraph on how to use that command.
  1335. 'apropos [-v] REGEXP'
  1336. The 'apropos' command searches through all of the GDB commands, and
  1337. their documentation, for the regular expression specified in ARGS.
  1338. It prints out all matches found. The optional flag '-v', which
  1339. stands for 'verbose', indicates to output the full documentation of
  1340. the matching commands and highlight the parts of the documentation
  1341. matching REGEXP. For example:
  1342. apropos alias
  1343. results in:
  1344. alias -- Define a new command that is an alias of an existing command
  1345. aliases -- Aliases of other commands
  1346. d -- Delete some breakpoints or auto-display expressions
  1347. del -- Delete some breakpoints or auto-display expressions
  1348. delete -- Delete some breakpoints or auto-display expressions
  1349. while
  1350. apropos -v cut.*thread apply
  1351. results in the below output, where 'cut for 'thread apply' is
  1352. highlighted if styling is enabled.
  1353. taas -- Apply a command to all threads (ignoring errors
  1354. and empty output).
  1355. Usage: taas COMMAND
  1356. shortcut for 'thread apply all -s COMMAND'
  1357. tfaas -- Apply a command to all frames of all threads
  1358. (ignoring errors and empty output).
  1359. Usage: tfaas COMMAND
  1360. shortcut for 'thread apply all -s frame apply all -s COMMAND'
  1361. 'complete ARGS'
  1362. The 'complete ARGS' command lists all the possible completions for
  1363. the beginning of a command. Use ARGS to specify the beginning of
  1364. the command you want completed. For example:
  1365. complete i
  1366. results in:
  1367. if
  1368. ignore
  1369. info
  1370. inspect
  1371. This is intended for use by GNU Emacs.
  1372. In addition to 'help', you can use the GDB commands 'info' and 'show'
  1373. to inquire about the state of your program, or the state of GDB itself.
  1374. Each command supports many topics of inquiry; this manual introduces
  1375. each of them in the appropriate context. The listings under 'info' and
  1376. under 'show' in the Command, Variable, and Function Index point to all
  1377. the sub-commands. *Note Command and Variable Index::.
  1378. 'info'
  1379. This command (abbreviated 'i') is for describing the state of your
  1380. program. For example, you can show the arguments passed to a
  1381. function with 'info args', list the registers currently in use with
  1382. 'info registers', or list the breakpoints you have set with 'info
  1383. breakpoints'. You can get a complete list of the 'info'
  1384. sub-commands with 'help info'.
  1385. 'set'
  1386. You can assign the result of an expression to an environment
  1387. variable with 'set'. For example, you can set the GDB prompt to a
  1388. $-sign with 'set prompt $'.
  1389. 'show'
  1390. In contrast to 'info', 'show' is for describing the state of GDB
  1391. itself. You can change most of the things you can 'show', by using
  1392. the related command 'set'; for example, you can control what number
  1393. system is used for displays with 'set radix', or simply inquire
  1394. which is currently in use with 'show radix'.
  1395. To display all the settable parameters and their current values,
  1396. you can use 'show' with no arguments; you may also use 'info set'.
  1397. Both commands produce the same display.
  1398. Here are several miscellaneous 'show' subcommands, all of which are
  1399. exceptional in lacking corresponding 'set' commands:
  1400. 'show version'
  1401. Show what version of GDB is running. You should include this
  1402. information in GDB bug-reports. If multiple versions of GDB are in
  1403. use at your site, you may need to determine which version of GDB
  1404. you are running; as GDB evolves, new commands are introduced, and
  1405. old ones may wither away. Also, many system vendors ship variant
  1406. versions of GDB, and there are variant versions of GDB in GNU/Linux
  1407. distributions as well. The version number is the same as the one
  1408. announced when you start GDB.
  1409. 'show copying'
  1410. 'info copying'
  1411. Display information about permission for copying GDB.
  1412. 'show warranty'
  1413. 'info warranty'
  1414. Display the GNU "NO WARRANTY" statement, or a warranty, if your
  1415. version of GDB comes with one.
  1416. 'show configuration'
  1417. Display detailed information about the way GDB was configured when
  1418. it was built. This displays the optional arguments passed to the
  1419. 'configure' script and also configuration parameters detected
  1420. automatically by 'configure'. When reporting a GDB bug (*note GDB
  1421. Bugs::), it is important to include this information in your
  1422. report.
  1423. 
  1424. File: gdb.info, Node: Running, Next: Stopping, Prev: Commands, Up: Top
  1425. 4 Running Programs Under GDB
  1426. ****************************
  1427. When you run a program under GDB, you must first generate debugging
  1428. information when you compile it.
  1429. You may start GDB with its arguments, if any, in an environment of
  1430. your choice. If you are doing native debugging, you may redirect your
  1431. program's input and output, debug an already running process, or kill a
  1432. child process.
  1433. * Menu:
  1434. * Compilation:: Compiling for debugging
  1435. * Starting:: Starting your program
  1436. * Arguments:: Your program's arguments
  1437. * Environment:: Your program's environment
  1438. * Working Directory:: Your program's working directory
  1439. * Input/Output:: Your program's input and output
  1440. * Attach:: Debugging an already-running process
  1441. * Kill Process:: Killing the child process
  1442. * Inferiors and Programs:: Debugging multiple inferiors and programs
  1443. * Threads:: Debugging programs with multiple threads
  1444. * Forks:: Debugging forks
  1445. * Checkpoint/Restart:: Setting a _bookmark_ to return to later
  1446. 
  1447. File: gdb.info, Node: Compilation, Next: Starting, Up: Running
  1448. 4.1 Compiling for Debugging
  1449. ===========================
  1450. In order to debug a program effectively, you need to generate debugging
  1451. information when you compile it. This debugging information is stored
  1452. in the object file; it describes the data type of each variable or
  1453. function and the correspondence between source line numbers and
  1454. addresses in the executable code.
  1455. To request debugging information, specify the '-g' option when you
  1456. run the compiler.
  1457. Programs that are to be shipped to your customers are compiled with
  1458. optimizations, using the '-O' compiler option. However, some compilers
  1459. are unable to handle the '-g' and '-O' options together. Using those
  1460. compilers, you cannot generate optimized executables containing
  1461. debugging information.
  1462. GCC, the GNU C/C++ compiler, supports '-g' with or without '-O',
  1463. making it possible to debug optimized code. We recommend that you
  1464. _always_ use '-g' whenever you compile a program. You may think your
  1465. program is correct, but there is no sense in pushing your luck. For
  1466. more information, see *note Optimized Code::.
  1467. Older versions of the GNU C compiler permitted a variant option '-gg'
  1468. for debugging information. GDB no longer supports this format; if your
  1469. GNU C compiler has this option, do not use it.
  1470. GDB knows about preprocessor macros and can show you their expansion
  1471. (*note Macros::). Most compilers do not include information about
  1472. preprocessor macros in the debugging information if you specify the '-g'
  1473. flag alone. Version 3.1 and later of GCC, the GNU C compiler, provides
  1474. macro information if you are using the DWARF debugging format, and
  1475. specify the option '-g3'.
  1476. *Note Options for Debugging Your Program or GCC: (gcc)Debugging
  1477. Options, for more information on GCC options affecting debug
  1478. information.
  1479. You will have the best debugging experience if you use the latest
  1480. version of the DWARF debugging format that your compiler supports.
  1481. DWARF is currently the most expressive and best supported debugging
  1482. format in GDB.
  1483. 
  1484. File: gdb.info, Node: Starting, Next: Arguments, Prev: Compilation, Up: Running
  1485. 4.2 Starting your Program
  1486. =========================
  1487. 'run'
  1488. 'r'
  1489. Use the 'run' command to start your program under GDB. You must
  1490. first specify the program name with an argument to GDB (*note
  1491. Getting In and Out of GDB: Invocation.), or by using the 'file' or
  1492. 'exec-file' command (*note Commands to Specify Files: Files.).
  1493. If you are running your program in an execution environment that
  1494. supports processes, 'run' creates an inferior process and makes that
  1495. process run your program. In some environments without processes, 'run'
  1496. jumps to the start of your program. Other targets, like 'remote', are
  1497. always running. If you get an error message like this one:
  1498. The "remote" target does not support "run".
  1499. Try "help target" or "continue".
  1500. then use 'continue' to run your program. You may need 'load' first
  1501. (*note load::).
  1502. The execution of a program is affected by certain information it
  1503. receives from its superior. GDB provides ways to specify this
  1504. information, which you must do _before_ starting your program. (You can
  1505. change it after starting your program, but such changes only affect your
  1506. program the next time you start it.) This information may be divided
  1507. into four categories:
  1508. The _arguments._
  1509. Specify the arguments to give your program as the arguments of the
  1510. 'run' command. If a shell is available on your target, the shell
  1511. is used to pass the arguments, so that you may use normal
  1512. conventions (such as wildcard expansion or variable substitution)
  1513. in describing the arguments. In Unix systems, you can control
  1514. which shell is used with the 'SHELL' environment variable. If you
  1515. do not define 'SHELL', GDB uses the default shell ('/bin/sh'). You
  1516. can disable use of any shell with the 'set startup-with-shell'
  1517. command (see below for details).
  1518. The _environment._
  1519. Your program normally inherits its environment from GDB, but you
  1520. can use the GDB commands 'set environment' and 'unset environment'
  1521. to change parts of the environment that affect your program. *Note
  1522. Your Program's Environment: Environment.
  1523. The _working directory._
  1524. You can set your program's working directory with the command 'set
  1525. cwd'. If you do not set any working directory with this command,
  1526. your program will inherit GDB's working directory if native
  1527. debugging, or the remote server's working directory if remote
  1528. debugging. *Note Your Program's Working Directory: Working
  1529. Directory.
  1530. The _standard input and output._
  1531. Your program normally uses the same device for standard input and
  1532. standard output as GDB is using. You can redirect input and output
  1533. in the 'run' command line, or you can use the 'tty' command to set
  1534. a different device for your program. *Note Your Program's Input
  1535. and Output: Input/Output.
  1536. _Warning:_ While input and output redirection work, you cannot use
  1537. pipes to pass the output of the program you are debugging to
  1538. another program; if you attempt this, GDB is likely to wind up
  1539. debugging the wrong program.
  1540. When you issue the 'run' command, your program begins to execute
  1541. immediately. *Note Stopping and Continuing: Stopping, for discussion of
  1542. how to arrange for your program to stop. Once your program has stopped,
  1543. you may call functions in your program, using the 'print' or 'call'
  1544. commands. *Note Examining Data: Data.
  1545. If the modification time of your symbol file has changed since the
  1546. last time GDB read its symbols, GDB discards its symbol table, and reads
  1547. it again. When it does this, GDB tries to retain your current
  1548. breakpoints.
  1549. 'start'
  1550. The name of the main procedure can vary from language to language.
  1551. With C or C++, the main procedure name is always 'main', but other
  1552. languages such as Ada do not require a specific name for their main
  1553. procedure. The debugger provides a convenient way to start the
  1554. execution of the program and to stop at the beginning of the main
  1555. procedure, depending on the language used.
  1556. The 'start' command does the equivalent of setting a temporary
  1557. breakpoint at the beginning of the main procedure and then invoking
  1558. the 'run' command.
  1559. Some programs contain an "elaboration" phase where some startup
  1560. code is executed before the main procedure is called. This depends
  1561. on the languages used to write your program. In C++, for instance,
  1562. constructors for static and global objects are executed before
  1563. 'main' is called. It is therefore possible that the debugger stops
  1564. before reaching the main procedure. However, the temporary
  1565. breakpoint will remain to halt execution.
  1566. Specify the arguments to give to your program as arguments to the
  1567. 'start' command. These arguments will be given verbatim to the
  1568. underlying 'run' command. Note that the same arguments will be
  1569. reused if no argument is provided during subsequent calls to
  1570. 'start' or 'run'.
  1571. It is sometimes necessary to debug the program during elaboration.
  1572. In these cases, using the 'start' command would stop the execution
  1573. of your program too late, as the program would have already
  1574. completed the elaboration phase. Under these circumstances, either
  1575. insert breakpoints in your elaboration code before running your
  1576. program or use the 'starti' command.
  1577. 'starti'
  1578. The 'starti' command does the equivalent of setting a temporary
  1579. breakpoint at the first instruction of a program's execution and
  1580. then invoking the 'run' command. For programs containing an
  1581. elaboration phase, the 'starti' command will stop execution at the
  1582. start of the elaboration phase.
  1583. 'set exec-wrapper WRAPPER'
  1584. 'show exec-wrapper'
  1585. 'unset exec-wrapper'
  1586. When 'exec-wrapper' is set, the specified wrapper is used to launch
  1587. programs for debugging. GDB starts your program with a shell
  1588. command of the form 'exec WRAPPER PROGRAM'. Quoting is added to
  1589. PROGRAM and its arguments, but not to WRAPPER, so you should add
  1590. quotes if appropriate for your shell. The wrapper runs until it
  1591. executes your program, and then GDB takes control.
  1592. You can use any program that eventually calls 'execve' with its
  1593. arguments as a wrapper. Several standard Unix utilities do this,
  1594. e.g. 'env' and 'nohup'. Any Unix shell script ending with 'exec
  1595. "$@"' will also work.
  1596. For example, you can use 'env' to pass an environment variable to
  1597. the debugged program, without setting the variable in your shell's
  1598. environment:
  1599. (gdb) set exec-wrapper env 'LD_PRELOAD=libtest.so'
  1600. (gdb) run
  1601. This command is available when debugging locally on most targets,
  1602. excluding DJGPP, Cygwin, MS Windows, and QNX Neutrino.
  1603. 'set startup-with-shell'
  1604. 'set startup-with-shell on'
  1605. 'set startup-with-shell off'
  1606. 'show startup-with-shell'
  1607. On Unix systems, by default, if a shell is available on your
  1608. target, GDB) uses it to start your program. Arguments of the 'run'
  1609. command are passed to the shell, which does variable substitution,
  1610. expands wildcard characters and performs redirection of I/O. In
  1611. some circumstances, it may be useful to disable such use of a
  1612. shell, for example, when debugging the shell itself or diagnosing
  1613. startup failures such as:
  1614. (gdb) run
  1615. Starting program: ./a.out
  1616. During startup program terminated with signal SIGSEGV, Segmentation fault.
  1617. which indicates the shell or the wrapper specified with
  1618. 'exec-wrapper' crashed, not your program. Most often, this is
  1619. caused by something odd in your shell's non-interactive mode
  1620. initialization file--such as '.cshrc' for C-shell, $'.zshenv' for
  1621. the Z shell, or the file specified in the 'BASH_ENV' environment
  1622. variable for BASH.
  1623. 'set auto-connect-native-target'
  1624. 'set auto-connect-native-target on'
  1625. 'set auto-connect-native-target off'
  1626. 'show auto-connect-native-target'
  1627. By default, if not connected to any target yet (e.g., with 'target
  1628. remote'), the 'run' command starts your program as a native process
  1629. under GDB, on your local machine. If you're sure you don't want to
  1630. debug programs on your local machine, you can tell GDB to not
  1631. connect to the native target automatically with the 'set
  1632. auto-connect-native-target off' command.
  1633. If 'on', which is the default, and if GDB is not connected to a
  1634. target already, the 'run' command automaticaly connects to the
  1635. native target, if one is available.
  1636. If 'off', and if GDB is not connected to a target already, the
  1637. 'run' command fails with an error:
  1638. (gdb) run
  1639. Don't know how to run. Try "help target".
  1640. If GDB is already connected to a target, GDB always uses it with
  1641. the 'run' command.
  1642. In any case, you can explicitly connect to the native target with
  1643. the 'target native' command. For example,
  1644. (gdb) set auto-connect-native-target off
  1645. (gdb) run
  1646. Don't know how to run. Try "help target".
  1647. (gdb) target native
  1648. (gdb) run
  1649. Starting program: ./a.out
  1650. [Inferior 1 (process 10421) exited normally]
  1651. In case you connected explicitly to the 'native' target, GDB
  1652. remains connected even if all inferiors exit, ready for the next
  1653. 'run' command. Use the 'disconnect' command to disconnect.
  1654. Examples of other commands that likewise respect the
  1655. 'auto-connect-native-target' setting: 'attach', 'info proc', 'info
  1656. os'.
  1657. 'set disable-randomization'
  1658. 'set disable-randomization on'
  1659. This option (enabled by default in GDB) will turn off the native
  1660. randomization of the virtual address space of the started program.
  1661. This option is useful for multiple debugging sessions to make the
  1662. execution better reproducible and memory addresses reusable across
  1663. debugging sessions.
  1664. This feature is implemented only on certain targets, including
  1665. GNU/Linux. On GNU/Linux you can get the same behavior using
  1666. (gdb) set exec-wrapper setarch `uname -m` -R
  1667. 'set disable-randomization off'
  1668. Leave the behavior of the started executable unchanged. Some bugs
  1669. rear their ugly heads only when the program is loaded at certain
  1670. addresses. If your bug disappears when you run the program under
  1671. GDB, that might be because GDB by default disables the address
  1672. randomization on platforms, such as GNU/Linux, which do that for
  1673. stand-alone programs. Use 'set disable-randomization off' to try
  1674. to reproduce such elusive bugs.
  1675. On targets where it is available, virtual address space
  1676. randomization protects the programs against certain kinds of
  1677. security attacks. In these cases the attacker needs to know the
  1678. exact location of a concrete executable code. Randomizing its
  1679. location makes it impossible to inject jumps misusing a code at its
  1680. expected addresses.
  1681. Prelinking shared libraries provides a startup performance
  1682. advantage but it makes addresses in these libraries predictable for
  1683. privileged processes by having just unprivileged access at the
  1684. target system. Reading the shared library binary gives enough
  1685. information for assembling the malicious code misusing it. Still
  1686. even a prelinked shared library can get loaded at a new random
  1687. address just requiring the regular relocation process during the
  1688. startup. Shared libraries not already prelinked are always loaded
  1689. at a randomly chosen address.
  1690. Position independent executables (PIE) contain position independent
  1691. code similar to the shared libraries and therefore such executables
  1692. get loaded at a randomly chosen address upon startup. PIE
  1693. executables always load even already prelinked shared libraries at
  1694. a random address. You can build such executable using 'gcc -fPIE
  1695. -pie'.
  1696. Heap (malloc storage), stack and custom mmap areas are always
  1697. placed randomly (as long as the randomization is enabled).
  1698. 'show disable-randomization'
  1699. Show the current setting of the explicit disable of the native
  1700. randomization of the virtual address space of the started program.
  1701. 
  1702. File: gdb.info, Node: Arguments, Next: Environment, Prev: Starting, Up: Running
  1703. 4.3 Your Program's Arguments
  1704. ============================
  1705. The arguments to your program can be specified by the arguments of the
  1706. 'run' command. They are passed to a shell, which expands wildcard
  1707. characters and performs redirection of I/O, and thence to your program.
  1708. Your 'SHELL' environment variable (if it exists) specifies what shell
  1709. GDB uses. If you do not define 'SHELL', GDB uses the default shell
  1710. ('/bin/sh' on Unix).
  1711. On non-Unix systems, the program is usually invoked directly by GDB,
  1712. which emulates I/O redirection via the appropriate system calls, and the
  1713. wildcard characters are expanded by the startup code of the program, not
  1714. by the shell.
  1715. 'run' with no arguments uses the same arguments used by the previous
  1716. 'run', or those set by the 'set args' command.
  1717. 'set args'
  1718. Specify the arguments to be used the next time your program is run.
  1719. If 'set args' has no arguments, 'run' executes your program with no
  1720. arguments. Once you have run your program with arguments, using
  1721. 'set args' before the next 'run' is the only way to run it again
  1722. without arguments.
  1723. 'show args'
  1724. Show the arguments to give your program when it is started.
  1725. 
  1726. File: gdb.info, Node: Environment, Next: Working Directory, Prev: Arguments, Up: Running
  1727. 4.4 Your Program's Environment
  1728. ==============================
  1729. The "environment" consists of a set of environment variables and their
  1730. values. Environment variables conventionally record such things as your
  1731. user name, your home directory, your terminal type, and your search path
  1732. for programs to run. Usually you set up environment variables with the
  1733. shell and they are inherited by all the other programs you run. When
  1734. debugging, it can be useful to try running your program with a modified
  1735. environment without having to start GDB over again.
  1736. 'path DIRECTORY'
  1737. Add DIRECTORY to the front of the 'PATH' environment variable (the
  1738. search path for executables) that will be passed to your program.
  1739. The value of 'PATH' used by GDB does not change. You may specify
  1740. several directory names, separated by whitespace or by a
  1741. system-dependent separator character (':' on Unix, ';' on MS-DOS
  1742. and MS-Windows). If DIRECTORY is already in the path, it is moved
  1743. to the front, so it is searched sooner.
  1744. You can use the string '$cwd' to refer to whatever is the current
  1745. working directory at the time GDB searches the path. If you use
  1746. '.' instead, it refers to the directory where you executed the
  1747. 'path' command. GDB replaces '.' in the DIRECTORY argument (with
  1748. the current path) before adding DIRECTORY to the search path.
  1749. 'show paths'
  1750. Display the list of search paths for executables (the 'PATH'
  1751. environment variable).
  1752. 'show environment [VARNAME]'
  1753. Print the value of environment variable VARNAME to be given to your
  1754. program when it starts. If you do not supply VARNAME, print the
  1755. names and values of all environment variables to be given to your
  1756. program. You can abbreviate 'environment' as 'env'.
  1757. 'set environment VARNAME [=VALUE]'
  1758. Set environment variable VARNAME to VALUE. The value changes for
  1759. your program (and the shell GDB uses to launch it), not for GDB
  1760. itself. The VALUE may be any string; the values of environment
  1761. variables are just strings, and any interpretation is supplied by
  1762. your program itself. The VALUE parameter is optional; if it is
  1763. eliminated, the variable is set to a null value.
  1764. For example, this command:
  1765. set env USER = foo
  1766. tells the debugged program, when subsequently run, that its user is
  1767. named 'foo'. (The spaces around '=' are used for clarity here;
  1768. they are not actually required.)
  1769. Note that on Unix systems, GDB runs your program via a shell, which
  1770. also inherits the environment set with 'set environment'. If
  1771. necessary, you can avoid that by using the 'env' program as a
  1772. wrapper instead of using 'set environment'. *Note set
  1773. exec-wrapper::, for an example doing just that.
  1774. Environment variables that are set by the user are also transmitted
  1775. to 'gdbserver' to be used when starting the remote inferior. *note
  1776. QEnvironmentHexEncoded::.
  1777. 'unset environment VARNAME'
  1778. Remove variable VARNAME from the environment to be passed to your
  1779. program. This is different from 'set env VARNAME ='; 'unset
  1780. environment' removes the variable from the environment, rather than
  1781. assigning it an empty value.
  1782. Environment variables that are unset by the user are also unset on
  1783. 'gdbserver' when starting the remote inferior. *note
  1784. QEnvironmentUnset::.
  1785. _Warning:_ On Unix systems, GDB runs your program using the shell
  1786. indicated by your 'SHELL' environment variable if it exists (or
  1787. '/bin/sh' if not). If your 'SHELL' variable names a shell that runs an
  1788. initialization file when started non-interactively--such as '.cshrc' for
  1789. C-shell, $'.zshenv' for the Z shell, or the file specified in the
  1790. 'BASH_ENV' environment variable for BASH--any variables you set in that
  1791. file affect your program. You may wish to move setting of environment
  1792. variables to files that are only run when you sign on, such as '.login'
  1793. or '.profile'.
  1794. 
  1795. File: gdb.info, Node: Working Directory, Next: Input/Output, Prev: Environment, Up: Running
  1796. 4.5 Your Program's Working Directory
  1797. ====================================
  1798. Each time you start your program with 'run', the inferior will be
  1799. initialized with the current working directory specified by the 'set
  1800. cwd' command. If no directory has been specified by this command, then
  1801. the inferior will inherit GDB's current working directory as its working
  1802. directory if native debugging, or it will inherit the remote server's
  1803. current working directory if remote debugging.
  1804. 'set cwd [DIRECTORY]'
  1805. Set the inferior's working directory to DIRECTORY, which will be
  1806. 'glob'-expanded in order to resolve tildes ('~'). If no argument
  1807. has been specified, the command clears the setting and resets it to
  1808. an empty state. This setting has no effect on GDB's working
  1809. directory, and it only takes effect the next time you start the
  1810. inferior. The '~' in DIRECTORY is a short for the "home
  1811. directory", usually pointed to by the 'HOME' environment variable.
  1812. On MS-Windows, if 'HOME' is not defined, GDB uses the concatenation
  1813. of 'HOMEDRIVE' and 'HOMEPATH' as fallback.
  1814. You can also change GDB's current working directory by using the
  1815. 'cd' command. *Note cd command::.
  1816. 'show cwd'
  1817. Show the inferior's working directory. If no directory has been
  1818. specified by 'set cwd', then the default inferior's working
  1819. directory is the same as GDB's working directory.
  1820. 'cd [DIRECTORY]'
  1821. Set the GDB working directory to DIRECTORY. If not given,
  1822. DIRECTORY uses ''~''.
  1823. The GDB working directory serves as a default for the commands that
  1824. specify files for GDB to operate on. *Note Commands to Specify
  1825. Files: Files. *Note set cwd command::.
  1826. 'pwd'
  1827. Print the GDB working directory.
  1828. It is generally impossible to find the current working directory of
  1829. the process being debugged (since a program can change its directory
  1830. during its run). If you work on a system where GDB supports the 'info
  1831. proc' command (*note Process Information::), you can use the 'info proc'
  1832. command to find out the current working directory of the debuggee.
  1833. 
  1834. File: gdb.info, Node: Input/Output, Next: Attach, Prev: Working Directory, Up: Running
  1835. 4.6 Your Program's Input and Output
  1836. ===================================
  1837. By default, the program you run under GDB does input and output to the
  1838. same terminal that GDB uses. GDB switches the terminal to its own
  1839. terminal modes to interact with you, but it records the terminal modes
  1840. your program was using and switches back to them when you continue
  1841. running your program.
  1842. 'info terminal'
  1843. Displays information recorded by GDB about the terminal modes your
  1844. program is using.
  1845. You can redirect your program's input and/or output using shell
  1846. redirection with the 'run' command. For example,
  1847. run > outfile
  1848. starts your program, diverting its output to the file 'outfile'.
  1849. Another way to specify where your program should do input and output
  1850. is with the 'tty' command. This command accepts a file name as
  1851. argument, and causes this file to be the default for future 'run'
  1852. commands. It also resets the controlling terminal for the child
  1853. process, for future 'run' commands. For example,
  1854. tty /dev/ttyb
  1855. directs that processes started with subsequent 'run' commands default to
  1856. do input and output on the terminal '/dev/ttyb' and have that as their
  1857. controlling terminal.
  1858. An explicit redirection in 'run' overrides the 'tty' command's effect
  1859. on the input/output device, but not its effect on the controlling
  1860. terminal.
  1861. When you use the 'tty' command or redirect input in the 'run'
  1862. command, only the input _for your program_ is affected. The input for
  1863. GDB still comes from your terminal. 'tty' is an alias for 'set
  1864. inferior-tty'.
  1865. You can use the 'show inferior-tty' command to tell GDB to display
  1866. the name of the terminal that will be used for future runs of your
  1867. program.
  1868. 'set inferior-tty [ TTY ]'
  1869. Set the tty for the program being debugged to TTY. Omitting TTY
  1870. restores the default behavior, which is to use the same terminal as
  1871. GDB.
  1872. 'show inferior-tty'
  1873. Show the current tty for the program being debugged.
  1874. 
  1875. File: gdb.info, Node: Attach, Next: Kill Process, Prev: Input/Output, Up: Running
  1876. 4.7 Debugging an Already-running Process
  1877. ========================================
  1878. 'attach PROCESS-ID'
  1879. This command attaches to a running process--one that was started
  1880. outside GDB. ('info files' shows your active targets.) The
  1881. command takes as argument a process ID. The usual way to find out
  1882. the PROCESS-ID of a Unix process is with the 'ps' utility, or with
  1883. the 'jobs -l' shell command.
  1884. 'attach' does not repeat if you press <RET> a second time after
  1885. executing the command.
  1886. To use 'attach', your program must be running in an environment which
  1887. supports processes; for example, 'attach' does not work for programs on
  1888. bare-board targets that lack an operating system. You must also have
  1889. permission to send the process a signal.
  1890. When you use 'attach', the debugger finds the program running in the
  1891. process first by looking in the current working directory, then (if the
  1892. program is not found) by using the source file search path (*note
  1893. Specifying Source Directories: Source Path.). You can also use the
  1894. 'file' command to load the program. *Note Commands to Specify Files:
  1895. Files.
  1896. The first thing GDB does after arranging to debug the specified
  1897. process is to stop it. You can examine and modify an attached process
  1898. with all the GDB commands that are ordinarily available when you start
  1899. processes with 'run'. You can insert breakpoints; you can step and
  1900. continue; you can modify storage. If you would rather the process
  1901. continue running, you may use the 'continue' command after attaching GDB
  1902. to the process.
  1903. 'detach'
  1904. When you have finished debugging the attached process, you can use
  1905. the 'detach' command to release it from GDB control. Detaching the
  1906. process continues its execution. After the 'detach' command, that
  1907. process and GDB become completely independent once more, and you
  1908. are ready to 'attach' another process or start one with 'run'.
  1909. 'detach' does not repeat if you press <RET> again after executing
  1910. the command.
  1911. If you exit GDB while you have an attached process, you detach that
  1912. process. If you use the 'run' command, you kill that process. By
  1913. default, GDB asks for confirmation if you try to do either of these
  1914. things; you can control whether or not you need to confirm by using the
  1915. 'set confirm' command (*note Optional Warnings and Messages:
  1916. Messages/Warnings.).
  1917. 
  1918. File: gdb.info, Node: Kill Process, Next: Inferiors and Programs, Prev: Attach, Up: Running
  1919. 4.8 Killing the Child Process
  1920. =============================
  1921. 'kill'
  1922. Kill the child process in which your program is running under GDB.
  1923. This command is useful if you wish to debug a core dump instead of a
  1924. running process. GDB ignores any core dump file while your program is
  1925. running.
  1926. On some operating systems, a program cannot be executed outside GDB
  1927. while you have breakpoints set on it inside GDB. You can use the 'kill'
  1928. command in this situation to permit running your program outside the
  1929. debugger.
  1930. The 'kill' command is also useful if you wish to recompile and relink
  1931. your program, since on many systems it is impossible to modify an
  1932. executable file while it is running in a process. In this case, when
  1933. you next type 'run', GDB notices that the file has changed, and reads
  1934. the symbol table again (while trying to preserve your current breakpoint
  1935. settings).
  1936. 
  1937. File: gdb.info, Node: Inferiors and Programs, Next: Threads, Prev: Kill Process, Up: Running
  1938. 4.9 Debugging Multiple Inferiors and Programs
  1939. =============================================
  1940. GDB lets you run and debug multiple programs in a single session. In
  1941. addition, GDB on some systems may let you run several programs
  1942. simultaneously (otherwise you have to exit from one before starting
  1943. another). In the most general case, you can have multiple threads of
  1944. execution in each of multiple processes, launched from multiple
  1945. executables.
  1946. GDB represents the state of each program execution with an object
  1947. called an "inferior". An inferior typically corresponds to a process,
  1948. but is more general and applies also to targets that do not have
  1949. processes. Inferiors may be created before a process runs, and may be
  1950. retained after a process exits. Inferiors have unique identifiers that
  1951. are different from process ids. Usually each inferior will also have
  1952. its own distinct address space, although some embedded targets may have
  1953. several inferiors running in different parts of a single address space.
  1954. Each inferior may in turn have multiple threads running in it.
  1955. To find out what inferiors exist at any moment, use 'info inferiors':
  1956. 'info inferiors'
  1957. Print a list of all inferiors currently being managed by GDB. By
  1958. default all inferiors are printed, but the argument ID... - a space
  1959. separated list of inferior numbers - can be used to limit the
  1960. display to just the requested inferiors.
  1961. GDB displays for each inferior (in this order):
  1962. 1. the inferior number assigned by GDB
  1963. 2. the target system's inferior identifier
  1964. 3. the name of the executable the inferior is running.
  1965. An asterisk '*' preceding the GDB inferior number indicates the
  1966. current inferior.
  1967. For example,
  1968. (gdb) info inferiors
  1969. Num Description Executable
  1970. 2 process 2307 hello
  1971. * 1 process 3401 goodbye
  1972. To switch focus between inferiors, use the 'inferior' command:
  1973. 'inferior INFNO'
  1974. Make inferior number INFNO the current inferior. The argument
  1975. INFNO is the inferior number assigned by GDB, as shown in the first
  1976. field of the 'info inferiors' display.
  1977. The debugger convenience variable '$_inferior' contains the number of
  1978. the current inferior. You may find this useful in writing breakpoint
  1979. conditional expressions, command scripts, and so forth. *Note
  1980. Convenience Variables: Convenience Vars, for general information on
  1981. convenience variables.
  1982. You can get multiple executables into a debugging session via the
  1983. 'add-inferior' and 'clone-inferior' commands. On some systems GDB can
  1984. add inferiors to the debug session automatically by following calls to
  1985. 'fork' and 'exec'. To remove inferiors from the debugging session use
  1986. the 'remove-inferiors' command.
  1987. 'add-inferior [ -copies N ] [ -exec EXECUTABLE ]'
  1988. Adds N inferiors to be run using EXECUTABLE as the executable; N
  1989. defaults to 1. If no executable is specified, the inferiors begins
  1990. empty, with no program. You can still assign or change the program
  1991. assigned to the inferior at any time by using the 'file' command
  1992. with the executable name as its argument.
  1993. 'clone-inferior [ -copies N ] [ INFNO ]'
  1994. Adds N inferiors ready to execute the same program as inferior
  1995. INFNO; N defaults to 1, and INFNO defaults to the number of the
  1996. current inferior. This is a convenient command when you want to
  1997. run another instance of the inferior you are debugging.
  1998. (gdb) info inferiors
  1999. Num Description Executable
  2000. * 1 process 29964 helloworld
  2001. (gdb) clone-inferior
  2002. Added inferior 2.
  2003. 1 inferiors added.
  2004. (gdb) info inferiors
  2005. Num Description Executable
  2006. 2 <null> helloworld
  2007. * 1 process 29964 helloworld
  2008. You can now simply switch focus to inferior 2 and run it.
  2009. 'remove-inferiors INFNO...'
  2010. Removes the inferior or inferiors INFNO.... It is not possible to
  2011. remove an inferior that is running with this command. For those,
  2012. use the 'kill' or 'detach' command first.
  2013. To quit debugging one of the running inferiors that is not the
  2014. current inferior, you can either detach from it by using the
  2015. 'detach inferior' command (allowing it to run independently), or kill it
  2016. using the 'kill inferiors' command:
  2017. 'detach inferior INFNO...'
  2018. Detach from the inferior or inferiors identified by GDB inferior
  2019. number(s) INFNO.... Note that the inferior's entry still stays on
  2020. the list of inferiors shown by 'info inferiors', but its
  2021. Description will show '<null>'.
  2022. 'kill inferiors INFNO...'
  2023. Kill the inferior or inferiors identified by GDB inferior number(s)
  2024. INFNO.... Note that the inferior's entry still stays on the list
  2025. of inferiors shown by 'info inferiors', but its Description will
  2026. show '<null>'.
  2027. After the successful completion of a command such as 'detach',
  2028. 'detach inferiors', 'kill' or 'kill inferiors', or after a normal
  2029. process exit, the inferior is still valid and listed with 'info
  2030. inferiors', ready to be restarted.
  2031. To be notified when inferiors are started or exit under GDB's control
  2032. use 'set print inferior-events':
  2033. 'set print inferior-events'
  2034. 'set print inferior-events on'
  2035. 'set print inferior-events off'
  2036. The 'set print inferior-events' command allows you to enable or
  2037. disable printing of messages when GDB notices that new inferiors
  2038. have started or that inferiors have exited or have been detached.
  2039. By default, these messages will not be printed.
  2040. 'show print inferior-events'
  2041. Show whether messages will be printed when GDB detects that
  2042. inferiors have started, exited or have been detached.
  2043. Many commands will work the same with multiple programs as with a
  2044. single program: e.g., 'print myglobal' will simply display the value of
  2045. 'myglobal' in the current inferior.
  2046. Occasionally, when debugging GDB itself, it may be useful to get more
  2047. info about the relationship of inferiors, programs, address spaces in a
  2048. debug session. You can do that with the 'maint info program-spaces'
  2049. command.
  2050. 'maint info program-spaces'
  2051. Print a list of all program spaces currently being managed by GDB.
  2052. GDB displays for each program space (in this order):
  2053. 1. the program space number assigned by GDB
  2054. 2. the name of the executable loaded into the program space, with
  2055. e.g., the 'file' command.
  2056. An asterisk '*' preceding the GDB program space number indicates
  2057. the current program space.
  2058. In addition, below each program space line, GDB prints extra
  2059. information that isn't suitable to display in tabular form. For
  2060. example, the list of inferiors bound to the program space.
  2061. (gdb) maint info program-spaces
  2062. Id Executable
  2063. * 1 hello
  2064. 2 goodbye
  2065. Bound inferiors: ID 1 (process 21561)
  2066. Here we can see that no inferior is running the program 'hello',
  2067. while 'process 21561' is running the program 'goodbye'. On some
  2068. targets, it is possible that multiple inferiors are bound to the
  2069. same program space. The most common example is that of debugging
  2070. both the parent and child processes of a 'vfork' call. For
  2071. example,
  2072. (gdb) maint info program-spaces
  2073. Id Executable
  2074. * 1 vfork-test
  2075. Bound inferiors: ID 2 (process 18050), ID 1 (process 18045)
  2076. Here, both inferior 2 and inferior 1 are running in the same
  2077. program space as a result of inferior 1 having executed a 'vfork'
  2078. call.
  2079. 
  2080. File: gdb.info, Node: Threads, Next: Forks, Prev: Inferiors and Programs, Up: Running
  2081. 4.10 Debugging Programs with Multiple Threads
  2082. =============================================
  2083. In some operating systems, such as GNU/Linux and Solaris, a single
  2084. program may have more than one "thread" of execution. The precise
  2085. semantics of threads differ from one operating system to another, but in
  2086. general the threads of a single program are akin to multiple
  2087. processes--except that they share one address space (that is, they can
  2088. all examine and modify the same variables). On the other hand, each
  2089. thread has its own registers and execution stack, and perhaps private
  2090. memory.
  2091. GDB provides these facilities for debugging multi-thread programs:
  2092. * automatic notification of new threads
  2093. * 'thread THREAD-ID', a command to switch among threads
  2094. * 'info threads', a command to inquire about existing threads
  2095. * 'thread apply [THREAD-ID-LIST | all] ARGS', a command to apply a
  2096. command to a list of threads
  2097. * thread-specific breakpoints
  2098. * 'set print thread-events', which controls printing of messages on
  2099. thread start and exit.
  2100. * 'set libthread-db-search-path PATH', which lets the user specify
  2101. which 'libthread_db' to use if the default choice isn't compatible
  2102. with the program.
  2103. The GDB thread debugging facility allows you to observe all threads
  2104. while your program runs--but whenever GDB takes control, one thread in
  2105. particular is always the focus of debugging. This thread is called the
  2106. "current thread". Debugging commands show program information from the
  2107. perspective of the current thread.
  2108. Whenever GDB detects a new thread in your program, it displays the
  2109. target system's identification for the thread with a message in the form
  2110. '[New SYSTAG]', where SYSTAG is a thread identifier whose form varies
  2111. depending on the particular system. For example, on GNU/Linux, you
  2112. might see
  2113. [New Thread 0x41e02940 (LWP 25582)]
  2114. when GDB notices a new thread. In contrast, on other systems, the
  2115. SYSTAG is simply something like 'process 368', with no further
  2116. qualifier.
  2117. For debugging purposes, GDB associates its own thread number --always
  2118. a single integer--with each thread of an inferior. This number is
  2119. unique between all threads of an inferior, but not unique between
  2120. threads of different inferiors.
  2121. You can refer to a given thread in an inferior using the qualified
  2122. INFERIOR-NUM.THREAD-NUM syntax, also known as "qualified thread ID",
  2123. with INFERIOR-NUM being the inferior number and THREAD-NUM being the
  2124. thread number of the given inferior. For example, thread '2.3' refers
  2125. to thread number 3 of inferior 2. If you omit INFERIOR-NUM (e.g.,
  2126. 'thread 3'), then GDB infers you're referring to a thread of the current
  2127. inferior.
  2128. Until you create a second inferior, GDB does not show the
  2129. INFERIOR-NUM part of thread IDs, even though you can always use the full
  2130. INFERIOR-NUM.THREAD-NUM form to refer to threads of inferior 1, the
  2131. initial inferior.
  2132. Some commands accept a space-separated "thread ID list" as argument.
  2133. A list element can be:
  2134. 1. A thread ID as shown in the first field of the 'info threads'
  2135. display, with or without an inferior qualifier. E.g., '2.1' or
  2136. '1'.
  2137. 2. A range of thread numbers, again with or without an inferior
  2138. qualifier, as in INF.THR1-THR2 or THR1-THR2. E.g., '1.2-4' or
  2139. '2-4'.
  2140. 3. All threads of an inferior, specified with a star wildcard, with or
  2141. without an inferior qualifier, as in INF.'*' (e.g., '1.*') or '*'.
  2142. The former refers to all threads of the given inferior, and the
  2143. latter form without an inferior qualifier refers to all threads of
  2144. the current inferior.
  2145. For example, if the current inferior is 1, and inferior 7 has one
  2146. thread with ID 7.1, the thread list '1 2-3 4.5 6.7-9 7.*' includes
  2147. threads 1 to 3 of inferior 1, thread 5 of inferior 4, threads 7 to 9 of
  2148. inferior 6 and all threads of inferior 7. That is, in expanded
  2149. qualified form, the same as '1.1 1.2 1.3 4.5 6.7 6.8 6.9 7.1'.
  2150. In addition to a _per-inferior_ number, each thread is also assigned
  2151. a unique _global_ number, also known as "global thread ID", a single
  2152. integer. Unlike the thread number component of the thread ID, no two
  2153. threads have the same global ID, even when you're debugging multiple
  2154. inferiors.
  2155. From GDB's perspective, a process always has at least one thread. In
  2156. other words, GDB assigns a thread number to the program's "main thread"
  2157. even if the program is not multi-threaded.
  2158. The debugger convenience variables '$_thread' and '$_gthread'
  2159. contain, respectively, the per-inferior thread number and the global
  2160. thread number of the current thread. You may find this useful in
  2161. writing breakpoint conditional expressions, command scripts, and so
  2162. forth. *Note Convenience Variables: Convenience Vars, for general
  2163. information on convenience variables.
  2164. If GDB detects the program is multi-threaded, it augments the usual
  2165. message about stopping at a breakpoint with the ID and name of the
  2166. thread that hit the breakpoint.
  2167. Thread 2 "client" hit Breakpoint 1, send_message () at client.c:68
  2168. Likewise when the program receives a signal:
  2169. Thread 1 "main" received signal SIGINT, Interrupt.
  2170. 'info threads [THREAD-ID-LIST]'
  2171. Display information about one or more threads. With no arguments
  2172. displays information about all threads. You can specify the list
  2173. of threads that you want to display using the thread ID list syntax
  2174. (*note thread ID lists::).
  2175. GDB displays for each thread (in this order):
  2176. 1. the per-inferior thread number assigned by GDB
  2177. 2. the global thread number assigned by GDB, if the '-gid' option
  2178. was specified
  2179. 3. the target system's thread identifier (SYSTAG)
  2180. 4. the thread's name, if one is known. A thread can either be
  2181. named by the user (see 'thread name', below), or, in some
  2182. cases, by the program itself.
  2183. 5. the current stack frame summary for that thread
  2184. An asterisk '*' to the left of the GDB thread number indicates the
  2185. current thread.
  2186. For example,
  2187. (gdb) info threads
  2188. Id Target Id Frame
  2189. * 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8)
  2190. 2 process 35 thread 23 0x34e5 in sigpause ()
  2191. 3 process 35 thread 27 0x34e5 in sigpause ()
  2192. at threadtest.c:68
  2193. If you're debugging multiple inferiors, GDB displays thread IDs using
  2194. the qualified INFERIOR-NUM.THREAD-NUM format. Otherwise, only
  2195. THREAD-NUM is shown.
  2196. If you specify the '-gid' option, GDB displays a column indicating
  2197. each thread's global thread ID:
  2198. (gdb) info threads
  2199. Id GId Target Id Frame
  2200. 1.1 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8)
  2201. 1.2 3 process 35 thread 23 0x34e5 in sigpause ()
  2202. 1.3 4 process 35 thread 27 0x34e5 in sigpause ()
  2203. * 2.1 2 process 65 thread 1 main (argc=1, argv=0x7ffffff8)
  2204. On Solaris, you can display more information about user threads with
  2205. a Solaris-specific command:
  2206. 'maint info sol-threads'
  2207. Display info on Solaris user threads.
  2208. 'thread THREAD-ID'
  2209. Make thread ID THREAD-ID the current thread. The command argument
  2210. THREAD-ID is the GDB thread ID, as shown in the first field of the
  2211. 'info threads' display, with or without an inferior qualifier
  2212. (e.g., '2.1' or '1').
  2213. GDB responds by displaying the system identifier of the thread you
  2214. selected, and its current stack frame summary:
  2215. (gdb) thread 2
  2216. [Switching to thread 2 (Thread 0xb7fdab70 (LWP 12747))]
  2217. #0 some_function (ignore=0x0) at example.c:8
  2218. 8 printf ("hello\n");
  2219. As with the '[New ...]' message, the form of the text after
  2220. 'Switching to' depends on your system's conventions for identifying
  2221. threads.
  2222. 'thread apply [THREAD-ID-LIST | all [-ascending]] [FLAG]... COMMAND'
  2223. The 'thread apply' command allows you to apply the named COMMAND to
  2224. one or more threads. Specify the threads that you want affected
  2225. using the thread ID list syntax (*note thread ID lists::), or
  2226. specify 'all' to apply to all threads. To apply a command to all
  2227. threads in descending order, type 'thread apply all COMMAND'. To
  2228. apply a command to all threads in ascending order, type 'thread
  2229. apply all -ascending COMMAND'.
  2230. The FLAG arguments control what output to produce and how to handle
  2231. errors raised when applying COMMAND to a thread. FLAG must start
  2232. with a '-' directly followed by one letter in 'qcs'. If several
  2233. flags are provided, they must be given individually, such as '-c
  2234. -q'.
  2235. By default, GDB displays some thread information before the output
  2236. produced by COMMAND, and an error raised during the execution of a
  2237. COMMAND will abort 'thread apply'. The following flags can be used
  2238. to fine-tune this behavior:
  2239. '-c'
  2240. The flag '-c', which stands for 'continue', causes any errors
  2241. in COMMAND to be displayed, and the execution of 'thread
  2242. apply' then continues.
  2243. '-s'
  2244. The flag '-s', which stands for 'silent', causes any errors or
  2245. empty output produced by a COMMAND to be silently ignored.
  2246. That is, the execution continues, but the thread information
  2247. and errors are not printed.
  2248. '-q'
  2249. The flag '-q' ('quiet') disables printing the thread
  2250. information.
  2251. Flags '-c' and '-s' cannot be used together.
  2252. 'taas [OPTION]... COMMAND'
  2253. Shortcut for 'thread apply all -s [OPTION]... COMMAND'. Applies
  2254. COMMAND on all threads, ignoring errors and empty output.
  2255. The 'taas' command accepts the same options as the 'thread apply
  2256. all' command. *Note thread apply all::.
  2257. 'tfaas [OPTION]... COMMAND'
  2258. Shortcut for 'thread apply all -s -- frame apply all -s [OPTION]...
  2259. COMMAND'. Applies COMMAND on all frames of all threads, ignoring
  2260. errors and empty output. Note that the flag '-s' is specified
  2261. twice: The first '-s' ensures that 'thread apply' only shows the
  2262. thread information of the threads for which 'frame apply' produces
  2263. some output. The second '-s' is needed to ensure that 'frame
  2264. apply' shows the frame information of a frame only if the COMMAND
  2265. successfully produced some output.
  2266. It can for example be used to print a local variable or a function
  2267. argument without knowing the thread or frame where this variable or
  2268. argument is, using:
  2269. (gdb) tfaas p some_local_var_i_do_not_remember_where_it_is
  2270. The 'tfaas' command accepts the same options as the 'frame apply'
  2271. command. *Note frame apply::.
  2272. 'thread name [NAME]'
  2273. This command assigns a name to the current thread. If no argument
  2274. is given, any existing user-specified name is removed. The thread
  2275. name appears in the 'info threads' display.
  2276. On some systems, such as GNU/Linux, GDB is able to determine the
  2277. name of the thread as given by the OS. On these systems, a name
  2278. specified with 'thread name' will override the system-give name,
  2279. and removing the user-specified name will cause GDB to once again
  2280. display the system-specified name.
  2281. 'thread find [REGEXP]'
  2282. Search for and display thread ids whose name or SYSTAG matches the
  2283. supplied regular expression.
  2284. As well as being the complement to the 'thread name' command, this
  2285. command also allows you to identify a thread by its target SYSTAG.
  2286. For instance, on GNU/Linux, the target SYSTAG is the LWP id.
  2287. (GDB) thread find 26688
  2288. Thread 4 has target id 'Thread 0x41e02940 (LWP 26688)'
  2289. (GDB) info thread 4
  2290. Id Target Id Frame
  2291. 4 Thread 0x41e02940 (LWP 26688) 0x00000031ca6cd372 in select ()
  2292. 'set print thread-events'
  2293. 'set print thread-events on'
  2294. 'set print thread-events off'
  2295. The 'set print thread-events' command allows you to enable or
  2296. disable printing of messages when GDB notices that new threads have
  2297. started or that threads have exited. By default, these messages
  2298. will be printed if detection of these events is supported by the
  2299. target. Note that these messages cannot be disabled on all
  2300. targets.
  2301. 'show print thread-events'
  2302. Show whether messages will be printed when GDB detects that threads
  2303. have started and exited.
  2304. *Note Stopping and Starting Multi-thread Programs: Thread Stops, for
  2305. more information about how GDB behaves when you stop and start programs
  2306. with multiple threads.
  2307. *Note Setting Watchpoints: Set Watchpoints, for information about
  2308. watchpoints in programs with multiple threads.
  2309. 'set libthread-db-search-path [PATH]'
  2310. If this variable is set, PATH is a colon-separated list of
  2311. directories GDB will use to search for 'libthread_db'. If you omit
  2312. PATH, 'libthread-db-search-path' will be reset to its default value
  2313. ('$sdir:$pdir' on GNU/Linux and Solaris systems). Internally, the
  2314. default value comes from the 'LIBTHREAD_DB_SEARCH_PATH' macro.
  2315. On GNU/Linux and Solaris systems, GDB uses a "helper"
  2316. 'libthread_db' library to obtain information about threads in the
  2317. inferior process. GDB will use 'libthread-db-search-path' to find
  2318. 'libthread_db'. GDB also consults first if inferior specific
  2319. thread debugging library loading is enabled by 'set auto-load
  2320. libthread-db' (*note libthread_db.so.1 file::).
  2321. A special entry '$sdir' for 'libthread-db-search-path' refers to
  2322. the default system directories that are normally searched for
  2323. loading shared libraries. The '$sdir' entry is the only kind not
  2324. needing to be enabled by 'set auto-load libthread-db' (*note
  2325. libthread_db.so.1 file::).
  2326. A special entry '$pdir' for 'libthread-db-search-path' refers to
  2327. the directory from which 'libpthread' was loaded in the inferior
  2328. process.
  2329. For any 'libthread_db' library GDB finds in above directories, GDB
  2330. attempts to initialize it with the current inferior process. If
  2331. this initialization fails (which could happen because of a version
  2332. mismatch between 'libthread_db' and 'libpthread'), GDB will unload
  2333. 'libthread_db', and continue with the next directory. If none of
  2334. 'libthread_db' libraries initialize successfully, GDB will issue a
  2335. warning and thread debugging will be disabled.
  2336. Setting 'libthread-db-search-path' is currently implemented only on
  2337. some platforms.
  2338. 'show libthread-db-search-path'
  2339. Display current libthread_db search path.
  2340. 'set debug libthread-db'
  2341. 'show debug libthread-db'
  2342. Turns on or off display of 'libthread_db'-related events. Use '1'
  2343. to enable, '0' to disable.
  2344. 
  2345. File: gdb.info, Node: Forks, Next: Checkpoint/Restart, Prev: Threads, Up: Running
  2346. 4.11 Debugging Forks
  2347. ====================
  2348. On most systems, GDB has no special support for debugging programs which
  2349. create additional processes using the 'fork' function. When a program
  2350. forks, GDB will continue to debug the parent process and the child
  2351. process will run unimpeded. If you have set a breakpoint in any code
  2352. which the child then executes, the child will get a 'SIGTRAP' signal
  2353. which (unless it catches the signal) will cause it to terminate.
  2354. However, if you want to debug the child process there is a workaround
  2355. which isn't too painful. Put a call to 'sleep' in the code which the
  2356. child process executes after the fork. It may be useful to sleep only
  2357. if a certain environment variable is set, or a certain file exists, so
  2358. that the delay need not occur when you don't want to run GDB on the
  2359. child. While the child is sleeping, use the 'ps' program to get its
  2360. process ID. Then tell GDB (a new invocation of GDB if you are also
  2361. debugging the parent process) to attach to the child process (*note
  2362. Attach::). From that point on you can debug the child process just like
  2363. any other process which you attached to.
  2364. On some systems, GDB provides support for debugging programs that
  2365. create additional processes using the 'fork' or 'vfork' functions. On
  2366. GNU/Linux platforms, this feature is supported with kernel version
  2367. 2.5.46 and later.
  2368. The fork debugging commands are supported in native mode and when
  2369. connected to 'gdbserver' in either 'target remote' mode or 'target
  2370. extended-remote' mode.
  2371. By default, when a program forks, GDB will continue to debug the
  2372. parent process and the child process will run unimpeded.
  2373. If you want to follow the child process instead of the parent
  2374. process, use the command 'set follow-fork-mode'.
  2375. 'set follow-fork-mode MODE'
  2376. Set the debugger response to a program call of 'fork' or 'vfork'.
  2377. A call to 'fork' or 'vfork' creates a new process. The MODE
  2378. argument can be:
  2379. 'parent'
  2380. The original process is debugged after a fork. The child
  2381. process runs unimpeded. This is the default.
  2382. 'child'
  2383. The new process is debugged after a fork. The parent process
  2384. runs unimpeded.
  2385. 'show follow-fork-mode'
  2386. Display the current debugger response to a 'fork' or 'vfork' call.
  2387. On Linux, if you want to debug both the parent and child processes,
  2388. use the command 'set detach-on-fork'.
  2389. 'set detach-on-fork MODE'
  2390. Tells gdb whether to detach one of the processes after a fork, or
  2391. retain debugger control over them both.
  2392. 'on'
  2393. The child process (or parent process, depending on the value
  2394. of 'follow-fork-mode') will be detached and allowed to run
  2395. independently. This is the default.
  2396. 'off'
  2397. Both processes will be held under the control of GDB. One
  2398. process (child or parent, depending on the value of
  2399. 'follow-fork-mode') is debugged as usual, while the other is
  2400. held suspended.
  2401. 'show detach-on-fork'
  2402. Show whether detach-on-fork mode is on/off.
  2403. If you choose to set 'detach-on-fork' mode off, then GDB will retain
  2404. control of all forked processes (including nested forks). You can list
  2405. the forked processes under the control of GDB by using the
  2406. 'info inferiors' command, and switch from one fork to another by using
  2407. the 'inferior' command (*note Debugging Multiple Inferiors and Programs:
  2408. Inferiors and Programs.).
  2409. To quit debugging one of the forked processes, you can either detach
  2410. from it by using the 'detach inferiors' command (allowing it to run
  2411. independently), or kill it using the 'kill inferiors' command. *Note
  2412. Debugging Multiple Inferiors and Programs: Inferiors and Programs.
  2413. If you ask to debug a child process and a 'vfork' is followed by an
  2414. 'exec', GDB executes the new target up to the first breakpoint in the
  2415. new target. If you have a breakpoint set on 'main' in your original
  2416. program, the breakpoint will also be set on the child process's 'main'.
  2417. On some systems, when a child process is spawned by 'vfork', you
  2418. cannot debug the child or parent until an 'exec' call completes.
  2419. If you issue a 'run' command to GDB after an 'exec' call executes,
  2420. the new target restarts. To restart the parent process, use the 'file'
  2421. command with the parent executable name as its argument. By default,
  2422. after an 'exec' call executes, GDB discards the symbols of the previous
  2423. executable image. You can change this behaviour with the
  2424. 'set follow-exec-mode' command.
  2425. 'set follow-exec-mode MODE'
  2426. Set debugger response to a program call of 'exec'. An 'exec' call
  2427. replaces the program image of a process.
  2428. 'follow-exec-mode' can be:
  2429. 'new'
  2430. GDB creates a new inferior and rebinds the process to this new
  2431. inferior. The program the process was running before the
  2432. 'exec' call can be restarted afterwards by restarting the
  2433. original inferior.
  2434. For example:
  2435. (gdb) info inferiors
  2436. (gdb) info inferior
  2437. Id Description Executable
  2438. * 1 <null> prog1
  2439. (gdb) run
  2440. process 12020 is executing new program: prog2
  2441. Program exited normally.
  2442. (gdb) info inferiors
  2443. Id Description Executable
  2444. 1 <null> prog1
  2445. * 2 <null> prog2
  2446. 'same'
  2447. GDB keeps the process bound to the same inferior. The new
  2448. executable image replaces the previous executable loaded in
  2449. the inferior. Restarting the inferior after the 'exec' call,
  2450. with e.g., the 'run' command, restarts the executable the
  2451. process was running after the 'exec' call. This is the
  2452. default mode.
  2453. For example:
  2454. (gdb) info inferiors
  2455. Id Description Executable
  2456. * 1 <null> prog1
  2457. (gdb) run
  2458. process 12020 is executing new program: prog2
  2459. Program exited normally.
  2460. (gdb) info inferiors
  2461. Id Description Executable
  2462. * 1 <null> prog2
  2463. 'follow-exec-mode' is supported in native mode and 'target
  2464. extended-remote' mode.
  2465. You can use the 'catch' command to make GDB stop whenever a 'fork',
  2466. 'vfork', or 'exec' call is made. *Note Setting Catchpoints: Set
  2467. Catchpoints.
  2468. 
  2469. File: gdb.info, Node: Checkpoint/Restart, Prev: Forks, Up: Running
  2470. 4.12 Setting a _Bookmark_ to Return to Later
  2471. ============================================
  2472. On certain operating systems(1), GDB is able to save a "snapshot" of a
  2473. program's state, called a "checkpoint", and come back to it later.
  2474. Returning to a checkpoint effectively undoes everything that has
  2475. happened in the program since the 'checkpoint' was saved. This includes
  2476. changes in memory, registers, and even (within some limits) system
  2477. state. Effectively, it is like going back in time to the moment when
  2478. the checkpoint was saved.
  2479. Thus, if you're stepping thru a program and you think you're getting
  2480. close to the point where things go wrong, you can save a checkpoint.
  2481. Then, if you accidentally go too far and miss the critical statement,
  2482. instead of having to restart your program from the beginning, you can
  2483. just go back to the checkpoint and start again from there.
  2484. This can be especially useful if it takes a lot of time or steps to
  2485. reach the point where you think the bug occurs.
  2486. To use the 'checkpoint'/'restart' method of debugging:
  2487. 'checkpoint'
  2488. Save a snapshot of the debugged program's current execution state.
  2489. The 'checkpoint' command takes no arguments, but each checkpoint is
  2490. assigned a small integer id, similar to a breakpoint id.
  2491. 'info checkpoints'
  2492. List the checkpoints that have been saved in the current debugging
  2493. session. For each checkpoint, the following information will be
  2494. listed:
  2495. 'Checkpoint ID'
  2496. 'Process ID'
  2497. 'Code Address'
  2498. 'Source line, or label'
  2499. 'restart CHECKPOINT-ID'
  2500. Restore the program state that was saved as checkpoint number
  2501. CHECKPOINT-ID. All program variables, registers, stack frames etc.
  2502. will be returned to the values that they had when the checkpoint
  2503. was saved. In essence, gdb will "wind back the clock" to the point
  2504. in time when the checkpoint was saved.
  2505. Note that breakpoints, GDB variables, command history etc. are not
  2506. affected by restoring a checkpoint. In general, a checkpoint only
  2507. restores things that reside in the program being debugged, not in
  2508. the debugger.
  2509. 'delete checkpoint CHECKPOINT-ID'
  2510. Delete the previously-saved checkpoint identified by CHECKPOINT-ID.
  2511. Returning to a previously saved checkpoint will restore the user
  2512. state of the program being debugged, plus a significant subset of the
  2513. system (OS) state, including file pointers. It won't "un-write" data
  2514. from a file, but it will rewind the file pointer to the previous
  2515. location, so that the previously written data can be overwritten. For
  2516. files opened in read mode, the pointer will also be restored so that the
  2517. previously read data can be read again.
  2518. Of course, characters that have been sent to a printer (or other
  2519. external device) cannot be "snatched back", and characters received from
  2520. eg. a serial device can be removed from internal program buffers, but
  2521. they cannot be "pushed back" into the serial pipeline, ready to be
  2522. received again. Similarly, the actual contents of files that have been
  2523. changed cannot be restored (at this time).
  2524. However, within those constraints, you actually can "rewind" your
  2525. program to a previously saved point in time, and begin debugging it
  2526. again -- and you can change the course of events so as to debug a
  2527. different execution path this time.
  2528. Finally, there is one bit of internal program state that will be
  2529. different when you return to a checkpoint -- the program's process id.
  2530. Each checkpoint will have a unique process id (or PID), and each will be
  2531. different from the program's original PID. If your program has saved a
  2532. local copy of its process id, this could potentially pose a problem.
  2533. 4.12.1 A Non-obvious Benefit of Using Checkpoints
  2534. -------------------------------------------------
  2535. On some systems such as GNU/Linux, address space randomization is
  2536. performed on new processes for security reasons. This makes it
  2537. difficult or impossible to set a breakpoint, or watchpoint, on an
  2538. absolute address if you have to restart the program, since the absolute
  2539. location of a symbol will change from one execution to the next.
  2540. A checkpoint, however, is an _identical_ copy of a process.
  2541. Therefore if you create a checkpoint at (eg.) the start of main, and
  2542. simply return to that checkpoint instead of restarting the process, you
  2543. can avoid the effects of address randomization and your symbols will all
  2544. stay in the same place.
  2545. ---------- Footnotes ----------
  2546. (1) Currently, only GNU/Linux.
  2547. 
  2548. File: gdb.info, Node: Stopping, Next: Reverse Execution, Prev: Running, Up: Top
  2549. 5 Stopping and Continuing
  2550. *************************
  2551. The principal purposes of using a debugger are so that you can stop your
  2552. program before it terminates; or so that, if your program runs into
  2553. trouble, you can investigate and find out why.
  2554. Inside GDB, your program may stop for any of several reasons, such as
  2555. a signal, a breakpoint, or reaching a new line after a GDB command such
  2556. as 'step'. You may then examine and change variables, set new
  2557. breakpoints or remove old ones, and then continue execution. Usually,
  2558. the messages shown by GDB provide ample explanation of the status of
  2559. your program--but you can also explicitly request this information at
  2560. any time.
  2561. 'info program'
  2562. Display information about the status of your program: whether it is
  2563. running or not, what process it is, and why it stopped.
  2564. * Menu:
  2565. * Breakpoints:: Breakpoints, watchpoints, and catchpoints
  2566. * Continuing and Stepping:: Resuming execution
  2567. * Skipping Over Functions and Files::
  2568. Skipping over functions and files
  2569. * Signals:: Signals
  2570. * Thread Stops:: Stopping and starting multi-thread programs
  2571. 
  2572. File: gdb.info, Node: Breakpoints, Next: Continuing and Stepping, Up: Stopping
  2573. 5.1 Breakpoints, Watchpoints, and Catchpoints
  2574. =============================================
  2575. A "breakpoint" makes your program stop whenever a certain point in the
  2576. program is reached. For each breakpoint, you can add conditions to
  2577. control in finer detail whether your program stops. You can set
  2578. breakpoints with the 'break' command and its variants (*note Setting
  2579. Breakpoints: Set Breaks.), to specify the place where your program
  2580. should stop by line number, function name or exact address in the
  2581. program.
  2582. On some systems, you can set breakpoints in shared libraries before
  2583. the executable is run.
  2584. A "watchpoint" is a special breakpoint that stops your program when
  2585. the value of an expression changes. The expression may be a value of a
  2586. variable, or it could involve values of one or more variables combined
  2587. by operators, such as 'a + b'. This is sometimes called "data
  2588. breakpoints". You must use a different command to set watchpoints
  2589. (*note Setting Watchpoints: Set Watchpoints.), but aside from that, you
  2590. can manage a watchpoint like any other breakpoint: you enable, disable,
  2591. and delete both breakpoints and watchpoints using the same commands.
  2592. You can arrange to have values from your program displayed
  2593. automatically whenever GDB stops at a breakpoint. *Note Automatic
  2594. Display: Auto Display.
  2595. A "catchpoint" is another special breakpoint that stops your program
  2596. when a certain kind of event occurs, such as the throwing of a C++
  2597. exception or the loading of a library. As with watchpoints, you use a
  2598. different command to set a catchpoint (*note Setting Catchpoints: Set
  2599. Catchpoints.), but aside from that, you can manage a catchpoint like any
  2600. other breakpoint. (To stop when your program receives a signal, use the
  2601. 'handle' command; see *note Signals: Signals.)
  2602. GDB assigns a number to each breakpoint, watchpoint, or catchpoint
  2603. when you create it; these numbers are successive integers starting with
  2604. one. In many of the commands for controlling various features of
  2605. breakpoints you use the breakpoint number to say which breakpoint you
  2606. want to change. Each breakpoint may be "enabled" or "disabled"; if
  2607. disabled, it has no effect on your program until you enable it again.
  2608. Some GDB commands accept a space-separated list of breakpoints on
  2609. which to operate. A list element can be either a single breakpoint
  2610. number, like '5', or a range of such numbers, like '5-7'. When a
  2611. breakpoint list is given to a command, all breakpoints in that list are
  2612. operated on.
  2613. * Menu:
  2614. * Set Breaks:: Setting breakpoints
  2615. * Set Watchpoints:: Setting watchpoints
  2616. * Set Catchpoints:: Setting catchpoints
  2617. * Delete Breaks:: Deleting breakpoints
  2618. * Disabling:: Disabling breakpoints
  2619. * Conditions:: Break conditions
  2620. * Break Commands:: Breakpoint command lists
  2621. * Dynamic Printf:: Dynamic printf
  2622. * Save Breakpoints:: How to save breakpoints in a file
  2623. * Static Probe Points:: Listing static probe points
  2624. * Error in Breakpoints:: "Cannot insert breakpoints"
  2625. * Breakpoint-related Warnings:: "Breakpoint address adjusted..."
  2626. 
  2627. File: gdb.info, Node: Set Breaks, Next: Set Watchpoints, Up: Breakpoints
  2628. 5.1.1 Setting Breakpoints
  2629. -------------------------
  2630. Breakpoints are set with the 'break' command (abbreviated 'b'). The
  2631. debugger convenience variable '$bpnum' records the number of the
  2632. breakpoint you've set most recently; see *note Convenience Variables:
  2633. Convenience Vars, for a discussion of what you can do with convenience
  2634. variables.
  2635. 'break LOCATION'
  2636. Set a breakpoint at the given LOCATION, which can specify a
  2637. function name, a line number, or an address of an instruction.
  2638. (*Note Specify Location::, for a list of all the possible ways to
  2639. specify a LOCATION.) The breakpoint will stop your program just
  2640. before it executes any of the code in the specified LOCATION.
  2641. When using source languages that permit overloading of symbols,
  2642. such as C++, a function name may refer to more than one possible
  2643. place to break. *Note Ambiguous Expressions: Ambiguous
  2644. Expressions, for a discussion of that situation.
  2645. It is also possible to insert a breakpoint that will stop the
  2646. program only if a specific thread (*note Thread-Specific
  2647. Breakpoints::) or a specific task (*note Ada Tasks::) hits that
  2648. breakpoint.
  2649. 'break'
  2650. When called without any arguments, 'break' sets a breakpoint at the
  2651. next instruction to be executed in the selected stack frame (*note
  2652. Examining the Stack: Stack.). In any selected frame but the
  2653. innermost, this makes your program stop as soon as control returns
  2654. to that frame. This is similar to the effect of a 'finish' command
  2655. in the frame inside the selected frame--except that 'finish' does
  2656. not leave an active breakpoint. If you use 'break' without an
  2657. argument in the innermost frame, GDB stops the next time it reaches
  2658. the current location; this may be useful inside loops.
  2659. GDB normally ignores breakpoints when it resumes execution, until
  2660. at least one instruction has been executed. If it did not do this,
  2661. you would be unable to proceed past a breakpoint without first
  2662. disabling the breakpoint. This rule applies whether or not the
  2663. breakpoint already existed when your program stopped.
  2664. 'break ... if COND'
  2665. Set a breakpoint with condition COND; evaluate the expression COND
  2666. each time the breakpoint is reached, and stop only if the value is
  2667. nonzero--that is, if COND evaluates as true. '...' stands for one
  2668. of the possible arguments described above (or no argument)
  2669. specifying where to break. *Note Break Conditions: Conditions, for
  2670. more information on breakpoint conditions.
  2671. 'tbreak ARGS'
  2672. Set a breakpoint enabled only for one stop. The ARGS are the same
  2673. as for the 'break' command, and the breakpoint is set in the same
  2674. way, but the breakpoint is automatically deleted after the first
  2675. time your program stops there. *Note Disabling Breakpoints:
  2676. Disabling.
  2677. 'hbreak ARGS'
  2678. Set a hardware-assisted breakpoint. The ARGS are the same as for
  2679. the 'break' command and the breakpoint is set in the same way, but
  2680. the breakpoint requires hardware support and some target hardware
  2681. may not have this support. The main purpose of this is EPROM/ROM
  2682. code debugging, so you can set a breakpoint at an instruction
  2683. without changing the instruction. This can be used with the new
  2684. trap-generation provided by SPARClite DSU and most x86-based
  2685. targets. These targets will generate traps when a program accesses
  2686. some data or instruction address that is assigned to the debug
  2687. registers. However the hardware breakpoint registers can take a
  2688. limited number of breakpoints. For example, on the DSU, only two
  2689. data breakpoints can be set at a time, and GDB will reject this
  2690. command if more than two are used. Delete or disable unused
  2691. hardware breakpoints before setting new ones (*note Disabling
  2692. Breakpoints: Disabling.). *Note Break Conditions: Conditions. For
  2693. remote targets, you can restrict the number of hardware breakpoints
  2694. GDB will use, see *note set remote hardware-breakpoint-limit::.
  2695. 'thbreak ARGS'
  2696. Set a hardware-assisted breakpoint enabled only for one stop. The
  2697. ARGS are the same as for the 'hbreak' command and the breakpoint is
  2698. set in the same way. However, like the 'tbreak' command, the
  2699. breakpoint is automatically deleted after the first time your
  2700. program stops there. Also, like the 'hbreak' command, the
  2701. breakpoint requires hardware support and some target hardware may
  2702. not have this support. *Note Disabling Breakpoints: Disabling.
  2703. See also *note Break Conditions: Conditions.
  2704. 'rbreak REGEX'
  2705. Set breakpoints on all functions matching the regular expression
  2706. REGEX. This command sets an unconditional breakpoint on all
  2707. matches, printing a list of all breakpoints it set. Once these
  2708. breakpoints are set, they are treated just like the breakpoints set
  2709. with the 'break' command. You can delete them, disable them, or
  2710. make them conditional the same way as any other breakpoint.
  2711. In programs using different languages, GDB chooses the syntax to
  2712. print the list of all breakpoints it sets according to the 'set
  2713. language' value: using 'set language auto' (see *note Set Language
  2714. Automatically: Automatically.) means to use the language of the
  2715. breakpoint's function, other values mean to use the manually
  2716. specified language (see *note Set Language Manually: Manually.).
  2717. The syntax of the regular expression is the standard one used with
  2718. tools like 'grep'. Note that this is different from the syntax
  2719. used by shells, so for instance 'foo*' matches all functions that
  2720. include an 'fo' followed by zero or more 'o's. There is an
  2721. implicit '.*' leading and trailing the regular expression you
  2722. supply, so to match only functions that begin with 'foo', use
  2723. '^foo'.
  2724. When debugging C++ programs, 'rbreak' is useful for setting
  2725. breakpoints on overloaded functions that are not members of any
  2726. special classes.
  2727. The 'rbreak' command can be used to set breakpoints in *all* the
  2728. functions in a program, like this:
  2729. (gdb) rbreak .
  2730. 'rbreak FILE:REGEX'
  2731. If 'rbreak' is called with a filename qualification, it limits the
  2732. search for functions matching the given regular expression to the
  2733. specified FILE. This can be used, for example, to set breakpoints
  2734. on every function in a given file:
  2735. (gdb) rbreak file.c:.
  2736. The colon separating the filename qualifier from the regex may
  2737. optionally be surrounded by spaces.
  2738. 'info breakpoints [LIST...]'
  2739. 'info break [LIST...]'
  2740. Print a table of all breakpoints, watchpoints, and catchpoints set
  2741. and not deleted. Optional argument N means print information only
  2742. about the specified breakpoint(s) (or watchpoint(s) or
  2743. catchpoint(s)). For each breakpoint, following columns are
  2744. printed:
  2745. _Breakpoint Numbers_
  2746. _Type_
  2747. Breakpoint, watchpoint, or catchpoint.
  2748. _Disposition_
  2749. Whether the breakpoint is marked to be disabled or deleted
  2750. when hit.
  2751. _Enabled or Disabled_
  2752. Enabled breakpoints are marked with 'y'. 'n' marks
  2753. breakpoints that are not enabled.
  2754. _Address_
  2755. Where the breakpoint is in your program, as a memory address.
  2756. For a pending breakpoint whose address is not yet known, this
  2757. field will contain '<PENDING>'. Such breakpoint won't fire
  2758. until a shared library that has the symbol or line referred by
  2759. breakpoint is loaded. See below for details. A breakpoint
  2760. with several locations will have '<MULTIPLE>' in this
  2761. field--see below for details.
  2762. _What_
  2763. Where the breakpoint is in the source for your program, as a
  2764. file and line number. For a pending breakpoint, the original
  2765. string passed to the breakpoint command will be listed as it
  2766. cannot be resolved until the appropriate shared library is
  2767. loaded in the future.
  2768. If a breakpoint is conditional, there are two evaluation modes:
  2769. "host" and "target". If mode is "host", breakpoint condition
  2770. evaluation is done by GDB on the host's side. If it is "target",
  2771. then the condition is evaluated by the target. The 'info break'
  2772. command shows the condition on the line following the affected
  2773. breakpoint, together with its condition evaluation mode in between
  2774. parentheses.
  2775. Breakpoint commands, if any, are listed after that. A pending
  2776. breakpoint is allowed to have a condition specified for it. The
  2777. condition is not parsed for validity until a shared library is
  2778. loaded that allows the pending breakpoint to resolve to a valid
  2779. location.
  2780. 'info break' with a breakpoint number N as argument lists only that
  2781. breakpoint. The convenience variable '$_' and the default
  2782. examining-address for the 'x' command are set to the address of the
  2783. last breakpoint listed (*note Examining Memory: Memory.).
  2784. 'info break' displays a count of the number of times the breakpoint
  2785. has been hit. This is especially useful in conjunction with the
  2786. 'ignore' command. You can ignore a large number of breakpoint
  2787. hits, look at the breakpoint info to see how many times the
  2788. breakpoint was hit, and then run again, ignoring one less than that
  2789. number. This will get you quickly to the last hit of that
  2790. breakpoint.
  2791. For a breakpoints with an enable count (xref) greater than 1, 'info
  2792. break' also displays that count.
  2793. GDB allows you to set any number of breakpoints at the same place in
  2794. your program. There is nothing silly or meaningless about this. When
  2795. the breakpoints are conditional, this is even useful (*note Break
  2796. Conditions: Conditions.).
  2797. It is possible that a breakpoint corresponds to several locations in
  2798. your program. Examples of this situation are:
  2799. * Multiple functions in the program may have the same name.
  2800. * For a C++ constructor, the GCC compiler generates several instances
  2801. of the function body, used in different cases.
  2802. * For a C++ template function, a given line in the function can
  2803. correspond to any number of instantiations.
  2804. * For an inlined function, a given source line can correspond to
  2805. several places where that function is inlined.
  2806. In all those cases, GDB will insert a breakpoint at all the relevant
  2807. locations.
  2808. A breakpoint with multiple locations is displayed in the breakpoint
  2809. table using several rows--one header row, followed by one row for each
  2810. breakpoint location. The header row has '<MULTIPLE>' in the address
  2811. column. The rows for individual locations contain the actual addresses
  2812. for locations, and show the functions to which those locations belong.
  2813. The number column for a location is of the form
  2814. BREAKPOINT-NUMBER.LOCATION-NUMBER.
  2815. For example:
  2816. Num Type Disp Enb Address What
  2817. 1 breakpoint keep y <MULTIPLE>
  2818. stop only if i==1
  2819. breakpoint already hit 1 time
  2820. 1.1 y 0x080486a2 in void foo<int>() at t.cc:8
  2821. 1.2 y 0x080486ca in void foo<double>() at t.cc:8
  2822. You cannot delete the individual locations from a breakpoint.
  2823. However, each location can be individually enabled or disabled by
  2824. passing BREAKPOINT-NUMBER.LOCATION-NUMBER as argument to the 'enable'
  2825. and 'disable' commands. It's also possible to 'enable' and 'disable' a
  2826. range of LOCATION-NUMBER locations using a BREAKPOINT-NUMBER and two
  2827. LOCATION-NUMBERs, in increasing order, separated by a hyphen, like
  2828. 'BREAKPOINT-NUMBER.LOCATION-NUMBER1-LOCATION-NUMBER2', in which case GDB
  2829. acts on all the locations in the range (inclusive). Disabling or
  2830. enabling the parent breakpoint (*note Disabling::) affects all of the
  2831. locations that belong to that breakpoint.
  2832. It's quite common to have a breakpoint inside a shared library.
  2833. Shared libraries can be loaded and unloaded explicitly, and possibly
  2834. repeatedly, as the program is executed. To support this use case, GDB
  2835. updates breakpoint locations whenever any shared library is loaded or
  2836. unloaded. Typically, you would set a breakpoint in a shared library at
  2837. the beginning of your debugging session, when the library is not loaded,
  2838. and when the symbols from the library are not available. When you try
  2839. to set breakpoint, GDB will ask you if you want to set a so called
  2840. "pending breakpoint"--breakpoint whose address is not yet resolved.
  2841. After the program is run, whenever a new shared library is loaded,
  2842. GDB reevaluates all the breakpoints. When a newly loaded shared library
  2843. contains the symbol or line referred to by some pending breakpoint, that
  2844. breakpoint is resolved and becomes an ordinary breakpoint. When a
  2845. library is unloaded, all breakpoints that refer to its symbols or source
  2846. lines become pending again.
  2847. This logic works for breakpoints with multiple locations, too. For
  2848. example, if you have a breakpoint in a C++ template function, and a
  2849. newly loaded shared library has an instantiation of that template, a new
  2850. location is added to the list of locations for the breakpoint.
  2851. Except for having unresolved address, pending breakpoints do not
  2852. differ from regular breakpoints. You can set conditions or commands,
  2853. enable and disable them and perform other breakpoint operations.
  2854. GDB provides some additional commands for controlling what happens
  2855. when the 'break' command cannot resolve breakpoint address specification
  2856. to an address:
  2857. 'set breakpoint pending auto'
  2858. This is the default behavior. When GDB cannot find the breakpoint
  2859. location, it queries you whether a pending breakpoint should be
  2860. created.
  2861. 'set breakpoint pending on'
  2862. This indicates that an unrecognized breakpoint location should
  2863. automatically result in a pending breakpoint being created.
  2864. 'set breakpoint pending off'
  2865. This indicates that pending breakpoints are not to be created. Any
  2866. unrecognized breakpoint location results in an error. This setting
  2867. does not affect any pending breakpoints previously created.
  2868. 'show breakpoint pending'
  2869. Show the current behavior setting for creating pending breakpoints.
  2870. The settings above only affect the 'break' command and its variants.
  2871. Once breakpoint is set, it will be automatically updated as shared
  2872. libraries are loaded and unloaded.
  2873. For some targets, GDB can automatically decide if hardware or
  2874. software breakpoints should be used, depending on whether the breakpoint
  2875. address is read-only or read-write. This applies to breakpoints set
  2876. with the 'break' command as well as to internal breakpoints set by
  2877. commands like 'next' and 'finish'. For breakpoints set with 'hbreak',
  2878. GDB will always use hardware breakpoints.
  2879. You can control this automatic behaviour with the following commands:
  2880. 'set breakpoint auto-hw on'
  2881. This is the default behavior. When GDB sets a breakpoint, it will
  2882. try to use the target memory map to decide if software or hardware
  2883. breakpoint must be used.
  2884. 'set breakpoint auto-hw off'
  2885. This indicates GDB should not automatically select breakpoint type.
  2886. If the target provides a memory map, GDB will warn when trying to
  2887. set software breakpoint at a read-only address.
  2888. GDB normally implements breakpoints by replacing the program code at
  2889. the breakpoint address with a special instruction, which, when executed,
  2890. given control to the debugger. By default, the program code is so
  2891. modified only when the program is resumed. As soon as the program
  2892. stops, GDB restores the original instructions. This behaviour guards
  2893. against leaving breakpoints inserted in the target should gdb abrubptly
  2894. disconnect. However, with slow remote targets, inserting and removing
  2895. breakpoint can reduce the performance. This behavior can be controlled
  2896. with the following commands::
  2897. 'set breakpoint always-inserted off'
  2898. All breakpoints, including newly added by the user, are inserted in
  2899. the target only when the target is resumed. All breakpoints are
  2900. removed from the target when it stops. This is the default mode.
  2901. 'set breakpoint always-inserted on'
  2902. Causes all breakpoints to be inserted in the target at all times.
  2903. If the user adds a new breakpoint, or changes an existing
  2904. breakpoint, the breakpoints in the target are updated immediately.
  2905. A breakpoint is removed from the target only when breakpoint itself
  2906. is deleted.
  2907. GDB handles conditional breakpoints by evaluating these conditions
  2908. when a breakpoint breaks. If the condition is true, then the process
  2909. being debugged stops, otherwise the process is resumed.
  2910. If the target supports evaluating conditions on its end, GDB may
  2911. download the breakpoint, together with its conditions, to it.
  2912. This feature can be controlled via the following commands:
  2913. 'set breakpoint condition-evaluation host'
  2914. This option commands GDB to evaluate the breakpoint conditions on
  2915. the host's side. Unconditional breakpoints are sent to the target
  2916. which in turn receives the triggers and reports them back to GDB
  2917. for condition evaluation. This is the standard evaluation mode.
  2918. 'set breakpoint condition-evaluation target'
  2919. This option commands GDB to download breakpoint conditions to the
  2920. target at the moment of their insertion. The target is responsible
  2921. for evaluating the conditional expression and reporting breakpoint
  2922. stop events back to GDB whenever the condition is true. Due to
  2923. limitations of target-side evaluation, some conditions cannot be
  2924. evaluated there, e.g., conditions that depend on local data that is
  2925. only known to the host. Examples include conditional expressions
  2926. involving convenience variables, complex types that cannot be
  2927. handled by the agent expression parser and expressions that are too
  2928. long to be sent over to the target, specially when the target is a
  2929. remote system. In these cases, the conditions will be evaluated by
  2930. GDB.
  2931. 'set breakpoint condition-evaluation auto'
  2932. This is the default mode. If the target supports evaluating
  2933. breakpoint conditions on its end, GDB will download breakpoint
  2934. conditions to the target (limitations mentioned previously apply).
  2935. If the target does not support breakpoint condition evaluation,
  2936. then GDB will fallback to evaluating all these conditions on the
  2937. host's side.
  2938. GDB itself sometimes sets breakpoints in your program for special
  2939. purposes, such as proper handling of 'longjmp' (in C programs). These
  2940. internal breakpoints are assigned negative numbers, starting with '-1';
  2941. 'info breakpoints' does not display them. You can see these breakpoints
  2942. with the GDB maintenance command 'maint info breakpoints' (*note maint
  2943. info breakpoints::).
  2944. 
  2945. File: gdb.info, Node: Set Watchpoints, Next: Set Catchpoints, Prev: Set Breaks, Up: Breakpoints
  2946. 5.1.2 Setting Watchpoints
  2947. -------------------------
  2948. You can use a watchpoint to stop execution whenever the value of an
  2949. expression changes, without having to predict a particular place where
  2950. this may happen. (This is sometimes called a "data breakpoint".) The
  2951. expression may be as simple as the value of a single variable, or as
  2952. complex as many variables combined by operators. Examples include:
  2953. * A reference to the value of a single variable.
  2954. * An address cast to an appropriate data type. For example, '*(int
  2955. *)0x12345678' will watch a 4-byte region at the specified address
  2956. (assuming an 'int' occupies 4 bytes).
  2957. * An arbitrarily complex expression, such as 'a*b + c/d'. The
  2958. expression can use any operators valid in the program's native
  2959. language (*note Languages::).
  2960. You can set a watchpoint on an expression even if the expression can
  2961. not be evaluated yet. For instance, you can set a watchpoint on
  2962. '*global_ptr' before 'global_ptr' is initialized. GDB will stop when
  2963. your program sets 'global_ptr' and the expression produces a valid
  2964. value. If the expression becomes valid in some other way than changing
  2965. a variable (e.g. if the memory pointed to by '*global_ptr' becomes
  2966. readable as the result of a 'malloc' call), GDB may not stop until the
  2967. next time the expression changes.
  2968. Depending on your system, watchpoints may be implemented in software
  2969. or hardware. GDB does software watchpointing by single-stepping your
  2970. program and testing the variable's value each time, which is hundreds of
  2971. times slower than normal execution. (But this may still be worth it, to
  2972. catch errors where you have no clue what part of your program is the
  2973. culprit.)
  2974. On some systems, such as most PowerPC or x86-based targets, GDB
  2975. includes support for hardware watchpoints, which do not slow down the
  2976. running of your program.
  2977. 'watch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  2978. Set a watchpoint for an expression. GDB will break when the
  2979. expression EXPR is written into by the program and its value
  2980. changes. The simplest (and the most popular) use of this command
  2981. is to watch the value of a single variable:
  2982. (gdb) watch foo
  2983. If the command includes a '[thread THREAD-ID]' argument, GDB breaks
  2984. only when the thread identified by THREAD-ID changes the value of
  2985. EXPR. If any other threads change the value of EXPR, GDB will not
  2986. break. Note that watchpoints restricted to a single thread in this
  2987. way only work with Hardware Watchpoints.
  2988. Ordinarily a watchpoint respects the scope of variables in EXPR
  2989. (see below). The '-location' argument tells GDB to instead watch
  2990. the memory referred to by EXPR. In this case, GDB will evaluate
  2991. EXPR, take the address of the result, and watch the memory at that
  2992. address. The type of the result is used to determine the size of
  2993. the watched memory. If the expression's result does not have an
  2994. address, then GDB will print an error.
  2995. The '[mask MASKVALUE]' argument allows creation of masked
  2996. watchpoints, if the current architecture supports this feature
  2997. (e.g., PowerPC Embedded architecture, see *note PowerPC
  2998. Embedded::.) A "masked watchpoint" specifies a mask in addition to
  2999. an address to watch. The mask specifies that some bits of an
  3000. address (the bits which are reset in the mask) should be ignored
  3001. when matching the address accessed by the inferior against the
  3002. watchpoint address. Thus, a masked watchpoint watches many
  3003. addresses simultaneously--those addresses whose unmasked bits are
  3004. identical to the unmasked bits in the watchpoint address. The
  3005. 'mask' argument implies '-location'. Examples:
  3006. (gdb) watch foo mask 0xffff00ff
  3007. (gdb) watch *0xdeadbeef mask 0xffffff00
  3008. 'rwatch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  3009. Set a watchpoint that will break when the value of EXPR is read by
  3010. the program.
  3011. 'awatch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  3012. Set a watchpoint that will break when EXPR is either read from or
  3013. written into by the program.
  3014. 'info watchpoints [LIST...]'
  3015. This command prints a list of watchpoints, using the same format as
  3016. 'info break' (*note Set Breaks::).
  3017. If you watch for a change in a numerically entered address you need
  3018. to dereference it, as the address itself is just a constant number which
  3019. will never change. GDB refuses to create a watchpoint that watches a
  3020. never-changing value:
  3021. (gdb) watch 0x600850
  3022. Cannot watch constant value 0x600850.
  3023. (gdb) watch *(int *) 0x600850
  3024. Watchpoint 1: *(int *) 6293584
  3025. GDB sets a "hardware watchpoint" if possible. Hardware watchpoints
  3026. execute very quickly, and the debugger reports a change in value at the
  3027. exact instruction where the change occurs. If GDB cannot set a hardware
  3028. watchpoint, it sets a software watchpoint, which executes more slowly
  3029. and reports the change in value at the next _statement_, not the
  3030. instruction, after the change occurs.
  3031. You can force GDB to use only software watchpoints with the 'set
  3032. can-use-hw-watchpoints 0' command. With this variable set to zero, GDB
  3033. will never try to use hardware watchpoints, even if the underlying
  3034. system supports them. (Note that hardware-assisted watchpoints that
  3035. were set _before_ setting 'can-use-hw-watchpoints' to zero will still
  3036. use the hardware mechanism of watching expression values.)
  3037. 'set can-use-hw-watchpoints'
  3038. Set whether or not to use hardware watchpoints.
  3039. 'show can-use-hw-watchpoints'
  3040. Show the current mode of using hardware watchpoints.
  3041. For remote targets, you can restrict the number of hardware
  3042. watchpoints GDB will use, see *note set remote
  3043. hardware-breakpoint-limit::.
  3044. When you issue the 'watch' command, GDB reports
  3045. Hardware watchpoint NUM: EXPR
  3046. if it was able to set a hardware watchpoint.
  3047. Currently, the 'awatch' and 'rwatch' commands can only set hardware
  3048. watchpoints, because accesses to data that don't change the value of the
  3049. watched expression cannot be detected without examining every
  3050. instruction as it is being executed, and GDB does not do that currently.
  3051. If GDB finds that it is unable to set a hardware breakpoint with the
  3052. 'awatch' or 'rwatch' command, it will print a message like this:
  3053. Expression cannot be implemented with read/access watchpoint.
  3054. Sometimes, GDB cannot set a hardware watchpoint because the data type
  3055. of the watched expression is wider than what a hardware watchpoint on
  3056. the target machine can handle. For example, some systems can only watch
  3057. regions that are up to 4 bytes wide; on such systems you cannot set
  3058. hardware watchpoints for an expression that yields a double-precision
  3059. floating-point number (which is typically 8 bytes wide). As a
  3060. work-around, it might be possible to break the large region into a
  3061. series of smaller ones and watch them with separate watchpoints.
  3062. If you set too many hardware watchpoints, GDB might be unable to
  3063. insert all of them when you resume the execution of your program. Since
  3064. the precise number of active watchpoints is unknown until such time as
  3065. the program is about to be resumed, GDB might not be able to warn you
  3066. about this when you set the watchpoints, and the warning will be printed
  3067. only when the program is resumed:
  3068. Hardware watchpoint NUM: Could not insert watchpoint
  3069. If this happens, delete or disable some of the watchpoints.
  3070. Watching complex expressions that reference many variables can also
  3071. exhaust the resources available for hardware-assisted watchpoints.
  3072. That's because GDB needs to watch every variable in the expression with
  3073. separately allocated resources.
  3074. If you call a function interactively using 'print' or 'call', any
  3075. watchpoints you have set will be inactive until GDB reaches another kind
  3076. of breakpoint or the call completes.
  3077. GDB automatically deletes watchpoints that watch local (automatic)
  3078. variables, or expressions that involve such variables, when they go out
  3079. of scope, that is, when the execution leaves the block in which these
  3080. variables were defined. In particular, when the program being debugged
  3081. terminates, _all_ local variables go out of scope, and so only
  3082. watchpoints that watch global variables remain set. If you rerun the
  3083. program, you will need to set all such watchpoints again. One way of
  3084. doing that would be to set a code breakpoint at the entry to the 'main'
  3085. function and when it breaks, set all the watchpoints.
  3086. In multi-threaded programs, watchpoints will detect changes to the
  3087. watched expression from every thread.
  3088. _Warning:_ In multi-threaded programs, software watchpoints have
  3089. only limited usefulness. If GDB creates a software watchpoint, it
  3090. can only watch the value of an expression _in a single thread_. If
  3091. you are confident that the expression can only change due to the
  3092. current thread's activity (and if you are also confident that no
  3093. other thread can become current), then you can use software
  3094. watchpoints as usual. However, GDB may not notice when a
  3095. non-current thread's activity changes the expression. (Hardware
  3096. watchpoints, in contrast, watch an expression in all threads.)
  3097. *Note set remote hardware-watchpoint-limit::.
  3098. 
  3099. File: gdb.info, Node: Set Catchpoints, Next: Delete Breaks, Prev: Set Watchpoints, Up: Breakpoints
  3100. 5.1.3 Setting Catchpoints
  3101. -------------------------
  3102. You can use "catchpoints" to cause the debugger to stop for certain
  3103. kinds of program events, such as C++ exceptions or the loading of a
  3104. shared library. Use the 'catch' command to set a catchpoint.
  3105. 'catch EVENT'
  3106. Stop when EVENT occurs. The EVENT can be any of the following:
  3107. 'throw [REGEXP]'
  3108. 'rethrow [REGEXP]'
  3109. 'catch [REGEXP]'
  3110. The throwing, re-throwing, or catching of a C++ exception.
  3111. If REGEXP is given, then only exceptions whose type matches
  3112. the regular expression will be caught.
  3113. The convenience variable '$_exception' is available at an
  3114. exception-related catchpoint, on some systems. This holds the
  3115. exception being thrown.
  3116. There are currently some limitations to C++ exception handling
  3117. in GDB:
  3118. * The support for these commands is system-dependent.
  3119. Currently, only systems using the 'gnu-v3' C++ ABI (*note
  3120. ABI::) are supported.
  3121. * The regular expression feature and the '$_exception'
  3122. convenience variable rely on the presence of some SDT
  3123. probes in 'libstdc++'. If these probes are not present,
  3124. then these features cannot be used. These probes were
  3125. first available in the GCC 4.8 release, but whether or
  3126. not they are available in your GCC also depends on how it
  3127. was built.
  3128. * The '$_exception' convenience variable is only valid at
  3129. the instruction at which an exception-related catchpoint
  3130. is set.
  3131. * When an exception-related catchpoint is hit, GDB stops at
  3132. a location in the system library which implements runtime
  3133. exception support for C++, usually 'libstdc++'. You can
  3134. use 'up' (*note Selection::) to get to your code.
  3135. * If you call a function interactively, GDB normally
  3136. returns control to you when the function has finished
  3137. executing. If the call raises an exception, however, the
  3138. call may bypass the mechanism that returns control to you
  3139. and cause your program either to abort or to simply
  3140. continue running until it hits a breakpoint, catches a
  3141. signal that GDB is listening for, or exits. This is the
  3142. case even if you set a catchpoint for the exception;
  3143. catchpoints on exceptions are disabled within interactive
  3144. calls. *Note Calling::, for information on controlling
  3145. this with 'set unwind-on-terminating-exception'.
  3146. * You cannot raise an exception interactively.
  3147. * You cannot install an exception handler interactively.
  3148. 'exception [NAME]'
  3149. An Ada exception being raised. If an exception name is
  3150. specified at the end of the command (eg 'catch exception
  3151. Program_Error'), the debugger will stop only when this
  3152. specific exception is raised. Otherwise, the debugger stops
  3153. execution when any Ada exception is raised.
  3154. When inserting an exception catchpoint on a user-defined
  3155. exception whose name is identical to one of the exceptions
  3156. defined by the language, the fully qualified name must be used
  3157. as the exception name. Otherwise, GDB will assume that it
  3158. should stop on the pre-defined exception rather than the
  3159. user-defined one. For instance, assuming an exception called
  3160. 'Constraint_Error' is defined in package 'Pck', then the
  3161. command to use to catch such exceptions is 'catch exception
  3162. Pck.Constraint_Error'.
  3163. The convenience variable '$_ada_exception' holds the address
  3164. of the exception being thrown. This can be useful when
  3165. setting a condition for such a catchpoint.
  3166. 'exception unhandled'
  3167. An exception that was raised but is not handled by the
  3168. program. The convenience variable '$_ada_exception' is set as
  3169. for 'catch exception'.
  3170. 'handlers [NAME]'
  3171. An Ada exception being handled. If an exception name is
  3172. specified at the end of the command (eg 'catch handlers
  3173. Program_Error'), the debugger will stop only when this
  3174. specific exception is handled. Otherwise, the debugger stops
  3175. execution when any Ada exception is handled.
  3176. When inserting a handlers catchpoint on a user-defined
  3177. exception whose name is identical to one of the exceptions
  3178. defined by the language, the fully qualified name must be used
  3179. as the exception name. Otherwise, GDB will assume that it
  3180. should stop on the pre-defined exception rather than the
  3181. user-defined one. For instance, assuming an exception called
  3182. 'Constraint_Error' is defined in package 'Pck', then the
  3183. command to use to catch such exceptions handling is 'catch
  3184. handlers Pck.Constraint_Error'.
  3185. The convenience variable '$_ada_exception' is set as for
  3186. 'catch exception'.
  3187. 'assert'
  3188. A failed Ada assertion. Note that the convenience variable
  3189. '$_ada_exception' is _not_ set by this catchpoint.
  3190. 'exec'
  3191. A call to 'exec'.
  3192. 'syscall'
  3193. 'syscall [NAME | NUMBER | group:GROUPNAME | g:GROUPNAME] ...'
  3194. A call to or return from a system call, a.k.a. "syscall". A
  3195. syscall is a mechanism for application programs to request a
  3196. service from the operating system (OS) or one of the OS system
  3197. services. GDB can catch some or all of the syscalls issued by
  3198. the debuggee, and show the related information for each
  3199. syscall. If no argument is specified, calls to and returns
  3200. from all system calls will be caught.
  3201. NAME can be any system call name that is valid for the
  3202. underlying OS. Just what syscalls are valid depends on the OS.
  3203. On GNU and Unix systems, you can find the full list of valid
  3204. syscall names on '/usr/include/asm/unistd.h'.
  3205. Normally, GDB knows in advance which syscalls are valid for
  3206. each OS, so you can use the GDB command-line completion
  3207. facilities (*note command completion: Completion.) to list the
  3208. available choices.
  3209. You may also specify the system call numerically. A syscall's
  3210. number is the value passed to the OS's syscall dispatcher to
  3211. identify the requested service. When you specify the syscall
  3212. by its name, GDB uses its database of syscalls to convert the
  3213. name into the corresponding numeric code, but using the number
  3214. directly may be useful if GDB's database does not have the
  3215. complete list of syscalls on your system (e.g., because GDB
  3216. lags behind the OS upgrades).
  3217. You may specify a group of related syscalls to be caught at
  3218. once using the 'group:' syntax ('g:' is a shorter equivalent).
  3219. For instance, on some platforms GDB allows you to catch all
  3220. network related syscalls, by passing the argument
  3221. 'group:network' to 'catch syscall'. Note that not all syscall
  3222. groups are available in every system. You can use the command
  3223. completion facilities (*note command completion: Completion.)
  3224. to list the syscall groups available on your environment.
  3225. The example below illustrates how this command works if you
  3226. don't provide arguments to it:
  3227. (gdb) catch syscall
  3228. Catchpoint 1 (syscall)
  3229. (gdb) r
  3230. Starting program: /tmp/catch-syscall
  3231. Catchpoint 1 (call to syscall 'close'), \
  3232. 0xffffe424 in __kernel_vsyscall ()
  3233. (gdb) c
  3234. Continuing.
  3235. Catchpoint 1 (returned from syscall 'close'), \
  3236. 0xffffe424 in __kernel_vsyscall ()
  3237. (gdb)
  3238. Here is an example of catching a system call by name:
  3239. (gdb) catch syscall chroot
  3240. Catchpoint 1 (syscall 'chroot' [61])
  3241. (gdb) r
  3242. Starting program: /tmp/catch-syscall
  3243. Catchpoint 1 (call to syscall 'chroot'), \
  3244. 0xffffe424 in __kernel_vsyscall ()
  3245. (gdb) c
  3246. Continuing.
  3247. Catchpoint 1 (returned from syscall 'chroot'), \
  3248. 0xffffe424 in __kernel_vsyscall ()
  3249. (gdb)
  3250. An example of specifying a system call numerically. In the
  3251. case below, the syscall number has a corresponding entry in
  3252. the XML file, so GDB finds its name and prints it:
  3253. (gdb) catch syscall 252
  3254. Catchpoint 1 (syscall(s) 'exit_group')
  3255. (gdb) r
  3256. Starting program: /tmp/catch-syscall
  3257. Catchpoint 1 (call to syscall 'exit_group'), \
  3258. 0xffffe424 in __kernel_vsyscall ()
  3259. (gdb) c
  3260. Continuing.
  3261. Program exited normally.
  3262. (gdb)
  3263. Here is an example of catching a syscall group:
  3264. (gdb) catch syscall group:process
  3265. Catchpoint 1 (syscalls 'exit' [1] 'fork' [2] 'waitpid' [7]
  3266. 'execve' [11] 'wait4' [114] 'clone' [120] 'vfork' [190]
  3267. 'exit_group' [252] 'waitid' [284] 'unshare' [310])
  3268. (gdb) r
  3269. Starting program: /tmp/catch-syscall
  3270. Catchpoint 1 (call to syscall fork), 0x00007ffff7df4e27 in open64 ()
  3271. from /lib64/ld-linux-x86-64.so.2
  3272. (gdb) c
  3273. Continuing.
  3274. However, there can be situations when there is no
  3275. corresponding name in XML file for that syscall number. In
  3276. this case, GDB prints a warning message saying that it was not
  3277. able to find the syscall name, but the catchpoint will be set
  3278. anyway. See the example below:
  3279. (gdb) catch syscall 764
  3280. warning: The number '764' does not represent a known syscall.
  3281. Catchpoint 2 (syscall 764)
  3282. (gdb)
  3283. If you configure GDB using the '--without-expat' option, it
  3284. will not be able to display syscall names. Also, if your
  3285. architecture does not have an XML file describing its system
  3286. calls, you will not be able to see the syscall names. It is
  3287. important to notice that these two features are used for
  3288. accessing the syscall name database. In either case, you will
  3289. see a warning like this:
  3290. (gdb) catch syscall
  3291. warning: Could not open "syscalls/i386-linux.xml"
  3292. warning: Could not load the syscall XML file 'syscalls/i386-linux.xml'.
  3293. GDB will not be able to display syscall names.
  3294. Catchpoint 1 (syscall)
  3295. (gdb)
  3296. Of course, the file name will change depending on your
  3297. architecture and system.
  3298. Still using the example above, you can also try to catch a
  3299. syscall by its number. In this case, you would see something
  3300. like:
  3301. (gdb) catch syscall 252
  3302. Catchpoint 1 (syscall(s) 252)
  3303. Again, in this case GDB would not be able to display syscall's
  3304. names.
  3305. 'fork'
  3306. A call to 'fork'.
  3307. 'vfork'
  3308. A call to 'vfork'.
  3309. 'load [REGEXP]'
  3310. 'unload [REGEXP]'
  3311. The loading or unloading of a shared library. If REGEXP is
  3312. given, then the catchpoint will stop only if the regular
  3313. expression matches one of the affected libraries.
  3314. 'signal [SIGNAL... | 'all']'
  3315. The delivery of a signal.
  3316. With no arguments, this catchpoint will catch any signal that
  3317. is not used internally by GDB, specifically, all signals
  3318. except 'SIGTRAP' and 'SIGINT'.
  3319. With the argument 'all', all signals, including those used by
  3320. GDB, will be caught. This argument cannot be used with other
  3321. signal names.
  3322. Otherwise, the arguments are a list of signal names as given
  3323. to 'handle' (*note Signals::). Only signals specified in this
  3324. list will be caught.
  3325. One reason that 'catch signal' can be more useful than
  3326. 'handle' is that you can attach commands and conditions to the
  3327. catchpoint.
  3328. When a signal is caught by a catchpoint, the signal's 'stop'
  3329. and 'print' settings, as specified by 'handle', are ignored.
  3330. However, whether the signal is still delivered to the inferior
  3331. depends on the 'pass' setting; this can be changed in the
  3332. catchpoint's commands.
  3333. 'tcatch EVENT'
  3334. Set a catchpoint that is enabled only for one stop. The catchpoint
  3335. is automatically deleted after the first time the event is caught.
  3336. Use the 'info break' command to list the current catchpoints.
  3337. 
  3338. File: gdb.info, Node: Delete Breaks, Next: Disabling, Prev: Set Catchpoints, Up: Breakpoints
  3339. 5.1.4 Deleting Breakpoints
  3340. --------------------------
  3341. It is often necessary to eliminate a breakpoint, watchpoint, or
  3342. catchpoint once it has done its job and you no longer want your program
  3343. to stop there. This is called "deleting" the breakpoint. A breakpoint
  3344. that has been deleted no longer exists; it is forgotten.
  3345. With the 'clear' command you can delete breakpoints according to
  3346. where they are in your program. With the 'delete' command you can
  3347. delete individual breakpoints, watchpoints, or catchpoints by specifying
  3348. their breakpoint numbers.
  3349. It is not necessary to delete a breakpoint to proceed past it. GDB
  3350. automatically ignores breakpoints on the first instruction to be
  3351. executed when you continue execution without changing the execution
  3352. address.
  3353. 'clear'
  3354. Delete any breakpoints at the next instruction to be executed in
  3355. the selected stack frame (*note Selecting a Frame: Selection.).
  3356. When the innermost frame is selected, this is a good way to delete
  3357. a breakpoint where your program just stopped.
  3358. 'clear LOCATION'
  3359. Delete any breakpoints set at the specified LOCATION. *Note
  3360. Specify Location::, for the various forms of LOCATION; the most
  3361. useful ones are listed below:
  3362. 'clear FUNCTION'
  3363. 'clear FILENAME:FUNCTION'
  3364. Delete any breakpoints set at entry to the named FUNCTION.
  3365. 'clear LINENUM'
  3366. 'clear FILENAME:LINENUM'
  3367. Delete any breakpoints set at or within the code of the
  3368. specified LINENUM of the specified FILENAME.
  3369. 'delete [breakpoints] [LIST...]'
  3370. Delete the breakpoints, watchpoints, or catchpoints of the
  3371. breakpoint list specified as argument. If no argument is
  3372. specified, delete all breakpoints (GDB asks confirmation, unless
  3373. you have 'set confirm off'). You can abbreviate this command as
  3374. 'd'.
  3375. 
  3376. File: gdb.info, Node: Disabling, Next: Conditions, Prev: Delete Breaks, Up: Breakpoints
  3377. 5.1.5 Disabling Breakpoints
  3378. ---------------------------
  3379. Rather than deleting a breakpoint, watchpoint, or catchpoint, you might
  3380. prefer to "disable" it. This makes the breakpoint inoperative as if it
  3381. had been deleted, but remembers the information on the breakpoint so
  3382. that you can "enable" it again later.
  3383. You disable and enable breakpoints, watchpoints, and catchpoints with
  3384. the 'enable' and 'disable' commands, optionally specifying one or more
  3385. breakpoint numbers as arguments. Use 'info break' to print a list of
  3386. all breakpoints, watchpoints, and catchpoints if you do not know which
  3387. numbers to use.
  3388. Disabling and enabling a breakpoint that has multiple locations
  3389. affects all of its locations.
  3390. A breakpoint, watchpoint, or catchpoint can have any of several
  3391. different states of enablement:
  3392. * Enabled. The breakpoint stops your program. A breakpoint set with
  3393. the 'break' command starts out in this state.
  3394. * Disabled. The breakpoint has no effect on your program.
  3395. * Enabled once. The breakpoint stops your program, but then becomes
  3396. disabled.
  3397. * Enabled for a count. The breakpoint stops your program for the
  3398. next N times, then becomes disabled.
  3399. * Enabled for deletion. The breakpoint stops your program, but
  3400. immediately after it does so it is deleted permanently. A
  3401. breakpoint set with the 'tbreak' command starts out in this state.
  3402. You can use the following commands to enable or disable breakpoints,
  3403. watchpoints, and catchpoints:
  3404. 'disable [breakpoints] [LIST...]'
  3405. Disable the specified breakpoints--or all breakpoints, if none are
  3406. listed. A disabled breakpoint has no effect but is not forgotten.
  3407. All options such as ignore-counts, conditions and commands are
  3408. remembered in case the breakpoint is enabled again later. You may
  3409. abbreviate 'disable' as 'dis'.
  3410. 'enable [breakpoints] [LIST...]'
  3411. Enable the specified breakpoints (or all defined breakpoints).
  3412. They become effective once again in stopping your program.
  3413. 'enable [breakpoints] once LIST...'
  3414. Enable the specified breakpoints temporarily. GDB disables any of
  3415. these breakpoints immediately after stopping your program.
  3416. 'enable [breakpoints] count COUNT LIST...'
  3417. Enable the specified breakpoints temporarily. GDB records COUNT
  3418. with each of the specified breakpoints, and decrements a
  3419. breakpoint's count when it is hit. When any count reaches 0, GDB
  3420. disables that breakpoint. If a breakpoint has an ignore count
  3421. (*note Break Conditions: Conditions.), that will be decremented to
  3422. 0 before COUNT is affected.
  3423. 'enable [breakpoints] delete LIST...'
  3424. Enable the specified breakpoints to work once, then die. GDB
  3425. deletes any of these breakpoints as soon as your program stops
  3426. there. Breakpoints set by the 'tbreak' command start out in this
  3427. state.
  3428. Except for a breakpoint set with 'tbreak' (*note Setting Breakpoints:
  3429. Set Breaks.), breakpoints that you set are initially enabled;
  3430. subsequently, they become disabled or enabled only when you use one of
  3431. the commands above. (The command 'until' can set and delete a
  3432. breakpoint of its own, but it does not change the state of your other
  3433. breakpoints; see *note Continuing and Stepping: Continuing and
  3434. Stepping.)
  3435. 
  3436. File: gdb.info, Node: Conditions, Next: Break Commands, Prev: Disabling, Up: Breakpoints
  3437. 5.1.6 Break Conditions
  3438. ----------------------
  3439. The simplest sort of breakpoint breaks every time your program reaches a
  3440. specified place. You can also specify a "condition" for a breakpoint.
  3441. A condition is just a Boolean expression in your programming language
  3442. (*note Expressions: Expressions.). A breakpoint with a condition
  3443. evaluates the expression each time your program reaches it, and your
  3444. program stops only if the condition is _true_.
  3445. This is the converse of using assertions for program validation; in
  3446. that situation, you want to stop when the assertion is violated--that
  3447. is, when the condition is false. In C, if you want to test an assertion
  3448. expressed by the condition ASSERT, you should set the condition '!
  3449. ASSERT' on the appropriate breakpoint.
  3450. Conditions are also accepted for watchpoints; you may not need them,
  3451. since a watchpoint is inspecting the value of an expression anyhow--but
  3452. it might be simpler, say, to just set a watchpoint on a variable name,
  3453. and specify a condition that tests whether the new value is an
  3454. interesting one.
  3455. Break conditions can have side effects, and may even call functions
  3456. in your program. This can be useful, for example, to activate functions
  3457. that log program progress, or to use your own print functions to format
  3458. special data structures. The effects are completely predictable unless
  3459. there is another enabled breakpoint at the same address. (In that case,
  3460. GDB might see the other breakpoint first and stop your program without
  3461. checking the condition of this one.) Note that breakpoint commands are
  3462. usually more convenient and flexible than break conditions for the
  3463. purpose of performing side effects when a breakpoint is reached (*note
  3464. Breakpoint Command Lists: Break Commands.).
  3465. Breakpoint conditions can also be evaluated on the target's side if
  3466. the target supports it. Instead of evaluating the conditions locally,
  3467. GDB encodes the expression into an agent expression (*note Agent
  3468. Expressions::) suitable for execution on the target, independently of
  3469. GDB. Global variables become raw memory locations, locals become stack
  3470. accesses, and so forth.
  3471. In this case, GDB will only be notified of a breakpoint trigger when
  3472. its condition evaluates to true. This mechanism may provide faster
  3473. response times depending on the performance characteristics of the
  3474. target since it does not need to keep GDB informed about every
  3475. breakpoint trigger, even those with false conditions.
  3476. Break conditions can be specified when a breakpoint is set, by using
  3477. 'if' in the arguments to the 'break' command. *Note Setting
  3478. Breakpoints: Set Breaks. They can also be changed at any time with the
  3479. 'condition' command.
  3480. You can also use the 'if' keyword with the 'watch' command. The
  3481. 'catch' command does not recognize the 'if' keyword; 'condition' is the
  3482. only way to impose a further condition on a catchpoint.
  3483. 'condition BNUM EXPRESSION'
  3484. Specify EXPRESSION as the break condition for breakpoint,
  3485. watchpoint, or catchpoint number BNUM. After you set a condition,
  3486. breakpoint BNUM stops your program only if the value of EXPRESSION
  3487. is true (nonzero, in C). When you use 'condition', GDB checks
  3488. EXPRESSION immediately for syntactic correctness, and to determine
  3489. whether symbols in it have referents in the context of your
  3490. breakpoint. If EXPRESSION uses symbols not referenced in the
  3491. context of the breakpoint, GDB prints an error message:
  3492. No symbol "foo" in current context.
  3493. GDB does not actually evaluate EXPRESSION at the time the
  3494. 'condition' command (or a command that sets a breakpoint with a
  3495. condition, like 'break if ...') is given, however. *Note
  3496. Expressions: Expressions.
  3497. 'condition BNUM'
  3498. Remove the condition from breakpoint number BNUM. It becomes an
  3499. ordinary unconditional breakpoint.
  3500. A special case of a breakpoint condition is to stop only when the
  3501. breakpoint has been reached a certain number of times. This is so
  3502. useful that there is a special way to do it, using the "ignore count" of
  3503. the breakpoint. Every breakpoint has an ignore count, which is an
  3504. integer. Most of the time, the ignore count is zero, and therefore has
  3505. no effect. But if your program reaches a breakpoint whose ignore count
  3506. is positive, then instead of stopping, it just decrements the ignore
  3507. count by one and continues. As a result, if the ignore count value is
  3508. N, the breakpoint does not stop the next N times your program reaches
  3509. it.
  3510. 'ignore BNUM COUNT'
  3511. Set the ignore count of breakpoint number BNUM to COUNT. The next
  3512. COUNT times the breakpoint is reached, your program's execution
  3513. does not stop; other than to decrement the ignore count, GDB takes
  3514. no action.
  3515. To make the breakpoint stop the next time it is reached, specify a
  3516. count of zero.
  3517. When you use 'continue' to resume execution of your program from a
  3518. breakpoint, you can specify an ignore count directly as an argument
  3519. to 'continue', rather than using 'ignore'. *Note Continuing and
  3520. Stepping: Continuing and Stepping.
  3521. If a breakpoint has a positive ignore count and a condition, the
  3522. condition is not checked. Once the ignore count reaches zero, GDB
  3523. resumes checking the condition.
  3524. You could achieve the effect of the ignore count with a condition
  3525. such as '$foo-- <= 0' using a debugger convenience variable that is
  3526. decremented each time. *Note Convenience Variables: Convenience
  3527. Vars.
  3528. Ignore counts apply to breakpoints, watchpoints, and catchpoints.
  3529. 
  3530. File: gdb.info, Node: Break Commands, Next: Dynamic Printf, Prev: Conditions, Up: Breakpoints
  3531. 5.1.7 Breakpoint Command Lists
  3532. ------------------------------
  3533. You can give any breakpoint (or watchpoint or catchpoint) a series of
  3534. commands to execute when your program stops due to that breakpoint. For
  3535. example, you might want to print the values of certain expressions, or
  3536. enable other breakpoints.
  3537. 'commands [LIST...]'
  3538. '... COMMAND-LIST ...'
  3539. 'end'
  3540. Specify a list of commands for the given breakpoints. The commands
  3541. themselves appear on the following lines. Type a line containing
  3542. just 'end' to terminate the commands.
  3543. To remove all commands from a breakpoint, type 'commands' and
  3544. follow it immediately with 'end'; that is, give no commands.
  3545. With no argument, 'commands' refers to the last breakpoint,
  3546. watchpoint, or catchpoint set (not to the breakpoint most recently
  3547. encountered). If the most recent breakpoints were set with a
  3548. single command, then the 'commands' will apply to all the
  3549. breakpoints set by that command. This applies to breakpoints set
  3550. by 'rbreak', and also applies when a single 'break' command creates
  3551. multiple breakpoints (*note Ambiguous Expressions: Ambiguous
  3552. Expressions.).
  3553. Pressing <RET> as a means of repeating the last GDB command is
  3554. disabled within a COMMAND-LIST.
  3555. You can use breakpoint commands to start your program up again.
  3556. Simply use the 'continue' command, or 'step', or any other command that
  3557. resumes execution.
  3558. Any other commands in the command list, after a command that resumes
  3559. execution, are ignored. This is because any time you resume execution
  3560. (even with a simple 'next' or 'step'), you may encounter another
  3561. breakpoint--which could have its own command list, leading to
  3562. ambiguities about which list to execute.
  3563. If the first command you specify in a command list is 'silent', the
  3564. usual message about stopping at a breakpoint is not printed. This may
  3565. be desirable for breakpoints that are to print a specific message and
  3566. then continue. If none of the remaining commands print anything, you
  3567. see no sign that the breakpoint was reached. 'silent' is meaningful
  3568. only at the beginning of a breakpoint command list.
  3569. The commands 'echo', 'output', and 'printf' allow you to print
  3570. precisely controlled output, and are often useful in silent breakpoints.
  3571. *Note Commands for Controlled Output: Output.
  3572. For example, here is how you could use breakpoint commands to print
  3573. the value of 'x' at entry to 'foo' whenever 'x' is positive.
  3574. break foo if x>0
  3575. commands
  3576. silent
  3577. printf "x is %d\n",x
  3578. cont
  3579. end
  3580. One application for breakpoint commands is to compensate for one bug
  3581. so you can test for another. Put a breakpoint just after the erroneous
  3582. line of code, give it a condition to detect the case in which something
  3583. erroneous has been done, and give it commands to assign correct values
  3584. to any variables that need them. End with the 'continue' command so
  3585. that your program does not stop, and start with the 'silent' command so
  3586. that no output is produced. Here is an example:
  3587. break 403
  3588. commands
  3589. silent
  3590. set x = y + 4
  3591. cont
  3592. end
  3593. 
  3594. File: gdb.info, Node: Dynamic Printf, Next: Save Breakpoints, Prev: Break Commands, Up: Breakpoints
  3595. 5.1.8 Dynamic Printf
  3596. --------------------
  3597. The dynamic printf command 'dprintf' combines a breakpoint with
  3598. formatted printing of your program's data to give you the effect of
  3599. inserting 'printf' calls into your program on-the-fly, without having to
  3600. recompile it.
  3601. In its most basic form, the output goes to the GDB console. However,
  3602. you can set the variable 'dprintf-style' for alternate handling. For
  3603. instance, you can ask to format the output by calling your program's
  3604. 'printf' function. This has the advantage that the characters go to the
  3605. program's output device, so they can recorded in redirects to files and
  3606. so forth.
  3607. If you are doing remote debugging with a stub or agent, you can also
  3608. ask to have the printf handled by the remote agent. In addition to
  3609. ensuring that the output goes to the remote program's device along with
  3610. any other output the program might produce, you can also ask that the
  3611. dprintf remain active even after disconnecting from the remote target.
  3612. Using the stub/agent is also more efficient, as it can do everything
  3613. without needing to communicate with GDB.
  3614. 'dprintf LOCATION,TEMPLATE,EXPRESSION[,EXPRESSION...]'
  3615. Whenever execution reaches LOCATION, print the values of one or
  3616. more EXPRESSIONS under the control of the string TEMPLATE. To
  3617. print several values, separate them with commas.
  3618. 'set dprintf-style STYLE'
  3619. Set the dprintf output to be handled in one of several different
  3620. styles enumerated below. A change of style affects all existing
  3621. dynamic printfs immediately. (If you need individual control over
  3622. the print commands, simply define normal breakpoints with
  3623. explicitly-supplied command lists.)
  3624. 'gdb'
  3625. Handle the output using the GDB 'printf' command.
  3626. 'call'
  3627. Handle the output by calling a function in your program
  3628. (normally 'printf').
  3629. 'agent'
  3630. Have the remote debugging agent (such as 'gdbserver') handle
  3631. the output itself. This style is only available for agents
  3632. that support running commands on the target.
  3633. 'set dprintf-function FUNCTION'
  3634. Set the function to call if the dprintf style is 'call'. By
  3635. default its value is 'printf'. You may set it to any expression.
  3636. that GDB can evaluate to a function, as per the 'call' command.
  3637. 'set dprintf-channel CHANNEL'
  3638. Set a "channel" for dprintf. If set to a non-empty value, GDB will
  3639. evaluate it as an expression and pass the result as a first
  3640. argument to the 'dprintf-function', in the manner of 'fprintf' and
  3641. similar functions. Otherwise, the dprintf format string will be
  3642. the first argument, in the manner of 'printf'.
  3643. As an example, if you wanted 'dprintf' output to go to a logfile
  3644. that is a standard I/O stream assigned to the variable 'mylog', you
  3645. could do the following:
  3646. (gdb) set dprintf-style call
  3647. (gdb) set dprintf-function fprintf
  3648. (gdb) set dprintf-channel mylog
  3649. (gdb) dprintf 25,"at line 25, glob=%d\n",glob
  3650. Dprintf 1 at 0x123456: file main.c, line 25.
  3651. (gdb) info break
  3652. 1 dprintf keep y 0x00123456 in main at main.c:25
  3653. call (void) fprintf (mylog,"at line 25, glob=%d\n",glob)
  3654. continue
  3655. (gdb)
  3656. Note that the 'info break' displays the dynamic printf commands as
  3657. normal breakpoint commands; you can thus easily see the effect of
  3658. the variable settings.
  3659. 'set disconnected-dprintf on'
  3660. 'set disconnected-dprintf off'
  3661. Choose whether 'dprintf' commands should continue to run if GDB has
  3662. disconnected from the target. This only applies if the
  3663. 'dprintf-style' is 'agent'.
  3664. 'show disconnected-dprintf off'
  3665. Show the current choice for disconnected 'dprintf'.
  3666. GDB does not check the validity of function and channel, relying on
  3667. you to supply values that are meaningful for the contexts in which they
  3668. are being used. For instance, the function and channel may be the
  3669. values of local variables, but if that is the case, then all enabled
  3670. dynamic prints must be at locations within the scope of those locals.
  3671. If evaluation fails, GDB will report an error.
  3672. 
  3673. File: gdb.info, Node: Save Breakpoints, Next: Static Probe Points, Prev: Dynamic Printf, Up: Breakpoints
  3674. 5.1.9 How to save breakpoints to a file
  3675. ---------------------------------------
  3676. To save breakpoint definitions to a file use the 'save breakpoints'
  3677. command.
  3678. 'save breakpoints [FILENAME]'
  3679. This command saves all current breakpoint definitions together with
  3680. their commands and ignore counts, into a file 'FILENAME' suitable
  3681. for use in a later debugging session. This includes all types of
  3682. breakpoints (breakpoints, watchpoints, catchpoints, tracepoints).
  3683. To read the saved breakpoint definitions, use the 'source' command
  3684. (*note Command Files::). Note that watchpoints with expressions
  3685. involving local variables may fail to be recreated because it may
  3686. not be possible to access the context where the watchpoint is valid
  3687. anymore. Because the saved breakpoint definitions are simply a
  3688. sequence of GDB commands that recreate the breakpoints, you can
  3689. edit the file in your favorite editing program, and remove the
  3690. breakpoint definitions you're not interested in, or that can no
  3691. longer be recreated.
  3692. 
  3693. File: gdb.info, Node: Static Probe Points, Next: Error in Breakpoints, Prev: Save Breakpoints, Up: Breakpoints
  3694. 5.1.10 Static Probe Points
  3695. --------------------------
  3696. GDB supports "SDT" probes in the code. SDT stands for Statically
  3697. Defined Tracing, and the probes are designed to have a tiny runtime code
  3698. and data footprint, and no dynamic relocations.
  3699. Currently, the following types of probes are supported on
  3700. ELF-compatible systems:
  3701. * 'SystemTap' (<http://sourceware.org/systemtap/>) SDT probes(1).
  3702. 'SystemTap' probes are usable from assembly, C and C++
  3703. languages(2).
  3704. * 'DTrace' (<http://oss.oracle.com/projects/DTrace>) USDT probes.
  3705. 'DTrace' probes are usable from C and C++ languages.
  3706. Some 'SystemTap' probes have an associated semaphore variable; for
  3707. instance, this happens automatically if you defined your probe using a
  3708. DTrace-style '.d' file. If your probe has a semaphore, GDB will
  3709. automatically enable it when you specify a breakpoint using the
  3710. '-probe-stap' notation. But, if you put a breakpoint at a probe's
  3711. location by some other method (e.g., 'break file:line'), then GDB will
  3712. not automatically set the semaphore. 'DTrace' probes do not support
  3713. semaphores.
  3714. You can examine the available static static probes using 'info
  3715. probes', with optional arguments:
  3716. 'info probes [TYPE] [PROVIDER [NAME [OBJFILE]]]'
  3717. If given, TYPE is either 'stap' for listing 'SystemTap' probes or
  3718. 'dtrace' for listing 'DTrace' probes. If omitted all probes are
  3719. listed regardless of their types.
  3720. If given, PROVIDER is a regular expression used to match against
  3721. provider names when selecting which probes to list. If omitted,
  3722. probes by all probes from all providers are listed.
  3723. If given, NAME is a regular expression to match against probe names
  3724. when selecting which probes to list. If omitted, probe names are
  3725. not considered when deciding whether to display them.
  3726. If given, OBJFILE is a regular expression used to select which
  3727. object files (executable or shared libraries) to examine. If not
  3728. given, all object files are considered.
  3729. 'info probes all'
  3730. List the available static probes, from all types.
  3731. Some probe points can be enabled and/or disabled. The effect of
  3732. enabling or disabling a probe depends on the type of probe being
  3733. handled. Some 'DTrace' probes can be enabled or disabled, but
  3734. 'SystemTap' probes cannot be disabled.
  3735. You can enable (or disable) one or more probes using the following
  3736. commands, with optional arguments:
  3737. 'enable probes [PROVIDER [NAME [OBJFILE]]]'
  3738. If given, PROVIDER is a regular expression used to match against
  3739. provider names when selecting which probes to enable. If omitted,
  3740. all probes from all providers are enabled.
  3741. If given, NAME is a regular expression to match against probe names
  3742. when selecting which probes to enable. If omitted, probe names are
  3743. not considered when deciding whether to enable them.
  3744. If given, OBJFILE is a regular expression used to select which
  3745. object files (executable or shared libraries) to examine. If not
  3746. given, all object files are considered.
  3747. 'disable probes [PROVIDER [NAME [OBJFILE]]]'
  3748. See the 'enable probes' command above for a description of the
  3749. optional arguments accepted by this command.
  3750. A probe may specify up to twelve arguments. These are available at
  3751. the point at which the probe is defined--that is, when the current PC is
  3752. at the probe's location. The arguments are available using the
  3753. convenience variables (*note Convenience Vars::)
  3754. '$_probe_arg0'...'$_probe_arg11'. In 'SystemTap' probes each probe
  3755. argument is an integer of the appropriate size; types are not preserved.
  3756. In 'DTrace' probes types are preserved provided that they are recognized
  3757. as such by GDB; otherwise the value of the probe argument will be a long
  3758. integer. The convenience variable '$_probe_argc' holds the number of
  3759. arguments at the current probe point.
  3760. These variables are always available, but attempts to access them at
  3761. any location other than a probe point will cause GDB to give an error
  3762. message.
  3763. ---------- Footnotes ----------
  3764. (1) See
  3765. <http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps> for
  3766. more information on how to add 'SystemTap' SDT probes in your
  3767. applications.
  3768. (2) See
  3769. <http://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation> for
  3770. a good reference on how the SDT probes are implemented.
  3771. 
  3772. File: gdb.info, Node: Error in Breakpoints, Next: Breakpoint-related Warnings, Prev: Static Probe Points, Up: Breakpoints
  3773. 5.1.11 "Cannot insert breakpoints"
  3774. ----------------------------------
  3775. If you request too many active hardware-assisted breakpoints and
  3776. watchpoints, you will see this error message:
  3777. Stopped; cannot insert breakpoints.
  3778. You may have requested too many hardware breakpoints and watchpoints.
  3779. This message is printed when you attempt to resume the program, since
  3780. only then GDB knows exactly how many hardware breakpoints and
  3781. watchpoints it needs to insert.
  3782. When this message is printed, you need to disable or remove some of
  3783. the hardware-assisted breakpoints and watchpoints, and then continue.
  3784. 
  3785. File: gdb.info, Node: Breakpoint-related Warnings, Prev: Error in Breakpoints, Up: Breakpoints
  3786. 5.1.12 "Breakpoint address adjusted..."
  3787. ---------------------------------------
  3788. Some processor architectures place constraints on the addresses at which
  3789. breakpoints may be placed. For architectures thus constrained, GDB will
  3790. attempt to adjust the breakpoint's address to comply with the
  3791. constraints dictated by the architecture.
  3792. One example of such an architecture is the Fujitsu FR-V. The FR-V is
  3793. a VLIW architecture in which a number of RISC-like instructions may be
  3794. bundled together for parallel execution. The FR-V architecture
  3795. constrains the location of a breakpoint instruction within such a bundle
  3796. to the instruction with the lowest address. GDB honors this constraint
  3797. by adjusting a breakpoint's address to the first in the bundle.
  3798. It is not uncommon for optimized code to have bundles which contain
  3799. instructions from different source statements, thus it may happen that a
  3800. breakpoint's address will be adjusted from one source statement to
  3801. another. Since this adjustment may significantly alter GDB's breakpoint
  3802. related behavior from what the user expects, a warning is printed when
  3803. the breakpoint is first set and also when the breakpoint is hit.
  3804. A warning like the one below is printed when setting a breakpoint
  3805. that's been subject to address adjustment:
  3806. warning: Breakpoint address adjusted from 0x00010414 to 0x00010410.
  3807. Such warnings are printed both for user settable and GDB's internal
  3808. breakpoints. If you see one of these warnings, you should verify that a
  3809. breakpoint set at the adjusted address will have the desired affect. If
  3810. not, the breakpoint in question may be removed and other breakpoints may
  3811. be set which will have the desired behavior. E.g., it may be sufficient
  3812. to place the breakpoint at a later instruction. A conditional
  3813. breakpoint may also be useful in some cases to prevent the breakpoint
  3814. from triggering too often.
  3815. GDB will also issue a warning when stopping at one of these adjusted
  3816. breakpoints:
  3817. warning: Breakpoint 1 address previously adjusted from 0x00010414
  3818. to 0x00010410.
  3819. When this warning is encountered, it may be too late to take remedial
  3820. action except in cases where the breakpoint is hit earlier or more
  3821. frequently than expected.
  3822. 
  3823. File: gdb.info, Node: Continuing and Stepping, Next: Skipping Over Functions and Files, Prev: Breakpoints, Up: Stopping
  3824. 5.2 Continuing and Stepping
  3825. ===========================
  3826. "Continuing" means resuming program execution until your program
  3827. completes normally. In contrast, "stepping" means executing just one
  3828. more "step" of your program, where "step" may mean either one line of
  3829. source code, or one machine instruction (depending on what particular
  3830. command you use). Either when continuing or when stepping, your program
  3831. may stop even sooner, due to a breakpoint or a signal. (If it stops due
  3832. to a signal, you may want to use 'handle', or use 'signal 0' to resume
  3833. execution (*note Signals: Signals.), or you may step into the signal's
  3834. handler (*note stepping and signal handlers::).)
  3835. 'continue [IGNORE-COUNT]'
  3836. 'c [IGNORE-COUNT]'
  3837. 'fg [IGNORE-COUNT]'
  3838. Resume program execution, at the address where your program last
  3839. stopped; any breakpoints set at that address are bypassed. The
  3840. optional argument IGNORE-COUNT allows you to specify a further
  3841. number of times to ignore a breakpoint at this location; its effect
  3842. is like that of 'ignore' (*note Break Conditions: Conditions.).
  3843. The argument IGNORE-COUNT is meaningful only when your program
  3844. stopped due to a breakpoint. At other times, the argument to
  3845. 'continue' is ignored.
  3846. The synonyms 'c' and 'fg' (for "foreground", as the debugged
  3847. program is deemed to be the foreground program) are provided purely
  3848. for convenience, and have exactly the same behavior as 'continue'.
  3849. To resume execution at a different place, you can use 'return' (*note
  3850. Returning from a Function: Returning.) to go back to the calling
  3851. function; or 'jump' (*note Continuing at a Different Address: Jumping.)
  3852. to go to an arbitrary location in your program.
  3853. A typical technique for using stepping is to set a breakpoint (*note
  3854. Breakpoints; Watchpoints; and Catchpoints: Breakpoints.) at the
  3855. beginning of the function or the section of your program where a problem
  3856. is believed to lie, run your program until it stops at that breakpoint,
  3857. and then step through the suspect area, examining the variables that are
  3858. interesting, until you see the problem happen.
  3859. 'step'
  3860. Continue running your program until control reaches a different
  3861. source line, then stop it and return control to GDB. This command
  3862. is abbreviated 's'.
  3863. _Warning:_ If you use the 'step' command while control is
  3864. within a function that was compiled without debugging
  3865. information, execution proceeds until control reaches a
  3866. function that does have debugging information. Likewise, it
  3867. will not step into a function which is compiled without
  3868. debugging information. To step through functions without
  3869. debugging information, use the 'stepi' command, described
  3870. below.
  3871. The 'step' command only stops at the first instruction of a source
  3872. line. This prevents the multiple stops that could otherwise occur
  3873. in 'switch' statements, 'for' loops, etc. 'step' continues to stop
  3874. if a function that has debugging information is called within the
  3875. line. In other words, 'step' _steps inside_ any functions called
  3876. within the line.
  3877. Also, the 'step' command only enters a function if there is line
  3878. number information for the function. Otherwise it acts like the
  3879. 'next' command. This avoids problems when using 'cc -gl' on MIPS
  3880. machines. Previously, 'step' entered subroutines if there was any
  3881. debugging information about the routine.
  3882. 'step COUNT'
  3883. Continue running as in 'step', but do so COUNT times. If a
  3884. breakpoint is reached, or a signal not related to stepping occurs
  3885. before COUNT steps, stepping stops right away.
  3886. 'next [COUNT]'
  3887. Continue to the next source line in the current (innermost) stack
  3888. frame. This is similar to 'step', but function calls that appear
  3889. within the line of code are executed without stopping. Execution
  3890. stops when control reaches a different line of code at the original
  3891. stack level that was executing when you gave the 'next' command.
  3892. This command is abbreviated 'n'.
  3893. An argument COUNT is a repeat count, as for 'step'.
  3894. The 'next' command only stops at the first instruction of a source
  3895. line. This prevents multiple stops that could otherwise occur in
  3896. 'switch' statements, 'for' loops, etc.
  3897. 'set step-mode'
  3898. 'set step-mode on'
  3899. The 'set step-mode on' command causes the 'step' command to stop at
  3900. the first instruction of a function which contains no debug line
  3901. information rather than stepping over it.
  3902. This is useful in cases where you may be interested in inspecting
  3903. the machine instructions of a function which has no symbolic info
  3904. and do not want GDB to automatically skip over this function.
  3905. 'set step-mode off'
  3906. Causes the 'step' command to step over any functions which contains
  3907. no debug information. This is the default.
  3908. 'show step-mode'
  3909. Show whether GDB will stop in or step over functions without source
  3910. line debug information.
  3911. 'finish'
  3912. Continue running until just after function in the selected stack
  3913. frame returns. Print the returned value (if any). This command
  3914. can be abbreviated as 'fin'.
  3915. Contrast this with the 'return' command (*note Returning from a
  3916. Function: Returning.).
  3917. 'set print finish [on|off]'
  3918. 'show print finish'
  3919. By default the 'finish' command will show the value that is
  3920. returned by the function. This can be disabled using 'set print
  3921. finish off'. When disabled, the value is still entered into the
  3922. value history (*note Value History::), but not displayed.
  3923. 'until'
  3924. 'u'
  3925. Continue running until a source line past the current line, in the
  3926. current stack frame, is reached. This command is used to avoid
  3927. single stepping through a loop more than once. It is like the
  3928. 'next' command, except that when 'until' encounters a jump, it
  3929. automatically continues execution until the program counter is
  3930. greater than the address of the jump.
  3931. This means that when you reach the end of a loop after single
  3932. stepping though it, 'until' makes your program continue execution
  3933. until it exits the loop. In contrast, a 'next' command at the end
  3934. of a loop simply steps back to the beginning of the loop, which
  3935. forces you to step through the next iteration.
  3936. 'until' always stops your program if it attempts to exit the
  3937. current stack frame.
  3938. 'until' may produce somewhat counterintuitive results if the order
  3939. of machine code does not match the order of the source lines. For
  3940. example, in the following excerpt from a debugging session, the 'f'
  3941. ('frame') command shows that execution is stopped at line '206';
  3942. yet when we use 'until', we get to line '195':
  3943. (gdb) f
  3944. #0 main (argc=4, argv=0xf7fffae8) at m4.c:206
  3945. 206 expand_input();
  3946. (gdb) until
  3947. 195 for ( ; argc > 0; NEXTARG) {
  3948. This happened because, for execution efficiency, the compiler had
  3949. generated code for the loop closure test at the end, rather than
  3950. the start, of the loop--even though the test in a C 'for'-loop is
  3951. written before the body of the loop. The 'until' command appeared
  3952. to step back to the beginning of the loop when it advanced to this
  3953. expression; however, it has not really gone to an earlier
  3954. statement--not in terms of the actual machine code.
  3955. 'until' with no argument works by means of single instruction
  3956. stepping, and hence is slower than 'until' with an argument.
  3957. 'until LOCATION'
  3958. 'u LOCATION'
  3959. Continue running your program until either the specified LOCATION
  3960. is reached, or the current stack frame returns. The location is
  3961. any of the forms described in *note Specify Location::. This form
  3962. of the command uses temporary breakpoints, and hence is quicker
  3963. than 'until' without an argument. The specified location is
  3964. actually reached only if it is in the current frame. This implies
  3965. that 'until' can be used to skip over recursive function
  3966. invocations. For instance in the code below, if the current
  3967. location is line '96', issuing 'until 99' will execute the program
  3968. up to line '99' in the same invocation of factorial, i.e., after
  3969. the inner invocations have returned.
  3970. 94 int factorial (int value)
  3971. 95 {
  3972. 96 if (value > 1) {
  3973. 97 value *= factorial (value - 1);
  3974. 98 }
  3975. 99 return (value);
  3976. 100 }
  3977. 'advance LOCATION'
  3978. Continue running the program up to the given LOCATION. An argument
  3979. is required, which should be of one of the forms described in *note
  3980. Specify Location::. Execution will also stop upon exit from the
  3981. current stack frame. This command is similar to 'until', but
  3982. 'advance' will not skip over recursive function calls, and the
  3983. target location doesn't have to be in the same frame as the current
  3984. one.
  3985. 'stepi'
  3986. 'stepi ARG'
  3987. 'si'
  3988. Execute one machine instruction, then stop and return to the
  3989. debugger.
  3990. It is often useful to do 'display/i $pc' when stepping by machine
  3991. instructions. This makes GDB automatically display the next
  3992. instruction to be executed, each time your program stops. *Note
  3993. Automatic Display: Auto Display.
  3994. An argument is a repeat count, as in 'step'.
  3995. 'nexti'
  3996. 'nexti ARG'
  3997. 'ni'
  3998. Execute one machine instruction, but if it is a function call,
  3999. proceed until the function returns.
  4000. An argument is a repeat count, as in 'next'.
  4001. By default, and if available, GDB makes use of target-assisted "range
  4002. stepping". In other words, whenever you use a stepping command (e.g.,
  4003. 'step', 'next'), GDB tells the target to step the corresponding range of
  4004. instruction addresses instead of issuing multiple single-steps. This
  4005. speeds up line stepping, particularly for remote targets. Ideally,
  4006. there should be no reason you would want to turn range stepping off.
  4007. However, it's possible that a bug in the debug info, a bug in the remote
  4008. stub (for remote targets), or even a bug in GDB could make line stepping
  4009. behave incorrectly when target-assisted range stepping is enabled. You
  4010. can use the following command to turn off range stepping if necessary:
  4011. 'set range-stepping'
  4012. 'show range-stepping'
  4013. Control whether range stepping is enabled.
  4014. If 'on', and the target supports it, GDB tells the target to step a
  4015. range of addresses itself, instead of issuing multiple
  4016. single-steps. If 'off', GDB always issues single-steps, even if
  4017. range stepping is supported by the target. The default is 'on'.
  4018. 
  4019. File: gdb.info, Node: Skipping Over Functions and Files, Next: Signals, Prev: Continuing and Stepping, Up: Stopping
  4020. 5.3 Skipping Over Functions and Files
  4021. =====================================
  4022. The program you are debugging may contain some functions which are
  4023. uninteresting to debug. The 'skip' command lets you tell GDB to skip a
  4024. function, all functions in a file or a particular function in a
  4025. particular file when stepping.
  4026. For example, consider the following C function:
  4027. 101 int func()
  4028. 102 {
  4029. 103 foo(boring());
  4030. 104 bar(boring());
  4031. 105 }
  4032. Suppose you wish to step into the functions 'foo' and 'bar', but you are
  4033. not interested in stepping through 'boring'. If you run 'step' at line
  4034. 103, you'll enter 'boring()', but if you run 'next', you'll step over
  4035. both 'foo' and 'boring'!
  4036. One solution is to 'step' into 'boring' and use the 'finish' command
  4037. to immediately exit it. But this can become tedious if 'boring' is
  4038. called from many places.
  4039. A more flexible solution is to execute 'skip boring'. This instructs
  4040. GDB never to step into 'boring'. Now when you execute 'step' at line
  4041. 103, you'll step over 'boring' and directly into 'foo'.
  4042. Functions may be skipped by providing either a function name,
  4043. linespec (*note Specify Location::), regular expression that matches the
  4044. function's name, file name or a 'glob'-style pattern that matches the
  4045. file name.
  4046. On Posix systems the form of the regular expression is "Extended
  4047. Regular Expressions". See for example 'man 7 regex' on GNU/Linux
  4048. systems. On non-Posix systems the form of the regular expression is
  4049. whatever is provided by the 'regcomp' function of the underlying system.
  4050. See for example 'man 7 glob' on GNU/Linux systems for a description of
  4051. 'glob'-style patterns.
  4052. 'skip [OPTIONS]'
  4053. The basic form of the 'skip' command takes zero or more options
  4054. that specify what to skip. The OPTIONS argument is any useful
  4055. combination of the following:
  4056. '-file FILE'
  4057. '-fi FILE'
  4058. Functions in FILE will be skipped over when stepping.
  4059. '-gfile FILE-GLOB-PATTERN'
  4060. '-gfi FILE-GLOB-PATTERN'
  4061. Functions in files matching FILE-GLOB-PATTERN will be skipped
  4062. over when stepping.
  4063. (gdb) skip -gfi utils/*.c
  4064. '-function LINESPEC'
  4065. '-fu LINESPEC'
  4066. Functions named by LINESPEC or the function containing the
  4067. line named by LINESPEC will be skipped over when stepping.
  4068. *Note Specify Location::.
  4069. '-rfunction REGEXP'
  4070. '-rfu REGEXP'
  4071. Functions whose name matches REGEXP will be skipped over when
  4072. stepping.
  4073. This form is useful for complex function names. For example,
  4074. there is generally no need to step into C++ 'std::string'
  4075. constructors or destructors. Plus with C++ templates it can
  4076. be hard to write out the full name of the function, and often
  4077. it doesn't matter what the template arguments are. Specifying
  4078. the function to be skipped as a regular expression makes this
  4079. easier.
  4080. (gdb) skip -rfu ^std::(allocator|basic_string)<.*>::~?\1 *\(
  4081. If you want to skip every templated C++ constructor and
  4082. destructor in the 'std' namespace you can do:
  4083. (gdb) skip -rfu ^std::([a-zA-z0-9_]+)<.*>::~?\1 *\(
  4084. If no options are specified, the function you're currently
  4085. debugging will be skipped.
  4086. 'skip function [LINESPEC]'
  4087. After running this command, the function named by LINESPEC or the
  4088. function containing the line named by LINESPEC will be skipped over
  4089. when stepping. *Note Specify Location::.
  4090. If you do not specify LINESPEC, the function you're currently
  4091. debugging will be skipped.
  4092. (If you have a function called 'file' that you want to skip, use
  4093. 'skip function file'.)
  4094. 'skip file [FILENAME]'
  4095. After running this command, any function whose source lives in
  4096. FILENAME will be skipped over when stepping.
  4097. (gdb) skip file boring.c
  4098. File boring.c will be skipped when stepping.
  4099. If you do not specify FILENAME, functions whose source lives in the
  4100. file you're currently debugging will be skipped.
  4101. Skips can be listed, deleted, disabled, and enabled, much like
  4102. breakpoints. These are the commands for managing your list of skips:
  4103. 'info skip [RANGE]'
  4104. Print details about the specified skip(s). If RANGE is not
  4105. specified, print a table with details about all functions and files
  4106. marked for skipping. 'info skip' prints the following information
  4107. about each skip:
  4108. _Identifier_
  4109. A number identifying this skip.
  4110. _Enabled or Disabled_
  4111. Enabled skips are marked with 'y'. Disabled skips are marked
  4112. with 'n'.
  4113. _Glob_
  4114. If the file name is a 'glob' pattern this is 'y'. Otherwise
  4115. it is 'n'.
  4116. _File_
  4117. The name or 'glob' pattern of the file to be skipped. If no
  4118. file is specified this is '<none>'.
  4119. _RE_
  4120. If the function name is a 'regular expression' this is 'y'.
  4121. Otherwise it is 'n'.
  4122. _Function_
  4123. The name or regular expression of the function to skip. If no
  4124. function is specified this is '<none>'.
  4125. 'skip delete [RANGE]'
  4126. Delete the specified skip(s). If RANGE is not specified, delete
  4127. all skips.
  4128. 'skip enable [RANGE]'
  4129. Enable the specified skip(s). If RANGE is not specified, enable
  4130. all skips.
  4131. 'skip disable [RANGE]'
  4132. Disable the specified skip(s). If RANGE is not specified, disable
  4133. all skips.
  4134. 'set debug skip [on|off]'
  4135. Set whether to print the debug output about skipping files and
  4136. functions.
  4137. 'show debug skip'
  4138. Show whether the debug output about skipping files and functions is
  4139. printed.
  4140. 
  4141. File: gdb.info, Node: Signals, Next: Thread Stops, Prev: Skipping Over Functions and Files, Up: Stopping
  4142. 5.4 Signals
  4143. ===========
  4144. A signal is an asynchronous event that can happen in a program. The
  4145. operating system defines the possible kinds of signals, and gives each
  4146. kind a name and a number. For example, in Unix 'SIGINT' is the signal a
  4147. program gets when you type an interrupt character (often 'Ctrl-c');
  4148. 'SIGSEGV' is the signal a program gets from referencing a place in
  4149. memory far away from all the areas in use; 'SIGALRM' occurs when the
  4150. alarm clock timer goes off (which happens only if your program has
  4151. requested an alarm).
  4152. Some signals, including 'SIGALRM', are a normal part of the
  4153. functioning of your program. Others, such as 'SIGSEGV', indicate
  4154. errors; these signals are "fatal" (they kill your program immediately)
  4155. if the program has not specified in advance some other way to handle the
  4156. signal. 'SIGINT' does not indicate an error in your program, but it is
  4157. normally fatal so it can carry out the purpose of the interrupt: to kill
  4158. the program.
  4159. GDB has the ability to detect any occurrence of a signal in your
  4160. program. You can tell GDB in advance what to do for each kind of
  4161. signal.
  4162. Normally, GDB is set up to let the non-erroneous signals like
  4163. 'SIGALRM' be silently passed to your program (so as not to interfere
  4164. with their role in the program's functioning) but to stop your program
  4165. immediately whenever an error signal happens. You can change these
  4166. settings with the 'handle' command.
  4167. 'info signals'
  4168. 'info handle'
  4169. Print a table of all the kinds of signals and how GDB has been told
  4170. to handle each one. You can use this to see the signal numbers of
  4171. all the defined types of signals.
  4172. 'info signals SIG'
  4173. Similar, but print information only about the specified signal
  4174. number.
  4175. 'info handle' is an alias for 'info signals'.
  4176. 'catch signal [SIGNAL... | 'all']'
  4177. Set a catchpoint for the indicated signals. *Note Set
  4178. Catchpoints::, for details about this command.
  4179. 'handle SIGNAL [KEYWORDS...]'
  4180. Change the way GDB handles signal SIGNAL. The SIGNAL can be the
  4181. number of a signal or its name (with or without the 'SIG' at the
  4182. beginning); a list of signal numbers of the form 'LOW-HIGH'; or the
  4183. word 'all', meaning all the known signals. Optional arguments
  4184. KEYWORDS, described below, say what change to make.
  4185. The keywords allowed by the 'handle' command can be abbreviated.
  4186. Their full names are:
  4187. 'nostop'
  4188. GDB should not stop your program when this signal happens. It may
  4189. still print a message telling you that the signal has come in.
  4190. 'stop'
  4191. GDB should stop your program when this signal happens. This
  4192. implies the 'print' keyword as well.
  4193. 'print'
  4194. GDB should print a message when this signal happens.
  4195. 'noprint'
  4196. GDB should not mention the occurrence of the signal at all. This
  4197. implies the 'nostop' keyword as well.
  4198. 'pass'
  4199. 'noignore'
  4200. GDB should allow your program to see this signal; your program can
  4201. handle the signal, or else it may terminate if the signal is fatal
  4202. and not handled. 'pass' and 'noignore' are synonyms.
  4203. 'nopass'
  4204. 'ignore'
  4205. GDB should not allow your program to see this signal. 'nopass' and
  4206. 'ignore' are synonyms.
  4207. When a signal stops your program, the signal is not visible to the
  4208. program until you continue. Your program sees the signal then, if
  4209. 'pass' is in effect for the signal in question _at that time_. In other
  4210. words, after GDB reports a signal, you can use the 'handle' command with
  4211. 'pass' or 'nopass' to control whether your program sees that signal when
  4212. you continue.
  4213. The default is set to 'nostop', 'noprint', 'pass' for non-erroneous
  4214. signals such as 'SIGALRM', 'SIGWINCH' and 'SIGCHLD', and to 'stop',
  4215. 'print', 'pass' for the erroneous signals.
  4216. You can also use the 'signal' command to prevent your program from
  4217. seeing a signal, or cause it to see a signal it normally would not see,
  4218. or to give it any signal at any time. For example, if your program
  4219. stopped due to some sort of memory reference error, you might store
  4220. correct values into the erroneous variables and continue, hoping to see
  4221. more execution; but your program would probably terminate immediately as
  4222. a result of the fatal signal once it saw the signal. To prevent this,
  4223. you can continue with 'signal 0'. *Note Giving your Program a Signal:
  4224. Signaling.
  4225. GDB optimizes for stepping the mainline code. If a signal that has
  4226. 'handle nostop' and 'handle pass' set arrives while a stepping command
  4227. (e.g., 'stepi', 'step', 'next') is in progress, GDB lets the signal
  4228. handler run and then resumes stepping the mainline code once the signal
  4229. handler returns. In other words, GDB steps over the signal handler.
  4230. This prevents signals that you've specified as not interesting (with
  4231. 'handle nostop') from changing the focus of debugging unexpectedly.
  4232. Note that the signal handler itself may still hit a breakpoint, stop for
  4233. another signal that has 'handle stop' in effect, or for any other event
  4234. that normally results in stopping the stepping command sooner. Also
  4235. note that GDB still informs you that the program received a signal if
  4236. 'handle print' is set.
  4237. If you set 'handle pass' for a signal, and your program sets up a
  4238. handler for it, then issuing a stepping command, such as 'step' or
  4239. 'stepi', when your program is stopped due to the signal will step _into_
  4240. the signal handler (if the target supports that).
  4241. Likewise, if you use the 'queue-signal' command to queue a signal to
  4242. be delivered to the current thread when execution of the thread resumes
  4243. (*note Giving your Program a Signal: Signaling.), then a stepping
  4244. command will step into the signal handler.
  4245. Here's an example, using 'stepi' to step to the first instruction of
  4246. 'SIGUSR1''s handler:
  4247. (gdb) handle SIGUSR1
  4248. Signal Stop Print Pass to program Description
  4249. SIGUSR1 Yes Yes Yes User defined signal 1
  4250. (gdb) c
  4251. Continuing.
  4252. Program received signal SIGUSR1, User defined signal 1.
  4253. main () sigusr1.c:28
  4254. 28 p = 0;
  4255. (gdb) si
  4256. sigusr1_handler () at sigusr1.c:9
  4257. 9 {
  4258. The same, but using 'queue-signal' instead of waiting for the program
  4259. to receive the signal first:
  4260. (gdb) n
  4261. 28 p = 0;
  4262. (gdb) queue-signal SIGUSR1
  4263. (gdb) si
  4264. sigusr1_handler () at sigusr1.c:9
  4265. 9 {
  4266. (gdb)
  4267. On some targets, GDB can inspect extra signal information associated
  4268. with the intercepted signal, before it is actually delivered to the
  4269. program being debugged. This information is exported by the convenience
  4270. variable '$_siginfo', and consists of data that is passed by the kernel
  4271. to the signal handler at the time of the receipt of a signal. The data
  4272. type of the information itself is target dependent. You can see the
  4273. data type using the 'ptype $_siginfo' command. On Unix systems, it
  4274. typically corresponds to the standard 'siginfo_t' type, as defined in
  4275. the 'signal.h' system header.
  4276. Here's an example, on a GNU/Linux system, printing the stray
  4277. referenced address that raised a segmentation fault.
  4278. (gdb) continue
  4279. Program received signal SIGSEGV, Segmentation fault.
  4280. 0x0000000000400766 in main ()
  4281. 69 *(int *)p = 0;
  4282. (gdb) ptype $_siginfo
  4283. type = struct {
  4284. int si_signo;
  4285. int si_errno;
  4286. int si_code;
  4287. union {
  4288. int _pad[28];
  4289. struct {...} _kill;
  4290. struct {...} _timer;
  4291. struct {...} _rt;
  4292. struct {...} _sigchld;
  4293. struct {...} _sigfault;
  4294. struct {...} _sigpoll;
  4295. } _sifields;
  4296. }
  4297. (gdb) ptype $_siginfo._sifields._sigfault
  4298. type = struct {
  4299. void *si_addr;
  4300. }
  4301. (gdb) p $_siginfo._sifields._sigfault.si_addr
  4302. $1 = (void *) 0x7ffff7ff7000
  4303. Depending on target support, '$_siginfo' may also be writable.
  4304. On some targets, a 'SIGSEGV' can be caused by a boundary violation,
  4305. i.e., accessing an address outside of the allowed range. In those cases
  4306. GDB may displays additional information, depending on how GDB has been
  4307. told to handle the signal. With 'handle stop SIGSEGV', GDB displays the
  4308. violation kind: "Upper" or "Lower", the memory address accessed and the
  4309. bounds, while with 'handle nostop SIGSEGV' no additional information is
  4310. displayed.
  4311. The usual output of a segfault is:
  4312. Program received signal SIGSEGV, Segmentation fault
  4313. 0x0000000000400d7c in upper () at i386-mpx-sigsegv.c:68
  4314. 68 value = *(p + len);
  4315. While a bound violation is presented as:
  4316. Program received signal SIGSEGV, Segmentation fault
  4317. Upper bound violation while accessing address 0x7fffffffc3b3
  4318. Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
  4319. 0x0000000000400d7c in upper () at i386-mpx-sigsegv.c:68
  4320. 68 value = *(p + len);
  4321. 
  4322. File: gdb.info, Node: Thread Stops, Prev: Signals, Up: Stopping
  4323. 5.5 Stopping and Starting Multi-thread Programs
  4324. ===============================================
  4325. GDB supports debugging programs with multiple threads (*note Debugging
  4326. Programs with Multiple Threads: Threads.). There are two modes of
  4327. controlling execution of your program within the debugger. In the
  4328. default mode, referred to as "all-stop mode", when any thread in your
  4329. program stops (for example, at a breakpoint or while being stepped), all
  4330. other threads in the program are also stopped by GDB. On some targets,
  4331. GDB also supports "non-stop mode", in which other threads can continue
  4332. to run freely while you examine the stopped thread in the debugger.
  4333. * Menu:
  4334. * All-Stop Mode:: All threads stop when GDB takes control
  4335. * Non-Stop Mode:: Other threads continue to execute
  4336. * Background Execution:: Running your program asynchronously
  4337. * Thread-Specific Breakpoints:: Controlling breakpoints
  4338. * Interrupted System Calls:: GDB may interfere with system calls
  4339. * Observer Mode:: GDB does not alter program behavior
  4340. 
  4341. File: gdb.info, Node: All-Stop Mode, Next: Non-Stop Mode, Up: Thread Stops
  4342. 5.5.1 All-Stop Mode
  4343. -------------------
  4344. In all-stop mode, whenever your program stops under GDB for any reason,
  4345. _all_ threads of execution stop, not just the current thread. This
  4346. allows you to examine the overall state of the program, including
  4347. switching between threads, without worrying that things may change
  4348. underfoot.
  4349. Conversely, whenever you restart the program, _all_ threads start
  4350. executing. _This is true even when single-stepping_ with commands like
  4351. 'step' or 'next'.
  4352. In particular, GDB cannot single-step all threads in lockstep. Since
  4353. thread scheduling is up to your debugging target's operating system (not
  4354. controlled by GDB), other threads may execute more than one statement
  4355. while the current thread completes a single step. Moreover, in general
  4356. other threads stop in the middle of a statement, rather than at a clean
  4357. statement boundary, when the program stops.
  4358. You might even find your program stopped in another thread after
  4359. continuing or even single-stepping. This happens whenever some other
  4360. thread runs into a breakpoint, a signal, or an exception before the
  4361. first thread completes whatever you requested.
  4362. Whenever GDB stops your program, due to a breakpoint or a signal, it
  4363. automatically selects the thread where that breakpoint or signal
  4364. happened. GDB alerts you to the context switch with a message such as
  4365. '[Switching to Thread N]' to identify the thread.
  4366. On some OSes, you can modify GDB's default behavior by locking the OS
  4367. scheduler to allow only a single thread to run.
  4368. 'set scheduler-locking MODE'
  4369. Set the scheduler locking mode. It applies to normal execution,
  4370. record mode, and replay mode. If it is 'off', then there is no
  4371. locking and any thread may run at any time. If 'on', then only the
  4372. current thread may run when the inferior is resumed. The 'step'
  4373. mode optimizes for single-stepping; it prevents other threads from
  4374. preempting the current thread while you are stepping, so that the
  4375. focus of debugging does not change unexpectedly. Other threads
  4376. never get a chance to run when you step, and they are completely
  4377. free to run when you use commands like 'continue', 'until', or
  4378. 'finish'. However, unless another thread hits a breakpoint during
  4379. its timeslice, GDB does not change the current thread away from the
  4380. thread that you are debugging. The 'replay' mode behaves like
  4381. 'off' in record mode and like 'on' in replay mode.
  4382. 'show scheduler-locking'
  4383. Display the current scheduler locking mode.
  4384. By default, when you issue one of the execution commands such as
  4385. 'continue', 'next' or 'step', GDB allows only threads of the current
  4386. inferior to run. For example, if GDB is attached to two inferiors, each
  4387. with two threads, the 'continue' command resumes only the two threads of
  4388. the current inferior. This is useful, for example, when you debug a
  4389. program that forks and you want to hold the parent stopped (so that, for
  4390. instance, it doesn't run to exit), while you debug the child. In other
  4391. situations, you may not be interested in inspecting the current state of
  4392. any of the processes GDB is attached to, and you may want to resume them
  4393. all until some breakpoint is hit. In the latter case, you can instruct
  4394. GDB to allow all threads of all the inferiors to run with the
  4395. 'set schedule-multiple' command.
  4396. 'set schedule-multiple'
  4397. Set the mode for allowing threads of multiple processes to be
  4398. resumed when an execution command is issued. When 'on', all
  4399. threads of all processes are allowed to run. When 'off', only the
  4400. threads of the current process are resumed. The default is 'off'.
  4401. The 'scheduler-locking' mode takes precedence when set to 'on', or
  4402. while you are stepping and set to 'step'.
  4403. 'show schedule-multiple'
  4404. Display the current mode for resuming the execution of threads of
  4405. multiple processes.
  4406. 
  4407. File: gdb.info, Node: Non-Stop Mode, Next: Background Execution, Prev: All-Stop Mode, Up: Thread Stops
  4408. 5.5.2 Non-Stop Mode
  4409. -------------------
  4410. For some multi-threaded targets, GDB supports an optional mode of
  4411. operation in which you can examine stopped program threads in the
  4412. debugger while other threads continue to execute freely. This minimizes
  4413. intrusion when debugging live systems, such as programs where some
  4414. threads have real-time constraints or must continue to respond to
  4415. external events. This is referred to as "non-stop" mode.
  4416. In non-stop mode, when a thread stops to report a debugging event,
  4417. _only_ that thread is stopped; GDB does not stop other threads as well,
  4418. in contrast to the all-stop mode behavior. Additionally, execution
  4419. commands such as 'continue' and 'step' apply by default only to the
  4420. current thread in non-stop mode, rather than all threads as in all-stop
  4421. mode. This allows you to control threads explicitly in ways that are
  4422. not possible in all-stop mode -- for example, stepping one thread while
  4423. allowing others to run freely, stepping one thread while holding all
  4424. others stopped, or stepping several threads independently and
  4425. simultaneously.
  4426. To enter non-stop mode, use this sequence of commands before you run
  4427. or attach to your program:
  4428. # If using the CLI, pagination breaks non-stop.
  4429. set pagination off
  4430. # Finally, turn it on!
  4431. set non-stop on
  4432. You can use these commands to manipulate the non-stop mode setting:
  4433. 'set non-stop on'
  4434. Enable selection of non-stop mode.
  4435. 'set non-stop off'
  4436. Disable selection of non-stop mode.
  4437. 'show non-stop'
  4438. Show the current non-stop enablement setting.
  4439. Note these commands only reflect whether non-stop mode is enabled,
  4440. not whether the currently-executing program is being run in non-stop
  4441. mode. In particular, the 'set non-stop' preference is only consulted
  4442. when GDB starts or connects to the target program, and it is generally
  4443. not possible to switch modes once debugging has started. Furthermore,
  4444. since not all targets support non-stop mode, even when you have enabled
  4445. non-stop mode, GDB may still fall back to all-stop operation by default.
  4446. In non-stop mode, all execution commands apply only to the current
  4447. thread by default. That is, 'continue' only continues one thread. To
  4448. continue all threads, issue 'continue -a' or 'c -a'.
  4449. You can use GDB's background execution commands (*note Background
  4450. Execution::) to run some threads in the background while you continue to
  4451. examine or step others from GDB. The MI execution commands (*note
  4452. GDB/MI Program Execution::) are always executed asynchronously in
  4453. non-stop mode.
  4454. Suspending execution is done with the 'interrupt' command when
  4455. running in the background, or 'Ctrl-c' during foreground execution. In
  4456. all-stop mode, this stops the whole process; but in non-stop mode the
  4457. interrupt applies only to the current thread. To stop the whole
  4458. program, use 'interrupt -a'.
  4459. Other execution commands do not currently support the '-a' option.
  4460. In non-stop mode, when a thread stops, GDB doesn't automatically make
  4461. that thread current, as it does in all-stop mode. This is because the
  4462. thread stop notifications are asynchronous with respect to GDB's command
  4463. interpreter, and it would be confusing if GDB unexpectedly changed to a
  4464. different thread just as you entered a command to operate on the
  4465. previously current thread.
  4466. 
  4467. File: gdb.info, Node: Background Execution, Next: Thread-Specific Breakpoints, Prev: Non-Stop Mode, Up: Thread Stops
  4468. 5.5.3 Background Execution
  4469. --------------------------
  4470. GDB's execution commands have two variants: the normal foreground
  4471. (synchronous) behavior, and a background (asynchronous) behavior. In
  4472. foreground execution, GDB waits for the program to report that some
  4473. thread has stopped before prompting for another command. In background
  4474. execution, GDB immediately gives a command prompt so that you can issue
  4475. other commands while your program runs.
  4476. If the target doesn't support async mode, GDB issues an error message
  4477. if you attempt to use the background execution commands.
  4478. To specify background execution, add a '&' to the command. For
  4479. example, the background form of the 'continue' command is 'continue&',
  4480. or just 'c&'. The execution commands that accept background execution
  4481. are:
  4482. 'run'
  4483. *Note Starting your Program: Starting.
  4484. 'attach'
  4485. *Note Debugging an Already-running Process: Attach.
  4486. 'step'
  4487. *Note step: Continuing and Stepping.
  4488. 'stepi'
  4489. *Note stepi: Continuing and Stepping.
  4490. 'next'
  4491. *Note next: Continuing and Stepping.
  4492. 'nexti'
  4493. *Note nexti: Continuing and Stepping.
  4494. 'continue'
  4495. *Note continue: Continuing and Stepping.
  4496. 'finish'
  4497. *Note finish: Continuing and Stepping.
  4498. 'until'
  4499. *Note until: Continuing and Stepping.
  4500. Background execution is especially useful in conjunction with
  4501. non-stop mode for debugging programs with multiple threads; see *note
  4502. Non-Stop Mode::. However, you can also use these commands in the normal
  4503. all-stop mode with the restriction that you cannot issue another
  4504. execution command until the previous one finishes. Examples of commands
  4505. that are valid in all-stop mode while the program is running include
  4506. 'help' and 'info break'.
  4507. You can interrupt your program while it is running in the background
  4508. by using the 'interrupt' command.
  4509. 'interrupt'
  4510. 'interrupt -a'
  4511. Suspend execution of the running program. In all-stop mode,
  4512. 'interrupt' stops the whole process, but in non-stop mode, it stops
  4513. only the current thread. To stop the whole program in non-stop
  4514. mode, use 'interrupt -a'.
  4515. 
  4516. File: gdb.info, Node: Thread-Specific Breakpoints, Next: Interrupted System Calls, Prev: Background Execution, Up: Thread Stops
  4517. 5.5.4 Thread-Specific Breakpoints
  4518. ---------------------------------
  4519. When your program has multiple threads (*note Debugging Programs with
  4520. Multiple Threads: Threads.), you can choose whether to set breakpoints
  4521. on all threads, or on a particular thread.
  4522. 'break LOCATION thread THREAD-ID'
  4523. 'break LOCATION thread THREAD-ID if ...'
  4524. LOCATION specifies source lines; there are several ways of writing
  4525. them (*note Specify Location::), but the effect is always to
  4526. specify some source line.
  4527. Use the qualifier 'thread THREAD-ID' with a breakpoint command to
  4528. specify that you only want GDB to stop the program when a
  4529. particular thread reaches this breakpoint. The THREAD-ID specifier
  4530. is one of the thread identifiers assigned by GDB, shown in the
  4531. first column of the 'info threads' display.
  4532. If you do not specify 'thread THREAD-ID' when you set a breakpoint,
  4533. the breakpoint applies to _all_ threads of your program.
  4534. You can use the 'thread' qualifier on conditional breakpoints as
  4535. well; in this case, place 'thread THREAD-ID' before or after the
  4536. breakpoint condition, like this:
  4537. (gdb) break frik.c:13 thread 28 if bartab > lim
  4538. Thread-specific breakpoints are automatically deleted when GDB
  4539. detects the corresponding thread is no longer in the thread list. For
  4540. example:
  4541. (gdb) c
  4542. Thread-specific breakpoint 3 deleted - thread 28 no longer in the thread list.
  4543. There are several ways for a thread to disappear, such as a regular
  4544. thread exit, but also when you detach from the process with the 'detach'
  4545. command (*note Debugging an Already-running Process: Attach.), or if GDB
  4546. loses the remote connection (*note Remote Debugging::), etc. Note that
  4547. with some targets, GDB is only able to detect a thread has exited when
  4548. the user explictly asks for the thread list with the 'info threads'
  4549. command.
  4550. 
  4551. File: gdb.info, Node: Interrupted System Calls, Next: Observer Mode, Prev: Thread-Specific Breakpoints, Up: Thread Stops
  4552. 5.5.5 Interrupted System Calls
  4553. ------------------------------
  4554. There is an unfortunate side effect when using GDB to debug
  4555. multi-threaded programs. If one thread stops for a breakpoint, or for
  4556. some other reason, and another thread is blocked in a system call, then
  4557. the system call may return prematurely. This is a consequence of the
  4558. interaction between multiple threads and the signals that GDB uses to
  4559. implement breakpoints and other events that stop execution.
  4560. To handle this problem, your program should check the return value of
  4561. each system call and react appropriately. This is good programming
  4562. style anyways.
  4563. For example, do not write code like this:
  4564. sleep (10);
  4565. The call to 'sleep' will return early if a different thread stops at
  4566. a breakpoint or for some other reason.
  4567. Instead, write this:
  4568. int unslept = 10;
  4569. while (unslept > 0)
  4570. unslept = sleep (unslept);
  4571. A system call is allowed to return early, so the system is still
  4572. conforming to its specification. But GDB does cause your multi-threaded
  4573. program to behave differently than it would without GDB.
  4574. Also, GDB uses internal breakpoints in the thread library to monitor
  4575. certain events such as thread creation and thread destruction. When
  4576. such an event happens, a system call in another thread may return
  4577. prematurely, even though your program does not appear to stop.
  4578. 
  4579. File: gdb.info, Node: Observer Mode, Prev: Interrupted System Calls, Up: Thread Stops
  4580. 5.5.6 Observer Mode
  4581. -------------------
  4582. If you want to build on non-stop mode and observe program behavior
  4583. without any chance of disruption by GDB, you can set variables to
  4584. disable all of the debugger's attempts to modify state, whether by
  4585. writing memory, inserting breakpoints, etc. These operate at a low
  4586. level, intercepting operations from all commands.
  4587. When all of these are set to 'off', then GDB is said to be "observer
  4588. mode". As a convenience, the variable 'observer' can be set to disable
  4589. these, plus enable non-stop mode.
  4590. Note that GDB will not prevent you from making nonsensical
  4591. combinations of these settings. For instance, if you have enabled
  4592. 'may-insert-breakpoints' but disabled 'may-write-memory', then
  4593. breakpoints that work by writing trap instructions into the code stream
  4594. will still not be able to be placed.
  4595. 'set observer on'
  4596. 'set observer off'
  4597. When set to 'on', this disables all the permission variables below
  4598. (except for 'insert-fast-tracepoints'), plus enables non-stop
  4599. debugging. Setting this to 'off' switches back to normal
  4600. debugging, though remaining in non-stop mode.
  4601. 'show observer'
  4602. Show whether observer mode is on or off.
  4603. 'set may-write-registers on'
  4604. 'set may-write-registers off'
  4605. This controls whether GDB will attempt to alter the values of
  4606. registers, such as with assignment expressions in 'print', or the
  4607. 'jump' command. It defaults to 'on'.
  4608. 'show may-write-registers'
  4609. Show the current permission to write registers.
  4610. 'set may-write-memory on'
  4611. 'set may-write-memory off'
  4612. This controls whether GDB will attempt to alter the contents of
  4613. memory, such as with assignment expressions in 'print'. It
  4614. defaults to 'on'.
  4615. 'show may-write-memory'
  4616. Show the current permission to write memory.
  4617. 'set may-insert-breakpoints on'
  4618. 'set may-insert-breakpoints off'
  4619. This controls whether GDB will attempt to insert breakpoints. This
  4620. affects all breakpoints, including internal breakpoints defined by
  4621. GDB. It defaults to 'on'.
  4622. 'show may-insert-breakpoints'
  4623. Show the current permission to insert breakpoints.
  4624. 'set may-insert-tracepoints on'
  4625. 'set may-insert-tracepoints off'
  4626. This controls whether GDB will attempt to insert (regular)
  4627. tracepoints at the beginning of a tracing experiment. It affects
  4628. only non-fast tracepoints, fast tracepoints being under the control
  4629. of 'may-insert-fast-tracepoints'. It defaults to 'on'.
  4630. 'show may-insert-tracepoints'
  4631. Show the current permission to insert tracepoints.
  4632. 'set may-insert-fast-tracepoints on'
  4633. 'set may-insert-fast-tracepoints off'
  4634. This controls whether GDB will attempt to insert fast tracepoints
  4635. at the beginning of a tracing experiment. It affects only fast
  4636. tracepoints, regular (non-fast) tracepoints being under the control
  4637. of 'may-insert-tracepoints'. It defaults to 'on'.
  4638. 'show may-insert-fast-tracepoints'
  4639. Show the current permission to insert fast tracepoints.
  4640. 'set may-interrupt on'
  4641. 'set may-interrupt off'
  4642. This controls whether GDB will attempt to interrupt or stop program
  4643. execution. When this variable is 'off', the 'interrupt' command
  4644. will have no effect, nor will 'Ctrl-c'. It defaults to 'on'.
  4645. 'show may-interrupt'
  4646. Show the current permission to interrupt or stop the program.
  4647. 
  4648. File: gdb.info, Node: Reverse Execution, Next: Process Record and Replay, Prev: Stopping, Up: Top
  4649. 6 Running programs backward
  4650. ***************************
  4651. When you are debugging a program, it is not unusual to realize that you
  4652. have gone too far, and some event of interest has already happened. If
  4653. the target environment supports it, GDB can allow you to "rewind" the
  4654. program by running it backward.
  4655. A target environment that supports reverse execution should be able
  4656. to "undo" the changes in machine state that have taken place as the
  4657. program was executing normally. Variables, registers etc. should revert
  4658. to their previous values. Obviously this requires a great deal of
  4659. sophistication on the part of the target environment; not all target
  4660. environments can support reverse execution.
  4661. When a program is executed in reverse, the instructions that have
  4662. most recently been executed are "un-executed", in reverse order. The
  4663. program counter runs backward, following the previous thread of
  4664. execution in reverse. As each instruction is "un-executed", the values
  4665. of memory and/or registers that were changed by that instruction are
  4666. reverted to their previous states. After executing a piece of source
  4667. code in reverse, all side effects of that code should be "undone", and
  4668. all variables should be returned to their prior values(1).
  4669. On some platforms, GDB has built-in support for reverse execution,
  4670. activated with the 'record' or 'record btrace' commands. *Note Process
  4671. Record and Replay::. Some remote targets, typically full system
  4672. emulators, support reverse execution directly without requiring any
  4673. special command.
  4674. If you are debugging in a target environment that supports reverse
  4675. execution, GDB provides the following commands.
  4676. 'reverse-continue [IGNORE-COUNT]'
  4677. 'rc [IGNORE-COUNT]'
  4678. Beginning at the point where your program last stopped, start
  4679. executing in reverse. Reverse execution will stop for breakpoints
  4680. and synchronous exceptions (signals), just like normal execution.
  4681. Behavior of asynchronous signals depends on the target environment.
  4682. 'reverse-step [COUNT]'
  4683. Run the program backward until control reaches the start of a
  4684. different source line; then stop it, and return control to GDB.
  4685. Like the 'step' command, 'reverse-step' will only stop at the
  4686. beginning of a source line. It "un-executes" the previously
  4687. executed source line. If the previous source line included calls
  4688. to debuggable functions, 'reverse-step' will step (backward) into
  4689. the called function, stopping at the beginning of the _last_
  4690. statement in the called function (typically a return statement).
  4691. Also, as with the 'step' command, if non-debuggable functions are
  4692. called, 'reverse-step' will run thru them backward without
  4693. stopping.
  4694. 'reverse-stepi [COUNT]'
  4695. Reverse-execute one machine instruction. Note that the instruction
  4696. to be reverse-executed is _not_ the one pointed to by the program
  4697. counter, but the instruction executed prior to that one. For
  4698. instance, if the last instruction was a jump, 'reverse-stepi' will
  4699. take you back from the destination of the jump to the jump
  4700. instruction itself.
  4701. 'reverse-next [COUNT]'
  4702. Run backward to the beginning of the previous line executed in the
  4703. current (innermost) stack frame. If the line contains function
  4704. calls, they will be "un-executed" without stopping. Starting from
  4705. the first line of a function, 'reverse-next' will take you back to
  4706. the caller of that function, _before_ the function was called, just
  4707. as the normal 'next' command would take you from the last line of a
  4708. function back to its return to its caller (2).
  4709. 'reverse-nexti [COUNT]'
  4710. Like 'nexti', 'reverse-nexti' executes a single instruction in
  4711. reverse, except that called functions are "un-executed" atomically.
  4712. That is, if the previously executed instruction was a return from
  4713. another function, 'reverse-nexti' will continue to execute in
  4714. reverse until the call to that function (from the current stack
  4715. frame) is reached.
  4716. 'reverse-finish'
  4717. Just as the 'finish' command takes you to the point where the
  4718. current function returns, 'reverse-finish' takes you to the point
  4719. where it was called. Instead of ending up at the end of the
  4720. current function invocation, you end up at the beginning.
  4721. 'set exec-direction'
  4722. Set the direction of target execution.
  4723. 'set exec-direction reverse'
  4724. GDB will perform all execution commands in reverse, until the
  4725. exec-direction mode is changed to "forward". Affected commands
  4726. include 'step, stepi, next, nexti, continue, and finish'. The
  4727. 'return' command cannot be used in reverse mode.
  4728. 'set exec-direction forward'
  4729. GDB will perform all execution commands in the normal fashion.
  4730. This is the default.
  4731. ---------- Footnotes ----------
  4732. (1) Note that some side effects are easier to undo than others. For
  4733. instance, memory and registers are relatively easy, but device I/O is
  4734. hard. Some targets may be able undo things like device I/O, and some
  4735. may not.
  4736. The contract between GDB and the reverse executing target requires
  4737. only that the target do something reasonable when GDB tells it to
  4738. execute backwards, and then report the results back to GDB. Whatever
  4739. the target reports back to GDB, GDB will report back to the user. GDB
  4740. assumes that the memory and registers that the target reports are in a
  4741. consistent state, but GDB accepts whatever it is given.
  4742. (2) Unless the code is too heavily optimized.
  4743. 
  4744. File: gdb.info, Node: Process Record and Replay, Next: Stack, Prev: Reverse Execution, Up: Top
  4745. 7 Recording Inferior's Execution and Replaying It
  4746. *************************************************
  4747. On some platforms, GDB provides a special "process record and replay"
  4748. target that can record a log of the process execution, and replay it
  4749. later with both forward and reverse execution commands.
  4750. When this target is in use, if the execution log includes the record
  4751. for the next instruction, GDB will debug in "replay mode". In the
  4752. replay mode, the inferior does not really execute code instructions.
  4753. Instead, all the events that normally happen during code execution are
  4754. taken from the execution log. While code is not really executed in
  4755. replay mode, the values of registers (including the program counter
  4756. register) and the memory of the inferior are still changed as they
  4757. normally would. Their contents are taken from the execution log.
  4758. If the record for the next instruction is not in the execution log,
  4759. GDB will debug in "record mode". In this mode, the inferior executes
  4760. normally, and GDB records the execution log for future replay.
  4761. The process record and replay target supports reverse execution
  4762. (*note Reverse Execution::), even if the platform on which the inferior
  4763. runs does not. However, the reverse execution is limited in this case
  4764. by the range of the instructions recorded in the execution log. In
  4765. other words, reverse execution on platforms that don't support it
  4766. directly can only be done in the replay mode.
  4767. When debugging in the reverse direction, GDB will work in replay mode
  4768. as long as the execution log includes the record for the previous
  4769. instruction; otherwise, it will work in record mode, if the platform
  4770. supports reverse execution, or stop if not.
  4771. Currently, process record and replay is supported on ARM, Aarch64,
  4772. Moxie, PowerPC, PowerPC64, S/390, and x86 (i386/amd64) running
  4773. GNU/Linux. Process record and replay can be used both when native
  4774. debugging, and when remote debugging via 'gdbserver'.
  4775. For architecture environments that support process record and replay,
  4776. GDB provides the following commands:
  4777. 'record METHOD'
  4778. This command starts the process record and replay target. The
  4779. recording method can be specified as parameter. Without a
  4780. parameter the command uses the 'full' recording method. The
  4781. following recording methods are available:
  4782. 'full'
  4783. Full record/replay recording using GDB's software record and
  4784. replay implementation. This method allows replaying and
  4785. reverse execution.
  4786. 'btrace FORMAT'
  4787. Hardware-supported instruction recording, supported on Intel
  4788. processors. This method does not record data. Further, the
  4789. data is collected in a ring buffer so old data will be
  4790. overwritten when the buffer is full. It allows limited
  4791. reverse execution. Variables and registers are not available
  4792. during reverse execution. In remote debugging, recording
  4793. continues on disconnect. Recorded data can be inspected after
  4794. reconnecting. The recording may be stopped using 'record
  4795. stop'.
  4796. The recording format can be specified as parameter. Without a
  4797. parameter the command chooses the recording format. The
  4798. following recording formats are available:
  4799. 'bts'
  4800. Use the "Branch Trace Store" (BTS) recording format. In
  4801. this format, the processor stores a from/to record for
  4802. each executed branch in the btrace ring buffer.
  4803. 'pt'
  4804. Use the "Intel Processor Trace" recording format. In
  4805. this format, the processor stores the execution trace in
  4806. a compressed form that is afterwards decoded by GDB.
  4807. The trace can be recorded with very low overhead. The
  4808. compressed trace format also allows small trace buffers
  4809. to already contain a big number of instructions compared
  4810. to BTS.
  4811. Decoding the recorded execution trace, on the other hand,
  4812. is more expensive than decoding BTS trace. This is
  4813. mostly due to the increased number of instructions to
  4814. process. You should increase the buffer-size with care.
  4815. Not all recording formats may be available on all processors.
  4816. The process record and replay target can only debug a process that
  4817. is already running. Therefore, you need first to start the process
  4818. with the 'run' or 'start' commands, and then start the recording
  4819. with the 'record METHOD' command.
  4820. Displaced stepping (*note displaced stepping: Maintenance
  4821. Commands.) will be automatically disabled when process record and
  4822. replay target is started. That's because the process record and
  4823. replay target doesn't support displaced stepping.
  4824. If the inferior is in the non-stop mode (*note Non-Stop Mode::) or
  4825. in the asynchronous execution mode (*note Background Execution::),
  4826. not all recording methods are available. The 'full' recording
  4827. method does not support these two modes.
  4828. 'record stop'
  4829. Stop the process record and replay target. When process record and
  4830. replay target stops, the entire execution log will be deleted and
  4831. the inferior will either be terminated, or will remain in its final
  4832. state.
  4833. When you stop the process record and replay target in record mode
  4834. (at the end of the execution log), the inferior will be stopped at
  4835. the next instruction that would have been recorded. In other
  4836. words, if you record for a while and then stop recording, the
  4837. inferior process will be left in the same state as if the recording
  4838. never happened.
  4839. On the other hand, if the process record and replay target is
  4840. stopped while in replay mode (that is, not at the end of the
  4841. execution log, but at some earlier point), the inferior process
  4842. will become "live" at that earlier state, and it will then be
  4843. possible to continue the usual "live" debugging of the process from
  4844. that state.
  4845. When the inferior process exits, or GDB detaches from it, process
  4846. record and replay target will automatically stop itself.
  4847. 'record goto'
  4848. Go to a specific location in the execution log. There are several
  4849. ways to specify the location to go to:
  4850. 'record goto begin'
  4851. 'record goto start'
  4852. Go to the beginning of the execution log.
  4853. 'record goto end'
  4854. Go to the end of the execution log.
  4855. 'record goto N'
  4856. Go to instruction number N in the execution log.
  4857. 'record save FILENAME'
  4858. Save the execution log to a file 'FILENAME'. Default filename is
  4859. 'gdb_record.PROCESS_ID', where PROCESS_ID is the process ID of the
  4860. inferior.
  4861. This command may not be available for all recording methods.
  4862. 'record restore FILENAME'
  4863. Restore the execution log from a file 'FILENAME'. File must have
  4864. been created with 'record save'.
  4865. 'set record full insn-number-max LIMIT'
  4866. 'set record full insn-number-max unlimited'
  4867. Set the limit of instructions to be recorded for the 'full'
  4868. recording method. Default value is 200000.
  4869. If LIMIT is a positive number, then GDB will start deleting
  4870. instructions from the log once the number of the record
  4871. instructions becomes greater than LIMIT. For every new recorded
  4872. instruction, GDB will delete the earliest recorded instruction to
  4873. keep the number of recorded instructions at the limit. (Since
  4874. deleting recorded instructions loses information, GDB lets you
  4875. control what happens when the limit is reached, by means of the
  4876. 'stop-at-limit' option, described below.)
  4877. If LIMIT is 'unlimited' or zero, GDB will never delete recorded
  4878. instructions from the execution log. The number of recorded
  4879. instructions is limited only by the available memory.
  4880. 'show record full insn-number-max'
  4881. Show the limit of instructions to be recorded with the 'full'
  4882. recording method.
  4883. 'set record full stop-at-limit'
  4884. Control the behavior of the 'full' recording method when the number
  4885. of recorded instructions reaches the limit. If ON (the default),
  4886. GDB will stop when the limit is reached for the first time and ask
  4887. you whether you want to stop the inferior or continue running it
  4888. and recording the execution log. If you decide to continue
  4889. recording, each new recorded instruction will cause the oldest one
  4890. to be deleted.
  4891. If this option is OFF, GDB will automatically delete the oldest
  4892. record to make room for each new one, without asking.
  4893. 'show record full stop-at-limit'
  4894. Show the current setting of 'stop-at-limit'.
  4895. 'set record full memory-query'
  4896. Control the behavior when GDB is unable to record memory changes
  4897. caused by an instruction for the 'full' recording method. If ON,
  4898. GDB will query whether to stop the inferior in that case.
  4899. If this option is OFF (the default), GDB will automatically ignore
  4900. the effect of such instructions on memory. Later, when GDB replays
  4901. this execution log, it will mark the log of this instruction as not
  4902. accessible, and it will not affect the replay results.
  4903. 'show record full memory-query'
  4904. Show the current setting of 'memory-query'.
  4905. The 'btrace' record target does not trace data. As a convenience,
  4906. when replaying, GDB reads read-only memory off the live program
  4907. directly, assuming that the addresses of the read-only areas don't
  4908. change. This for example makes it possible to disassemble code
  4909. while replaying, but not to print variables. In some cases, being
  4910. able to inspect variables might be useful. You can use the
  4911. following command for that:
  4912. 'set record btrace replay-memory-access'
  4913. Control the behavior of the 'btrace' recording method when
  4914. accessing memory during replay. If 'read-only' (the default), GDB
  4915. will only allow accesses to read-only memory. If 'read-write', GDB
  4916. will allow accesses to read-only and to read-write memory. Beware
  4917. that the accessed memory corresponds to the live target and not
  4918. necessarily to the current replay position.
  4919. 'set record btrace cpu IDENTIFIER'
  4920. Set the processor to be used for enabling workarounds for processor
  4921. errata when decoding the trace.
  4922. Processor errata are defects in processor operation, caused by its
  4923. design or manufacture. They can cause a trace not to match the
  4924. specification. This, in turn, may cause trace decode to fail. GDB
  4925. can detect erroneous trace packets and correct them, thus avoiding
  4926. the decoding failures. These corrections are known as "errata
  4927. workarounds", and are enabled based on the processor on which the
  4928. trace was recorded.
  4929. By default, GDB attempts to detect the processor automatically, and
  4930. apply the necessary workarounds for it. However, you may need to
  4931. specify the processor if GDB does not yet support it. This command
  4932. allows you to do that, and also allows to disable the workarounds.
  4933. The argument IDENTIFIER identifies the CPU and is of the form:
  4934. 'VENDOR:PROCESSOR IDENTIFIER'. In addition, there are two special
  4935. identifiers, 'none' and 'auto' (default).
  4936. The following vendor identifiers and corresponding processor
  4937. identifiers are currently supported:
  4938. 'intel' FAMILY/MODEL[/STEPPING]
  4939. On GNU/Linux systems, the processor FAMILY, MODEL, and STEPPING can
  4940. be obtained from '/proc/cpuinfo'.
  4941. If IDENTIFIER is 'auto', enable errata workarounds for the
  4942. processor on which the trace was recorded. If IDENTIFIER is
  4943. 'none', errata workarounds are disabled.
  4944. For example, when using an old GDB on a new system, decode may fail
  4945. because GDB does not support the new processor. It often suffices
  4946. to specify an older processor that GDB supports.
  4947. (gdb) info record
  4948. Active record target: record-btrace
  4949. Recording format: Intel Processor Trace.
  4950. Buffer size: 16kB.
  4951. Failed to configure the Intel Processor Trace decoder: unknown cpu.
  4952. (gdb) set record btrace cpu intel:6/158
  4953. (gdb) info record
  4954. Active record target: record-btrace
  4955. Recording format: Intel Processor Trace.
  4956. Buffer size: 16kB.
  4957. Recorded 84872 instructions in 3189 functions (0 gaps) for thread 1 (...).
  4958. 'show record btrace replay-memory-access'
  4959. Show the current setting of 'replay-memory-access'.
  4960. 'show record btrace cpu'
  4961. Show the processor to be used for enabling trace decode errata
  4962. workarounds.
  4963. 'set record btrace bts buffer-size SIZE'
  4964. 'set record btrace bts buffer-size unlimited'
  4965. Set the requested ring buffer size for branch tracing in BTS
  4966. format. Default is 64KB.
  4967. If SIZE is a positive number, then GDB will try to allocate a
  4968. buffer of at least SIZE bytes for each new thread that uses the
  4969. btrace recording method and the BTS format. The actually obtained
  4970. buffer size may differ from the requested SIZE. Use the 'info
  4971. record' command to see the actual buffer size for each thread that
  4972. uses the btrace recording method and the BTS format.
  4973. If LIMIT is 'unlimited' or zero, GDB will try to allocate a buffer
  4974. of 4MB.
  4975. Bigger buffers mean longer traces. On the other hand, GDB will
  4976. also need longer to process the branch trace data before it can be
  4977. used.
  4978. 'show record btrace bts buffer-size SIZE'
  4979. Show the current setting of the requested ring buffer size for
  4980. branch tracing in BTS format.
  4981. 'set record btrace pt buffer-size SIZE'
  4982. 'set record btrace pt buffer-size unlimited'
  4983. Set the requested ring buffer size for branch tracing in Intel
  4984. Processor Trace format. Default is 16KB.
  4985. If SIZE is a positive number, then GDB will try to allocate a
  4986. buffer of at least SIZE bytes for each new thread that uses the
  4987. btrace recording method and the Intel Processor Trace format. The
  4988. actually obtained buffer size may differ from the requested SIZE.
  4989. Use the 'info record' command to see the actual buffer size for
  4990. each thread.
  4991. If LIMIT is 'unlimited' or zero, GDB will try to allocate a buffer
  4992. of 4MB.
  4993. Bigger buffers mean longer traces. On the other hand, GDB will
  4994. also need longer to process the branch trace data before it can be
  4995. used.
  4996. 'show record btrace pt buffer-size SIZE'
  4997. Show the current setting of the requested ring buffer size for
  4998. branch tracing in Intel Processor Trace format.
  4999. 'info record'
  5000. Show various statistics about the recording depending on the
  5001. recording method:
  5002. 'full'
  5003. For the 'full' recording method, it shows the state of process
  5004. record and its in-memory execution log buffer, including:
  5005. * Whether in record mode or replay mode.
  5006. * Lowest recorded instruction number (counting from when
  5007. the current execution log started recording
  5008. instructions).
  5009. * Highest recorded instruction number.
  5010. * Current instruction about to be replayed (if in replay
  5011. mode).
  5012. * Number of instructions contained in the execution log.
  5013. * Maximum number of instructions that may be contained in
  5014. the execution log.
  5015. 'btrace'
  5016. For the 'btrace' recording method, it shows:
  5017. * Recording format.
  5018. * Number of instructions that have been recorded.
  5019. * Number of blocks of sequential control-flow formed by the
  5020. recorded instructions.
  5021. * Whether in record mode or replay mode.
  5022. For the 'bts' recording format, it also shows:
  5023. * Size of the perf ring buffer.
  5024. For the 'pt' recording format, it also shows:
  5025. * Size of the perf ring buffer.
  5026. 'record delete'
  5027. When record target runs in replay mode ("in the past"), delete the
  5028. subsequent execution log and begin to record a new execution log
  5029. starting from the current address. This means you will abandon the
  5030. previously recorded "future" and begin recording a new "future".
  5031. 'record instruction-history'
  5032. Disassembles instructions from the recorded execution log. By
  5033. default, ten instructions are disassembled. This can be changed
  5034. using the 'set record instruction-history-size' command.
  5035. Instructions are printed in execution order.
  5036. It can also print mixed source+disassembly if you specify the the
  5037. '/m' or '/s' modifier, and print the raw instructions in hex as
  5038. well as in symbolic form by specifying the '/r' modifier.
  5039. The current position marker is printed for the instruction at the
  5040. current program counter value. This instruction can appear
  5041. multiple times in the trace and the current position marker will be
  5042. printed every time. To omit the current position marker, specify
  5043. the '/p' modifier.
  5044. To better align the printed instructions when the trace contains
  5045. instructions from more than one function, the function name may be
  5046. omitted by specifying the '/f' modifier.
  5047. Speculatively executed instructions are prefixed with '?'. This
  5048. feature is not available for all recording formats.
  5049. There are several ways to specify what part of the execution log to
  5050. disassemble:
  5051. 'record instruction-history INSN'
  5052. Disassembles ten instructions starting from instruction number
  5053. INSN.
  5054. 'record instruction-history INSN, +/-N'
  5055. Disassembles N instructions around instruction number INSN.
  5056. If N is preceded with '+', disassembles N instructions after
  5057. instruction number INSN. If N is preceded with '-',
  5058. disassembles N instructions before instruction number INSN.
  5059. 'record instruction-history'
  5060. Disassembles ten more instructions after the last disassembly.
  5061. 'record instruction-history -'
  5062. Disassembles ten more instructions before the last
  5063. disassembly.
  5064. 'record instruction-history BEGIN, END'
  5065. Disassembles instructions beginning with instruction number
  5066. BEGIN until instruction number END. The instruction number
  5067. END is included.
  5068. This command may not be available for all recording methods.
  5069. 'set record instruction-history-size SIZE'
  5070. 'set record instruction-history-size unlimited'
  5071. Define how many instructions to disassemble in the 'record
  5072. instruction-history' command. The default value is 10. A SIZE of
  5073. 'unlimited' means unlimited instructions.
  5074. 'show record instruction-history-size'
  5075. Show how many instructions to disassemble in the 'record
  5076. instruction-history' command.
  5077. 'record function-call-history'
  5078. Prints the execution history at function granularity. It prints
  5079. one line for each sequence of instructions that belong to the same
  5080. function giving the name of that function, the source lines for
  5081. this instruction sequence (if the '/l' modifier is specified), and
  5082. the instructions numbers that form the sequence (if the '/i'
  5083. modifier is specified). The function names are indented to reflect
  5084. the call stack depth if the '/c' modifier is specified. The '/l',
  5085. '/i', and '/c' modifiers can be given together.
  5086. (gdb) list 1, 10
  5087. 1 void foo (void)
  5088. 2 {
  5089. 3 }
  5090. 4
  5091. 5 void bar (void)
  5092. 6 {
  5093. 7 ...
  5094. 8 foo ();
  5095. 9 ...
  5096. 10 }
  5097. (gdb) record function-call-history /ilc
  5098. 1 bar inst 1,4 at foo.c:6,8
  5099. 2 foo inst 5,10 at foo.c:2,3
  5100. 3 bar inst 11,13 at foo.c:9,10
  5101. By default, ten lines are printed. This can be changed using the
  5102. 'set record function-call-history-size' command. Functions are
  5103. printed in execution order. There are several ways to specify what
  5104. to print:
  5105. 'record function-call-history FUNC'
  5106. Prints ten functions starting from function number FUNC.
  5107. 'record function-call-history FUNC, +/-N'
  5108. Prints N functions around function number FUNC. If N is
  5109. preceded with '+', prints N functions after function number
  5110. FUNC. If N is preceded with '-', prints N functions before
  5111. function number FUNC.
  5112. 'record function-call-history'
  5113. Prints ten more functions after the last ten-line print.
  5114. 'record function-call-history -'
  5115. Prints ten more functions before the last ten-line print.
  5116. 'record function-call-history BEGIN, END'
  5117. Prints functions beginning with function number BEGIN until
  5118. function number END. The function number END is included.
  5119. This command may not be available for all recording methods.
  5120. 'set record function-call-history-size SIZE'
  5121. 'set record function-call-history-size unlimited'
  5122. Define how many lines to print in the 'record
  5123. function-call-history' command. The default value is 10. A size
  5124. of 'unlimited' means unlimited lines.
  5125. 'show record function-call-history-size'
  5126. Show how many lines to print in the 'record function-call-history'
  5127. command.
  5128. 
  5129. File: gdb.info, Node: Stack, Next: Source, Prev: Process Record and Replay, Up: Top
  5130. 8 Examining the Stack
  5131. *********************
  5132. When your program has stopped, the first thing you need to know is where
  5133. it stopped and how it got there.
  5134. Each time your program performs a function call, information about
  5135. the call is generated. That information includes the location of the
  5136. call in your program, the arguments of the call, and the local variables
  5137. of the function being called. The information is saved in a block of
  5138. data called a "stack frame". The stack frames are allocated in a region
  5139. of memory called the "call stack".
  5140. When your program stops, the GDB commands for examining the stack
  5141. allow you to see all of this information.
  5142. One of the stack frames is "selected" by GDB and many GDB commands
  5143. refer implicitly to the selected frame. In particular, whenever you ask
  5144. GDB for the value of a variable in your program, the value is found in
  5145. the selected frame. There are special GDB commands to select whichever
  5146. frame you are interested in. *Note Selecting a Frame: Selection.
  5147. When your program stops, GDB automatically selects the currently
  5148. executing frame and describes it briefly, similar to the 'frame' command
  5149. (*note Information about a Frame: Frame Info.).
  5150. * Menu:
  5151. * Frames:: Stack frames
  5152. * Backtrace:: Backtraces
  5153. * Selection:: Selecting a frame
  5154. * Frame Info:: Information on a frame
  5155. * Frame Apply:: Applying a command to several frames
  5156. * Frame Filter Management:: Managing frame filters
  5157. 
  5158. File: gdb.info, Node: Frames, Next: Backtrace, Up: Stack
  5159. 8.1 Stack Frames
  5160. ================
  5161. The call stack is divided up into contiguous pieces called "stack
  5162. frames", or "frames" for short; each frame is the data associated with
  5163. one call to one function. The frame contains the arguments given to the
  5164. function, the function's local variables, and the address at which the
  5165. function is executing.
  5166. When your program is started, the stack has only one frame, that of
  5167. the function 'main'. This is called the "initial" frame or the
  5168. "outermost" frame. Each time a function is called, a new frame is made.
  5169. Each time a function returns, the frame for that function invocation is
  5170. eliminated. If a function is recursive, there can be many frames for
  5171. the same function. The frame for the function in which execution is
  5172. actually occurring is called the "innermost" frame. This is the most
  5173. recently created of all the stack frames that still exist.
  5174. Inside your program, stack frames are identified by their addresses.
  5175. A stack frame consists of many bytes, each of which has its own address;
  5176. each kind of computer has a convention for choosing one byte whose
  5177. address serves as the address of the frame. Usually this address is
  5178. kept in a register called the "frame pointer register" (*note $fp:
  5179. Registers.) while execution is going on in that frame.
  5180. GDB labels each existing stack frame with a "level", a number that is
  5181. zero for the innermost frame, one for the frame that called it, and so
  5182. on upward. These level numbers give you a way of designating stack
  5183. frames in GDB commands. The terms "frame number" and "frame level" can
  5184. be used interchangeably to describe this number.
  5185. Some compilers provide a way to compile functions so that they
  5186. operate without stack frames. (For example, the GCC option
  5187. '-fomit-frame-pointer'
  5188. generates functions without a frame.) This is occasionally done with
  5189. heavily used library functions to save the frame setup time. GDB has
  5190. limited facilities for dealing with these function invocations. If the
  5191. innermost function invocation has no stack frame, GDB nevertheless
  5192. regards it as though it had a separate frame, which is numbered zero as
  5193. usual, allowing correct tracing of the function call chain. However,
  5194. GDB has no provision for frameless functions elsewhere in the stack.
  5195. 
  5196. File: gdb.info, Node: Backtrace, Next: Selection, Prev: Frames, Up: Stack
  5197. 8.2 Backtraces
  5198. ==============
  5199. A backtrace is a summary of how your program got where it is. It shows
  5200. one line per frame, for many frames, starting with the currently
  5201. executing frame (frame zero), followed by its caller (frame one), and on
  5202. up the stack.
  5203. To print a backtrace of the entire stack, use the 'backtrace'
  5204. command, or its alias 'bt'. This command will print one line per frame
  5205. for frames in the stack. By default, all stack frames are printed. You
  5206. can stop the backtrace at any time by typing the system interrupt
  5207. character, normally 'Ctrl-c'.
  5208. 'backtrace [OPTION]... [QUALIFIER]... [COUNT]'
  5209. 'bt [OPTION]... [QUALIFIER]... [COUNT]'
  5210. Print the backtrace of the entire stack.
  5211. The optional COUNT can be one of the following:
  5212. 'N'
  5213. 'N'
  5214. Print only the innermost N frames, where N is a positive
  5215. number.
  5216. '-N'
  5217. '-N'
  5218. Print only the outermost N frames, where N is a positive
  5219. number.
  5220. Options:
  5221. '-full'
  5222. Print the values of the local variables also. This can be
  5223. combined with the optional COUNT to limit the number of frames
  5224. shown.
  5225. '-no-filters'
  5226. Do not run Python frame filters on this backtrace. *Note
  5227. Frame Filter API::, for more information. Additionally use
  5228. *note disable frame-filter all:: to turn off all frame
  5229. filters. This is only relevant when GDB has been configured
  5230. with 'Python' support.
  5231. '-hide'
  5232. A Python frame filter might decide to "elide" some frames.
  5233. Normally such elided frames are still printed, but they are
  5234. indented relative to the filtered frames that cause them to be
  5235. elided. The '-hide' option causes elided frames to not be
  5236. printed at all.
  5237. The 'backtrace' command also supports a number of options that
  5238. allow overriding relevant global print settings as set by 'set
  5239. backtrace' and 'set print' subcommands:
  5240. '-past-main [on|off]'
  5241. Set whether backtraces should continue past 'main'. Related
  5242. setting: *note set backtrace past-main::.
  5243. '-past-entry [on|off]'
  5244. Set whether backtraces should continue past the entry point of
  5245. a program. Related setting: *note set backtrace past-entry::.
  5246. '-entry-values no|only|preferred|if-needed|both|compact|default'
  5247. Set printing of function arguments at function entry. Related
  5248. setting: *note set print entry-values::.
  5249. '-frame-arguments all|scalars|none'
  5250. Set printing of non-scalar frame arguments. Related setting:
  5251. *note set print frame-arguments::.
  5252. '-raw-frame-arguments [on|off]'
  5253. Set whether to print frame arguments in raw form. Related
  5254. setting: *note set print raw-frame-arguments::.
  5255. '-frame-info auto|source-line|location|source-and-location|location-and-address|short-location'
  5256. Set printing of frame information. Related setting: *note set
  5257. print frame-info::.
  5258. The optional QUALIFIER is maintained for backward compatibility.
  5259. It can be one of the following:
  5260. 'full'
  5261. Equivalent to the '-full' option.
  5262. 'no-filters'
  5263. Equivalent to the '-no-filters' option.
  5264. 'hide'
  5265. Equivalent to the '-hide' option.
  5266. The names 'where' and 'info stack' (abbreviated 'info s') are
  5267. additional aliases for 'backtrace'.
  5268. In a multi-threaded program, GDB by default shows the backtrace only
  5269. for the current thread. To display the backtrace for several or all of
  5270. the threads, use the command 'thread apply' (*note thread apply:
  5271. Threads.). For example, if you type 'thread apply all backtrace', GDB
  5272. will display the backtrace for all the threads; this is handy when you
  5273. debug a core dump of a multi-threaded program.
  5274. Each line in the backtrace shows the frame number and the function
  5275. name. The program counter value is also shown--unless you use 'set
  5276. print address off'. The backtrace also shows the source file name and
  5277. line number, as well as the arguments to the function. The program
  5278. counter value is omitted if it is at the beginning of the code for that
  5279. line number.
  5280. Here is an example of a backtrace. It was made with the command 'bt
  5281. 3', so it shows the innermost three frames.
  5282. #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
  5283. at builtin.c:993
  5284. #1 0x6e38 in expand_macro (sym=0x2b600, data=...) at macro.c:242
  5285. #2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
  5286. at macro.c:71
  5287. (More stack frames follow...)
  5288. The display for frame zero does not begin with a program counter value,
  5289. indicating that your program has stopped at the beginning of the code
  5290. for line '993' of 'builtin.c'.
  5291. The value of parameter 'data' in frame 1 has been replaced by '...'. By
  5292. default, GDB prints the value of a parameter only if it is a scalar
  5293. (integer, pointer, enumeration, etc). See command 'set print
  5294. frame-arguments' in *note Print Settings:: for more details on how to
  5295. configure the way function parameter values are printed. The command
  5296. 'set print frame-info' (*note Print Settings::) controls what frame
  5297. information is printed.
  5298. If your program was compiled with optimizations, some compilers will
  5299. optimize away arguments passed to functions if those arguments are never
  5300. used after the call. Such optimizations generate code that passes
  5301. arguments through registers, but doesn't store those arguments in the
  5302. stack frame. GDB has no way of displaying such arguments in stack
  5303. frames other than the innermost one. Here's what such a backtrace might
  5304. look like:
  5305. #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
  5306. at builtin.c:993
  5307. #1 0x6e38 in expand_macro (sym=<optimized out>) at macro.c:242
  5308. #2 0x6840 in expand_token (obs=0x0, t=<optimized out>, td=0xf7fffb08)
  5309. at macro.c:71
  5310. (More stack frames follow...)
  5311. The values of arguments that were not saved in their stack frames are
  5312. shown as '<optimized out>'.
  5313. If you need to display the values of such optimized-out arguments,
  5314. either deduce that from other variables whose values depend on the one
  5315. you are interested in, or recompile without optimizations.
  5316. Most programs have a standard user entry point--a place where system
  5317. libraries and startup code transition into user code. For C this is
  5318. 'main'(1). When GDB finds the entry function in a backtrace it will
  5319. terminate the backtrace, to avoid tracing into highly system-specific
  5320. (and generally uninteresting) code.
  5321. If you need to examine the startup code, or limit the number of
  5322. levels in a backtrace, you can change this behavior:
  5323. 'set backtrace past-main'
  5324. 'set backtrace past-main on'
  5325. Backtraces will continue past the user entry point.
  5326. 'set backtrace past-main off'
  5327. Backtraces will stop when they encounter the user entry point.
  5328. This is the default.
  5329. 'show backtrace past-main'
  5330. Display the current user entry point backtrace policy.
  5331. 'set backtrace past-entry'
  5332. 'set backtrace past-entry on'
  5333. Backtraces will continue past the internal entry point of an
  5334. application. This entry point is encoded by the linker when the
  5335. application is built, and is likely before the user entry point
  5336. 'main' (or equivalent) is called.
  5337. 'set backtrace past-entry off'
  5338. Backtraces will stop when they encounter the internal entry point
  5339. of an application. This is the default.
  5340. 'show backtrace past-entry'
  5341. Display the current internal entry point backtrace policy.
  5342. 'set backtrace limit N'
  5343. 'set backtrace limit 0'
  5344. 'set backtrace limit unlimited'
  5345. Limit the backtrace to N levels. A value of 'unlimited' or zero
  5346. means unlimited levels.
  5347. 'show backtrace limit'
  5348. Display the current limit on backtrace levels.
  5349. You can control how file names are displayed.
  5350. 'set filename-display'
  5351. 'set filename-display relative'
  5352. Display file names relative to the compilation directory. This is
  5353. the default.
  5354. 'set filename-display basename'
  5355. Display only basename of a filename.
  5356. 'set filename-display absolute'
  5357. Display an absolute filename.
  5358. 'show filename-display'
  5359. Show the current way to display filenames.
  5360. ---------- Footnotes ----------
  5361. (1) Note that embedded programs (the so-called "free-standing"
  5362. environment) are not required to have a 'main' function as the entry
  5363. point. They could even have multiple entry points.
  5364. 
  5365. File: gdb.info, Node: Selection, Next: Frame Info, Prev: Backtrace, Up: Stack
  5366. 8.3 Selecting a Frame
  5367. =====================
  5368. Most commands for examining the stack and other data in your program
  5369. work on whichever stack frame is selected at the moment. Here are the
  5370. commands for selecting a stack frame; all of them finish by printing a
  5371. brief description of the stack frame just selected.
  5372. 'frame [ FRAME-SELECTION-SPEC ]'
  5373. 'f [ FRAME-SELECTION-SPEC ]'
  5374. The 'frame' command allows different stack frames to be selected.
  5375. The FRAME-SELECTION-SPEC can be any of the following:
  5376. 'NUM'
  5377. 'level NUM'
  5378. Select frame level NUM. Recall that frame zero is the
  5379. innermost (currently executing) frame, frame one is the frame
  5380. that called the innermost one, and so on. The highest level
  5381. frame is usually the one for 'main'.
  5382. As this is the most common method of navigating the frame
  5383. stack, the string 'level' can be omitted. For example, the
  5384. following two commands are equivalent:
  5385. (gdb) frame 3
  5386. (gdb) frame level 3
  5387. 'address STACK-ADDRESS'
  5388. Select the frame with stack address STACK-ADDRESS. The
  5389. STACK-ADDRESS for a frame can be seen in the output of 'info
  5390. frame', for example:
  5391. (gdb) info frame
  5392. Stack level 1, frame at 0x7fffffffda30:
  5393. rip = 0x40066d in b (amd64-entry-value.cc:59); saved rip 0x4004c5
  5394. tail call frame, caller of frame at 0x7fffffffda30
  5395. source language c++.
  5396. Arglist at unknown address.
  5397. Locals at unknown address, Previous frame's sp is 0x7fffffffda30
  5398. The STACK-ADDRESS for this frame is '0x7fffffffda30' as
  5399. indicated by the line:
  5400. Stack level 1, frame at 0x7fffffffda30:
  5401. 'function FUNCTION-NAME'
  5402. Select the stack frame for function FUNCTION-NAME. If there
  5403. are multiple stack frames for function FUNCTION-NAME then the
  5404. inner most stack frame is selected.
  5405. 'view STACK-ADDRESS [ PC-ADDR ]'
  5406. View a frame that is not part of GDB's backtrace. The frame
  5407. viewed has stack address STACK-ADDR, and optionally, a program
  5408. counter address of PC-ADDR.
  5409. This is useful mainly if the chaining of stack frames has been
  5410. damaged by a bug, making it impossible for GDB to assign
  5411. numbers properly to all frames. In addition, this can be
  5412. useful when your program has multiple stacks and switches
  5413. between them.
  5414. When viewing a frame outside the current backtrace using
  5415. 'frame view' then you can always return to the original stack
  5416. using one of the previous stack frame selection instructions,
  5417. for example 'frame level 0'.
  5418. 'up N'
  5419. Move N frames up the stack; N defaults to 1. For positive numbers
  5420. N, this advances toward the outermost frame, to higher frame
  5421. numbers, to frames that have existed longer.
  5422. 'down N'
  5423. Move N frames down the stack; N defaults to 1. For positive
  5424. numbers N, this advances toward the innermost frame, to lower frame
  5425. numbers, to frames that were created more recently. You may
  5426. abbreviate 'down' as 'do'.
  5427. All of these commands end by printing two lines of output describing
  5428. the frame. The first line shows the frame number, the function name,
  5429. the arguments, and the source file and line number of execution in that
  5430. frame. The second line shows the text of that source line.
  5431. For example:
  5432. (gdb) up
  5433. #1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc)
  5434. at env.c:10
  5435. 10 read_input_file (argv[i]);
  5436. After such a printout, the 'list' command with no arguments prints
  5437. ten lines centered on the point of execution in the frame. You can also
  5438. edit the program at the point of execution with your favorite editing
  5439. program by typing 'edit'. *Note Printing Source Lines: List, for
  5440. details.
  5441. 'select-frame [ FRAME-SELECTION-SPEC ]'
  5442. The 'select-frame' command is a variant of 'frame' that does not
  5443. display the new frame after selecting it. This command is intended
  5444. primarily for use in GDB command scripts, where the output might be
  5445. unnecessary and distracting. The FRAME-SELECTION-SPEC is as for
  5446. the 'frame' command described in *note Selecting a Frame:
  5447. Selection.
  5448. 'up-silently N'
  5449. 'down-silently N'
  5450. These two commands are variants of 'up' and 'down', respectively;
  5451. they differ in that they do their work silently, without causing
  5452. display of the new frame. They are intended primarily for use in
  5453. GDB command scripts, where the output might be unnecessary and
  5454. distracting.
  5455. 
  5456. File: gdb.info, Node: Frame Info, Next: Frame Apply, Prev: Selection, Up: Stack
  5457. 8.4 Information About a Frame
  5458. =============================
  5459. There are several other commands to print information about the selected
  5460. stack frame.
  5461. 'frame'
  5462. 'f'
  5463. When used without any argument, this command does not change which
  5464. frame is selected, but prints a brief description of the currently
  5465. selected stack frame. It can be abbreviated 'f'. With an
  5466. argument, this command is used to select a stack frame. *Note
  5467. Selecting a Frame: Selection.
  5468. 'info frame'
  5469. 'info f'
  5470. This command prints a verbose description of the selected stack
  5471. frame, including:
  5472. * the address of the frame
  5473. * the address of the next frame down (called by this frame)
  5474. * the address of the next frame up (caller of this frame)
  5475. * the language in which the source code corresponding to this
  5476. frame is written
  5477. * the address of the frame's arguments
  5478. * the address of the frame's local variables
  5479. * the program counter saved in it (the address of execution in
  5480. the caller frame)
  5481. * which registers were saved in the frame
  5482. The verbose description is useful when something has gone wrong
  5483. that has made the stack format fail to fit the usual conventions.
  5484. 'info frame [ FRAME-SELECTION-SPEC ]'
  5485. 'info f [ FRAME-SELECTION-SPEC ]'
  5486. Print a verbose description of the frame selected by
  5487. FRAME-SELECTION-SPEC. The FRAME-SELECTION-SPEC is the same as for
  5488. the 'frame' command (*note Selecting a Frame: Selection.). The
  5489. selected frame remains unchanged by this command.
  5490. 'info args [-q]'
  5491. Print the arguments of the selected frame, each on a separate line.
  5492. The optional flag '-q', which stands for 'quiet', disables printing
  5493. header information and messages explaining why no argument have
  5494. been printed.
  5495. 'info args [-q] [-t TYPE_REGEXP] [REGEXP]'
  5496. Like 'info args', but only print the arguments selected with the
  5497. provided regexp(s).
  5498. If REGEXP is provided, print only the arguments whose names match
  5499. the regular expression REGEXP.
  5500. If TYPE_REGEXP is provided, print only the arguments whose types,
  5501. as printed by the 'whatis' command, match the regular expression
  5502. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  5503. enclosed in quote characters. If needed, use backslash to escape
  5504. the meaning of special characters or quotes.
  5505. If both REGEXP and TYPE_REGEXP are provided, an argument is printed
  5506. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  5507. 'info locals [-q]'
  5508. Print the local variables of the selected frame, each on a separate
  5509. line. These are all variables (declared either static or
  5510. automatic) accessible at the point of execution of the selected
  5511. frame.
  5512. The optional flag '-q', which stands for 'quiet', disables printing
  5513. header information and messages explaining why no local variables
  5514. have been printed.
  5515. 'info locals [-q] [-t TYPE_REGEXP] [REGEXP]'
  5516. Like 'info locals', but only print the local variables selected
  5517. with the provided regexp(s).
  5518. If REGEXP is provided, print only the local variables whose names
  5519. match the regular expression REGEXP.
  5520. If TYPE_REGEXP is provided, print only the local variables whose
  5521. types, as printed by the 'whatis' command, match the regular
  5522. expression TYPE_REGEXP. If TYPE_REGEXP contains space(s), it
  5523. should be enclosed in quote characters. If needed, use backslash
  5524. to escape the meaning of special characters or quotes.
  5525. If both REGEXP and TYPE_REGEXP are provided, a local variable is
  5526. printed only if its name matches REGEXP and its type matches
  5527. TYPE_REGEXP.
  5528. The command 'info locals -q -t TYPE_REGEXP' can usefully be
  5529. combined with the commands 'frame apply' and 'thread apply'. For
  5530. example, your program might use Resource Acquisition Is
  5531. Initialization types (RAII) such as 'lock_something_t': each local
  5532. variable of type 'lock_something_t' automatically places a lock
  5533. that is destroyed when the variable goes out of scope. You can
  5534. then list all acquired locks in your program by doing
  5535. thread apply all -s frame apply all -s info locals -q -t lock_something_t
  5536. or the equivalent shorter form
  5537. tfaas i lo -q -t lock_something_t
  5538. 
  5539. File: gdb.info, Node: Frame Apply, Next: Frame Filter Management, Prev: Frame Info, Up: Stack
  5540. 8.5 Applying a Command to Several Frames.
  5541. =========================================
  5542. 'frame apply [all | COUNT | -COUNT | level LEVEL...] [OPTION]... COMMAND'
  5543. The 'frame apply' command allows you to apply the named COMMAND to
  5544. one or more frames.
  5545. 'all'
  5546. Specify 'all' to apply COMMAND to all frames.
  5547. 'COUNT'
  5548. Use COUNT to apply COMMAND to the innermost COUNT frames,
  5549. where COUNT is a positive number.
  5550. '-COUNT'
  5551. Use -COUNT to apply COMMAND to the outermost COUNT frames,
  5552. where COUNT is a positive number.
  5553. 'level'
  5554. Use 'level' to apply COMMAND to the set of frames identified
  5555. by the LEVEL list. LEVEL is a frame level or a range of frame
  5556. levels as LEVEL1-LEVEL2. The frame level is the number shown
  5557. in the first field of the 'backtrace' command output. E.g.,
  5558. '2-4 6-8 3' indicates to apply COMMAND for the frames at
  5559. levels 2, 3, 4, 6, 7, 8, and then again on frame at level 3.
  5560. Note that the frames on which 'frame apply' applies a command are
  5561. also influenced by the 'set backtrace' settings such as 'set
  5562. backtrace past-main' and 'set backtrace limit N'. *Note
  5563. Backtraces: Backtrace.
  5564. The 'frame apply' command also supports a number of options that
  5565. allow overriding relevant 'set backtrace' settings:
  5566. '-past-main [on|off]'
  5567. Whether backtraces should continue past 'main'. Related
  5568. setting: *note set backtrace past-main::.
  5569. '-past-entry [on|off]'
  5570. Whether backtraces should continue past the entry point of a
  5571. program. Related setting: *note set backtrace past-entry::.
  5572. By default, GDB displays some frame information before the output
  5573. produced by COMMAND, and an error raised during the execution of a
  5574. COMMAND will abort 'frame apply'. The following options can be
  5575. used to fine-tune these behaviors:
  5576. '-c'
  5577. The flag '-c', which stands for 'continue', causes any errors
  5578. in COMMAND to be displayed, and the execution of 'frame apply'
  5579. then continues.
  5580. '-s'
  5581. The flag '-s', which stands for 'silent', causes any errors or
  5582. empty output produced by a COMMAND to be silently ignored.
  5583. That is, the execution continues, but the frame information
  5584. and errors are not printed.
  5585. '-q'
  5586. The flag '-q' ('quiet') disables printing the frame
  5587. information.
  5588. The following example shows how the flags '-c' and '-s' are working
  5589. when applying the command 'p j' to all frames, where variable 'j'
  5590. can only be successfully printed in the outermost '#1 main' frame.
  5591. (gdb) frame apply all p j
  5592. #0 some_function (i=5) at fun.c:4
  5593. No symbol "j" in current context.
  5594. (gdb) frame apply all -c p j
  5595. #0 some_function (i=5) at fun.c:4
  5596. No symbol "j" in current context.
  5597. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5598. $1 = 5
  5599. (gdb) frame apply all -s p j
  5600. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5601. $2 = 5
  5602. (gdb)
  5603. By default, 'frame apply', prints the frame location information
  5604. before the command output:
  5605. (gdb) frame apply all p $sp
  5606. #0 some_function (i=5) at fun.c:4
  5607. $4 = (void *) 0xffffd1e0
  5608. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5609. $5 = (void *) 0xffffd1f0
  5610. (gdb)
  5611. If the flag '-q' is given, no frame information is printed:
  5612. (gdb) frame apply all -q p $sp
  5613. $12 = (void *) 0xffffd1e0
  5614. $13 = (void *) 0xffffd1f0
  5615. (gdb)
  5616. 'faas COMMAND'
  5617. Shortcut for 'frame apply all -s COMMAND'. Applies COMMAND on all
  5618. frames, ignoring errors and empty output.
  5619. It can for example be used to print a local variable or a function
  5620. argument without knowing the frame where this variable or argument
  5621. is, using:
  5622. (gdb) faas p some_local_var_i_do_not_remember_where_it_is
  5623. The 'faas' command accepts the same options as the 'frame apply'
  5624. command. *Note frame apply::.
  5625. Note that the command 'tfaas COMMAND' applies COMMAND on all frames
  5626. of all threads. See *Note Threads: Threads.
  5627. 
  5628. File: gdb.info, Node: Frame Filter Management, Prev: Frame Apply, Up: Stack
  5629. 8.6 Management of Frame Filters.
  5630. ================================
  5631. Frame filters are Python based utilities to manage and decorate the
  5632. output of frames. *Note Frame Filter API::, for further information.
  5633. Managing frame filters is performed by several commands available
  5634. within GDB, detailed here.
  5635. 'info frame-filter'
  5636. Print a list of installed frame filters from all dictionaries,
  5637. showing their name, priority and enabled status.
  5638. 'disable frame-filter FILTER-DICTIONARY FILTER-NAME'
  5639. Disable a frame filter in the dictionary matching FILTER-DICTIONARY
  5640. and FILTER-NAME. The FILTER-DICTIONARY may be 'all', 'global',
  5641. 'progspace', or the name of the object file where the frame filter
  5642. dictionary resides. When 'all' is specified, all frame filters
  5643. across all dictionaries are disabled. The FILTER-NAME is the name
  5644. of the frame filter and is used when 'all' is not the option for
  5645. FILTER-DICTIONARY. A disabled frame-filter is not deleted, it may
  5646. be enabled again later.
  5647. 'enable frame-filter FILTER-DICTIONARY FILTER-NAME'
  5648. Enable a frame filter in the dictionary matching FILTER-DICTIONARY
  5649. and FILTER-NAME. The FILTER-DICTIONARY may be 'all', 'global',
  5650. 'progspace' or the name of the object file where the frame filter
  5651. dictionary resides. When 'all' is specified, all frame filters
  5652. across all dictionaries are enabled. The FILTER-NAME is the name
  5653. of the frame filter and is used when 'all' is not the option for
  5654. FILTER-DICTIONARY.
  5655. Example:
  5656. (gdb) info frame-filter
  5657. global frame-filters:
  5658. Priority Enabled Name
  5659. 1000 No PrimaryFunctionFilter
  5660. 100 Yes Reverse
  5661. progspace /build/test frame-filters:
  5662. Priority Enabled Name
  5663. 100 Yes ProgspaceFilter
  5664. objfile /build/test frame-filters:
  5665. Priority Enabled Name
  5666. 999 Yes BuildProgramFilter
  5667. (gdb) disable frame-filter /build/test BuildProgramFilter
  5668. (gdb) info frame-filter
  5669. global frame-filters:
  5670. Priority Enabled Name
  5671. 1000 No PrimaryFunctionFilter
  5672. 100 Yes Reverse
  5673. progspace /build/test frame-filters:
  5674. Priority Enabled Name
  5675. 100 Yes ProgspaceFilter
  5676. objfile /build/test frame-filters:
  5677. Priority Enabled Name
  5678. 999 No BuildProgramFilter
  5679. (gdb) enable frame-filter global PrimaryFunctionFilter
  5680. (gdb) info frame-filter
  5681. global frame-filters:
  5682. Priority Enabled Name
  5683. 1000 Yes PrimaryFunctionFilter
  5684. 100 Yes Reverse
  5685. progspace /build/test frame-filters:
  5686. Priority Enabled Name
  5687. 100 Yes ProgspaceFilter
  5688. objfile /build/test frame-filters:
  5689. Priority Enabled Name
  5690. 999 No BuildProgramFilter
  5691. 'set frame-filter priority FILTER-DICTIONARY FILTER-NAME PRIORITY'
  5692. Set the PRIORITY of a frame filter in the dictionary matching
  5693. FILTER-DICTIONARY, and the frame filter name matching FILTER-NAME.
  5694. The FILTER-DICTIONARY may be 'global', 'progspace' or the name of
  5695. the object file where the frame filter dictionary resides. The
  5696. PRIORITY is an integer.
  5697. 'show frame-filter priority FILTER-DICTIONARY FILTER-NAME'
  5698. Show the PRIORITY of a frame filter in the dictionary matching
  5699. FILTER-DICTIONARY, and the frame filter name matching FILTER-NAME.
  5700. The FILTER-DICTIONARY may be 'global', 'progspace' or the name of
  5701. the object file where the frame filter dictionary resides.
  5702. Example:
  5703. (gdb) info frame-filter
  5704. global frame-filters:
  5705. Priority Enabled Name
  5706. 1000 Yes PrimaryFunctionFilter
  5707. 100 Yes Reverse
  5708. progspace /build/test frame-filters:
  5709. Priority Enabled Name
  5710. 100 Yes ProgspaceFilter
  5711. objfile /build/test frame-filters:
  5712. Priority Enabled Name
  5713. 999 No BuildProgramFilter
  5714. (gdb) set frame-filter priority global Reverse 50
  5715. (gdb) info frame-filter
  5716. global frame-filters:
  5717. Priority Enabled Name
  5718. 1000 Yes PrimaryFunctionFilter
  5719. 50 Yes Reverse
  5720. progspace /build/test frame-filters:
  5721. Priority Enabled Name
  5722. 100 Yes ProgspaceFilter
  5723. objfile /build/test frame-filters:
  5724. Priority Enabled Name
  5725. 999 No BuildProgramFilter
  5726. 
  5727. File: gdb.info, Node: Source, Next: Data, Prev: Stack, Up: Top
  5728. 9 Examining Source Files
  5729. ************************
  5730. GDB can print parts of your program's source, since the debugging
  5731. information recorded in the program tells GDB what source files were
  5732. used to build it. When your program stops, GDB spontaneously prints the
  5733. line where it stopped. Likewise, when you select a stack frame (*note
  5734. Selecting a Frame: Selection.), GDB prints the line where execution in
  5735. that frame has stopped. You can print other portions of source files by
  5736. explicit command.
  5737. If you use GDB through its GNU Emacs interface, you may prefer to use
  5738. Emacs facilities to view source; see *note Using GDB under GNU Emacs:
  5739. Emacs.
  5740. * Menu:
  5741. * List:: Printing source lines
  5742. * Specify Location:: How to specify code locations
  5743. * Edit:: Editing source files
  5744. * Search:: Searching source files
  5745. * Source Path:: Specifying source directories
  5746. * Machine Code:: Source and machine code
  5747. 
  5748. File: gdb.info, Node: List, Next: Specify Location, Up: Source
  5749. 9.1 Printing Source Lines
  5750. =========================
  5751. To print lines from a source file, use the 'list' command (abbreviated
  5752. 'l'). By default, ten lines are printed. There are several ways to
  5753. specify what part of the file you want to print; see *note Specify
  5754. Location::, for the full list.
  5755. Here are the forms of the 'list' command most commonly used:
  5756. 'list LINENUM'
  5757. Print lines centered around line number LINENUM in the current
  5758. source file.
  5759. 'list FUNCTION'
  5760. Print lines centered around the beginning of function FUNCTION.
  5761. 'list'
  5762. Print more lines. If the last lines printed were printed with a
  5763. 'list' command, this prints lines following the last lines printed;
  5764. however, if the last line printed was a solitary line printed as
  5765. part of displaying a stack frame (*note Examining the Stack:
  5766. Stack.), this prints lines centered around that line.
  5767. 'list -'
  5768. Print lines just before the lines last printed.
  5769. By default, GDB prints ten source lines with any of these forms of
  5770. the 'list' command. You can change this using 'set listsize':
  5771. 'set listsize COUNT'
  5772. 'set listsize unlimited'
  5773. Make the 'list' command display COUNT source lines (unless the
  5774. 'list' argument explicitly specifies some other number). Setting
  5775. COUNT to 'unlimited' or 0 means there's no limit.
  5776. 'show listsize'
  5777. Display the number of lines that 'list' prints.
  5778. Repeating a 'list' command with <RET> discards the argument, so it is
  5779. equivalent to typing just 'list'. This is more useful than listing the
  5780. same lines again. An exception is made for an argument of '-'; that
  5781. argument is preserved in repetition so that each repetition moves up in
  5782. the source file.
  5783. In general, the 'list' command expects you to supply zero, one or two
  5784. "locations". Locations specify source lines; there are several ways of
  5785. writing them (*note Specify Location::), but the effect is always to
  5786. specify some source line.
  5787. Here is a complete description of the possible arguments for 'list':
  5788. 'list LOCATION'
  5789. Print lines centered around the line specified by LOCATION.
  5790. 'list FIRST,LAST'
  5791. Print lines from FIRST to LAST. Both arguments are locations.
  5792. When a 'list' command has two locations, and the source file of the
  5793. second location is omitted, this refers to the same source file as
  5794. the first location.
  5795. 'list ,LAST'
  5796. Print lines ending with LAST.
  5797. 'list FIRST,'
  5798. Print lines starting with FIRST.
  5799. 'list +'
  5800. Print lines just after the lines last printed.
  5801. 'list -'
  5802. Print lines just before the lines last printed.
  5803. 'list'
  5804. As described in the preceding table.
  5805. 
  5806. File: gdb.info, Node: Specify Location, Next: Edit, Prev: List, Up: Source
  5807. 9.2 Specifying a Location
  5808. =========================
  5809. * Menu:
  5810. * Linespec Locations:: Linespec locations
  5811. * Explicit Locations:: Explicit locations
  5812. * Address Locations:: Address locations
  5813. Several GDB commands accept arguments that specify a location of your
  5814. program's code. Since GDB is a source-level debugger, a location
  5815. usually specifies some line in the source code. Locations may be
  5816. specified using three different formats: linespec locations, explicit
  5817. locations, or address locations.
  5818. 
  5819. File: gdb.info, Node: Linespec Locations, Next: Explicit Locations, Up: Specify Location
  5820. 9.2.1 Linespec Locations
  5821. ------------------------
  5822. A "linespec" is a colon-separated list of source location parameters
  5823. such as file name, function name, etc. Here are all the different ways
  5824. of specifying a linespec:
  5825. 'LINENUM'
  5826. Specifies the line number LINENUM of the current source file.
  5827. '-OFFSET'
  5828. '+OFFSET'
  5829. Specifies the line OFFSET lines before or after the "current line".
  5830. For the 'list' command, the current line is the last one printed;
  5831. for the breakpoint commands, this is the line at which execution
  5832. stopped in the currently selected "stack frame" (*note Frames:
  5833. Frames, for a description of stack frames.) When used as the
  5834. second of the two linespecs in a 'list' command, this specifies the
  5835. line OFFSET lines up or down from the first linespec.
  5836. 'FILENAME:LINENUM'
  5837. Specifies the line LINENUM in the source file FILENAME. If
  5838. FILENAME is a relative file name, then it will match any source
  5839. file name with the same trailing components. For example, if
  5840. FILENAME is 'gcc/expr.c', then it will match source file name of
  5841. '/build/trunk/gcc/expr.c', but not '/build/trunk/libcpp/expr.c' or
  5842. '/build/trunk/gcc/x-expr.c'.
  5843. 'FUNCTION'
  5844. Specifies the line that begins the body of the function FUNCTION.
  5845. For example, in C, this is the line with the open brace.
  5846. By default, in C++ and Ada, FUNCTION is interpreted as specifying
  5847. all functions named FUNCTION in all scopes. For C++, this means in
  5848. all namespaces and classes. For Ada, this means in all packages.
  5849. For example, assuming a program with C++ symbols named 'A::B::func'
  5850. and 'B::func', both commands 'break func' and 'break B::func' set a
  5851. breakpoint on both symbols.
  5852. Commands that accept a linespec let you override this with the
  5853. '-qualified' option. For example, 'break -qualified func' sets a
  5854. breakpoint on a free-function named 'func' ignoring any C++ class
  5855. methods and namespace functions called 'func'.
  5856. *Note Explicit Locations::.
  5857. 'FUNCTION:LABEL'
  5858. Specifies the line where LABEL appears in FUNCTION.
  5859. 'FILENAME:FUNCTION'
  5860. Specifies the line that begins the body of the function FUNCTION in
  5861. the file FILENAME. You only need the file name with a function
  5862. name to avoid ambiguity when there are identically named functions
  5863. in different source files.
  5864. 'LABEL'
  5865. Specifies the line at which the label named LABEL appears in the
  5866. function corresponding to the currently selected stack frame. If
  5867. there is no current selected stack frame (for instance, if the
  5868. inferior is not running), then GDB will not search for a label.
  5869. '-pstap|-probe-stap [OBJFILE:[PROVIDER:]]NAME'
  5870. The GNU/Linux tool 'SystemTap' provides a way for applications to
  5871. embed static probes. *Note Static Probe Points::, for more
  5872. information on finding and using static probes. This form of
  5873. linespec specifies the location of such a static probe.
  5874. If OBJFILE is given, only probes coming from that shared library or
  5875. executable matching OBJFILE as a regular expression are considered.
  5876. If PROVIDER is given, then only probes from that provider are
  5877. considered. If several probes match the spec, GDB will insert a
  5878. breakpoint at each one of those probes.
  5879. 
  5880. File: gdb.info, Node: Explicit Locations, Next: Address Locations, Prev: Linespec Locations, Up: Specify Location
  5881. 9.2.2 Explicit Locations
  5882. ------------------------
  5883. "Explicit locations" allow the user to directly specify the source
  5884. location's parameters using option-value pairs.
  5885. Explicit locations are useful when several functions, labels, or file
  5886. names have the same name (base name for files) in the program's sources.
  5887. In these cases, explicit locations point to the source line you meant
  5888. more accurately and unambiguously. Also, using explicit locations might
  5889. be faster in large programs.
  5890. For example, the linespec 'foo:bar' may refer to a function 'bar'
  5891. defined in the file named 'foo' or the label 'bar' in a function named
  5892. 'foo'. GDB must search either the file system or the symbol table to
  5893. know.
  5894. The list of valid explicit location options is summarized in the
  5895. following table:
  5896. '-source FILENAME'
  5897. The value specifies the source file name. To differentiate between
  5898. files with the same base name, prepend as many directories as is
  5899. necessary to uniquely identify the desired file, e.g.,
  5900. 'foo/bar/baz.c'. Otherwise GDB will use the first file it finds
  5901. with the given base name. This option requires the use of either
  5902. '-function' or '-line'.
  5903. '-function FUNCTION'
  5904. The value specifies the name of a function. Operations on function
  5905. locations unmodified by other options (such as '-label' or '-line')
  5906. refer to the line that begins the body of the function. In C, for
  5907. example, this is the line with the open brace.
  5908. By default, in C++ and Ada, FUNCTION is interpreted as specifying
  5909. all functions named FUNCTION in all scopes. For C++, this means in
  5910. all namespaces and classes. For Ada, this means in all packages.
  5911. For example, assuming a program with C++ symbols named 'A::B::func'
  5912. and 'B::func', both commands 'break -function func' and
  5913. 'break -function B::func' set a breakpoint on both symbols.
  5914. You can use the '-qualified' flag to override this (see below).
  5915. '-qualified'
  5916. This flag makes GDB interpret a function name specified with
  5917. '-function' as a complete fully-qualified name.
  5918. For example, assuming a C++ program with symbols named 'A::B::func'
  5919. and 'B::func', the 'break -qualified -function B::func' command
  5920. sets a breakpoint on 'B::func', only.
  5921. (Note: the '-qualified' option can precede a linespec as well
  5922. (*note Linespec Locations::), so the particular example above could
  5923. be simplified as 'break -qualified B::func'.)
  5924. '-label LABEL'
  5925. The value specifies the name of a label. When the function name is
  5926. not specified, the label is searched in the function of the
  5927. currently selected stack frame.
  5928. '-line NUMBER'
  5929. The value specifies a line offset for the location. The offset may
  5930. either be absolute ('-line 3') or relative ('-line +3'), depending
  5931. on the command. When specified without any other options, the line
  5932. offset is relative to the current line.
  5933. Explicit location options may be abbreviated by omitting any
  5934. non-unique trailing characters from the option name, e.g.,
  5935. 'break -s main.c -li 3'.
  5936. 
  5937. File: gdb.info, Node: Address Locations, Prev: Explicit Locations, Up: Specify Location
  5938. 9.2.3 Address Locations
  5939. -----------------------
  5940. "Address locations" indicate a specific program address. They have the
  5941. generalized form *ADDRESS.
  5942. For line-oriented commands, such as 'list' and 'edit', this specifies
  5943. a source line that contains ADDRESS. For 'break' and other
  5944. breakpoint-oriented commands, this can be used to set breakpoints in
  5945. parts of your program which do not have debugging information or source
  5946. files.
  5947. Here ADDRESS may be any expression valid in the current working
  5948. language (*note working language: Languages.) that specifies a code
  5949. address. In addition, as a convenience, GDB extends the semantics of
  5950. expressions used in locations to cover several situations that
  5951. frequently occur during debugging. Here are the various forms of
  5952. ADDRESS:
  5953. 'EXPRESSION'
  5954. Any expression valid in the current working language.
  5955. 'FUNCADDR'
  5956. An address of a function or procedure derived from its name. In C,
  5957. C++, Objective-C, Fortran, minimal, and assembly, this is simply
  5958. the function's name FUNCTION (and actually a special case of a
  5959. valid expression). In Pascal and Modula-2, this is '&FUNCTION'.
  5960. In Ada, this is 'FUNCTION'Address' (although the Pascal form also
  5961. works).
  5962. This form specifies the address of the function's first
  5963. instruction, before the stack frame and arguments have been set up.
  5964. ''FILENAME':FUNCADDR'
  5965. Like FUNCADDR above, but also specifies the name of the source file
  5966. explicitly. This is useful if the name of the function does not
  5967. specify the function unambiguously, e.g., if there are several
  5968. functions with identical names in different source files.
  5969. 
  5970. File: gdb.info, Node: Edit, Next: Search, Prev: Specify Location, Up: Source
  5971. 9.3 Editing Source Files
  5972. ========================
  5973. To edit the lines in a source file, use the 'edit' command. The editing
  5974. program of your choice is invoked with the current line set to the
  5975. active line in the program. Alternatively, there are several ways to
  5976. specify what part of the file you want to print if you want to see other
  5977. parts of the program:
  5978. 'edit LOCATION'
  5979. Edit the source file specified by 'location'. Editing starts at
  5980. that LOCATION, e.g., at the specified source line of the specified
  5981. file. *Note Specify Location::, for all the possible forms of the
  5982. LOCATION argument; here are the forms of the 'edit' command most
  5983. commonly used:
  5984. 'edit NUMBER'
  5985. Edit the current source file with NUMBER as the active line
  5986. number.
  5987. 'edit FUNCTION'
  5988. Edit the file containing FUNCTION at the beginning of its
  5989. definition.
  5990. 9.3.1 Choosing your Editor
  5991. --------------------------
  5992. You can customize GDB to use any editor you want (1). By default, it is
  5993. '/bin/ex', but you can change this by setting the environment variable
  5994. 'EDITOR' before using GDB. For example, to configure GDB to use the
  5995. 'vi' editor, you could use these commands with the 'sh' shell:
  5996. EDITOR=/usr/bin/vi
  5997. export EDITOR
  5998. gdb ...
  5999. or in the 'csh' shell,
  6000. setenv EDITOR /usr/bin/vi
  6001. gdb ...
  6002. ---------- Footnotes ----------
  6003. (1) The only restriction is that your editor (say 'ex'), recognizes
  6004. the following command-line syntax:
  6005. ex +NUMBER file
  6006. The optional numeric value +NUMBER specifies the number of the line
  6007. in the file where to start editing.
  6008. 
  6009. File: gdb.info, Node: Search, Next: Source Path, Prev: Edit, Up: Source
  6010. 9.4 Searching Source Files
  6011. ==========================
  6012. There are two commands for searching through the current source file for
  6013. a regular expression.
  6014. 'forward-search REGEXP'
  6015. 'search REGEXP'
  6016. The command 'forward-search REGEXP' checks each line, starting with
  6017. the one following the last line listed, for a match for REGEXP. It
  6018. lists the line that is found. You can use the synonym 'search
  6019. REGEXP' or abbreviate the command name as 'fo'.
  6020. 'reverse-search REGEXP'
  6021. The command 'reverse-search REGEXP' checks each line, starting with
  6022. the one before the last line listed and going backward, for a match
  6023. for REGEXP. It lists the line that is found. You can abbreviate
  6024. this command as 'rev'.
  6025. 
  6026. File: gdb.info, Node: Source Path, Next: Machine Code, Prev: Search, Up: Source
  6027. 9.5 Specifying Source Directories
  6028. =================================
  6029. Executable programs sometimes do not record the directories of the
  6030. source files from which they were compiled, just the names. Even when
  6031. they do, the directories could be moved between the compilation and your
  6032. debugging session. GDB has a list of directories to search for source
  6033. files; this is called the "source path". Each time GDB wants a source
  6034. file, it tries all the directories in the list, in the order they are
  6035. present in the list, until it finds a file with the desired name.
  6036. For example, suppose an executable references the file
  6037. '/usr/src/foo-1.0/lib/foo.c', does not record a compilation directory,
  6038. and the "source path" is '/mnt/cross'. GDB would look for the source
  6039. file in the following locations:
  6040. 1. '/usr/src/foo-1.0/lib/foo.c'
  6041. 2. '/mnt/cross/usr/src/foo-1.0/lib/foo.c'
  6042. 3. '/mnt/cross/foo.c'
  6043. If the source file is not present at any of the above locations then
  6044. an error is printed. GDB does not look up the parts of the source file
  6045. name, such as '/mnt/cross/src/foo-1.0/lib/foo.c'. Likewise, the
  6046. subdirectories of the source path are not searched: if the source path
  6047. is '/mnt/cross', and the binary refers to 'foo.c', GDB would not find it
  6048. under '/mnt/cross/usr/src/foo-1.0/lib'.
  6049. Plain file names, relative file names with leading directories, file
  6050. names containing dots, etc. are all treated as described above, except
  6051. that non-absolute file names are not looked up literally. If the
  6052. "source path" is '/mnt/cross', the source file is recorded as
  6053. '../lib/foo.c', and no compilation directory is recorded, then GDB will
  6054. search in the following locations:
  6055. 1. '/mnt/cross/../lib/foo.c'
  6056. 2. '/mnt/cross/foo.c'
  6057. The "source path" will always include two special entries '$cdir' and
  6058. '$cwd', these refer to the compilation directory (if one is recorded)
  6059. and the current working directory respectively.
  6060. '$cdir' causes GDB to search within the compilation directory, if one
  6061. is recorded in the debug information. If no compilation directory is
  6062. recorded in the debug information then '$cdir' is ignored.
  6063. '$cwd' is not the same as '.'--the former tracks the current working
  6064. directory as it changes during your GDB session, while the latter is
  6065. immediately expanded to the current directory at the time you add an
  6066. entry to the source path.
  6067. If a compilation directory is recorded in the debug information, and
  6068. GDB has not found the source file after the first search using "source
  6069. path", then GDB will combine the compilation directory and the filename,
  6070. and then search for the source file again using the "source path".
  6071. For example, if the executable records the source file as
  6072. '/usr/src/foo-1.0/lib/foo.c', the compilation directory is recorded as
  6073. '/project/build', and the "source path" is '/mnt/cross:$cdir:$cwd' while
  6074. the current working directory of the GDB session is '/home/user', then
  6075. GDB will search for the source file in the following locations:
  6076. 1. '/usr/src/foo-1.0/lib/foo.c'
  6077. 2. '/mnt/cross/usr/src/foo-1.0/lib/foo.c'
  6078. 3. '/project/build/usr/src/foo-1.0/lib/foo.c'
  6079. 4. '/home/user/usr/src/foo-1.0/lib/foo.c'
  6080. 5. '/mnt/cross/project/build/usr/src/foo-1.0/lib/foo.c'
  6081. 6. '/project/build/project/build/usr/src/foo-1.0/lib/foo.c'
  6082. 7. '/home/user/project/build/usr/src/foo-1.0/lib/foo.c'
  6083. 8. '/mnt/cross/foo.c'
  6084. 9. '/project/build/foo.c'
  6085. 10. '/home/user/foo.c'
  6086. If the file name in the previous example had been recorded in the
  6087. executable as a relative path rather than an absolute path, then the
  6088. first look up would not have occurred, but all of the remaining steps
  6089. would be similar.
  6090. When searching for source files on MS-DOS and MS-Windows, where
  6091. absolute paths start with a drive letter (e.g. 'C:/project/foo.c'), GDB
  6092. will remove the drive letter from the file name before appending it to a
  6093. search directory from "source path"; for instance if the executable
  6094. references the source file 'C:/project/foo.c' and "source path" is set
  6095. to 'D:/mnt/cross', then GDB will search in the following locations for
  6096. the source file:
  6097. 1. 'C:/project/foo.c'
  6098. 2. 'D:/mnt/cross/project/foo.c'
  6099. 3. 'D:/mnt/cross/foo.c'
  6100. Note that the executable search path is _not_ used to locate the
  6101. source files.
  6102. Whenever you reset or rearrange the source path, GDB clears out any
  6103. information it has cached about where source files are found and where
  6104. each line is in the file.
  6105. When you start GDB, its source path includes only '$cdir' and '$cwd',
  6106. in that order. To add other directories, use the 'directory' command.
  6107. The search path is used to find both program source files and GDB
  6108. script files (read using the '-command' option and 'source' command).
  6109. In addition to the source path, GDB provides a set of commands that
  6110. manage a list of source path substitution rules. A "substitution rule"
  6111. specifies how to rewrite source directories stored in the program's
  6112. debug information in case the sources were moved to a different
  6113. directory between compilation and debugging. A rule is made of two
  6114. strings, the first specifying what needs to be rewritten in the path,
  6115. and the second specifying how it should be rewritten. In *note set
  6116. substitute-path::, we name these two parts FROM and TO respectively.
  6117. GDB does a simple string replacement of FROM with TO at the start of the
  6118. directory part of the source file name, and uses that result instead of
  6119. the original file name to look up the sources.
  6120. Using the previous example, suppose the 'foo-1.0' tree has been moved
  6121. from '/usr/src' to '/mnt/cross', then you can tell GDB to replace
  6122. '/usr/src' in all source path names with '/mnt/cross'. The first lookup
  6123. will then be '/mnt/cross/foo-1.0/lib/foo.c' in place of the original
  6124. location of '/usr/src/foo-1.0/lib/foo.c'. To define a source path
  6125. substitution rule, use the 'set substitute-path' command (*note set
  6126. substitute-path::).
  6127. To avoid unexpected substitution results, a rule is applied only if
  6128. the FROM part of the directory name ends at a directory separator. For
  6129. instance, a rule substituting '/usr/source' into '/mnt/cross' will be
  6130. applied to '/usr/source/foo-1.0' but not to '/usr/sourceware/foo-2.0'.
  6131. And because the substitution is applied only at the beginning of the
  6132. directory name, this rule will not be applied to
  6133. '/root/usr/source/baz.c' either.
  6134. In many cases, you can achieve the same result using the 'directory'
  6135. command. However, 'set substitute-path' can be more efficient in the
  6136. case where the sources are organized in a complex tree with multiple
  6137. subdirectories. With the 'directory' command, you need to add each
  6138. subdirectory of your project. If you moved the entire tree while
  6139. preserving its internal organization, then 'set substitute-path' allows
  6140. you to direct the debugger to all the sources with one single command.
  6141. 'set substitute-path' is also more than just a shortcut command. The
  6142. source path is only used if the file at the original location no longer
  6143. exists. On the other hand, 'set substitute-path' modifies the debugger
  6144. behavior to look at the rewritten location instead. So, if for any
  6145. reason a source file that is not relevant to your executable is located
  6146. at the original location, a substitution rule is the only method
  6147. available to point GDB at the new location.
  6148. You can configure a default source path substitution rule by
  6149. configuring GDB with the '--with-relocated-sources=DIR' option. The DIR
  6150. should be the name of a directory under GDB's configured prefix (set
  6151. with '--prefix' or '--exec-prefix'), and directory names in debug
  6152. information under DIR will be adjusted automatically if the installed
  6153. GDB is moved to a new location. This is useful if GDB, libraries or
  6154. executables with debug information and corresponding source code are
  6155. being moved together.
  6156. 'directory DIRNAME ...'
  6157. 'dir DIRNAME ...'
  6158. Add directory DIRNAME to the front of the source path. Several
  6159. directory names may be given to this command, separated by ':' (';'
  6160. on MS-DOS and MS-Windows, where ':' usually appears as part of
  6161. absolute file names) or whitespace. You may specify a directory
  6162. that is already in the source path; this moves it forward, so GDB
  6163. searches it sooner.
  6164. The special strings '$cdir' (to refer to the compilation directory,
  6165. if one is recorded), and '$cwd' (to refer to the current working
  6166. directory) can also be included in the list of directories DIRNAME.
  6167. Though these will already be in the source path they will be moved
  6168. forward in the list so GDB searches them sooner.
  6169. 'directory'
  6170. Reset the source path to its default value ('$cdir:$cwd' on Unix
  6171. systems). This requires confirmation.
  6172. 'set directories PATH-LIST'
  6173. Set the source path to PATH-LIST. '$cdir:$cwd' are added if
  6174. missing.
  6175. 'show directories'
  6176. Print the source path: show which directories it contains.
  6177. 'set substitute-path FROM TO'
  6178. Define a source path substitution rule, and add it at the end of
  6179. the current list of existing substitution rules. If a rule with
  6180. the same FROM was already defined, then the old rule is also
  6181. deleted.
  6182. For example, if the file '/foo/bar/baz.c' was moved to
  6183. '/mnt/cross/baz.c', then the command
  6184. (gdb) set substitute-path /foo/bar /mnt/cross
  6185. will tell GDB to replace '/foo/bar' with '/mnt/cross', which will
  6186. allow GDB to find the file 'baz.c' even though it was moved.
  6187. In the case when more than one substitution rule have been defined,
  6188. the rules are evaluated one by one in the order where they have
  6189. been defined. The first one matching, if any, is selected to
  6190. perform the substitution.
  6191. For instance, if we had entered the following commands:
  6192. (gdb) set substitute-path /usr/src/include /mnt/include
  6193. (gdb) set substitute-path /usr/src /mnt/src
  6194. GDB would then rewrite '/usr/src/include/defs.h' into
  6195. '/mnt/include/defs.h' by using the first rule. However, it would
  6196. use the second rule to rewrite '/usr/src/lib/foo.c' into
  6197. '/mnt/src/lib/foo.c'.
  6198. 'unset substitute-path [path]'
  6199. If a path is specified, search the current list of substitution
  6200. rules for a rule that would rewrite that path. Delete that rule if
  6201. found. A warning is emitted by the debugger if no rule could be
  6202. found.
  6203. If no path is specified, then all substitution rules are deleted.
  6204. 'show substitute-path [path]'
  6205. If a path is specified, then print the source path substitution
  6206. rule which would rewrite that path, if any.
  6207. If no path is specified, then print all existing source path
  6208. substitution rules.
  6209. If your source path is cluttered with directories that are no longer
  6210. of interest, GDB may sometimes cause confusion by finding the wrong
  6211. versions of source. You can correct the situation as follows:
  6212. 1. Use 'directory' with no argument to reset the source path to its
  6213. default value.
  6214. 2. Use 'directory' with suitable arguments to reinstall the
  6215. directories you want in the source path. You can add all the
  6216. directories in one command.
  6217. 
  6218. File: gdb.info, Node: Machine Code, Prev: Source Path, Up: Source
  6219. 9.6 Source and Machine Code
  6220. ===========================
  6221. You can use the command 'info line' to map source lines to program
  6222. addresses (and vice versa), and the command 'disassemble' to display a
  6223. range of addresses as machine instructions. You can use the command
  6224. 'set disassemble-next-line' to set whether to disassemble next source
  6225. line when execution stops. When run under GNU Emacs mode, the 'info
  6226. line' command causes the arrow to point to the line specified. Also,
  6227. 'info line' prints addresses in symbolic form as well as hex.
  6228. 'info line'
  6229. 'info line LOCATION'
  6230. Print the starting and ending addresses of the compiled code for
  6231. source line LOCATION. You can specify source lines in any of the
  6232. ways documented in *note Specify Location::. With no LOCATION
  6233. information about the current source line is printed.
  6234. For example, we can use 'info line' to discover the location of the
  6235. object code for the first line of function 'm4_changequote':
  6236. (gdb) info line m4_changequote
  6237. Line 895 of "builtin.c" starts at pc 0x634c <m4_changequote> and \
  6238. ends at 0x6350 <m4_changequote+4>.
  6239. We can also inquire (using '*ADDR' as the form for LOCATION) what source
  6240. line covers a particular address:
  6241. (gdb) info line *0x63ff
  6242. Line 926 of "builtin.c" starts at pc 0x63e4 <m4_changequote+152> and \
  6243. ends at 0x6404 <m4_changequote+184>.
  6244. After 'info line', the default address for the 'x' command is changed
  6245. to the starting address of the line, so that 'x/i' is sufficient to
  6246. begin examining the machine code (*note Examining Memory: Memory.).
  6247. Also, this address is saved as the value of the convenience variable
  6248. '$_' (*note Convenience Variables: Convenience Vars.).
  6249. After 'info line', using 'info line' again without specifying a
  6250. location will display information about the next source line.
  6251. 'disassemble'
  6252. 'disassemble /m'
  6253. 'disassemble /s'
  6254. 'disassemble /r'
  6255. This specialized command dumps a range of memory as machine
  6256. instructions. It can also print mixed source+disassembly by
  6257. specifying the '/m' or '/s' modifier and print the raw instructions
  6258. in hex as well as in symbolic form by specifying the '/r' modifier.
  6259. The default memory range is the function surrounding the program
  6260. counter of the selected frame. A single argument to this command
  6261. is a program counter value; GDB dumps the function surrounding this
  6262. value. When two arguments are given, they should be separated by a
  6263. comma, possibly surrounded by whitespace. The arguments specify a
  6264. range of addresses to dump, in one of two forms:
  6265. 'START,END'
  6266. the addresses from START (inclusive) to END (exclusive)
  6267. 'START,+LENGTH'
  6268. the addresses from START (inclusive) to 'START+LENGTH'
  6269. (exclusive).
  6270. When 2 arguments are specified, the name of the function is also
  6271. printed (since there could be several functions in the given
  6272. range).
  6273. The argument(s) can be any expression yielding a numeric value,
  6274. such as '0x32c4', '&main+10' or '$pc - 8'.
  6275. If the range of memory being disassembled contains current program
  6276. counter, the instruction at that location is shown with a '=>'
  6277. marker.
  6278. The following example shows the disassembly of a range of addresses
  6279. of HP PA-RISC 2.0 code:
  6280. (gdb) disas 0x32c4, 0x32e4
  6281. Dump of assembler code from 0x32c4 to 0x32e4:
  6282. 0x32c4 <main+204>: addil 0,dp
  6283. 0x32c8 <main+208>: ldw 0x22c(sr0,r1),r26
  6284. 0x32cc <main+212>: ldil 0x3000,r31
  6285. 0x32d0 <main+216>: ble 0x3f8(sr4,r31)
  6286. 0x32d4 <main+220>: ldo 0(r31),rp
  6287. 0x32d8 <main+224>: addil -0x800,dp
  6288. 0x32dc <main+228>: ldo 0x588(r1),r26
  6289. 0x32e0 <main+232>: ldil 0x3000,r31
  6290. End of assembler dump.
  6291. Here is an example showing mixed source+assembly for Intel x86 with
  6292. '/m' or '/s', when the program is stopped just after function prologue
  6293. in a non-optimized function with no inline code.
  6294. (gdb) disas /m main
  6295. Dump of assembler code for function main:
  6296. 5 {
  6297. 0x08048330 <+0>: push %ebp
  6298. 0x08048331 <+1>: mov %esp,%ebp
  6299. 0x08048333 <+3>: sub $0x8,%esp
  6300. 0x08048336 <+6>: and $0xfffffff0,%esp
  6301. 0x08048339 <+9>: sub $0x10,%esp
  6302. 6 printf ("Hello.\n");
  6303. => 0x0804833c <+12>: movl $0x8048440,(%esp)
  6304. 0x08048343 <+19>: call 0x8048284 <puts@plt>
  6305. 7 return 0;
  6306. 8 }
  6307. 0x08048348 <+24>: mov $0x0,%eax
  6308. 0x0804834d <+29>: leave
  6309. 0x0804834e <+30>: ret
  6310. End of assembler dump.
  6311. The '/m' option is deprecated as its output is not useful when there
  6312. is either inlined code or re-ordered code. The '/s' option is the
  6313. preferred choice. Here is an example for AMD x86-64 showing the
  6314. difference between '/m' output and '/s' output. This example has one
  6315. inline function defined in a header file, and the code is compiled with
  6316. '-O2' optimization. Note how the '/m' output is missing the disassembly
  6317. of several instructions that are present in the '/s' output.
  6318. 'foo.h':
  6319. int
  6320. foo (int a)
  6321. {
  6322. if (a < 0)
  6323. return a * 2;
  6324. if (a == 0)
  6325. return 1;
  6326. return a + 10;
  6327. }
  6328. 'foo.c':
  6329. #include "foo.h"
  6330. volatile int x, y;
  6331. int
  6332. main ()
  6333. {
  6334. x = foo (y);
  6335. return 0;
  6336. }
  6337. (gdb) disas /m main
  6338. Dump of assembler code for function main:
  6339. 5 {
  6340. 6 x = foo (y);
  6341. 0x0000000000400400 <+0>: mov 0x200c2e(%rip),%eax # 0x601034 <y>
  6342. 0x0000000000400417 <+23>: mov %eax,0x200c13(%rip) # 0x601030 <x>
  6343. 7 return 0;
  6344. 8 }
  6345. 0x000000000040041d <+29>: xor %eax,%eax
  6346. 0x000000000040041f <+31>: retq
  6347. 0x0000000000400420 <+32>: add %eax,%eax
  6348. 0x0000000000400422 <+34>: jmp 0x400417 <main+23>
  6349. End of assembler dump.
  6350. (gdb) disas /s main
  6351. Dump of assembler code for function main:
  6352. foo.c:
  6353. 5 {
  6354. 6 x = foo (y);
  6355. 0x0000000000400400 <+0>: mov 0x200c2e(%rip),%eax # 0x601034 <y>
  6356. foo.h:
  6357. 4 if (a < 0)
  6358. 0x0000000000400406 <+6>: test %eax,%eax
  6359. 0x0000000000400408 <+8>: js 0x400420 <main+32>
  6360. 6 if (a == 0)
  6361. 7 return 1;
  6362. 8 return a + 10;
  6363. 0x000000000040040a <+10>: lea 0xa(%rax),%edx
  6364. 0x000000000040040d <+13>: test %eax,%eax
  6365. 0x000000000040040f <+15>: mov $0x1,%eax
  6366. 0x0000000000400414 <+20>: cmovne %edx,%eax
  6367. foo.c:
  6368. 6 x = foo (y);
  6369. 0x0000000000400417 <+23>: mov %eax,0x200c13(%rip) # 0x601030 <x>
  6370. 7 return 0;
  6371. 8 }
  6372. 0x000000000040041d <+29>: xor %eax,%eax
  6373. 0x000000000040041f <+31>: retq
  6374. foo.h:
  6375. 5 return a * 2;
  6376. 0x0000000000400420 <+32>: add %eax,%eax
  6377. 0x0000000000400422 <+34>: jmp 0x400417 <main+23>
  6378. End of assembler dump.
  6379. Here is another example showing raw instructions in hex for AMD
  6380. x86-64,
  6381. (gdb) disas /r 0x400281,+10
  6382. Dump of assembler code from 0x400281 to 0x40028b:
  6383. 0x0000000000400281: 38 36 cmp %dh,(%rsi)
  6384. 0x0000000000400283: 2d 36 34 2e 73 sub $0x732e3436,%eax
  6385. 0x0000000000400288: 6f outsl %ds:(%rsi),(%dx)
  6386. 0x0000000000400289: 2e 32 00 xor %cs:(%rax),%al
  6387. End of assembler dump.
  6388. Addresses cannot be specified as a location (*note Specify
  6389. Location::). So, for example, if you want to disassemble function 'bar'
  6390. in file 'foo.c', you must type 'disassemble 'foo.c'::bar' and not
  6391. 'disassemble foo.c:bar'.
  6392. Some architectures have more than one commonly-used set of
  6393. instruction mnemonics or other syntax.
  6394. For programs that were dynamically linked and use shared libraries,
  6395. instructions that call functions or branch to locations in the shared
  6396. libraries might show a seemingly bogus location--it's actually a
  6397. location of the relocation table. On some architectures, GDB might be
  6398. able to resolve these to actual function names.
  6399. 'set disassembler-options OPTION1[,OPTION2...]'
  6400. This command controls the passing of target specific information to
  6401. the disassembler. For a list of valid options, please refer to the
  6402. '-M'/'--disassembler-options' section of the 'objdump' manual
  6403. and/or the output of 'objdump --help' (*note objdump:
  6404. (binutils)objdump.). The default value is the empty string.
  6405. If it is necessary to specify more than one disassembler option,
  6406. then multiple options can be placed together into a comma separated
  6407. list. Currently this command is only supported on targets ARM,
  6408. MIPS, PowerPC and S/390.
  6409. 'show disassembler-options'
  6410. Show the current setting of the disassembler options.
  6411. 'set disassembly-flavor INSTRUCTION-SET'
  6412. Select the instruction set to use when disassembling the program
  6413. via the 'disassemble' or 'x/i' commands.
  6414. Currently this command is only defined for the Intel x86 family.
  6415. You can set INSTRUCTION-SET to either 'intel' or 'att'. The
  6416. default is 'att', the AT&T flavor used by default by Unix
  6417. assemblers for x86-based targets.
  6418. 'show disassembly-flavor'
  6419. Show the current setting of the disassembly flavor.
  6420. 'set disassemble-next-line'
  6421. 'show disassemble-next-line'
  6422. Control whether or not GDB will disassemble the next source line or
  6423. instruction when execution stops. If ON, GDB will display
  6424. disassembly of the next source line when execution of the program
  6425. being debugged stops. This is _in addition_ to displaying the
  6426. source line itself, which GDB always does if possible. If the next
  6427. source line cannot be displayed for some reason (e.g., if GDB
  6428. cannot find the source file, or there's no line info in the debug
  6429. info), GDB will display disassembly of the next _instruction_
  6430. instead of showing the next source line. If AUTO, GDB will display
  6431. disassembly of next instruction only if the source line cannot be
  6432. displayed. This setting causes GDB to display some feedback when
  6433. you step through a function with no line info or whose source file
  6434. is unavailable. The default is OFF, which means never display the
  6435. disassembly of the next line or instruction.
  6436. 
  6437. File: gdb.info, Node: Data, Next: Optimized Code, Prev: Source, Up: Top
  6438. 10 Examining Data
  6439. *****************
  6440. The usual way to examine data in your program is with the 'print'
  6441. command (abbreviated 'p'), or its synonym 'inspect'. It evaluates and
  6442. prints the value of an expression of the language your program is
  6443. written in (*note Using GDB with Different Languages: Languages.). It
  6444. may also print the expression using a Python-based pretty-printer (*note
  6445. Pretty Printing::).
  6446. 'print [[OPTIONS] --] EXPR'
  6447. 'print [[OPTIONS] --] /F EXPR'
  6448. EXPR is an expression (in the source language). By default the
  6449. value of EXPR is printed in a format appropriate to its data type;
  6450. you can choose a different format by specifying '/F', where F is a
  6451. letter specifying the format; see *note Output Formats: Output
  6452. Formats.
  6453. The 'print' command supports a number of options that allow
  6454. overriding relevant global print settings as set by 'set print'
  6455. subcommands:
  6456. '-address [on|off]'
  6457. Set printing of addresses. Related setting: *note set print
  6458. address::.
  6459. '-array [on|off]'
  6460. Pretty formatting of arrays. Related setting: *note set print
  6461. array::.
  6462. '-array-indexes [on|off]'
  6463. Set printing of array indexes. Related setting: *note set
  6464. print array-indexes::.
  6465. '-elements NUMBER-OF-ELEMENTS|unlimited'
  6466. Set limit on string chars or array elements to print. The
  6467. value 'unlimited' causes there to be no limit. Related
  6468. setting: *note set print elements::.
  6469. '-max-depth DEPTH|unlimited'
  6470. Set the threshold after which nested structures are replaced
  6471. with ellipsis. Related setting: *note set print max-depth::.
  6472. '-null-stop [on|off]'
  6473. Set printing of char arrays to stop at first null char.
  6474. Related setting: *note set print null-stop::.
  6475. '-object [on|off]'
  6476. Set printing C++ virtual function tables. Related setting:
  6477. *note set print object::.
  6478. '-pretty [on|off]'
  6479. Set pretty formatting of structures. Related setting: *note
  6480. set print pretty::.
  6481. '-raw-values [on|off]'
  6482. Set whether to print values in raw form, bypassing any
  6483. pretty-printers for that value. Related setting: *note set
  6484. print raw-values::.
  6485. '-repeats NUMBER-OF-REPEATS|unlimited'
  6486. Set threshold for repeated print elements. 'unlimited' causes
  6487. all elements to be individually printed. Related setting:
  6488. *note set print repeats::.
  6489. '-static-members [on|off]'
  6490. Set printing C++ static members. Related setting: *note set
  6491. print static-members::.
  6492. '-symbol [on|off]'
  6493. Set printing of symbol names when printing pointers. Related
  6494. setting: *note set print symbol::.
  6495. '-union [on|off]'
  6496. Set printing of unions interior to structures. Related
  6497. setting: *note set print union::.
  6498. '-vtbl [on|off]'
  6499. Set printing of C++ virtual function tables. Related setting:
  6500. *note set print vtbl::.
  6501. Because the 'print' command accepts arbitrary expressions which may
  6502. look like options (including abbreviations), if you specify any
  6503. command option, then you must use a double dash ('--') to mark the
  6504. end of option processing.
  6505. For example, this prints the value of the '-p' expression:
  6506. (gdb) print -p
  6507. While this repeats the last value in the value history (see below)
  6508. with the '-pretty' option in effect:
  6509. (gdb) print -p --
  6510. Here is an example including both on option and an expression:
  6511. (gdb) print -pretty -- *myptr
  6512. $1 = {
  6513. next = 0x0,
  6514. flags = {
  6515. sweet = 1,
  6516. sour = 1
  6517. },
  6518. meat = 0x54 "Pork"
  6519. }
  6520. 'print [OPTIONS]'
  6521. 'print [OPTIONS] /F'
  6522. If you omit EXPR, GDB displays the last value again (from the
  6523. "value history"; *note Value History: Value History.). This allows
  6524. you to conveniently inspect the same value in an alternative
  6525. format.
  6526. A more low-level way of examining data is with the 'x' command. It
  6527. examines data in memory at a specified address and prints it in a
  6528. specified format. *Note Examining Memory: Memory.
  6529. If you are interested in information about types, or about how the
  6530. fields of a struct or a class are declared, use the 'ptype EXP' command
  6531. rather than 'print'. *Note Examining the Symbol Table: Symbols.
  6532. Another way of examining values of expressions and type information
  6533. is through the Python extension command 'explore' (available only if the
  6534. GDB build is configured with '--with-python'). It offers an interactive
  6535. way to start at the highest level (or, the most abstract level) of the
  6536. data type of an expression (or, the data type itself) and explore all
  6537. the way down to leaf scalar values/fields embedded in the higher level
  6538. data types.
  6539. 'explore ARG'
  6540. ARG is either an expression (in the source language), or a type
  6541. visible in the current context of the program being debugged.
  6542. The working of the 'explore' command can be illustrated with an
  6543. example. If a data type 'struct ComplexStruct' is defined in your C
  6544. program as
  6545. struct SimpleStruct
  6546. {
  6547. int i;
  6548. double d;
  6549. };
  6550. struct ComplexStruct
  6551. {
  6552. struct SimpleStruct *ss_p;
  6553. int arr[10];
  6554. };
  6555. followed by variable declarations as
  6556. struct SimpleStruct ss = { 10, 1.11 };
  6557. struct ComplexStruct cs = { &ss, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } };
  6558. then, the value of the variable 'cs' can be explored using the 'explore'
  6559. command as follows.
  6560. (gdb) explore cs
  6561. The value of `cs' is a struct/class of type `struct ComplexStruct' with
  6562. the following fields:
  6563. ss_p = <Enter 0 to explore this field of type `struct SimpleStruct *'>
  6564. arr = <Enter 1 to explore this field of type `int [10]'>
  6565. Enter the field number of choice:
  6566. Since the fields of 'cs' are not scalar values, you are being prompted
  6567. to chose the field you want to explore. Let's say you choose the field
  6568. 'ss_p' by entering '0'. Then, since this field is a pointer, you will
  6569. be asked if it is pointing to a single value. From the declaration of
  6570. 'cs' above, it is indeed pointing to a single value, hence you enter
  6571. 'y'. If you enter 'n', then you will be asked if it were pointing to an
  6572. array of values, in which case this field will be explored as if it were
  6573. an array.
  6574. `cs.ss_p' is a pointer to a value of type `struct SimpleStruct'
  6575. Continue exploring it as a pointer to a single value [y/n]: y
  6576. The value of `*(cs.ss_p)' is a struct/class of type `struct
  6577. SimpleStruct' with the following fields:
  6578. i = 10 .. (Value of type `int')
  6579. d = 1.1100000000000001 .. (Value of type `double')
  6580. Press enter to return to parent value:
  6581. If the field 'arr' of 'cs' was chosen for exploration by entering '1'
  6582. earlier, then since it is as array, you will be prompted to enter the
  6583. index of the element in the array that you want to explore.
  6584. `cs.arr' is an array of `int'.
  6585. Enter the index of the element you want to explore in `cs.arr': 5
  6586. `(cs.arr)[5]' is a scalar value of type `int'.
  6587. (cs.arr)[5] = 4
  6588. Press enter to return to parent value:
  6589. In general, at any stage of exploration, you can go deeper towards
  6590. the leaf values by responding to the prompts appropriately, or hit the
  6591. return key to return to the enclosing data structure (the higher level
  6592. data structure).
  6593. Similar to exploring values, you can use the 'explore' command to
  6594. explore types. Instead of specifying a value (which is typically a
  6595. variable name or an expression valid in the current context of the
  6596. program being debugged), you specify a type name. If you consider the
  6597. same example as above, your can explore the type 'struct ComplexStruct'
  6598. by passing the argument 'struct ComplexStruct' to the 'explore' command.
  6599. (gdb) explore struct ComplexStruct
  6600. By responding to the prompts appropriately in the subsequent interactive
  6601. session, you can explore the type 'struct ComplexStruct' in a manner
  6602. similar to how the value 'cs' was explored in the above example.
  6603. The 'explore' command also has two sub-commands, 'explore value' and
  6604. 'explore type'. The former sub-command is a way to explicitly specify
  6605. that value exploration of the argument is being invoked, while the
  6606. latter is a way to explicitly specify that type exploration of the
  6607. argument is being invoked.
  6608. 'explore value EXPR'
  6609. This sub-command of 'explore' explores the value of the expression
  6610. EXPR (if EXPR is an expression valid in the current context of the
  6611. program being debugged). The behavior of this command is identical
  6612. to that of the behavior of the 'explore' command being passed the
  6613. argument EXPR.
  6614. 'explore type ARG'
  6615. This sub-command of 'explore' explores the type of ARG (if ARG is a
  6616. type visible in the current context of program being debugged), or
  6617. the type of the value/expression ARG (if ARG is an expression valid
  6618. in the current context of the program being debugged). If ARG is a
  6619. type, then the behavior of this command is identical to that of the
  6620. 'explore' command being passed the argument ARG. If ARG is an
  6621. expression, then the behavior of this command will be identical to
  6622. that of the 'explore' command being passed the type of ARG as the
  6623. argument.
  6624. * Menu:
  6625. * Expressions:: Expressions
  6626. * Ambiguous Expressions:: Ambiguous Expressions
  6627. * Variables:: Program variables
  6628. * Arrays:: Artificial arrays
  6629. * Output Formats:: Output formats
  6630. * Memory:: Examining memory
  6631. * Auto Display:: Automatic display
  6632. * Print Settings:: Print settings
  6633. * Pretty Printing:: Python pretty printing
  6634. * Value History:: Value history
  6635. * Convenience Vars:: Convenience variables
  6636. * Convenience Funs:: Convenience functions
  6637. * Registers:: Registers
  6638. * Floating Point Hardware:: Floating point hardware
  6639. * Vector Unit:: Vector Unit
  6640. * OS Information:: Auxiliary data provided by operating system
  6641. * Memory Region Attributes:: Memory region attributes
  6642. * Dump/Restore Files:: Copy between memory and a file
  6643. * Core File Generation:: Cause a program dump its core
  6644. * Character Sets:: Debugging programs that use a different
  6645. character set than GDB does
  6646. * Caching Target Data:: Data caching for targets
  6647. * Searching Memory:: Searching memory for a sequence of bytes
  6648. * Value Sizes:: Managing memory allocated for values
  6649. 
  6650. File: gdb.info, Node: Expressions, Next: Ambiguous Expressions, Up: Data
  6651. 10.1 Expressions
  6652. ================
  6653. 'print' and many other GDB commands accept an expression and compute its
  6654. value. Any kind of constant, variable or operator defined by the
  6655. programming language you are using is valid in an expression in GDB.
  6656. This includes conditional expressions, function calls, casts, and string
  6657. constants. It also includes preprocessor macros, if you compiled your
  6658. program to include this information; see *note Compilation::.
  6659. GDB supports array constants in expressions input by the user. The
  6660. syntax is {ELEMENT, ELEMENT...}. For example, you can use the command
  6661. 'print {1, 2, 3}' to create an array of three integers. If you pass an
  6662. array to a function or assign it to a program variable, GDB copies the
  6663. array to memory that is 'malloc'ed in the target program.
  6664. Because C is so widespread, most of the expressions shown in examples
  6665. in this manual are in C. *Note Using GDB with Different Languages:
  6666. Languages, for information on how to use expressions in other languages.
  6667. In this section, we discuss operators that you can use in GDB
  6668. expressions regardless of your programming language.
  6669. Casts are supported in all languages, not just in C, because it is so
  6670. useful to cast a number into a pointer in order to examine a structure
  6671. at that address in memory.
  6672. GDB supports these operators, in addition to those common to
  6673. programming languages:
  6674. '@'
  6675. '@' is a binary operator for treating parts of memory as arrays.
  6676. *Note Artificial Arrays: Arrays, for more information.
  6677. '::'
  6678. '::' allows you to specify a variable in terms of the file or
  6679. function where it is defined. *Note Program Variables: Variables.
  6680. '{TYPE} ADDR'
  6681. Refers to an object of type TYPE stored at address ADDR in memory.
  6682. The address ADDR may be any expression whose value is an integer or
  6683. pointer (but parentheses are required around binary operators, just
  6684. as in a cast). This construct is allowed regardless of what kind
  6685. of data is normally supposed to reside at ADDR.
  6686. 
  6687. File: gdb.info, Node: Ambiguous Expressions, Next: Variables, Prev: Expressions, Up: Data
  6688. 10.2 Ambiguous Expressions
  6689. ==========================
  6690. Expressions can sometimes contain some ambiguous elements. For
  6691. instance, some programming languages (notably Ada, C++ and Objective-C)
  6692. permit a single function name to be defined several times, for
  6693. application in different contexts. This is called "overloading".
  6694. Another example involving Ada is generics. A "generic package" is
  6695. similar to C++ templates and is typically instantiated several times,
  6696. resulting in the same function name being defined in different contexts.
  6697. In some cases and depending on the language, it is possible to adjust
  6698. the expression to remove the ambiguity. For instance in C++, you can
  6699. specify the signature of the function you want to break on, as in 'break
  6700. FUNCTION(TYPES)'. In Ada, using the fully qualified name of your
  6701. function often makes the expression unambiguous as well.
  6702. When an ambiguity that needs to be resolved is detected, the debugger
  6703. has the capability to display a menu of numbered choices for each
  6704. possibility, and then waits for the selection with the prompt '>'. The
  6705. first option is always '[0] cancel', and typing '0 <RET>' aborts the
  6706. current command. If the command in which the expression was used allows
  6707. more than one choice to be selected, the next option in the menu is '[1]
  6708. all', and typing '1 <RET>' selects all possible choices.
  6709. For example, the following session excerpt shows an attempt to set a
  6710. breakpoint at the overloaded symbol 'String::after'. We choose three
  6711. particular definitions of that function name:
  6712. (gdb) b String::after
  6713. [0] cancel
  6714. [1] all
  6715. [2] file:String.cc; line number:867
  6716. [3] file:String.cc; line number:860
  6717. [4] file:String.cc; line number:875
  6718. [5] file:String.cc; line number:853
  6719. [6] file:String.cc; line number:846
  6720. [7] file:String.cc; line number:735
  6721. > 2 4 6
  6722. Breakpoint 1 at 0xb26c: file String.cc, line 867.
  6723. Breakpoint 2 at 0xb344: file String.cc, line 875.
  6724. Breakpoint 3 at 0xafcc: file String.cc, line 846.
  6725. Multiple breakpoints were set.
  6726. Use the "delete" command to delete unwanted
  6727. breakpoints.
  6728. (gdb)
  6729. 'set multiple-symbols MODE'
  6730. This option allows you to adjust the debugger behavior when an
  6731. expression is ambiguous.
  6732. By default, MODE is set to 'all'. If the command with which the
  6733. expression is used allows more than one choice, then GDB
  6734. automatically selects all possible choices. For instance,
  6735. inserting a breakpoint on a function using an ambiguous name
  6736. results in a breakpoint inserted on each possible match. However,
  6737. if a unique choice must be made, then GDB uses the menu to help you
  6738. disambiguate the expression. For instance, printing the address of
  6739. an overloaded function will result in the use of the menu.
  6740. When MODE is set to 'ask', the debugger always uses the menu when
  6741. an ambiguity is detected.
  6742. Finally, when MODE is set to 'cancel', the debugger reports an
  6743. error due to the ambiguity and the command is aborted.
  6744. 'show multiple-symbols'
  6745. Show the current value of the 'multiple-symbols' setting.
  6746. 
  6747. File: gdb.info, Node: Variables, Next: Arrays, Prev: Ambiguous Expressions, Up: Data
  6748. 10.3 Program Variables
  6749. ======================
  6750. The most common kind of expression to use is the name of a variable in
  6751. your program.
  6752. Variables in expressions are understood in the selected stack frame
  6753. (*note Selecting a Frame: Selection.); they must be either:
  6754. * global (or file-static)
  6755. or
  6756. * visible according to the scope rules of the programming language
  6757. from the point of execution in that frame
  6758. This means that in the function
  6759. foo (a)
  6760. int a;
  6761. {
  6762. bar (a);
  6763. {
  6764. int b = test ();
  6765. bar (b);
  6766. }
  6767. }
  6768. you can examine and use the variable 'a' whenever your program is
  6769. executing within the function 'foo', but you can only use or examine the
  6770. variable 'b' while your program is executing inside the block where 'b'
  6771. is declared.
  6772. There is an exception: you can refer to a variable or function whose
  6773. scope is a single source file even if the current execution point is not
  6774. in this file. But it is possible to have more than one such variable or
  6775. function with the same name (in different source files). If that
  6776. happens, referring to that name has unpredictable effects. If you wish,
  6777. you can specify a static variable in a particular function or file by
  6778. using the colon-colon ('::') notation:
  6779. FILE::VARIABLE
  6780. FUNCTION::VARIABLE
  6781. Here FILE or FUNCTION is the name of the context for the static
  6782. VARIABLE. In the case of file names, you can use quotes to make sure
  6783. GDB parses the file name as a single word--for example, to print a
  6784. global value of 'x' defined in 'f2.c':
  6785. (gdb) p 'f2.c'::x
  6786. The '::' notation is normally used for referring to static variables,
  6787. since you typically disambiguate uses of local variables in functions by
  6788. selecting the appropriate frame and using the simple name of the
  6789. variable. However, you may also use this notation to refer to local
  6790. variables in frames enclosing the selected frame:
  6791. void
  6792. foo (int a)
  6793. {
  6794. if (a < 10)
  6795. bar (a);
  6796. else
  6797. process (a); /* Stop here */
  6798. }
  6799. int
  6800. bar (int a)
  6801. {
  6802. foo (a + 5);
  6803. }
  6804. For example, if there is a breakpoint at the commented line, here is
  6805. what you might see when the program stops after executing the call
  6806. 'bar(0)':
  6807. (gdb) p a
  6808. $1 = 10
  6809. (gdb) p bar::a
  6810. $2 = 5
  6811. (gdb) up 2
  6812. #2 0x080483d0 in foo (a=5) at foobar.c:12
  6813. (gdb) p a
  6814. $3 = 5
  6815. (gdb) p bar::a
  6816. $4 = 0
  6817. These uses of '::' are very rarely in conflict with the very similar
  6818. use of the same notation in C++. When they are in conflict, the C++
  6819. meaning takes precedence; however, this can be overridden by quoting the
  6820. file or function name with single quotes.
  6821. For example, suppose the program is stopped in a method of a class
  6822. that has a field named 'includefile', and there is also an include file
  6823. named 'includefile' that defines a variable, 'some_global'.
  6824. (gdb) p includefile
  6825. $1 = 23
  6826. (gdb) p includefile::some_global
  6827. A syntax error in expression, near `'.
  6828. (gdb) p 'includefile'::some_global
  6829. $2 = 27
  6830. _Warning:_ Occasionally, a local variable may appear to have the
  6831. wrong value at certain points in a function--just after entry to a
  6832. new scope, and just before exit.
  6833. You may see this problem when you are stepping by machine
  6834. instructions. This is because, on most machines, it takes more than one
  6835. instruction to set up a stack frame (including local variable
  6836. definitions); if you are stepping by machine instructions, variables may
  6837. appear to have the wrong values until the stack frame is completely
  6838. built. On exit, it usually also takes more than one machine instruction
  6839. to destroy a stack frame; after you begin stepping through that group of
  6840. instructions, local variable definitions may be gone.
  6841. This may also happen when the compiler does significant
  6842. optimizations. To be sure of always seeing accurate values, turn off
  6843. all optimization when compiling.
  6844. Another possible effect of compiler optimizations is to optimize
  6845. unused variables out of existence, or assign variables to registers (as
  6846. opposed to memory addresses). Depending on the support for such cases
  6847. offered by the debug info format used by the compiler, GDB might not be
  6848. able to display values for such local variables. If that happens, GDB
  6849. will print a message like this:
  6850. No symbol "foo" in current context.
  6851. To solve such problems, either recompile without optimizations, or
  6852. use a different debug info format, if the compiler supports several such
  6853. formats. *Note Compilation::, for more information on choosing compiler
  6854. options. *Note C and C++: C, for more information about debug info
  6855. formats that are best suited to C++ programs.
  6856. If you ask to print an object whose contents are unknown to GDB,
  6857. e.g., because its data type is not completely specified by the debug
  6858. information, GDB will say '<incomplete type>'. *Note incomplete type:
  6859. Symbols, for more about this.
  6860. If you try to examine or use the value of a (global) variable for
  6861. which GDB has no type information, e.g., because the program includes no
  6862. debug information, GDB displays an error message. *Note unknown type:
  6863. Symbols, for more about unknown types. If you cast the variable to its
  6864. declared type, GDB gets the variable's value using the cast-to type as
  6865. the variable's type. For example, in a C program:
  6866. (gdb) p var
  6867. 'var' has unknown type; cast it to its declared type
  6868. (gdb) p (float) var
  6869. $1 = 3.14
  6870. If you append '@entry' string to a function parameter name you get
  6871. its value at the time the function got called. If the value is not
  6872. available an error message is printed. Entry values are available only
  6873. with some compilers. Entry values are normally also printed at the
  6874. function parameter list according to *note set print entry-values::.
  6875. Breakpoint 1, d (i=30) at gdb.base/entry-value.c:29
  6876. 29 i++;
  6877. (gdb) next
  6878. 30 e (i);
  6879. (gdb) print i
  6880. $1 = 31
  6881. (gdb) print i@entry
  6882. $2 = 30
  6883. Strings are identified as arrays of 'char' values without specified
  6884. signedness. Arrays of either 'signed char' or 'unsigned char' get
  6885. printed as arrays of 1 byte sized integers. '-fsigned-char' or
  6886. '-funsigned-char' GCC options have no effect as GDB defines literal
  6887. string type '"char"' as 'char' without a sign. For program code
  6888. char var0[] = "A";
  6889. signed char var1[] = "A";
  6890. You get during debugging
  6891. (gdb) print var0
  6892. $1 = "A"
  6893. (gdb) print var1
  6894. $2 = {65 'A', 0 '\0'}
  6895. 
  6896. File: gdb.info, Node: Arrays, Next: Output Formats, Prev: Variables, Up: Data
  6897. 10.4 Artificial Arrays
  6898. ======================
  6899. It is often useful to print out several successive objects of the same
  6900. type in memory; a section of an array, or an array of dynamically
  6901. determined size for which only a pointer exists in the program.
  6902. You can do this by referring to a contiguous span of memory as an
  6903. "artificial array", using the binary operator '@'. The left operand of
  6904. '@' should be the first element of the desired array and be an
  6905. individual object. The right operand should be the desired length of
  6906. the array. The result is an array value whose elements are all of the
  6907. type of the left argument. The first element is actually the left
  6908. argument; the second element comes from bytes of memory immediately
  6909. following those that hold the first element, and so on. Here is an
  6910. example. If a program says
  6911. int *array = (int *) malloc (len * sizeof (int));
  6912. you can print the contents of 'array' with
  6913. p *array@len
  6914. The left operand of '@' must reside in memory. Array values made
  6915. with '@' in this way behave just like other arrays in terms of
  6916. subscripting, and are coerced to pointers when used in expressions.
  6917. Artificial arrays most often appear in expressions via the value history
  6918. (*note Value History: Value History.), after printing one out.
  6919. Another way to create an artificial array is to use a cast. This
  6920. re-interprets a value as if it were an array. The value need not be in
  6921. memory:
  6922. (gdb) p/x (short[2])0x12345678
  6923. $1 = {0x1234, 0x5678}
  6924. As a convenience, if you leave the array length out (as in
  6925. '(TYPE[])VALUE') GDB calculates the size to fill the value (as
  6926. 'sizeof(VALUE)/sizeof(TYPE)':
  6927. (gdb) p/x (short[])0x12345678
  6928. $2 = {0x1234, 0x5678}
  6929. Sometimes the artificial array mechanism is not quite enough; in
  6930. moderately complex data structures, the elements of interest may not
  6931. actually be adjacent--for example, if you are interested in the values
  6932. of pointers in an array. One useful work-around in this situation is to
  6933. use a convenience variable (*note Convenience Variables: Convenience
  6934. Vars.) as a counter in an expression that prints the first interesting
  6935. value, and then repeat that expression via <RET>. For instance, suppose
  6936. you have an array 'dtab' of pointers to structures, and you are
  6937. interested in the values of a field 'fv' in each structure. Here is an
  6938. example of what you might type:
  6939. set $i = 0
  6940. p dtab[$i++]->fv
  6941. <RET>
  6942. <RET>
  6943. ...
  6944. 
  6945. File: gdb.info, Node: Output Formats, Next: Memory, Prev: Arrays, Up: Data
  6946. 10.5 Output Formats
  6947. ===================
  6948. By default, GDB prints a value according to its data type. Sometimes
  6949. this is not what you want. For example, you might want to print a
  6950. number in hex, or a pointer in decimal. Or you might want to view data
  6951. in memory at a certain address as a character string or as an
  6952. instruction. To do these things, specify an "output format" when you
  6953. print a value.
  6954. The simplest use of output formats is to say how to print a value
  6955. already computed. This is done by starting the arguments of the 'print'
  6956. command with a slash and a format letter. The format letters supported
  6957. are:
  6958. 'x'
  6959. Regard the bits of the value as an integer, and print the integer
  6960. in hexadecimal.
  6961. 'd'
  6962. Print as integer in signed decimal.
  6963. 'u'
  6964. Print as integer in unsigned decimal.
  6965. 'o'
  6966. Print as integer in octal.
  6967. 't'
  6968. Print as integer in binary. The letter 't' stands for "two". (1)
  6969. 'a'
  6970. Print as an address, both absolute in hexadecimal and as an offset
  6971. from the nearest preceding symbol. You can use this format used to
  6972. discover where (in what function) an unknown address is located:
  6973. (gdb) p/a 0x54320
  6974. $3 = 0x54320 <_initialize_vx+396>
  6975. The command 'info symbol 0x54320' yields similar results. *Note
  6976. info symbol: Symbols.
  6977. 'c'
  6978. Regard as an integer and print it as a character constant. This
  6979. prints both the numerical value and its character representation.
  6980. The character representation is replaced with the octal escape
  6981. '\nnn' for characters outside the 7-bit ASCII range.
  6982. Without this format, GDB displays 'char', 'unsigned char', and
  6983. 'signed char' data as character constants. Single-byte members of
  6984. vectors are displayed as integer data.
  6985. 'f'
  6986. Regard the bits of the value as a floating point number and print
  6987. using typical floating point syntax.
  6988. 's'
  6989. Regard as a string, if possible. With this format, pointers to
  6990. single-byte data are displayed as null-terminated strings and
  6991. arrays of single-byte data are displayed as fixed-length strings.
  6992. Other values are displayed in their natural types.
  6993. Without this format, GDB displays pointers to and arrays of 'char',
  6994. 'unsigned char', and 'signed char' as strings. Single-byte members
  6995. of a vector are displayed as an integer array.
  6996. 'z'
  6997. Like 'x' formatting, the value is treated as an integer and printed
  6998. as hexadecimal, but leading zeros are printed to pad the value to
  6999. the size of the integer type.
  7000. 'r'
  7001. Print using the 'raw' formatting. By default, GDB will use a
  7002. Python-based pretty-printer, if one is available (*note Pretty
  7003. Printing::). This typically results in a higher-level display of
  7004. the value's contents. The 'r' format bypasses any Python
  7005. pretty-printer which might exist.
  7006. For example, to print the program counter in hex (*note Registers::),
  7007. type
  7008. p/x $pc
  7009. Note that no space is required before the slash; this is because command
  7010. names in GDB cannot contain a slash.
  7011. To reprint the last value in the value history with a different
  7012. format, you can use the 'print' command with just a format and no
  7013. expression. For example, 'p/x' reprints the last value in hex.
  7014. ---------- Footnotes ----------
  7015. (1) 'b' cannot be used because these format letters are also used
  7016. with the 'x' command, where 'b' stands for "byte"; see *note Examining
  7017. Memory: Memory.
  7018. 
  7019. File: gdb.info, Node: Memory, Next: Auto Display, Prev: Output Formats, Up: Data
  7020. 10.6 Examining Memory
  7021. =====================
  7022. You can use the command 'x' (for "examine") to examine memory in any of
  7023. several formats, independently of your program's data types.
  7024. 'x/NFU ADDR'
  7025. 'x ADDR'
  7026. 'x'
  7027. Use the 'x' command to examine memory.
  7028. N, F, and U are all optional parameters that specify how much memory
  7029. to display and how to format it; ADDR is an expression giving the
  7030. address where you want to start displaying memory. If you use defaults
  7031. for NFU, you need not type the slash '/'. Several commands set
  7032. convenient defaults for ADDR.
  7033. N, the repeat count
  7034. The repeat count is a decimal integer; the default is 1. It
  7035. specifies how much memory (counting by units U) to display. If a
  7036. negative number is specified, memory is examined backward from
  7037. ADDR.
  7038. F, the display format
  7039. The display format is one of the formats used by 'print' ('x', 'd',
  7040. 'u', 'o', 't', 'a', 'c', 'f', 's'), and in addition 'i' (for
  7041. machine instructions). The default is 'x' (hexadecimal) initially.
  7042. The default changes each time you use either 'x' or 'print'.
  7043. U, the unit size
  7044. The unit size is any of
  7045. 'b'
  7046. Bytes.
  7047. 'h'
  7048. Halfwords (two bytes).
  7049. 'w'
  7050. Words (four bytes). This is the initial default.
  7051. 'g'
  7052. Giant words (eight bytes).
  7053. Each time you specify a unit size with 'x', that size becomes the
  7054. default unit the next time you use 'x'. For the 'i' format, the
  7055. unit size is ignored and is normally not written. For the 's'
  7056. format, the unit size defaults to 'b', unless it is explicitly
  7057. given. Use 'x /hs' to display 16-bit char strings and 'x /ws' to
  7058. display 32-bit strings. The next use of 'x /s' will again display
  7059. 8-bit strings. Note that the results depend on the programming
  7060. language of the current compilation unit. If the language is C,
  7061. the 's' modifier will use the UTF-16 encoding while 'w' will use
  7062. UTF-32. The encoding is set by the programming language and cannot
  7063. be altered.
  7064. ADDR, starting display address
  7065. ADDR is the address where you want GDB to begin displaying memory.
  7066. The expression need not have a pointer value (though it may); it is
  7067. always interpreted as an integer address of a byte of memory.
  7068. *Note Expressions: Expressions, for more information on
  7069. expressions. The default for ADDR is usually just after the last
  7070. address examined--but several other commands also set the default
  7071. address: 'info breakpoints' (to the address of the last breakpoint
  7072. listed), 'info line' (to the starting address of a line), and
  7073. 'print' (if you use it to display a value from memory).
  7074. For example, 'x/3uh 0x54320' is a request to display three halfwords
  7075. ('h') of memory, formatted as unsigned decimal integers ('u'), starting
  7076. at address '0x54320'. 'x/4xw $sp' prints the four words ('w') of memory
  7077. above the stack pointer (here, '$sp'; *note Registers: Registers.) in
  7078. hexadecimal ('x').
  7079. You can also specify a negative repeat count to examine memory
  7080. backward from the given address. For example, 'x/-3uh 0x54320' prints
  7081. three halfwords ('h') at '0x54314', '0x54328', and '0x5431c'.
  7082. Since the letters indicating unit sizes are all distinct from the
  7083. letters specifying output formats, you do not have to remember whether
  7084. unit size or format comes first; either order works. The output
  7085. specifications '4xw' and '4wx' mean exactly the same thing. (However,
  7086. the count N must come first; 'wx4' does not work.)
  7087. Even though the unit size U is ignored for the formats 's' and 'i',
  7088. you might still want to use a count N; for example, '3i' specifies that
  7089. you want to see three machine instructions, including any operands. For
  7090. convenience, especially when used with the 'display' command, the 'i'
  7091. format also prints branch delay slot instructions, if any, beyond the
  7092. count specified, which immediately follow the last instruction that is
  7093. within the count. The command 'disassemble' gives an alternative way of
  7094. inspecting machine instructions; see *note Source and Machine Code:
  7095. Machine Code.
  7096. If a negative repeat count is specified for the formats 's' or 'i',
  7097. the command displays null-terminated strings or instructions before the
  7098. given address as many as the absolute value of the given number. For
  7099. the 'i' format, we use line number information in the debug info to
  7100. accurately locate instruction boundaries while disassembling backward.
  7101. If line info is not available, the command stops examining memory with
  7102. an error message.
  7103. All the defaults for the arguments to 'x' are designed to make it
  7104. easy to continue scanning memory with minimal specifications each time
  7105. you use 'x'. For example, after you have inspected three machine
  7106. instructions with 'x/3i ADDR', you can inspect the next seven with just
  7107. 'x/7'. If you use <RET> to repeat the 'x' command, the repeat count N
  7108. is used again; the other arguments default as for successive uses of
  7109. 'x'.
  7110. When examining machine instructions, the instruction at current
  7111. program counter is shown with a '=>' marker. For example:
  7112. (gdb) x/5i $pc-6
  7113. 0x804837f <main+11>: mov %esp,%ebp
  7114. 0x8048381 <main+13>: push %ecx
  7115. 0x8048382 <main+14>: sub $0x4,%esp
  7116. => 0x8048385 <main+17>: movl $0x8048460,(%esp)
  7117. 0x804838c <main+24>: call 0x80482d4 <puts@plt>
  7118. The addresses and contents printed by the 'x' command are not saved
  7119. in the value history because there is often too much of them and they
  7120. would get in the way. Instead, GDB makes these values available for
  7121. subsequent use in expressions as values of the convenience variables
  7122. '$_' and '$__'. After an 'x' command, the last address examined is
  7123. available for use in expressions in the convenience variable '$_'. The
  7124. contents of that address, as examined, are available in the convenience
  7125. variable '$__'.
  7126. If the 'x' command has a repeat count, the address and contents saved
  7127. are from the last memory unit printed; this is not the same as the last
  7128. address printed if several units were printed on the last line of
  7129. output.
  7130. Most targets have an addressable memory unit size of 8 bits. This
  7131. means that to each memory address are associated 8 bits of data. Some
  7132. targets, however, have other addressable memory unit sizes. Within GDB
  7133. and this document, the term "addressable memory unit" (or "memory unit"
  7134. for short) is used when explicitly referring to a chunk of data of that
  7135. size. The word "byte" is used to refer to a chunk of data of 8 bits,
  7136. regardless of the addressable memory unit size of the target. For most
  7137. systems, addressable memory unit is a synonym of byte.
  7138. When you are debugging a program running on a remote target machine
  7139. (*note Remote Debugging::), you may wish to verify the program's image
  7140. in the remote machine's memory against the executable file you
  7141. downloaded to the target. Or, on any target, you may want to check
  7142. whether the program has corrupted its own read-only sections. The
  7143. 'compare-sections' command is provided for such situations.
  7144. 'compare-sections [SECTION-NAME|-r]'
  7145. Compare the data of a loadable section SECTION-NAME in the
  7146. executable file of the program being debugged with the same section
  7147. in the target machine's memory, and report any mismatches. With no
  7148. arguments, compares all loadable sections. With an argument of
  7149. '-r', compares all loadable read-only sections.
  7150. Note: for remote targets, this command can be accelerated if the
  7151. target supports computing the CRC checksum of a block of memory
  7152. (*note qCRC packet::).
  7153. 
  7154. File: gdb.info, Node: Auto Display, Next: Print Settings, Prev: Memory, Up: Data
  7155. 10.7 Automatic Display
  7156. ======================
  7157. If you find that you want to print the value of an expression frequently
  7158. (to see how it changes), you might want to add it to the "automatic
  7159. display list" so that GDB prints its value each time your program stops.
  7160. Each expression added to the list is given a number to identify it; to
  7161. remove an expression from the list, you specify that number. The
  7162. automatic display looks like this:
  7163. 2: foo = 38
  7164. 3: bar[5] = (struct hack *) 0x3804
  7165. This display shows item numbers, expressions and their current values.
  7166. As with displays you request manually using 'x' or 'print', you can
  7167. specify the output format you prefer; in fact, 'display' decides whether
  7168. to use 'print' or 'x' depending your format specification--it uses 'x'
  7169. if you specify either the 'i' or 's' format, or a unit size; otherwise
  7170. it uses 'print'.
  7171. 'display EXPR'
  7172. Add the expression EXPR to the list of expressions to display each
  7173. time your program stops. *Note Expressions: Expressions.
  7174. 'display' does not repeat if you press <RET> again after using it.
  7175. 'display/FMT EXPR'
  7176. For FMT specifying only a display format and not a size or count,
  7177. add the expression EXPR to the auto-display list but arrange to
  7178. display it each time in the specified format FMT. *Note Output
  7179. Formats: Output Formats.
  7180. 'display/FMT ADDR'
  7181. For FMT 'i' or 's', or including a unit-size or a number of units,
  7182. add the expression ADDR as a memory address to be examined each
  7183. time your program stops. Examining means in effect doing 'x/FMT
  7184. ADDR'. *Note Examining Memory: Memory.
  7185. For example, 'display/i $pc' can be helpful, to see the machine
  7186. instruction about to be executed each time execution stops ('$pc' is a
  7187. common name for the program counter; *note Registers: Registers.).
  7188. 'undisplay DNUMS...'
  7189. 'delete display DNUMS...'
  7190. Remove items from the list of expressions to display. Specify the
  7191. numbers of the displays that you want affected with the command
  7192. argument DNUMS. It can be a single display number, one of the
  7193. numbers shown in the first field of the 'info display' display; or
  7194. it could be a range of display numbers, as in '2-4'.
  7195. 'undisplay' does not repeat if you press <RET> after using it.
  7196. (Otherwise you would just get the error 'No display number ...'.)
  7197. 'disable display DNUMS...'
  7198. Disable the display of item numbers DNUMS. A disabled display item
  7199. is not printed automatically, but is not forgotten. It may be
  7200. enabled again later. Specify the numbers of the displays that you
  7201. want affected with the command argument DNUMS. It can be a single
  7202. display number, one of the numbers shown in the first field of the
  7203. 'info display' display; or it could be a range of display numbers,
  7204. as in '2-4'.
  7205. 'enable display DNUMS...'
  7206. Enable display of item numbers DNUMS. It becomes effective once
  7207. again in auto display of its expression, until you specify
  7208. otherwise. Specify the numbers of the displays that you want
  7209. affected with the command argument DNUMS. It can be a single
  7210. display number, one of the numbers shown in the first field of the
  7211. 'info display' display; or it could be a range of display numbers,
  7212. as in '2-4'.
  7213. 'display'
  7214. Display the current values of the expressions on the list, just as
  7215. is done when your program stops.
  7216. 'info display'
  7217. Print the list of expressions previously set up to display
  7218. automatically, each one with its item number, but without showing
  7219. the values. This includes disabled expressions, which are marked
  7220. as such. It also includes expressions which would not be displayed
  7221. right now because they refer to automatic variables not currently
  7222. available.
  7223. If a display expression refers to local variables, then it does not
  7224. make sense outside the lexical context for which it was set up. Such an
  7225. expression is disabled when execution enters a context where one of its
  7226. variables is not defined. For example, if you give the command 'display
  7227. last_char' while inside a function with an argument 'last_char', GDB
  7228. displays this argument while your program continues to stop inside that
  7229. function. When it stops elsewhere--where there is no variable
  7230. 'last_char'--the display is disabled automatically. The next time your
  7231. program stops where 'last_char' is meaningful, you can enable the
  7232. display expression once again.
  7233. 
  7234. File: gdb.info, Node: Print Settings, Next: Pretty Printing, Prev: Auto Display, Up: Data
  7235. 10.8 Print Settings
  7236. ===================
  7237. GDB provides the following ways to control how arrays, structures, and
  7238. symbols are printed.
  7239. These settings are useful for debugging programs in any language:
  7240. 'set print address'
  7241. 'set print address on'
  7242. GDB prints memory addresses showing the location of stack traces,
  7243. structure values, pointer values, breakpoints, and so forth, even
  7244. when it also displays the contents of those addresses. The default
  7245. is 'on'. For example, this is what a stack frame display looks
  7246. like with 'set print address on':
  7247. (gdb) f
  7248. #0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>")
  7249. at input.c:530
  7250. 530 if (lquote != def_lquote)
  7251. 'set print address off'
  7252. Do not print addresses when displaying their contents. For
  7253. example, this is the same stack frame displayed with 'set print
  7254. address off':
  7255. (gdb) set print addr off
  7256. (gdb) f
  7257. #0 set_quotes (lq="<<", rq=">>") at input.c:530
  7258. 530 if (lquote != def_lquote)
  7259. You can use 'set print address off' to eliminate all machine
  7260. dependent displays from the GDB interface. For example, with
  7261. 'print address off', you should get the same text for backtraces on
  7262. all machines--whether or not they involve pointer arguments.
  7263. 'show print address'
  7264. Show whether or not addresses are to be printed.
  7265. When GDB prints a symbolic address, it normally prints the closest
  7266. earlier symbol plus an offset. If that symbol does not uniquely
  7267. identify the address (for example, it is a name whose scope is a single
  7268. source file), you may need to clarify. One way to do this is with 'info
  7269. line', for example 'info line *0x4537'. Alternately, you can set GDB to
  7270. print the source file and line number when it prints a symbolic address:
  7271. 'set print symbol-filename on'
  7272. Tell GDB to print the source file name and line number of a symbol
  7273. in the symbolic form of an address.
  7274. 'set print symbol-filename off'
  7275. Do not print source file name and line number of a symbol. This is
  7276. the default.
  7277. 'show print symbol-filename'
  7278. Show whether or not GDB will print the source file name and line
  7279. number of a symbol in the symbolic form of an address.
  7280. Another situation where it is helpful to show symbol filenames and
  7281. line numbers is when disassembling code; GDB shows you the line number
  7282. and source file that corresponds to each instruction.
  7283. Also, you may wish to see the symbolic form only if the address being
  7284. printed is reasonably close to the closest earlier symbol:
  7285. 'set print max-symbolic-offset MAX-OFFSET'
  7286. 'set print max-symbolic-offset unlimited'
  7287. Tell GDB to only display the symbolic form of an address if the
  7288. offset between the closest earlier symbol and the address is less
  7289. than MAX-OFFSET. The default is 'unlimited', which tells GDB to
  7290. always print the symbolic form of an address if any symbol precedes
  7291. it. Zero is equivalent to 'unlimited'.
  7292. 'show print max-symbolic-offset'
  7293. Ask how large the maximum offset is that GDB prints in a symbolic
  7294. address.
  7295. If you have a pointer and you are not sure where it points, try 'set
  7296. print symbol-filename on'. Then you can determine the name and source
  7297. file location of the variable where it points, using 'p/a POINTER'.
  7298. This interprets the address in symbolic form. For example, here GDB
  7299. shows that a variable 'ptt' points at another variable 't', defined in
  7300. 'hi2.c':
  7301. (gdb) set print symbol-filename on
  7302. (gdb) p/a ptt
  7303. $4 = 0xe008 <t in hi2.c>
  7304. _Warning:_ For pointers that point to a local variable, 'p/a' does
  7305. not show the symbol name and filename of the referent, even with
  7306. the appropriate 'set print' options turned on.
  7307. You can also enable '/a'-like formatting all the time using 'set
  7308. print symbol on':
  7309. 'set print symbol on'
  7310. Tell GDB to print the symbol corresponding to an address, if one
  7311. exists.
  7312. 'set print symbol off'
  7313. Tell GDB not to print the symbol corresponding to an address. In
  7314. this mode, GDB will still print the symbol corresponding to
  7315. pointers to functions. This is the default.
  7316. 'show print symbol'
  7317. Show whether GDB will display the symbol corresponding to an
  7318. address.
  7319. Other settings control how different kinds of objects are printed:
  7320. 'set print array'
  7321. 'set print array on'
  7322. Pretty print arrays. This format is more convenient to read, but
  7323. uses more space. The default is off.
  7324. 'set print array off'
  7325. Return to compressed format for arrays.
  7326. 'show print array'
  7327. Show whether compressed or pretty format is selected for displaying
  7328. arrays.
  7329. 'set print array-indexes'
  7330. 'set print array-indexes on'
  7331. Print the index of each element when displaying arrays. May be
  7332. more convenient to locate a given element in the array or quickly
  7333. find the index of a given element in that printed array. The
  7334. default is off.
  7335. 'set print array-indexes off'
  7336. Stop printing element indexes when displaying arrays.
  7337. 'show print array-indexes'
  7338. Show whether the index of each element is printed when displaying
  7339. arrays.
  7340. 'set print elements NUMBER-OF-ELEMENTS'
  7341. 'set print elements unlimited'
  7342. Set a limit on how many elements of an array GDB will print. If
  7343. GDB is printing a large array, it stops printing after it has
  7344. printed the number of elements set by the 'set print elements'
  7345. command. This limit also applies to the display of strings. When
  7346. GDB starts, this limit is set to 200. Setting NUMBER-OF-ELEMENTS
  7347. to 'unlimited' or zero means that the number of elements to print
  7348. is unlimited.
  7349. 'show print elements'
  7350. Display the number of elements of a large array that GDB will
  7351. print. If the number is 0, then the printing is unlimited.
  7352. 'set print frame-arguments VALUE'
  7353. This command allows to control how the values of arguments are
  7354. printed when the debugger prints a frame (*note Frames::). The
  7355. possible values are:
  7356. 'all'
  7357. The values of all arguments are printed.
  7358. 'scalars'
  7359. Print the value of an argument only if it is a scalar. The
  7360. value of more complex arguments such as arrays, structures,
  7361. unions, etc, is replaced by '...'. This is the default. Here
  7362. is an example where only scalar arguments are shown:
  7363. #1 0x08048361 in call_me (i=3, s=..., ss=0xbf8d508c, u=..., e=green)
  7364. at frame-args.c:23
  7365. 'none'
  7366. None of the argument values are printed. Instead, the value
  7367. of each argument is replaced by '...'. In this case, the
  7368. example above now becomes:
  7369. #1 0x08048361 in call_me (i=..., s=..., ss=..., u=..., e=...)
  7370. at frame-args.c:23
  7371. 'presence'
  7372. Only the presence of arguments is indicated by '...'. The
  7373. '...' are not printed for function without any arguments.
  7374. None of the argument names and values are printed. In this
  7375. case, the example above now becomes:
  7376. #1 0x08048361 in call_me (...) at frame-args.c:23
  7377. By default, only scalar arguments are printed. This command can be
  7378. used to configure the debugger to print the value of all arguments,
  7379. regardless of their type. However, it is often advantageous to not
  7380. print the value of more complex parameters. For instance, it
  7381. reduces the amount of information printed in each frame, making the
  7382. backtrace more readable. Also, it improves performance when
  7383. displaying Ada frames, because the computation of large arguments
  7384. can sometimes be CPU-intensive, especially in large applications.
  7385. Setting 'print frame-arguments' to 'scalars' (the default), 'none'
  7386. or 'presence' avoids this computation, thus speeding up the display
  7387. of each Ada frame.
  7388. 'show print frame-arguments'
  7389. Show how the value of arguments should be displayed when printing a
  7390. frame.
  7391. 'set print raw-frame-arguments on'
  7392. Print frame arguments in raw, non pretty-printed, form.
  7393. 'set print raw-frame-arguments off'
  7394. Print frame arguments in pretty-printed form, if there is a
  7395. pretty-printer for the value (*note Pretty Printing::), otherwise
  7396. print the value in raw form. This is the default.
  7397. 'show print raw-frame-arguments'
  7398. Show whether to print frame arguments in raw form.
  7399. 'set print entry-values VALUE'
  7400. Set printing of frame argument values at function entry. In some
  7401. cases GDB can determine the value of function argument which was
  7402. passed by the function caller, even if the value was modified
  7403. inside the called function and therefore is different. With
  7404. optimized code, the current value could be unavailable, but the
  7405. entry value may still be known.
  7406. The default value is 'default' (see below for its description).
  7407. Older GDB behaved as with the setting 'no'. Compilers not
  7408. supporting this feature will behave in the 'default' setting the
  7409. same way as with the 'no' setting.
  7410. This functionality is currently supported only by DWARF 2 debugging
  7411. format and the compiler has to produce 'DW_TAG_call_site' tags.
  7412. With GCC, you need to specify '-O -g' during compilation, to get
  7413. this information.
  7414. The VALUE parameter can be one of the following:
  7415. 'no'
  7416. Print only actual parameter values, never print values from
  7417. function entry point.
  7418. #0 equal (val=5)
  7419. #0 different (val=6)
  7420. #0 lost (val=<optimized out>)
  7421. #0 born (val=10)
  7422. #0 invalid (val=<optimized out>)
  7423. 'only'
  7424. Print only parameter values from function entry point. The
  7425. actual parameter values are never printed.
  7426. #0 equal (val@entry=5)
  7427. #0 different (val@entry=5)
  7428. #0 lost (val@entry=5)
  7429. #0 born (val@entry=<optimized out>)
  7430. #0 invalid (val@entry=<optimized out>)
  7431. 'preferred'
  7432. Print only parameter values from function entry point. If
  7433. value from function entry point is not known while the actual
  7434. value is known, print the actual value for such parameter.
  7435. #0 equal (val@entry=5)
  7436. #0 different (val@entry=5)
  7437. #0 lost (val@entry=5)
  7438. #0 born (val=10)
  7439. #0 invalid (val@entry=<optimized out>)
  7440. 'if-needed'
  7441. Print actual parameter values. If actual parameter value is
  7442. not known while value from function entry point is known,
  7443. print the entry point value for such parameter.
  7444. #0 equal (val=5)
  7445. #0 different (val=6)
  7446. #0 lost (val@entry=5)
  7447. #0 born (val=10)
  7448. #0 invalid (val=<optimized out>)
  7449. 'both'
  7450. Always print both the actual parameter value and its value
  7451. from function entry point, even if values of one or both are
  7452. not available due to compiler optimizations.
  7453. #0 equal (val=5, val@entry=5)
  7454. #0 different (val=6, val@entry=5)
  7455. #0 lost (val=<optimized out>, val@entry=5)
  7456. #0 born (val=10, val@entry=<optimized out>)
  7457. #0 invalid (val=<optimized out>, val@entry=<optimized out>)
  7458. 'compact'
  7459. Print the actual parameter value if it is known and also its
  7460. value from function entry point if it is known. If neither is
  7461. known, print for the actual value '<optimized out>'. If not
  7462. in MI mode (*note GDB/MI::) and if both values are known and
  7463. identical, print the shortened 'param=param@entry=VALUE'
  7464. notation.
  7465. #0 equal (val=val@entry=5)
  7466. #0 different (val=6, val@entry=5)
  7467. #0 lost (val@entry=5)
  7468. #0 born (val=10)
  7469. #0 invalid (val=<optimized out>)
  7470. 'default'
  7471. Always print the actual parameter value. Print also its value
  7472. from function entry point, but only if it is known. If not in
  7473. MI mode (*note GDB/MI::) and if both values are known and
  7474. identical, print the shortened 'param=param@entry=VALUE'
  7475. notation.
  7476. #0 equal (val=val@entry=5)
  7477. #0 different (val=6, val@entry=5)
  7478. #0 lost (val=<optimized out>, val@entry=5)
  7479. #0 born (val=10)
  7480. #0 invalid (val=<optimized out>)
  7481. For analysis messages on possible failures of frame argument values
  7482. at function entry resolution see *note set debug entry-values::.
  7483. 'show print entry-values'
  7484. Show the method being used for printing of frame argument values at
  7485. function entry.
  7486. 'set print frame-info VALUE'
  7487. This command allows to control the information printed when the
  7488. debugger prints a frame. See *note Frames::, *note Backtrace::,
  7489. for a general explanation about frames and frame information. Note
  7490. that some other settings (such as 'set print frame-arguments' and
  7491. 'set print address') are also influencing if and how some frame
  7492. information is displayed. In particular, the frame program counter
  7493. is never printed if 'set print address' is off.
  7494. The possible values for 'set print frame-info' are:
  7495. 'short-location'
  7496. Print the frame level, the program counter (if not at the
  7497. beginning of the location source line), the function, the
  7498. function arguments.
  7499. 'location'
  7500. Same as 'short-location' but also print the source file and
  7501. source line number.
  7502. 'location-and-address'
  7503. Same as 'location' but print the program counter even if
  7504. located at the beginning of the location source line.
  7505. 'source-line'
  7506. Print the program counter (if not at the beginning of the
  7507. location source line), the line number and the source line.
  7508. 'source-and-location'
  7509. Print what 'location' and 'source-line' are printing.
  7510. 'auto'
  7511. The information printed for a frame is decided automatically
  7512. by the GDB command that prints a frame. For example, 'frame'
  7513. prints the information printed by 'source-and-location' while
  7514. 'stepi' will switch between 'source-line' and
  7515. 'source-and-location' depending on the program counter. The
  7516. default value is 'auto'.
  7517. 'set print repeats NUMBER-OF-REPEATS'
  7518. 'set print repeats unlimited'
  7519. Set the threshold for suppressing display of repeated array
  7520. elements. When the number of consecutive identical elements of an
  7521. array exceeds the threshold, GDB prints the string '"<repeats N
  7522. times>"', where N is the number of identical repetitions, instead
  7523. of displaying the identical elements themselves. Setting the
  7524. threshold to 'unlimited' or zero will cause all elements to be
  7525. individually printed. The default threshold is 10.
  7526. 'show print repeats'
  7527. Display the current threshold for printing repeated identical
  7528. elements.
  7529. 'set print max-depth DEPTH'
  7530. 'set print max-depth unlimited'
  7531. Set the threshold after which nested structures are replaced with
  7532. ellipsis, this can make visualising deeply nested structures
  7533. easier.
  7534. For example, given this C code
  7535. typedef struct s1 { int a; } s1;
  7536. typedef struct s2 { s1 b; } s2;
  7537. typedef struct s3 { s2 c; } s3;
  7538. typedef struct s4 { s3 d; } s4;
  7539. s4 var = { { { { 3 } } } };
  7540. The following table shows how different values of DEPTH will effect
  7541. how 'var' is printed by GDB:
  7542. DEPTH setting Result of 'p var'
  7543. --------------------------------------------------------------------------
  7544. unlimited '$1 = {d = {c = {b = {a = 3}}}}'
  7545. '0' '$1 = {...}'
  7546. '1' '$1 = {d = {...}}'
  7547. '2' '$1 = {d = {c = {...}}}'
  7548. '3' '$1 = {d = {c = {b = {...}}}}'
  7549. '4' '$1 = {d = {c = {b = {a = 3}}}}'
  7550. To see the contents of structures that have been hidden the user
  7551. can either increase the print max-depth, or they can print the
  7552. elements of the structure that are visible, for example
  7553. (gdb) set print max-depth 2
  7554. (gdb) p var
  7555. $1 = {d = {c = {...}}}
  7556. (gdb) p var.d
  7557. $2 = {c = {b = {...}}}
  7558. (gdb) p var.d.c
  7559. $3 = {b = {a = 3}}
  7560. The pattern used to replace nested structures varies based on
  7561. language, for most languages '{...}' is used, but Fortran uses
  7562. '(...)'.
  7563. 'show print max-depth'
  7564. Display the current threshold after which nested structures are
  7565. replaces with ellipsis.
  7566. 'set print null-stop'
  7567. Cause GDB to stop printing the characters of an array when the
  7568. first NULL is encountered. This is useful when large arrays
  7569. actually contain only short strings. The default is off.
  7570. 'show print null-stop'
  7571. Show whether GDB stops printing an array on the first NULL
  7572. character.
  7573. 'set print pretty on'
  7574. Cause GDB to print structures in an indented format with one member
  7575. per line, like this:
  7576. $1 = {
  7577. next = 0x0,
  7578. flags = {
  7579. sweet = 1,
  7580. sour = 1
  7581. },
  7582. meat = 0x54 "Pork"
  7583. }
  7584. 'set print pretty off'
  7585. Cause GDB to print structures in a compact format, like this:
  7586. $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \
  7587. meat = 0x54 "Pork"}
  7588. This is the default format.
  7589. 'show print pretty'
  7590. Show which format GDB is using to print structures.
  7591. 'set print raw-values on'
  7592. Print values in raw form, without applying the pretty printers for
  7593. the value.
  7594. 'set print raw-values off'
  7595. Print values in pretty-printed form, if there is a pretty-printer
  7596. for the value (*note Pretty Printing::), otherwise print the value
  7597. in raw form.
  7598. The default setting is "off".
  7599. 'show print raw-values'
  7600. Show whether to print values in raw form.
  7601. 'set print sevenbit-strings on'
  7602. Print using only seven-bit characters; if this option is set, GDB
  7603. displays any eight-bit characters (in strings or character values)
  7604. using the notation '\'NNN. This setting is best if you are working
  7605. in English (ASCII) and you use the high-order bit of characters as
  7606. a marker or "meta" bit.
  7607. 'set print sevenbit-strings off'
  7608. Print full eight-bit characters. This allows the use of more
  7609. international character sets, and is the default.
  7610. 'show print sevenbit-strings'
  7611. Show whether or not GDB is printing only seven-bit characters.
  7612. 'set print union on'
  7613. Tell GDB to print unions which are contained in structures and
  7614. other unions. This is the default setting.
  7615. 'set print union off'
  7616. Tell GDB not to print unions which are contained in structures and
  7617. other unions. GDB will print '"{...}"' instead.
  7618. 'show print union'
  7619. Ask GDB whether or not it will print unions which are contained in
  7620. structures and other unions.
  7621. For example, given the declarations
  7622. typedef enum {Tree, Bug} Species;
  7623. typedef enum {Big_tree, Acorn, Seedling} Tree_forms;
  7624. typedef enum {Caterpillar, Cocoon, Butterfly}
  7625. Bug_forms;
  7626. struct thing {
  7627. Species it;
  7628. union {
  7629. Tree_forms tree;
  7630. Bug_forms bug;
  7631. } form;
  7632. };
  7633. struct thing foo = {Tree, {Acorn}};
  7634. with 'set print union on' in effect 'p foo' would print
  7635. $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}}
  7636. and with 'set print union off' in effect it would print
  7637. $1 = {it = Tree, form = {...}}
  7638. 'set print union' affects programs written in C-like languages and
  7639. in Pascal.
  7640. These settings are of interest when debugging C++ programs:
  7641. 'set print demangle'
  7642. 'set print demangle on'
  7643. Print C++ names in their source form rather than in the encoded
  7644. ("mangled") form passed to the assembler and linker for type-safe
  7645. linkage. The default is on.
  7646. 'show print demangle'
  7647. Show whether C++ names are printed in mangled or demangled form.
  7648. 'set print asm-demangle'
  7649. 'set print asm-demangle on'
  7650. Print C++ names in their source form rather than their mangled
  7651. form, even in assembler code printouts such as instruction
  7652. disassemblies. The default is off.
  7653. 'show print asm-demangle'
  7654. Show whether C++ names in assembly listings are printed in mangled
  7655. or demangled form.
  7656. 'set demangle-style STYLE'
  7657. Choose among several encoding schemes used by different compilers
  7658. to represent C++ names. If you omit STYLE, you will see a list of
  7659. possible formats. The default value is AUTO, which lets GDB choose
  7660. a decoding style by inspecting your program.
  7661. 'show demangle-style'
  7662. Display the encoding style currently in use for decoding C++
  7663. symbols.
  7664. 'set print object'
  7665. 'set print object on'
  7666. When displaying a pointer to an object, identify the _actual_
  7667. (derived) type of the object rather than the _declared_ type, using
  7668. the virtual function table. Note that the virtual function table
  7669. is required--this feature can only work for objects that have
  7670. run-time type identification; a single virtual method in the
  7671. object's declared type is sufficient. Note that this setting is
  7672. also taken into account when working with variable objects via MI
  7673. (*note GDB/MI::).
  7674. 'set print object off'
  7675. Display only the declared type of objects, without reference to the
  7676. virtual function table. This is the default setting.
  7677. 'show print object'
  7678. Show whether actual, or declared, object types are displayed.
  7679. 'set print static-members'
  7680. 'set print static-members on'
  7681. Print static members when displaying a C++ object. The default is
  7682. on.
  7683. 'set print static-members off'
  7684. Do not print static members when displaying a C++ object.
  7685. 'show print static-members'
  7686. Show whether C++ static members are printed or not.
  7687. 'set print pascal_static-members'
  7688. 'set print pascal_static-members on'
  7689. Print static members when displaying a Pascal object. The default
  7690. is on.
  7691. 'set print pascal_static-members off'
  7692. Do not print static members when displaying a Pascal object.
  7693. 'show print pascal_static-members'
  7694. Show whether Pascal static members are printed or not.
  7695. 'set print vtbl'
  7696. 'set print vtbl on'
  7697. Pretty print C++ virtual function tables. The default is off.
  7698. (The 'vtbl' commands do not work on programs compiled with the HP
  7699. ANSI C++ compiler ('aCC').)
  7700. 'set print vtbl off'
  7701. Do not pretty print C++ virtual function tables.
  7702. 'show print vtbl'
  7703. Show whether C++ virtual function tables are pretty printed, or
  7704. not.
  7705. 
  7706. File: gdb.info, Node: Pretty Printing, Next: Value History, Prev: Print Settings, Up: Data
  7707. 10.9 Pretty Printing
  7708. ====================
  7709. GDB provides a mechanism to allow pretty-printing of values using Python
  7710. code. It greatly simplifies the display of complex objects. This
  7711. mechanism works for both MI and the CLI.
  7712. * Menu:
  7713. * Pretty-Printer Introduction:: Introduction to pretty-printers
  7714. * Pretty-Printer Example:: An example pretty-printer
  7715. * Pretty-Printer Commands:: Pretty-printer commands
  7716. 
  7717. File: gdb.info, Node: Pretty-Printer Introduction, Next: Pretty-Printer Example, Up: Pretty Printing
  7718. 10.9.1 Pretty-Printer Introduction
  7719. ----------------------------------
  7720. When GDB prints a value, it first sees if there is a pretty-printer
  7721. registered for the value. If there is then GDB invokes the
  7722. pretty-printer to print the value. Otherwise the value is printed
  7723. normally.
  7724. Pretty-printers are normally named. This makes them easy to manage.
  7725. The 'info pretty-printer' command will list all the installed
  7726. pretty-printers with their names. If a pretty-printer can handle
  7727. multiple data types, then its "subprinters" are the printers for the
  7728. individual data types. Each such subprinter has its own name. The
  7729. format of the name is PRINTER-NAME;SUBPRINTER-NAME.
  7730. Pretty-printers are installed by "registering" them with GDB.
  7731. Typically they are automatically loaded and registered when the
  7732. corresponding debug information is loaded, thus making them available
  7733. without having to do anything special.
  7734. There are three places where a pretty-printer can be registered.
  7735. * Pretty-printers registered globally are available when debugging
  7736. all inferiors.
  7737. * Pretty-printers registered with a program space are available only
  7738. when debugging that program. *Note Progspaces In Python::, for
  7739. more details on program spaces in Python.
  7740. * Pretty-printers registered with an objfile are loaded and unloaded
  7741. with the corresponding objfile (e.g., shared library). *Note
  7742. Objfiles In Python::, for more details on objfiles in Python.
  7743. *Note Selecting Pretty-Printers::, for further information on how
  7744. pretty-printers are selected,
  7745. *Note Writing a Pretty-Printer::, for implementing pretty printers
  7746. for new types.
  7747. 
  7748. File: gdb.info, Node: Pretty-Printer Example, Next: Pretty-Printer Commands, Prev: Pretty-Printer Introduction, Up: Pretty Printing
  7749. 10.9.2 Pretty-Printer Example
  7750. -----------------------------
  7751. Here is how a C++ 'std::string' looks without a pretty-printer:
  7752. (gdb) print s
  7753. $1 = {
  7754. static npos = 4294967295,
  7755. _M_dataplus = {
  7756. <std::allocator<char>> = {
  7757. <__gnu_cxx::new_allocator<char>> = {
  7758. <No data fields>}, <No data fields>
  7759. },
  7760. members of std::basic_string<char, std::char_traits<char>,
  7761. std::allocator<char> >::_Alloc_hider:
  7762. _M_p = 0x804a014 "abcd"
  7763. }
  7764. }
  7765. With a pretty-printer for 'std::string' only the contents are
  7766. printed:
  7767. (gdb) print s
  7768. $2 = "abcd"
  7769. 
  7770. File: gdb.info, Node: Pretty-Printer Commands, Prev: Pretty-Printer Example, Up: Pretty Printing
  7771. 10.9.3 Pretty-Printer Commands
  7772. ------------------------------
  7773. 'info pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7774. Print the list of installed pretty-printers. This includes
  7775. disabled pretty-printers, which are marked as such.
  7776. OBJECT-REGEXP is a regular expression matching the objects whose
  7777. pretty-printers to list. Objects can be 'global', the program
  7778. space's file (*note Progspaces In Python::), and the object files
  7779. within that program space (*note Objfiles In Python::). *Note
  7780. Selecting Pretty-Printers::, for details on how GDB looks up a
  7781. printer from these three objects.
  7782. NAME-REGEXP is a regular expression matching the name of the
  7783. printers to list.
  7784. 'disable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7785. Disable pretty-printers matching OBJECT-REGEXP and NAME-REGEXP. A
  7786. disabled pretty-printer is not forgotten, it may be enabled again
  7787. later.
  7788. 'enable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7789. Enable pretty-printers matching OBJECT-REGEXP and NAME-REGEXP.
  7790. Example:
  7791. Suppose we have three pretty-printers installed: one from library1.so
  7792. named 'foo' that prints objects of type 'foo', and another from
  7793. library2.so named 'bar' that prints two types of objects, 'bar1' and
  7794. 'bar2'.
  7795. (gdb) info pretty-printer
  7796. library1.so:
  7797. foo
  7798. library2.so:
  7799. bar
  7800. bar1
  7801. bar2
  7802. (gdb) info pretty-printer library2
  7803. library2.so:
  7804. bar
  7805. bar1
  7806. bar2
  7807. (gdb) disable pretty-printer library1
  7808. 1 printer disabled
  7809. 2 of 3 printers enabled
  7810. (gdb) info pretty-printer
  7811. library1.so:
  7812. foo [disabled]
  7813. library2.so:
  7814. bar
  7815. bar1
  7816. bar2
  7817. (gdb) disable pretty-printer library2 bar;bar1
  7818. 1 printer disabled
  7819. 1 of 3 printers enabled
  7820. (gdb) info pretty-printer library2
  7821. library1.so:
  7822. foo [disabled]
  7823. library2.so:
  7824. bar
  7825. bar1 [disabled]
  7826. bar2
  7827. (gdb) disable pretty-printer library2 bar
  7828. 1 printer disabled
  7829. 0 of 3 printers enabled
  7830. (gdb) info pretty-printer library2
  7831. library1.so:
  7832. foo [disabled]
  7833. library2.so:
  7834. bar [disabled]
  7835. bar1 [disabled]
  7836. bar2
  7837. Note that for 'bar' the entire printer can be disabled, as can each
  7838. individual subprinter.
  7839. Printing values and frame arguments is done by default using the
  7840. enabled pretty printers.
  7841. The print option '-raw-values' and GDB setting 'set print raw-values'
  7842. (*note set print raw-values::) can be used to print values without
  7843. applying the enabled pretty printers.
  7844. Similarly, the backtrace option '-raw-frame-arguments' and GDB
  7845. setting 'set print raw-frame-arguments' (*note set print
  7846. raw-frame-arguments::) can be used to ignore the enabled pretty printers
  7847. when printing frame argument values.
  7848. 
  7849. File: gdb.info, Node: Value History, Next: Convenience Vars, Prev: Pretty Printing, Up: Data
  7850. 10.10 Value History
  7851. ===================
  7852. Values printed by the 'print' command are saved in the GDB "value
  7853. history". This allows you to refer to them in other expressions.
  7854. Values are kept until the symbol table is re-read or discarded (for
  7855. example with the 'file' or 'symbol-file' commands). When the symbol
  7856. table changes, the value history is discarded, since the values may
  7857. contain pointers back to the types defined in the symbol table.
  7858. The values printed are given "history numbers" by which you can refer
  7859. to them. These are successive integers starting with one. 'print'
  7860. shows you the history number assigned to a value by printing '$NUM = '
  7861. before the value; here NUM is the history number.
  7862. To refer to any previous value, use '$' followed by the value's
  7863. history number. The way 'print' labels its output is designed to remind
  7864. you of this. Just '$' refers to the most recent value in the history,
  7865. and '$$' refers to the value before that. '$$N' refers to the Nth value
  7866. from the end; '$$2' is the value just prior to '$$', '$$1' is equivalent
  7867. to '$$', and '$$0' is equivalent to '$'.
  7868. For example, suppose you have just printed a pointer to a structure
  7869. and want to see the contents of the structure. It suffices to type
  7870. p *$
  7871. If you have a chain of structures where the component 'next' points
  7872. to the next one, you can print the contents of the next one with this:
  7873. p *$.next
  7874. You can print successive links in the chain by repeating this
  7875. command--which you can do by just typing <RET>.
  7876. Note that the history records values, not expressions. If the value
  7877. of 'x' is 4 and you type these commands:
  7878. print x
  7879. set x=5
  7880. then the value recorded in the value history by the 'print' command
  7881. remains 4 even though the value of 'x' has changed.
  7882. 'show values'
  7883. Print the last ten values in the value history, with their item
  7884. numbers. This is like 'p $$9' repeated ten times, except that
  7885. 'show values' does not change the history.
  7886. 'show values N'
  7887. Print ten history values centered on history item number N.
  7888. 'show values +'
  7889. Print ten history values just after the values last printed. If no
  7890. more values are available, 'show values +' produces no display.
  7891. Pressing <RET> to repeat 'show values N' has exactly the same effect
  7892. as 'show values +'.
  7893. 
  7894. File: gdb.info, Node: Convenience Vars, Next: Convenience Funs, Prev: Value History, Up: Data
  7895. 10.11 Convenience Variables
  7896. ===========================
  7897. GDB provides "convenience variables" that you can use within GDB to hold
  7898. on to a value and refer to it later. These variables exist entirely
  7899. within GDB; they are not part of your program, and setting a convenience
  7900. variable has no direct effect on further execution of your program.
  7901. That is why you can use them freely.
  7902. Convenience variables are prefixed with '$'. Any name preceded by
  7903. '$' can be used for a convenience variable, unless it is one of the
  7904. predefined machine-specific register names (*note Registers:
  7905. Registers.). (Value history references, in contrast, are _numbers_
  7906. preceded by '$'. *Note Value History: Value History.)
  7907. You can save a value in a convenience variable with an assignment
  7908. expression, just as you would set a variable in your program. For
  7909. example:
  7910. set $foo = *object_ptr
  7911. would save in '$foo' the value contained in the object pointed to by
  7912. 'object_ptr'.
  7913. Using a convenience variable for the first time creates it, but its
  7914. value is 'void' until you assign a new value. You can alter the value
  7915. with another assignment at any time.
  7916. Convenience variables have no fixed types. You can assign a
  7917. convenience variable any type of value, including structures and arrays,
  7918. even if that variable already has a value of a different type. The
  7919. convenience variable, when used as an expression, has the type of its
  7920. current value.
  7921. 'show convenience'
  7922. Print a list of convenience variables used so far, and their
  7923. values, as well as a list of the convenience functions.
  7924. Abbreviated 'show conv'.
  7925. 'init-if-undefined $VARIABLE = EXPRESSION'
  7926. Set a convenience variable if it has not already been set. This is
  7927. useful for user-defined commands that keep some state. It is
  7928. similar, in concept, to using local static variables with
  7929. initializers in C (except that convenience variables are global).
  7930. It can also be used to allow users to override default values used
  7931. in a command script.
  7932. If the variable is already defined then the expression is not
  7933. evaluated so any side-effects do not occur.
  7934. One of the ways to use a convenience variable is as a counter to be
  7935. incremented or a pointer to be advanced. For example, to print a field
  7936. from successive elements of an array of structures:
  7937. set $i = 0
  7938. print bar[$i++]->contents
  7939. Repeat that command by typing <RET>.
  7940. Some convenience variables are created automatically by GDB and given
  7941. values likely to be useful.
  7942. '$_'
  7943. The variable '$_' is automatically set by the 'x' command to the
  7944. last address examined (*note Examining Memory: Memory.). Other
  7945. commands which provide a default address for 'x' to examine also
  7946. set '$_' to that address; these commands include 'info line' and
  7947. 'info breakpoint'. The type of '$_' is 'void *' except when set by
  7948. the 'x' command, in which case it is a pointer to the type of
  7949. '$__'.
  7950. '$__'
  7951. The variable '$__' is automatically set by the 'x' command to the
  7952. value found in the last address examined. Its type is chosen to
  7953. match the format in which the data was printed.
  7954. '$_exitcode'
  7955. When the program being debugged terminates normally, GDB
  7956. automatically sets this variable to the exit code of the program,
  7957. and resets '$_exitsignal' to 'void'.
  7958. '$_exitsignal'
  7959. When the program being debugged dies due to an uncaught signal, GDB
  7960. automatically sets this variable to that signal's number, and
  7961. resets '$_exitcode' to 'void'.
  7962. To distinguish between whether the program being debugged has
  7963. exited (i.e., '$_exitcode' is not 'void') or signalled (i.e.,
  7964. '$_exitsignal' is not 'void'), the convenience function '$_isvoid'
  7965. can be used (*note Convenience Functions: Convenience Funs.). For
  7966. example, considering the following source code:
  7967. #include <signal.h>
  7968. int
  7969. main (int argc, char *argv[])
  7970. {
  7971. raise (SIGALRM);
  7972. return 0;
  7973. }
  7974. A valid way of telling whether the program being debugged has
  7975. exited or signalled would be:
  7976. (gdb) define has_exited_or_signalled
  7977. Type commands for definition of ``has_exited_or_signalled''.
  7978. End with a line saying just ``end''.
  7979. >if $_isvoid ($_exitsignal)
  7980. >echo The program has exited\n
  7981. >else
  7982. >echo The program has signalled\n
  7983. >end
  7984. >end
  7985. (gdb) run
  7986. Starting program:
  7987. Program terminated with signal SIGALRM, Alarm clock.
  7988. The program no longer exists.
  7989. (gdb) has_exited_or_signalled
  7990. The program has signalled
  7991. As can be seen, GDB correctly informs that the program being
  7992. debugged has signalled, since it calls 'raise' and raises a
  7993. 'SIGALRM' signal. If the program being debugged had not called
  7994. 'raise', then GDB would report a normal exit:
  7995. (gdb) has_exited_or_signalled
  7996. The program has exited
  7997. '$_exception'
  7998. The variable '$_exception' is set to the exception object being
  7999. thrown at an exception-related catchpoint. *Note Set
  8000. Catchpoints::.
  8001. '$_ada_exception'
  8002. The variable '$_ada_exception' is set to the address of the
  8003. exception being caught or thrown at an Ada exception-related
  8004. catchpoint. *Note Set Catchpoints::.
  8005. '$_probe_argc'
  8006. '$_probe_arg0...$_probe_arg11'
  8007. Arguments to a static probe. *Note Static Probe Points::.
  8008. '$_sdata'
  8009. The variable '$_sdata' contains extra collected static tracepoint
  8010. data. *Note Tracepoint Action Lists: Tracepoint Actions. Note
  8011. that '$_sdata' could be empty, if not inspecting a trace buffer, or
  8012. if extra static tracepoint data has not been collected.
  8013. '$_siginfo'
  8014. The variable '$_siginfo' contains extra signal information (*note
  8015. extra signal information::). Note that '$_siginfo' could be empty,
  8016. if the application has not yet received any signals. For example,
  8017. it will be empty before you execute the 'run' command.
  8018. '$_tlb'
  8019. The variable '$_tlb' is automatically set when debugging
  8020. applications running on MS-Windows in native mode or connected to
  8021. gdbserver that supports the 'qGetTIBAddr' request. *Note General
  8022. Query Packets::. This variable contains the address of the thread
  8023. information block.
  8024. '$_inferior'
  8025. The number of the current inferior. *Note Debugging Multiple
  8026. Inferiors and Programs: Inferiors and Programs.
  8027. '$_thread'
  8028. The thread number of the current thread. *Note thread numbers::.
  8029. '$_gthread'
  8030. The global number of the current thread. *Note global thread
  8031. numbers::.
  8032. '$_gdb_major'
  8033. '$_gdb_minor'
  8034. The major and minor version numbers of the running GDB.
  8035. Development snapshots and pretest versions have their minor version
  8036. incremented by one; thus, GDB pretest 9.11.90 will produce the
  8037. value 12 for '$_gdb_minor'. These variables allow you to write
  8038. scripts that work with different versions of GDB without errors
  8039. caused by features unavailable in some of those versions.
  8040. '$_shell_exitcode'
  8041. '$_shell_exitsignal'
  8042. GDB commands such as 'shell' and '|' are launching shell commands.
  8043. When a launched command terminates, GDB automatically maintains the
  8044. variables '$_shell_exitcode' and '$_shell_exitsignal' according to
  8045. the exit status of the last launched command. These variables are
  8046. set and used similarly to the variables '$_exitcode' and
  8047. '$_exitsignal'.
  8048. 
  8049. File: gdb.info, Node: Convenience Funs, Next: Registers, Prev: Convenience Vars, Up: Data
  8050. 10.12 Convenience Functions
  8051. ===========================
  8052. GDB also supplies some "convenience functions". These have a syntax
  8053. similar to convenience variables. A convenience function can be used in
  8054. an expression just like an ordinary function; however, a convenience
  8055. function is implemented internally to GDB.
  8056. These functions do not require GDB to be configured with 'Python'
  8057. support, which means that they are always available.
  8058. '$_isvoid (EXPR)'
  8059. Return one if the expression EXPR is 'void'. Otherwise it returns
  8060. zero.
  8061. A 'void' expression is an expression where the type of the result
  8062. is 'void'. For example, you can examine a convenience variable
  8063. (see *note Convenience Variables: Convenience Vars.) to check
  8064. whether it is 'void':
  8065. (gdb) print $_exitcode
  8066. $1 = void
  8067. (gdb) print $_isvoid ($_exitcode)
  8068. $2 = 1
  8069. (gdb) run
  8070. Starting program: ./a.out
  8071. [Inferior 1 (process 29572) exited normally]
  8072. (gdb) print $_exitcode
  8073. $3 = 0
  8074. (gdb) print $_isvoid ($_exitcode)
  8075. $4 = 0
  8076. In the example above, we used '$_isvoid' to check whether
  8077. '$_exitcode' is 'void' before and after the execution of the
  8078. program being debugged. Before the execution there is no exit code
  8079. to be examined, therefore '$_exitcode' is 'void'. After the
  8080. execution the program being debugged returned zero, therefore
  8081. '$_exitcode' is zero, which means that it is not 'void' anymore.
  8082. The 'void' expression can also be a call of a function from the
  8083. program being debugged. For example, given the following function:
  8084. void
  8085. foo (void)
  8086. {
  8087. }
  8088. The result of calling it inside GDB is 'void':
  8089. (gdb) print foo ()
  8090. $1 = void
  8091. (gdb) print $_isvoid (foo ())
  8092. $2 = 1
  8093. (gdb) set $v = foo ()
  8094. (gdb) print $v
  8095. $3 = void
  8096. (gdb) print $_isvoid ($v)
  8097. $4 = 1
  8098. '$_gdb_setting_str (SETTING)'
  8099. Return the value of the GDB SETTING as a string. SETTING is any
  8100. setting that can be used in a 'set' or 'show' command (*note
  8101. Controlling GDB::).
  8102. (gdb) show print frame-arguments
  8103. Printing of non-scalar frame arguments is "scalars".
  8104. (gdb) p $_gdb_setting_str("print frame-arguments")
  8105. $1 = "scalars"
  8106. (gdb) p $_gdb_setting_str("height")
  8107. $2 = "30"
  8108. (gdb)
  8109. '$_gdb_setting (SETTING)'
  8110. Return the value of the GDB SETTING. The type of the returned
  8111. value depends on the setting.
  8112. The value type for boolean and auto boolean settings is 'int'. The
  8113. boolean values 'off' and 'on' are converted to the integer values
  8114. '0' and '1'. The value 'auto' is converted to the value '-1'.
  8115. The value type for integer settings is either 'unsigned int' or
  8116. 'int', depending on the setting.
  8117. Some integer settings accept an 'unlimited' value. Depending on
  8118. the setting, the 'set' command also accepts the value '0' or the
  8119. value '-1' as a synonym for 'unlimited'. For example, 'set height
  8120. unlimited' is equivalent to 'set height 0'.
  8121. Some other settings that accept the 'unlimited' value use the value
  8122. '0' to literally mean zero. For example, 'set history size 0'
  8123. indicates to not record any GDB commands in the command history.
  8124. For such settings, '-1' is the synonym for 'unlimited'.
  8125. See the documentation of the corresponding 'set' command for the
  8126. numerical value equivalent to 'unlimited'.
  8127. The '$_gdb_setting' function converts the unlimited value to a '0'
  8128. or a '-1' value according to what the 'set' command uses.
  8129. (gdb) p $_gdb_setting_str("height")
  8130. $1 = "30"
  8131. (gdb) p $_gdb_setting("height")
  8132. $2 = 30
  8133. (gdb) set height unlimited
  8134. (gdb) p $_gdb_setting_str("height")
  8135. $3 = "unlimited"
  8136. (gdb) p $_gdb_setting("height")
  8137. $4 = 0
  8138. (gdb) p $_gdb_setting_str("history size")
  8139. $5 = "unlimited"
  8140. (gdb) p $_gdb_setting("history size")
  8141. $6 = -1
  8142. (gdb) p $_gdb_setting_str("disassemble-next-line")
  8143. $7 = "auto"
  8144. (gdb) p $_gdb_setting("disassemble-next-line")
  8145. $8 = -1
  8146. (gdb)
  8147. Other setting types (enum, filename, optional filename, string,
  8148. string noescape) are returned as string values.
  8149. '$_gdb_maint_setting_str (SETTING)'
  8150. Like the '$_gdb_setting_str' function, but works with 'maintenance
  8151. set' variables.
  8152. '$_gdb_maint_setting (SETTING)'
  8153. Like the '$_gdb_setting' function, but works with 'maintenance set'
  8154. variables.
  8155. The following functions require GDB to be configured with 'Python'
  8156. support.
  8157. '$_memeq(BUF1, BUF2, LENGTH)'
  8158. Returns one if the LENGTH bytes at the addresses given by BUF1 and
  8159. BUF2 are equal. Otherwise it returns zero.
  8160. '$_regex(STR, REGEX)'
  8161. Returns one if the string STR matches the regular expression REGEX.
  8162. Otherwise it returns zero. The syntax of the regular expression is
  8163. that specified by 'Python''s regular expression support.
  8164. '$_streq(STR1, STR2)'
  8165. Returns one if the strings STR1 and STR2 are equal. Otherwise it
  8166. returns zero.
  8167. '$_strlen(STR)'
  8168. Returns the length of string STR.
  8169. '$_caller_is(NAME[, NUMBER_OF_FRAMES])'
  8170. Returns one if the calling function's name is equal to NAME.
  8171. Otherwise it returns zero.
  8172. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8173. number of frames up in the stack to look. The default is 1.
  8174. Example:
  8175. (gdb) backtrace
  8176. #0 bottom_func ()
  8177. at testsuite/gdb.python/py-caller-is.c:21
  8178. #1 0x00000000004005a0 in middle_func ()
  8179. at testsuite/gdb.python/py-caller-is.c:27
  8180. #2 0x00000000004005ab in top_func ()
  8181. at testsuite/gdb.python/py-caller-is.c:33
  8182. #3 0x00000000004005b6 in main ()
  8183. at testsuite/gdb.python/py-caller-is.c:39
  8184. (gdb) print $_caller_is ("middle_func")
  8185. $1 = 1
  8186. (gdb) print $_caller_is ("top_func", 2)
  8187. $1 = 1
  8188. '$_caller_matches(REGEXP[, NUMBER_OF_FRAMES])'
  8189. Returns one if the calling function's name matches the regular
  8190. expression REGEXP. Otherwise it returns zero.
  8191. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8192. number of frames up in the stack to look. The default is 1.
  8193. '$_any_caller_is(NAME[, NUMBER_OF_FRAMES])'
  8194. Returns one if any calling function's name is equal to NAME.
  8195. Otherwise it returns zero.
  8196. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8197. number of frames up in the stack to look. The default is 1.
  8198. This function differs from '$_caller_is' in that this function
  8199. checks all stack frames from the immediate caller to the frame
  8200. specified by NUMBER_OF_FRAMES, whereas '$_caller_is' only checks
  8201. the frame specified by NUMBER_OF_FRAMES.
  8202. '$_any_caller_matches(REGEXP[, NUMBER_OF_FRAMES])'
  8203. Returns one if any calling function's name matches the regular
  8204. expression REGEXP. Otherwise it returns zero.
  8205. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  8206. number of frames up in the stack to look. The default is 1.
  8207. This function differs from '$_caller_matches' in that this function
  8208. checks all stack frames from the immediate caller to the frame
  8209. specified by NUMBER_OF_FRAMES, whereas '$_caller_matches' only
  8210. checks the frame specified by NUMBER_OF_FRAMES.
  8211. '$_as_string(VALUE)'
  8212. Return the string representation of VALUE.
  8213. This function is useful to obtain the textual label (enumerator) of
  8214. an enumeration value. For example, assuming the variable NODE is
  8215. of an enumerated type:
  8216. (gdb) printf "Visiting node of type %s\n", $_as_string(node)
  8217. Visiting node of type NODE_INTEGER
  8218. '$_cimag(VALUE)'
  8219. '$_creal(VALUE)'
  8220. Return the imaginary ('$_cimag') or real ('$_creal') part of the
  8221. complex number VALUE.
  8222. The type of the imaginary or real part depends on the type of the
  8223. complex number, e.g., using '$_cimag' on a 'float complex' will
  8224. return an imaginary part of type 'float'.
  8225. GDB provides the ability to list and get help on convenience
  8226. functions.
  8227. 'help function'
  8228. Print a list of all convenience functions.
  8229. 
  8230. File: gdb.info, Node: Registers, Next: Floating Point Hardware, Prev: Convenience Funs, Up: Data
  8231. 10.13 Registers
  8232. ===============
  8233. You can refer to machine register contents, in expressions, as variables
  8234. with names starting with '$'. The names of registers are different for
  8235. each machine; use 'info registers' to see the names used on your
  8236. machine.
  8237. 'info registers'
  8238. Print the names and values of all registers except floating-point
  8239. and vector registers (in the selected stack frame).
  8240. 'info all-registers'
  8241. Print the names and values of all registers, including
  8242. floating-point and vector registers (in the selected stack frame).
  8243. 'info registers REGGROUP ...'
  8244. Print the name and value of the registers in each of the specified
  8245. REGGROUPs. The REGGROUP can be any of those returned by 'maint
  8246. print reggroups' (*note Maintenance Commands::).
  8247. 'info registers REGNAME ...'
  8248. Print the "relativized" value of each specified register REGNAME.
  8249. As discussed in detail below, register values are normally relative
  8250. to the selected stack frame. The REGNAME may be any register name
  8251. valid on the machine you are using, with or without the initial
  8252. '$'.
  8253. GDB has four "standard" register names that are available (in
  8254. expressions) on most machines--whenever they do not conflict with an
  8255. architecture's canonical mnemonics for registers. The register names
  8256. '$pc' and '$sp' are used for the program counter register and the stack
  8257. pointer. '$fp' is used for a register that contains a pointer to the
  8258. current stack frame, and '$ps' is used for a register that contains the
  8259. processor status. For example, you could print the program counter in
  8260. hex with
  8261. p/x $pc
  8262. or print the instruction to be executed next with
  8263. x/i $pc
  8264. or add four to the stack pointer(1) with
  8265. set $sp += 4
  8266. Whenever possible, these four standard register names are available
  8267. on your machine even though the machine has different canonical
  8268. mnemonics, so long as there is no conflict. The 'info registers'
  8269. command shows the canonical names. For example, on the SPARC, 'info
  8270. registers' displays the processor status register as '$psr' but you can
  8271. also refer to it as '$ps'; and on x86-based machines '$ps' is an alias
  8272. for the EFLAGS register.
  8273. GDB always considers the contents of an ordinary register as an
  8274. integer when the register is examined in this way. Some machines have
  8275. special registers which can hold nothing but floating point; these
  8276. registers are considered to have floating point values. There is no way
  8277. to refer to the contents of an ordinary register as floating point value
  8278. (although you can _print_ it as a floating point value with 'print/f
  8279. $REGNAME').
  8280. Some registers have distinct "raw" and "virtual" data formats. This
  8281. means that the data format in which the register contents are saved by
  8282. the operating system is not the same one that your program normally
  8283. sees. For example, the registers of the 68881 floating point
  8284. coprocessor are always saved in "extended" (raw) format, but all C
  8285. programs expect to work with "double" (virtual) format. In such cases,
  8286. GDB normally works with the virtual format only (the format that makes
  8287. sense for your program), but the 'info registers' command prints the
  8288. data in both formats.
  8289. Some machines have special registers whose contents can be
  8290. interpreted in several different ways. For example, modern x86-based
  8291. machines have SSE and MMX registers that can hold several values packed
  8292. together in several different formats. GDB refers to such registers in
  8293. 'struct' notation:
  8294. (gdb) print $xmm1
  8295. $1 = {
  8296. v4_float = {0, 3.43859137e-038, 1.54142831e-044, 1.821688e-044},
  8297. v2_double = {9.92129282474342e-303, 2.7585945287983262e-313},
  8298. v16_int8 = "\000\000\000\000\3706;\001\v\000\000\000\r\000\000",
  8299. v8_int16 = {0, 0, 14072, 315, 11, 0, 13, 0},
  8300. v4_int32 = {0, 20657912, 11, 13},
  8301. v2_int64 = {88725056443645952, 55834574859},
  8302. uint128 = 0x0000000d0000000b013b36f800000000
  8303. }
  8304. To set values of such registers, you need to tell GDB which view of the
  8305. register you wish to change, as if you were assigning value to a
  8306. 'struct' member:
  8307. (gdb) set $xmm1.uint128 = 0x000000000000000000000000FFFFFFFF
  8308. Normally, register values are relative to the selected stack frame
  8309. (*note Selecting a Frame: Selection.). This means that you get the
  8310. value that the register would contain if all stack frames farther in
  8311. were exited and their saved registers restored. In order to see the
  8312. true contents of hardware registers, you must select the innermost frame
  8313. (with 'frame 0').
  8314. Usually ABIs reserve some registers as not needed to be saved by the
  8315. callee (a.k.a.: "caller-saved", "call-clobbered" or "volatile"
  8316. registers). It may therefore not be possible for GDB to know the value
  8317. a register had before the call (in other words, in the outer frame), if
  8318. the register value has since been changed by the callee. GDB tries to
  8319. deduce where the inner frame saved ("callee-saved") registers, from the
  8320. debug info, unwind info, or the machine code generated by your compiler.
  8321. If some register is not saved, and GDB knows the register is
  8322. "caller-saved" (via its own knowledge of the ABI, or because the
  8323. debug/unwind info explicitly says the register's value is undefined),
  8324. GDB displays '<not saved>' as the register's value. With targets that
  8325. GDB has no knowledge of the register saving convention, if a register
  8326. was not saved by the callee, then its value and location in the outer
  8327. frame are assumed to be the same of the inner frame. This is usually
  8328. harmless, because if the register is call-clobbered, the caller either
  8329. does not care what is in the register after the call, or has code to
  8330. restore the value that it does care about. Note, however, that if you
  8331. change such a register in the outer frame, you may also be affecting the
  8332. inner frame. Also, the more "outer" the frame is you're looking at, the
  8333. more likely a call-clobbered register's value is to be wrong, in the
  8334. sense that it doesn't actually represent the value the register had just
  8335. before the call.
  8336. ---------- Footnotes ----------
  8337. (1) This is a way of removing one word from the stack, on machines
  8338. where stacks grow downward in memory (most machines, nowadays). This
  8339. assumes that the innermost stack frame is selected; setting '$sp' is not
  8340. allowed when other stack frames are selected. To pop entire frames off
  8341. the stack, regardless of machine architecture, use 'return'; see *note
  8342. Returning from a Function: Returning.
  8343. 
  8344. File: gdb.info, Node: Floating Point Hardware, Next: Vector Unit, Prev: Registers, Up: Data
  8345. 10.14 Floating Point Hardware
  8346. =============================
  8347. Depending on the configuration, GDB may be able to give you more
  8348. information about the status of the floating point hardware.
  8349. 'info float'
  8350. Display hardware-dependent information about the floating point
  8351. unit. The exact contents and layout vary depending on the floating
  8352. point chip. Currently, 'info float' is supported on the ARM and
  8353. x86 machines.
  8354. 
  8355. File: gdb.info, Node: Vector Unit, Next: OS Information, Prev: Floating Point Hardware, Up: Data
  8356. 10.15 Vector Unit
  8357. =================
  8358. Depending on the configuration, GDB may be able to give you more
  8359. information about the status of the vector unit.
  8360. 'info vector'
  8361. Display information about the vector unit. The exact contents and
  8362. layout vary depending on the hardware.
  8363. 
  8364. File: gdb.info, Node: OS Information, Next: Memory Region Attributes, Prev: Vector Unit, Up: Data
  8365. 10.16 Operating System Auxiliary Information
  8366. ============================================
  8367. GDB provides interfaces to useful OS facilities that can help you debug
  8368. your program.
  8369. Some operating systems supply an "auxiliary vector" to programs at
  8370. startup. This is akin to the arguments and environment that you specify
  8371. for a program, but contains a system-dependent variety of binary values
  8372. that tell system libraries important details about the hardware,
  8373. operating system, and process. Each value's purpose is identified by an
  8374. integer tag; the meanings are well-known but system-specific. Depending
  8375. on the configuration and operating system facilities, GDB may be able to
  8376. show you this information. For remote targets, this functionality may
  8377. further depend on the remote stub's support of the 'qXfer:auxv:read'
  8378. packet, see *note qXfer auxiliary vector read::.
  8379. 'info auxv'
  8380. Display the auxiliary vector of the inferior, which can be either a
  8381. live process or a core dump file. GDB prints each tag value
  8382. numerically, and also shows names and text descriptions for
  8383. recognized tags. Some values in the vector are numbers, some bit
  8384. masks, and some pointers to strings or other data. GDB displays
  8385. each value in the most appropriate form for a recognized tag, and
  8386. in hexadecimal for an unrecognized tag.
  8387. On some targets, GDB can access operating system-specific information
  8388. and show it to you. The types of information available will differ
  8389. depending on the type of operating system running on the target. The
  8390. mechanism used to fetch the data is described in *note Operating System
  8391. Information::. For remote targets, this functionality depends on the
  8392. remote stub's support of the 'qXfer:osdata:read' packet, see *note qXfer
  8393. osdata read::.
  8394. 'info os INFOTYPE'
  8395. Display OS information of the requested type.
  8396. On GNU/Linux, the following values of INFOTYPE are valid:
  8397. 'cpus'
  8398. Display the list of all CPUs/cores. For each CPU/core, GDB
  8399. prints the available fields from /proc/cpuinfo. For each
  8400. supported architecture different fields are available. Two
  8401. common entries are processor which gives CPU number and
  8402. bogomips; a system constant that is calculated during kernel
  8403. initialization.
  8404. 'files'
  8405. Display the list of open file descriptors on the target. For
  8406. each file descriptor, GDB prints the identifier of the process
  8407. owning the descriptor, the command of the owning process, the
  8408. value of the descriptor, and the target of the descriptor.
  8409. 'modules'
  8410. Display the list of all loaded kernel modules on the target.
  8411. For each module, GDB prints the module name, the size of the
  8412. module in bytes, the number of times the module is used, the
  8413. dependencies of the module, the status of the module, and the
  8414. address of the loaded module in memory.
  8415. 'msg'
  8416. Display the list of all System V message queues on the target.
  8417. For each message queue, GDB prints the message queue key, the
  8418. message queue identifier, the access permissions, the current
  8419. number of bytes on the queue, the current number of messages
  8420. on the queue, the processes that last sent and received a
  8421. message on the queue, the user and group of the owner and
  8422. creator of the message queue, the times at which a message was
  8423. last sent and received on the queue, and the time at which the
  8424. message queue was last changed.
  8425. 'processes'
  8426. Display the list of processes on the target. For each
  8427. process, GDB prints the process identifier, the name of the
  8428. user, the command corresponding to the process, and the list
  8429. of processor cores that the process is currently running on.
  8430. (To understand what these properties mean, for this and the
  8431. following info types, please consult the general GNU/Linux
  8432. documentation.)
  8433. 'procgroups'
  8434. Display the list of process groups on the target. For each
  8435. process, GDB prints the identifier of the process group that
  8436. it belongs to, the command corresponding to the process group
  8437. leader, the process identifier, and the command line of the
  8438. process. The list is sorted first by the process group
  8439. identifier, then by the process identifier, so that processes
  8440. belonging to the same process group are grouped together and
  8441. the process group leader is listed first.
  8442. 'semaphores'
  8443. Display the list of all System V semaphore sets on the target.
  8444. For each semaphore set, GDB prints the semaphore set key, the
  8445. semaphore set identifier, the access permissions, the number
  8446. of semaphores in the set, the user and group of the owner and
  8447. creator of the semaphore set, and the times at which the
  8448. semaphore set was operated upon and changed.
  8449. 'shm'
  8450. Display the list of all System V shared-memory regions on the
  8451. target. For each shared-memory region, GDB prints the region
  8452. key, the shared-memory identifier, the access permissions, the
  8453. size of the region, the process that created the region, the
  8454. process that last attached to or detached from the region, the
  8455. current number of live attaches to the region, and the times
  8456. at which the region was last attached to, detach from, and
  8457. changed.
  8458. 'sockets'
  8459. Display the list of Internet-domain sockets on the target.
  8460. For each socket, GDB prints the address and port of the local
  8461. and remote endpoints, the current state of the connection, the
  8462. creator of the socket, the IP address family of the socket,
  8463. and the type of the connection.
  8464. 'threads'
  8465. Display the list of threads running on the target. For each
  8466. thread, GDB prints the identifier of the process that the
  8467. thread belongs to, the command of the process, the thread
  8468. identifier, and the processor core that it is currently
  8469. running on. The main thread of a process is not listed.
  8470. 'info os'
  8471. If INFOTYPE is omitted, then list the possible values for INFOTYPE
  8472. and the kind of OS information available for each INFOTYPE. If the
  8473. target does not return a list of possible types, this command will
  8474. report an error.
  8475. 
  8476. File: gdb.info, Node: Memory Region Attributes, Next: Dump/Restore Files, Prev: OS Information, Up: Data
  8477. 10.17 Memory Region Attributes
  8478. ==============================
  8479. "Memory region attributes" allow you to describe special handling
  8480. required by regions of your target's memory. GDB uses attributes to
  8481. determine whether to allow certain types of memory accesses; whether to
  8482. use specific width accesses; and whether to cache target memory. By
  8483. default the description of memory regions is fetched from the target (if
  8484. the current target supports this), but the user can override the fetched
  8485. regions.
  8486. Defined memory regions can be individually enabled and disabled.
  8487. When a memory region is disabled, GDB uses the default attributes when
  8488. accessing memory in that region. Similarly, if no memory regions have
  8489. been defined, GDB uses the default attributes when accessing all memory.
  8490. When a memory region is defined, it is given a number to identify it;
  8491. to enable, disable, or remove a memory region, you specify that number.
  8492. 'mem LOWER UPPER ATTRIBUTES...'
  8493. Define a memory region bounded by LOWER and UPPER with attributes
  8494. ATTRIBUTES..., and add it to the list of regions monitored by GDB.
  8495. Note that UPPER == 0 is a special case: it is treated as the
  8496. target's maximum memory address. (0xffff on 16 bit targets,
  8497. 0xffffffff on 32 bit targets, etc.)
  8498. 'mem auto'
  8499. Discard any user changes to the memory regions and use
  8500. target-supplied regions, if available, or no regions if the target
  8501. does not support.
  8502. 'delete mem NUMS...'
  8503. Remove memory regions NUMS... from the list of regions monitored by
  8504. GDB.
  8505. 'disable mem NUMS...'
  8506. Disable monitoring of memory regions NUMS.... A disabled memory
  8507. region is not forgotten. It may be enabled again later.
  8508. 'enable mem NUMS...'
  8509. Enable monitoring of memory regions NUMS....
  8510. 'info mem'
  8511. Print a table of all defined memory regions, with the following
  8512. columns for each region:
  8513. _Memory Region Number_
  8514. _Enabled or Disabled._
  8515. Enabled memory regions are marked with 'y'. Disabled memory
  8516. regions are marked with 'n'.
  8517. _Lo Address_
  8518. The address defining the inclusive lower bound of the memory
  8519. region.
  8520. _Hi Address_
  8521. The address defining the exclusive upper bound of the memory
  8522. region.
  8523. _Attributes_
  8524. The list of attributes set for this memory region.
  8525. 10.17.1 Attributes
  8526. ------------------
  8527. 10.17.1.1 Memory Access Mode
  8528. ............................
  8529. The access mode attributes set whether GDB may make read or write
  8530. accesses to a memory region.
  8531. While these attributes prevent GDB from performing invalid memory
  8532. accesses, they do nothing to prevent the target system, I/O DMA, etc.
  8533. from accessing memory.
  8534. 'ro'
  8535. Memory is read only.
  8536. 'wo'
  8537. Memory is write only.
  8538. 'rw'
  8539. Memory is read/write. This is the default.
  8540. 10.17.1.2 Memory Access Size
  8541. ............................
  8542. The access size attribute tells GDB to use specific sized accesses in
  8543. the memory region. Often memory mapped device registers require
  8544. specific sized accesses. If no access size attribute is specified, GDB
  8545. may use accesses of any size.
  8546. '8'
  8547. Use 8 bit memory accesses.
  8548. '16'
  8549. Use 16 bit memory accesses.
  8550. '32'
  8551. Use 32 bit memory accesses.
  8552. '64'
  8553. Use 64 bit memory accesses.
  8554. 10.17.1.3 Data Cache
  8555. ....................
  8556. The data cache attributes set whether GDB will cache target memory.
  8557. While this generally improves performance by reducing debug protocol
  8558. overhead, it can lead to incorrect results because GDB does not know
  8559. about volatile variables or memory mapped device registers.
  8560. 'cache'
  8561. Enable GDB to cache target memory.
  8562. 'nocache'
  8563. Disable GDB from caching target memory. This is the default.
  8564. 10.17.2 Memory Access Checking
  8565. ------------------------------
  8566. GDB can be instructed to refuse accesses to memory that is not
  8567. explicitly described. This can be useful if accessing such regions has
  8568. undesired effects for a specific target, or to provide better error
  8569. checking. The following commands control this behaviour.
  8570. 'set mem inaccessible-by-default [on|off]'
  8571. If 'on' is specified, make GDB treat memory not explicitly
  8572. described by the memory ranges as non-existent and refuse accesses
  8573. to such memory. The checks are only performed if there's at least
  8574. one memory range defined. If 'off' is specified, make GDB treat
  8575. the memory not explicitly described by the memory ranges as RAM.
  8576. The default value is 'on'.
  8577. 'show mem inaccessible-by-default'
  8578. Show the current handling of accesses to unknown memory.
  8579. 
  8580. File: gdb.info, Node: Dump/Restore Files, Next: Core File Generation, Prev: Memory Region Attributes, Up: Data
  8581. 10.18 Copy Between Memory and a File
  8582. ====================================
  8583. You can use the commands 'dump', 'append', and 'restore' to copy data
  8584. between target memory and a file. The 'dump' and 'append' commands
  8585. write data to a file, and the 'restore' command reads data from a file
  8586. back into the inferior's memory. Files may be in binary, Motorola
  8587. S-record, Intel hex, Tektronix Hex, or Verilog Hex format; however, GDB
  8588. can only append to binary files, and cannot read from Verilog Hex files.
  8589. 'dump [FORMAT] memory FILENAME START_ADDR END_ADDR'
  8590. 'dump [FORMAT] value FILENAME EXPR'
  8591. Dump the contents of memory from START_ADDR to END_ADDR, or the
  8592. value of EXPR, to FILENAME in the given format.
  8593. The FORMAT parameter may be any one of:
  8594. 'binary'
  8595. Raw binary form.
  8596. 'ihex'
  8597. Intel hex format.
  8598. 'srec'
  8599. Motorola S-record format.
  8600. 'tekhex'
  8601. Tektronix Hex format.
  8602. 'verilog'
  8603. Verilog Hex format.
  8604. GDB uses the same definitions of these formats as the GNU binary
  8605. utilities, like 'objdump' and 'objcopy'. If FORMAT is omitted, GDB
  8606. dumps the data in raw binary form.
  8607. 'append [binary] memory FILENAME START_ADDR END_ADDR'
  8608. 'append [binary] value FILENAME EXPR'
  8609. Append the contents of memory from START_ADDR to END_ADDR, or the
  8610. value of EXPR, to the file FILENAME, in raw binary form. (GDB can
  8611. only append data to files in raw binary form.)
  8612. 'restore FILENAME [binary] BIAS START END'
  8613. Restore the contents of file FILENAME into memory. The 'restore'
  8614. command can automatically recognize any known BFD file format,
  8615. except for raw binary. To restore a raw binary file you must
  8616. specify the optional keyword 'binary' after the filename.
  8617. If BIAS is non-zero, its value will be added to the addresses
  8618. contained in the file. Binary files always start at address zero,
  8619. so they will be restored at address BIAS. Other bfd files have a
  8620. built-in location; they will be restored at offset BIAS from that
  8621. location.
  8622. If START and/or END are non-zero, then only data between file
  8623. offset START and file offset END will be restored. These offsets
  8624. are relative to the addresses in the file, before the BIAS argument
  8625. is applied.
  8626. 
  8627. File: gdb.info, Node: Core File Generation, Next: Character Sets, Prev: Dump/Restore Files, Up: Data
  8628. 10.19 How to Produce a Core File from Your Program
  8629. ==================================================
  8630. A "core file" or "core dump" is a file that records the memory image of
  8631. a running process and its process status (register values etc.). Its
  8632. primary use is post-mortem debugging of a program that crashed while it
  8633. ran outside a debugger. A program that crashes automatically produces a
  8634. core file, unless this feature is disabled by the user. *Note Files::,
  8635. for information on invoking GDB in the post-mortem debugging mode.
  8636. Occasionally, you may wish to produce a core file of the program you
  8637. are debugging in order to preserve a snapshot of its state. GDB has a
  8638. special command for that.
  8639. 'generate-core-file [FILE]'
  8640. 'gcore [FILE]'
  8641. Produce a core dump of the inferior process. The optional argument
  8642. FILE specifies the file name where to put the core dump. If not
  8643. specified, the file name defaults to 'core.PID', where PID is the
  8644. inferior process ID.
  8645. Note that this command is implemented only for some systems (as of
  8646. this writing, GNU/Linux, FreeBSD, Solaris, and S390).
  8647. On GNU/Linux, this command can take into account the value of the
  8648. file '/proc/PID/coredump_filter' when generating the core dump
  8649. (*note set use-coredump-filter::), and by default honors the
  8650. 'VM_DONTDUMP' flag for mappings where it is present in the file
  8651. '/proc/PID/smaps' (*note set dump-excluded-mappings::).
  8652. 'set use-coredump-filter on'
  8653. 'set use-coredump-filter off'
  8654. Enable or disable the use of the file '/proc/PID/coredump_filter'
  8655. when generating core dump files. This file is used by the Linux
  8656. kernel to decide what types of memory mappings will be dumped or
  8657. ignored when generating a core dump file. PID is the process ID of
  8658. a currently running process.
  8659. To make use of this feature, you have to write in the
  8660. '/proc/PID/coredump_filter' file a value, in hexadecimal, which is
  8661. a bit mask representing the memory mapping types. If a bit is set
  8662. in the bit mask, then the memory mappings of the corresponding
  8663. types will be dumped; otherwise, they will be ignored. This
  8664. configuration is inherited by child processes. For more
  8665. information about the bits that can be set in the
  8666. '/proc/PID/coredump_filter' file, please refer to the manpage of
  8667. 'core(5)'.
  8668. By default, this option is 'on'. If this option is turned 'off',
  8669. GDB does not read the 'coredump_filter' file and instead uses the
  8670. same default value as the Linux kernel in order to decide which
  8671. pages will be dumped in the core dump file. This value is
  8672. currently '0x33', which means that bits '0' (anonymous private
  8673. mappings), '1' (anonymous shared mappings), '4' (ELF headers) and
  8674. '5' (private huge pages) are active. This will cause these memory
  8675. mappings to be dumped automatically.
  8676. 'set dump-excluded-mappings on'
  8677. 'set dump-excluded-mappings off'
  8678. If 'on' is specified, GDB will dump memory mappings marked with the
  8679. 'VM_DONTDUMP' flag. This flag is represented in the file
  8680. '/proc/PID/smaps' with the acronym 'dd'.
  8681. The default value is 'off'.
  8682. 
  8683. File: gdb.info, Node: Character Sets, Next: Caching Target Data, Prev: Core File Generation, Up: Data
  8684. 10.20 Character Sets
  8685. ====================
  8686. If the program you are debugging uses a different character set to
  8687. represent characters and strings than the one GDB uses itself, GDB can
  8688. automatically translate between the character sets for you. The
  8689. character set GDB uses we call the "host character set"; the one the
  8690. inferior program uses we call the "target character set".
  8691. For example, if you are running GDB on a GNU/Linux system, which uses
  8692. the ISO Latin 1 character set, but you are using GDB's remote protocol
  8693. (*note Remote Debugging::) to debug a program running on an IBM
  8694. mainframe, which uses the EBCDIC character set, then the host character
  8695. set is Latin-1, and the target character set is EBCDIC. If you give GDB
  8696. the command 'set target-charset EBCDIC-US', then GDB translates between
  8697. EBCDIC and Latin 1 as you print character or string values, or use
  8698. character and string literals in expressions.
  8699. GDB has no way to automatically recognize which character set the
  8700. inferior program uses; you must tell it, using the 'set target-charset'
  8701. command, described below.
  8702. Here are the commands for controlling GDB's character set support:
  8703. 'set target-charset CHARSET'
  8704. Set the current target character set to CHARSET. To display the
  8705. list of supported target character sets, type
  8706. 'set target-charset <TAB><TAB>'.
  8707. 'set host-charset CHARSET'
  8708. Set the current host character set to CHARSET.
  8709. By default, GDB uses a host character set appropriate to the system
  8710. it is running on; you can override that default using the 'set
  8711. host-charset' command. On some systems, GDB cannot automatically
  8712. determine the appropriate host character set. In this case, GDB
  8713. uses 'UTF-8'.
  8714. GDB can only use certain character sets as its host character set.
  8715. If you type 'set host-charset <TAB><TAB>', GDB will list the host
  8716. character sets it supports.
  8717. 'set charset CHARSET'
  8718. Set the current host and target character sets to CHARSET. As
  8719. above, if you type 'set charset <TAB><TAB>', GDB will list the
  8720. names of the character sets that can be used for both host and
  8721. target.
  8722. 'show charset'
  8723. Show the names of the current host and target character sets.
  8724. 'show host-charset'
  8725. Show the name of the current host character set.
  8726. 'show target-charset'
  8727. Show the name of the current target character set.
  8728. 'set target-wide-charset CHARSET'
  8729. Set the current target's wide character set to CHARSET. This is
  8730. the character set used by the target's 'wchar_t' type. To display
  8731. the list of supported wide character sets, type
  8732. 'set target-wide-charset <TAB><TAB>'.
  8733. 'show target-wide-charset'
  8734. Show the name of the current target's wide character set.
  8735. Here is an example of GDB's character set support in action. Assume
  8736. that the following source code has been placed in the file
  8737. 'charset-test.c':
  8738. #include <stdio.h>
  8739. char ascii_hello[]
  8740. = {72, 101, 108, 108, 111, 44, 32, 119,
  8741. 111, 114, 108, 100, 33, 10, 0};
  8742. char ibm1047_hello[]
  8743. = {200, 133, 147, 147, 150, 107, 64, 166,
  8744. 150, 153, 147, 132, 90, 37, 0};
  8745. main ()
  8746. {
  8747. printf ("Hello, world!\n");
  8748. }
  8749. In this program, 'ascii_hello' and 'ibm1047_hello' are arrays
  8750. containing the string 'Hello, world!' followed by a newline, encoded in
  8751. the ASCII and IBM1047 character sets.
  8752. We compile the program, and invoke the debugger on it:
  8753. $ gcc -g charset-test.c -o charset-test
  8754. $ gdb -nw charset-test
  8755. GNU gdb 2001-12-19-cvs
  8756. Copyright 2001 Free Software Foundation, Inc.
  8757. ...
  8758. (gdb)
  8759. We can use the 'show charset' command to see what character sets GDB
  8760. is currently using to interpret and display characters and strings:
  8761. (gdb) show charset
  8762. The current host and target character set is `ISO-8859-1'.
  8763. (gdb)
  8764. For the sake of printing this manual, let's use ASCII as our initial
  8765. character set:
  8766. (gdb) set charset ASCII
  8767. (gdb) show charset
  8768. The current host and target character set is `ASCII'.
  8769. (gdb)
  8770. Let's assume that ASCII is indeed the correct character set for our
  8771. host system -- in other words, let's assume that if GDB prints
  8772. characters using the ASCII character set, our terminal will display them
  8773. properly. Since our current target character set is also ASCII, the
  8774. contents of 'ascii_hello' print legibly:
  8775. (gdb) print ascii_hello
  8776. $1 = 0x401698 "Hello, world!\n"
  8777. (gdb) print ascii_hello[0]
  8778. $2 = 72 'H'
  8779. (gdb)
  8780. GDB uses the target character set for character and string literals
  8781. you use in expressions:
  8782. (gdb) print '+'
  8783. $3 = 43 '+'
  8784. (gdb)
  8785. The ASCII character set uses the number 43 to encode the '+'
  8786. character.
  8787. GDB relies on the user to tell it which character set the target
  8788. program uses. If we print 'ibm1047_hello' while our target character
  8789. set is still ASCII, we get jibberish:
  8790. (gdb) print ibm1047_hello
  8791. $4 = 0x4016a8 "\310\205\223\223\226k@\246\226\231\223\204Z%"
  8792. (gdb) print ibm1047_hello[0]
  8793. $5 = 200 '\310'
  8794. (gdb)
  8795. If we invoke the 'set target-charset' followed by <TAB><TAB>, GDB
  8796. tells us the character sets it supports:
  8797. (gdb) set target-charset
  8798. ASCII EBCDIC-US IBM1047 ISO-8859-1
  8799. (gdb) set target-charset
  8800. We can select IBM1047 as our target character set, and examine the
  8801. program's strings again. Now the ASCII string is wrong, but GDB
  8802. translates the contents of 'ibm1047_hello' from the target character
  8803. set, IBM1047, to the host character set, ASCII, and they display
  8804. correctly:
  8805. (gdb) set target-charset IBM1047
  8806. (gdb) show charset
  8807. The current host character set is `ASCII'.
  8808. The current target character set is `IBM1047'.
  8809. (gdb) print ascii_hello
  8810. $6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012"
  8811. (gdb) print ascii_hello[0]
  8812. $7 = 72 '\110'
  8813. (gdb) print ibm1047_hello
  8814. $8 = 0x4016a8 "Hello, world!\n"
  8815. (gdb) print ibm1047_hello[0]
  8816. $9 = 200 'H'
  8817. (gdb)
  8818. As above, GDB uses the target character set for character and string
  8819. literals you use in expressions:
  8820. (gdb) print '+'
  8821. $10 = 78 '+'
  8822. (gdb)
  8823. The IBM1047 character set uses the number 78 to encode the '+'
  8824. character.
  8825. 
  8826. File: gdb.info, Node: Caching Target Data, Next: Searching Memory, Prev: Character Sets, Up: Data
  8827. 10.21 Caching Data of Targets
  8828. =============================
  8829. GDB caches data exchanged between the debugger and a target. Each cache
  8830. is associated with the address space of the inferior. *Note Inferiors
  8831. and Programs::, about inferior and address space. Such caching
  8832. generally improves performance in remote debugging (*note Remote
  8833. Debugging::), because it reduces the overhead of the remote protocol by
  8834. bundling memory reads and writes into large chunks. Unfortunately,
  8835. simply caching everything would lead to incorrect results, since GDB
  8836. does not necessarily know anything about volatile values, memory-mapped
  8837. I/O addresses, etc. Furthermore, in non-stop mode (*note Non-Stop
  8838. Mode::) memory can be changed _while_ a gdb command is executing.
  8839. Therefore, by default, GDB only caches data known to be on the stack(1)
  8840. or in the code segment. Other regions of memory can be explicitly
  8841. marked as cacheable; *note Memory Region Attributes::.
  8842. 'set remotecache on'
  8843. 'set remotecache off'
  8844. This option no longer does anything; it exists for compatibility
  8845. with old scripts.
  8846. 'show remotecache'
  8847. Show the current state of the obsolete remotecache flag.
  8848. 'set stack-cache on'
  8849. 'set stack-cache off'
  8850. Enable or disable caching of stack accesses. When 'on', use
  8851. caching. By default, this option is 'on'.
  8852. 'show stack-cache'
  8853. Show the current state of data caching for memory accesses.
  8854. 'set code-cache on'
  8855. 'set code-cache off'
  8856. Enable or disable caching of code segment accesses. When 'on', use
  8857. caching. By default, this option is 'on'. This improves
  8858. performance of disassembly in remote debugging.
  8859. 'show code-cache'
  8860. Show the current state of target memory cache for code segment
  8861. accesses.
  8862. 'info dcache [line]'
  8863. Print the information about the performance of data cache of the
  8864. current inferior's address space. The information displayed
  8865. includes the dcache width and depth, and for each cache line, its
  8866. number, address, and how many times it was referenced. This
  8867. command is useful for debugging the data cache operation.
  8868. If a line number is specified, the contents of that line will be
  8869. printed in hex.
  8870. 'set dcache size SIZE'
  8871. Set maximum number of entries in dcache (dcache depth above).
  8872. 'set dcache line-size LINE-SIZE'
  8873. Set number of bytes each dcache entry caches (dcache width above).
  8874. Must be a power of 2.
  8875. 'show dcache size'
  8876. Show maximum number of dcache entries. *Note info dcache: Caching
  8877. Target Data.
  8878. 'show dcache line-size'
  8879. Show default size of dcache lines.
  8880. ---------- Footnotes ----------
  8881. (1) In non-stop mode, it is moderately rare for a running thread to
  8882. modify the stack of a stopped thread in a way that would interfere with
  8883. a backtrace, and caching of stack reads provides a significant speed up
  8884. of remote backtraces.
  8885. 
  8886. File: gdb.info, Node: Searching Memory, Next: Value Sizes, Prev: Caching Target Data, Up: Data
  8887. 10.22 Search Memory
  8888. ===================
  8889. Memory can be searched for a particular sequence of bytes with the
  8890. 'find' command.
  8891. 'find [/SN] START_ADDR, +LEN, VAL1 [, VAL2, ...]'
  8892. 'find [/SN] START_ADDR, END_ADDR, VAL1 [, VAL2, ...]'
  8893. Search memory for the sequence of bytes specified by VAL1, VAL2,
  8894. etc. The search begins at address START_ADDR and continues for
  8895. either LEN bytes or through to END_ADDR inclusive.
  8896. S and N are optional parameters. They may be specified in either
  8897. order, apart or together.
  8898. S, search query size
  8899. The size of each search query value.
  8900. 'b'
  8901. bytes
  8902. 'h'
  8903. halfwords (two bytes)
  8904. 'w'
  8905. words (four bytes)
  8906. 'g'
  8907. giant words (eight bytes)
  8908. All values are interpreted in the current language. This means,
  8909. for example, that if the current source language is C/C++ then
  8910. searching for the string "hello" includes the trailing '\0'. The
  8911. null terminator can be removed from searching by using casts, e.g.:
  8912. '{char[5]}"hello"'.
  8913. If the value size is not specified, it is taken from the value's
  8914. type in the current language. This is useful when one wants to
  8915. specify the search pattern as a mixture of types. Note that this
  8916. means, for example, that in the case of C-like languages a search
  8917. for an untyped 0x42 will search for '(int) 0x42' which is typically
  8918. four bytes.
  8919. N, maximum number of finds
  8920. The maximum number of matches to print. The default is to print
  8921. all finds.
  8922. You can use strings as search values. Quote them with double-quotes
  8923. ('"'). The string value is copied into the search pattern byte by byte,
  8924. regardless of the endianness of the target and the size specification.
  8925. The address of each match found is printed as well as a count of the
  8926. number of matches found.
  8927. The address of the last value found is stored in convenience variable
  8928. '$_'. A count of the number of matches is stored in '$numfound'.
  8929. For example, if stopped at the 'printf' in this function:
  8930. void
  8931. hello ()
  8932. {
  8933. static char hello[] = "hello-hello";
  8934. static struct { char c; short s; int i; }
  8935. __attribute__ ((packed)) mixed
  8936. = { 'c', 0x1234, 0x87654321 };
  8937. printf ("%s\n", hello);
  8938. }
  8939. you get during debugging:
  8940. (gdb) find &hello[0], +sizeof(hello), "hello"
  8941. 0x804956d <hello.1620+6>
  8942. 1 pattern found
  8943. (gdb) find &hello[0], +sizeof(hello), 'h', 'e', 'l', 'l', 'o'
  8944. 0x8049567 <hello.1620>
  8945. 0x804956d <hello.1620+6>
  8946. 2 patterns found.
  8947. (gdb) find &hello[0], +sizeof(hello), {char[5]}"hello"
  8948. 0x8049567 <hello.1620>
  8949. 0x804956d <hello.1620+6>
  8950. 2 patterns found.
  8951. (gdb) find /b1 &hello[0], +sizeof(hello), 'h', 0x65, 'l'
  8952. 0x8049567 <hello.1620>
  8953. 1 pattern found
  8954. (gdb) find &mixed, +sizeof(mixed), (char) 'c', (short) 0x1234, (int) 0x87654321
  8955. 0x8049560 <mixed.1625>
  8956. 1 pattern found
  8957. (gdb) print $numfound
  8958. $1 = 1
  8959. (gdb) print $_
  8960. $2 = (void *) 0x8049560
  8961. 
  8962. File: gdb.info, Node: Value Sizes, Prev: Searching Memory, Up: Data
  8963. 10.23 Value Sizes
  8964. =================
  8965. Whenever GDB prints a value memory will be allocated within GDB to hold
  8966. the contents of the value. It is possible in some languages with
  8967. dynamic typing systems, that an invalid program may indicate a value
  8968. that is incorrectly large, this in turn may cause GDB to try and
  8969. allocate an overly large amount of memory.
  8970. 'set max-value-size BYTES'
  8971. 'set max-value-size unlimited'
  8972. Set the maximum size of memory that GDB will allocate for the
  8973. contents of a value to BYTES, trying to display a value that
  8974. requires more memory than that will result in an error.
  8975. Setting this variable does not effect values that have already been
  8976. allocated within GDB, only future allocations.
  8977. There's a minimum size that 'max-value-size' can be set to in order
  8978. that GDB can still operate correctly, this minimum is currently 16
  8979. bytes.
  8980. The limit applies to the results of some subexpressions as well as
  8981. to complete expressions. For example, an expression denoting a
  8982. simple integer component, such as 'x.y.z', may fail if the size of
  8983. X.Y is dynamic and exceeds BYTES. On the other hand, GDB is
  8984. sometimes clever; the expression 'A[i]', where A is an array
  8985. variable with non-constant size, will generally succeed regardless
  8986. of the bounds on A, as long as the component size is less than
  8987. BYTES.
  8988. The default value of 'max-value-size' is currently 64k.
  8989. 'show max-value-size'
  8990. Show the maximum size of memory, in bytes, that GDB will allocate
  8991. for the contents of a value.
  8992. 
  8993. File: gdb.info, Node: Optimized Code, Next: Macros, Prev: Data, Up: Top
  8994. 11 Debugging Optimized Code
  8995. ***************************
  8996. Almost all compilers support optimization. With optimization disabled,
  8997. the compiler generates assembly code that corresponds directly to your
  8998. source code, in a simplistic way. As the compiler applies more powerful
  8999. optimizations, the generated assembly code diverges from your original
  9000. source code. With help from debugging information generated by the
  9001. compiler, GDB can map from the running program back to constructs from
  9002. your original source.
  9003. GDB is more accurate with optimization disabled. If you can
  9004. recompile without optimization, it is easier to follow the progress of
  9005. your program during debugging. But, there are many cases where you may
  9006. need to debug an optimized version.
  9007. When you debug a program compiled with '-g -O', remember that the
  9008. optimizer has rearranged your code; the debugger shows you what is
  9009. really there. Do not be too surprised when the execution path does not
  9010. exactly match your source file! An extreme example: if you define a
  9011. variable, but never use it, GDB never sees that variable--because the
  9012. compiler optimizes it out of existence.
  9013. Some things do not work as well with '-g -O' as with just '-g',
  9014. particularly on machines with instruction scheduling. If in doubt,
  9015. recompile with '-g' alone, and if this fixes the problem, please report
  9016. it to us as a bug (including a test case!). *Note Variables::, for more
  9017. information about debugging optimized code.
  9018. * Menu:
  9019. * Inline Functions:: How GDB presents inlining
  9020. * Tail Call Frames:: GDB analysis of jumps to functions
  9021. 
  9022. File: gdb.info, Node: Inline Functions, Next: Tail Call Frames, Up: Optimized Code
  9023. 11.1 Inline Functions
  9024. =====================
  9025. "Inlining" is an optimization that inserts a copy of the function body
  9026. directly at each call site, instead of jumping to a shared routine. GDB
  9027. displays inlined functions just like non-inlined functions. They appear
  9028. in backtraces. You can view their arguments and local variables, step
  9029. into them with 'step', skip them with 'next', and escape from them with
  9030. 'finish'. You can check whether a function was inlined by using the
  9031. 'info frame' command.
  9032. For GDB to support inlined functions, the compiler must record
  9033. information about inlining in the debug information -- GCC using the
  9034. DWARF 2 format does this, and several other compilers do also. GDB only
  9035. supports inlined functions when using DWARF 2. Versions of GCC before
  9036. 4.1 do not emit two required attributes ('DW_AT_call_file' and
  9037. 'DW_AT_call_line'); GDB does not display inlined function calls with
  9038. earlier versions of GCC. It instead displays the arguments and local
  9039. variables of inlined functions as local variables in the caller.
  9040. The body of an inlined function is directly included at its call
  9041. site; unlike a non-inlined function, there are no instructions devoted
  9042. to the call. GDB still pretends that the call site and the start of the
  9043. inlined function are different instructions. Stepping to the call site
  9044. shows the call site, and then stepping again shows the first line of the
  9045. inlined function, even though no additional instructions are executed.
  9046. This makes source-level debugging much clearer; you can see both the
  9047. context of the call and then the effect of the call. Only stepping by a
  9048. single instruction using 'stepi' or 'nexti' does not do this; single
  9049. instruction steps always show the inlined body.
  9050. There are some ways that GDB does not pretend that inlined function
  9051. calls are the same as normal calls:
  9052. * Setting breakpoints at the call site of an inlined function may not
  9053. work, because the call site does not contain any code. GDB may
  9054. incorrectly move the breakpoint to the next line of the enclosing
  9055. function, after the call. This limitation will be removed in a
  9056. future version of GDB; until then, set a breakpoint on an earlier
  9057. line or inside the inlined function instead.
  9058. * GDB cannot locate the return value of inlined calls after using the
  9059. 'finish' command. This is a limitation of compiler-generated
  9060. debugging information; after 'finish', you can step to the next
  9061. line and print a variable where your program stored the return
  9062. value.
  9063. 
  9064. File: gdb.info, Node: Tail Call Frames, Prev: Inline Functions, Up: Optimized Code
  9065. 11.2 Tail Call Frames
  9066. =====================
  9067. Function 'B' can call function 'C' in its very last statement. In
  9068. unoptimized compilation the call of 'C' is immediately followed by
  9069. return instruction at the end of 'B' code. Optimizing compiler may
  9070. replace the call and return in function 'B' into one jump to function
  9071. 'C' instead. Such use of a jump instruction is called "tail call".
  9072. During execution of function 'C', there will be no indication in the
  9073. function call stack frames that it was tail-called from 'B'. If
  9074. function 'A' regularly calls function 'B' which tail-calls function 'C',
  9075. then GDB will see 'A' as the caller of 'C'. However, in some cases GDB
  9076. can determine that 'C' was tail-called from 'B', and it will then create
  9077. fictitious call frame for that, with the return address set up as if 'B'
  9078. called 'C' normally.
  9079. This functionality is currently supported only by DWARF 2 debugging
  9080. format and the compiler has to produce 'DW_TAG_call_site' tags. With
  9081. GCC, you need to specify '-O -g' during compilation, to get this
  9082. information.
  9083. 'info frame' command (*note Frame Info::) will indicate the tail call
  9084. frame kind by text 'tail call frame' such as in this sample GDB output:
  9085. (gdb) x/i $pc - 2
  9086. 0x40066b <b(int, double)+11>: jmp 0x400640 <c(int, double)>
  9087. (gdb) info frame
  9088. Stack level 1, frame at 0x7fffffffda30:
  9089. rip = 0x40066d in b (amd64-entry-value.cc:59); saved rip 0x4004c5
  9090. tail call frame, caller of frame at 0x7fffffffda30
  9091. source language c++.
  9092. Arglist at unknown address.
  9093. Locals at unknown address, Previous frame's sp is 0x7fffffffda30
  9094. The detection of all the possible code path executions can find them
  9095. ambiguous. There is no execution history stored (possible *note Reverse
  9096. Execution:: is never used for this purpose) and the last known caller
  9097. could have reached the known callee by multiple different jump
  9098. sequences. In such case GDB still tries to show at least all the
  9099. unambiguous top tail callers and all the unambiguous bottom tail calees,
  9100. if any.
  9101. 'set debug entry-values'
  9102. When set to on, enables printing of analysis messages for both
  9103. frame argument values at function entry and tail calls. It will
  9104. show all the possible valid tail calls code paths it has
  9105. considered. It will also print the intersection of them with the
  9106. final unambiguous (possibly partial or even empty) code path
  9107. result.
  9108. 'show debug entry-values'
  9109. Show the current state of analysis messages printing for both frame
  9110. argument values at function entry and tail calls.
  9111. The analysis messages for tail calls can for example show why the
  9112. virtual tail call frame for function 'c' has not been recognized (due to
  9113. the indirect reference by variable 'x'):
  9114. static void __attribute__((noinline, noclone)) c (void);
  9115. void (*x) (void) = c;
  9116. static void __attribute__((noinline, noclone)) a (void) { x++; }
  9117. static void __attribute__((noinline, noclone)) c (void) { a (); }
  9118. int main (void) { x (); return 0; }
  9119. Breakpoint 1, DW_OP_entry_value resolving cannot find
  9120. DW_TAG_call_site 0x40039a in main
  9121. a () at t.c:3
  9122. 3 static void __attribute__((noinline, noclone)) a (void) { x++; }
  9123. (gdb) bt
  9124. #0 a () at t.c:3
  9125. #1 0x000000000040039a in main () at t.c:5
  9126. Another possibility is an ambiguous virtual tail call frames
  9127. resolution:
  9128. int i;
  9129. static void __attribute__((noinline, noclone)) f (void) { i++; }
  9130. static void __attribute__((noinline, noclone)) e (void) { f (); }
  9131. static void __attribute__((noinline, noclone)) d (void) { f (); }
  9132. static void __attribute__((noinline, noclone)) c (void) { d (); }
  9133. static void __attribute__((noinline, noclone)) b (void)
  9134. { if (i) c (); else e (); }
  9135. static void __attribute__((noinline, noclone)) a (void) { b (); }
  9136. int main (void) { a (); return 0; }
  9137. tailcall: initial: 0x4004d2(a) 0x4004ce(b) 0x4004b2(c) 0x4004a2(d)
  9138. tailcall: compare: 0x4004d2(a) 0x4004cc(b) 0x400492(e)
  9139. tailcall: reduced: 0x4004d2(a) |
  9140. (gdb) bt
  9141. #0 f () at t.c:2
  9142. #1 0x00000000004004d2 in a () at t.c:8
  9143. #2 0x0000000000400395 in main () at t.c:9
  9144. Frames #0 and #2 are real, #1 is a virtual tail call frame. The code
  9145. can have possible execution paths 'main->a->b->c->d->f' or
  9146. 'main->a->b->e->f', GDB cannot find which one from the inferior state.
  9147. 'initial:' state shows some random possible calling sequence GDB has
  9148. found. It then finds another possible calling sequence - that one is
  9149. prefixed by 'compare:'. The non-ambiguous intersection of these two is
  9150. printed as the 'reduced:' calling sequence. That one could have many
  9151. further 'compare:' and 'reduced:' statements as long as there remain any
  9152. non-ambiguous sequence entries.
  9153. For the frame of function 'b' in both cases there are different
  9154. possible '$pc' values ('0x4004cc' or '0x4004ce'), therefore this frame
  9155. is also ambiguous. The only non-ambiguous frame is the one for function
  9156. 'a', therefore this one is displayed to the user while the ambiguous
  9157. frames are omitted.
  9158. There can be also reasons why printing of frame argument values at
  9159. function entry may fail:
  9160. int v;
  9161. static void __attribute__((noinline, noclone)) c (int i) { v++; }
  9162. static void __attribute__((noinline, noclone)) a (int i);
  9163. static void __attribute__((noinline, noclone)) b (int i) { a (i); }
  9164. static void __attribute__((noinline, noclone)) a (int i)
  9165. { if (i) b (i - 1); else c (0); }
  9166. int main (void) { a (5); return 0; }
  9167. (gdb) bt
  9168. #0 c (i=i@entry=0) at t.c:2
  9169. #1 0x0000000000400428 in a (DW_OP_entry_value resolving has found
  9170. function "a" at 0x400420 can call itself via tail calls
  9171. i=<optimized out>) at t.c:6
  9172. #2 0x000000000040036e in main () at t.c:7
  9173. GDB cannot find out from the inferior state if and how many times did
  9174. function 'a' call itself (via function 'b') as these calls would be tail
  9175. calls. Such tail calls would modify the 'i' variable, therefore GDB
  9176. cannot be sure the value it knows would be right - GDB prints
  9177. '<optimized out>' instead.
  9178. 
  9179. File: gdb.info, Node: Macros, Next: Tracepoints, Prev: Optimized Code, Up: Top
  9180. 12 C Preprocessor Macros
  9181. ************************
  9182. Some languages, such as C and C++, provide a way to define and invoke
  9183. "preprocessor macros" which expand into strings of tokens. GDB can
  9184. evaluate expressions containing macro invocations, show the result of
  9185. macro expansion, and show a macro's definition, including where it was
  9186. defined.
  9187. You may need to compile your program specially to provide GDB with
  9188. information about preprocessor macros. Most compilers do not include
  9189. macros in their debugging information, even when you compile with the
  9190. '-g' flag. *Note Compilation::.
  9191. A program may define a macro at one point, remove that definition
  9192. later, and then provide a different definition after that. Thus, at
  9193. different points in the program, a macro may have different definitions,
  9194. or have no definition at all. If there is a current stack frame, GDB
  9195. uses the macros in scope at that frame's source code line. Otherwise,
  9196. GDB uses the macros in scope at the current listing location; see *note
  9197. List::.
  9198. Whenever GDB evaluates an expression, it always expands any macro
  9199. invocations present in the expression. GDB also provides the following
  9200. commands for working with macros explicitly.
  9201. 'macro expand EXPRESSION'
  9202. 'macro exp EXPRESSION'
  9203. Show the results of expanding all preprocessor macro invocations in
  9204. EXPRESSION. Since GDB simply expands macros, but does not parse
  9205. the result, EXPRESSION need not be a valid expression; it can be
  9206. any string of tokens.
  9207. 'macro expand-once EXPRESSION'
  9208. 'macro exp1 EXPRESSION'
  9209. (This command is not yet implemented.) Show the results of
  9210. expanding those preprocessor macro invocations that appear
  9211. explicitly in EXPRESSION. Macro invocations appearing in that
  9212. expansion are left unchanged. This command allows you to see the
  9213. effect of a particular macro more clearly, without being confused
  9214. by further expansions. Since GDB simply expands macros, but does
  9215. not parse the result, EXPRESSION need not be a valid expression; it
  9216. can be any string of tokens.
  9217. 'info macro [-a|-all] [--] MACRO'
  9218. Show the current definition or all definitions of the named MACRO,
  9219. and describe the source location or compiler command-line where
  9220. that definition was established. The optional double dash is to
  9221. signify the end of argument processing and the beginning of MACRO
  9222. for non C-like macros where the macro may begin with a hyphen.
  9223. 'info macros LOCATION'
  9224. Show all macro definitions that are in effect at the location
  9225. specified by LOCATION, and describe the source location or compiler
  9226. command-line where those definitions were established.
  9227. 'macro define MACRO REPLACEMENT-LIST'
  9228. 'macro define MACRO(ARGLIST) REPLACEMENT-LIST'
  9229. Introduce a definition for a preprocessor macro named MACRO,
  9230. invocations of which are replaced by the tokens given in
  9231. REPLACEMENT-LIST. The first form of this command defines an
  9232. "object-like" macro, which takes no arguments; the second form
  9233. defines a "function-like" macro, which takes the arguments given in
  9234. ARGLIST.
  9235. A definition introduced by this command is in scope in every
  9236. expression evaluated in GDB, until it is removed with the 'macro
  9237. undef' command, described below. The definition overrides all
  9238. definitions for MACRO present in the program being debugged, as
  9239. well as any previous user-supplied definition.
  9240. 'macro undef MACRO'
  9241. Remove any user-supplied definition for the macro named MACRO.
  9242. This command only affects definitions provided with the 'macro
  9243. define' command, described above; it cannot remove definitions
  9244. present in the program being debugged.
  9245. 'macro list'
  9246. List all the macros defined using the 'macro define' command.
  9247. Here is a transcript showing the above commands in action. First, we
  9248. show our source files:
  9249. $ cat sample.c
  9250. #include <stdio.h>
  9251. #include "sample.h"
  9252. #define M 42
  9253. #define ADD(x) (M + x)
  9254. main ()
  9255. {
  9256. #define N 28
  9257. printf ("Hello, world!\n");
  9258. #undef N
  9259. printf ("We're so creative.\n");
  9260. #define N 1729
  9261. printf ("Goodbye, world!\n");
  9262. }
  9263. $ cat sample.h
  9264. #define Q <
  9265. $
  9266. Now, we compile the program using the GNU C compiler, GCC. We pass
  9267. the '-gdwarf-2'(1) _and_ '-g3' flags to ensure the compiler includes
  9268. information about preprocessor macros in the debugging information.
  9269. $ gcc -gdwarf-2 -g3 sample.c -o sample
  9270. $
  9271. Now, we start GDB on our sample program:
  9272. $ gdb -nw sample
  9273. GNU gdb 2002-05-06-cvs
  9274. Copyright 2002 Free Software Foundation, Inc.
  9275. GDB is free software, ...
  9276. (gdb)
  9277. We can expand macros and examine their definitions, even when the
  9278. program is not running. GDB uses the current listing position to decide
  9279. which macro definitions are in scope:
  9280. (gdb) list main
  9281. 3
  9282. 4 #define M 42
  9283. 5 #define ADD(x) (M + x)
  9284. 6
  9285. 7 main ()
  9286. 8 {
  9287. 9 #define N 28
  9288. 10 printf ("Hello, world!\n");
  9289. 11 #undef N
  9290. 12 printf ("We're so creative.\n");
  9291. (gdb) info macro ADD
  9292. Defined at /home/jimb/gdb/macros/play/sample.c:5
  9293. #define ADD(x) (M + x)
  9294. (gdb) info macro Q
  9295. Defined at /home/jimb/gdb/macros/play/sample.h:1
  9296. included at /home/jimb/gdb/macros/play/sample.c:2
  9297. #define Q <
  9298. (gdb) macro expand ADD(1)
  9299. expands to: (42 + 1)
  9300. (gdb) macro expand-once ADD(1)
  9301. expands to: once (M + 1)
  9302. (gdb)
  9303. In the example above, note that 'macro expand-once' expands only the
  9304. macro invocation explicit in the original text -- the invocation of
  9305. 'ADD' -- but does not expand the invocation of the macro 'M', which was
  9306. introduced by 'ADD'.
  9307. Once the program is running, GDB uses the macro definitions in force
  9308. at the source line of the current stack frame:
  9309. (gdb) break main
  9310. Breakpoint 1 at 0x8048370: file sample.c, line 10.
  9311. (gdb) run
  9312. Starting program: /home/jimb/gdb/macros/play/sample
  9313. Breakpoint 1, main () at sample.c:10
  9314. 10 printf ("Hello, world!\n");
  9315. (gdb)
  9316. At line 10, the definition of the macro 'N' at line 9 is in force:
  9317. (gdb) info macro N
  9318. Defined at /home/jimb/gdb/macros/play/sample.c:9
  9319. #define N 28
  9320. (gdb) macro expand N Q M
  9321. expands to: 28 < 42
  9322. (gdb) print N Q M
  9323. $1 = 1
  9324. (gdb)
  9325. As we step over directives that remove 'N''s definition, and then
  9326. give it a new definition, GDB finds the definition (or lack thereof) in
  9327. force at each point:
  9328. (gdb) next
  9329. Hello, world!
  9330. 12 printf ("We're so creative.\n");
  9331. (gdb) info macro N
  9332. The symbol `N' has no definition as a C/C++ preprocessor macro
  9333. at /home/jimb/gdb/macros/play/sample.c:12
  9334. (gdb) next
  9335. We're so creative.
  9336. 14 printf ("Goodbye, world!\n");
  9337. (gdb) info macro N
  9338. Defined at /home/jimb/gdb/macros/play/sample.c:13
  9339. #define N 1729
  9340. (gdb) macro expand N Q M
  9341. expands to: 1729 < 42
  9342. (gdb) print N Q M
  9343. $2 = 0
  9344. (gdb)
  9345. In addition to source files, macros can be defined on the compilation
  9346. command line using the '-DNAME=VALUE' syntax. For macros defined in
  9347. such a way, GDB displays the location of their definition as line zero
  9348. of the source file submitted to the compiler.
  9349. (gdb) info macro __STDC__
  9350. Defined at /home/jimb/gdb/macros/play/sample.c:0
  9351. -D__STDC__=1
  9352. (gdb)
  9353. ---------- Footnotes ----------
  9354. (1) This is the minimum. Recent versions of GCC support '-gdwarf-3'
  9355. and '-gdwarf-4'; we recommend always choosing the most recent version of
  9356. DWARF.
  9357. 
  9358. File: gdb.info, Node: Tracepoints, Next: Overlays, Prev: Macros, Up: Top
  9359. 13 Tracepoints
  9360. **************
  9361. In some applications, it is not feasible for the debugger to interrupt
  9362. the program's execution long enough for the developer to learn anything
  9363. helpful about its behavior. If the program's correctness depends on its
  9364. real-time behavior, delays introduced by a debugger might cause the
  9365. program to change its behavior drastically, or perhaps fail, even when
  9366. the code itself is correct. It is useful to be able to observe the
  9367. program's behavior without interrupting it.
  9368. Using GDB's 'trace' and 'collect' commands, you can specify locations
  9369. in the program, called "tracepoints", and arbitrary expressions to
  9370. evaluate when those tracepoints are reached. Later, using the 'tfind'
  9371. command, you can examine the values those expressions had when the
  9372. program hit the tracepoints. The expressions may also denote objects in
  9373. memory--structures or arrays, for example--whose values GDB should
  9374. record; while visiting a particular tracepoint, you may inspect those
  9375. objects as if they were in memory at that moment. However, because GDB
  9376. records these values without interacting with you, it can do so quickly
  9377. and unobtrusively, hopefully not disturbing the program's behavior.
  9378. The tracepoint facility is currently available only for remote
  9379. targets. *Note Targets::. In addition, your remote target must know
  9380. how to collect trace data. This functionality is implemented in the
  9381. remote stub; however, none of the stubs distributed with GDB support
  9382. tracepoints as of this writing. The format of the remote packets used
  9383. to implement tracepoints are described in *note Tracepoint Packets::.
  9384. It is also possible to get trace data from a file, in a manner
  9385. reminiscent of corefiles; you specify the filename, and use 'tfind' to
  9386. search through the file. *Note Trace Files::, for more details.
  9387. This chapter describes the tracepoint commands and features.
  9388. * Menu:
  9389. * Set Tracepoints::
  9390. * Analyze Collected Data::
  9391. * Tracepoint Variables::
  9392. * Trace Files::
  9393. 
  9394. File: gdb.info, Node: Set Tracepoints, Next: Analyze Collected Data, Up: Tracepoints
  9395. 13.1 Commands to Set Tracepoints
  9396. ================================
  9397. Before running such a "trace experiment", an arbitrary number of
  9398. tracepoints can be set. A tracepoint is actually a special type of
  9399. breakpoint (*note Set Breaks::), so you can manipulate it using standard
  9400. breakpoint commands. For instance, as with breakpoints, tracepoint
  9401. numbers are successive integers starting from one, and many of the
  9402. commands associated with tracepoints take the tracepoint number as their
  9403. argument, to identify which tracepoint to work on.
  9404. For each tracepoint, you can specify, in advance, some arbitrary set
  9405. of data that you want the target to collect in the trace buffer when it
  9406. hits that tracepoint. The collected data can include registers, local
  9407. variables, or global data. Later, you can use GDB commands to examine
  9408. the values these data had at the time the tracepoint was hit.
  9409. Tracepoints do not support every breakpoint feature. Ignore counts
  9410. on tracepoints have no effect, and tracepoints cannot run GDB commands
  9411. when they are hit. Tracepoints may not be thread-specific either.
  9412. Some targets may support "fast tracepoints", which are inserted in a
  9413. different way (such as with a jump instead of a trap), that is faster
  9414. but possibly restricted in where they may be installed.
  9415. Regular and fast tracepoints are dynamic tracing facilities, meaning
  9416. that they can be used to insert tracepoints at (almost) any location in
  9417. the target. Some targets may also support controlling "static
  9418. tracepoints" from GDB. With static tracing, a set of instrumentation
  9419. points, also known as "markers", are embedded in the target program, and
  9420. can be activated or deactivated by name or address. These are usually
  9421. placed at locations which facilitate investigating what the target is
  9422. actually doing. GDB's support for static tracing includes being able to
  9423. list instrumentation points, and attach them with GDB defined high level
  9424. tracepoints that expose the whole range of convenience of GDB's
  9425. tracepoints support. Namely, support for collecting registers values
  9426. and values of global or local (to the instrumentation point) variables;
  9427. tracepoint conditions and trace state variables. The act of installing
  9428. a GDB static tracepoint on an instrumentation point, or marker, is
  9429. referred to as "probing" a static tracepoint marker.
  9430. 'gdbserver' supports tracepoints on some target systems. *Note
  9431. Tracepoints support in 'gdbserver': Server.
  9432. This section describes commands to set tracepoints and associated
  9433. conditions and actions.
  9434. * Menu:
  9435. * Create and Delete Tracepoints::
  9436. * Enable and Disable Tracepoints::
  9437. * Tracepoint Passcounts::
  9438. * Tracepoint Conditions::
  9439. * Trace State Variables::
  9440. * Tracepoint Actions::
  9441. * Listing Tracepoints::
  9442. * Listing Static Tracepoint Markers::
  9443. * Starting and Stopping Trace Experiments::
  9444. * Tracepoint Restrictions::
  9445. 
  9446. File: gdb.info, Node: Create and Delete Tracepoints, Next: Enable and Disable Tracepoints, Up: Set Tracepoints
  9447. 13.1.1 Create and Delete Tracepoints
  9448. ------------------------------------
  9449. 'trace LOCATION'
  9450. The 'trace' command is very similar to the 'break' command. Its
  9451. argument LOCATION can be any valid location. *Note Specify
  9452. Location::. The 'trace' command defines a tracepoint, which is a
  9453. point in the target program where the debugger will briefly stop,
  9454. collect some data, and then allow the program to continue. Setting
  9455. a tracepoint or changing its actions takes effect immediately if
  9456. the remote stub supports the 'InstallInTrace' feature (*note
  9457. install tracepoint in tracing::). If remote stub doesn't support
  9458. the 'InstallInTrace' feature, all these changes don't take effect
  9459. until the next 'tstart' command, and once a trace experiment is
  9460. running, further changes will not have any effect until the next
  9461. trace experiment starts. In addition, GDB supports "pending
  9462. tracepoints"--tracepoints whose address is not yet resolved. (This
  9463. is similar to pending breakpoints.) Pending tracepoints are not
  9464. downloaded to the target and not installed until they are resolved.
  9465. The resolution of pending tracepoints requires GDB support--when
  9466. debugging with the remote target, and GDB disconnects from the
  9467. remote stub (*note disconnected tracing::), pending tracepoints can
  9468. not be resolved (and downloaded to the remote stub) while GDB is
  9469. disconnected.
  9470. Here are some examples of using the 'trace' command:
  9471. (gdb) trace foo.c:121 // a source file and line number
  9472. (gdb) trace +2 // 2 lines forward
  9473. (gdb) trace my_function // first source line of function
  9474. (gdb) trace *my_function // EXACT start address of function
  9475. (gdb) trace *0x2117c4 // an address
  9476. You can abbreviate 'trace' as 'tr'.
  9477. 'trace LOCATION if COND'
  9478. Set a tracepoint with condition COND; evaluate the expression COND
  9479. each time the tracepoint is reached, and collect data only if the
  9480. value is nonzero--that is, if COND evaluates as true. *Note
  9481. Tracepoint Conditions: Tracepoint Conditions, for more information
  9482. on tracepoint conditions.
  9483. 'ftrace LOCATION [ if COND ]'
  9484. The 'ftrace' command sets a fast tracepoint. For targets that
  9485. support them, fast tracepoints will use a more efficient but
  9486. possibly less general technique to trigger data collection, such as
  9487. a jump instruction instead of a trap, or some sort of hardware
  9488. support. It may not be possible to create a fast tracepoint at the
  9489. desired location, in which case the command will exit with an
  9490. explanatory message.
  9491. GDB handles arguments to 'ftrace' exactly as for 'trace'.
  9492. On 32-bit x86-architecture systems, fast tracepoints normally need
  9493. to be placed at an instruction that is 5 bytes or longer, but can
  9494. be placed at 4-byte instructions if the low 64K of memory of the
  9495. target program is available to install trampolines. Some Unix-type
  9496. systems, such as GNU/Linux, exclude low addresses from the
  9497. program's address space; but for instance with the Linux kernel it
  9498. is possible to let GDB use this area by doing a 'sysctl' command to
  9499. set the 'mmap_min_addr' kernel parameter, as in
  9500. sudo sysctl -w vm.mmap_min_addr=32768
  9501. which sets the low address to 32K, which leaves plenty of room for
  9502. trampolines. The minimum address should be set to a page boundary.
  9503. 'strace LOCATION [ if COND ]'
  9504. The 'strace' command sets a static tracepoint. For targets that
  9505. support it, setting a static tracepoint probes a static
  9506. instrumentation point, or marker, found at LOCATION. It may not be
  9507. possible to set a static tracepoint at the desired location, in
  9508. which case the command will exit with an explanatory message.
  9509. GDB handles arguments to 'strace' exactly as for 'trace', with the
  9510. addition that the user can also specify '-m MARKER' as LOCATION.
  9511. This probes the marker identified by the MARKER string identifier.
  9512. This identifier depends on the static tracepoint backend library
  9513. your program is using. You can find all the marker identifiers in
  9514. the 'ID' field of the 'info static-tracepoint-markers' command
  9515. output. *Note Listing Static Tracepoint Markers: Listing Static
  9516. Tracepoint Markers. For example, in the following small program
  9517. using the UST tracing engine:
  9518. main ()
  9519. {
  9520. trace_mark(ust, bar33, "str %s", "FOOBAZ");
  9521. }
  9522. the marker id is composed of joining the first two arguments to the
  9523. 'trace_mark' call with a slash, which translates to:
  9524. (gdb) info static-tracepoint-markers
  9525. Cnt Enb ID Address What
  9526. 1 n ust/bar33 0x0000000000400ddc in main at stexample.c:22
  9527. Data: "str %s"
  9528. [etc...]
  9529. so you may probe the marker above with:
  9530. (gdb) strace -m ust/bar33
  9531. Static tracepoints accept an extra collect action -- 'collect
  9532. $_sdata'. This collects arbitrary user data passed in the probe
  9533. point call to the tracing library. In the UST example above,
  9534. you'll see that the third argument to 'trace_mark' is a printf-like
  9535. format string. The user data is then the result of running that
  9536. formatting string against the following arguments. Note that 'info
  9537. static-tracepoint-markers' command output lists that format string
  9538. in the 'Data:' field.
  9539. You can inspect this data when analyzing the trace buffer, by
  9540. printing the $_sdata variable like any other variable available to
  9541. GDB. *Note Tracepoint Action Lists: Tracepoint Actions.
  9542. The convenience variable '$tpnum' records the tracepoint number of
  9543. the most recently set tracepoint.
  9544. 'delete tracepoint [NUM]'
  9545. Permanently delete one or more tracepoints. With no argument, the
  9546. default is to delete all tracepoints. Note that the regular
  9547. 'delete' command can remove tracepoints also.
  9548. Examples:
  9549. (gdb) delete trace 1 2 3 // remove three tracepoints
  9550. (gdb) delete trace // remove all tracepoints
  9551. You can abbreviate this command as 'del tr'.
  9552. 
  9553. File: gdb.info, Node: Enable and Disable Tracepoints, Next: Tracepoint Passcounts, Prev: Create and Delete Tracepoints, Up: Set Tracepoints
  9554. 13.1.2 Enable and Disable Tracepoints
  9555. -------------------------------------
  9556. These commands are deprecated; they are equivalent to plain 'disable'
  9557. and 'enable'.
  9558. 'disable tracepoint [NUM]'
  9559. Disable tracepoint NUM, or all tracepoints if no argument NUM is
  9560. given. A disabled tracepoint will have no effect during a trace
  9561. experiment, but it is not forgotten. You can re-enable a disabled
  9562. tracepoint using the 'enable tracepoint' command. If the command
  9563. is issued during a trace experiment and the debug target has
  9564. support for disabling tracepoints during a trace experiment, then
  9565. the change will be effective immediately. Otherwise, it will be
  9566. applied to the next trace experiment.
  9567. 'enable tracepoint [NUM]'
  9568. Enable tracepoint NUM, or all tracepoints. If this command is
  9569. issued during a trace experiment and the debug target supports
  9570. enabling tracepoints during a trace experiment, then the enabled
  9571. tracepoints will become effective immediately. Otherwise, they
  9572. will become effective the next time a trace experiment is run.
  9573. 
  9574. File: gdb.info, Node: Tracepoint Passcounts, Next: Tracepoint Conditions, Prev: Enable and Disable Tracepoints, Up: Set Tracepoints
  9575. 13.1.3 Tracepoint Passcounts
  9576. ----------------------------
  9577. 'passcount [N [NUM]]'
  9578. Set the "passcount" of a tracepoint. The passcount is a way to
  9579. automatically stop a trace experiment. If a tracepoint's passcount
  9580. is N, then the trace experiment will be automatically stopped on
  9581. the N'th time that tracepoint is hit. If the tracepoint number NUM
  9582. is not specified, the 'passcount' command sets the passcount of the
  9583. most recently defined tracepoint. If no passcount is given, the
  9584. trace experiment will run until stopped explicitly by the user.
  9585. Examples:
  9586. (gdb) passcount 5 2 // Stop on the 5th execution of
  9587. // tracepoint 2
  9588. (gdb) passcount 12 // Stop on the 12th execution of the
  9589. // most recently defined tracepoint.
  9590. (gdb) trace foo
  9591. (gdb) pass 3
  9592. (gdb) trace bar
  9593. (gdb) pass 2
  9594. (gdb) trace baz
  9595. (gdb) pass 1 // Stop tracing when foo has been
  9596. // executed 3 times OR when bar has
  9597. // been executed 2 times
  9598. // OR when baz has been executed 1 time.
  9599. 
  9600. File: gdb.info, Node: Tracepoint Conditions, Next: Trace State Variables, Prev: Tracepoint Passcounts, Up: Set Tracepoints
  9601. 13.1.4 Tracepoint Conditions
  9602. ----------------------------
  9603. The simplest sort of tracepoint collects data every time your program
  9604. reaches a specified place. You can also specify a "condition" for a
  9605. tracepoint. A condition is just a Boolean expression in your
  9606. programming language (*note Expressions: Expressions.). A tracepoint
  9607. with a condition evaluates the expression each time your program reaches
  9608. it, and data collection happens only if the condition is true.
  9609. Tracepoint conditions can be specified when a tracepoint is set, by
  9610. using 'if' in the arguments to the 'trace' command. *Note Setting
  9611. Tracepoints: Create and Delete Tracepoints. They can also be set or
  9612. changed at any time with the 'condition' command, just as with
  9613. breakpoints.
  9614. Unlike breakpoint conditions, GDB does not actually evaluate the
  9615. conditional expression itself. Instead, GDB encodes the expression into
  9616. an agent expression (*note Agent Expressions::) suitable for execution
  9617. on the target, independently of GDB. Global variables become raw memory
  9618. locations, locals become stack accesses, and so forth.
  9619. For instance, suppose you have a function that is usually called
  9620. frequently, but should not be called after an error has occurred. You
  9621. could use the following tracepoint command to collect data about calls
  9622. of that function that happen while the error code is propagating through
  9623. the program; an unconditional tracepoint could end up collecting
  9624. thousands of useless trace frames that you would have to search through.
  9625. (gdb) trace normal_operation if errcode > 0
  9626. 
  9627. File: gdb.info, Node: Trace State Variables, Next: Tracepoint Actions, Prev: Tracepoint Conditions, Up: Set Tracepoints
  9628. 13.1.5 Trace State Variables
  9629. ----------------------------
  9630. A "trace state variable" is a special type of variable that is created
  9631. and managed by target-side code. The syntax is the same as that for
  9632. GDB's convenience variables (a string prefixed with "$"), but they are
  9633. stored on the target. They must be created explicitly, using a
  9634. 'tvariable' command. They are always 64-bit signed integers.
  9635. Trace state variables are remembered by GDB, and downloaded to the
  9636. target along with tracepoint information when the trace experiment
  9637. starts. There are no intrinsic limits on the number of trace state
  9638. variables, beyond memory limitations of the target.
  9639. Although trace state variables are managed by the target, you can use
  9640. them in print commands and expressions as if they were convenience
  9641. variables; GDB will get the current value from the target while the
  9642. trace experiment is running. Trace state variables share the same
  9643. namespace as other "$" variables, which means that you cannot have trace
  9644. state variables with names like '$23' or '$pc', nor can you have a trace
  9645. state variable and a convenience variable with the same name.
  9646. 'tvariable $NAME [ = EXPRESSION ]'
  9647. The 'tvariable' command creates a new trace state variable named
  9648. '$NAME', and optionally gives it an initial value of EXPRESSION.
  9649. The EXPRESSION is evaluated when this command is entered; the
  9650. result will be converted to an integer if possible, otherwise GDB
  9651. will report an error. A subsequent 'tvariable' command specifying
  9652. the same name does not create a variable, but instead assigns the
  9653. supplied initial value to the existing variable of that name,
  9654. overwriting any previous initial value. The default initial value
  9655. is 0.
  9656. 'info tvariables'
  9657. List all the trace state variables along with their initial values.
  9658. Their current values may also be displayed, if the trace experiment
  9659. is currently running.
  9660. 'delete tvariable [ $NAME ... ]'
  9661. Delete the given trace state variables, or all of them if no
  9662. arguments are specified.
  9663. 
  9664. File: gdb.info, Node: Tracepoint Actions, Next: Listing Tracepoints, Prev: Trace State Variables, Up: Set Tracepoints
  9665. 13.1.6 Tracepoint Action Lists
  9666. ------------------------------
  9667. 'actions [NUM]'
  9668. This command will prompt for a list of actions to be taken when the
  9669. tracepoint is hit. If the tracepoint number NUM is not specified,
  9670. this command sets the actions for the one that was most recently
  9671. defined (so that you can define a tracepoint and then say 'actions'
  9672. without bothering about its number). You specify the actions
  9673. themselves on the following lines, one action at a time, and
  9674. terminate the actions list with a line containing just 'end'. So
  9675. far, the only defined actions are 'collect', 'teval', and
  9676. 'while-stepping'.
  9677. 'actions' is actually equivalent to 'commands' (*note Breakpoint
  9678. Command Lists: Break Commands.), except that only the defined
  9679. actions are allowed; any other GDB command is rejected.
  9680. To remove all actions from a tracepoint, type 'actions NUM' and
  9681. follow it immediately with 'end'.
  9682. (gdb) collect DATA // collect some data
  9683. (gdb) while-stepping 5 // single-step 5 times, collect data
  9684. (gdb) end // signals the end of actions.
  9685. In the following example, the action list begins with 'collect'
  9686. commands indicating the things to be collected when the tracepoint
  9687. is hit. Then, in order to single-step and collect additional data
  9688. following the tracepoint, a 'while-stepping' command is used,
  9689. followed by the list of things to be collected after each step in a
  9690. sequence of single steps. The 'while-stepping' command is
  9691. terminated by its own separate 'end' command. Lastly, the action
  9692. list is terminated by an 'end' command.
  9693. (gdb) trace foo
  9694. (gdb) actions
  9695. Enter actions for tracepoint 1, one per line:
  9696. > collect bar,baz
  9697. > collect $regs
  9698. > while-stepping 12
  9699. > collect $pc, arr[i]
  9700. > end
  9701. end
  9702. 'collect[/MODS] EXPR1, EXPR2, ...'
  9703. Collect values of the given expressions when the tracepoint is hit.
  9704. This command accepts a comma-separated list of any valid
  9705. expressions. In addition to global, static, or local variables,
  9706. the following special arguments are supported:
  9707. '$regs'
  9708. Collect all registers.
  9709. '$args'
  9710. Collect all function arguments.
  9711. '$locals'
  9712. Collect all local variables.
  9713. '$_ret'
  9714. Collect the return address. This is helpful if you want to
  9715. see more of a backtrace.
  9716. _Note:_ The return address location can not always be reliably
  9717. determined up front, and the wrong address / registers may end
  9718. up collected instead. On some architectures the reliability
  9719. is higher for tracepoints at function entry, while on others
  9720. it's the opposite. When this happens, backtracing will stop
  9721. because the return address is found unavailable (unless
  9722. another collect rule happened to match it).
  9723. '$_probe_argc'
  9724. Collects the number of arguments from the static probe at
  9725. which the tracepoint is located. *Note Static Probe Points::.
  9726. '$_probe_argN'
  9727. N is an integer between 0 and 11. Collects the Nth argument
  9728. from the static probe at which the tracepoint is located.
  9729. *Note Static Probe Points::.
  9730. '$_sdata'
  9731. Collect static tracepoint marker specific data. Only
  9732. available for static tracepoints. *Note Tracepoint Action
  9733. Lists: Tracepoint Actions. On the UST static tracepoints
  9734. library backend, an instrumentation point resembles a 'printf'
  9735. function call. The tracing library is able to collect user
  9736. specified data formatted to a character string using the
  9737. format provided by the programmer that instrumented the
  9738. program. Other backends have similar mechanisms. Here's an
  9739. example of a UST marker call:
  9740. const char master_name[] = "$your_name";
  9741. trace_mark(channel1, marker1, "hello %s", master_name)
  9742. In this case, collecting '$_sdata' collects the string 'hello
  9743. $yourname'. When analyzing the trace buffer, you can inspect
  9744. '$_sdata' like any other variable available to GDB.
  9745. You can give several consecutive 'collect' commands, each one with
  9746. a single argument, or one 'collect' command with several arguments
  9747. separated by commas; the effect is the same.
  9748. The optional MODS changes the usual handling of the arguments. 's'
  9749. requests that pointers to chars be handled as strings, in
  9750. particular collecting the contents of the memory being pointed at,
  9751. up to the first zero. The upper bound is by default the value of
  9752. the 'print elements' variable; if 's' is followed by a decimal
  9753. number, that is the upper bound instead. So for instance
  9754. 'collect/s25 mystr' collects as many as 25 characters at 'mystr'.
  9755. The command 'info scope' (*note info scope: Symbols.) is
  9756. particularly useful for figuring out what data to collect.
  9757. 'teval EXPR1, EXPR2, ...'
  9758. Evaluate the given expressions when the tracepoint is hit. This
  9759. command accepts a comma-separated list of expressions. The results
  9760. are discarded, so this is mainly useful for assigning values to
  9761. trace state variables (*note Trace State Variables::) without
  9762. adding those values to the trace buffer, as would be the case if
  9763. the 'collect' action were used.
  9764. 'while-stepping N'
  9765. Perform N single-step instruction traces after the tracepoint,
  9766. collecting new data after each step. The 'while-stepping' command
  9767. is followed by the list of what to collect while stepping (followed
  9768. by its own 'end' command):
  9769. > while-stepping 12
  9770. > collect $regs, myglobal
  9771. > end
  9772. >
  9773. Note that '$pc' is not automatically collected by 'while-stepping';
  9774. you need to explicitly collect that register if you need it. You
  9775. may abbreviate 'while-stepping' as 'ws' or 'stepping'.
  9776. 'set default-collect EXPR1, EXPR2, ...'
  9777. This variable is a list of expressions to collect at each
  9778. tracepoint hit. It is effectively an additional 'collect' action
  9779. prepended to every tracepoint action list. The expressions are
  9780. parsed individually for each tracepoint, so for instance a variable
  9781. named 'xyz' may be interpreted as a global for one tracepoint, and
  9782. a local for another, as appropriate to the tracepoint's location.
  9783. 'show default-collect'
  9784. Show the list of expressions that are collected by default at each
  9785. tracepoint hit.
  9786. 
  9787. File: gdb.info, Node: Listing Tracepoints, Next: Listing Static Tracepoint Markers, Prev: Tracepoint Actions, Up: Set Tracepoints
  9788. 13.1.7 Listing Tracepoints
  9789. --------------------------
  9790. 'info tracepoints [NUM...]'
  9791. Display information about the tracepoint NUM. If you don't specify
  9792. a tracepoint number, displays information about all the tracepoints
  9793. defined so far. The format is similar to that used for 'info
  9794. breakpoints'; in fact, 'info tracepoints' is the same command,
  9795. simply restricting itself to tracepoints.
  9796. A tracepoint's listing may include additional information specific
  9797. to tracing:
  9798. * its passcount as given by the 'passcount N' command
  9799. * the state about installed on target of each location
  9800. (gdb) info trace
  9801. Num Type Disp Enb Address What
  9802. 1 tracepoint keep y 0x0804ab57 in foo() at main.cxx:7
  9803. while-stepping 20
  9804. collect globfoo, $regs
  9805. end
  9806. collect globfoo2
  9807. end
  9808. pass count 1200
  9809. 2 tracepoint keep y <MULTIPLE>
  9810. collect $eip
  9811. 2.1 y 0x0804859c in func4 at change-loc.h:35
  9812. installed on target
  9813. 2.2 y 0xb7ffc480 in func4 at change-loc.h:35
  9814. installed on target
  9815. 2.3 y <PENDING> set_tracepoint
  9816. 3 tracepoint keep y 0x080485b1 in foo at change-loc.c:29
  9817. not installed on target
  9818. (gdb)
  9819. This command can be abbreviated 'info tp'.
  9820. 
  9821. File: gdb.info, Node: Listing Static Tracepoint Markers, Next: Starting and Stopping Trace Experiments, Prev: Listing Tracepoints, Up: Set Tracepoints
  9822. 13.1.8 Listing Static Tracepoint Markers
  9823. ----------------------------------------
  9824. 'info static-tracepoint-markers'
  9825. Display information about all static tracepoint markers defined in
  9826. the program.
  9827. For each marker, the following columns are printed:
  9828. _Count_
  9829. An incrementing counter, output to help readability. This is
  9830. not a stable identifier.
  9831. _ID_
  9832. The marker ID, as reported by the target.
  9833. _Enabled or Disabled_
  9834. Probed markers are tagged with 'y'. 'n' identifies marks that
  9835. are not enabled.
  9836. _Address_
  9837. Where the marker is in your program, as a memory address.
  9838. _What_
  9839. Where the marker is in the source for your program, as a file
  9840. and line number. If the debug information included in the
  9841. program does not allow GDB to locate the source of the marker,
  9842. this column will be left blank.
  9843. In addition, the following information may be printed for each
  9844. marker:
  9845. _Data_
  9846. User data passed to the tracing library by the marker call.
  9847. In the UST backend, this is the format string passed as
  9848. argument to the marker call.
  9849. _Static tracepoints probing the marker_
  9850. The list of static tracepoints attached to the marker.
  9851. (gdb) info static-tracepoint-markers
  9852. Cnt ID Enb Address What
  9853. 1 ust/bar2 y 0x0000000000400e1a in main at stexample.c:25
  9854. Data: number1 %d number2 %d
  9855. Probed by static tracepoints: #2
  9856. 2 ust/bar33 n 0x0000000000400c87 in main at stexample.c:24
  9857. Data: str %s
  9858. (gdb)
  9859. 
  9860. File: gdb.info, Node: Starting and Stopping Trace Experiments, Next: Tracepoint Restrictions, Prev: Listing Static Tracepoint Markers, Up: Set Tracepoints
  9861. 13.1.9 Starting and Stopping Trace Experiments
  9862. ----------------------------------------------
  9863. 'tstart'
  9864. This command starts the trace experiment, and begins collecting
  9865. data. It has the side effect of discarding all the data collected
  9866. in the trace buffer during the previous trace experiment. If any
  9867. arguments are supplied, they are taken as a note and stored with
  9868. the trace experiment's state. The notes may be arbitrary text, and
  9869. are especially useful with disconnected tracing in a multi-user
  9870. context; the notes can explain what the trace is doing, supply user
  9871. contact information, and so forth.
  9872. 'tstop'
  9873. This command stops the trace experiment. If any arguments are
  9874. supplied, they are recorded with the experiment as a note. This is
  9875. useful if you are stopping a trace started by someone else, for
  9876. instance if the trace is interfering with the system's behavior and
  9877. needs to be stopped quickly.
  9878. *Note*: a trace experiment and data collection may stop
  9879. automatically if any tracepoint's passcount is reached (*note
  9880. Tracepoint Passcounts::), or if the trace buffer becomes full.
  9881. 'tstatus'
  9882. This command displays the status of the current trace data
  9883. collection.
  9884. Here is an example of the commands we described so far:
  9885. (gdb) trace gdb_c_test
  9886. (gdb) actions
  9887. Enter actions for tracepoint #1, one per line.
  9888. > collect $regs,$locals,$args
  9889. > while-stepping 11
  9890. > collect $regs
  9891. > end
  9892. > end
  9893. (gdb) tstart
  9894. [time passes ...]
  9895. (gdb) tstop
  9896. You can choose to continue running the trace experiment even if GDB
  9897. disconnects from the target, voluntarily or involuntarily. For commands
  9898. such as 'detach', the debugger will ask what you want to do with the
  9899. trace. But for unexpected terminations (GDB crash, network outage), it
  9900. would be unfortunate to lose hard-won trace data, so the variable
  9901. 'disconnected-tracing' lets you decide whether the trace should continue
  9902. running without GDB.
  9903. 'set disconnected-tracing on'
  9904. 'set disconnected-tracing off'
  9905. Choose whether a tracing run should continue to run if GDB has
  9906. disconnected from the target. Note that 'detach' or 'quit' will
  9907. ask you directly what to do about a running trace no matter what
  9908. this variable's setting, so the variable is mainly useful for
  9909. handling unexpected situations, such as loss of the network.
  9910. 'show disconnected-tracing'
  9911. Show the current choice for disconnected tracing.
  9912. When you reconnect to the target, the trace experiment may or may not
  9913. still be running; it might have filled the trace buffer in the meantime,
  9914. or stopped for one of the other reasons. If it is running, it will
  9915. continue after reconnection.
  9916. Upon reconnection, the target will upload information about the
  9917. tracepoints in effect. GDB will then compare that information to the
  9918. set of tracepoints currently defined, and attempt to match them up,
  9919. allowing for the possibility that the numbers may have changed due to
  9920. creation and deletion in the meantime. If one of the target's
  9921. tracepoints does not match any in GDB, the debugger will create a new
  9922. tracepoint, so that you have a number with which to specify that
  9923. tracepoint. This matching-up process is necessarily heuristic, and it
  9924. may result in useless tracepoints being created; you may simply delete
  9925. them if they are of no use.
  9926. If your target agent supports a "circular trace buffer", then you can
  9927. run a trace experiment indefinitely without filling the trace buffer;
  9928. when space runs out, the agent deletes already-collected trace frames,
  9929. oldest first, until there is enough room to continue collecting. This
  9930. is especially useful if your tracepoints are being hit too often, and
  9931. your trace gets terminated prematurely because the buffer is full. To
  9932. ask for a circular trace buffer, simply set 'circular-trace-buffer' to
  9933. on. You can set this at any time, including during tracing; if the
  9934. agent can do it, it will change buffer handling on the fly, otherwise it
  9935. will not take effect until the next run.
  9936. 'set circular-trace-buffer on'
  9937. 'set circular-trace-buffer off'
  9938. Choose whether a tracing run should use a linear or circular buffer
  9939. for trace data. A linear buffer will not lose any trace data, but
  9940. may fill up prematurely, while a circular buffer will discard old
  9941. trace data, but it will have always room for the latest tracepoint
  9942. hits.
  9943. 'show circular-trace-buffer'
  9944. Show the current choice for the trace buffer. Note that this may
  9945. not match the agent's current buffer handling, nor is it guaranteed
  9946. to match the setting that might have been in effect during a past
  9947. run, for instance if you are looking at frames from a trace file.
  9948. 'set trace-buffer-size N'
  9949. 'set trace-buffer-size unlimited'
  9950. Request that the target use a trace buffer of N bytes. Not all
  9951. targets will honor the request; they may have a compiled-in size
  9952. for the trace buffer, or some other limitation. Set to a value of
  9953. 'unlimited' or '-1' to let the target use whatever size it likes.
  9954. This is also the default.
  9955. 'show trace-buffer-size'
  9956. Show the current requested size for the trace buffer. Note that
  9957. this will only match the actual size if the target supports
  9958. size-setting, and was able to handle the requested size. For
  9959. instance, if the target can only change buffer size between runs,
  9960. this variable will not reflect the change until the next run
  9961. starts. Use 'tstatus' to get a report of the actual buffer size.
  9962. 'set trace-user TEXT'
  9963. 'show trace-user'
  9964. 'set trace-notes TEXT'
  9965. Set the trace run's notes.
  9966. 'show trace-notes'
  9967. Show the trace run's notes.
  9968. 'set trace-stop-notes TEXT'
  9969. Set the trace run's stop notes. The handling of the note is as for
  9970. 'tstop' arguments; the set command is convenient way to fix a stop
  9971. note that is mistaken or incomplete.
  9972. 'show trace-stop-notes'
  9973. Show the trace run's stop notes.
  9974. 
  9975. File: gdb.info, Node: Tracepoint Restrictions, Prev: Starting and Stopping Trace Experiments, Up: Set Tracepoints
  9976. 13.1.10 Tracepoint Restrictions
  9977. -------------------------------
  9978. There are a number of restrictions on the use of tracepoints. As
  9979. described above, tracepoint data gathering occurs on the target without
  9980. interaction from GDB. Thus the full capabilities of the debugger are
  9981. not available during data gathering, and then at data examination time,
  9982. you will be limited by only having what was collected. The following
  9983. items describe some common problems, but it is not exhaustive, and you
  9984. may run into additional difficulties not mentioned here.
  9985. * Tracepoint expressions are intended to gather objects (lvalues).
  9986. Thus the full flexibility of GDB's expression evaluator is not
  9987. available. You cannot call functions, cast objects to aggregate
  9988. types, access convenience variables or modify values (except by
  9989. assignment to trace state variables). Some language features may
  9990. implicitly call functions (for instance Objective-C fields with
  9991. accessors), and therefore cannot be collected either.
  9992. * Collection of local variables, either individually or in bulk with
  9993. '$locals' or '$args', during 'while-stepping' may behave
  9994. erratically. The stepping action may enter a new scope (for
  9995. instance by stepping into a function), or the location of the
  9996. variable may change (for instance it is loaded into a register).
  9997. The tracepoint data recorded uses the location information for the
  9998. variables that is correct for the tracepoint location. When the
  9999. tracepoint is created, it is not possible, in general, to determine
  10000. where the steps of a 'while-stepping' sequence will advance the
  10001. program--particularly if a conditional branch is stepped.
  10002. * Collection of an incompletely-initialized or partially-destroyed
  10003. object may result in something that GDB cannot display, or displays
  10004. in a misleading way.
  10005. * When GDB displays a pointer to character it automatically
  10006. dereferences the pointer to also display characters of the string
  10007. being pointed to. However, collecting the pointer during tracing
  10008. does not automatically collect the string. You need to explicitly
  10009. dereference the pointer and provide size information if you want to
  10010. collect not only the pointer, but the memory pointed to. For
  10011. example, '*ptr@50' can be used to collect the 50 element array
  10012. pointed to by 'ptr'.
  10013. * It is not possible to collect a complete stack backtrace at a
  10014. tracepoint. Instead, you may collect the registers and a few
  10015. hundred bytes from the stack pointer with something like
  10016. '*(unsigned char *)$esp@300' (adjust to use the name of the actual
  10017. stack pointer register on your target architecture, and the amount
  10018. of stack you wish to capture). Then the 'backtrace' command will
  10019. show a partial backtrace when using a trace frame. The number of
  10020. stack frames that can be examined depends on the sizes of the
  10021. frames in the collected stack. Note that if you ask for a block so
  10022. large that it goes past the bottom of the stack, the target agent
  10023. may report an error trying to read from an invalid address.
  10024. * If you do not collect registers at a tracepoint, GDB can infer that
  10025. the value of '$pc' must be the same as the address of the
  10026. tracepoint and use that when you are looking at a trace frame for
  10027. that tracepoint. However, this cannot work if the tracepoint has
  10028. multiple locations (for instance if it was set in a function that
  10029. was inlined), or if it has a 'while-stepping' loop. In those cases
  10030. GDB will warn you that it can't infer '$pc', and default it to
  10031. zero.
  10032. 
  10033. File: gdb.info, Node: Analyze Collected Data, Next: Tracepoint Variables, Prev: Set Tracepoints, Up: Tracepoints
  10034. 13.2 Using the Collected Data
  10035. =============================
  10036. After the tracepoint experiment ends, you use GDB commands for examining
  10037. the trace data. The basic idea is that each tracepoint collects a trace
  10038. "snapshot" every time it is hit and another snapshot every time it
  10039. single-steps. All these snapshots are consecutively numbered from zero
  10040. and go into a buffer, and you can examine them later. The way you
  10041. examine them is to "focus" on a specific trace snapshot. When the
  10042. remote stub is focused on a trace snapshot, it will respond to all GDB
  10043. requests for memory and registers by reading from the buffer which
  10044. belongs to that snapshot, rather than from _real_ memory or registers of
  10045. the program being debugged. This means that *all* GDB commands
  10046. ('print', 'info registers', 'backtrace', etc.) will behave as if we
  10047. were currently debugging the program state as it was when the tracepoint
  10048. occurred. Any requests for data that are not in the buffer will fail.
  10049. * Menu:
  10050. * tfind:: How to select a trace snapshot
  10051. * tdump:: How to display all data for a snapshot
  10052. * save tracepoints:: How to save tracepoints for a future run
  10053. 
  10054. File: gdb.info, Node: tfind, Next: tdump, Up: Analyze Collected Data
  10055. 13.2.1 'tfind N'
  10056. ----------------
  10057. The basic command for selecting a trace snapshot from the buffer is
  10058. 'tfind N', which finds trace snapshot number N, counting from zero. If
  10059. no argument N is given, the next snapshot is selected.
  10060. Here are the various forms of using the 'tfind' command.
  10061. 'tfind start'
  10062. Find the first snapshot in the buffer. This is a synonym for
  10063. 'tfind 0' (since 0 is the number of the first snapshot).
  10064. 'tfind none'
  10065. Stop debugging trace snapshots, resume _live_ debugging.
  10066. 'tfind end'
  10067. Same as 'tfind none'.
  10068. 'tfind'
  10069. No argument means find the next trace snapshot or find the first
  10070. one if no trace snapshot is selected.
  10071. 'tfind -'
  10072. Find the previous trace snapshot before the current one. This
  10073. permits retracing earlier steps.
  10074. 'tfind tracepoint NUM'
  10075. Find the next snapshot associated with tracepoint NUM. Search
  10076. proceeds forward from the last examined trace snapshot. If no
  10077. argument NUM is given, it means find the next snapshot collected
  10078. for the same tracepoint as the current snapshot.
  10079. 'tfind pc ADDR'
  10080. Find the next snapshot associated with the value ADDR of the
  10081. program counter. Search proceeds forward from the last examined
  10082. trace snapshot. If no argument ADDR is given, it means find the
  10083. next snapshot with the same value of PC as the current snapshot.
  10084. 'tfind outside ADDR1, ADDR2'
  10085. Find the next snapshot whose PC is outside the given range of
  10086. addresses (exclusive).
  10087. 'tfind range ADDR1, ADDR2'
  10088. Find the next snapshot whose PC is between ADDR1 and ADDR2
  10089. (inclusive).
  10090. 'tfind line [FILE:]N'
  10091. Find the next snapshot associated with the source line N. If the
  10092. optional argument FILE is given, refer to line N in that source
  10093. file. Search proceeds forward from the last examined trace
  10094. snapshot. If no argument N is given, it means find the next line
  10095. other than the one currently being examined; thus saying 'tfind
  10096. line' repeatedly can appear to have the same effect as stepping
  10097. from line to line in a _live_ debugging session.
  10098. The default arguments for the 'tfind' commands are specifically
  10099. designed to make it easy to scan through the trace buffer. For
  10100. instance, 'tfind' with no argument selects the next trace snapshot, and
  10101. 'tfind -' with no argument selects the previous trace snapshot. So, by
  10102. giving one 'tfind' command, and then simply hitting <RET> repeatedly you
  10103. can examine all the trace snapshots in order. Or, by saying 'tfind -'
  10104. and then hitting <RET> repeatedly you can examine the snapshots in
  10105. reverse order. The 'tfind line' command with no argument selects the
  10106. snapshot for the next source line executed. The 'tfind pc' command with
  10107. no argument selects the next snapshot with the same program counter (PC)
  10108. as the current frame. The 'tfind tracepoint' command with no argument
  10109. selects the next trace snapshot collected by the same tracepoint as the
  10110. current one.
  10111. In addition to letting you scan through the trace buffer manually,
  10112. these commands make it easy to construct GDB scripts that scan through
  10113. the trace buffer and print out whatever collected data you are
  10114. interested in. Thus, if we want to examine the PC, FP, and SP registers
  10115. from each trace frame in the buffer, we can say this:
  10116. (gdb) tfind start
  10117. (gdb) while ($trace_frame != -1)
  10118. > printf "Frame %d, PC = %08X, SP = %08X, FP = %08X\n", \
  10119. $trace_frame, $pc, $sp, $fp
  10120. > tfind
  10121. > end
  10122. Frame 0, PC = 0020DC64, SP = 0030BF3C, FP = 0030BF44
  10123. Frame 1, PC = 0020DC6C, SP = 0030BF38, FP = 0030BF44
  10124. Frame 2, PC = 0020DC70, SP = 0030BF34, FP = 0030BF44
  10125. Frame 3, PC = 0020DC74, SP = 0030BF30, FP = 0030BF44
  10126. Frame 4, PC = 0020DC78, SP = 0030BF2C, FP = 0030BF44
  10127. Frame 5, PC = 0020DC7C, SP = 0030BF28, FP = 0030BF44
  10128. Frame 6, PC = 0020DC80, SP = 0030BF24, FP = 0030BF44
  10129. Frame 7, PC = 0020DC84, SP = 0030BF20, FP = 0030BF44
  10130. Frame 8, PC = 0020DC88, SP = 0030BF1C, FP = 0030BF44
  10131. Frame 9, PC = 0020DC8E, SP = 0030BF18, FP = 0030BF44
  10132. Frame 10, PC = 00203F6C, SP = 0030BE3C, FP = 0030BF14
  10133. Or, if we want to examine the variable 'X' at each source line in the
  10134. buffer:
  10135. (gdb) tfind start
  10136. (gdb) while ($trace_frame != -1)
  10137. > printf "Frame %d, X == %d\n", $trace_frame, X
  10138. > tfind line
  10139. > end
  10140. Frame 0, X = 1
  10141. Frame 7, X = 2
  10142. Frame 13, X = 255
  10143. 
  10144. File: gdb.info, Node: tdump, Next: save tracepoints, Prev: tfind, Up: Analyze Collected Data
  10145. 13.2.2 'tdump'
  10146. --------------
  10147. This command takes no arguments. It prints all the data collected at
  10148. the current trace snapshot.
  10149. (gdb) trace 444
  10150. (gdb) actions
  10151. Enter actions for tracepoint #2, one per line:
  10152. > collect $regs, $locals, $args, gdb_long_test
  10153. > end
  10154. (gdb) tstart
  10155. (gdb) tfind line 444
  10156. #0 gdb_test (p1=0x11, p2=0x22, p3=0x33, p4=0x44, p5=0x55, p6=0x66)
  10157. at gdb_test.c:444
  10158. 444 printp( "%s: arguments = 0x%X 0x%X 0x%X 0x%X 0x%X 0x%X\n", )
  10159. (gdb) tdump
  10160. Data collected at tracepoint 2, trace frame 1:
  10161. d0 0xc4aa0085 -995491707
  10162. d1 0x18 24
  10163. d2 0x80 128
  10164. d3 0x33 51
  10165. d4 0x71aea3d 119204413
  10166. d5 0x22 34
  10167. d6 0xe0 224
  10168. d7 0x380035 3670069
  10169. a0 0x19e24a 1696330
  10170. a1 0x3000668 50333288
  10171. a2 0x100 256
  10172. a3 0x322000 3284992
  10173. a4 0x3000698 50333336
  10174. a5 0x1ad3cc 1758156
  10175. fp 0x30bf3c 0x30bf3c
  10176. sp 0x30bf34 0x30bf34
  10177. ps 0x0 0
  10178. pc 0x20b2c8 0x20b2c8
  10179. fpcontrol 0x0 0
  10180. fpstatus 0x0 0
  10181. fpiaddr 0x0 0
  10182. p = 0x20e5b4 "gdb-test"
  10183. p1 = (void *) 0x11
  10184. p2 = (void *) 0x22
  10185. p3 = (void *) 0x33
  10186. p4 = (void *) 0x44
  10187. p5 = (void *) 0x55
  10188. p6 = (void *) 0x66
  10189. gdb_long_test = 17 '\021'
  10190. (gdb)
  10191. 'tdump' works by scanning the tracepoint's current collection actions
  10192. and printing the value of each expression listed. So 'tdump' can fail,
  10193. if after a run, you change the tracepoint's actions to mention variables
  10194. that were not collected during the run.
  10195. Also, for tracepoints with 'while-stepping' loops, 'tdump' uses the
  10196. collected value of '$pc' to distinguish between trace frames that were
  10197. collected at the tracepoint hit, and frames that were collected while
  10198. stepping. This allows it to correctly choose whether to display the
  10199. basic list of collections, or the collections from the body of the
  10200. while-stepping loop. However, if '$pc' was not collected, then 'tdump'
  10201. will always attempt to dump using the basic collection list, and may
  10202. fail if a while-stepping frame does not include all the same data that
  10203. is collected at the tracepoint hit.
  10204. 
  10205. File: gdb.info, Node: save tracepoints, Prev: tdump, Up: Analyze Collected Data
  10206. 13.2.3 'save tracepoints FILENAME'
  10207. ----------------------------------
  10208. This command saves all current tracepoint definitions together with
  10209. their actions and passcounts, into a file 'FILENAME' suitable for use in
  10210. a later debugging session. To read the saved tracepoint definitions,
  10211. use the 'source' command (*note Command Files::). The
  10212. 'save-tracepoints' command is a deprecated alias for 'save tracepoints'
  10213. 
  10214. File: gdb.info, Node: Tracepoint Variables, Next: Trace Files, Prev: Analyze Collected Data, Up: Tracepoints
  10215. 13.3 Convenience Variables for Tracepoints
  10216. ==========================================
  10217. '(int) $trace_frame'
  10218. The current trace snapshot (a.k.a. "frame") number, or -1 if no
  10219. snapshot is selected.
  10220. '(int) $tracepoint'
  10221. The tracepoint for the current trace snapshot.
  10222. '(int) $trace_line'
  10223. The line number for the current trace snapshot.
  10224. '(char []) $trace_file'
  10225. The source file for the current trace snapshot.
  10226. '(char []) $trace_func'
  10227. The name of the function containing '$tracepoint'.
  10228. Note: '$trace_file' is not suitable for use in 'printf', use 'output'
  10229. instead.
  10230. Here's a simple example of using these convenience variables for
  10231. stepping through all the trace snapshots and printing some of their
  10232. data. Note that these are not the same as trace state variables, which
  10233. are managed by the target.
  10234. (gdb) tfind start
  10235. (gdb) while $trace_frame != -1
  10236. > output $trace_file
  10237. > printf ", line %d (tracepoint #%d)\n", $trace_line, $tracepoint
  10238. > tfind
  10239. > end
  10240. 
  10241. File: gdb.info, Node: Trace Files, Prev: Tracepoint Variables, Up: Tracepoints
  10242. 13.4 Using Trace Files
  10243. ======================
  10244. In some situations, the target running a trace experiment may no longer
  10245. be available; perhaps it crashed, or the hardware was needed for a
  10246. different activity. To handle these cases, you can arrange to dump the
  10247. trace data into a file, and later use that file as a source of trace
  10248. data, via the 'target tfile' command.
  10249. 'tsave [ -r ] FILENAME'
  10250. 'tsave [-ctf] DIRNAME'
  10251. Save the trace data to FILENAME. By default, this command assumes
  10252. that FILENAME refers to the host filesystem, so if necessary GDB
  10253. will copy raw trace data up from the target and then save it. If
  10254. the target supports it, you can also supply the optional argument
  10255. '-r' ("remote") to direct the target to save the data directly into
  10256. FILENAME in its own filesystem, which may be more efficient if the
  10257. trace buffer is very large. (Note, however, that 'target tfile'
  10258. can only read from files accessible to the host.) By default, this
  10259. command will save trace frame in tfile format. You can supply the
  10260. optional argument '-ctf' to save data in CTF format. The "Common
  10261. Trace Format" (CTF) is proposed as a trace format that can be
  10262. shared by multiple debugging and tracing tools. Please go to
  10263. 'http://www.efficios.com/ctf' to get more information.
  10264. 'target tfile FILENAME'
  10265. 'target ctf DIRNAME'
  10266. Use the file named FILENAME or directory named DIRNAME as a source
  10267. of trace data. Commands that examine data work as they do with a
  10268. live target, but it is not possible to run any new trace
  10269. experiments. 'tstatus' will report the state of the trace run at
  10270. the moment the data was saved, as well as the current trace frame
  10271. you are examining. Both FILENAME and DIRNAME must be on a
  10272. filesystem accessible to the host.
  10273. (gdb) target ctf ctf.ctf
  10274. (gdb) tfind
  10275. Found trace frame 0, tracepoint 2
  10276. 39 ++a; /* set tracepoint 1 here */
  10277. (gdb) tdump
  10278. Data collected at tracepoint 2, trace frame 0:
  10279. i = 0
  10280. a = 0
  10281. b = 1 '\001'
  10282. c = {"123", "456", "789", "123", "456", "789"}
  10283. d = {{{a = 1, b = 2}, {a = 3, b = 4}}, {{a = 5, b = 6}, {a = 7, b = 8}}}
  10284. (gdb) p b
  10285. $1 = 1
  10286. 
  10287. File: gdb.info, Node: Overlays, Next: Languages, Prev: Tracepoints, Up: Top
  10288. 14 Debugging Programs That Use Overlays
  10289. ***************************************
  10290. If your program is too large to fit completely in your target system's
  10291. memory, you can sometimes use "overlays" to work around this problem.
  10292. GDB provides some support for debugging programs that use overlays.
  10293. * Menu:
  10294. * How Overlays Work:: A general explanation of overlays.
  10295. * Overlay Commands:: Managing overlays in GDB.
  10296. * Automatic Overlay Debugging:: GDB can find out which overlays are
  10297. mapped by asking the inferior.
  10298. * Overlay Sample Program:: A sample program using overlays.
  10299. 
  10300. File: gdb.info, Node: How Overlays Work, Next: Overlay Commands, Up: Overlays
  10301. 14.1 How Overlays Work
  10302. ======================
  10303. Suppose you have a computer whose instruction address space is only 64
  10304. kilobytes long, but which has much more memory which can be accessed by
  10305. other means: special instructions, segment registers, or memory
  10306. management hardware, for example. Suppose further that you want to
  10307. adapt a program which is larger than 64 kilobytes to run on this system.
  10308. One solution is to identify modules of your program which are
  10309. relatively independent, and need not call each other directly; call
  10310. these modules "overlays". Separate the overlays from the main program,
  10311. and place their machine code in the larger memory. Place your main
  10312. program in instruction memory, but leave at least enough space there to
  10313. hold the largest overlay as well.
  10314. Now, to call a function located in an overlay, you must first copy
  10315. that overlay's machine code from the large memory into the space set
  10316. aside for it in the instruction memory, and then jump to its entry point
  10317. there.
  10318. Data Instruction Larger
  10319. Address Space Address Space Address Space
  10320. +-----------+ +-----------+ +-----------+
  10321. | | | | | |
  10322. +-----------+ +-----------+ +-----------+<-- overlay 1
  10323. | program | | main | .----| overlay 1 | load address
  10324. | variables | | program | | +-----------+
  10325. | and heap | | | | | |
  10326. +-----------+ | | | +-----------+<-- overlay 2
  10327. | | +-----------+ | | | load address
  10328. +-----------+ | | | .-| overlay 2 |
  10329. | | | | | |
  10330. mapped --->+-----------+ | | +-----------+
  10331. address | | | | | |
  10332. | overlay | <-' | | |
  10333. | area | <---' +-----------+<-- overlay 3
  10334. | | <---. | | load address
  10335. +-----------+ `--| overlay 3 |
  10336. | | | |
  10337. +-----------+ | |
  10338. +-----------+
  10339. | |
  10340. +-----------+
  10341. A code overlay
  10342. The diagram (*note A code overlay::) shows a system with separate
  10343. data and instruction address spaces. To map an overlay, the program
  10344. copies its code from the larger address space to the instruction address
  10345. space. Since the overlays shown here all use the same mapped address,
  10346. only one may be mapped at a time. For a system with a single address
  10347. space for data and instructions, the diagram would be similar, except
  10348. that the program variables and heap would share an address space with
  10349. the main program and the overlay area.
  10350. An overlay loaded into instruction memory and ready for use is called
  10351. a "mapped" overlay; its "mapped address" is its address in the
  10352. instruction memory. An overlay not present (or only partially present)
  10353. in instruction memory is called "unmapped"; its "load address" is its
  10354. address in the larger memory. The mapped address is also called the
  10355. "virtual memory address", or "VMA"; the load address is also called the
  10356. "load memory address", or "LMA".
  10357. Unfortunately, overlays are not a completely transparent way to adapt
  10358. a program to limited instruction memory. They introduce a new set of
  10359. global constraints you must keep in mind as you design your program:
  10360. * Before calling or returning to a function in an overlay, your
  10361. program must make sure that overlay is actually mapped. Otherwise,
  10362. the call or return will transfer control to the right address, but
  10363. in the wrong overlay, and your program will probably crash.
  10364. * If the process of mapping an overlay is expensive on your system,
  10365. you will need to choose your overlays carefully to minimize their
  10366. effect on your program's performance.
  10367. * The executable file you load onto your system must contain each
  10368. overlay's instructions, appearing at the overlay's load address,
  10369. not its mapped address. However, each overlay's instructions must
  10370. be relocated and its symbols defined as if the overlay were at its
  10371. mapped address. You can use GNU linker scripts to specify
  10372. different load and relocation addresses for pieces of your program;
  10373. see *note (ld.info)Overlay Description::.
  10374. * The procedure for loading executable files onto your system must be
  10375. able to load their contents into the larger address space as well
  10376. as the instruction and data spaces.
  10377. The overlay system described above is rather simple, and could be
  10378. improved in many ways:
  10379. * If your system has suitable bank switch registers or memory
  10380. management hardware, you could use those facilities to make an
  10381. overlay's load area contents simply appear at their mapped address
  10382. in instruction space. This would probably be faster than copying
  10383. the overlay to its mapped area in the usual way.
  10384. * If your overlays are small enough, you could set aside more than
  10385. one overlay area, and have more than one overlay mapped at a time.
  10386. * You can use overlays to manage data, as well as instructions. In
  10387. general, data overlays are even less transparent to your design
  10388. than code overlays: whereas code overlays only require care when
  10389. you call or return to functions, data overlays require care every
  10390. time you access the data. Also, if you change the contents of a
  10391. data overlay, you must copy its contents back out to its load
  10392. address before you can copy a different data overlay into the same
  10393. mapped area.
  10394. 
  10395. File: gdb.info, Node: Overlay Commands, Next: Automatic Overlay Debugging, Prev: How Overlays Work, Up: Overlays
  10396. 14.2 Overlay Commands
  10397. =====================
  10398. To use GDB's overlay support, each overlay in your program must
  10399. correspond to a separate section of the executable file. The section's
  10400. virtual memory address and load memory address must be the overlay's
  10401. mapped and load addresses. Identifying overlays with sections allows
  10402. GDB to determine the appropriate address of a function or variable,
  10403. depending on whether the overlay is mapped or not.
  10404. GDB's overlay commands all start with the word 'overlay'; you can
  10405. abbreviate this as 'ov' or 'ovly'. The commands are:
  10406. 'overlay off'
  10407. Disable GDB's overlay support. When overlay support is disabled,
  10408. GDB assumes that all functions and variables are always present at
  10409. their mapped addresses. By default, GDB's overlay support is
  10410. disabled.
  10411. 'overlay manual'
  10412. Enable "manual" overlay debugging. In this mode, GDB relies on you
  10413. to tell it which overlays are mapped, and which are not, using the
  10414. 'overlay map-overlay' and 'overlay unmap-overlay' commands
  10415. described below.
  10416. 'overlay map-overlay OVERLAY'
  10417. 'overlay map OVERLAY'
  10418. Tell GDB that OVERLAY is now mapped; OVERLAY must be the name of
  10419. the object file section containing the overlay. When an overlay is
  10420. mapped, GDB assumes it can find the overlay's functions and
  10421. variables at their mapped addresses. GDB assumes that any other
  10422. overlays whose mapped ranges overlap that of OVERLAY are now
  10423. unmapped.
  10424. 'overlay unmap-overlay OVERLAY'
  10425. 'overlay unmap OVERLAY'
  10426. Tell GDB that OVERLAY is no longer mapped; OVERLAY must be the name
  10427. of the object file section containing the overlay. When an overlay
  10428. is unmapped, GDB assumes it can find the overlay's functions and
  10429. variables at their load addresses.
  10430. 'overlay auto'
  10431. Enable "automatic" overlay debugging. In this mode, GDB consults a
  10432. data structure the overlay manager maintains in the inferior to see
  10433. which overlays are mapped. For details, see *note Automatic
  10434. Overlay Debugging::.
  10435. 'overlay load-target'
  10436. 'overlay load'
  10437. Re-read the overlay table from the inferior. Normally, GDB
  10438. re-reads the table GDB automatically each time the inferior stops,
  10439. so this command should only be necessary if you have changed the
  10440. overlay mapping yourself using GDB. This command is only useful
  10441. when using automatic overlay debugging.
  10442. 'overlay list-overlays'
  10443. 'overlay list'
  10444. Display a list of the overlays currently mapped, along with their
  10445. mapped addresses, load addresses, and sizes.
  10446. Normally, when GDB prints a code address, it includes the name of the
  10447. function the address falls in:
  10448. (gdb) print main
  10449. $3 = {int ()} 0x11a0 <main>
  10450. When overlay debugging is enabled, GDB recognizes code in unmapped
  10451. overlays, and prints the names of unmapped functions with asterisks
  10452. around them. For example, if 'foo' is a function in an unmapped
  10453. overlay, GDB prints it this way:
  10454. (gdb) overlay list
  10455. No sections are mapped.
  10456. (gdb) print foo
  10457. $5 = {int (int)} 0x100000 <*foo*>
  10458. When 'foo''s overlay is mapped, GDB prints the function's name normally:
  10459. (gdb) overlay list
  10460. Section .ov.foo.text, loaded at 0x100000 - 0x100034,
  10461. mapped at 0x1016 - 0x104a
  10462. (gdb) print foo
  10463. $6 = {int (int)} 0x1016 <foo>
  10464. When overlay debugging is enabled, GDB can find the correct address
  10465. for functions and variables in an overlay, whether or not the overlay is
  10466. mapped. This allows most GDB commands, like 'break' and 'disassemble',
  10467. to work normally, even on unmapped code. However, GDB's breakpoint
  10468. support has some limitations:
  10469. * You can set breakpoints in functions in unmapped overlays, as long
  10470. as GDB can write to the overlay at its load address.
  10471. * GDB can not set hardware or simulator-based breakpoints in unmapped
  10472. overlays. However, if you set a breakpoint at the end of your
  10473. overlay manager (and tell GDB which overlays are now mapped, if you
  10474. are using manual overlay management), GDB will re-set its
  10475. breakpoints properly.
  10476. 
  10477. File: gdb.info, Node: Automatic Overlay Debugging, Next: Overlay Sample Program, Prev: Overlay Commands, Up: Overlays
  10478. 14.3 Automatic Overlay Debugging
  10479. ================================
  10480. GDB can automatically track which overlays are mapped and which are not,
  10481. given some simple co-operation from the overlay manager in the inferior.
  10482. If you enable automatic overlay debugging with the 'overlay auto'
  10483. command (*note Overlay Commands::), GDB looks in the inferior's memory
  10484. for certain variables describing the current state of the overlays.
  10485. Here are the variables your overlay manager must define to support
  10486. GDB's automatic overlay debugging:
  10487. '_ovly_table':
  10488. This variable must be an array of the following structures:
  10489. struct
  10490. {
  10491. /* The overlay's mapped address. */
  10492. unsigned long vma;
  10493. /* The size of the overlay, in bytes. */
  10494. unsigned long size;
  10495. /* The overlay's load address. */
  10496. unsigned long lma;
  10497. /* Non-zero if the overlay is currently mapped;
  10498. zero otherwise. */
  10499. unsigned long mapped;
  10500. }
  10501. '_novlys':
  10502. This variable must be a four-byte signed integer, holding the total
  10503. number of elements in '_ovly_table'.
  10504. To decide whether a particular overlay is mapped or not, GDB looks
  10505. for an entry in '_ovly_table' whose 'vma' and 'lma' members equal the
  10506. VMA and LMA of the overlay's section in the executable file. When GDB
  10507. finds a matching entry, it consults the entry's 'mapped' member to
  10508. determine whether the overlay is currently mapped.
  10509. In addition, your overlay manager may define a function called
  10510. '_ovly_debug_event'. If this function is defined, GDB will silently set
  10511. a breakpoint there. If the overlay manager then calls this function
  10512. whenever it has changed the overlay table, this will enable GDB to
  10513. accurately keep track of which overlays are in program memory, and
  10514. update any breakpoints that may be set in overlays. This will allow
  10515. breakpoints to work even if the overlays are kept in ROM or other
  10516. non-writable memory while they are not being executed.
  10517. 
  10518. File: gdb.info, Node: Overlay Sample Program, Prev: Automatic Overlay Debugging, Up: Overlays
  10519. 14.4 Overlay Sample Program
  10520. ===========================
  10521. When linking a program which uses overlays, you must place the overlays
  10522. at their load addresses, while relocating them to run at their mapped
  10523. addresses. To do this, you must write a linker script (*note
  10524. (ld.info)Overlay Description::). Unfortunately, since linker scripts
  10525. are specific to a particular host system, target architecture, and
  10526. target memory layout, this manual cannot provide portable sample code
  10527. demonstrating GDB's overlay support.
  10528. However, the GDB source distribution does contain an overlaid
  10529. program, with linker scripts for a few systems, as part of its test
  10530. suite. The program consists of the following files from
  10531. 'gdb/testsuite/gdb.base':
  10532. 'overlays.c'
  10533. The main program file.
  10534. 'ovlymgr.c'
  10535. A simple overlay manager, used by 'overlays.c'.
  10536. 'foo.c'
  10537. 'bar.c'
  10538. 'baz.c'
  10539. 'grbx.c'
  10540. Overlay modules, loaded and used by 'overlays.c'.
  10541. 'd10v.ld'
  10542. 'm32r.ld'
  10543. Linker scripts for linking the test program on the 'd10v-elf' and
  10544. 'm32r-elf' targets.
  10545. You can build the test program using the 'd10v-elf' GCC
  10546. cross-compiler like this:
  10547. $ d10v-elf-gcc -g -c overlays.c
  10548. $ d10v-elf-gcc -g -c ovlymgr.c
  10549. $ d10v-elf-gcc -g -c foo.c
  10550. $ d10v-elf-gcc -g -c bar.c
  10551. $ d10v-elf-gcc -g -c baz.c
  10552. $ d10v-elf-gcc -g -c grbx.c
  10553. $ d10v-elf-gcc -g overlays.o ovlymgr.o foo.o bar.o \
  10554. baz.o grbx.o -Wl,-Td10v.ld -o overlays
  10555. The build process is identical for any other architecture, except
  10556. that you must substitute the appropriate compiler and linker script for
  10557. the target system for 'd10v-elf-gcc' and 'd10v.ld'.
  10558. 
  10559. File: gdb.info, Node: Languages, Next: Symbols, Prev: Overlays, Up: Top
  10560. 15 Using GDB with Different Languages
  10561. *************************************
  10562. Although programming languages generally have common aspects, they are
  10563. rarely expressed in the same manner. For instance, in ANSI C,
  10564. dereferencing a pointer 'p' is accomplished by '*p', but in Modula-2, it
  10565. is accomplished by 'p^'. Values can also be represented (and displayed)
  10566. differently. Hex numbers in C appear as '0x1ae', while in Modula-2 they
  10567. appear as '1AEH'.
  10568. Language-specific information is built into GDB for some languages,
  10569. allowing you to express operations like the above in your program's
  10570. native language, and allowing GDB to output values in a manner
  10571. consistent with the syntax of your program's native language. The
  10572. language you use to build expressions is called the "working language".
  10573. * Menu:
  10574. * Setting:: Switching between source languages
  10575. * Show:: Displaying the language
  10576. * Checks:: Type and range checks
  10577. * Supported Languages:: Supported languages
  10578. * Unsupported Languages:: Unsupported languages
  10579. 
  10580. File: gdb.info, Node: Setting, Next: Show, Up: Languages
  10581. 15.1 Switching Between Source Languages
  10582. =======================================
  10583. There are two ways to control the working language--either have GDB set
  10584. it automatically, or select it manually yourself. You can use the 'set
  10585. language' command for either purpose. On startup, GDB defaults to
  10586. setting the language automatically. The working language is used to
  10587. determine how expressions you type are interpreted, how values are
  10588. printed, etc.
  10589. In addition to the working language, every source file that GDB knows
  10590. about has its own working language. For some object file formats, the
  10591. compiler might indicate which language a particular source file is in.
  10592. However, most of the time GDB infers the language from the name of the
  10593. file. The language of a source file controls whether C++ names are
  10594. demangled--this way 'backtrace' can show each frame appropriately for
  10595. its own language. There is no way to set the language of a source file
  10596. from within GDB, but you can set the language associated with a filename
  10597. extension. *Note Displaying the Language: Show.
  10598. This is most commonly a problem when you use a program, such as
  10599. 'cfront' or 'f2c', that generates C but is written in another language.
  10600. In that case, make the program use '#line' directives in its C output;
  10601. that way GDB will know the correct language of the source code of the
  10602. original program, and will display that source code, not the generated C
  10603. code.
  10604. * Menu:
  10605. * Filenames:: Filename extensions and languages.
  10606. * Manually:: Setting the working language manually
  10607. * Automatically:: Having GDB infer the source language
  10608. 
  10609. File: gdb.info, Node: Filenames, Next: Manually, Up: Setting
  10610. 15.1.1 List of Filename Extensions and Languages
  10611. ------------------------------------------------
  10612. If a source file name ends in one of the following extensions, then GDB
  10613. infers that its language is the one indicated.
  10614. '.ada'
  10615. '.ads'
  10616. '.adb'
  10617. '.a'
  10618. Ada source file.
  10619. '.c'
  10620. C source file
  10621. '.C'
  10622. '.cc'
  10623. '.cp'
  10624. '.cpp'
  10625. '.cxx'
  10626. '.c++'
  10627. C++ source file
  10628. '.d'
  10629. D source file
  10630. '.m'
  10631. Objective-C source file
  10632. '.f'
  10633. '.F'
  10634. Fortran source file
  10635. '.mod'
  10636. Modula-2 source file
  10637. '.s'
  10638. '.S'
  10639. Assembler source file. This actually behaves almost like C, but
  10640. GDB does not skip over function prologues when stepping.
  10641. In addition, you may set the language associated with a filename
  10642. extension. *Note Displaying the Language: Show.
  10643. 
  10644. File: gdb.info, Node: Manually, Next: Automatically, Prev: Filenames, Up: Setting
  10645. 15.1.2 Setting the Working Language
  10646. -----------------------------------
  10647. If you allow GDB to set the language automatically, expressions are
  10648. interpreted the same way in your debugging session and your program.
  10649. If you wish, you may set the language manually. To do this, issue
  10650. the command 'set language LANG', where LANG is the name of a language,
  10651. such as 'c' or 'modula-2'. For a list of the supported languages, type
  10652. 'set language'.
  10653. Setting the language manually prevents GDB from updating the working
  10654. language automatically. This can lead to confusion if you try to debug
  10655. a program when the working language is not the same as the source
  10656. language, when an expression is acceptable to both languages--but means
  10657. different things. For instance, if the current source file were written
  10658. in C, and GDB was parsing Modula-2, a command such as:
  10659. print a = b + c
  10660. might not have the effect you intended. In C, this means to add 'b' and
  10661. 'c' and place the result in 'a'. The result printed would be the value
  10662. of 'a'. In Modula-2, this means to compare 'a' to the result of 'b+c',
  10663. yielding a 'BOOLEAN' value.
  10664. 
  10665. File: gdb.info, Node: Automatically, Prev: Manually, Up: Setting
  10666. 15.1.3 Having GDB Infer the Source Language
  10667. -------------------------------------------
  10668. To have GDB set the working language automatically, use 'set language
  10669. local' or 'set language auto'. GDB then infers the working language.
  10670. That is, when your program stops in a frame (usually by encountering a
  10671. breakpoint), GDB sets the working language to the language recorded for
  10672. the function in that frame. If the language for a frame is unknown
  10673. (that is, if the function or block corresponding to the frame was
  10674. defined in a source file that does not have a recognized extension), the
  10675. current working language is not changed, and GDB issues a warning.
  10676. This may not seem necessary for most programs, which are written
  10677. entirely in one source language. However, program modules and libraries
  10678. written in one source language can be used by a main program written in
  10679. a different source language. Using 'set language auto' in this case
  10680. frees you from having to set the working language manually.
  10681. 
  10682. File: gdb.info, Node: Show, Next: Checks, Prev: Setting, Up: Languages
  10683. 15.2 Displaying the Language
  10684. ============================
  10685. The following commands help you find out which language is the working
  10686. language, and also what language source files were written in.
  10687. 'show language'
  10688. Display the current working language. This is the language you can
  10689. use with commands such as 'print' to build and compute expressions
  10690. that may involve variables in your program.
  10691. 'info frame'
  10692. Display the source language for this frame. This language becomes
  10693. the working language if you use an identifier from this frame.
  10694. *Note Information about a Frame: Frame Info, to identify the other
  10695. information listed here.
  10696. 'info source'
  10697. Display the source language of this source file. *Note Examining
  10698. the Symbol Table: Symbols, to identify the other information listed
  10699. here.
  10700. In unusual circumstances, you may have source files with extensions
  10701. not in the standard list. You can then set the extension associated
  10702. with a language explicitly:
  10703. 'set extension-language EXT LANGUAGE'
  10704. Tell GDB that source files with extension EXT are to be assumed as
  10705. written in the source language LANGUAGE.
  10706. 'info extensions'
  10707. List all the filename extensions and the associated languages.
  10708. 
  10709. File: gdb.info, Node: Checks, Next: Supported Languages, Prev: Show, Up: Languages
  10710. 15.3 Type and Range Checking
  10711. ============================
  10712. Some languages are designed to guard you against making seemingly common
  10713. errors through a series of compile- and run-time checks. These include
  10714. checking the type of arguments to functions and operators and making
  10715. sure mathematical overflows are caught at run time. Checks such as
  10716. these help to ensure a program's correctness once it has been compiled
  10717. by eliminating type mismatches and providing active checks for range
  10718. errors when your program is running.
  10719. By default GDB checks for these errors according to the rules of the
  10720. current source language. Although GDB does not check the statements in
  10721. your program, it can check expressions entered directly into GDB for
  10722. evaluation via the 'print' command, for example.
  10723. * Menu:
  10724. * Type Checking:: An overview of type checking
  10725. * Range Checking:: An overview of range checking
  10726. 
  10727. File: gdb.info, Node: Type Checking, Next: Range Checking, Up: Checks
  10728. 15.3.1 An Overview of Type Checking
  10729. -----------------------------------
  10730. Some languages, such as C and C++, are strongly typed, meaning that the
  10731. arguments to operators and functions have to be of the correct type,
  10732. otherwise an error occurs. These checks prevent type mismatch errors
  10733. from ever causing any run-time problems. For example,
  10734. int klass::my_method(char *b) { return b ? 1 : 2; }
  10735. (gdb) print obj.my_method (0)
  10736. $1 = 2
  10737. but
  10738. (gdb) print obj.my_method (0x1234)
  10739. Cannot resolve method klass::my_method to any overloaded instance
  10740. The second example fails because in C++ the integer constant '0x1234'
  10741. is not type-compatible with the pointer parameter type.
  10742. For the expressions you use in GDB commands, you can tell GDB to not
  10743. enforce strict type checking or to treat any mismatches as errors and
  10744. abandon the expression; When type checking is disabled, GDB successfully
  10745. evaluates expressions like the second example above.
  10746. Even if type checking is off, there may be other reasons related to
  10747. type that prevent GDB from evaluating an expression. For instance, GDB
  10748. does not know how to add an 'int' and a 'struct foo'. These particular
  10749. type errors have nothing to do with the language in use and usually
  10750. arise from expressions which make little sense to evaluate anyway.
  10751. GDB provides some additional commands for controlling type checking:
  10752. 'set check type on'
  10753. 'set check type off'
  10754. Set strict type checking on or off. If any type mismatches occur
  10755. in evaluating an expression while type checking is on, GDB prints a
  10756. message and aborts evaluation of the expression.
  10757. 'show check type'
  10758. Show the current setting of type checking and whether GDB is
  10759. enforcing strict type checking rules.
  10760. 
  10761. File: gdb.info, Node: Range Checking, Prev: Type Checking, Up: Checks
  10762. 15.3.2 An Overview of Range Checking
  10763. ------------------------------------
  10764. In some languages (such as Modula-2), it is an error to exceed the
  10765. bounds of a type; this is enforced with run-time checks. Such range
  10766. checking is meant to ensure program correctness by making sure
  10767. computations do not overflow, or indices on an array element access do
  10768. not exceed the bounds of the array.
  10769. For expressions you use in GDB commands, you can tell GDB to treat
  10770. range errors in one of three ways: ignore them, always treat them as
  10771. errors and abandon the expression, or issue warnings but evaluate the
  10772. expression anyway.
  10773. A range error can result from numerical overflow, from exceeding an
  10774. array index bound, or when you type a constant that is not a member of
  10775. any type. Some languages, however, do not treat overflows as an error.
  10776. In many implementations of C, mathematical overflow causes the result to
  10777. "wrap around" to lower values--for example, if M is the largest integer
  10778. value, and S is the smallest, then
  10779. M + 1 => S
  10780. This, too, is specific to individual languages, and in some cases
  10781. specific to individual compilers or machines. *Note Supported
  10782. Languages: Supported Languages, for further details on specific
  10783. languages.
  10784. GDB provides some additional commands for controlling the range
  10785. checker:
  10786. 'set check range auto'
  10787. Set range checking on or off based on the current working language.
  10788. *Note Supported Languages: Supported Languages, for the default
  10789. settings for each language.
  10790. 'set check range on'
  10791. 'set check range off'
  10792. Set range checking on or off, overriding the default setting for
  10793. the current working language. A warning is issued if the setting
  10794. does not match the language default. If a range error occurs and
  10795. range checking is on, then a message is printed and evaluation of
  10796. the expression is aborted.
  10797. 'set check range warn'
  10798. Output messages when the GDB range checker detects a range error,
  10799. but attempt to evaluate the expression anyway. Evaluating the
  10800. expression may still be impossible for other reasons, such as
  10801. accessing memory that the process does not own (a typical example
  10802. from many Unix systems).
  10803. 'show range'
  10804. Show the current setting of the range checker, and whether or not
  10805. it is being set automatically by GDB.
  10806. 
  10807. File: gdb.info, Node: Supported Languages, Next: Unsupported Languages, Prev: Checks, Up: Languages
  10808. 15.4 Supported Languages
  10809. ========================
  10810. GDB supports C, C++, D, Go, Objective-C, Fortran, OpenCL C, Pascal,
  10811. Rust, assembly, Modula-2, and Ada. Some GDB features may be used in
  10812. expressions regardless of the language you use: the GDB '@' and '::'
  10813. operators, and the '{type}addr' construct (*note Expressions:
  10814. Expressions.) can be used with the constructs of any supported language.
  10815. The following sections detail to what degree each source language is
  10816. supported by GDB. These sections are not meant to be language tutorials
  10817. or references, but serve only as a reference guide to what the GDB
  10818. expression parser accepts, and what input and output formats should look
  10819. like for different languages. There are many good books written on each
  10820. of these languages; please look to these for a language reference or
  10821. tutorial.
  10822. * Menu:
  10823. * C:: C and C++
  10824. * D:: D
  10825. * Go:: Go
  10826. * Objective-C:: Objective-C
  10827. * OpenCL C:: OpenCL C
  10828. * Fortran:: Fortran
  10829. * Pascal:: Pascal
  10830. * Rust:: Rust
  10831. * Modula-2:: Modula-2
  10832. * Ada:: Ada
  10833. 
  10834. File: gdb.info, Node: C, Next: D, Up: Supported Languages
  10835. 15.4.1 C and C++
  10836. ----------------
  10837. Since C and C++ are so closely related, many features of GDB apply to
  10838. both languages. Whenever this is the case, we discuss those languages
  10839. together.
  10840. The C++ debugging facilities are jointly implemented by the C++
  10841. compiler and GDB. Therefore, to debug your C++ code effectively, you
  10842. must compile your C++ programs with a supported C++ compiler, such as
  10843. GNU 'g++', or the HP ANSI C++ compiler ('aCC').
  10844. * Menu:
  10845. * C Operators:: C and C++ operators
  10846. * C Constants:: C and C++ constants
  10847. * C Plus Plus Expressions:: C++ expressions
  10848. * C Defaults:: Default settings for C and C++
  10849. * C Checks:: C and C++ type and range checks
  10850. * Debugging C:: GDB and C
  10851. * Debugging C Plus Plus:: GDB features for C++
  10852. * Decimal Floating Point:: Numbers in Decimal Floating Point format
  10853. 
  10854. File: gdb.info, Node: C Operators, Next: C Constants, Up: C
  10855. 15.4.1.1 C and C++ Operators
  10856. ............................
  10857. Operators must be defined on values of specific types. For instance,
  10858. '+' is defined on numbers, but not on structures. Operators are often
  10859. defined on groups of types.
  10860. For the purposes of C and C++, the following definitions hold:
  10861. * _Integral types_ include 'int' with any of its storage-class
  10862. specifiers; 'char'; 'enum'; and, for C++, 'bool'.
  10863. * _Floating-point types_ include 'float', 'double', and 'long double'
  10864. (if supported by the target platform).
  10865. * _Pointer types_ include all types defined as '(TYPE *)'.
  10866. * _Scalar types_ include all of the above.
  10867. The following operators are supported. They are listed here in order of
  10868. increasing precedence:
  10869. ','
  10870. The comma or sequencing operator. Expressions in a comma-separated
  10871. list are evaluated from left to right, with the result of the
  10872. entire expression being the last expression evaluated.
  10873. '='
  10874. Assignment. The value of an assignment expression is the value
  10875. assigned. Defined on scalar types.
  10876. 'OP='
  10877. Used in an expression of the form 'A OP= B', and translated to
  10878. 'A = A OP B'. 'OP=' and '=' have the same precedence. The operator
  10879. OP is any one of the operators '|', '^', '&', '<<', '>>', '+', '-',
  10880. '*', '/', '%'.
  10881. '?:'
  10882. The ternary operator. 'A ? B : C' can be thought of as: if A then
  10883. B else C. The argument A should be of an integral type.
  10884. '||'
  10885. Logical OR. Defined on integral types.
  10886. '&&'
  10887. Logical AND. Defined on integral types.
  10888. '|'
  10889. Bitwise OR. Defined on integral types.
  10890. '^'
  10891. Bitwise exclusive-OR. Defined on integral types.
  10892. '&'
  10893. Bitwise AND. Defined on integral types.
  10894. '==, !='
  10895. Equality and inequality. Defined on scalar types. The value of
  10896. these expressions is 0 for false and non-zero for true.
  10897. '<, >, <=, >='
  10898. Less than, greater than, less than or equal, greater than or equal.
  10899. Defined on scalar types. The value of these expressions is 0 for
  10900. false and non-zero for true.
  10901. '<<, >>'
  10902. left shift, and right shift. Defined on integral types.
  10903. '@'
  10904. The GDB "artificial array" operator (*note Expressions:
  10905. Expressions.).
  10906. '+, -'
  10907. Addition and subtraction. Defined on integral types,
  10908. floating-point types and pointer types.
  10909. '*, /, %'
  10910. Multiplication, division, and modulus. Multiplication and division
  10911. are defined on integral and floating-point types. Modulus is
  10912. defined on integral types.
  10913. '++, --'
  10914. Increment and decrement. When appearing before a variable, the
  10915. operation is performed before the variable is used in an
  10916. expression; when appearing after it, the variable's value is used
  10917. before the operation takes place.
  10918. '*'
  10919. Pointer dereferencing. Defined on pointer types. Same precedence
  10920. as '++'.
  10921. '&'
  10922. Address operator. Defined on variables. Same precedence as '++'.
  10923. For debugging C++, GDB implements a use of '&' beyond what is
  10924. allowed in the C++ language itself: you can use '&(&REF)' to
  10925. examine the address where a C++ reference variable (declared with
  10926. '&REF') is stored.
  10927. '-'
  10928. Negative. Defined on integral and floating-point types. Same
  10929. precedence as '++'.
  10930. '!'
  10931. Logical negation. Defined on integral types. Same precedence as
  10932. '++'.
  10933. '~'
  10934. Bitwise complement operator. Defined on integral types. Same
  10935. precedence as '++'.
  10936. '., ->'
  10937. Structure member, and pointer-to-structure member. For
  10938. convenience, GDB regards the two as equivalent, choosing whether to
  10939. dereference a pointer based on the stored type information.
  10940. Defined on 'struct' and 'union' data.
  10941. '.*, ->*'
  10942. Dereferences of pointers to members.
  10943. '[]'
  10944. Array indexing. 'A[I]' is defined as '*(A+I)'. Same precedence as
  10945. '->'.
  10946. '()'
  10947. Function parameter list. Same precedence as '->'.
  10948. '::'
  10949. C++ scope resolution operator. Defined on 'struct', 'union', and
  10950. 'class' types.
  10951. '::'
  10952. Doubled colons also represent the GDB scope operator (*note
  10953. Expressions: Expressions.). Same precedence as '::', above.
  10954. If an operator is redefined in the user code, GDB usually attempts to
  10955. invoke the redefined version instead of using the operator's predefined
  10956. meaning.
  10957. 
  10958. File: gdb.info, Node: C Constants, Next: C Plus Plus Expressions, Prev: C Operators, Up: C
  10959. 15.4.1.2 C and C++ Constants
  10960. ............................
  10961. GDB allows you to express the constants of C and C++ in the following
  10962. ways:
  10963. * Integer constants are a sequence of digits. Octal constants are
  10964. specified by a leading '0' (i.e. zero), and hexadecimal constants
  10965. by a leading '0x' or '0X'. Constants may also end with a letter
  10966. 'l', specifying that the constant should be treated as a 'long'
  10967. value.
  10968. * Floating point constants are a sequence of digits, followed by a
  10969. decimal point, followed by a sequence of digits, and optionally
  10970. followed by an exponent. An exponent is of the form:
  10971. 'e[[+]|-]NNN', where NNN is another sequence of digits. The '+' is
  10972. optional for positive exponents. A floating-point constant may
  10973. also end with a letter 'f' or 'F', specifying that the constant
  10974. should be treated as being of the 'float' (as opposed to the
  10975. default 'double') type; or with a letter 'l' or 'L', which
  10976. specifies a 'long double' constant.
  10977. * Enumerated constants consist of enumerated identifiers, or their
  10978. integral equivalents.
  10979. * Character constants are a single character surrounded by single
  10980. quotes ('''), or a number--the ordinal value of the corresponding
  10981. character (usually its ASCII value). Within quotes, the single
  10982. character may be represented by a letter or by "escape sequences",
  10983. which are of the form '\NNN', where NNN is the octal representation
  10984. of the character's ordinal value; or of the form '\X', where 'X' is
  10985. a predefined special character--for example, '\n' for newline.
  10986. Wide character constants can be written by prefixing a character
  10987. constant with 'L', as in C. For example, 'L'x'' is the wide form of
  10988. 'x'. The target wide character set is used when computing the
  10989. value of this constant (*note Character Sets::).
  10990. * String constants are a sequence of character constants surrounded
  10991. by double quotes ('"'). Any valid character constant (as described
  10992. above) may appear. Double quotes within the string must be
  10993. preceded by a backslash, so for instance '"a\"b'c"' is a string of
  10994. five characters.
  10995. Wide string constants can be written by prefixing a string constant
  10996. with 'L', as in C. The target wide character set is used when
  10997. computing the value of this constant (*note Character Sets::).
  10998. * Pointer constants are an integral value. You can also write
  10999. pointers to constants using the C operator '&'.
  11000. * Array constants are comma-separated lists surrounded by braces '{'
  11001. and '}'; for example, '{1,2,3}' is a three-element array of
  11002. integers, '{{1,2}, {3,4}, {5,6}}' is a three-by-two array, and
  11003. '{&"hi", &"there", &"fred"}' is a three-element array of pointers.
  11004. 
  11005. File: gdb.info, Node: C Plus Plus Expressions, Next: C Defaults, Prev: C Constants, Up: C
  11006. 15.4.1.3 C++ Expressions
  11007. ........................
  11008. GDB expression handling can interpret most C++ expressions.
  11009. _Warning:_ GDB can only debug C++ code if you use the proper
  11010. compiler and the proper debug format. Currently, GDB works best
  11011. when debugging C++ code that is compiled with the most recent
  11012. version of GCC possible. The DWARF debugging format is preferred;
  11013. GCC defaults to this on most popular platforms. Other compilers
  11014. and/or debug formats are likely to work badly or not at all when
  11015. using GDB to debug C++ code. *Note Compilation::.
  11016. 1. Member function calls are allowed; you can use expressions like
  11017. count = aml->GetOriginal(x, y)
  11018. 2. While a member function is active (in the selected stack frame),
  11019. your expressions have the same namespace available as the member
  11020. function; that is, GDB allows implicit references to the class
  11021. instance pointer 'this' following the same rules as C++. 'using'
  11022. declarations in the current scope are also respected by GDB.
  11023. 3. You can call overloaded functions; GDB resolves the function call
  11024. to the right definition, with some restrictions. GDB does not
  11025. perform overload resolution involving user-defined type
  11026. conversions, calls to constructors, or instantiations of templates
  11027. that do not exist in the program. It also cannot handle ellipsis
  11028. argument lists or default arguments.
  11029. It does perform integral conversions and promotions, floating-point
  11030. promotions, arithmetic conversions, pointer conversions,
  11031. conversions of class objects to base classes, and standard
  11032. conversions such as those of functions or arrays to pointers; it
  11033. requires an exact match on the number of function arguments.
  11034. Overload resolution is always performed, unless you have specified
  11035. 'set overload-resolution off'. *Note GDB Features for C++:
  11036. Debugging C Plus Plus.
  11037. You must specify 'set overload-resolution off' in order to use an
  11038. explicit function signature to call an overloaded function, as in
  11039. p 'foo(char,int)'('x', 13)
  11040. The GDB command-completion facility can simplify this; see *note
  11041. Command Completion: Completion.
  11042. 4. GDB understands variables declared as C++ lvalue or rvalue
  11043. references; you can use them in expressions just as you do in C++
  11044. source--they are automatically dereferenced.
  11045. In the parameter list shown when GDB displays a frame, the values
  11046. of reference variables are not displayed (unlike other variables);
  11047. this avoids clutter, since references are often used for large
  11048. structures. The _address_ of a reference variable is always shown,
  11049. unless you have specified 'set print address off'.
  11050. 5. GDB supports the C++ name resolution operator '::'--your
  11051. expressions can use it just as expressions in your program do.
  11052. Since one scope may be defined in another, you can use '::'
  11053. repeatedly if necessary, for example in an expression like
  11054. 'SCOPE1::SCOPE2::NAME'. GDB also allows resolving name scope by
  11055. reference to source files, in both C and C++ debugging (*note
  11056. Program Variables: Variables.).
  11057. 6. GDB performs argument-dependent lookup, following the C++
  11058. specification.
  11059. 
  11060. File: gdb.info, Node: C Defaults, Next: C Checks, Prev: C Plus Plus Expressions, Up: C
  11061. 15.4.1.4 C and C++ Defaults
  11062. ...........................
  11063. If you allow GDB to set range checking automatically, it defaults to
  11064. 'off' whenever the working language changes to C or C++. This happens
  11065. regardless of whether you or GDB selects the working language.
  11066. If you allow GDB to set the language automatically, it recognizes
  11067. source files whose names end with '.c', '.C', or '.cc', etc, and when
  11068. GDB enters code compiled from one of these files, it sets the working
  11069. language to C or C++. *Note Having GDB Infer the Source Language:
  11070. Automatically, for further details.
  11071. 
  11072. File: gdb.info, Node: C Checks, Next: Debugging C, Prev: C Defaults, Up: C
  11073. 15.4.1.5 C and C++ Type and Range Checks
  11074. ........................................
  11075. By default, when GDB parses C or C++ expressions, strict type checking
  11076. is used. However, if you turn type checking off, GDB will allow certain
  11077. non-standard conversions, such as promoting integer constants to
  11078. pointers.
  11079. Range checking, if turned on, is done on mathematical operations.
  11080. Array indices are not checked, since they are often used to index a
  11081. pointer that is not itself an array.
  11082. 
  11083. File: gdb.info, Node: Debugging C, Next: Debugging C Plus Plus, Prev: C Checks, Up: C
  11084. 15.4.1.6 GDB and C
  11085. ..................
  11086. The 'set print union' and 'show print union' commands apply to the
  11087. 'union' type. When set to 'on', any 'union' that is inside a 'struct'
  11088. or 'class' is also printed. Otherwise, it appears as '{...}'.
  11089. The '@' operator aids in the debugging of dynamic arrays, formed with
  11090. pointers and a memory allocation function. *Note Expressions:
  11091. Expressions.
  11092. 
  11093. File: gdb.info, Node: Debugging C Plus Plus, Next: Decimal Floating Point, Prev: Debugging C, Up: C
  11094. 15.4.1.7 GDB Features for C++
  11095. .............................
  11096. Some GDB commands are particularly useful with C++, and some are
  11097. designed specifically for use with C++. Here is a summary:
  11098. 'breakpoint menus'
  11099. When you want a breakpoint in a function whose name is overloaded,
  11100. GDB has the capability to display a menu of possible breakpoint
  11101. locations to help you specify which function definition you want.
  11102. *Note Ambiguous Expressions: Ambiguous Expressions.
  11103. 'rbreak REGEX'
  11104. Setting breakpoints using regular expressions is helpful for
  11105. setting breakpoints on overloaded functions that are not members of
  11106. any special classes. *Note Setting Breakpoints: Set Breaks.
  11107. 'catch throw'
  11108. 'catch rethrow'
  11109. 'catch catch'
  11110. Debug C++ exception handling using these commands. *Note Setting
  11111. Catchpoints: Set Catchpoints.
  11112. 'ptype TYPENAME'
  11113. Print inheritance relationships as well as other information for
  11114. type TYPENAME. *Note Examining the Symbol Table: Symbols.
  11115. 'info vtbl EXPRESSION.'
  11116. The 'info vtbl' command can be used to display the virtual method
  11117. tables of the object computed by EXPRESSION. This shows one entry
  11118. per virtual table; there may be multiple virtual tables when
  11119. multiple inheritance is in use.
  11120. 'demangle NAME'
  11121. Demangle NAME. *Note Symbols::, for a more complete description of
  11122. the 'demangle' command.
  11123. 'set print demangle'
  11124. 'show print demangle'
  11125. 'set print asm-demangle'
  11126. 'show print asm-demangle'
  11127. Control whether C++ symbols display in their source form, both when
  11128. displaying code as C++ source and when displaying disassemblies.
  11129. *Note Print Settings: Print Settings.
  11130. 'set print object'
  11131. 'show print object'
  11132. Choose whether to print derived (actual) or declared types of
  11133. objects. *Note Print Settings: Print Settings.
  11134. 'set print vtbl'
  11135. 'show print vtbl'
  11136. Control the format for printing virtual function tables. *Note
  11137. Print Settings: Print Settings. (The 'vtbl' commands do not work
  11138. on programs compiled with the HP ANSI C++ compiler ('aCC').)
  11139. 'set overload-resolution on'
  11140. Enable overload resolution for C++ expression evaluation. The
  11141. default is on. For overloaded functions, GDB evaluates the
  11142. arguments and searches for a function whose signature matches the
  11143. argument types, using the standard C++ conversion rules (see *note
  11144. C++ Expressions: C Plus Plus Expressions, for details). If it
  11145. cannot find a match, it emits a message.
  11146. 'set overload-resolution off'
  11147. Disable overload resolution for C++ expression evaluation. For
  11148. overloaded functions that are not class member functions, GDB
  11149. chooses the first function of the specified name that it finds in
  11150. the symbol table, whether or not its arguments are of the correct
  11151. type. For overloaded functions that are class member functions,
  11152. GDB searches for a function whose signature _exactly_ matches the
  11153. argument types.
  11154. 'show overload-resolution'
  11155. Show the current setting of overload resolution.
  11156. 'Overloaded symbol names'
  11157. You can specify a particular definition of an overloaded symbol,
  11158. using the same notation that is used to declare such symbols in
  11159. C++: type 'SYMBOL(TYPES)' rather than just SYMBOL. You can also
  11160. use the GDB command-line word completion facilities to list the
  11161. available choices, or to finish the type list for you. *Note
  11162. Command Completion: Completion, for details on how to do this.
  11163. 'Breakpoints in functions with ABI tags'
  11164. The GNU C++ compiler introduced the notion of ABI "tags", which
  11165. correspond to changes in the ABI of a type, function, or variable
  11166. that would not otherwise be reflected in a mangled name. See
  11167. <https://developers.redhat.com/blog/2015/02/05/gcc5-and-the-c11-abi/>
  11168. for more detail.
  11169. The ABI tags are visible in C++ demangled names. For example, a
  11170. function that returns a std::string:
  11171. std::string function(int);
  11172. when compiled for the C++11 ABI is marked with the 'cxx11' ABI tag,
  11173. and GDB displays the symbol like this:
  11174. function[abi:cxx11](int)
  11175. You can set a breakpoint on such functions simply as if they had no
  11176. tag. For example:
  11177. (gdb) b function(int)
  11178. Breakpoint 2 at 0x40060d: file main.cc, line 10.
  11179. (gdb) info breakpoints
  11180. Num Type Disp Enb Address What
  11181. 1 breakpoint keep y 0x0040060d in function[abi:cxx11](int)
  11182. at main.cc:10
  11183. On the rare occasion you need to disambiguate between different ABI
  11184. tags, you can do so by simply including the ABI tag in the function
  11185. name, like:
  11186. (gdb) b ambiguous[abi:other_tag](int)
  11187. 
  11188. File: gdb.info, Node: Decimal Floating Point, Prev: Debugging C Plus Plus, Up: C
  11189. 15.4.1.8 Decimal Floating Point format
  11190. ......................................
  11191. GDB can examine, set and perform computations with numbers in decimal
  11192. floating point format, which in the C language correspond to the
  11193. '_Decimal32', '_Decimal64' and '_Decimal128' types as specified by the
  11194. extension to support decimal floating-point arithmetic.
  11195. There are two encodings in use, depending on the architecture: BID
  11196. (Binary Integer Decimal) for x86 and x86-64, and DPD (Densely Packed
  11197. Decimal) for PowerPC and S/390. GDB will use the appropriate encoding
  11198. for the configured target.
  11199. Because of a limitation in 'libdecnumber', the library used by GDB to
  11200. manipulate decimal floating point numbers, it is not possible to convert
  11201. (using a cast, for example) integers wider than 32-bit to decimal float.
  11202. In addition, in order to imitate GDB's behaviour with binary floating
  11203. point computations, error checking in decimal float operations ignores
  11204. underflow, overflow and divide by zero exceptions.
  11205. In the PowerPC architecture, GDB provides a set of pseudo-registers
  11206. to inspect '_Decimal128' values stored in floating point registers. See
  11207. *note PowerPC: PowerPC. for more details.
  11208. 
  11209. File: gdb.info, Node: D, Next: Go, Prev: C, Up: Supported Languages
  11210. 15.4.2 D
  11211. --------
  11212. GDB can be used to debug programs written in D and compiled with GDC,
  11213. LDC or DMD compilers. Currently GDB supports only one D specific
  11214. feature -- dynamic arrays.
  11215. 
  11216. File: gdb.info, Node: Go, Next: Objective-C, Prev: D, Up: Supported Languages
  11217. 15.4.3 Go
  11218. ---------
  11219. GDB can be used to debug programs written in Go and compiled with
  11220. 'gccgo' or '6g' compilers.
  11221. Here is a summary of the Go-specific features and restrictions:
  11222. 'The current Go package'
  11223. The name of the current package does not need to be specified when
  11224. specifying global variables and functions.
  11225. For example, given the program:
  11226. package main
  11227. var myglob = "Shall we?"
  11228. func main () {
  11229. // ...
  11230. }
  11231. When stopped inside 'main' either of these work:
  11232. (gdb) p myglob
  11233. (gdb) p main.myglob
  11234. 'Builtin Go types'
  11235. The 'string' type is recognized by GDB and is printed as a string.
  11236. 'Builtin Go functions'
  11237. The GDB expression parser recognizes the 'unsafe.Sizeof' function
  11238. and handles it internally.
  11239. 'Restrictions on Go expressions'
  11240. All Go operators are supported except '&^'. The Go '_' "blank
  11241. identifier" is not supported. Automatic dereferencing of pointers
  11242. is not supported.
  11243. 
  11244. File: gdb.info, Node: Objective-C, Next: OpenCL C, Prev: Go, Up: Supported Languages
  11245. 15.4.4 Objective-C
  11246. ------------------
  11247. This section provides information about some commands and command
  11248. options that are useful for debugging Objective-C code. See also *note
  11249. info classes: Symbols, and *note info selectors: Symbols, for a few more
  11250. commands specific to Objective-C support.
  11251. * Menu:
  11252. * Method Names in Commands::
  11253. * The Print Command with Objective-C::
  11254. 
  11255. File: gdb.info, Node: Method Names in Commands, Next: The Print Command with Objective-C, Up: Objective-C
  11256. 15.4.4.1 Method Names in Commands
  11257. .................................
  11258. The following commands have been extended to accept Objective-C method
  11259. names as line specifications:
  11260. * 'clear'
  11261. * 'break'
  11262. * 'info line'
  11263. * 'jump'
  11264. * 'list'
  11265. A fully qualified Objective-C method name is specified as
  11266. -[CLASS METHODNAME]
  11267. where the minus sign is used to indicate an instance method and a
  11268. plus sign (not shown) is used to indicate a class method. The class
  11269. name CLASS and method name METHODNAME are enclosed in brackets, similar
  11270. to the way messages are specified in Objective-C source code. For
  11271. example, to set a breakpoint at the 'create' instance method of class
  11272. 'Fruit' in the program currently being debugged, enter:
  11273. break -[Fruit create]
  11274. To list ten program lines around the 'initialize' class method,
  11275. enter:
  11276. list +[NSText initialize]
  11277. In the current version of GDB, the plus or minus sign is required.
  11278. In future versions of GDB, the plus or minus sign will be optional, but
  11279. you can use it to narrow the search. It is also possible to specify
  11280. just a method name:
  11281. break create
  11282. You must specify the complete method name, including any colons. If
  11283. your program's source files contain more than one 'create' method,
  11284. you'll be presented with a numbered list of classes that implement that
  11285. method. Indicate your choice by number, or type '0' to exit if none
  11286. apply.
  11287. As another example, to clear a breakpoint established at the
  11288. 'makeKeyAndOrderFront:' method of the 'NSWindow' class, enter:
  11289. clear -[NSWindow makeKeyAndOrderFront:]
  11290. 
  11291. File: gdb.info, Node: The Print Command with Objective-C, Prev: Method Names in Commands, Up: Objective-C
  11292. 15.4.4.2 The Print Command With Objective-C
  11293. ...........................................
  11294. The print command has also been extended to accept methods. For
  11295. example:
  11296. print -[OBJECT hash]
  11297. will tell GDB to send the 'hash' message to OBJECT and print the result.
  11298. Also, an additional command has been added, 'print-object' or 'po' for
  11299. short, which is meant to print the description of an object. However,
  11300. this command may only work with certain Objective-C libraries that have
  11301. a particular hook function, '_NSPrintForDebugger', defined.
  11302. 
  11303. File: gdb.info, Node: OpenCL C, Next: Fortran, Prev: Objective-C, Up: Supported Languages
  11304. 15.4.5 OpenCL C
  11305. ---------------
  11306. This section provides information about GDBs OpenCL C support.
  11307. * Menu:
  11308. * OpenCL C Datatypes::
  11309. * OpenCL C Expressions::
  11310. * OpenCL C Operators::
  11311. 
  11312. File: gdb.info, Node: OpenCL C Datatypes, Next: OpenCL C Expressions, Up: OpenCL C
  11313. 15.4.5.1 OpenCL C Datatypes
  11314. ...........................
  11315. GDB supports the builtin scalar and vector datatypes specified by OpenCL
  11316. 1.1. In addition the half- and double-precision floating point data
  11317. types of the 'cl_khr_fp16' and 'cl_khr_fp64' OpenCL extensions are also
  11318. known to GDB.
  11319. 
  11320. File: gdb.info, Node: OpenCL C Expressions, Next: OpenCL C Operators, Prev: OpenCL C Datatypes, Up: OpenCL C
  11321. 15.4.5.2 OpenCL C Expressions
  11322. .............................
  11323. GDB supports accesses to vector components including the access as
  11324. lvalue where possible. Since OpenCL C is based on C99 most C
  11325. expressions supported by GDB can be used as well.
  11326. 
  11327. File: gdb.info, Node: OpenCL C Operators, Prev: OpenCL C Expressions, Up: OpenCL C
  11328. 15.4.5.3 OpenCL C Operators
  11329. ...........................
  11330. GDB supports the operators specified by OpenCL 1.1 for scalar and vector
  11331. data types.
  11332. 
  11333. File: gdb.info, Node: Fortran, Next: Pascal, Prev: OpenCL C, Up: Supported Languages
  11334. 15.4.6 Fortran
  11335. --------------
  11336. GDB can be used to debug programs written in Fortran, but it currently
  11337. supports only the features of Fortran 77 language.
  11338. Some Fortran compilers (GNU Fortran 77 and Fortran 95 compilers among
  11339. them) append an underscore to the names of variables and functions.
  11340. When you debug programs compiled by those compilers, you will need to
  11341. refer to variables and functions with a trailing underscore.
  11342. * Menu:
  11343. * Fortran Operators:: Fortran operators and expressions
  11344. * Fortran Defaults:: Default settings for Fortran
  11345. * Special Fortran Commands:: Special GDB commands for Fortran
  11346. 
  11347. File: gdb.info, Node: Fortran Operators, Next: Fortran Defaults, Up: Fortran
  11348. 15.4.6.1 Fortran Operators and Expressions
  11349. ..........................................
  11350. Operators must be defined on values of specific types. For instance,
  11351. '+' is defined on numbers, but not on characters or other non-
  11352. arithmetic types. Operators are often defined on groups of types.
  11353. '**'
  11354. The exponentiation operator. It raises the first operand to the
  11355. power of the second one.
  11356. ':'
  11357. The range operator. Normally used in the form of array(low:high)
  11358. to represent a section of array.
  11359. '%'
  11360. The access component operator. Normally used to access elements in
  11361. derived types. Also suitable for unions. As unions aren't part of
  11362. regular Fortran, this can only happen when accessing a register
  11363. that uses a gdbarch-defined union type.
  11364. '::'
  11365. The scope operator. Normally used to access variables in modules
  11366. or to set breakpoints on subroutines nested in modules or in other
  11367. subroutines (internal subroutines).
  11368. 
  11369. File: gdb.info, Node: Fortran Defaults, Next: Special Fortran Commands, Prev: Fortran Operators, Up: Fortran
  11370. 15.4.6.2 Fortran Defaults
  11371. .........................
  11372. Fortran symbols are usually case-insensitive, so GDB by default uses
  11373. case-insensitive matches for Fortran symbols. You can change that with
  11374. the 'set case-insensitive' command, see *note Symbols::, for the
  11375. details.
  11376. 
  11377. File: gdb.info, Node: Special Fortran Commands, Prev: Fortran Defaults, Up: Fortran
  11378. 15.4.6.3 Special Fortran Commands
  11379. .................................
  11380. GDB has some commands to support Fortran-specific features, such as
  11381. displaying common blocks.
  11382. 'info common [COMMON-NAME]'
  11383. This command prints the values contained in the Fortran 'COMMON'
  11384. block whose name is COMMON-NAME. With no argument, the names of
  11385. all 'COMMON' blocks visible at the current program location are
  11386. printed.
  11387. 
  11388. File: gdb.info, Node: Pascal, Next: Rust, Prev: Fortran, Up: Supported Languages
  11389. 15.4.7 Pascal
  11390. -------------
  11391. Debugging Pascal programs which use sets, subranges, file variables, or
  11392. nested functions does not currently work. GDB does not support entering
  11393. expressions, printing values, or similar features using Pascal syntax.
  11394. The Pascal-specific command 'set print pascal_static-members'
  11395. controls whether static members of Pascal objects are displayed. *Note
  11396. pascal_static-members: Print Settings.
  11397. 
  11398. File: gdb.info, Node: Rust, Next: Modula-2, Prev: Pascal, Up: Supported Languages
  11399. 15.4.8 Rust
  11400. -----------
  11401. GDB supports the Rust Programming Language (https://www.rust-lang.org/).
  11402. Type- and value-printing, and expression parsing, are reasonably
  11403. complete. However, there are a few peculiarities and holes to be aware
  11404. of.
  11405. * Linespecs (*note Specify Location::) are never relative to the
  11406. current crate. Instead, they act as if there were a global
  11407. namespace of crates, somewhat similar to the way 'extern crate'
  11408. behaves.
  11409. That is, if GDB is stopped at a breakpoint in a function in crate
  11410. 'A', module 'B', then 'break B::f' will attempt to set a breakpoint
  11411. in a function named 'f' in a crate named 'B'.
  11412. As a consequence of this approach, linespecs also cannot refer to
  11413. items using 'self::' or 'super::'.
  11414. * Because GDB implements Rust name-lookup semantics in expressions,
  11415. it will sometimes prepend the current crate to a name. For
  11416. example, if GDB is stopped at a breakpoint in the crate 'K', then
  11417. 'print ::x::y' will try to find the symbol 'K::x::y'.
  11418. However, since it is useful to be able to refer to other crates
  11419. when debugging, GDB provides the 'extern' extension to circumvent
  11420. this. To use the extension, just put 'extern' before a path
  11421. expression to refer to the otherwise unavailable "global" scope.
  11422. In the above example, if you wanted to refer to the symbol 'y' in
  11423. the crate 'x', you would use 'print extern x::y'.
  11424. * The Rust expression evaluator does not support "statement-like"
  11425. expressions such as 'if' or 'match', or lambda expressions.
  11426. * Tuple expressions are not implemented.
  11427. * The Rust expression evaluator does not currently implement the
  11428. 'Drop' trait. Objects that may be created by the evaluator will
  11429. never be destroyed.
  11430. * GDB does not implement type inference for generics. In order to
  11431. call generic functions or otherwise refer to generic items, you
  11432. will have to specify the type parameters manually.
  11433. * GDB currently uses the C++ demangler for Rust. In most cases this
  11434. does not cause any problems. However, in an expression context,
  11435. completing a generic function name will give syntactically invalid
  11436. results. This happens because Rust requires the '::' operator
  11437. between the function name and its generic arguments. For example,
  11438. GDB might provide a completion like 'crate::f<u32>', where the
  11439. parser would require 'crate::f::<u32>'.
  11440. * As of this writing, the Rust compiler (version 1.8) has a few holes
  11441. in the debugging information it generates. These holes prevent
  11442. certain features from being implemented by GDB:
  11443. * Method calls cannot be made via traits.
  11444. * Operator overloading is not implemented.
  11445. * When debugging in a monomorphized function, you cannot use the
  11446. generic type names.
  11447. * The type 'Self' is not available.
  11448. * 'use' statements are not available, so some names may not be
  11449. available in the crate.
  11450. 
  11451. File: gdb.info, Node: Modula-2, Next: Ada, Prev: Rust, Up: Supported Languages
  11452. 15.4.9 Modula-2
  11453. ---------------
  11454. The extensions made to GDB to support Modula-2 only support output from
  11455. the GNU Modula-2 compiler (which is currently being developed). Other
  11456. Modula-2 compilers are not currently supported, and attempting to debug
  11457. executables produced by them is most likely to give an error as GDB
  11458. reads in the executable's symbol table.
  11459. * Menu:
  11460. * M2 Operators:: Built-in operators
  11461. * Built-In Func/Proc:: Built-in functions and procedures
  11462. * M2 Constants:: Modula-2 constants
  11463. * M2 Types:: Modula-2 types
  11464. * M2 Defaults:: Default settings for Modula-2
  11465. * Deviations:: Deviations from standard Modula-2
  11466. * M2 Checks:: Modula-2 type and range checks
  11467. * M2 Scope:: The scope operators '::' and '.'
  11468. * GDB/M2:: GDB and Modula-2
  11469. 
  11470. File: gdb.info, Node: M2 Operators, Next: Built-In Func/Proc, Up: Modula-2
  11471. 15.4.9.1 Operators
  11472. ..................
  11473. Operators must be defined on values of specific types. For instance,
  11474. '+' is defined on numbers, but not on structures. Operators are often
  11475. defined on groups of types. For the purposes of Modula-2, the following
  11476. definitions hold:
  11477. * _Integral types_ consist of 'INTEGER', 'CARDINAL', and their
  11478. subranges.
  11479. * _Character types_ consist of 'CHAR' and its subranges.
  11480. * _Floating-point types_ consist of 'REAL'.
  11481. * _Pointer types_ consist of anything declared as 'POINTER TO TYPE'.
  11482. * _Scalar types_ consist of all of the above.
  11483. * _Set types_ consist of 'SET' and 'BITSET' types.
  11484. * _Boolean types_ consist of 'BOOLEAN'.
  11485. The following operators are supported, and appear in order of increasing
  11486. precedence:
  11487. ','
  11488. Function argument or array index separator.
  11489. ':='
  11490. Assignment. The value of VAR ':=' VALUE is VALUE.
  11491. '<, >'
  11492. Less than, greater than on integral, floating-point, or enumerated
  11493. types.
  11494. '<=, >='
  11495. Less than or equal to, greater than or equal to on integral,
  11496. floating-point and enumerated types, or set inclusion on set types.
  11497. Same precedence as '<'.
  11498. '=, <>, #'
  11499. Equality and two ways of expressing inequality, valid on scalar
  11500. types. Same precedence as '<'. In GDB scripts, only '<>' is
  11501. available for inequality, since '#' conflicts with the script
  11502. comment character.
  11503. 'IN'
  11504. Set membership. Defined on set types and the types of their
  11505. members. Same precedence as '<'.
  11506. 'OR'
  11507. Boolean disjunction. Defined on boolean types.
  11508. 'AND, &'
  11509. Boolean conjunction. Defined on boolean types.
  11510. '@'
  11511. The GDB "artificial array" operator (*note Expressions:
  11512. Expressions.).
  11513. '+, -'
  11514. Addition and subtraction on integral and floating-point types, or
  11515. union and difference on set types.
  11516. '*'
  11517. Multiplication on integral and floating-point types, or set
  11518. intersection on set types.
  11519. '/'
  11520. Division on floating-point types, or symmetric set difference on
  11521. set types. Same precedence as '*'.
  11522. 'DIV, MOD'
  11523. Integer division and remainder. Defined on integral types. Same
  11524. precedence as '*'.
  11525. '-'
  11526. Negative. Defined on 'INTEGER' and 'REAL' data.
  11527. '^'
  11528. Pointer dereferencing. Defined on pointer types.
  11529. 'NOT'
  11530. Boolean negation. Defined on boolean types. Same precedence as
  11531. '^'.
  11532. '.'
  11533. 'RECORD' field selector. Defined on 'RECORD' data. Same
  11534. precedence as '^'.
  11535. '[]'
  11536. Array indexing. Defined on 'ARRAY' data. Same precedence as '^'.
  11537. '()'
  11538. Procedure argument list. Defined on 'PROCEDURE' objects. Same
  11539. precedence as '^'.
  11540. '::, .'
  11541. GDB and Modula-2 scope operators.
  11542. _Warning:_ Set expressions and their operations are not yet
  11543. supported, so GDB treats the use of the operator 'IN', or the use
  11544. of operators '+', '-', '*', '/', '=', , '<>', '#', '<=', and '>='
  11545. on sets as an error.
  11546. 
  11547. File: gdb.info, Node: Built-In Func/Proc, Next: M2 Constants, Prev: M2 Operators, Up: Modula-2
  11548. 15.4.9.2 Built-in Functions and Procedures
  11549. ..........................................
  11550. Modula-2 also makes available several built-in procedures and functions.
  11551. In describing these, the following metavariables are used:
  11552. A
  11553. represents an 'ARRAY' variable.
  11554. C
  11555. represents a 'CHAR' constant or variable.
  11556. I
  11557. represents a variable or constant of integral type.
  11558. M
  11559. represents an identifier that belongs to a set. Generally used in
  11560. the same function with the metavariable S. The type of S should be
  11561. 'SET OF MTYPE' (where MTYPE is the type of M).
  11562. N
  11563. represents a variable or constant of integral or floating-point
  11564. type.
  11565. R
  11566. represents a variable or constant of floating-point type.
  11567. T
  11568. represents a type.
  11569. V
  11570. represents a variable.
  11571. X
  11572. represents a variable or constant of one of many types. See the
  11573. explanation of the function for details.
  11574. All Modula-2 built-in procedures also return a result, described
  11575. below.
  11576. 'ABS(N)'
  11577. Returns the absolute value of N.
  11578. 'CAP(C)'
  11579. If C is a lower case letter, it returns its upper case equivalent,
  11580. otherwise it returns its argument.
  11581. 'CHR(I)'
  11582. Returns the character whose ordinal value is I.
  11583. 'DEC(V)'
  11584. Decrements the value in the variable V by one. Returns the new
  11585. value.
  11586. 'DEC(V,I)'
  11587. Decrements the value in the variable V by I. Returns the new
  11588. value.
  11589. 'EXCL(M,S)'
  11590. Removes the element M from the set S. Returns the new set.
  11591. 'FLOAT(I)'
  11592. Returns the floating point equivalent of the integer I.
  11593. 'HIGH(A)'
  11594. Returns the index of the last member of A.
  11595. 'INC(V)'
  11596. Increments the value in the variable V by one. Returns the new
  11597. value.
  11598. 'INC(V,I)'
  11599. Increments the value in the variable V by I. Returns the new
  11600. value.
  11601. 'INCL(M,S)'
  11602. Adds the element M to the set S if it is not already there.
  11603. Returns the new set.
  11604. 'MAX(T)'
  11605. Returns the maximum value of the type T.
  11606. 'MIN(T)'
  11607. Returns the minimum value of the type T.
  11608. 'ODD(I)'
  11609. Returns boolean TRUE if I is an odd number.
  11610. 'ORD(X)'
  11611. Returns the ordinal value of its argument. For example, the
  11612. ordinal value of a character is its ASCII value (on machines
  11613. supporting the ASCII character set). The argument X must be of an
  11614. ordered type, which include integral, character and enumerated
  11615. types.
  11616. 'SIZE(X)'
  11617. Returns the size of its argument. The argument X can be a variable
  11618. or a type.
  11619. 'TRUNC(R)'
  11620. Returns the integral part of R.
  11621. 'TSIZE(X)'
  11622. Returns the size of its argument. The argument X can be a variable
  11623. or a type.
  11624. 'VAL(T,I)'
  11625. Returns the member of the type T whose ordinal value is I.
  11626. _Warning:_ Sets and their operations are not yet supported, so GDB
  11627. treats the use of procedures 'INCL' and 'EXCL' as an error.
  11628. 
  11629. File: gdb.info, Node: M2 Constants, Next: M2 Types, Prev: Built-In Func/Proc, Up: Modula-2
  11630. 15.4.9.3 Constants
  11631. ..................
  11632. GDB allows you to express the constants of Modula-2 in the following
  11633. ways:
  11634. * Integer constants are simply a sequence of digits. When used in an
  11635. expression, a constant is interpreted to be type-compatible with
  11636. the rest of the expression. Hexadecimal integers are specified by
  11637. a trailing 'H', and octal integers by a trailing 'B'.
  11638. * Floating point constants appear as a sequence of digits, followed
  11639. by a decimal point and another sequence of digits. An optional
  11640. exponent can then be specified, in the form 'E[+|-]NNN', where
  11641. '[+|-]NNN' is the desired exponent. All of the digits of the
  11642. floating point constant must be valid decimal (base 10) digits.
  11643. * Character constants consist of a single character enclosed by a
  11644. pair of like quotes, either single (''') or double ('"'). They may
  11645. also be expressed by their ordinal value (their ASCII value,
  11646. usually) followed by a 'C'.
  11647. * String constants consist of a sequence of characters enclosed by a
  11648. pair of like quotes, either single (''') or double ('"'). Escape
  11649. sequences in the style of C are also allowed. *Note C and C++
  11650. Constants: C Constants, for a brief explanation of escape
  11651. sequences.
  11652. * Enumerated constants consist of an enumerated identifier.
  11653. * Boolean constants consist of the identifiers 'TRUE' and 'FALSE'.
  11654. * Pointer constants consist of integral values only.
  11655. * Set constants are not yet supported.
  11656. 
  11657. File: gdb.info, Node: M2 Types, Next: M2 Defaults, Prev: M2 Constants, Up: Modula-2
  11658. 15.4.9.4 Modula-2 Types
  11659. .......................
  11660. Currently GDB can print the following data types in Modula-2 syntax:
  11661. array types, record types, set types, pointer types, procedure types,
  11662. enumerated types, subrange types and base types. You can also print the
  11663. contents of variables declared using these type. This section gives a
  11664. number of simple source code examples together with sample GDB sessions.
  11665. The first example contains the following section of code:
  11666. VAR
  11667. s: SET OF CHAR ;
  11668. r: [20..40] ;
  11669. and you can request GDB to interrogate the type and value of 'r' and
  11670. 's'.
  11671. (gdb) print s
  11672. {'A'..'C', 'Z'}
  11673. (gdb) ptype s
  11674. SET OF CHAR
  11675. (gdb) print r
  11676. 21
  11677. (gdb) ptype r
  11678. [20..40]
  11679. Likewise if your source code declares 's' as:
  11680. VAR
  11681. s: SET ['A'..'Z'] ;
  11682. then you may query the type of 's' by:
  11683. (gdb) ptype s
  11684. type = SET ['A'..'Z']
  11685. Note that at present you cannot interactively manipulate set expressions
  11686. using the debugger.
  11687. The following example shows how you might declare an array in
  11688. Modula-2 and how you can interact with GDB to print its type and
  11689. contents:
  11690. VAR
  11691. s: ARRAY [-10..10] OF CHAR ;
  11692. (gdb) ptype s
  11693. ARRAY [-10..10] OF CHAR
  11694. Note that the array handling is not yet complete and although the
  11695. type is printed correctly, expression handling still assumes that all
  11696. arrays have a lower bound of zero and not '-10' as in the example above.
  11697. Here are some more type related Modula-2 examples:
  11698. TYPE
  11699. colour = (blue, red, yellow, green) ;
  11700. t = [blue..yellow] ;
  11701. VAR
  11702. s: t ;
  11703. BEGIN
  11704. s := blue ;
  11705. The GDB interaction shows how you can query the data type and value of a
  11706. variable.
  11707. (gdb) print s
  11708. $1 = blue
  11709. (gdb) ptype t
  11710. type = [blue..yellow]
  11711. In this example a Modula-2 array is declared and its contents displayed.
  11712. Observe that the contents are written in the same way as their 'C'
  11713. counterparts.
  11714. VAR
  11715. s: ARRAY [1..5] OF CARDINAL ;
  11716. BEGIN
  11717. s[1] := 1 ;
  11718. (gdb) print s
  11719. $1 = {1, 0, 0, 0, 0}
  11720. (gdb) ptype s
  11721. type = ARRAY [1..5] OF CARDINAL
  11722. The Modula-2 language interface to GDB also understands pointer types
  11723. as shown in this example:
  11724. VAR
  11725. s: POINTER TO ARRAY [1..5] OF CARDINAL ;
  11726. BEGIN
  11727. NEW(s) ;
  11728. s^[1] := 1 ;
  11729. and you can request that GDB describes the type of 's'.
  11730. (gdb) ptype s
  11731. type = POINTER TO ARRAY [1..5] OF CARDINAL
  11732. GDB handles compound types as we can see in this example. Here we
  11733. combine array types, record types, pointer types and subrange types:
  11734. TYPE
  11735. foo = RECORD
  11736. f1: CARDINAL ;
  11737. f2: CHAR ;
  11738. f3: myarray ;
  11739. END ;
  11740. myarray = ARRAY myrange OF CARDINAL ;
  11741. myrange = [-2..2] ;
  11742. VAR
  11743. s: POINTER TO ARRAY myrange OF foo ;
  11744. and you can ask GDB to describe the type of 's' as shown below.
  11745. (gdb) ptype s
  11746. type = POINTER TO ARRAY [-2..2] OF foo = RECORD
  11747. f1 : CARDINAL;
  11748. f2 : CHAR;
  11749. f3 : ARRAY [-2..2] OF CARDINAL;
  11750. END
  11751. 
  11752. File: gdb.info, Node: M2 Defaults, Next: Deviations, Prev: M2 Types, Up: Modula-2
  11753. 15.4.9.5 Modula-2 Defaults
  11754. ..........................
  11755. If type and range checking are set automatically by GDB, they both
  11756. default to 'on' whenever the working language changes to Modula-2. This
  11757. happens regardless of whether you or GDB selected the working language.
  11758. If you allow GDB to set the language automatically, then entering
  11759. code compiled from a file whose name ends with '.mod' sets the working
  11760. language to Modula-2. *Note Having GDB Infer the Source Language:
  11761. Automatically, for further details.
  11762. 
  11763. File: gdb.info, Node: Deviations, Next: M2 Checks, Prev: M2 Defaults, Up: Modula-2
  11764. 15.4.9.6 Deviations from Standard Modula-2
  11765. ..........................................
  11766. A few changes have been made to make Modula-2 programs easier to debug.
  11767. This is done primarily via loosening its type strictness:
  11768. * Unlike in standard Modula-2, pointer constants can be formed by
  11769. integers. This allows you to modify pointer variables during
  11770. debugging. (In standard Modula-2, the actual address contained in
  11771. a pointer variable is hidden from you; it can only be modified
  11772. through direct assignment to another pointer variable or expression
  11773. that returned a pointer.)
  11774. * C escape sequences can be used in strings and characters to
  11775. represent non-printable characters. GDB prints out strings with
  11776. these escape sequences embedded. Single non-printable characters
  11777. are printed using the 'CHR(NNN)' format.
  11778. * The assignment operator (':=') returns the value of its right-hand
  11779. argument.
  11780. * All built-in procedures both modify _and_ return their argument.
  11781. 
  11782. File: gdb.info, Node: M2 Checks, Next: M2 Scope, Prev: Deviations, Up: Modula-2
  11783. 15.4.9.7 Modula-2 Type and Range Checks
  11784. .......................................
  11785. _Warning:_ in this release, GDB does not yet perform type or range
  11786. checking.
  11787. GDB considers two Modula-2 variables type equivalent if:
  11788. * They are of types that have been declared equivalent via a 'TYPE T1
  11789. = T2' statement
  11790. * They have been declared on the same line. (Note: This is true of
  11791. the GNU Modula-2 compiler, but it may not be true of other
  11792. compilers.)
  11793. As long as type checking is enabled, any attempt to combine variables
  11794. whose types are not equivalent is an error.
  11795. Range checking is done on all mathematical operations, assignment,
  11796. array index bounds, and all built-in functions and procedures.
  11797. 
  11798. File: gdb.info, Node: M2 Scope, Next: GDB/M2, Prev: M2 Checks, Up: Modula-2
  11799. 15.4.9.8 The Scope Operators '::' and '.'
  11800. .........................................
  11801. There are a few subtle differences between the Modula-2 scope operator
  11802. ('.') and the GDB scope operator ('::'). The two have similar syntax:
  11803. MODULE . ID
  11804. SCOPE :: ID
  11805. where SCOPE is the name of a module or a procedure, MODULE the name of a
  11806. module, and ID is any declared identifier within your program, except
  11807. another module.
  11808. Using the '::' operator makes GDB search the scope specified by SCOPE
  11809. for the identifier ID. If it is not found in the specified scope, then
  11810. GDB searches all scopes enclosing the one specified by SCOPE.
  11811. Using the '.' operator makes GDB search the current scope for the
  11812. identifier specified by ID that was imported from the definition module
  11813. specified by MODULE. With this operator, it is an error if the
  11814. identifier ID was not imported from definition module MODULE, or if ID
  11815. is not an identifier in MODULE.
  11816. 
  11817. File: gdb.info, Node: GDB/M2, Prev: M2 Scope, Up: Modula-2
  11818. 15.4.9.9 GDB and Modula-2
  11819. .........................
  11820. Some GDB commands have little use when debugging Modula-2 programs.
  11821. Five subcommands of 'set print' and 'show print' apply specifically to C
  11822. and C++: 'vtbl', 'demangle', 'asm-demangle', 'object', and 'union'. The
  11823. first four apply to C++, and the last to the C 'union' type, which has
  11824. no direct analogue in Modula-2.
  11825. The '@' operator (*note Expressions: Expressions.), while available
  11826. with any language, is not useful with Modula-2. Its intent is to aid
  11827. the debugging of "dynamic arrays", which cannot be created in Modula-2
  11828. as they can in C or C++. However, because an address can be specified
  11829. by an integral constant, the construct '{TYPE}ADREXP' is still useful.
  11830. In GDB scripts, the Modula-2 inequality operator '#' is interpreted
  11831. as the beginning of a comment. Use '<>' instead.
  11832. 
  11833. File: gdb.info, Node: Ada, Prev: Modula-2, Up: Supported Languages
  11834. 15.4.10 Ada
  11835. -----------
  11836. The extensions made to GDB for Ada only support output from the GNU Ada
  11837. (GNAT) compiler. Other Ada compilers are not currently supported, and
  11838. attempting to debug executables produced by them is most likely to be
  11839. difficult.
  11840. * Menu:
  11841. * Ada Mode Intro:: General remarks on the Ada syntax
  11842. and semantics supported by Ada mode
  11843. in GDB.
  11844. * Omissions from Ada:: Restrictions on the Ada expression syntax.
  11845. * Additions to Ada:: Extensions of the Ada expression syntax.
  11846. * Overloading support for Ada:: Support for expressions involving overloaded
  11847. subprograms.
  11848. * Stopping Before Main Program:: Debugging the program during elaboration.
  11849. * Ada Exceptions:: Ada Exceptions
  11850. * Ada Tasks:: Listing and setting breakpoints in tasks.
  11851. * Ada Tasks and Core Files:: Tasking Support when Debugging Core Files
  11852. * Ravenscar Profile:: Tasking Support when using the Ravenscar
  11853. Profile
  11854. * Ada Settings:: New settable GDB parameters for Ada.
  11855. * Ada Glitches:: Known peculiarities of Ada mode.
  11856. 
  11857. File: gdb.info, Node: Ada Mode Intro, Next: Omissions from Ada, Up: Ada
  11858. 15.4.10.1 Introduction
  11859. ......................
  11860. The Ada mode of GDB supports a fairly large subset of Ada expression
  11861. syntax, with some extensions. The philosophy behind the design of this
  11862. subset is
  11863. * That GDB should provide basic literals and access to operations for
  11864. arithmetic, dereferencing, field selection, indexing, and
  11865. subprogram calls, leaving more sophisticated computations to
  11866. subprograms written into the program (which therefore may be called
  11867. from GDB).
  11868. * That type safety and strict adherence to Ada language restrictions
  11869. are not particularly important to the GDB user.
  11870. * That brevity is important to the GDB user.
  11871. Thus, for brevity, the debugger acts as if all names declared in
  11872. user-written packages are directly visible, even if they are not visible
  11873. according to Ada rules, thus making it unnecessary to fully qualify most
  11874. names with their packages, regardless of context. Where this causes
  11875. ambiguity, GDB asks the user's intent.
  11876. The debugger will start in Ada mode if it detects an Ada main
  11877. program. As for other languages, it will enter Ada mode when stopped in
  11878. a program that was translated from an Ada source file.
  11879. While in Ada mode, you may use '--' for comments. This is useful
  11880. mostly for documenting command files. The standard GDB comment ('#')
  11881. still works at the beginning of a line in Ada mode, but not in the
  11882. middle (to allow based literals).
  11883. 
  11884. File: gdb.info, Node: Omissions from Ada, Next: Additions to Ada, Prev: Ada Mode Intro, Up: Ada
  11885. 15.4.10.2 Omissions from Ada
  11886. ............................
  11887. Here are the notable omissions from the subset:
  11888. * Only a subset of the attributes are supported:
  11889. - 'First, 'Last, and 'Length on array objects (not on types and
  11890. subtypes).
  11891. - 'Min and 'Max.
  11892. - 'Pos and 'Val.
  11893. - 'Tag.
  11894. - 'Range on array objects (not subtypes), but only as the right
  11895. operand of the membership ('in') operator.
  11896. - 'Access, 'Unchecked_Access, and 'Unrestricted_Access (a GNAT
  11897. extension).
  11898. - 'Address.
  11899. * The names in 'Characters.Latin_1' are not available and
  11900. concatenation is not implemented. Thus, escape characters in
  11901. strings are not currently available.
  11902. * Equality tests ('=' and '/=') on arrays test for bitwise equality
  11903. of representations. They will generally work correctly for strings
  11904. and arrays whose elements have integer or enumeration types. They
  11905. may not work correctly for arrays whose element types have
  11906. user-defined equality, for arrays of real values (in particular,
  11907. IEEE-conformant floating point, because of negative zeroes and
  11908. NaNs), and for arrays whose elements contain unused bits with
  11909. indeterminate values.
  11910. * The other component-by-component array operations ('and', 'or',
  11911. 'xor', 'not', and relational tests other than equality) are not
  11912. implemented.
  11913. * There is limited support for array and record aggregates. They are
  11914. permitted only on the right sides of assignments, as in these
  11915. examples:
  11916. (gdb) set An_Array := (1, 2, 3, 4, 5, 6)
  11917. (gdb) set An_Array := (1, others => 0)
  11918. (gdb) set An_Array := (0|4 => 1, 1..3 => 2, 5 => 6)
  11919. (gdb) set A_2D_Array := ((1, 2, 3), (4, 5, 6), (7, 8, 9))
  11920. (gdb) set A_Record := (1, "Peter", True);
  11921. (gdb) set A_Record := (Name => "Peter", Id => 1, Alive => True)
  11922. Changing a discriminant's value by assigning an aggregate has an
  11923. undefined effect if that discriminant is used within the record.
  11924. However, you can first modify discriminants by directly assigning
  11925. to them (which normally would not be allowed in Ada), and then
  11926. performing an aggregate assignment. For example, given a variable
  11927. 'A_Rec' declared to have a type such as:
  11928. type Rec (Len : Small_Integer := 0) is record
  11929. Id : Integer;
  11930. Vals : IntArray (1 .. Len);
  11931. end record;
  11932. you can assign a value with a different size of 'Vals' with two
  11933. assignments:
  11934. (gdb) set A_Rec.Len := 4
  11935. (gdb) set A_Rec := (Id => 42, Vals => (1, 2, 3, 4))
  11936. As this example also illustrates, GDB is very loose about the usual
  11937. rules concerning aggregates. You may leave out some of the
  11938. components of an array or record aggregate (such as the 'Len'
  11939. component in the assignment to 'A_Rec' above); they will retain
  11940. their original values upon assignment. You may freely use dynamic
  11941. values as indices in component associations. You may even use
  11942. overlapping or redundant component associations, although which
  11943. component values are assigned in such cases is not defined.
  11944. * Calls to dispatching subprograms are not implemented.
  11945. * The overloading algorithm is much more limited (i.e., less
  11946. selective) than that of real Ada. It makes only limited use of the
  11947. context in which a subexpression appears to resolve its meaning,
  11948. and it is much looser in its rules for allowing type matches. As a
  11949. result, some function calls will be ambiguous, and the user will be
  11950. asked to choose the proper resolution.
  11951. * The 'new' operator is not implemented.
  11952. * Entry calls are not implemented.
  11953. * Aside from printing, arithmetic operations on the native VAX
  11954. floating-point formats are not supported.
  11955. * It is not possible to slice a packed array.
  11956. * The names 'True' and 'False', when not part of a qualified name,
  11957. are interpreted as if implicitly prefixed by 'Standard', regardless
  11958. of context. Should your program redefine these names in a package
  11959. or procedure (at best a dubious practice), you will have to use
  11960. fully qualified names to access their new definitions.
  11961. 
  11962. File: gdb.info, Node: Additions to Ada, Next: Overloading support for Ada, Prev: Omissions from Ada, Up: Ada
  11963. 15.4.10.3 Additions to Ada
  11964. ..........................
  11965. As it does for other languages, GDB makes certain generic extensions to
  11966. Ada (*note Expressions::):
  11967. * If the expression E is a variable residing in memory (typically a
  11968. local variable or array element) and N is a positive integer, then
  11969. 'E@N' displays the values of E and the N-1 adjacent variables
  11970. following it in memory as an array. In Ada, this operator is
  11971. generally not necessary, since its prime use is in displaying parts
  11972. of an array, and slicing will usually do this in Ada. However,
  11973. there are occasional uses when debugging programs in which certain
  11974. debugging information has been optimized away.
  11975. * 'B::VAR' means "the variable named VAR that appears in function or
  11976. file B." When B is a file name, you must typically surround it in
  11977. single quotes.
  11978. * The expression '{TYPE} ADDR' means "the variable of type TYPE that
  11979. appears at address ADDR."
  11980. * A name starting with '$' is a convenience variable (*note
  11981. Convenience Vars::) or a machine register (*note Registers::).
  11982. In addition, GDB provides a few other shortcuts and outright
  11983. additions specific to Ada:
  11984. * The assignment statement is allowed as an expression, returning its
  11985. right-hand operand as its value. Thus, you may enter
  11986. (gdb) set x := y + 3
  11987. (gdb) print A(tmp := y + 1)
  11988. * The semicolon is allowed as an "operator," returning as its value
  11989. the value of its right-hand operand. This allows, for example,
  11990. complex conditional breaks:
  11991. (gdb) break f
  11992. (gdb) condition 1 (report(i); k += 1; A(k) > 100)
  11993. * Rather than use catenation and symbolic character names to
  11994. introduce special characters into strings, one may instead use a
  11995. special bracket notation, which is also used to print strings. A
  11996. sequence of characters of the form '["XX"]' within a string or
  11997. character literal denotes the (single) character whose numeric
  11998. encoding is XX in hexadecimal. The sequence of characters '["""]'
  11999. also denotes a single quotation mark in strings. For example,
  12000. "One line.["0a"]Next line.["0a"]"
  12001. contains an ASCII newline character ('Ada.Characters.Latin_1.LF')
  12002. after each period.
  12003. * The subtype used as a prefix for the attributes 'Pos, 'Min, and
  12004. 'Max is optional (and is ignored in any case). For example, it is
  12005. valid to write
  12006. (gdb) print 'max(x, y)
  12007. * When printing arrays, GDB uses positional notation when the array
  12008. has a lower bound of 1, and uses a modified named notation
  12009. otherwise. For example, a one-dimensional array of three integers
  12010. with a lower bound of 3 might print as
  12011. (3 => 10, 17, 1)
  12012. That is, in contrast to valid Ada, only the first component has a
  12013. '=>' clause.
  12014. * You may abbreviate attributes in expressions with any unique,
  12015. multi-character subsequence of their names (an exact match gets
  12016. preference). For example, you may use a'len, a'gth, or a'lh in
  12017. place of a'length.
  12018. * Since Ada is case-insensitive, the debugger normally maps
  12019. identifiers you type to lower case. The GNAT compiler uses
  12020. upper-case characters for some of its internal identifiers, which
  12021. are normally of no interest to users. For the rare occasions when
  12022. you actually have to look at them, enclose them in angle brackets
  12023. to avoid the lower-case mapping. For example,
  12024. (gdb) print <JMPBUF_SAVE>[0]
  12025. * Printing an object of class-wide type or dereferencing an
  12026. access-to-class-wide value will display all the components of the
  12027. object's specific type (as indicated by its run-time tag).
  12028. Likewise, component selection on such a value will operate on the
  12029. specific type of the object.
  12030. 
  12031. File: gdb.info, Node: Overloading support for Ada, Next: Stopping Before Main Program, Prev: Additions to Ada, Up: Ada
  12032. 15.4.10.4 Overloading support for Ada
  12033. .....................................
  12034. The debugger supports limited overloading. Given a subprogram call in
  12035. which the function symbol has multiple definitions, it will use the
  12036. number of actual parameters and some information about their types to
  12037. attempt to narrow the set of definitions. It also makes very limited
  12038. use of context, preferring procedures to functions in the context of the
  12039. 'call' command, and functions to procedures elsewhere.
  12040. If, after narrowing, the set of matching definitions still contains
  12041. more than one definition, GDB will display a menu to query which one it
  12042. should use, for instance:
  12043. (gdb) print f(1)
  12044. Multiple matches for f
  12045. [0] cancel
  12046. [1] foo.f (integer) return boolean at foo.adb:23
  12047. [2] foo.f (foo.new_integer) return boolean at foo.adb:28
  12048. >
  12049. In this case, just select one menu entry either to cancel expression
  12050. evaluation (type '0' and press <RET>) or to continue evaluation with a
  12051. specific instance (type the corresponding number and press <RET>).
  12052. Here are a couple of commands to customize GDB's behavior in this
  12053. case:
  12054. 'set ada print-signatures'
  12055. Control whether parameter types and return types are displayed in
  12056. overloads selection menus. It is 'on' by default. *Note
  12057. Overloading support for Ada::.
  12058. 'show ada print-signatures'
  12059. Show the current setting for displaying parameter types and return
  12060. types in overloads selection menu. *Note Overloading support for
  12061. Ada::.
  12062. 
  12063. File: gdb.info, Node: Stopping Before Main Program, Next: Ada Exceptions, Prev: Overloading support for Ada, Up: Ada
  12064. 15.4.10.5 Stopping at the Very Beginning
  12065. ........................................
  12066. It is sometimes necessary to debug the program during elaboration, and
  12067. before reaching the main procedure. As defined in the Ada Reference
  12068. Manual, the elaboration code is invoked from a procedure called
  12069. 'adainit'. To run your program up to the beginning of elaboration,
  12070. simply use the following two commands: 'tbreak adainit' and 'run'.
  12071. 
  12072. File: gdb.info, Node: Ada Exceptions, Next: Ada Tasks, Prev: Stopping Before Main Program, Up: Ada
  12073. 15.4.10.6 Ada Exceptions
  12074. ........................
  12075. A command is provided to list all Ada exceptions:
  12076. 'info exceptions'
  12077. 'info exceptions REGEXP'
  12078. The 'info exceptions' command allows you to list all Ada exceptions
  12079. defined within the program being debugged, as well as their
  12080. addresses. With a regular expression, REGEXP, as argument, only
  12081. those exceptions whose names match REGEXP are listed.
  12082. Below is a small example, showing how the command can be used, first
  12083. without argument, and next with a regular expression passed as an
  12084. argument.
  12085. (gdb) info exceptions
  12086. All defined Ada exceptions:
  12087. constraint_error: 0x613da0
  12088. program_error: 0x613d20
  12089. storage_error: 0x613ce0
  12090. tasking_error: 0x613ca0
  12091. const.aint_global_e: 0x613b00
  12092. (gdb) info exceptions const.aint
  12093. All Ada exceptions matching regular expression "const.aint":
  12094. constraint_error: 0x613da0
  12095. const.aint_global_e: 0x613b00
  12096. It is also possible to ask GDB to stop your program's execution when
  12097. an exception is raised. For more details, see *note Set Catchpoints::.
  12098. 
  12099. File: gdb.info, Node: Ada Tasks, Next: Ada Tasks and Core Files, Prev: Ada Exceptions, Up: Ada
  12100. 15.4.10.7 Extensions for Ada Tasks
  12101. ..................................
  12102. Support for Ada tasks is analogous to that for threads (*note
  12103. Threads::). GDB provides the following task-related commands:
  12104. 'info tasks'
  12105. This command shows a list of current Ada tasks, as in the following
  12106. example:
  12107. (gdb) info tasks
  12108. ID TID P-ID Pri State Name
  12109. 1 8088000 0 15 Child Activation Wait main_task
  12110. 2 80a4000 1 15 Accept Statement b
  12111. 3 809a800 1 15 Child Activation Wait a
  12112. * 4 80ae800 3 15 Runnable c
  12113. In this listing, the asterisk before the last task indicates it to
  12114. be the task currently being inspected.
  12115. ID
  12116. Represents GDB's internal task number.
  12117. TID
  12118. The Ada task ID.
  12119. P-ID
  12120. The parent's task ID (GDB's internal task number).
  12121. Pri
  12122. The base priority of the task.
  12123. State
  12124. Current state of the task.
  12125. 'Unactivated'
  12126. The task has been created but has not been activated. It
  12127. cannot be executing.
  12128. 'Runnable'
  12129. The task is not blocked for any reason known to Ada. (It
  12130. may be waiting for a mutex, though.) It is conceptually
  12131. "executing" in normal mode.
  12132. 'Terminated'
  12133. The task is terminated, in the sense of ARM 9.3 (5). Any
  12134. dependents that were waiting on terminate alternatives
  12135. have been awakened and have terminated themselves.
  12136. 'Child Activation Wait'
  12137. The task is waiting for created tasks to complete
  12138. activation.
  12139. 'Accept Statement'
  12140. The task is waiting on an accept or selective wait
  12141. statement.
  12142. 'Waiting on entry call'
  12143. The task is waiting on an entry call.
  12144. 'Async Select Wait'
  12145. The task is waiting to start the abortable part of an
  12146. asynchronous select statement.
  12147. 'Delay Sleep'
  12148. The task is waiting on a select statement with only a
  12149. delay alternative open.
  12150. 'Child Termination Wait'
  12151. The task is sleeping having completed a master within
  12152. itself, and is waiting for the tasks dependent on that
  12153. master to become terminated or waiting on a terminate
  12154. Phase.
  12155. 'Wait Child in Term Alt'
  12156. The task is sleeping waiting for tasks on terminate
  12157. alternatives to finish terminating.
  12158. 'Accepting RV with TASKNO'
  12159. The task is accepting a rendez-vous with the task TASKNO.
  12160. Name
  12161. Name of the task in the program.
  12162. 'info task TASKNO'
  12163. This command shows detailed informations on the specified task, as
  12164. in the following example:
  12165. (gdb) info tasks
  12166. ID TID P-ID Pri State Name
  12167. 1 8077880 0 15 Child Activation Wait main_task
  12168. * 2 807c468 1 15 Runnable task_1
  12169. (gdb) info task 2
  12170. Ada Task: 0x807c468
  12171. Name: "task_1"
  12172. Thread: 0
  12173. LWP: 0x1fac
  12174. Parent: 1 ("main_task")
  12175. Base Priority: 15
  12176. State: Runnable
  12177. 'task'
  12178. This command prints the ID and name of the current task.
  12179. (gdb) info tasks
  12180. ID TID P-ID Pri State Name
  12181. 1 8077870 0 15 Child Activation Wait main_task
  12182. * 2 807c458 1 15 Runnable some_task
  12183. (gdb) task
  12184. [Current task is 2 "some_task"]
  12185. 'task TASKNO'
  12186. This command is like the 'thread THREAD-ID' command (*note
  12187. Threads::). It switches the context of debugging from the current
  12188. task to the given task.
  12189. (gdb) info tasks
  12190. ID TID P-ID Pri State Name
  12191. 1 8077870 0 15 Child Activation Wait main_task
  12192. * 2 807c458 1 15 Runnable some_task
  12193. (gdb) task 1
  12194. [Switching to task 1 "main_task"]
  12195. #0 0x8067726 in pthread_cond_wait ()
  12196. (gdb) bt
  12197. #0 0x8067726 in pthread_cond_wait ()
  12198. #1 0x8056714 in system.os_interface.pthread_cond_wait ()
  12199. #2 0x805cb63 in system.task_primitives.operations.sleep ()
  12200. #3 0x806153e in system.tasking.stages.activate_tasks ()
  12201. #4 0x804aacc in un () at un.adb:5
  12202. 'break LOCATION task TASKNO'
  12203. 'break LOCATION task TASKNO if ...'
  12204. These commands are like the 'break ... thread ...' command (*note
  12205. Thread Stops::). The LOCATION argument specifies source lines, as
  12206. described in *note Specify Location::.
  12207. Use the qualifier 'task TASKNO' with a breakpoint command to
  12208. specify that you only want GDB to stop the program when a
  12209. particular Ada task reaches this breakpoint. The TASKNO is one of
  12210. the numeric task identifiers assigned by GDB, shown in the first
  12211. column of the 'info tasks' display.
  12212. If you do not specify 'task TASKNO' when you set a breakpoint, the
  12213. breakpoint applies to _all_ tasks of your program.
  12214. You can use the 'task' qualifier on conditional breakpoints as
  12215. well; in this case, place 'task TASKNO' before the breakpoint
  12216. condition (before the 'if').
  12217. For example,
  12218. (gdb) info tasks
  12219. ID TID P-ID Pri State Name
  12220. 1 140022020 0 15 Child Activation Wait main_task
  12221. 2 140045060 1 15 Accept/Select Wait t2
  12222. 3 140044840 1 15 Runnable t1
  12223. * 4 140056040 1 15 Runnable t3
  12224. (gdb) b 15 task 2
  12225. Breakpoint 5 at 0x120044cb0: file test_task_debug.adb, line 15.
  12226. (gdb) cont
  12227. Continuing.
  12228. task # 1 running
  12229. task # 2 running
  12230. Breakpoint 5, test_task_debug () at test_task_debug.adb:15
  12231. 15 flush;
  12232. (gdb) info tasks
  12233. ID TID P-ID Pri State Name
  12234. 1 140022020 0 15 Child Activation Wait main_task
  12235. * 2 140045060 1 15 Runnable t2
  12236. 3 140044840 1 15 Runnable t1
  12237. 4 140056040 1 15 Delay Sleep t3
  12238. 
  12239. File: gdb.info, Node: Ada Tasks and Core Files, Next: Ravenscar Profile, Prev: Ada Tasks, Up: Ada
  12240. 15.4.10.8 Tasking Support when Debugging Core Files
  12241. ...................................................
  12242. When inspecting a core file, as opposed to debugging a live program,
  12243. tasking support may be limited or even unavailable, depending on the
  12244. platform being used. For instance, on x86-linux, the list of tasks is
  12245. available, but task switching is not supported.
  12246. On certain platforms, the debugger needs to perform some memory
  12247. writes in order to provide Ada tasking support. When inspecting a core
  12248. file, this means that the core file must be opened with read-write
  12249. privileges, using the command '"set write on"' (*note Patching::).
  12250. Under these circumstances, you should make a backup copy of the core
  12251. file before inspecting it with GDB.
  12252. 
  12253. File: gdb.info, Node: Ravenscar Profile, Next: Ada Settings, Prev: Ada Tasks and Core Files, Up: Ada
  12254. 15.4.10.9 Tasking Support when using the Ravenscar Profile
  12255. ..........................................................
  12256. The "Ravenscar Profile" is a subset of the Ada tasking features,
  12257. specifically designed for systems with safety-critical real-time
  12258. requirements.
  12259. 'set ravenscar task-switching on'
  12260. Allows task switching when debugging a program that uses the
  12261. Ravenscar Profile. This is the default.
  12262. 'set ravenscar task-switching off'
  12263. Turn off task switching when debugging a program that uses the
  12264. Ravenscar Profile. This is mostly intended to disable the code
  12265. that adds support for the Ravenscar Profile, in case a bug in
  12266. either GDB or in the Ravenscar runtime is preventing GDB from
  12267. working properly. To be effective, this command should be run
  12268. before the program is started.
  12269. 'show ravenscar task-switching'
  12270. Show whether it is possible to switch from task to task in a
  12271. program using the Ravenscar Profile.
  12272. 
  12273. File: gdb.info, Node: Ada Settings, Next: Ada Glitches, Prev: Ravenscar Profile, Up: Ada
  12274. 15.4.10.10 Ada Settings
  12275. .......................
  12276. 'set varsize-limit SIZE'
  12277. Prevent GDB from attempting to evaluate objects whose size is above
  12278. the given limit (SIZE) when those sizes are computed from run-time
  12279. quantities. This is typically the case when the object has a
  12280. variable size, such as an array whose bounds are not known at
  12281. compile time for example. Setting SIZE to 'unlimited' removes the
  12282. size limitation. By default, the limit is about 65KB.
  12283. The purpose of having such a limit is to prevent GDB from trying to
  12284. grab enormous chunks of virtual memory when asked to evaluate a
  12285. quantity whose bounds have been corrupted or have not yet been
  12286. fully initialized. The limit applies to the results of some
  12287. subexpressions as well as to complete expressions. For example, an
  12288. expression denoting a simple integer component, such as 'x.y.z',
  12289. may fail if the size of 'x.y' is variable and exceeds 'size'. On
  12290. the other hand, GDB is sometimes clever; the expression 'A(i)',
  12291. where 'A' is an array variable with non-constant size, will
  12292. generally succeed regardless of the bounds on 'A', as long as the
  12293. component size is less than SIZE.
  12294. 'show varsize-limit'
  12295. Show the limit on types whose size is determined by run-time
  12296. quantities.
  12297. 
  12298. File: gdb.info, Node: Ada Glitches, Prev: Ada Settings, Up: Ada
  12299. 15.4.10.11 Known Peculiarities of Ada Mode
  12300. ..........................................
  12301. Besides the omissions listed previously (*note Omissions from Ada::), we
  12302. know of several problems with and limitations of Ada mode in GDB, some
  12303. of which will be fixed with planned future releases of the debugger and
  12304. the GNU Ada compiler.
  12305. * Static constants that the compiler chooses not to materialize as
  12306. objects in storage are invisible to the debugger.
  12307. * Named parameter associations in function argument lists are ignored
  12308. (the argument lists are treated as positional).
  12309. * Many useful library packages are currently invisible to the
  12310. debugger.
  12311. * Fixed-point arithmetic, conversions, input, and output is carried
  12312. out using floating-point arithmetic, and may give results that only
  12313. approximate those on the host machine.
  12314. * The GNAT compiler never generates the prefix 'Standard' for any of
  12315. the standard symbols defined by the Ada language. GDB knows about
  12316. this: it will strip the prefix from names when you use it, and will
  12317. never look for a name you have so qualified among local symbols,
  12318. nor match against symbols in other packages or subprograms. If you
  12319. have defined entities anywhere in your program other than
  12320. parameters and local variables whose simple names match names in
  12321. 'Standard', GNAT's lack of qualification here can cause confusion.
  12322. When this happens, you can usually resolve the confusion by
  12323. qualifying the problematic names with package 'Standard'
  12324. explicitly.
  12325. Older versions of the compiler sometimes generate erroneous debugging
  12326. information, resulting in the debugger incorrectly printing the value of
  12327. affected entities. In some cases, the debugger is able to work around
  12328. an issue automatically. In other cases, the debugger is able to work
  12329. around the issue, but the work-around has to be specifically enabled.
  12330. 'set ada trust-PAD-over-XVS on'
  12331. Configure GDB to strictly follow the GNAT encoding when computing
  12332. the value of Ada entities, particularly when 'PAD' and 'PAD___XVS'
  12333. types are involved (see 'ada/exp_dbug.ads' in the GCC sources for a
  12334. complete description of the encoding used by the GNAT compiler).
  12335. This is the default.
  12336. 'set ada trust-PAD-over-XVS off'
  12337. This is related to the encoding using by the GNAT compiler. If GDB
  12338. sometimes prints the wrong value for certain entities, changing
  12339. 'ada trust-PAD-over-XVS' to 'off' activates a work-around which may
  12340. fix the issue. It is always safe to set 'ada trust-PAD-over-XVS'
  12341. to 'off', but this incurs a slight performance penalty, so it is
  12342. recommended to leave this setting to 'on' unless necessary.
  12343. Internally, the debugger also relies on the compiler following a
  12344. number of conventions known as the 'GNAT Encoding', all documented in
  12345. 'gcc/ada/exp_dbug.ads' in the GCC sources. This encoding describes how
  12346. the debugging information should be generated for certain types. In
  12347. particular, this convention makes use of "descriptive types", which are
  12348. artificial types generated purely to help the debugger.
  12349. These encodings were defined at a time when the debugging information
  12350. format used was not powerful enough to describe some of the more complex
  12351. types available in Ada. Since DWARF allows us to express nearly all Ada
  12352. features, the long-term goal is to slowly replace these descriptive
  12353. types by their pure DWARF equivalent. To facilitate that transition, a
  12354. new maintenance option is available to force the debugger to ignore
  12355. those descriptive types. It allows the user to quickly evaluate how
  12356. well GDB works without them.
  12357. 'maintenance ada set ignore-descriptive-types [on|off]'
  12358. Control whether the debugger should ignore descriptive types. The
  12359. default is not to ignore descriptives types ('off').
  12360. 'maintenance ada show ignore-descriptive-types'
  12361. Show if descriptive types are ignored by GDB.
  12362. 
  12363. File: gdb.info, Node: Unsupported Languages, Prev: Supported Languages, Up: Languages
  12364. 15.5 Unsupported Languages
  12365. ==========================
  12366. In addition to the other fully-supported programming languages, GDB also
  12367. provides a pseudo-language, called 'minimal'. It does not represent a
  12368. real programming language, but provides a set of capabilities close to
  12369. what the C or assembly languages provide. This should allow most simple
  12370. operations to be performed while debugging an application that uses a
  12371. language currently not supported by GDB.
  12372. If the language is set to 'auto', GDB will automatically select this
  12373. language if the current frame corresponds to an unsupported language.
  12374. 
  12375. File: gdb.info, Node: Symbols, Next: Altering, Prev: Languages, Up: Top
  12376. 16 Examining the Symbol Table
  12377. *****************************
  12378. The commands described in this chapter allow you to inquire about the
  12379. symbols (names of variables, functions and types) defined in your
  12380. program. This information is inherent in the text of your program and
  12381. does not change as your program executes. GDB finds it in your
  12382. program's symbol table, in the file indicated when you started GDB
  12383. (*note Choosing Files: File Options.), or by one of the file-management
  12384. commands (*note Commands to Specify Files: Files.).
  12385. Occasionally, you may need to refer to symbols that contain unusual
  12386. characters, which GDB ordinarily treats as word delimiters. The most
  12387. frequent case is in referring to static variables in other source files
  12388. (*note Program Variables: Variables.). File names are recorded in
  12389. object files as debugging symbols, but GDB would ordinarily parse a
  12390. typical file name, like 'foo.c', as the three words 'foo' '.' 'c'. To
  12391. allow GDB to recognize 'foo.c' as a single symbol, enclose it in single
  12392. quotes; for example,
  12393. p 'foo.c'::x
  12394. looks up the value of 'x' in the scope of the file 'foo.c'.
  12395. 'set case-sensitive on'
  12396. 'set case-sensitive off'
  12397. 'set case-sensitive auto'
  12398. Normally, when GDB looks up symbols, it matches their names with
  12399. case sensitivity determined by the current source language.
  12400. Occasionally, you may wish to control that. The command 'set
  12401. case-sensitive' lets you do that by specifying 'on' for
  12402. case-sensitive matches or 'off' for case-insensitive ones. If you
  12403. specify 'auto', case sensitivity is reset to the default suitable
  12404. for the source language. The default is case-sensitive matches for
  12405. all languages except for Fortran, for which the default is
  12406. case-insensitive matches.
  12407. 'show case-sensitive'
  12408. This command shows the current setting of case sensitivity for
  12409. symbols lookups.
  12410. 'set print type methods'
  12411. 'set print type methods on'
  12412. 'set print type methods off'
  12413. Normally, when GDB prints a class, it displays any methods declared
  12414. in that class. You can control this behavior either by passing the
  12415. appropriate flag to 'ptype', or using 'set print type methods'.
  12416. Specifying 'on' will cause GDB to display the methods; this is the
  12417. default. Specifying 'off' will cause GDB to omit the methods.
  12418. 'show print type methods'
  12419. This command shows the current setting of method display when
  12420. printing classes.
  12421. 'set print type nested-type-limit LIMIT'
  12422. 'set print type nested-type-limit unlimited'
  12423. Set the limit of displayed nested types that the type printer will
  12424. show. A LIMIT of 'unlimited' or '-1' will show all nested
  12425. definitions. By default, the type printer will not show any nested
  12426. types defined in classes.
  12427. 'show print type nested-type-limit'
  12428. This command shows the current display limit of nested types when
  12429. printing classes.
  12430. 'set print type typedefs'
  12431. 'set print type typedefs on'
  12432. 'set print type typedefs off'
  12433. Normally, when GDB prints a class, it displays any typedefs defined
  12434. in that class. You can control this behavior either by passing the
  12435. appropriate flag to 'ptype', or using 'set print type typedefs'.
  12436. Specifying 'on' will cause GDB to display the typedef definitions;
  12437. this is the default. Specifying 'off' will cause GDB to omit the
  12438. typedef definitions. Note that this controls whether the typedef
  12439. definition itself is printed, not whether typedef names are
  12440. substituted when printing other types.
  12441. 'show print type typedefs'
  12442. This command shows the current setting of typedef display when
  12443. printing classes.
  12444. 'info address SYMBOL'
  12445. Describe where the data for SYMBOL is stored. For a register
  12446. variable, this says which register it is kept in. For a
  12447. non-register local variable, this prints the stack-frame offset at
  12448. which the variable is always stored.
  12449. Note the contrast with 'print &SYMBOL', which does not work at all
  12450. for a register variable, and for a stack local variable prints the
  12451. exact address of the current instantiation of the variable.
  12452. 'info symbol ADDR'
  12453. Print the name of a symbol which is stored at the address ADDR. If
  12454. no symbol is stored exactly at ADDR, GDB prints the nearest symbol
  12455. and an offset from it:
  12456. (gdb) info symbol 0x54320
  12457. _initialize_vx + 396 in section .text
  12458. This is the opposite of the 'info address' command. You can use it
  12459. to find out the name of a variable or a function given its address.
  12460. For dynamically linked executables, the name of executable or
  12461. shared library containing the symbol is also printed:
  12462. (gdb) info symbol 0x400225
  12463. _start + 5 in section .text of /tmp/a.out
  12464. (gdb) info symbol 0x2aaaac2811cf
  12465. __read_nocancel + 6 in section .text of /usr/lib64/libc.so.6
  12466. 'demangle [-l LANGUAGE] [--] NAME'
  12467. Demangle NAME. If LANGUAGE is provided it is the name of the
  12468. language to demangle NAME in. Otherwise NAME is demangled in the
  12469. current language.
  12470. The '--' option specifies the end of options, and is useful when
  12471. NAME begins with a dash.
  12472. The parameter 'demangle-style' specifies how to interpret the kind
  12473. of mangling used. *Note Print Settings::.
  12474. 'whatis[/FLAGS] [ARG]'
  12475. Print the data type of ARG, which can be either an expression or a
  12476. name of a data type. With no argument, print the data type of '$',
  12477. the last value in the value history.
  12478. If ARG is an expression (*note Expressions: Expressions.), it is
  12479. not actually evaluated, and any side-effecting operations (such as
  12480. assignments or function calls) inside it do not take place.
  12481. If ARG is a variable or an expression, 'whatis' prints its literal
  12482. type as it is used in the source code. If the type was defined
  12483. using a 'typedef', 'whatis' will _not_ print the data type
  12484. underlying the 'typedef'. If the type of the variable or the
  12485. expression is a compound data type, such as 'struct' or 'class',
  12486. 'whatis' never prints their fields or methods. It just prints the
  12487. 'struct'/'class' name (a.k.a. its "tag"). If you want to see the
  12488. members of such a compound data type, use 'ptype'.
  12489. If ARG is a type name that was defined using 'typedef', 'whatis'
  12490. "unrolls" only one level of that 'typedef'. Unrolling means that
  12491. 'whatis' will show the underlying type used in the 'typedef'
  12492. declaration of ARG. However, if that underlying type is also a
  12493. 'typedef', 'whatis' will not unroll it.
  12494. For C code, the type names may also have the form 'class
  12495. CLASS-NAME', 'struct STRUCT-TAG', 'union UNION-TAG' or 'enum
  12496. ENUM-TAG'.
  12497. FLAGS can be used to modify how the type is displayed. Available
  12498. flags are:
  12499. 'r'
  12500. Display in "raw" form. Normally, GDB substitutes template
  12501. parameters and typedefs defined in a class when printing the
  12502. class' members. The '/r' flag disables this.
  12503. 'm'
  12504. Do not print methods defined in the class.
  12505. 'M'
  12506. Print methods defined in the class. This is the default, but
  12507. the flag exists in case you change the default with 'set print
  12508. type methods'.
  12509. 't'
  12510. Do not print typedefs defined in the class. Note that this
  12511. controls whether the typedef definition itself is printed, not
  12512. whether typedef names are substituted when printing other
  12513. types.
  12514. 'T'
  12515. Print typedefs defined in the class. This is the default, but
  12516. the flag exists in case you change the default with 'set print
  12517. type typedefs'.
  12518. 'o'
  12519. Print the offsets and sizes of fields in a struct, similar to
  12520. what the 'pahole' tool does. This option implies the '/tm'
  12521. flags.
  12522. For example, given the following declarations:
  12523. struct tuv
  12524. {
  12525. int a1;
  12526. char *a2;
  12527. int a3;
  12528. };
  12529. struct xyz
  12530. {
  12531. int f1;
  12532. char f2;
  12533. void *f3;
  12534. struct tuv f4;
  12535. };
  12536. union qwe
  12537. {
  12538. struct tuv fff1;
  12539. struct xyz fff2;
  12540. };
  12541. struct tyu
  12542. {
  12543. int a1 : 1;
  12544. int a2 : 3;
  12545. int a3 : 23;
  12546. char a4 : 2;
  12547. int64_t a5;
  12548. int a6 : 5;
  12549. int64_t a7 : 3;
  12550. };
  12551. Issuing a 'ptype /o struct tuv' command would print:
  12552. (gdb) ptype /o struct tuv
  12553. /* offset | size */ type = struct tuv {
  12554. /* 0 | 4 */ int a1;
  12555. /* XXX 4-byte hole */
  12556. /* 8 | 8 */ char *a2;
  12557. /* 16 | 4 */ int a3;
  12558. /* total size (bytes): 24 */
  12559. }
  12560. Notice the format of the first column of comments. There, you
  12561. can find two parts separated by the '|' character: the
  12562. _offset_, which indicates where the field is located inside
  12563. the struct, in bytes, and the _size_ of the field. Another
  12564. interesting line is the marker of a _hole_ in the struct,
  12565. indicating that it may be possible to pack the struct and make
  12566. it use less space by reorganizing its fields.
  12567. It is also possible to print offsets inside an union:
  12568. (gdb) ptype /o union qwe
  12569. /* offset | size */ type = union qwe {
  12570. /* 24 */ struct tuv {
  12571. /* 0 | 4 */ int a1;
  12572. /* XXX 4-byte hole */
  12573. /* 8 | 8 */ char *a2;
  12574. /* 16 | 4 */ int a3;
  12575. /* total size (bytes): 24 */
  12576. } fff1;
  12577. /* 40 */ struct xyz {
  12578. /* 0 | 4 */ int f1;
  12579. /* 4 | 1 */ char f2;
  12580. /* XXX 3-byte hole */
  12581. /* 8 | 8 */ void *f3;
  12582. /* 16 | 24 */ struct tuv {
  12583. /* 16 | 4 */ int a1;
  12584. /* XXX 4-byte hole */
  12585. /* 24 | 8 */ char *a2;
  12586. /* 32 | 4 */ int a3;
  12587. /* total size (bytes): 24 */
  12588. } f4;
  12589. /* total size (bytes): 40 */
  12590. } fff2;
  12591. /* total size (bytes): 40 */
  12592. }
  12593. In this case, since 'struct tuv' and 'struct xyz' occupy the
  12594. same space (because we are dealing with an union), the offset
  12595. is not printed for them. However, you can still examine the
  12596. offset of each of these structures' fields.
  12597. Another useful scenario is printing the offsets of a struct
  12598. containing bitfields:
  12599. (gdb) ptype /o struct tyu
  12600. /* offset | size */ type = struct tyu {
  12601. /* 0:31 | 4 */ int a1 : 1;
  12602. /* 0:28 | 4 */ int a2 : 3;
  12603. /* 0: 5 | 4 */ int a3 : 23;
  12604. /* 3: 3 | 1 */ signed char a4 : 2;
  12605. /* XXX 3-bit hole */
  12606. /* XXX 4-byte hole */
  12607. /* 8 | 8 */ int64_t a5;
  12608. /* 16: 0 | 4 */ int a6 : 5;
  12609. /* 16: 5 | 8 */ int64_t a7 : 3;
  12610. "/* XXX 7-byte padding */
  12611. /* total size (bytes): 24 */
  12612. }
  12613. Note how the offset information is now extended to also
  12614. include the first bit of the bitfield.
  12615. 'ptype[/FLAGS] [ARG]'
  12616. 'ptype' accepts the same arguments as 'whatis', but prints a
  12617. detailed description of the type, instead of just the name of the
  12618. type. *Note Expressions: Expressions.
  12619. Contrary to 'whatis', 'ptype' always unrolls any 'typedef's in its
  12620. argument declaration, whether the argument is a variable,
  12621. expression, or a data type. This means that 'ptype' of a variable
  12622. or an expression will not print literally its type as present in
  12623. the source code--use 'whatis' for that. 'typedef's at the pointer
  12624. or reference targets are also unrolled. Only 'typedef's of fields,
  12625. methods and inner 'class typedef's of 'struct's, 'class'es and
  12626. 'union's are not unrolled even with 'ptype'.
  12627. For example, for this variable declaration:
  12628. typedef double real_t;
  12629. struct complex { real_t real; double imag; };
  12630. typedef struct complex complex_t;
  12631. complex_t var;
  12632. real_t *real_pointer_var;
  12633. the two commands give this output:
  12634. (gdb) whatis var
  12635. type = complex_t
  12636. (gdb) ptype var
  12637. type = struct complex {
  12638. real_t real;
  12639. double imag;
  12640. }
  12641. (gdb) whatis complex_t
  12642. type = struct complex
  12643. (gdb) whatis struct complex
  12644. type = struct complex
  12645. (gdb) ptype struct complex
  12646. type = struct complex {
  12647. real_t real;
  12648. double imag;
  12649. }
  12650. (gdb) whatis real_pointer_var
  12651. type = real_t *
  12652. (gdb) ptype real_pointer_var
  12653. type = double *
  12654. As with 'whatis', using 'ptype' without an argument refers to the
  12655. type of '$', the last value in the value history.
  12656. Sometimes, programs use opaque data types or incomplete
  12657. specifications of complex data structure. If the debug information
  12658. included in the program does not allow GDB to display a full
  12659. declaration of the data type, it will say '<incomplete type>'. For
  12660. example, given these declarations:
  12661. struct foo;
  12662. struct foo *fooptr;
  12663. but no definition for 'struct foo' itself, GDB will say:
  12664. (gdb) ptype foo
  12665. $1 = <incomplete type>
  12666. "Incomplete type" is C terminology for data types that are not
  12667. completely specified.
  12668. Othertimes, information about a variable's type is completely
  12669. absent from the debug information included in the program. This
  12670. most often happens when the program or library where the variable
  12671. is defined includes no debug information at all. GDB knows the
  12672. variable exists from inspecting the linker/loader symbol table
  12673. (e.g., the ELF dynamic symbol table), but such symbols do not
  12674. contain type information. Inspecting the type of a (global)
  12675. variable for which GDB has no type information shows:
  12676. (gdb) ptype var
  12677. type = <data variable, no debug info>
  12678. *Note no debug info variables: Variables, for how to print the
  12679. values of such variables.
  12680. 'info types [-q] [REGEXP]'
  12681. Print a brief description of all types whose names match the
  12682. regular expression REGEXP (or all types in your program, if you
  12683. supply no argument). Each complete typename is matched as though
  12684. it were a complete line; thus, 'i type value' gives information on
  12685. all types in your program whose names include the string 'value',
  12686. but 'i type ^value$' gives information only on types whose complete
  12687. name is 'value'.
  12688. In programs using different languages, GDB chooses the syntax to
  12689. print the type description according to the 'set language' value:
  12690. using 'set language auto' (see *note Set Language Automatically:
  12691. Automatically.) means to use the language of the type, other values
  12692. mean to use the manually specified language (see *note Set Language
  12693. Manually: Manually.).
  12694. This command differs from 'ptype' in two ways: first, like
  12695. 'whatis', it does not print a detailed description; second, it
  12696. lists all source files and line numbers where a type is defined.
  12697. The output from 'into types' is proceeded with a header line
  12698. describing what types are being listed. The optional flag '-q',
  12699. which stands for 'quiet', disables printing this header
  12700. information.
  12701. 'info type-printers'
  12702. Versions of GDB that ship with Python scripting enabled may have
  12703. "type printers" available. When using 'ptype' or 'whatis', these
  12704. printers are consulted when the name of a type is needed. *Note
  12705. Type Printing API::, for more information on writing type printers.
  12706. 'info type-printers' displays all the available type printers.
  12707. 'enable type-printer NAME...'
  12708. 'disable type-printer NAME...'
  12709. These commands can be used to enable or disable type printers.
  12710. 'info scope LOCATION'
  12711. List all the variables local to a particular scope. This command
  12712. accepts a LOCATION argument--a function name, a source line, or an
  12713. address preceded by a '*', and prints all the variables local to
  12714. the scope defined by that location. (*Note Specify Location::, for
  12715. details about supported forms of LOCATION.) For example:
  12716. (gdb) info scope command_line_handler
  12717. Scope for command_line_handler:
  12718. Symbol rl is an argument at stack/frame offset 8, length 4.
  12719. Symbol linebuffer is in static storage at address 0x150a18, length 4.
  12720. Symbol linelength is in static storage at address 0x150a1c, length 4.
  12721. Symbol p is a local variable in register $esi, length 4.
  12722. Symbol p1 is a local variable in register $ebx, length 4.
  12723. Symbol nline is a local variable in register $edx, length 4.
  12724. Symbol repeat is a local variable at frame offset -8, length 4.
  12725. This command is especially useful for determining what data to
  12726. collect during a "trace experiment", see *note collect: Tracepoint
  12727. Actions.
  12728. 'info source'
  12729. Show information about the current source file--that is, the source
  12730. file for the function containing the current point of execution:
  12731. * the name of the source file, and the directory containing it,
  12732. * the directory it was compiled in,
  12733. * its length, in lines,
  12734. * which programming language it is written in,
  12735. * if the debug information provides it, the program that
  12736. compiled the file (which may include, e.g., the compiler
  12737. version and command line arguments),
  12738. * whether the executable includes debugging information for that
  12739. file, and if so, what format the information is in (e.g.,
  12740. STABS, Dwarf 2, etc.), and
  12741. * whether the debugging information includes information about
  12742. preprocessor macros.
  12743. 'info sources'
  12744. Print the names of all source files in your program for which there
  12745. is debugging information, organized into two lists: files whose
  12746. symbols have already been read, and files whose symbols will be
  12747. read when needed.
  12748. 'info sources [-dirname | -basename] [--] [REGEXP]'
  12749. Like 'info sources', but only print the names of the files matching
  12750. the provided REGEXP. By default, the REGEXP is used to match
  12751. anywhere in the filename. If '-dirname', only files having a
  12752. dirname matching REGEXP are shown. If '-basename', only files
  12753. having a basename matching REGEXP are shown. The matching is
  12754. case-sensitive, except on operating systems that have
  12755. case-insensitive filesystem (e.g., MS-Windows).
  12756. 'info functions [-q] [-n]'
  12757. Print the names and data types of all defined functions. Similarly
  12758. to 'info types', this command groups its output by source files and
  12759. annotates each function definition with its source line number.
  12760. In programs using different languages, GDB chooses the syntax to
  12761. print the function name and type according to the 'set language'
  12762. value: using 'set language auto' (see *note Set Language
  12763. Automatically: Automatically.) means to use the language of the
  12764. function, other values mean to use the manually specified language
  12765. (see *note Set Language Manually: Manually.).
  12766. The '-n' flag excludes "non-debugging symbols" from the results. A
  12767. non-debugging symbol is a symbol that comes from the executable's
  12768. symbol table, not from the debug information (for example, DWARF)
  12769. associated with the executable.
  12770. The optional flag '-q', which stands for 'quiet', disables printing
  12771. header information and messages explaining why no functions have
  12772. been printed.
  12773. 'info functions [-q] [-n] [-t TYPE_REGEXP] [REGEXP]'
  12774. Like 'info functions', but only print the names and data types of
  12775. the functions selected with the provided regexp(s).
  12776. If REGEXP is provided, print only the functions whose names match
  12777. the regular expression REGEXP. Thus, 'info fun step' finds all
  12778. functions whose names include 'step'; 'info fun ^step' finds those
  12779. whose names start with 'step'. If a function name contains
  12780. characters that conflict with the regular expression language (e.g.
  12781. 'operator*()'), they may be quoted with a backslash.
  12782. If TYPE_REGEXP is provided, print only the functions whose types,
  12783. as printed by the 'whatis' command, match the regular expression
  12784. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  12785. enclosed in quote characters. If needed, use backslash to escape
  12786. the meaning of special characters or quotes. Thus, 'info fun -t
  12787. '^int ('' finds the functions that return an integer; 'info fun -t
  12788. '(.*int.*'' finds the functions that have an argument type
  12789. containing int; 'info fun -t '^int (' ^step' finds the functions
  12790. whose names start with 'step' and that return int.
  12791. If both REGEXP and TYPE_REGEXP are provided, a function is printed
  12792. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  12793. 'info variables [-q] [-n]'
  12794. Print the names and data types of all variables that are defined
  12795. outside of functions (i.e. excluding local variables). The printed
  12796. variables are grouped by source files and annotated with their
  12797. respective source line numbers.
  12798. In programs using different languages, GDB chooses the syntax to
  12799. print the variable name and type according to the 'set language'
  12800. value: using 'set language auto' (see *note Set Language
  12801. Automatically: Automatically.) means to use the language of the
  12802. variable, other values mean to use the manually specified language
  12803. (see *note Set Language Manually: Manually.).
  12804. The '-n' flag excludes non-debugging symbols from the results.
  12805. The optional flag '-q', which stands for 'quiet', disables printing
  12806. header information and messages explaining why no variables have
  12807. been printed.
  12808. 'info variables [-q] [-n] [-t TYPE_REGEXP] [REGEXP]'
  12809. Like 'info variables', but only print the variables selected with
  12810. the provided regexp(s).
  12811. If REGEXP is provided, print only the variables whose names match
  12812. the regular expression REGEXP.
  12813. If TYPE_REGEXP is provided, print only the variables whose types,
  12814. as printed by the 'whatis' command, match the regular expression
  12815. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  12816. enclosed in quote characters. If needed, use backslash to escape
  12817. the meaning of special characters or quotes.
  12818. If both REGEXP and TYPE_REGEXP are provided, an argument is printed
  12819. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  12820. 'info modules [-q] [REGEXP]'
  12821. List all Fortran modules in the program, or all modules matching
  12822. the optional regular expression REGEXP.
  12823. The optional flag '-q', which stands for 'quiet', disables printing
  12824. header information and messages explaining why no modules have been
  12825. printed.
  12826. 'info module functions [-q] [-m MODULE-REGEXP] [-t TYPE-REGEXP] [REGEXP]'
  12827. 'info module variables [-q] [-m MODULE-REGEXP] [-t TYPE-REGEXP] [REGEXP]'
  12828. List all functions or variables within all Fortran modules. The
  12829. set of functions or variables listed can be limited by providing
  12830. some or all of the optional regular expressions. If MODULE-REGEXP
  12831. is provided, then only Fortran modules matching MODULE-REGEXP will
  12832. be searched. Only functions or variables whose type matches the
  12833. optional regular expression TYPE-REGEXP will be listed. And only
  12834. functions or variables whose name matches the optional regular
  12835. expression REGEXP will be listed.
  12836. The optional flag '-q', which stands for 'quiet', disables printing
  12837. header information and messages explaining why no functions or
  12838. variables have been printed.
  12839. 'info classes'
  12840. 'info classes REGEXP'
  12841. Display all Objective-C classes in your program, or (with the
  12842. REGEXP argument) all those matching a particular regular
  12843. expression.
  12844. 'info selectors'
  12845. 'info selectors REGEXP'
  12846. Display all Objective-C selectors in your program, or (with the
  12847. REGEXP argument) all those matching a particular regular
  12848. expression.
  12849. 'set opaque-type-resolution on'
  12850. Tell GDB to resolve opaque types. An opaque type is a type
  12851. declared as a pointer to a 'struct', 'class', or 'union'--for
  12852. example, 'struct MyType *'--that is used in one source file
  12853. although the full declaration of 'struct MyType' is in another
  12854. source file. The default is on.
  12855. A change in the setting of this subcommand will not take effect
  12856. until the next time symbols for a file are loaded.
  12857. 'set opaque-type-resolution off'
  12858. Tell GDB not to resolve opaque types. In this case, the type is
  12859. printed as follows:
  12860. {<no data fields>}
  12861. 'show opaque-type-resolution'
  12862. Show whether opaque types are resolved or not.
  12863. 'set print symbol-loading'
  12864. 'set print symbol-loading full'
  12865. 'set print symbol-loading brief'
  12866. 'set print symbol-loading off'
  12867. The 'set print symbol-loading' command allows you to control the
  12868. printing of messages when GDB loads symbol information. By default
  12869. a message is printed for the executable and one for each shared
  12870. library, and normally this is what you want. However, when
  12871. debugging apps with large numbers of shared libraries these
  12872. messages can be annoying. When set to 'brief' a message is printed
  12873. for each executable, and when GDB loads a collection of shared
  12874. libraries at once it will only print one message regardless of the
  12875. number of shared libraries. When set to 'off' no messages are
  12876. printed.
  12877. 'show print symbol-loading'
  12878. Show whether messages will be printed when a GDB command entered
  12879. from the keyboard causes symbol information to be loaded.
  12880. 'maint print symbols [-pc ADDRESS] [FILENAME]'
  12881. 'maint print symbols [-objfile OBJFILE] [-source SOURCE] [--] [FILENAME]'
  12882. 'maint print psymbols [-objfile OBJFILE] [-pc ADDRESS] [--] [FILENAME]'
  12883. 'maint print psymbols [-objfile OBJFILE] [-source SOURCE] [--] [FILENAME]'
  12884. 'maint print msymbols [-objfile OBJFILE] [--] [FILENAME]'
  12885. Write a dump of debugging symbol data into the file FILENAME or the
  12886. terminal if FILENAME is unspecified. If '-objfile OBJFILE' is
  12887. specified, only dump symbols for that objfile. If '-pc ADDRESS' is
  12888. specified, only dump symbols for the file with code at that
  12889. address. Note that ADDRESS may be a symbol like 'main'. If
  12890. '-source SOURCE' is specified, only dump symbols for that source
  12891. file.
  12892. These commands are used to debug the GDB symbol-reading code.
  12893. These commands do not modify internal GDB state, therefore 'maint
  12894. print symbols' will only print symbols for already expanded symbol
  12895. tables. You can use the command 'info sources' to find out which
  12896. files these are. If you use 'maint print psymbols' instead, the
  12897. dump shows information about symbols that GDB only knows
  12898. partially--that is, symbols defined in files that GDB has skimmed,
  12899. but not yet read completely. Finally, 'maint print msymbols' just
  12900. dumps "minimal symbols", e.g., "ELF symbols".
  12901. *Note Commands to Specify Files: Files, for a discussion of how GDB
  12902. reads symbols (in the description of 'symbol-file').
  12903. 'maint info symtabs [ REGEXP ]'
  12904. 'maint info psymtabs [ REGEXP ]'
  12905. List the 'struct symtab' or 'struct partial_symtab' structures
  12906. whose names match REGEXP. If REGEXP is not given, list them all.
  12907. The output includes expressions which you can copy into a GDB
  12908. debugging this one to examine a particular structure in more
  12909. detail. For example:
  12910. (gdb) maint info psymtabs dwarf2read
  12911. { objfile /home/gnu/build/gdb/gdb
  12912. ((struct objfile *) 0x82e69d0)
  12913. { psymtab /home/gnu/src/gdb/dwarf2read.c
  12914. ((struct partial_symtab *) 0x8474b10)
  12915. readin no
  12916. fullname (null)
  12917. text addresses 0x814d3c8 -- 0x8158074
  12918. globals (* (struct partial_symbol **) 0x8507a08 @ 9)
  12919. statics (* (struct partial_symbol **) 0x40e95b78 @ 2882)
  12920. dependencies (none)
  12921. }
  12922. }
  12923. (gdb) maint info symtabs
  12924. (gdb)
  12925. We see that there is one partial symbol table whose filename
  12926. contains the string 'dwarf2read', belonging to the 'gdb'
  12927. executable; and we see that GDB has not read in any symtabs yet at
  12928. all. If we set a breakpoint on a function, that will cause GDB to
  12929. read the symtab for the compilation unit containing that function:
  12930. (gdb) break dwarf2_psymtab_to_symtab
  12931. Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c,
  12932. line 1574.
  12933. (gdb) maint info symtabs
  12934. { objfile /home/gnu/build/gdb/gdb
  12935. ((struct objfile *) 0x82e69d0)
  12936. { symtab /home/gnu/src/gdb/dwarf2read.c
  12937. ((struct symtab *) 0x86c1f38)
  12938. dirname (null)
  12939. fullname (null)
  12940. blockvector ((struct blockvector *) 0x86c1bd0) (primary)
  12941. linetable ((struct linetable *) 0x8370fa0)
  12942. debugformat DWARF 2
  12943. }
  12944. }
  12945. (gdb)
  12946. 'maint info line-table [ REGEXP ]'
  12947. List the 'struct linetable' from all 'struct symtab' instances
  12948. whose name matches REGEXP. If REGEXP is not given, list the
  12949. 'struct linetable' from all 'struct symtab'.
  12950. 'maint set symbol-cache-size SIZE'
  12951. Set the size of the symbol cache to SIZE. The default size is
  12952. intended to be good enough for debugging most applications. This
  12953. option exists to allow for experimenting with different sizes.
  12954. 'maint show symbol-cache-size'
  12955. Show the size of the symbol cache.
  12956. 'maint print symbol-cache'
  12957. Print the contents of the symbol cache. This is useful when
  12958. debugging symbol cache issues.
  12959. 'maint print symbol-cache-statistics'
  12960. Print symbol cache usage statistics. This helps determine how well
  12961. the cache is being utilized.
  12962. 'maint flush-symbol-cache'
  12963. Flush the contents of the symbol cache, all entries are removed.
  12964. This command is useful when debugging the symbol cache. It is also
  12965. useful when collecting performance data.
  12966. 
  12967. File: gdb.info, Node: Altering, Next: GDB Files, Prev: Symbols, Up: Top
  12968. 17 Altering Execution
  12969. *********************
  12970. Once you think you have found an error in your program, you might want
  12971. to find out for certain whether correcting the apparent error would lead
  12972. to correct results in the rest of the run. You can find the answer by
  12973. experiment, using the GDB features for altering execution of the
  12974. program.
  12975. For example, you can store new values into variables or memory
  12976. locations, give your program a signal, restart it at a different
  12977. address, or even return prematurely from a function.
  12978. * Menu:
  12979. * Assignment:: Assignment to variables
  12980. * Jumping:: Continuing at a different address
  12981. * Signaling:: Giving your program a signal
  12982. * Returning:: Returning from a function
  12983. * Calling:: Calling your program's functions
  12984. * Patching:: Patching your program
  12985. * Compiling and Injecting Code:: Compiling and injecting code in GDB
  12986. 
  12987. File: gdb.info, Node: Assignment, Next: Jumping, Up: Altering
  12988. 17.1 Assignment to Variables
  12989. ============================
  12990. To alter the value of a variable, evaluate an assignment expression.
  12991. *Note Expressions: Expressions. For example,
  12992. print x=4
  12993. stores the value 4 into the variable 'x', and then prints the value of
  12994. the assignment expression (which is 4). *Note Using GDB with Different
  12995. Languages: Languages, for more information on operators in supported
  12996. languages.
  12997. If you are not interested in seeing the value of the assignment, use
  12998. the 'set' command instead of the 'print' command. 'set' is really the
  12999. same as 'print' except that the expression's value is not printed and is
  13000. not put in the value history (*note Value History: Value History.). The
  13001. expression is evaluated only for its effects.
  13002. If the beginning of the argument string of the 'set' command appears
  13003. identical to a 'set' subcommand, use the 'set variable' command instead
  13004. of just 'set'. This command is identical to 'set' except for its lack
  13005. of subcommands. For example, if your program has a variable 'width',
  13006. you get an error if you try to set a new value with just 'set width=13',
  13007. because GDB has the command 'set width':
  13008. (gdb) whatis width
  13009. type = double
  13010. (gdb) p width
  13011. $4 = 13
  13012. (gdb) set width=47
  13013. Invalid syntax in expression.
  13014. The invalid expression, of course, is '=47'. In order to actually set
  13015. the program's variable 'width', use
  13016. (gdb) set var width=47
  13017. Because the 'set' command has many subcommands that can conflict with
  13018. the names of program variables, it is a good idea to use the 'set
  13019. variable' command instead of just 'set'. For example, if your program
  13020. has a variable 'g', you run into problems if you try to set a new value
  13021. with just 'set g=4', because GDB has the command 'set gnutarget',
  13022. abbreviated 'set g':
  13023. (gdb) whatis g
  13024. type = double
  13025. (gdb) p g
  13026. $1 = 1
  13027. (gdb) set g=4
  13028. (gdb) p g
  13029. $2 = 1
  13030. (gdb) r
  13031. The program being debugged has been started already.
  13032. Start it from the beginning? (y or n) y
  13033. Starting program: /home/smith/cc_progs/a.out
  13034. "/home/smith/cc_progs/a.out": can't open to read symbols:
  13035. Invalid bfd target.
  13036. (gdb) show g
  13037. The current BFD target is "=4".
  13038. The program variable 'g' did not change, and you silently set the
  13039. 'gnutarget' to an invalid value. In order to set the variable 'g', use
  13040. (gdb) set var g=4
  13041. GDB allows more implicit conversions in assignments than C; you can
  13042. freely store an integer value into a pointer variable or vice versa, and
  13043. you can convert any structure to any other structure that is the same
  13044. length or shorter.
  13045. To store values into arbitrary places in memory, use the '{...}'
  13046. construct to generate a value of specified type at a specified address
  13047. (*note Expressions: Expressions.). For example, '{int}0x83040' refers
  13048. to memory location '0x83040' as an integer (which implies a certain size
  13049. and representation in memory), and
  13050. set {int}0x83040 = 4
  13051. stores the value 4 into that memory location.
  13052. 
  13053. File: gdb.info, Node: Jumping, Next: Signaling, Prev: Assignment, Up: Altering
  13054. 17.2 Continuing at a Different Address
  13055. ======================================
  13056. Ordinarily, when you continue your program, you do so at the place where
  13057. it stopped, with the 'continue' command. You can instead continue at an
  13058. address of your own choosing, with the following commands:
  13059. 'jump LOCATION'
  13060. 'j LOCATION'
  13061. Resume execution at LOCATION. Execution stops again immediately if
  13062. there is a breakpoint there. *Note Specify Location::, for a
  13063. description of the different forms of LOCATION. It is common
  13064. practice to use the 'tbreak' command in conjunction with 'jump'.
  13065. *Note Setting Breakpoints: Set Breaks.
  13066. The 'jump' command does not change the current stack frame, or the
  13067. stack pointer, or the contents of any memory location or any
  13068. register other than the program counter. If LOCATION is in a
  13069. different function from the one currently executing, the results
  13070. may be bizarre if the two functions expect different patterns of
  13071. arguments or of local variables. For this reason, the 'jump'
  13072. command requests confirmation if the specified line is not in the
  13073. function currently executing. However, even bizarre results are
  13074. predictable if you are well acquainted with the machine-language
  13075. code of your program.
  13076. On many systems, you can get much the same effect as the 'jump'
  13077. command by storing a new value into the register '$pc'. The difference
  13078. is that this does not start your program running; it only changes the
  13079. address of where it _will_ run when you continue. For example,
  13080. set $pc = 0x485
  13081. makes the next 'continue' command or stepping command execute at address
  13082. '0x485', rather than at the address where your program stopped. *Note
  13083. Continuing and Stepping: Continuing and Stepping.
  13084. The most common occasion to use the 'jump' command is to back
  13085. up--perhaps with more breakpoints set--over a portion of a program that
  13086. has already executed, in order to examine its execution in more detail.
  13087. 
  13088. File: gdb.info, Node: Signaling, Next: Returning, Prev: Jumping, Up: Altering
  13089. 17.3 Giving your Program a Signal
  13090. =================================
  13091. 'signal SIGNAL'
  13092. Resume execution where your program is stopped, but immediately
  13093. give it the signal SIGNAL. The SIGNAL can be the name or the
  13094. number of a signal. For example, on many systems 'signal 2' and
  13095. 'signal SIGINT' are both ways of sending an interrupt signal.
  13096. Alternatively, if SIGNAL is zero, continue execution without giving
  13097. a signal. This is useful when your program stopped on account of a
  13098. signal and would ordinarily see the signal when resumed with the
  13099. 'continue' command; 'signal 0' causes it to resume without a
  13100. signal.
  13101. _Note:_ When resuming a multi-threaded program, SIGNAL is delivered
  13102. to the currently selected thread, not the thread that last reported
  13103. a stop. This includes the situation where a thread was stopped due
  13104. to a signal. So if you want to continue execution suppressing the
  13105. signal that stopped a thread, you should select that same thread
  13106. before issuing the 'signal 0' command. If you issue the 'signal 0'
  13107. command with another thread as the selected one, GDB detects that
  13108. and asks for confirmation.
  13109. Invoking the 'signal' command is not the same as invoking the
  13110. 'kill' utility from the shell. Sending a signal with 'kill' causes
  13111. GDB to decide what to do with the signal depending on the signal
  13112. handling tables (*note Signals::). The 'signal' command passes the
  13113. signal directly to your program.
  13114. 'signal' does not repeat when you press <RET> a second time after
  13115. executing the command.
  13116. 'queue-signal SIGNAL'
  13117. Queue SIGNAL to be delivered immediately to the current thread when
  13118. execution of the thread resumes. The SIGNAL can be the name or the
  13119. number of a signal. For example, on many systems 'signal 2' and
  13120. 'signal SIGINT' are both ways of sending an interrupt signal. The
  13121. handling of the signal must be set to pass the signal to the
  13122. program, otherwise GDB will report an error. You can control the
  13123. handling of signals from GDB with the 'handle' command (*note
  13124. Signals::).
  13125. Alternatively, if SIGNAL is zero, any currently queued signal for
  13126. the current thread is discarded and when execution resumes no
  13127. signal will be delivered. This is useful when your program stopped
  13128. on account of a signal and would ordinarily see the signal when
  13129. resumed with the 'continue' command.
  13130. This command differs from the 'signal' command in that the signal
  13131. is just queued, execution is not resumed. And 'queue-signal'
  13132. cannot be used to pass a signal whose handling state has been set
  13133. to 'nopass' (*note Signals::).
  13134. *Note stepping into signal handlers::, for information on how
  13135. stepping commands behave when the thread has a signal queued.
  13136. 
  13137. File: gdb.info, Node: Returning, Next: Calling, Prev: Signaling, Up: Altering
  13138. 17.4 Returning from a Function
  13139. ==============================
  13140. 'return'
  13141. 'return EXPRESSION'
  13142. You can cancel execution of a function call with the 'return'
  13143. command. If you give an EXPRESSION argument, its value is used as
  13144. the function's return value.
  13145. When you use 'return', GDB discards the selected stack frame (and all
  13146. frames within it). You can think of this as making the discarded frame
  13147. return prematurely. If you wish to specify a value to be returned, give
  13148. that value as the argument to 'return'.
  13149. This pops the selected stack frame (*note Selecting a Frame:
  13150. Selection.), and any other frames inside of it, leaving its caller as
  13151. the innermost remaining frame. That frame becomes selected. The
  13152. specified value is stored in the registers used for returning values of
  13153. functions.
  13154. The 'return' command does not resume execution; it leaves the program
  13155. stopped in the state that would exist if the function had just returned.
  13156. In contrast, the 'finish' command (*note Continuing and Stepping:
  13157. Continuing and Stepping.) resumes execution until the selected stack
  13158. frame returns naturally.
  13159. GDB needs to know how the EXPRESSION argument should be set for the
  13160. inferior. The concrete registers assignment depends on the OS ABI and
  13161. the type being returned by the selected stack frame. For example it is
  13162. common for OS ABI to return floating point values in FPU registers while
  13163. integer values in CPU registers. Still some ABIs return even floating
  13164. point values in CPU registers. Larger integer widths (such as 'long
  13165. long int') also have specific placement rules. GDB already knows the OS
  13166. ABI from its current target so it needs to find out also the type being
  13167. returned to make the assignment into the right register(s).
  13168. Normally, the selected stack frame has debug info. GDB will always
  13169. use the debug info instead of the implicit type of EXPRESSION when the
  13170. debug info is available. For example, if you type 'return -1', and the
  13171. function in the current stack frame is declared to return a 'long long
  13172. int', GDB transparently converts the implicit 'int' value of -1 into a
  13173. 'long long int':
  13174. Breakpoint 1, func () at gdb.base/return-nodebug.c:29
  13175. 29 return 31;
  13176. (gdb) return -1
  13177. Make func return now? (y or n) y
  13178. #0 0x004004f6 in main () at gdb.base/return-nodebug.c:43
  13179. 43 printf ("result=%lld\n", func ());
  13180. (gdb)
  13181. However, if the selected stack frame does not have a debug info,
  13182. e.g., if the function was compiled without debug info, GDB has to find
  13183. out the type to return from user. Specifying a different type by
  13184. mistake may set the value in different inferior registers than the
  13185. caller code expects. For example, typing 'return -1' with its implicit
  13186. type 'int' would set only a part of a 'long long int' result for a debug
  13187. info less function (on 32-bit architectures). Therefore the user is
  13188. required to specify the return type by an appropriate cast explicitly:
  13189. Breakpoint 2, 0x0040050b in func ()
  13190. (gdb) return -1
  13191. Return value type not available for selected stack frame.
  13192. Please use an explicit cast of the value to return.
  13193. (gdb) return (long long int) -1
  13194. Make selected stack frame return now? (y or n) y
  13195. #0 0x00400526 in main ()
  13196. (gdb)
  13197. 
  13198. File: gdb.info, Node: Calling, Next: Patching, Prev: Returning, Up: Altering
  13199. 17.5 Calling Program Functions
  13200. ==============================
  13201. 'print EXPR'
  13202. Evaluate the expression EXPR and display the resulting value. The
  13203. expression may include calls to functions in the program being
  13204. debugged.
  13205. 'call EXPR'
  13206. Evaluate the expression EXPR without displaying 'void' returned
  13207. values.
  13208. You can use this variant of the 'print' command if you want to
  13209. execute a function from your program that does not return anything
  13210. (a.k.a. "a void function"), but without cluttering the output with
  13211. 'void' returned values that GDB will otherwise print. If the
  13212. result is not void, it is printed and saved in the value history.
  13213. It is possible for the function you call via the 'print' or 'call'
  13214. command to generate a signal (e.g., if there's a bug in the function, or
  13215. if you passed it incorrect arguments). What happens in that case is
  13216. controlled by the 'set unwindonsignal' command.
  13217. Similarly, with a C++ program it is possible for the function you
  13218. call via the 'print' or 'call' command to generate an exception that is
  13219. not handled due to the constraints of the dummy frame. In this case,
  13220. any exception that is raised in the frame, but has an out-of-frame
  13221. exception handler will not be found. GDB builds a dummy-frame for the
  13222. inferior function call, and the unwinder cannot seek for exception
  13223. handlers outside of this dummy-frame. What happens in that case is
  13224. controlled by the 'set unwind-on-terminating-exception' command.
  13225. 'set unwindonsignal'
  13226. Set unwinding of the stack if a signal is received while in a
  13227. function that GDB called in the program being debugged. If set to
  13228. on, GDB unwinds the stack it created for the call and restores the
  13229. context to what it was before the call. If set to off (the
  13230. default), GDB stops in the frame where the signal was received.
  13231. 'show unwindonsignal'
  13232. Show the current setting of stack unwinding in the functions called
  13233. by GDB.
  13234. 'set unwind-on-terminating-exception'
  13235. Set unwinding of the stack if a C++ exception is raised, but left
  13236. unhandled while in a function that GDB called in the program being
  13237. debugged. If set to on (the default), GDB unwinds the stack it
  13238. created for the call and restores the context to what it was before
  13239. the call. If set to off, GDB the exception is delivered to the
  13240. default C++ exception handler and the inferior terminated.
  13241. 'show unwind-on-terminating-exception'
  13242. Show the current setting of stack unwinding in the functions called
  13243. by GDB.
  13244. 'set may-call-functions'
  13245. Set permission to call functions in the program. This controls
  13246. whether GDB will attempt to call functions in the program, such as
  13247. with expressions in the 'print' command. It defaults to 'on'.
  13248. To call a function in the program, GDB has to temporarily modify
  13249. the state of the inferior. This has potentially undesired side
  13250. effects. Also, having GDB call nested functions is likely to be
  13251. erroneous and may even crash the program being debugged. You can
  13252. avoid such hazards by forbidding GDB from calling functions in the
  13253. program being debugged. If calling functions in the program is
  13254. forbidden, GDB will throw an error when a command (such as printing
  13255. an expression) starts a function call in the program.
  13256. 'show may-call-functions'
  13257. Show permission to call functions in the program.
  13258. 17.5.1 Calling functions with no debug info
  13259. -------------------------------------------
  13260. Sometimes, a function you wish to call is missing debug information. In
  13261. such case, GDB does not know the type of the function, including the
  13262. types of the function's parameters. To avoid calling the inferior
  13263. function incorrectly, which could result in the called function
  13264. functioning erroneously and even crash, GDB refuses to call the function
  13265. unless you tell it the type of the function.
  13266. For prototyped (i.e. ANSI/ISO style) functions, there are two ways to
  13267. do that. The simplest is to cast the call to the function's declared
  13268. return type. For example:
  13269. (gdb) p getenv ("PATH")
  13270. 'getenv' has unknown return type; cast the call to its declared return type
  13271. (gdb) p (char *) getenv ("PATH")
  13272. $1 = 0x7fffffffe7ba "/usr/local/bin:/"...
  13273. Casting the return type of a no-debug function is equivalent to
  13274. casting the function to a pointer to a prototyped function that has a
  13275. prototype that matches the types of the passed-in arguments, and calling
  13276. that. I.e., the call above is equivalent to:
  13277. (gdb) p ((char * (*) (const char *)) getenv) ("PATH")
  13278. and given this prototyped C or C++ function with float parameters:
  13279. float multiply (float v1, float v2) { return v1 * v2; }
  13280. these calls are equivalent:
  13281. (gdb) p (float) multiply (2.0f, 3.0f)
  13282. (gdb) p ((float (*) (float, float)) multiply) (2.0f, 3.0f)
  13283. If the function you wish to call is declared as unprototyped (i.e.
  13284. old K&R style), you must use the cast-to-function-pointer syntax, so
  13285. that GDB knows that it needs to apply default argument promotions
  13286. (promote float arguments to double). *Note float promotion: ABI. For
  13287. example, given this unprototyped C function with float parameters, and
  13288. no debug info:
  13289. float
  13290. multiply_noproto (v1, v2)
  13291. float v1, v2;
  13292. {
  13293. return v1 * v2;
  13294. }
  13295. you call it like this:
  13296. (gdb) p ((float (*) ()) multiply_noproto) (2.0f, 3.0f)
  13297. 
  13298. File: gdb.info, Node: Patching, Next: Compiling and Injecting Code, Prev: Calling, Up: Altering
  13299. 17.6 Patching Programs
  13300. ======================
  13301. By default, GDB opens the file containing your program's executable code
  13302. (or the corefile) read-only. This prevents accidental alterations to
  13303. machine code; but it also prevents you from intentionally patching your
  13304. program's binary.
  13305. If you'd like to be able to patch the binary, you can specify that
  13306. explicitly with the 'set write' command. For example, you might want to
  13307. turn on internal debugging flags, or even to make emergency repairs.
  13308. 'set write on'
  13309. 'set write off'
  13310. If you specify 'set write on', GDB opens executable and core files
  13311. for both reading and writing; if you specify 'set write off' (the
  13312. default), GDB opens them read-only.
  13313. If you have already loaded a file, you must load it again (using
  13314. the 'exec-file' or 'core-file' command) after changing 'set write',
  13315. for your new setting to take effect.
  13316. 'show write'
  13317. Display whether executable files and core files are opened for
  13318. writing as well as reading.
  13319. 
  13320. File: gdb.info, Node: Compiling and Injecting Code, Prev: Patching, Up: Altering
  13321. 17.7 Compiling and injecting code in GDB
  13322. ========================================
  13323. GDB supports on-demand compilation and code injection into programs
  13324. running under GDB. GCC 5.0 or higher built with 'libcc1.so' must be
  13325. installed for this functionality to be enabled. This functionality is
  13326. implemented with the following commands.
  13327. 'compile code SOURCE-CODE'
  13328. 'compile code -raw -- SOURCE-CODE'
  13329. Compile SOURCE-CODE with the compiler language found as the current
  13330. language in GDB (*note Languages::). If compilation and injection
  13331. is not supported with the current language specified in GDB, or the
  13332. compiler does not support this feature, an error message will be
  13333. printed. If SOURCE-CODE compiles and links successfully, GDB will
  13334. load the object-code emitted, and execute it within the context of
  13335. the currently selected inferior. It is important to note that the
  13336. compiled code is executed immediately. After execution, the
  13337. compiled code is removed from GDB and any new types or variables
  13338. you have defined will be deleted.
  13339. The command allows you to specify SOURCE-CODE in two ways. The
  13340. simplest method is to provide a single line of code to the command.
  13341. E.g.:
  13342. compile code printf ("hello world\n");
  13343. If you specify options on the command line as well as source code,
  13344. they may conflict. The '--' delimiter can be used to separate
  13345. options from actual source code. E.g.:
  13346. compile code -r -- printf ("hello world\n");
  13347. Alternatively you can enter source code as multiple lines of text.
  13348. To enter this mode, invoke the 'compile code' command without any
  13349. text following the command. This will start the multiple-line
  13350. editor and allow you to type as many lines of source code as
  13351. required. When you have completed typing, enter 'end' on its own
  13352. line to exit the editor.
  13353. compile code
  13354. >printf ("hello\n");
  13355. >printf ("world\n");
  13356. >end
  13357. Specifying '-raw', prohibits GDB from wrapping the provided
  13358. SOURCE-CODE in a callable scope. In this case, you must specify
  13359. the entry point of the code by defining a function named
  13360. '_gdb_expr_'. The '-raw' code cannot access variables of the
  13361. inferior. Using '-raw' option may be needed for example when
  13362. SOURCE-CODE requires '#include' lines which may conflict with
  13363. inferior symbols otherwise.
  13364. 'compile file FILENAME'
  13365. 'compile file -raw FILENAME'
  13366. Like 'compile code', but take the source code from FILENAME.
  13367. compile file /home/user/example.c
  13368. 'compile print [[OPTIONS] --] EXPR'
  13369. 'compile print [[OPTIONS] --] /F EXPR'
  13370. Compile and execute EXPR with the compiler language found as the
  13371. current language in GDB (*note Languages::). By default the value
  13372. of EXPR is printed in a format appropriate to its data type; you
  13373. can choose a different format by specifying '/F', where F is a
  13374. letter specifying the format; see *note Output Formats: Output
  13375. Formats. The 'compile print' command accepts the same options as
  13376. the 'print' command; see *note print options::.
  13377. 'compile print [[OPTIONS] --]'
  13378. 'compile print [[OPTIONS] --] /F'
  13379. Alternatively you can enter the expression (source code producing
  13380. it) as multiple lines of text. To enter this mode, invoke the
  13381. 'compile print' command without any text following the command.
  13382. This will start the multiple-line editor.
  13383. The process of compiling and injecting the code can be inspected using:
  13384. 'set debug compile'
  13385. Turns on or off display of GDB process of compiling and injecting
  13386. the code. The default is off.
  13387. 'show debug compile'
  13388. Displays the current state of displaying GDB process of compiling
  13389. and injecting the code.
  13390. 'set debug compile-cplus-types'
  13391. Turns on or off the display of C++ type conversion debugging
  13392. information. The default is off.
  13393. 'show debug compile-cplus-types'
  13394. Displays the current state of displaying debugging information for
  13395. C++ type conversion.
  13396. 17.7.1 Compilation options for the 'compile' command
  13397. ----------------------------------------------------
  13398. GDB needs to specify the right compilation options for the code to be
  13399. injected, in part to make its ABI compatible with the inferior and in
  13400. part to make the injected code compatible with GDB's injecting process.
  13401. The options used, in increasing precedence:
  13402. target architecture and OS options ('gdbarch')
  13403. These options depend on target processor type and target operating
  13404. system, usually they specify at least 32-bit ('-m32') or 64-bit
  13405. ('-m64') compilation option.
  13406. compilation options recorded in the target
  13407. GCC (since version 4.7) stores the options used for compilation
  13408. into 'DW_AT_producer' part of DWARF debugging information according
  13409. to the GCC option '-grecord-gcc-switches'. One has to explicitly
  13410. specify '-g' during inferior compilation otherwise GCC produces no
  13411. DWARF. This feature is only relevant for platforms where '-g'
  13412. produces DWARF by default, otherwise one may try to enforce DWARF
  13413. by using '-gdwarf-4'.
  13414. compilation options set by 'set compile-args'
  13415. You can override compilation options using the following command:
  13416. 'set compile-args'
  13417. Set compilation options used for compiling and injecting code with
  13418. the 'compile' commands. These options override any conflicting
  13419. ones from the target architecture and/or options stored during
  13420. inferior compilation.
  13421. 'show compile-args'
  13422. Displays the current state of compilation options override. This
  13423. does not show all the options actually used during compilation, use
  13424. *note set debug compile:: for that.
  13425. 17.7.2 Caveats when using the 'compile' command
  13426. -----------------------------------------------
  13427. There are a few caveats to keep in mind when using the 'compile'
  13428. command. As the caveats are different per language, the table below
  13429. highlights specific issues on a per language basis.
  13430. C code examples and caveats
  13431. When the language in GDB is set to 'C', the compiler will attempt
  13432. to compile the source code with a 'C' compiler. The source code
  13433. provided to the 'compile' command will have much the same access to
  13434. variables and types as it normally would if it were part of the
  13435. program currently being debugged in GDB.
  13436. Below is a sample program that forms the basis of the examples that
  13437. follow. This program has been compiled and loaded into GDB, much
  13438. like any other normal debugging session.
  13439. void function1 (void)
  13440. {
  13441. int i = 42;
  13442. printf ("function 1\n");
  13443. }
  13444. void function2 (void)
  13445. {
  13446. int j = 12;
  13447. function1 ();
  13448. }
  13449. int main(void)
  13450. {
  13451. int k = 6;
  13452. int *p;
  13453. function2 ();
  13454. return 0;
  13455. }
  13456. For the purposes of the examples in this section, the program above
  13457. has been compiled, loaded into GDB, stopped at the function 'main',
  13458. and GDB is awaiting input from the user.
  13459. To access variables and types for any program in GDB, the program
  13460. must be compiled and packaged with debug information. The
  13461. 'compile' command is not an exception to this rule. Without debug
  13462. information, you can still use the 'compile' command, but you will
  13463. be very limited in what variables and types you can access.
  13464. So with that in mind, the example above has been compiled with
  13465. debug information enabled. The 'compile' command will have access
  13466. to all variables and types (except those that may have been
  13467. optimized out). Currently, as GDB has stopped the program in the
  13468. 'main' function, the 'compile' command would have access to the
  13469. variable 'k'. You could invoke the 'compile' command and type some
  13470. source code to set the value of 'k'. You can also read it, or do
  13471. anything with that variable you would normally do in 'C'. Be aware
  13472. that changes to inferior variables in the 'compile' command are
  13473. persistent. In the following example:
  13474. compile code k = 3;
  13475. the variable 'k' is now 3. It will retain that value until
  13476. something else in the example program changes it, or another
  13477. 'compile' command changes it.
  13478. Normal scope and access rules apply to source code compiled and
  13479. injected by the 'compile' command. In the example, the variables
  13480. 'j' and 'k' are not accessible yet, because the program is
  13481. currently stopped in the 'main' function, where these variables are
  13482. not in scope. Therefore, the following command
  13483. compile code j = 3;
  13484. will result in a compilation error message.
  13485. Once the program is continued, execution will bring these variables
  13486. in scope, and they will become accessible; then the code you
  13487. specify via the 'compile' command will be able to access them.
  13488. You can create variables and types with the 'compile' command as
  13489. part of your source code. Variables and types that are created as
  13490. part of the 'compile' command are not visible to the rest of the
  13491. program for the duration of its run. This example is valid:
  13492. compile code int ff = 5; printf ("ff is %d\n", ff);
  13493. However, if you were to type the following into GDB after that
  13494. command has completed:
  13495. compile code printf ("ff is %d\n'', ff);
  13496. a compiler error would be raised as the variable 'ff' no longer
  13497. exists. Object code generated and injected by the 'compile'
  13498. command is removed when its execution ends. Caution is advised
  13499. when assigning to program variables values of variables created by
  13500. the code submitted to the 'compile' command. This example is
  13501. valid:
  13502. compile code int ff = 5; k = ff;
  13503. The value of the variable 'ff' is assigned to 'k'. The variable
  13504. 'k' does not require the existence of 'ff' to maintain the value it
  13505. has been assigned. However, pointers require particular care in
  13506. assignment. If the source code compiled with the 'compile' command
  13507. changed the address of a pointer in the example program, perhaps to
  13508. a variable created in the 'compile' command, that pointer would
  13509. point to an invalid location when the command exits. The following
  13510. example would likely cause issues with your debugged program:
  13511. compile code int ff = 5; p = &ff;
  13512. In this example, 'p' would point to 'ff' when the 'compile' command
  13513. is executing the source code provided to it. However, as variables
  13514. in the (example) program persist with their assigned values, the
  13515. variable 'p' would point to an invalid location when the command
  13516. exists. A general rule should be followed in that you should
  13517. either assign 'NULL' to any assigned pointers, or restore a valid
  13518. location to the pointer before the command exits.
  13519. Similar caution must be exercised with any structs, unions, and
  13520. typedefs defined in 'compile' command. Types defined in the
  13521. 'compile' command will no longer be available in the next 'compile'
  13522. command. Therefore, if you cast a variable to a type defined in
  13523. the 'compile' command, care must be taken to ensure that any future
  13524. need to resolve the type can be achieved.
  13525. (gdb) compile code static struct a { int a; } v = { 42 }; argv = &v;
  13526. (gdb) compile code printf ("%d\n", ((struct a *) argv)->a);
  13527. gdb command line:1:36: error: dereferencing pointer to incomplete type ‘struct a’
  13528. Compilation failed.
  13529. (gdb) compile code struct a { int a; }; printf ("%d\n", ((struct a *) argv)->a);
  13530. 42
  13531. Variables that have been optimized away by the compiler are not
  13532. accessible to the code submitted to the 'compile' command. Access
  13533. to those variables will generate a compiler error which GDB will
  13534. print to the console.
  13535. 17.7.3 Compiler search for the 'compile' command
  13536. ------------------------------------------------
  13537. GDB needs to find GCC for the inferior being debugged which may not be
  13538. obvious for remote targets of different architecture than where GDB is
  13539. running. Environment variable 'PATH' on GDB host is searched for GCC
  13540. binary matching the target architecture and operating system. This
  13541. search can be overriden by 'set compile-gcc' GDB command below. 'PATH'
  13542. is taken from shell that executed GDB, it is not the value set by GDB
  13543. command 'set environment'). *Note Environment::.
  13544. Specifically 'PATH' is searched for binaries matching regular
  13545. expression 'ARCH(-[^-]*)?-OS-gcc' according to the inferior target being
  13546. debugged. ARCH is processor name -- multiarch is supported, so for
  13547. example both 'i386' and 'x86_64' targets look for pattern
  13548. '(x86_64|i.86)' and both 's390' and 's390x' targets look for pattern
  13549. 's390x?'. OS is currently supported only for pattern 'linux(-gnu)?'.
  13550. On Posix hosts the compiler driver GDB needs to find also shared
  13551. library 'libcc1.so' from the compiler. It is searched in default shared
  13552. library search path (overridable with usual environment variable
  13553. 'LD_LIBRARY_PATH'), unrelated to 'PATH' or 'set compile-gcc' settings.
  13554. Contrary to it 'libcc1plugin.so' is found according to the installation
  13555. of the found compiler -- as possibly specified by the 'set compile-gcc'
  13556. command.
  13557. 'set compile-gcc'
  13558. Set compilation command used for compiling and injecting code with
  13559. the 'compile' commands. If this option is not set (it is set to an
  13560. empty string), the search described above will occur -- that is the
  13561. default.
  13562. 'show compile-gcc'
  13563. Displays the current compile command GCC driver filename. If set,
  13564. it is the main command 'gcc', found usually for example under name
  13565. 'x86_64-linux-gnu-gcc'.
  13566. 
  13567. File: gdb.info, Node: GDB Files, Next: Targets, Prev: Altering, Up: Top
  13568. 18 GDB Files
  13569. ************
  13570. GDB needs to know the file name of the program to be debugged, both in
  13571. order to read its symbol table and in order to start your program. To
  13572. debug a core dump of a previous run, you must also tell GDB the name of
  13573. the core dump file.
  13574. * Menu:
  13575. * Files:: Commands to specify files
  13576. * File Caching:: Information about GDB's file caching
  13577. * Separate Debug Files:: Debugging information in separate files
  13578. * MiniDebugInfo:: Debugging information in a special section
  13579. * Index Files:: Index files speed up GDB
  13580. * Symbol Errors:: Errors reading symbol files
  13581. * Data Files:: GDB data files
  13582. 
  13583. File: gdb.info, Node: Files, Next: File Caching, Up: GDB Files
  13584. 18.1 Commands to Specify Files
  13585. ==============================
  13586. You may want to specify executable and core dump file names. The usual
  13587. way to do this is at start-up time, using the arguments to GDB's
  13588. start-up commands (*note Getting In and Out of GDB: Invocation.).
  13589. Occasionally it is necessary to change to a different file during a
  13590. GDB session. Or you may run GDB and forget to specify a file you want
  13591. to use. Or you are debugging a remote target via 'gdbserver' (*note
  13592. file: Server.). In these situations the GDB commands to specify new
  13593. files are useful.
  13594. 'file FILENAME'
  13595. Use FILENAME as the program to be debugged. It is read for its
  13596. symbols and for the contents of pure memory. It is also the
  13597. program executed when you use the 'run' command. If you do not
  13598. specify a directory and the file is not found in the GDB working
  13599. directory, GDB uses the environment variable 'PATH' as a list of
  13600. directories to search, just as the shell does when looking for a
  13601. program to run. You can change the value of this variable, for
  13602. both GDB and your program, using the 'path' command.
  13603. You can load unlinked object '.o' files into GDB using the 'file'
  13604. command. You will not be able to "run" an object file, but you can
  13605. disassemble functions and inspect variables. Also, if the
  13606. underlying BFD functionality supports it, you could use 'gdb
  13607. -write' to patch object files using this technique. Note that GDB
  13608. can neither interpret nor modify relocations in this case, so
  13609. branches and some initialized variables will appear to go to the
  13610. wrong place. But this feature is still handy from time to time.
  13611. 'file'
  13612. 'file' with no argument makes GDB discard any information it has on
  13613. both executable file and the symbol table.
  13614. 'exec-file [ FILENAME ]'
  13615. Specify that the program to be run (but not the symbol table) is
  13616. found in FILENAME. GDB searches the environment variable 'PATH' if
  13617. necessary to locate your program. Omitting FILENAME means to
  13618. discard information on the executable file.
  13619. 'symbol-file [ FILENAME [ -o OFFSET ]]'
  13620. Read symbol table information from file FILENAME. 'PATH' is
  13621. searched when necessary. Use the 'file' command to get both symbol
  13622. table and program to run from the same file.
  13623. If an optional OFFSET is specified, it is added to the start
  13624. address of each section in the symbol file. This is useful if the
  13625. program is relocated at runtime, such as the Linux kernel with
  13626. kASLR enabled.
  13627. 'symbol-file' with no argument clears out GDB information on your
  13628. program's symbol table.
  13629. The 'symbol-file' command causes GDB to forget the contents of some
  13630. breakpoints and auto-display expressions. This is because they may
  13631. contain pointers to the internal data recording symbols and data
  13632. types, which are part of the old symbol table data being discarded
  13633. inside GDB.
  13634. 'symbol-file' does not repeat if you press <RET> again after
  13635. executing it once.
  13636. When GDB is configured for a particular environment, it understands
  13637. debugging information in whatever format is the standard generated
  13638. for that environment; you may use either a GNU compiler, or other
  13639. compilers that adhere to the local conventions. Best results are
  13640. usually obtained from GNU compilers; for example, using 'GCC' you
  13641. can generate debugging information for optimized code.
  13642. For most kinds of object files, with the exception of old SVR3
  13643. systems using COFF, the 'symbol-file' command does not normally
  13644. read the symbol table in full right away. Instead, it scans the
  13645. symbol table quickly to find which source files and which symbols
  13646. are present. The details are read later, one source file at a
  13647. time, as they are needed.
  13648. The purpose of this two-stage reading strategy is to make GDB start
  13649. up faster. For the most part, it is invisible except for
  13650. occasional pauses while the symbol table details for a particular
  13651. source file are being read. (The 'set verbose' command can turn
  13652. these pauses into messages if desired. *Note Optional Warnings and
  13653. Messages: Messages/Warnings.)
  13654. We have not implemented the two-stage strategy for COFF yet. When
  13655. the symbol table is stored in COFF format, 'symbol-file' reads the
  13656. symbol table data in full right away. Note that "stabs-in-COFF"
  13657. still does the two-stage strategy, since the debug info is actually
  13658. in stabs format.
  13659. 'symbol-file [ -readnow ] FILENAME'
  13660. 'file [ -readnow ] FILENAME'
  13661. You can override the GDB two-stage strategy for reading symbol
  13662. tables by using the '-readnow' option with any of the commands that
  13663. load symbol table information, if you want to be sure GDB has the
  13664. entire symbol table available.
  13665. 'symbol-file [ -readnever ] FILENAME'
  13666. 'file [ -readnever ] FILENAME'
  13667. You can instruct GDB to never read the symbolic information
  13668. contained in FILENAME by using the '-readnever' option. *Note
  13669. --readnever::.
  13670. 'core-file [FILENAME]'
  13671. 'core'
  13672. Specify the whereabouts of a core dump file to be used as the
  13673. "contents of memory". Traditionally, core files contain only some
  13674. parts of the address space of the process that generated them; GDB
  13675. can access the executable file itself for other parts.
  13676. 'core-file' with no argument specifies that no core file is to be
  13677. used.
  13678. Note that the core file is ignored when your program is actually
  13679. running under GDB. So, if you have been running your program and
  13680. you wish to debug a core file instead, you must kill the subprocess
  13681. in which the program is running. To do this, use the 'kill'
  13682. command (*note Killing the Child Process: Kill Process.).
  13683. 'add-symbol-file FILENAME [ -readnow | -readnever ] [ -o OFFSET ] [ TEXTADDRESS ] [ -s SECTION ADDRESS ... ]'
  13684. The 'add-symbol-file' command reads additional symbol table
  13685. information from the file FILENAME. You would use this command
  13686. when FILENAME has been dynamically loaded (by some other means)
  13687. into the program that is running. The TEXTADDRESS parameter gives
  13688. the memory address at which the file's text section has been
  13689. loaded. You can additionally specify the base address of other
  13690. sections using an arbitrary number of '-s SECTION ADDRESS' pairs.
  13691. If a section is omitted, GDB will use its default addresses as
  13692. found in FILENAME. Any ADDRESS or TEXTADDRESS can be given as an
  13693. expression.
  13694. If an optional OFFSET is specified, it is added to the start
  13695. address of each section, except those for which the address was
  13696. specified explicitly.
  13697. The symbol table of the file FILENAME is added to the symbol table
  13698. originally read with the 'symbol-file' command. You can use the
  13699. 'add-symbol-file' command any number of times; the new symbol data
  13700. thus read is kept in addition to the old.
  13701. Changes can be reverted using the command 'remove-symbol-file'.
  13702. Although FILENAME is typically a shared library file, an executable
  13703. file, or some other object file which has been fully relocated for
  13704. loading into a process, you can also load symbolic information from
  13705. relocatable '.o' files, as long as:
  13706. * the file's symbolic information refers only to linker symbols
  13707. defined in that file, not to symbols defined by other object
  13708. files,
  13709. * every section the file's symbolic information refers to has
  13710. actually been loaded into the inferior, as it appears in the
  13711. file, and
  13712. * you can determine the address at which every section was
  13713. loaded, and provide these to the 'add-symbol-file' command.
  13714. Some embedded operating systems, like Sun Chorus and VxWorks, can
  13715. load relocatable files into an already running program; such
  13716. systems typically make the requirements above easy to meet.
  13717. However, it's important to recognize that many native systems use
  13718. complex link procedures ('.linkonce' section factoring and C++
  13719. constructor table assembly, for example) that make the requirements
  13720. difficult to meet. In general, one cannot assume that using
  13721. 'add-symbol-file' to read a relocatable object file's symbolic
  13722. information will have the same effect as linking the relocatable
  13723. object file into the program in the normal way.
  13724. 'add-symbol-file' does not repeat if you press <RET> after using
  13725. it.
  13726. 'remove-symbol-file FILENAME'
  13727. 'remove-symbol-file -a ADDRESS'
  13728. Remove a symbol file added via the 'add-symbol-file' command. The
  13729. file to remove can be identified by its FILENAME or by an ADDRESS
  13730. that lies within the boundaries of this symbol file in memory.
  13731. Example:
  13732. (gdb) add-symbol-file /home/user/gdb/mylib.so 0x7ffff7ff9480
  13733. add symbol table from file "/home/user/gdb/mylib.so" at
  13734. .text_addr = 0x7ffff7ff9480
  13735. (y or n) y
  13736. Reading symbols from /home/user/gdb/mylib.so...done.
  13737. (gdb) remove-symbol-file -a 0x7ffff7ff9480
  13738. Remove symbol table from file "/home/user/gdb/mylib.so"? (y or n) y
  13739. (gdb)
  13740. 'remove-symbol-file' does not repeat if you press <RET> after using
  13741. it.
  13742. 'add-symbol-file-from-memory ADDRESS'
  13743. Load symbols from the given ADDRESS in a dynamically loaded object
  13744. file whose image is mapped directly into the inferior's memory.
  13745. For example, the Linux kernel maps a 'syscall DSO' into each
  13746. process's address space; this DSO provides kernel-specific code for
  13747. some system calls. The argument can be any expression whose
  13748. evaluation yields the address of the file's shared object file
  13749. header. For this command to work, you must have used 'symbol-file'
  13750. or 'exec-file' commands in advance.
  13751. 'section SECTION ADDR'
  13752. The 'section' command changes the base address of the named SECTION
  13753. of the exec file to ADDR. This can be used if the exec file does
  13754. not contain section addresses, (such as in the 'a.out' format), or
  13755. when the addresses specified in the file itself are wrong. Each
  13756. section must be changed separately. The 'info files' command,
  13757. described below, lists all the sections and their addresses.
  13758. 'info files'
  13759. 'info target'
  13760. 'info files' and 'info target' are synonymous; both print the
  13761. current target (*note Specifying a Debugging Target: Targets.),
  13762. including the names of the executable and core dump files currently
  13763. in use by GDB, and the files from which symbols were loaded. The
  13764. command 'help target' lists all possible targets rather than
  13765. current ones.
  13766. 'maint info sections'
  13767. Another command that can give you extra information about program
  13768. sections is 'maint info sections'. In addition to the section
  13769. information displayed by 'info files', this command displays the
  13770. flags and file offset of each section in the executable and core
  13771. dump files. In addition, 'maint info sections' provides the
  13772. following command options (which may be arbitrarily combined):
  13773. 'ALLOBJ'
  13774. Display sections for all loaded object files, including shared
  13775. libraries.
  13776. 'SECTIONS'
  13777. Display info only for named SECTIONS.
  13778. 'SECTION-FLAGS'
  13779. Display info only for sections for which SECTION-FLAGS are
  13780. true. The section flags that GDB currently knows about are:
  13781. 'ALLOC'
  13782. Section will have space allocated in the process when
  13783. loaded. Set for all sections except those containing
  13784. debug information.
  13785. 'LOAD'
  13786. Section will be loaded from the file into the child
  13787. process memory. Set for pre-initialized code and data,
  13788. clear for '.bss' sections.
  13789. 'RELOC'
  13790. Section needs to be relocated before loading.
  13791. 'READONLY'
  13792. Section cannot be modified by the child process.
  13793. 'CODE'
  13794. Section contains executable code only.
  13795. 'DATA'
  13796. Section contains data only (no executable code).
  13797. 'ROM'
  13798. Section will reside in ROM.
  13799. 'CONSTRUCTOR'
  13800. Section contains data for constructor/destructor lists.
  13801. 'HAS_CONTENTS'
  13802. Section is not empty.
  13803. 'NEVER_LOAD'
  13804. An instruction to the linker to not output the section.
  13805. 'COFF_SHARED_LIBRARY'
  13806. A notification to the linker that the section contains
  13807. COFF shared library information.
  13808. 'IS_COMMON'
  13809. Section contains common symbols.
  13810. 'set trust-readonly-sections on'
  13811. Tell GDB that readonly sections in your object file really are
  13812. read-only (i.e. that their contents will not change). In that
  13813. case, GDB can fetch values from these sections out of the object
  13814. file, rather than from the target program. For some targets
  13815. (notably embedded ones), this can be a significant enhancement to
  13816. debugging performance.
  13817. The default is off.
  13818. 'set trust-readonly-sections off'
  13819. Tell GDB not to trust readonly sections. This means that the
  13820. contents of the section might change while the program is running,
  13821. and must therefore be fetched from the target when needed.
  13822. 'show trust-readonly-sections'
  13823. Show the current setting of trusting readonly sections.
  13824. All file-specifying commands allow both absolute and relative file
  13825. names as arguments. GDB always converts the file name to an absolute
  13826. file name and remembers it that way.
  13827. GDB supports GNU/Linux, MS-Windows, SunOS, Darwin/Mach-O, SVr4, IBM
  13828. RS/6000 AIX, QNX Neutrino, FDPIC (FR-V), and DSBT (TIC6X) shared
  13829. libraries.
  13830. On MS-Windows GDB must be linked with the Expat library to support
  13831. shared libraries. *Note Expat::.
  13832. GDB automatically loads symbol definitions from shared libraries when
  13833. you use the 'run' command, or when you examine a core file. (Before you
  13834. issue the 'run' command, GDB does not understand references to a
  13835. function in a shared library, however--unless you are debugging a core
  13836. file).
  13837. There are times, however, when you may wish to not automatically load
  13838. symbol definitions from shared libraries, such as when they are
  13839. particularly large or there are many of them.
  13840. To control the automatic loading of shared library symbols, use the
  13841. commands:
  13842. 'set auto-solib-add MODE'
  13843. If MODE is 'on', symbols from all shared object libraries will be
  13844. loaded automatically when the inferior begins execution, you attach
  13845. to an independently started inferior, or when the dynamic linker
  13846. informs GDB that a new library has been loaded. If MODE is 'off',
  13847. symbols must be loaded manually, using the 'sharedlibrary' command.
  13848. The default value is 'on'.
  13849. If your program uses lots of shared libraries with debug info that
  13850. takes large amounts of memory, you can decrease the GDB memory
  13851. footprint by preventing it from automatically loading the symbols
  13852. from shared libraries. To that end, type 'set auto-solib-add off'
  13853. before running the inferior, then load each library whose debug
  13854. symbols you do need with 'sharedlibrary REGEXP', where REGEXP is a
  13855. regular expression that matches the libraries whose symbols you
  13856. want to be loaded.
  13857. 'show auto-solib-add'
  13858. Display the current autoloading mode.
  13859. To explicitly load shared library symbols, use the 'sharedlibrary'
  13860. command:
  13861. 'info share REGEX'
  13862. 'info sharedlibrary REGEX'
  13863. Print the names of the shared libraries which are currently loaded
  13864. that match REGEX. If REGEX is omitted then print all shared
  13865. libraries that are loaded.
  13866. 'info dll REGEX'
  13867. This is an alias of 'info sharedlibrary'.
  13868. 'sharedlibrary REGEX'
  13869. 'share REGEX'
  13870. Load shared object library symbols for files matching a Unix
  13871. regular expression. As with files loaded automatically, it only
  13872. loads shared libraries required by your program for a core file or
  13873. after typing 'run'. If REGEX is omitted all shared libraries
  13874. required by your program are loaded.
  13875. 'nosharedlibrary'
  13876. Unload all shared object library symbols. This discards all
  13877. symbols that have been loaded from all shared libraries. Symbols
  13878. from shared libraries that were loaded by explicit user requests
  13879. are not discarded.
  13880. Sometimes you may wish that GDB stops and gives you control when any
  13881. of shared library events happen. The best way to do this is to use
  13882. 'catch load' and 'catch unload' (*note Set Catchpoints::).
  13883. GDB also supports the the 'set stop-on-solib-events' command for
  13884. this. This command exists for historical reasons. It is less useful
  13885. than setting a catchpoint, because it does not allow for conditions or
  13886. commands as a catchpoint does.
  13887. 'set stop-on-solib-events'
  13888. This command controls whether GDB should give you control when the
  13889. dynamic linker notifies it about some shared library event. The
  13890. most common event of interest is loading or unloading of a new
  13891. shared library.
  13892. 'show stop-on-solib-events'
  13893. Show whether GDB stops and gives you control when shared library
  13894. events happen.
  13895. Shared libraries are also supported in many cross or remote debugging
  13896. configurations. GDB needs to have access to the target's libraries;
  13897. this can be accomplished either by providing copies of the libraries on
  13898. the host system, or by asking GDB to automatically retrieve the
  13899. libraries from the target. If copies of the target libraries are
  13900. provided, they need to be the same as the target libraries, although the
  13901. copies on the target can be stripped as long as the copies on the host
  13902. are not.
  13903. For remote debugging, you need to tell GDB where the target libraries
  13904. are, so that it can load the correct copies--otherwise, it may try to
  13905. load the host's libraries. GDB has two variables to specify the search
  13906. directories for target libraries.
  13907. 'set sysroot PATH'
  13908. Use PATH as the system root for the program being debugged. Any
  13909. absolute shared library paths will be prefixed with PATH; many
  13910. runtime loaders store the absolute paths to the shared library in
  13911. the target program's memory. When starting processes remotely, and
  13912. when attaching to already-running processes (local or remote),
  13913. their executable filenames will be prefixed with PATH if reported
  13914. to GDB as absolute by the operating system. If you use 'set
  13915. sysroot' to find executables and shared libraries, they need to be
  13916. laid out in the same way that they are on the target, with e.g. a
  13917. '/bin', '/lib' and '/usr/lib' hierarchy under PATH.
  13918. If PATH starts with the sequence 'target:' and the target system is
  13919. remote then GDB will retrieve the target binaries from the remote
  13920. system. This is only supported when using a remote target that
  13921. supports the 'remote get' command (*note Sending files to a remote
  13922. system: File Transfer.). The part of PATH following the initial
  13923. 'target:' (if present) is used as system root prefix on the remote
  13924. file system. If PATH starts with the sequence 'remote:' this is
  13925. converted to the sequence 'target:' by 'set sysroot'(1). If you
  13926. want to specify a local system root using a directory that happens
  13927. to be named 'target:' or 'remote:', you need to use some equivalent
  13928. variant of the name like './target:'.
  13929. For targets with an MS-DOS based filesystem, such as MS-Windows and
  13930. SymbianOS, GDB tries prefixing a few variants of the target
  13931. absolute file name with PATH. But first, on Unix hosts, GDB
  13932. converts all backslash directory separators into forward slashes,
  13933. because the backslash is not a directory separator on Unix:
  13934. c:\foo\bar.dll => c:/foo/bar.dll
  13935. Then, GDB attempts prefixing the target file name with PATH, and
  13936. looks for the resulting file name in the host file system:
  13937. c:/foo/bar.dll => /path/to/sysroot/c:/foo/bar.dll
  13938. If that does not find the binary, GDB tries removing the ':'
  13939. character from the drive spec, both for convenience, and, for the
  13940. case of the host file system not supporting file names with colons:
  13941. c:/foo/bar.dll => /path/to/sysroot/c/foo/bar.dll
  13942. This makes it possible to have a system root that mirrors a target
  13943. with more than one drive. E.g., you may want to setup your local
  13944. copies of the target system shared libraries like so (note 'c' vs
  13945. 'z'):
  13946. /path/to/sysroot/c/sys/bin/foo.dll
  13947. /path/to/sysroot/c/sys/bin/bar.dll
  13948. /path/to/sysroot/z/sys/bin/bar.dll
  13949. and point the system root at '/path/to/sysroot', so that GDB can
  13950. find the correct copies of both 'c:\sys\bin\foo.dll', and
  13951. 'z:\sys\bin\bar.dll'.
  13952. If that still does not find the binary, GDB tries removing the
  13953. whole drive spec from the target file name:
  13954. c:/foo/bar.dll => /path/to/sysroot/foo/bar.dll
  13955. This last lookup makes it possible to not care about the drive
  13956. name, if you don't want or need to.
  13957. The 'set solib-absolute-prefix' command is an alias for 'set
  13958. sysroot'.
  13959. You can set the default system root by using the configure-time
  13960. '--with-sysroot' option. If the system root is inside GDB's
  13961. configured binary prefix (set with '--prefix' or '--exec-prefix'),
  13962. then the default system root will be updated automatically if the
  13963. installed GDB is moved to a new location.
  13964. 'show sysroot'
  13965. Display the current executable and shared library prefix.
  13966. 'set solib-search-path PATH'
  13967. If this variable is set, PATH is a colon-separated list of
  13968. directories to search for shared libraries. 'solib-search-path' is
  13969. used after 'sysroot' fails to locate the library, or if the path to
  13970. the library is relative instead of absolute. If you want to use
  13971. 'solib-search-path' instead of 'sysroot', be sure to set 'sysroot'
  13972. to a nonexistent directory to prevent GDB from finding your host's
  13973. libraries. 'sysroot' is preferred; setting it to a nonexistent
  13974. directory may interfere with automatic loading of shared library
  13975. symbols.
  13976. 'show solib-search-path'
  13977. Display the current shared library search path.
  13978. 'set target-file-system-kind KIND'
  13979. Set assumed file system kind for target reported file names.
  13980. Shared library file names as reported by the target system may not
  13981. make sense as is on the system GDB is running on. For example,
  13982. when remote debugging a target that has MS-DOS based file system
  13983. semantics, from a Unix host, the target may be reporting to GDB a
  13984. list of loaded shared libraries with file names such as
  13985. 'c:\Windows\kernel32.dll'. On Unix hosts, there's no concept of
  13986. drive letters, so the 'c:\' prefix is not normally understood as
  13987. indicating an absolute file name, and neither is the backslash
  13988. normally considered a directory separator character. In that case,
  13989. the native file system would interpret this whole absolute file
  13990. name as a relative file name with no directory components. This
  13991. would make it impossible to point GDB at a copy of the remote
  13992. target's shared libraries on the host using 'set sysroot', and
  13993. impractical with 'set solib-search-path'. Setting
  13994. 'target-file-system-kind' to 'dos-based' tells GDB to interpret
  13995. such file names similarly to how the target would, and to map them
  13996. to file names valid on GDB's native file system semantics. The
  13997. value of KIND can be '"auto"', in addition to one of the supported
  13998. file system kinds. In that case, GDB tries to determine the
  13999. appropriate file system variant based on the current target's
  14000. operating system (*note Configuring the Current ABI: ABI.). The
  14001. supported file system settings are:
  14002. 'unix'
  14003. Instruct GDB to assume the target file system is of Unix kind.
  14004. Only file names starting the forward slash ('/') character are
  14005. considered absolute, and the directory separator character is
  14006. also the forward slash.
  14007. 'dos-based'
  14008. Instruct GDB to assume the target file system is DOS based.
  14009. File names starting with either a forward slash, or a drive
  14010. letter followed by a colon (e.g., 'c:'), are considered
  14011. absolute, and both the slash ('/') and the backslash ('\\')
  14012. characters are considered directory separators.
  14013. 'auto'
  14014. Instruct GDB to use the file system kind associated with the
  14015. target operating system (*note Configuring the Current ABI:
  14016. ABI.). This is the default.
  14017. When processing file names provided by the user, GDB frequently needs
  14018. to compare them to the file names recorded in the program's debug info.
  14019. Normally, GDB compares just the "base names" of the files as strings,
  14020. which is reasonably fast even for very large programs. (The base name
  14021. of a file is the last portion of its name, after stripping all the
  14022. leading directories.) This shortcut in comparison is based upon the
  14023. assumption that files cannot have more than one base name. This is
  14024. usually true, but references to files that use symlinks or similar
  14025. filesystem facilities violate that assumption. If your program records
  14026. files using such facilities, or if you provide file names to GDB using
  14027. symlinks etc., you can set 'basenames-may-differ' to 'true' to instruct
  14028. GDB to completely canonicalize each pair of file names it needs to
  14029. compare. This will make file-name comparisons accurate, but at a price
  14030. of a significant slowdown.
  14031. 'set basenames-may-differ'
  14032. Set whether a source file may have multiple base names.
  14033. 'show basenames-may-differ'
  14034. Show whether a source file may have multiple base names.
  14035. ---------- Footnotes ----------
  14036. (1) Historically the functionality to retrieve binaries from the
  14037. remote system was provided by prefixing PATH with 'remote:'
  14038. 
  14039. File: gdb.info, Node: File Caching, Next: Separate Debug Files, Prev: Files, Up: GDB Files
  14040. 18.2 File Caching
  14041. =================
  14042. To speed up file loading, and reduce memory usage, GDB will reuse the
  14043. 'bfd' objects used to track open files. *Note BFD: (bfd)Top. The
  14044. following commands allow visibility and control of the caching behavior.
  14045. 'maint info bfds'
  14046. This prints information about each 'bfd' object that is known to
  14047. GDB.
  14048. 'maint set bfd-sharing'
  14049. 'maint show bfd-sharing'
  14050. Control whether 'bfd' objects can be shared. When sharing is
  14051. enabled GDB reuses already open 'bfd' objects rather than reopening
  14052. the same file. Turning sharing off does not cause already shared
  14053. 'bfd' objects to be unshared, but all future files that are opened
  14054. will create a new 'bfd' object. Similarly, re-enabling sharing
  14055. does not cause multiple existing 'bfd' objects to be collapsed into
  14056. a single shared 'bfd' object.
  14057. 'set debug bfd-cache LEVEL'
  14058. Turns on debugging of the bfd cache, setting the level to LEVEL.
  14059. 'show debug bfd-cache'
  14060. Show the current debugging level of the bfd cache.
  14061. 
  14062. File: gdb.info, Node: Separate Debug Files, Next: MiniDebugInfo, Prev: File Caching, Up: GDB Files
  14063. 18.3 Debugging Information in Separate Files
  14064. ============================================
  14065. GDB allows you to put a program's debugging information in a file
  14066. separate from the executable itself, in a way that allows GDB to find
  14067. and load the debugging information automatically. Since debugging
  14068. information can be very large--sometimes larger than the executable code
  14069. itself--some systems distribute debugging information for their
  14070. executables in separate files, which users can install only when they
  14071. need to debug a problem.
  14072. GDB supports two ways of specifying the separate debug info file:
  14073. * The executable contains a "debug link" that specifies the name of
  14074. the separate debug info file. The separate debug file's name is
  14075. usually 'EXECUTABLE.debug', where EXECUTABLE is the name of the
  14076. corresponding executable file without leading directories (e.g.,
  14077. 'ls.debug' for '/usr/bin/ls'). In addition, the debug link
  14078. specifies a 32-bit "Cyclic Redundancy Check" (CRC) checksum for the
  14079. debug file, which GDB uses to validate that the executable and the
  14080. debug file came from the same build.
  14081. * The executable contains a "build ID", a unique bit string that is
  14082. also present in the corresponding debug info file. (This is
  14083. supported only on some operating systems, when using the ELF or PE
  14084. file formats for binary files and the GNU Binutils.) For more
  14085. details about this feature, see the description of the '--build-id'
  14086. command-line option in *note Command Line Options: (ld)Options.
  14087. The debug info file's name is not specified explicitly by the build
  14088. ID, but can be computed from the build ID, see below.
  14089. Depending on the way the debug info file is specified, GDB uses two
  14090. different methods of looking for the debug file:
  14091. * For the "debug link" method, GDB looks up the named file in the
  14092. directory of the executable file, then in a subdirectory of that
  14093. directory named '.debug', and finally under each one of the global
  14094. debug directories, in a subdirectory whose name is identical to the
  14095. leading directories of the executable's absolute file name. (On
  14096. MS-Windows/MS-DOS, the drive letter of the executable's leading
  14097. directories is converted to a one-letter subdirectory, i.e.
  14098. 'd:/usr/bin/' is converted to '/d/usr/bin/', because Windows
  14099. filesystems disallow colons in file names.)
  14100. * For the "build ID" method, GDB looks in the '.build-id'
  14101. subdirectory of each one of the global debug directories for a file
  14102. named 'NN/NNNNNNNN.debug', where NN are the first 2 hex characters
  14103. of the build ID bit string, and NNNNNNNN are the rest of the bit
  14104. string. (Real build ID strings are 32 or more hex characters, not
  14105. 10.)
  14106. So, for example, suppose you ask GDB to debug '/usr/bin/ls', which
  14107. has a debug link that specifies the file 'ls.debug', and a build ID
  14108. whose value in hex is 'abcdef1234'. If the list of the global debug
  14109. directories includes '/usr/lib/debug', then GDB will look for the
  14110. following debug information files, in the indicated order:
  14111. - '/usr/lib/debug/.build-id/ab/cdef1234.debug'
  14112. - '/usr/bin/ls.debug'
  14113. - '/usr/bin/.debug/ls.debug'
  14114. - '/usr/lib/debug/usr/bin/ls.debug'.
  14115. Global debugging info directories default to what is set by GDB
  14116. configure option '--with-separate-debug-dir'. During GDB run you can
  14117. also set the global debugging info directories, and view the list GDB is
  14118. currently using.
  14119. 'set debug-file-directory DIRECTORIES'
  14120. Set the directories which GDB searches for separate debugging
  14121. information files to DIRECTORY. Multiple path components can be
  14122. set concatenating them by a path separator.
  14123. 'show debug-file-directory'
  14124. Show the directories GDB searches for separate debugging
  14125. information files.
  14126. A debug link is a special section of the executable file named
  14127. '.gnu_debuglink'. The section must contain:
  14128. * A filename, with any leading directory components removed, followed
  14129. by a zero byte,
  14130. * zero to three bytes of padding, as needed to reach the next
  14131. four-byte boundary within the section, and
  14132. * a four-byte CRC checksum, stored in the same endianness used for
  14133. the executable file itself. The checksum is computed on the
  14134. debugging information file's full contents by the function given
  14135. below, passing zero as the CRC argument.
  14136. Any executable file format can carry a debug link, as long as it can
  14137. contain a section named '.gnu_debuglink' with the contents described
  14138. above.
  14139. The build ID is a special section in the executable file (and in
  14140. other ELF binary files that GDB may consider). This section is often
  14141. named '.note.gnu.build-id', but that name is not mandatory. It contains
  14142. unique identification for the built files--the ID remains the same
  14143. across multiple builds of the same build tree. The default algorithm
  14144. SHA1 produces 160 bits (40 hexadecimal characters) of the content for
  14145. the build ID string. The same section with an identical value is
  14146. present in the original built binary with symbols, in its stripped
  14147. variant, and in the separate debugging information file.
  14148. The debugging information file itself should be an ordinary
  14149. executable, containing a full set of linker symbols, sections, and
  14150. debugging information. The sections of the debugging information file
  14151. should have the same names, addresses, and sizes as the original file,
  14152. but they need not contain any data--much like a '.bss' section in an
  14153. ordinary executable.
  14154. The GNU binary utilities (Binutils) package includes the 'objcopy'
  14155. utility that can produce the separated executable / debugging
  14156. information file pairs using the following commands:
  14157. objcopy --only-keep-debug foo foo.debug
  14158. strip -g foo
  14159. These commands remove the debugging information from the executable file
  14160. 'foo' and place it in the file 'foo.debug'. You can use the first,
  14161. second or both methods to link the two files:
  14162. * The debug link method needs the following additional command to
  14163. also leave behind a debug link in 'foo':
  14164. objcopy --add-gnu-debuglink=foo.debug foo
  14165. Ulrich Drepper's 'elfutils' package, starting with version 0.53,
  14166. contains a version of the 'strip' command such that the command
  14167. 'strip foo -f foo.debug' has the same functionality as the two
  14168. 'objcopy' commands and the 'ln -s' command above, together.
  14169. * Build ID gets embedded into the main executable using 'ld
  14170. --build-id' or the GCC counterpart 'gcc -Wl,--build-id'. Build ID
  14171. support plus compatibility fixes for debug files separation are
  14172. present in GNU binary utilities (Binutils) package since version
  14173. 2.18.
  14174. The CRC used in '.gnu_debuglink' is the CRC-32 defined in IEEE 802.3
  14175. using the polynomial:
  14176. x^{32} + x^{26} + x^{23} + x^{22} + x^{16} + x^{12} + x^{11}
  14177. + x^{10} + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1
  14178. The function is computed byte at a time, taking the least significant
  14179. bit of each byte first. The initial pattern '0xffffffff' is used, to
  14180. ensure leading zeros affect the CRC and the final result is inverted to
  14181. ensure trailing zeros also affect the CRC.
  14182. _Note:_ This is the same CRC polynomial as used in handling the
  14183. "Remote Serial Protocol" 'qCRC' packet (*note qCRC packet::). However
  14184. in the case of the Remote Serial Protocol, the CRC is computed _most_
  14185. significant bit first, and the result is not inverted, so trailing zeros
  14186. have no effect on the CRC value.
  14187. To complete the description, we show below the code of the function
  14188. which produces the CRC used in '.gnu_debuglink'. Inverting the
  14189. initially supplied 'crc' argument means that an initial call to this
  14190. function passing in zero will start computing the CRC using
  14191. '0xffffffff'.
  14192. unsigned long
  14193. gnu_debuglink_crc32 (unsigned long crc,
  14194. unsigned char *buf, size_t len)
  14195. {
  14196. static const unsigned long crc32_table[256] =
  14197. {
  14198. 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
  14199. 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
  14200. 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
  14201. 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
  14202. 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
  14203. 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
  14204. 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
  14205. 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
  14206. 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
  14207. 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
  14208. 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
  14209. 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
  14210. 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
  14211. 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
  14212. 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
  14213. 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
  14214. 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
  14215. 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
  14216. 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
  14217. 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
  14218. 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
  14219. 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
  14220. 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
  14221. 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
  14222. 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
  14223. 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
  14224. 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
  14225. 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
  14226. 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
  14227. 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
  14228. 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
  14229. 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
  14230. 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
  14231. 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
  14232. 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
  14233. 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
  14234. 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
  14235. 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
  14236. 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
  14237. 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
  14238. 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
  14239. 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
  14240. 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
  14241. 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
  14242. 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
  14243. 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
  14244. 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
  14245. 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
  14246. 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
  14247. 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
  14248. 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
  14249. 0x2d02ef8d
  14250. };
  14251. unsigned char *end;
  14252. crc = ~crc & 0xffffffff;
  14253. for (end = buf + len; buf < end; ++buf)
  14254. crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
  14255. return ~crc & 0xffffffff;
  14256. }
  14257. This computation does not apply to the "build ID" method.
  14258. 
  14259. File: gdb.info, Node: MiniDebugInfo, Next: Index Files, Prev: Separate Debug Files, Up: GDB Files
  14260. 18.4 Debugging information in a special section
  14261. ===============================================
  14262. Some systems ship pre-built executables and libraries that have a
  14263. special '.gnu_debugdata' section. This feature is called
  14264. "MiniDebugInfo". This section holds an LZMA-compressed object and is
  14265. used to supply extra symbols for backtraces.
  14266. The intent of this section is to provide extra minimal debugging
  14267. information for use in simple backtraces. It is not intended to be a
  14268. replacement for full separate debugging information (*note Separate
  14269. Debug Files::). The example below shows the intended use; however, GDB
  14270. does not currently put restrictions on what sort of debugging
  14271. information might be included in the section.
  14272. GDB has support for this extension. If the section exists, then it
  14273. is used provided that no other source of debugging information can be
  14274. found, and that GDB was configured with LZMA support.
  14275. This section can be easily created using 'objcopy' and other standard
  14276. utilities:
  14277. # Extract the dynamic symbols from the main binary, there is no need
  14278. # to also have these in the normal symbol table.
  14279. nm -D BINARY --format=posix --defined-only \
  14280. | awk '{ print $1 }' | sort > dynsyms
  14281. # Extract all the text (i.e. function) symbols from the debuginfo.
  14282. # (Note that we actually also accept "D" symbols, for the benefit
  14283. # of platforms like PowerPC64 that use function descriptors.)
  14284. nm BINARY --format=posix --defined-only \
  14285. | awk '{ if ($2 == "T" || $2 == "t" || $2 == "D") print $1 }' \
  14286. | sort > funcsyms
  14287. # Keep all the function symbols not already in the dynamic symbol
  14288. # table.
  14289. comm -13 dynsyms funcsyms > keep_symbols
  14290. # Separate full debug info into debug binary.
  14291. objcopy --only-keep-debug BINARY debug
  14292. # Copy the full debuginfo, keeping only a minimal set of symbols and
  14293. # removing some unnecessary sections.
  14294. objcopy -S --remove-section .gdb_index --remove-section .comment \
  14295. --keep-symbols=keep_symbols debug mini_debuginfo
  14296. # Drop the full debug info from the original binary.
  14297. strip --strip-all -R .comment BINARY
  14298. # Inject the compressed data into the .gnu_debugdata section of the
  14299. # original binary.
  14300. xz mini_debuginfo
  14301. objcopy --add-section .gnu_debugdata=mini_debuginfo.xz BINARY
  14302. 
  14303. File: gdb.info, Node: Index Files, Next: Symbol Errors, Prev: MiniDebugInfo, Up: GDB Files
  14304. 18.5 Index Files Speed Up GDB
  14305. =============================
  14306. When GDB finds a symbol file, it scans the symbols in the file in order
  14307. to construct an internal symbol table. This lets most GDB operations
  14308. work quickly--at the cost of a delay early on. For large programs, this
  14309. delay can be quite lengthy, so GDB provides a way to build an index,
  14310. which speeds up startup.
  14311. For convenience, GDB comes with a program, 'gdb-add-index', which can
  14312. be used to add the index to a symbol file. It takes the symbol file as
  14313. its only argument:
  14314. $ gdb-add-index symfile
  14315. *Note gdb-add-index::.
  14316. It is also possible to do the work manually. Here is what
  14317. 'gdb-add-index' does behind the curtains.
  14318. The index is stored as a section in the symbol file. GDB can write
  14319. the index to a file, then you can put it into the symbol file using
  14320. 'objcopy'.
  14321. To create an index file, use the 'save gdb-index' command:
  14322. 'save gdb-index [-dwarf-5] DIRECTORY'
  14323. Create index files for all symbol files currently known by GDB.
  14324. For each known SYMBOL-FILE, this command by default creates it
  14325. produces a single file 'SYMBOL-FILE.gdb-index'. If you invoke this
  14326. command with the '-dwarf-5' option, it produces 2 files:
  14327. 'SYMBOL-FILE.debug_names' and 'SYMBOL-FILE.debug_str'. The files
  14328. are created in the given DIRECTORY.
  14329. Once you have created an index file you can merge it into your symbol
  14330. file, here named 'symfile', using 'objcopy':
  14331. $ objcopy --add-section .gdb_index=symfile.gdb-index \
  14332. --set-section-flags .gdb_index=readonly symfile symfile
  14333. Or for '-dwarf-5':
  14334. $ objcopy --dump-section .debug_str=symfile.debug_str.new symfile
  14335. $ cat symfile.debug_str >>symfile.debug_str.new
  14336. $ objcopy --add-section .debug_names=symfile.gdb-index \
  14337. --set-section-flags .debug_names=readonly \
  14338. --update-section .debug_str=symfile.debug_str.new symfile symfile
  14339. GDB will normally ignore older versions of '.gdb_index' sections that
  14340. have been deprecated. Usually they are deprecated because they are
  14341. missing a new feature or have performance issues. To tell GDB to use a
  14342. deprecated index section anyway specify 'set
  14343. use-deprecated-index-sections on'. The default is 'off'. This can
  14344. speed up startup, but may result in some functionality being lost.
  14345. *Note Index Section Format::.
  14346. _Warning:_ Setting 'use-deprecated-index-sections' to 'on' must be
  14347. done before gdb reads the file. The following will not work:
  14348. $ gdb -ex "set use-deprecated-index-sections on" <program>
  14349. Instead you must do, for example,
  14350. $ gdb -iex "set use-deprecated-index-sections on" <program>
  14351. There are currently some limitation on indices. They only work when
  14352. using DWARF debugging information, not stabs. And, only the '-dwarf-5'
  14353. index works for programs using Ada.
  14354. 18.5.1 Automatic symbol index cache
  14355. -----------------------------------
  14356. It is possible for GDB to automatically save a copy of this index in a
  14357. cache on disk and retrieve it from there when loading the same binary in
  14358. the future. This feature can be turned on with 'set index-cache on'.
  14359. The following commands can be used to tweak the behavior of the index
  14360. cache.
  14361. 'set index-cache on'
  14362. 'set index-cache off'
  14363. Enable or disable the use of the symbol index cache.
  14364. 'set index-cache directory DIRECTORY'
  14365. 'show index-cache directory'
  14366. Set/show the directory where index files will be saved.
  14367. The default value for this directory depends on the host platform.
  14368. On most systems, the index is cached in the 'gdb' subdirectory of
  14369. the directory pointed to by the 'XDG_CACHE_HOME' environment
  14370. variable, if it is defined, else in the '.cache/gdb' subdirectory
  14371. of your home directory. However, on some systems, the default may
  14372. differ according to local convention.
  14373. There is no limit on the disk space used by index cache. It is
  14374. perfectly safe to delete the content of that directory to free up
  14375. disk space.
  14376. 'show index-cache stats'
  14377. Print the number of cache hits and misses since the launch of GDB.
  14378. 
  14379. File: gdb.info, Node: Symbol Errors, Next: Data Files, Prev: Index Files, Up: GDB Files
  14380. 18.6 Errors Reading Symbol Files
  14381. ================================
  14382. While reading a symbol file, GDB occasionally encounters problems, such
  14383. as symbol types it does not recognize, or known bugs in compiler output.
  14384. By default, GDB does not notify you of such problems, since they are
  14385. relatively common and primarily of interest to people debugging
  14386. compilers. If you are interested in seeing information about
  14387. ill-constructed symbol tables, you can either ask GDB to print only one
  14388. message about each such type of problem, no matter how many times the
  14389. problem occurs; or you can ask GDB to print more messages, to see how
  14390. many times the problems occur, with the 'set complaints' command (*note
  14391. Optional Warnings and Messages: Messages/Warnings.).
  14392. The messages currently printed, and their meanings, include:
  14393. 'inner block not inside outer block in SYMBOL'
  14394. The symbol information shows where symbol scopes begin and end
  14395. (such as at the start of a function or a block of statements).
  14396. This error indicates that an inner scope block is not fully
  14397. contained in its outer scope blocks.
  14398. GDB circumvents the problem by treating the inner block as if it
  14399. had the same scope as the outer block. In the error message,
  14400. SYMBOL may be shown as "'(don't know)'" if the outer block is not a
  14401. function.
  14402. 'block at ADDRESS out of order'
  14403. The symbol information for symbol scope blocks should occur in
  14404. order of increasing addresses. This error indicates that it does
  14405. not do so.
  14406. GDB does not circumvent this problem, and has trouble locating
  14407. symbols in the source file whose symbols it is reading. (You can
  14408. often determine what source file is affected by specifying 'set
  14409. verbose on'. *Note Optional Warnings and Messages:
  14410. Messages/Warnings.)
  14411. 'bad block start address patched'
  14412. The symbol information for a symbol scope block has a start address
  14413. smaller than the address of the preceding source line. This is
  14414. known to occur in the SunOS 4.1.1 (and earlier) C compiler.
  14415. GDB circumvents the problem by treating the symbol scope block as
  14416. starting on the previous source line.
  14417. 'bad string table offset in symbol N'
  14418. Symbol number N contains a pointer into the string table which is
  14419. larger than the size of the string table.
  14420. GDB circumvents the problem by considering the symbol to have the
  14421. name 'foo', which may cause other problems if many symbols end up
  14422. with this name.
  14423. 'unknown symbol type 0xNN'
  14424. The symbol information contains new data types that GDB does not
  14425. yet know how to read. '0xNN' is the symbol type of the
  14426. uncomprehended information, in hexadecimal.
  14427. GDB circumvents the error by ignoring this symbol information.
  14428. This usually allows you to debug your program, though certain
  14429. symbols are not accessible. If you encounter such a problem and
  14430. feel like debugging it, you can debug 'gdb' with itself, breakpoint
  14431. on 'complain', then go up to the function 'read_dbx_symtab' and
  14432. examine '*bufp' to see the symbol.
  14433. 'stub type has NULL name'
  14434. GDB could not find the full definition for a struct or class.
  14435. 'const/volatile indicator missing (ok if using g++ v1.x), got...'
  14436. The symbol information for a C++ member function is missing some
  14437. information that recent versions of the compiler should have output
  14438. for it.
  14439. 'info mismatch between compiler and debugger'
  14440. GDB could not parse a type specification output by the compiler.
  14441. 
  14442. File: gdb.info, Node: Data Files, Prev: Symbol Errors, Up: GDB Files
  14443. 18.7 GDB Data Files
  14444. ===================
  14445. GDB will sometimes read an auxiliary data file. These files are kept in
  14446. a directory known as the "data directory".
  14447. You can set the data directory's name, and view the name GDB is
  14448. currently using.
  14449. 'set data-directory DIRECTORY'
  14450. Set the directory which GDB searches for auxiliary data files to
  14451. DIRECTORY.
  14452. 'show data-directory'
  14453. Show the directory GDB searches for auxiliary data files.
  14454. You can set the default data directory by using the configure-time
  14455. '--with-gdb-datadir' option. If the data directory is inside GDB's
  14456. configured binary prefix (set with '--prefix' or '--exec-prefix'), then
  14457. the default data directory will be updated automatically if the
  14458. installed GDB is moved to a new location.
  14459. The data directory may also be specified with the '--data-directory'
  14460. command line option. *Note Mode Options::.
  14461. 
  14462. File: gdb.info, Node: Targets, Next: Remote Debugging, Prev: GDB Files, Up: Top
  14463. 19 Specifying a Debugging Target
  14464. ********************************
  14465. A "target" is the execution environment occupied by your program.
  14466. Often, GDB runs in the same host environment as your program; in that
  14467. case, the debugging target is specified as a side effect when you use
  14468. the 'file' or 'core' commands. When you need more flexibility--for
  14469. example, running GDB on a physically separate host, or controlling a
  14470. standalone system over a serial port or a realtime system over a TCP/IP
  14471. connection--you can use the 'target' command to specify one of the
  14472. target types configured for GDB (*note Commands for Managing Targets:
  14473. Target Commands.).
  14474. It is possible to build GDB for several different "target
  14475. architectures". When GDB is built like that, you can choose one of the
  14476. available architectures with the 'set architecture' command.
  14477. 'set architecture ARCH'
  14478. This command sets the current target architecture to ARCH. The
  14479. value of ARCH can be '"auto"', in addition to one of the supported
  14480. architectures.
  14481. 'show architecture'
  14482. Show the current target architecture.
  14483. 'set processor'
  14484. 'processor'
  14485. These are alias commands for, respectively, 'set architecture' and
  14486. 'show architecture'.
  14487. * Menu:
  14488. * Active Targets:: Active targets
  14489. * Target Commands:: Commands for managing targets
  14490. * Byte Order:: Choosing target byte order
  14491. 
  14492. File: gdb.info, Node: Active Targets, Next: Target Commands, Up: Targets
  14493. 19.1 Active Targets
  14494. ===================
  14495. There are multiple classes of targets such as: processes, executable
  14496. files or recording sessions. Core files belong to the process class,
  14497. making core file and process mutually exclusive. Otherwise, GDB can
  14498. work concurrently on multiple active targets, one in each class. This
  14499. allows you to (for example) start a process and inspect its activity,
  14500. while still having access to the executable file after the process
  14501. finishes. Or if you start process recording (*note Reverse Execution::)
  14502. and 'reverse-step' there, you are presented a virtual layer of the
  14503. recording target, while the process target remains stopped at the
  14504. chronologically last point of the process execution.
  14505. Use the 'core-file' and 'exec-file' commands to select a new core
  14506. file or executable target (*note Commands to Specify Files: Files.). To
  14507. specify as a target a process that is already running, use the 'attach'
  14508. command (*note Debugging an Already-running Process: Attach.).
  14509. 
  14510. File: gdb.info, Node: Target Commands, Next: Byte Order, Prev: Active Targets, Up: Targets
  14511. 19.2 Commands for Managing Targets
  14512. ==================================
  14513. 'target TYPE PARAMETERS'
  14514. Connects the GDB host environment to a target machine or process.
  14515. A target is typically a protocol for talking to debugging
  14516. facilities. You use the argument TYPE to specify the type or
  14517. protocol of the target machine.
  14518. Further PARAMETERS are interpreted by the target protocol, but
  14519. typically include things like device names or host names to connect
  14520. with, process numbers, and baud rates.
  14521. The 'target' command does not repeat if you press <RET> again after
  14522. executing the command.
  14523. 'help target'
  14524. Displays the names of all targets available. To display targets
  14525. currently selected, use either 'info target' or 'info files' (*note
  14526. Commands to Specify Files: Files.).
  14527. 'help target NAME'
  14528. Describe a particular target, including any parameters necessary to
  14529. select it.
  14530. 'set gnutarget ARGS'
  14531. GDB uses its own library BFD to read your files. GDB knows whether
  14532. it is reading an "executable", a "core", or a ".o" file; however,
  14533. you can specify the file format with the 'set gnutarget' command.
  14534. Unlike most 'target' commands, with 'gnutarget' the 'target' refers
  14535. to a program, not a machine.
  14536. _Warning:_ To specify a file format with 'set gnutarget', you
  14537. must know the actual BFD name.
  14538. *Note Commands to Specify Files: Files.
  14539. 'show gnutarget'
  14540. Use the 'show gnutarget' command to display what file format
  14541. 'gnutarget' is set to read. If you have not set 'gnutarget', GDB
  14542. will determine the file format for each file automatically, and
  14543. 'show gnutarget' displays 'The current BFD target is "auto"'.
  14544. Here are some common targets (available, or not, depending on the GDB
  14545. configuration):
  14546. 'target exec PROGRAM'
  14547. An executable file. 'target exec PROGRAM' is the same as
  14548. 'exec-file PROGRAM'.
  14549. 'target core FILENAME'
  14550. A core dump file. 'target core FILENAME' is the same as 'core-file
  14551. FILENAME'.
  14552. 'target remote MEDIUM'
  14553. A remote system connected to GDB via a serial line or network
  14554. connection. This command tells GDB to use its own remote protocol
  14555. over MEDIUM for debugging. *Note Remote Debugging::.
  14556. For example, if you have a board connected to '/dev/ttya' on the
  14557. machine running GDB, you could say:
  14558. target remote /dev/ttya
  14559. 'target remote' supports the 'load' command. This is only useful
  14560. if you have some other way of getting the stub to the target
  14561. system, and you can put it somewhere in memory where it won't get
  14562. clobbered by the download.
  14563. 'target sim [SIMARGS] ...'
  14564. Builtin CPU simulator. GDB includes simulators for most
  14565. architectures. In general,
  14566. target sim
  14567. load
  14568. run
  14569. works; however, you cannot assume that a specific memory map,
  14570. device drivers, or even basic I/O is available, although some
  14571. simulators do provide these. For info about any processor-specific
  14572. simulator details, see the appropriate section in *note Embedded
  14573. Processors: Embedded Processors.
  14574. 'target native'
  14575. Setup for local/native process debugging. Useful to make the 'run'
  14576. command spawn native processes (likewise 'attach', etc.) even when
  14577. 'set auto-connect-native-target' is 'off' (*note set
  14578. auto-connect-native-target::).
  14579. Different targets are available on different configurations of GDB;
  14580. your configuration may have more or fewer targets.
  14581. Many remote targets require you to download the executable's code
  14582. once you've successfully established a connection. You may wish to
  14583. control various aspects of this process.
  14584. 'set hash'
  14585. This command controls whether a hash mark '#' is displayed while
  14586. downloading a file to the remote monitor. If on, a hash mark is
  14587. displayed after each S-record is successfully downloaded to the
  14588. monitor.
  14589. 'show hash'
  14590. Show the current status of displaying the hash mark.
  14591. 'set debug monitor'
  14592. Enable or disable display of communications messages between GDB
  14593. and the remote monitor.
  14594. 'show debug monitor'
  14595. Show the current status of displaying communications between GDB
  14596. and the remote monitor.
  14597. 'load FILENAME OFFSET'
  14598. Depending on what remote debugging facilities are configured into
  14599. GDB, the 'load' command may be available. Where it exists, it is
  14600. meant to make FILENAME (an executable) available for debugging on
  14601. the remote system--by downloading, or dynamic linking, for example.
  14602. 'load' also records the FILENAME symbol table in GDB, like the
  14603. 'add-symbol-file' command.
  14604. If your GDB does not have a 'load' command, attempting to execute
  14605. it gets the error message "'You can't do that when your target is
  14606. ...'"
  14607. The file is loaded at whatever address is specified in the
  14608. executable. For some object file formats, you can specify the load
  14609. address when you link the program; for other formats, like a.out,
  14610. the object file format specifies a fixed address.
  14611. It is also possible to tell GDB to load the executable file at a
  14612. specific offset described by the optional argument OFFSET. When
  14613. OFFSET is provided, FILENAME must also be provided.
  14614. Depending on the remote side capabilities, GDB may be able to load
  14615. programs into flash memory.
  14616. 'load' does not repeat if you press <RET> again after using it.
  14617. 'flash-erase'
  14618. Erases all known flash memory regions on the target.
  14619. 
  14620. File: gdb.info, Node: Byte Order, Prev: Target Commands, Up: Targets
  14621. 19.3 Choosing Target Byte Order
  14622. ===============================
  14623. Some types of processors, such as the MIPS, PowerPC, and Renesas SH,
  14624. offer the ability to run either big-endian or little-endian byte orders.
  14625. Usually the executable or symbol will include a bit to designate the
  14626. endian-ness, and you will not need to worry about which to use.
  14627. However, you may still find it useful to adjust GDB's idea of processor
  14628. endian-ness manually.
  14629. 'set endian big'
  14630. Instruct GDB to assume the target is big-endian.
  14631. 'set endian little'
  14632. Instruct GDB to assume the target is little-endian.
  14633. 'set endian auto'
  14634. Instruct GDB to use the byte order associated with the executable.
  14635. 'show endian'
  14636. Display GDB's current idea of the target byte order.
  14637. If the 'set endian auto' mode is in effect and no executable has been
  14638. selected, then the endianness used is the last one chosen either by one
  14639. of the 'set endian big' and 'set endian little' commands or by inferring
  14640. from the last executable used. If no endianness has been previously
  14641. chosen, then the default for this mode is inferred from the target GDB
  14642. has been built for, and is 'little' if the name of the target CPU has an
  14643. 'el' suffix and 'big' otherwise.
  14644. Note that these commands merely adjust interpretation of symbolic
  14645. data on the host, and that they have absolutely no effect on the target
  14646. system.
  14647. 
  14648. File: gdb.info, Node: Remote Debugging, Next: Configurations, Prev: Targets, Up: Top
  14649. 20 Debugging Remote Programs
  14650. ****************************
  14651. If you are trying to debug a program running on a machine that cannot
  14652. run GDB in the usual way, it is often useful to use remote debugging.
  14653. For example, you might use remote debugging on an operating system
  14654. kernel, or on a small system which does not have a general purpose
  14655. operating system powerful enough to run a full-featured debugger.
  14656. Some configurations of GDB have special serial or TCP/IP interfaces
  14657. to make this work with particular debugging targets. In addition, GDB
  14658. comes with a generic serial protocol (specific to GDB, but not specific
  14659. to any particular target system) which you can use if you write the
  14660. remote stubs--the code that runs on the remote system to communicate
  14661. with GDB.
  14662. Other remote targets may be available in your configuration of GDB;
  14663. use 'help target' to list them.
  14664. * Menu:
  14665. * Connecting:: Connecting to a remote target
  14666. * File Transfer:: Sending files to a remote system
  14667. * Server:: Using the gdbserver program
  14668. * Remote Configuration:: Remote configuration
  14669. * Remote Stub:: Implementing a remote stub
  14670. 
  14671. File: gdb.info, Node: Connecting, Next: File Transfer, Up: Remote Debugging
  14672. 20.1 Connecting to a Remote Target
  14673. ==================================
  14674. This section describes how to connect to a remote target, including the
  14675. types of connections and their differences, how to set up executable and
  14676. symbol files on the host and target, and the commands used for
  14677. connecting to and disconnecting from the remote target.
  14678. 20.1.1 Types of Remote Connections
  14679. ----------------------------------
  14680. GDB supports two types of remote connections, 'target remote' mode and
  14681. 'target extended-remote' mode. Note that many remote targets support
  14682. only 'target remote' mode. There are several major differences between
  14683. the two types of connections, enumerated here:
  14684. Result of detach or program exit
  14685. *With target remote mode:* When the debugged program exits or you
  14686. detach from it, GDB disconnects from the target. When using
  14687. 'gdbserver', 'gdbserver' will exit.
  14688. *With target extended-remote mode:* When the debugged program exits
  14689. or you detach from it, GDB remains connected to the target, even
  14690. though no program is running. You can rerun the program, attach to
  14691. a running program, or use 'monitor' commands specific to the
  14692. target.
  14693. When using 'gdbserver' in this case, it does not exit unless it was
  14694. invoked using the '--once' option. If the '--once' option was not
  14695. used, you can ask 'gdbserver' to exit using the 'monitor exit'
  14696. command (*note Monitor Commands for gdbserver::).
  14697. Specifying the program to debug
  14698. For both connection types you use the 'file' command to specify the
  14699. program on the host system. If you are using 'gdbserver' there are
  14700. some differences in how to specify the location of the program on
  14701. the target.
  14702. *With target remote mode:* You must either specify the program to
  14703. debug on the 'gdbserver' command line or use the '--attach' option
  14704. (*note Attaching to a Running Program: Attaching to a program.).
  14705. *With target extended-remote mode:* You may specify the program to
  14706. debug on the 'gdbserver' command line, or you can load the program
  14707. or attach to it using GDB commands after connecting to 'gdbserver'.
  14708. You can start 'gdbserver' without supplying an initial command to
  14709. run or process ID to attach. To do this, use the '--multi' command
  14710. line option. Then you can connect using 'target extended-remote'
  14711. and start the program you want to debug (see below for details on
  14712. using the 'run' command in this scenario). Note that the
  14713. conditions under which 'gdbserver' terminates depend on how GDB
  14714. connects to it ('target remote' or 'target extended-remote'). The
  14715. '--multi' option to 'gdbserver' has no influence on that.
  14716. The 'run' command
  14717. *With target remote mode:* The 'run' command is not supported.
  14718. Once a connection has been established, you can use all the usual
  14719. GDB commands to examine and change data. The remote program is
  14720. already running, so you can use commands like 'step' and
  14721. 'continue'.
  14722. *With target extended-remote mode:* The 'run' command is supported.
  14723. The 'run' command uses the value set by 'set remote exec-file'
  14724. (*note set remote exec-file::) to select the program to run.
  14725. Command line arguments are supported, except for wildcard expansion
  14726. and I/O redirection (*note Arguments::).
  14727. If you specify the program to debug on the command line, then the
  14728. 'run' command is not required to start execution, and you can
  14729. resume using commands like 'step' and 'continue' as with 'target
  14730. remote' mode.
  14731. Attaching
  14732. *With target remote mode:* The GDB command 'attach' is not
  14733. supported. To attach to a running program using 'gdbserver', you
  14734. must use the '--attach' option (*note Running gdbserver::).
  14735. *With target extended-remote mode:* To attach to a running program,
  14736. you may use the 'attach' command after the connection has been
  14737. established. If you are using 'gdbserver', you may also invoke
  14738. 'gdbserver' using the '--attach' option (*note Running
  14739. gdbserver::).
  14740. 20.1.2 Host and Target Files
  14741. ----------------------------
  14742. GDB, running on the host, needs access to symbol and debugging
  14743. information for your program running on the target. This requires
  14744. access to an unstripped copy of your program, and possibly any
  14745. associated symbol files. Note that this section applies equally to both
  14746. 'target remote' mode and 'target extended-remote' mode.
  14747. Some remote targets (*note qXfer executable filename read::, and
  14748. *note Host I/O Packets::) allow GDB to access program files over the
  14749. same connection used to communicate with GDB. With such a target, if
  14750. the remote program is unstripped, the only command you need is 'target
  14751. remote' (or 'target extended-remote').
  14752. If the remote program is stripped, or the target does not support
  14753. remote program file access, start up GDB using the name of the local
  14754. unstripped copy of your program as the first argument, or use the 'file'
  14755. command. Use 'set sysroot' to specify the location (on the host) of
  14756. target libraries (unless your GDB was compiled with the correct sysroot
  14757. using '--with-sysroot'). Alternatively, you may use 'set
  14758. solib-search-path' to specify how GDB locates target libraries.
  14759. The symbol file and target libraries must exactly match the
  14760. executable and libraries on the target, with one exception: the files on
  14761. the host system should not be stripped, even if the files on the target
  14762. system are. Mismatched or missing files will lead to confusing results
  14763. during debugging. On GNU/Linux targets, mismatched or missing files may
  14764. also prevent 'gdbserver' from debugging multi-threaded programs.
  14765. 20.1.3 Remote Connection Commands
  14766. ---------------------------------
  14767. GDB can communicate with the target over a serial line, a local Unix
  14768. domain socket, or over an IP network using TCP or UDP. In each case,
  14769. GDB uses the same protocol for debugging your program; only the medium
  14770. carrying the debugging packets varies. The 'target remote' and 'target
  14771. extended-remote' commands establish a connection to the target. Both
  14772. commands accept the same arguments, which indicate the medium to use:
  14773. 'target remote SERIAL-DEVICE'
  14774. 'target extended-remote SERIAL-DEVICE'
  14775. Use SERIAL-DEVICE to communicate with the target. For example, to
  14776. use a serial line connected to the device named '/dev/ttyb':
  14777. target remote /dev/ttyb
  14778. If you're using a serial line, you may want to give GDB the
  14779. '--baud' option, or use the 'set serial baud' command (*note set
  14780. serial baud: Remote Configuration.) before the 'target' command.
  14781. 'target remote LOCAL-SOCKET'
  14782. 'target extended-remote LOCAL-SOCKET'
  14783. Use LOCAL-SOCKET to communicate with the target. For example, to
  14784. use a local Unix domain socket bound to the file system entry
  14785. '/tmp/gdb-socket0':
  14786. target remote /tmp/gdb-socket0
  14787. Note that this command has the same form as the command to connect
  14788. to a serial line. GDB will automatically determine which kind of
  14789. file you have specified and will make the appropriate kind of
  14790. connection. This feature is not available if the host system does
  14791. not support Unix domain sockets.
  14792. 'target remote HOST:PORT'
  14793. 'target remote [HOST]:PORT'
  14794. 'target remote tcp:HOST:PORT'
  14795. 'target remote tcp:[HOST]:PORT'
  14796. 'target remote tcp4:HOST:PORT'
  14797. 'target remote tcp6:HOST:PORT'
  14798. 'target remote tcp6:[HOST]:PORT'
  14799. 'target extended-remote HOST:PORT'
  14800. 'target extended-remote [HOST]:PORT'
  14801. 'target extended-remote tcp:HOST:PORT'
  14802. 'target extended-remote tcp:[HOST]:PORT'
  14803. 'target extended-remote tcp4:HOST:PORT'
  14804. 'target extended-remote tcp6:HOST:PORT'
  14805. 'target extended-remote tcp6:[HOST]:PORT'
  14806. Debug using a TCP connection to PORT on HOST. The HOST may be
  14807. either a host name, a numeric IPv4 address, or a numeric IPv6
  14808. address (with or without the square brackets to separate the
  14809. address from the port); PORT must be a decimal number. The HOST
  14810. could be the target machine itself, if it is directly connected to
  14811. the net, or it might be a terminal server which in turn has a
  14812. serial line to the target.
  14813. For example, to connect to port 2828 on a terminal server named
  14814. 'manyfarms':
  14815. target remote manyfarms:2828
  14816. To connect to port 2828 on a terminal server whose address is
  14817. '2001:0db8:85a3:0000:0000:8a2e:0370:7334', you can either use the
  14818. square bracket syntax:
  14819. target remote [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:2828
  14820. or explicitly specify the IPv6 protocol:
  14821. target remote tcp6:2001:0db8:85a3:0000:0000:8a2e:0370:7334:2828
  14822. This last example may be confusing to the reader, because there is
  14823. no visible separation between the hostname and the port number.
  14824. Therefore, we recommend the user to provide IPv6 addresses using
  14825. square brackets for clarity. However, it is important to mention
  14826. that for GDB there is no ambiguity: the number after the last colon
  14827. is considered to be the port number.
  14828. If your remote target is actually running on the same machine as
  14829. your debugger session (e.g. a simulator for your target running on
  14830. the same host), you can omit the hostname. For example, to connect
  14831. to port 1234 on your local machine:
  14832. target remote :1234
  14833. Note that the colon is still required here.
  14834. 'target remote udp:HOST:PORT'
  14835. 'target remote udp:[HOST]:PORT'
  14836. 'target remote udp4:HOST:PORT'
  14837. 'target remote udp6:[HOST]:PORT'
  14838. 'target extended-remote udp:HOST:PORT'
  14839. 'target extended-remote udp:HOST:PORT'
  14840. 'target extended-remote udp:[HOST]:PORT'
  14841. 'target extended-remote udp4:HOST:PORT'
  14842. 'target extended-remote udp6:HOST:PORT'
  14843. 'target extended-remote udp6:[HOST]:PORT'
  14844. Debug using UDP packets to PORT on HOST. For example, to connect
  14845. to UDP port 2828 on a terminal server named 'manyfarms':
  14846. target remote udp:manyfarms:2828
  14847. When using a UDP connection for remote debugging, you should keep
  14848. in mind that the 'U' stands for "Unreliable". UDP can silently
  14849. drop packets on busy or unreliable networks, which will cause havoc
  14850. with your debugging session.
  14851. 'target remote | COMMAND'
  14852. 'target extended-remote | COMMAND'
  14853. Run COMMAND in the background and communicate with it using a pipe.
  14854. The COMMAND is a shell command, to be parsed and expanded by the
  14855. system's command shell, '/bin/sh'; it should expect remote protocol
  14856. packets on its standard input, and send replies on its standard
  14857. output. You could use this to run a stand-alone simulator that
  14858. speaks the remote debugging protocol, to make net connections using
  14859. programs like 'ssh', or for other similar tricks.
  14860. If COMMAND closes its standard output (perhaps by exiting), GDB
  14861. will try to send it a 'SIGTERM' signal. (If the program has
  14862. already exited, this will have no effect.)
  14863. Whenever GDB is waiting for the remote program, if you type the
  14864. interrupt character (often 'Ctrl-c'), GDB attempts to stop the program.
  14865. This may or may not succeed, depending in part on the hardware and the
  14866. serial drivers the remote system uses. If you type the interrupt
  14867. character once again, GDB displays this prompt:
  14868. Interrupted while waiting for the program.
  14869. Give up (and stop debugging it)? (y or n)
  14870. In 'target remote' mode, if you type 'y', GDB abandons the remote
  14871. debugging session. (If you decide you want to try again later, you can
  14872. use 'target remote' again to connect once more.) If you type 'n', GDB
  14873. goes back to waiting.
  14874. In 'target extended-remote' mode, typing 'n' will leave GDB connected
  14875. to the target.
  14876. 'detach'
  14877. When you have finished debugging the remote program, you can use
  14878. the 'detach' command to release it from GDB control. Detaching
  14879. from the target normally resumes its execution, but the results
  14880. will depend on your particular remote stub. After the 'detach'
  14881. command in 'target remote' mode, GDB is free to connect to another
  14882. target. In 'target extended-remote' mode, GDB is still connected
  14883. to the target.
  14884. 'disconnect'
  14885. The 'disconnect' command closes the connection to the target, and
  14886. the target is generally not resumed. It will wait for GDB (this
  14887. instance or another one) to connect and continue debugging. After
  14888. the 'disconnect' command, GDB is again free to connect to another
  14889. target.
  14890. 'monitor CMD'
  14891. This command allows you to send arbitrary commands directly to the
  14892. remote monitor. Since GDB doesn't care about the commands it sends
  14893. like this, this command is the way to extend GDB--you can add new
  14894. commands that only the external monitor will understand and
  14895. implement.
  14896. 
  14897. File: gdb.info, Node: File Transfer, Next: Server, Prev: Connecting, Up: Remote Debugging
  14898. 20.2 Sending files to a remote system
  14899. =====================================
  14900. Some remote targets offer the ability to transfer files over the same
  14901. connection used to communicate with GDB. This is convenient for targets
  14902. accessible through other means, e.g. GNU/Linux systems running
  14903. 'gdbserver' over a network interface. For other targets, e.g. embedded
  14904. devices with only a single serial port, this may be the only way to
  14905. upload or download files.
  14906. Not all remote targets support these commands.
  14907. 'remote put HOSTFILE TARGETFILE'
  14908. Copy file HOSTFILE from the host system (the machine running GDB)
  14909. to TARGETFILE on the target system.
  14910. 'remote get TARGETFILE HOSTFILE'
  14911. Copy file TARGETFILE from the target system to HOSTFILE on the host
  14912. system.
  14913. 'remote delete TARGETFILE'
  14914. Delete TARGETFILE from the target system.
  14915. 
  14916. File: gdb.info, Node: Server, Next: Remote Configuration, Prev: File Transfer, Up: Remote Debugging
  14917. 20.3 Using the 'gdbserver' Program
  14918. ==================================
  14919. 'gdbserver' is a control program for Unix-like systems, which allows you
  14920. to connect your program with a remote GDB via 'target remote' or 'target
  14921. extended-remote'--but without linking in the usual debugging stub.
  14922. 'gdbserver' is not a complete replacement for the debugging stubs,
  14923. because it requires essentially the same operating-system facilities
  14924. that GDB itself does. In fact, a system that can run 'gdbserver' to
  14925. connect to a remote GDB could also run GDB locally! 'gdbserver' is
  14926. sometimes useful nevertheless, because it is a much smaller program than
  14927. GDB itself. It is also easier to port than all of GDB, so you may be
  14928. able to get started more quickly on a new system by using 'gdbserver'.
  14929. Finally, if you develop code for real-time systems, you may find that
  14930. the tradeoffs involved in real-time operation make it more convenient to
  14931. do as much development work as possible on another system, for example
  14932. by cross-compiling. You can use 'gdbserver' to make a similar choice
  14933. for debugging.
  14934. GDB and 'gdbserver' communicate via either a serial line or a TCP
  14935. connection, using the standard GDB remote serial protocol.
  14936. _Warning:_ 'gdbserver' does not have any built-in security. Do not
  14937. run 'gdbserver' connected to any public network; a GDB connection
  14938. to 'gdbserver' provides access to the target system with the same
  14939. privileges as the user running 'gdbserver'.
  14940. 20.3.1 Running 'gdbserver'
  14941. --------------------------
  14942. Run 'gdbserver' on the target system. You need a copy of the program
  14943. you want to debug, including any libraries it requires. 'gdbserver'
  14944. does not need your program's symbol table, so you can strip the program
  14945. if necessary to save space. GDB on the host system does all the symbol
  14946. handling.
  14947. To use the server, you must tell it how to communicate with GDB; the
  14948. name of your program; and the arguments for your program. The usual
  14949. syntax is:
  14950. target> gdbserver COMM PROGRAM [ ARGS ... ]
  14951. COMM is either a device name (to use a serial line), or a TCP
  14952. hostname and portnumber, or '-' or 'stdio' to use stdin/stdout of
  14953. 'gdbserver'. For example, to debug Emacs with the argument 'foo.txt'
  14954. and communicate with GDB over the serial port '/dev/com1':
  14955. target> gdbserver /dev/com1 emacs foo.txt
  14956. 'gdbserver' waits passively for the host GDB to communicate with it.
  14957. To use a TCP connection instead of a serial line:
  14958. target> gdbserver host:2345 emacs foo.txt
  14959. The only difference from the previous example is the first argument,
  14960. specifying that you are communicating with the host GDB via TCP. The
  14961. 'host:2345' argument means that 'gdbserver' is to expect a TCP
  14962. connection from machine 'host' to local TCP port 2345. (Currently, the
  14963. 'host' part is ignored.) You can choose any number you want for the
  14964. port number as long as it does not conflict with any TCP ports already
  14965. in use on the target system (for example, '23' is reserved for
  14966. 'telnet').(1) You must use the same port number with the host GDB
  14967. 'target remote' command.
  14968. The 'stdio' connection is useful when starting 'gdbserver' with ssh:
  14969. (gdb) target remote | ssh -T hostname gdbserver - hello
  14970. The '-T' option to ssh is provided because we don't need a remote
  14971. pty, and we don't want escape-character handling. Ssh does this by
  14972. default when a command is provided, the flag is provided to make it
  14973. explicit. You could elide it if you want to.
  14974. Programs started with stdio-connected gdbserver have '/dev/null' for
  14975. 'stdin', and 'stdout','stderr' are sent back to gdb for display through
  14976. a pipe connected to gdbserver. Both 'stdout' and 'stderr' use the same
  14977. pipe.
  14978. 20.3.1.1 Attaching to a Running Program
  14979. .......................................
  14980. On some targets, 'gdbserver' can also attach to running programs. This
  14981. is accomplished via the '--attach' argument. The syntax is:
  14982. target> gdbserver --attach COMM PID
  14983. PID is the process ID of a currently running process. It isn't
  14984. necessary to point 'gdbserver' at a binary for the running process.
  14985. In 'target extended-remote' mode, you can also attach using the GDB
  14986. attach command (*note Attaching in Types of Remote Connections::).
  14987. You can debug processes by name instead of process ID if your target
  14988. has the 'pidof' utility:
  14989. target> gdbserver --attach COMM `pidof PROGRAM`
  14990. In case more than one copy of PROGRAM is running, or PROGRAM has
  14991. multiple threads, most versions of 'pidof' support the '-s' option to
  14992. only return the first process ID.
  14993. 20.3.1.2 TCP port allocation lifecycle of 'gdbserver'
  14994. .....................................................
  14995. This section applies only when 'gdbserver' is run to listen on a TCP
  14996. port.
  14997. 'gdbserver' normally terminates after all of its debugged processes
  14998. have terminated in 'target remote' mode. On the other hand, for 'target
  14999. extended-remote', 'gdbserver' stays running even with no processes left.
  15000. GDB normally terminates the spawned debugged process on its exit, which
  15001. normally also terminates 'gdbserver' in the 'target remote' mode.
  15002. Therefore, when the connection drops unexpectedly, and GDB cannot ask
  15003. 'gdbserver' to kill its debugged processes, 'gdbserver' stays running
  15004. even in the 'target remote' mode.
  15005. When 'gdbserver' stays running, GDB can connect to it again later.
  15006. Such reconnecting is useful for features like *note disconnected
  15007. tracing::. For completeness, at most one GDB can be connected at a
  15008. time.
  15009. By default, 'gdbserver' keeps the listening TCP port open, so that
  15010. subsequent connections are possible. However, if you start 'gdbserver'
  15011. with the '--once' option, it will stop listening for any further
  15012. connection attempts after connecting to the first GDB session. This
  15013. means no further connections to 'gdbserver' will be possible after the
  15014. first one. It also means 'gdbserver' will terminate after the first
  15015. connection with remote GDB has closed, even for unexpectedly closed
  15016. connections and even in the 'target extended-remote' mode. The '--once'
  15017. option allows reusing the same port number for connecting to multiple
  15018. instances of 'gdbserver' running on the same host, since each instance
  15019. closes its port after the first connection.
  15020. 20.3.1.3 Other Command-Line Arguments for 'gdbserver'
  15021. .....................................................
  15022. You can use the '--multi' option to start 'gdbserver' without specifying
  15023. a program to debug or a process to attach to. Then you can attach in
  15024. 'target extended-remote' mode and run or attach to a program. For more
  15025. information, *note --multi Option in Types of Remote Connnections::.
  15026. The '--debug' option tells 'gdbserver' to display extra status
  15027. information about the debugging process. The '--remote-debug' option
  15028. tells 'gdbserver' to display remote protocol debug output. The
  15029. '--debug-file=FILENAME' option tells 'gdbserver' to write any debug
  15030. output to the given FILENAME. These options are intended for
  15031. 'gdbserver' development and for bug reports to the developers.
  15032. The '--debug-format=option1[,option2,...]' option tells 'gdbserver'
  15033. to include additional information in each output. Possible options are:
  15034. 'none'
  15035. Turn off all extra information in debugging output.
  15036. 'all'
  15037. Turn on all extra information in debugging output.
  15038. 'timestamps'
  15039. Include a timestamp in each line of debugging output.
  15040. Options are processed in order. Thus, for example, if 'none' appears
  15041. last then no additional information is added to debugging output.
  15042. The '--wrapper' option specifies a wrapper to launch programs for
  15043. debugging. The option should be followed by the name of the wrapper,
  15044. then any command-line arguments to pass to the wrapper, then '--'
  15045. indicating the end of the wrapper arguments.
  15046. 'gdbserver' runs the specified wrapper program with a combined
  15047. command line including the wrapper arguments, then the name of the
  15048. program to debug, then any arguments to the program. The wrapper runs
  15049. until it executes your program, and then GDB gains control.
  15050. You can use any program that eventually calls 'execve' with its
  15051. arguments as a wrapper. Several standard Unix utilities do this, e.g.
  15052. 'env' and 'nohup'. Any Unix shell script ending with 'exec "$@"' will
  15053. also work.
  15054. For example, you can use 'env' to pass an environment variable to the
  15055. debugged program, without setting the variable in 'gdbserver''s
  15056. environment:
  15057. $ gdbserver --wrapper env LD_PRELOAD=libtest.so -- :2222 ./testprog
  15058. The '--selftest' option runs the self tests in 'gdbserver':
  15059. $ gdbserver --selftest
  15060. Ran 2 unit tests, 0 failed
  15061. These tests are disabled in release.
  15062. 20.3.2 Connecting to 'gdbserver'
  15063. --------------------------------
  15064. The basic procedure for connecting to the remote target is:
  15065. * Run GDB on the host system.
  15066. * Make sure you have the necessary symbol files (*note Host and
  15067. target files::). Load symbols for your application using the
  15068. 'file' command before you connect. Use 'set sysroot' to locate
  15069. target libraries (unless your GDB was compiled with the correct
  15070. sysroot using '--with-sysroot').
  15071. * Connect to your target (*note Connecting to a Remote Target:
  15072. Connecting.). For TCP connections, you must start up 'gdbserver'
  15073. prior to using the 'target' command. Otherwise you may get an
  15074. error whose text depends on the host system, but which usually
  15075. looks something like 'Connection refused'. Don't use the 'load'
  15076. command in GDB when using 'target remote' mode, since the program
  15077. is already on the target.
  15078. 20.3.3 Monitor Commands for 'gdbserver'
  15079. ---------------------------------------
  15080. During a GDB session using 'gdbserver', you can use the 'monitor'
  15081. command to send special requests to 'gdbserver'. Here are the available
  15082. commands.
  15083. 'monitor help'
  15084. List the available monitor commands.
  15085. 'monitor set debug 0'
  15086. 'monitor set debug 1'
  15087. Disable or enable general debugging messages.
  15088. 'monitor set remote-debug 0'
  15089. 'monitor set remote-debug 1'
  15090. Disable or enable specific debugging messages associated with the
  15091. remote protocol (*note Remote Protocol::).
  15092. 'monitor set debug-file filename'
  15093. 'monitor set debug-file'
  15094. Send any debug output to the given file, or to stderr.
  15095. 'monitor set debug-format option1[,option2,...]'
  15096. Specify additional text to add to debugging messages. Possible
  15097. options are:
  15098. 'none'
  15099. Turn off all extra information in debugging output.
  15100. 'all'
  15101. Turn on all extra information in debugging output.
  15102. 'timestamps'
  15103. Include a timestamp in each line of debugging output.
  15104. Options are processed in order. Thus, for example, if 'none'
  15105. appears last then no additional information is added to debugging
  15106. output.
  15107. 'monitor set libthread-db-search-path [PATH]'
  15108. When this command is issued, PATH is a colon-separated list of
  15109. directories to search for 'libthread_db' (*note set
  15110. libthread-db-search-path: Threads.). If you omit PATH,
  15111. 'libthread-db-search-path' will be reset to its default value.
  15112. The special entry '$pdir' for 'libthread-db-search-path' is not
  15113. supported in 'gdbserver'.
  15114. 'monitor exit'
  15115. Tell gdbserver to exit immediately. This command should be
  15116. followed by 'disconnect' to close the debugging session.
  15117. 'gdbserver' will detach from any attached processes and kill any
  15118. processes it created. Use 'monitor exit' to terminate 'gdbserver'
  15119. at the end of a multi-process mode debug session.
  15120. 20.3.4 Tracepoints support in 'gdbserver'
  15121. -----------------------------------------
  15122. On some targets, 'gdbserver' supports tracepoints, fast tracepoints and
  15123. static tracepoints.
  15124. For fast or static tracepoints to work, a special library called the
  15125. "in-process agent" (IPA), must be loaded in the inferior process. This
  15126. library is built and distributed as an integral part of 'gdbserver'. In
  15127. addition, support for static tracepoints requires building the
  15128. in-process agent library with static tracepoints support. At present,
  15129. the UST (LTTng Userspace Tracer, <http://lttng.org/ust>) tracing engine
  15130. is supported. This support is automatically available if UST
  15131. development headers are found in the standard include path when
  15132. 'gdbserver' is built, or if 'gdbserver' was explicitly configured using
  15133. '--with-ust' to point at such headers. You can explicitly disable the
  15134. support using '--with-ust=no'.
  15135. There are several ways to load the in-process agent in your program:
  15136. 'Specifying it as dependency at link time'
  15137. You can link your program dynamically with the in-process agent
  15138. library. On most systems, this is accomplished by adding
  15139. '-linproctrace' to the link command.
  15140. 'Using the system's preloading mechanisms'
  15141. You can force loading the in-process agent at startup time by using
  15142. your system's support for preloading shared libraries. Many Unixes
  15143. support the concept of preloading user defined libraries. In most
  15144. cases, you do that by specifying 'LD_PRELOAD=libinproctrace.so' in
  15145. the environment. See also the description of 'gdbserver''s
  15146. '--wrapper' command line option.
  15147. 'Using GDB to force loading the agent at run time'
  15148. On some systems, you can force the inferior to load a shared
  15149. library, by calling a dynamic loader function in the inferior that
  15150. takes care of dynamically looking up and loading a shared library.
  15151. On most Unix systems, the function is 'dlopen'. You'll use the
  15152. 'call' command for that. For example:
  15153. (gdb) call dlopen ("libinproctrace.so", ...)
  15154. Note that on most Unix systems, for the 'dlopen' function to be
  15155. available, the program needs to be linked with '-ldl'.
  15156. On systems that have a userspace dynamic loader, like most Unix
  15157. systems, when you connect to 'gdbserver' using 'target remote', you'll
  15158. find that the program is stopped at the dynamic loader's entry point,
  15159. and no shared library has been loaded in the program's address space
  15160. yet, including the in-process agent. In that case, before being able to
  15161. use any of the fast or static tracepoints features, you need to let the
  15162. loader run and load the shared libraries. The simplest way to do that
  15163. is to run the program to the main procedure. E.g., if debugging a C or
  15164. C++ program, start 'gdbserver' like so:
  15165. $ gdbserver :9999 myprogram
  15166. Start GDB and connect to 'gdbserver' like so, and run to main:
  15167. $ gdb myprogram
  15168. (gdb) target remote myhost:9999
  15169. 0x00007f215893ba60 in ?? () from /lib64/ld-linux-x86-64.so.2
  15170. (gdb) b main
  15171. (gdb) continue
  15172. The in-process tracing agent library should now be loaded into the
  15173. process; you can confirm it with the 'info sharedlibrary' command, which
  15174. will list 'libinproctrace.so' as loaded in the process. You are now
  15175. ready to install fast tracepoints, list static tracepoint markers, probe
  15176. static tracepoints markers, and start tracing.
  15177. ---------- Footnotes ----------
  15178. (1) If you choose a port number that conflicts with another service,
  15179. 'gdbserver' prints an error message and exits.
  15180. 
  15181. File: gdb.info, Node: Remote Configuration, Next: Remote Stub, Prev: Server, Up: Remote Debugging
  15182. 20.4 Remote Configuration
  15183. =========================
  15184. This section documents the configuration options available when
  15185. debugging remote programs. For the options related to the File I/O
  15186. extensions of the remote protocol, see *note system-call-allowed:
  15187. system.
  15188. 'set remoteaddresssize BITS'
  15189. Set the maximum size of address in a memory packet to the specified
  15190. number of bits. GDB will mask off the address bits above that
  15191. number, when it passes addresses to the remote target. The default
  15192. value is the number of bits in the target's address.
  15193. 'show remoteaddresssize'
  15194. Show the current value of remote address size in bits.
  15195. 'set serial baud N'
  15196. Set the baud rate for the remote serial I/O to N baud. The value
  15197. is used to set the speed of the serial port used for debugging
  15198. remote targets.
  15199. 'show serial baud'
  15200. Show the current speed of the remote connection.
  15201. 'set serial parity PARITY'
  15202. Set the parity for the remote serial I/O. Supported values of
  15203. PARITY are: 'even', 'none', and 'odd'. The default is 'none'.
  15204. 'show serial parity'
  15205. Show the current parity of the serial port.
  15206. 'set remotebreak'
  15207. If set to on, GDB sends a 'BREAK' signal to the remote when you
  15208. type 'Ctrl-c' to interrupt the program running on the remote. If
  15209. set to off, GDB sends the 'Ctrl-C' character instead. The default
  15210. is off, since most remote systems expect to see 'Ctrl-C' as the
  15211. interrupt signal.
  15212. 'show remotebreak'
  15213. Show whether GDB sends 'BREAK' or 'Ctrl-C' to interrupt the remote
  15214. program.
  15215. 'set remoteflow on'
  15216. 'set remoteflow off'
  15217. Enable or disable hardware flow control ('RTS'/'CTS') on the serial
  15218. port used to communicate to the remote target.
  15219. 'show remoteflow'
  15220. Show the current setting of hardware flow control.
  15221. 'set remotelogbase BASE'
  15222. Set the base (a.k.a. radix) of logging serial protocol
  15223. communications to BASE. Supported values of BASE are: 'ascii',
  15224. 'octal', and 'hex'. The default is 'ascii'.
  15225. 'show remotelogbase'
  15226. Show the current setting of the radix for logging remote serial
  15227. protocol.
  15228. 'set remotelogfile FILE'
  15229. Record remote serial communications on the named FILE. The default
  15230. is not to record at all.
  15231. 'show remotelogfile'
  15232. Show the current setting of the file name on which to record the
  15233. serial communications.
  15234. 'set remotetimeout NUM'
  15235. Set the timeout limit to wait for the remote target to respond to
  15236. NUM seconds. The default is 2 seconds.
  15237. 'show remotetimeout'
  15238. Show the current number of seconds to wait for the remote target
  15239. responses.
  15240. 'set remote hardware-watchpoint-limit LIMIT'
  15241. 'set remote hardware-breakpoint-limit LIMIT'
  15242. Restrict GDB to using LIMIT remote hardware watchpoints or
  15243. breakpoints. The LIMIT can be set to 0 to disable hardware
  15244. watchpoints or breakpoints, and 'unlimited' for unlimited
  15245. watchpoints or breakpoints.
  15246. 'show remote hardware-watchpoint-limit'
  15247. 'show remote hardware-breakpoint-limit'
  15248. Show the current limit for the number of hardware watchpoints or
  15249. breakpoints that GDB can use.
  15250. 'set remote hardware-watchpoint-length-limit LIMIT'
  15251. Restrict GDB to using LIMIT bytes for the maximum length of a
  15252. remote hardware watchpoint. A LIMIT of 0 disables hardware
  15253. watchpoints and 'unlimited' allows watchpoints of any length.
  15254. 'show remote hardware-watchpoint-length-limit'
  15255. Show the current limit (in bytes) of the maximum length of a remote
  15256. hardware watchpoint.
  15257. 'set remote exec-file FILENAME'
  15258. 'show remote exec-file'
  15259. Select the file used for 'run' with 'target extended-remote'. This
  15260. should be set to a filename valid on the target system. If it is
  15261. not set, the target will use a default filename (e.g. the last
  15262. program run).
  15263. 'set remote interrupt-sequence'
  15264. Allow the user to select one of 'Ctrl-C', a 'BREAK' or 'BREAK-g' as
  15265. the sequence to the remote target in order to interrupt the
  15266. execution. 'Ctrl-C' is a default. Some system prefers 'BREAK'
  15267. which is high level of serial line for some certain time. Linux
  15268. kernel prefers 'BREAK-g', a.k.a Magic SysRq g. It is 'BREAK'
  15269. signal followed by character 'g'.
  15270. 'show interrupt-sequence'
  15271. Show which of 'Ctrl-C', 'BREAK' or 'BREAK-g' is sent by GDB to
  15272. interrupt the remote program. 'BREAK-g' is BREAK signal followed
  15273. by 'g' and also known as Magic SysRq g.
  15274. 'set remote interrupt-on-connect'
  15275. Specify whether interrupt-sequence is sent to remote target when
  15276. GDB connects to it. This is mostly needed when you debug Linux
  15277. kernel. Linux kernel expects 'BREAK' followed by 'g' which is
  15278. known as Magic SysRq g in order to connect GDB.
  15279. 'show interrupt-on-connect'
  15280. Show whether interrupt-sequence is sent to remote target when GDB
  15281. connects to it.
  15282. 'set tcp auto-retry on'
  15283. Enable auto-retry for remote TCP connections. This is useful if
  15284. the remote debugging agent is launched in parallel with GDB; there
  15285. is a race condition because the agent may not become ready to
  15286. accept the connection before GDB attempts to connect. When
  15287. auto-retry is enabled, if the initial attempt to connect fails, GDB
  15288. reattempts to establish the connection using the timeout specified
  15289. by 'set tcp connect-timeout'.
  15290. 'set tcp auto-retry off'
  15291. Do not auto-retry failed TCP connections.
  15292. 'show tcp auto-retry'
  15293. Show the current auto-retry setting.
  15294. 'set tcp connect-timeout SECONDS'
  15295. 'set tcp connect-timeout unlimited'
  15296. Set the timeout for establishing a TCP connection to the remote
  15297. target to SECONDS. The timeout affects both polling to retry
  15298. failed connections (enabled by 'set tcp auto-retry on') and waiting
  15299. for connections that are merely slow to complete, and represents an
  15300. approximate cumulative value. If SECONDS is 'unlimited', there is
  15301. no timeout and GDB will keep attempting to establish a connection
  15302. forever, unless interrupted with 'Ctrl-c'. The default is 15
  15303. seconds.
  15304. 'show tcp connect-timeout'
  15305. Show the current connection timeout setting.
  15306. The GDB remote protocol autodetects the packets supported by your
  15307. debugging stub. If you need to override the autodetection, you can use
  15308. these commands to enable or disable individual packets. Each packet can
  15309. be set to 'on' (the remote target supports this packet), 'off' (the
  15310. remote target does not support this packet), or 'auto' (detect remote
  15311. target support for this packet). They all default to 'auto'. For more
  15312. information about each packet, see *note Remote Protocol::.
  15313. During normal use, you should not have to use any of these commands.
  15314. If you do, that may be a bug in your remote debugging stub, or a bug in
  15315. GDB. You may want to report the problem to the GDB developers.
  15316. For each packet NAME, the command to enable or disable the packet is
  15317. 'set remote NAME-packet'. The available settings are:
  15318. Command Name Remote Packet Related Features
  15319. 'fetch-register' 'p' 'info registers'
  15320. 'set-register' 'P' 'set'
  15321. 'binary-download' 'X' 'load', 'set'
  15322. 'read-aux-vector' 'qXfer:auxv:read' 'info auxv'
  15323. 'symbol-lookup' 'qSymbol' Detecting
  15324. multiple threads
  15325. 'attach' 'vAttach' 'attach'
  15326. 'verbose-resume' 'vCont' Stepping or
  15327. resuming
  15328. multiple threads
  15329. 'run' 'vRun' 'run'
  15330. 'software-breakpoint''Z0' 'break'
  15331. 'hardware-breakpoint''Z1' 'hbreak'
  15332. 'write-watchpoint' 'Z2' 'watch'
  15333. 'read-watchpoint' 'Z3' 'rwatch'
  15334. 'access-watchpoint' 'Z4' 'awatch'
  15335. 'pid-to-exec-file' 'qXfer:exec-file:read' 'attach', 'run'
  15336. 'target-features' 'qXfer:features:read' 'set
  15337. architecture'
  15338. 'library-info' 'qXfer:libraries:read' 'info
  15339. sharedlibrary'
  15340. 'memory-map' 'qXfer:memory-map:read' 'info mem'
  15341. 'read-sdata-object' 'qXfer:sdata:read' 'print $_sdata'
  15342. 'read-siginfo-object''qXfer:siginfo:read' 'print
  15343. $_siginfo'
  15344. 'write-siginfo-object''qXfer:siginfo:write' 'set $_siginfo'
  15345. 'threads' 'qXfer:threads:read' 'info threads'
  15346. 'get-thread-local- 'qGetTLSAddr' Displaying
  15347. storage-address' '__thread'
  15348. variables
  15349. 'get-thread-information-block-address''qGetTIBAddr'Display
  15350. MS-Windows
  15351. Thread
  15352. Information
  15353. Block.
  15354. 'search-memory' 'qSearch:memory' 'find'
  15355. 'supported-packets' 'qSupported' Remote
  15356. communications
  15357. parameters
  15358. 'catch-syscalls' 'QCatchSyscalls' 'catch syscall'
  15359. 'pass-signals' 'QPassSignals' 'handle SIGNAL'
  15360. 'program-signals' 'QProgramSignals' 'handle SIGNAL'
  15361. 'hostio-close-packet''vFile:close' 'remote get',
  15362. 'remote put'
  15363. 'hostio-open-packet' 'vFile:open' 'remote get',
  15364. 'remote put'
  15365. 'hostio-pread-packet''vFile:pread' 'remote get',
  15366. 'remote put'
  15367. 'hostio-pwrite-packet''vFile:pwrite' 'remote get',
  15368. 'remote put'
  15369. 'hostio-unlink-packet''vFile:unlink' 'remote delete'
  15370. 'hostio-readlink-packet''vFile:readlink' Host I/O
  15371. 'hostio-fstat-packet''vFile:fstat' Host I/O
  15372. 'hostio-setfs-packet''vFile:setfs' Host I/O
  15373. 'noack-packet' 'QStartNoAckMode' Packet
  15374. acknowledgment
  15375. 'osdata' 'qXfer:osdata:read' 'info os'
  15376. 'query-attached' 'qAttached' Querying remote
  15377. process attach
  15378. state.
  15379. 'trace-buffer-size' 'QTBuffer:size' 'set
  15380. trace-buffer-size'
  15381. 'trace-status' 'qTStatus' 'tstatus'
  15382. 'traceframe-info' 'qXfer:traceframe-info:read'Traceframe info
  15383. 'install-in-trace' 'InstallInTrace' Install
  15384. tracepoint in
  15385. tracing
  15386. 'disable-randomization''QDisableRandomization''set
  15387. disable-randomization'
  15388. 'startup-with-shell' 'QStartupWithShell' 'set
  15389. startup-with-shell'
  15390. 'environment-hex-encoded''QEnvironmentHexEncoded''set
  15391. environment'
  15392. 'environment-unset' 'QEnvironmentUnset' 'unset
  15393. environment'
  15394. 'environment-reset' 'QEnvironmentReset' 'Reset the
  15395. inferior
  15396. environment
  15397. (i.e., unset
  15398. user-set
  15399. variables)'
  15400. 'set-working-dir' 'QSetWorkingDir' 'set cwd'
  15401. 'conditional-breakpoints-packet''Z0 and Z1' 'Support for
  15402. target-side
  15403. breakpoint
  15404. condition
  15405. evaluation'
  15406. 'multiprocess-extensions''multiprocess Debug multiple
  15407. extensions' processes and
  15408. remote process
  15409. PID awareness
  15410. 'swbreak-feature' 'swbreak stop reason' 'break'
  15411. 'hwbreak-feature' 'hwbreak stop reason' 'hbreak'
  15412. 'fork-event-feature' 'fork stop reason' 'fork'
  15413. 'vfork-event-feature''vfork stop reason' 'vfork'
  15414. 'exec-event-feature' 'exec stop reason' 'exec'
  15415. 'thread-events' 'QThreadEvents' Tracking thread
  15416. lifetime.
  15417. 'no-resumed-stop-reply''no resumed thread Tracking thread
  15418. left stop reply' lifetime.
  15419. 
  15420. File: gdb.info, Node: Remote Stub, Prev: Remote Configuration, Up: Remote Debugging
  15421. 20.5 Implementing a Remote Stub
  15422. ===============================
  15423. The stub files provided with GDB implement the target side of the
  15424. communication protocol, and the GDB side is implemented in the GDB
  15425. source file 'remote.c'. Normally, you can simply allow these
  15426. subroutines to communicate, and ignore the details. (If you're
  15427. implementing your own stub file, you can still ignore the details: start
  15428. with one of the existing stub files. 'sparc-stub.c' is the best
  15429. organized, and therefore the easiest to read.)
  15430. To debug a program running on another machine (the debugging "target"
  15431. machine), you must first arrange for all the usual prerequisites for the
  15432. program to run by itself. For example, for a C program, you need:
  15433. 1. A startup routine to set up the C runtime environment; these
  15434. usually have a name like 'crt0'. The startup routine may be
  15435. supplied by your hardware supplier, or you may have to write your
  15436. own.
  15437. 2. A C subroutine library to support your program's subroutine calls,
  15438. notably managing input and output.
  15439. 3. A way of getting your program to the other machine--for example, a
  15440. download program. These are often supplied by the hardware
  15441. manufacturer, but you may have to write your own from hardware
  15442. documentation.
  15443. The next step is to arrange for your program to use a serial port to
  15444. communicate with the machine where GDB is running (the "host" machine).
  15445. In general terms, the scheme looks like this:
  15446. _On the host,_
  15447. GDB already understands how to use this protocol; when everything
  15448. else is set up, you can simply use the 'target remote' command
  15449. (*note Specifying a Debugging Target: Targets.).
  15450. _On the target,_
  15451. you must link with your program a few special-purpose subroutines
  15452. that implement the GDB remote serial protocol. The file containing
  15453. these subroutines is called a "debugging stub".
  15454. On certain remote targets, you can use an auxiliary program
  15455. 'gdbserver' instead of linking a stub into your program. *Note
  15456. Using the 'gdbserver' Program: Server, for details.
  15457. The debugging stub is specific to the architecture of the remote
  15458. machine; for example, use 'sparc-stub.c' to debug programs on SPARC
  15459. boards.
  15460. These working remote stubs are distributed with GDB:
  15461. 'i386-stub.c'
  15462. For Intel 386 and compatible architectures.
  15463. 'm68k-stub.c'
  15464. For Motorola 680x0 architectures.
  15465. 'sh-stub.c'
  15466. For Renesas SH architectures.
  15467. 'sparc-stub.c'
  15468. For SPARC architectures.
  15469. 'sparcl-stub.c'
  15470. For Fujitsu SPARCLITE architectures.
  15471. The 'README' file in the GDB distribution may list other recently
  15472. added stubs.
  15473. * Menu:
  15474. * Stub Contents:: What the stub can do for you
  15475. * Bootstrapping:: What you must do for the stub
  15476. * Debug Session:: Putting it all together
  15477. 
  15478. File: gdb.info, Node: Stub Contents, Next: Bootstrapping, Up: Remote Stub
  15479. 20.5.1 What the Stub Can Do for You
  15480. -----------------------------------
  15481. The debugging stub for your architecture supplies these three
  15482. subroutines:
  15483. 'set_debug_traps'
  15484. This routine arranges for 'handle_exception' to run when your
  15485. program stops. You must call this subroutine explicitly in your
  15486. program's startup code.
  15487. 'handle_exception'
  15488. This is the central workhorse, but your program never calls it
  15489. explicitly--the setup code arranges for 'handle_exception' to run
  15490. when a trap is triggered.
  15491. 'handle_exception' takes control when your program stops during
  15492. execution (for example, on a breakpoint), and mediates
  15493. communications with GDB on the host machine. This is where the
  15494. communications protocol is implemented; 'handle_exception' acts as
  15495. the GDB representative on the target machine. It begins by sending
  15496. summary information on the state of your program, then continues to
  15497. execute, retrieving and transmitting any information GDB needs,
  15498. until you execute a GDB command that makes your program resume; at
  15499. that point, 'handle_exception' returns control to your own code on
  15500. the target machine.
  15501. 'breakpoint'
  15502. Use this auxiliary subroutine to make your program contain a
  15503. breakpoint. Depending on the particular situation, this may be the
  15504. only way for GDB to get control. For instance, if your target
  15505. machine has some sort of interrupt button, you won't need to call
  15506. this; pressing the interrupt button transfers control to
  15507. 'handle_exception'--in effect, to GDB. On some machines, simply
  15508. receiving characters on the serial port may also trigger a trap;
  15509. again, in that situation, you don't need to call 'breakpoint' from
  15510. your own program--simply running 'target remote' from the host GDB
  15511. session gets control.
  15512. Call 'breakpoint' if none of these is true, or if you simply want
  15513. to make certain your program stops at a predetermined point for the
  15514. start of your debugging session.
  15515. 
  15516. File: gdb.info, Node: Bootstrapping, Next: Debug Session, Prev: Stub Contents, Up: Remote Stub
  15517. 20.5.2 What You Must Do for the Stub
  15518. ------------------------------------
  15519. The debugging stubs that come with GDB are set up for a particular chip
  15520. architecture, but they have no information about the rest of your
  15521. debugging target machine.
  15522. First of all you need to tell the stub how to communicate with the
  15523. serial port.
  15524. 'int getDebugChar()'
  15525. Write this subroutine to read a single character from the serial
  15526. port. It may be identical to 'getchar' for your target system; a
  15527. different name is used to allow you to distinguish the two if you
  15528. wish.
  15529. 'void putDebugChar(int)'
  15530. Write this subroutine to write a single character to the serial
  15531. port. It may be identical to 'putchar' for your target system; a
  15532. different name is used to allow you to distinguish the two if you
  15533. wish.
  15534. If you want GDB to be able to stop your program while it is running,
  15535. you need to use an interrupt-driven serial driver, and arrange for it to
  15536. stop when it receives a '^C' ('\003', the control-C character). That is
  15537. the character which GDB uses to tell the remote system to stop.
  15538. Getting the debugging target to return the proper status to GDB
  15539. probably requires changes to the standard stub; one quick and dirty way
  15540. is to just execute a breakpoint instruction (the "dirty" part is that
  15541. GDB reports a 'SIGTRAP' instead of a 'SIGINT').
  15542. Other routines you need to supply are:
  15543. 'void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)'
  15544. Write this function to install EXCEPTION_ADDRESS in the exception
  15545. handling tables. You need to do this because the stub does not
  15546. have any way of knowing what the exception handling tables on your
  15547. target system are like (for example, the processor's table might be
  15548. in ROM, containing entries which point to a table in RAM). The
  15549. EXCEPTION_NUMBER specifies the exception which should be changed;
  15550. its meaning is architecture-dependent (for example, different
  15551. numbers might represent divide by zero, misaligned access, etc).
  15552. When this exception occurs, control should be transferred directly
  15553. to EXCEPTION_ADDRESS, and the processor state (stack, registers,
  15554. and so on) should be just as it is when a processor exception
  15555. occurs. So if you want to use a jump instruction to reach
  15556. EXCEPTION_ADDRESS, it should be a simple jump, not a jump to
  15557. subroutine.
  15558. For the 386, EXCEPTION_ADDRESS should be installed as an interrupt
  15559. gate so that interrupts are masked while the handler runs. The
  15560. gate should be at privilege level 0 (the most privileged level).
  15561. The SPARC and 68k stubs are able to mask interrupts themselves
  15562. without help from 'exceptionHandler'.
  15563. 'void flush_i_cache()'
  15564. On SPARC and SPARCLITE only, write this subroutine to flush the
  15565. instruction cache, if any, on your target machine. If there is no
  15566. instruction cache, this subroutine may be a no-op.
  15567. On target machines that have instruction caches, GDB requires this
  15568. function to make certain that the state of your program is stable.
  15569. You must also make sure this library routine is available:
  15570. 'void *memset(void *, int, int)'
  15571. This is the standard library function 'memset' that sets an area of
  15572. memory to a known value. If you have one of the free versions of
  15573. 'libc.a', 'memset' can be found there; otherwise, you must either
  15574. obtain it from your hardware manufacturer, or write your own.
  15575. If you do not use the GNU C compiler, you may need other standard
  15576. library subroutines as well; this varies from one stub to another, but
  15577. in general the stubs are likely to use any of the common library
  15578. subroutines which 'GCC' generates as inline code.
  15579. 
  15580. File: gdb.info, Node: Debug Session, Prev: Bootstrapping, Up: Remote Stub
  15581. 20.5.3 Putting it All Together
  15582. ------------------------------
  15583. In summary, when your program is ready to debug, you must follow these
  15584. steps.
  15585. 1. Make sure you have defined the supporting low-level routines (*note
  15586. What You Must Do for the Stub: Bootstrapping.):
  15587. 'getDebugChar', 'putDebugChar',
  15588. 'flush_i_cache', 'memset', 'exceptionHandler'.
  15589. 2. Insert these lines in your program's startup code, before the main
  15590. procedure is called:
  15591. set_debug_traps();
  15592. breakpoint();
  15593. On some machines, when a breakpoint trap is raised, the hardware
  15594. automatically makes the PC point to the instruction after the
  15595. breakpoint. If your machine doesn't do that, you may need to
  15596. adjust 'handle_exception' to arrange for it to return to the
  15597. instruction after the breakpoint on this first invocation, so that
  15598. your program doesn't keep hitting the initial breakpoint instead of
  15599. making progress.
  15600. 3. For the 680x0 stub only, you need to provide a variable called
  15601. 'exceptionHook'. Normally you just use:
  15602. void (*exceptionHook)() = 0;
  15603. but if before calling 'set_debug_traps', you set it to point to a
  15604. function in your program, that function is called when 'GDB'
  15605. continues after stopping on a trap (for example, bus error). The
  15606. function indicated by 'exceptionHook' is called with one parameter:
  15607. an 'int' which is the exception number.
  15608. 4. Compile and link together: your program, the GDB debugging stub for
  15609. your target architecture, and the supporting subroutines.
  15610. 5. Make sure you have a serial connection between your target machine
  15611. and the GDB host, and identify the serial port on the host.
  15612. 6. Download your program to your target machine (or get it there by
  15613. whatever means the manufacturer provides), and start it.
  15614. 7. Start GDB on the host, and connect to the target (*note Connecting
  15615. to a Remote Target: Connecting.).
  15616. 
  15617. File: gdb.info, Node: Configurations, Next: Controlling GDB, Prev: Remote Debugging, Up: Top
  15618. 21 Configuration-Specific Information
  15619. *************************************
  15620. While nearly all GDB commands are available for all native and cross
  15621. versions of the debugger, there are some exceptions. This chapter
  15622. describes things that are only available in certain configurations.
  15623. There are three major categories of configurations: native
  15624. configurations, where the host and target are the same, embedded
  15625. operating system configurations, which are usually the same for several
  15626. different processor architectures, and bare embedded processors, which
  15627. are quite different from each other.
  15628. * Menu:
  15629. * Native::
  15630. * Embedded OS::
  15631. * Embedded Processors::
  15632. * Architectures::
  15633. 
  15634. File: gdb.info, Node: Native, Next: Embedded OS, Up: Configurations
  15635. 21.1 Native
  15636. ===========
  15637. This section describes details specific to particular native
  15638. configurations.
  15639. * Menu:
  15640. * BSD libkvm Interface:: Debugging BSD kernel memory images
  15641. * Process Information:: Process information
  15642. * DJGPP Native:: Features specific to the DJGPP port
  15643. * Cygwin Native:: Features specific to the Cygwin port
  15644. * Hurd Native:: Features specific to GNU Hurd
  15645. * Darwin:: Features specific to Darwin
  15646. * FreeBSD:: Features specific to FreeBSD
  15647. 
  15648. File: gdb.info, Node: BSD libkvm Interface, Next: Process Information, Up: Native
  15649. 21.1.1 BSD libkvm Interface
  15650. ---------------------------
  15651. BSD-derived systems (FreeBSD/NetBSD/OpenBSD) have a kernel memory
  15652. interface that provides a uniform interface for accessing kernel virtual
  15653. memory images, including live systems and crash dumps. GDB uses this
  15654. interface to allow you to debug live kernels and kernel crash dumps on
  15655. many native BSD configurations. This is implemented as a special 'kvm'
  15656. debugging target. For debugging a live system, load the currently
  15657. running kernel into GDB and connect to the 'kvm' target:
  15658. (gdb) target kvm
  15659. For debugging crash dumps, provide the file name of the crash dump as
  15660. an argument:
  15661. (gdb) target kvm /var/crash/bsd.0
  15662. Once connected to the 'kvm' target, the following commands are
  15663. available:
  15664. 'kvm pcb'
  15665. Set current context from the "Process Control Block" (PCB) address.
  15666. 'kvm proc'
  15667. Set current context from proc address. This command isn't
  15668. available on modern FreeBSD systems.
  15669. 
  15670. File: gdb.info, Node: Process Information, Next: DJGPP Native, Prev: BSD libkvm Interface, Up: Native
  15671. 21.1.2 Process Information
  15672. --------------------------
  15673. Some operating systems provide interfaces to fetch additional
  15674. information about running processes beyond memory and per-thread
  15675. register state. If GDB is configured for an operating system with a
  15676. supported interface, the command 'info proc' is available to report
  15677. information about the process running your program, or about any process
  15678. running on your system.
  15679. One supported interface is a facility called '/proc' that can be used
  15680. to examine the image of a running process using file-system subroutines.
  15681. This facility is supported on GNU/Linux and Solaris systems.
  15682. On FreeBSD systems, system control nodes are used to query process
  15683. information.
  15684. In addition, some systems may provide additional process information
  15685. in core files. Note that a core file may include a subset of the
  15686. information available from a live process. Process information is
  15687. currently available from cores created on GNU/Linux and FreeBSD systems.
  15688. 'info proc'
  15689. 'info proc PROCESS-ID'
  15690. Summarize available information about a process. If a process ID
  15691. is specified by PROCESS-ID, display information about that process;
  15692. otherwise display information about the program being debugged.
  15693. The summary includes the debugged process ID, the command line used
  15694. to invoke it, its current working directory, and its executable
  15695. file's absolute file name.
  15696. On some systems, PROCESS-ID can be of the form '[PID]/TID' which
  15697. specifies a certain thread ID within a process. If the optional
  15698. PID part is missing, it means a thread from the process being
  15699. debugged (the leading '/' still needs to be present, or else GDB
  15700. will interpret the number as a process ID rather than a thread ID).
  15701. 'info proc cmdline'
  15702. Show the original command line of the process. This command is
  15703. supported on GNU/Linux and FreeBSD.
  15704. 'info proc cwd'
  15705. Show the current working directory of the process. This command is
  15706. supported on GNU/Linux and FreeBSD.
  15707. 'info proc exe'
  15708. Show the name of executable of the process. This command is
  15709. supported on GNU/Linux and FreeBSD.
  15710. 'info proc files'
  15711. Show the file descriptors open by the process. For each open file
  15712. descriptor, GDB shows its number, type (file, directory, character
  15713. device, socket), file pointer offset, and the name of the resource
  15714. open on the descriptor. The resource name can be a file name (for
  15715. files, directories, and devices) or a protocol followed by socket
  15716. address (for network connections). This command is supported on
  15717. FreeBSD.
  15718. This example shows the open file descriptors for a process using a
  15719. tty for standard input and output as well as two network sockets:
  15720. (gdb) info proc files 22136
  15721. process 22136
  15722. Open files:
  15723. FD Type Offset Flags Name
  15724. text file - r-------- /usr/bin/ssh
  15725. ctty chr - rw------- /dev/pts/20
  15726. cwd dir - r-------- /usr/home/john
  15727. root dir - r-------- /
  15728. 0 chr 0x32933a4 rw------- /dev/pts/20
  15729. 1 chr 0x32933a4 rw------- /dev/pts/20
  15730. 2 chr 0x32933a4 rw------- /dev/pts/20
  15731. 3 socket 0x0 rw----n-- tcp4 10.0.1.2:53014 -> 10.0.1.10:22
  15732. 4 socket 0x0 rw------- unix stream:/tmp/ssh-FIt89oAzOn5f/agent.2456
  15733. 'info proc mappings'
  15734. Report the memory address space ranges accessible in a process. On
  15735. Solaris and FreeBSD systems, each memory range includes information
  15736. on whether the process has read, write, or execute access rights to
  15737. each range. On GNU/Linux and FreeBSD systems, each memory range
  15738. includes the object file which is mapped to that range.
  15739. 'info proc stat'
  15740. 'info proc status'
  15741. Show additional process-related information, including the user ID
  15742. and group ID; virtual memory usage; the signals that are pending,
  15743. blocked, and ignored; its TTY; its consumption of system and user
  15744. time; its stack size; its 'nice' value; etc. These commands are
  15745. supported on GNU/Linux and FreeBSD.
  15746. For GNU/Linux systems, see the 'proc' man page for more information
  15747. (type 'man 5 proc' from your shell prompt).
  15748. For FreeBSD systems, 'info proc stat' is an alias for 'info proc
  15749. status'.
  15750. 'info proc all'
  15751. Show all the information about the process described under all of
  15752. the above 'info proc' subcommands.
  15753. 'set procfs-trace'
  15754. This command enables and disables tracing of 'procfs' API calls.
  15755. 'show procfs-trace'
  15756. Show the current state of 'procfs' API call tracing.
  15757. 'set procfs-file FILE'
  15758. Tell GDB to write 'procfs' API trace to the named FILE. GDB
  15759. appends the trace info to the previous contents of the file. The
  15760. default is to display the trace on the standard output.
  15761. 'show procfs-file'
  15762. Show the file to which 'procfs' API trace is written.
  15763. 'proc-trace-entry'
  15764. 'proc-trace-exit'
  15765. 'proc-untrace-entry'
  15766. 'proc-untrace-exit'
  15767. These commands enable and disable tracing of entries into and exits
  15768. from the 'syscall' interface.
  15769. 'info pidlist'
  15770. For QNX Neutrino only, this command displays the list of all the
  15771. processes and all the threads within each process.
  15772. 'info meminfo'
  15773. For QNX Neutrino only, this command displays the list of all
  15774. mapinfos.
  15775. 
  15776. File: gdb.info, Node: DJGPP Native, Next: Cygwin Native, Prev: Process Information, Up: Native
  15777. 21.1.3 Features for Debugging DJGPP Programs
  15778. --------------------------------------------
  15779. DJGPP is a port of the GNU development tools to MS-DOS and MS-Windows.
  15780. DJGPP programs are 32-bit protected-mode programs that use the "DPMI"
  15781. (DOS Protected-Mode Interface) API to run on top of real-mode DOS
  15782. systems and their emulations.
  15783. GDB supports native debugging of DJGPP programs, and defines a few
  15784. commands specific to the DJGPP port. This subsection describes those
  15785. commands.
  15786. 'info dos'
  15787. This is a prefix of DJGPP-specific commands which print information
  15788. about the target system and important OS structures.
  15789. 'info dos sysinfo'
  15790. This command displays assorted information about the underlying
  15791. platform: the CPU type and features, the OS version and flavor, the
  15792. DPMI version, and the available conventional and DPMI memory.
  15793. 'info dos gdt'
  15794. 'info dos ldt'
  15795. 'info dos idt'
  15796. These 3 commands display entries from, respectively, Global, Local,
  15797. and Interrupt Descriptor Tables (GDT, LDT, and IDT). The descriptor
  15798. tables are data structures which store a descriptor for each
  15799. segment that is currently in use. The segment's selector is an
  15800. index into a descriptor table; the table entry for that index holds
  15801. the descriptor's base address and limit, and its attributes and
  15802. access rights.
  15803. A typical DJGPP program uses 3 segments: a code segment, a data
  15804. segment (used for both data and the stack), and a DOS segment
  15805. (which allows access to DOS/BIOS data structures and absolute
  15806. addresses in conventional memory). However, the DPMI host will
  15807. usually define additional segments in order to support the DPMI
  15808. environment.
  15809. These commands allow to display entries from the descriptor tables.
  15810. Without an argument, all entries from the specified table are
  15811. displayed. An argument, which should be an integer expression,
  15812. means display a single entry whose index is given by the argument.
  15813. For example, here's a convenient way to display information about
  15814. the debugged program's data segment:
  15815. (gdb) info dos ldt $ds
  15816. 0x13f: base=0x11970000 limit=0x0009ffff 32-Bit Data (Read/Write, Exp-up)
  15817. This comes in handy when you want to see whether a pointer is
  15818. outside the data segment's limit (i.e. "garbled").
  15819. 'info dos pde'
  15820. 'info dos pte'
  15821. These two commands display entries from, respectively, the Page
  15822. Directory and the Page Tables. Page Directories and Page Tables
  15823. are data structures which control how virtual memory addresses are
  15824. mapped into physical addresses. A Page Table includes an entry for
  15825. every page of memory that is mapped into the program's address
  15826. space; there may be several Page Tables, each one holding up to
  15827. 4096 entries. A Page Directory has up to 4096 entries, one each
  15828. for every Page Table that is currently in use.
  15829. Without an argument, 'info dos pde' displays the entire Page
  15830. Directory, and 'info dos pte' displays all the entries in all of
  15831. the Page Tables. An argument, an integer expression, given to the
  15832. 'info dos pde' command means display only that entry from the Page
  15833. Directory table. An argument given to the 'info dos pte' command
  15834. means display entries from a single Page Table, the one pointed to
  15835. by the specified entry in the Page Directory.
  15836. These commands are useful when your program uses "DMA" (Direct
  15837. Memory Access), which needs physical addresses to program the DMA
  15838. controller.
  15839. These commands are supported only with some DPMI servers.
  15840. 'info dos address-pte ADDR'
  15841. This command displays the Page Table entry for a specified linear
  15842. address. The argument ADDR is a linear address which should
  15843. already have the appropriate segment's base address added to it,
  15844. because this command accepts addresses which may belong to _any_
  15845. segment. For example, here's how to display the Page Table entry
  15846. for the page where a variable 'i' is stored:
  15847. (gdb) info dos address-pte __djgpp_base_address + (char *)&i
  15848. Page Table entry for address 0x11a00d30:
  15849. Base=0x02698000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0xd30
  15850. This says that 'i' is stored at offset '0xd30' from the page whose
  15851. physical base address is '0x02698000', and shows all the attributes
  15852. of that page.
  15853. Note that you must cast the addresses of variables to a 'char *',
  15854. since otherwise the value of '__djgpp_base_address', the base
  15855. address of all variables and functions in a DJGPP program, will be
  15856. added using the rules of C pointer arithmetics: if 'i' is declared
  15857. an 'int', GDB will add 4 times the value of '__djgpp_base_address'
  15858. to the address of 'i'.
  15859. Here's another example, it displays the Page Table entry for the
  15860. transfer buffer:
  15861. (gdb) info dos address-pte *((unsigned *)&_go32_info_block + 3)
  15862. Page Table entry for address 0x29110:
  15863. Base=0x00029000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0x110
  15864. (The '+ 3' offset is because the transfer buffer's address is the
  15865. 3rd member of the '_go32_info_block' structure.) The output
  15866. clearly shows that this DPMI server maps the addresses in
  15867. conventional memory 1:1, i.e. the physical ('0x00029000' + '0x110')
  15868. and linear ('0x29110') addresses are identical.
  15869. This command is supported only with some DPMI servers.
  15870. In addition to native debugging, the DJGPP port supports remote
  15871. debugging via a serial data link. The following commands are specific
  15872. to remote serial debugging in the DJGPP port of GDB.
  15873. 'set com1base ADDR'
  15874. This command sets the base I/O port address of the 'COM1' serial
  15875. port.
  15876. 'set com1irq IRQ'
  15877. This command sets the "Interrupt Request" ('IRQ') line to use for
  15878. the 'COM1' serial port.
  15879. There are similar commands 'set com2base', 'set com3irq', etc. for
  15880. setting the port address and the 'IRQ' lines for the other 3 COM
  15881. ports.
  15882. The related commands 'show com1base', 'show com1irq' etc. display
  15883. the current settings of the base address and the 'IRQ' lines used
  15884. by the COM ports.
  15885. 'info serial'
  15886. This command prints the status of the 4 DOS serial ports. For each
  15887. port, it prints whether it's active or not, its I/O base address
  15888. and IRQ number, whether it uses a 16550-style FIFO, its baudrate,
  15889. and the counts of various errors encountered so far.
  15890. 
  15891. File: gdb.info, Node: Cygwin Native, Next: Hurd Native, Prev: DJGPP Native, Up: Native
  15892. 21.1.4 Features for Debugging MS Windows PE Executables
  15893. -------------------------------------------------------
  15894. GDB supports native debugging of MS Windows programs, including DLLs
  15895. with and without symbolic debugging information.
  15896. MS-Windows programs that call 'SetConsoleMode' to switch off the
  15897. special meaning of the 'Ctrl-C' keystroke cannot be interrupted by
  15898. typing 'C-c'. For this reason, GDB on MS-Windows supports 'C-<BREAK>'
  15899. as an alternative interrupt key sequence, which can be used to interrupt
  15900. the debuggee even if it ignores 'C-c'.
  15901. There are various additional Cygwin-specific commands, described in
  15902. this section. Working with DLLs that have no debugging symbols is
  15903. described in *note Non-debug DLL Symbols::.
  15904. 'info w32'
  15905. This is a prefix of MS Windows-specific commands which print
  15906. information about the target system and important OS structures.
  15907. 'info w32 selector'
  15908. This command displays information returned by the Win32 API
  15909. 'GetThreadSelectorEntry' function. It takes an optional argument
  15910. that is evaluated to a long value to give the information about
  15911. this given selector. Without argument, this command displays
  15912. information about the six segment registers.
  15913. 'info w32 thread-information-block'
  15914. This command displays thread specific information stored in the
  15915. Thread Information Block (readable on the X86 CPU family using
  15916. '$fs' selector for 32-bit programs and '$gs' for 64-bit programs).
  15917. 'signal-event ID'
  15918. This command signals an event with user-provided ID. Used to
  15919. resume crashing process when attached to it using MS-Windows JIT
  15920. debugging (AeDebug).
  15921. To use it, create or edit the following keys in
  15922. 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug' and/or
  15923. 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows
  15924. NT\CurrentVersion\AeDebug' (for x86_64 versions):
  15925. - 'Debugger' (REG_SZ) -- a command to launch the debugger.
  15926. Suggested command is: 'FULLY-QUALIFIED-PATH-TO-GDB.EXE -ex
  15927. "attach %ld" -ex "signal-event %ld" -ex "continue"'.
  15928. The first '%ld' will be replaced by the process ID of the
  15929. crashing process, the second '%ld' will be replaced by the ID
  15930. of the event that blocks the crashing process, waiting for GDB
  15931. to attach.
  15932. - 'Auto' (REG_SZ) -- either '1' or '0'. '1' will make the
  15933. system run debugger specified by the Debugger key
  15934. automatically, '0' will cause a dialog box with "OK" and
  15935. "Cancel" buttons to appear, which allows the user to either
  15936. terminate the crashing process (OK) or debug it (Cancel).
  15937. 'set cygwin-exceptions MODE'
  15938. If MODE is 'on', GDB will break on exceptions that happen inside
  15939. the Cygwin DLL. If MODE is 'off', GDB will delay recognition of
  15940. exceptions, and may ignore some exceptions which seem to be caused
  15941. by internal Cygwin DLL "bookkeeping". This option is meant
  15942. primarily for debugging the Cygwin DLL itself; the default value is
  15943. 'off' to avoid annoying GDB users with false 'SIGSEGV' signals.
  15944. 'show cygwin-exceptions'
  15945. Displays whether GDB will break on exceptions that happen inside
  15946. the Cygwin DLL itself.
  15947. 'set new-console MODE'
  15948. If MODE is 'on' the debuggee will be started in a new console on
  15949. next start. If MODE is 'off', the debuggee will be started in the
  15950. same console as the debugger.
  15951. 'show new-console'
  15952. Displays whether a new console is used when the debuggee is
  15953. started.
  15954. 'set new-group MODE'
  15955. This boolean value controls whether the debuggee should start a new
  15956. group or stay in the same group as the debugger. This affects the
  15957. way the Windows OS handles 'Ctrl-C'.
  15958. 'show new-group'
  15959. Displays current value of new-group boolean.
  15960. 'set debugevents'
  15961. This boolean value adds debug output concerning kernel events
  15962. related to the debuggee seen by the debugger. This includes events
  15963. that signal thread and process creation and exit, DLL loading and
  15964. unloading, console interrupts, and debugging messages produced by
  15965. the Windows 'OutputDebugString' API call.
  15966. 'set debugexec'
  15967. This boolean value adds debug output concerning execute events
  15968. (such as resume thread) seen by the debugger.
  15969. 'set debugexceptions'
  15970. This boolean value adds debug output concerning exceptions in the
  15971. debuggee seen by the debugger.
  15972. 'set debugmemory'
  15973. This boolean value adds debug output concerning debuggee memory
  15974. reads and writes by the debugger.
  15975. 'set shell'
  15976. This boolean values specifies whether the debuggee is called via a
  15977. shell or directly (default value is on).
  15978. 'show shell'
  15979. Displays if the debuggee will be started with a shell.
  15980. * Menu:
  15981. * Non-debug DLL Symbols:: Support for DLLs without debugging symbols
  15982. 
  15983. File: gdb.info, Node: Non-debug DLL Symbols, Up: Cygwin Native
  15984. 21.1.4.1 Support for DLLs without Debugging Symbols
  15985. ...................................................
  15986. Very often on windows, some of the DLLs that your program relies on do
  15987. not include symbolic debugging information (for example,
  15988. 'kernel32.dll'). When GDB doesn't recognize any debugging symbols in a
  15989. DLL, it relies on the minimal amount of symbolic information contained
  15990. in the DLL's export table. This section describes working with such
  15991. symbols, known internally to GDB as "minimal symbols".
  15992. Note that before the debugged program has started execution, no DLLs
  15993. will have been loaded. The easiest way around this problem is simply to
  15994. start the program -- either by setting a breakpoint or letting the
  15995. program run once to completion.
  15996. 21.1.4.2 DLL Name Prefixes
  15997. ..........................
  15998. In keeping with the naming conventions used by the Microsoft debugging
  15999. tools, DLL export symbols are made available with a prefix based on the
  16000. DLL name, for instance 'KERNEL32!CreateFileA'. The plain name is also
  16001. entered into the symbol table, so 'CreateFileA' is often sufficient. In
  16002. some cases there will be name clashes within a program (particularly if
  16003. the executable itself includes full debugging symbols) necessitating the
  16004. use of the fully qualified name when referring to the contents of the
  16005. DLL. Use single-quotes around the name to avoid the exclamation mark
  16006. ("!") being interpreted as a language operator.
  16007. Note that the internal name of the DLL may be all upper-case, even
  16008. though the file name of the DLL is lower-case, or vice-versa. Since
  16009. symbols within GDB are _case-sensitive_ this may cause some confusion.
  16010. If in doubt, try the 'info functions' and 'info variables' commands or
  16011. even 'maint print msymbols' (*note Symbols::). Here's an example:
  16012. (gdb) info function CreateFileA
  16013. All functions matching regular expression "CreateFileA":
  16014. Non-debugging symbols:
  16015. 0x77e885f4 CreateFileA
  16016. 0x77e885f4 KERNEL32!CreateFileA
  16017. (gdb) info function !
  16018. All functions matching regular expression "!":
  16019. Non-debugging symbols:
  16020. 0x6100114c cygwin1!__assert
  16021. 0x61004034 cygwin1!_dll_crt0@0
  16022. 0x61004240 cygwin1!dll_crt0(per_process *)
  16023. [etc...]
  16024. 21.1.4.3 Working with Minimal Symbols
  16025. .....................................
  16026. Symbols extracted from a DLL's export table do not contain very much
  16027. type information. All that GDB can do is guess whether a symbol refers
  16028. to a function or variable depending on the linker section that contains
  16029. the symbol. Also note that the actual contents of the memory contained
  16030. in a DLL are not available unless the program is running. This means
  16031. that you cannot examine the contents of a variable or disassemble a
  16032. function within a DLL without a running program.
  16033. Variables are generally treated as pointers and dereferenced
  16034. automatically. For this reason, it is often necessary to prefix a
  16035. variable name with the address-of operator ("&") and provide explicit
  16036. type information in the command. Here's an example of the type of
  16037. problem:
  16038. (gdb) print 'cygwin1!__argv'
  16039. 'cygwin1!__argv' has unknown type; cast it to its declared type
  16040. (gdb) x 'cygwin1!__argv'
  16041. 'cygwin1!__argv' has unknown type; cast it to its declared type
  16042. And two possible solutions:
  16043. (gdb) print ((char **)'cygwin1!__argv')[0]
  16044. $2 = 0x22fd98 "/cygdrive/c/mydirectory/myprogram"
  16045. (gdb) x/2x &'cygwin1!__argv'
  16046. 0x610c0aa8 <cygwin1!__argv>: 0x10021608 0x00000000
  16047. (gdb) x/x 0x10021608
  16048. 0x10021608: 0x0022fd98
  16049. (gdb) x/s 0x0022fd98
  16050. 0x22fd98: "/cygdrive/c/mydirectory/myprogram"
  16051. Setting a break point within a DLL is possible even before the
  16052. program starts execution. However, under these circumstances, GDB can't
  16053. examine the initial instructions of the function in order to skip the
  16054. function's frame set-up code. You can work around this by using "*&" to
  16055. set the breakpoint at a raw memory address:
  16056. (gdb) break *&'python22!PyOS_Readline'
  16057. Breakpoint 1 at 0x1e04eff0
  16058. The author of these extensions is not entirely convinced that setting
  16059. a break point within a shared DLL like 'kernel32.dll' is completely
  16060. safe.
  16061. 
  16062. File: gdb.info, Node: Hurd Native, Next: Darwin, Prev: Cygwin Native, Up: Native
  16063. 21.1.5 Commands Specific to GNU Hurd Systems
  16064. --------------------------------------------
  16065. This subsection describes GDB commands specific to the GNU Hurd native
  16066. debugging.
  16067. 'set signals'
  16068. 'set sigs'
  16069. This command toggles the state of inferior signal interception by
  16070. GDB. Mach exceptions, such as breakpoint traps, are not affected
  16071. by this command. 'sigs' is a shorthand alias for 'signals'.
  16072. 'show signals'
  16073. 'show sigs'
  16074. Show the current state of intercepting inferior's signals.
  16075. 'set signal-thread'
  16076. 'set sigthread'
  16077. This command tells GDB which thread is the 'libc' signal thread.
  16078. That thread is run when a signal is delivered to a running process.
  16079. 'set sigthread' is the shorthand alias of 'set signal-thread'.
  16080. 'show signal-thread'
  16081. 'show sigthread'
  16082. These two commands show which thread will run when the inferior is
  16083. delivered a signal.
  16084. 'set stopped'
  16085. This commands tells GDB that the inferior process is stopped, as
  16086. with the 'SIGSTOP' signal. The stopped process can be continued by
  16087. delivering a signal to it.
  16088. 'show stopped'
  16089. This command shows whether GDB thinks the debuggee is stopped.
  16090. 'set exceptions'
  16091. Use this command to turn off trapping of exceptions in the
  16092. inferior. When exception trapping is off, neither breakpoints nor
  16093. single-stepping will work. To restore the default, set exception
  16094. trapping on.
  16095. 'show exceptions'
  16096. Show the current state of trapping exceptions in the inferior.
  16097. 'set task pause'
  16098. This command toggles task suspension when GDB has control. Setting
  16099. it to on takes effect immediately, and the task is suspended
  16100. whenever GDB gets control. Setting it to off will take effect the
  16101. next time the inferior is continued. If this option is set to off,
  16102. you can use 'set thread default pause on' or 'set thread pause on'
  16103. (see below) to pause individual threads.
  16104. 'show task pause'
  16105. Show the current state of task suspension.
  16106. 'set task detach-suspend-count'
  16107. This command sets the suspend count the task will be left with when
  16108. GDB detaches from it.
  16109. 'show task detach-suspend-count'
  16110. Show the suspend count the task will be left with when detaching.
  16111. 'set task exception-port'
  16112. 'set task excp'
  16113. This command sets the task exception port to which GDB will forward
  16114. exceptions. The argument should be the value of the "send rights"
  16115. of the task. 'set task excp' is a shorthand alias.
  16116. 'set noninvasive'
  16117. This command switches GDB to a mode that is the least invasive as
  16118. far as interfering with the inferior is concerned. This is the
  16119. same as using 'set task pause', 'set exceptions', and 'set signals'
  16120. to values opposite to the defaults.
  16121. 'info send-rights'
  16122. 'info receive-rights'
  16123. 'info port-rights'
  16124. 'info port-sets'
  16125. 'info dead-names'
  16126. 'info ports'
  16127. 'info psets'
  16128. These commands display information about, respectively, send
  16129. rights, receive rights, port rights, port sets, and dead names of a
  16130. task. There are also shorthand aliases: 'info ports' for 'info
  16131. port-rights' and 'info psets' for 'info port-sets'.
  16132. 'set thread pause'
  16133. This command toggles current thread suspension when GDB has
  16134. control. Setting it to on takes effect immediately, and the
  16135. current thread is suspended whenever GDB gets control. Setting it
  16136. to off will take effect the next time the inferior is continued.
  16137. Normally, this command has no effect, since when GDB has control,
  16138. the whole task is suspended. However, if you used 'set task pause
  16139. off' (see above), this command comes in handy to suspend only the
  16140. current thread.
  16141. 'show thread pause'
  16142. This command shows the state of current thread suspension.
  16143. 'set thread run'
  16144. This command sets whether the current thread is allowed to run.
  16145. 'show thread run'
  16146. Show whether the current thread is allowed to run.
  16147. 'set thread detach-suspend-count'
  16148. This command sets the suspend count GDB will leave on a thread when
  16149. detaching. This number is relative to the suspend count found by
  16150. GDB when it notices the thread; use 'set thread
  16151. takeover-suspend-count' to force it to an absolute value.
  16152. 'show thread detach-suspend-count'
  16153. Show the suspend count GDB will leave on the thread when detaching.
  16154. 'set thread exception-port'
  16155. 'set thread excp'
  16156. Set the thread exception port to which to forward exceptions. This
  16157. overrides the port set by 'set task exception-port' (see above).
  16158. 'set thread excp' is the shorthand alias.
  16159. 'set thread takeover-suspend-count'
  16160. Normally, GDB's thread suspend counts are relative to the value GDB
  16161. finds when it notices each thread. This command changes the
  16162. suspend counts to be absolute instead.
  16163. 'set thread default'
  16164. 'show thread default'
  16165. Each of the above 'set thread' commands has a 'set thread default'
  16166. counterpart (e.g., 'set thread default pause', 'set thread default
  16167. exception-port', etc.). The 'thread default' variety of commands
  16168. sets the default thread properties for all threads; you can then
  16169. change the properties of individual threads with the non-default
  16170. commands.
  16171. 
  16172. File: gdb.info, Node: Darwin, Next: FreeBSD, Prev: Hurd Native, Up: Native
  16173. 21.1.6 Darwin
  16174. -------------
  16175. GDB provides the following commands specific to the Darwin target:
  16176. 'set debug darwin NUM'
  16177. When set to a non zero value, enables debugging messages specific
  16178. to the Darwin support. Higher values produce more verbose output.
  16179. 'show debug darwin'
  16180. Show the current state of Darwin messages.
  16181. 'set debug mach-o NUM'
  16182. When set to a non zero value, enables debugging messages while GDB
  16183. is reading Darwin object files. ("Mach-O" is the file format used
  16184. on Darwin for object and executable files.) Higher values produce
  16185. more verbose output. This is a command to diagnose problems
  16186. internal to GDB and should not be needed in normal usage.
  16187. 'show debug mach-o'
  16188. Show the current state of Mach-O file messages.
  16189. 'set mach-exceptions on'
  16190. 'set mach-exceptions off'
  16191. On Darwin, faults are first reported as a Mach exception and are
  16192. then mapped to a Posix signal. Use this command to turn on
  16193. trapping of Mach exceptions in the inferior. This might be
  16194. sometimes useful to better understand the cause of a fault. The
  16195. default is off.
  16196. 'show mach-exceptions'
  16197. Show the current state of exceptions trapping.
  16198. 
  16199. File: gdb.info, Node: FreeBSD, Prev: Darwin, Up: Native
  16200. 21.1.7 FreeBSD
  16201. --------------
  16202. When the ABI of a system call is changed in the FreeBSD kernel, this is
  16203. implemented by leaving a compatibility system call using the old ABI at
  16204. the existing number and allocating a new system call number for the
  16205. version using the new ABI. As a convenience, when a system call is
  16206. caught by name (*note catch syscall::), compatibility system calls are
  16207. also caught.
  16208. For example, FreeBSD 12 introduced a new variant of the 'kevent'
  16209. system call and catching the 'kevent' system call by name catches both
  16210. variants:
  16211. (gdb) catch syscall kevent
  16212. Catchpoint 1 (syscalls 'freebsd11_kevent' [363] 'kevent' [560])
  16213. (gdb)
  16214. 
  16215. File: gdb.info, Node: Embedded OS, Next: Embedded Processors, Prev: Native, Up: Configurations
  16216. 21.2 Embedded Operating Systems
  16217. ===============================
  16218. This section describes configurations involving the debugging of
  16219. embedded operating systems that are available for several different
  16220. architectures.
  16221. GDB includes the ability to debug programs running on various
  16222. real-time operating systems.
  16223. 
  16224. File: gdb.info, Node: Embedded Processors, Next: Architectures, Prev: Embedded OS, Up: Configurations
  16225. 21.3 Embedded Processors
  16226. ========================
  16227. This section goes into details specific to particular embedded
  16228. configurations.
  16229. Whenever a specific embedded processor has a simulator, GDB allows to
  16230. send an arbitrary command to the simulator.
  16231. 'sim COMMAND'
  16232. Send an arbitrary COMMAND string to the simulator. Consult the
  16233. documentation for the specific simulator in use for information
  16234. about acceptable commands.
  16235. * Menu:
  16236. * ARC:: Synopsys ARC
  16237. * ARM:: ARM
  16238. * M68K:: Motorola M68K
  16239. * MicroBlaze:: Xilinx MicroBlaze
  16240. * MIPS Embedded:: MIPS Embedded
  16241. * OpenRISC 1000:: OpenRISC 1000 (or1k)
  16242. * PowerPC Embedded:: PowerPC Embedded
  16243. * AVR:: Atmel AVR
  16244. * CRIS:: CRIS
  16245. * Super-H:: Renesas Super-H
  16246. 
  16247. File: gdb.info, Node: ARC, Next: ARM, Up: Embedded Processors
  16248. 21.3.1 Synopsys ARC
  16249. -------------------
  16250. GDB provides the following ARC-specific commands:
  16251. 'set debug arc'
  16252. Control the level of ARC specific debug messages. Use 0 for no
  16253. messages (the default), 1 for debug messages, and 2 for even more
  16254. debug messages.
  16255. 'show debug arc'
  16256. Show the level of ARC specific debugging in operation.
  16257. 'maint print arc arc-instruction ADDRESS'
  16258. Print internal disassembler information about instruction at a
  16259. given address.
  16260. 
  16261. File: gdb.info, Node: ARM, Next: M68K, Prev: ARC, Up: Embedded Processors
  16262. 21.3.2 ARM
  16263. ----------
  16264. GDB provides the following ARM-specific commands:
  16265. 'set arm disassembler'
  16266. This commands selects from a list of disassembly styles. The
  16267. '"std"' style is the standard style.
  16268. 'show arm disassembler'
  16269. Show the current disassembly style.
  16270. 'set arm apcs32'
  16271. This command toggles ARM operation mode between 32-bit and 26-bit.
  16272. 'show arm apcs32'
  16273. Display the current usage of the ARM 32-bit mode.
  16274. 'set arm fpu FPUTYPE'
  16275. This command sets the ARM floating-point unit (FPU) type. The
  16276. argument FPUTYPE can be one of these:
  16277. 'auto'
  16278. Determine the FPU type by querying the OS ABI.
  16279. 'softfpa'
  16280. Software FPU, with mixed-endian doubles on little-endian ARM
  16281. processors.
  16282. 'fpa'
  16283. GCC-compiled FPA co-processor.
  16284. 'softvfp'
  16285. Software FPU with pure-endian doubles.
  16286. 'vfp'
  16287. VFP co-processor.
  16288. 'show arm fpu'
  16289. Show the current type of the FPU.
  16290. 'set arm abi'
  16291. This command forces GDB to use the specified ABI.
  16292. 'show arm abi'
  16293. Show the currently used ABI.
  16294. 'set arm fallback-mode (arm|thumb|auto)'
  16295. GDB uses the symbol table, when available, to determine whether
  16296. instructions are ARM or Thumb. This command controls GDB's default
  16297. behavior when the symbol table is not available. The default is
  16298. 'auto', which causes GDB to use the current execution mode (from
  16299. the 'T' bit in the 'CPSR' register).
  16300. 'show arm fallback-mode'
  16301. Show the current fallback instruction mode.
  16302. 'set arm force-mode (arm|thumb|auto)'
  16303. This command overrides use of the symbol table to determine whether
  16304. instructions are ARM or Thumb. The default is 'auto', which causes
  16305. GDB to use the symbol table and then the setting of 'set arm
  16306. fallback-mode'.
  16307. 'show arm force-mode'
  16308. Show the current forced instruction mode.
  16309. 'set debug arm'
  16310. Toggle whether to display ARM-specific debugging messages from the
  16311. ARM target support subsystem.
  16312. 'show debug arm'
  16313. Show whether ARM-specific debugging messages are enabled.
  16314. 'target sim [SIMARGS] ...'
  16315. The GDB ARM simulator accepts the following optional arguments.
  16316. '--swi-support=TYPE'
  16317. Tell the simulator which SWI interfaces to support. The
  16318. argument TYPE may be a comma separated list of the following
  16319. values. The default value is 'all'.
  16320. 'none'
  16321. 'demon'
  16322. 'angel'
  16323. 'redboot'
  16324. 'all'
  16325. 
  16326. File: gdb.info, Node: M68K, Next: MicroBlaze, Prev: ARM, Up: Embedded Processors
  16327. 21.3.3 M68k
  16328. -----------
  16329. The Motorola m68k configuration includes ColdFire support.
  16330. 
  16331. File: gdb.info, Node: MicroBlaze, Next: MIPS Embedded, Prev: M68K, Up: Embedded Processors
  16332. 21.3.4 MicroBlaze
  16333. -----------------
  16334. The MicroBlaze is a soft-core processor supported on various Xilinx
  16335. FPGAs, such as Spartan or Virtex series. Boards with these processors
  16336. usually have JTAG ports which connect to a host system running the
  16337. Xilinx Embedded Development Kit (EDK) or Software Development Kit (SDK).
  16338. This host system is used to download the configuration bitstream to the
  16339. target FPGA. The Xilinx Microprocessor Debugger (XMD) program
  16340. communicates with the target board using the JTAG interface and presents
  16341. a 'gdbserver' interface to the board. By default 'xmd' uses port
  16342. '1234'. (While it is possible to change this default port, it requires
  16343. the use of undocumented 'xmd' commands. Contact Xilinx support if you
  16344. need to do this.)
  16345. Use these GDB commands to connect to the MicroBlaze target processor.
  16346. 'target remote :1234'
  16347. Use this command to connect to the target if you are running GDB on
  16348. the same system as 'xmd'.
  16349. 'target remote XMD-HOST:1234'
  16350. Use this command to connect to the target if it is connected to
  16351. 'xmd' running on a different system named XMD-HOST.
  16352. 'load'
  16353. Use this command to download a program to the MicroBlaze target.
  16354. 'set debug microblaze N'
  16355. Enable MicroBlaze-specific debugging messages if non-zero.
  16356. 'show debug microblaze N'
  16357. Show MicroBlaze-specific debugging level.
  16358. 
  16359. File: gdb.info, Node: MIPS Embedded, Next: OpenRISC 1000, Prev: MicroBlaze, Up: Embedded Processors
  16360. 21.3.5 MIPS Embedded
  16361. --------------------
  16362. GDB supports these special commands for MIPS targets:
  16363. 'set mipsfpu double'
  16364. 'set mipsfpu single'
  16365. 'set mipsfpu none'
  16366. 'set mipsfpu auto'
  16367. 'show mipsfpu'
  16368. If your target board does not support the MIPS floating point
  16369. coprocessor, you should use the command 'set mipsfpu none' (if you
  16370. need this, you may wish to put the command in your GDB init file).
  16371. This tells GDB how to find the return value of functions which
  16372. return floating point values. It also allows GDB to avoid saving
  16373. the floating point registers when calling functions on the board.
  16374. If you are using a floating point coprocessor with only single
  16375. precision floating point support, as on the R4650 processor, use
  16376. the command 'set mipsfpu single'. The default double precision
  16377. floating point coprocessor may be selected using 'set mipsfpu
  16378. double'.
  16379. In previous versions the only choices were double precision or no
  16380. floating point, so 'set mipsfpu on' will select double precision
  16381. and 'set mipsfpu off' will select no floating point.
  16382. As usual, you can inquire about the 'mipsfpu' variable with 'show
  16383. mipsfpu'.
  16384. 
  16385. File: gdb.info, Node: OpenRISC 1000, Next: PowerPC Embedded, Prev: MIPS Embedded, Up: Embedded Processors
  16386. 21.3.6 OpenRISC 1000
  16387. --------------------
  16388. The OpenRISC 1000 provides a free RISC instruction set architecture. It
  16389. is mainly provided as a soft-core which can run on Xilinx, Altera and
  16390. other FPGA's.
  16391. GDB for OpenRISC supports the below commands when connecting to a
  16392. target:
  16393. 'target sim'
  16394. Runs the builtin CPU simulator which can run very basic programs
  16395. but does not support most hardware functions like MMU. For more
  16396. complex use cases the user is advised to run an external target,
  16397. and connect using 'target remote'.
  16398. Example: 'target sim'
  16399. 'set debug or1k'
  16400. Toggle whether to display OpenRISC-specific debugging messages from
  16401. the OpenRISC target support subsystem.
  16402. 'show debug or1k'
  16403. Show whether OpenRISC-specific debugging messages are enabled.
  16404. 
  16405. File: gdb.info, Node: PowerPC Embedded, Next: AVR, Prev: OpenRISC 1000, Up: Embedded Processors
  16406. 21.3.7 PowerPC Embedded
  16407. -----------------------
  16408. GDB supports using the DVC (Data Value Compare) register to implement in
  16409. hardware simple hardware watchpoint conditions of the form:
  16410. (gdb) watch ADDRESS|VARIABLE \
  16411. if ADDRESS|VARIABLE == CONSTANT EXPRESSION
  16412. The DVC register will be automatically used when GDB detects such
  16413. pattern in a condition expression, and the created watchpoint uses one
  16414. debug register (either the 'exact-watchpoints' option is on and the
  16415. variable is scalar, or the variable has a length of one byte). This
  16416. feature is available in native GDB running on a Linux kernel version
  16417. 2.6.34 or newer.
  16418. When running on PowerPC embedded processors, GDB automatically uses
  16419. ranged hardware watchpoints, unless the 'exact-watchpoints' option is
  16420. on, in which case watchpoints using only one debug register are created
  16421. when watching variables of scalar types.
  16422. You can create an artificial array to watch an arbitrary memory
  16423. region using one of the following commands (*note Expressions::):
  16424. (gdb) watch *((char *) ADDRESS)@LENGTH
  16425. (gdb) watch {char[LENGTH]} ADDRESS
  16426. PowerPC embedded processors support masked watchpoints. See the
  16427. discussion about the 'mask' argument in *note Set Watchpoints::.
  16428. PowerPC embedded processors support hardware accelerated "ranged
  16429. breakpoints". A ranged breakpoint stops execution of the inferior
  16430. whenever it executes an instruction at any address within the range it
  16431. specifies. To set a ranged breakpoint in GDB, use the 'break-range'
  16432. command.
  16433. GDB provides the following PowerPC-specific commands:
  16434. 'break-range START-LOCATION, END-LOCATION'
  16435. Set a breakpoint for an address range given by START-LOCATION and
  16436. END-LOCATION, which can specify a function name, a line number, an
  16437. offset of lines from the current line or from the start location,
  16438. or an address of an instruction (see *note Specify Location::, for
  16439. a list of all the possible ways to specify a LOCATION.) The
  16440. breakpoint will stop execution of the inferior whenever it executes
  16441. an instruction at any address within the specified range,
  16442. (including START-LOCATION and END-LOCATION.)
  16443. 'set powerpc soft-float'
  16444. 'show powerpc soft-float'
  16445. Force GDB to use (or not use) a software floating point calling
  16446. convention. By default, GDB selects the calling convention based
  16447. on the selected architecture and the provided executable file.
  16448. 'set powerpc vector-abi'
  16449. 'show powerpc vector-abi'
  16450. Force GDB to use the specified calling convention for vector
  16451. arguments and return values. The valid options are 'auto';
  16452. 'generic', to avoid vector registers even if they are present;
  16453. 'altivec', to use AltiVec registers; and 'spe' to use SPE
  16454. registers. By default, GDB selects the calling convention based on
  16455. the selected architecture and the provided executable file.
  16456. 'set powerpc exact-watchpoints'
  16457. 'show powerpc exact-watchpoints'
  16458. Allow GDB to use only one debug register when watching a variable
  16459. of scalar type, thus assuming that the variable is accessed through
  16460. the address of its first byte.
  16461. 
  16462. File: gdb.info, Node: AVR, Next: CRIS, Prev: PowerPC Embedded, Up: Embedded Processors
  16463. 21.3.8 Atmel AVR
  16464. ----------------
  16465. When configured for debugging the Atmel AVR, GDB supports the following
  16466. AVR-specific commands:
  16467. 'info io_registers'
  16468. This command displays information about the AVR I/O registers. For
  16469. each register, GDB prints its number and value.
  16470. 
  16471. File: gdb.info, Node: CRIS, Next: Super-H, Prev: AVR, Up: Embedded Processors
  16472. 21.3.9 CRIS
  16473. -----------
  16474. When configured for debugging CRIS, GDB provides the following
  16475. CRIS-specific commands:
  16476. 'set cris-version VER'
  16477. Set the current CRIS version to VER, either '10' or '32'. The CRIS
  16478. version affects register names and sizes. This command is useful
  16479. in case autodetection of the CRIS version fails.
  16480. 'show cris-version'
  16481. Show the current CRIS version.
  16482. 'set cris-dwarf2-cfi'
  16483. Set the usage of DWARF-2 CFI for CRIS debugging. The default is
  16484. 'on'. Change to 'off' when using 'gcc-cris' whose version is below
  16485. 'R59'.
  16486. 'show cris-dwarf2-cfi'
  16487. Show the current state of using DWARF-2 CFI.
  16488. 'set cris-mode MODE'
  16489. Set the current CRIS mode to MODE. It should only be changed when
  16490. debugging in guru mode, in which case it should be set to 'guru'
  16491. (the default is 'normal').
  16492. 'show cris-mode'
  16493. Show the current CRIS mode.
  16494. 
  16495. File: gdb.info, Node: Super-H, Prev: CRIS, Up: Embedded Processors
  16496. 21.3.10 Renesas Super-H
  16497. -----------------------
  16498. For the Renesas Super-H processor, GDB provides these commands:
  16499. 'set sh calling-convention CONVENTION'
  16500. Set the calling-convention used when calling functions from GDB.
  16501. Allowed values are 'gcc', which is the default setting, and
  16502. 'renesas'. With the 'gcc' setting, functions are called using the
  16503. GCC calling convention. If the DWARF-2 information of the called
  16504. function specifies that the function follows the Renesas calling
  16505. convention, the function is called using the Renesas calling
  16506. convention. If the calling convention is set to 'renesas', the
  16507. Renesas calling convention is always used, regardless of the
  16508. DWARF-2 information. This can be used to override the default of
  16509. 'gcc' if debug information is missing, or the compiler does not
  16510. emit the DWARF-2 calling convention entry for a function.
  16511. 'show sh calling-convention'
  16512. Show the current calling convention setting.
  16513. 
  16514. File: gdb.info, Node: Architectures, Prev: Embedded Processors, Up: Configurations
  16515. 21.4 Architectures
  16516. ==================
  16517. This section describes characteristics of architectures that affect all
  16518. uses of GDB with the architecture, both native and cross.
  16519. * Menu:
  16520. * AArch64::
  16521. * i386::
  16522. * Alpha::
  16523. * MIPS::
  16524. * HPPA:: HP PA architecture
  16525. * PowerPC::
  16526. * Nios II::
  16527. * Sparc64::
  16528. * S12Z::
  16529. 
  16530. File: gdb.info, Node: AArch64, Next: i386, Up: Architectures
  16531. 21.4.1 AArch64
  16532. --------------
  16533. When GDB is debugging the AArch64 architecture, it provides the
  16534. following special commands:
  16535. 'set debug aarch64'
  16536. This command determines whether AArch64 architecture-specific
  16537. debugging messages are to be displayed.
  16538. 'show debug aarch64'
  16539. Show whether AArch64 debugging messages are displayed.
  16540. 21.4.1.1 AArch64 SVE.
  16541. .....................
  16542. When GDB is debugging the AArch64 architecture, if the Scalable Vector
  16543. Extension (SVE) is present, then GDB will provide the vector registers
  16544. '$z0' through '$z31', vector predicate registers '$p0' through '$p15',
  16545. and the '$ffr' register. In addition, the pseudo register '$vg' will be
  16546. provided. This is the vector granule for the current thread and
  16547. represents the number of 64-bit chunks in an SVE 'z' register.
  16548. If the vector length changes, then the '$vg' register will be
  16549. updated, but the lengths of the 'z' and 'p' registers will not change.
  16550. This is a known limitation of GDB and does not affect the execution of
  16551. the target process.
  16552. 21.4.1.2 AArch64 Pointer Authentication.
  16553. ........................................
  16554. When GDB is debugging the AArch64 architecture, and the program is using
  16555. the v8.3-A feature Pointer Authentication (PAC), then whenever the link
  16556. register '$lr' is pointing to an PAC function its value will be masked.
  16557. When GDB prints a backtrace, any addresses that required unmasking will
  16558. be postfixed with the marker [PAC]. When using the MI, this is printed
  16559. as part of the 'addr_flags' field.
  16560. 
  16561. File: gdb.info, Node: i386, Next: Alpha, Prev: AArch64, Up: Architectures
  16562. 21.4.2 x86 Architecture-specific Issues
  16563. ---------------------------------------
  16564. 'set struct-convention MODE'
  16565. Set the convention used by the inferior to return 'struct's and
  16566. 'union's from functions to MODE. Possible values of MODE are
  16567. '"pcc"', '"reg"', and '"default"' (the default). '"default"' or
  16568. '"pcc"' means that 'struct's are returned on the stack, while
  16569. '"reg"' means that a 'struct' or a 'union' whose size is 1, 2, 4,
  16570. or 8 bytes will be returned in a register.
  16571. 'show struct-convention'
  16572. Show the current setting of the convention to return 'struct's from
  16573. functions.
  16574. 21.4.2.1 Intel "Memory Protection Extensions" (MPX).
  16575. ....................................................
  16576. Memory Protection Extension (MPX) adds the bound registers 'BND0' (1)
  16577. through 'BND3'. Bound registers store a pair of 64-bit values which are
  16578. the lower bound and upper bound. Bounds are effective addresses or
  16579. memory locations. The upper bounds are architecturally represented in
  16580. 1's complement form. A bound having lower bound = 0, and upper bound =
  16581. 0 (1's complement of all bits set) will allow access to the entire
  16582. address space.
  16583. 'BND0' through 'BND3' are represented in GDB as 'bnd0raw' through
  16584. 'bnd3raw'. Pseudo registers 'bnd0' through 'bnd3' display the upper
  16585. bound performing the complement of one operation on the upper bound
  16586. value, i.e. when upper bound in 'bnd0raw' is 0 in the GDB 'bnd0' it will
  16587. be '0xfff...'. In this sense it can also be noted that the upper bounds
  16588. are inclusive.
  16589. As an example, assume that the register BND0 holds bounds for a
  16590. pointer having access allowed for the range between 0x32 and 0x71. The
  16591. values present on bnd0raw and bnd registers are presented as follows:
  16592. bnd0raw = {0x32, 0xffffffff8e}
  16593. bnd0 = {lbound = 0x32, ubound = 0x71} : size 64
  16594. This way the raw value can be accessed via bnd0raw...bnd3raw. Any
  16595. change on bnd0...bnd3 or bnd0raw...bnd3raw is reflect on its
  16596. counterpart. When the bnd0...bnd3 registers are displayed via Python,
  16597. the display includes the memory size, in bits, accessible to the
  16598. pointer.
  16599. Bounds can also be stored in bounds tables, which are stored in
  16600. application memory. These tables store bounds for pointers by
  16601. specifying the bounds pointer's value along with its bounds. Evaluating
  16602. and changing bounds located in bound tables is therefore interesting
  16603. while investigating bugs on MPX context. GDB provides commands for this
  16604. purpose:
  16605. 'show mpx bound POINTER'
  16606. Display bounds of the given POINTER.
  16607. 'set mpx bound POINTER, LBOUND, UBOUND'
  16608. Set the bounds of a pointer in the bound table. This command takes
  16609. three parameters: POINTER is the pointers whose bounds are to be
  16610. changed, LBOUND and UBOUND are new values for lower and upper
  16611. bounds respectively.
  16612. When you call an inferior function on an Intel MPX enabled program,
  16613. GDB sets the inferior's bound registers to the init (disabled) state
  16614. before calling the function. As a consequence, bounds checks for the
  16615. pointer arguments passed to the function will always pass.
  16616. This is necessary because when you call an inferior function, the
  16617. program is usually in the middle of the execution of other function.
  16618. Since at that point bound registers are in an arbitrary state, not
  16619. clearing them would lead to random bound violations in the called
  16620. function.
  16621. You can still examine the influence of the bound registers on the
  16622. execution of the called function by stopping the execution of the called
  16623. function at its prologue, setting bound registers, and continuing the
  16624. execution. For example:
  16625. $ break *upper
  16626. Breakpoint 2 at 0x4009de: file i386-mpx-call.c, line 47.
  16627. $ print upper (a, b, c, d, 1)
  16628. Breakpoint 2, upper (a=0x0, b=0x6e0000005b, c=0x0, d=0x0, len=48)....
  16629. $ print $bnd0
  16630. {lbound = 0x0, ubound = ffffffff} : size -1
  16631. At this last step the value of bnd0 can be changed for investigation
  16632. of bound violations caused along the execution of the call. In order to
  16633. know how to set the bound registers or bound table for the call consult
  16634. the ABI.
  16635. ---------- Footnotes ----------
  16636. (1) The register named with capital letters represent the
  16637. architecture registers.
  16638. 
  16639. File: gdb.info, Node: Alpha, Next: MIPS, Prev: i386, Up: Architectures
  16640. 21.4.3 Alpha
  16641. ------------
  16642. See the following section.
  16643. 
  16644. File: gdb.info, Node: MIPS, Next: HPPA, Prev: Alpha, Up: Architectures
  16645. 21.4.4 MIPS
  16646. -----------
  16647. Alpha- and MIPS-based computers use an unusual stack frame, which
  16648. sometimes requires GDB to search backward in the object code to find the
  16649. beginning of a function.
  16650. To improve response time (especially for embedded applications, where
  16651. GDB may be restricted to a slow serial line for this search) you may
  16652. want to limit the size of this search, using one of these commands:
  16653. 'set heuristic-fence-post LIMIT'
  16654. Restrict GDB to examining at most LIMIT bytes in its search for the
  16655. beginning of a function. A value of 0 (the default) means there is
  16656. no limit. However, except for 0, the larger the limit the more
  16657. bytes 'heuristic-fence-post' must search and therefore the longer
  16658. it takes to run. You should only need to use this command when
  16659. debugging a stripped executable.
  16660. 'show heuristic-fence-post'
  16661. Display the current limit.
  16662. These commands are available _only_ when GDB is configured for debugging
  16663. programs on Alpha or MIPS processors.
  16664. Several MIPS-specific commands are available when debugging MIPS
  16665. programs:
  16666. 'set mips abi ARG'
  16667. Tell GDB which MIPS ABI is used by the inferior. Possible values
  16668. of ARG are:
  16669. 'auto'
  16670. The default ABI associated with the current binary (this is
  16671. the default).
  16672. 'o32'
  16673. 'o64'
  16674. 'n32'
  16675. 'n64'
  16676. 'eabi32'
  16677. 'eabi64'
  16678. 'show mips abi'
  16679. Show the MIPS ABI used by GDB to debug the inferior.
  16680. 'set mips compression ARG'
  16681. Tell GDB which MIPS compressed ISA (Instruction Set Architecture)
  16682. encoding is used by the inferior. GDB uses this for code
  16683. disassembly and other internal interpretation purposes. This
  16684. setting is only referred to when no executable has been associated
  16685. with the debugging session or the executable does not provide
  16686. information about the encoding it uses. Otherwise this setting is
  16687. automatically updated from information provided by the executable.
  16688. Possible values of ARG are 'mips16' and 'micromips'. The default
  16689. compressed ISA encoding is 'mips16', as executables containing
  16690. MIPS16 code frequently are not identified as such.
  16691. This setting is "sticky"; that is, it retains its value across
  16692. debugging sessions until reset either explicitly with this command
  16693. or implicitly from an executable.
  16694. The compiler and/or assembler typically add symbol table
  16695. annotations to identify functions compiled for the MIPS16 or
  16696. microMIPS ISAs. If these function-scope annotations are present,
  16697. GDB uses them in preference to the global compressed ISA encoding
  16698. setting.
  16699. 'show mips compression'
  16700. Show the MIPS compressed ISA encoding used by GDB to debug the
  16701. inferior.
  16702. 'set mipsfpu'
  16703. 'show mipsfpu'
  16704. *Note set mipsfpu: MIPS Embedded.
  16705. 'set mips mask-address ARG'
  16706. This command determines whether the most-significant 32 bits of
  16707. 64-bit MIPS addresses are masked off. The argument ARG can be
  16708. 'on', 'off', or 'auto'. The latter is the default setting, which
  16709. lets GDB determine the correct value.
  16710. 'show mips mask-address'
  16711. Show whether the upper 32 bits of MIPS addresses are masked off or
  16712. not.
  16713. 'set remote-mips64-transfers-32bit-regs'
  16714. This command controls compatibility with 64-bit MIPS targets that
  16715. transfer data in 32-bit quantities. If you have an old MIPS 64
  16716. target that transfers 32 bits for some registers, like SR and FSR,
  16717. and 64 bits for other registers, set this option to 'on'.
  16718. 'show remote-mips64-transfers-32bit-regs'
  16719. Show the current setting of compatibility with older MIPS 64
  16720. targets.
  16721. 'set debug mips'
  16722. This command turns on and off debugging messages for the
  16723. MIPS-specific target code in GDB.
  16724. 'show debug mips'
  16725. Show the current setting of MIPS debugging messages.
  16726. 
  16727. File: gdb.info, Node: HPPA, Next: PowerPC, Prev: MIPS, Up: Architectures
  16728. 21.4.5 HPPA
  16729. -----------
  16730. When GDB is debugging the HP PA architecture, it provides the following
  16731. special commands:
  16732. 'set debug hppa'
  16733. This command determines whether HPPA architecture-specific
  16734. debugging messages are to be displayed.
  16735. 'show debug hppa'
  16736. Show whether HPPA debugging messages are displayed.
  16737. 'maint print unwind ADDRESS'
  16738. This command displays the contents of the unwind table entry at the
  16739. given ADDRESS.
  16740. 
  16741. File: gdb.info, Node: PowerPC, Next: Nios II, Prev: HPPA, Up: Architectures
  16742. 21.4.6 PowerPC
  16743. --------------
  16744. When GDB is debugging the PowerPC architecture, it provides a set of
  16745. pseudo-registers to enable inspection of 128-bit wide Decimal Floating
  16746. Point numbers stored in the floating point registers. These values must
  16747. be stored in two consecutive registers, always starting at an even
  16748. register like 'f0' or 'f2'.
  16749. The pseudo-registers go from '$dl0' through '$dl15', and are formed
  16750. by joining the even/odd register pairs 'f0' and 'f1' for '$dl0', 'f2'
  16751. and 'f3' for '$dl1' and so on.
  16752. For POWER7 processors, GDB provides a set of pseudo-registers, the
  16753. 64-bit wide Extended Floating Point Registers ('f32' through 'f63').
  16754. 
  16755. File: gdb.info, Node: Nios II, Next: Sparc64, Prev: PowerPC, Up: Architectures
  16756. 21.4.7 Nios II
  16757. --------------
  16758. When GDB is debugging the Nios II architecture, it provides the
  16759. following special commands:
  16760. 'set debug nios2'
  16761. This command turns on and off debugging messages for the Nios II
  16762. target code in GDB.
  16763. 'show debug nios2'
  16764. Show the current setting of Nios II debugging messages.
  16765. 
  16766. File: gdb.info, Node: Sparc64, Next: S12Z, Prev: Nios II, Up: Architectures
  16767. 21.4.8 Sparc64
  16768. --------------
  16769. 21.4.8.1 ADI Support
  16770. ....................
  16771. The M7 processor supports an Application Data Integrity (ADI) feature
  16772. that detects invalid data accesses. When software allocates memory and
  16773. enables ADI on the allocated memory, it chooses a 4-bit version number,
  16774. sets the version in the upper 4 bits of the 64-bit pointer to that data,
  16775. and stores the 4-bit version in every cacheline of that data. Hardware
  16776. saves the latter in spare bits in the cache and memory hierarchy. On
  16777. each load and store, the processor compares the upper 4 VA (virtual
  16778. address) bits to the cacheline's version. If there is a mismatch, the
  16779. processor generates a version mismatch trap which can be either precise
  16780. or disrupting. The trap is an error condition which the kernel delivers
  16781. to the process as a SIGSEGV signal.
  16782. Note that only 64-bit applications can use ADI and need to be built
  16783. with ADI-enabled.
  16784. Values of the ADI version tags, which are in granularity of a
  16785. cacheline (64 bytes), can be viewed or modified.
  16786. 'adi (examine | x) [ / N ] ADDR'
  16787. The 'adi examine' command displays the value of one ADI version tag
  16788. per cacheline.
  16789. N is a decimal integer specifying the number in bytes; the default
  16790. is 1. It specifies how much ADI version information, at the ratio
  16791. of 1:ADI block size, to display.
  16792. ADDR is the address in user address space where you want GDB to
  16793. begin displaying the ADI version tags.
  16794. Below is an example of displaying ADI versions of variable
  16795. "shmaddr".
  16796. (gdb) adi x/100 shmaddr
  16797. 0xfff800010002c000: 0 0
  16798. 'adi (assign | a) [ / N ] ADDR = TAG'
  16799. The 'adi assign' command is used to assign new ADI version tag to
  16800. an address.
  16801. N is a decimal integer specifying the number in bytes; the default
  16802. is 1. It specifies how much ADI version information, at the ratio
  16803. of 1:ADI block size, to modify.
  16804. ADDR is the address in user address space where you want GDB to
  16805. begin modifying the ADI version tags.
  16806. TAG is the new ADI version tag.
  16807. For example, do the following to modify then verify ADI versions of
  16808. variable "shmaddr":
  16809. (gdb) adi a/100 shmaddr = 7
  16810. (gdb) adi x/100 shmaddr
  16811. 0xfff800010002c000: 7 7
  16812. 
  16813. File: gdb.info, Node: S12Z, Prev: Sparc64, Up: Architectures
  16814. 21.4.9 S12Z
  16815. -----------
  16816. When GDB is debugging the S12Z architecture, it provides the following
  16817. special command:
  16818. 'maint info bdccsr'
  16819. This command displays the current value of the microprocessor's
  16820. BDCCSR register.
  16821. 
  16822. File: gdb.info, Node: Controlling GDB, Next: Extending GDB, Prev: Configurations, Up: Top
  16823. 22 Controlling GDB
  16824. ******************
  16825. You can alter the way GDB interacts with you by using the 'set' command.
  16826. For commands controlling how GDB displays data, see *note Print
  16827. Settings: Print Settings. Other settings are described here.
  16828. * Menu:
  16829. * Prompt:: Prompt
  16830. * Editing:: Command editing
  16831. * Command History:: Command history
  16832. * Screen Size:: Screen size
  16833. * Output Styling:: Output styling
  16834. * Numbers:: Numbers
  16835. * ABI:: Configuring the current ABI
  16836. * Auto-loading:: Automatically loading associated files
  16837. * Messages/Warnings:: Optional warnings and messages
  16838. * Debugging Output:: Optional messages about internal happenings
  16839. * Other Misc Settings:: Other Miscellaneous Settings
  16840. 
  16841. File: gdb.info, Node: Prompt, Next: Editing, Up: Controlling GDB
  16842. 22.1 Prompt
  16843. ===========
  16844. GDB indicates its readiness to read a command by printing a string
  16845. called the "prompt". This string is normally '(gdb)'. You can change
  16846. the prompt string with the 'set prompt' command. For instance, when
  16847. debugging GDB with GDB, it is useful to change the prompt in one of the
  16848. GDB sessions so that you can always tell which one you are talking to.
  16849. _Note:_ 'set prompt' does not add a space for you after the prompt
  16850. you set. This allows you to set a prompt which ends in a space or a
  16851. prompt that does not.
  16852. 'set prompt NEWPROMPT'
  16853. Directs GDB to use NEWPROMPT as its prompt string henceforth.
  16854. 'show prompt'
  16855. Prints a line of the form: 'Gdb's prompt is: YOUR-PROMPT'
  16856. Versions of GDB that ship with Python scripting enabled have prompt
  16857. extensions. The commands for interacting with these extensions are:
  16858. 'set extended-prompt PROMPT'
  16859. Set an extended prompt that allows for substitutions. *Note
  16860. gdb.prompt::, for a list of escape sequences that can be used for
  16861. substitution. Any escape sequences specified as part of the prompt
  16862. string are replaced with the corresponding strings each time the
  16863. prompt is displayed.
  16864. For example:
  16865. set extended-prompt Current working directory: \w (gdb)
  16866. Note that when an extended-prompt is set, it takes control of the
  16867. PROMPT_HOOK hook. *Note prompt_hook::, for further information.
  16868. 'show extended-prompt'
  16869. Prints the extended prompt. Any escape sequences specified as part
  16870. of the prompt string with 'set extended-prompt', are replaced with
  16871. the corresponding strings each time the prompt is displayed.
  16872. 
  16873. File: gdb.info, Node: Editing, Next: Command History, Prev: Prompt, Up: Controlling GDB
  16874. 22.2 Command Editing
  16875. ====================
  16876. GDB reads its input commands via the "Readline" interface. This GNU
  16877. library provides consistent behavior for programs which provide a
  16878. command line interface to the user. Advantages are GNU Emacs-style or
  16879. "vi"-style inline editing of commands, 'csh'-like history substitution,
  16880. and a storage and recall of command history across debugging sessions.
  16881. You may control the behavior of command line editing in GDB with the
  16882. command 'set'.
  16883. 'set editing'
  16884. 'set editing on'
  16885. Enable command line editing (enabled by default).
  16886. 'set editing off'
  16887. Disable command line editing.
  16888. 'show editing'
  16889. Show whether command line editing is enabled.
  16890. *Note Command Line Editing::, for more details about the Readline
  16891. interface. Users unfamiliar with GNU Emacs or 'vi' are encouraged to
  16892. read that chapter.
  16893. GDB sets the Readline application name to 'gdb'. This is useful for
  16894. conditions in '.inputrc'.
  16895. GDB defines a bindable Readline command, 'operate-and-get-next'.
  16896. This is bound to 'C-o' by default. This command accepts the current
  16897. line for execution and fetches the next line relative to the current
  16898. line from the history for editing. Any argument is ignored.
  16899. 
  16900. File: gdb.info, Node: Command History, Next: Screen Size, Prev: Editing, Up: Controlling GDB
  16901. 22.3 Command History
  16902. ====================
  16903. GDB can keep track of the commands you type during your debugging
  16904. sessions, so that you can be certain of precisely what happened. Use
  16905. these commands to manage the GDB command history facility.
  16906. GDB uses the GNU History library, a part of the Readline package, to
  16907. provide the history facility. *Note Using History Interactively::, for
  16908. the detailed description of the History library.
  16909. To issue a command to GDB without affecting certain aspects of the
  16910. state which is seen by users, prefix it with 'server ' (*note Server
  16911. Prefix::). This means that this command will not affect the command
  16912. history, nor will it affect GDB's notion of which command to repeat if
  16913. <RET> is pressed on a line by itself.
  16914. The server prefix does not affect the recording of values into the
  16915. value history; to print a value without recording it into the value
  16916. history, use the 'output' command instead of the 'print' command.
  16917. Here is the description of GDB commands related to command history.
  16918. 'set history filename FNAME'
  16919. Set the name of the GDB command history file to FNAME. This is the
  16920. file where GDB reads an initial command history list, and where it
  16921. writes the command history from this session when it exits. You
  16922. can access this list through history expansion or through the
  16923. history command editing characters listed below. This file
  16924. defaults to the value of the environment variable 'GDBHISTFILE', or
  16925. to './.gdb_history' ('./_gdb_history' on MS-DOS) if this variable
  16926. is not set.
  16927. 'set history save'
  16928. 'set history save on'
  16929. Record command history in a file, whose name may be specified with
  16930. the 'set history filename' command. By default, this option is
  16931. disabled.
  16932. 'set history save off'
  16933. Stop recording command history in a file.
  16934. 'set history size SIZE'
  16935. 'set history size unlimited'
  16936. Set the number of commands which GDB keeps in its history list.
  16937. This defaults to the value of the environment variable
  16938. 'GDBHISTSIZE', or to 256 if this variable is not set. Non-numeric
  16939. values of 'GDBHISTSIZE' are ignored. If SIZE is 'unlimited' or if
  16940. 'GDBHISTSIZE' is either a negative number or the empty string, then
  16941. the number of commands GDB keeps in the history list is unlimited.
  16942. 'set history remove-duplicates COUNT'
  16943. 'set history remove-duplicates unlimited'
  16944. Control the removal of duplicate history entries in the command
  16945. history list. If COUNT is non-zero, GDB will look back at the last
  16946. COUNT history entries and remove the first entry that is a
  16947. duplicate of the current entry being added to the command history
  16948. list. If COUNT is 'unlimited' then this lookbehind is unbounded.
  16949. If COUNT is 0, then removal of duplicate history entries is
  16950. disabled.
  16951. Only history entries added during the current session are
  16952. considered for removal. This option is set to 0 by default.
  16953. History expansion assigns special meaning to the character '!'.
  16954. *Note Event Designators::, for more details.
  16955. Since '!' is also the logical not operator in C, history expansion is
  16956. off by default. If you decide to enable history expansion with the 'set
  16957. history expansion on' command, you may sometimes need to follow '!'
  16958. (when it is used as logical not, in an expression) with a space or a tab
  16959. to prevent it from being expanded. The readline history facilities do
  16960. not attempt substitution on the strings '!=' and '!(', even when history
  16961. expansion is enabled.
  16962. The commands to control history expansion are:
  16963. 'set history expansion on'
  16964. 'set history expansion'
  16965. Enable history expansion. History expansion is off by default.
  16966. 'set history expansion off'
  16967. Disable history expansion.
  16968. 'show history'
  16969. 'show history filename'
  16970. 'show history save'
  16971. 'show history size'
  16972. 'show history expansion'
  16973. These commands display the state of the GDB history parameters.
  16974. 'show history' by itself displays all four states.
  16975. 'show commands'
  16976. Display the last ten commands in the command history.
  16977. 'show commands N'
  16978. Print ten commands centered on command number N.
  16979. 'show commands +'
  16980. Print ten commands just after the commands last printed.
  16981. 
  16982. File: gdb.info, Node: Screen Size, Next: Output Styling, Prev: Command History, Up: Controlling GDB
  16983. 22.4 Screen Size
  16984. ================
  16985. Certain commands to GDB may produce large amounts of information output
  16986. to the screen. To help you read all of it, GDB pauses and asks you for
  16987. input at the end of each page of output. Type <RET> when you want to
  16988. see one more page of output, 'q' to discard the remaining output, or 'c'
  16989. to continue without paging for the rest of the current command. Also,
  16990. the screen width setting determines when to wrap lines of output.
  16991. Depending on what is being printed, GDB tries to break the line at a
  16992. readable place, rather than simply letting it overflow onto the
  16993. following line.
  16994. Normally GDB knows the size of the screen from the terminal driver
  16995. software. For example, on Unix GDB uses the termcap data base together
  16996. with the value of the 'TERM' environment variable and the 'stty rows'
  16997. and 'stty cols' settings. If this is not correct, you can override it
  16998. with the 'set height' and 'set width' commands:
  16999. 'set height LPP'
  17000. 'set height unlimited'
  17001. 'show height'
  17002. 'set width CPL'
  17003. 'set width unlimited'
  17004. 'show width'
  17005. These 'set' commands specify a screen height of LPP lines and a
  17006. screen width of CPL characters. The associated 'show' commands
  17007. display the current settings.
  17008. If you specify a height of either 'unlimited' or zero lines, GDB
  17009. does not pause during output no matter how long the output is.
  17010. This is useful if output is to a file or to an editor buffer.
  17011. Likewise, you can specify 'set width unlimited' or 'set width 0' to
  17012. prevent GDB from wrapping its output.
  17013. 'set pagination on'
  17014. 'set pagination off'
  17015. Turn the output pagination on or off; the default is on. Turning
  17016. pagination off is the alternative to 'set height unlimited'. Note
  17017. that running GDB with the '--batch' option (*note -batch: Mode
  17018. Options.) also automatically disables pagination.
  17019. 'show pagination'
  17020. Show the current pagination mode.
  17021. 
  17022. File: gdb.info, Node: Output Styling, Next: Numbers, Prev: Screen Size, Up: Controlling GDB
  17023. 22.5 Output Styling
  17024. ===================
  17025. GDB can style its output on a capable terminal. This is enabled by
  17026. default on most systems, but disabled by default when in batch mode
  17027. (*note Mode Options::). Various style settings are available; and
  17028. styles can also be disabled entirely.
  17029. 'set style enabled 'on|off''
  17030. Enable or disable all styling. The default is host-dependent, with
  17031. most hosts defaulting to 'on'.
  17032. 'show style enabled'
  17033. Show the current state of styling.
  17034. 'set style sources 'on|off''
  17035. Enable or disable source code styling. This affects whether source
  17036. code, such as the output of the 'list' command, is styled. Note
  17037. that source styling only works if styling in general is enabled,
  17038. and if GDB was linked with the GNU Source Highlight library. The
  17039. default is 'on'.
  17040. 'show style sources'
  17041. Show the current state of source code styling.
  17042. Subcommands of 'set style' control specific forms of styling. These
  17043. subcommands all follow the same pattern: each style-able object can be
  17044. styled with a foreground color, a background color, and an intensity.
  17045. For example, the style of file names can be controlled using the 'set
  17046. style filename' group of commands:
  17047. 'set style filename background COLOR'
  17048. Set the background to COLOR. Valid colors are 'none' (meaning the
  17049. terminal's default color), 'black', 'red', 'green', 'yellow',
  17050. 'blue', 'magenta', 'cyan', and'white'.
  17051. 'set style filename foreground COLOR'
  17052. Set the foreground to COLOR. Valid colors are 'none' (meaning the
  17053. terminal's default color), 'black', 'red', 'green', 'yellow',
  17054. 'blue', 'magenta', 'cyan', and'white'.
  17055. 'set style filename intensity VALUE'
  17056. Set the intensity to VALUE. Valid intensities are 'normal' (the
  17057. default), 'bold', and 'dim'.
  17058. The 'show style' command and its subcommands are styling a style name
  17059. in their output using its own style. So, use 'show style' to see the
  17060. complete list of styles, their characteristics and the visual aspect of
  17061. each style.
  17062. The style-able objects are:
  17063. 'filename'
  17064. Control the styling of file names. By default, this style's
  17065. foreground color is green.
  17066. 'function'
  17067. Control the styling of function names. These are managed with the
  17068. 'set style function' family of commands. By default, this style's
  17069. foreground color is yellow.
  17070. 'variable'
  17071. Control the styling of variable names. These are managed with the
  17072. 'set style variable' family of commands. By default, this style's
  17073. foreground color is cyan.
  17074. 'address'
  17075. Control the styling of addresses. These are managed with the 'set
  17076. style address' family of commands. By default, this style's
  17077. foreground color is blue.
  17078. 'title'
  17079. Control the styling of titles. These are managed with the 'set
  17080. style title' family of commands. By default, this style's
  17081. intensity is bold. Commands are using the title style to improve
  17082. the readability of large output. For example, the commands
  17083. 'apropos' and 'help' are using the title style for the command
  17084. names.
  17085. 'highlight'
  17086. Control the styling of highlightings. These are managed with the
  17087. 'set style highlight' family of commands. By default, this style's
  17088. foreground color is red. Commands are using the highlight style to
  17089. draw the user attention to some specific parts of their output.
  17090. For example, the command 'apropos -v REGEXP' uses the highlight
  17091. style to mark the documentation parts matching REGEXP.
  17092. 'tui-border'
  17093. Control the styling of the TUI border. Note that, unlike other
  17094. styling options, only the color of the border can be controlled via
  17095. 'set style'. This was done for compatibility reasons, as TUI
  17096. controls to set the border's intensity predated the addition of
  17097. general styling to GDB. *Note TUI Configuration::.
  17098. 'tui-active-border'
  17099. Control the styling of the active TUI border; that is, the TUI
  17100. window that has the focus.
  17101. 
  17102. File: gdb.info, Node: Numbers, Next: ABI, Prev: Output Styling, Up: Controlling GDB
  17103. 22.6 Numbers
  17104. ============
  17105. You can always enter numbers in octal, decimal, or hexadecimal in GDB by
  17106. the usual conventions: octal numbers begin with '0', decimal numbers end
  17107. with '.', and hexadecimal numbers begin with '0x'. Numbers that neither
  17108. begin with '0' or '0x', nor end with a '.' are, by default, entered in
  17109. base 10; likewise, the default display for numbers--when no particular
  17110. format is specified--is base 10. You can change the default base for
  17111. both input and output with the commands described below.
  17112. 'set input-radix BASE'
  17113. Set the default base for numeric input. Supported choices for BASE
  17114. are decimal 8, 10, or 16. The base must itself be specified either
  17115. unambiguously or using the current input radix; for example, any of
  17116. set input-radix 012
  17117. set input-radix 10.
  17118. set input-radix 0xa
  17119. sets the input base to decimal. On the other hand, 'set
  17120. input-radix 10' leaves the input radix unchanged, no matter what it
  17121. was, since '10', being without any leading or trailing signs of its
  17122. base, is interpreted in the current radix. Thus, if the current
  17123. radix is 16, '10' is interpreted in hex, i.e. as 16 decimal, which
  17124. doesn't change the radix.
  17125. 'set output-radix BASE'
  17126. Set the default base for numeric display. Supported choices for
  17127. BASE are decimal 8, 10, or 16. The base must itself be specified
  17128. either unambiguously or using the current input radix.
  17129. 'show input-radix'
  17130. Display the current default base for numeric input.
  17131. 'show output-radix'
  17132. Display the current default base for numeric display.
  17133. 'set radix [BASE]'
  17134. 'show radix'
  17135. These commands set and show the default base for both input and
  17136. output of numbers. 'set radix' sets the radix of input and output
  17137. to the same base; without an argument, it resets the radix back to
  17138. its default value of 10.
  17139. 
  17140. File: gdb.info, Node: ABI, Next: Auto-loading, Prev: Numbers, Up: Controlling GDB
  17141. 22.7 Configuring the Current ABI
  17142. ================================
  17143. GDB can determine the "ABI" (Application Binary Interface) of your
  17144. application automatically. However, sometimes you need to override its
  17145. conclusions. Use these commands to manage GDB's view of the current
  17146. ABI.
  17147. One GDB configuration can debug binaries for multiple operating
  17148. system targets, either via remote debugging or native emulation. GDB
  17149. will autodetect the "OS ABI" (Operating System ABI) in use, but you can
  17150. override its conclusion using the 'set osabi' command. One example
  17151. where this is useful is in debugging of binaries which use an alternate
  17152. C library (e.g. UCLIBC for GNU/Linux) which does not have the same
  17153. identifying marks that the standard C library for your platform
  17154. provides.
  17155. When GDB is debugging the AArch64 architecture, it provides a
  17156. "Newlib" OS ABI. This is useful for handling 'setjmp' and 'longjmp' when
  17157. debugging binaries that use the NEWLIB C library. The "Newlib" OS ABI
  17158. can be selected by 'set osabi Newlib'.
  17159. 'show osabi'
  17160. Show the OS ABI currently in use.
  17161. 'set osabi'
  17162. With no argument, show the list of registered available OS ABI's.
  17163. 'set osabi ABI'
  17164. Set the current OS ABI to ABI.
  17165. Generally, the way that an argument of type 'float' is passed to a
  17166. function depends on whether the function is prototyped. For a
  17167. prototyped (i.e. ANSI/ISO style) function, 'float' arguments are passed
  17168. unchanged, according to the architecture's convention for 'float'. For
  17169. unprototyped (i.e. K&R style) functions, 'float' arguments are first
  17170. promoted to type 'double' and then passed.
  17171. Unfortunately, some forms of debug information do not reliably
  17172. indicate whether a function is prototyped. If GDB calls a function that
  17173. is not marked as prototyped, it consults 'set coerce-float-to-double'.
  17174. 'set coerce-float-to-double'
  17175. 'set coerce-float-to-double on'
  17176. Arguments of type 'float' will be promoted to 'double' when passed
  17177. to an unprototyped function. This is the default setting.
  17178. 'set coerce-float-to-double off'
  17179. Arguments of type 'float' will be passed directly to unprototyped
  17180. functions.
  17181. 'show coerce-float-to-double'
  17182. Show the current setting of promoting 'float' to 'double'.
  17183. GDB needs to know the ABI used for your program's C++ objects. The
  17184. correct C++ ABI depends on which C++ compiler was used to build your
  17185. application. GDB only fully supports programs with a single C++ ABI; if
  17186. your program contains code using multiple C++ ABI's or if GDB can not
  17187. identify your program's ABI correctly, you can tell GDB which ABI to
  17188. use. Currently supported ABI's include "gnu-v2", for 'g++' versions
  17189. before 3.0, "gnu-v3", for 'g++' versions 3.0 and later, and "hpaCC" for
  17190. the HP ANSI C++ compiler. Other C++ compilers may use the "gnu-v2" or
  17191. "gnu-v3" ABI's as well. The default setting is "auto".
  17192. 'show cp-abi'
  17193. Show the C++ ABI currently in use.
  17194. 'set cp-abi'
  17195. With no argument, show the list of supported C++ ABI's.
  17196. 'set cp-abi ABI'
  17197. 'set cp-abi auto'
  17198. Set the current C++ ABI to ABI, or return to automatic detection.
  17199. 
  17200. File: gdb.info, Node: Auto-loading, Next: Messages/Warnings, Prev: ABI, Up: Controlling GDB
  17201. 22.8 Automatically loading associated files
  17202. ===========================================
  17203. GDB sometimes reads files with commands and settings automatically,
  17204. without being explicitly told so by the user. We call this feature
  17205. "auto-loading". While auto-loading is useful for automatically adapting
  17206. GDB to the needs of your project, it can sometimes produce unexpected
  17207. results or introduce security risks (e.g., if the file comes from
  17208. untrusted sources).
  17209. * Menu:
  17210. * Init File in the Current Directory:: 'set/show/info auto-load local-gdbinit'
  17211. * libthread_db.so.1 file:: 'set/show/info auto-load libthread-db'
  17212. * Auto-loading safe path:: 'set/show/info auto-load safe-path'
  17213. * Auto-loading verbose mode:: 'set/show debug auto-load'
  17214. There are various kinds of files GDB can automatically load. In
  17215. addition to these files, GDB supports auto-loading code written in
  17216. various extension languages. *Note Auto-loading extensions::.
  17217. Note that loading of these associated files (including the local
  17218. '.gdbinit' file) requires accordingly configured 'auto-load safe-path'
  17219. (*note Auto-loading safe path::).
  17220. For these reasons, GDB includes commands and options to let you
  17221. control when to auto-load files and which files should be auto-loaded.
  17222. 'set auto-load off'
  17223. Globally disable loading of all auto-loaded files. You may want to
  17224. use this command with the '-iex' option (*note Option
  17225. -init-eval-command::) such as:
  17226. $ gdb -iex "set auto-load off" untrusted-executable corefile
  17227. Be aware that system init file (*note System-wide configuration::)
  17228. and init files from your home directory (*note Home Directory Init
  17229. File::) still get read (as they come from generally trusted
  17230. directories). To prevent GDB from auto-loading even those init
  17231. files, use the '-nx' option (*note Mode Options::), in addition to
  17232. 'set auto-load no'.
  17233. 'show auto-load'
  17234. Show whether auto-loading of each specific 'auto-load' file(s) is
  17235. enabled or disabled.
  17236. (gdb) show auto-load
  17237. gdb-scripts: Auto-loading of canned sequences of commands scripts is on.
  17238. libthread-db: Auto-loading of inferior specific libthread_db is on.
  17239. local-gdbinit: Auto-loading of .gdbinit script from current directory
  17240. is on.
  17241. python-scripts: Auto-loading of Python scripts is on.
  17242. safe-path: List of directories from which it is safe to auto-load files
  17243. is $debugdir:$datadir/auto-load.
  17244. scripts-directory: List of directories from which to load auto-loaded scripts
  17245. is $debugdir:$datadir/auto-load.
  17246. 'info auto-load'
  17247. Print whether each specific 'auto-load' file(s) have been
  17248. auto-loaded or not.
  17249. (gdb) info auto-load
  17250. gdb-scripts:
  17251. Loaded Script
  17252. Yes /home/user/gdb/gdb-gdb.gdb
  17253. libthread-db: No auto-loaded libthread-db.
  17254. local-gdbinit: Local .gdbinit file "/home/user/gdb/.gdbinit" has been
  17255. loaded.
  17256. python-scripts:
  17257. Loaded Script
  17258. Yes /home/user/gdb/gdb-gdb.py
  17259. These are GDB control commands for the auto-loading:
  17260. *Note set auto-load off::. Disable auto-loading globally.
  17261. *Note show auto-load::. Show setting of all kinds of
  17262. files.
  17263. *Note info auto-load::. Show state of all kinds of files.
  17264. *Note set auto-load gdb-scripts::. Control for GDB command scripts.
  17265. *Note show auto-load gdb-scripts::. Show setting of GDB command
  17266. scripts.
  17267. *Note info auto-load gdb-scripts::. Show state of GDB command scripts.
  17268. *Note set auto-load python-scripts::.Control for GDB Python scripts.
  17269. *Note show auto-load python-scripts::.Show setting of GDB Python
  17270. scripts.
  17271. *Note info auto-load python-scripts::.Show state of GDB Python scripts.
  17272. *Note set auto-load guile-scripts::. Control for GDB Guile scripts.
  17273. *Note show auto-load guile-scripts::.Show setting of GDB Guile scripts.
  17274. *Note info auto-load guile-scripts::.Show state of GDB Guile scripts.
  17275. *Note set auto-load scripts-directory::.Control for GDB auto-loaded
  17276. scripts location.
  17277. *Note show auto-load scripts-directory::.Show GDB auto-loaded scripts
  17278. location.
  17279. *Note add-auto-load-scripts-directory::.Add directory for auto-loaded
  17280. scripts location list.
  17281. *Note set auto-load local-gdbinit::. Control for init file in the
  17282. current directory.
  17283. *Note show auto-load local-gdbinit::.Show setting of init file in the
  17284. current directory.
  17285. *Note info auto-load local-gdbinit::.Show state of init file in the
  17286. current directory.
  17287. *Note set auto-load libthread-db::. Control for thread debugging
  17288. library.
  17289. *Note show auto-load libthread-db::. Show setting of thread debugging
  17290. library.
  17291. *Note info auto-load libthread-db::. Show state of thread debugging
  17292. library.
  17293. *Note set auto-load safe-path::. Control directories trusted for
  17294. automatic loading.
  17295. *Note show auto-load safe-path::. Show directories trusted for
  17296. automatic loading.
  17297. *Note add-auto-load-safe-path::. Add directory trusted for
  17298. automatic loading.
  17299. 
  17300. File: gdb.info, Node: Init File in the Current Directory, Next: libthread_db.so.1 file, Up: Auto-loading
  17301. 22.8.1 Automatically loading init file in the current directory
  17302. ---------------------------------------------------------------
  17303. By default, GDB reads and executes the canned sequences of commands from
  17304. init file (if any) in the current working directory, see *note Init File
  17305. in the Current Directory during Startup::.
  17306. Note that loading of this local '.gdbinit' file also requires
  17307. accordingly configured 'auto-load safe-path' (*note Auto-loading safe
  17308. path::).
  17309. 'set auto-load local-gdbinit [on|off]'
  17310. Enable or disable the auto-loading of canned sequences of commands
  17311. (*note Sequences::) found in init file in the current directory.
  17312. 'show auto-load local-gdbinit'
  17313. Show whether auto-loading of canned sequences of commands from init
  17314. file in the current directory is enabled or disabled.
  17315. 'info auto-load local-gdbinit'
  17316. Print whether canned sequences of commands from init file in the
  17317. current directory have been auto-loaded.
  17318. 
  17319. File: gdb.info, Node: libthread_db.so.1 file, Next: Auto-loading safe path, Prev: Init File in the Current Directory, Up: Auto-loading
  17320. 22.8.2 Automatically loading thread debugging library
  17321. -----------------------------------------------------
  17322. This feature is currently present only on GNU/Linux native hosts.
  17323. GDB reads in some cases thread debugging library from places specific
  17324. to the inferior (*note set libthread-db-search-path::).
  17325. The special 'libthread-db-search-path' entry '$sdir' is processed
  17326. without checking this 'set auto-load libthread-db' switch as system
  17327. libraries have to be trusted in general. In all other cases of
  17328. 'libthread-db-search-path' entries GDB checks first if 'set auto-load
  17329. libthread-db' is enabled before trying to open such thread debugging
  17330. library.
  17331. Note that loading of this debugging library also requires accordingly
  17332. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  17333. 'set auto-load libthread-db [on|off]'
  17334. Enable or disable the auto-loading of inferior specific thread
  17335. debugging library.
  17336. 'show auto-load libthread-db'
  17337. Show whether auto-loading of inferior specific thread debugging
  17338. library is enabled or disabled.
  17339. 'info auto-load libthread-db'
  17340. Print the list of all loaded inferior specific thread debugging
  17341. libraries and for each such library print list of inferior PIDs
  17342. using it.
  17343. 
  17344. File: gdb.info, Node: Auto-loading safe path, Next: Auto-loading verbose mode, Prev: libthread_db.so.1 file, Up: Auto-loading
  17345. 22.8.3 Security restriction for auto-loading
  17346. --------------------------------------------
  17347. As the files of inferior can come from untrusted source (such as
  17348. submitted by an application user) GDB does not always load any files
  17349. automatically. GDB provides the 'set auto-load safe-path' setting to
  17350. list directories trusted for loading files not explicitly requested by
  17351. user. Each directory can also be a shell wildcard pattern.
  17352. If the path is not set properly you will see a warning and the file
  17353. will not get loaded:
  17354. $ ./gdb -q ./gdb
  17355. Reading symbols from /home/user/gdb/gdb...done.
  17356. warning: File "/home/user/gdb/gdb-gdb.gdb" auto-loading has been
  17357. declined by your `auto-load safe-path' set
  17358. to "$debugdir:$datadir/auto-load".
  17359. warning: File "/home/user/gdb/gdb-gdb.py" auto-loading has been
  17360. declined by your `auto-load safe-path' set
  17361. to "$debugdir:$datadir/auto-load".
  17362. To instruct GDB to go ahead and use the init files anyway, invoke GDB
  17363. like this:
  17364. $ gdb -q -iex "set auto-load safe-path /home/user/gdb" ./gdb
  17365. The list of trusted directories is controlled by the following
  17366. commands:
  17367. 'set auto-load safe-path [DIRECTORIES]'
  17368. Set the list of directories (and their subdirectories) trusted for
  17369. automatic loading and execution of scripts. You can also enter a
  17370. specific trusted file. Each directory can also be a shell wildcard
  17371. pattern; wildcards do not match directory separator - see
  17372. 'FNM_PATHNAME' for system function 'fnmatch' (*note fnmatch:
  17373. (libc)Wildcard Matching.). If you omit DIRECTORIES, 'auto-load
  17374. safe-path' will be reset to its default value as specified during
  17375. GDB compilation.
  17376. The list of directories uses path separator (':' on GNU and Unix
  17377. systems, ';' on MS-Windows and MS-DOS) to separate directories,
  17378. similarly to the 'PATH' environment variable.
  17379. 'show auto-load safe-path'
  17380. Show the list of directories trusted for automatic loading and
  17381. execution of scripts.
  17382. 'add-auto-load-safe-path'
  17383. Add an entry (or list of entries) to the list of directories
  17384. trusted for automatic loading and execution of scripts. Multiple
  17385. entries may be delimited by the host platform path separator in
  17386. use.
  17387. This variable defaults to what '--with-auto-load-dir' has been
  17388. configured to (*note with-auto-load-dir::). '$debugdir' and '$datadir'
  17389. substitution applies the same as for *note set auto-load
  17390. scripts-directory::. The default 'set auto-load safe-path' value can be
  17391. also overriden by GDB configuration option '--with-auto-load-safe-path'.
  17392. Setting this variable to '/' disables this security protection,
  17393. corresponding GDB configuration option is
  17394. '--without-auto-load-safe-path'. This variable is supposed to be set to
  17395. the system directories writable by the system superuser only. Users can
  17396. add their source directories in init files in their home directories
  17397. (*note Home Directory Init File::). See also deprecated init file in
  17398. the current directory (*note Init File in the Current Directory during
  17399. Startup::).
  17400. To force GDB to load the files it declined to load in the previous
  17401. example, you could use one of the following ways:
  17402. '~/.gdbinit': 'add-auto-load-safe-path ~/src/gdb'
  17403. Specify this trusted directory (or a file) as additional component
  17404. of the list. You have to specify also any existing directories
  17405. displayed by by 'show auto-load safe-path' (such as '/usr:/bin' in
  17406. this example).
  17407. 'gdb -iex "set auto-load safe-path /usr:/bin:~/src/gdb" ...'
  17408. Specify this directory as in the previous case but just for a
  17409. single GDB session.
  17410. 'gdb -iex "set auto-load safe-path /" ...'
  17411. Disable auto-loading safety for a single GDB session. This assumes
  17412. all the files you debug during this GDB session will come from
  17413. trusted sources.
  17414. './configure --without-auto-load-safe-path'
  17415. During compilation of GDB you may disable any auto-loading safety.
  17416. This assumes all the files you will ever debug with this GDB come
  17417. from trusted sources.
  17418. On the other hand you can also explicitly forbid automatic files
  17419. loading which also suppresses any such warning messages:
  17420. 'gdb -iex "set auto-load no" ...'
  17421. You can use GDB command-line option for a single GDB session.
  17422. '~/.gdbinit': 'set auto-load no'
  17423. Disable auto-loading globally for the user (*note Home Directory
  17424. Init File::). While it is improbable, you could also use system
  17425. init file instead (*note System-wide configuration::).
  17426. This setting applies to the file names as entered by user. If no
  17427. entry matches GDB tries as a last resort to also resolve all the file
  17428. names into their canonical form (typically resolving symbolic links) and
  17429. compare the entries again. GDB already canonicalizes most of the
  17430. filenames on its own before starting the comparison so a canonical form
  17431. of directories is recommended to be entered.
  17432. 
  17433. File: gdb.info, Node: Auto-loading verbose mode, Prev: Auto-loading safe path, Up: Auto-loading
  17434. 22.8.4 Displaying files tried for auto-load
  17435. -------------------------------------------
  17436. For better visibility of all the file locations where you can place
  17437. scripts to be auto-loaded with inferior -- or to protect yourself
  17438. against accidental execution of untrusted scripts -- GDB provides a
  17439. feature for printing all the files attempted to be loaded. Both
  17440. existing and non-existing files may be printed.
  17441. For example the list of directories from which it is safe to
  17442. auto-load files (*note Auto-loading safe path::) applies also to
  17443. canonicalized filenames which may not be too obvious while setting it
  17444. up.
  17445. (gdb) set debug auto-load on
  17446. (gdb) file ~/src/t/true
  17447. auto-load: Loading canned sequences of commands script "/tmp/true-gdb.gdb"
  17448. for objfile "/tmp/true".
  17449. auto-load: Updating directories of "/usr:/opt".
  17450. auto-load: Using directory "/usr".
  17451. auto-load: Using directory "/opt".
  17452. warning: File "/tmp/true-gdb.gdb" auto-loading has been declined
  17453. by your `auto-load safe-path' set to "/usr:/opt".
  17454. 'set debug auto-load [on|off]'
  17455. Set whether to print the filenames attempted to be auto-loaded.
  17456. 'show debug auto-load'
  17457. Show whether printing of the filenames attempted to be auto-loaded
  17458. is turned on or off.
  17459. 
  17460. File: gdb.info, Node: Messages/Warnings, Next: Debugging Output, Prev: Auto-loading, Up: Controlling GDB
  17461. 22.9 Optional Warnings and Messages
  17462. ===================================
  17463. By default, GDB is silent about its inner workings. If you are running
  17464. on a slow machine, you may want to use the 'set verbose' command. This
  17465. makes GDB tell you when it does a lengthy internal operation, so you
  17466. will not think it has crashed.
  17467. Currently, the messages controlled by 'set verbose' are those which
  17468. announce that the symbol table for a source file is being read; see
  17469. 'symbol-file' in *note Commands to Specify Files: Files.
  17470. 'set verbose on'
  17471. Enables GDB output of certain informational messages.
  17472. 'set verbose off'
  17473. Disables GDB output of certain informational messages.
  17474. 'show verbose'
  17475. Displays whether 'set verbose' is on or off.
  17476. By default, if GDB encounters bugs in the symbol table of an object
  17477. file, it is silent; but if you are debugging a compiler, you may find
  17478. this information useful (*note Errors Reading Symbol Files: Symbol
  17479. Errors.).
  17480. 'set complaints LIMIT'
  17481. Permits GDB to output LIMIT complaints about each type of unusual
  17482. symbols before becoming silent about the problem. Set LIMIT to
  17483. zero to suppress all complaints; set it to a large number to
  17484. prevent complaints from being suppressed.
  17485. 'show complaints'
  17486. Displays how many symbol complaints GDB is permitted to produce.
  17487. By default, GDB is cautious, and asks what sometimes seems to be a
  17488. lot of stupid questions to confirm certain commands. For example, if
  17489. you try to run a program which is already running:
  17490. (gdb) run
  17491. The program being debugged has been started already.
  17492. Start it from the beginning? (y or n)
  17493. If you are willing to unflinchingly face the consequences of your own
  17494. commands, you can disable this "feature":
  17495. 'set confirm off'
  17496. Disables confirmation requests. Note that running GDB with the
  17497. '--batch' option (*note -batch: Mode Options.) also automatically
  17498. disables confirmation requests.
  17499. 'set confirm on'
  17500. Enables confirmation requests (the default).
  17501. 'show confirm'
  17502. Displays state of confirmation requests.
  17503. If you need to debug user-defined commands or sourced files you may
  17504. find it useful to enable "command tracing". In this mode each command
  17505. will be printed as it is executed, prefixed with one or more '+'
  17506. symbols, the quantity denoting the call depth of each command.
  17507. 'set trace-commands on'
  17508. Enable command tracing.
  17509. 'set trace-commands off'
  17510. Disable command tracing.
  17511. 'show trace-commands'
  17512. Display the current state of command tracing.
  17513. 
  17514. File: gdb.info, Node: Debugging Output, Next: Other Misc Settings, Prev: Messages/Warnings, Up: Controlling GDB
  17515. 22.10 Optional Messages about Internal Happenings
  17516. =================================================
  17517. GDB has commands that enable optional debugging messages from various
  17518. GDB subsystems; normally these commands are of interest to GDB
  17519. maintainers, or when reporting a bug. This section documents those
  17520. commands.
  17521. 'set exec-done-display'
  17522. Turns on or off the notification of asynchronous commands'
  17523. completion. When on, GDB will print a message when an asynchronous
  17524. command finishes its execution. The default is off.
  17525. 'show exec-done-display'
  17526. Displays the current setting of asynchronous command completion
  17527. notification.
  17528. 'set debug aarch64'
  17529. Turns on or off display of debugging messages related to ARM
  17530. AArch64. The default is off.
  17531. 'show debug aarch64'
  17532. Displays the current state of displaying debugging messages related
  17533. to ARM AArch64.
  17534. 'set debug arch'
  17535. Turns on or off display of gdbarch debugging info. The default is
  17536. off
  17537. 'show debug arch'
  17538. Displays the current state of displaying gdbarch debugging info.
  17539. 'set debug aix-solib'
  17540. Control display of debugging messages from the AIX shared library
  17541. support module. The default is off.
  17542. 'show debug aix-thread'
  17543. Show the current state of displaying AIX shared library debugging
  17544. messages.
  17545. 'set debug aix-thread'
  17546. Display debugging messages about inner workings of the AIX thread
  17547. module.
  17548. 'show debug aix-thread'
  17549. Show the current state of AIX thread debugging info display.
  17550. 'set debug check-physname'
  17551. Check the results of the "physname" computation. When reading
  17552. DWARF debugging information for C++, GDB attempts to compute each
  17553. entity's name. GDB can do this computation in two different ways,
  17554. depending on exactly what information is present. When enabled,
  17555. this setting causes GDB to compute the names both ways and display
  17556. any discrepancies.
  17557. 'show debug check-physname'
  17558. Show the current state of "physname" checking.
  17559. 'set debug coff-pe-read'
  17560. Control display of debugging messages related to reading of COFF/PE
  17561. exported symbols. The default is off.
  17562. 'show debug coff-pe-read'
  17563. Displays the current state of displaying debugging messages related
  17564. to reading of COFF/PE exported symbols.
  17565. 'set debug dwarf-die'
  17566. Dump DWARF DIEs after they are read in. The value is the number of
  17567. nesting levels to print. A value of zero turns off the display.
  17568. 'show debug dwarf-die'
  17569. Show the current state of DWARF DIE debugging.
  17570. 'set debug dwarf-line'
  17571. Turns on or off display of debugging messages related to reading
  17572. DWARF line tables. The default is 0 (off). A value of 1 provides
  17573. basic information. A value greater than 1 provides more verbose
  17574. information.
  17575. 'show debug dwarf-line'
  17576. Show the current state of DWARF line table debugging.
  17577. 'set debug dwarf-read'
  17578. Turns on or off display of debugging messages related to reading
  17579. DWARF debug info. The default is 0 (off). A value of 1 provides
  17580. basic information. A value greater than 1 provides more verbose
  17581. information.
  17582. 'show debug dwarf-read'
  17583. Show the current state of DWARF reader debugging.
  17584. 'set debug displaced'
  17585. Turns on or off display of GDB debugging info for the displaced
  17586. stepping support. The default is off.
  17587. 'show debug displaced'
  17588. Displays the current state of displaying GDB debugging info related
  17589. to displaced stepping.
  17590. 'set debug event'
  17591. Turns on or off display of GDB event debugging info. The default
  17592. is off.
  17593. 'show debug event'
  17594. Displays the current state of displaying GDB event debugging info.
  17595. 'set debug expression'
  17596. Turns on or off display of debugging info about GDB expression
  17597. parsing. The default is off.
  17598. 'show debug expression'
  17599. Displays the current state of displaying debugging info about GDB
  17600. expression parsing.
  17601. 'set debug fbsd-lwp'
  17602. Turns on or off debugging messages from the FreeBSD LWP debug
  17603. support.
  17604. 'show debug fbsd-lwp'
  17605. Show the current state of FreeBSD LWP debugging messages.
  17606. 'set debug fbsd-nat'
  17607. Turns on or off debugging messages from the FreeBSD native target.
  17608. 'show debug fbsd-nat'
  17609. Show the current state of FreeBSD native target debugging messages.
  17610. 'set debug frame'
  17611. Turns on or off display of GDB frame debugging info. The default
  17612. is off.
  17613. 'show debug frame'
  17614. Displays the current state of displaying GDB frame debugging info.
  17615. 'set debug gnu-nat'
  17616. Turn on or off debugging messages from the GNU/Hurd debug support.
  17617. 'show debug gnu-nat'
  17618. Show the current state of GNU/Hurd debugging messages.
  17619. 'set debug infrun'
  17620. Turns on or off display of GDB debugging info for running the
  17621. inferior. The default is off. 'infrun.c' contains GDB's runtime
  17622. state machine used for implementing operations such as
  17623. single-stepping the inferior.
  17624. 'show debug infrun'
  17625. Displays the current state of GDB inferior debugging.
  17626. 'set debug jit'
  17627. Turn on or off debugging messages from JIT debug support.
  17628. 'show debug jit'
  17629. Displays the current state of GDB JIT debugging.
  17630. 'set debug lin-lwp'
  17631. Turn on or off debugging messages from the Linux LWP debug support.
  17632. 'show debug lin-lwp'
  17633. Show the current state of Linux LWP debugging messages.
  17634. 'set debug linux-namespaces'
  17635. Turn on or off debugging messages from the Linux namespaces debug
  17636. support.
  17637. 'show debug linux-namespaces'
  17638. Show the current state of Linux namespaces debugging messages.
  17639. 'set debug mach-o'
  17640. Control display of debugging messages related to Mach-O symbols
  17641. processing. The default is off.
  17642. 'show debug mach-o'
  17643. Displays the current state of displaying debugging messages related
  17644. to reading of COFF/PE exported symbols.
  17645. 'set debug notification'
  17646. Turn on or off debugging messages about remote async notification.
  17647. The default is off.
  17648. 'show debug notification'
  17649. Displays the current state of remote async notification debugging
  17650. messages.
  17651. 'set debug observer'
  17652. Turns on or off display of GDB observer debugging. This includes
  17653. info such as the notification of observable events.
  17654. 'show debug observer'
  17655. Displays the current state of observer debugging.
  17656. 'set debug overload'
  17657. Turns on or off display of GDB C++ overload debugging info. This
  17658. includes info such as ranking of functions, etc. The default is
  17659. off.
  17660. 'show debug overload'
  17661. Displays the current state of displaying GDB C++ overload debugging
  17662. info.
  17663. 'set debug parser'
  17664. Turns on or off the display of expression parser debugging output.
  17665. Internally, this sets the 'yydebug' variable in the expression
  17666. parser. *Note Tracing Your Parser: (bison)Tracing, for details.
  17667. The default is off.
  17668. 'show debug parser'
  17669. Show the current state of expression parser debugging.
  17670. 'set debug remote'
  17671. Turns on or off display of reports on all packets sent back and
  17672. forth across the serial line to the remote machine. The info is
  17673. printed on the GDB standard output stream. The default is off.
  17674. 'show debug remote'
  17675. Displays the state of display of remote packets.
  17676. 'set debug remote-packet-max-chars'
  17677. Sets the maximum number of characters to display for each remote
  17678. packet when 'set debug remote' is on. This is useful to prevent
  17679. GDB from displaying lengthy remote packets and polluting the
  17680. console.
  17681. The default value is '512', which means GDB will truncate each
  17682. remote packet after 512 bytes.
  17683. Setting this option to 'unlimited' will disable truncation and will
  17684. output the full length of the remote packets.
  17685. 'show debug remote-packet-max-chars'
  17686. Displays the number of bytes to output for remote packet debugging.
  17687. 'set debug separate-debug-file'
  17688. Turns on or off display of debug output about separate debug file
  17689. search.
  17690. 'show debug separate-debug-file'
  17691. Displays the state of separate debug file search debug output.
  17692. 'set debug serial'
  17693. Turns on or off display of GDB serial debugging info. The default
  17694. is off.
  17695. 'show debug serial'
  17696. Displays the current state of displaying GDB serial debugging info.
  17697. 'set debug solib-frv'
  17698. Turn on or off debugging messages for FR-V shared-library code.
  17699. 'show debug solib-frv'
  17700. Display the current state of FR-V shared-library code debugging
  17701. messages.
  17702. 'set debug symbol-lookup'
  17703. Turns on or off display of debugging messages related to symbol
  17704. lookup. The default is 0 (off). A value of 1 provides basic
  17705. information. A value greater than 1 provides more verbose
  17706. information.
  17707. 'show debug symbol-lookup'
  17708. Show the current state of symbol lookup debugging messages.
  17709. 'set debug symfile'
  17710. Turns on or off display of debugging messages related to symbol
  17711. file functions. The default is off. *Note Files::.
  17712. 'show debug symfile'
  17713. Show the current state of symbol file debugging messages.
  17714. 'set debug symtab-create'
  17715. Turns on or off display of debugging messages related to symbol
  17716. table creation. The default is 0 (off). A value of 1 provides
  17717. basic information. A value greater than 1 provides more verbose
  17718. information.
  17719. 'show debug symtab-create'
  17720. Show the current state of symbol table creation debugging.
  17721. 'set debug target'
  17722. Turns on or off display of GDB target debugging info. This info
  17723. includes what is going on at the target level of GDB, as it
  17724. happens. The default is 0. Set it to 1 to track events, and to 2
  17725. to also track the value of large memory transfers.
  17726. 'show debug target'
  17727. Displays the current state of displaying GDB target debugging info.
  17728. 'set debug timestamp'
  17729. Turns on or off display of timestamps with GDB debugging info.
  17730. When enabled, seconds and microseconds are displayed before each
  17731. debugging message.
  17732. 'show debug timestamp'
  17733. Displays the current state of displaying timestamps with GDB
  17734. debugging info.
  17735. 'set debug varobj'
  17736. Turns on or off display of GDB variable object debugging info. The
  17737. default is off.
  17738. 'show debug varobj'
  17739. Displays the current state of displaying GDB variable object
  17740. debugging info.
  17741. 'set debug xml'
  17742. Turn on or off debugging messages for built-in XML parsers.
  17743. 'show debug xml'
  17744. Displays the current state of XML debugging messages.
  17745. 
  17746. File: gdb.info, Node: Other Misc Settings, Prev: Debugging Output, Up: Controlling GDB
  17747. 22.11 Other Miscellaneous Settings
  17748. ==================================
  17749. 'set interactive-mode'
  17750. If 'on', forces GDB to assume that GDB was started in a terminal.
  17751. In practice, this means that GDB should wait for the user to answer
  17752. queries generated by commands entered at the command prompt. If
  17753. 'off', forces GDB to operate in the opposite mode, and it uses the
  17754. default answers to all queries. If 'auto' (the default), GDB tries
  17755. to determine whether its standard input is a terminal, and works in
  17756. interactive-mode if it is, non-interactively otherwise.
  17757. In the vast majority of cases, the debugger should be able to guess
  17758. correctly which mode should be used. But this setting can be
  17759. useful in certain specific cases, such as running a MinGW GDB
  17760. inside a cygwin window.
  17761. 'show interactive-mode'
  17762. Displays whether the debugger is operating in interactive mode or
  17763. not.
  17764. 
  17765. File: gdb.info, Node: Extending GDB, Next: Interpreters, Prev: Controlling GDB, Up: Top
  17766. 23 Extending GDB
  17767. ****************
  17768. GDB provides several mechanisms for extension. GDB also provides the
  17769. ability to automatically load extensions when it reads a file for
  17770. debugging. This allows the user to automatically customize GDB for the
  17771. program being debugged.
  17772. * Menu:
  17773. * Sequences:: Canned Sequences of GDB Commands
  17774. * Python:: Extending GDB using Python
  17775. * Guile:: Extending GDB using Guile
  17776. * Auto-loading extensions:: Automatically loading extensions
  17777. * Multiple Extension Languages:: Working with multiple extension languages
  17778. * Aliases:: Creating new spellings of existing commands
  17779. To facilitate the use of extension languages, GDB is capable of
  17780. evaluating the contents of a file. When doing so, GDB can recognize
  17781. which extension language is being used by looking at the filename
  17782. extension. Files with an unrecognized filename extension are always
  17783. treated as a GDB Command Files. *Note Command files: Command Files.
  17784. You can control how GDB evaluates these files with the following
  17785. setting:
  17786. 'set script-extension off'
  17787. All scripts are always evaluated as GDB Command Files.
  17788. 'set script-extension soft'
  17789. The debugger determines the scripting language based on filename
  17790. extension. If this scripting language is supported, GDB evaluates
  17791. the script using that language. Otherwise, it evaluates the file
  17792. as a GDB Command File.
  17793. 'set script-extension strict'
  17794. The debugger determines the scripting language based on filename
  17795. extension, and evaluates the script using that language. If the
  17796. language is not supported, then the evaluation fails.
  17797. 'show script-extension'
  17798. Display the current value of the 'script-extension' option.
  17799. 
  17800. File: gdb.info, Node: Sequences, Next: Python, Up: Extending GDB
  17801. 23.1 Canned Sequences of Commands
  17802. =================================
  17803. Aside from breakpoint commands (*note Breakpoint Command Lists: Break
  17804. Commands.), GDB provides two ways to store sequences of commands for
  17805. execution as a unit: user-defined commands and command files.
  17806. * Menu:
  17807. * Define:: How to define your own commands
  17808. * Hooks:: Hooks for user-defined commands
  17809. * Command Files:: How to write scripts of commands to be stored in a file
  17810. * Output:: Commands for controlled output
  17811. * Auto-loading sequences:: Controlling auto-loaded command files
  17812. 
  17813. File: gdb.info, Node: Define, Next: Hooks, Up: Sequences
  17814. 23.1.1 User-defined Commands
  17815. ----------------------------
  17816. A "user-defined command" is a sequence of GDB commands to which you
  17817. assign a new name as a command. This is done with the 'define' command.
  17818. User commands may accept an unlimited number of arguments separated by
  17819. whitespace. Arguments are accessed within the user command via
  17820. '$arg0...$argN'. A trivial example:
  17821. define adder
  17822. print $arg0 + $arg1 + $arg2
  17823. end
  17824. To execute the command use:
  17825. adder 1 2 3
  17826. This defines the command 'adder', which prints the sum of its three
  17827. arguments. Note the arguments are text substitutions, so they may
  17828. reference variables, use complex expressions, or even perform inferior
  17829. functions calls.
  17830. In addition, '$argc' may be used to find out how many arguments have
  17831. been passed.
  17832. define adder
  17833. if $argc == 2
  17834. print $arg0 + $arg1
  17835. end
  17836. if $argc == 3
  17837. print $arg0 + $arg1 + $arg2
  17838. end
  17839. end
  17840. Combining with the 'eval' command (*note eval::) makes it easier to
  17841. process a variable number of arguments:
  17842. define adder
  17843. set $i = 0
  17844. set $sum = 0
  17845. while $i < $argc
  17846. eval "set $sum = $sum + $arg%d", $i
  17847. set $i = $i + 1
  17848. end
  17849. print $sum
  17850. end
  17851. 'define COMMANDNAME'
  17852. Define a command named COMMANDNAME. If there is already a command
  17853. by that name, you are asked to confirm that you want to redefine
  17854. it. The argument COMMANDNAME may be a bare command name consisting
  17855. of letters, numbers, dashes, dots, and underscores. It may also
  17856. start with any predefined or user-defined prefix command. For
  17857. example, 'define target my-target' creates a user-defined 'target
  17858. my-target' command.
  17859. The definition of the command is made up of other GDB command
  17860. lines, which are given following the 'define' command. The end of
  17861. these commands is marked by a line containing 'end'.
  17862. 'document COMMANDNAME'
  17863. Document the user-defined command COMMANDNAME, so that it can be
  17864. accessed by 'help'. The command COMMANDNAME must already be
  17865. defined. This command reads lines of documentation just as
  17866. 'define' reads the lines of the command definition, ending with
  17867. 'end'. After the 'document' command is finished, 'help' on command
  17868. COMMANDNAME displays the documentation you have written.
  17869. You may use the 'document' command again to change the
  17870. documentation of a command. Redefining the command with 'define'
  17871. does not change the documentation.
  17872. 'define-prefix COMMANDNAME'
  17873. Define or mark the command COMMANDNAME as a user-defined prefix
  17874. command. Once marked, COMMANDNAME can be used as prefix command by
  17875. the 'define' command. Note that 'define-prefix' can be used with a
  17876. not yet defined COMMANDNAME. In such a case, COMMANDNAME is
  17877. defined as an empty user-defined command. In case you redefine a
  17878. command that was marked as a user-defined prefix command, the
  17879. subcommands of the redefined command are kept (and GDB indicates so
  17880. to the user).
  17881. Example:
  17882. (gdb) define-prefix abc
  17883. (gdb) define-prefix abc def
  17884. (gdb) define abc def
  17885. Type commands for definition of "abc def".
  17886. End with a line saying just "end".
  17887. >echo command initial def\n
  17888. >end
  17889. (gdb) define abc def ghi
  17890. Type commands for definition of "abc def ghi".
  17891. End with a line saying just "end".
  17892. >echo command ghi\n
  17893. >end
  17894. (gdb) define abc def
  17895. Keeping subcommands of prefix command "def".
  17896. Redefine command "def"? (y or n) y
  17897. Type commands for definition of "abc def".
  17898. End with a line saying just "end".
  17899. >echo command def\n
  17900. >end
  17901. (gdb) abc def ghi
  17902. command ghi
  17903. (gdb) abc def
  17904. command def
  17905. (gdb)
  17906. 'dont-repeat'
  17907. Used inside a user-defined command, this tells GDB that this
  17908. command should not be repeated when the user hits <RET> (*note
  17909. repeat last command: Command Syntax.).
  17910. 'help user-defined'
  17911. List all user-defined commands and all python commands defined in
  17912. class COMMAND_USER. The first line of the documentation or
  17913. docstring is included (if any).
  17914. 'show user'
  17915. 'show user COMMANDNAME'
  17916. Display the GDB commands used to define COMMANDNAME (but not its
  17917. documentation). If no COMMANDNAME is given, display the
  17918. definitions for all user-defined commands. This does not work for
  17919. user-defined python commands.
  17920. 'show max-user-call-depth'
  17921. 'set max-user-call-depth'
  17922. The value of 'max-user-call-depth' controls how many recursion
  17923. levels are allowed in user-defined commands before GDB suspects an
  17924. infinite recursion and aborts the command. This does not apply to
  17925. user-defined python commands.
  17926. In addition to the above commands, user-defined commands frequently
  17927. use control flow commands, described in *note Command Files::.
  17928. When user-defined commands are executed, the commands of the
  17929. definition are not printed. An error in any command stops execution of
  17930. the user-defined command.
  17931. If used interactively, commands that would ask for confirmation
  17932. proceed without asking when used inside a user-defined command. Many
  17933. GDB commands that normally print messages to say what they are doing
  17934. omit the messages when used in a user-defined command.
  17935. 
  17936. File: gdb.info, Node: Hooks, Next: Command Files, Prev: Define, Up: Sequences
  17937. 23.1.2 User-defined Command Hooks
  17938. ---------------------------------
  17939. You may define "hooks", which are a special kind of user-defined
  17940. command. Whenever you run the command 'foo', if the user-defined
  17941. command 'hook-foo' exists, it is executed (with no arguments) before
  17942. that command.
  17943. A hook may also be defined which is run after the command you
  17944. executed. Whenever you run the command 'foo', if the user-defined
  17945. command 'hookpost-foo' exists, it is executed (with no arguments) after
  17946. that command. Post-execution hooks may exist simultaneously with
  17947. pre-execution hooks, for the same command.
  17948. It is valid for a hook to call the command which it hooks. If this
  17949. occurs, the hook is not re-executed, thereby avoiding infinite
  17950. recursion.
  17951. In addition, a pseudo-command, 'stop' exists. Defining ('hook-stop')
  17952. makes the associated commands execute every time execution stops in your
  17953. program: before breakpoint commands are run, displays are printed, or
  17954. the stack frame is printed.
  17955. For example, to ignore 'SIGALRM' signals while single-stepping, but
  17956. treat them normally during normal execution, you could define:
  17957. define hook-stop
  17958. handle SIGALRM nopass
  17959. end
  17960. define hook-run
  17961. handle SIGALRM pass
  17962. end
  17963. define hook-continue
  17964. handle SIGALRM pass
  17965. end
  17966. As a further example, to hook at the beginning and end of the 'echo'
  17967. command, and to add extra text to the beginning and end of the message,
  17968. you could define:
  17969. define hook-echo
  17970. echo <<<---
  17971. end
  17972. define hookpost-echo
  17973. echo --->>>\n
  17974. end
  17975. (gdb) echo Hello World
  17976. <<<---Hello World--->>>
  17977. (gdb)
  17978. You can define a hook for any single-word command in GDB, but not for
  17979. command aliases; you should define a hook for the basic command name,
  17980. e.g. 'backtrace' rather than 'bt'. You can hook a multi-word command by
  17981. adding 'hook-' or 'hookpost-' to the last word of the command, e.g.
  17982. 'define target hook-remote' to add a hook to 'target remote'.
  17983. If an error occurs during the execution of your hook, execution of
  17984. GDB commands stops and GDB issues a prompt (before the command that you
  17985. actually typed had a chance to run).
  17986. If you try to define a hook which does not match any known command,
  17987. you get a warning from the 'define' command.
  17988. 
  17989. File: gdb.info, Node: Command Files, Next: Output, Prev: Hooks, Up: Sequences
  17990. 23.1.3 Command Files
  17991. --------------------
  17992. A command file for GDB is a text file made of lines that are GDB
  17993. commands. Comments (lines starting with '#') may also be included. An
  17994. empty line in a command file does nothing; it does not mean to repeat
  17995. the last command, as it would from the terminal.
  17996. You can request the execution of a command file with the 'source'
  17997. command. Note that the 'source' command is also used to evaluate
  17998. scripts that are not Command Files. The exact behavior can be
  17999. configured using the 'script-extension' setting. *Note Extending GDB:
  18000. Extending GDB.
  18001. 'source [-s] [-v] FILENAME'
  18002. Execute the command file FILENAME.
  18003. The lines in a command file are generally executed sequentially,
  18004. unless the order of execution is changed by one of the _flow-control
  18005. commands_ described below. The commands are not printed as they are
  18006. executed. An error in any command terminates execution of the command
  18007. file and control is returned to the console.
  18008. GDB first searches for FILENAME in the current directory. If the
  18009. file is not found there, and FILENAME does not specify a directory, then
  18010. GDB also looks for the file on the source search path (specified with
  18011. the 'directory' command); except that '$cdir' is not searched because
  18012. the compilation directory is not relevant to scripts.
  18013. If '-s' is specified, then GDB searches for FILENAME on the search
  18014. path even if FILENAME specifies a directory. The search is done by
  18015. appending FILENAME to each element of the search path. So, for example,
  18016. if FILENAME is 'mylib/myscript' and the search path contains
  18017. '/home/user' then GDB will look for the script
  18018. '/home/user/mylib/myscript'. The search is also done if FILENAME is an
  18019. absolute path. For example, if FILENAME is '/tmp/myscript' and the
  18020. search path contains '/home/user' then GDB will look for the script
  18021. '/home/user/tmp/myscript'. For DOS-like systems, if FILENAME contains a
  18022. drive specification, it is stripped before concatenation. For example,
  18023. if FILENAME is 'd:myscript' and the search path contains 'c:/tmp' then
  18024. GDB will look for the script 'c:/tmp/myscript'.
  18025. If '-v', for verbose mode, is given then GDB displays each command as
  18026. it is executed. The option must be given before FILENAME, and is
  18027. interpreted as part of the filename anywhere else.
  18028. Commands that would ask for confirmation if used interactively
  18029. proceed without asking when used in a command file. Many GDB commands
  18030. that normally print messages to say what they are doing omit the
  18031. messages when called from command files.
  18032. GDB also accepts command input from standard input. In this mode,
  18033. normal output goes to standard output and error output goes to standard
  18034. error. Errors in a command file supplied on standard input do not
  18035. terminate execution of the command file--execution continues with the
  18036. next command.
  18037. gdb < cmds > log 2>&1
  18038. (The syntax above will vary depending on the shell used.) This
  18039. example will execute commands from the file 'cmds'. All output and
  18040. errors would be directed to 'log'.
  18041. Since commands stored on command files tend to be more general than
  18042. commands typed interactively, they frequently need to deal with
  18043. complicated situations, such as different or unexpected values of
  18044. variables and symbols, changes in how the program being debugged is
  18045. built, etc. GDB provides a set of flow-control commands to deal with
  18046. these complexities. Using these commands, you can write complex scripts
  18047. that loop over data structures, execute commands conditionally, etc.
  18048. 'if'
  18049. 'else'
  18050. This command allows to include in your script conditionally
  18051. executed commands. The 'if' command takes a single argument, which
  18052. is an expression to evaluate. It is followed by a series of
  18053. commands that are executed only if the expression is true (its
  18054. value is nonzero). There can then optionally be an 'else' line,
  18055. followed by a series of commands that are only executed if the
  18056. expression was false. The end of the list is marked by a line
  18057. containing 'end'.
  18058. 'while'
  18059. This command allows to write loops. Its syntax is similar to 'if':
  18060. the command takes a single argument, which is an expression to
  18061. evaluate, and must be followed by the commands to execute, one per
  18062. line, terminated by an 'end'. These commands are called the "body"
  18063. of the loop. The commands in the body of 'while' are executed
  18064. repeatedly as long as the expression evaluates to true.
  18065. 'loop_break'
  18066. This command exits the 'while' loop in whose body it is included.
  18067. Execution of the script continues after that 'while's 'end' line.
  18068. 'loop_continue'
  18069. This command skips the execution of the rest of the body of
  18070. commands in the 'while' loop in whose body it is included.
  18071. Execution branches to the beginning of the 'while' loop, where it
  18072. evaluates the controlling expression.
  18073. 'end'
  18074. Terminate the block of commands that are the body of 'if', 'else',
  18075. or 'while' flow-control commands.
  18076. 
  18077. File: gdb.info, Node: Output, Next: Auto-loading sequences, Prev: Command Files, Up: Sequences
  18078. 23.1.4 Commands for Controlled Output
  18079. -------------------------------------
  18080. During the execution of a command file or a user-defined command, normal
  18081. GDB output is suppressed; the only output that appears is what is
  18082. explicitly printed by the commands in the definition. This section
  18083. describes three commands useful for generating exactly the output you
  18084. want.
  18085. 'echo TEXT'
  18086. Print TEXT. Nonprinting characters can be included in TEXT using C
  18087. escape sequences, such as '\n' to print a newline. *No newline is
  18088. printed unless you specify one.* In addition to the standard C
  18089. escape sequences, a backslash followed by a space stands for a
  18090. space. This is useful for displaying a string with spaces at the
  18091. beginning or the end, since leading and trailing spaces are
  18092. otherwise trimmed from all arguments. To print ' and foo = ', use
  18093. the command 'echo \ and foo = \ '.
  18094. A backslash at the end of TEXT can be used, as in C, to continue
  18095. the command onto subsequent lines. For example,
  18096. echo This is some text\n\
  18097. which is continued\n\
  18098. onto several lines.\n
  18099. produces the same output as
  18100. echo This is some text\n
  18101. echo which is continued\n
  18102. echo onto several lines.\n
  18103. 'output EXPRESSION'
  18104. Print the value of EXPRESSION and nothing but that value: no
  18105. newlines, no '$NN = '. The value is not entered in the value
  18106. history either. *Note Expressions: Expressions, for more
  18107. information on expressions.
  18108. 'output/FMT EXPRESSION'
  18109. Print the value of EXPRESSION in format FMT. You can use the same
  18110. formats as for 'print'. *Note Output Formats: Output Formats, for
  18111. more information.
  18112. 'printf TEMPLATE, EXPRESSIONS...'
  18113. Print the values of one or more EXPRESSIONS under the control of
  18114. the string TEMPLATE. To print several values, make EXPRESSIONS be
  18115. a comma-separated list of individual expressions, which may be
  18116. either numbers or pointers. Their values are printed as specified
  18117. by TEMPLATE, exactly as a C program would do by executing the code
  18118. below:
  18119. printf (TEMPLATE, EXPRESSIONS...);
  18120. As in 'C' 'printf', ordinary characters in TEMPLATE are printed
  18121. verbatim, while "conversion specification" introduced by the '%'
  18122. character cause subsequent EXPRESSIONS to be evaluated, their
  18123. values converted and formatted according to type and style
  18124. information encoded in the conversion specifications, and then
  18125. printed.
  18126. For example, you can print two values in hex like this:
  18127. printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
  18128. 'printf' supports all the standard 'C' conversion specifications,
  18129. including the flags and modifiers between the '%' character and the
  18130. conversion letter, with the following exceptions:
  18131. * The argument-ordering modifiers, such as '2$', are not
  18132. supported.
  18133. * The modifier '*' is not supported for specifying precision or
  18134. width.
  18135. * The ''' flag (for separation of digits into groups according
  18136. to 'LC_NUMERIC'') is not supported.
  18137. * The type modifiers 'hh', 'j', 't', and 'z' are not supported.
  18138. * The conversion letter 'n' (as in '%n') is not supported.
  18139. * The conversion letters 'a' and 'A' are not supported.
  18140. Note that the 'll' type modifier is supported only if the
  18141. underlying 'C' implementation used to build GDB supports the 'long
  18142. long int' type, and the 'L' type modifier is supported only if
  18143. 'long double' type is available.
  18144. As in 'C', 'printf' supports simple backslash-escape sequences,
  18145. such as '\n', '\t', '\\', '\"', '\a', and '\f', that consist of
  18146. backslash followed by a single character. Octal and hexadecimal
  18147. escape sequences are not supported.
  18148. Additionally, 'printf' supports conversion specifications for DFP
  18149. ("Decimal Floating Point") types using the following length
  18150. modifiers together with a floating point specifier. letters:
  18151. * 'H' for printing 'Decimal32' types.
  18152. * 'D' for printing 'Decimal64' types.
  18153. * 'DD' for printing 'Decimal128' types.
  18154. If the underlying 'C' implementation used to build GDB has support
  18155. for the three length modifiers for DFP types, other modifiers such
  18156. as width and precision will also be available for GDB to use.
  18157. In case there is no such 'C' support, no additional modifiers will
  18158. be available and the value will be printed in the standard way.
  18159. Here's an example of printing DFP types using the above conversion
  18160. letters:
  18161. printf "D32: %Hf - D64: %Df - D128: %DDf\n",1.2345df,1.2E10dd,1.2E1dl
  18162. 'eval TEMPLATE, EXPRESSIONS...'
  18163. Convert the values of one or more EXPRESSIONS under the control of
  18164. the string TEMPLATE to a command line, and call it.
  18165. 
  18166. File: gdb.info, Node: Auto-loading sequences, Prev: Output, Up: Sequences
  18167. 23.1.5 Controlling auto-loading native GDB scripts
  18168. --------------------------------------------------
  18169. When a new object file is read (for example, due to the 'file' command,
  18170. or because the inferior has loaded a shared library), GDB will look for
  18171. the command file 'OBJFILE-gdb.gdb'. *Note Auto-loading extensions::.
  18172. Auto-loading can be enabled or disabled, and the list of auto-loaded
  18173. scripts can be printed.
  18174. 'set auto-load gdb-scripts [on|off]'
  18175. Enable or disable the auto-loading of canned sequences of commands
  18176. scripts.
  18177. 'show auto-load gdb-scripts'
  18178. Show whether auto-loading of canned sequences of commands scripts
  18179. is enabled or disabled.
  18180. 'info auto-load gdb-scripts [REGEXP]'
  18181. Print the list of all canned sequences of commands scripts that GDB
  18182. auto-loaded.
  18183. If REGEXP is supplied only canned sequences of commands scripts with
  18184. matching names are printed.
  18185. 
  18186. File: gdb.info, Node: Python, Next: Guile, Prev: Sequences, Up: Extending GDB
  18187. 23.2 Extending GDB using Python
  18188. ===============================
  18189. You can extend GDB using the Python programming language
  18190. (http://www.python.org/). This feature is available only if GDB was
  18191. configured using '--with-python'. GDB can be built against either
  18192. Python 2 or Python 3; which one you have depends on this configure-time
  18193. option.
  18194. Python scripts used by GDB should be installed in
  18195. 'DATA-DIRECTORY/python', where DATA-DIRECTORY is the data directory as
  18196. determined at GDB startup (*note Data Files::). This directory, known
  18197. as the "python directory", is automatically added to the Python Search
  18198. Path in order to allow the Python interpreter to locate all scripts
  18199. installed at this location.
  18200. Additionally, GDB commands and convenience functions which are
  18201. written in Python and are located in the
  18202. 'DATA-DIRECTORY/python/gdb/command' or
  18203. 'DATA-DIRECTORY/python/gdb/function' directories are automatically
  18204. imported when GDB starts.
  18205. * Menu:
  18206. * Python Commands:: Accessing Python from GDB.
  18207. * Python API:: Accessing GDB from Python.
  18208. * Python Auto-loading:: Automatically loading Python code.
  18209. * Python modules:: Python modules provided by GDB.
  18210. 
  18211. File: gdb.info, Node: Python Commands, Next: Python API, Up: Python
  18212. 23.2.1 Python Commands
  18213. ----------------------
  18214. GDB provides two commands for accessing the Python interpreter, and one
  18215. related setting:
  18216. 'python-interactive [COMMAND]'
  18217. 'pi [COMMAND]'
  18218. Without an argument, the 'python-interactive' command can be used
  18219. to start an interactive Python prompt. To return to GDB, type the
  18220. 'EOF' character (e.g., 'Ctrl-D' on an empty prompt).
  18221. Alternatively, a single-line Python command can be given as an
  18222. argument and evaluated. If the command is an expression, the
  18223. result will be printed; otherwise, nothing will be printed. For
  18224. example:
  18225. (gdb) python-interactive 2 + 3
  18226. 5
  18227. 'python [COMMAND]'
  18228. 'py [COMMAND]'
  18229. The 'python' command can be used to evaluate Python code.
  18230. If given an argument, the 'python' command will evaluate the
  18231. argument as a Python command. For example:
  18232. (gdb) python print 23
  18233. 23
  18234. If you do not provide an argument to 'python', it will act as a
  18235. multi-line command, like 'define'. In this case, the Python script
  18236. is made up of subsequent command lines, given after the 'python'
  18237. command. This command list is terminated using a line containing
  18238. 'end'. For example:
  18239. (gdb) python
  18240. >print 23
  18241. >end
  18242. 23
  18243. 'set python print-stack'
  18244. By default, GDB will print only the message component of a Python
  18245. exception when an error occurs in a Python script. This can be
  18246. controlled using 'set python print-stack': if 'full', then full
  18247. Python stack printing is enabled; if 'none', then Python stack and
  18248. message printing is disabled; if 'message', the default, only the
  18249. message component of the error is printed.
  18250. It is also possible to execute a Python script from the GDB
  18251. interpreter:
  18252. 'source script-name'
  18253. The script name must end with '.py' and GDB must be configured to
  18254. recognize the script language based on filename extension using the
  18255. 'script-extension' setting. *Note Extending GDB: Extending GDB.
  18256. 
  18257. File: gdb.info, Node: Python API, Next: Python Auto-loading, Prev: Python Commands, Up: Python
  18258. 23.2.2 Python API
  18259. -----------------
  18260. You can get quick online help for GDB's Python API by issuing the
  18261. command 'python help (gdb)'.
  18262. Functions and methods which have two or more optional arguments allow
  18263. them to be specified using keyword syntax. This allows passing some
  18264. optional arguments while skipping others. Example:
  18265. 'gdb.some_function ('foo', bar = 1, baz = 2)'.
  18266. * Menu:
  18267. * Basic Python:: Basic Python Functions.
  18268. * Exception Handling:: How Python exceptions are translated.
  18269. * Values From Inferior:: Python representation of values.
  18270. * Types In Python:: Python representation of types.
  18271. * Pretty Printing API:: Pretty-printing values.
  18272. * Selecting Pretty-Printers:: How GDB chooses a pretty-printer.
  18273. * Writing a Pretty-Printer:: Writing a Pretty-Printer.
  18274. * Type Printing API:: Pretty-printing types.
  18275. * Frame Filter API:: Filtering Frames.
  18276. * Frame Decorator API:: Decorating Frames.
  18277. * Writing a Frame Filter:: Writing a Frame Filter.
  18278. * Unwinding Frames in Python:: Writing frame unwinder.
  18279. * Xmethods In Python:: Adding and replacing methods of C++ classes.
  18280. * Xmethod API:: Xmethod types.
  18281. * Writing an Xmethod:: Writing an xmethod.
  18282. * Inferiors In Python:: Python representation of inferiors (processes)
  18283. * Events In Python:: Listening for events from GDB.
  18284. * Threads In Python:: Accessing inferior threads from Python.
  18285. * Recordings In Python:: Accessing recordings from Python.
  18286. * Commands In Python:: Implementing new commands in Python.
  18287. * Parameters In Python:: Adding new GDB parameters.
  18288. * Functions In Python:: Writing new convenience functions.
  18289. * Progspaces In Python:: Program spaces.
  18290. * Objfiles In Python:: Object files.
  18291. * Frames In Python:: Accessing inferior stack frames from Python.
  18292. * Blocks In Python:: Accessing blocks from Python.
  18293. * Symbols In Python:: Python representation of symbols.
  18294. * Symbol Tables In Python:: Python representation of symbol tables.
  18295. * Line Tables In Python:: Python representation of line tables.
  18296. * Breakpoints In Python:: Manipulating breakpoints using Python.
  18297. * Finish Breakpoints in Python:: Setting Breakpoints on function return
  18298. using Python.
  18299. * Lazy Strings In Python:: Python representation of lazy strings.
  18300. * Architectures In Python:: Python representation of architectures.
  18301. 
  18302. File: gdb.info, Node: Basic Python, Next: Exception Handling, Up: Python API
  18303. 23.2.2.1 Basic Python
  18304. .....................
  18305. At startup, GDB overrides Python's 'sys.stdout' and 'sys.stderr' to
  18306. print using GDB's output-paging streams. A Python program which outputs
  18307. to one of these streams may have its output interrupted by the user
  18308. (*note Screen Size::). In this situation, a Python 'KeyboardInterrupt'
  18309. exception is thrown.
  18310. Some care must be taken when writing Python code to run in GDB. Two
  18311. things worth noting in particular:
  18312. * GDB install handlers for 'SIGCHLD' and 'SIGINT'. Python code must
  18313. not override these, or even change the options using 'sigaction'.
  18314. If your program changes the handling of these signals, GDB will
  18315. most likely stop working correctly. Note that it is unfortunately
  18316. common for GUI toolkits to install a 'SIGCHLD' handler.
  18317. * GDB takes care to mark its internal file descriptors as
  18318. close-on-exec. However, this cannot be done in a thread-safe way
  18319. on all platforms. Your Python programs should be aware of this and
  18320. should both create new file descriptors with the close-on-exec flag
  18321. set and arrange to close unneeded file descriptors before starting
  18322. a child process.
  18323. GDB introduces a new Python module, named 'gdb'. All methods and
  18324. classes added by GDB are placed in this module. GDB automatically
  18325. 'import's the 'gdb' module for use in all scripts evaluated by the
  18326. 'python' command.
  18327. Some types of the 'gdb' module come with a textual representation
  18328. (accessible through the 'repr' or 'str' functions). These are offered
  18329. for debugging purposes only, expect them to change over time.
  18330. -- Variable: gdb.PYTHONDIR
  18331. A string containing the python directory (*note Python::).
  18332. -- Function: gdb.execute (command [, from_tty [, to_string]])
  18333. Evaluate COMMAND, a string, as a GDB CLI command. If a GDB
  18334. exception happens while COMMAND runs, it is translated as described
  18335. in *note Exception Handling: Exception Handling.
  18336. The FROM_TTY flag specifies whether GDB ought to consider this
  18337. command as having originated from the user invoking it
  18338. interactively. It must be a boolean value. If omitted, it
  18339. defaults to 'False'.
  18340. By default, any output produced by COMMAND is sent to GDB's
  18341. standard output (and to the log output if logging is turned on).
  18342. If the TO_STRING parameter is 'True', then output will be collected
  18343. by 'gdb.execute' and returned as a string. The default is 'False',
  18344. in which case the return value is 'None'. If TO_STRING is 'True',
  18345. the GDB virtual terminal will be temporarily set to unlimited width
  18346. and height, and its pagination will be disabled; *note Screen
  18347. Size::.
  18348. -- Function: gdb.breakpoints ()
  18349. Return a sequence holding all of GDB's breakpoints. *Note
  18350. Breakpoints In Python::, for more information. In GDB version 7.11
  18351. and earlier, this function returned 'None' if there were no
  18352. breakpoints. This peculiarity was subsequently fixed, and now
  18353. 'gdb.breakpoints' returns an empty sequence in this case.
  18354. -- Function: gdb.rbreak (regex [, minsyms [, throttle, [, symtabs ]]])
  18355. Return a Python list holding a collection of newly set
  18356. 'gdb.Breakpoint' objects matching function names defined by the
  18357. REGEX pattern. If the MINSYMS keyword is 'True', all system
  18358. functions (those not explicitly defined in the inferior) will also
  18359. be included in the match. The THROTTLE keyword takes an integer
  18360. that defines the maximum number of pattern matches for functions
  18361. matched by the REGEX pattern. If the number of matches exceeds the
  18362. integer value of THROTTLE, a 'RuntimeError' will be raised and no
  18363. breakpoints will be created. If THROTTLE is not defined then there
  18364. is no imposed limit on the maximum number of matches and
  18365. breakpoints to be created. The SYMTABS keyword takes a Python
  18366. iterable that yields a collection of 'gdb.Symtab' objects and will
  18367. restrict the search to those functions only contained within the
  18368. 'gdb.Symtab' objects.
  18369. -- Function: gdb.parameter (parameter)
  18370. Return the value of a GDB PARAMETER given by its name, a string;
  18371. the parameter name string may contain spaces if the parameter has a
  18372. multi-part name. For example, 'print object' is a valid parameter
  18373. name.
  18374. If the named parameter does not exist, this function throws a
  18375. 'gdb.error' (*note Exception Handling::). Otherwise, the
  18376. parameter's value is converted to a Python value of the appropriate
  18377. type, and returned.
  18378. -- Function: gdb.history (number)
  18379. Return a value from GDB's value history (*note Value History::).
  18380. The NUMBER argument indicates which history element to return. If
  18381. NUMBER is negative, then GDB will take its absolute value and count
  18382. backward from the last element (i.e., the most recent element) to
  18383. find the value to return. If NUMBER is zero, then GDB will return
  18384. the most recent element. If the element specified by NUMBER
  18385. doesn't exist in the value history, a 'gdb.error' exception will be
  18386. raised.
  18387. If no exception is raised, the return value is always an instance
  18388. of 'gdb.Value' (*note Values From Inferior::).
  18389. -- Function: gdb.convenience_variable (name)
  18390. Return the value of the convenience variable (*note Convenience
  18391. Vars::) named NAME. NAME must be a string. The name should not
  18392. include the '$' that is used to mark a convenience variable in an
  18393. expression. If the convenience variable does not exist, then
  18394. 'None' is returned.
  18395. -- Function: gdb.set_convenience_variable (name, value)
  18396. Set the value of the convenience variable (*note Convenience
  18397. Vars::) named NAME. NAME must be a string. The name should not
  18398. include the '$' that is used to mark a convenience variable in an
  18399. expression. If VALUE is 'None', then the convenience variable is
  18400. removed. Otherwise, if VALUE is not a 'gdb.Value' (*note Values
  18401. From Inferior::), it is is converted using the 'gdb.Value'
  18402. constructor.
  18403. -- Function: gdb.parse_and_eval (expression)
  18404. Parse EXPRESSION, which must be a string, as an expression in the
  18405. current language, evaluate it, and return the result as a
  18406. 'gdb.Value'.
  18407. This function can be useful when implementing a new command (*note
  18408. Commands In Python::), as it provides a way to parse the command's
  18409. argument as an expression. It is also useful simply to compute
  18410. values.
  18411. -- Function: gdb.find_pc_line (pc)
  18412. Return the 'gdb.Symtab_and_line' object corresponding to the PC
  18413. value. *Note Symbol Tables In Python::. If an invalid value of PC
  18414. is passed as an argument, then the 'symtab' and 'line' attributes
  18415. of the returned 'gdb.Symtab_and_line' object will be 'None' and 0
  18416. respectively. This is identical to
  18417. 'gdb.current_progspace().find_pc_line(pc)' and is included for
  18418. historical compatibility.
  18419. -- Function: gdb.post_event (event)
  18420. Put EVENT, a callable object taking no arguments, into GDB's
  18421. internal event queue. This callable will be invoked at some later
  18422. point, during GDB's event processing. Events posted using
  18423. 'post_event' will be run in the order in which they were posted;
  18424. however, there is no way to know when they will be processed
  18425. relative to other events inside GDB.
  18426. GDB is not thread-safe. If your Python program uses multiple
  18427. threads, you must be careful to only call GDB-specific functions in
  18428. the GDB thread. 'post_event' ensures this. For example:
  18429. (gdb) python
  18430. >import threading
  18431. >
  18432. >class Writer():
  18433. > def __init__(self, message):
  18434. > self.message = message;
  18435. > def __call__(self):
  18436. > gdb.write(self.message)
  18437. >
  18438. >class MyThread1 (threading.Thread):
  18439. > def run (self):
  18440. > gdb.post_event(Writer("Hello "))
  18441. >
  18442. >class MyThread2 (threading.Thread):
  18443. > def run (self):
  18444. > gdb.post_event(Writer("World\n"))
  18445. >
  18446. >MyThread1().start()
  18447. >MyThread2().start()
  18448. >end
  18449. (gdb) Hello World
  18450. -- Function: gdb.write (string [, stream])
  18451. Print a string to GDB's paginated output stream. The optional
  18452. STREAM determines the stream to print to. The default stream is
  18453. GDB's standard output stream. Possible stream values are:
  18454. 'gdb.STDOUT'
  18455. GDB's standard output stream.
  18456. 'gdb.STDERR'
  18457. GDB's standard error stream.
  18458. 'gdb.STDLOG'
  18459. GDB's log stream (*note Logging Output::).
  18460. Writing to 'sys.stdout' or 'sys.stderr' will automatically call
  18461. this function and will automatically direct the output to the
  18462. relevant stream.
  18463. -- Function: gdb.flush ()
  18464. Flush the buffer of a GDB paginated stream so that the contents are
  18465. displayed immediately. GDB will flush the contents of a stream
  18466. automatically when it encounters a newline in the buffer. The
  18467. optional STREAM determines the stream to flush. The default stream
  18468. is GDB's standard output stream. Possible stream values are:
  18469. 'gdb.STDOUT'
  18470. GDB's standard output stream.
  18471. 'gdb.STDERR'
  18472. GDB's standard error stream.
  18473. 'gdb.STDLOG'
  18474. GDB's log stream (*note Logging Output::).
  18475. Flushing 'sys.stdout' or 'sys.stderr' will automatically call this
  18476. function for the relevant stream.
  18477. -- Function: gdb.target_charset ()
  18478. Return the name of the current target character set (*note
  18479. Character Sets::). This differs from
  18480. 'gdb.parameter('target-charset')' in that 'auto' is never returned.
  18481. -- Function: gdb.target_wide_charset ()
  18482. Return the name of the current target wide character set (*note
  18483. Character Sets::). This differs from
  18484. 'gdb.parameter('target-wide-charset')' in that 'auto' is never
  18485. returned.
  18486. -- Function: gdb.solib_name (address)
  18487. Return the name of the shared library holding the given ADDRESS as
  18488. a string, or 'None'. This is identical to
  18489. 'gdb.current_progspace().solib_name(address)' and is included for
  18490. historical compatibility.
  18491. -- Function: gdb.decode_line ([expression])
  18492. Return locations of the line specified by EXPRESSION, or of the
  18493. current line if no argument was given. This function returns a
  18494. Python tuple containing two elements. The first element contains a
  18495. string holding any unparsed section of EXPRESSION (or 'None' if the
  18496. expression has been fully parsed). The second element contains
  18497. either 'None' or another tuple that contains all the locations that
  18498. match the expression represented as 'gdb.Symtab_and_line' objects
  18499. (*note Symbol Tables In Python::). If EXPRESSION is provided, it
  18500. is decoded the way that GDB's inbuilt 'break' or 'edit' commands do
  18501. (*note Specify Location::).
  18502. -- Function: gdb.prompt_hook (current_prompt)
  18503. If PROMPT_HOOK is callable, GDB will call the method assigned to
  18504. this operation before a prompt is displayed by GDB.
  18505. The parameter 'current_prompt' contains the current GDB prompt.
  18506. This method must return a Python string, or 'None'. If a string is
  18507. returned, the GDB prompt will be set to that string. If 'None' is
  18508. returned, GDB will continue to use the current prompt.
  18509. Some prompts cannot be substituted in GDB. Secondary prompts such
  18510. as those used by readline for command input, and annotation related
  18511. prompts are prohibited from being changed.
  18512. 
  18513. File: gdb.info, Node: Exception Handling, Next: Values From Inferior, Prev: Basic Python, Up: Python API
  18514. 23.2.2.2 Exception Handling
  18515. ...........................
  18516. When executing the 'python' command, Python exceptions uncaught within
  18517. the Python code are translated to calls to GDB error-reporting
  18518. mechanism. If the command that called 'python' does not handle the
  18519. error, GDB will terminate it and print an error message containing the
  18520. Python exception name, the associated value, and the Python call stack
  18521. backtrace at the point where the exception was raised. Example:
  18522. (gdb) python print foo
  18523. Traceback (most recent call last):
  18524. File "<string>", line 1, in <module>
  18525. NameError: name 'foo' is not defined
  18526. GDB errors that happen in GDB commands invoked by Python code are
  18527. converted to Python exceptions. The type of the Python exception
  18528. depends on the error.
  18529. 'gdb.error'
  18530. This is the base class for most exceptions generated by GDB. It is
  18531. derived from 'RuntimeError', for compatibility with earlier
  18532. versions of GDB.
  18533. If an error occurring in GDB does not fit into some more specific
  18534. category, then the generated exception will have this type.
  18535. 'gdb.MemoryError'
  18536. This is a subclass of 'gdb.error' which is thrown when an operation
  18537. tried to access invalid memory in the inferior.
  18538. 'KeyboardInterrupt'
  18539. User interrupt (via 'C-c' or by typing 'q' at a pagination prompt)
  18540. is translated to a Python 'KeyboardInterrupt' exception.
  18541. In all cases, your exception handler will see the GDB error message
  18542. as its value and the Python call stack backtrace at the Python statement
  18543. closest to where the GDB error occured as the traceback.
  18544. When implementing GDB commands in Python via 'gdb.Command', or
  18545. functions via 'gdb.Function', it is useful to be able to throw an
  18546. exception that doesn't cause a traceback to be printed. For example,
  18547. the user may have invoked the command incorrectly. GDB provides a
  18548. special exception class that can be used for this purpose.
  18549. 'gdb.GdbError'
  18550. When thrown from a command or function, this exception will cause
  18551. the command or function to fail, but the Python stack will not be
  18552. displayed. GDB does not throw this exception itself, but rather
  18553. recognizes it when thrown from user Python code. Example:
  18554. (gdb) python
  18555. >class HelloWorld (gdb.Command):
  18556. > """Greet the whole world."""
  18557. > def __init__ (self):
  18558. > super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
  18559. > def invoke (self, args, from_tty):
  18560. > argv = gdb.string_to_argv (args)
  18561. > if len (argv) != 0:
  18562. > raise gdb.GdbError ("hello-world takes no arguments")
  18563. > print "Hello, World!"
  18564. >HelloWorld ()
  18565. >end
  18566. (gdb) hello-world 42
  18567. hello-world takes no arguments
  18568. 
  18569. File: gdb.info, Node: Values From Inferior, Next: Types In Python, Prev: Exception Handling, Up: Python API
  18570. 23.2.2.3 Values From Inferior
  18571. .............................
  18572. GDB provides values it obtains from the inferior program in an object of
  18573. type 'gdb.Value'. GDB uses this object for its internal bookkeeping of
  18574. the inferior's values, and for fetching values when necessary.
  18575. Inferior values that are simple scalars can be used directly in
  18576. Python expressions that are valid for the value's data type. Here's an
  18577. example for an integer or floating-point value 'some_val':
  18578. bar = some_val + 2
  18579. As result of this, 'bar' will also be a 'gdb.Value' object whose values
  18580. are of the same type as those of 'some_val'. Valid Python operations
  18581. can also be performed on 'gdb.Value' objects representing a 'struct' or
  18582. 'class' object. For such cases, the overloaded operator (if present),
  18583. is used to perform the operation. For example, if 'val1' and 'val2' are
  18584. 'gdb.Value' objects representing instances of a 'class' which overloads
  18585. the '+' operator, then one can use the '+' operator in their Python
  18586. script as follows:
  18587. val3 = val1 + val2
  18588. The result of the operation 'val3' is also a 'gdb.Value' object
  18589. corresponding to the value returned by the overloaded '+' operator. In
  18590. general, overloaded operators are invoked for the following operations:
  18591. '+' (binary addition), '-' (binary subtraction), '*' (multiplication),
  18592. '/', '%', '<<', '>>', '|', '&', '^'.
  18593. Inferior values that are structures or instances of some class can be
  18594. accessed using the Python "dictionary syntax". For example, if
  18595. 'some_val' is a 'gdb.Value' instance holding a structure, you can access
  18596. its 'foo' element with:
  18597. bar = some_val['foo']
  18598. Again, 'bar' will also be a 'gdb.Value' object. Structure elements
  18599. can also be accessed by using 'gdb.Field' objects as subscripts (*note
  18600. Types In Python::, for more information on 'gdb.Field' objects). For
  18601. example, if 'foo_field' is a 'gdb.Field' object corresponding to element
  18602. 'foo' of the above structure, then 'bar' can also be accessed as
  18603. follows:
  18604. bar = some_val[foo_field]
  18605. A 'gdb.Value' that represents a function can be executed via inferior
  18606. function call. Any arguments provided to the call must match the
  18607. function's prototype, and must be provided in the order specified by
  18608. that prototype.
  18609. For example, 'some_val' is a 'gdb.Value' instance representing a
  18610. function that takes two integers as arguments. To execute this
  18611. function, call it like so:
  18612. result = some_val (10,20)
  18613. Any values returned from a function call will be stored as a
  18614. 'gdb.Value'.
  18615. The following attributes are provided:
  18616. -- Variable: Value.address
  18617. If this object is addressable, this read-only attribute holds a
  18618. 'gdb.Value' object representing the address. Otherwise, this
  18619. attribute holds 'None'.
  18620. -- Variable: Value.is_optimized_out
  18621. This read-only boolean attribute is true if the compiler optimized
  18622. out this value, thus it is not available for fetching from the
  18623. inferior.
  18624. -- Variable: Value.type
  18625. The type of this 'gdb.Value'. The value of this attribute is a
  18626. 'gdb.Type' object (*note Types In Python::).
  18627. -- Variable: Value.dynamic_type
  18628. The dynamic type of this 'gdb.Value'. This uses the object's
  18629. virtual table and the C++ run-time type information (RTTI) to
  18630. determine the dynamic type of the value. If this value is of class
  18631. type, it will return the class in which the value is embedded, if
  18632. any. If this value is of pointer or reference to a class type, it
  18633. will compute the dynamic type of the referenced object, and return
  18634. a pointer or reference to that type, respectively. In all other
  18635. cases, it will return the value's static type.
  18636. Note that this feature will only work when debugging a C++ program
  18637. that includes RTTI for the object in question. Otherwise, it will
  18638. just return the static type of the value as in 'ptype foo' (*note
  18639. ptype: Symbols.).
  18640. -- Variable: Value.is_lazy
  18641. The value of this read-only boolean attribute is 'True' if this
  18642. 'gdb.Value' has not yet been fetched from the inferior. GDB does
  18643. not fetch values until necessary, for efficiency. For example:
  18644. myval = gdb.parse_and_eval ('somevar')
  18645. The value of 'somevar' is not fetched at this time. It will be
  18646. fetched when the value is needed, or when the 'fetch_lazy' method
  18647. is invoked.
  18648. The following methods are provided:
  18649. -- Function: Value.__init__ (VAL)
  18650. Many Python values can be converted directly to a 'gdb.Value' via
  18651. this object initializer. Specifically:
  18652. Python boolean
  18653. A Python boolean is converted to the boolean type from the
  18654. current language.
  18655. Python integer
  18656. A Python integer is converted to the C 'long' type for the
  18657. current architecture.
  18658. Python long
  18659. A Python long is converted to the C 'long long' type for the
  18660. current architecture.
  18661. Python float
  18662. A Python float is converted to the C 'double' type for the
  18663. current architecture.
  18664. Python string
  18665. A Python string is converted to a target string in the current
  18666. target language using the current target encoding. If a
  18667. character cannot be represented in the current target
  18668. encoding, then an exception is thrown.
  18669. 'gdb.Value'
  18670. If 'val' is a 'gdb.Value', then a copy of the value is made.
  18671. 'gdb.LazyString'
  18672. If 'val' is a 'gdb.LazyString' (*note Lazy Strings In
  18673. Python::), then the lazy string's 'value' method is called,
  18674. and its result is used.
  18675. -- Function: Value.__init__ (VAL, TYPE)
  18676. This second form of the 'gdb.Value' constructor returns a
  18677. 'gdb.Value' of type TYPE where the value contents are taken from
  18678. the Python buffer object specified by VAL. The number of bytes in
  18679. the Python buffer object must be greater than or equal to the size
  18680. of TYPE.
  18681. -- Function: Value.cast (type)
  18682. Return a new instance of 'gdb.Value' that is the result of casting
  18683. this instance to the type described by TYPE, which must be a
  18684. 'gdb.Type' object. If the cast cannot be performed for some
  18685. reason, this method throws an exception.
  18686. -- Function: Value.dereference ()
  18687. For pointer data types, this method returns a new 'gdb.Value'
  18688. object whose contents is the object pointed to by the pointer. For
  18689. example, if 'foo' is a C pointer to an 'int', declared in your C
  18690. program as
  18691. int *foo;
  18692. then you can use the corresponding 'gdb.Value' to access what 'foo'
  18693. points to like this:
  18694. bar = foo.dereference ()
  18695. The result 'bar' will be a 'gdb.Value' object holding the value
  18696. pointed to by 'foo'.
  18697. A similar function 'Value.referenced_value' exists which also
  18698. returns 'gdb.Value' objects corresponding to the values pointed to
  18699. by pointer values (and additionally, values referenced by reference
  18700. values). However, the behavior of 'Value.dereference' differs from
  18701. 'Value.referenced_value' by the fact that the behavior of
  18702. 'Value.dereference' is identical to applying the C unary operator
  18703. '*' on a given value. For example, consider a reference to a
  18704. pointer 'ptrref', declared in your C++ program as
  18705. typedef int *intptr;
  18706. ...
  18707. int val = 10;
  18708. intptr ptr = &val;
  18709. intptr &ptrref = ptr;
  18710. Though 'ptrref' is a reference value, one can apply the method
  18711. 'Value.dereference' to the 'gdb.Value' object corresponding to it
  18712. and obtain a 'gdb.Value' which is identical to that corresponding
  18713. to 'val'. However, if you apply the method
  18714. 'Value.referenced_value', the result would be a 'gdb.Value' object
  18715. identical to that corresponding to 'ptr'.
  18716. py_ptrref = gdb.parse_and_eval ("ptrref")
  18717. py_val = py_ptrref.dereference ()
  18718. py_ptr = py_ptrref.referenced_value ()
  18719. The 'gdb.Value' object 'py_val' is identical to that corresponding
  18720. to 'val', and 'py_ptr' is identical to that corresponding to 'ptr'.
  18721. In general, 'Value.dereference' can be applied whenever the C unary
  18722. operator '*' can be applied to the corresponding C value. For
  18723. those cases where applying both 'Value.dereference' and
  18724. 'Value.referenced_value' is allowed, the results obtained need not
  18725. be identical (as we have seen in the above example). The results
  18726. are however identical when applied on 'gdb.Value' objects
  18727. corresponding to pointers ('gdb.Value' objects with type code
  18728. 'TYPE_CODE_PTR') in a C/C++ program.
  18729. -- Function: Value.referenced_value ()
  18730. For pointer or reference data types, this method returns a new
  18731. 'gdb.Value' object corresponding to the value referenced by the
  18732. pointer/reference value. For pointer data types,
  18733. 'Value.dereference' and 'Value.referenced_value' produce identical
  18734. results. The difference between these methods is that
  18735. 'Value.dereference' cannot get the values referenced by reference
  18736. values. For example, consider a reference to an 'int', declared in
  18737. your C++ program as
  18738. int val = 10;
  18739. int &ref = val;
  18740. then applying 'Value.dereference' to the 'gdb.Value' object
  18741. corresponding to 'ref' will result in an error, while applying
  18742. 'Value.referenced_value' will result in a 'gdb.Value' object
  18743. identical to that corresponding to 'val'.
  18744. py_ref = gdb.parse_and_eval ("ref")
  18745. er_ref = py_ref.dereference () # Results in error
  18746. py_val = py_ref.referenced_value () # Returns the referenced value
  18747. The 'gdb.Value' object 'py_val' is identical to that corresponding
  18748. to 'val'.
  18749. -- Function: Value.reference_value ()
  18750. Return a 'gdb.Value' object which is a reference to the value
  18751. encapsulated by this instance.
  18752. -- Function: Value.const_value ()
  18753. Return a 'gdb.Value' object which is a 'const' version of the value
  18754. encapsulated by this instance.
  18755. -- Function: Value.dynamic_cast (type)
  18756. Like 'Value.cast', but works as if the C++ 'dynamic_cast' operator
  18757. were used. Consult a C++ reference for details.
  18758. -- Function: Value.reinterpret_cast (type)
  18759. Like 'Value.cast', but works as if the C++ 'reinterpret_cast'
  18760. operator were used. Consult a C++ reference for details.
  18761. -- Function: Value.format_string (...)
  18762. Convert a 'gdb.Value' to a string, similarly to what the 'print'
  18763. command does. Invoked with no arguments, this is equivalent to
  18764. calling the 'str' function on the 'gdb.Value'. The representation
  18765. of the same value may change across different versions of GDB, so
  18766. you shouldn't, for instance, parse the strings returned by this
  18767. method.
  18768. All the arguments are keyword only. If an argument is not
  18769. specified, the current global default setting is used.
  18770. 'raw'
  18771. 'True' if pretty-printers (*note Pretty Printing::) should not
  18772. be used to format the value. 'False' if enabled
  18773. pretty-printers matching the type represented by the
  18774. 'gdb.Value' should be used to format it.
  18775. 'pretty_arrays'
  18776. 'True' if arrays should be pretty printed to be more
  18777. convenient to read, 'False' if they shouldn't (see 'set print
  18778. array' in *note Print Settings::).
  18779. 'pretty_structs'
  18780. 'True' if structs should be pretty printed to be more
  18781. convenient to read, 'False' if they shouldn't (see 'set print
  18782. pretty' in *note Print Settings::).
  18783. 'array_indexes'
  18784. 'True' if array indexes should be included in the string
  18785. representation of arrays, 'False' if they shouldn't (see 'set
  18786. print array-indexes' in *note Print Settings::).
  18787. 'symbols'
  18788. 'True' if the string representation of a pointer should
  18789. include the corresponding symbol name (if one exists), 'False'
  18790. if it shouldn't (see 'set print symbol' in *note Print
  18791. Settings::).
  18792. 'unions'
  18793. 'True' if unions which are contained in other structures or
  18794. unions should be expanded, 'False' if they shouldn't (see 'set
  18795. print union' in *note Print Settings::).
  18796. 'deref_refs'
  18797. 'True' if C++ references should be resolved to the value they
  18798. refer to, 'False' (the default) if they shouldn't. Note that,
  18799. unlike for the 'print' command, references are not
  18800. automatically expanded when using the 'format_string' method
  18801. or the 'str' function. There is no global 'print' setting to
  18802. change the default behaviour.
  18803. 'actual_objects'
  18804. 'True' if the representation of a pointer to an object should
  18805. identify the _actual_ (derived) type of the object rather than
  18806. the _declared_ type, using the virtual function table.
  18807. 'False' if the _declared_ type should be used. (See 'set
  18808. print object' in *note Print Settings::).
  18809. 'static_fields'
  18810. 'True' if static members should be included in the string
  18811. representation of a C++ object, 'False' if they shouldn't (see
  18812. 'set print static-members' in *note Print Settings::).
  18813. 'max_elements'
  18814. Number of array elements to print, or '0' to print an
  18815. unlimited number of elements (see 'set print elements' in
  18816. *note Print Settings::).
  18817. 'max_depth'
  18818. The maximum depth to print for nested structs and unions, or
  18819. '-1' to print an unlimited number of elements (see 'set print
  18820. max-depth' in *note Print Settings::).
  18821. 'repeat_threshold'
  18822. Set the threshold for suppressing display of repeated array
  18823. elements, or '0' to represent all elements, even if repeated.
  18824. (See 'set print repeats' in *note Print Settings::).
  18825. 'format'
  18826. A string containing a single character representing the format
  18827. to use for the returned string. For instance, ''x'' is
  18828. equivalent to using the GDB command 'print' with the '/x'
  18829. option and formats the value as a hexadecimal number.
  18830. -- Function: Value.string ([encoding[, errors[, length]]])
  18831. If this 'gdb.Value' represents a string, then this method converts
  18832. the contents to a Python string. Otherwise, this method will throw
  18833. an exception.
  18834. Values are interpreted as strings according to the rules of the
  18835. current language. If the optional length argument is given, the
  18836. string will be converted to that length, and will include any
  18837. embedded zeroes that the string may contain. Otherwise, for
  18838. languages where the string is zero-terminated, the entire string
  18839. will be converted.
  18840. For example, in C-like languages, a value is a string if it is a
  18841. pointer to or an array of characters or ints of type 'wchar_t',
  18842. 'char16_t', or 'char32_t'.
  18843. If the optional ENCODING argument is given, it must be a string
  18844. naming the encoding of the string in the 'gdb.Value', such as
  18845. '"ascii"', '"iso-8859-6"' or '"utf-8"'. It accepts the same
  18846. encodings as the corresponding argument to Python's 'string.decode'
  18847. method, and the Python codec machinery will be used to convert the
  18848. string. If ENCODING is not given, or if ENCODING is the empty
  18849. string, then either the 'target-charset' (*note Character Sets::)
  18850. will be used, or a language-specific encoding will be used, if the
  18851. current language is able to supply one.
  18852. The optional ERRORS argument is the same as the corresponding
  18853. argument to Python's 'string.decode' method.
  18854. If the optional LENGTH argument is given, the string will be
  18855. fetched and converted to the given length.
  18856. -- Function: Value.lazy_string ([encoding [, length]])
  18857. If this 'gdb.Value' represents a string, then this method converts
  18858. the contents to a 'gdb.LazyString' (*note Lazy Strings In
  18859. Python::). Otherwise, this method will throw an exception.
  18860. If the optional ENCODING argument is given, it must be a string
  18861. naming the encoding of the 'gdb.LazyString'. Some examples are:
  18862. 'ascii', 'iso-8859-6' or 'utf-8'. If the ENCODING argument is an
  18863. encoding that GDB does recognize, GDB will raise an error.
  18864. When a lazy string is printed, the GDB encoding machinery is used
  18865. to convert the string during printing. If the optional ENCODING
  18866. argument is not provided, or is an empty string, GDB will
  18867. automatically select the encoding most suitable for the string
  18868. type. For further information on encoding in GDB please see *note
  18869. Character Sets::.
  18870. If the optional LENGTH argument is given, the string will be
  18871. fetched and encoded to the length of characters specified. If the
  18872. LENGTH argument is not provided, the string will be fetched and
  18873. encoded until a null of appropriate width is found.
  18874. -- Function: Value.fetch_lazy ()
  18875. If the 'gdb.Value' object is currently a lazy value
  18876. ('gdb.Value.is_lazy' is 'True'), then the value is fetched from the
  18877. inferior. Any errors that occur in the process will produce a
  18878. Python exception.
  18879. If the 'gdb.Value' object is not a lazy value, this method has no
  18880. effect.
  18881. This method does not return a value.
  18882. 
  18883. File: gdb.info, Node: Types In Python, Next: Pretty Printing API, Prev: Values From Inferior, Up: Python API
  18884. 23.2.2.4 Types In Python
  18885. ........................
  18886. GDB represents types from the inferior using the class 'gdb.Type'.
  18887. The following type-related functions are available in the 'gdb'
  18888. module:
  18889. -- Function: gdb.lookup_type (name [, block])
  18890. This function looks up a type by its NAME, which must be a string.
  18891. If BLOCK is given, then NAME is looked up in that scope.
  18892. Otherwise, it is searched for globally.
  18893. Ordinarily, this function will return an instance of 'gdb.Type'.
  18894. If the named type cannot be found, it will throw an exception.
  18895. If the type is a structure or class type, or an enum type, the fields
  18896. of that type can be accessed using the Python "dictionary syntax". For
  18897. example, if 'some_type' is a 'gdb.Type' instance holding a structure
  18898. type, you can access its 'foo' field with:
  18899. bar = some_type['foo']
  18900. 'bar' will be a 'gdb.Field' object; see below under the description
  18901. of the 'Type.fields' method for a description of the 'gdb.Field' class.
  18902. An instance of 'Type' has the following attributes:
  18903. -- Variable: Type.alignof
  18904. The alignment of this type, in bytes. Type alignment comes from
  18905. the debugging information; if it was not specified, then GDB will
  18906. use the relevant ABI to try to determine the alignment. In some
  18907. cases, even this is not possible, and zero will be returned.
  18908. -- Variable: Type.code
  18909. The type code for this type. The type code will be one of the
  18910. 'TYPE_CODE_' constants defined below.
  18911. -- Variable: Type.name
  18912. The name of this type. If this type has no name, then 'None' is
  18913. returned.
  18914. -- Variable: Type.sizeof
  18915. The size of this type, in target 'char' units. Usually, a target's
  18916. 'char' type will be an 8-bit byte. However, on some unusual
  18917. platforms, this type may have a different size.
  18918. -- Variable: Type.tag
  18919. The tag name for this type. The tag name is the name after
  18920. 'struct', 'union', or 'enum' in C and C++; not all languages have
  18921. this concept. If this type has no tag name, then 'None' is
  18922. returned.
  18923. -- Variable: Type.objfile
  18924. The 'gdb.Objfile' that this type was defined in, or 'None' if there
  18925. is no associated objfile.
  18926. The following methods are provided:
  18927. -- Function: Type.fields ()
  18928. For structure and union types, this method returns the fields.
  18929. Range types have two fields, the minimum and maximum values. Enum
  18930. types have one field per enum constant. Function and method types
  18931. have one field per parameter. The base types of C++ classes are
  18932. also represented as fields. If the type has no fields, or does not
  18933. fit into one of these categories, an empty sequence will be
  18934. returned.
  18935. Each field is a 'gdb.Field' object, with some pre-defined
  18936. attributes:
  18937. 'bitpos'
  18938. This attribute is not available for 'enum' or 'static' (as in
  18939. C++) fields. The value is the position, counting in bits,
  18940. from the start of the containing type.
  18941. 'enumval'
  18942. This attribute is only available for 'enum' fields, and its
  18943. value is the enumeration member's integer representation.
  18944. 'name'
  18945. The name of the field, or 'None' for anonymous fields.
  18946. 'artificial'
  18947. This is 'True' if the field is artificial, usually meaning
  18948. that it was provided by the compiler and not the user. This
  18949. attribute is always provided, and is 'False' if the field is
  18950. not artificial.
  18951. 'is_base_class'
  18952. This is 'True' if the field represents a base class of a C++
  18953. structure. This attribute is always provided, and is 'False'
  18954. if the field is not a base class of the type that is the
  18955. argument of 'fields', or if that type was not a C++ class.
  18956. 'bitsize'
  18957. If the field is packed, or is a bitfield, then this will have
  18958. a non-zero value, which is the size of the field in bits.
  18959. Otherwise, this will be zero; in this case the field's size is
  18960. given by its type.
  18961. 'type'
  18962. The type of the field. This is usually an instance of 'Type',
  18963. but it can be 'None' in some situations.
  18964. 'parent_type'
  18965. The type which contains this field. This is an instance of
  18966. 'gdb.Type'.
  18967. -- Function: Type.array (N1 [, N2])
  18968. Return a new 'gdb.Type' object which represents an array of this
  18969. type. If one argument is given, it is the inclusive upper bound of
  18970. the array; in this case the lower bound is zero. If two arguments
  18971. are given, the first argument is the lower bound of the array, and
  18972. the second argument is the upper bound of the array. An array's
  18973. length must not be negative, but the bounds can be.
  18974. -- Function: Type.vector (N1 [, N2])
  18975. Return a new 'gdb.Type' object which represents a vector of this
  18976. type. If one argument is given, it is the inclusive upper bound of
  18977. the vector; in this case the lower bound is zero. If two arguments
  18978. are given, the first argument is the lower bound of the vector, and
  18979. the second argument is the upper bound of the vector. A vector's
  18980. length must not be negative, but the bounds can be.
  18981. The difference between an 'array' and a 'vector' is that arrays
  18982. behave like in C: when used in expressions they decay to a pointer
  18983. to the first element whereas vectors are treated as first class
  18984. values.
  18985. -- Function: Type.const ()
  18986. Return a new 'gdb.Type' object which represents a 'const'-qualified
  18987. variant of this type.
  18988. -- Function: Type.volatile ()
  18989. Return a new 'gdb.Type' object which represents a
  18990. 'volatile'-qualified variant of this type.
  18991. -- Function: Type.unqualified ()
  18992. Return a new 'gdb.Type' object which represents an unqualified
  18993. variant of this type. That is, the result is neither 'const' nor
  18994. 'volatile'.
  18995. -- Function: Type.range ()
  18996. Return a Python 'Tuple' object that contains two elements: the low
  18997. bound of the argument type and the high bound of that type. If the
  18998. type does not have a range, GDB will raise a 'gdb.error' exception
  18999. (*note Exception Handling::).
  19000. -- Function: Type.reference ()
  19001. Return a new 'gdb.Type' object which represents a reference to this
  19002. type.
  19003. -- Function: Type.pointer ()
  19004. Return a new 'gdb.Type' object which represents a pointer to this
  19005. type.
  19006. -- Function: Type.strip_typedefs ()
  19007. Return a new 'gdb.Type' that represents the real type, after
  19008. removing all layers of typedefs.
  19009. -- Function: Type.target ()
  19010. Return a new 'gdb.Type' object which represents the target type of
  19011. this type.
  19012. For a pointer type, the target type is the type of the pointed-to
  19013. object. For an array type (meaning C-like arrays), the target type
  19014. is the type of the elements of the array. For a function or method
  19015. type, the target type is the type of the return value. For a
  19016. complex type, the target type is the type of the elements. For a
  19017. typedef, the target type is the aliased type.
  19018. If the type does not have a target, this method will throw an
  19019. exception.
  19020. -- Function: Type.template_argument (n [, block])
  19021. If this 'gdb.Type' is an instantiation of a template, this will
  19022. return a new 'gdb.Value' or 'gdb.Type' which represents the value
  19023. of the Nth template argument (indexed starting at 0).
  19024. If this 'gdb.Type' is not a template type, or if the type has fewer
  19025. than N template arguments, this will throw an exception.
  19026. Ordinarily, only C++ code will have template types.
  19027. If BLOCK is given, then NAME is looked up in that scope.
  19028. Otherwise, it is searched for globally.
  19029. -- Function: Type.optimized_out ()
  19030. Return 'gdb.Value' instance of this type whose value is optimized
  19031. out. This allows a frame decorator to indicate that the value of
  19032. an argument or a local variable is not known.
  19033. Each type has a code, which indicates what category this type falls
  19034. into. The available type categories are represented by constants
  19035. defined in the 'gdb' module:
  19036. 'gdb.TYPE_CODE_PTR'
  19037. The type is a pointer.
  19038. 'gdb.TYPE_CODE_ARRAY'
  19039. The type is an array.
  19040. 'gdb.TYPE_CODE_STRUCT'
  19041. The type is a structure.
  19042. 'gdb.TYPE_CODE_UNION'
  19043. The type is a union.
  19044. 'gdb.TYPE_CODE_ENUM'
  19045. The type is an enum.
  19046. 'gdb.TYPE_CODE_FLAGS'
  19047. A bit flags type, used for things such as status registers.
  19048. 'gdb.TYPE_CODE_FUNC'
  19049. The type is a function.
  19050. 'gdb.TYPE_CODE_INT'
  19051. The type is an integer type.
  19052. 'gdb.TYPE_CODE_FLT'
  19053. A floating point type.
  19054. 'gdb.TYPE_CODE_VOID'
  19055. The special type 'void'.
  19056. 'gdb.TYPE_CODE_SET'
  19057. A Pascal set type.
  19058. 'gdb.TYPE_CODE_RANGE'
  19059. A range type, that is, an integer type with bounds.
  19060. 'gdb.TYPE_CODE_STRING'
  19061. A string type. Note that this is only used for certain languages
  19062. with language-defined string types; C strings are not represented
  19063. this way.
  19064. 'gdb.TYPE_CODE_BITSTRING'
  19065. A string of bits. It is deprecated.
  19066. 'gdb.TYPE_CODE_ERROR'
  19067. An unknown or erroneous type.
  19068. 'gdb.TYPE_CODE_METHOD'
  19069. A method type, as found in C++.
  19070. 'gdb.TYPE_CODE_METHODPTR'
  19071. A pointer-to-member-function.
  19072. 'gdb.TYPE_CODE_MEMBERPTR'
  19073. A pointer-to-member.
  19074. 'gdb.TYPE_CODE_REF'
  19075. A reference type.
  19076. 'gdb.TYPE_CODE_RVALUE_REF'
  19077. A C++11 rvalue reference type.
  19078. 'gdb.TYPE_CODE_CHAR'
  19079. A character type.
  19080. 'gdb.TYPE_CODE_BOOL'
  19081. A boolean type.
  19082. 'gdb.TYPE_CODE_COMPLEX'
  19083. A complex float type.
  19084. 'gdb.TYPE_CODE_TYPEDEF'
  19085. A typedef to some other type.
  19086. 'gdb.TYPE_CODE_NAMESPACE'
  19087. A C++ namespace.
  19088. 'gdb.TYPE_CODE_DECFLOAT'
  19089. A decimal floating point type.
  19090. 'gdb.TYPE_CODE_INTERNAL_FUNCTION'
  19091. A function internal to GDB. This is the type used to represent
  19092. convenience functions.
  19093. Further support for types is provided in the 'gdb.types' Python
  19094. module (*note gdb.types::).
  19095. 
  19096. File: gdb.info, Node: Pretty Printing API, Next: Selecting Pretty-Printers, Prev: Types In Python, Up: Python API
  19097. 23.2.2.5 Pretty Printing API
  19098. ............................
  19099. A pretty-printer is just an object that holds a value and implements a
  19100. specific interface, defined here. An example output is provided (*note
  19101. Pretty Printing::).
  19102. -- Function: pretty_printer.children (self)
  19103. GDB will call this method on a pretty-printer to compute the
  19104. children of the pretty-printer's value.
  19105. This method must return an object conforming to the Python iterator
  19106. protocol. Each item returned by the iterator must be a tuple
  19107. holding two elements. The first element is the "name" of the
  19108. child; the second element is the child's value. The value can be
  19109. any Python object which is convertible to a GDB value.
  19110. This method is optional. If it does not exist, GDB will act as
  19111. though the value has no children.
  19112. For efficiency, the 'children' method should lazily compute its
  19113. results. This will let GDB read as few elements as necessary, for
  19114. example when various print settings (*note Print Settings::) or
  19115. '-var-list-children' (*note GDB/MI Variable Objects::) limit the
  19116. number of elements to be displayed.
  19117. Children may be hidden from display based on the value of 'set
  19118. print max-depth' (*note Print Settings::).
  19119. -- Function: pretty_printer.display_hint (self)
  19120. The CLI may call this method and use its result to change the
  19121. formatting of a value. The result will also be supplied to an MI
  19122. consumer as a 'displayhint' attribute of the variable being
  19123. printed.
  19124. This method is optional. If it does exist, this method must return
  19125. a string or the special value 'None'.
  19126. Some display hints are predefined by GDB:
  19127. 'array'
  19128. Indicate that the object being printed is "array-like". The
  19129. CLI uses this to respect parameters such as 'set print
  19130. elements' and 'set print array'.
  19131. 'map'
  19132. Indicate that the object being printed is "map-like", and that
  19133. the children of this value can be assumed to alternate between
  19134. keys and values.
  19135. 'string'
  19136. Indicate that the object being printed is "string-like". If
  19137. the printer's 'to_string' method returns a Python string of
  19138. some kind, then GDB will call its internal language-specific
  19139. string-printing function to format the string. For the CLI
  19140. this means adding quotation marks, possibly escaping some
  19141. characters, respecting 'set print elements', and the like.
  19142. The special value 'None' causes GDB to apply the default display
  19143. rules.
  19144. -- Function: pretty_printer.to_string (self)
  19145. GDB will call this method to display the string representation of
  19146. the value passed to the object's constructor.
  19147. When printing from the CLI, if the 'to_string' method exists, then
  19148. GDB will prepend its result to the values returned by 'children'.
  19149. Exactly how this formatting is done is dependent on the display
  19150. hint, and may change as more hints are added. Also, depending on
  19151. the print settings (*note Print Settings::), the CLI may print just
  19152. the result of 'to_string' in a stack trace, omitting the result of
  19153. 'children'.
  19154. If this method returns a string, it is printed verbatim.
  19155. Otherwise, if this method returns an instance of 'gdb.Value', then
  19156. GDB prints this value. This may result in a call to another
  19157. pretty-printer.
  19158. If instead the method returns a Python value which is convertible
  19159. to a 'gdb.Value', then GDB performs the conversion and prints the
  19160. resulting value. Again, this may result in a call to another
  19161. pretty-printer. Python scalars (integers, floats, and booleans)
  19162. and strings are convertible to 'gdb.Value'; other types are not.
  19163. Finally, if this method returns 'None' then no further operations
  19164. are peformed in this method and nothing is printed.
  19165. If the result is not one of these types, an exception is raised.
  19166. GDB provides a function which can be used to look up the default
  19167. pretty-printer for a 'gdb.Value':
  19168. -- Function: gdb.default_visualizer (value)
  19169. This function takes a 'gdb.Value' object as an argument. If a
  19170. pretty-printer for this value exists, then it is returned. If no
  19171. such printer exists, then this returns 'None'.
  19172. 
  19173. File: gdb.info, Node: Selecting Pretty-Printers, Next: Writing a Pretty-Printer, Prev: Pretty Printing API, Up: Python API
  19174. 23.2.2.6 Selecting Pretty-Printers
  19175. ..................................
  19176. GDB provides several ways to register a pretty-printer: globally, per
  19177. program space, and per objfile. When choosing how to register your
  19178. pretty-printer, a good rule is to register it with the smallest scope
  19179. possible: that is prefer a specific objfile first, then a program space,
  19180. and only register a printer globally as a last resort.
  19181. -- Variable: gdb.pretty_printers
  19182. The Python list 'gdb.pretty_printers' contains an array of
  19183. functions or callable objects that have been registered via
  19184. addition as a pretty-printer. Printers in this list are called
  19185. 'global' printers, they're available when debugging all inferiors.
  19186. Each 'gdb.Progspace' contains a 'pretty_printers' attribute. Each
  19187. 'gdb.Objfile' also contains a 'pretty_printers' attribute.
  19188. Each function on these lists is passed a single 'gdb.Value' argument
  19189. and should return a pretty-printer object conforming to the interface
  19190. definition above (*note Pretty Printing API::). If a function cannot
  19191. create a pretty-printer for the value, it should return 'None'.
  19192. GDB first checks the 'pretty_printers' attribute of each
  19193. 'gdb.Objfile' in the current program space and iteratively calls each
  19194. enabled lookup routine in the list for that 'gdb.Objfile' until it
  19195. receives a pretty-printer object. If no pretty-printer is found in the
  19196. objfile lists, GDB then searches the pretty-printer list of the current
  19197. program space, calling each enabled function until an object is
  19198. returned. After these lists have been exhausted, it tries the global
  19199. 'gdb.pretty_printers' list, again calling each enabled function until an
  19200. object is returned.
  19201. The order in which the objfiles are searched is not specified. For a
  19202. given list, functions are always invoked from the head of the list, and
  19203. iterated over sequentially until the end of the list, or a printer
  19204. object is returned.
  19205. For various reasons a pretty-printer may not work. For example, the
  19206. underlying data structure may have changed and the pretty-printer is out
  19207. of date.
  19208. The consequences of a broken pretty-printer are severe enough that
  19209. GDB provides support for enabling and disabling individual printers.
  19210. For example, if 'print frame-arguments' is on, a backtrace can become
  19211. highly illegible if any argument is printed with a broken printer.
  19212. Pretty-printers are enabled and disabled by attaching an 'enabled'
  19213. attribute to the registered function or callable object. If this
  19214. attribute is present and its value is 'False', the printer is disabled,
  19215. otherwise the printer is enabled.
  19216. 
  19217. File: gdb.info, Node: Writing a Pretty-Printer, Next: Type Printing API, Prev: Selecting Pretty-Printers, Up: Python API
  19218. 23.2.2.7 Writing a Pretty-Printer
  19219. .................................
  19220. A pretty-printer consists of two parts: a lookup function to detect if
  19221. the type is supported, and the printer itself.
  19222. Here is an example showing how a 'std::string' printer might be
  19223. written. *Note Pretty Printing API::, for details on the API this class
  19224. must provide.
  19225. class StdStringPrinter(object):
  19226. "Print a std::string"
  19227. def __init__(self, val):
  19228. self.val = val
  19229. def to_string(self):
  19230. return self.val['_M_dataplus']['_M_p']
  19231. def display_hint(self):
  19232. return 'string'
  19233. And here is an example showing how a lookup function for the printer
  19234. example above might be written.
  19235. def str_lookup_function(val):
  19236. lookup_tag = val.type.tag
  19237. if lookup_tag == None:
  19238. return None
  19239. regex = re.compile("^std::basic_string<char,.*>$")
  19240. if regex.match(lookup_tag):
  19241. return StdStringPrinter(val)
  19242. return None
  19243. The example lookup function extracts the value's type, and attempts
  19244. to match it to a type that it can pretty-print. If it is a type the
  19245. printer can pretty-print, it will return a printer object. If not, it
  19246. returns 'None'.
  19247. We recommend that you put your core pretty-printers into a Python
  19248. package. If your pretty-printers are for use with a library, we further
  19249. recommend embedding a version number into the package name. This
  19250. practice will enable GDB to load multiple versions of your
  19251. pretty-printers at the same time, because they will have different
  19252. names.
  19253. You should write auto-loaded code (*note Python Auto-loading::) such
  19254. that it can be evaluated multiple times without changing its meaning.
  19255. An ideal auto-load file will consist solely of 'import's of your printer
  19256. modules, followed by a call to a register pretty-printers with the
  19257. current objfile.
  19258. Taken as a whole, this approach will scale nicely to multiple
  19259. inferiors, each potentially using a different library version.
  19260. Embedding a version number in the Python package name will ensure that
  19261. GDB is able to load both sets of printers simultaneously. Then, because
  19262. the search for pretty-printers is done by objfile, and because your
  19263. auto-loaded code took care to register your library's printers with a
  19264. specific objfile, GDB will find the correct printers for the specific
  19265. version of the library used by each inferior.
  19266. To continue the 'std::string' example (*note Pretty Printing API::),
  19267. this code might appear in 'gdb.libstdcxx.v6':
  19268. def register_printers(objfile):
  19269. objfile.pretty_printers.append(str_lookup_function)
  19270. And then the corresponding contents of the auto-load file would be:
  19271. import gdb.libstdcxx.v6
  19272. gdb.libstdcxx.v6.register_printers(gdb.current_objfile())
  19273. The previous example illustrates a basic pretty-printer. There are a
  19274. few things that can be improved on. The printer doesn't have a name,
  19275. making it hard to identify in a list of installed printers. The lookup
  19276. function has a name, but lookup functions can have arbitrary, even
  19277. identical, names.
  19278. Second, the printer only handles one type, whereas a library
  19279. typically has several types. One could install a lookup function for
  19280. each desired type in the library, but one could also have a single
  19281. lookup function recognize several types. The latter is the conventional
  19282. way this is handled. If a pretty-printer can handle multiple data
  19283. types, then its "subprinters" are the printers for the individual data
  19284. types.
  19285. The 'gdb.printing' module provides a formal way of solving these
  19286. problems (*note gdb.printing::). Here is another example that handles
  19287. multiple types.
  19288. These are the types we are going to pretty-print:
  19289. struct foo { int a, b; };
  19290. struct bar { struct foo x, y; };
  19291. Here are the printers:
  19292. class fooPrinter:
  19293. """Print a foo object."""
  19294. def __init__(self, val):
  19295. self.val = val
  19296. def to_string(self):
  19297. return ("a=<" + str(self.val["a"]) +
  19298. "> b=<" + str(self.val["b"]) + ">")
  19299. class barPrinter:
  19300. """Print a bar object."""
  19301. def __init__(self, val):
  19302. self.val = val
  19303. def to_string(self):
  19304. return ("x=<" + str(self.val["x"]) +
  19305. "> y=<" + str(self.val["y"]) + ">")
  19306. This example doesn't need a lookup function, that is handled by the
  19307. 'gdb.printing' module. Instead a function is provided to build up the
  19308. object that handles the lookup.
  19309. import gdb.printing
  19310. def build_pretty_printer():
  19311. pp = gdb.printing.RegexpCollectionPrettyPrinter(
  19312. "my_library")
  19313. pp.add_printer('foo', '^foo$', fooPrinter)
  19314. pp.add_printer('bar', '^bar$', barPrinter)
  19315. return pp
  19316. And here is the autoload support:
  19317. import gdb.printing
  19318. import my_library
  19319. gdb.printing.register_pretty_printer(
  19320. gdb.current_objfile(),
  19321. my_library.build_pretty_printer())
  19322. Finally, when this printer is loaded into GDB, here is the
  19323. corresponding output of 'info pretty-printer':
  19324. (gdb) info pretty-printer
  19325. my_library.so:
  19326. my_library
  19327. foo
  19328. bar
  19329. 
  19330. File: gdb.info, Node: Type Printing API, Next: Frame Filter API, Prev: Writing a Pretty-Printer, Up: Python API
  19331. 23.2.2.8 Type Printing API
  19332. ..........................
  19333. GDB provides a way for Python code to customize type display. This is
  19334. mainly useful for substituting canonical typedef names for types.
  19335. A "type printer" is just a Python object conforming to a certain
  19336. protocol. A simple base class implementing the protocol is provided;
  19337. see *note gdb.types::. A type printer must supply at least:
  19338. -- Instance Variable of type_printer: enabled
  19339. A boolean which is True if the printer is enabled, and False
  19340. otherwise. This is manipulated by the 'enable type-printer' and
  19341. 'disable type-printer' commands.
  19342. -- Instance Variable of type_printer: name
  19343. The name of the type printer. This must be a string. This is used
  19344. by the 'enable type-printer' and 'disable type-printer' commands.
  19345. -- Method on type_printer: instantiate (self)
  19346. This is called by GDB at the start of type-printing. It is only
  19347. called if the type printer is enabled. This method must return a
  19348. new object that supplies a 'recognize' method, as described below.
  19349. When displaying a type, say via the 'ptype' command, GDB will compute
  19350. a list of type recognizers. This is done by iterating first over the
  19351. per-objfile type printers (*note Objfiles In Python::), followed by the
  19352. per-progspace type printers (*note Progspaces In Python::), and finally
  19353. the global type printers.
  19354. GDB will call the 'instantiate' method of each enabled type printer.
  19355. If this method returns 'None', then the result is ignored; otherwise, it
  19356. is appended to the list of recognizers.
  19357. Then, when GDB is going to display a type name, it iterates over the
  19358. list of recognizers. For each one, it calls the recognition function,
  19359. stopping if the function returns a non-'None' value. The recognition
  19360. function is defined as:
  19361. -- Method on type_recognizer: recognize (self, type)
  19362. If TYPE is not recognized, return 'None'. Otherwise, return a
  19363. string which is to be printed as the name of TYPE. The TYPE
  19364. argument will be an instance of 'gdb.Type' (*note Types In
  19365. Python::).
  19366. GDB uses this two-pass approach so that type printers can efficiently
  19367. cache information without holding on to it too long. For example, it
  19368. can be convenient to look up type information in a type printer and hold
  19369. it for a recognizer's lifetime; if a single pass were done then type
  19370. printers would have to make use of the event system in order to avoid
  19371. holding information that could become stale as the inferior changed.
  19372. 
  19373. File: gdb.info, Node: Frame Filter API, Next: Frame Decorator API, Prev: Type Printing API, Up: Python API
  19374. 23.2.2.9 Filtering Frames
  19375. .........................
  19376. Frame filters are Python objects that manipulate the visibility of a
  19377. frame or frames when a backtrace (*note Backtrace::) is printed by GDB.
  19378. Only commands that print a backtrace, or, in the case of GDB/MI
  19379. commands (*note GDB/MI::), those that return a collection of frames are
  19380. affected. The commands that work with frame filters are:
  19381. 'backtrace' (*note The backtrace command: backtrace-command.),
  19382. '-stack-list-frames' (*note The -stack-list-frames command:
  19383. -stack-list-frames.), '-stack-list-variables' (*note The
  19384. -stack-list-variables command: -stack-list-variables.),
  19385. '-stack-list-arguments' *note The -stack-list-arguments command:
  19386. -stack-list-arguments.) and '-stack-list-locals' (*note The
  19387. -stack-list-locals command: -stack-list-locals.).
  19388. A frame filter works by taking an iterator as an argument, applying
  19389. actions to the contents of that iterator, and returning another iterator
  19390. (or, possibly, the same iterator it was provided in the case where the
  19391. filter does not perform any operations). Typically, frame filters
  19392. utilize tools such as the Python's 'itertools' module to work with and
  19393. create new iterators from the source iterator. Regardless of how a
  19394. filter chooses to apply actions, it must not alter the underlying GDB
  19395. frame or frames, or attempt to alter the call-stack within GDB. This
  19396. preserves data integrity within GDB. Frame filters are executed on a
  19397. priority basis and care should be taken that some frame filters may have
  19398. been executed before, and that some frame filters will be executed
  19399. after.
  19400. An important consideration when designing frame filters, and well
  19401. worth reflecting upon, is that frame filters should avoid unwinding the
  19402. call stack if possible. Some stacks can run very deep, into the tens of
  19403. thousands in some cases. To search every frame when a frame filter
  19404. executes may be too expensive at that step. The frame filter cannot
  19405. know how many frames it has to iterate over, and it may have to iterate
  19406. through them all. This ends up duplicating effort as GDB performs this
  19407. iteration when it prints the frames. If the filter can defer unwinding
  19408. frames until frame decorators are executed, after the last filter has
  19409. executed, it should. *Note Frame Decorator API::, for more information
  19410. on decorators. Also, there are examples for both frame decorators and
  19411. filters in later chapters. *Note Writing a Frame Filter::, for more
  19412. information.
  19413. The Python dictionary 'gdb.frame_filters' contains key/object
  19414. pairings that comprise a frame filter. Frame filters in this dictionary
  19415. are called 'global' frame filters, and they are available when debugging
  19416. all inferiors. These frame filters must register with the dictionary
  19417. directly. In addition to the 'global' dictionary, there are other
  19418. dictionaries that are loaded with different inferiors via auto-loading
  19419. (*note Python Auto-loading::). The two other areas where frame filter
  19420. dictionaries can be found are: 'gdb.Progspace' which contains a
  19421. 'frame_filters' dictionary attribute, and each 'gdb.Objfile' object
  19422. which also contains a 'frame_filters' dictionary attribute.
  19423. When a command is executed from GDB that is compatible with frame
  19424. filters, GDB combines the 'global', 'gdb.Progspace' and all
  19425. 'gdb.Objfile' dictionaries currently loaded. All of the 'gdb.Objfile'
  19426. dictionaries are combined, as several frames, and thus several object
  19427. files, might be in use. GDB then prunes any frame filter whose
  19428. 'enabled' attribute is 'False'. This pruned list is then sorted
  19429. according to the 'priority' attribute in each filter.
  19430. Once the dictionaries are combined, pruned and sorted, GDB creates an
  19431. iterator which wraps each frame in the call stack in a 'FrameDecorator'
  19432. object, and calls each filter in order. The output from the previous
  19433. filter will always be the input to the next filter, and so on.
  19434. Frame filters have a mandatory interface which each frame filter must
  19435. implement, defined here:
  19436. -- Function: FrameFilter.filter (iterator)
  19437. GDB will call this method on a frame filter when it has reached the
  19438. order in the priority list for that filter.
  19439. For example, if there are four frame filters:
  19440. Name Priority
  19441. Filter1 5
  19442. Filter2 10
  19443. Filter3 100
  19444. Filter4 1
  19445. The order that the frame filters will be called is:
  19446. Filter3 -> Filter2 -> Filter1 -> Filter4
  19447. Note that the output from 'Filter3' is passed to the input of
  19448. 'Filter2', and so on.
  19449. This 'filter' method is passed a Python iterator. This iterator
  19450. contains a sequence of frame decorators that wrap each 'gdb.Frame',
  19451. or a frame decorator that wraps another frame decorator. The first
  19452. filter that is executed in the sequence of frame filters will
  19453. receive an iterator entirely comprised of default 'FrameDecorator'
  19454. objects. However, after each frame filter is executed, the
  19455. previous frame filter may have wrapped some or all of the frame
  19456. decorators with their own frame decorator. As frame decorators
  19457. must also conform to a mandatory interface, these decorators can be
  19458. assumed to act in a uniform manner (*note Frame Decorator API::).
  19459. This method must return an object conforming to the Python iterator
  19460. protocol. Each item in the iterator must be an object conforming
  19461. to the frame decorator interface. If a frame filter does not wish
  19462. to perform any operations on this iterator, it should return that
  19463. iterator untouched.
  19464. This method is not optional. If it does not exist, GDB will raise
  19465. and print an error.
  19466. -- Variable: FrameFilter.name
  19467. The 'name' attribute must be Python string which contains the name
  19468. of the filter displayed by GDB (*note Frame Filter Management::).
  19469. This attribute may contain any combination of letters or numbers.
  19470. Care should be taken to ensure that it is unique. This attribute
  19471. is mandatory.
  19472. -- Variable: FrameFilter.enabled
  19473. The 'enabled' attribute must be Python boolean. This attribute
  19474. indicates to GDB whether the frame filter is enabled, and should be
  19475. considered when frame filters are executed. If 'enabled' is
  19476. 'True', then the frame filter will be executed when any of the
  19477. backtrace commands detailed earlier in this chapter are executed.
  19478. If 'enabled' is 'False', then the frame filter will not be
  19479. executed. This attribute is mandatory.
  19480. -- Variable: FrameFilter.priority
  19481. The 'priority' attribute must be Python integer. This attribute
  19482. controls the order of execution in relation to other frame filters.
  19483. There are no imposed limits on the range of 'priority' other than
  19484. it must be a valid integer. The higher the 'priority' attribute,
  19485. the sooner the frame filter will be executed in relation to other
  19486. frame filters. Although 'priority' can be negative, it is
  19487. recommended practice to assume zero is the lowest priority that a
  19488. frame filter can be assigned. Frame filters that have the same
  19489. priority are executed in unsorted order in that priority slot.
  19490. This attribute is mandatory. 100 is a good default priority.
  19491. 
  19492. File: gdb.info, Node: Frame Decorator API, Next: Writing a Frame Filter, Prev: Frame Filter API, Up: Python API
  19493. 23.2.2.10 Decorating Frames
  19494. ...........................
  19495. Frame decorators are sister objects to frame filters (*note Frame Filter
  19496. API::). Frame decorators are applied by a frame filter and can only be
  19497. used in conjunction with frame filters.
  19498. The purpose of a frame decorator is to customize the printed content
  19499. of each 'gdb.Frame' in commands where frame filters are executed. This
  19500. concept is called decorating a frame. Frame decorators decorate a
  19501. 'gdb.Frame' with Python code contained within each API call. This
  19502. separates the actual data contained in a 'gdb.Frame' from the decorated
  19503. data produced by a frame decorator. This abstraction is necessary to
  19504. maintain integrity of the data contained in each 'gdb.Frame'.
  19505. Frame decorators have a mandatory interface, defined below.
  19506. GDB already contains a frame decorator called 'FrameDecorator'. This
  19507. contains substantial amounts of boilerplate code to decorate the content
  19508. of a 'gdb.Frame'. It is recommended that other frame decorators inherit
  19509. and extend this object, and only to override the methods needed.
  19510. 'FrameDecorator' is defined in the Python module
  19511. 'gdb.FrameDecorator', so your code can import it like:
  19512. from gdb.FrameDecorator import FrameDecorator
  19513. -- Function: FrameDecorator.elided (self)
  19514. The 'elided' method groups frames together in a hierarchical
  19515. system. An example would be an interpreter, where multiple
  19516. low-level frames make up a single call in the interpreted language.
  19517. In this example, the frame filter would elide the low-level frames
  19518. and present a single high-level frame, representing the call in the
  19519. interpreted language, to the user.
  19520. The 'elided' function must return an iterable and this iterable
  19521. must contain the frames that are being elided wrapped in a suitable
  19522. frame decorator. If no frames are being elided this function may
  19523. return an empty iterable, or 'None'. Elided frames are indented
  19524. from normal frames in a 'CLI' backtrace, or in the case of
  19525. 'GDB/MI', are placed in the 'children' field of the eliding frame.
  19526. It is the frame filter's task to also filter out the elided frames
  19527. from the source iterator. This will avoid printing the frame
  19528. twice.
  19529. -- Function: FrameDecorator.function (self)
  19530. This method returns the name of the function in the frame that is
  19531. to be printed.
  19532. This method must return a Python string describing the function, or
  19533. 'None'.
  19534. If this function returns 'None', GDB will not print any data for
  19535. this field.
  19536. -- Function: FrameDecorator.address (self)
  19537. This method returns the address of the frame that is to be printed.
  19538. This method must return a Python numeric integer type of sufficient
  19539. size to describe the address of the frame, or 'None'.
  19540. If this function returns a 'None', GDB will not print any data for
  19541. this field.
  19542. -- Function: FrameDecorator.filename (self)
  19543. This method returns the filename and path associated with this
  19544. frame.
  19545. This method must return a Python string containing the filename and
  19546. the path to the object file backing the frame, or 'None'.
  19547. If this function returns a 'None', GDB will not print any data for
  19548. this field.
  19549. -- Function: FrameDecorator.line (self):
  19550. This method returns the line number associated with the current
  19551. position within the function addressed by this frame.
  19552. This method must return a Python integer type, or 'None'.
  19553. If this function returns a 'None', GDB will not print any data for
  19554. this field.
  19555. -- Function: FrameDecorator.frame_args (self)
  19556. This method must return an iterable, or 'None'. Returning an empty
  19557. iterable, or 'None' means frame arguments will not be printed for
  19558. this frame. This iterable must contain objects that implement two
  19559. methods, described here.
  19560. This object must implement a 'argument' method which takes a single
  19561. 'self' parameter and must return a 'gdb.Symbol' (*note Symbols In
  19562. Python::), or a Python string. The object must also implement a
  19563. 'value' method which takes a single 'self' parameter and must
  19564. return a 'gdb.Value' (*note Values From Inferior::), a Python
  19565. value, or 'None'. If the 'value' method returns 'None', and the
  19566. 'argument' method returns a 'gdb.Symbol', GDB will look-up and
  19567. print the value of the 'gdb.Symbol' automatically.
  19568. A brief example:
  19569. class SymValueWrapper():
  19570. def __init__(self, symbol, value):
  19571. self.sym = symbol
  19572. self.val = value
  19573. def value(self):
  19574. return self.val
  19575. def symbol(self):
  19576. return self.sym
  19577. class SomeFrameDecorator()
  19578. ...
  19579. ...
  19580. def frame_args(self):
  19581. args = []
  19582. try:
  19583. block = self.inferior_frame.block()
  19584. except:
  19585. return None
  19586. # Iterate over all symbols in a block. Only add
  19587. # symbols that are arguments.
  19588. for sym in block:
  19589. if not sym.is_argument:
  19590. continue
  19591. args.append(SymValueWrapper(sym,None))
  19592. # Add example synthetic argument.
  19593. args.append(SymValueWrapper(``foo'', 42))
  19594. return args
  19595. -- Function: FrameDecorator.frame_locals (self)
  19596. This method must return an iterable or 'None'. Returning an empty
  19597. iterable, or 'None' means frame local arguments will not be printed
  19598. for this frame.
  19599. The object interface, the description of the various strategies for
  19600. reading frame locals, and the example are largely similar to those
  19601. described in the 'frame_args' function, (*note The frame filter
  19602. frame_args function: frame_args.). Below is a modified example:
  19603. class SomeFrameDecorator()
  19604. ...
  19605. ...
  19606. def frame_locals(self):
  19607. vars = []
  19608. try:
  19609. block = self.inferior_frame.block()
  19610. except:
  19611. return None
  19612. # Iterate over all symbols in a block. Add all
  19613. # symbols, except arguments.
  19614. for sym in block:
  19615. if sym.is_argument:
  19616. continue
  19617. vars.append(SymValueWrapper(sym,None))
  19618. # Add an example of a synthetic local variable.
  19619. vars.append(SymValueWrapper(``bar'', 99))
  19620. return vars
  19621. -- Function: FrameDecorator.inferior_frame (self):
  19622. This method must return the underlying 'gdb.Frame' that this frame
  19623. decorator is decorating. GDB requires the underlying frame for
  19624. internal frame information to determine how to print certain values
  19625. when printing a frame.
  19626. 
  19627. File: gdb.info, Node: Writing a Frame Filter, Next: Unwinding Frames in Python, Prev: Frame Decorator API, Up: Python API
  19628. 23.2.2.11 Writing a Frame Filter
  19629. ................................
  19630. There are three basic elements that a frame filter must implement: it
  19631. must correctly implement the documented interface (*note Frame Filter
  19632. API::), it must register itself with GDB, and finally, it must decide if
  19633. it is to work on the data provided by GDB. In all cases, whether it
  19634. works on the iterator or not, each frame filter must return an iterator.
  19635. A bare-bones frame filter follows the pattern in the following example.
  19636. import gdb
  19637. class FrameFilter():
  19638. def __init__(self):
  19639. # Frame filter attribute creation.
  19640. #
  19641. # 'name' is the name of the filter that GDB will display.
  19642. #
  19643. # 'priority' is the priority of the filter relative to other
  19644. # filters.
  19645. #
  19646. # 'enabled' is a boolean that indicates whether this filter is
  19647. # enabled and should be executed.
  19648. self.name = "Foo"
  19649. self.priority = 100
  19650. self.enabled = True
  19651. # Register this frame filter with the global frame_filters
  19652. # dictionary.
  19653. gdb.frame_filters[self.name] = self
  19654. def filter(self, frame_iter):
  19655. # Just return the iterator.
  19656. return frame_iter
  19657. The frame filter in the example above implements the three
  19658. requirements for all frame filters. It implements the API, self
  19659. registers, and makes a decision on the iterator (in this case, it just
  19660. returns the iterator untouched).
  19661. The first step is attribute creation and assignment, and as shown in
  19662. the comments the filter assigns the following attributes: 'name',
  19663. 'priority' and whether the filter should be enabled with the 'enabled'
  19664. attribute.
  19665. The second step is registering the frame filter with the dictionary
  19666. or dictionaries that the frame filter has interest in. As shown in the
  19667. comments, this filter just registers itself with the global dictionary
  19668. 'gdb.frame_filters'. As noted earlier, 'gdb.frame_filters' is a
  19669. dictionary that is initialized in the 'gdb' module when GDB starts.
  19670. What dictionary a filter registers with is an important consideration.
  19671. Generally, if a filter is specific to a set of code, it should be
  19672. registered either in the 'objfile' or 'progspace' dictionaries as they
  19673. are specific to the program currently loaded in GDB. The global
  19674. dictionary is always present in GDB and is never unloaded. Any filters
  19675. registered with the global dictionary will exist until GDB exits. To
  19676. avoid filters that may conflict, it is generally better to register
  19677. frame filters against the dictionaries that more closely align with the
  19678. usage of the filter currently in question. *Note Python Auto-loading::,
  19679. for further information on auto-loading Python scripts.
  19680. GDB takes a hands-off approach to frame filter registration,
  19681. therefore it is the frame filter's responsibility to ensure registration
  19682. has occurred, and that any exceptions are handled appropriately. In
  19683. particular, you may wish to handle exceptions relating to Python
  19684. dictionary key uniqueness. It is mandatory that the dictionary key is
  19685. the same as frame filter's 'name' attribute. When a user manages frame
  19686. filters (*note Frame Filter Management::), the names GDB will display
  19687. are those contained in the 'name' attribute.
  19688. The final step of this example is the implementation of the 'filter'
  19689. method. As shown in the example comments, we define the 'filter' method
  19690. and note that the method must take an iterator, and also must return an
  19691. iterator. In this bare-bones example, the frame filter is not very
  19692. useful as it just returns the iterator untouched. However this is a
  19693. valid operation for frame filters that have the 'enabled' attribute set,
  19694. but decide not to operate on any frames.
  19695. In the next example, the frame filter operates on all frames and
  19696. utilizes a frame decorator to perform some work on the frames. *Note
  19697. Frame Decorator API::, for further information on the frame decorator
  19698. interface.
  19699. This example works on inlined frames. It highlights frames which are
  19700. inlined by tagging them with an "[inlined]" tag. By applying a frame
  19701. decorator to all frames with the Python 'itertools imap' method, the
  19702. example defers actions to the frame decorator. Frame decorators are
  19703. only processed when GDB prints the backtrace.
  19704. This introduces a new decision making topic: whether to perform
  19705. decision making operations at the filtering step, or at the printing
  19706. step. In this example's approach, it does not perform any filtering
  19707. decisions at the filtering step beyond mapping a frame decorator to each
  19708. frame. This allows the actual decision making to be performed when each
  19709. frame is printed. This is an important consideration, and well worth
  19710. reflecting upon when designing a frame filter. An issue that frame
  19711. filters should avoid is unwinding the stack if possible. Some stacks
  19712. can run very deep, into the tens of thousands in some cases. To search
  19713. every frame to determine if it is inlined ahead of time may be too
  19714. expensive at the filtering step. The frame filter cannot know how many
  19715. frames it has to iterate over, and it would have to iterate through them
  19716. all. This ends up duplicating effort as GDB performs this iteration
  19717. when it prints the frames.
  19718. In this example decision making can be deferred to the printing step.
  19719. As each frame is printed, the frame decorator can examine each frame in
  19720. turn when GDB iterates. From a performance viewpoint, this is the most
  19721. appropriate decision to make as it avoids duplicating the effort that
  19722. the printing step would undertake anyway. Also, if there are many frame
  19723. filters unwinding the stack during filtering, it can substantially delay
  19724. the printing of the backtrace which will result in large memory usage,
  19725. and a poor user experience.
  19726. class InlineFilter():
  19727. def __init__(self):
  19728. self.name = "InlinedFrameFilter"
  19729. self.priority = 100
  19730. self.enabled = True
  19731. gdb.frame_filters[self.name] = self
  19732. def filter(self, frame_iter):
  19733. frame_iter = itertools.imap(InlinedFrameDecorator,
  19734. frame_iter)
  19735. return frame_iter
  19736. This frame filter is somewhat similar to the earlier example, except
  19737. that the 'filter' method applies a frame decorator object called
  19738. 'InlinedFrameDecorator' to each element in the iterator. The 'imap'
  19739. Python method is light-weight. It does not proactively iterate over the
  19740. iterator, but rather creates a new iterator which wraps the existing
  19741. one.
  19742. Below is the frame decorator for this example.
  19743. class InlinedFrameDecorator(FrameDecorator):
  19744. def __init__(self, fobj):
  19745. super(InlinedFrameDecorator, self).__init__(fobj)
  19746. def function(self):
  19747. frame = fobj.inferior_frame()
  19748. name = str(frame.name())
  19749. if frame.type() == gdb.INLINE_FRAME:
  19750. name = name + " [inlined]"
  19751. return name
  19752. This frame decorator only defines and overrides the 'function'
  19753. method. It lets the supplied 'FrameDecorator', which is shipped with
  19754. GDB, perform the other work associated with printing this frame.
  19755. The combination of these two objects create this output from a
  19756. backtrace:
  19757. #0 0x004004e0 in bar () at inline.c:11
  19758. #1 0x00400566 in max [inlined] (b=6, a=12) at inline.c:21
  19759. #2 0x00400566 in main () at inline.c:31
  19760. So in the case of this example, a frame decorator is applied to all
  19761. frames, regardless of whether they may be inlined or not. As GDB
  19762. iterates over the iterator produced by the frame filters, GDB executes
  19763. each frame decorator which then makes a decision on what to print in the
  19764. 'function' callback. Using a strategy like this is a way to defer
  19765. decisions on the frame content to printing time.
  19766. Eliding Frames
  19767. --------------
  19768. It might be that the above example is not desirable for representing
  19769. inlined frames, and a hierarchical approach may be preferred. If we
  19770. want to hierarchically represent frames, the 'elided' frame decorator
  19771. interface might be preferable.
  19772. This example approaches the issue with the 'elided' method. This
  19773. example is quite long, but very simplistic. It is out-of-scope for this
  19774. section to write a complete example that comprehensively covers all
  19775. approaches of finding and printing inlined frames. However, this
  19776. example illustrates the approach an author might use.
  19777. This example comprises of three sections.
  19778. class InlineFrameFilter():
  19779. def __init__(self):
  19780. self.name = "InlinedFrameFilter"
  19781. self.priority = 100
  19782. self.enabled = True
  19783. gdb.frame_filters[self.name] = self
  19784. def filter(self, frame_iter):
  19785. return ElidingInlineIterator(frame_iter)
  19786. This frame filter is very similar to the other examples. The only
  19787. difference is this frame filter is wrapping the iterator provided to it
  19788. ('frame_iter') with a custom iterator called 'ElidingInlineIterator'.
  19789. This again defers actions to when GDB prints the backtrace, as the
  19790. iterator is not traversed until printing.
  19791. The iterator for this example is as follows. It is in this section
  19792. of the example where decisions are made on the content of the backtrace.
  19793. class ElidingInlineIterator:
  19794. def __init__(self, ii):
  19795. self.input_iterator = ii
  19796. def __iter__(self):
  19797. return self
  19798. def next(self):
  19799. frame = next(self.input_iterator)
  19800. if frame.inferior_frame().type() != gdb.INLINE_FRAME:
  19801. return frame
  19802. try:
  19803. eliding_frame = next(self.input_iterator)
  19804. except StopIteration:
  19805. return frame
  19806. return ElidingFrameDecorator(eliding_frame, [frame])
  19807. This iterator implements the Python iterator protocol. When the
  19808. 'next' function is called (when GDB prints each frame), the iterator
  19809. checks if this frame decorator, 'frame', is wrapping an inlined frame.
  19810. If it is not, it returns the existing frame decorator untouched. If it
  19811. is wrapping an inlined frame, it assumes that the inlined frame was
  19812. contained within the next oldest frame, 'eliding_frame', which it
  19813. fetches. It then creates and returns a frame decorator,
  19814. 'ElidingFrameDecorator', which contains both the elided frame, and the
  19815. eliding frame.
  19816. class ElidingInlineDecorator(FrameDecorator):
  19817. def __init__(self, frame, elided_frames):
  19818. super(ElidingInlineDecorator, self).__init__(frame)
  19819. self.frame = frame
  19820. self.elided_frames = elided_frames
  19821. def elided(self):
  19822. return iter(self.elided_frames)
  19823. This frame decorator overrides one function and returns the inlined
  19824. frame in the 'elided' method. As before it lets 'FrameDecorator' do the
  19825. rest of the work involved in printing this frame. This produces the
  19826. following output.
  19827. #0 0x004004e0 in bar () at inline.c:11
  19828. #2 0x00400529 in main () at inline.c:25
  19829. #1 0x00400529 in max (b=6, a=12) at inline.c:15
  19830. In that output, 'max' which has been inlined into 'main' is printed
  19831. hierarchically. Another approach would be to combine the 'function'
  19832. method, and the 'elided' method to both print a marker in the inlined
  19833. frame, and also show the hierarchical relationship.
  19834. 
  19835. File: gdb.info, Node: Unwinding Frames in Python, Next: Xmethods In Python, Prev: Writing a Frame Filter, Up: Python API
  19836. 23.2.2.12 Unwinding Frames in Python
  19837. ....................................
  19838. In GDB terminology "unwinding" is the process of finding the previous
  19839. frame (that is, caller's) from the current one. An unwinder has three
  19840. methods. The first one checks if it can handle given frame ("sniff"
  19841. it). For the frames it can sniff an unwinder provides two additional
  19842. methods: it can return frame's ID, and it can fetch registers from the
  19843. previous frame. A running GDB mantains a list of the unwinders and
  19844. calls each unwinder's sniffer in turn until it finds the one that
  19845. recognizes the current frame. There is an API to register an unwinder.
  19846. The unwinders that come with GDB handle standard frames. However,
  19847. mixed language applications (for example, an application running Java
  19848. Virtual Machine) sometimes use frame layouts that cannot be handled by
  19849. the GDB unwinders. You can write Python code that can handle such
  19850. custom frames.
  19851. You implement a frame unwinder in Python as a class with which has
  19852. two attributes, 'name' and 'enabled', with obvious meanings, and a
  19853. single method '__call__', which examines a given frame and returns an
  19854. object (an instance of 'gdb.UnwindInfo class)' describing it. If an
  19855. unwinder does not recognize a frame, it should return 'None'. The code
  19856. in GDB that enables writing unwinders in Python uses this object to
  19857. return frame's ID and previous frame registers when GDB core asks for
  19858. them.
  19859. An unwinder should do as little work as possible. Some otherwise
  19860. innocuous operations can cause problems (even crashes, as this code is
  19861. not not well-hardened yet). For example, making an inferior call from
  19862. an unwinder is unadvisable, as an inferior call will reset GDB's stack
  19863. unwinding process, potentially causing re-entrant unwinding.
  19864. Unwinder Input
  19865. --------------
  19866. An object passed to an unwinder (a 'gdb.PendingFrame' instance) provides
  19867. a method to read frame's registers:
  19868. -- Function: PendingFrame.read_register (reg)
  19869. This method returns the contents of the register REG in the frame
  19870. as a 'gdb.Value' object. REG can be either a register number or a
  19871. register name; the values are platform-specific. They are usually
  19872. found in the corresponding 'PLATFORM-tdep.h' file in the GDB source
  19873. tree. If REG does not name a register for the current
  19874. architecture, this method will throw an exception.
  19875. Note that this method will always return a 'gdb.Value' for a valid
  19876. register name. This does not mean that the value will be valid.
  19877. For example, you may request a register that an earlier unwinder
  19878. could not unwind--the value will be unavailable. Instead, the
  19879. 'gdb.Value' returned from this method will be lazy; that is, its
  19880. underlying bits will not be fetched until it is first used. So,
  19881. attempting to use such a value will cause an exception at the point
  19882. of use.
  19883. The type of the returned 'gdb.Value' depends on the register and
  19884. the architecture. It is common for registers to have a scalar
  19885. type, like 'long long'; but many other types are possible, such as
  19886. pointer, pointer-to-function, floating point or vector types.
  19887. It also provides a factory method to create a 'gdb.UnwindInfo'
  19888. instance to be returned to GDB:
  19889. -- Function: PendingFrame.create_unwind_info (frame_id)
  19890. Returns a new 'gdb.UnwindInfo' instance identified by given
  19891. FRAME_ID. The argument is used to build GDB's frame ID using one
  19892. of functions provided by GDB. FRAME_ID's attributes determine
  19893. which function will be used, as follows:
  19894. 'sp, pc'
  19895. The frame is identified by the given stack address and PC. The
  19896. stack address must be chosen so that it is constant throughout
  19897. the lifetime of the frame, so a typical choice is the value of
  19898. the stack pointer at the start of the function--in the DWARF
  19899. standard, this would be the "Call Frame Address".
  19900. This is the most common case by far. The other cases are
  19901. documented for completeness but are only useful in specialized
  19902. situations.
  19903. 'sp, pc, special'
  19904. The frame is identified by the stack address, the PC, and a
  19905. "special" address. The special address is used on
  19906. architectures that can have frames that do not change the
  19907. stack, but which are still distinct, for example the IA-64,
  19908. which has a second stack for registers. Both SP and SPECIAL
  19909. must be constant throughout the lifetime of the frame.
  19910. 'sp'
  19911. The frame is identified by the stack address only. Any other
  19912. stack frame with a matching SP will be considered to match
  19913. this frame. Inside gdb, this is called a "wild frame". You
  19914. will never need this.
  19915. Each attribute value should be an instance of 'gdb.Value'.
  19916. Unwinder Output: UnwindInfo
  19917. ---------------------------
  19918. Use 'PendingFrame.create_unwind_info' method described above to create a
  19919. 'gdb.UnwindInfo' instance. Use the following method to specify caller
  19920. registers that have been saved in this frame:
  19921. -- Function: gdb.UnwindInfo.add_saved_register (reg, value)
  19922. REG identifies the register. It can be a number or a name, just as
  19923. for the 'PendingFrame.read_register' method above. VALUE is a
  19924. register value (a 'gdb.Value' object).
  19925. Unwinder Skeleton Code
  19926. ----------------------
  19927. GDB comes with the module containing the base 'Unwinder' class. Derive
  19928. your unwinder class from it and structure the code as follows:
  19929. from gdb.unwinders import Unwinder
  19930. class FrameId(object):
  19931. def __init__(self, sp, pc):
  19932. self.sp = sp
  19933. self.pc = pc
  19934. class MyUnwinder(Unwinder):
  19935. def __init__(....):
  19936. super(MyUnwinder, self).__init___(<expects unwinder name argument>)
  19937. def __call__(pending_frame):
  19938. if not <we recognize frame>:
  19939. return None
  19940. # Create UnwindInfo. Usually the frame is identified by the stack
  19941. # pointer and the program counter.
  19942. sp = pending_frame.read_register(<SP number>)
  19943. pc = pending_frame.read_register(<PC number>)
  19944. unwind_info = pending_frame.create_unwind_info(FrameId(sp, pc))
  19945. # Find the values of the registers in the caller's frame and
  19946. # save them in the result:
  19947. unwind_info.add_saved_register(<register>, <value>)
  19948. ....
  19949. # Return the result:
  19950. return unwind_info
  19951. Registering a Unwinder
  19952. ----------------------
  19953. An object file, a program space, and the GDB proper can have unwinders
  19954. registered with it.
  19955. The 'gdb.unwinders' module provides the function to register a
  19956. unwinder:
  19957. -- Function: gdb.unwinder.register_unwinder (locus, unwinder,
  19958. replace=False)
  19959. LOCUS is specifies an object file or a program space to which
  19960. UNWINDER is added. Passing 'None' or 'gdb' adds UNWINDER to the
  19961. GDB's global unwinder list. The newly added UNWINDER will be
  19962. called before any other unwinder from the same locus. Two
  19963. unwinders in the same locus cannot have the same name. An attempt
  19964. to add a unwinder with already existing name raises an exception
  19965. unless REPLACE is 'True', in which case the old unwinder is
  19966. deleted.
  19967. Unwinder Precedence
  19968. -------------------
  19969. GDB first calls the unwinders from all the object files in no particular
  19970. order, then the unwinders from the current program space, and finally
  19971. the unwinders from GDB.
  19972. 
  19973. File: gdb.info, Node: Xmethods In Python, Next: Xmethod API, Prev: Unwinding Frames in Python, Up: Python API
  19974. 23.2.2.13 Xmethods In Python
  19975. ............................
  19976. "Xmethods" are additional methods or replacements for existing methods
  19977. of a C++ class. This feature is useful for those cases where a method
  19978. defined in C++ source code could be inlined or optimized out by the
  19979. compiler, making it unavailable to GDB. For such cases, one can define
  19980. an xmethod to serve as a replacement for the method defined in the C++
  19981. source code. GDB will then invoke the xmethod, instead of the C++
  19982. method, to evaluate expressions. One can also use xmethods when
  19983. debugging with core files. Moreover, when debugging live programs,
  19984. invoking an xmethod need not involve running the inferior (which can
  19985. potentially perturb its state). Hence, even if the C++ method is
  19986. available, it is better to use its replacement xmethod if one is
  19987. defined.
  19988. The xmethods feature in Python is available via the concepts of an
  19989. "xmethod matcher" and an "xmethod worker". To implement an xmethod, one
  19990. has to implement a matcher and a corresponding worker for it (more than
  19991. one worker can be implemented, each catering to a different overloaded
  19992. instance of the method). Internally, GDB invokes the 'match' method of
  19993. a matcher to match the class type and method name. On a match, the
  19994. 'match' method returns a list of matching _worker_ objects. Each worker
  19995. object typically corresponds to an overloaded instance of the xmethod.
  19996. They implement a 'get_arg_types' method which returns a sequence of
  19997. types corresponding to the arguments the xmethod requires. GDB uses
  19998. this sequence of types to perform overload resolution and picks a
  19999. winning xmethod worker. A winner is also selected from among the
  20000. methods GDB finds in the C++ source code. Next, the winning xmethod
  20001. worker and the winning C++ method are compared to select an overall
  20002. winner. In case of a tie between a xmethod worker and a C++ method, the
  20003. xmethod worker is selected as the winner. That is, if a winning xmethod
  20004. worker is found to be equivalent to the winning C++ method, then the
  20005. xmethod worker is treated as a replacement for the C++ method. GDB uses
  20006. the overall winner to invoke the method. If the winning xmethod worker
  20007. is the overall winner, then the corresponding xmethod is invoked via the
  20008. '__call__' method of the worker object.
  20009. If one wants to implement an xmethod as a replacement for an existing
  20010. C++ method, then they have to implement an equivalent xmethod which has
  20011. exactly the same name and takes arguments of exactly the same type as
  20012. the C++ method. If the user wants to invoke the C++ method even though
  20013. a replacement xmethod is available for that method, then they can
  20014. disable the xmethod.
  20015. *Note Xmethod API::, for API to implement xmethods in Python. *Note
  20016. Writing an Xmethod::, for implementing xmethods in Python.
  20017. 
  20018. File: gdb.info, Node: Xmethod API, Next: Writing an Xmethod, Prev: Xmethods In Python, Up: Python API
  20019. 23.2.2.14 Xmethod API
  20020. .....................
  20021. The GDB Python API provides classes, interfaces and functions to
  20022. implement, register and manipulate xmethods. *Note Xmethods In
  20023. Python::.
  20024. An xmethod matcher should be an instance of a class derived from
  20025. 'XMethodMatcher' defined in the module 'gdb.xmethod', or an object with
  20026. similar interface and attributes. An instance of 'XMethodMatcher' has
  20027. the following attributes:
  20028. -- Variable: name
  20029. The name of the matcher.
  20030. -- Variable: enabled
  20031. A boolean value indicating whether the matcher is enabled or
  20032. disabled.
  20033. -- Variable: methods
  20034. A list of named methods managed by the matcher. Each object in the
  20035. list is an instance of the class 'XMethod' defined in the module
  20036. 'gdb.xmethod', or any object with the following attributes:
  20037. 'name'
  20038. Name of the xmethod which should be unique for each xmethod
  20039. managed by the matcher.
  20040. 'enabled'
  20041. A boolean value indicating whether the xmethod is enabled or
  20042. disabled.
  20043. The class 'XMethod' is a convenience class with same attributes as
  20044. above along with the following constructor:
  20045. -- Function: XMethod.__init__ (self, name)
  20046. Constructs an enabled xmethod with name NAME.
  20047. The 'XMethodMatcher' class has the following methods:
  20048. -- Function: XMethodMatcher.__init__ (self, name)
  20049. Constructs an enabled xmethod matcher with name NAME. The
  20050. 'methods' attribute is initialized to 'None'.
  20051. -- Function: XMethodMatcher.match (self, class_type, method_name)
  20052. Derived classes should override this method. It should return a
  20053. xmethod worker object (or a sequence of xmethod worker objects)
  20054. matching the CLASS_TYPE and METHOD_NAME. CLASS_TYPE is a
  20055. 'gdb.Type' object, and METHOD_NAME is a string value. If the
  20056. matcher manages named methods as listed in its 'methods' attribute,
  20057. then only those worker objects whose corresponding entries in the
  20058. 'methods' list are enabled should be returned.
  20059. An xmethod worker should be an instance of a class derived from
  20060. 'XMethodWorker' defined in the module 'gdb.xmethod', or support the
  20061. following interface:
  20062. -- Function: XMethodWorker.get_arg_types (self)
  20063. This method returns a sequence of 'gdb.Type' objects corresponding
  20064. to the arguments that the xmethod takes. It can return an empty
  20065. sequence or 'None' if the xmethod does not take any arguments. If
  20066. the xmethod takes a single argument, then a single 'gdb.Type'
  20067. object corresponding to it can be returned.
  20068. -- Function: XMethodWorker.get_result_type (self, *args)
  20069. This method returns a 'gdb.Type' object representing the type of
  20070. the result of invoking this xmethod. The ARGS argument is the same
  20071. tuple of arguments that would be passed to the '__call__' method of
  20072. this worker.
  20073. -- Function: XMethodWorker.__call__ (self, *args)
  20074. This is the method which does the _work_ of the xmethod. The ARGS
  20075. arguments is the tuple of arguments to the xmethod. Each element
  20076. in this tuple is a gdb.Value object. The first element is always
  20077. the 'this' pointer value.
  20078. For GDB to lookup xmethods, the xmethod matchers should be registered
  20079. using the following function defined in the module 'gdb.xmethod':
  20080. -- Function: register_xmethod_matcher (locus, matcher, replace=False)
  20081. The 'matcher' is registered with 'locus', replacing an existing
  20082. matcher with the same name as 'matcher' if 'replace' is 'True'.
  20083. 'locus' can be a 'gdb.Objfile' object (*note Objfiles In Python::),
  20084. or a 'gdb.Progspace' object (*note Progspaces In Python::), or
  20085. 'None'. If it is 'None', then 'matcher' is registered globally.
  20086. 
  20087. File: gdb.info, Node: Writing an Xmethod, Next: Inferiors In Python, Prev: Xmethod API, Up: Python API
  20088. 23.2.2.15 Writing an Xmethod
  20089. ............................
  20090. Implementing xmethods in Python will require implementing xmethod
  20091. matchers and xmethod workers (*note Xmethods In Python::). Consider the
  20092. following C++ class:
  20093. class MyClass
  20094. {
  20095. public:
  20096. MyClass (int a) : a_(a) { }
  20097. int geta (void) { return a_; }
  20098. int operator+ (int b);
  20099. private:
  20100. int a_;
  20101. };
  20102. int
  20103. MyClass::operator+ (int b)
  20104. {
  20105. return a_ + b;
  20106. }
  20107. Let us define two xmethods for the class 'MyClass', one replacing the
  20108. method 'geta', and another adding an overloaded flavor of 'operator+'
  20109. which takes a 'MyClass' argument (the C++ code above already has an
  20110. overloaded 'operator+' which takes an 'int' argument). The xmethod
  20111. matcher can be defined as follows:
  20112. class MyClass_geta(gdb.xmethod.XMethod):
  20113. def __init__(self):
  20114. gdb.xmethod.XMethod.__init__(self, 'geta')
  20115. def get_worker(self, method_name):
  20116. if method_name == 'geta':
  20117. return MyClassWorker_geta()
  20118. class MyClass_sum(gdb.xmethod.XMethod):
  20119. def __init__(self):
  20120. gdb.xmethod.XMethod.__init__(self, 'sum')
  20121. def get_worker(self, method_name):
  20122. if method_name == 'operator+':
  20123. return MyClassWorker_plus()
  20124. class MyClassMatcher(gdb.xmethod.XMethodMatcher):
  20125. def __init__(self):
  20126. gdb.xmethod.XMethodMatcher.__init__(self, 'MyClassMatcher')
  20127. # List of methods 'managed' by this matcher
  20128. self.methods = [MyClass_geta(), MyClass_sum()]
  20129. def match(self, class_type, method_name):
  20130. if class_type.tag != 'MyClass':
  20131. return None
  20132. workers = []
  20133. for method in self.methods:
  20134. if method.enabled:
  20135. worker = method.get_worker(method_name)
  20136. if worker:
  20137. workers.append(worker)
  20138. return workers
  20139. Notice that the 'match' method of 'MyClassMatcher' returns a worker
  20140. object of type 'MyClassWorker_geta' for the 'geta' method, and a worker
  20141. object of type 'MyClassWorker_plus' for the 'operator+' method. This is
  20142. done indirectly via helper classes derived from 'gdb.xmethod.XMethod'.
  20143. One does not need to use the 'methods' attribute in a matcher as it is
  20144. optional. However, if a matcher manages more than one xmethod, it is a
  20145. good practice to list the xmethods in the 'methods' attribute of the
  20146. matcher. This will then facilitate enabling and disabling individual
  20147. xmethods via the 'enable/disable' commands. Notice also that a worker
  20148. object is returned only if the corresponding entry in the 'methods'
  20149. attribute of the matcher is enabled.
  20150. The implementation of the worker classes returned by the matcher
  20151. setup above is as follows:
  20152. class MyClassWorker_geta(gdb.xmethod.XMethodWorker):
  20153. def get_arg_types(self):
  20154. return None
  20155. def get_result_type(self, obj):
  20156. return gdb.lookup_type('int')
  20157. def __call__(self, obj):
  20158. return obj['a_']
  20159. class MyClassWorker_plus(gdb.xmethod.XMethodWorker):
  20160. def get_arg_types(self):
  20161. return gdb.lookup_type('MyClass')
  20162. def get_result_type(self, obj):
  20163. return gdb.lookup_type('int')
  20164. def __call__(self, obj, other):
  20165. return obj['a_'] + other['a_']
  20166. For GDB to actually lookup a xmethod, it has to be registered with
  20167. it. The matcher defined above is registered with GDB globally as
  20168. follows:
  20169. gdb.xmethod.register_xmethod_matcher(None, MyClassMatcher())
  20170. If an object 'obj' of type 'MyClass' is initialized in C++ code as
  20171. follows:
  20172. MyClass obj(5);
  20173. then, after loading the Python script defining the xmethod matchers and
  20174. workers into 'GDBN', invoking the method 'geta' or using the operator
  20175. '+' on 'obj' will invoke the xmethods defined above:
  20176. (gdb) p obj.geta()
  20177. $1 = 5
  20178. (gdb) p obj + obj
  20179. $2 = 10
  20180. Consider another example with a C++ template class:
  20181. template <class T>
  20182. class MyTemplate
  20183. {
  20184. public:
  20185. MyTemplate () : dsize_(10), data_ (new T [10]) { }
  20186. ~MyTemplate () { delete [] data_; }
  20187. int footprint (void)
  20188. {
  20189. return sizeof (T) * dsize_ + sizeof (MyTemplate<T>);
  20190. }
  20191. private:
  20192. int dsize_;
  20193. T *data_;
  20194. };
  20195. Let us implement an xmethod for the above class which serves as a
  20196. replacement for the 'footprint' method. The full code listing of the
  20197. xmethod workers and xmethod matchers is as follows:
  20198. class MyTemplateWorker_footprint(gdb.xmethod.XMethodWorker):
  20199. def __init__(self, class_type):
  20200. self.class_type = class_type
  20201. def get_arg_types(self):
  20202. return None
  20203. def get_result_type(self):
  20204. return gdb.lookup_type('int')
  20205. def __call__(self, obj):
  20206. return (self.class_type.sizeof +
  20207. obj['dsize_'] *
  20208. self.class_type.template_argument(0).sizeof)
  20209. class MyTemplateMatcher_footprint(gdb.xmethod.XMethodMatcher):
  20210. def __init__(self):
  20211. gdb.xmethod.XMethodMatcher.__init__(self, 'MyTemplateMatcher')
  20212. def match(self, class_type, method_name):
  20213. if (re.match('MyTemplate<[ \t\n]*[_a-zA-Z][ _a-zA-Z0-9]*>',
  20214. class_type.tag) and
  20215. method_name == 'footprint'):
  20216. return MyTemplateWorker_footprint(class_type)
  20217. Notice that, in this example, we have not used the 'methods'
  20218. attribute of the matcher as the matcher manages only one xmethod. The
  20219. user can enable/disable this xmethod by enabling/disabling the matcher
  20220. itself.
  20221. 
  20222. File: gdb.info, Node: Inferiors In Python, Next: Events In Python, Prev: Writing an Xmethod, Up: Python API
  20223. 23.2.2.16 Inferiors In Python
  20224. .............................
  20225. Programs which are being run under GDB are called inferiors (*note
  20226. Inferiors and Programs::). Python scripts can access information about
  20227. and manipulate inferiors controlled by GDB via objects of the
  20228. 'gdb.Inferior' class.
  20229. The following inferior-related functions are available in the 'gdb'
  20230. module:
  20231. -- Function: gdb.inferiors ()
  20232. Return a tuple containing all inferior objects.
  20233. -- Function: gdb.selected_inferior ()
  20234. Return an object representing the current inferior.
  20235. A 'gdb.Inferior' object has the following attributes:
  20236. -- Variable: Inferior.num
  20237. ID of inferior, as assigned by GDB.
  20238. -- Variable: Inferior.pid
  20239. Process ID of the inferior, as assigned by the underlying operating
  20240. system.
  20241. -- Variable: Inferior.was_attached
  20242. Boolean signaling whether the inferior was created using 'attach',
  20243. or started by GDB itself.
  20244. -- Variable: Inferior.progspace
  20245. The inferior's program space. *Note Progspaces In Python::.
  20246. A 'gdb.Inferior' object has the following methods:
  20247. -- Function: Inferior.is_valid ()
  20248. Returns 'True' if the 'gdb.Inferior' object is valid, 'False' if
  20249. not. A 'gdb.Inferior' object will become invalid if the inferior
  20250. no longer exists within GDB. All other 'gdb.Inferior' methods will
  20251. throw an exception if it is invalid at the time the method is
  20252. called.
  20253. -- Function: Inferior.threads ()
  20254. This method returns a tuple holding all the threads which are valid
  20255. when it is called. If there are no valid threads, the method will
  20256. return an empty tuple.
  20257. -- Function: Inferior.architecture ()
  20258. Return the 'gdb.Architecture' (*note Architectures In Python::) for
  20259. this inferior. This represents the architecture of the inferior as
  20260. a whole. Some platforms can have multiple architectures in a
  20261. single address space, so this may not match the architecture of a
  20262. particular frame (*note Frames In Python::).
  20263. -- Function: Inferior.read_memory (address, length)
  20264. Read LENGTH addressable memory units from the inferior, starting at
  20265. ADDRESS. Returns a buffer object, which behaves much like an array
  20266. or a string. It can be modified and given to the
  20267. 'Inferior.write_memory' function. In Python 3, the return value is
  20268. a 'memoryview' object.
  20269. -- Function: Inferior.write_memory (address, buffer [, length])
  20270. Write the contents of BUFFER to the inferior, starting at ADDRESS.
  20271. The BUFFER parameter must be a Python object which supports the
  20272. buffer protocol, i.e., a string, an array or the object returned
  20273. from 'Inferior.read_memory'. If given, LENGTH determines the
  20274. number of addressable memory units from BUFFER to be written.
  20275. -- Function: Inferior.search_memory (address, length, pattern)
  20276. Search a region of the inferior memory starting at ADDRESS with the
  20277. given LENGTH using the search pattern supplied in PATTERN. The
  20278. PATTERN parameter must be a Python object which supports the buffer
  20279. protocol, i.e., a string, an array or the object returned from
  20280. 'gdb.read_memory'. Returns a Python 'Long' containing the address
  20281. where the pattern was found, or 'None' if the pattern could not be
  20282. found.
  20283. -- Function: Inferior.thread_from_handle (handle)
  20284. Return the thread object corresponding to HANDLE, a thread library
  20285. specific data structure such as 'pthread_t' for pthreads library
  20286. implementations.
  20287. The function 'Inferior.thread_from_thread_handle' provides the same
  20288. functionality, but use of 'Inferior.thread_from_thread_handle' is
  20289. deprecated.
  20290. 
  20291. File: gdb.info, Node: Events In Python, Next: Threads In Python, Prev: Inferiors In Python, Up: Python API
  20292. 23.2.2.17 Events In Python
  20293. ..........................
  20294. GDB provides a general event facility so that Python code can be
  20295. notified of various state changes, particularly changes that occur in
  20296. the inferior.
  20297. An "event" is just an object that describes some state change. The
  20298. type of the object and its attributes will vary depending on the details
  20299. of the change. All the existing events are described below.
  20300. In order to be notified of an event, you must register an event
  20301. handler with an "event registry". An event registry is an object in the
  20302. 'gdb.events' module which dispatches particular events. A registry
  20303. provides methods to register and unregister event handlers:
  20304. -- Function: EventRegistry.connect (object)
  20305. Add the given callable OBJECT to the registry. This object will be
  20306. called when an event corresponding to this registry occurs.
  20307. -- Function: EventRegistry.disconnect (object)
  20308. Remove the given OBJECT from the registry. Once removed, the
  20309. object will no longer receive notifications of events.
  20310. Here is an example:
  20311. def exit_handler (event):
  20312. print "event type: exit"
  20313. print "exit code: %d" % (event.exit_code)
  20314. gdb.events.exited.connect (exit_handler)
  20315. In the above example we connect our handler 'exit_handler' to the
  20316. registry 'events.exited'. Once connected, 'exit_handler' gets called
  20317. when the inferior exits. The argument "event" in this example is of
  20318. type 'gdb.ExitedEvent'. As you can see in the example the 'ExitedEvent'
  20319. object has an attribute which indicates the exit code of the inferior.
  20320. The following is a listing of the event registries that are available
  20321. and details of the events they emit:
  20322. 'events.cont'
  20323. Emits 'gdb.ThreadEvent'.
  20324. Some events can be thread specific when GDB is running in non-stop
  20325. mode. When represented in Python, these events all extend
  20326. 'gdb.ThreadEvent'. Note, this event is not emitted directly;
  20327. instead, events which are emitted by this or other modules might
  20328. extend this event. Examples of these events are
  20329. 'gdb.BreakpointEvent' and 'gdb.ContinueEvent'.
  20330. -- Variable: ThreadEvent.inferior_thread
  20331. In non-stop mode this attribute will be set to the specific
  20332. thread which was involved in the emitted event. Otherwise, it
  20333. will be set to 'None'.
  20334. Emits 'gdb.ContinueEvent' which extends 'gdb.ThreadEvent'.
  20335. This event indicates that the inferior has been continued after a
  20336. stop. For inherited attribute refer to 'gdb.ThreadEvent' above.
  20337. 'events.exited'
  20338. Emits 'events.ExitedEvent' which indicates that the inferior has
  20339. exited. 'events.ExitedEvent' has two attributes:
  20340. -- Variable: ExitedEvent.exit_code
  20341. An integer representing the exit code, if available, which the
  20342. inferior has returned. (The exit code could be unavailable
  20343. if, for example, GDB detaches from the inferior.) If the exit
  20344. code is unavailable, the attribute does not exist.
  20345. -- Variable: ExitedEvent.inferior
  20346. A reference to the inferior which triggered the 'exited'
  20347. event.
  20348. 'events.stop'
  20349. Emits 'gdb.StopEvent' which extends 'gdb.ThreadEvent'.
  20350. Indicates that the inferior has stopped. All events emitted by
  20351. this registry extend StopEvent. As a child of 'gdb.ThreadEvent',
  20352. 'gdb.StopEvent' will indicate the stopped thread when GDB is
  20353. running in non-stop mode. Refer to 'gdb.ThreadEvent' above for
  20354. more details.
  20355. Emits 'gdb.SignalEvent' which extends 'gdb.StopEvent'.
  20356. This event indicates that the inferior or one of its threads has
  20357. received as signal. 'gdb.SignalEvent' has the following
  20358. attributes:
  20359. -- Variable: SignalEvent.stop_signal
  20360. A string representing the signal received by the inferior. A
  20361. list of possible signal values can be obtained by running the
  20362. command 'info signals' in the GDB command prompt.
  20363. Also emits 'gdb.BreakpointEvent' which extends 'gdb.StopEvent'.
  20364. 'gdb.BreakpointEvent' event indicates that one or more breakpoints
  20365. have been hit, and has the following attributes:
  20366. -- Variable: BreakpointEvent.breakpoints
  20367. A sequence containing references to all the breakpoints (type
  20368. 'gdb.Breakpoint') that were hit. *Note Breakpoints In
  20369. Python::, for details of the 'gdb.Breakpoint' object.
  20370. -- Variable: BreakpointEvent.breakpoint
  20371. A reference to the first breakpoint that was hit. This
  20372. function is maintained for backward compatibility and is now
  20373. deprecated in favor of the 'gdb.BreakpointEvent.breakpoints'
  20374. attribute.
  20375. 'events.new_objfile'
  20376. Emits 'gdb.NewObjFileEvent' which indicates that a new object file
  20377. has been loaded by GDB. 'gdb.NewObjFileEvent' has one attribute:
  20378. -- Variable: NewObjFileEvent.new_objfile
  20379. A reference to the object file ('gdb.Objfile') which has been
  20380. loaded. *Note Objfiles In Python::, for details of the
  20381. 'gdb.Objfile' object.
  20382. 'events.clear_objfiles'
  20383. Emits 'gdb.ClearObjFilesEvent' which indicates that the list of
  20384. object files for a program space has been reset.
  20385. 'gdb.ClearObjFilesEvent' has one attribute:
  20386. -- Variable: ClearObjFilesEvent.progspace
  20387. A reference to the program space ('gdb.Progspace') whose
  20388. objfile list has been cleared. *Note Progspaces In Python::.
  20389. 'events.inferior_call'
  20390. Emits events just before and after a function in the inferior is
  20391. called by GDB. Before an inferior call, this emits an event of
  20392. type 'gdb.InferiorCallPreEvent', and after an inferior call, this
  20393. emits an event of type 'gdb.InferiorCallPostEvent'.
  20394. 'gdb.InferiorCallPreEvent'
  20395. Indicates that a function in the inferior is about to be
  20396. called.
  20397. -- Variable: InferiorCallPreEvent.ptid
  20398. The thread in which the call will be run.
  20399. -- Variable: InferiorCallPreEvent.address
  20400. The location of the function to be called.
  20401. 'gdb.InferiorCallPostEvent'
  20402. Indicates that a function in the inferior has just been
  20403. called.
  20404. -- Variable: InferiorCallPostEvent.ptid
  20405. The thread in which the call was run.
  20406. -- Variable: InferiorCallPostEvent.address
  20407. The location of the function that was called.
  20408. 'events.memory_changed'
  20409. Emits 'gdb.MemoryChangedEvent' which indicates that the memory of
  20410. the inferior has been modified by the GDB user, for instance via a
  20411. command like 'set *addr = value'. The event has the following
  20412. attributes:
  20413. -- Variable: MemoryChangedEvent.address
  20414. The start address of the changed region.
  20415. -- Variable: MemoryChangedEvent.length
  20416. Length in bytes of the changed region.
  20417. 'events.register_changed'
  20418. Emits 'gdb.RegisterChangedEvent' which indicates that a register in
  20419. the inferior has been modified by the GDB user.
  20420. -- Variable: RegisterChangedEvent.frame
  20421. A gdb.Frame object representing the frame in which the
  20422. register was modified.
  20423. -- Variable: RegisterChangedEvent.regnum
  20424. Denotes which register was modified.
  20425. 'events.breakpoint_created'
  20426. This is emitted when a new breakpoint has been created. The
  20427. argument that is passed is the new 'gdb.Breakpoint' object.
  20428. 'events.breakpoint_modified'
  20429. This is emitted when a breakpoint has been modified in some way.
  20430. The argument that is passed is the new 'gdb.Breakpoint' object.
  20431. 'events.breakpoint_deleted'
  20432. This is emitted when a breakpoint has been deleted. The argument
  20433. that is passed is the 'gdb.Breakpoint' object. When this event is
  20434. emitted, the 'gdb.Breakpoint' object will already be in its invalid
  20435. state; that is, the 'is_valid' method will return 'False'.
  20436. 'events.before_prompt'
  20437. This event carries no payload. It is emitted each time GDB
  20438. presents a prompt to the user.
  20439. 'events.new_inferior'
  20440. This is emitted when a new inferior is created. Note that the
  20441. inferior is not necessarily running; in fact, it may not even have
  20442. an associated executable.
  20443. The event is of type 'gdb.NewInferiorEvent'. This has a single
  20444. attribute:
  20445. -- Variable: NewInferiorEvent.inferior
  20446. The new inferior, a 'gdb.Inferior' object.
  20447. 'events.inferior_deleted'
  20448. This is emitted when an inferior has been deleted. Note that this
  20449. is not the same as process exit; it is notified when the inferior
  20450. itself is removed, say via 'remove-inferiors'.
  20451. The event is of type 'gdb.InferiorDeletedEvent'. This has a single
  20452. attribute:
  20453. -- Variable: NewInferiorEvent.inferior
  20454. The inferior that is being removed, a 'gdb.Inferior' object.
  20455. 'events.new_thread'
  20456. This is emitted when GDB notices a new thread. The event is of
  20457. type 'gdb.NewThreadEvent', which extends 'gdb.ThreadEvent'. This
  20458. has a single attribute:
  20459. -- Variable: NewThreadEvent.inferior_thread
  20460. The new thread.
  20461. 
  20462. File: gdb.info, Node: Threads In Python, Next: Recordings In Python, Prev: Events In Python, Up: Python API
  20463. 23.2.2.18 Threads In Python
  20464. ...........................
  20465. Python scripts can access information about, and manipulate inferior
  20466. threads controlled by GDB, via objects of the 'gdb.InferiorThread'
  20467. class.
  20468. The following thread-related functions are available in the 'gdb'
  20469. module:
  20470. -- Function: gdb.selected_thread ()
  20471. This function returns the thread object for the selected thread.
  20472. If there is no selected thread, this will return 'None'.
  20473. To get the list of threads for an inferior, use the
  20474. 'Inferior.threads()' method. *Note Inferiors In Python::
  20475. A 'gdb.InferiorThread' object has the following attributes:
  20476. -- Variable: InferiorThread.name
  20477. The name of the thread. If the user specified a name using 'thread
  20478. name', then this returns that name. Otherwise, if an OS-supplied
  20479. name is available, then it is returned. Otherwise, this returns
  20480. 'None'.
  20481. This attribute can be assigned to. The new value must be a string
  20482. object, which sets the new name, or 'None', which removes any
  20483. user-specified thread name.
  20484. -- Variable: InferiorThread.num
  20485. The per-inferior number of the thread, as assigned by GDB.
  20486. -- Variable: InferiorThread.global_num
  20487. The global ID of the thread, as assigned by GDB. You can use this
  20488. to make Python breakpoints thread-specific, for example (*note The
  20489. Breakpoint.thread attribute: python_breakpoint_thread.).
  20490. -- Variable: InferiorThread.ptid
  20491. ID of the thread, as assigned by the operating system. This
  20492. attribute is a tuple containing three integers. The first is the
  20493. Process ID (PID); the second is the Lightweight Process ID (LWPID),
  20494. and the third is the Thread ID (TID). Either the LWPID or TID may
  20495. be 0, which indicates that the operating system does not use that
  20496. identifier.
  20497. -- Variable: InferiorThread.inferior
  20498. The inferior this thread belongs to. This attribute is represented
  20499. as a 'gdb.Inferior' object. This attribute is not writable.
  20500. A 'gdb.InferiorThread' object has the following methods:
  20501. -- Function: InferiorThread.is_valid ()
  20502. Returns 'True' if the 'gdb.InferiorThread' object is valid, 'False'
  20503. if not. A 'gdb.InferiorThread' object will become invalid if the
  20504. thread exits, or the inferior that the thread belongs is deleted.
  20505. All other 'gdb.InferiorThread' methods will throw an exception if
  20506. it is invalid at the time the method is called.
  20507. -- Function: InferiorThread.switch ()
  20508. This changes GDB's currently selected thread to the one represented
  20509. by this object.
  20510. -- Function: InferiorThread.is_stopped ()
  20511. Return a Boolean indicating whether the thread is stopped.
  20512. -- Function: InferiorThread.is_running ()
  20513. Return a Boolean indicating whether the thread is running.
  20514. -- Function: InferiorThread.is_exited ()
  20515. Return a Boolean indicating whether the thread is exited.
  20516. -- Function: InferiorThread.handle ()
  20517. Return the thread object's handle, represented as a Python 'bytes'
  20518. object. A 'gdb.Value' representation of the handle may be
  20519. constructed via 'gdb.Value(bufobj, type)' where BUFOBJ is the
  20520. Python 'bytes' representation of the handle and TYPE is a
  20521. 'gdb.Type' for the handle type.
  20522. 
  20523. File: gdb.info, Node: Recordings In Python, Next: Commands In Python, Prev: Threads In Python, Up: Python API
  20524. 23.2.2.19 Recordings In Python
  20525. ..............................
  20526. The following recordings-related functions (*note Process Record and
  20527. Replay::) are available in the 'gdb' module:
  20528. -- Function: gdb.start_recording ([method], [format])
  20529. Start a recording using the given METHOD and FORMAT. If no FORMAT
  20530. is given, the default format for the recording method is used. If
  20531. no METHOD is given, the default method will be used. Returns a
  20532. 'gdb.Record' object on success. Throw an exception on failure.
  20533. The following strings can be passed as METHOD:
  20534. * '"full"'
  20535. * '"btrace"': Possible values for FORMAT: '"pt"', '"bts"' or
  20536. leave out for default format.
  20537. -- Function: gdb.current_recording ()
  20538. Access a currently running recording. Return a 'gdb.Record' object
  20539. on success. Return 'None' if no recording is currently active.
  20540. -- Function: gdb.stop_recording ()
  20541. Stop the current recording. Throw an exception if no recording is
  20542. currently active. All record objects become invalid after this
  20543. call.
  20544. A 'gdb.Record' object has the following attributes:
  20545. -- Variable: Record.method
  20546. A string with the current recording method, e.g. 'full' or
  20547. 'btrace'.
  20548. -- Variable: Record.format
  20549. A string with the current recording format, e.g. 'bt', 'pts' or
  20550. 'None'.
  20551. -- Variable: Record.begin
  20552. A method specific instruction object representing the first
  20553. instruction in this recording.
  20554. -- Variable: Record.end
  20555. A method specific instruction object representing the current
  20556. instruction, that is not actually part of the recording.
  20557. -- Variable: Record.replay_position
  20558. The instruction representing the current replay position. If there
  20559. is no replay active, this will be 'None'.
  20560. -- Variable: Record.instruction_history
  20561. A list with all recorded instructions.
  20562. -- Variable: Record.function_call_history
  20563. A list with all recorded function call segments.
  20564. A 'gdb.Record' object has the following methods:
  20565. -- Function: Record.goto (instruction)
  20566. Move the replay position to the given INSTRUCTION.
  20567. The common 'gdb.Instruction' class that recording method specific
  20568. instruction objects inherit from, has the following attributes:
  20569. -- Variable: Instruction.pc
  20570. An integer representing this instruction's address.
  20571. -- Variable: Instruction.data
  20572. A buffer with the raw instruction data. In Python 3, the return
  20573. value is a 'memoryview' object.
  20574. -- Variable: Instruction.decoded
  20575. A human readable string with the disassembled instruction.
  20576. -- Variable: Instruction.size
  20577. The size of the instruction in bytes.
  20578. Additionally 'gdb.RecordInstruction' has the following attributes:
  20579. -- Variable: RecordInstruction.number
  20580. An integer identifying this instruction. 'number' corresponds to
  20581. the numbers seen in 'record instruction-history' (*note Process
  20582. Record and Replay::).
  20583. -- Variable: RecordInstruction.sal
  20584. A 'gdb.Symtab_and_line' object representing the associated symtab
  20585. and line of this instruction. May be 'None' if no debug
  20586. information is available.
  20587. -- Variable: RecordInstruction.is_speculative
  20588. A boolean indicating whether the instruction was executed
  20589. speculatively.
  20590. If an error occured during recording or decoding a recording, this
  20591. error is represented by a 'gdb.RecordGap' object in the instruction
  20592. list. It has the following attributes:
  20593. -- Variable: RecordGap.number
  20594. An integer identifying this gap. 'number' corresponds to the
  20595. numbers seen in 'record instruction-history' (*note Process Record
  20596. and Replay::).
  20597. -- Variable: RecordGap.error_code
  20598. A numerical representation of the reason for the gap. The value is
  20599. specific to the current recording method.
  20600. -- Variable: RecordGap.error_string
  20601. A human readable string with the reason for the gap.
  20602. A 'gdb.RecordFunctionSegment' object has the following attributes:
  20603. -- Variable: RecordFunctionSegment.number
  20604. An integer identifying this function segment. 'number' corresponds
  20605. to the numbers seen in 'record function-call-history' (*note
  20606. Process Record and Replay::).
  20607. -- Variable: RecordFunctionSegment.symbol
  20608. A 'gdb.Symbol' object representing the associated symbol. May be
  20609. 'None' if no debug information is available.
  20610. -- Variable: RecordFunctionSegment.level
  20611. An integer representing the function call's stack level. May be
  20612. 'None' if the function call is a gap.
  20613. -- Variable: RecordFunctionSegment.instructions
  20614. A list of 'gdb.RecordInstruction' or 'gdb.RecordGap' objects
  20615. associated with this function call.
  20616. -- Variable: RecordFunctionSegment.up
  20617. A 'gdb.RecordFunctionSegment' object representing the caller's
  20618. function segment. If the call has not been recorded, this will be
  20619. the function segment to which control returns. If neither the call
  20620. nor the return have been recorded, this will be 'None'.
  20621. -- Variable: RecordFunctionSegment.prev
  20622. A 'gdb.RecordFunctionSegment' object representing the previous
  20623. segment of this function call. May be 'None'.
  20624. -- Variable: RecordFunctionSegment.next
  20625. A 'gdb.RecordFunctionSegment' object representing the next segment
  20626. of this function call. May be 'None'.
  20627. The following example demonstrates the usage of these objects and
  20628. functions to create a function that will rewind a record to the last
  20629. time a function in a different file was executed. This would typically
  20630. be used to track the execution of user provided callback functions in a
  20631. library which typically are not visible in a back trace.
  20632. def bringback ():
  20633. rec = gdb.current_recording ()
  20634. if not rec:
  20635. return
  20636. insn = rec.instruction_history
  20637. if len (insn) == 0:
  20638. return
  20639. try:
  20640. position = insn.index (rec.replay_position)
  20641. except:
  20642. position = -1
  20643. try:
  20644. filename = insn[position].sal.symtab.fullname ()
  20645. except:
  20646. filename = None
  20647. for i in reversed (insn[:position]):
  20648. try:
  20649. current = i.sal.symtab.fullname ()
  20650. except:
  20651. current = None
  20652. if filename == current:
  20653. continue
  20654. rec.goto (i)
  20655. return
  20656. Another possible application is to write a function that counts the
  20657. number of code executions in a given line range. This line range can
  20658. contain parts of functions or span across several functions and is not
  20659. limited to be contiguous.
  20660. def countrange (filename, linerange):
  20661. count = 0
  20662. def filter_only (file_name):
  20663. for call in gdb.current_recording ().function_call_history:
  20664. try:
  20665. if file_name in call.symbol.symtab.fullname ():
  20666. yield call
  20667. except:
  20668. pass
  20669. for c in filter_only (filename):
  20670. for i in c.instructions:
  20671. try:
  20672. if i.sal.line in linerange:
  20673. count += 1
  20674. break;
  20675. except:
  20676. pass
  20677. return count
  20678. 
  20679. File: gdb.info, Node: Commands In Python, Next: Parameters In Python, Prev: Recordings In Python, Up: Python API
  20680. 23.2.2.20 Commands In Python
  20681. ............................
  20682. You can implement new GDB CLI commands in Python. A CLI command is
  20683. implemented using an instance of the 'gdb.Command' class, most commonly
  20684. using a subclass.
  20685. -- Function: Command.__init__ (name, COMMAND_CLASS [, COMPLETER_CLASS
  20686. [, PREFIX]])
  20687. The object initializer for 'Command' registers the new command with
  20688. GDB. This initializer is normally invoked from the subclass' own
  20689. '__init__' method.
  20690. NAME is the name of the command. If NAME consists of multiple
  20691. words, then the initial words are looked for as prefix commands.
  20692. In this case, if one of the prefix commands does not exist, an
  20693. exception is raised.
  20694. There is no support for multi-line commands.
  20695. COMMAND_CLASS should be one of the 'COMMAND_' constants defined
  20696. below. This argument tells GDB how to categorize the new command
  20697. in the help system.
  20698. COMPLETER_CLASS is an optional argument. If given, it should be
  20699. one of the 'COMPLETE_' constants defined below. This argument
  20700. tells GDB how to perform completion for this command. If not
  20701. given, GDB will attempt to complete using the object's 'complete'
  20702. method (see below); if no such method is found, an error will occur
  20703. when completion is attempted.
  20704. PREFIX is an optional argument. If 'True', then the new command is
  20705. a prefix command; sub-commands of this command may be registered.
  20706. The help text for the new command is taken from the Python
  20707. documentation string for the command's class, if there is one. If
  20708. no documentation string is provided, the default value "This
  20709. command is not documented." is used.
  20710. -- Function: Command.dont_repeat ()
  20711. By default, a GDB command is repeated when the user enters a blank
  20712. line at the command prompt. A command can suppress this behavior
  20713. by invoking the 'dont_repeat' method. This is similar to the user
  20714. command 'dont-repeat', see *note dont-repeat: Define.
  20715. -- Function: Command.invoke (argument, from_tty)
  20716. This method is called by GDB when this command is invoked.
  20717. ARGUMENT is a string. It is the argument to the command, after
  20718. leading and trailing whitespace has been stripped.
  20719. FROM_TTY is a boolean argument. When true, this means that the
  20720. command was entered by the user at the terminal; when false it
  20721. means that the command came from elsewhere.
  20722. If this method throws an exception, it is turned into a GDB 'error'
  20723. call. Otherwise, the return value is ignored.
  20724. To break ARGUMENT up into an argv-like string use
  20725. 'gdb.string_to_argv'. This function behaves identically to GDB's
  20726. internal argument lexer 'buildargv'. It is recommended to use this
  20727. for consistency. Arguments are separated by spaces and may be
  20728. quoted. Example:
  20729. print gdb.string_to_argv ("1 2\ \\\"3 '4 \"5' \"6 '7\"")
  20730. ['1', '2 "3', '4 "5', "6 '7"]
  20731. -- Function: Command.complete (text, word)
  20732. This method is called by GDB when the user attempts completion on
  20733. this command. All forms of completion are handled by this method,
  20734. that is, the <TAB> and <M-?> key bindings (*note Completion::), and
  20735. the 'complete' command (*note complete: Help.).
  20736. The arguments TEXT and WORD are both strings; TEXT holds the
  20737. complete command line up to the cursor's location, while WORD holds
  20738. the last word of the command line; this is computed using a
  20739. word-breaking heuristic.
  20740. The 'complete' method can return several values:
  20741. * If the return value is a sequence, the contents of the
  20742. sequence are used as the completions. It is up to 'complete'
  20743. to ensure that the contents actually do complete the word. A
  20744. zero-length sequence is allowed, it means that there were no
  20745. completions available. Only string elements of the sequence
  20746. are used; other elements in the sequence are ignored.
  20747. * If the return value is one of the 'COMPLETE_' constants
  20748. defined below, then the corresponding GDB-internal completion
  20749. function is invoked, and its result is used.
  20750. * All other results are treated as though there were no
  20751. available completions.
  20752. When a new command is registered, it must be declared as a member of
  20753. some general class of commands. This is used to classify top-level
  20754. commands in the on-line help system; note that prefix commands are not
  20755. listed under their own category but rather that of their top-level
  20756. command. The available classifications are represented by constants
  20757. defined in the 'gdb' module:
  20758. 'gdb.COMMAND_NONE'
  20759. The command does not belong to any particular class. A command in
  20760. this category will not be displayed in any of the help categories.
  20761. 'gdb.COMMAND_RUNNING'
  20762. The command is related to running the inferior. For example,
  20763. 'start', 'step', and 'continue' are in this category. Type 'help
  20764. running' at the GDB prompt to see a list of commands in this
  20765. category.
  20766. 'gdb.COMMAND_DATA'
  20767. The command is related to data or variables. For example, 'call',
  20768. 'find', and 'print' are in this category. Type 'help data' at the
  20769. GDB prompt to see a list of commands in this category.
  20770. 'gdb.COMMAND_STACK'
  20771. The command has to do with manipulation of the stack. For example,
  20772. 'backtrace', 'frame', and 'return' are in this category. Type
  20773. 'help stack' at the GDB prompt to see a list of commands in this
  20774. category.
  20775. 'gdb.COMMAND_FILES'
  20776. This class is used for file-related commands. For example, 'file',
  20777. 'list' and 'section' are in this category. Type 'help files' at
  20778. the GDB prompt to see a list of commands in this category.
  20779. 'gdb.COMMAND_SUPPORT'
  20780. This should be used for "support facilities", generally meaning
  20781. things that are useful to the user when interacting with GDB, but
  20782. not related to the state of the inferior. For example, 'help',
  20783. 'make', and 'shell' are in this category. Type 'help support' at
  20784. the GDB prompt to see a list of commands in this category.
  20785. 'gdb.COMMAND_STATUS'
  20786. The command is an 'info'-related command, that is, related to the
  20787. state of GDB itself. For example, 'info', 'macro', and 'show' are
  20788. in this category. Type 'help status' at the GDB prompt to see a
  20789. list of commands in this category.
  20790. 'gdb.COMMAND_BREAKPOINTS'
  20791. The command has to do with breakpoints. For example, 'break',
  20792. 'clear', and 'delete' are in this category. Type 'help
  20793. breakpoints' at the GDB prompt to see a list of commands in this
  20794. category.
  20795. 'gdb.COMMAND_TRACEPOINTS'
  20796. The command has to do with tracepoints. For example, 'trace',
  20797. 'actions', and 'tfind' are in this category. Type 'help
  20798. tracepoints' at the GDB prompt to see a list of commands in this
  20799. category.
  20800. 'gdb.COMMAND_USER'
  20801. The command is a general purpose command for the user, and
  20802. typically does not fit in one of the other categories. Type 'help
  20803. user-defined' at the GDB prompt to see a list of commands in this
  20804. category, as well as the list of gdb macros (*note Sequences::).
  20805. 'gdb.COMMAND_OBSCURE'
  20806. The command is only used in unusual circumstances, or is not of
  20807. general interest to users. For example, 'checkpoint', 'fork', and
  20808. 'stop' are in this category. Type 'help obscure' at the GDB prompt
  20809. to see a list of commands in this category.
  20810. 'gdb.COMMAND_MAINTENANCE'
  20811. The command is only useful to GDB maintainers. The 'maintenance'
  20812. and 'flushregs' commands are in this category. Type 'help
  20813. internals' at the GDB prompt to see a list of commands in this
  20814. category.
  20815. A new command can use a predefined completion function, either by
  20816. specifying it via an argument at initialization, or by returning it from
  20817. the 'complete' method. These predefined completion constants are all
  20818. defined in the 'gdb' module:
  20819. 'gdb.COMPLETE_NONE'
  20820. This constant means that no completion should be done.
  20821. 'gdb.COMPLETE_FILENAME'
  20822. This constant means that filename completion should be performed.
  20823. 'gdb.COMPLETE_LOCATION'
  20824. This constant means that location completion should be done. *Note
  20825. Specify Location::.
  20826. 'gdb.COMPLETE_COMMAND'
  20827. This constant means that completion should examine GDB command
  20828. names.
  20829. 'gdb.COMPLETE_SYMBOL'
  20830. This constant means that completion should be done using symbol
  20831. names as the source.
  20832. 'gdb.COMPLETE_EXPRESSION'
  20833. This constant means that completion should be done on expressions.
  20834. Often this means completing on symbol names, but some language
  20835. parsers also have support for completing on field names.
  20836. The following code snippet shows how a trivial CLI command can be
  20837. implemented in Python:
  20838. class HelloWorld (gdb.Command):
  20839. """Greet the whole world."""
  20840. def __init__ (self):
  20841. super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
  20842. def invoke (self, arg, from_tty):
  20843. print "Hello, World!"
  20844. HelloWorld ()
  20845. The last line instantiates the class, and is necessary to trigger the
  20846. registration of the command with GDB. Depending on how the Python code
  20847. is read into GDB, you may need to import the 'gdb' module explicitly.
  20848. 
  20849. File: gdb.info, Node: Parameters In Python, Next: Functions In Python, Prev: Commands In Python, Up: Python API
  20850. 23.2.2.21 Parameters In Python
  20851. ..............................
  20852. You can implement new GDB parameters using Python. A new parameter is
  20853. implemented as an instance of the 'gdb.Parameter' class.
  20854. Parameters are exposed to the user via the 'set' and 'show' commands.
  20855. *Note Help::.
  20856. There are many parameters that already exist and can be set in GDB.
  20857. Two examples are: 'set follow fork' and 'set charset'. Setting these
  20858. parameters influences certain behavior in GDB. Similarly, you can
  20859. define parameters that can be used to influence behavior in custom
  20860. Python scripts and commands.
  20861. -- Function: Parameter.__init__ (name, COMMAND-CLASS, PARAMETER-CLASS
  20862. [, ENUM-SEQUENCE])
  20863. The object initializer for 'Parameter' registers the new parameter
  20864. with GDB. This initializer is normally invoked from the subclass'
  20865. own '__init__' method.
  20866. NAME is the name of the new parameter. If NAME consists of
  20867. multiple words, then the initial words are looked for as prefix
  20868. parameters. An example of this can be illustrated with the 'set
  20869. print' set of parameters. If NAME is 'print foo', then 'print'
  20870. will be searched as the prefix parameter. In this case the
  20871. parameter can subsequently be accessed in GDB as 'set print foo'.
  20872. If NAME consists of multiple words, and no prefix parameter group
  20873. can be found, an exception is raised.
  20874. COMMAND-CLASS should be one of the 'COMMAND_' constants (*note
  20875. Commands In Python::). This argument tells GDB how to categorize
  20876. the new parameter in the help system.
  20877. PARAMETER-CLASS should be one of the 'PARAM_' constants defined
  20878. below. This argument tells GDB the type of the new parameter; this
  20879. information is used for input validation and completion.
  20880. If PARAMETER-CLASS is 'PARAM_ENUM', then ENUM-SEQUENCE must be a
  20881. sequence of strings. These strings represent the possible values
  20882. for the parameter.
  20883. If PARAMETER-CLASS is not 'PARAM_ENUM', then the presence of a
  20884. fourth argument will cause an exception to be thrown.
  20885. The help text for the new parameter is taken from the Python
  20886. documentation string for the parameter's class, if there is one.
  20887. If there is no documentation string, a default value is used.
  20888. -- Variable: Parameter.set_doc
  20889. If this attribute exists, and is a string, then its value is used
  20890. as the help text for this parameter's 'set' command. The value is
  20891. examined when 'Parameter.__init__' is invoked; subsequent changes
  20892. have no effect.
  20893. -- Variable: Parameter.show_doc
  20894. If this attribute exists, and is a string, then its value is used
  20895. as the help text for this parameter's 'show' command. The value is
  20896. examined when 'Parameter.__init__' is invoked; subsequent changes
  20897. have no effect.
  20898. -- Variable: Parameter.value
  20899. The 'value' attribute holds the underlying value of the parameter.
  20900. It can be read and assigned to just as any other attribute. GDB
  20901. does validation when assignments are made.
  20902. There are two methods that may be implemented in any 'Parameter'
  20903. class. These are:
  20904. -- Function: Parameter.get_set_string (self)
  20905. If this method exists, GDB will call it when a PARAMETER's value
  20906. has been changed via the 'set' API (for example, 'set foo off').
  20907. The 'value' attribute has already been populated with the new value
  20908. and may be used in output. This method must return a string. If
  20909. the returned string is not empty, GDB will present it to the user.
  20910. If this method raises the 'gdb.GdbError' exception (*note Exception
  20911. Handling::), then GDB will print the exception's string and the
  20912. 'set' command will fail. Note, however, that the 'value' attribute
  20913. will not be reset in this case. So, if your parameter must
  20914. validate values, it should store the old value internally and reset
  20915. the exposed value, like so:
  20916. class ExampleParam (gdb.Parameter):
  20917. def __init__ (self, name):
  20918. super (ExampleParam, self).__init__ (name,
  20919. gdb.COMMAND_DATA,
  20920. gdb.PARAM_BOOLEAN)
  20921. self.value = True
  20922. self.saved_value = True
  20923. def validate(self):
  20924. return False
  20925. def get_set_string (self):
  20926. if not self.validate():
  20927. self.value = self.saved_value
  20928. raise gdb.GdbError('Failed to validate')
  20929. self.saved_value = self.value
  20930. -- Function: Parameter.get_show_string (self, svalue)
  20931. GDB will call this method when a PARAMETER's 'show' API has been
  20932. invoked (for example, 'show foo'). The argument 'svalue' receives
  20933. the string representation of the current value. This method must
  20934. return a string.
  20935. When a new parameter is defined, its type must be specified. The
  20936. available types are represented by constants defined in the 'gdb'
  20937. module:
  20938. 'gdb.PARAM_BOOLEAN'
  20939. The value is a plain boolean. The Python boolean values, 'True'
  20940. and 'False' are the only valid values.
  20941. 'gdb.PARAM_AUTO_BOOLEAN'
  20942. The value has three possible states: true, false, and 'auto'. In
  20943. Python, true and false are represented using boolean constants, and
  20944. 'auto' is represented using 'None'.
  20945. 'gdb.PARAM_UINTEGER'
  20946. The value is an unsigned integer. The value of 0 should be
  20947. interpreted to mean "unlimited".
  20948. 'gdb.PARAM_INTEGER'
  20949. The value is a signed integer. The value of 0 should be
  20950. interpreted to mean "unlimited".
  20951. 'gdb.PARAM_STRING'
  20952. The value is a string. When the user modifies the string, any
  20953. escape sequences, such as '\t', '\f', and octal escapes, are
  20954. translated into corresponding characters and encoded into the
  20955. current host charset.
  20956. 'gdb.PARAM_STRING_NOESCAPE'
  20957. The value is a string. When the user modifies the string, escapes
  20958. are passed through untranslated.
  20959. 'gdb.PARAM_OPTIONAL_FILENAME'
  20960. The value is a either a filename (a string), or 'None'.
  20961. 'gdb.PARAM_FILENAME'
  20962. The value is a filename. This is just like
  20963. 'PARAM_STRING_NOESCAPE', but uses file names for completion.
  20964. 'gdb.PARAM_ZINTEGER'
  20965. The value is an integer. This is like 'PARAM_INTEGER', except 0 is
  20966. interpreted as itself.
  20967. 'gdb.PARAM_ZUINTEGER'
  20968. The value is an unsigned integer. This is like 'PARAM_INTEGER',
  20969. except 0 is interpreted as itself, and the value cannot be
  20970. negative.
  20971. 'gdb.PARAM_ZUINTEGER_UNLIMITED'
  20972. The value is a signed integer. This is like 'PARAM_ZUINTEGER',
  20973. except the special value -1 should be interpreted to mean
  20974. "unlimited". Other negative values are not allowed.
  20975. 'gdb.PARAM_ENUM'
  20976. The value is a string, which must be one of a collection string
  20977. constants provided when the parameter is created.
  20978. 
  20979. File: gdb.info, Node: Functions In Python, Next: Progspaces In Python, Prev: Parameters In Python, Up: Python API
  20980. 23.2.2.22 Writing new convenience functions
  20981. ...........................................
  20982. You can implement new convenience functions (*note Convenience Vars::)
  20983. in Python. A convenience function is an instance of a subclass of the
  20984. class 'gdb.Function'.
  20985. -- Function: Function.__init__ (name)
  20986. The initializer for 'Function' registers the new function with GDB.
  20987. The argument NAME is the name of the function, a string. The
  20988. function will be visible to the user as a convenience variable of
  20989. type 'internal function', whose name is the same as the given NAME.
  20990. The documentation for the new function is taken from the
  20991. documentation string for the new class.
  20992. -- Function: Function.invoke (*ARGS)
  20993. When a convenience function is evaluated, its arguments are
  20994. converted to instances of 'gdb.Value', and then the function's
  20995. 'invoke' method is called. Note that GDB does not predetermine the
  20996. arity of convenience functions. Instead, all available arguments
  20997. are passed to 'invoke', following the standard Python calling
  20998. convention. In particular, a convenience function can have default
  20999. values for parameters without ill effect.
  21000. The return value of this method is used as its value in the
  21001. enclosing expression. If an ordinary Python value is returned, it
  21002. is converted to a 'gdb.Value' following the usual rules.
  21003. The following code snippet shows how a trivial convenience function
  21004. can be implemented in Python:
  21005. class Greet (gdb.Function):
  21006. """Return string to greet someone.
  21007. Takes a name as argument."""
  21008. def __init__ (self):
  21009. super (Greet, self).__init__ ("greet")
  21010. def invoke (self, name):
  21011. return "Hello, %s!" % name.string ()
  21012. Greet ()
  21013. The last line instantiates the class, and is necessary to trigger the
  21014. registration of the function with GDB. Depending on how the Python code
  21015. is read into GDB, you may need to import the 'gdb' module explicitly.
  21016. Now you can use the function in an expression:
  21017. (gdb) print $greet("Bob")
  21018. $1 = "Hello, Bob!"
  21019. 
  21020. File: gdb.info, Node: Progspaces In Python, Next: Objfiles In Python, Prev: Functions In Python, Up: Python API
  21021. 23.2.2.23 Program Spaces In Python
  21022. ..................................
  21023. A program space, or "progspace", represents a symbolic view of an
  21024. address space. It consists of all of the objfiles of the program.
  21025. *Note Objfiles In Python::. *Note program spaces: Inferiors and
  21026. Programs, for more details about program spaces.
  21027. The following progspace-related functions are available in the 'gdb'
  21028. module:
  21029. -- Function: gdb.current_progspace ()
  21030. This function returns the program space of the currently selected
  21031. inferior. *Note Inferiors and Programs::. This is identical to
  21032. 'gdb.selected_inferior().progspace' (*note Inferiors In Python::)
  21033. and is included for historical compatibility.
  21034. -- Function: gdb.progspaces ()
  21035. Return a sequence of all the progspaces currently known to GDB.
  21036. Each progspace is represented by an instance of the 'gdb.Progspace'
  21037. class.
  21038. -- Variable: Progspace.filename
  21039. The file name of the progspace as a string.
  21040. -- Variable: Progspace.pretty_printers
  21041. The 'pretty_printers' attribute is a list of functions. It is used
  21042. to look up pretty-printers. A 'Value' is passed to each function
  21043. in order; if the function returns 'None', then the search
  21044. continues. Otherwise, the return value should be an object which
  21045. is used to format the value. *Note Pretty Printing API::, for more
  21046. information.
  21047. -- Variable: Progspace.type_printers
  21048. The 'type_printers' attribute is a list of type printer objects.
  21049. *Note Type Printing API::, for more information.
  21050. -- Variable: Progspace.frame_filters
  21051. The 'frame_filters' attribute is a dictionary of frame filter
  21052. objects. *Note Frame Filter API::, for more information.
  21053. A program space has the following methods:
  21054. -- Function: Progspace.block_for_pc (pc)
  21055. Return the innermost 'gdb.Block' containing the given PC value. If
  21056. the block cannot be found for the PC value specified, the function
  21057. will return 'None'.
  21058. -- Function: Progspace.find_pc_line (pc)
  21059. Return the 'gdb.Symtab_and_line' object corresponding to the PC
  21060. value. *Note Symbol Tables In Python::. If an invalid value of PC
  21061. is passed as an argument, then the 'symtab' and 'line' attributes
  21062. of the returned 'gdb.Symtab_and_line' object will be 'None' and 0
  21063. respectively.
  21064. -- Function: Progspace.is_valid ()
  21065. Returns 'True' if the 'gdb.Progspace' object is valid, 'False' if
  21066. not. A 'gdb.Progspace' object can become invalid if the program
  21067. space file it refers to is not referenced by any inferior. All
  21068. other 'gdb.Progspace' methods will throw an exception if it is
  21069. invalid at the time the method is called.
  21070. -- Function: Progspace.objfiles ()
  21071. Return a sequence of all the objfiles referenced by this program
  21072. space. *Note Objfiles In Python::.
  21073. -- Function: Progspace.solib_name (address)
  21074. Return the name of the shared library holding the given ADDRESS as
  21075. a string, or 'None'.
  21076. One may add arbitrary attributes to 'gdb.Progspace' objects in the
  21077. usual Python way. This is useful if, for example, one needs to do some
  21078. extra record keeping associated with the program space.
  21079. In this contrived example, we want to perform some processing when an
  21080. objfile with a certain symbol is loaded, but we only want to do this
  21081. once because it is expensive. To achieve this we record the results
  21082. with the program space because we can't predict when the desired objfile
  21083. will be loaded.
  21084. (gdb) python
  21085. def clear_objfiles_handler(event):
  21086. event.progspace.expensive_computation = None
  21087. def expensive(symbol):
  21088. """A mock routine to perform an "expensive" computation on symbol."""
  21089. print "Computing the answer to the ultimate question ..."
  21090. return 42
  21091. def new_objfile_handler(event):
  21092. objfile = event.new_objfile
  21093. progspace = objfile.progspace
  21094. if not hasattr(progspace, 'expensive_computation') or \
  21095. progspace.expensive_computation is None:
  21096. # We use 'main' for the symbol to keep the example simple.
  21097. # Note: There's no current way to constrain the lookup
  21098. # to one objfile.
  21099. symbol = gdb.lookup_global_symbol('main')
  21100. if symbol is not None:
  21101. progspace.expensive_computation = expensive(symbol)
  21102. gdb.events.clear_objfiles.connect(clear_objfiles_handler)
  21103. gdb.events.new_objfile.connect(new_objfile_handler)
  21104. end
  21105. (gdb) file /tmp/hello
  21106. Reading symbols from /tmp/hello...done.
  21107. Computing the answer to the ultimate question ...
  21108. (gdb) python print gdb.current_progspace().expensive_computation
  21109. 42
  21110. (gdb) run
  21111. Starting program: /tmp/hello
  21112. Hello.
  21113. [Inferior 1 (process 4242) exited normally]
  21114. 
  21115. File: gdb.info, Node: Objfiles In Python, Next: Frames In Python, Prev: Progspaces In Python, Up: Python API
  21116. 23.2.2.24 Objfiles In Python
  21117. ............................
  21118. GDB loads symbols for an inferior from various symbol-containing files
  21119. (*note Files::). These include the primary executable file, any shared
  21120. libraries used by the inferior, and any separate debug info files (*note
  21121. Separate Debug Files::). GDB calls these symbol-containing files
  21122. "objfiles".
  21123. The following objfile-related functions are available in the 'gdb'
  21124. module:
  21125. -- Function: gdb.current_objfile ()
  21126. When auto-loading a Python script (*note Python Auto-loading::),
  21127. GDB sets the "current objfile" to the corresponding objfile. This
  21128. function returns the current objfile. If there is no current
  21129. objfile, this function returns 'None'.
  21130. -- Function: gdb.objfiles ()
  21131. Return a sequence of objfiles referenced by the current program
  21132. space. *Note Objfiles In Python::, and *note Progspaces In
  21133. Python::. This is identical to
  21134. 'gdb.selected_inferior().progspace.objfiles()' and is included for
  21135. historical compatibility.
  21136. -- Function: gdb.lookup_objfile (name [, by_build_id])
  21137. Look up NAME, a file name or build ID, in the list of objfiles for
  21138. the current program space (*note Progspaces In Python::). If the
  21139. objfile is not found throw the Python 'ValueError' exception.
  21140. If NAME is a relative file name, then it will match any source file
  21141. name with the same trailing components. For example, if NAME is
  21142. 'gcc/expr.c', then it will match source file name of
  21143. '/build/trunk/gcc/expr.c', but not '/build/trunk/libcpp/expr.c' or
  21144. '/build/trunk/gcc/x-expr.c'.
  21145. If BY_BUILD_ID is provided and is 'True' then NAME is the build ID
  21146. of the objfile. Otherwise, NAME is a file name. This is supported
  21147. only on some operating systems, notably those which use the ELF
  21148. format for binary files and the GNU Binutils. For more details
  21149. about this feature, see the description of the '--build-id'
  21150. command-line option in *note Command Line Options: (ld)Options.
  21151. Each objfile is represented by an instance of the 'gdb.Objfile'
  21152. class.
  21153. -- Variable: Objfile.filename
  21154. The file name of the objfile as a string, with symbolic links
  21155. resolved.
  21156. The value is 'None' if the objfile is no longer valid. See the
  21157. 'gdb.Objfile.is_valid' method, described below.
  21158. -- Variable: Objfile.username
  21159. The file name of the objfile as specified by the user as a string.
  21160. The value is 'None' if the objfile is no longer valid. See the
  21161. 'gdb.Objfile.is_valid' method, described below.
  21162. -- Variable: Objfile.owner
  21163. For separate debug info objfiles this is the corresponding
  21164. 'gdb.Objfile' object that debug info is being provided for.
  21165. Otherwise this is 'None'. Separate debug info objfiles are added
  21166. with the 'gdb.Objfile.add_separate_debug_file' method, described
  21167. below.
  21168. -- Variable: Objfile.build_id
  21169. The build ID of the objfile as a string. If the objfile does not
  21170. have a build ID then the value is 'None'.
  21171. This is supported only on some operating systems, notably those
  21172. which use the ELF format for binary files and the GNU Binutils.
  21173. For more details about this feature, see the description of the
  21174. '--build-id' command-line option in *note Command Line Options:
  21175. (ld)Options.
  21176. -- Variable: Objfile.progspace
  21177. The containing program space of the objfile as a 'gdb.Progspace'
  21178. object. *Note Progspaces In Python::.
  21179. -- Variable: Objfile.pretty_printers
  21180. The 'pretty_printers' attribute is a list of functions. It is used
  21181. to look up pretty-printers. A 'Value' is passed to each function
  21182. in order; if the function returns 'None', then the search
  21183. continues. Otherwise, the return value should be an object which
  21184. is used to format the value. *Note Pretty Printing API::, for more
  21185. information.
  21186. -- Variable: Objfile.type_printers
  21187. The 'type_printers' attribute is a list of type printer objects.
  21188. *Note Type Printing API::, for more information.
  21189. -- Variable: Objfile.frame_filters
  21190. The 'frame_filters' attribute is a dictionary of frame filter
  21191. objects. *Note Frame Filter API::, for more information.
  21192. One may add arbitrary attributes to 'gdb.Objfile' objects in the
  21193. usual Python way. This is useful if, for example, one needs to do some
  21194. extra record keeping associated with the objfile.
  21195. In this contrived example we record the time when GDB loaded the
  21196. objfile.
  21197. (gdb) python
  21198. import datetime
  21199. def new_objfile_handler(event):
  21200. # Set the time_loaded attribute of the new objfile.
  21201. event.new_objfile.time_loaded = datetime.datetime.today()
  21202. gdb.events.new_objfile.connect(new_objfile_handler)
  21203. end
  21204. (gdb) file ./hello
  21205. Reading symbols from ./hello...done.
  21206. (gdb) python print gdb.objfiles()[0].time_loaded
  21207. 2014-10-09 11:41:36.770345
  21208. A 'gdb.Objfile' object has the following methods:
  21209. -- Function: Objfile.is_valid ()
  21210. Returns 'True' if the 'gdb.Objfile' object is valid, 'False' if
  21211. not. A 'gdb.Objfile' object can become invalid if the object file
  21212. it refers to is not loaded in GDB any longer. All other
  21213. 'gdb.Objfile' methods will throw an exception if it is invalid at
  21214. the time the method is called.
  21215. -- Function: Objfile.add_separate_debug_file (file)
  21216. Add FILE to the list of files that GDB will search for debug
  21217. information for the objfile. This is useful when the debug info
  21218. has been removed from the program and stored in a separate file.
  21219. GDB has built-in support for finding separate debug info files
  21220. (*note Separate Debug Files::), but if the file doesn't live in one
  21221. of the standard places that GDB searches then this function can be
  21222. used to add a debug info file from a different place.
  21223. -- Function: Objfile.lookup_global_symbol (name [, domain])
  21224. Search for a global symbol named NAME in this objfile. Optionally,
  21225. the search scope can be restricted with the DOMAIN argument. The
  21226. DOMAIN argument must be a domain constant defined in the 'gdb'
  21227. module and described in *note Symbols In Python::. This function
  21228. is similar to 'gdb.lookup_global_symbol', except that the search is
  21229. limited to this objfile.
  21230. The result is a 'gdb.Symbol' object or 'None' if the symbol is not
  21231. found.
  21232. -- Function: Objfile.lookup_static_symbol (name [, domain])
  21233. Like 'Objfile.lookup_global_symbol', but searches for a global
  21234. symbol with static linkage named NAME in this objfile.
  21235. 
  21236. File: gdb.info, Node: Frames In Python, Next: Blocks In Python, Prev: Objfiles In Python, Up: Python API
  21237. 23.2.2.25 Accessing inferior stack frames from Python
  21238. .....................................................
  21239. When the debugged program stops, GDB is able to analyze its call stack
  21240. (*note Stack frames: Frames.). The 'gdb.Frame' class represents a frame
  21241. in the stack. A 'gdb.Frame' object is only valid while its
  21242. corresponding frame exists in the inferior's stack. If you try to use
  21243. an invalid frame object, GDB will throw a 'gdb.error' exception (*note
  21244. Exception Handling::).
  21245. Two 'gdb.Frame' objects can be compared for equality with the '=='
  21246. operator, like:
  21247. (gdb) python print gdb.newest_frame() == gdb.selected_frame ()
  21248. True
  21249. The following frame-related functions are available in the 'gdb'
  21250. module:
  21251. -- Function: gdb.selected_frame ()
  21252. Return the selected frame object. (*note Selecting a Frame:
  21253. Selection.).
  21254. -- Function: gdb.newest_frame ()
  21255. Return the newest frame object for the selected thread.
  21256. -- Function: gdb.frame_stop_reason_string (reason)
  21257. Return a string explaining the reason why GDB stopped unwinding
  21258. frames, as expressed by the given REASON code (an integer, see the
  21259. 'unwind_stop_reason' method further down in this section).
  21260. -- Function: gdb.invalidate_cached_frames
  21261. GDB internally keeps a cache of the frames that have been unwound.
  21262. This function invalidates this cache.
  21263. This function should not generally be called by ordinary Python
  21264. code. It is documented for the sake of completeness.
  21265. A 'gdb.Frame' object has the following methods:
  21266. -- Function: Frame.is_valid ()
  21267. Returns true if the 'gdb.Frame' object is valid, false if not. A
  21268. frame object can become invalid if the frame it refers to doesn't
  21269. exist anymore in the inferior. All 'gdb.Frame' methods will throw
  21270. an exception if it is invalid at the time the method is called.
  21271. -- Function: Frame.name ()
  21272. Returns the function name of the frame, or 'None' if it can't be
  21273. obtained.
  21274. -- Function: Frame.architecture ()
  21275. Returns the 'gdb.Architecture' object corresponding to the frame's
  21276. architecture. *Note Architectures In Python::.
  21277. -- Function: Frame.type ()
  21278. Returns the type of the frame. The value can be one of:
  21279. 'gdb.NORMAL_FRAME'
  21280. An ordinary stack frame.
  21281. 'gdb.DUMMY_FRAME'
  21282. A fake stack frame that was created by GDB when performing an
  21283. inferior function call.
  21284. 'gdb.INLINE_FRAME'
  21285. A frame representing an inlined function. The function was
  21286. inlined into a 'gdb.NORMAL_FRAME' that is older than this one.
  21287. 'gdb.TAILCALL_FRAME'
  21288. A frame representing a tail call. *Note Tail Call Frames::.
  21289. 'gdb.SIGTRAMP_FRAME'
  21290. A signal trampoline frame. This is the frame created by the
  21291. OS when it calls into a signal handler.
  21292. 'gdb.ARCH_FRAME'
  21293. A fake stack frame representing a cross-architecture call.
  21294. 'gdb.SENTINEL_FRAME'
  21295. This is like 'gdb.NORMAL_FRAME', but it is only used for the
  21296. newest frame.
  21297. -- Function: Frame.unwind_stop_reason ()
  21298. Return an integer representing the reason why it's not possible to
  21299. find more frames toward the outermost frame. Use
  21300. 'gdb.frame_stop_reason_string' to convert the value returned by
  21301. this function to a string. The value can be one of:
  21302. 'gdb.FRAME_UNWIND_NO_REASON'
  21303. No particular reason (older frames should be available).
  21304. 'gdb.FRAME_UNWIND_NULL_ID'
  21305. The previous frame's analyzer returns an invalid result. This
  21306. is no longer used by GDB, and is kept only for backward
  21307. compatibility.
  21308. 'gdb.FRAME_UNWIND_OUTERMOST'
  21309. This frame is the outermost.
  21310. 'gdb.FRAME_UNWIND_UNAVAILABLE'
  21311. Cannot unwind further, because that would require knowing the
  21312. values of registers or memory that have not been collected.
  21313. 'gdb.FRAME_UNWIND_INNER_ID'
  21314. This frame ID looks like it ought to belong to a NEXT frame,
  21315. but we got it for a PREV frame. Normally, this is a sign of
  21316. unwinder failure. It could also indicate stack corruption.
  21317. 'gdb.FRAME_UNWIND_SAME_ID'
  21318. This frame has the same ID as the previous one. That means
  21319. that unwinding further would almost certainly give us another
  21320. frame with exactly the same ID, so break the chain. Normally,
  21321. this is a sign of unwinder failure. It could also indicate
  21322. stack corruption.
  21323. 'gdb.FRAME_UNWIND_NO_SAVED_PC'
  21324. The frame unwinder did not find any saved PC, but we needed
  21325. one to unwind further.
  21326. 'gdb.FRAME_UNWIND_MEMORY_ERROR'
  21327. The frame unwinder caused an error while trying to access
  21328. memory.
  21329. 'gdb.FRAME_UNWIND_FIRST_ERROR'
  21330. Any stop reason greater or equal to this value indicates some
  21331. kind of error. This special value facilitates writing code
  21332. that tests for errors in unwinding in a way that will work
  21333. correctly even if the list of the other values is modified in
  21334. future GDB versions. Using it, you could write:
  21335. reason = gdb.selected_frame().unwind_stop_reason ()
  21336. reason_str = gdb.frame_stop_reason_string (reason)
  21337. if reason >= gdb.FRAME_UNWIND_FIRST_ERROR:
  21338. print "An error occured: %s" % reason_str
  21339. -- Function: Frame.pc ()
  21340. Returns the frame's resume address.
  21341. -- Function: Frame.block ()
  21342. Return the frame's code block. *Note Blocks In Python::. If the
  21343. frame does not have a block - for example, if there is no debugging
  21344. information for the code in question - then this will throw an
  21345. exception.
  21346. -- Function: Frame.function ()
  21347. Return the symbol for the function corresponding to this frame.
  21348. *Note Symbols In Python::.
  21349. -- Function: Frame.older ()
  21350. Return the frame that called this frame.
  21351. -- Function: Frame.newer ()
  21352. Return the frame called by this frame.
  21353. -- Function: Frame.find_sal ()
  21354. Return the frame's symtab and line object. *Note Symbol Tables In
  21355. Python::.
  21356. -- Function: Frame.read_register (register)
  21357. Return the value of REGISTER in this frame. The REGISTER argument
  21358. must be a string (e.g., ''sp'' or ''rax''). Returns a 'Gdb.Value'
  21359. object. Throws an exception if REGISTER does not exist.
  21360. -- Function: Frame.read_var (variable [, block])
  21361. Return the value of VARIABLE in this frame. If the optional
  21362. argument BLOCK is provided, search for the variable from that
  21363. block; otherwise start at the frame's current block (which is
  21364. determined by the frame's current program counter). The VARIABLE
  21365. argument must be a string or a 'gdb.Symbol' object; BLOCK must be a
  21366. 'gdb.Block' object.
  21367. -- Function: Frame.select ()
  21368. Set this frame to be the selected frame. *Note Examining the
  21369. Stack: Stack.
  21370. 
  21371. File: gdb.info, Node: Blocks In Python, Next: Symbols In Python, Prev: Frames In Python, Up: Python API
  21372. 23.2.2.26 Accessing blocks from Python
  21373. ......................................
  21374. In GDB, symbols are stored in blocks. A block corresponds roughly to a
  21375. scope in the source code. Blocks are organized hierarchically, and are
  21376. represented individually in Python as a 'gdb.Block'. Blocks rely on
  21377. debugging information being available.
  21378. A frame has a block. Please see *note Frames In Python::, for a more
  21379. in-depth discussion of frames.
  21380. The outermost block is known as the "global block". The global block
  21381. typically holds public global variables and functions.
  21382. The block nested just inside the global block is the "static block".
  21383. The static block typically holds file-scoped variables and functions.
  21384. GDB provides a method to get a block's superblock, but there is
  21385. currently no way to examine the sub-blocks of a block, or to iterate
  21386. over all the blocks in a symbol table (*note Symbol Tables In Python::).
  21387. Here is a short example that should help explain blocks:
  21388. /* This is in the global block. */
  21389. int global;
  21390. /* This is in the static block. */
  21391. static int file_scope;
  21392. /* 'function' is in the global block, and 'argument' is
  21393. in a block nested inside of 'function'. */
  21394. int function (int argument)
  21395. {
  21396. /* 'local' is in a block inside 'function'. It may or may
  21397. not be in the same block as 'argument'. */
  21398. int local;
  21399. {
  21400. /* 'inner' is in a block whose superblock is the one holding
  21401. 'local'. */
  21402. int inner;
  21403. /* If this call is expanded by the compiler, you may see
  21404. a nested block here whose function is 'inline_function'
  21405. and whose superblock is the one holding 'inner'. */
  21406. inline_function ();
  21407. }
  21408. }
  21409. A 'gdb.Block' is iterable. The iterator returns the symbols (*note
  21410. Symbols In Python::) local to the block. Python programs should not
  21411. assume that a specific block object will always contain a given symbol,
  21412. since changes in GDB features and infrastructure may cause symbols move
  21413. across blocks in a symbol table. You can also use Python's "dictionary
  21414. syntax" to access variables in this block, e.g.:
  21415. symbol = some_block['variable'] # symbol is of type gdb.Symbol
  21416. The following block-related functions are available in the 'gdb'
  21417. module:
  21418. -- Function: gdb.block_for_pc (pc)
  21419. Return the innermost 'gdb.Block' containing the given PC value. If
  21420. the block cannot be found for the PC value specified, the function
  21421. will return 'None'. This is identical to
  21422. 'gdb.current_progspace().block_for_pc(pc)' and is included for
  21423. historical compatibility.
  21424. A 'gdb.Block' object has the following methods:
  21425. -- Function: Block.is_valid ()
  21426. Returns 'True' if the 'gdb.Block' object is valid, 'False' if not.
  21427. A block object can become invalid if the block it refers to doesn't
  21428. exist anymore in the inferior. All other 'gdb.Block' methods will
  21429. throw an exception if it is invalid at the time the method is
  21430. called. The block's validity is also checked during iteration over
  21431. symbols of the block.
  21432. A 'gdb.Block' object has the following attributes:
  21433. -- Variable: Block.start
  21434. The start address of the block. This attribute is not writable.
  21435. -- Variable: Block.end
  21436. One past the last address that appears in the block. This
  21437. attribute is not writable.
  21438. -- Variable: Block.function
  21439. The name of the block represented as a 'gdb.Symbol'. If the block
  21440. is not named, then this attribute holds 'None'. This attribute is
  21441. not writable.
  21442. For ordinary function blocks, the superblock is the static block.
  21443. However, you should note that it is possible for a function block
  21444. to have a superblock that is not the static block - for instance
  21445. this happens for an inlined function.
  21446. -- Variable: Block.superblock
  21447. The block containing this block. If this parent block does not
  21448. exist, this attribute holds 'None'. This attribute is not
  21449. writable.
  21450. -- Variable: Block.global_block
  21451. The global block associated with this block. This attribute is not
  21452. writable.
  21453. -- Variable: Block.static_block
  21454. The static block associated with this block. This attribute is not
  21455. writable.
  21456. -- Variable: Block.is_global
  21457. 'True' if the 'gdb.Block' object is a global block, 'False' if not.
  21458. This attribute is not writable.
  21459. -- Variable: Block.is_static
  21460. 'True' if the 'gdb.Block' object is a static block, 'False' if not.
  21461. This attribute is not writable.
  21462. 
  21463. File: gdb.info, Node: Symbols In Python, Next: Symbol Tables In Python, Prev: Blocks In Python, Up: Python API
  21464. 23.2.2.27 Python representation of Symbols
  21465. ..........................................
  21466. GDB represents every variable, function and type as an entry in a symbol
  21467. table. *Note Examining the Symbol Table: Symbols. Similarly, Python
  21468. represents these symbols in GDB with the 'gdb.Symbol' object.
  21469. The following symbol-related functions are available in the 'gdb'
  21470. module:
  21471. -- Function: gdb.lookup_symbol (name [, block [, domain]])
  21472. This function searches for a symbol by name. The search scope can
  21473. be restricted to the parameters defined in the optional domain and
  21474. block arguments.
  21475. NAME is the name of the symbol. It must be a string. The optional
  21476. BLOCK argument restricts the search to symbols visible in that
  21477. BLOCK. The BLOCK argument must be a 'gdb.Block' object. If
  21478. omitted, the block for the current frame is used. The optional
  21479. DOMAIN argument restricts the search to the domain type. The
  21480. DOMAIN argument must be a domain constant defined in the 'gdb'
  21481. module and described later in this chapter.
  21482. The result is a tuple of two elements. The first element is a
  21483. 'gdb.Symbol' object or 'None' if the symbol is not found. If the
  21484. symbol is found, the second element is 'True' if the symbol is a
  21485. field of a method's object (e.g., 'this' in C++), otherwise it is
  21486. 'False'. If the symbol is not found, the second element is
  21487. 'False'.
  21488. -- Function: gdb.lookup_global_symbol (name [, domain])
  21489. This function searches for a global symbol by name. The search
  21490. scope can be restricted to by the domain argument.
  21491. NAME is the name of the symbol. It must be a string. The optional
  21492. DOMAIN argument restricts the search to the domain type. The
  21493. DOMAIN argument must be a domain constant defined in the 'gdb'
  21494. module and described later in this chapter.
  21495. The result is a 'gdb.Symbol' object or 'None' if the symbol is not
  21496. found.
  21497. -- Function: gdb.lookup_static_symbol (name [, domain])
  21498. This function searches for a global symbol with static linkage by
  21499. name. The search scope can be restricted to by the domain
  21500. argument.
  21501. NAME is the name of the symbol. It must be a string. The optional
  21502. DOMAIN argument restricts the search to the domain type. The
  21503. DOMAIN argument must be a domain constant defined in the 'gdb'
  21504. module and described later in this chapter.
  21505. The result is a 'gdb.Symbol' object or 'None' if the symbol is not
  21506. found.
  21507. Note that this function will not find function-scoped static
  21508. variables. To look up such variables, iterate over the variables
  21509. of the function's 'gdb.Block' and check that 'block.addr_class' is
  21510. 'gdb.SYMBOL_LOC_STATIC'.
  21511. There can be multiple global symbols with static linkage with the
  21512. same name. This function will only return the first matching
  21513. symbol that it finds. Which symbol is found depends on where GDB
  21514. is currently stopped, as GDB will first search for matching symbols
  21515. in the current object file, and then search all other object files.
  21516. If the application is not yet running then GDB will search all
  21517. object files in the order they appear in the debug information.
  21518. -- Function: gdb.lookup_static_symbols (name [, domain])
  21519. Similar to 'gdb.lookup_static_symbol', this function searches for
  21520. global symbols with static linkage by name, and optionally
  21521. restricted by the domain argument. However, this function returns
  21522. a list of all matching symbols found, not just the first one.
  21523. NAME is the name of the symbol. It must be a string. The optional
  21524. DOMAIN argument restricts the search to the domain type. The
  21525. DOMAIN argument must be a domain constant defined in the 'gdb'
  21526. module and described later in this chapter.
  21527. The result is a list of 'gdb.Symbol' objects which could be empty
  21528. if no matching symbols were found.
  21529. Note that this function will not find function-scoped static
  21530. variables. To look up such variables, iterate over the variables
  21531. of the function's 'gdb.Block' and check that 'block.addr_class' is
  21532. 'gdb.SYMBOL_LOC_STATIC'.
  21533. A 'gdb.Symbol' object has the following attributes:
  21534. -- Variable: Symbol.type
  21535. The type of the symbol or 'None' if no type is recorded. This
  21536. attribute is represented as a 'gdb.Type' object. *Note Types In
  21537. Python::. This attribute is not writable.
  21538. -- Variable: Symbol.symtab
  21539. The symbol table in which the symbol appears. This attribute is
  21540. represented as a 'gdb.Symtab' object. *Note Symbol Tables In
  21541. Python::. This attribute is not writable.
  21542. -- Variable: Symbol.line
  21543. The line number in the source code at which the symbol was defined.
  21544. This is an integer.
  21545. -- Variable: Symbol.name
  21546. The name of the symbol as a string. This attribute is not
  21547. writable.
  21548. -- Variable: Symbol.linkage_name
  21549. The name of the symbol, as used by the linker (i.e., may be
  21550. mangled). This attribute is not writable.
  21551. -- Variable: Symbol.print_name
  21552. The name of the symbol in a form suitable for output. This is
  21553. either 'name' or 'linkage_name', depending on whether the user
  21554. asked GDB to display demangled or mangled names.
  21555. -- Variable: Symbol.addr_class
  21556. The address class of the symbol. This classifies how to find the
  21557. value of a symbol. Each address class is a constant defined in the
  21558. 'gdb' module and described later in this chapter.
  21559. -- Variable: Symbol.needs_frame
  21560. This is 'True' if evaluating this symbol's value requires a frame
  21561. (*note Frames In Python::) and 'False' otherwise. Typically, local
  21562. variables will require a frame, but other symbols will not.
  21563. -- Variable: Symbol.is_argument
  21564. 'True' if the symbol is an argument of a function.
  21565. -- Variable: Symbol.is_constant
  21566. 'True' if the symbol is a constant.
  21567. -- Variable: Symbol.is_function
  21568. 'True' if the symbol is a function or a method.
  21569. -- Variable: Symbol.is_variable
  21570. 'True' if the symbol is a variable.
  21571. A 'gdb.Symbol' object has the following methods:
  21572. -- Function: Symbol.is_valid ()
  21573. Returns 'True' if the 'gdb.Symbol' object is valid, 'False' if not.
  21574. A 'gdb.Symbol' object can become invalid if the symbol it refers to
  21575. does not exist in GDB any longer. All other 'gdb.Symbol' methods
  21576. will throw an exception if it is invalid at the time the method is
  21577. called.
  21578. -- Function: Symbol.value ([frame])
  21579. Compute the value of the symbol, as a 'gdb.Value'. For functions,
  21580. this computes the address of the function, cast to the appropriate
  21581. type. If the symbol requires a frame in order to compute its
  21582. value, then FRAME must be given. If FRAME is not given, or if
  21583. FRAME is invalid, then this method will throw an exception.
  21584. The available domain categories in 'gdb.Symbol' are represented as
  21585. constants in the 'gdb' module:
  21586. 'gdb.SYMBOL_UNDEF_DOMAIN'
  21587. This is used when a domain has not been discovered or none of the
  21588. following domains apply. This usually indicates an error either in
  21589. the symbol information or in GDB's handling of symbols.
  21590. 'gdb.SYMBOL_VAR_DOMAIN'
  21591. This domain contains variables, function names, typedef names and
  21592. enum type values.
  21593. 'gdb.SYMBOL_STRUCT_DOMAIN'
  21594. This domain holds struct, union and enum type names.
  21595. 'gdb.SYMBOL_LABEL_DOMAIN'
  21596. This domain contains names of labels (for gotos).
  21597. 'gdb.SYMBOL_MODULE_DOMAIN'
  21598. This domain contains names of Fortran module types.
  21599. 'gdb.SYMBOL_COMMON_BLOCK_DOMAIN'
  21600. This domain contains names of Fortran common blocks.
  21601. The available address class categories in 'gdb.Symbol' are
  21602. represented as constants in the 'gdb' module:
  21603. 'gdb.SYMBOL_LOC_UNDEF'
  21604. If this is returned by address class, it indicates an error either
  21605. in the symbol information or in GDB's handling of symbols.
  21606. 'gdb.SYMBOL_LOC_CONST'
  21607. Value is constant int.
  21608. 'gdb.SYMBOL_LOC_STATIC'
  21609. Value is at a fixed address.
  21610. 'gdb.SYMBOL_LOC_REGISTER'
  21611. Value is in a register.
  21612. 'gdb.SYMBOL_LOC_ARG'
  21613. Value is an argument. This value is at the offset stored within
  21614. the symbol inside the frame's argument list.
  21615. 'gdb.SYMBOL_LOC_REF_ARG'
  21616. Value address is stored in the frame's argument list. Just like
  21617. 'LOC_ARG' except that the value's address is stored at the offset,
  21618. not the value itself.
  21619. 'gdb.SYMBOL_LOC_REGPARM_ADDR'
  21620. Value is a specified register. Just like 'LOC_REGISTER' except the
  21621. register holds the address of the argument instead of the argument
  21622. itself.
  21623. 'gdb.SYMBOL_LOC_LOCAL'
  21624. Value is a local variable.
  21625. 'gdb.SYMBOL_LOC_TYPEDEF'
  21626. Value not used. Symbols in the domain 'SYMBOL_STRUCT_DOMAIN' all
  21627. have this class.
  21628. 'gdb.SYMBOL_LOC_BLOCK'
  21629. Value is a block.
  21630. 'gdb.SYMBOL_LOC_CONST_BYTES'
  21631. Value is a byte-sequence.
  21632. 'gdb.SYMBOL_LOC_UNRESOLVED'
  21633. Value is at a fixed address, but the address of the variable has to
  21634. be determined from the minimal symbol table whenever the variable
  21635. is referenced.
  21636. 'gdb.SYMBOL_LOC_OPTIMIZED_OUT'
  21637. The value does not actually exist in the program.
  21638. 'gdb.SYMBOL_LOC_COMPUTED'
  21639. The value's address is a computed location.
  21640. 'gdb.SYMBOL_LOC_COMPUTED'
  21641. The value's address is a symbol. This is only used for Fortran
  21642. common blocks.
  21643. 
  21644. File: gdb.info, Node: Symbol Tables In Python, Next: Line Tables In Python, Prev: Symbols In Python, Up: Python API
  21645. 23.2.2.28 Symbol table representation in Python
  21646. ...............................................
  21647. Access to symbol table data maintained by GDB on the inferior is exposed
  21648. to Python via two objects: 'gdb.Symtab_and_line' and 'gdb.Symtab'.
  21649. Symbol table and line data for a frame is returned from the 'find_sal'
  21650. method in 'gdb.Frame' object. *Note Frames In Python::.
  21651. For more information on GDB's symbol table management, see *note
  21652. Examining the Symbol Table: Symbols, for more information.
  21653. A 'gdb.Symtab_and_line' object has the following attributes:
  21654. -- Variable: Symtab_and_line.symtab
  21655. The symbol table object ('gdb.Symtab') for this frame. This
  21656. attribute is not writable.
  21657. -- Variable: Symtab_and_line.pc
  21658. Indicates the start of the address range occupied by code for the
  21659. current source line. This attribute is not writable.
  21660. -- Variable: Symtab_and_line.last
  21661. Indicates the end of the address range occupied by code for the
  21662. current source line. This attribute is not writable.
  21663. -- Variable: Symtab_and_line.line
  21664. Indicates the current line number for this object. This attribute
  21665. is not writable.
  21666. A 'gdb.Symtab_and_line' object has the following methods:
  21667. -- Function: Symtab_and_line.is_valid ()
  21668. Returns 'True' if the 'gdb.Symtab_and_line' object is valid,
  21669. 'False' if not. A 'gdb.Symtab_and_line' object can become invalid
  21670. if the Symbol table and line object it refers to does not exist in
  21671. GDB any longer. All other 'gdb.Symtab_and_line' methods will throw
  21672. an exception if it is invalid at the time the method is called.
  21673. A 'gdb.Symtab' object has the following attributes:
  21674. -- Variable: Symtab.filename
  21675. The symbol table's source filename. This attribute is not
  21676. writable.
  21677. -- Variable: Symtab.objfile
  21678. The symbol table's backing object file. *Note Objfiles In
  21679. Python::. This attribute is not writable.
  21680. -- Variable: Symtab.producer
  21681. The name and possibly version number of the program that compiled
  21682. the code in the symbol table. The contents of this string is up to
  21683. the compiler. If no producer information is available then 'None'
  21684. is returned. This attribute is not writable.
  21685. A 'gdb.Symtab' object has the following methods:
  21686. -- Function: Symtab.is_valid ()
  21687. Returns 'True' if the 'gdb.Symtab' object is valid, 'False' if not.
  21688. A 'gdb.Symtab' object can become invalid if the symbol table it
  21689. refers to does not exist in GDB any longer. All other 'gdb.Symtab'
  21690. methods will throw an exception if it is invalid at the time the
  21691. method is called.
  21692. -- Function: Symtab.fullname ()
  21693. Return the symbol table's source absolute file name.
  21694. -- Function: Symtab.global_block ()
  21695. Return the global block of the underlying symbol table. *Note
  21696. Blocks In Python::.
  21697. -- Function: Symtab.static_block ()
  21698. Return the static block of the underlying symbol table. *Note
  21699. Blocks In Python::.
  21700. -- Function: Symtab.linetable ()
  21701. Return the line table associated with the symbol table. *Note Line
  21702. Tables In Python::.
  21703. 
  21704. File: gdb.info, Node: Line Tables In Python, Next: Breakpoints In Python, Prev: Symbol Tables In Python, Up: Python API
  21705. 23.2.2.29 Manipulating line tables using Python
  21706. ...............................................
  21707. Python code can request and inspect line table information from a symbol
  21708. table that is loaded in GDB. A line table is a mapping of source lines
  21709. to their executable locations in memory. To acquire the line table
  21710. information for a particular symbol table, use the 'linetable' function
  21711. (*note Symbol Tables In Python::).
  21712. A 'gdb.LineTable' is iterable. The iterator returns 'LineTableEntry'
  21713. objects that correspond to the source line and address for each line
  21714. table entry. 'LineTableEntry' objects have the following attributes:
  21715. -- Variable: LineTableEntry.line
  21716. The source line number for this line table entry. This number
  21717. corresponds to the actual line of source. This attribute is not
  21718. writable.
  21719. -- Variable: LineTableEntry.pc
  21720. The address that is associated with the line table entry where the
  21721. executable code for that source line resides in memory. This
  21722. attribute is not writable.
  21723. As there can be multiple addresses for a single source line, you may
  21724. receive multiple 'LineTableEntry' objects with matching 'line'
  21725. attributes, but with different 'pc' attributes. The iterator is sorted
  21726. in ascending 'pc' order. Here is a small example illustrating iterating
  21727. over a line table.
  21728. symtab = gdb.selected_frame().find_sal().symtab
  21729. linetable = symtab.linetable()
  21730. for line in linetable:
  21731. print "Line: "+str(line.line)+" Address: "+hex(line.pc)
  21732. This will have the following output:
  21733. Line: 33 Address: 0x4005c8L
  21734. Line: 37 Address: 0x4005caL
  21735. Line: 39 Address: 0x4005d2L
  21736. Line: 40 Address: 0x4005f8L
  21737. Line: 42 Address: 0x4005ffL
  21738. Line: 44 Address: 0x400608L
  21739. Line: 42 Address: 0x40060cL
  21740. Line: 45 Address: 0x400615L
  21741. In addition to being able to iterate over a 'LineTable', it also has
  21742. the following direct access methods:
  21743. -- Function: LineTable.line (line)
  21744. Return a Python 'Tuple' of 'LineTableEntry' objects for any entries
  21745. in the line table for the given LINE, which specifies the source
  21746. code line. If there are no entries for that source code LINE, the
  21747. Python 'None' is returned.
  21748. -- Function: LineTable.has_line (line)
  21749. Return a Python 'Boolean' indicating whether there is an entry in
  21750. the line table for this source line. Return 'True' if an entry is
  21751. found, or 'False' if not.
  21752. -- Function: LineTable.source_lines ()
  21753. Return a Python 'List' of the source line numbers in the symbol
  21754. table. Only lines with executable code locations are returned.
  21755. The contents of the 'List' will just be the source line entries
  21756. represented as Python 'Long' values.
  21757. 
  21758. File: gdb.info, Node: Breakpoints In Python, Next: Finish Breakpoints in Python, Prev: Line Tables In Python, Up: Python API
  21759. 23.2.2.30 Manipulating breakpoints using Python
  21760. ...............................................
  21761. Python code can manipulate breakpoints via the 'gdb.Breakpoint' class.
  21762. A breakpoint can be created using one of the two forms of the
  21763. 'gdb.Breakpoint' constructor. The first one accepts a string like one
  21764. would pass to the 'break' (*note Setting Breakpoints: Set Breaks.) and
  21765. 'watch' (*note Setting Watchpoints: Set Watchpoints.) commands, and can
  21766. be used to create both breakpoints and watchpoints. The second accepts
  21767. separate Python arguments similar to *note Explicit Locations::, and can
  21768. only be used to create breakpoints.
  21769. -- Function: Breakpoint.__init__ (spec [, type ][, wp_class ][,
  21770. internal ][, temporary ][, qualified ])
  21771. Create a new breakpoint according to SPEC, which is a string naming
  21772. the location of a breakpoint, or an expression that defines a
  21773. watchpoint. The string should describe a location in a format
  21774. recognized by the 'break' command (*note Setting Breakpoints: Set
  21775. Breaks.) or, in the case of a watchpoint, by the 'watch' command
  21776. (*note Setting Watchpoints: Set Watchpoints.).
  21777. The optional TYPE argument specifies the type of the breakpoint to
  21778. create, as defined below.
  21779. The optional WP_CLASS argument defines the class of watchpoint to
  21780. create, if TYPE is 'gdb.BP_WATCHPOINT'. If WP_CLASS is omitted, it
  21781. defaults to 'gdb.WP_WRITE'.
  21782. The optional INTERNAL argument allows the breakpoint to become
  21783. invisible to the user. The breakpoint will neither be reported
  21784. when created, nor will it be listed in the output from 'info
  21785. breakpoints' (but will be listed with the 'maint info breakpoints'
  21786. command).
  21787. The optional TEMPORARY argument makes the breakpoint a temporary
  21788. breakpoint. Temporary breakpoints are deleted after they have been
  21789. hit. Any further access to the Python breakpoint after it has been
  21790. hit will result in a runtime error (as that breakpoint has now been
  21791. automatically deleted).
  21792. The optional QUALIFIED argument is a boolean that allows
  21793. interpreting the function passed in 'spec' as a fully-qualified
  21794. name. It is equivalent to 'break''s '-qualified' flag (*note
  21795. Linespec Locations:: and *note Explicit Locations::).
  21796. -- Function: Breakpoint.__init__ ([ source ][, function ][, label ][,
  21797. line ], ][ internal ][, temporary ][, qualified ])
  21798. This second form of creating a new breakpoint specifies the
  21799. explicit location (*note Explicit Locations::) using keywords. The
  21800. new breakpoint will be created in the specified source file SOURCE,
  21801. at the specified FUNCTION, LABEL and LINE.
  21802. INTERNAL, TEMPORARY and QUALIFIED have the same usage as explained
  21803. previously.
  21804. The available types are represented by constants defined in the 'gdb'
  21805. module:
  21806. 'gdb.BP_BREAKPOINT'
  21807. Normal code breakpoint.
  21808. 'gdb.BP_WATCHPOINT'
  21809. Watchpoint breakpoint.
  21810. 'gdb.BP_HARDWARE_WATCHPOINT'
  21811. Hardware assisted watchpoint.
  21812. 'gdb.BP_READ_WATCHPOINT'
  21813. Hardware assisted read watchpoint.
  21814. 'gdb.BP_ACCESS_WATCHPOINT'
  21815. Hardware assisted access watchpoint.
  21816. The available watchpoint types represented by constants are defined
  21817. in the 'gdb' module:
  21818. 'gdb.WP_READ'
  21819. Read only watchpoint.
  21820. 'gdb.WP_WRITE'
  21821. Write only watchpoint.
  21822. 'gdb.WP_ACCESS'
  21823. Read/Write watchpoint.
  21824. -- Function: Breakpoint.stop (self)
  21825. The 'gdb.Breakpoint' class can be sub-classed and, in particular,
  21826. you may choose to implement the 'stop' method. If this method is
  21827. defined in a sub-class of 'gdb.Breakpoint', it will be called when
  21828. the inferior reaches any location of a breakpoint which
  21829. instantiates that sub-class. If the method returns 'True', the
  21830. inferior will be stopped at the location of the breakpoint,
  21831. otherwise the inferior will continue.
  21832. If there are multiple breakpoints at the same location with a
  21833. 'stop' method, each one will be called regardless of the return
  21834. status of the previous. This ensures that all 'stop' methods have
  21835. a chance to execute at that location. In this scenario if one of
  21836. the methods returns 'True' but the others return 'False', the
  21837. inferior will still be stopped.
  21838. You should not alter the execution state of the inferior (i.e.,
  21839. step, next, etc.), alter the current frame context (i.e., change
  21840. the current active frame), or alter, add or delete any breakpoint.
  21841. As a general rule, you should not alter any data within GDB or the
  21842. inferior at this time.
  21843. Example 'stop' implementation:
  21844. class MyBreakpoint (gdb.Breakpoint):
  21845. def stop (self):
  21846. inf_val = gdb.parse_and_eval("foo")
  21847. if inf_val == 3:
  21848. return True
  21849. return False
  21850. -- Function: Breakpoint.is_valid ()
  21851. Return 'True' if this 'Breakpoint' object is valid, 'False'
  21852. otherwise. A 'Breakpoint' object can become invalid if the user
  21853. deletes the breakpoint. In this case, the object still exists, but
  21854. the underlying breakpoint does not. In the cases of watchpoint
  21855. scope, the watchpoint remains valid even if execution of the
  21856. inferior leaves the scope of that watchpoint.
  21857. -- Function: Breakpoint.delete ()
  21858. Permanently deletes the GDB breakpoint. This also invalidates the
  21859. Python 'Breakpoint' object. Any further access to this object's
  21860. attributes or methods will raise an error.
  21861. -- Variable: Breakpoint.enabled
  21862. This attribute is 'True' if the breakpoint is enabled, and 'False'
  21863. otherwise. This attribute is writable. You can use it to enable
  21864. or disable the breakpoint.
  21865. -- Variable: Breakpoint.silent
  21866. This attribute is 'True' if the breakpoint is silent, and 'False'
  21867. otherwise. This attribute is writable.
  21868. Note that a breakpoint can also be silent if it has commands and
  21869. the first command is 'silent'. This is not reported by the
  21870. 'silent' attribute.
  21871. -- Variable: Breakpoint.pending
  21872. This attribute is 'True' if the breakpoint is pending, and 'False'
  21873. otherwise. *Note Set Breaks::. This attribute is read-only.
  21874. -- Variable: Breakpoint.thread
  21875. If the breakpoint is thread-specific, this attribute holds the
  21876. thread's global id. If the breakpoint is not thread-specific, this
  21877. attribute is 'None'. This attribute is writable.
  21878. -- Variable: Breakpoint.task
  21879. If the breakpoint is Ada task-specific, this attribute holds the
  21880. Ada task id. If the breakpoint is not task-specific (or the
  21881. underlying language is not Ada), this attribute is 'None'. This
  21882. attribute is writable.
  21883. -- Variable: Breakpoint.ignore_count
  21884. This attribute holds the ignore count for the breakpoint, an
  21885. integer. This attribute is writable.
  21886. -- Variable: Breakpoint.number
  21887. This attribute holds the breakpoint's number -- the identifier used
  21888. by the user to manipulate the breakpoint. This attribute is not
  21889. writable.
  21890. -- Variable: Breakpoint.type
  21891. This attribute holds the breakpoint's type -- the identifier used
  21892. to determine the actual breakpoint type or use-case. This
  21893. attribute is not writable.
  21894. -- Variable: Breakpoint.visible
  21895. This attribute tells whether the breakpoint is visible to the user
  21896. when set, or when the 'info breakpoints' command is run. This
  21897. attribute is not writable.
  21898. -- Variable: Breakpoint.temporary
  21899. This attribute indicates whether the breakpoint was created as a
  21900. temporary breakpoint. Temporary breakpoints are automatically
  21901. deleted after that breakpoint has been hit. Access to this
  21902. attribute, and all other attributes and functions other than the
  21903. 'is_valid' function, will result in an error after the breakpoint
  21904. has been hit (as it has been automatically deleted). This
  21905. attribute is not writable.
  21906. -- Variable: Breakpoint.hit_count
  21907. This attribute holds the hit count for the breakpoint, an integer.
  21908. This attribute is writable, but currently it can only be set to
  21909. zero.
  21910. -- Variable: Breakpoint.location
  21911. This attribute holds the location of the breakpoint, as specified
  21912. by the user. It is a string. If the breakpoint does not have a
  21913. location (that is, it is a watchpoint) the attribute's value is
  21914. 'None'. This attribute is not writable.
  21915. -- Variable: Breakpoint.expression
  21916. This attribute holds a breakpoint expression, as specified by the
  21917. user. It is a string. If the breakpoint does not have an
  21918. expression (the breakpoint is not a watchpoint) the attribute's
  21919. value is 'None'. This attribute is not writable.
  21920. -- Variable: Breakpoint.condition
  21921. This attribute holds the condition of the breakpoint, as specified
  21922. by the user. It is a string. If there is no condition, this
  21923. attribute's value is 'None'. This attribute is writable.
  21924. -- Variable: Breakpoint.commands
  21925. This attribute holds the commands attached to the breakpoint. If
  21926. there are commands, this attribute's value is a string holding all
  21927. the commands, separated by newlines. If there are no commands,
  21928. this attribute is 'None'. This attribute is writable.
  21929. 
  21930. File: gdb.info, Node: Finish Breakpoints in Python, Next: Lazy Strings In Python, Prev: Breakpoints In Python, Up: Python API
  21931. 23.2.2.31 Finish Breakpoints
  21932. ............................
  21933. A finish breakpoint is a temporary breakpoint set at the return address
  21934. of a frame, based on the 'finish' command. 'gdb.FinishBreakpoint'
  21935. extends 'gdb.Breakpoint'. The underlying breakpoint will be disabled
  21936. and deleted when the execution will run out of the breakpoint scope
  21937. (i.e. 'Breakpoint.stop' or 'FinishBreakpoint.out_of_scope' triggered).
  21938. Finish breakpoints are thread specific and must be create with the right
  21939. thread selected.
  21940. -- Function: FinishBreakpoint.__init__ ([frame] [, internal])
  21941. Create a finish breakpoint at the return address of the 'gdb.Frame'
  21942. object FRAME. If FRAME is not provided, this defaults to the
  21943. newest frame. The optional INTERNAL argument allows the breakpoint
  21944. to become invisible to the user. *Note Breakpoints In Python::,
  21945. for further details about this argument.
  21946. -- Function: FinishBreakpoint.out_of_scope (self)
  21947. In some circumstances (e.g. 'longjmp', C++ exceptions, GDB 'return'
  21948. command, ...), a function may not properly terminate, and thus
  21949. never hit the finish breakpoint. When GDB notices such a
  21950. situation, the 'out_of_scope' callback will be triggered.
  21951. You may want to sub-class 'gdb.FinishBreakpoint' and override this
  21952. method:
  21953. class MyFinishBreakpoint (gdb.FinishBreakpoint)
  21954. def stop (self):
  21955. print "normal finish"
  21956. return True
  21957. def out_of_scope ():
  21958. print "abnormal finish"
  21959. -- Variable: FinishBreakpoint.return_value
  21960. When GDB is stopped at a finish breakpoint and the frame used to
  21961. build the 'gdb.FinishBreakpoint' object had debug symbols, this
  21962. attribute will contain a 'gdb.Value' object corresponding to the
  21963. return value of the function. The value will be 'None' if the
  21964. function return type is 'void' or if the return value was not
  21965. computable. This attribute is not writable.
  21966. 
  21967. File: gdb.info, Node: Lazy Strings In Python, Next: Architectures In Python, Prev: Finish Breakpoints in Python, Up: Python API
  21968. 23.2.2.32 Python representation of lazy strings
  21969. ...............................................
  21970. A "lazy string" is a string whose contents is not retrieved or encoded
  21971. until it is needed.
  21972. A 'gdb.LazyString' is represented in GDB as an 'address' that points
  21973. to a region of memory, an 'encoding' that will be used to encode that
  21974. region of memory, and a 'length' to delimit the region of memory that
  21975. represents the string. The difference between a 'gdb.LazyString' and a
  21976. string wrapped within a 'gdb.Value' is that a 'gdb.LazyString' will be
  21977. treated differently by GDB when printing. A 'gdb.LazyString' is
  21978. retrieved and encoded during printing, while a 'gdb.Value' wrapping a
  21979. string is immediately retrieved and encoded on creation.
  21980. A 'gdb.LazyString' object has the following functions:
  21981. -- Function: LazyString.value ()
  21982. Convert the 'gdb.LazyString' to a 'gdb.Value'. This value will
  21983. point to the string in memory, but will lose all the delayed
  21984. retrieval, encoding and handling that GDB applies to a
  21985. 'gdb.LazyString'.
  21986. -- Variable: LazyString.address
  21987. This attribute holds the address of the string. This attribute is
  21988. not writable.
  21989. -- Variable: LazyString.length
  21990. This attribute holds the length of the string in characters. If
  21991. the length is -1, then the string will be fetched and encoded up to
  21992. the first null of appropriate width. This attribute is not
  21993. writable.
  21994. -- Variable: LazyString.encoding
  21995. This attribute holds the encoding that will be applied to the
  21996. string when the string is printed by GDB. If the encoding is not
  21997. set, or contains an empty string, then GDB will select the most
  21998. appropriate encoding when the string is printed. This attribute is
  21999. not writable.
  22000. -- Variable: LazyString.type
  22001. This attribute holds the type that is represented by the lazy
  22002. string's type. For a lazy string this is a pointer or array type.
  22003. To resolve this to the lazy string's character type, use the type's
  22004. 'target' method. *Note Types In Python::. This attribute is not
  22005. writable.
  22006. 
  22007. File: gdb.info, Node: Architectures In Python, Prev: Lazy Strings In Python, Up: Python API
  22008. 23.2.2.33 Python representation of architectures
  22009. ................................................
  22010. GDB uses architecture specific parameters and artifacts in a number of
  22011. its various computations. An architecture is represented by an instance
  22012. of the 'gdb.Architecture' class.
  22013. A 'gdb.Architecture' class has the following methods:
  22014. -- Function: Architecture.name ()
  22015. Return the name (string value) of the architecture.
  22016. -- Function: Architecture.disassemble (START_PC [, END_PC [, COUNT]])
  22017. Return a list of disassembled instructions starting from the memory
  22018. address START_PC. The optional arguments END_PC and COUNT
  22019. determine the number of instructions in the returned list. If both
  22020. the optional arguments END_PC and COUNT are specified, then a list
  22021. of at most COUNT disassembled instructions whose start address
  22022. falls in the closed memory address interval from START_PC to END_PC
  22023. are returned. If END_PC is not specified, but COUNT is specified,
  22024. then COUNT number of instructions starting from the address
  22025. START_PC are returned. If COUNT is not specified but END_PC is
  22026. specified, then all instructions whose start address falls in the
  22027. closed memory address interval from START_PC to END_PC are
  22028. returned. If neither END_PC nor COUNT are specified, then a single
  22029. instruction at START_PC is returned. For all of these cases, each
  22030. element of the returned list is a Python 'dict' with the following
  22031. string keys:
  22032. 'addr'
  22033. The value corresponding to this key is a Python long integer
  22034. capturing the memory address of the instruction.
  22035. 'asm'
  22036. The value corresponding to this key is a string value which
  22037. represents the instruction with assembly language mnemonics.
  22038. The assembly language flavor used is the same as that
  22039. specified by the current CLI variable 'disassembly-flavor'.
  22040. *Note Machine Code::.
  22041. 'length'
  22042. The value corresponding to this key is the length (integer
  22043. value) of the instruction in bytes.
  22044. 
  22045. File: gdb.info, Node: Python Auto-loading, Next: Python modules, Prev: Python API, Up: Python
  22046. 23.2.3 Python Auto-loading
  22047. --------------------------
  22048. When a new object file is read (for example, due to the 'file' command,
  22049. or because the inferior has loaded a shared library), GDB will look for
  22050. Python support scripts in several ways: 'OBJFILE-gdb.py' and
  22051. '.debug_gdb_scripts' section. *Note Auto-loading extensions::.
  22052. The auto-loading feature is useful for supplying application-specific
  22053. debugging commands and scripts.
  22054. Auto-loading can be enabled or disabled, and the list of auto-loaded
  22055. scripts can be printed.
  22056. 'set auto-load python-scripts [on|off]'
  22057. Enable or disable the auto-loading of Python scripts.
  22058. 'show auto-load python-scripts'
  22059. Show whether auto-loading of Python scripts is enabled or disabled.
  22060. 'info auto-load python-scripts [REGEXP]'
  22061. Print the list of all Python scripts that GDB auto-loaded.
  22062. Also printed is the list of Python scripts that were mentioned in
  22063. the '.debug_gdb_scripts' section and were either not found (*note
  22064. dotdebug_gdb_scripts section::) or were not auto-loaded due to
  22065. 'auto-load safe-path' rejection (*note Auto-loading::). This is
  22066. useful because their names are not printed when GDB tries to load
  22067. them and fails. There may be many of them, and printing an error
  22068. message for each one is problematic.
  22069. If REGEXP is supplied only Python scripts with matching names are
  22070. printed.
  22071. Example:
  22072. (gdb) info auto-load python-scripts
  22073. Loaded Script
  22074. Yes py-section-script.py
  22075. full name: /tmp/py-section-script.py
  22076. No my-foo-pretty-printers.py
  22077. When reading an auto-loaded file or script, GDB sets the "current
  22078. objfile". This is available via the 'gdb.current_objfile' function
  22079. (*note Objfiles In Python::). This can be useful for registering
  22080. objfile-specific pretty-printers and frame-filters.
  22081. 
  22082. File: gdb.info, Node: Python modules, Prev: Python Auto-loading, Up: Python
  22083. 23.2.4 Python modules
  22084. ---------------------
  22085. GDB comes with several modules to assist writing Python code.
  22086. * Menu:
  22087. * gdb.printing:: Building and registering pretty-printers.
  22088. * gdb.types:: Utilities for working with types.
  22089. * gdb.prompt:: Utilities for prompt value substitution.
  22090. 
  22091. File: gdb.info, Node: gdb.printing, Next: gdb.types, Up: Python modules
  22092. 23.2.4.1 gdb.printing
  22093. .....................
  22094. This module provides a collection of utilities for working with
  22095. pretty-printers.
  22096. 'PrettyPrinter (NAME, SUBPRINTERS=None)'
  22097. This class specifies the API that makes 'info pretty-printer',
  22098. 'enable pretty-printer' and 'disable pretty-printer' work.
  22099. Pretty-printers should generally inherit from this class.
  22100. 'SubPrettyPrinter (NAME)'
  22101. For printers that handle multiple types, this class specifies the
  22102. corresponding API for the subprinters.
  22103. 'RegexpCollectionPrettyPrinter (NAME)'
  22104. Utility class for handling multiple printers, all recognized via
  22105. regular expressions. *Note Writing a Pretty-Printer::, for an
  22106. example.
  22107. 'FlagEnumerationPrinter (NAME)'
  22108. A pretty-printer which handles printing of 'enum' values. Unlike
  22109. GDB's built-in 'enum' printing, this printer attempts to work
  22110. properly when there is some overlap between the enumeration
  22111. constants. The argument NAME is the name of the printer and also
  22112. the name of the 'enum' type to look up.
  22113. 'register_pretty_printer (OBJ, PRINTER, REPLACE=False)'
  22114. Register PRINTER with the pretty-printer list of OBJ. If REPLACE
  22115. is 'True' then any existing copy of the printer is replaced.
  22116. Otherwise a 'RuntimeError' exception is raised if a printer with
  22117. the same name already exists.
  22118. 
  22119. File: gdb.info, Node: gdb.types, Next: gdb.prompt, Prev: gdb.printing, Up: Python modules
  22120. 23.2.4.2 gdb.types
  22121. ..................
  22122. This module provides a collection of utilities for working with
  22123. 'gdb.Type' objects.
  22124. 'get_basic_type (TYPE)'
  22125. Return TYPE with const and volatile qualifiers stripped, and with
  22126. typedefs and C++ references converted to the underlying type.
  22127. C++ example:
  22128. typedef const int const_int;
  22129. const_int foo (3);
  22130. const_int& foo_ref (foo);
  22131. int main () { return 0; }
  22132. Then in gdb:
  22133. (gdb) start
  22134. (gdb) python import gdb.types
  22135. (gdb) python foo_ref = gdb.parse_and_eval("foo_ref")
  22136. (gdb) python print gdb.types.get_basic_type(foo_ref.type)
  22137. int
  22138. 'has_field (TYPE, FIELD)'
  22139. Return 'True' if TYPE, assumed to be a type with fields (e.g., a
  22140. structure or union), has field FIELD.
  22141. 'make_enum_dict (ENUM_TYPE)'
  22142. Return a Python 'dictionary' type produced from ENUM_TYPE.
  22143. 'deep_items (TYPE)'
  22144. Returns a Python iterator similar to the standard
  22145. 'gdb.Type.iteritems' method, except that the iterator returned by
  22146. 'deep_items' will recursively traverse anonymous struct or union
  22147. fields. For example:
  22148. struct A
  22149. {
  22150. int a;
  22151. union {
  22152. int b0;
  22153. int b1;
  22154. };
  22155. };
  22156. Then in GDB:
  22157. (gdb) python import gdb.types
  22158. (gdb) python struct_a = gdb.lookup_type("struct A")
  22159. (gdb) python print struct_a.keys ()
  22160. {['a', '']}
  22161. (gdb) python print [k for k,v in gdb.types.deep_items(struct_a)]
  22162. {['a', 'b0', 'b1']}
  22163. 'get_type_recognizers ()'
  22164. Return a list of the enabled type recognizers for the current
  22165. context. This is called by GDB during the type-printing process
  22166. (*note Type Printing API::).
  22167. 'apply_type_recognizers (recognizers, type_obj)'
  22168. Apply the type recognizers, RECOGNIZERS, to the type object
  22169. TYPE_OBJ. If any recognizer returns a string, return that string.
  22170. Otherwise, return 'None'. This is called by GDB during the
  22171. type-printing process (*note Type Printing API::).
  22172. 'register_type_printer (locus, printer)'
  22173. This is a convenience function to register a type printer PRINTER.
  22174. The printer must implement the type printer protocol. The LOCUS
  22175. argument is either a 'gdb.Objfile', in which case the printer is
  22176. registered with that objfile; a 'gdb.Progspace', in which case the
  22177. printer is registered with that progspace; or 'None', in which case
  22178. the printer is registered globally.
  22179. 'TypePrinter'
  22180. This is a base class that implements the type printer protocol.
  22181. Type printers are encouraged, but not required, to derive from this
  22182. class. It defines a constructor:
  22183. -- Method on TypePrinter: __init__ (self, name)
  22184. Initialize the type printer with the given name. The new
  22185. printer starts in the enabled state.
  22186. 
  22187. File: gdb.info, Node: gdb.prompt, Prev: gdb.types, Up: Python modules
  22188. 23.2.4.3 gdb.prompt
  22189. ...................
  22190. This module provides a method for prompt value-substitution.
  22191. 'substitute_prompt (STRING)'
  22192. Return STRING with escape sequences substituted by values. Some
  22193. escape sequences take arguments. You can specify arguments inside
  22194. "{}" immediately following the escape sequence.
  22195. The escape sequences you can pass to this function are:
  22196. '\\'
  22197. Substitute a backslash.
  22198. '\e'
  22199. Substitute an ESC character.
  22200. '\f'
  22201. Substitute the selected frame; an argument names a frame
  22202. parameter.
  22203. '\n'
  22204. Substitute a newline.
  22205. '\p'
  22206. Substitute a parameter's value; the argument names the
  22207. parameter.
  22208. '\r'
  22209. Substitute a carriage return.
  22210. '\t'
  22211. Substitute the selected thread; an argument names a thread
  22212. parameter.
  22213. '\v'
  22214. Substitute the version of GDB.
  22215. '\w'
  22216. Substitute the current working directory.
  22217. '\['
  22218. Begin a sequence of non-printing characters. These sequences
  22219. are typically used with the ESC character, and are not counted
  22220. in the string length. Example: "\[\e[0;34m\](gdb)\[\e[0m\]"
  22221. will return a blue-colored "(gdb)" prompt where the length is
  22222. five.
  22223. '\]'
  22224. End a sequence of non-printing characters.
  22225. For example:
  22226. substitute_prompt ("frame: \f, args: \p{print frame-arguments}")
  22227. will return the string:
  22228. "frame: main, args: scalars"
  22229. 
  22230. File: gdb.info, Node: Guile, Next: Auto-loading extensions, Prev: Python, Up: Extending GDB
  22231. 23.3 Extending GDB using Guile
  22232. ==============================
  22233. You can extend GDB using the Guile implementation of the Scheme
  22234. programming language (http://www.gnu.org/software/guile/). This feature
  22235. is available only if GDB was configured using '--with-guile'.
  22236. * Menu:
  22237. * Guile Introduction:: Introduction to Guile scripting in GDB
  22238. * Guile Commands:: Accessing Guile from GDB
  22239. * Guile API:: Accessing GDB from Guile
  22240. * Guile Auto-loading:: Automatically loading Guile code
  22241. * Guile Modules:: Guile modules provided by GDB
  22242. 
  22243. File: gdb.info, Node: Guile Introduction, Next: Guile Commands, Up: Guile
  22244. 23.3.1 Guile Introduction
  22245. -------------------------
  22246. Guile is an implementation of the Scheme programming language and is the
  22247. GNU project's official extension language.
  22248. Guile support in GDB follows the Python support in GDB reasonably
  22249. closely, so concepts there should carry over. However, some things are
  22250. done differently where it makes sense.
  22251. GDB requires Guile version 2.0 or greater. Older versions are not
  22252. supported.
  22253. Guile scripts used by GDB should be installed in
  22254. 'DATA-DIRECTORY/guile', where DATA-DIRECTORY is the data directory as
  22255. determined at GDB startup (*note Data Files::). This directory, known
  22256. as the "guile directory", is automatically added to the Guile Search
  22257. Path in order to allow the Guile interpreter to locate all scripts
  22258. installed at this location.
  22259. 
  22260. File: gdb.info, Node: Guile Commands, Next: Guile API, Prev: Guile Introduction, Up: Guile
  22261. 23.3.2 Guile Commands
  22262. ---------------------
  22263. GDB provides two commands for accessing the Guile interpreter:
  22264. 'guile-repl'
  22265. 'gr'
  22266. The 'guile-repl' command can be used to start an interactive Guile
  22267. prompt or "repl". To return to GDB, type ',q' or the 'EOF'
  22268. character (e.g., 'Ctrl-D' on an empty prompt). These commands do
  22269. not take any arguments.
  22270. 'guile [SCHEME-EXPRESSION]'
  22271. 'gu [SCHEME-EXPRESSION]'
  22272. The 'guile' command can be used to evaluate a Scheme expression.
  22273. If given an argument, GDB will pass the argument to the Guile
  22274. interpreter for evaluation.
  22275. (gdb) guile (display (+ 20 3)) (newline)
  22276. 23
  22277. The result of the Scheme expression is displayed using normal Guile
  22278. rules.
  22279. (gdb) guile (+ 20 3)
  22280. 23
  22281. If you do not provide an argument to 'guile', it will act as a
  22282. multi-line command, like 'define'. In this case, the Guile script
  22283. is made up of subsequent command lines, given after the 'guile'
  22284. command. This command list is terminated using a line containing
  22285. 'end'. For example:
  22286. (gdb) guile
  22287. >(display 23)
  22288. >(newline)
  22289. >end
  22290. 23
  22291. It is also possible to execute a Guile script from the GDB
  22292. interpreter:
  22293. 'source script-name'
  22294. The script name must end with '.scm' and GDB must be configured to
  22295. recognize the script language based on filename extension using the
  22296. 'script-extension' setting. *Note Extending GDB: Extending GDB.
  22297. 'guile (load "script-name")'
  22298. This method uses the 'load' Guile function. It takes a string
  22299. argument that is the name of the script to load. See the Guile
  22300. documentation for a description of this function. (*note
  22301. (guile)Loading::).
  22302. 
  22303. File: gdb.info, Node: Guile API, Next: Guile Auto-loading, Prev: Guile Commands, Up: Guile
  22304. 23.3.3 Guile API
  22305. ----------------
  22306. You can get quick online help for GDB's Guile API by issuing the command
  22307. 'help guile', or by issuing the command ',help' from an interactive
  22308. Guile session. Furthermore, most Guile procedures provided by GDB have
  22309. doc strings which can be obtained with ',describe PROCEDURE-NAME' or ',d
  22310. PROCEDURE-NAME' from the Guile interactive prompt.
  22311. * Menu:
  22312. * Basic Guile:: Basic Guile Functions
  22313. * Guile Configuration:: Guile configuration variables
  22314. * GDB Scheme Data Types:: Scheme representations of GDB objects
  22315. * Guile Exception Handling:: How Guile exceptions are translated
  22316. * Values From Inferior In Guile:: Guile representation of values
  22317. * Arithmetic In Guile:: Arithmetic in Guile
  22318. * Types In Guile:: Guile representation of types
  22319. * Guile Pretty Printing API:: Pretty-printing values with Guile
  22320. * Selecting Guile Pretty-Printers:: How GDB chooses a pretty-printer
  22321. * Writing a Guile Pretty-Printer:: Writing a pretty-printer
  22322. * Commands In Guile:: Implementing new commands in Guile
  22323. * Parameters In Guile:: Adding new GDB parameters
  22324. * Progspaces In Guile:: Program spaces
  22325. * Objfiles In Guile:: Object files in Guile
  22326. * Frames In Guile:: Accessing inferior stack frames from Guile
  22327. * Blocks In Guile:: Accessing blocks from Guile
  22328. * Symbols In Guile:: Guile representation of symbols
  22329. * Symbol Tables In Guile:: Guile representation of symbol tables
  22330. * Breakpoints In Guile:: Manipulating breakpoints using Guile
  22331. * Lazy Strings In Guile:: Guile representation of lazy strings
  22332. * Architectures In Guile:: Guile representation of architectures
  22333. * Disassembly In Guile:: Disassembling instructions from Guile
  22334. * I/O Ports in Guile:: GDB I/O ports
  22335. * Memory Ports in Guile:: Accessing memory through ports and bytevectors
  22336. * Iterators In Guile:: Basic iterator support
  22337. 
  22338. File: gdb.info, Node: Basic Guile, Next: Guile Configuration, Up: Guile API
  22339. 23.3.3.1 Basic Guile
  22340. ....................
  22341. At startup, GDB overrides Guile's 'current-output-port' and
  22342. 'current-error-port' to print using GDB's output-paging streams. A
  22343. Guile program which outputs to one of these streams may have its output
  22344. interrupted by the user (*note Screen Size::). In this situation, a
  22345. Guile 'signal' exception is thrown with value 'SIGINT'.
  22346. Guile's history mechanism uses the same naming as GDB's, namely the
  22347. user of dollar-variables (e.g., $1, $2, etc.). The results of
  22348. evaluations in Guile and in GDB are counted separately, '$1' in Guile is
  22349. not the same value as '$1' in GDB.
  22350. GDB is not thread-safe. If your Guile program uses multiple threads,
  22351. you must be careful to only call GDB-specific functions in the GDB
  22352. thread.
  22353. Some care must be taken when writing Guile code to run in GDB. Two
  22354. things are worth noting in particular:
  22355. * GDB installs handlers for 'SIGCHLD' and 'SIGINT'. Guile code must
  22356. not override these, or even change the options using 'sigaction'.
  22357. If your program changes the handling of these signals, GDB will
  22358. most likely stop working correctly. Note that it is unfortunately
  22359. common for GUI toolkits to install a 'SIGCHLD' handler.
  22360. * GDB takes care to mark its internal file descriptors as
  22361. close-on-exec. However, this cannot be done in a thread-safe way
  22362. on all platforms. Your Guile programs should be aware of this and
  22363. should both create new file descriptors with the close-on-exec flag
  22364. set and arrange to close unneeded file descriptors before starting
  22365. a child process.
  22366. GDB introduces a new Guile module, named 'gdb'. All methods and
  22367. classes added by GDB are placed in this module. GDB does not
  22368. automatically 'import' the 'gdb' module, scripts must do this
  22369. themselves. There are various options for how to import a module, so
  22370. GDB leaves the choice of how the 'gdb' module is imported to the user.
  22371. To simplify interactive use, it is recommended to add one of the
  22372. following to your ~/.gdbinit.
  22373. guile (use-modules (gdb))
  22374. guile (use-modules ((gdb) #:renamer (symbol-prefix-proc 'gdb:)))
  22375. Which one to choose depends on your preference. The second one adds
  22376. 'gdb:' as a prefix to all module functions and variables.
  22377. The rest of this manual assumes the 'gdb' module has been imported
  22378. without any prefix. See the Guile documentation for 'use-modules' for
  22379. more information (*note (guile)Using Guile Modules::).
  22380. Example:
  22381. (gdb) guile (value-type (make-value 1))
  22382. ERROR: Unbound variable: value-type
  22383. Error while executing Scheme code.
  22384. (gdb) guile (use-modules (gdb))
  22385. (gdb) guile (value-type (make-value 1))
  22386. int
  22387. (gdb)
  22388. The '(gdb)' module provides these basic Guile functions.
  22389. -- Scheme Procedure: execute command [#:from-tty boolean] [#:to-string
  22390. boolean]
  22391. Evaluate COMMAND, a string, as a GDB CLI command. If a GDB
  22392. exception happens while COMMAND runs, it is translated as described
  22393. in *note Guile Exception Handling: Guile Exception Handling.
  22394. FROM-TTY specifies whether GDB ought to consider this command as
  22395. having originated from the user invoking it interactively. It must
  22396. be a boolean value. If omitted, it defaults to '#f'.
  22397. By default, any output produced by COMMAND is sent to GDB's
  22398. standard output (and to the log output if logging is turned on).
  22399. If the TO-STRING parameter is '#t', then output will be collected
  22400. by 'execute' and returned as a string. The default is '#f', in
  22401. which case the return value is unspecified. If TO-STRING is '#t',
  22402. the GDB virtual terminal will be temporarily set to unlimited width
  22403. and height, and its pagination will be disabled; *note Screen
  22404. Size::.
  22405. -- Scheme Procedure: history-ref number
  22406. Return a value from GDB's value history (*note Value History::).
  22407. The NUMBER argument indicates which history element to return. If
  22408. NUMBER is negative, then GDB will take its absolute value and count
  22409. backward from the last element (i.e., the most recent element) to
  22410. find the value to return. If NUMBER is zero, then GDB will return
  22411. the most recent element. If the element specified by NUMBER
  22412. doesn't exist in the value history, a 'gdb:error' exception will be
  22413. raised.
  22414. If no exception is raised, the return value is always an instance
  22415. of '<gdb:value>' (*note Values From Inferior In Guile::).
  22416. _Note:_ GDB's value history is independent of Guile's. '$1' in
  22417. GDB's value history contains the result of evaluating an expression
  22418. from GDB's command line and '$1' from Guile's history contains the
  22419. result of evaluating an expression from Guile's command line.
  22420. -- Scheme Procedure: history-append! value
  22421. Append VALUE, an instance of '<gdb:value>', to GDB's value history.
  22422. Return its index in the history.
  22423. Putting into history values returned by Guile extensions will allow
  22424. the user convenient access to those values via CLI history
  22425. facilities.
  22426. -- Scheme Procedure: parse-and-eval expression
  22427. Parse EXPRESSION as an expression in the current language, evaluate
  22428. it, and return the result as a '<gdb:value>'. The EXPRESSION must
  22429. be a string.
  22430. This function can be useful when implementing a new command (*note
  22431. Commands In Guile::), as it provides a way to parse the command's
  22432. arguments as an expression. It is also is useful when computing
  22433. values. For example, it is the only way to get the value of a
  22434. convenience variable (*note Convenience Vars::) as a '<gdb:value>'.
  22435. 
  22436. File: gdb.info, Node: Guile Configuration, Next: GDB Scheme Data Types, Prev: Basic Guile, Up: Guile API
  22437. 23.3.3.2 Guile Configuration
  22438. ............................
  22439. GDB provides these Scheme functions to access various configuration
  22440. parameters.
  22441. -- Scheme Procedure: data-directory
  22442. Return a string containing GDB's data directory. This directory
  22443. contains GDB's ancillary files.
  22444. -- Scheme Procedure: guile-data-directory
  22445. Return a string containing GDB's Guile data directory. This
  22446. directory contains the Guile modules provided by GDB.
  22447. -- Scheme Procedure: gdb-version
  22448. Return a string containing the GDB version.
  22449. -- Scheme Procedure: host-config
  22450. Return a string containing the host configuration. This is the
  22451. string passed to '--host' when GDB was configured.
  22452. -- Scheme Procedure: target-config
  22453. Return a string containing the target configuration. This is the
  22454. string passed to '--target' when GDB was configured.
  22455. 
  22456. File: gdb.info, Node: GDB Scheme Data Types, Next: Guile Exception Handling, Prev: Guile Configuration, Up: Guile API
  22457. 23.3.3.3 GDB Scheme Data Types
  22458. ..............................
  22459. The values exposed by GDB to Guile are known as "GDB objects". There
  22460. are several kinds of GDB object, and each is disjoint from all other
  22461. types known to Guile.
  22462. -- Scheme Procedure: gdb-object-kind object
  22463. Return the kind of the GDB object, e.g., '<gdb:breakpoint>', as a
  22464. symbol.
  22465. GDB defines the following object types:
  22466. '<gdb:arch>'
  22467. *Note Architectures In Guile::.
  22468. '<gdb:block>'
  22469. *Note Blocks In Guile::.
  22470. '<gdb:block-symbols-iterator>'
  22471. *Note Blocks In Guile::.
  22472. '<gdb:breakpoint>'
  22473. *Note Breakpoints In Guile::.
  22474. '<gdb:command>'
  22475. *Note Commands In Guile::.
  22476. '<gdb:exception>'
  22477. *Note Guile Exception Handling::.
  22478. '<gdb:frame>'
  22479. *Note Frames In Guile::.
  22480. '<gdb:iterator>'
  22481. *Note Iterators In Guile::.
  22482. '<gdb:lazy-string>'
  22483. *Note Lazy Strings In Guile::.
  22484. '<gdb:objfile>'
  22485. *Note Objfiles In Guile::.
  22486. '<gdb:parameter>'
  22487. *Note Parameters In Guile::.
  22488. '<gdb:pretty-printer>'
  22489. *Note Guile Pretty Printing API::.
  22490. '<gdb:pretty-printer-worker>'
  22491. *Note Guile Pretty Printing API::.
  22492. '<gdb:progspace>'
  22493. *Note Progspaces In Guile::.
  22494. '<gdb:symbol>'
  22495. *Note Symbols In Guile::.
  22496. '<gdb:symtab>'
  22497. *Note Symbol Tables In Guile::.
  22498. '<gdb:sal>'
  22499. *Note Symbol Tables In Guile::.
  22500. '<gdb:type>'
  22501. *Note Types In Guile::.
  22502. '<gdb:field>'
  22503. *Note Types In Guile::.
  22504. '<gdb:value>'
  22505. *Note Values From Inferior In Guile::.
  22506. The following GDB objects are managed internally so that the Scheme
  22507. function 'eq?' may be applied to them.
  22508. '<gdb:arch>'
  22509. '<gdb:block>'
  22510. '<gdb:breakpoint>'
  22511. '<gdb:frame>'
  22512. '<gdb:objfile>'
  22513. '<gdb:progspace>'
  22514. '<gdb:symbol>'
  22515. '<gdb:symtab>'
  22516. '<gdb:type>'
  22517. 
  22518. File: gdb.info, Node: Guile Exception Handling, Next: Values From Inferior In Guile, Prev: GDB Scheme Data Types, Up: Guile API
  22519. 23.3.3.4 Guile Exception Handling
  22520. .................................
  22521. When executing the 'guile' command, Guile exceptions uncaught within the
  22522. Guile code are translated to calls to the GDB error-reporting mechanism.
  22523. If the command that called 'guile' does not handle the error, GDB will
  22524. terminate it and report the error according to the setting of the 'guile
  22525. print-stack' parameter.
  22526. The 'guile print-stack' parameter has three settings:
  22527. 'none'
  22528. Nothing is printed.
  22529. 'message'
  22530. An error message is printed containing the Guile exception name,
  22531. the associated value, and the Guile call stack backtrace at the
  22532. point where the exception was raised. Example:
  22533. (gdb) guile (display foo)
  22534. ERROR: In procedure memoize-variable-access!:
  22535. ERROR: Unbound variable: foo
  22536. Error while executing Scheme code.
  22537. 'full'
  22538. In addition to an error message a full backtrace is printed.
  22539. (gdb) set guile print-stack full
  22540. (gdb) guile (display foo)
  22541. Guile Backtrace:
  22542. In ice-9/boot-9.scm:
  22543. 157: 10 [catch #t #<catch-closure 2c76e20> ...]
  22544. In unknown file:
  22545. ?: 9 [apply-smob/1 #<catch-closure 2c76e20>]
  22546. In ice-9/boot-9.scm:
  22547. 157: 8 [catch #t #<catch-closure 2c76d20> ...]
  22548. In unknown file:
  22549. ?: 7 [apply-smob/1 #<catch-closure 2c76d20>]
  22550. ?: 6 [call-with-input-string "(display foo)" ...]
  22551. In ice-9/boot-9.scm:
  22552. 2320: 5 [save-module-excursion #<procedure 2c2dc30 ... ()>]
  22553. In ice-9/eval-string.scm:
  22554. 44: 4 [read-and-eval #<input: string 27cb410> #:lang ...]
  22555. 37: 3 [lp (display foo)]
  22556. In ice-9/eval.scm:
  22557. 387: 2 [eval # ()]
  22558. 393: 1 [eval #<memoized foo> ()]
  22559. In unknown file:
  22560. ?: 0 [memoize-variable-access! #<memoized foo> ...]
  22561. ERROR: In procedure memoize-variable-access!:
  22562. ERROR: Unbound variable: foo
  22563. Error while executing Scheme code.
  22564. GDB errors that happen in GDB commands invoked by Guile code are
  22565. converted to Guile exceptions. The type of the Guile exception depends
  22566. on the error.
  22567. Guile procedures provided by GDB can throw the standard Guile
  22568. exceptions like 'wrong-type-arg' and 'out-of-range'.
  22569. User interrupt (via 'C-c' or by typing 'q' at a pagination prompt) is
  22570. translated to a Guile 'signal' exception with value 'SIGINT'.
  22571. GDB Guile procedures can also throw these exceptions:
  22572. 'gdb:error'
  22573. This exception is a catch-all for errors generated from within GDB.
  22574. 'gdb:invalid-object'
  22575. This exception is thrown when accessing Guile objects that wrap
  22576. underlying GDB objects have become invalid. For example, a
  22577. '<gdb:breakpoint>' object becomes invalid if the user deletes it
  22578. from the command line. The object still exists in Guile, but the
  22579. object it represents is gone. Further operations on this
  22580. breakpoint will throw this exception.
  22581. 'gdb:memory-error'
  22582. This exception is thrown when an operation tried to access invalid
  22583. memory in the inferior.
  22584. 'gdb:pp-type-error'
  22585. This exception is thrown when a Guile pretty-printer passes a bad
  22586. object to GDB.
  22587. The following exception-related procedures are provided by the
  22588. '(gdb)' module.
  22589. -- Scheme Procedure: make-exception key args
  22590. Return a '<gdb:exception>' object given by its KEY and ARGS, which
  22591. are the standard Guile parameters of an exception. See the Guile
  22592. documentation for more information (*note (guile)Exceptions::).
  22593. -- Scheme Procedure: exception? object
  22594. Return '#t' if OBJECT is a '<gdb:exception>' object. Otherwise
  22595. return '#f'.
  22596. -- Scheme Procedure: exception-key exception
  22597. Return the ARGS field of a '<gdb:exception>' object.
  22598. -- Scheme Procedure: exception-args exception
  22599. Return the ARGS field of a '<gdb:exception>' object.
  22600. 
  22601. File: gdb.info, Node: Values From Inferior In Guile, Next: Arithmetic In Guile, Prev: Guile Exception Handling, Up: Guile API
  22602. 23.3.3.5 Values From Inferior In Guile
  22603. ......................................
  22604. GDB provides values it obtains from the inferior program in an object of
  22605. type '<gdb:value>'. GDB uses this object for its internal bookkeeping
  22606. of the inferior's values, and for fetching values when necessary.
  22607. GDB does not memoize '<gdb:value>' objects. 'make-value' always
  22608. returns a fresh object.
  22609. (gdb) guile (eq? (make-value 1) (make-value 1))
  22610. $1 = #f
  22611. (gdb) guile (equal? (make-value 1) (make-value 1))
  22612. $1 = #t
  22613. A '<gdb:value>' that represents a function can be executed via
  22614. inferior function call with 'value-call'. Any arguments provided to the
  22615. call must match the function's prototype, and must be provided in the
  22616. order specified by that prototype.
  22617. For example, 'some-val' is a '<gdb:value>' instance representing a
  22618. function that takes two integers as arguments. To execute this
  22619. function, call it like so:
  22620. (define result (value-call some-val 10 20))
  22621. Any values returned from a function call are '<gdb:value>' objects.
  22622. Note: Unlike Python scripting in GDB, inferior values that are simple
  22623. scalars cannot be used directly in Scheme expressions that are valid for
  22624. the value's data type. For example, '(+ (parse-and-eval "int_variable")
  22625. 2)' does not work. And inferior values that are structures or instances
  22626. of some class cannot be accessed using any special syntax, instead
  22627. 'value-field' must be used.
  22628. The following value-related procedures are provided by the '(gdb)'
  22629. module.
  22630. -- Scheme Procedure: value? object
  22631. Return '#t' if OBJECT is a '<gdb:value>' object. Otherwise return
  22632. '#f'.
  22633. -- Scheme Procedure: make-value value [#:type type]
  22634. Many Scheme values can be converted directly to a '<gdb:value>'
  22635. with this procedure. If TYPE is specified, the result is a value
  22636. of this type, and if VALUE can't be represented with this type an
  22637. exception is thrown. Otherwise the type of the result is
  22638. determined from VALUE as described below.
  22639. *Note Architectures In Guile::, for a list of the builtin types for
  22640. an architecture.
  22641. Here's how Scheme values are converted when TYPE argument to
  22642. 'make-value' is not specified:
  22643. Scheme boolean
  22644. A Scheme boolean is converted the boolean type for the current
  22645. language.
  22646. Scheme integer
  22647. A Scheme integer is converted to the first of a C 'int',
  22648. 'unsigned int', 'long', 'unsigned long', 'long long' or
  22649. 'unsigned long long' type for the current architecture that
  22650. can represent the value.
  22651. If the Scheme integer cannot be represented as a target
  22652. integer an 'out-of-range' exception is thrown.
  22653. Scheme real
  22654. A Scheme real is converted to the C 'double' type for the
  22655. current architecture.
  22656. Scheme string
  22657. A Scheme string is converted to a string in the current target
  22658. language using the current target encoding. Characters that
  22659. cannot be represented in the current target encoding are
  22660. replaced with the corresponding escape sequence. This is
  22661. Guile's 'SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE' conversion
  22662. strategy (*note (guile)Strings::).
  22663. Passing TYPE is not supported in this case, if it is provided
  22664. a 'wrong-type-arg' exception is thrown.
  22665. '<gdb:lazy-string>'
  22666. If VALUE is a '<gdb:lazy-string>' object (*note Lazy Strings
  22667. In Guile::), then the 'lazy-string->value' procedure is
  22668. called, and its result is used.
  22669. Passing TYPE is not supported in this case, if it is provided
  22670. a 'wrong-type-arg' exception is thrown.
  22671. Scheme bytevector
  22672. If VALUE is a Scheme bytevector and TYPE is provided, VALUE
  22673. must be the same size, in bytes, of values of type TYPE, and
  22674. the result is essentially created by using 'memcpy'.
  22675. If VALUE is a Scheme bytevector and TYPE is not provided, the
  22676. result is an array of type 'uint8' of the same length.
  22677. -- Scheme Procedure: value-optimized-out? value
  22678. Return '#t' if the compiler optimized out VALUE, thus it is not
  22679. available for fetching from the inferior. Otherwise return '#f'.
  22680. -- Scheme Procedure: value-address value
  22681. If VALUE is addressable, returns a '<gdb:value>' object
  22682. representing the address. Otherwise, '#f' is returned.
  22683. -- Scheme Procedure: value-type value
  22684. Return the type of VALUE as a '<gdb:type>' object (*note Types In
  22685. Guile::).
  22686. -- Scheme Procedure: value-dynamic-type value
  22687. Return the dynamic type of VALUE. This uses C++ run-time type
  22688. information (RTTI) to determine the dynamic type of the value. If
  22689. the value is of class type, it will return the class in which the
  22690. value is embedded, if any. If the value is of pointer or reference
  22691. to a class type, it will compute the dynamic type of the referenced
  22692. object, and return a pointer or reference to that type,
  22693. respectively. In all other cases, it will return the value's
  22694. static type.
  22695. Note that this feature will only work when debugging a C++ program
  22696. that includes RTTI for the object in question. Otherwise, it will
  22697. just return the static type of the value as in 'ptype foo'. *Note
  22698. ptype: Symbols.
  22699. -- Scheme Procedure: value-cast value type
  22700. Return a new instance of '<gdb:value>' that is the result of
  22701. casting VALUE to the type described by TYPE, which must be a
  22702. '<gdb:type>' object. If the cast cannot be performed for some
  22703. reason, this method throws an exception.
  22704. -- Scheme Procedure: value-dynamic-cast value type
  22705. Like 'value-cast', but works as if the C++ 'dynamic_cast' operator
  22706. were used. Consult a C++ reference for details.
  22707. -- Scheme Procedure: value-reinterpret-cast value type
  22708. Like 'value-cast', but works as if the C++ 'reinterpret_cast'
  22709. operator were used. Consult a C++ reference for details.
  22710. -- Scheme Procedure: value-dereference value
  22711. For pointer data types, this method returns a new '<gdb:value>'
  22712. object whose contents is the object pointed to by VALUE. For
  22713. example, if 'foo' is a C pointer to an 'int', declared in your C
  22714. program as
  22715. int *foo;
  22716. then you can use the corresponding '<gdb:value>' to access what
  22717. 'foo' points to like this:
  22718. (define bar (value-dereference foo))
  22719. The result 'bar' will be a '<gdb:value>' object holding the value
  22720. pointed to by 'foo'.
  22721. A similar function 'value-referenced-value' exists which also
  22722. returns '<gdb:value>' objects corresponding to the values pointed
  22723. to by pointer values (and additionally, values referenced by
  22724. reference values). However, the behavior of 'value-dereference'
  22725. differs from 'value-referenced-value' by the fact that the behavior
  22726. of 'value-dereference' is identical to applying the C unary
  22727. operator '*' on a given value. For example, consider a reference
  22728. to a pointer 'ptrref', declared in your C++ program as
  22729. typedef int *intptr;
  22730. ...
  22731. int val = 10;
  22732. intptr ptr = &val;
  22733. intptr &ptrref = ptr;
  22734. Though 'ptrref' is a reference value, one can apply the method
  22735. 'value-dereference' to the '<gdb:value>' object corresponding to it
  22736. and obtain a '<gdb:value>' which is identical to that corresponding
  22737. to 'val'. However, if you apply the method
  22738. 'value-referenced-value', the result would be a '<gdb:value>'
  22739. object identical to that corresponding to 'ptr'.
  22740. (define scm-ptrref (parse-and-eval "ptrref"))
  22741. (define scm-val (value-dereference scm-ptrref))
  22742. (define scm-ptr (value-referenced-value scm-ptrref))
  22743. The '<gdb:value>' object 'scm-val' is identical to that
  22744. corresponding to 'val', and 'scm-ptr' is identical to that
  22745. corresponding to 'ptr'. In general, 'value-dereference' can be
  22746. applied whenever the C unary operator '*' can be applied to the
  22747. corresponding C value. For those cases where applying both
  22748. 'value-dereference' and 'value-referenced-value' is allowed, the
  22749. results obtained need not be identical (as we have seen in the
  22750. above example). The results are however identical when applied on
  22751. '<gdb:value>' objects corresponding to pointers ('<gdb:value>'
  22752. objects with type code 'TYPE_CODE_PTR') in a C/C++ program.
  22753. -- Scheme Procedure: value-referenced-value value
  22754. For pointer or reference data types, this method returns a new
  22755. '<gdb:value>' object corresponding to the value referenced by the
  22756. pointer/reference value. For pointer data types,
  22757. 'value-dereference' and 'value-referenced-value' produce identical
  22758. results. The difference between these methods is that
  22759. 'value-dereference' cannot get the values referenced by reference
  22760. values. For example, consider a reference to an 'int', declared in
  22761. your C++ program as
  22762. int val = 10;
  22763. int &ref = val;
  22764. then applying 'value-dereference' to the '<gdb:value>' object
  22765. corresponding to 'ref' will result in an error, while applying
  22766. 'value-referenced-value' will result in a '<gdb:value>' object
  22767. identical to that corresponding to 'val'.
  22768. (define scm-ref (parse-and-eval "ref"))
  22769. (define err-ref (value-dereference scm-ref)) ;; error
  22770. (define scm-val (value-referenced-value scm-ref)) ;; ok
  22771. The '<gdb:value>' object 'scm-val' is identical to that
  22772. corresponding to 'val'.
  22773. -- Scheme Procedure: value-field value field-name
  22774. Return field FIELD-NAME from '<gdb:value>' object VALUE.
  22775. -- Scheme Procedure: value-subscript value index
  22776. Return the value of array VALUE at index INDEX. The VALUE argument
  22777. must be a subscriptable '<gdb:value>' object.
  22778. -- Scheme Procedure: value-call value arg-list
  22779. Perform an inferior function call, taking VALUE as a pointer to the
  22780. function to call. Each element of list ARG-LIST must be a
  22781. <gdb:value> object or an object that can be converted to a value.
  22782. The result is the value returned by the function.
  22783. -- Scheme Procedure: value->bool value
  22784. Return the Scheme boolean representing '<gdb:value>' VALUE. The
  22785. value must be "integer like". Pointers are ok.
  22786. -- Scheme Procedure: value->integer
  22787. Return the Scheme integer representing '<gdb:value>' VALUE. The
  22788. value must be "integer like". Pointers are ok.
  22789. -- Scheme Procedure: value->real
  22790. Return the Scheme real number representing '<gdb:value>' VALUE.
  22791. The value must be a number.
  22792. -- Scheme Procedure: value->bytevector
  22793. Return a Scheme bytevector with the raw contents of '<gdb:value>'
  22794. VALUE. No transformation, endian or otherwise, is performed.
  22795. -- Scheme Procedure: value->string value [#:encoding encoding]
  22796. [#:errors errors] [#:length length]
  22797. If VALUE> represents a string, then this method converts the
  22798. contents to a Guile string. Otherwise, this method will throw an
  22799. exception.
  22800. Values are interpreted as strings according to the rules of the
  22801. current language. If the optional length argument is given, the
  22802. string will be converted to that length, and will include any
  22803. embedded zeroes that the string may contain. Otherwise, for
  22804. languages where the string is zero-terminated, the entire string
  22805. will be converted.
  22806. For example, in C-like languages, a value is a string if it is a
  22807. pointer to or an array of characters or ints of type 'wchar_t',
  22808. 'char16_t', or 'char32_t'.
  22809. If the optional ENCODING argument is given, it must be a string
  22810. naming the encoding of the string in the '<gdb:value>', such as
  22811. '"ascii"', '"iso-8859-6"' or '"utf-8"'. It accepts the same
  22812. encodings as the corresponding argument to Guile's
  22813. 'scm_from_stringn' function, and the Guile codec machinery will be
  22814. used to convert the string. If ENCODING is not given, or if
  22815. ENCODING is the empty string, then either the 'target-charset'
  22816. (*note Character Sets::) will be used, or a language-specific
  22817. encoding will be used, if the current language is able to supply
  22818. one.
  22819. The optional ERRORS argument is one of '#f', 'error' or
  22820. 'substitute'. 'error' and 'substitute' must be symbols. If ERRORS
  22821. is not specified, or if its value is '#f', then the default
  22822. conversion strategy is used, which is set with the Scheme function
  22823. 'set-port-conversion-strategy!'. If the value is ''error' then an
  22824. exception is thrown if there is any conversion error. If the value
  22825. is ''substitute' then any conversion error is replaced with
  22826. question marks. *Note (guile)Strings::.
  22827. If the optional LENGTH argument is given, the string will be
  22828. fetched and converted to the given length. The length must be a
  22829. Scheme integer and not a '<gdb:value>' integer.
  22830. -- Scheme Procedure: value->lazy-string value [#:encoding encoding]
  22831. [#:length length]
  22832. If this '<gdb:value>' represents a string, then this method
  22833. converts VALUE to a '<gdb:lazy-string' (*note Lazy Strings In
  22834. Guile::). Otherwise, this method will throw an exception.
  22835. If the optional ENCODING argument is given, it must be a string
  22836. naming the encoding of the '<gdb:lazy-string'. Some examples are:
  22837. '"ascii"', '"iso-8859-6"' or '"utf-8"'. If the ENCODING argument
  22838. is an encoding that GDB does not recognize, GDB will raise an
  22839. error.
  22840. When a lazy string is printed, the GDB encoding machinery is used
  22841. to convert the string during printing. If the optional ENCODING
  22842. argument is not provided, or is an empty string, GDB will
  22843. automatically select the encoding most suitable for the string
  22844. type. For further information on encoding in GDB please see *note
  22845. Character Sets::.
  22846. If the optional LENGTH argument is given, the string will be
  22847. fetched and encoded to the length of characters specified. If the
  22848. LENGTH argument is not provided, the string will be fetched and
  22849. encoded until a null of appropriate width is found. The length
  22850. must be a Scheme integer and not a '<gdb:value>' integer.
  22851. -- Scheme Procedure: value-lazy? value
  22852. Return '#t' if VALUE has not yet been fetched from the inferior.
  22853. Otherwise return '#f'. GDB does not fetch values until necessary,
  22854. for efficiency. For example:
  22855. (define myval (parse-and-eval "somevar"))
  22856. The value of 'somevar' is not fetched at this time. It will be
  22857. fetched when the value is needed, or when the 'fetch-lazy'
  22858. procedure is invoked.
  22859. -- Scheme Procedure: make-lazy-value type address
  22860. Return a '<gdb:value>' that will be lazily fetched from the target.
  22861. The object of type '<gdb:type>' whose value to fetch is specified
  22862. by its TYPE and its target memory ADDRESS, which is a Scheme
  22863. integer.
  22864. -- Scheme Procedure: value-fetch-lazy! value
  22865. If VALUE is a lazy value ('(value-lazy? value)' is '#t'), then the
  22866. value is fetched from the inferior. Any errors that occur in the
  22867. process will produce a Guile exception.
  22868. If VALUE is not a lazy value, this method has no effect.
  22869. The result of this function is unspecified.
  22870. -- Scheme Procedure: value-print value
  22871. Return the string representation (print form) of '<gdb:value>'
  22872. VALUE.
  22873. 
  22874. File: gdb.info, Node: Arithmetic In Guile, Next: Types In Guile, Prev: Values From Inferior In Guile, Up: Guile API
  22875. 23.3.3.6 Arithmetic In Guile
  22876. ............................
  22877. The '(gdb)' module provides several functions for performing arithmetic
  22878. on '<gdb:value>' objects. The arithmetic is performed as if it were
  22879. done by the target, and therefore has target semantics which are not
  22880. necessarily those of Scheme. For example operations work with a fixed
  22881. precision, not the arbitrary precision of Scheme.
  22882. Wherever a function takes an integer or pointer as an operand, GDB
  22883. will convert appropriate Scheme values to perform the operation.
  22884. -- Scheme Procedure: value-add a b
  22885. -- Scheme Procedure: value-sub a b
  22886. -- Scheme Procedure: value-mul a b
  22887. -- Scheme Procedure: value-div a b
  22888. -- Scheme Procedure: value-rem a b
  22889. -- Scheme Procedure: value-mod a b
  22890. -- Scheme Procedure: value-pow a b
  22891. -- Scheme Procedure: value-not a
  22892. -- Scheme Procedure: value-neg a
  22893. -- Scheme Procedure: value-pos a
  22894. -- Scheme Procedure: value-abs a
  22895. -- Scheme Procedure: value-lsh a b
  22896. -- Scheme Procedure: value-rsh a b
  22897. -- Scheme Procedure: value-min a b
  22898. -- Scheme Procedure: value-max a b
  22899. -- Scheme Procedure: value-lognot a
  22900. -- Scheme Procedure: value-logand a b
  22901. -- Scheme Procedure: value-logior a b
  22902. -- Scheme Procedure: value-logxor a b
  22903. -- Scheme Procedure: value=? a b
  22904. -- Scheme Procedure: value<? a b
  22905. -- Scheme Procedure: value<=? a b
  22906. -- Scheme Procedure: value>? a b
  22907. -- Scheme Procedure: value>=? a b
  22908. Scheme does not provide a 'not-equal' function, and thus Guile
  22909. support in GDB does not either.
  22910. 
  22911. File: gdb.info, Node: Types In Guile, Next: Guile Pretty Printing API, Prev: Arithmetic In Guile, Up: Guile API
  22912. 23.3.3.7 Types In Guile
  22913. .......................
  22914. GDB represents types from the inferior in objects of type '<gdb:type>'.
  22915. The following type-related procedures are provided by the '(gdb)'
  22916. module.
  22917. -- Scheme Procedure: type? object
  22918. Return '#t' if OBJECT is an object of type '<gdb:type>'. Otherwise
  22919. return '#f'.
  22920. -- Scheme Procedure: lookup-type name [#:block block]
  22921. This function looks up a type by its NAME, which must be a string.
  22922. If BLOCK is given, it is an object of type '<gdb:block>', and NAME
  22923. is looked up in that scope. Otherwise, it is searched for
  22924. globally.
  22925. Ordinarily, this function will return an instance of '<gdb:type>'.
  22926. If the named type cannot be found, it will throw an exception.
  22927. -- Scheme Procedure: type-code type
  22928. Return the type code of TYPE. The type code will be one of the
  22929. 'TYPE_CODE_' constants defined below.
  22930. -- Scheme Procedure: type-tag type
  22931. Return the tag name of TYPE. The tag name is the name after
  22932. 'struct', 'union', or 'enum' in C and C++; not all languages have
  22933. this concept. If this type has no tag name, then '#f' is returned.
  22934. -- Scheme Procedure: type-name type
  22935. Return the name of TYPE. If this type has no name, then '#f' is
  22936. returned.
  22937. -- Scheme Procedure: type-print-name type
  22938. Return the print name of TYPE. This returns something even for
  22939. anonymous types. For example, for an anonymous C struct '"struct
  22940. {...}"' is returned.
  22941. -- Scheme Procedure: type-sizeof type
  22942. Return the size of this type, in target 'char' units. Usually, a
  22943. target's 'char' type will be an 8-bit byte. However, on some
  22944. unusual platforms, this type may have a different size.
  22945. -- Scheme Procedure: type-strip-typedefs type
  22946. Return a new '<gdb:type>' that represents the real type of TYPE,
  22947. after removing all layers of typedefs.
  22948. -- Scheme Procedure: type-array type n1 [n2]
  22949. Return a new '<gdb:type>' object which represents an array of this
  22950. type. If one argument is given, it is the inclusive upper bound of
  22951. the array; in this case the lower bound is zero. If two arguments
  22952. are given, the first argument is the lower bound of the array, and
  22953. the second argument is the upper bound of the array. An array's
  22954. length must not be negative, but the bounds can be.
  22955. -- Scheme Procedure: type-vector type n1 [n2]
  22956. Return a new '<gdb:type>' object which represents a vector of this
  22957. type. If one argument is given, it is the inclusive upper bound of
  22958. the vector; in this case the lower bound is zero. If two arguments
  22959. are given, the first argument is the lower bound of the vector, and
  22960. the second argument is the upper bound of the vector. A vector's
  22961. length must not be negative, but the bounds can be.
  22962. The difference between an 'array' and a 'vector' is that arrays
  22963. behave like in C: when used in expressions they decay to a pointer
  22964. to the first element whereas vectors are treated as first class
  22965. values.
  22966. -- Scheme Procedure: type-pointer type
  22967. Return a new '<gdb:type>' object which represents a pointer to
  22968. TYPE.
  22969. -- Scheme Procedure: type-range type
  22970. Return a list of two elements: the low bound and high bound of
  22971. TYPE. If TYPE does not have a range, an exception is thrown.
  22972. -- Scheme Procedure: type-reference type
  22973. Return a new '<gdb:type>' object which represents a reference to
  22974. TYPE.
  22975. -- Scheme Procedure: type-target type
  22976. Return a new '<gdb:type>' object which represents the target type
  22977. of TYPE.
  22978. For a pointer type, the target type is the type of the pointed-to
  22979. object. For an array type (meaning C-like arrays), the target type
  22980. is the type of the elements of the array. For a function or method
  22981. type, the target type is the type of the return value. For a
  22982. complex type, the target type is the type of the elements. For a
  22983. typedef, the target type is the aliased type.
  22984. If the type does not have a target, this method will throw an
  22985. exception.
  22986. -- Scheme Procedure: type-const type
  22987. Return a new '<gdb:type>' object which represents a
  22988. 'const'-qualified variant of TYPE.
  22989. -- Scheme Procedure: type-volatile type
  22990. Return a new '<gdb:type>' object which represents a
  22991. 'volatile'-qualified variant of TYPE.
  22992. -- Scheme Procedure: type-unqualified type
  22993. Return a new '<gdb:type>' object which represents an unqualified
  22994. variant of TYPE. That is, the result is neither 'const' nor
  22995. 'volatile'.
  22996. -- Scheme Procedure: type-num-fields
  22997. Return the number of fields of '<gdb:type>' TYPE.
  22998. -- Scheme Procedure: type-fields type
  22999. Return the fields of TYPE as a list. For structure and union
  23000. types, 'fields' has the usual meaning. Range types have two
  23001. fields, the minimum and maximum values. Enum types have one field
  23002. per enum constant. Function and method types have one field per
  23003. parameter. The base types of C++ classes are also represented as
  23004. fields. If the type has no fields, or does not fit into one of
  23005. these categories, an empty list will be returned. *Note Fields of
  23006. a type in Guile::.
  23007. -- Scheme Procedure: make-field-iterator type
  23008. Return the fields of TYPE as a <gdb:iterator> object. *Note
  23009. Iterators In Guile::.
  23010. -- Scheme Procedure: type-field type field-name
  23011. Return field named FIELD-NAME in TYPE. The result is an object of
  23012. type '<gdb:field>'. *Note Fields of a type in Guile::. If the
  23013. type does not have fields, or FIELD-NAME is not a field of TYPE, an
  23014. exception is thrown.
  23015. For example, if 'some-type' is a '<gdb:type>' instance holding a
  23016. structure type, you can access its 'foo' field with:
  23017. (define bar (type-field some-type "foo"))
  23018. 'bar' will be a '<gdb:field>' object.
  23019. -- Scheme Procedure: type-has-field? type name
  23020. Return '#t' if '<gdb:type>' TYPE has field named NAME. Otherwise
  23021. return '#f'.
  23022. Each type has a code, which indicates what category this type falls
  23023. into. The available type categories are represented by constants
  23024. defined in the '(gdb)' module:
  23025. 'TYPE_CODE_PTR'
  23026. The type is a pointer.
  23027. 'TYPE_CODE_ARRAY'
  23028. The type is an array.
  23029. 'TYPE_CODE_STRUCT'
  23030. The type is a structure.
  23031. 'TYPE_CODE_UNION'
  23032. The type is a union.
  23033. 'TYPE_CODE_ENUM'
  23034. The type is an enum.
  23035. 'TYPE_CODE_FLAGS'
  23036. A bit flags type, used for things such as status registers.
  23037. 'TYPE_CODE_FUNC'
  23038. The type is a function.
  23039. 'TYPE_CODE_INT'
  23040. The type is an integer type.
  23041. 'TYPE_CODE_FLT'
  23042. A floating point type.
  23043. 'TYPE_CODE_VOID'
  23044. The special type 'void'.
  23045. 'TYPE_CODE_SET'
  23046. A Pascal set type.
  23047. 'TYPE_CODE_RANGE'
  23048. A range type, that is, an integer type with bounds.
  23049. 'TYPE_CODE_STRING'
  23050. A string type. Note that this is only used for certain languages
  23051. with language-defined string types; C strings are not represented
  23052. this way.
  23053. 'TYPE_CODE_BITSTRING'
  23054. A string of bits. It is deprecated.
  23055. 'TYPE_CODE_ERROR'
  23056. An unknown or erroneous type.
  23057. 'TYPE_CODE_METHOD'
  23058. A method type, as found in C++.
  23059. 'TYPE_CODE_METHODPTR'
  23060. A pointer-to-member-function.
  23061. 'TYPE_CODE_MEMBERPTR'
  23062. A pointer-to-member.
  23063. 'TYPE_CODE_REF'
  23064. A reference type.
  23065. 'TYPE_CODE_CHAR'
  23066. A character type.
  23067. 'TYPE_CODE_BOOL'
  23068. A boolean type.
  23069. 'TYPE_CODE_COMPLEX'
  23070. A complex float type.
  23071. 'TYPE_CODE_TYPEDEF'
  23072. A typedef to some other type.
  23073. 'TYPE_CODE_NAMESPACE'
  23074. A C++ namespace.
  23075. 'TYPE_CODE_DECFLOAT'
  23076. A decimal floating point type.
  23077. 'TYPE_CODE_INTERNAL_FUNCTION'
  23078. A function internal to GDB. This is the type used to represent
  23079. convenience functions (*note Convenience Funs::).
  23080. Further support for types is provided in the '(gdb types)' Guile
  23081. module (*note Guile Types Module::).
  23082. Each field is represented as an object of type '<gdb:field>'.
  23083. The following field-related procedures are provided by the '(gdb)'
  23084. module:
  23085. -- Scheme Procedure: field? object
  23086. Return '#t' if OBJECT is an object of type '<gdb:field>'.
  23087. Otherwise return '#f'.
  23088. -- Scheme Procedure: field-name field
  23089. Return the name of the field, or '#f' for anonymous fields.
  23090. -- Scheme Procedure: field-type field
  23091. Return the type of the field. This is usually an instance of
  23092. '<gdb:type>', but it can be '#f' in some situations.
  23093. -- Scheme Procedure: field-enumval field
  23094. Return the enum value represented by '<gdb:field>' FIELD.
  23095. -- Scheme Procedure: field-bitpos field
  23096. Return the bit position of '<gdb:field>' FIELD. This attribute is
  23097. not available for 'static' fields (as in C++).
  23098. -- Scheme Procedure: field-bitsize field
  23099. If the field is packed, or is a bitfield, return the size of
  23100. '<gdb:field>' FIELD in bits. Otherwise, zero is returned; in which
  23101. case the field's size is given by its type.
  23102. -- Scheme Procedure: field-artificial? field
  23103. Return '#t' if the field is artificial, usually meaning that it was
  23104. provided by the compiler and not the user. Otherwise return '#f'.
  23105. -- Scheme Procedure: field-base-class? field
  23106. Return '#t' if the field represents a base class of a C++
  23107. structure. Otherwise return '#f'.
  23108. 
  23109. File: gdb.info, Node: Guile Pretty Printing API, Next: Selecting Guile Pretty-Printers, Prev: Types In Guile, Up: Guile API
  23110. 23.3.3.8 Guile Pretty Printing API
  23111. ..................................
  23112. An example output is provided (*note Pretty Printing::).
  23113. A pretty-printer is represented by an object of type
  23114. <gdb:pretty-printer>. Pretty-printer objects are created with
  23115. 'make-pretty-printer'.
  23116. The following pretty-printer-related procedures are provided by the
  23117. '(gdb)' module:
  23118. -- Scheme Procedure: make-pretty-printer name lookup-function
  23119. Return a '<gdb:pretty-printer>' object named NAME.
  23120. LOOKUP-FUNCTION is a function of one parameter: the value to be
  23121. printed. If the value is handled by this pretty-printer, then
  23122. LOOKUP-FUNCTION returns an object of type
  23123. <gdb:pretty-printer-worker> to perform the actual pretty-printing.
  23124. Otherwise LOOKUP-FUNCTION returns '#f'.
  23125. -- Scheme Procedure: pretty-printer? object
  23126. Return '#t' if OBJECT is a '<gdb:pretty-printer>' object.
  23127. Otherwise return '#f'.
  23128. -- Scheme Procedure: pretty-printer-enabled? pretty-printer
  23129. Return '#t' if PRETTY-PRINTER is enabled. Otherwise return '#f'.
  23130. -- Scheme Procedure: set-pretty-printer-enabled! pretty-printer flag
  23131. Set the enabled flag of PRETTY-PRINTER to FLAG. The value returned
  23132. is unspecified.
  23133. -- Scheme Procedure: pretty-printers
  23134. Return the list of global pretty-printers.
  23135. -- Scheme Procedure: set-pretty-printers! pretty-printers
  23136. Set the list of global pretty-printers to PRETTY-PRINTERS. The
  23137. value returned is unspecified.
  23138. -- Scheme Procedure: make-pretty-printer-worker display-hint to-string
  23139. children
  23140. Return an object of type '<gdb:pretty-printer-worker>'.
  23141. This function takes three parameters:
  23142. 'display-hint'
  23143. DISPLAY-HINT provides a hint to GDB or GDB front end via MI to
  23144. change the formatting of the value being printed. The value
  23145. must be a string or '#f' (meaning there is no hint). Several
  23146. values for DISPLAY-HINT are predefined by GDB:
  23147. 'array'
  23148. Indicate that the object being printed is "array-like".
  23149. The CLI uses this to respect parameters such as 'set
  23150. print elements' and 'set print array'.
  23151. 'map'
  23152. Indicate that the object being printed is "map-like", and
  23153. that the children of this value can be assumed to
  23154. alternate between keys and values.
  23155. 'string'
  23156. Indicate that the object being printed is "string-like".
  23157. If the printer's 'to-string' function returns a Guile
  23158. string of some kind, then GDB will call its internal
  23159. language-specific string-printing function to format the
  23160. string. For the CLI this means adding quotation marks,
  23161. possibly escaping some characters, respecting 'set print
  23162. elements', and the like.
  23163. 'to-string'
  23164. TO-STRING is either a function of one parameter, the
  23165. '<gdb:pretty-printer-worker>' object, or '#f'.
  23166. When printing from the CLI, if the 'to-string' method exists,
  23167. then GDB will prepend its result to the values returned by
  23168. 'children'. Exactly how this formatting is done is dependent
  23169. on the display hint, and may change as more hints are added.
  23170. Also, depending on the print settings (*note Print
  23171. Settings::), the CLI may print just the result of 'to-string'
  23172. in a stack trace, omitting the result of 'children'.
  23173. If this method returns a string, it is printed verbatim.
  23174. Otherwise, if this method returns an instance of
  23175. '<gdb:value>', then GDB prints this value. This may result in
  23176. a call to another pretty-printer.
  23177. If instead the method returns a Guile value which is
  23178. convertible to a '<gdb:value>', then GDB performs the
  23179. conversion and prints the resulting value. Again, this may
  23180. result in a call to another pretty-printer. Guile scalars
  23181. (integers, floats, and booleans) and strings are convertible
  23182. to '<gdb:value>'; other types are not.
  23183. Finally, if this method returns '#f' then no further
  23184. operations are peformed in this method and nothing is printed.
  23185. If the result is not one of these types, an exception is
  23186. raised.
  23187. TO-STRING may also be '#f' in which case it is left to
  23188. CHILDREN to print the value.
  23189. 'children'
  23190. CHILDREN is either a function of one parameter, the
  23191. '<gdb:pretty-printer-worker>' object, or '#f'.
  23192. GDB will call this function on a pretty-printer to compute the
  23193. children of the pretty-printer's value.
  23194. This function must return a <gdb:iterator> object. Each item
  23195. returned by the iterator must be a tuple holding two elements.
  23196. The first element is the "name" of the child; the second
  23197. element is the child's value. The value can be any Guile
  23198. object which is convertible to a GDB value.
  23199. If CHILDREN is '#f', GDB will act as though the value has no
  23200. children.
  23201. Children may be hidden from display based on the value of 'set
  23202. print max-depth' (*note Print Settings::).
  23203. GDB provides a function which can be used to look up the default
  23204. pretty-printer for a '<gdb:value>':
  23205. -- Scheme Procedure: default-visualizer value
  23206. This function takes a '<gdb:value>' object as an argument. If a
  23207. pretty-printer for this value exists, then it is returned. If no
  23208. such printer exists, then this returns '#f'.
  23209. 
  23210. File: gdb.info, Node: Selecting Guile Pretty-Printers, Next: Writing a Guile Pretty-Printer, Prev: Guile Pretty Printing API, Up: Guile API
  23211. 23.3.3.9 Selecting Guile Pretty-Printers
  23212. ........................................
  23213. There are three sets of pretty-printers that GDB searches:
  23214. * Per-objfile list of pretty-printers (*note Objfiles In Guile::).
  23215. * Per-progspace list of pretty-printers (*note Progspaces In
  23216. Guile::).
  23217. * The global list of pretty-printers (*note Guile Pretty Printing
  23218. API::). These printers are available when debugging any inferior.
  23219. Pretty-printer lookup is done by passing the value to be printed to
  23220. the lookup function of each enabled object in turn. Lookup stops when a
  23221. lookup function returns a non-'#f' value or when the list is exhausted.
  23222. Lookup functions must return either a '<gdb:pretty-printer-worker>'
  23223. object or '#f'. Otherwise an exception is thrown.
  23224. GDB first checks the result of 'objfile-pretty-printers' of each
  23225. '<gdb:objfile>' in the current program space and iteratively calls each
  23226. enabled lookup function in the list for that '<gdb:objfile>' until a
  23227. non-'#f' object is returned. If no pretty-printer is found in the
  23228. objfile lists, GDB then searches the result of
  23229. 'progspace-pretty-printers' of the current program space, calling each
  23230. enabled function until a non-'#f' object is returned. After these lists
  23231. have been exhausted, it tries the global pretty-printers list, obtained
  23232. with 'pretty-printers', again calling each enabled function until a
  23233. non-'#f' object is returned.
  23234. The order in which the objfiles are searched is not specified. For a
  23235. given list, functions are always invoked from the head of the list, and
  23236. iterated over sequentially until the end of the list, or a
  23237. '<gdb:pretty-printer-worker>' object is returned.
  23238. For various reasons a pretty-printer may not work. For example, the
  23239. underlying data structure may have changed and the pretty-printer is out
  23240. of date.
  23241. The consequences of a broken pretty-printer are severe enough that
  23242. GDB provides support for enabling and disabling individual printers.
  23243. For example, if 'print frame-arguments' is on, a backtrace can become
  23244. highly illegible if any argument is printed with a broken printer.
  23245. Pretty-printers are enabled and disabled from Scheme by calling
  23246. 'set-pretty-printer-enabled!'. *Note Guile Pretty Printing API::.
  23247. 
  23248. File: gdb.info, Node: Writing a Guile Pretty-Printer, Next: Commands In Guile, Prev: Selecting Guile Pretty-Printers, Up: Guile API
  23249. 23.3.3.10 Writing a Guile Pretty-Printer
  23250. ........................................
  23251. A pretty-printer consists of two basic parts: a lookup function to
  23252. determine if the type is supported, and the printer itself.
  23253. Here is an example showing how a 'std::string' printer might be
  23254. written. *Note Guile Pretty Printing API::, for details.
  23255. (define (make-my-string-printer value)
  23256. "Print a my::string string"
  23257. (make-pretty-printer-worker
  23258. "string"
  23259. (lambda (printer)
  23260. (value-field value "_data"))
  23261. #f))
  23262. And here is an example showing how a lookup function for the printer
  23263. example above might be written.
  23264. (define (str-lookup-function pretty-printer value)
  23265. (let ((tag (type-tag (value-type value))))
  23266. (and tag
  23267. (string-prefix? "std::string<" tag)
  23268. (make-my-string-printer value))))
  23269. Then to register this printer in the global printer list:
  23270. (append-pretty-printer!
  23271. (make-pretty-printer "my-string" str-lookup-function))
  23272. The example lookup function extracts the value's type, and attempts
  23273. to match it to a type that it can pretty-print. If it is a type the
  23274. printer can pretty-print, it will return a <gdb:pretty-printer-worker>
  23275. object. If not, it returns '#f'.
  23276. We recommend that you put your core pretty-printers into a Guile
  23277. package. If your pretty-printers are for use with a library, we further
  23278. recommend embedding a version number into the package name. This
  23279. practice will enable GDB to load multiple versions of your
  23280. pretty-printers at the same time, because they will have different
  23281. names.
  23282. You should write auto-loaded code (*note Guile Auto-loading::) such
  23283. that it can be evaluated multiple times without changing its meaning.
  23284. An ideal auto-load file will consist solely of 'import's of your printer
  23285. modules, followed by a call to a register pretty-printers with the
  23286. current objfile.
  23287. Taken as a whole, this approach will scale nicely to multiple
  23288. inferiors, each potentially using a different library version.
  23289. Embedding a version number in the Guile package name will ensure that
  23290. GDB is able to load both sets of printers simultaneously. Then, because
  23291. the search for pretty-printers is done by objfile, and because your
  23292. auto-loaded code took care to register your library's printers with a
  23293. specific objfile, GDB will find the correct printers for the specific
  23294. version of the library used by each inferior.
  23295. To continue the 'my::string' example, this code might appear in
  23296. '(my-project my-library v1)':
  23297. (use-modules (gdb))
  23298. (define (register-printers objfile)
  23299. (append-objfile-pretty-printer!
  23300. (make-pretty-printer "my-string" str-lookup-function)))
  23301. And then the corresponding contents of the auto-load file would be:
  23302. (use-modules (gdb) (my-project my-library v1))
  23303. (register-printers (current-objfile))
  23304. The previous example illustrates a basic pretty-printer. There are a
  23305. few things that can be improved on. The printer only handles one type,
  23306. whereas a library typically has several types. One could install a
  23307. lookup function for each desired type in the library, but one could also
  23308. have a single lookup function recognize several types. The latter is
  23309. the conventional way this is handled. If a pretty-printer can handle
  23310. multiple data types, then its "subprinters" are the printers for the
  23311. individual data types.
  23312. The '(gdb printing)' module provides a formal way of solving this
  23313. problem (*note Guile Printing Module::). Here is another example that
  23314. handles multiple types.
  23315. These are the types we are going to pretty-print:
  23316. struct foo { int a, b; };
  23317. struct bar { struct foo x, y; };
  23318. Here are the printers:
  23319. (define (make-foo-printer value)
  23320. "Print a foo object"
  23321. (make-pretty-printer-worker
  23322. "foo"
  23323. (lambda (printer)
  23324. (format #f "a=<~a> b=<~a>"
  23325. (value-field value "a") (value-field value "a")))
  23326. #f))
  23327. (define (make-bar-printer value)
  23328. "Print a bar object"
  23329. (make-pretty-printer-worker
  23330. "foo"
  23331. (lambda (printer)
  23332. (format #f "x=<~a> y=<~a>"
  23333. (value-field value "x") (value-field value "y")))
  23334. #f))
  23335. This example doesn't need a lookup function, that is handled by the
  23336. '(gdb printing)' module. Instead a function is provided to build up the
  23337. object that handles the lookup.
  23338. (use-modules (gdb printing))
  23339. (define (build-pretty-printer)
  23340. (let ((pp (make-pretty-printer-collection "my-library")))
  23341. (pp-collection-add-tag-printer "foo" make-foo-printer)
  23342. (pp-collection-add-tag-printer "bar" make-bar-printer)
  23343. pp))
  23344. And here is the autoload support:
  23345. (use-modules (gdb) (my-library))
  23346. (append-objfile-pretty-printer! (current-objfile) (build-pretty-printer))
  23347. Finally, when this printer is loaded into GDB, here is the
  23348. corresponding output of 'info pretty-printer':
  23349. (gdb) info pretty-printer
  23350. my_library.so:
  23351. my-library
  23352. foo
  23353. bar
  23354. 
  23355. File: gdb.info, Node: Commands In Guile, Next: Parameters In Guile, Prev: Writing a Guile Pretty-Printer, Up: Guile API
  23356. 23.3.3.11 Commands In Guile
  23357. ...........................
  23358. You can implement new GDB CLI commands in Guile. A CLI command object
  23359. is created with the 'make-command' Guile function, and added to GDB with
  23360. the 'register-command!' Guile function. This two-step approach is taken
  23361. to separate out the side-effect of adding the command to GDB from
  23362. 'make-command'.
  23363. There is no support for multi-line commands, that is commands that
  23364. consist of multiple lines and are terminated with 'end'.
  23365. -- Scheme Procedure: (make-command name [#:invoke invoke]
  23366. [#:command-class command-class] [#:completer-class completer]
  23367. [#:prefix? prefix] [#:doc doc-string])
  23368. The argument NAME is the name of the command. If NAME consists of
  23369. multiple words, then the initial words are looked for as prefix
  23370. commands. In this case, if one of the prefix commands does not
  23371. exist, an exception is raised.
  23372. The result is the '<gdb:command>' object representing the command.
  23373. The command is not usable until it has been registered with GDB
  23374. with 'register-command!'.
  23375. The rest of the arguments are optional.
  23376. The argument INVOKE is a procedure of three arguments: SELF, ARGS
  23377. and FROM-TTY. The argument SELF is the '<gdb:command>' object
  23378. representing the command. The argument ARGS is a string
  23379. representing the arguments passed to the command, after leading and
  23380. trailing whitespace has been stripped. The argument FROM-TTY is a
  23381. boolean flag and specifies whether the command should consider
  23382. itself to have been originated from the user invoking it
  23383. interactively. If this function throws an exception, it is turned
  23384. into a GDB 'error' call. Otherwise, the return value is ignored.
  23385. The argument COMMAND-CLASS is one of the 'COMMAND_' constants
  23386. defined below. This argument tells GDB how to categorize the new
  23387. command in the help system. The default is 'COMMAND_NONE'.
  23388. The argument COMPLETER is either '#f', one of the 'COMPLETE_'
  23389. constants defined below, or a procedure, also defined below. This
  23390. argument tells GDB how to perform completion for this command. If
  23391. not provided or if the value is '#f', then no completion is
  23392. performed on the command.
  23393. The argument PREFIX is a boolean flag indicating whether the new
  23394. command is a prefix command; sub-commands of this command may be
  23395. registered.
  23396. The argument DOC-STRING is help text for the new command. If no
  23397. documentation string is provided, the default value "This command
  23398. is not documented." is used.
  23399. -- Scheme Procedure: register-command! command
  23400. Add COMMAND, a '<gdb:command>' object, to GDB's list of commands.
  23401. It is an error to register a command more than once. The result is
  23402. unspecified.
  23403. -- Scheme Procedure: command? object
  23404. Return '#t' if OBJECT is a '<gdb:command>' object. Otherwise
  23405. return '#f'.
  23406. -- Scheme Procedure: dont-repeat
  23407. By default, a GDB command is repeated when the user enters a blank
  23408. line at the command prompt. A command can suppress this behavior
  23409. by invoking the 'dont-repeat' function. This is similar to the
  23410. user command 'dont-repeat', see *note dont-repeat: Define.
  23411. -- Scheme Procedure: string->argv string
  23412. Convert a string to a list of strings split up according to GDB's
  23413. argv parsing rules. It is recommended to use this for consistency.
  23414. Arguments are separated by spaces and may be quoted. Example:
  23415. scheme@(guile-user)> (string->argv "1 2\\ \\\"3 '4 \"5' \"6 '7\"")
  23416. $1 = ("1" "2 \"3" "4 \"5" "6 '7")
  23417. -- Scheme Procedure: throw-user-error message . args
  23418. Throw a 'gdb:user-error' exception. The argument MESSAGE is the
  23419. error message as a format string, like the FMT argument to the
  23420. 'format' Scheme function. *Note (guile)Formatted Output::. The
  23421. argument ARGS is a list of the optional arguments of MESSAGE.
  23422. This is used when the command detects a user error of some kind,
  23423. say a bad command argument.
  23424. (gdb) guile (use-modules (gdb))
  23425. (gdb) guile
  23426. (register-command! (make-command "test-user-error"
  23427. #:command-class COMMAND_OBSCURE
  23428. #:invoke (lambda (self arg from-tty)
  23429. (throw-user-error "Bad argument ~a" arg))))
  23430. end
  23431. (gdb) test-user-error ugh
  23432. ERROR: Bad argument ugh
  23433. -- completer: self text word
  23434. If the COMPLETER option to 'make-command' is a procedure, it takes
  23435. three arguments: SELF which is the '<gdb:command>' object, and TEXT
  23436. and WORD which are both strings. The argument TEXT holds the
  23437. complete command line up to the cursor's location. The argument
  23438. WORD holds the last word of the command line; this is computed
  23439. using a word-breaking heuristic.
  23440. All forms of completion are handled by this function, that is, the
  23441. <TAB> and <M-?> key bindings (*note Completion::), and the
  23442. 'complete' command (*note complete: Help.).
  23443. This procedure can return several kinds of values:
  23444. * If the return value is a list, the contents of the list are
  23445. used as the completions. It is up to COMPLETER to ensure that
  23446. the contents actually do complete the word. An empty list is
  23447. allowed, it means that there were no completions available.
  23448. Only string elements of the list are used; other elements in
  23449. the list are ignored.
  23450. * If the return value is a '<gdb:iterator>' object, it is
  23451. iterated over to obtain the completions. It is up to
  23452. 'completer-procedure' to ensure that the results actually do
  23453. complete the word. Only string elements of the result are
  23454. used; other elements in the sequence are ignored.
  23455. * All other results are treated as though there were no
  23456. available completions.
  23457. When a new command is registered, it will have been declared as a
  23458. member of some general class of commands. This is used to classify
  23459. top-level commands in the on-line help system; note that prefix commands
  23460. are not listed under their own category but rather that of their
  23461. top-level command. The available classifications are represented by
  23462. constants defined in the 'gdb' module:
  23463. 'COMMAND_NONE'
  23464. The command does not belong to any particular class. A command in
  23465. this category will not be displayed in any of the help categories.
  23466. This is the default.
  23467. 'COMMAND_RUNNING'
  23468. The command is related to running the inferior. For example,
  23469. 'start', 'step', and 'continue' are in this category. Type 'help
  23470. running' at the GDB prompt to see a list of commands in this
  23471. category.
  23472. 'COMMAND_DATA'
  23473. The command is related to data or variables. For example, 'call',
  23474. 'find', and 'print' are in this category. Type 'help data' at the
  23475. GDB prompt to see a list of commands in this category.
  23476. 'COMMAND_STACK'
  23477. The command has to do with manipulation of the stack. For example,
  23478. 'backtrace', 'frame', and 'return' are in this category. Type
  23479. 'help stack' at the GDB prompt to see a list of commands in this
  23480. category.
  23481. 'COMMAND_FILES'
  23482. This class is used for file-related commands. For example, 'file',
  23483. 'list' and 'section' are in this category. Type 'help files' at
  23484. the GDB prompt to see a list of commands in this category.
  23485. 'COMMAND_SUPPORT'
  23486. This should be used for "support facilities", generally meaning
  23487. things that are useful to the user when interacting with GDB, but
  23488. not related to the state of the inferior. For example, 'help',
  23489. 'make', and 'shell' are in this category. Type 'help support' at
  23490. the GDB prompt to see a list of commands in this category.
  23491. 'COMMAND_STATUS'
  23492. The command is an 'info'-related command, that is, related to the
  23493. state of GDB itself. For example, 'info', 'macro', and 'show' are
  23494. in this category. Type 'help status' at the GDB prompt to see a
  23495. list of commands in this category.
  23496. 'COMMAND_BREAKPOINTS'
  23497. The command has to do with breakpoints. For example, 'break',
  23498. 'clear', and 'delete' are in this category. Type 'help
  23499. breakpoints' at the GDB prompt to see a list of commands in this
  23500. category.
  23501. 'COMMAND_TRACEPOINTS'
  23502. The command has to do with tracepoints. For example, 'trace',
  23503. 'actions', and 'tfind' are in this category. Type 'help
  23504. tracepoints' at the GDB prompt to see a list of commands in this
  23505. category.
  23506. 'COMMAND_USER'
  23507. The command is a general purpose command for the user, and
  23508. typically does not fit in one of the other categories. Type 'help
  23509. user-defined' at the GDB prompt to see a list of commands in this
  23510. category, as well as the list of gdb macros (*note Sequences::).
  23511. 'COMMAND_OBSCURE'
  23512. The command is only used in unusual circumstances, or is not of
  23513. general interest to users. For example, 'checkpoint', 'fork', and
  23514. 'stop' are in this category. Type 'help obscure' at the GDB prompt
  23515. to see a list of commands in this category.
  23516. 'COMMAND_MAINTENANCE'
  23517. The command is only useful to GDB maintainers. The 'maintenance'
  23518. and 'flushregs' commands are in this category. Type 'help
  23519. internals' at the GDB prompt to see a list of commands in this
  23520. category.
  23521. A new command can use a predefined completion function, either by
  23522. specifying it via an argument at initialization, or by returning it from
  23523. the 'completer' procedure. These predefined completion constants are
  23524. all defined in the 'gdb' module:
  23525. 'COMPLETE_NONE'
  23526. This constant means that no completion should be done.
  23527. 'COMPLETE_FILENAME'
  23528. This constant means that filename completion should be performed.
  23529. 'COMPLETE_LOCATION'
  23530. This constant means that location completion should be done. *Note
  23531. Specify Location::.
  23532. 'COMPLETE_COMMAND'
  23533. This constant means that completion should examine GDB command
  23534. names.
  23535. 'COMPLETE_SYMBOL'
  23536. This constant means that completion should be done using symbol
  23537. names as the source.
  23538. 'COMPLETE_EXPRESSION'
  23539. This constant means that completion should be done on expressions.
  23540. Often this means completing on symbol names, but some language
  23541. parsers also have support for completing on field names.
  23542. The following code snippet shows how a trivial CLI command can be
  23543. implemented in Guile:
  23544. (gdb) guile
  23545. (register-command! (make-command "hello-world"
  23546. #:command-class COMMAND_USER
  23547. #:doc "Greet the whole world."
  23548. #:invoke (lambda (self args from-tty) (display "Hello, World!\n"))))
  23549. end
  23550. (gdb) hello-world
  23551. Hello, World!
  23552. 
  23553. File: gdb.info, Node: Parameters In Guile, Next: Progspaces In Guile, Prev: Commands In Guile, Up: Guile API
  23554. 23.3.3.12 Parameters In Guile
  23555. .............................
  23556. You can implement new GDB "parameters" using Guile (1).
  23557. There are many parameters that already exist and can be set in GDB.
  23558. Two examples are: 'set follow-fork' and 'set charset'. Setting these
  23559. parameters influences certain behavior in GDB. Similarly, you can
  23560. define parameters that can be used to influence behavior in custom Guile
  23561. scripts and commands.
  23562. A new parameter is defined with the 'make-parameter' Guile function,
  23563. and added to GDB with the 'register-parameter!' Guile function. This
  23564. two-step approach is taken to separate out the side-effect of adding the
  23565. parameter to GDB from 'make-parameter'.
  23566. Parameters are exposed to the user via the 'set' and 'show' commands.
  23567. *Note Help::.
  23568. -- Scheme Procedure: (make-parameter name [#:command-class
  23569. command-class] [#:parameter-type parameter-type] [#:enum-list
  23570. enum-list] [#:set-func set-func] [#:show-func show-func]
  23571. [#:doc doc] [#:set-doc set-doc] [#:show-doc show-doc]
  23572. [#:initial-value initial-value])
  23573. The argument NAME is the name of the new parameter. If NAME
  23574. consists of multiple words, then the initial words are looked for
  23575. as prefix parameters. An example of this can be illustrated with
  23576. the 'set print' set of parameters. If NAME is 'print foo', then
  23577. 'print' will be searched as the prefix parameter. In this case the
  23578. parameter can subsequently be accessed in GDB as 'set print foo'.
  23579. If NAME consists of multiple words, and no prefix parameter group
  23580. can be found, an exception is raised.
  23581. The result is the '<gdb:parameter>' object representing the
  23582. parameter. The parameter is not usable until it has been
  23583. registered with GDB with 'register-parameter!'.
  23584. The rest of the arguments are optional.
  23585. The argument COMMAND-CLASS should be one of the 'COMMAND_'
  23586. constants (*note Commands In Guile::). This argument tells GDB how
  23587. to categorize the new parameter in the help system. The default is
  23588. 'COMMAND_NONE'.
  23589. The argument PARAMETER-TYPE should be one of the 'PARAM_' constants
  23590. defined below. This argument tells GDB the type of the new
  23591. parameter; this information is used for input validation and
  23592. completion. The default is 'PARAM_BOOLEAN'.
  23593. If PARAMETER-TYPE is 'PARAM_ENUM', then ENUM-LIST must be a list of
  23594. strings. These strings represent the possible values for the
  23595. parameter.
  23596. If PARAMETER-TYPE is not 'PARAM_ENUM', then the presence of
  23597. ENUM-LIST will cause an exception to be thrown.
  23598. The argument SET-FUNC is a function of one argument: SELF which is
  23599. the '<gdb:parameter>' object representing the parameter. GDB will
  23600. call this function when a PARAMETER's value has been changed via
  23601. the 'set' API (for example, 'set foo off'). The value of the
  23602. parameter has already been set to the new value. This function
  23603. must return a string to be displayed to the user. GDB will add a
  23604. trailing newline if the string is non-empty. GDB generally doesn't
  23605. print anything when a parameter is set, thus typically this
  23606. function should return '""'. A non-empty string result should
  23607. typically be used for displaying warnings and errors.
  23608. The argument SHOW-FUNC is a function of two arguments: SELF which
  23609. is the '<gdb:parameter>' object representing the parameter, and
  23610. SVALUE which is the string representation of the current value.
  23611. GDB will call this function when a PARAMETER's 'show' API has been
  23612. invoked (for example, 'show foo'). This function must return a
  23613. string, and will be displayed to the user. GDB will add a trailing
  23614. newline.
  23615. The argument DOC is the help text for the new parameter. If there
  23616. is no documentation string, a default value is used.
  23617. The argument SET-DOC is the help text for this parameter's 'set'
  23618. command.
  23619. The argument SHOW-DOC is the help text for this parameter's 'show'
  23620. command.
  23621. The argument INITIAL-VALUE specifies the initial value of the
  23622. parameter. If it is a function, it takes one parameter, the
  23623. '<gdb:parameter>' object and its result is used as the initial
  23624. value of the parameter. The initial value must be valid for the
  23625. parameter type, otherwise an exception is thrown.
  23626. -- Scheme Procedure: register-parameter! parameter
  23627. Add PARAMETER, a '<gdb:parameter>' object, to GDB's list of
  23628. parameters. It is an error to register a parameter more than once.
  23629. The result is unspecified.
  23630. -- Scheme Procedure: parameter? object
  23631. Return '#t' if OBJECT is a '<gdb:parameter>' object. Otherwise
  23632. return '#f'.
  23633. -- Scheme Procedure: parameter-value parameter
  23634. Return the value of PARAMETER which may either be a
  23635. '<gdb:parameter>' object or a string naming the parameter.
  23636. -- Scheme Procedure: set-parameter-value! parameter new-value
  23637. Assign PARAMETER the value of NEW-VALUE. The argument PARAMETER
  23638. must be an object of type '<gdb:parameter>'. GDB does validation
  23639. when assignments are made.
  23640. When a new parameter is defined, its type must be specified. The
  23641. available types are represented by constants defined in the 'gdb'
  23642. module:
  23643. 'PARAM_BOOLEAN'
  23644. The value is a plain boolean. The Guile boolean values, '#t' and
  23645. '#f' are the only valid values.
  23646. 'PARAM_AUTO_BOOLEAN'
  23647. The value has three possible states: true, false, and 'auto'. In
  23648. Guile, true and false are represented using boolean constants, and
  23649. 'auto' is represented using '#:auto'.
  23650. 'PARAM_UINTEGER'
  23651. The value is an unsigned integer. The value of 0 should be
  23652. interpreted to mean "unlimited".
  23653. 'PARAM_ZINTEGER'
  23654. The value is an integer.
  23655. 'PARAM_ZUINTEGER'
  23656. The value is an unsigned integer.
  23657. 'PARAM_ZUINTEGER_UNLIMITED'
  23658. The value is an integer in the range '[0, INT_MAX]'. A value of
  23659. '-1' means "unlimited", and other negative numbers are not allowed.
  23660. 'PARAM_STRING'
  23661. The value is a string. When the user modifies the string, any
  23662. escape sequences, such as '\t', '\f', and octal escapes, are
  23663. translated into corresponding characters and encoded into the
  23664. current host charset.
  23665. 'PARAM_STRING_NOESCAPE'
  23666. The value is a string. When the user modifies the string, escapes
  23667. are passed through untranslated.
  23668. 'PARAM_OPTIONAL_FILENAME'
  23669. The value is a either a filename (a string), or '#f'.
  23670. 'PARAM_FILENAME'
  23671. The value is a filename. This is just like
  23672. 'PARAM_STRING_NOESCAPE', but uses file names for completion.
  23673. 'PARAM_ENUM'
  23674. The value is a string, which must be one of a collection of string
  23675. constants provided when the parameter is created.
  23676. ---------- Footnotes ----------
  23677. (1) Note that GDB parameters must not be confused with Guile’s
  23678. parameter objects (*note (guile)Parameters::).
  23679. 
  23680. File: gdb.info, Node: Progspaces In Guile, Next: Objfiles In Guile, Prev: Parameters In Guile, Up: Guile API
  23681. 23.3.3.13 Program Spaces In Guile
  23682. .................................
  23683. A program space, or "progspace", represents a symbolic view of an
  23684. address space. It consists of all of the objfiles of the program.
  23685. *Note Objfiles In Guile::. *Note program spaces: Inferiors and
  23686. Programs, for more details about program spaces.
  23687. Each progspace is represented by an instance of the '<gdb:progspace>'
  23688. smob. *Note GDB Scheme Data Types::.
  23689. The following progspace-related functions are available in the
  23690. '(gdb)' module:
  23691. -- Scheme Procedure: progspace? object
  23692. Return '#t' if OBJECT is a '<gdb:progspace>' object. Otherwise
  23693. return '#f'.
  23694. -- Scheme Procedure: progspace-valid? progspace
  23695. Return '#t' if PROGSPACE is valid, '#f' if not. A
  23696. '<gdb:progspace>' object can become invalid if the program it
  23697. refers to is not loaded in GDB any longer.
  23698. -- Scheme Procedure: current-progspace
  23699. This function returns the program space of the currently selected
  23700. inferior. There is always a current progspace, this never returns
  23701. '#f'. *Note Inferiors and Programs::.
  23702. -- Scheme Procedure: progspaces
  23703. Return a list of all the progspaces currently known to GDB.
  23704. -- Scheme Procedure: progspace-filename progspace
  23705. Return the absolute file name of PROGSPACE as a string. This is
  23706. the name of the file passed as the argument to the 'file' or
  23707. 'symbol-file' commands. If the program space does not have an
  23708. associated file name, then '#f' is returned. This occurs, for
  23709. example, when GDB is started without a program to debug.
  23710. A 'gdb:invalid-object-error' exception is thrown if PROGSPACE is
  23711. invalid.
  23712. -- Scheme Procedure: progspace-objfiles progspace
  23713. Return the list of objfiles of PROGSPACE. The order of objfiles in
  23714. the result is arbitrary. Each element is an object of type
  23715. '<gdb:objfile>'. *Note Objfiles In Guile::.
  23716. A 'gdb:invalid-object-error' exception is thrown if PROGSPACE is
  23717. invalid.
  23718. -- Scheme Procedure: progspace-pretty-printers progspace
  23719. Return the list of pretty-printers of PROGSPACE. Each element is
  23720. an object of type '<gdb:pretty-printer>'. *Note Guile Pretty
  23721. Printing API::, for more information.
  23722. -- Scheme Procedure: set-progspace-pretty-printers! progspace
  23723. printer-list
  23724. Set the list of registered '<gdb:pretty-printer>' objects for
  23725. PROGSPACE to PRINTER-LIST. *Note Guile Pretty Printing API::, for
  23726. more information.
  23727. 
  23728. File: gdb.info, Node: Objfiles In Guile, Next: Frames In Guile, Prev: Progspaces In Guile, Up: Guile API
  23729. 23.3.3.14 Objfiles In Guile
  23730. ...........................
  23731. GDB loads symbols for an inferior from various symbol-containing files
  23732. (*note Files::). These include the primary executable file, any shared
  23733. libraries used by the inferior, and any separate debug info files (*note
  23734. Separate Debug Files::). GDB calls these symbol-containing files
  23735. "objfiles".
  23736. Each objfile is represented as an object of type '<gdb:objfile>'.
  23737. The following objfile-related procedures are provided by the '(gdb)'
  23738. module:
  23739. -- Scheme Procedure: objfile? object
  23740. Return '#t' if OBJECT is a '<gdb:objfile>' object. Otherwise
  23741. return '#f'.
  23742. -- Scheme Procedure: objfile-valid? objfile
  23743. Return '#t' if OBJFILE is valid, '#f' if not. A '<gdb:objfile>'
  23744. object can become invalid if the object file it refers to is not
  23745. loaded in GDB any longer. All other '<gdb:objfile>' procedures
  23746. will throw an exception if it is invalid at the time the procedure
  23747. is called.
  23748. -- Scheme Procedure: objfile-filename objfile
  23749. Return the file name of OBJFILE as a string, with symbolic links
  23750. resolved.
  23751. -- Scheme Procedure: objfile-progspace objfile
  23752. Return the '<gdb:progspace>' that this object file lives in. *Note
  23753. Progspaces In Guile::, for more on progspaces.
  23754. -- Scheme Procedure: objfile-pretty-printers objfile
  23755. Return the list of registered '<gdb:pretty-printer>' objects for
  23756. OBJFILE. *Note Guile Pretty Printing API::, for more information.
  23757. -- Scheme Procedure: set-objfile-pretty-printers! objfile printer-list
  23758. Set the list of registered '<gdb:pretty-printer>' objects for
  23759. OBJFILE to PRINTER-LIST. The PRINTER-LIST must be a list of
  23760. '<gdb:pretty-printer>' objects. *Note Guile Pretty Printing API::,
  23761. for more information.
  23762. -- Scheme Procedure: current-objfile
  23763. When auto-loading a Guile script (*note Guile Auto-loading::), GDB
  23764. sets the "current objfile" to the corresponding objfile. This
  23765. function returns the current objfile. If there is no current
  23766. objfile, this function returns '#f'.
  23767. -- Scheme Procedure: objfiles
  23768. Return a list of all the objfiles in the current program space.
  23769. 
  23770. File: gdb.info, Node: Frames In Guile, Next: Blocks In Guile, Prev: Objfiles In Guile, Up: Guile API
  23771. 23.3.3.15 Accessing inferior stack frames from Guile.
  23772. .....................................................
  23773. When the debugged program stops, GDB is able to analyze its call stack
  23774. (*note Stack frames: Frames.). The '<gdb:frame>' class represents a
  23775. frame in the stack. A '<gdb:frame>' object is only valid while its
  23776. corresponding frame exists in the inferior's stack. If you try to use
  23777. an invalid frame object, GDB will throw a 'gdb:invalid-object' exception
  23778. (*note Guile Exception Handling::).
  23779. Two '<gdb:frame>' objects can be compared for equality with the
  23780. 'equal?' function, like:
  23781. (gdb) guile (equal? (newest-frame) (selected-frame))
  23782. #t
  23783. The following frame-related procedures are provided by the '(gdb)'
  23784. module:
  23785. -- Scheme Procedure: frame? object
  23786. Return '#t' if OBJECT is a '<gdb:frame>' object. Otherwise return
  23787. '#f'.
  23788. -- Scheme Procedure: frame-valid? frame
  23789. Returns '#t' if FRAME is valid, '#f' if not. A frame object can
  23790. become invalid if the frame it refers to doesn't exist anymore in
  23791. the inferior. All '<gdb:frame>' procedures will throw an exception
  23792. if the frame is invalid at the time the procedure is called.
  23793. -- Scheme Procedure: frame-name frame
  23794. Return the function name of FRAME, or '#f' if it can't be obtained.
  23795. -- Scheme Procedure: frame-arch frame
  23796. Return the '<gdb:architecture>' object corresponding to FRAME's
  23797. architecture. *Note Architectures In Guile::.
  23798. -- Scheme Procedure: frame-type frame
  23799. Return the type of FRAME. The value can be one of:
  23800. 'NORMAL_FRAME'
  23801. An ordinary stack frame.
  23802. 'DUMMY_FRAME'
  23803. A fake stack frame that was created by GDB when performing an
  23804. inferior function call.
  23805. 'INLINE_FRAME'
  23806. A frame representing an inlined function. The function was
  23807. inlined into a 'NORMAL_FRAME' that is older than this one.
  23808. 'TAILCALL_FRAME'
  23809. A frame representing a tail call. *Note Tail Call Frames::.
  23810. 'SIGTRAMP_FRAME'
  23811. A signal trampoline frame. This is the frame created by the
  23812. OS when it calls into a signal handler.
  23813. 'ARCH_FRAME'
  23814. A fake stack frame representing a cross-architecture call.
  23815. 'SENTINEL_FRAME'
  23816. This is like 'NORMAL_FRAME', but it is only used for the
  23817. newest frame.
  23818. -- Scheme Procedure: frame-unwind-stop-reason frame
  23819. Return an integer representing the reason why it's not possible to
  23820. find more frames toward the outermost frame. Use
  23821. 'unwind-stop-reason-string' to convert the value returned by this
  23822. function to a string. The value can be one of:
  23823. 'FRAME_UNWIND_NO_REASON'
  23824. No particular reason (older frames should be available).
  23825. 'FRAME_UNWIND_NULL_ID'
  23826. The previous frame's analyzer returns an invalid result.
  23827. 'FRAME_UNWIND_OUTERMOST'
  23828. This frame is the outermost.
  23829. 'FRAME_UNWIND_UNAVAILABLE'
  23830. Cannot unwind further, because that would require knowing the
  23831. values of registers or memory that have not been collected.
  23832. 'FRAME_UNWIND_INNER_ID'
  23833. This frame ID looks like it ought to belong to a NEXT frame,
  23834. but we got it for a PREV frame. Normally, this is a sign of
  23835. unwinder failure. It could also indicate stack corruption.
  23836. 'FRAME_UNWIND_SAME_ID'
  23837. This frame has the same ID as the previous one. That means
  23838. that unwinding further would almost certainly give us another
  23839. frame with exactly the same ID, so break the chain. Normally,
  23840. this is a sign of unwinder failure. It could also indicate
  23841. stack corruption.
  23842. 'FRAME_UNWIND_NO_SAVED_PC'
  23843. The frame unwinder did not find any saved PC, but we needed
  23844. one to unwind further.
  23845. 'FRAME_UNWIND_MEMORY_ERROR'
  23846. The frame unwinder caused an error while trying to access
  23847. memory.
  23848. 'FRAME_UNWIND_FIRST_ERROR'
  23849. Any stop reason greater or equal to this value indicates some
  23850. kind of error. This special value facilitates writing code
  23851. that tests for errors in unwinding in a way that will work
  23852. correctly even if the list of the other values is modified in
  23853. future GDB versions. Using it, you could write:
  23854. (define reason (frame-unwind-stop-readon (selected-frame)))
  23855. (define reason-str (unwind-stop-reason-string reason))
  23856. (if (>= reason FRAME_UNWIND_FIRST_ERROR)
  23857. (format #t "An error occured: ~s\n" reason-str))
  23858. -- Scheme Procedure: frame-pc frame
  23859. Return the frame's resume address.
  23860. -- Scheme Procedure: frame-block frame
  23861. Return the frame's code block as a '<gdb:block>' object. *Note
  23862. Blocks In Guile::.
  23863. -- Scheme Procedure: frame-function frame
  23864. Return the symbol for the function corresponding to this frame as a
  23865. '<gdb:symbol>' object, or '#f' if there isn't one. *Note Symbols
  23866. In Guile::.
  23867. -- Scheme Procedure: frame-older frame
  23868. Return the frame that called FRAME.
  23869. -- Scheme Procedure: frame-newer frame
  23870. Return the frame called by FRAME.
  23871. -- Scheme Procedure: frame-sal frame
  23872. Return the frame's '<gdb:sal>' (symtab and line) object. *Note
  23873. Symbol Tables In Guile::.
  23874. -- Scheme Procedure: frame-read-register frame register
  23875. Return the value of REGISTER in FRAME. REGISTER should be a
  23876. string, like 'pc'.
  23877. -- Scheme Procedure: frame-read-var frame variable [#:block block]
  23878. Return the value of VARIABLE in FRAME. If the optional argument
  23879. BLOCK is provided, search for the variable from that block;
  23880. otherwise start at the frame's current block (which is determined
  23881. by the frame's current program counter). The VARIABLE must be
  23882. given as a string or a '<gdb:symbol>' object, and BLOCK must be a
  23883. '<gdb:block>' object.
  23884. -- Scheme Procedure: frame-select frame
  23885. Set FRAME to be the selected frame. *Note Examining the Stack:
  23886. Stack.
  23887. -- Scheme Procedure: selected-frame
  23888. Return the selected frame object. *Note Selecting a Frame:
  23889. Selection.
  23890. -- Scheme Procedure: newest-frame
  23891. Return the newest frame object for the selected thread.
  23892. -- Scheme Procedure: unwind-stop-reason-string reason
  23893. Return a string explaining the reason why GDB stopped unwinding
  23894. frames, as expressed by the given REASON code (an integer, see the
  23895. 'frame-unwind-stop-reason' procedure above in this section).
  23896. 
  23897. File: gdb.info, Node: Blocks In Guile, Next: Symbols In Guile, Prev: Frames In Guile, Up: Guile API
  23898. 23.3.3.16 Accessing blocks from Guile.
  23899. ......................................
  23900. In GDB, symbols are stored in blocks. A block corresponds roughly to a
  23901. scope in the source code. Blocks are organized hierarchically, and are
  23902. represented individually in Guile as an object of type '<gdb:block>'.
  23903. Blocks rely on debugging information being available.
  23904. A frame has a block. Please see *note Frames In Guile::, for a more
  23905. in-depth discussion of frames.
  23906. The outermost block is known as the "global block". The global block
  23907. typically holds public global variables and functions.
  23908. The block nested just inside the global block is the "static block".
  23909. The static block typically holds file-scoped variables and functions.
  23910. GDB provides a method to get a block's superblock, but there is
  23911. currently no way to examine the sub-blocks of a block, or to iterate
  23912. over all the blocks in a symbol table (*note Symbol Tables In Guile::).
  23913. Here is a short example that should help explain blocks:
  23914. /* This is in the global block. */
  23915. int global;
  23916. /* This is in the static block. */
  23917. static int file_scope;
  23918. /* 'function' is in the global block, and 'argument' is
  23919. in a block nested inside of 'function'. */
  23920. int function (int argument)
  23921. {
  23922. /* 'local' is in a block inside 'function'. It may or may
  23923. not be in the same block as 'argument'. */
  23924. int local;
  23925. {
  23926. /* 'inner' is in a block whose superblock is the one holding
  23927. 'local'. */
  23928. int inner;
  23929. /* If this call is expanded by the compiler, you may see
  23930. a nested block here whose function is 'inline_function'
  23931. and whose superblock is the one holding 'inner'. */
  23932. inline_function ();
  23933. }
  23934. }
  23935. The following block-related procedures are provided by the '(gdb)'
  23936. module:
  23937. -- Scheme Procedure: block? object
  23938. Return '#t' if OBJECT is a '<gdb:block>' object. Otherwise return
  23939. '#f'.
  23940. -- Scheme Procedure: block-valid? block
  23941. Returns '#t' if '<gdb:block>' BLOCK is valid, '#f' if not. A block
  23942. object can become invalid if the block it refers to doesn't exist
  23943. anymore in the inferior. All other '<gdb:block>' methods will
  23944. throw an exception if it is invalid at the time the procedure is
  23945. called. The block's validity is also checked during iteration over
  23946. symbols of the block.
  23947. -- Scheme Procedure: block-start block
  23948. Return the start address of '<gdb:block>' BLOCK.
  23949. -- Scheme Procedure: block-end block
  23950. Return the end address of '<gdb:block>' BLOCK.
  23951. -- Scheme Procedure: block-function block
  23952. Return the name of '<gdb:block>' BLOCK represented as a
  23953. '<gdb:symbol>' object. If the block is not named, then '#f' is
  23954. returned.
  23955. For ordinary function blocks, the superblock is the static block.
  23956. However, you should note that it is possible for a function block
  23957. to have a superblock that is not the static block - for instance
  23958. this happens for an inlined function.
  23959. -- Scheme Procedure: block-superblock block
  23960. Return the block containing '<gdb:block>' BLOCK. If the parent
  23961. block does not exist, then '#f' is returned.
  23962. -- Scheme Procedure: block-global-block block
  23963. Return the global block associated with '<gdb:block>' BLOCK.
  23964. -- Scheme Procedure: block-static-block block
  23965. Return the static block associated with '<gdb:block>' BLOCK.
  23966. -- Scheme Procedure: block-global? block
  23967. Return '#t' if '<gdb:block>' BLOCK is a global block. Otherwise
  23968. return '#f'.
  23969. -- Scheme Procedure: block-static? block
  23970. Return '#t' if '<gdb:block>' BLOCK is a static block. Otherwise
  23971. return '#f'.
  23972. -- Scheme Procedure: block-symbols
  23973. Return a list of all symbols (as <gdb:symbol> objects) in
  23974. '<gdb:block>' BLOCK.
  23975. -- Scheme Procedure: make-block-symbols-iterator block
  23976. Return an object of type '<gdb:iterator>' that will iterate over
  23977. all symbols of the block. Guile programs should not assume that a
  23978. specific block object will always contain a given symbol, since
  23979. changes in GDB features and infrastructure may cause symbols move
  23980. across blocks in a symbol table. *Note Iterators In Guile::.
  23981. -- Scheme Procedure: block-symbols-progress?
  23982. Return #t if the object is a <gdb:block-symbols-progress> object.
  23983. This object would be obtained from the 'progress' element of the
  23984. '<gdb:iterator>' object returned by 'make-block-symbols-iterator'.
  23985. -- Scheme Procedure: lookup-block pc
  23986. Return the innermost '<gdb:block>' containing the given PC value.
  23987. If the block cannot be found for the PC value specified, the
  23988. function will return '#f'.
  23989. 
  23990. File: gdb.info, Node: Symbols In Guile, Next: Symbol Tables In Guile, Prev: Blocks In Guile, Up: Guile API
  23991. 23.3.3.17 Guile representation of Symbols.
  23992. ..........................................
  23993. GDB represents every variable, function and type as an entry in a symbol
  23994. table. *Note Examining the Symbol Table: Symbols. Guile represents
  23995. these symbols in GDB with the '<gdb:symbol>' object.
  23996. The following symbol-related procedures are provided by the '(gdb)'
  23997. module:
  23998. -- Scheme Procedure: symbol? object
  23999. Return '#t' if OBJECT is an object of type '<gdb:symbol>'.
  24000. Otherwise return '#f'.
  24001. -- Scheme Procedure: symbol-valid? symbol
  24002. Return '#t' if the '<gdb:symbol>' object is valid, '#f' if not. A
  24003. '<gdb:symbol>' object can become invalid if the symbol it refers to
  24004. does not exist in GDB any longer. All other '<gdb:symbol>'
  24005. procedures will throw an exception if it is invalid at the time the
  24006. procedure is called.
  24007. -- Scheme Procedure: symbol-type symbol
  24008. Return the type of SYMBOL or '#f' if no type is recorded. The
  24009. result is an object of type '<gdb:type>'. *Note Types In Guile::.
  24010. -- Scheme Procedure: symbol-symtab symbol
  24011. Return the symbol table in which SYMBOL appears. The result is an
  24012. object of type '<gdb:symtab>'. *Note Symbol Tables In Guile::.
  24013. -- Scheme Procedure: symbol-line symbol
  24014. Return the line number in the source code at which SYMBOL was
  24015. defined. This is an integer.
  24016. -- Scheme Procedure: symbol-name symbol
  24017. Return the name of SYMBOL as a string.
  24018. -- Scheme Procedure: symbol-linkage-name symbol
  24019. Return the name of SYMBOL, as used by the linker (i.e., may be
  24020. mangled).
  24021. -- Scheme Procedure: symbol-print-name symbol
  24022. Return the name of SYMBOL in a form suitable for output. This is
  24023. either 'name' or 'linkage_name', depending on whether the user
  24024. asked GDB to display demangled or mangled names.
  24025. -- Scheme Procedure: symbol-addr-class symbol
  24026. Return the address class of the symbol. This classifies how to
  24027. find the value of a symbol. Each address class is a constant
  24028. defined in the '(gdb)' module and described later in this chapter.
  24029. -- Scheme Procedure: symbol-needs-frame? symbol
  24030. Return '#t' if evaluating SYMBOL's value requires a frame (*note
  24031. Frames In Guile::) and '#f' otherwise. Typically, local variables
  24032. will require a frame, but other symbols will not.
  24033. -- Scheme Procedure: symbol-argument? symbol
  24034. Return '#t' if SYMBOL is an argument of a function. Otherwise
  24035. return '#f'.
  24036. -- Scheme Procedure: symbol-constant? symbol
  24037. Return '#t' if SYMBOL is a constant. Otherwise return '#f'.
  24038. -- Scheme Procedure: symbol-function? symbol
  24039. Return '#t' if SYMBOL is a function or a method. Otherwise return
  24040. '#f'.
  24041. -- Scheme Procedure: symbol-variable? symbol
  24042. Return '#t' if SYMBOL is a variable. Otherwise return '#f'.
  24043. -- Scheme Procedure: symbol-value symbol [#:frame frame]
  24044. Compute the value of SYMBOL, as a '<gdb:value>'. For functions,
  24045. this computes the address of the function, cast to the appropriate
  24046. type. If the symbol requires a frame in order to compute its
  24047. value, then FRAME must be given. If FRAME is not given, or if
  24048. FRAME is invalid, then an exception is thrown.
  24049. -- Scheme Procedure: lookup-symbol name [#:block block] [#:domain
  24050. domain]
  24051. This function searches for a symbol by name. The search scope can
  24052. be restricted to the parameters defined in the optional domain and
  24053. block arguments.
  24054. NAME is the name of the symbol. It must be a string. The optional
  24055. BLOCK argument restricts the search to symbols visible in that
  24056. BLOCK. The BLOCK argument must be a '<gdb:block>' object. If
  24057. omitted, the block for the current frame is used. The optional
  24058. DOMAIN argument restricts the search to the domain type. The
  24059. DOMAIN argument must be a domain constant defined in the '(gdb)'
  24060. module and described later in this chapter.
  24061. The result is a list of two elements. The first element is a
  24062. '<gdb:symbol>' object or '#f' if the symbol is not found. If the
  24063. symbol is found, the second element is '#t' if the symbol is a
  24064. field of a method's object (e.g., 'this' in C++), otherwise it is
  24065. '#f'. If the symbol is not found, the second element is '#f'.
  24066. -- Scheme Procedure: lookup-global-symbol name [#:domain domain]
  24067. This function searches for a global symbol by name. The search
  24068. scope can be restricted by the domain argument.
  24069. NAME is the name of the symbol. It must be a string. The optional
  24070. DOMAIN argument restricts the search to the domain type. The
  24071. DOMAIN argument must be a domain constant defined in the '(gdb)'
  24072. module and described later in this chapter.
  24073. The result is a '<gdb:symbol>' object or '#f' if the symbol is not
  24074. found.
  24075. The available domain categories in '<gdb:symbol>' are represented as
  24076. constants in the '(gdb)' module:
  24077. 'SYMBOL_UNDEF_DOMAIN'
  24078. This is used when a domain has not been discovered or none of the
  24079. following domains apply. This usually indicates an error either in
  24080. the symbol information or in GDB's handling of symbols.
  24081. 'SYMBOL_VAR_DOMAIN'
  24082. This domain contains variables, function names, typedef names and
  24083. enum type values.
  24084. 'SYMBOL_STRUCT_DOMAIN'
  24085. This domain holds struct, union and enum type names.
  24086. 'SYMBOL_LABEL_DOMAIN'
  24087. This domain contains names of labels (for gotos).
  24088. 'SYMBOL_VARIABLES_DOMAIN'
  24089. This domain holds a subset of the 'SYMBOLS_VAR_DOMAIN'; it contains
  24090. everything minus functions and types.
  24091. 'SYMBOL_FUNCTIONS_DOMAIN'
  24092. This domain contains all functions.
  24093. 'SYMBOL_TYPES_DOMAIN'
  24094. This domain contains all types.
  24095. The available address class categories in '<gdb:symbol>' are
  24096. represented as constants in the 'gdb' module:
  24097. 'SYMBOL_LOC_UNDEF'
  24098. If this is returned by address class, it indicates an error either
  24099. in the symbol information or in GDB's handling of symbols.
  24100. 'SYMBOL_LOC_CONST'
  24101. Value is constant int.
  24102. 'SYMBOL_LOC_STATIC'
  24103. Value is at a fixed address.
  24104. 'SYMBOL_LOC_REGISTER'
  24105. Value is in a register.
  24106. 'SYMBOL_LOC_ARG'
  24107. Value is an argument. This value is at the offset stored within
  24108. the symbol inside the frame's argument list.
  24109. 'SYMBOL_LOC_REF_ARG'
  24110. Value address is stored in the frame's argument list. Just like
  24111. 'LOC_ARG' except that the value's address is stored at the offset,
  24112. not the value itself.
  24113. 'SYMBOL_LOC_REGPARM_ADDR'
  24114. Value is a specified register. Just like 'LOC_REGISTER' except the
  24115. register holds the address of the argument instead of the argument
  24116. itself.
  24117. 'SYMBOL_LOC_LOCAL'
  24118. Value is a local variable.
  24119. 'SYMBOL_LOC_TYPEDEF'
  24120. Value not used. Symbols in the domain 'SYMBOL_STRUCT_DOMAIN' all
  24121. have this class.
  24122. 'SYMBOL_LOC_BLOCK'
  24123. Value is a block.
  24124. 'SYMBOL_LOC_CONST_BYTES'
  24125. Value is a byte-sequence.
  24126. 'SYMBOL_LOC_UNRESOLVED'
  24127. Value is at a fixed address, but the address of the variable has to
  24128. be determined from the minimal symbol table whenever the variable
  24129. is referenced.
  24130. 'SYMBOL_LOC_OPTIMIZED_OUT'
  24131. The value does not actually exist in the program.
  24132. 'SYMBOL_LOC_COMPUTED'
  24133. The value's address is a computed location.
  24134. 
  24135. File: gdb.info, Node: Symbol Tables In Guile, Next: Breakpoints In Guile, Prev: Symbols In Guile, Up: Guile API
  24136. 23.3.3.18 Symbol table representation in Guile.
  24137. ...............................................
  24138. Access to symbol table data maintained by GDB on the inferior is exposed
  24139. to Guile via two objects: '<gdb:sal>' (symtab-and-line) and
  24140. '<gdb:symtab>'. Symbol table and line data for a frame is returned from
  24141. the 'frame-find-sal' '<gdb:frame>' procedure. *Note Frames In Guile::.
  24142. For more information on GDB's symbol table management, see *note
  24143. Examining the Symbol Table: Symbols.
  24144. The following symtab-related procedures are provided by the '(gdb)'
  24145. module:
  24146. -- Scheme Procedure: symtab? object
  24147. Return '#t' if OBJECT is an object of type '<gdb:symtab>'.
  24148. Otherwise return '#f'.
  24149. -- Scheme Procedure: symtab-valid? symtab
  24150. Return '#t' if the '<gdb:symtab>' object is valid, '#f' if not. A
  24151. '<gdb:symtab>' object becomes invalid when the symbol table it
  24152. refers to no longer exists in GDB. All other '<gdb:symtab>'
  24153. procedures will throw an exception if it is invalid at the time the
  24154. procedure is called.
  24155. -- Scheme Procedure: symtab-filename symtab
  24156. Return the symbol table's source filename.
  24157. -- Scheme Procedure: symtab-fullname symtab
  24158. Return the symbol table's source absolute file name.
  24159. -- Scheme Procedure: symtab-objfile symtab
  24160. Return the symbol table's backing object file. *Note Objfiles In
  24161. Guile::.
  24162. -- Scheme Procedure: symtab-global-block symtab
  24163. Return the global block of the underlying symbol table. *Note
  24164. Blocks In Guile::.
  24165. -- Scheme Procedure: symtab-static-block symtab
  24166. Return the static block of the underlying symbol table. *Note
  24167. Blocks In Guile::.
  24168. The following symtab-and-line-related procedures are provided by the
  24169. '(gdb)' module:
  24170. -- Scheme Procedure: sal? object
  24171. Return '#t' if OBJECT is an object of type '<gdb:sal>'. Otherwise
  24172. return '#f'.
  24173. -- Scheme Procedure: sal-valid? sal
  24174. Return '#t' if SAL is valid, '#f' if not. A '<gdb:sal>' object
  24175. becomes invalid when the Symbol table object it refers to no longer
  24176. exists in GDB. All other '<gdb:sal>' procedures will throw an
  24177. exception if it is invalid at the time the procedure is called.
  24178. -- Scheme Procedure: sal-symtab sal
  24179. Return the symbol table object ('<gdb:symtab>') for SAL.
  24180. -- Scheme Procedure: sal-line sal
  24181. Return the line number for SAL.
  24182. -- Scheme Procedure: sal-pc sal
  24183. Return the start of the address range occupied by code for SAL.
  24184. -- Scheme Procedure: sal-last sal
  24185. Return the end of the address range occupied by code for SAL.
  24186. -- Scheme Procedure: find-pc-line pc
  24187. Return the '<gdb:sal>' object corresponding to the PC value. If an
  24188. invalid value of PC is passed as an argument, then the 'symtab' and
  24189. 'line' attributes of the returned '<gdb:sal>' object will be '#f'
  24190. and 0 respectively.
  24191. 
  24192. File: gdb.info, Node: Breakpoints In Guile, Next: Lazy Strings In Guile, Prev: Symbol Tables In Guile, Up: Guile API
  24193. 23.3.3.19 Manipulating breakpoints using Guile
  24194. ..............................................
  24195. Breakpoints in Guile are represented by objects of type
  24196. '<gdb:breakpoint>'. New breakpoints can be created with the
  24197. 'make-breakpoint' Guile function, and then added to GDB with the
  24198. 'register-breakpoint!' Guile function. This two-step approach is taken
  24199. to separate out the side-effect of adding the breakpoint to GDB from
  24200. 'make-breakpoint'.
  24201. Support is also provided to view and manipulate breakpoints created
  24202. outside of Guile.
  24203. The following breakpoint-related procedures are provided by the
  24204. '(gdb)' module:
  24205. -- Scheme Procedure: make-breakpoint location [#:type type] [#:wp-class
  24206. wp-class] [#:internal internal]
  24207. Create a new breakpoint at LOCATION, a string naming the location
  24208. of the breakpoint, or an expression that defines a watchpoint. The
  24209. contents can be any location recognized by the 'break' command, or
  24210. in the case of a watchpoint, by the 'watch' command.
  24211. The breakpoint is initially marked as 'invalid'. The breakpoint is
  24212. not usable until it has been registered with GDB with
  24213. 'register-breakpoint!', at which point it becomes 'valid'. The
  24214. result is the '<gdb:breakpoint>' object representing the
  24215. breakpoint.
  24216. The optional TYPE denotes the breakpoint to create. This argument
  24217. can be either 'BP_BREAKPOINT' or 'BP_WATCHPOINT', and defaults to
  24218. 'BP_BREAKPOINT'.
  24219. The optional WP-CLASS argument defines the class of watchpoint to
  24220. create, if TYPE is 'BP_WATCHPOINT'. If a watchpoint class is not
  24221. provided, it is assumed to be a 'WP_WRITE' class.
  24222. The optional INTERNAL argument allows the breakpoint to become
  24223. invisible to the user. The breakpoint will neither be reported
  24224. when registered, nor will it be listed in the output from 'info
  24225. breakpoints' (but will be listed with the 'maint info breakpoints'
  24226. command). If an internal flag is not provided, the breakpoint is
  24227. visible (non-internal).
  24228. When a watchpoint is created, GDB will try to create a hardware
  24229. assisted watchpoint. If successful, the type of the watchpoint is
  24230. changed from 'BP_WATCHPOINT' to 'BP_HARDWARE_WATCHPOINT' for
  24231. 'WP_WRITE', 'BP_READ_WATCHPOINT' for 'WP_READ', and
  24232. 'BP_ACCESS_WATCHPOINT' for 'WP_ACCESS'. If not successful, the
  24233. type of the watchpoint is left as 'WP_WATCHPOINT'.
  24234. The available types are represented by constants defined in the
  24235. 'gdb' module:
  24236. 'BP_BREAKPOINT'
  24237. Normal code breakpoint.
  24238. 'BP_WATCHPOINT'
  24239. Watchpoint breakpoint.
  24240. 'BP_HARDWARE_WATCHPOINT'
  24241. Hardware assisted watchpoint. This value cannot be specified
  24242. when creating the breakpoint.
  24243. 'BP_READ_WATCHPOINT'
  24244. Hardware assisted read watchpoint. This value cannot be
  24245. specified when creating the breakpoint.
  24246. 'BP_ACCESS_WATCHPOINT'
  24247. Hardware assisted access watchpoint. This value cannot be
  24248. specified when creating the breakpoint.
  24249. The available watchpoint types represented by constants are defined
  24250. in the '(gdb)' module:
  24251. 'WP_READ'
  24252. Read only watchpoint.
  24253. 'WP_WRITE'
  24254. Write only watchpoint.
  24255. 'WP_ACCESS'
  24256. Read/Write watchpoint.
  24257. -- Scheme Procedure: register-breakpoint! breakpoint
  24258. Add BREAKPOINT, a '<gdb:breakpoint>' object, to GDB's list of
  24259. breakpoints. The breakpoint must have been created with
  24260. 'make-breakpoint'. One cannot register breakpoints that have been
  24261. created outside of Guile. Once a breakpoint is registered it
  24262. becomes 'valid'. It is an error to register an already registered
  24263. breakpoint. The result is unspecified.
  24264. -- Scheme Procedure: delete-breakpoint! breakpoint
  24265. Remove BREAKPOINT from GDB's list of breakpoints. This also
  24266. invalidates the Guile BREAKPOINT object. Any further attempt to
  24267. access the object will throw an exception.
  24268. If BREAKPOINT was created from Guile with 'make-breakpoint' it may
  24269. be re-registered with GDB, in which case the breakpoint becomes
  24270. valid again.
  24271. -- Scheme Procedure: breakpoints
  24272. Return a list of all breakpoints. Each element of the list is a
  24273. '<gdb:breakpoint>' object.
  24274. -- Scheme Procedure: breakpoint? object
  24275. Return '#t' if OBJECT is a '<gdb:breakpoint>' object, and '#f'
  24276. otherwise.
  24277. -- Scheme Procedure: breakpoint-valid? breakpoint
  24278. Return '#t' if BREAKPOINT is valid, '#f' otherwise. Breakpoints
  24279. created with 'make-breakpoint' are marked as invalid until they are
  24280. registered with GDB with 'register-breakpoint!'. A
  24281. '<gdb:breakpoint>' object can become invalid if the user deletes
  24282. the breakpoint. In this case, the object still exists, but the
  24283. underlying breakpoint does not. In the cases of watchpoint scope,
  24284. the watchpoint remains valid even if execution of the inferior
  24285. leaves the scope of that watchpoint.
  24286. -- Scheme Procedure: breakpoint-number breakpoint
  24287. Return the breakpoint's number -- the identifier used by the user
  24288. to manipulate the breakpoint.
  24289. -- Scheme Procedure: breakpoint-type breakpoint
  24290. Return the breakpoint's type -- the identifier used to determine
  24291. the actual breakpoint type or use-case.
  24292. -- Scheme Procedure: breakpoint-visible? breakpoint
  24293. Return '#t' if the breakpoint is visible to the user when hit, or
  24294. when the 'info breakpoints' command is run. Otherwise return '#f'.
  24295. -- Scheme Procedure: breakpoint-location breakpoint
  24296. Return the location of the breakpoint, as specified by the user.
  24297. It is a string. If the breakpoint does not have a location (that
  24298. is, it is a watchpoint) return '#f'.
  24299. -- Scheme Procedure: breakpoint-expression breakpoint
  24300. Return the breakpoint expression, as specified by the user. It is
  24301. a string. If the breakpoint does not have an expression (the
  24302. breakpoint is not a watchpoint) return '#f'.
  24303. -- Scheme Procedure: breakpoint-enabled? breakpoint
  24304. Return '#t' if the breakpoint is enabled, and '#f' otherwise.
  24305. -- Scheme Procedure: set-breakpoint-enabled! breakpoint flag
  24306. Set the enabled state of BREAKPOINT to FLAG. If flag is '#f' it is
  24307. disabled, otherwise it is enabled.
  24308. -- Scheme Procedure: breakpoint-silent? breakpoint
  24309. Return '#t' if the breakpoint is silent, and '#f' otherwise.
  24310. Note that a breakpoint can also be silent if it has commands and
  24311. the first command is 'silent'. This is not reported by the
  24312. 'silent' attribute.
  24313. -- Scheme Procedure: set-breakpoint-silent! breakpoint flag
  24314. Set the silent state of BREAKPOINT to FLAG. If flag is '#f' the
  24315. breakpoint is made silent, otherwise it is made non-silent (or
  24316. noisy).
  24317. -- Scheme Procedure: breakpoint-ignore-count breakpoint
  24318. Return the ignore count for BREAKPOINT.
  24319. -- Scheme Procedure: set-breakpoint-ignore-count! breakpoint count
  24320. Set the ignore count for BREAKPOINT to COUNT.
  24321. -- Scheme Procedure: breakpoint-hit-count breakpoint
  24322. Return hit count of BREAKPOINT.
  24323. -- Scheme Procedure: set-breakpoint-hit-count! breakpoint count
  24324. Set the hit count of BREAKPOINT to COUNT. At present, COUNT must
  24325. be zero.
  24326. -- Scheme Procedure: breakpoint-thread breakpoint
  24327. Return the global-thread-id for thread-specific breakpoint
  24328. BREAKPOINT. Return #f if BREAKPOINT is not thread-specific.
  24329. -- Scheme Procedure: set-breakpoint-thread! breakpoint
  24330. global-thread-id|#f
  24331. Set the thread-id for BREAKPOINT to GLOBAL-THREAD-ID If set to
  24332. '#f', the breakpoint is no longer thread-specific.
  24333. -- Scheme Procedure: breakpoint-task breakpoint
  24334. If the breakpoint is Ada task-specific, return the Ada task id. If
  24335. the breakpoint is not task-specific (or the underlying language is
  24336. not Ada), return '#f'.
  24337. -- Scheme Procedure: set-breakpoint-task! breakpoint task
  24338. Set the Ada task of BREAKPOINT to TASK. If set to '#f', the
  24339. breakpoint is no longer task-specific.
  24340. -- Scheme Procedure: breakpoint-condition breakpoint
  24341. Return the condition of BREAKPOINT, as specified by the user. It
  24342. is a string. If there is no condition, return '#f'.
  24343. -- Scheme Procedure: set-breakpoint-condition! breakpoint condition
  24344. Set the condition of BREAKPOINT to CONDITION, which must be a
  24345. string. If set to '#f' then the breakpoint becomes unconditional.
  24346. -- Scheme Procedure: breakpoint-stop breakpoint
  24347. Return the stop predicate of BREAKPOINT. See
  24348. 'set-breakpoint-stop!' below in this section.
  24349. -- Scheme Procedure: set-breakpoint-stop! breakpoint procedure|#f
  24350. Set the stop predicate of BREAKPOINT. The predicate PROCEDURE
  24351. takes one argument: the <gdb:breakpoint> object. If this predicate
  24352. is set to a procedure then it is invoked whenever the inferior
  24353. reaches this breakpoint. If it returns '#t', or any non-'#f'
  24354. value, then the inferior is stopped, otherwise the inferior will
  24355. continue.
  24356. If there are multiple breakpoints at the same location with a
  24357. 'stop' predicate, each one will be called regardless of the return
  24358. status of the previous. This ensures that all 'stop' predicates
  24359. have a chance to execute at that location. In this scenario if one
  24360. of the methods returns '#t' but the others return '#f', the
  24361. inferior will still be stopped.
  24362. You should not alter the execution state of the inferior (i.e.,
  24363. step, next, etc.), alter the current frame context (i.e., change
  24364. the current active frame), or alter, add or delete any breakpoint.
  24365. As a general rule, you should not alter any data within GDB or the
  24366. inferior at this time.
  24367. Example 'stop' implementation:
  24368. (define (my-stop? bkpt)
  24369. (let ((int-val (parse-and-eval "foo")))
  24370. (value=? int-val 3)))
  24371. (define bkpt (make-breakpoint "main.c:42"))
  24372. (register-breakpoint! bkpt)
  24373. (set-breakpoint-stop! bkpt my-stop?)
  24374. -- Scheme Procedure: breakpoint-commands breakpoint
  24375. Return the commands attached to BREAKPOINT as a string, or '#f' if
  24376. there are none.
  24377. 
  24378. File: gdb.info, Node: Lazy Strings In Guile, Next: Architectures In Guile, Prev: Breakpoints In Guile, Up: Guile API
  24379. 23.3.3.20 Guile representation of lazy strings.
  24380. ...............................................
  24381. A "lazy string" is a string whose contents is not retrieved or encoded
  24382. until it is needed.
  24383. A '<gdb:lazy-string>' is represented in GDB as an 'address' that
  24384. points to a region of memory, an 'encoding' that will be used to encode
  24385. that region of memory, and a 'length' to delimit the region of memory
  24386. that represents the string. The difference between a
  24387. '<gdb:lazy-string>' and a string wrapped within a '<gdb:value>' is that
  24388. a '<gdb:lazy-string>' will be treated differently by GDB when printing.
  24389. A '<gdb:lazy-string>' is retrieved and encoded during printing, while a
  24390. '<gdb:value>' wrapping a string is immediately retrieved and encoded on
  24391. creation.
  24392. The following lazy-string-related procedures are provided by the
  24393. '(gdb)' module:
  24394. -- Scheme Procedure: lazy-string? object
  24395. Return '#t' if OBJECT is an object of type '<gdb:lazy-string>'.
  24396. Otherwise return '#f'.
  24397. -- Scheme Procedure: lazy-string-address lazy-sring
  24398. Return the address of LAZY-STRING.
  24399. -- Scheme Procedure: lazy-string-length lazy-string
  24400. Return the length of LAZY-STRING in characters. If the length is
  24401. -1, then the string will be fetched and encoded up to the first
  24402. null of appropriate width.
  24403. -- Scheme Procedure: lazy-string-encoding lazy-string
  24404. Return the encoding that will be applied to LAZY-STRING when the
  24405. string is printed by GDB. If the encoding is not set, or contains
  24406. an empty string, then GDB will select the most appropriate encoding
  24407. when the string is printed.
  24408. -- Scheme Procedure: lazy-string-type lazy-string
  24409. Return the type that is represented by LAZY-STRING's type. For a
  24410. lazy string this is a pointer or array type. To resolve this to
  24411. the lazy string's character type, use 'type-target-type'. *Note
  24412. Types In Guile::.
  24413. -- Scheme Procedure: lazy-string->value lazy-string
  24414. Convert the '<gdb:lazy-string>' to a '<gdb:value>'. This value
  24415. will point to the string in memory, but will lose all the delayed
  24416. retrieval, encoding and handling that GDB applies to a
  24417. '<gdb:lazy-string>'.
  24418. 
  24419. File: gdb.info, Node: Architectures In Guile, Next: Disassembly In Guile, Prev: Lazy Strings In Guile, Up: Guile API
  24420. 23.3.3.21 Guile representation of architectures
  24421. ...............................................
  24422. GDB uses architecture specific parameters and artifacts in a number of
  24423. its various computations. An architecture is represented by an instance
  24424. of the '<gdb:arch>' class.
  24425. The following architecture-related procedures are provided by the
  24426. '(gdb)' module:
  24427. -- Scheme Procedure: arch? object
  24428. Return '#t' if OBJECT is an object of type '<gdb:arch>'. Otherwise
  24429. return '#f'.
  24430. -- Scheme Procedure: current-arch
  24431. Return the current architecture as a '<gdb:arch>' object.
  24432. -- Scheme Procedure: arch-name arch
  24433. Return the name (string value) of '<gdb:arch>' ARCH.
  24434. -- Scheme Procedure: arch-charset arch
  24435. Return name of target character set of '<gdb:arch>' ARCH.
  24436. -- Scheme Procedure: arch-wide-charset
  24437. Return name of target wide character set of '<gdb:arch>' ARCH.
  24438. Each architecture provides a set of predefined types, obtained by the
  24439. following functions.
  24440. -- Scheme Procedure: arch-void-type arch
  24441. Return the '<gdb:type>' object for a 'void' type of architecture
  24442. ARCH.
  24443. -- Scheme Procedure: arch-char-type arch
  24444. Return the '<gdb:type>' object for a 'char' type of architecture
  24445. ARCH.
  24446. -- Scheme Procedure: arch-short-type arch
  24447. Return the '<gdb:type>' object for a 'short' type of architecture
  24448. ARCH.
  24449. -- Scheme Procedure: arch-int-type arch
  24450. Return the '<gdb:type>' object for an 'int' type of architecture
  24451. ARCH.
  24452. -- Scheme Procedure: arch-long-type arch
  24453. Return the '<gdb:type>' object for a 'long' type of architecture
  24454. ARCH.
  24455. -- Scheme Procedure: arch-schar-type arch
  24456. Return the '<gdb:type>' object for a 'signed char' type of
  24457. architecture ARCH.
  24458. -- Scheme Procedure: arch-uchar-type arch
  24459. Return the '<gdb:type>' object for an 'unsigned char' type of
  24460. architecture ARCH.
  24461. -- Scheme Procedure: arch-ushort-type arch
  24462. Return the '<gdb:type>' object for an 'unsigned short' type of
  24463. architecture ARCH.
  24464. -- Scheme Procedure: arch-uint-type arch
  24465. Return the '<gdb:type>' object for an 'unsigned int' type of
  24466. architecture ARCH.
  24467. -- Scheme Procedure: arch-ulong-type arch
  24468. Return the '<gdb:type>' object for an 'unsigned long' type of
  24469. architecture ARCH.
  24470. -- Scheme Procedure: arch-float-type arch
  24471. Return the '<gdb:type>' object for a 'float' type of architecture
  24472. ARCH.
  24473. -- Scheme Procedure: arch-double-type arch
  24474. Return the '<gdb:type>' object for a 'double' type of architecture
  24475. ARCH.
  24476. -- Scheme Procedure: arch-longdouble-type arch
  24477. Return the '<gdb:type>' object for a 'long double' type of
  24478. architecture ARCH.
  24479. -- Scheme Procedure: arch-bool-type arch
  24480. Return the '<gdb:type>' object for a 'bool' type of architecture
  24481. ARCH.
  24482. -- Scheme Procedure: arch-longlong-type arch
  24483. Return the '<gdb:type>' object for a 'long long' type of
  24484. architecture ARCH.
  24485. -- Scheme Procedure: arch-ulonglong-type arch
  24486. Return the '<gdb:type>' object for an 'unsigned long long' type of
  24487. architecture ARCH.
  24488. -- Scheme Procedure: arch-int8-type arch
  24489. Return the '<gdb:type>' object for an 'int8' type of architecture
  24490. ARCH.
  24491. -- Scheme Procedure: arch-uint8-type arch
  24492. Return the '<gdb:type>' object for a 'uint8' type of architecture
  24493. ARCH.
  24494. -- Scheme Procedure: arch-int16-type arch
  24495. Return the '<gdb:type>' object for an 'int16' type of architecture
  24496. ARCH.
  24497. -- Scheme Procedure: arch-uint16-type arch
  24498. Return the '<gdb:type>' object for a 'uint16' type of architecture
  24499. ARCH.
  24500. -- Scheme Procedure: arch-int32-type arch
  24501. Return the '<gdb:type>' object for an 'int32' type of architecture
  24502. ARCH.
  24503. -- Scheme Procedure: arch-uint32-type arch
  24504. Return the '<gdb:type>' object for a 'uint32' type of architecture
  24505. ARCH.
  24506. -- Scheme Procedure: arch-int64-type arch
  24507. Return the '<gdb:type>' object for an 'int64' type of architecture
  24508. ARCH.
  24509. -- Scheme Procedure: arch-uint64-type arch
  24510. Return the '<gdb:type>' object for a 'uint64' type of architecture
  24511. ARCH.
  24512. Example:
  24513. (gdb) guile (type-name (arch-uchar-type (current-arch)))
  24514. "unsigned char"
  24515. 
  24516. File: gdb.info, Node: Disassembly In Guile, Next: I/O Ports in Guile, Prev: Architectures In Guile, Up: Guile API
  24517. 23.3.3.22 Disassembly In Guile
  24518. ..............................
  24519. The disassembler can be invoked from Scheme code. Furthermore, the
  24520. disassembler can take a Guile port as input, allowing one to disassemble
  24521. from any source, and not just target memory.
  24522. -- Scheme Procedure: arch-disassemble arch start-pc [#:port port]
  24523. [#:offset offset] [#:size size] [#:count count]
  24524. Return a list of disassembled instructions starting from the memory
  24525. address START-PC.
  24526. The optional argument PORT specifies the input port to read bytes
  24527. from. If PORT is '#f' then bytes are read from target memory.
  24528. The optional argument OFFSET specifies the address offset of the
  24529. first byte in PORT. This is useful, for example, when PORT
  24530. specifies a 'bytevector' and you want the bytevector to be
  24531. disassembled as if it came from that address. The START-PC passed
  24532. to the reader for PORT is offset by the same amount.
  24533. Example:
  24534. (gdb) guile (use-modules (rnrs io ports))
  24535. (gdb) guile (define pc (value->integer (parse-and-eval "$pc")))
  24536. (gdb) guile (define mem (open-memory #:start pc))
  24537. (gdb) guile (define bv (get-bytevector-n mem 10))
  24538. (gdb) guile (define bv-port (open-bytevector-input-port bv))
  24539. (gdb) guile (define arch (current-arch))
  24540. (gdb) guile (arch-disassemble arch pc #:port bv-port #:offset pc)
  24541. (((address . 4195516) (asm . "mov $0x4005c8,%edi") (length . 5)))
  24542. The optional arguments SIZE and COUNT determine the number of
  24543. instructions in the returned list. If either SIZE or COUNT is
  24544. specified as zero, then no instructions are disassembled and an
  24545. empty list is returned. If both the optional arguments SIZE and
  24546. COUNT are specified, then a list of at most COUNT disassembled
  24547. instructions whose start address falls in the closed memory address
  24548. interval from START-PC to (START-PC + SIZE - 1) are returned. If
  24549. SIZE is not specified, but COUNT is specified, then COUNT number of
  24550. instructions starting from the address START-PC are returned. If
  24551. COUNT is not specified but SIZE is specified, then all instructions
  24552. whose start address falls in the closed memory address interval
  24553. from START-PC to (START-PC + SIZE - 1) are returned. If neither
  24554. SIZE nor COUNT are specified, then a single instruction at START-PC
  24555. is returned.
  24556. Each element of the returned list is an alist (associative list)
  24557. with the following keys:
  24558. 'address'
  24559. The value corresponding to this key is a Guile integer of the
  24560. memory address of the instruction.
  24561. 'asm'
  24562. The value corresponding to this key is a string value which
  24563. represents the instruction with assembly language mnemonics.
  24564. The assembly language flavor used is the same as that
  24565. specified by the current CLI variable 'disassembly-flavor'.
  24566. *Note Machine Code::.
  24567. 'length'
  24568. The value corresponding to this key is the length of the
  24569. instruction in bytes.
  24570. 
  24571. File: gdb.info, Node: I/O Ports in Guile, Next: Memory Ports in Guile, Prev: Disassembly In Guile, Up: Guile API
  24572. 23.3.3.23 I/O Ports in Guile
  24573. ............................
  24574. -- Scheme Procedure: input-port
  24575. Return GDB's input port as a Guile port object.
  24576. -- Scheme Procedure: output-port
  24577. Return GDB's output port as a Guile port object.
  24578. -- Scheme Procedure: error-port
  24579. Return GDB's error port as a Guile port object.
  24580. -- Scheme Procedure: stdio-port? object
  24581. Return '#t' if OBJECT is a GDB stdio port. Otherwise return '#f'.
  24582. 
  24583. File: gdb.info, Node: Memory Ports in Guile, Next: Iterators In Guile, Prev: I/O Ports in Guile, Up: Guile API
  24584. 23.3.3.24 Memory Ports in Guile
  24585. ...............................
  24586. GDB provides a 'port' interface to target memory. This allows Guile
  24587. code to read/write target memory using Guile's port and bytevector
  24588. functionality. The main routine is 'open-memory' which returns a port
  24589. object. One can then read/write memory using that object.
  24590. -- Scheme Procedure: open-memory [#:mode mode] [#:start address]
  24591. [#:size size]
  24592. Return a port object that can be used for reading and writing
  24593. memory. The port will be open according to MODE, which is the
  24594. standard mode argument to Guile port open routines, except that the
  24595. '"a"' and '"l"' modes are not supported. *Note (guile)File
  24596. Ports::. The '"b"' (binary) character may be present, but is
  24597. ignored: memory ports are binary only. If '"0"' is appended then
  24598. the port is marked as unbuffered. The default is '"r"', read-only
  24599. and buffered.
  24600. The chunk of memory that can be accessed can be bounded. If both
  24601. START and SIZE are unspecified, all of memory can be accessed. If
  24602. only START is specified, all of memory from that point on can be
  24603. accessed. If only SIZE if specified, all memory in the range
  24604. [0,SIZE) can be accessed. If both are specified, all memory in the
  24605. rane [START,START+SIZE) can be accessed.
  24606. -- Scheme Procedure: memory-port?
  24607. Return '#t' if OBJECT is an object of type '<gdb:memory-port>'.
  24608. Otherwise return '#f'.
  24609. -- Scheme Procedure: memory-port-range memory-port
  24610. Return the range of '<gdb:memory-port>' MEMORY-PORT as a list of
  24611. two elements: '(start end)'. The range is START to END inclusive.
  24612. -- Scheme Procedure: memory-port-read-buffer-size memory-port
  24613. Return the size of the read buffer of '<gdb:memory-port>'
  24614. MEMORY-PORT.
  24615. -- Scheme Procedure: set-memory-port-read-buffer-size! memory-port size
  24616. Set the size of the read buffer of '<gdb:memory-port>' MEMORY-PORT
  24617. to SIZE. The result is unspecified.
  24618. -- Scheme Procedure: memory-port-write-buffer-size memory-port
  24619. Return the size of the write buffer of '<gdb:memory-port>'
  24620. MEMORY-PORT.
  24621. -- Scheme Procedure: set-memory-port-write-buffer-size! memory-port
  24622. size
  24623. Set the size of the write buffer of '<gdb:memory-port>' MEMORY-PORT
  24624. to SIZE. The result is unspecified.
  24625. A memory port is closed like any other port, with 'close-port'.
  24626. Combined with Guile's 'bytevectors', memory ports provide a lot of
  24627. utility. For example, to fill a buffer of 10 integers in memory, one
  24628. can do something like the following.
  24629. ;; In the program: int buffer[10];
  24630. (use-modules (rnrs bytevectors))
  24631. (use-modules (rnrs io ports))
  24632. (define addr (parse-and-eval "buffer"))
  24633. (define n 10)
  24634. (define byte-size (* n 4))
  24635. (define mem-port (open-memory #:mode "r+" #:start
  24636. (value->integer addr) #:size byte-size))
  24637. (define byte-vec (make-bytevector byte-size))
  24638. (do ((i 0 (+ i 1)))
  24639. ((>= i n))
  24640. (bytevector-s32-native-set! byte-vec (* i 4) (* i 42)))
  24641. (put-bytevector mem-port byte-vec)
  24642. (close-port mem-port)
  24643. 
  24644. File: gdb.info, Node: Iterators In Guile, Prev: Memory Ports in Guile, Up: Guile API
  24645. 23.3.3.25 Iterators In Guile
  24646. ............................
  24647. A simple iterator facility is provided to allow, for example, iterating
  24648. over the set of program symbols without having to first construct a list
  24649. of all of them. A useful contribution would be to add support for SRFI
  24650. 41 and SRFI 45.
  24651. -- Scheme Procedure: make-iterator object progress next!
  24652. A '<gdb:iterator>' object is constructed with the 'make-iterator'
  24653. procedure. It takes three arguments: the object to be iterated
  24654. over, an object to record the progress of the iteration, and a
  24655. procedure to return the next element in the iteration, or an
  24656. implementation chosen value to denote the end of iteration.
  24657. By convention, end of iteration is marked with
  24658. '(end-of-iteration)', and may be tested with the
  24659. 'end-of-iteration?' predicate. The result of '(end-of-iteration)'
  24660. is chosen so that it is not otherwise used by the '(gdb)' module.
  24661. If you are using '<gdb:iterator>' in your own code it is your
  24662. responsibility to maintain this invariant.
  24663. A trivial example for illustration's sake:
  24664. (use-modules (gdb iterator))
  24665. (define my-list (list 1 2 3))
  24666. (define iter
  24667. (make-iterator my-list my-list
  24668. (lambda (iter)
  24669. (let ((l (iterator-progress iter)))
  24670. (if (eq? l '())
  24671. (end-of-iteration)
  24672. (begin
  24673. (set-iterator-progress! iter (cdr l))
  24674. (car l)))))))
  24675. Here is a slightly more realistic example, which computes a list of
  24676. all the functions in 'my-global-block'.
  24677. (use-modules (gdb iterator))
  24678. (define this-sal (find-pc-line (frame-pc (selected-frame))))
  24679. (define this-symtab (sal-symtab this-sal))
  24680. (define this-global-block (symtab-global-block this-symtab))
  24681. (define syms-iter (make-block-symbols-iterator this-global-block))
  24682. (define functions (iterator-filter symbol-function? syms-iter))
  24683. -- Scheme Procedure: iterator? object
  24684. Return '#t' if OBJECT is a '<gdb:iterator>' object. Otherwise
  24685. return '#f'.
  24686. -- Scheme Procedure: iterator-object iterator
  24687. Return the first argument that was passed to 'make-iterator'. This
  24688. is the object being iterated over.
  24689. -- Scheme Procedure: iterator-progress iterator
  24690. Return the object tracking iteration progress.
  24691. -- Scheme Procedure: set-iterator-progress! iterator new-value
  24692. Set the object tracking iteration progress.
  24693. -- Scheme Procedure: iterator-next! iterator
  24694. Invoke the procedure that was the third argument to
  24695. 'make-iterator', passing it one argument, the '<gdb:iterator>'
  24696. object. The result is either the next element in the iteration, or
  24697. an end marker as implemented by the 'next!' procedure. By
  24698. convention the end marker is the result of '(end-of-iteration)'.
  24699. -- Scheme Procedure: end-of-iteration
  24700. Return the Scheme object that denotes end of iteration.
  24701. -- Scheme Procedure: end-of-iteration? object
  24702. Return '#t' if OBJECT is the end of iteration marker. Otherwise
  24703. return '#f'.
  24704. These functions are provided by the '(gdb iterator)' module to assist
  24705. in using iterators.
  24706. -- Scheme Procedure: make-list-iterator list
  24707. Return a '<gdb:iterator>' object that will iterate over LIST.
  24708. -- Scheme Procedure: iterator->list iterator
  24709. Return the elements pointed to by ITERATOR as a list.
  24710. -- Scheme Procedure: iterator-map proc iterator
  24711. Return the list of objects obtained by applying PROC to the object
  24712. pointed to by ITERATOR and to each subsequent object.
  24713. -- Scheme Procedure: iterator-for-each proc iterator
  24714. Apply PROC to each element pointed to by ITERATOR. The result is
  24715. unspecified.
  24716. -- Scheme Procedure: iterator-filter pred iterator
  24717. Return the list of elements pointed to by ITERATOR that satisfy
  24718. PRED.
  24719. -- Scheme Procedure: iterator-until pred iterator
  24720. Run ITERATOR until the result of '(pred element)' is true and
  24721. return that as the result. Otherwise return '#f'.
  24722. 
  24723. File: gdb.info, Node: Guile Auto-loading, Next: Guile Modules, Prev: Guile API, Up: Guile
  24724. 23.3.4 Guile Auto-loading
  24725. -------------------------
  24726. When a new object file is read (for example, due to the 'file' command,
  24727. or because the inferior has loaded a shared library), GDB will look for
  24728. Guile support scripts in two ways: 'OBJFILE-gdb.scm' and the
  24729. '.debug_gdb_scripts' section. *Note Auto-loading extensions::.
  24730. The auto-loading feature is useful for supplying application-specific
  24731. debugging commands and scripts.
  24732. Auto-loading can be enabled or disabled, and the list of auto-loaded
  24733. scripts can be printed.
  24734. 'set auto-load guile-scripts [on|off]'
  24735. Enable or disable the auto-loading of Guile scripts.
  24736. 'show auto-load guile-scripts'
  24737. Show whether auto-loading of Guile scripts is enabled or disabled.
  24738. 'info auto-load guile-scripts [REGEXP]'
  24739. Print the list of all Guile scripts that GDB auto-loaded.
  24740. Also printed is the list of Guile scripts that were mentioned in
  24741. the '.debug_gdb_scripts' section and were not found. This is
  24742. useful because their names are not printed when GDB tries to load
  24743. them and fails. There may be many of them, and printing an error
  24744. message for each one is problematic.
  24745. If REGEXP is supplied only Guile scripts with matching names are
  24746. printed.
  24747. Example:
  24748. (gdb) info auto-load guile-scripts
  24749. Loaded Script
  24750. Yes scm-section-script.scm
  24751. full name: /tmp/scm-section-script.scm
  24752. No my-foo-pretty-printers.scm
  24753. When reading an auto-loaded file, GDB sets the "current objfile".
  24754. This is available via the 'current-objfile' procedure (*note Objfiles In
  24755. Guile::). This can be useful for registering objfile-specific
  24756. pretty-printers.
  24757. 
  24758. File: gdb.info, Node: Guile Modules, Prev: Guile Auto-loading, Up: Guile
  24759. 23.3.5 Guile Modules
  24760. --------------------
  24761. GDB comes with several modules to assist writing Guile code.
  24762. * Menu:
  24763. * Guile Printing Module:: Building and registering pretty-printers
  24764. * Guile Types Module:: Utilities for working with types
  24765. 
  24766. File: gdb.info, Node: Guile Printing Module, Next: Guile Types Module, Up: Guile Modules
  24767. 23.3.5.1 Guile Printing Module
  24768. ..............................
  24769. This module provides a collection of utilities for working with
  24770. pretty-printers.
  24771. Usage:
  24772. (use-modules (gdb printing))
  24773. -- Scheme Procedure: prepend-pretty-printer! object printer
  24774. Add PRINTER to the front of the list of pretty-printers for OBJECT.
  24775. The OBJECT must either be a '<gdb:objfile>' object, or '#f' in
  24776. which case PRINTER is added to the global list of printers.
  24777. -- Scheme Procecure: append-pretty-printer! object printer
  24778. Add PRINTER to the end of the list of pretty-printers for OBJECT.
  24779. The OBJECT must either be a '<gdb:objfile>' object, or '#f' in
  24780. which case PRINTER is added to the global list of printers.
  24781. 
  24782. File: gdb.info, Node: Guile Types Module, Prev: Guile Printing Module, Up: Guile Modules
  24783. 23.3.5.2 Guile Types Module
  24784. ...........................
  24785. This module provides a collection of utilities for working with
  24786. '<gdb:type>' objects.
  24787. Usage:
  24788. (use-modules (gdb types))
  24789. -- Scheme Procedure: get-basic-type type
  24790. Return TYPE with const and volatile qualifiers stripped, and with
  24791. typedefs and C++ references converted to the underlying type.
  24792. C++ example:
  24793. typedef const int const_int;
  24794. const_int foo (3);
  24795. const_int& foo_ref (foo);
  24796. int main () { return 0; }
  24797. Then in gdb:
  24798. (gdb) start
  24799. (gdb) guile (use-modules (gdb) (gdb types))
  24800. (gdb) guile (define foo-ref (parse-and-eval "foo_ref"))
  24801. (gdb) guile (get-basic-type (value-type foo-ref))
  24802. int
  24803. -- Scheme Procedure: type-has-field-deep? type field
  24804. Return '#t' if TYPE, assumed to be a type with fields (e.g., a
  24805. structure or union), has field FIELD. Otherwise return '#f'. This
  24806. searches baseclasses, whereas 'type-has-field?' does not.
  24807. -- Scheme Procedure: make-enum-hashtable enum-type
  24808. Return a Guile hash table produced from ENUM-TYPE. Elements in the
  24809. hash table are referenced with 'hashq-ref'.
  24810. 
  24811. File: gdb.info, Node: Auto-loading extensions, Next: Multiple Extension Languages, Prev: Guile, Up: Extending GDB
  24812. 23.4 Auto-loading extensions
  24813. ============================
  24814. GDB provides two mechanisms for automatically loading extensions when a
  24815. new object file is read (for example, due to the 'file' command, or
  24816. because the inferior has loaded a shared library): 'OBJFILE-gdb.EXT' and
  24817. the '.debug_gdb_scripts' section of modern file formats like ELF.
  24818. * Menu:
  24819. * objfile-gdb.ext file: objfile-gdbdotext file. The 'OBJFILE-gdb.EXT' file
  24820. * .debug_gdb_scripts section: dotdebug_gdb_scripts section. The '.debug_gdb_scripts' section
  24821. * Which flavor to choose?::
  24822. The auto-loading feature is useful for supplying application-specific
  24823. debugging commands and features.
  24824. Auto-loading can be enabled or disabled, and the list of auto-loaded
  24825. scripts can be printed. See the 'auto-loading' section of each
  24826. extension language for more information. For GDB command files see
  24827. *note Auto-loading sequences::. For Python files see *note Python
  24828. Auto-loading::.
  24829. Note that loading of this script file also requires accordingly
  24830. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  24831. 
  24832. File: gdb.info, Node: objfile-gdbdotext file, Next: dotdebug_gdb_scripts section, Up: Auto-loading extensions
  24833. 23.4.1 The 'OBJFILE-gdb.EXT' file
  24834. ---------------------------------
  24835. When a new object file is read, GDB looks for a file named
  24836. 'OBJFILE-gdb.EXT' (we call it SCRIPT-NAME below), where OBJFILE is the
  24837. object file's name and where EXT is the file extension for the extension
  24838. language:
  24839. 'OBJFILE-gdb.gdb'
  24840. GDB's own command language
  24841. 'OBJFILE-gdb.py'
  24842. Python
  24843. 'OBJFILE-gdb.scm'
  24844. Guile
  24845. SCRIPT-NAME is formed by ensuring that the file name of OBJFILE is
  24846. absolute, following all symlinks, and resolving '.' and '..' components,
  24847. and appending the '-gdb.EXT' suffix. If this file exists and is
  24848. readable, GDB will evaluate it as a script in the specified extension
  24849. language.
  24850. If this file does not exist, then GDB will look for SCRIPT-NAME file
  24851. in all of the directories as specified below.
  24852. Note that loading of these files requires an accordingly configured
  24853. 'auto-load safe-path' (*note Auto-loading safe path::).
  24854. For object files using '.exe' suffix GDB tries to load first the
  24855. scripts normally according to its '.exe' filename. But if no scripts
  24856. are found GDB also tries script filenames matching the object file
  24857. without its '.exe' suffix. This '.exe' stripping is case insensitive
  24858. and it is attempted on any platform. This makes the script filenames
  24859. compatible between Unix and MS-Windows hosts.
  24860. 'set auto-load scripts-directory [DIRECTORIES]'
  24861. Control GDB auto-loaded scripts location. Multiple directory
  24862. entries may be delimited by the host platform path separator in use
  24863. (':' on Unix, ';' on MS-Windows and MS-DOS).
  24864. Each entry here needs to be covered also by the security setting
  24865. 'set auto-load safe-path' (*note set auto-load safe-path::).
  24866. This variable defaults to '$debugdir:$datadir/auto-load'. The
  24867. default 'set auto-load safe-path' value can be also overriden by
  24868. GDB configuration option '--with-auto-load-dir'.
  24869. Any reference to '$debugdir' will get replaced by
  24870. DEBUG-FILE-DIRECTORY value (*note Separate Debug Files::) and any
  24871. reference to '$datadir' will get replaced by DATA-DIRECTORY which
  24872. is determined at GDB startup (*note Data Files::). '$debugdir' and
  24873. '$datadir' must be placed as a directory component -- either alone
  24874. or delimited by '/' or '\' directory separators, depending on the
  24875. host platform.
  24876. The list of directories uses path separator (':' on GNU and Unix
  24877. systems, ';' on MS-Windows and MS-DOS) to separate directories,
  24878. similarly to the 'PATH' environment variable.
  24879. 'show auto-load scripts-directory'
  24880. Show GDB auto-loaded scripts location.
  24881. 'add-auto-load-scripts-directory [DIRECTORIES...]'
  24882. Add an entry (or list of entries) to the list of auto-loaded
  24883. scripts locations. Multiple entries may be delimited by the host
  24884. platform path separator in use.
  24885. GDB does not track which files it has already auto-loaded this way.
  24886. GDB will load the associated script every time the corresponding OBJFILE
  24887. is opened. So your '-gdb.EXT' file should be careful to avoid errors if
  24888. it is evaluated more than once.
  24889. 
  24890. File: gdb.info, Node: dotdebug_gdb_scripts section, Next: Which flavor to choose?, Prev: objfile-gdbdotext file, Up: Auto-loading extensions
  24891. 23.4.2 The '.debug_gdb_scripts' section
  24892. ---------------------------------------
  24893. For systems using file formats like ELF and COFF, when GDB loads a new
  24894. object file it will look for a special section named
  24895. '.debug_gdb_scripts'. If this section exists, its contents is a list of
  24896. null-terminated entries specifying scripts to load. Each entry begins
  24897. with a non-null prefix byte that specifies the kind of entry, typically
  24898. the extension language and whether the script is in a file or inlined in
  24899. '.debug_gdb_scripts'.
  24900. The following entries are supported:
  24901. 'SECTION_SCRIPT_ID_PYTHON_FILE = 1'
  24902. 'SECTION_SCRIPT_ID_SCHEME_FILE = 3'
  24903. 'SECTION_SCRIPT_ID_PYTHON_TEXT = 4'
  24904. 'SECTION_SCRIPT_ID_SCHEME_TEXT = 6'
  24905. 23.4.2.1 Script File Entries
  24906. ............................
  24907. If the entry specifies a file, GDB will look for the file first in the
  24908. current directory and then along the source search path (*note
  24909. Specifying Source Directories: Source Path.), except that '$cdir' is not
  24910. searched, since the compilation directory is not relevant to scripts.
  24911. File entries can be placed in section '.debug_gdb_scripts' with, for
  24912. example, this GCC macro for Python scripts.
  24913. /* Note: The "MS" section flags are to remove duplicates. */
  24914. #define DEFINE_GDB_PY_SCRIPT(script_name) \
  24915. asm("\
  24916. .pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n\
  24917. .byte 1 /* Python */\n\
  24918. .asciz \"" script_name "\"\n\
  24919. .popsection \n\
  24920. ");
  24921. For Guile scripts, replace '.byte 1' with '.byte 3'. Then one can
  24922. reference the macro in a header or source file like this:
  24923. DEFINE_GDB_PY_SCRIPT ("my-app-scripts.py")
  24924. The script name may include directories if desired.
  24925. Note that loading of this script file also requires accordingly
  24926. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  24927. If the macro invocation is put in a header, any application or
  24928. library using this header will get a reference to the specified script,
  24929. and with the use of '"MS"' attributes on the section, the linker will
  24930. remove duplicates.
  24931. 23.4.2.2 Script Text Entries
  24932. ............................
  24933. Script text entries allow to put the executable script in the entry
  24934. itself instead of loading it from a file. The first line of the entry,
  24935. everything after the prefix byte and up to the first newline ('0xa')
  24936. character, is the script name, and must not contain any kind of space
  24937. character, e.g., spaces or tabs. The rest of the entry, up to the
  24938. trailing null byte, is the script to execute in the specified language.
  24939. The name needs to be unique among all script names, as GDB executes each
  24940. script only once based on its name.
  24941. Here is an example from file 'py-section-script.c' in the GDB
  24942. testsuite.
  24943. #include "symcat.h"
  24944. #include "gdb/section-scripts.h"
  24945. asm(
  24946. ".pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n"
  24947. ".byte " XSTRING (SECTION_SCRIPT_ID_PYTHON_TEXT) "\n"
  24948. ".ascii \"gdb.inlined-script\\n\"\n"
  24949. ".ascii \"class test_cmd (gdb.Command):\\n\"\n"
  24950. ".ascii \" def __init__ (self):\\n\"\n"
  24951. ".ascii \" super (test_cmd, self).__init__ ("
  24952. "\\\"test-cmd\\\", gdb.COMMAND_OBSCURE)\\n\"\n"
  24953. ".ascii \" def invoke (self, arg, from_tty):\\n\"\n"
  24954. ".ascii \" print (\\\"test-cmd output, arg = %s\\\" % arg)\\n\"\n"
  24955. ".ascii \"test_cmd ()\\n\"\n"
  24956. ".byte 0\n"
  24957. ".popsection\n"
  24958. );
  24959. Loading of inlined scripts requires a properly configured 'auto-load
  24960. safe-path' (*note Auto-loading safe path::). The path to specify in
  24961. 'auto-load safe-path' is the path of the file containing the
  24962. '.debug_gdb_scripts' section.
  24963. 
  24964. File: gdb.info, Node: Which flavor to choose?, Prev: dotdebug_gdb_scripts section, Up: Auto-loading extensions
  24965. 23.4.3 Which flavor to choose?
  24966. ------------------------------
  24967. Given the multiple ways of auto-loading extensions, it might not always
  24968. be clear which one to choose. This section provides some guidance.
  24969. Benefits of the '-gdb.EXT' way:
  24970. * Can be used with file formats that don't support multiple sections.
  24971. * Ease of finding scripts for public libraries.
  24972. Scripts specified in the '.debug_gdb_scripts' section are searched
  24973. for in the source search path. For publicly installed libraries,
  24974. e.g., 'libstdc++', there typically isn't a source directory in
  24975. which to find the script.
  24976. * Doesn't require source code additions.
  24977. Benefits of the '.debug_gdb_scripts' way:
  24978. * Works with static linking.
  24979. Scripts for libraries done the '-gdb.EXT' way require an objfile to
  24980. trigger their loading. When an application is statically linked
  24981. the only objfile available is the executable, and it is cumbersome
  24982. to attach all the scripts from all the input libraries to the
  24983. executable's '-gdb.EXT' script.
  24984. * Works with classes that are entirely inlined.
  24985. Some classes can be entirely inlined, and thus there may not be an
  24986. associated shared library to attach a '-gdb.EXT' script to.
  24987. * Scripts needn't be copied out of the source tree.
  24988. In some circumstances, apps can be built out of large collections
  24989. of internal libraries, and the build infrastructure necessary to
  24990. install the '-gdb.EXT' scripts in a place where GDB can find them
  24991. is cumbersome. It may be easier to specify the scripts in the
  24992. '.debug_gdb_scripts' section as relative paths, and add a path to
  24993. the top of the source tree to the source search path.
  24994. 
  24995. File: gdb.info, Node: Multiple Extension Languages, Next: Aliases, Prev: Auto-loading extensions, Up: Extending GDB
  24996. 23.5 Multiple Extension Languages
  24997. =================================
  24998. The Guile and Python extension languages do not share any state, and
  24999. generally do not interfere with each other. There are some things to be
  25000. aware of, however.
  25001. 23.5.1 Python comes first
  25002. -------------------------
  25003. Python was GDB's first extension language, and to avoid breaking
  25004. existing behaviour Python comes first. This is generally solved by the
  25005. "first one wins" principle. GDB maintains a list of enabled extension
  25006. languages, and when it makes a call to an extension language, (say to
  25007. pretty-print a value), it tries each in turn until an extension language
  25008. indicates it has performed the request (e.g., has returned the
  25009. pretty-printed form of a value). This extends to errors while
  25010. performing such requests: If an error happens while, for example, trying
  25011. to pretty-print an object then the error is reported and any following
  25012. extension languages are not tried.
  25013. 
  25014. File: gdb.info, Node: Aliases, Prev: Multiple Extension Languages, Up: Extending GDB
  25015. 23.6 Creating new spellings of existing commands
  25016. ================================================
  25017. It is often useful to define alternate spellings of existing commands.
  25018. For example, if a new GDB command defined in Python has a long name to
  25019. type, it is handy to have an abbreviated version of it that involves
  25020. less typing.
  25021. GDB itself uses aliases. For example 's' is an alias of the 'step'
  25022. command even though it is otherwise an ambiguous abbreviation of other
  25023. commands like 'set' and 'show'.
  25024. Aliases are also used to provide shortened or more common versions of
  25025. multi-word commands. For example, GDB provides the 'tty' alias of the
  25026. 'set inferior-tty' command.
  25027. You can define a new alias with the 'alias' command.
  25028. 'alias [-a] [--] ALIAS = COMMAND'
  25029. ALIAS specifies the name of the new alias. Each word of ALIAS must
  25030. consist of letters, numbers, dashes and underscores.
  25031. COMMAND specifies the name of an existing command that is being
  25032. aliased.
  25033. The '-a' option specifies that the new alias is an abbreviation of
  25034. the command. Abbreviations are not shown in command lists displayed by
  25035. the 'help' command.
  25036. The '--' option specifies the end of options, and is useful when
  25037. ALIAS begins with a dash.
  25038. Here is a simple example showing how to make an abbreviation of a
  25039. command so that there is less to type. Suppose you were tired of typing
  25040. 'disas', the current shortest unambiguous abbreviation of the
  25041. 'disassemble' command and you wanted an even shorter version named 'di'.
  25042. The following will accomplish this.
  25043. (gdb) alias -a di = disas
  25044. Note that aliases are different from user-defined commands. With a
  25045. user-defined command, you also need to write documentation for it with
  25046. the 'document' command. An alias automatically picks up the
  25047. documentation of the existing command.
  25048. Here is an example where we make 'elms' an abbreviation of 'elements'
  25049. in the 'set print elements' command. This is to show that you can make
  25050. an abbreviation of any part of a command.
  25051. (gdb) alias -a set print elms = set print elements
  25052. (gdb) alias -a show print elms = show print elements
  25053. (gdb) set p elms 20
  25054. (gdb) show p elms
  25055. Limit on string chars or array elements to print is 200.
  25056. Note that if you are defining an alias of a 'set' command, and you
  25057. want to have an alias for the corresponding 'show' command, then you
  25058. need to define the latter separately.
  25059. Unambiguously abbreviated commands are allowed in COMMAND and ALIAS,
  25060. just as they are normally.
  25061. (gdb) alias -a set pr elms = set p ele
  25062. Finally, here is an example showing the creation of a one word alias
  25063. for a more complex command. This creates alias 'spe' of the command
  25064. 'set print elements'.
  25065. (gdb) alias spe = set print elements
  25066. (gdb) spe 20
  25067. 
  25068. File: gdb.info, Node: Interpreters, Next: TUI, Prev: Extending GDB, Up: Top
  25069. 24 Command Interpreters
  25070. ***********************
  25071. GDB supports multiple command interpreters, and some command
  25072. infrastructure to allow users or user interface writers to switch
  25073. between interpreters or run commands in other interpreters.
  25074. GDB currently supports two command interpreters, the console
  25075. interpreter (sometimes called the command-line interpreter or CLI) and
  25076. the machine interface interpreter (or GDB/MI). This manual describes
  25077. both of these interfaces in great detail.
  25078. By default, GDB will start with the console interpreter. However,
  25079. the user may choose to start GDB with another interpreter by specifying
  25080. the '-i' or '--interpreter' startup options. Defined interpreters
  25081. include:
  25082. 'console'
  25083. The traditional console or command-line interpreter. This is the
  25084. most often used interpreter with GDB. With no interpreter
  25085. specified at runtime, GDB will use this interpreter.
  25086. 'mi'
  25087. The newest GDB/MI interface (currently 'mi3'). Used primarily by
  25088. programs wishing to use GDB as a backend for a debugger GUI or an
  25089. IDE. For more information, see *note The GDB/MI Interface: GDB/MI.
  25090. 'mi3'
  25091. The GDB/MI interface introduced in GDB 9.1.
  25092. 'mi2'
  25093. The GDB/MI interface introduced in GDB 6.0.
  25094. 'mi1'
  25095. The GDB/MI interface introduced in GDB 5.1.
  25096. You may execute commands in any interpreter from the current
  25097. interpreter using the appropriate command. If you are running the
  25098. console interpreter, simply use the 'interpreter-exec' command:
  25099. interpreter-exec mi "-data-list-register-names"
  25100. GDB/MI has a similar command, although it is only available in
  25101. versions of GDB which support GDB/MI version 2 (or greater).
  25102. Note that 'interpreter-exec' only changes the interpreter for the
  25103. duration of the specified command. It does not change the interpreter
  25104. permanently.
  25105. Although you may only choose a single interpreter at startup, it is
  25106. possible to run an independent interpreter on a specified input/output
  25107. device (usually a tty).
  25108. For example, consider a debugger GUI or IDE that wants to provide a
  25109. GDB console view. It may do so by embedding a terminal emulator widget
  25110. in its GUI, starting GDB in the traditional command-line mode with
  25111. stdin/stdout/stderr redirected to that terminal, and then creating an MI
  25112. interpreter running on a specified input/output device. The console
  25113. interpreter created by GDB at startup handles commands the user types in
  25114. the terminal widget, while the GUI controls and synchronizes state with
  25115. GDB using the separate MI interpreter.
  25116. To start a new secondary "user interface" running MI, use the
  25117. 'new-ui' command:
  25118. new-ui INTERPRETER TTY
  25119. The INTERPRETER parameter specifies the interpreter to run. This
  25120. accepts the same values as the 'interpreter-exec' command. For example,
  25121. 'console', 'mi', 'mi2', etc. The TTY parameter specifies the name of
  25122. the bidirectional file the interpreter uses for input/output, usually
  25123. the name of a pseudoterminal slave on Unix systems. For example:
  25124. (gdb) new-ui mi /dev/pts/9
  25125. runs an MI interpreter on '/dev/pts/9'.
  25126. 
  25127. File: gdb.info, Node: TUI, Next: Emacs, Prev: Interpreters, Up: Top
  25128. 25 GDB Text User Interface
  25129. **************************
  25130. * Menu:
  25131. * TUI Overview:: TUI overview
  25132. * TUI Keys:: TUI key bindings
  25133. * TUI Single Key Mode:: TUI single key mode
  25134. * TUI Commands:: TUI-specific commands
  25135. * TUI Configuration:: TUI configuration variables
  25136. The GDB Text User Interface (TUI) is a terminal interface which uses the
  25137. 'curses' library to show the source file, the assembly output, the
  25138. program registers and GDB commands in separate text windows. The TUI
  25139. mode is supported only on platforms where a suitable version of the
  25140. 'curses' library is available.
  25141. The TUI mode is enabled by default when you invoke GDB as 'gdb -tui'.
  25142. You can also switch in and out of TUI mode while GDB runs by using
  25143. various TUI commands and key bindings, such as 'tui enable' or 'C-x
  25144. C-a'. *Note TUI Commands: TUI Commands, and *note TUI Key Bindings: TUI
  25145. Keys.
  25146. 
  25147. File: gdb.info, Node: TUI Overview, Next: TUI Keys, Up: TUI
  25148. 25.1 TUI Overview
  25149. =================
  25150. In TUI mode, GDB can display several text windows:
  25151. _command_
  25152. This window is the GDB command window with the GDB prompt and the
  25153. GDB output. The GDB input is still managed using readline.
  25154. _source_
  25155. The source window shows the source file of the program. The
  25156. current line and active breakpoints are displayed in this window.
  25157. _assembly_
  25158. The assembly window shows the disassembly output of the program.
  25159. _register_
  25160. This window shows the processor registers. Registers are
  25161. highlighted when their values change.
  25162. The source and assembly windows show the current program position by
  25163. highlighting the current line and marking it with a '>' marker.
  25164. Breakpoints are indicated with two markers. The first marker indicates
  25165. the breakpoint type:
  25166. 'B'
  25167. Breakpoint which was hit at least once.
  25168. 'b'
  25169. Breakpoint which was never hit.
  25170. 'H'
  25171. Hardware breakpoint which was hit at least once.
  25172. 'h'
  25173. Hardware breakpoint which was never hit.
  25174. The second marker indicates whether the breakpoint is enabled or not:
  25175. '+'
  25176. Breakpoint is enabled.
  25177. '-'
  25178. Breakpoint is disabled.
  25179. The source, assembly and register windows are updated when the
  25180. current thread changes, when the frame changes, or when the program
  25181. counter changes.
  25182. These windows are not all visible at the same time. The command
  25183. window is always visible. The others can be arranged in several
  25184. layouts:
  25185. * source only,
  25186. * assembly only,
  25187. * source and assembly,
  25188. * source and registers, or
  25189. * assembly and registers.
  25190. A status line above the command window shows the following
  25191. information:
  25192. _target_
  25193. Indicates the current GDB target. (*note Specifying a Debugging
  25194. Target: Targets.).
  25195. _process_
  25196. Gives the current process or thread number. When no process is
  25197. being debugged, this field is set to 'No process'.
  25198. _function_
  25199. Gives the current function name for the selected frame. The name
  25200. is demangled if demangling is turned on (*note Print Settings::).
  25201. When there is no symbol corresponding to the current program
  25202. counter, the string '??' is displayed.
  25203. _line_
  25204. Indicates the current line number for the selected frame. When the
  25205. current line number is not known, the string '??' is displayed.
  25206. _pc_
  25207. Indicates the current program counter address.
  25208. 
  25209. File: gdb.info, Node: TUI Keys, Next: TUI Single Key Mode, Prev: TUI Overview, Up: TUI
  25210. 25.2 TUI Key Bindings
  25211. =====================
  25212. The TUI installs several key bindings in the readline keymaps (*note
  25213. Command Line Editing::). The following key bindings are installed for
  25214. both TUI mode and the GDB standard mode.
  25215. 'C-x C-a'
  25216. 'C-x a'
  25217. 'C-x A'
  25218. Enter or leave the TUI mode. When leaving the TUI mode, the curses
  25219. window management stops and GDB operates using its standard mode,
  25220. writing on the terminal directly. When reentering the TUI mode,
  25221. control is given back to the curses windows. The screen is then
  25222. refreshed.
  25223. This key binding uses the bindable Readline function
  25224. 'tui-switch-mode'.
  25225. 'C-x 1'
  25226. Use a TUI layout with only one window. The layout will either be
  25227. 'source' or 'assembly'. When the TUI mode is not active, it will
  25228. switch to the TUI mode.
  25229. Think of this key binding as the Emacs 'C-x 1' binding.
  25230. This key binding uses the bindable Readline function
  25231. 'tui-delete-other-windows'.
  25232. 'C-x 2'
  25233. Use a TUI layout with at least two windows. When the current
  25234. layout already has two windows, the next layout with two windows is
  25235. used. When a new layout is chosen, one window will always be
  25236. common to the previous layout and the new one.
  25237. Think of it as the Emacs 'C-x 2' binding.
  25238. This key binding uses the bindable Readline function
  25239. 'tui-change-windows'.
  25240. 'C-x o'
  25241. Change the active window. The TUI associates several key bindings
  25242. (like scrolling and arrow keys) with the active window. This
  25243. command gives the focus to the next TUI window.
  25244. Think of it as the Emacs 'C-x o' binding.
  25245. This key binding uses the bindable Readline function
  25246. 'tui-other-window'.
  25247. 'C-x s'
  25248. Switch in and out of the TUI SingleKey mode that binds single keys
  25249. to GDB commands (*note TUI Single Key Mode::).
  25250. This key binding uses the bindable Readline function 'next-keymap'.
  25251. The following key bindings only work in the TUI mode:
  25252. <PgUp>
  25253. Scroll the active window one page up.
  25254. <PgDn>
  25255. Scroll the active window one page down.
  25256. <Up>
  25257. Scroll the active window one line up.
  25258. <Down>
  25259. Scroll the active window one line down.
  25260. <Left>
  25261. Scroll the active window one column left.
  25262. <Right>
  25263. Scroll the active window one column right.
  25264. 'C-L'
  25265. Refresh the screen.
  25266. Because the arrow keys scroll the active window in the TUI mode, they
  25267. are not available for their normal use by readline unless the command
  25268. window has the focus. When another window is active, you must use other
  25269. readline key bindings such as 'C-p', 'C-n', 'C-b' and 'C-f' to control
  25270. the command window.
  25271. 
  25272. File: gdb.info, Node: TUI Single Key Mode, Next: TUI Commands, Prev: TUI Keys, Up: TUI
  25273. 25.3 TUI Single Key Mode
  25274. ========================
  25275. The TUI also provides a "SingleKey" mode, which binds several frequently
  25276. used GDB commands to single keys. Type 'C-x s' to switch into this
  25277. mode, where the following key bindings are used:
  25278. 'c'
  25279. continue
  25280. 'd'
  25281. down
  25282. 'f'
  25283. finish
  25284. 'n'
  25285. next
  25286. 'o'
  25287. nexti. The shortcut letter 'o' stands for "step Over".
  25288. 'q'
  25289. exit the SingleKey mode.
  25290. 'r'
  25291. run
  25292. 's'
  25293. step
  25294. 'i'
  25295. stepi. The shortcut letter 'i' stands for "step Into".
  25296. 'u'
  25297. up
  25298. 'v'
  25299. info locals
  25300. 'w'
  25301. where
  25302. Other keys temporarily switch to the GDB command prompt. The key
  25303. that was pressed is inserted in the editing buffer so that it is
  25304. possible to type most GDB commands without interaction with the TUI
  25305. SingleKey mode. Once the command is entered the TUI SingleKey mode is
  25306. restored. The only way to permanently leave this mode is by typing 'q'
  25307. or 'C-x s'.
  25308. If GDB was built with Readline 8.0 or later, the TUI SingleKey keymap
  25309. will be named 'SingleKey'. This can be used in '.inputrc' to add
  25310. additional bindings to this keymap.
  25311. 
  25312. File: gdb.info, Node: TUI Commands, Next: TUI Configuration, Prev: TUI Single Key Mode, Up: TUI
  25313. 25.4 TUI-specific Commands
  25314. ==========================
  25315. The TUI has specific commands to control the text windows. These
  25316. commands are always available, even when GDB is not in the TUI mode.
  25317. When GDB is in the standard mode, most of these commands will
  25318. automatically switch to the TUI mode.
  25319. Note that if GDB's 'stdout' is not connected to a terminal, or GDB
  25320. has been started with the machine interface interpreter (*note The
  25321. GDB/MI Interface: GDB/MI.), most of these commands will fail with an
  25322. error, because it would not be possible or desirable to enable curses
  25323. window management.
  25324. 'tui enable'
  25325. Activate TUI mode. The last active TUI window layout will be used
  25326. if TUI mode has previously been used in the current debugging
  25327. session, otherwise a default layout is used.
  25328. 'tui disable'
  25329. Disable TUI mode, returning to the console interpreter.
  25330. 'info win'
  25331. List and give the size of all displayed windows.
  25332. 'layout NAME'
  25333. Changes which TUI windows are displayed. In each layout the
  25334. command window is always displayed, the NAME parameter controls
  25335. which additional windows are displayed, and can be any of the
  25336. following:
  25337. 'next'
  25338. Display the next layout.
  25339. 'prev'
  25340. Display the previous layout.
  25341. 'src'
  25342. Display the source and command windows.
  25343. 'asm'
  25344. Display the assembly and command windows.
  25345. 'split'
  25346. Display the source, assembly, and command windows.
  25347. 'regs'
  25348. When in 'src' layout display the register, source, and command
  25349. windows. When in 'asm' or 'split' layout display the
  25350. register, assembler, and command windows.
  25351. 'focus NAME'
  25352. Changes which TUI window is currently active for scrolling. The
  25353. NAME parameter can be any of the following:
  25354. 'next'
  25355. Make the next window active for scrolling.
  25356. 'prev'
  25357. Make the previous window active for scrolling.
  25358. 'src'
  25359. Make the source window active for scrolling.
  25360. 'asm'
  25361. Make the assembly window active for scrolling.
  25362. 'regs'
  25363. Make the register window active for scrolling.
  25364. 'cmd'
  25365. Make the command window active for scrolling.
  25366. 'refresh'
  25367. Refresh the screen. This is similar to typing 'C-L'.
  25368. 'tui reg GROUP'
  25369. Changes the register group displayed in the tui register window to
  25370. GROUP. If the register window is not currently displayed this
  25371. command will cause the register window to be displayed. The list
  25372. of register groups, as well as their order is target specific. The
  25373. following groups are available on most targets:
  25374. 'next'
  25375. Repeatedly selecting this group will cause the display to
  25376. cycle through all of the available register groups.
  25377. 'prev'
  25378. Repeatedly selecting this group will cause the display to
  25379. cycle through all of the available register groups in the
  25380. reverse order to NEXT.
  25381. 'general'
  25382. Display the general registers.
  25383. 'float'
  25384. Display the floating point registers.
  25385. 'system'
  25386. Display the system registers.
  25387. 'vector'
  25388. Display the vector registers.
  25389. 'all'
  25390. Display all registers.
  25391. 'update'
  25392. Update the source window and the current execution point.
  25393. 'winheight NAME +COUNT'
  25394. 'winheight NAME -COUNT'
  25395. Change the height of the window NAME by COUNT lines. Positive
  25396. counts increase the height, while negative counts decrease it. The
  25397. NAME parameter can be one of 'src' (the source window), 'cmd' (the
  25398. command window), 'asm' (the disassembly window), or 'regs' (the
  25399. register display window).
  25400. 
  25401. File: gdb.info, Node: TUI Configuration, Prev: TUI Commands, Up: TUI
  25402. 25.5 TUI Configuration Variables
  25403. ================================
  25404. Several configuration variables control the appearance of TUI windows.
  25405. 'set tui border-kind KIND'
  25406. Select the border appearance for the source, assembly and register
  25407. windows. The possible values are the following:
  25408. 'space'
  25409. Use a space character to draw the border.
  25410. 'ascii'
  25411. Use ASCII characters '+', '-' and '|' to draw the border.
  25412. 'acs'
  25413. Use the Alternate Character Set to draw the border. The
  25414. border is drawn using character line graphics if the terminal
  25415. supports them.
  25416. 'set tui border-mode MODE'
  25417. 'set tui active-border-mode MODE'
  25418. Select the display attributes for the borders of the inactive
  25419. windows or the active window. The MODE can be one of the
  25420. following:
  25421. 'normal'
  25422. Use normal attributes to display the border.
  25423. 'standout'
  25424. Use standout mode.
  25425. 'reverse'
  25426. Use reverse video mode.
  25427. 'half'
  25428. Use half bright mode.
  25429. 'half-standout'
  25430. Use half bright and standout mode.
  25431. 'bold'
  25432. Use extra bright or bold mode.
  25433. 'bold-standout'
  25434. Use extra bright or bold and standout mode.
  25435. 'set tui tab-width NCHARS'
  25436. Set the width of tab stops to be NCHARS characters. This setting
  25437. affects the display of TAB characters in the source and assembly
  25438. windows.
  25439. 'set tui compact-source [on|off]'
  25440. Set whether the TUI source window is displayed in "compact" form.
  25441. The default display uses more space for line numbers and starts the
  25442. source text at the next tab stop; the compact display uses only as
  25443. much space as is needed for the line numbers in the current file,
  25444. and only a single space to separate the line numbers from the
  25445. source.
  25446. Note that the colors of the TUI borders can be controlled using the
  25447. appropriate 'set style' commands. *Note Output Styling::.
  25448. 
  25449. File: gdb.info, Node: Emacs, Next: GDB/MI, Prev: TUI, Up: Top
  25450. 26 Using GDB under GNU Emacs
  25451. ****************************
  25452. A special interface allows you to use GNU Emacs to view (and edit) the
  25453. source files for the program you are debugging with GDB.
  25454. To use this interface, use the command 'M-x gdb' in Emacs. Give the
  25455. executable file you want to debug as an argument. This command starts
  25456. GDB as a subprocess of Emacs, with input and output through a newly
  25457. created Emacs buffer.
  25458. Running GDB under Emacs can be just like running GDB normally except
  25459. for two things:
  25460. * All "terminal" input and output goes through an Emacs buffer,
  25461. called the GUD buffer.
  25462. This applies both to GDB commands and their output, and to the
  25463. input and output done by the program you are debugging.
  25464. This is useful because it means that you can copy the text of
  25465. previous commands and input them again; you can even use parts of
  25466. the output in this way.
  25467. All the facilities of Emacs' Shell mode are available for
  25468. interacting with your program. In particular, you can send signals
  25469. the usual way--for example, 'C-c C-c' for an interrupt, 'C-c C-z'
  25470. for a stop.
  25471. * GDB displays source code through Emacs.
  25472. Each time GDB displays a stack frame, Emacs automatically finds the
  25473. source file for that frame and puts an arrow ('=>') at the left
  25474. margin of the current line. Emacs uses a separate buffer for
  25475. source display, and splits the screen to show both your GDB session
  25476. and the source.
  25477. Explicit GDB 'list' or search commands still produce output as
  25478. usual, but you probably have no reason to use them from Emacs.
  25479. We call this "text command mode". Emacs 22.1, and later, also uses a
  25480. graphical mode, enabled by default, which provides further buffers that
  25481. can control the execution and describe the state of your program. *Note
  25482. (Emacs)GDB Graphical Interface::.
  25483. If you specify an absolute file name when prompted for the 'M-x gdb'
  25484. argument, then Emacs sets your current working directory to where your
  25485. program resides. If you only specify the file name, then Emacs sets
  25486. your current working directory to the directory associated with the
  25487. previous buffer. In this case, GDB may find your program by searching
  25488. your environment's 'PATH' variable, but on some operating systems it
  25489. might not find the source. So, although the GDB input and output
  25490. session proceeds normally, the auxiliary buffer does not display the
  25491. current source and line of execution.
  25492. The initial working directory of GDB is printed on the top line of
  25493. the GUD buffer and this serves as a default for the commands that
  25494. specify files for GDB to operate on. *Note Commands to Specify Files:
  25495. Files.
  25496. By default, 'M-x gdb' calls the program called 'gdb'. If you need to
  25497. call GDB by a different name (for example, if you keep several
  25498. configurations around, with different names) you can customize the Emacs
  25499. variable 'gud-gdb-command-name' to run the one you want.
  25500. In the GUD buffer, you can use these special Emacs commands in
  25501. addition to the standard Shell mode commands:
  25502. 'C-h m'
  25503. Describe the features of Emacs' GUD Mode.
  25504. 'C-c C-s'
  25505. Execute to another source line, like the GDB 'step' command; also
  25506. update the display window to show the current file and location.
  25507. 'C-c C-n'
  25508. Execute to next source line in this function, skipping all function
  25509. calls, like the GDB 'next' command. Then update the display window
  25510. to show the current file and location.
  25511. 'C-c C-i'
  25512. Execute one instruction, like the GDB 'stepi' command; update
  25513. display window accordingly.
  25514. 'C-c C-f'
  25515. Execute until exit from the selected stack frame, like the GDB
  25516. 'finish' command.
  25517. 'C-c C-r'
  25518. Continue execution of your program, like the GDB 'continue'
  25519. command.
  25520. 'C-c <'
  25521. Go up the number of frames indicated by the numeric argument (*note
  25522. Numeric Arguments: (Emacs)Arguments.), like the GDB 'up' command.
  25523. 'C-c >'
  25524. Go down the number of frames indicated by the numeric argument,
  25525. like the GDB 'down' command.
  25526. In any source file, the Emacs command 'C-x <SPC>' ('gud-break') tells
  25527. GDB to set a breakpoint on the source line point is on.
  25528. In text command mode, if you type 'M-x speedbar', Emacs displays a
  25529. separate frame which shows a backtrace when the GUD buffer is current.
  25530. Move point to any frame in the stack and type <RET> to make it become
  25531. the current frame and display the associated source in the source
  25532. buffer. Alternatively, click 'Mouse-2' to make the selected frame
  25533. become the current one. In graphical mode, the speedbar displays watch
  25534. expressions.
  25535. If you accidentally delete the source-display buffer, an easy way to
  25536. get it back is to type the command 'f' in the GDB buffer, to request a
  25537. frame display; when you run under Emacs, this recreates the source
  25538. buffer if necessary to show you the context of the current frame.
  25539. The source files displayed in Emacs are in ordinary Emacs buffers
  25540. which are visiting the source files in the usual way. You can edit the
  25541. files with these buffers if you wish; but keep in mind that GDB
  25542. communicates with Emacs in terms of line numbers. If you add or delete
  25543. lines from the text, the line numbers that GDB knows cease to correspond
  25544. properly with the code.
  25545. A more detailed description of Emacs' interaction with GDB is given
  25546. in the Emacs manual (*note (Emacs)Debuggers::).
  25547. 
  25548. File: gdb.info, Node: GDB/MI, Next: Annotations, Prev: Emacs, Up: Top
  25549. 27 The GDB/MI Interface
  25550. ***********************
  25551. Function and Purpose
  25552. ====================
  25553. GDB/MI is a line based machine oriented text interface to GDB and is
  25554. activated by specifying using the '--interpreter' command line option
  25555. (*note Mode Options::). It is specifically intended to support the
  25556. development of systems which use the debugger as just one small
  25557. component of a larger system.
  25558. This chapter is a specification of the GDB/MI interface. It is
  25559. written in the form of a reference manual.
  25560. Note that GDB/MI is still under construction, so some of the features
  25561. described below are incomplete and subject to change (*note GDB/MI
  25562. Development and Front Ends: GDB/MI Development and Front Ends.).
  25563. Notation and Terminology
  25564. ========================
  25565. This chapter uses the following notation:
  25566. * '|' separates two alternatives.
  25567. * '[ SOMETHING ]' indicates that SOMETHING is optional: it may or may
  25568. not be given.
  25569. * '( GROUP )*' means that GROUP inside the parentheses may repeat
  25570. zero or more times.
  25571. * '( GROUP )+' means that GROUP inside the parentheses may repeat one
  25572. or more times.
  25573. * '"STRING"' means a literal STRING.
  25574. * Menu:
  25575. * GDB/MI General Design::
  25576. * GDB/MI Command Syntax::
  25577. * GDB/MI Compatibility with CLI::
  25578. * GDB/MI Development and Front Ends::
  25579. * GDB/MI Output Records::
  25580. * GDB/MI Simple Examples::
  25581. * GDB/MI Command Description Format::
  25582. * GDB/MI Breakpoint Commands::
  25583. * GDB/MI Catchpoint Commands::
  25584. * GDB/MI Program Context::
  25585. * GDB/MI Thread Commands::
  25586. * GDB/MI Ada Tasking Commands::
  25587. * GDB/MI Program Execution::
  25588. * GDB/MI Stack Manipulation::
  25589. * GDB/MI Variable Objects::
  25590. * GDB/MI Data Manipulation::
  25591. * GDB/MI Tracepoint Commands::
  25592. * GDB/MI Symbol Query::
  25593. * GDB/MI File Commands::
  25594. * GDB/MI Target Manipulation::
  25595. * GDB/MI File Transfer Commands::
  25596. * GDB/MI Ada Exceptions Commands::
  25597. * GDB/MI Support Commands::
  25598. * GDB/MI Miscellaneous Commands::
  25599. 
  25600. File: gdb.info, Node: GDB/MI General Design, Next: GDB/MI Command Syntax, Up: GDB/MI
  25601. 27.1 GDB/MI General Design
  25602. ==========================
  25603. Interaction of a GDB/MI frontend with GDB involves three parts--commands
  25604. sent to GDB, responses to those commands and notifications. Each
  25605. command results in exactly one response, indicating either successful
  25606. completion of the command, or an error. For the commands that do not
  25607. resume the target, the response contains the requested information. For
  25608. the commands that resume the target, the response only indicates whether
  25609. the target was successfully resumed. Notifications is the mechanism for
  25610. reporting changes in the state of the target, or in GDB state, that
  25611. cannot conveniently be associated with a command and reported as part of
  25612. that command response.
  25613. The important examples of notifications are:
  25614. * Exec notifications. These are used to report changes in target
  25615. state--when a target is resumed, or stopped. It would not be
  25616. feasible to include this information in response of resuming
  25617. commands, because one resume commands can result in multiple events
  25618. in different threads. Also, quite some time may pass before any
  25619. event happens in the target, while a frontend needs to know whether
  25620. the resuming command itself was successfully executed.
  25621. * Console output, and status notifications. Console output
  25622. notifications are used to report output of CLI commands, as well as
  25623. diagnostics for other commands. Status notifications are used to
  25624. report the progress of a long-running operation. Naturally,
  25625. including this information in command response would mean no output
  25626. is produced until the command is finished, which is undesirable.
  25627. * General notifications. Commands may have various side effects on
  25628. the GDB or target state beyond their official purpose. For
  25629. example, a command may change the selected thread. Although such
  25630. changes can be included in command response, using notification
  25631. allows for more orthogonal frontend design.
  25632. There's no guarantee that whenever an MI command reports an error,
  25633. GDB or the target are in any specific state, and especially, the state
  25634. is not reverted to the state before the MI command was processed.
  25635. Therefore, whenever an MI command results in an error, we recommend that
  25636. the frontend refreshes all the information shown in the user interface.
  25637. * Menu:
  25638. * Context management::
  25639. * Asynchronous and non-stop modes::
  25640. * Thread groups::
  25641. 
  25642. File: gdb.info, Node: Context management, Next: Asynchronous and non-stop modes, Up: GDB/MI General Design
  25643. 27.1.1 Context management
  25644. -------------------------
  25645. 27.1.1.1 Threads and Frames
  25646. ...........................
  25647. In most cases when GDB accesses the target, this access is done in
  25648. context of a specific thread and frame (*note Frames::). Often, even
  25649. when accessing global data, the target requires that a thread be
  25650. specified. The CLI interface maintains the selected thread and frame,
  25651. and supplies them to target on each command. This is convenient,
  25652. because a command line user would not want to specify that information
  25653. explicitly on each command, and because user interacts with GDB via a
  25654. single terminal, so no confusion is possible as to what thread and frame
  25655. are the current ones.
  25656. In the case of MI, the concept of selected thread and frame is less
  25657. useful. First, a frontend can easily remember this information itself.
  25658. Second, a graphical frontend can have more than one window, each one
  25659. used for debugging a different thread, and the frontend might want to
  25660. access additional threads for internal purposes. This increases the
  25661. risk that by relying on implicitly selected thread, the frontend may be
  25662. operating on a wrong one. Therefore, each MI command should explicitly
  25663. specify which thread and frame to operate on. To make it possible, each
  25664. MI command accepts the '--thread' and '--frame' options, the value to
  25665. each is GDB global identifier for thread and frame to operate on.
  25666. Usually, each top-level window in a frontend allows the user to
  25667. select a thread and a frame, and remembers the user selection for
  25668. further operations. However, in some cases GDB may suggest that the
  25669. current thread or frame be changed. For example, when stopping on a
  25670. breakpoint it is reasonable to switch to the thread where breakpoint is
  25671. hit. For another example, if the user issues the CLI 'thread' or
  25672. 'frame' commands via the frontend, it is desirable to change the
  25673. frontend's selection to the one specified by user. GDB communicates the
  25674. suggestion to change current thread and frame using the
  25675. '=thread-selected' notification.
  25676. Note that historically, MI shares the selected thread with CLI, so
  25677. frontends used the '-thread-select' to execute commands in the right
  25678. context. However, getting this to work right is cumbersome. The
  25679. simplest way is for frontend to emit '-thread-select' command before
  25680. every command. This doubles the number of commands that need to be
  25681. sent. The alternative approach is to suppress '-thread-select' if the
  25682. selected thread in GDB is supposed to be identical to the thread the
  25683. frontend wants to operate on. However, getting this optimization right
  25684. can be tricky. In particular, if the frontend sends several commands to
  25685. GDB, and one of the commands changes the selected thread, then the
  25686. behaviour of subsequent commands will change. So, a frontend should
  25687. either wait for response from such problematic commands, or explicitly
  25688. add '-thread-select' for all subsequent commands. No frontend is known
  25689. to do this exactly right, so it is suggested to just always pass the
  25690. '--thread' and '--frame' options.
  25691. 27.1.1.2 Language
  25692. .................
  25693. The execution of several commands depends on which language is selected.
  25694. By default, the current language (*note show language::) is used. But
  25695. for commands known to be language-sensitive, it is recommended to use
  25696. the '--language' option. This option takes one argument, which is the
  25697. name of the language to use while executing the command. For instance:
  25698. -data-evaluate-expression --language c "sizeof (void*)"
  25699. ^done,value="4"
  25700. (gdb)
  25701. The valid language names are the same names accepted by the 'set
  25702. language' command (*note Manually::), excluding 'auto', 'local' or
  25703. 'unknown'.
  25704. 
  25705. File: gdb.info, Node: Asynchronous and non-stop modes, Next: Thread groups, Prev: Context management, Up: GDB/MI General Design
  25706. 27.1.2 Asynchronous command execution and non-stop mode
  25707. -------------------------------------------------------
  25708. On some targets, GDB is capable of processing MI commands even while the
  25709. target is running. This is called "asynchronous command execution"
  25710. (*note Background Execution::). The frontend may specify a preference
  25711. for asynchronous execution using the '-gdb-set mi-async 1' command,
  25712. which should be emitted before either running the executable or
  25713. attaching to the target. After the frontend has started the executable
  25714. or attached to the target, it can find if asynchronous execution is
  25715. enabled using the '-list-target-features' command.
  25716. '-gdb-set mi-async on'
  25717. '-gdb-set mi-async off'
  25718. Set whether MI is in asynchronous mode.
  25719. When 'off', which is the default, MI execution commands (e.g.,
  25720. '-exec-continue') are foreground commands, and GDB waits for the
  25721. program to stop before processing further commands.
  25722. When 'on', MI execution commands are background execution commands
  25723. (e.g., '-exec-continue' becomes the equivalent of the 'c&' CLI
  25724. command), and so GDB is capable of processing MI commands even
  25725. while the target is running.
  25726. '-gdb-show mi-async'
  25727. Show whether MI asynchronous mode is enabled.
  25728. Note: In GDB version 7.7 and earlier, this option was called
  25729. 'target-async' instead of 'mi-async', and it had the effect of both
  25730. putting MI in asynchronous mode and making CLI background commands
  25731. possible. CLI background commands are now always possible "out of the
  25732. box" if the target supports them. The old spelling is kept as a
  25733. deprecated alias for backwards compatibility.
  25734. Even if GDB can accept a command while target is running, many
  25735. commands that access the target do not work when the target is running.
  25736. Therefore, asynchronous command execution is most useful when combined
  25737. with non-stop mode (*note Non-Stop Mode::). Then, it is possible to
  25738. examine the state of one thread, while other threads are running.
  25739. When a given thread is running, MI commands that try to access the
  25740. target in the context of that thread may not work, or may work only on
  25741. some targets. In particular, commands that try to operate on thread's
  25742. stack will not work, on any target. Commands that read memory, or
  25743. modify breakpoints, may work or not work, depending on the target. Note
  25744. that even commands that operate on global state, such as 'print', 'set',
  25745. and breakpoint commands, still access the target in the context of a
  25746. specific thread, so frontend should try to find a stopped thread and
  25747. perform the operation on that thread (using the '--thread' option).
  25748. Which commands will work in the context of a running thread is highly
  25749. target dependent. However, the two commands '-exec-interrupt', to stop
  25750. a thread, and '-thread-info', to find the state of a thread, will always
  25751. work.
  25752. 
  25753. File: gdb.info, Node: Thread groups, Prev: Asynchronous and non-stop modes, Up: GDB/MI General Design
  25754. 27.1.3 Thread groups
  25755. --------------------
  25756. GDB may be used to debug several processes at the same time. On some
  25757. platforms, GDB may support debugging of several hardware systems, each
  25758. one having several cores with several different processes running on
  25759. each core. This section describes the MI mechanism to support such
  25760. debugging scenarios.
  25761. The key observation is that regardless of the structure of the
  25762. target, MI can have a global list of threads, because most commands that
  25763. accept the '--thread' option do not need to know what process that
  25764. thread belongs to. Therefore, it is not necessary to introduce neither
  25765. additional '--process' option, nor an notion of the current process in
  25766. the MI interface. The only strictly new feature that is required is the
  25767. ability to find how the threads are grouped into processes.
  25768. To allow the user to discover such grouping, and to support arbitrary
  25769. hierarchy of machines/cores/processes, MI introduces the concept of a
  25770. "thread group". Thread group is a collection of threads and other
  25771. thread groups. A thread group always has a string identifier, a type,
  25772. and may have additional attributes specific to the type. A new command,
  25773. '-list-thread-groups', returns the list of top-level thread groups,
  25774. which correspond to processes that GDB is debugging at the moment. By
  25775. passing an identifier of a thread group to the '-list-thread-groups'
  25776. command, it is possible to obtain the members of specific thread group.
  25777. To allow the user to easily discover processes, and other objects, he
  25778. wishes to debug, a concept of "available thread group" is introduced.
  25779. Available thread group is an thread group that GDB is not debugging, but
  25780. that can be attached to, using the '-target-attach' command. The list
  25781. of available top-level thread groups can be obtained using
  25782. '-list-thread-groups --available'. In general, the content of a thread
  25783. group may be only retrieved only after attaching to that thread group.
  25784. Thread groups are related to inferiors (*note Inferiors and
  25785. Programs::). Each inferior corresponds to a thread group of a special
  25786. type 'process', and some additional operations are permitted on such
  25787. thread groups.
  25788. 
  25789. File: gdb.info, Node: GDB/MI Command Syntax, Next: GDB/MI Compatibility with CLI, Prev: GDB/MI General Design, Up: GDB/MI
  25790. 27.2 GDB/MI Command Syntax
  25791. ==========================
  25792. * Menu:
  25793. * GDB/MI Input Syntax::
  25794. * GDB/MI Output Syntax::
  25795. 
  25796. File: gdb.info, Node: GDB/MI Input Syntax, Next: GDB/MI Output Syntax, Up: GDB/MI Command Syntax
  25797. 27.2.1 GDB/MI Input Syntax
  25798. --------------------------
  25799. 'COMMAND ==>'
  25800. 'CLI-COMMAND | MI-COMMAND'
  25801. 'CLI-COMMAND ==>'
  25802. '[ TOKEN ] CLI-COMMAND NL', where CLI-COMMAND is any existing GDB
  25803. CLI command.
  25804. 'MI-COMMAND ==>'
  25805. '[ TOKEN ] "-" OPERATION ( " " OPTION )* [ " --" ] ( " " PARAMETER
  25806. )* NL'
  25807. 'TOKEN ==>'
  25808. "any sequence of digits"
  25809. 'OPTION ==>'
  25810. '"-" PARAMETER [ " " PARAMETER ]'
  25811. 'PARAMETER ==>'
  25812. 'NON-BLANK-SEQUENCE | C-STRING'
  25813. 'OPERATION ==>'
  25814. _any of the operations described in this chapter_
  25815. 'NON-BLANK-SEQUENCE ==>'
  25816. _anything, provided it doesn't contain special characters such as
  25817. "-", NL, """ and of course " "_
  25818. 'C-STRING ==>'
  25819. '""" SEVEN-BIT-ISO-C-STRING-CONTENT """'
  25820. 'NL ==>'
  25821. 'CR | CR-LF'
  25822. Notes:
  25823. * The CLI commands are still handled by the MI interpreter; their
  25824. output is described below.
  25825. * The 'TOKEN', when present, is passed back when the command
  25826. finishes.
  25827. * Some MI commands accept optional arguments as part of the parameter
  25828. list. Each option is identified by a leading '-' (dash) and may be
  25829. followed by an optional argument parameter. Options occur first in
  25830. the parameter list and can be delimited from normal parameters
  25831. using '--' (this is useful when some parameters begin with a dash).
  25832. Pragmatics:
  25833. * We want easy access to the existing CLI syntax (for debugging).
  25834. * We want it to be easy to spot a MI operation.
  25835. 
  25836. File: gdb.info, Node: GDB/MI Output Syntax, Prev: GDB/MI Input Syntax, Up: GDB/MI Command Syntax
  25837. 27.2.2 GDB/MI Output Syntax
  25838. ---------------------------
  25839. The output from GDB/MI consists of zero or more out-of-band records
  25840. followed, optionally, by a single result record. This result record is
  25841. for the most recent command. The sequence of output records is
  25842. terminated by '(gdb)'.
  25843. If an input command was prefixed with a 'TOKEN' then the
  25844. corresponding output for that command will also be prefixed by that same
  25845. TOKEN.
  25846. 'OUTPUT ==>'
  25847. '( OUT-OF-BAND-RECORD )* [ RESULT-RECORD ] "(gdb)" NL'
  25848. 'RESULT-RECORD ==>'
  25849. ' [ TOKEN ] "^" RESULT-CLASS ( "," RESULT )* NL'
  25850. 'OUT-OF-BAND-RECORD ==>'
  25851. 'ASYNC-RECORD | STREAM-RECORD'
  25852. 'ASYNC-RECORD ==>'
  25853. 'EXEC-ASYNC-OUTPUT | STATUS-ASYNC-OUTPUT | NOTIFY-ASYNC-OUTPUT'
  25854. 'EXEC-ASYNC-OUTPUT ==>'
  25855. '[ TOKEN ] "*" ASYNC-OUTPUT NL'
  25856. 'STATUS-ASYNC-OUTPUT ==>'
  25857. '[ TOKEN ] "+" ASYNC-OUTPUT NL'
  25858. 'NOTIFY-ASYNC-OUTPUT ==>'
  25859. '[ TOKEN ] "=" ASYNC-OUTPUT NL'
  25860. 'ASYNC-OUTPUT ==>'
  25861. 'ASYNC-CLASS ( "," RESULT )*'
  25862. 'RESULT-CLASS ==>'
  25863. '"done" | "running" | "connected" | "error" | "exit"'
  25864. 'ASYNC-CLASS ==>'
  25865. '"stopped" | OTHERS' (where OTHERS will be added depending on the
  25866. needs--this is still in development).
  25867. 'RESULT ==>'
  25868. ' VARIABLE "=" VALUE'
  25869. 'VARIABLE ==>'
  25870. ' STRING '
  25871. 'VALUE ==>'
  25872. ' CONST | TUPLE | LIST '
  25873. 'CONST ==>'
  25874. 'C-STRING'
  25875. 'TUPLE ==>'
  25876. ' "{}" | "{" RESULT ( "," RESULT )* "}" '
  25877. 'LIST ==>'
  25878. ' "[]" | "[" VALUE ( "," VALUE )* "]" | "[" RESULT ( "," RESULT )*
  25879. "]" '
  25880. 'STREAM-RECORD ==>'
  25881. 'CONSOLE-STREAM-OUTPUT | TARGET-STREAM-OUTPUT | LOG-STREAM-OUTPUT'
  25882. 'CONSOLE-STREAM-OUTPUT ==>'
  25883. '"~" C-STRING NL'
  25884. 'TARGET-STREAM-OUTPUT ==>'
  25885. '"@" C-STRING NL'
  25886. 'LOG-STREAM-OUTPUT ==>'
  25887. '"&" C-STRING NL'
  25888. 'NL ==>'
  25889. 'CR | CR-LF'
  25890. 'TOKEN ==>'
  25891. _any sequence of digits_.
  25892. Notes:
  25893. * All output sequences end in a single line containing a period.
  25894. * The 'TOKEN' is from the corresponding request. Note that for all
  25895. async output, while the token is allowed by the grammar and may be
  25896. output by future versions of GDB for select async output messages,
  25897. it is generally omitted. Frontends should treat all async output
  25898. as reporting general changes in the state of the target and there
  25899. should be no need to associate async output to any prior command.
  25900. * STATUS-ASYNC-OUTPUT contains on-going status information about the
  25901. progress of a slow operation. It can be discarded. All status
  25902. output is prefixed by '+'.
  25903. * EXEC-ASYNC-OUTPUT contains asynchronous state change on the target
  25904. (stopped, started, disappeared). All async output is prefixed by
  25905. '*'.
  25906. * NOTIFY-ASYNC-OUTPUT contains supplementary information that the
  25907. client should handle (e.g., a new breakpoint information). All
  25908. notify output is prefixed by '='.
  25909. * CONSOLE-STREAM-OUTPUT is output that should be displayed as is in
  25910. the console. It is the textual response to a CLI command. All the
  25911. console output is prefixed by '~'.
  25912. * TARGET-STREAM-OUTPUT is the output produced by the target program.
  25913. All the target output is prefixed by '@'.
  25914. * LOG-STREAM-OUTPUT is output text coming from GDB's internals, for
  25915. instance messages that should be displayed as part of an error log.
  25916. All the log output is prefixed by '&'.
  25917. * New GDB/MI commands should only output LISTS containing VALUES.
  25918. *Note GDB/MI Stream Records: GDB/MI Stream Records, for more details
  25919. about the various output records.
  25920. 
  25921. File: gdb.info, Node: GDB/MI Compatibility with CLI, Next: GDB/MI Development and Front Ends, Prev: GDB/MI Command Syntax, Up: GDB/MI
  25922. 27.3 GDB/MI Compatibility with CLI
  25923. ==================================
  25924. For the developers convenience CLI commands can be entered directly, but
  25925. there may be some unexpected behaviour. For example, commands that
  25926. query the user will behave as if the user replied yes, breakpoint
  25927. command lists are not executed and some CLI commands, such as 'if',
  25928. 'when' and 'define', prompt for further input with '>', which is not
  25929. valid MI output.
  25930. This feature may be removed at some stage in the future and it is
  25931. recommended that front ends use the '-interpreter-exec' command (*note
  25932. -interpreter-exec::).
  25933. 
  25934. File: gdb.info, Node: GDB/MI Development and Front Ends, Next: GDB/MI Output Records, Prev: GDB/MI Compatibility with CLI, Up: GDB/MI
  25935. 27.4 GDB/MI Development and Front Ends
  25936. ======================================
  25937. The application which takes the MI output and presents the state of the
  25938. program being debugged to the user is called a "front end".
  25939. Since GDB/MI is used by a variety of front ends to GDB, changes to
  25940. the MI interface may break existing usage. This section describes how
  25941. the protocol changes and how to request previous version of the protocol
  25942. when it does.
  25943. Some changes in MI need not break a carefully designed front end, and
  25944. for these the MI version will remain unchanged. The following is a list
  25945. of changes that may occur within one level, so front ends should parse
  25946. MI output in a way that can handle them:
  25947. * New MI commands may be added.
  25948. * New fields may be added to the output of any MI command.
  25949. * The range of values for fields with specified values, e.g.,
  25950. 'in_scope' (*note -var-update::) may be extended.
  25951. If the changes are likely to break front ends, the MI version level
  25952. will be increased by one. The new versions of the MI protocol are not
  25953. compatible with the old versions. Old versions of MI remain available,
  25954. allowing front ends to keep using them until they are modified to use
  25955. the latest MI version.
  25956. Since '--interpreter=mi' always points to the latest MI version, it
  25957. is recommended that front ends request a specific version of MI when
  25958. launching GDB (e.g. '--interpreter=mi2') to make sure they get an
  25959. interpreter with the MI version they expect.
  25960. The following table gives a summary of the the released versions of
  25961. the MI interface: the version number, the version of GDB in which it
  25962. first appeared and the breaking changes compared to the previous
  25963. version.
  25964. MI GDB Breaking changes
  25965. versionversion
  25966. ----------------------------------------------------------------------------
  25967. 1 5.1 None
  25968. 2 6.0
  25969. * The '-environment-pwd', '-environment-directory' and
  25970. '-environment-path' commands now returns values using the
  25971. MI output syntax, rather than CLI output syntax.
  25972. * '-var-list-children''s 'children' result field is now a
  25973. list, rather than a tuple.
  25974. * '-var-update''s 'changelist' result field is now a list,
  25975. rather than a tuple.
  25976. 3 9.1
  25977. * The output of information about multi-location breakpoints
  25978. has changed in the responses to the '-break-insert' and
  25979. '-break-info' commands, as well as in the
  25980. '=breakpoint-created' and '=breakpoint-modified' events.
  25981. The multiple locations are now placed in a 'locations'
  25982. field, whose value is a list.
  25983. If your front end cannot yet migrate to a more recent version of the
  25984. MI protocol, you can nevertheless selectively enable specific features
  25985. available in those recent MI versions, using the following commands:
  25986. '-fix-multi-location-breakpoint-output'
  25987. Use the output for multi-location breakpoints which was introduced
  25988. by MI 3, even when using MI versions 2 or 1. This command has no
  25989. effect when using MI version 3 or later.
  25990. The best way to avoid unexpected changes in MI that might break your
  25991. front end is to make your project known to GDB developers and follow
  25992. development on <gdb@sourceware.org> and <gdb-patches@sourceware.org>.
  25993. 
  25994. File: gdb.info, Node: GDB/MI Output Records, Next: GDB/MI Simple Examples, Prev: GDB/MI Development and Front Ends, Up: GDB/MI
  25995. 27.5 GDB/MI Output Records
  25996. ==========================
  25997. * Menu:
  25998. * GDB/MI Result Records::
  25999. * GDB/MI Stream Records::
  26000. * GDB/MI Async Records::
  26001. * GDB/MI Breakpoint Information::
  26002. * GDB/MI Frame Information::
  26003. * GDB/MI Thread Information::
  26004. * GDB/MI Ada Exception Information::
  26005. 
  26006. File: gdb.info, Node: GDB/MI Result Records, Next: GDB/MI Stream Records, Up: GDB/MI Output Records
  26007. 27.5.1 GDB/MI Result Records
  26008. ----------------------------
  26009. In addition to a number of out-of-band notifications, the response to a
  26010. GDB/MI command includes one of the following result indications:
  26011. '"^done" [ "," RESULTS ]'
  26012. The synchronous operation was successful, 'RESULTS' are the return
  26013. values.
  26014. '"^running"'
  26015. This result record is equivalent to '^done'. Historically, it was
  26016. output instead of '^done' if the command has resumed the target.
  26017. This behaviour is maintained for backward compatibility, but all
  26018. frontends should treat '^done' and '^running' identically and rely
  26019. on the '*running' output record to determine which threads are
  26020. resumed.
  26021. '"^connected"'
  26022. GDB has connected to a remote target.
  26023. '"^error" "," "msg=" C-STRING [ "," "code=" C-STRING ]'
  26024. The operation failed. The 'msg=C-STRING' variable contains the
  26025. corresponding error message.
  26026. If present, the 'code=C-STRING' variable provides an error code on
  26027. which consumers can rely on to detect the corresponding error
  26028. condition. At present, only one error code is defined:
  26029. '"undefined-command"'
  26030. Indicates that the command causing the error does not exist.
  26031. '"^exit"'
  26032. GDB has terminated.
  26033. 
  26034. File: gdb.info, Node: GDB/MI Stream Records, Next: GDB/MI Async Records, Prev: GDB/MI Result Records, Up: GDB/MI Output Records
  26035. 27.5.2 GDB/MI Stream Records
  26036. ----------------------------
  26037. GDB internally maintains a number of output streams: the console, the
  26038. target, and the log. The output intended for each of these streams is
  26039. funneled through the GDB/MI interface using "stream records".
  26040. Each stream record begins with a unique "prefix character" which
  26041. identifies its stream (*note GDB/MI Output Syntax: GDB/MI Output
  26042. Syntax.). In addition to the prefix, each stream record contains a
  26043. 'STRING-OUTPUT'. This is either raw text (with an implicit new line) or
  26044. a quoted C string (which does not contain an implicit newline).
  26045. '"~" STRING-OUTPUT'
  26046. The console output stream contains text that should be displayed in
  26047. the CLI console window. It contains the textual responses to CLI
  26048. commands.
  26049. '"@" STRING-OUTPUT'
  26050. The target output stream contains any textual output from the
  26051. running target. This is only present when GDB's event loop is
  26052. truly asynchronous, which is currently only the case for remote
  26053. targets.
  26054. '"&" STRING-OUTPUT'
  26055. The log stream contains debugging messages being produced by GDB's
  26056. internals.
  26057. 
  26058. File: gdb.info, Node: GDB/MI Async Records, Next: GDB/MI Breakpoint Information, Prev: GDB/MI Stream Records, Up: GDB/MI Output Records
  26059. 27.5.3 GDB/MI Async Records
  26060. ---------------------------
  26061. "Async" records are used to notify the GDB/MI client of additional
  26062. changes that have occurred. Those changes can either be a consequence
  26063. of GDB/MI commands (e.g., a breakpoint modified) or a result of target
  26064. activity (e.g., target stopped).
  26065. The following is the list of possible async records:
  26066. '*running,thread-id="THREAD"'
  26067. The target is now running. The THREAD field can be the global
  26068. thread ID of the the thread that is now running, and it can be
  26069. 'all' if all threads are running. The frontend should assume that
  26070. no interaction with a running thread is possible after this
  26071. notification is produced. The frontend should not assume that this
  26072. notification is output only once for any command. GDB may emit
  26073. this notification several times, either for different threads,
  26074. because it cannot resume all threads together, or even for a single
  26075. thread, if the thread must be stepped though some code before
  26076. letting it run freely.
  26077. '*stopped,reason="REASON",thread-id="ID",stopped-threads="STOPPED",core="CORE"'
  26078. The target has stopped. The REASON field can have one of the
  26079. following values:
  26080. 'breakpoint-hit'
  26081. A breakpoint was reached.
  26082. 'watchpoint-trigger'
  26083. A watchpoint was triggered.
  26084. 'read-watchpoint-trigger'
  26085. A read watchpoint was triggered.
  26086. 'access-watchpoint-trigger'
  26087. An access watchpoint was triggered.
  26088. 'function-finished'
  26089. An -exec-finish or similar CLI command was accomplished.
  26090. 'location-reached'
  26091. An -exec-until or similar CLI command was accomplished.
  26092. 'watchpoint-scope'
  26093. A watchpoint has gone out of scope.
  26094. 'end-stepping-range'
  26095. An -exec-next, -exec-next-instruction, -exec-step,
  26096. -exec-step-instruction or similar CLI command was
  26097. accomplished.
  26098. 'exited-signalled'
  26099. The inferior exited because of a signal.
  26100. 'exited'
  26101. The inferior exited.
  26102. 'exited-normally'
  26103. The inferior exited normally.
  26104. 'signal-received'
  26105. A signal was received by the inferior.
  26106. 'solib-event'
  26107. The inferior has stopped due to a library being loaded or
  26108. unloaded. This can happen when 'stop-on-solib-events' (*note
  26109. Files::) is set or when a 'catch load' or 'catch unload'
  26110. catchpoint is in use (*note Set Catchpoints::).
  26111. 'fork'
  26112. The inferior has forked. This is reported when 'catch fork'
  26113. (*note Set Catchpoints::) has been used.
  26114. 'vfork'
  26115. The inferior has vforked. This is reported in when 'catch
  26116. vfork' (*note Set Catchpoints::) has been used.
  26117. 'syscall-entry'
  26118. The inferior entered a system call. This is reported when
  26119. 'catch syscall' (*note Set Catchpoints::) has been used.
  26120. 'syscall-return'
  26121. The inferior returned from a system call. This is reported
  26122. when 'catch syscall' (*note Set Catchpoints::) has been used.
  26123. 'exec'
  26124. The inferior called 'exec'. This is reported when 'catch
  26125. exec' (*note Set Catchpoints::) has been used.
  26126. The ID field identifies the global thread ID of the thread that
  26127. directly caused the stop - for example by hitting a breakpoint.
  26128. Depending on whether all-stop mode is in effect (*note All-Stop
  26129. Mode::), GDB may either stop all threads, or only the thread that
  26130. directly triggered the stop. If all threads are stopped, the
  26131. STOPPED field will have the value of '"all"'. Otherwise, the value
  26132. of the STOPPED field will be a list of thread identifiers.
  26133. Presently, this list will always include a single thread, but
  26134. frontend should be prepared to see several threads in the list.
  26135. The CORE field reports the processor core on which the stop event
  26136. has happened. This field may be absent if such information is not
  26137. available.
  26138. '=thread-group-added,id="ID"'
  26139. '=thread-group-removed,id="ID"'
  26140. A thread group was either added or removed. The ID field contains
  26141. the GDB identifier of the thread group. When a thread group is
  26142. added, it generally might not be associated with a running process.
  26143. When a thread group is removed, its id becomes invalid and cannot
  26144. be used in any way.
  26145. '=thread-group-started,id="ID",pid="PID"'
  26146. A thread group became associated with a running program, either
  26147. because the program was just started or the thread group was
  26148. attached to a program. The ID field contains the GDB identifier of
  26149. the thread group. The PID field contains process identifier,
  26150. specific to the operating system.
  26151. '=thread-group-exited,id="ID"[,exit-code="CODE"]'
  26152. A thread group is no longer associated with a running program,
  26153. either because the program has exited, or because it was detached
  26154. from. The ID field contains the GDB identifier of the thread
  26155. group. The CODE field is the exit code of the inferior; it exists
  26156. only when the inferior exited with some code.
  26157. '=thread-created,id="ID",group-id="GID"'
  26158. '=thread-exited,id="ID",group-id="GID"'
  26159. A thread either was created, or has exited. The ID field contains
  26160. the global GDB identifier of the thread. The GID field identifies
  26161. the thread group this thread belongs to.
  26162. '=thread-selected,id="ID"[,frame="FRAME"]'
  26163. Informs that the selected thread or frame were changed. This
  26164. notification is not emitted as result of the '-thread-select' or
  26165. '-stack-select-frame' commands, but is emitted whenever an MI
  26166. command that is not documented to change the selected thread and
  26167. frame actually changes them. In particular, invoking, directly or
  26168. indirectly (via user-defined command), the CLI 'thread' or 'frame'
  26169. commands, will generate this notification. Changing the thread or
  26170. frame from another user interface (see *note Interpreters::) will
  26171. also generate this notification.
  26172. The FRAME field is only present if the newly selected thread is
  26173. stopped. See *note GDB/MI Frame Information:: for the format of
  26174. its value.
  26175. We suggest that in response to this notification, front ends
  26176. highlight the selected thread and cause subsequent commands to
  26177. apply to that thread.
  26178. '=library-loaded,...'
  26179. Reports that a new library file was loaded by the program. This
  26180. notification has 5 fields--ID, TARGET-NAME, HOST-NAME,
  26181. SYMBOLS-LOADED and RANGES. The ID field is an opaque identifier of
  26182. the library. For remote debugging case, TARGET-NAME and HOST-NAME
  26183. fields give the name of the library file on the target, and on the
  26184. host respectively. For native debugging, both those fields have
  26185. the same value. The SYMBOLS-LOADED field is emitted only for
  26186. backward compatibility and should not be relied on to convey any
  26187. useful information. The THREAD-GROUP field, if present, specifies
  26188. the id of the thread group in whose context the library was loaded.
  26189. If the field is absent, it means the library was loaded in the
  26190. context of all present thread groups. The RANGES field specifies
  26191. the ranges of addresses belonging to this library.
  26192. '=library-unloaded,...'
  26193. Reports that a library was unloaded by the program. This
  26194. notification has 3 fields--ID, TARGET-NAME and HOST-NAME with the
  26195. same meaning as for the '=library-loaded' notification. The
  26196. THREAD-GROUP field, if present, specifies the id of the thread
  26197. group in whose context the library was unloaded. If the field is
  26198. absent, it means the library was unloaded in the context of all
  26199. present thread groups.
  26200. '=traceframe-changed,num=TFNUM,tracepoint=TPNUM'
  26201. '=traceframe-changed,end'
  26202. Reports that the trace frame was changed and its new number is
  26203. TFNUM. The number of the tracepoint associated with this trace
  26204. frame is TPNUM.
  26205. '=tsv-created,name=NAME,initial=INITIAL'
  26206. Reports that the new trace state variable NAME is created with
  26207. initial value INITIAL.
  26208. '=tsv-deleted,name=NAME'
  26209. '=tsv-deleted'
  26210. Reports that the trace state variable NAME is deleted or all trace
  26211. state variables are deleted.
  26212. '=tsv-modified,name=NAME,initial=INITIAL[,current=CURRENT]'
  26213. Reports that the trace state variable NAME is modified with the
  26214. initial value INITIAL. The current value CURRENT of trace state
  26215. variable is optional and is reported if the current value of trace
  26216. state variable is known.
  26217. '=breakpoint-created,bkpt={...}'
  26218. '=breakpoint-modified,bkpt={...}'
  26219. '=breakpoint-deleted,id=NUMBER'
  26220. Reports that a breakpoint was created, modified, or deleted,
  26221. respectively. Only user-visible breakpoints are reported to the MI
  26222. user.
  26223. The BKPT argument is of the same form as returned by the various
  26224. breakpoint commands; *Note GDB/MI Breakpoint Commands::. The
  26225. NUMBER is the ordinal number of the breakpoint.
  26226. Note that if a breakpoint is emitted in the result record of a
  26227. command, then it will not also be emitted in an async record.
  26228. '=record-started,thread-group="ID",method="METHOD"[,format="FORMAT"]'
  26229. '=record-stopped,thread-group="ID"'
  26230. Execution log recording was either started or stopped on an
  26231. inferior. The ID is the GDB identifier of the thread group
  26232. corresponding to the affected inferior.
  26233. The METHOD field indicates the method used to record execution. If
  26234. the method in use supports multiple recording formats, FORMAT will
  26235. be present and contain the currently used format. *Note Process
  26236. Record and Replay::, for existing method and format values.
  26237. '=cmd-param-changed,param=PARAM,value=VALUE'
  26238. Reports that a parameter of the command 'set PARAM' is changed to
  26239. VALUE. In the multi-word 'set' command, the PARAM is the whole
  26240. parameter list to 'set' command. For example, In command 'set
  26241. check type on', PARAM is 'check type' and VALUE is 'on'.
  26242. '=memory-changed,thread-group=ID,addr=ADDR,len=LEN[,type="code"]'
  26243. Reports that bytes from ADDR to DATA + LEN were written in an
  26244. inferior. The ID is the identifier of the thread group
  26245. corresponding to the affected inferior. The optional 'type="code"'
  26246. part is reported if the memory written to holds executable code.
  26247. 
  26248. File: gdb.info, Node: GDB/MI Breakpoint Information, Next: GDB/MI Frame Information, Prev: GDB/MI Async Records, Up: GDB/MI Output Records
  26249. 27.5.4 GDB/MI Breakpoint Information
  26250. ------------------------------------
  26251. When GDB reports information about a breakpoint, a tracepoint, a
  26252. watchpoint, or a catchpoint, it uses a tuple with the following fields:
  26253. 'number'
  26254. The breakpoint number.
  26255. 'type'
  26256. The type of the breakpoint. For ordinary breakpoints this will be
  26257. 'breakpoint', but many values are possible.
  26258. 'catch-type'
  26259. If the type of the breakpoint is 'catchpoint', then this indicates
  26260. the exact type of catchpoint.
  26261. 'disp'
  26262. This is the breakpoint disposition--either 'del', meaning that the
  26263. breakpoint will be deleted at the next stop, or 'keep', meaning
  26264. that the breakpoint will not be deleted.
  26265. 'enabled'
  26266. This indicates whether the breakpoint is enabled, in which case the
  26267. value is 'y', or disabled, in which case the value is 'n'. Note
  26268. that this is not the same as the field 'enable'.
  26269. 'addr'
  26270. The address of the breakpoint. This may be a hexidecimal number,
  26271. giving the address; or the string '<PENDING>', for a pending
  26272. breakpoint; or the string '<MULTIPLE>', for a breakpoint with
  26273. multiple locations. This field will not be present if no address
  26274. can be determined. For example, a watchpoint does not have an
  26275. address.
  26276. 'addr_flags'
  26277. Optional field containing any flags related to the address. These
  26278. flags are architecture-dependent; see *note Architectures:: for
  26279. their meaning for a particular CPU.
  26280. 'func'
  26281. If known, the function in which the breakpoint appears. If not
  26282. known, this field is not present.
  26283. 'filename'
  26284. The name of the source file which contains this function, if known.
  26285. If not known, this field is not present.
  26286. 'fullname'
  26287. The full file name of the source file which contains this function,
  26288. if known. If not known, this field is not present.
  26289. 'line'
  26290. The line number at which this breakpoint appears, if known. If not
  26291. known, this field is not present.
  26292. 'at'
  26293. If the source file is not known, this field may be provided. If
  26294. provided, this holds the address of the breakpoint, possibly
  26295. followed by a symbol name.
  26296. 'pending'
  26297. If this breakpoint is pending, this field is present and holds the
  26298. text used to set the breakpoint, as entered by the user.
  26299. 'evaluated-by'
  26300. Where this breakpoint's condition is evaluated, either 'host' or
  26301. 'target'.
  26302. 'thread'
  26303. If this is a thread-specific breakpoint, then this identifies the
  26304. thread in which the breakpoint can trigger.
  26305. 'task'
  26306. If this breakpoint is restricted to a particular Ada task, then
  26307. this field will hold the task identifier.
  26308. 'cond'
  26309. If the breakpoint is conditional, this is the condition expression.
  26310. 'ignore'
  26311. The ignore count of the breakpoint.
  26312. 'enable'
  26313. The enable count of the breakpoint.
  26314. 'traceframe-usage'
  26315. FIXME.
  26316. 'static-tracepoint-marker-string-id'
  26317. For a static tracepoint, the name of the static tracepoint marker.
  26318. 'mask'
  26319. For a masked watchpoint, this is the mask.
  26320. 'pass'
  26321. A tracepoint's pass count.
  26322. 'original-location'
  26323. The location of the breakpoint as originally specified by the user.
  26324. This field is optional.
  26325. 'times'
  26326. The number of times the breakpoint has been hit.
  26327. 'installed'
  26328. This field is only given for tracepoints. This is either 'y',
  26329. meaning that the tracepoint is installed, or 'n', meaning that it
  26330. is not.
  26331. 'what'
  26332. Some extra data, the exact contents of which are type-dependent.
  26333. 'locations'
  26334. This field is present if the breakpoint has multiple locations. It
  26335. is also exceptionally present if the breakpoint is enabled and has
  26336. a single, disabled location.
  26337. The value is a list of locations. The format of a location is
  26338. described below.
  26339. A location in a multi-location breakpoint is represented as a tuple
  26340. with the following fields:
  26341. 'number'
  26342. The location number as a dotted pair, like '1.2'. The first digit
  26343. is the number of the parent breakpoint. The second digit is the
  26344. number of the location within that breakpoint.
  26345. 'enabled'
  26346. This indicates whether the location is enabled, in which case the
  26347. value is 'y', or disabled, in which case the value is 'n'. Note
  26348. that this is not the same as the field 'enable'.
  26349. 'addr'
  26350. The address of this location as an hexidecimal number.
  26351. 'addr_flags'
  26352. Optional field containing any flags related to the address. These
  26353. flags are architecture-dependent; see *note Architectures:: for
  26354. their meaning for a particular CPU.
  26355. 'func'
  26356. If known, the function in which the location appears. If not
  26357. known, this field is not present.
  26358. 'file'
  26359. The name of the source file which contains this location, if known.
  26360. If not known, this field is not present.
  26361. 'fullname'
  26362. The full file name of the source file which contains this location,
  26363. if known. If not known, this field is not present.
  26364. 'line'
  26365. The line number at which this location appears, if known. If not
  26366. known, this field is not present.
  26367. 'thread-groups'
  26368. The thread groups this location is in.
  26369. For example, here is what the output of '-break-insert' (*note GDB/MI
  26370. Breakpoint Commands::) might be:
  26371. -> -break-insert main
  26372. <- ^done,bkpt={number="1",type="breakpoint",disp="keep",
  26373. enabled="y",addr="0x08048564",func="main",file="myprog.c",
  26374. fullname="/home/nickrob/myprog.c",line="68",thread-groups=["i1"],
  26375. times="0"}
  26376. <- (gdb)
  26377. 
  26378. File: gdb.info, Node: GDB/MI Frame Information, Next: GDB/MI Thread Information, Prev: GDB/MI Breakpoint Information, Up: GDB/MI Output Records
  26379. 27.5.5 GDB/MI Frame Information
  26380. -------------------------------
  26381. Response from many MI commands includes an information about stack
  26382. frame. This information is a tuple that may have the following fields:
  26383. 'level'
  26384. The level of the stack frame. The innermost frame has the level of
  26385. zero. This field is always present.
  26386. 'func'
  26387. The name of the function corresponding to the frame. This field
  26388. may be absent if GDB is unable to determine the function name.
  26389. 'addr'
  26390. The code address for the frame. This field is always present.
  26391. 'addr_flags'
  26392. Optional field containing any flags related to the address. These
  26393. flags are architecture-dependent; see *note Architectures:: for
  26394. their meaning for a particular CPU.
  26395. 'file'
  26396. The name of the source files that correspond to the frame's code
  26397. address. This field may be absent.
  26398. 'line'
  26399. The source line corresponding to the frames' code address. This
  26400. field may be absent.
  26401. 'from'
  26402. The name of the binary file (either executable or shared library)
  26403. the corresponds to the frame's code address. This field may be
  26404. absent.
  26405. 
  26406. File: gdb.info, Node: GDB/MI Thread Information, Next: GDB/MI Ada Exception Information, Prev: GDB/MI Frame Information, Up: GDB/MI Output Records
  26407. 27.5.6 GDB/MI Thread Information
  26408. --------------------------------
  26409. Whenever GDB has to report an information about a thread, it uses a
  26410. tuple with the following fields. The fields are always present unless
  26411. stated otherwise.
  26412. 'id'
  26413. The global numeric id assigned to the thread by GDB.
  26414. 'target-id'
  26415. The target-specific string identifying the thread.
  26416. 'details'
  26417. Additional information about the thread provided by the target. It
  26418. is supposed to be human-readable and not interpreted by the
  26419. frontend. This field is optional.
  26420. 'name'
  26421. The name of the thread. If the user specified a name using the
  26422. 'thread name' command, then this name is given. Otherwise, if GDB
  26423. can extract the thread name from the target, then that name is
  26424. given. If GDB cannot find the thread name, then this field is
  26425. omitted.
  26426. 'state'
  26427. The execution state of the thread, either 'stopped' or 'running',
  26428. depending on whether the thread is presently running.
  26429. 'frame'
  26430. The stack frame currently executing in the thread. This field is
  26431. only present if the thread is stopped. Its format is documented in
  26432. *note GDB/MI Frame Information::.
  26433. 'core'
  26434. The value of this field is an integer number of the processor core
  26435. the thread was last seen on. This field is optional.
  26436. 
  26437. File: gdb.info, Node: GDB/MI Ada Exception Information, Prev: GDB/MI Thread Information, Up: GDB/MI Output Records
  26438. 27.5.7 GDB/MI Ada Exception Information
  26439. ---------------------------------------
  26440. Whenever a '*stopped' record is emitted because the program stopped
  26441. after hitting an exception catchpoint (*note Set Catchpoints::), GDB
  26442. provides the name of the exception that was raised via the
  26443. 'exception-name' field. Also, for exceptions that were raised with an
  26444. exception message, GDB provides that message via the 'exception-message'
  26445. field.
  26446. 
  26447. File: gdb.info, Node: GDB/MI Simple Examples, Next: GDB/MI Command Description Format, Prev: GDB/MI Output Records, Up: GDB/MI
  26448. 27.6 Simple Examples of GDB/MI Interaction
  26449. ==========================================
  26450. This subsection presents several simple examples of interaction using
  26451. the GDB/MI interface. In these examples, '->' means that the following
  26452. line is passed to GDB/MI as input, while '<-' means the output received
  26453. from GDB/MI.
  26454. Note the line breaks shown in the examples are here only for
  26455. readability, they don't appear in the real output.
  26456. Setting a Breakpoint
  26457. --------------------
  26458. Setting a breakpoint generates synchronous output which contains
  26459. detailed information of the breakpoint.
  26460. -> -break-insert main
  26461. <- ^done,bkpt={number="1",type="breakpoint",disp="keep",
  26462. enabled="y",addr="0x08048564",func="main",file="myprog.c",
  26463. fullname="/home/nickrob/myprog.c",line="68",thread-groups=["i1"],
  26464. times="0"}
  26465. <- (gdb)
  26466. Program Execution
  26467. -----------------
  26468. Program execution generates asynchronous records and MI gives the reason
  26469. that execution stopped.
  26470. -> -exec-run
  26471. <- ^running
  26472. <- (gdb)
  26473. <- *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
  26474. frame={addr="0x08048564",func="main",
  26475. args=[{name="argc",value="1"},{name="argv",value="0xbfc4d4d4"}],
  26476. file="myprog.c",fullname="/home/nickrob/myprog.c",line="68",
  26477. arch="i386:x86_64"}
  26478. <- (gdb)
  26479. -> -exec-continue
  26480. <- ^running
  26481. <- (gdb)
  26482. <- *stopped,reason="exited-normally"
  26483. <- (gdb)
  26484. Quitting GDB
  26485. ------------
  26486. Quitting GDB just prints the result class '^exit'.
  26487. -> (gdb)
  26488. <- -gdb-exit
  26489. <- ^exit
  26490. Please note that '^exit' is printed immediately, but it might take
  26491. some time for GDB to actually exit. During that time, GDB performs
  26492. necessary cleanups, including killing programs being debugged or
  26493. disconnecting from debug hardware, so the frontend should wait till GDB
  26494. exits and should only forcibly kill GDB if it fails to exit in
  26495. reasonable time.
  26496. A Bad Command
  26497. -------------
  26498. Here's what happens if you pass a non-existent command:
  26499. -> -rubbish
  26500. <- ^error,msg="Undefined MI command: rubbish"
  26501. <- (gdb)
  26502. 
  26503. File: gdb.info, Node: GDB/MI Command Description Format, Next: GDB/MI Breakpoint Commands, Prev: GDB/MI Simple Examples, Up: GDB/MI
  26504. 27.7 GDB/MI Command Description Format
  26505. ======================================
  26506. The remaining sections describe blocks of commands. Each block of
  26507. commands is laid out in a fashion similar to this section.
  26508. Motivation
  26509. ----------
  26510. The motivation for this collection of commands.
  26511. Introduction
  26512. ------------
  26513. A brief introduction to this collection of commands as a whole.
  26514. Commands
  26515. --------
  26516. For each command in the block, the following is described:
  26517. Synopsis
  26518. ........
  26519. -command ARGS...
  26520. Result
  26521. ......
  26522. GDB Command
  26523. ...........
  26524. The corresponding GDB CLI command(s), if any.
  26525. Example
  26526. .......
  26527. Example(s) formatted for readability. Some of the described commands
  26528. have not been implemented yet and these are labeled N.A. (not
  26529. available).
  26530. 
  26531. File: gdb.info, Node: GDB/MI Breakpoint Commands, Next: GDB/MI Catchpoint Commands, Prev: GDB/MI Command Description Format, Up: GDB/MI
  26532. 27.8 GDB/MI Breakpoint Commands
  26533. ===============================
  26534. This section documents GDB/MI commands for manipulating breakpoints.
  26535. The '-break-after' Command
  26536. --------------------------
  26537. Synopsis
  26538. ........
  26539. -break-after NUMBER COUNT
  26540. The breakpoint number NUMBER is not in effect until it has been hit
  26541. COUNT times. To see how this is reflected in the output of the
  26542. '-break-list' command, see the description of the '-break-list' command
  26543. below.
  26544. GDB Command
  26545. ...........
  26546. The corresponding GDB command is 'ignore'.
  26547. Example
  26548. .......
  26549. (gdb)
  26550. -break-insert main
  26551. ^done,bkpt={number="1",type="breakpoint",disp="keep",
  26552. enabled="y",addr="0x000100d0",func="main",file="hello.c",
  26553. fullname="/home/foo/hello.c",line="5",thread-groups=["i1"],
  26554. times="0"}
  26555. (gdb)
  26556. -break-after 1 3
  26557. ~
  26558. ^done
  26559. (gdb)
  26560. -break-list
  26561. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  26562. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26563. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26564. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26565. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26566. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26567. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26568. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  26569. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  26570. line="5",thread-groups=["i1"],times="0",ignore="3"}]}
  26571. (gdb)
  26572. The '-break-commands' Command
  26573. -----------------------------
  26574. Synopsis
  26575. ........
  26576. -break-commands NUMBER [ COMMAND1 ... COMMANDN ]
  26577. Specifies the CLI commands that should be executed when breakpoint
  26578. NUMBER is hit. The parameters COMMAND1 to COMMANDN are the commands.
  26579. If no command is specified, any previously-set commands are cleared.
  26580. *Note Break Commands::. Typical use of this functionality is tracing a
  26581. program, that is, printing of values of some variables whenever
  26582. breakpoint is hit and then continuing.
  26583. GDB Command
  26584. ...........
  26585. The corresponding GDB command is 'commands'.
  26586. Example
  26587. .......
  26588. (gdb)
  26589. -break-insert main
  26590. ^done,bkpt={number="1",type="breakpoint",disp="keep",
  26591. enabled="y",addr="0x000100d0",func="main",file="hello.c",
  26592. fullname="/home/foo/hello.c",line="5",thread-groups=["i1"],
  26593. times="0"}
  26594. (gdb)
  26595. -break-commands 1 "print v" "continue"
  26596. ^done
  26597. (gdb)
  26598. The '-break-condition' Command
  26599. ------------------------------
  26600. Synopsis
  26601. ........
  26602. -break-condition NUMBER EXPR
  26603. Breakpoint NUMBER will stop the program only if the condition in EXPR
  26604. is true. The condition becomes part of the '-break-list' output (see
  26605. the description of the '-break-list' command below).
  26606. GDB Command
  26607. ...........
  26608. The corresponding GDB command is 'condition'.
  26609. Example
  26610. .......
  26611. (gdb)
  26612. -break-condition 1 1
  26613. ^done
  26614. (gdb)
  26615. -break-list
  26616. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  26617. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26618. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26619. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26620. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26621. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26622. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26623. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  26624. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  26625. line="5",cond="1",thread-groups=["i1"],times="0",ignore="3"}]}
  26626. (gdb)
  26627. The '-break-delete' Command
  26628. ---------------------------
  26629. Synopsis
  26630. ........
  26631. -break-delete ( BREAKPOINT )+
  26632. Delete the breakpoint(s) whose number(s) are specified in the
  26633. argument list. This is obviously reflected in the breakpoint list.
  26634. GDB Command
  26635. ...........
  26636. The corresponding GDB command is 'delete'.
  26637. Example
  26638. .......
  26639. (gdb)
  26640. -break-delete 1
  26641. ^done
  26642. (gdb)
  26643. -break-list
  26644. ^done,BreakpointTable={nr_rows="0",nr_cols="6",
  26645. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26646. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26647. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26648. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26649. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26650. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26651. body=[]}
  26652. (gdb)
  26653. The '-break-disable' Command
  26654. ----------------------------
  26655. Synopsis
  26656. ........
  26657. -break-disable ( BREAKPOINT )+
  26658. Disable the named BREAKPOINT(s). The field 'enabled' in the break
  26659. list is now set to 'n' for the named BREAKPOINT(s).
  26660. GDB Command
  26661. ...........
  26662. The corresponding GDB command is 'disable'.
  26663. Example
  26664. .......
  26665. (gdb)
  26666. -break-disable 2
  26667. ^done
  26668. (gdb)
  26669. -break-list
  26670. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  26671. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26672. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26673. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26674. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26675. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26676. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26677. body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="n",
  26678. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  26679. line="5",thread-groups=["i1"],times="0"}]}
  26680. (gdb)
  26681. The '-break-enable' Command
  26682. ---------------------------
  26683. Synopsis
  26684. ........
  26685. -break-enable ( BREAKPOINT )+
  26686. Enable (previously disabled) BREAKPOINT(s).
  26687. GDB Command
  26688. ...........
  26689. The corresponding GDB command is 'enable'.
  26690. Example
  26691. .......
  26692. (gdb)
  26693. -break-enable 2
  26694. ^done
  26695. (gdb)
  26696. -break-list
  26697. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  26698. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26699. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26700. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26701. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26702. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26703. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26704. body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
  26705. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  26706. line="5",thread-groups=["i1"],times="0"}]}
  26707. (gdb)
  26708. The '-break-info' Command
  26709. -------------------------
  26710. Synopsis
  26711. ........
  26712. -break-info BREAKPOINT
  26713. Get information about a single breakpoint.
  26714. The result is a table of breakpoints. *Note GDB/MI Breakpoint
  26715. Information::, for details on the format of each breakpoint in the
  26716. table.
  26717. GDB Command
  26718. ...........
  26719. The corresponding GDB command is 'info break BREAKPOINT'.
  26720. Example
  26721. .......
  26722. N.A.
  26723. The '-break-insert' Command
  26724. ---------------------------
  26725. Synopsis
  26726. ........
  26727. -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -a ]
  26728. [ -c CONDITION ] [ -i IGNORE-COUNT ]
  26729. [ -p THREAD-ID ] [ LOCATION ]
  26730. If specified, LOCATION, can be one of:
  26731. LINESPEC LOCATION
  26732. A linespec location. *Note Linespec Locations::.
  26733. EXPLICIT LOCATION
  26734. An explicit location. GDB/MI explicit locations are analogous to
  26735. the CLI's explicit locations using the option names listed below.
  26736. *Note Explicit Locations::.
  26737. '--source FILENAME'
  26738. The source file name of the location. This option requires
  26739. the use of either '--function' or '--line'.
  26740. '--function FUNCTION'
  26741. The name of a function or method.
  26742. '--label LABEL'
  26743. The name of a label.
  26744. '--line LINEOFFSET'
  26745. An absolute or relative line offset from the start of the
  26746. location.
  26747. ADDRESS LOCATION
  26748. An address location, *ADDRESS. *Note Address Locations::.
  26749. The possible optional parameters of this command are:
  26750. '-t'
  26751. Insert a temporary breakpoint.
  26752. '-h'
  26753. Insert a hardware breakpoint.
  26754. '-f'
  26755. If LOCATION cannot be parsed (for example if it refers to unknown
  26756. files or functions), create a pending breakpoint. Without this
  26757. flag, GDB will report an error, and won't create a breakpoint, if
  26758. LOCATION cannot be parsed.
  26759. '-d'
  26760. Create a disabled breakpoint.
  26761. '-a'
  26762. Create a tracepoint. *Note Tracepoints::. When this parameter is
  26763. used together with '-h', a fast tracepoint is created.
  26764. '-c CONDITION'
  26765. Make the breakpoint conditional on CONDITION.
  26766. '-i IGNORE-COUNT'
  26767. Initialize the IGNORE-COUNT.
  26768. '-p THREAD-ID'
  26769. Restrict the breakpoint to the thread with the specified global
  26770. THREAD-ID.
  26771. Result
  26772. ......
  26773. *Note GDB/MI Breakpoint Information::, for details on the format of the
  26774. resulting breakpoint.
  26775. Note: this format is open to change.
  26776. GDB Command
  26777. ...........
  26778. The corresponding GDB commands are 'break', 'tbreak', 'hbreak', and
  26779. 'thbreak'.
  26780. Example
  26781. .......
  26782. (gdb)
  26783. -break-insert main
  26784. ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",
  26785. fullname="/home/foo/recursive2.c,line="4",thread-groups=["i1"],
  26786. times="0"}
  26787. (gdb)
  26788. -break-insert -t foo
  26789. ^done,bkpt={number="2",addr="0x00010774",file="recursive2.c",
  26790. fullname="/home/foo/recursive2.c,line="11",thread-groups=["i1"],
  26791. times="0"}
  26792. (gdb)
  26793. -break-list
  26794. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  26795. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26796. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26797. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26798. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26799. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26800. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26801. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  26802. addr="0x0001072c", func="main",file="recursive2.c",
  26803. fullname="/home/foo/recursive2.c,"line="4",thread-groups=["i1"],
  26804. times="0"},
  26805. bkpt={number="2",type="breakpoint",disp="del",enabled="y",
  26806. addr="0x00010774",func="foo",file="recursive2.c",
  26807. fullname="/home/foo/recursive2.c",line="11",thread-groups=["i1"],
  26808. times="0"}]}
  26809. (gdb)
  26810. The '-dprintf-insert' Command
  26811. -----------------------------
  26812. Synopsis
  26813. ........
  26814. -dprintf-insert [ -t ] [ -f ] [ -d ]
  26815. [ -c CONDITION ] [ -i IGNORE-COUNT ]
  26816. [ -p THREAD-ID ] [ LOCATION ] [ FORMAT ]
  26817. [ ARGUMENT ]
  26818. If supplied, LOCATION may be specified the same way as for the
  26819. '-break-insert' command. *Note -break-insert::.
  26820. The possible optional parameters of this command are:
  26821. '-t'
  26822. Insert a temporary breakpoint.
  26823. '-f'
  26824. If LOCATION cannot be parsed (for example, if it refers to unknown
  26825. files or functions), create a pending breakpoint. Without this
  26826. flag, GDB will report an error, and won't create a breakpoint, if
  26827. LOCATION cannot be parsed.
  26828. '-d'
  26829. Create a disabled breakpoint.
  26830. '-c CONDITION'
  26831. Make the breakpoint conditional on CONDITION.
  26832. '-i IGNORE-COUNT'
  26833. Set the ignore count of the breakpoint (*note ignore count:
  26834. Conditions.) to IGNORE-COUNT.
  26835. '-p THREAD-ID'
  26836. Restrict the breakpoint to the thread with the specified global
  26837. THREAD-ID.
  26838. Result
  26839. ......
  26840. *Note GDB/MI Breakpoint Information::, for details on the format of the
  26841. resulting breakpoint.
  26842. GDB Command
  26843. ...........
  26844. The corresponding GDB command is 'dprintf'.
  26845. Example
  26846. .......
  26847. (gdb)
  26848. 4-dprintf-insert foo "At foo entry\n"
  26849. 4^done,bkpt={number="1",type="dprintf",disp="keep",enabled="y",
  26850. addr="0x000000000040061b",func="foo",file="mi-dprintf.c",
  26851. fullname="mi-dprintf.c",line="25",thread-groups=["i1"],
  26852. times="0",script={"printf \"At foo entry\\n\"","continue"},
  26853. original-location="foo"}
  26854. (gdb)
  26855. 5-dprintf-insert 26 "arg=%d, g=%d\n" arg g
  26856. 5^done,bkpt={number="2",type="dprintf",disp="keep",enabled="y",
  26857. addr="0x000000000040062a",func="foo",file="mi-dprintf.c",
  26858. fullname="mi-dprintf.c",line="26",thread-groups=["i1"],
  26859. times="0",script={"printf \"arg=%d, g=%d\\n\", arg, g","continue"},
  26860. original-location="mi-dprintf.c:26"}
  26861. (gdb)
  26862. The '-break-list' Command
  26863. -------------------------
  26864. Synopsis
  26865. ........
  26866. -break-list
  26867. Displays the list of inserted breakpoints, showing the following
  26868. fields:
  26869. 'Number'
  26870. number of the breakpoint
  26871. 'Type'
  26872. type of the breakpoint: 'breakpoint' or 'watchpoint'
  26873. 'Disposition'
  26874. should the breakpoint be deleted or disabled when it is hit: 'keep'
  26875. or 'nokeep'
  26876. 'Enabled'
  26877. is the breakpoint enabled or no: 'y' or 'n'
  26878. 'Address'
  26879. memory location at which the breakpoint is set
  26880. 'What'
  26881. logical location of the breakpoint, expressed by function name,
  26882. file name, line number
  26883. 'Thread-groups'
  26884. list of thread groups to which this breakpoint applies
  26885. 'Times'
  26886. number of times the breakpoint has been hit
  26887. If there are no breakpoints or watchpoints, the 'BreakpointTable'
  26888. 'body' field is an empty list.
  26889. GDB Command
  26890. ...........
  26891. The corresponding GDB command is 'info break'.
  26892. Example
  26893. .......
  26894. (gdb)
  26895. -break-list
  26896. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  26897. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26898. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26899. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26900. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26901. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26902. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26903. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  26904. addr="0x000100d0",func="main",file="hello.c",line="5",thread-groups=["i1"],
  26905. times="0"},
  26906. bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
  26907. addr="0x00010114",func="foo",file="hello.c",fullname="/home/foo/hello.c",
  26908. line="13",thread-groups=["i1"],times="0"}]}
  26909. (gdb)
  26910. Here's an example of the result when there are no breakpoints:
  26911. (gdb)
  26912. -break-list
  26913. ^done,BreakpointTable={nr_rows="0",nr_cols="6",
  26914. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26915. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26916. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26917. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26918. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26919. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26920. body=[]}
  26921. (gdb)
  26922. The '-break-passcount' Command
  26923. ------------------------------
  26924. Synopsis
  26925. ........
  26926. -break-passcount TRACEPOINT-NUMBER PASSCOUNT
  26927. Set the passcount for tracepoint TRACEPOINT-NUMBER to PASSCOUNT. If
  26928. the breakpoint referred to by TRACEPOINT-NUMBER is not a tracepoint,
  26929. error is emitted. This corresponds to CLI command 'passcount'.
  26930. The '-break-watch' Command
  26931. --------------------------
  26932. Synopsis
  26933. ........
  26934. -break-watch [ -a | -r ]
  26935. Create a watchpoint. With the '-a' option it will create an "access"
  26936. watchpoint, i.e., a watchpoint that triggers either on a read from or on
  26937. a write to the memory location. With the '-r' option, the watchpoint
  26938. created is a "read" watchpoint, i.e., it will trigger only when the
  26939. memory location is accessed for reading. Without either of the options,
  26940. the watchpoint created is a regular watchpoint, i.e., it will trigger
  26941. when the memory location is accessed for writing. *Note Setting
  26942. Watchpoints: Set Watchpoints.
  26943. Note that '-break-list' will report a single list of watchpoints and
  26944. breakpoints inserted.
  26945. GDB Command
  26946. ...........
  26947. The corresponding GDB commands are 'watch', 'awatch', and 'rwatch'.
  26948. Example
  26949. .......
  26950. Setting a watchpoint on a variable in the 'main' function:
  26951. (gdb)
  26952. -break-watch x
  26953. ^done,wpt={number="2",exp="x"}
  26954. (gdb)
  26955. -exec-continue
  26956. ^running
  26957. (gdb)
  26958. *stopped,reason="watchpoint-trigger",wpt={number="2",exp="x"},
  26959. value={old="-268439212",new="55"},
  26960. frame={func="main",args=[],file="recursive2.c",
  26961. fullname="/home/foo/bar/recursive2.c",line="5",arch="i386:x86_64"}
  26962. (gdb)
  26963. Setting a watchpoint on a variable local to a function. GDB will
  26964. stop the program execution twice: first for the variable changing value,
  26965. then for the watchpoint going out of scope.
  26966. (gdb)
  26967. -break-watch C
  26968. ^done,wpt={number="5",exp="C"}
  26969. (gdb)
  26970. -exec-continue
  26971. ^running
  26972. (gdb)
  26973. *stopped,reason="watchpoint-trigger",
  26974. wpt={number="5",exp="C"},value={old="-276895068",new="3"},
  26975. frame={func="callee4",args=[],
  26976. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  26977. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",
  26978. arch="i386:x86_64"}
  26979. (gdb)
  26980. -exec-continue
  26981. ^running
  26982. (gdb)
  26983. *stopped,reason="watchpoint-scope",wpnum="5",
  26984. frame={func="callee3",args=[{name="strarg",
  26985. value="0x11940 \"A string argument.\""}],
  26986. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  26987. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  26988. arch="i386:x86_64"}
  26989. (gdb)
  26990. Listing breakpoints and watchpoints, at different points in the
  26991. program execution. Note that once the watchpoint goes out of scope, it
  26992. is deleted.
  26993. (gdb)
  26994. -break-watch C
  26995. ^done,wpt={number="2",exp="C"}
  26996. (gdb)
  26997. -break-list
  26998. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  26999. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27000. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27001. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27002. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27003. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27004. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27005. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27006. addr="0x00010734",func="callee4",
  27007. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27008. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c"line="8",thread-groups=["i1"],
  27009. times="1"},
  27010. bkpt={number="2",type="watchpoint",disp="keep",
  27011. enabled="y",addr="",what="C",thread-groups=["i1"],times="0"}]}
  27012. (gdb)
  27013. -exec-continue
  27014. ^running
  27015. (gdb)
  27016. *stopped,reason="watchpoint-trigger",wpt={number="2",exp="C"},
  27017. value={old="-276895068",new="3"},
  27018. frame={func="callee4",args=[],
  27019. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27020. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",
  27021. arch="i386:x86_64"}
  27022. (gdb)
  27023. -break-list
  27024. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  27025. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27026. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27027. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27028. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27029. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27030. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27031. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27032. addr="0x00010734",func="callee4",
  27033. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27034. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",thread-groups=["i1"],
  27035. times="1"},
  27036. bkpt={number="2",type="watchpoint",disp="keep",
  27037. enabled="y",addr="",what="C",thread-groups=["i1"],times="-5"}]}
  27038. (gdb)
  27039. -exec-continue
  27040. ^running
  27041. ^done,reason="watchpoint-scope",wpnum="2",
  27042. frame={func="callee3",args=[{name="strarg",
  27043. value="0x11940 \"A string argument.\""}],
  27044. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27045. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  27046. arch="i386:x86_64"}
  27047. (gdb)
  27048. -break-list
  27049. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  27050. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  27051. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  27052. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  27053. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  27054. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  27055. {width="40",alignment="2",col_name="what",colhdr="What"}],
  27056. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  27057. addr="0x00010734",func="callee4",
  27058. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27059. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  27060. thread-groups=["i1"],times="1"}]}
  27061. (gdb)
  27062. 
  27063. File: gdb.info, Node: GDB/MI Catchpoint Commands, Next: GDB/MI Program Context, Prev: GDB/MI Breakpoint Commands, Up: GDB/MI
  27064. 27.9 GDB/MI Catchpoint Commands
  27065. ===============================
  27066. This section documents GDB/MI commands for manipulating catchpoints.
  27067. * Menu:
  27068. * Shared Library GDB/MI Catchpoint Commands::
  27069. * Ada Exception GDB/MI Catchpoint Commands::
  27070. * C++ Exception GDB/MI Catchpoint Commands::
  27071. 
  27072. File: gdb.info, Node: Shared Library GDB/MI Catchpoint Commands, Next: Ada Exception GDB/MI Catchpoint Commands, Up: GDB/MI Catchpoint Commands
  27073. 27.9.1 Shared Library GDB/MI Catchpoints
  27074. ----------------------------------------
  27075. The '-catch-load' Command
  27076. -------------------------
  27077. Synopsis
  27078. ........
  27079. -catch-load [ -t ] [ -d ] REGEXP
  27080. Add a catchpoint for library load events. If the '-t' option is
  27081. used, the catchpoint is a temporary one (*note Setting Breakpoints: Set
  27082. Breaks.). If the '-d' option is used, the catchpoint is created in a
  27083. disabled state. The 'regexp' argument is a regular expression used to
  27084. match the name of the loaded library.
  27085. GDB Command
  27086. ...........
  27087. The corresponding GDB command is 'catch load'.
  27088. Example
  27089. .......
  27090. -catch-load -t foo.so
  27091. ^done,bkpt={number="1",type="catchpoint",disp="del",enabled="y",
  27092. what="load of library matching foo.so",catch-type="load",times="0"}
  27093. (gdb)
  27094. The '-catch-unload' Command
  27095. ---------------------------
  27096. Synopsis
  27097. ........
  27098. -catch-unload [ -t ] [ -d ] REGEXP
  27099. Add a catchpoint for library unload events. If the '-t' option is
  27100. used, the catchpoint is a temporary one (*note Setting Breakpoints: Set
  27101. Breaks.). If the '-d' option is used, the catchpoint is created in a
  27102. disabled state. The 'regexp' argument is a regular expression used to
  27103. match the name of the unloaded library.
  27104. GDB Command
  27105. ...........
  27106. The corresponding GDB command is 'catch unload'.
  27107. Example
  27108. .......
  27109. -catch-unload -d bar.so
  27110. ^done,bkpt={number="2",type="catchpoint",disp="keep",enabled="n",
  27111. what="load of library matching bar.so",catch-type="unload",times="0"}
  27112. (gdb)
  27113. 
  27114. 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
  27115. 27.9.2 Ada Exception GDB/MI Catchpoints
  27116. ---------------------------------------
  27117. The following GDB/MI commands can be used to create catchpoints that
  27118. stop the execution when Ada exceptions are being raised.
  27119. The '-catch-assert' Command
  27120. ---------------------------
  27121. Synopsis
  27122. ........
  27123. -catch-assert [ -c CONDITION] [ -d ] [ -t ]
  27124. Add a catchpoint for failed Ada assertions.
  27125. The possible optional parameters for this command are:
  27126. '-c CONDITION'
  27127. Make the catchpoint conditional on CONDITION.
  27128. '-d'
  27129. Create a disabled catchpoint.
  27130. '-t'
  27131. Create a temporary catchpoint.
  27132. GDB Command
  27133. ...........
  27134. The corresponding GDB command is 'catch assert'.
  27135. Example
  27136. .......
  27137. -catch-assert
  27138. ^done,bkptno="5",bkpt={number="5",type="breakpoint",disp="keep",
  27139. enabled="y",addr="0x0000000000404888",what="failed Ada assertions",
  27140. thread-groups=["i1"],times="0",
  27141. original-location="__gnat_debug_raise_assert_failure"}
  27142. (gdb)
  27143. The '-catch-exception' Command
  27144. ------------------------------
  27145. Synopsis
  27146. ........
  27147. -catch-exception [ -c CONDITION] [ -d ] [ -e EXCEPTION-NAME ]
  27148. [ -t ] [ -u ]
  27149. Add a catchpoint stopping when Ada exceptions are raised. By
  27150. default, the command stops the program when any Ada exception gets
  27151. raised. But it is also possible, by using some of the optional
  27152. parameters described below, to create more selective catchpoints.
  27153. The possible optional parameters for this command are:
  27154. '-c CONDITION'
  27155. Make the catchpoint conditional on CONDITION.
  27156. '-d'
  27157. Create a disabled catchpoint.
  27158. '-e EXCEPTION-NAME'
  27159. Only stop when EXCEPTION-NAME is raised. This option cannot be
  27160. used combined with '-u'.
  27161. '-t'
  27162. Create a temporary catchpoint.
  27163. '-u'
  27164. Stop only when an unhandled exception gets raised. This option
  27165. cannot be used combined with '-e'.
  27166. GDB Command
  27167. ...........
  27168. The corresponding GDB commands are 'catch exception' and 'catch
  27169. exception unhandled'.
  27170. Example
  27171. .......
  27172. -catch-exception -e Program_Error
  27173. ^done,bkptno="4",bkpt={number="4",type="breakpoint",disp="keep",
  27174. enabled="y",addr="0x0000000000404874",
  27175. what="`Program_Error' Ada exception", thread-groups=["i1"],
  27176. times="0",original-location="__gnat_debug_raise_exception"}
  27177. (gdb)
  27178. The '-catch-handlers' Command
  27179. -----------------------------
  27180. Synopsis
  27181. ........
  27182. -catch-handlers [ -c CONDITION] [ -d ] [ -e EXCEPTION-NAME ]
  27183. [ -t ]
  27184. Add a catchpoint stopping when Ada exceptions are handled. By
  27185. default, the command stops the program when any Ada exception gets
  27186. handled. But it is also possible, by using some of the optional
  27187. parameters described below, to create more selective catchpoints.
  27188. The possible optional parameters for this command are:
  27189. '-c CONDITION'
  27190. Make the catchpoint conditional on CONDITION.
  27191. '-d'
  27192. Create a disabled catchpoint.
  27193. '-e EXCEPTION-NAME'
  27194. Only stop when EXCEPTION-NAME is handled.
  27195. '-t'
  27196. Create a temporary catchpoint.
  27197. GDB Command
  27198. ...........
  27199. The corresponding GDB command is 'catch handlers'.
  27200. Example
  27201. .......
  27202. -catch-handlers -e Constraint_Error
  27203. ^done,bkptno="4",bkpt={number="4",type="breakpoint",disp="keep",
  27204. enabled="y",addr="0x0000000000402f68",
  27205. what="`Constraint_Error' Ada exception handlers",thread-groups=["i1"],
  27206. times="0",original-location="__gnat_begin_handler"}
  27207. (gdb)
  27208. 
  27209. File: gdb.info, Node: C++ Exception GDB/MI Catchpoint Commands, Prev: Ada Exception GDB/MI Catchpoint Commands, Up: GDB/MI Catchpoint Commands
  27210. 27.9.3 C++ Exception GDB/MI Catchpoints
  27211. ---------------------------------------
  27212. The following GDB/MI commands can be used to create catchpoints that
  27213. stop the execution when C++ exceptions are being throw, rethrown, or
  27214. caught.
  27215. The '-catch-throw' Command
  27216. --------------------------
  27217. Synopsis
  27218. ........
  27219. -catch-throw [ -t ] [ -r REGEXP]
  27220. Stop when the debuggee throws a C++ exception. If REGEXP is given,
  27221. then only exceptions whose type matches the regular expression will be
  27222. caught.
  27223. If '-t' is given, then the catchpoint is enabled only for one stop,
  27224. the catchpoint is automatically deleted after stopping once for the
  27225. event.
  27226. GDB Command
  27227. ...........
  27228. The corresponding GDB commands are 'catch throw' and 'tcatch throw'
  27229. (*note Set Catchpoints::).
  27230. Example
  27231. .......
  27232. -catch-throw -r exception_type
  27233. ^done,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",
  27234. what="exception throw",catch-type="throw",
  27235. thread-groups=["i1"],
  27236. regexp="exception_type",times="0"}
  27237. (gdb)
  27238. -exec-run
  27239. ^running
  27240. (gdb)
  27241. ~"\n"
  27242. ~"Catchpoint 1 (exception thrown), 0x00007ffff7ae00ed
  27243. in __cxa_throw () from /lib64/libstdc++.so.6\n"
  27244. *stopped,bkptno="1",reason="breakpoint-hit",disp="keep",
  27245. frame={addr="0x00007ffff7ae00ed",func="__cxa_throw",
  27246. args=[],from="/lib64/libstdc++.so.6",arch="i386:x86-64"},
  27247. thread-id="1",stopped-threads="all",core="6"
  27248. (gdb)
  27249. The '-catch-rethrow' Command
  27250. ----------------------------
  27251. Synopsis
  27252. ........
  27253. -catch-rethrow [ -t ] [ -r REGEXP]
  27254. Stop when a C++ exception is re-thrown. If REGEXP is given, then
  27255. only exceptions whose type matches the regular expression will be
  27256. caught.
  27257. If '-t' is given, then the catchpoint is enabled only for one stop,
  27258. the catchpoint is automatically deleted after the first event is caught.
  27259. GDB Command
  27260. ...........
  27261. The corresponding GDB commands are 'catch rethrow' and 'tcatch rethrow'
  27262. (*note Set Catchpoints::).
  27263. Example
  27264. .......
  27265. -catch-rethrow -r exception_type
  27266. ^done,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",
  27267. what="exception rethrow",catch-type="rethrow",
  27268. thread-groups=["i1"],
  27269. regexp="exception_type",times="0"}
  27270. (gdb)
  27271. -exec-run
  27272. ^running
  27273. (gdb)
  27274. ~"\n"
  27275. ~"Catchpoint 1 (exception rethrown), 0x00007ffff7ae00ed
  27276. in __cxa_rethrow () from /lib64/libstdc++.so.6\n"
  27277. *stopped,bkptno="1",reason="breakpoint-hit",disp="keep",
  27278. frame={addr="0x00007ffff7ae00ed",func="__cxa_rethrow",
  27279. args=[],from="/lib64/libstdc++.so.6",arch="i386:x86-64"},
  27280. thread-id="1",stopped-threads="all",core="6"
  27281. (gdb)
  27282. The '-catch-catch' Command
  27283. --------------------------
  27284. Synopsis
  27285. ........
  27286. -catch-catch [ -t ] [ -r REGEXP]
  27287. Stop when the debuggee catches a C++ exception. If REGEXP is given,
  27288. then only exceptions whose type matches the regular expression will be
  27289. caught.
  27290. If '-t' is given, then the catchpoint is enabled only for one stop,
  27291. the catchpoint is automatically deleted after the first event is caught.
  27292. GDB Command
  27293. ...........
  27294. The corresponding GDB commands are 'catch catch' and 'tcatch catch'
  27295. (*note Set Catchpoints::).
  27296. Example
  27297. .......
  27298. -catch-catch -r exception_type
  27299. ^done,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",
  27300. what="exception catch",catch-type="catch",
  27301. thread-groups=["i1"],
  27302. regexp="exception_type",times="0"}
  27303. (gdb)
  27304. -exec-run
  27305. ^running
  27306. (gdb)
  27307. ~"\n"
  27308. ~"Catchpoint 1 (exception caught), 0x00007ffff7ae00ed
  27309. in __cxa_begin_catch () from /lib64/libstdc++.so.6\n"
  27310. *stopped,bkptno="1",reason="breakpoint-hit",disp="keep",
  27311. frame={addr="0x00007ffff7ae00ed",func="__cxa_begin_catch",
  27312. args=[],from="/lib64/libstdc++.so.6",arch="i386:x86-64"},
  27313. thread-id="1",stopped-threads="all",core="6"
  27314. (gdb)
  27315. 
  27316. File: gdb.info, Node: GDB/MI Program Context, Next: GDB/MI Thread Commands, Prev: GDB/MI Catchpoint Commands, Up: GDB/MI
  27317. 27.10 GDB/MI Program Context
  27318. ============================
  27319. The '-exec-arguments' Command
  27320. -----------------------------
  27321. Synopsis
  27322. ........
  27323. -exec-arguments ARGS
  27324. Set the inferior program arguments, to be used in the next
  27325. '-exec-run'.
  27326. GDB Command
  27327. ...........
  27328. The corresponding GDB command is 'set args'.
  27329. Example
  27330. .......
  27331. (gdb)
  27332. -exec-arguments -v word
  27333. ^done
  27334. (gdb)
  27335. The '-environment-cd' Command
  27336. -----------------------------
  27337. Synopsis
  27338. ........
  27339. -environment-cd PATHDIR
  27340. Set GDB's working directory.
  27341. GDB Command
  27342. ...........
  27343. The corresponding GDB command is 'cd'.
  27344. Example
  27345. .......
  27346. (gdb)
  27347. -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
  27348. ^done
  27349. (gdb)
  27350. The '-environment-directory' Command
  27351. ------------------------------------
  27352. Synopsis
  27353. ........
  27354. -environment-directory [ -r ] [ PATHDIR ]+
  27355. Add directories PATHDIR to beginning of search path for source files.
  27356. If the '-r' option is used, the search path is reset to the default
  27357. search path. If directories PATHDIR are supplied in addition to the
  27358. '-r' option, the search path is first reset and then addition occurs as
  27359. normal. Multiple directories may be specified, separated by blanks.
  27360. Specifying multiple directories in a single command results in the
  27361. directories added to the beginning of the search path in the same order
  27362. they were presented in the command. If blanks are needed as part of a
  27363. directory name, double-quotes should be used around the name. In the
  27364. command output, the path will show up separated by the system
  27365. directory-separator character. The directory-separator character must
  27366. not be used in any directory name. If no directories are specified, the
  27367. current search path is displayed.
  27368. GDB Command
  27369. ...........
  27370. The corresponding GDB command is 'dir'.
  27371. Example
  27372. .......
  27373. (gdb)
  27374. -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
  27375. ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
  27376. (gdb)
  27377. -environment-directory ""
  27378. ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
  27379. (gdb)
  27380. -environment-directory -r /home/jjohnstn/src/gdb /usr/src
  27381. ^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
  27382. (gdb)
  27383. -environment-directory -r
  27384. ^done,source-path="$cdir:$cwd"
  27385. (gdb)
  27386. The '-environment-path' Command
  27387. -------------------------------
  27388. Synopsis
  27389. ........
  27390. -environment-path [ -r ] [ PATHDIR ]+
  27391. Add directories PATHDIR to beginning of search path for object files.
  27392. If the '-r' option is used, the search path is reset to the original
  27393. search path that existed at gdb start-up. If directories PATHDIR are
  27394. supplied in addition to the '-r' option, the search path is first reset
  27395. and then addition occurs as normal. Multiple directories may be
  27396. specified, separated by blanks. Specifying multiple directories in a
  27397. single command results in the directories added to the beginning of the
  27398. search path in the same order they were presented in the command. If
  27399. blanks are needed as part of a directory name, double-quotes should be
  27400. used around the name. In the command output, the path will show up
  27401. separated by the system directory-separator character. The
  27402. directory-separator character must not be used in any directory name.
  27403. If no directories are specified, the current path is displayed.
  27404. GDB Command
  27405. ...........
  27406. The corresponding GDB command is 'path'.
  27407. Example
  27408. .......
  27409. (gdb)
  27410. -environment-path
  27411. ^done,path="/usr/bin"
  27412. (gdb)
  27413. -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
  27414. ^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
  27415. (gdb)
  27416. -environment-path -r /usr/local/bin
  27417. ^done,path="/usr/local/bin:/usr/bin"
  27418. (gdb)
  27419. The '-environment-pwd' Command
  27420. ------------------------------
  27421. Synopsis
  27422. ........
  27423. -environment-pwd
  27424. Show the current working directory.
  27425. GDB Command
  27426. ...........
  27427. The corresponding GDB command is 'pwd'.
  27428. Example
  27429. .......
  27430. (gdb)
  27431. -environment-pwd
  27432. ^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
  27433. (gdb)
  27434. 
  27435. File: gdb.info, Node: GDB/MI Thread Commands, Next: GDB/MI Ada Tasking Commands, Prev: GDB/MI Program Context, Up: GDB/MI
  27436. 27.11 GDB/MI Thread Commands
  27437. ============================
  27438. The '-thread-info' Command
  27439. --------------------------
  27440. Synopsis
  27441. ........
  27442. -thread-info [ THREAD-ID ]
  27443. Reports information about either a specific thread, if the THREAD-ID
  27444. parameter is present, or about all threads. THREAD-ID is the thread's
  27445. global thread ID. When printing information about all threads, also
  27446. reports the global ID of the current thread.
  27447. GDB Command
  27448. ...........
  27449. The 'info thread' command prints the same information about all threads.
  27450. Result
  27451. ......
  27452. The result contains the following attributes:
  27453. 'threads'
  27454. A list of threads. The format of the elements of the list is
  27455. described in *note GDB/MI Thread Information::.
  27456. 'current-thread-id'
  27457. The global id of the currently selected thread. This field is
  27458. omitted if there is no selected thread (for example, when the
  27459. selected inferior is not running, and therefore has no threads) or
  27460. if a THREAD-ID argument was passed to the command.
  27461. Example
  27462. .......
  27463. -thread-info
  27464. ^done,threads=[
  27465. {id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
  27466. frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",
  27467. args=[]},state="running"},
  27468. {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
  27469. frame={level="0",addr="0x0804891f",func="foo",
  27470. args=[{name="i",value="10"}],
  27471. file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"},
  27472. state="running"}],
  27473. current-thread-id="1"
  27474. (gdb)
  27475. The '-thread-list-ids' Command
  27476. ------------------------------
  27477. Synopsis
  27478. ........
  27479. -thread-list-ids
  27480. Produces a list of the currently known global GDB thread ids. At the
  27481. end of the list it also prints the total number of such threads.
  27482. This command is retained for historical reasons, the '-thread-info'
  27483. command should be used instead.
  27484. GDB Command
  27485. ...........
  27486. Part of 'info threads' supplies the same information.
  27487. Example
  27488. .......
  27489. (gdb)
  27490. -thread-list-ids
  27491. ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},
  27492. current-thread-id="1",number-of-threads="3"
  27493. (gdb)
  27494. The '-thread-select' Command
  27495. ----------------------------
  27496. Synopsis
  27497. ........
  27498. -thread-select THREAD-ID
  27499. Make thread with global thread number THREAD-ID the current thread.
  27500. It prints the number of the new current thread, and the topmost frame
  27501. for that thread.
  27502. This command is deprecated in favor of explicitly using the
  27503. '--thread' option to each command.
  27504. GDB Command
  27505. ...........
  27506. The corresponding GDB command is 'thread'.
  27507. Example
  27508. .......
  27509. (gdb)
  27510. -exec-next
  27511. ^running
  27512. (gdb)
  27513. *stopped,reason="end-stepping-range",thread-id="2",line="187",
  27514. file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
  27515. (gdb)
  27516. -thread-list-ids
  27517. ^done,
  27518. thread-ids={thread-id="3",thread-id="2",thread-id="1"},
  27519. number-of-threads="3"
  27520. (gdb)
  27521. -thread-select 3
  27522. ^done,new-thread-id="3",
  27523. frame={level="0",func="vprintf",
  27524. args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""},
  27525. {name="arg",value="0x2"}],file="vprintf.c",line="31",arch="i386:x86_64"}
  27526. (gdb)
  27527. 
  27528. File: gdb.info, Node: GDB/MI Ada Tasking Commands, Next: GDB/MI Program Execution, Prev: GDB/MI Thread Commands, Up: GDB/MI
  27529. 27.12 GDB/MI Ada Tasking Commands
  27530. =================================
  27531. The '-ada-task-info' Command
  27532. ----------------------------
  27533. Synopsis
  27534. ........
  27535. -ada-task-info [ TASK-ID ]
  27536. Reports information about either a specific Ada task, if the TASK-ID
  27537. parameter is present, or about all Ada tasks.
  27538. GDB Command
  27539. ...........
  27540. The 'info tasks' command prints the same information about all Ada tasks
  27541. (*note Ada Tasks::).
  27542. Result
  27543. ......
  27544. The result is a table of Ada tasks. The following columns are defined
  27545. for each Ada task:
  27546. 'current'
  27547. This field exists only for the current thread. It has the value
  27548. '*'.
  27549. 'id'
  27550. The identifier that GDB uses to refer to the Ada task.
  27551. 'task-id'
  27552. The identifier that the target uses to refer to the Ada task.
  27553. 'thread-id'
  27554. The global thread identifier of the thread corresponding to the Ada
  27555. task.
  27556. This field should always exist, as Ada tasks are always implemented
  27557. on top of a thread. But if GDB cannot find this corresponding
  27558. thread for any reason, the field is omitted.
  27559. 'parent-id'
  27560. This field exists only when the task was created by another task.
  27561. In this case, it provides the ID of the parent task.
  27562. 'priority'
  27563. The base priority of the task.
  27564. 'state'
  27565. The current state of the task. For a detailed description of the
  27566. possible states, see *note Ada Tasks::.
  27567. 'name'
  27568. The name of the task.
  27569. Example
  27570. .......
  27571. -ada-task-info
  27572. ^done,tasks={nr_rows="3",nr_cols="8",
  27573. hdr=[{width="1",alignment="-1",col_name="current",colhdr=""},
  27574. {width="3",alignment="1",col_name="id",colhdr="ID"},
  27575. {width="9",alignment="1",col_name="task-id",colhdr="TID"},
  27576. {width="4",alignment="1",col_name="thread-id",colhdr=""},
  27577. {width="4",alignment="1",col_name="parent-id",colhdr="P-ID"},
  27578. {width="3",alignment="1",col_name="priority",colhdr="Pri"},
  27579. {width="22",alignment="-1",col_name="state",colhdr="State"},
  27580. {width="1",alignment="2",col_name="name",colhdr="Name"}],
  27581. body=[{current="*",id="1",task-id=" 644010",thread-id="1",priority="48",
  27582. state="Child Termination Wait",name="main_task"}]}
  27583. (gdb)
  27584. 
  27585. File: gdb.info, Node: GDB/MI Program Execution, Next: GDB/MI Stack Manipulation, Prev: GDB/MI Ada Tasking Commands, Up: GDB/MI
  27586. 27.13 GDB/MI Program Execution
  27587. ==============================
  27588. These are the asynchronous commands which generate the out-of-band
  27589. record '*stopped'. Currently GDB only really executes asynchronously
  27590. with remote targets and this interaction is mimicked in other cases.
  27591. The '-exec-continue' Command
  27592. ----------------------------
  27593. Synopsis
  27594. ........
  27595. -exec-continue [--reverse] [--all|--thread-group N]
  27596. Resumes the execution of the inferior program, which will continue to
  27597. execute until it reaches a debugger stop event. If the '--reverse'
  27598. option is specified, execution resumes in reverse until it reaches a
  27599. stop event. Stop events may include
  27600. * breakpoints or watchpoints
  27601. * signals or exceptions
  27602. * the end of the process (or its beginning under '--reverse')
  27603. * the end or beginning of a replay log if one is being used.
  27604. In all-stop mode (*note All-Stop Mode::), may resume only one thread,
  27605. or all threads, depending on the value of the 'scheduler-locking'
  27606. variable. If '--all' is specified, all threads (in all inferiors) will
  27607. be resumed. The '--all' option is ignored in all-stop mode. If the
  27608. '--thread-group' options is specified, then all threads in that thread
  27609. group are resumed.
  27610. GDB Command
  27611. ...........
  27612. The corresponding GDB corresponding is 'continue'.
  27613. Example
  27614. .......
  27615. -exec-continue
  27616. ^running
  27617. (gdb)
  27618. @Hello world
  27619. *stopped,reason="breakpoint-hit",disp="keep",bkptno="2",frame={
  27620. func="foo",args=[],file="hello.c",fullname="/home/foo/bar/hello.c",
  27621. line="13",arch="i386:x86_64"}
  27622. (gdb)
  27623. The '-exec-finish' Command
  27624. --------------------------
  27625. Synopsis
  27626. ........
  27627. -exec-finish [--reverse]
  27628. Resumes the execution of the inferior program until the current
  27629. function is exited. Displays the results returned by the function. If
  27630. the '--reverse' option is specified, resumes the reverse execution of
  27631. the inferior program until the point where current function was called.
  27632. GDB Command
  27633. ...........
  27634. The corresponding GDB command is 'finish'.
  27635. Example
  27636. .......
  27637. Function returning 'void'.
  27638. -exec-finish
  27639. ^running
  27640. (gdb)
  27641. @hello from foo
  27642. *stopped,reason="function-finished",frame={func="main",args=[],
  27643. file="hello.c",fullname="/home/foo/bar/hello.c",line="7",arch="i386:x86_64"}
  27644. (gdb)
  27645. Function returning other than 'void'. The name of the internal GDB
  27646. variable storing the result is printed, together with the value itself.
  27647. -exec-finish
  27648. ^running
  27649. (gdb)
  27650. *stopped,reason="function-finished",frame={addr="0x000107b0",func="foo",
  27651. args=[{name="a",value="1"],{name="b",value="9"}},
  27652. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27653. arch="i386:x86_64"},
  27654. gdb-result-var="$1",return-value="0"
  27655. (gdb)
  27656. The '-exec-interrupt' Command
  27657. -----------------------------
  27658. Synopsis
  27659. ........
  27660. -exec-interrupt [--all|--thread-group N]
  27661. Interrupts the background execution of the target. Note how the
  27662. token associated with the stop message is the one for the execution
  27663. command that has been interrupted. The token for the interrupt itself
  27664. only appears in the '^done' output. If the user is trying to interrupt
  27665. a non-running program, an error message will be printed.
  27666. Note that when asynchronous execution is enabled, this command is
  27667. asynchronous just like other execution commands. That is, first the
  27668. '^done' response will be printed, and the target stop will be reported
  27669. after that using the '*stopped' notification.
  27670. In non-stop mode, only the context thread is interrupted by default.
  27671. All threads (in all inferiors) will be interrupted if the '--all' option
  27672. is specified. If the '--thread-group' option is specified, all threads
  27673. in that group will be interrupted.
  27674. GDB Command
  27675. ...........
  27676. The corresponding GDB command is 'interrupt'.
  27677. Example
  27678. .......
  27679. (gdb)
  27680. 111-exec-continue
  27681. 111^running
  27682. (gdb)
  27683. 222-exec-interrupt
  27684. 222^done
  27685. (gdb)
  27686. 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
  27687. frame={addr="0x00010140",func="foo",args=[],file="try.c",
  27688. fullname="/home/foo/bar/try.c",line="13",arch="i386:x86_64"}
  27689. (gdb)
  27690. (gdb)
  27691. -exec-interrupt
  27692. ^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
  27693. (gdb)
  27694. The '-exec-jump' Command
  27695. ------------------------
  27696. Synopsis
  27697. ........
  27698. -exec-jump LOCATION
  27699. Resumes execution of the inferior program at the location specified
  27700. by parameter. *Note Specify Location::, for a description of the
  27701. different forms of LOCATION.
  27702. GDB Command
  27703. ...........
  27704. The corresponding GDB command is 'jump'.
  27705. Example
  27706. .......
  27707. -exec-jump foo.c:10
  27708. *running,thread-id="all"
  27709. ^running
  27710. The '-exec-next' Command
  27711. ------------------------
  27712. Synopsis
  27713. ........
  27714. -exec-next [--reverse]
  27715. Resumes execution of the inferior program, stopping when the
  27716. beginning of the next source line is reached.
  27717. If the '--reverse' option is specified, resumes reverse execution of
  27718. the inferior program, stopping at the beginning of the previous source
  27719. line. If you issue this command on the first line of a function, it
  27720. will take you back to the caller of that function, to the source line
  27721. where the function was called.
  27722. GDB Command
  27723. ...........
  27724. The corresponding GDB command is 'next'.
  27725. Example
  27726. .......
  27727. -exec-next
  27728. ^running
  27729. (gdb)
  27730. *stopped,reason="end-stepping-range",line="8",file="hello.c"
  27731. (gdb)
  27732. The '-exec-next-instruction' Command
  27733. ------------------------------------
  27734. Synopsis
  27735. ........
  27736. -exec-next-instruction [--reverse]
  27737. Executes one machine instruction. If the instruction is a function
  27738. call, continues until the function returns. If the program stops at an
  27739. instruction in the middle of a source line, the address will be printed
  27740. as well.
  27741. If the '--reverse' option is specified, resumes reverse execution of
  27742. the inferior program, stopping at the previous instruction. If the
  27743. previously executed instruction was a return from another function, it
  27744. will continue to execute in reverse until the call to that function
  27745. (from the current stack frame) is reached.
  27746. GDB Command
  27747. ...........
  27748. The corresponding GDB command is 'nexti'.
  27749. Example
  27750. .......
  27751. (gdb)
  27752. -exec-next-instruction
  27753. ^running
  27754. (gdb)
  27755. *stopped,reason="end-stepping-range",
  27756. addr="0x000100d4",line="5",file="hello.c"
  27757. (gdb)
  27758. The '-exec-return' Command
  27759. --------------------------
  27760. Synopsis
  27761. ........
  27762. -exec-return
  27763. Makes current function return immediately. Doesn't execute the
  27764. inferior. Displays the new current frame.
  27765. GDB Command
  27766. ...........
  27767. The corresponding GDB command is 'return'.
  27768. Example
  27769. .......
  27770. (gdb)
  27771. 200-break-insert callee4
  27772. 200^done,bkpt={number="1",addr="0x00010734",
  27773. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
  27774. (gdb)
  27775. 000-exec-run
  27776. 000^running
  27777. (gdb)
  27778. 000*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
  27779. frame={func="callee4",args=[],
  27780. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27781. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  27782. arch="i386:x86_64"}
  27783. (gdb)
  27784. 205-break-delete
  27785. 205^done
  27786. (gdb)
  27787. 111-exec-return
  27788. 111^done,frame={level="0",func="callee3",
  27789. args=[{name="strarg",
  27790. value="0x11940 \"A string argument.\""}],
  27791. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27792. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  27793. arch="i386:x86_64"}
  27794. (gdb)
  27795. The '-exec-run' Command
  27796. -----------------------
  27797. Synopsis
  27798. ........
  27799. -exec-run [ --all | --thread-group N ] [ --start ]
  27800. Starts execution of the inferior from the beginning. The inferior
  27801. executes until either a breakpoint is encountered or the program exits.
  27802. In the latter case the output will include an exit code, if the program
  27803. has exited exceptionally.
  27804. When neither the '--all' nor the '--thread-group' option is
  27805. specified, the current inferior is started. If the '--thread-group'
  27806. option is specified, it should refer to a thread group of type
  27807. 'process', and that thread group will be started. If the '--all' option
  27808. is specified, then all inferiors will be started.
  27809. Using the '--start' option instructs the debugger to stop the
  27810. execution at the start of the inferior's main subprogram, following the
  27811. same behavior as the 'start' command (*note Starting::).
  27812. GDB Command
  27813. ...........
  27814. The corresponding GDB command is 'run'.
  27815. Examples
  27816. ........
  27817. (gdb)
  27818. -break-insert main
  27819. ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"}
  27820. (gdb)
  27821. -exec-run
  27822. ^running
  27823. (gdb)
  27824. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
  27825. frame={func="main",args=[],file="recursive2.c",
  27826. fullname="/home/foo/bar/recursive2.c",line="4",arch="i386:x86_64"}
  27827. (gdb)
  27828. Program exited normally:
  27829. (gdb)
  27830. -exec-run
  27831. ^running
  27832. (gdb)
  27833. x = 55
  27834. *stopped,reason="exited-normally"
  27835. (gdb)
  27836. Program exited exceptionally:
  27837. (gdb)
  27838. -exec-run
  27839. ^running
  27840. (gdb)
  27841. x = 55
  27842. *stopped,reason="exited",exit-code="01"
  27843. (gdb)
  27844. Another way the program can terminate is if it receives a signal such
  27845. as 'SIGINT'. In this case, GDB/MI displays this:
  27846. (gdb)
  27847. *stopped,reason="exited-signalled",signal-name="SIGINT",
  27848. signal-meaning="Interrupt"
  27849. The '-exec-step' Command
  27850. ------------------------
  27851. Synopsis
  27852. ........
  27853. -exec-step [--reverse]
  27854. Resumes execution of the inferior program, stopping when the
  27855. beginning of the next source line is reached, if the next source line is
  27856. not a function call. If it is, stop at the first instruction of the
  27857. called function. If the '--reverse' option is specified, resumes
  27858. reverse execution of the inferior program, stopping at the beginning of
  27859. the previously executed source line.
  27860. GDB Command
  27861. ...........
  27862. The corresponding GDB command is 'step'.
  27863. Example
  27864. .......
  27865. Stepping into a function:
  27866. -exec-step
  27867. ^running
  27868. (gdb)
  27869. *stopped,reason="end-stepping-range",
  27870. frame={func="foo",args=[{name="a",value="10"},
  27871. {name="b",value="0"}],file="recursive2.c",
  27872. fullname="/home/foo/bar/recursive2.c",line="11",arch="i386:x86_64"}
  27873. (gdb)
  27874. Regular stepping:
  27875. -exec-step
  27876. ^running
  27877. (gdb)
  27878. *stopped,reason="end-stepping-range",line="14",file="recursive2.c"
  27879. (gdb)
  27880. The '-exec-step-instruction' Command
  27881. ------------------------------------
  27882. Synopsis
  27883. ........
  27884. -exec-step-instruction [--reverse]
  27885. Resumes the inferior which executes one machine instruction. If the
  27886. '--reverse' option is specified, resumes reverse execution of the
  27887. inferior program, stopping at the previously executed instruction. The
  27888. output, once GDB has stopped, will vary depending on whether we have
  27889. stopped in the middle of a source line or not. In the former case, the
  27890. address at which the program stopped will be printed as well.
  27891. GDB Command
  27892. ...........
  27893. The corresponding GDB command is 'stepi'.
  27894. Example
  27895. .......
  27896. (gdb)
  27897. -exec-step-instruction
  27898. ^running
  27899. (gdb)
  27900. *stopped,reason="end-stepping-range",
  27901. frame={func="foo",args=[],file="try.c",
  27902. fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"}
  27903. (gdb)
  27904. -exec-step-instruction
  27905. ^running
  27906. (gdb)
  27907. *stopped,reason="end-stepping-range",
  27908. frame={addr="0x000100f4",func="foo",args=[],file="try.c",
  27909. fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"}
  27910. (gdb)
  27911. The '-exec-until' Command
  27912. -------------------------
  27913. Synopsis
  27914. ........
  27915. -exec-until [ LOCATION ]
  27916. Executes the inferior until the LOCATION specified in the argument is
  27917. reached. If there is no argument, the inferior executes until a source
  27918. line greater than the current one is reached. The reason for stopping
  27919. in this case will be 'location-reached'.
  27920. GDB Command
  27921. ...........
  27922. The corresponding GDB command is 'until'.
  27923. Example
  27924. .......
  27925. (gdb)
  27926. -exec-until recursive2.c:6
  27927. ^running
  27928. (gdb)
  27929. x = 55
  27930. *stopped,reason="location-reached",frame={func="main",args=[],
  27931. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6",
  27932. arch="i386:x86_64"}
  27933. (gdb)
  27934. 
  27935. File: gdb.info, Node: GDB/MI Stack Manipulation, Next: GDB/MI Variable Objects, Prev: GDB/MI Program Execution, Up: GDB/MI
  27936. 27.14 GDB/MI Stack Manipulation Commands
  27937. ========================================
  27938. The '-enable-frame-filters' Command
  27939. -----------------------------------
  27940. -enable-frame-filters
  27941. GDB allows Python-based frame filters to affect the output of the MI
  27942. commands relating to stack traces. As there is no way to implement this
  27943. in a fully backward-compatible way, a front end must request that this
  27944. functionality be enabled.
  27945. Once enabled, this feature cannot be disabled.
  27946. Note that if Python support has not been compiled into GDB, this
  27947. command will still succeed (and do nothing).
  27948. The '-stack-info-frame' Command
  27949. -------------------------------
  27950. Synopsis
  27951. ........
  27952. -stack-info-frame
  27953. Get info on the selected frame.
  27954. GDB Command
  27955. ...........
  27956. The corresponding GDB command is 'info frame' or 'frame' (without
  27957. arguments).
  27958. Example
  27959. .......
  27960. (gdb)
  27961. -stack-info-frame
  27962. ^done,frame={level="1",addr="0x0001076c",func="callee3",
  27963. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27964. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",
  27965. arch="i386:x86_64"}
  27966. (gdb)
  27967. The '-stack-info-depth' Command
  27968. -------------------------------
  27969. Synopsis
  27970. ........
  27971. -stack-info-depth [ MAX-DEPTH ]
  27972. Return the depth of the stack. If the integer argument MAX-DEPTH is
  27973. specified, do not count beyond MAX-DEPTH frames.
  27974. GDB Command
  27975. ...........
  27976. There's no equivalent GDB command.
  27977. Example
  27978. .......
  27979. For a stack with frame levels 0 through 11:
  27980. (gdb)
  27981. -stack-info-depth
  27982. ^done,depth="12"
  27983. (gdb)
  27984. -stack-info-depth 4
  27985. ^done,depth="4"
  27986. (gdb)
  27987. -stack-info-depth 12
  27988. ^done,depth="12"
  27989. (gdb)
  27990. -stack-info-depth 11
  27991. ^done,depth="11"
  27992. (gdb)
  27993. -stack-info-depth 13
  27994. ^done,depth="12"
  27995. (gdb)
  27996. The '-stack-list-arguments' Command
  27997. -----------------------------------
  27998. Synopsis
  27999. ........
  28000. -stack-list-arguments [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  28001. [ LOW-FRAME HIGH-FRAME ]
  28002. Display a list of the arguments for the frames between LOW-FRAME and
  28003. HIGH-FRAME (inclusive). If LOW-FRAME and HIGH-FRAME are not provided,
  28004. list the arguments for the whole call stack. If the two arguments are
  28005. equal, show the single frame at the corresponding level. It is an error
  28006. if LOW-FRAME is larger than the actual number of frames. On the other
  28007. hand, HIGH-FRAME may be larger than the actual number of frames, in
  28008. which case only existing frames will be returned.
  28009. If PRINT-VALUES is 0 or '--no-values', print only the names of the
  28010. variables; if it is 1 or '--all-values', print also their values; and if
  28011. it is 2 or '--simple-values', print the name, type and value for simple
  28012. data types, and the name and type for arrays, structures and unions. If
  28013. the option '--no-frame-filters' is supplied, then Python frame filters
  28014. will not be executed.
  28015. If the '--skip-unavailable' option is specified, arguments that are
  28016. not available are not listed. Partially available arguments are still
  28017. displayed, however.
  28018. Use of this command to obtain arguments in a single frame is
  28019. deprecated in favor of the '-stack-list-variables' command.
  28020. GDB Command
  28021. ...........
  28022. GDB does not have an equivalent command. 'gdbtk' has a 'gdb_get_args'
  28023. command which partially overlaps with the functionality of
  28024. '-stack-list-arguments'.
  28025. Example
  28026. .......
  28027. (gdb)
  28028. -stack-list-frames
  28029. ^done,
  28030. stack=[
  28031. frame={level="0",addr="0x00010734",func="callee4",
  28032. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28033. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  28034. arch="i386:x86_64"},
  28035. frame={level="1",addr="0x0001076c",func="callee3",
  28036. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28037. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",
  28038. arch="i386:x86_64"},
  28039. frame={level="2",addr="0x0001078c",func="callee2",
  28040. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28041. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22",
  28042. arch="i386:x86_64"},
  28043. frame={level="3",addr="0x000107b4",func="callee1",
  28044. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28045. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27",
  28046. arch="i386:x86_64"},
  28047. frame={level="4",addr="0x000107e0",func="main",
  28048. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  28049. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32",
  28050. arch="i386:x86_64"}]
  28051. (gdb)
  28052. -stack-list-arguments 0
  28053. ^done,
  28054. stack-args=[
  28055. frame={level="0",args=[]},
  28056. frame={level="1",args=[name="strarg"]},
  28057. frame={level="2",args=[name="intarg",name="strarg"]},
  28058. frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]},
  28059. frame={level="4",args=[]}]
  28060. (gdb)
  28061. -stack-list-arguments 1
  28062. ^done,
  28063. stack-args=[
  28064. frame={level="0",args=[]},
  28065. frame={level="1",
  28066. args=[{name="strarg",value="0x11940 \"A string argument.\""}]},
  28067. frame={level="2",args=[
  28068. {name="intarg",value="2"},
  28069. {name="strarg",value="0x11940 \"A string argument.\""}]},
  28070. {frame={level="3",args=[
  28071. {name="intarg",value="2"},
  28072. {name="strarg",value="0x11940 \"A string argument.\""},
  28073. {name="fltarg",value="3.5"}]},
  28074. frame={level="4",args=[]}]
  28075. (gdb)
  28076. -stack-list-arguments 0 2 2
  28077. ^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}]
  28078. (gdb)
  28079. -stack-list-arguments 1 2 2
  28080. ^done,stack-args=[frame={level="2",
  28081. args=[{name="intarg",value="2"},
  28082. {name="strarg",value="0x11940 \"A string argument.\""}]}]
  28083. (gdb)
  28084. The '-stack-list-frames' Command
  28085. --------------------------------
  28086. Synopsis
  28087. ........
  28088. -stack-list-frames [ --no-frame-filters LOW-FRAME HIGH-FRAME ]
  28089. List the frames currently on the stack. For each frame it displays
  28090. the following info:
  28091. 'LEVEL'
  28092. The frame number, 0 being the topmost frame, i.e., the innermost
  28093. function.
  28094. 'ADDR'
  28095. The '$pc' value for that frame.
  28096. 'FUNC'
  28097. Function name.
  28098. 'FILE'
  28099. File name of the source file where the function lives.
  28100. 'FULLNAME'
  28101. The full file name of the source file where the function lives.
  28102. 'LINE'
  28103. Line number corresponding to the '$pc'.
  28104. 'FROM'
  28105. The shared library where this function is defined. This is only
  28106. given if the frame's function is not known.
  28107. 'ARCH'
  28108. Frame's architecture.
  28109. If invoked without arguments, this command prints a backtrace for the
  28110. whole stack. If given two integer arguments, it shows the frames whose
  28111. levels are between the two arguments (inclusive). If the two arguments
  28112. are equal, it shows the single frame at the corresponding level. It is
  28113. an error if LOW-FRAME is larger than the actual number of frames. On
  28114. the other hand, HIGH-FRAME may be larger than the actual number of
  28115. frames, in which case only existing frames will be returned. If the
  28116. option '--no-frame-filters' is supplied, then Python frame filters will
  28117. not be executed.
  28118. GDB Command
  28119. ...........
  28120. The corresponding GDB commands are 'backtrace' and 'where'.
  28121. Example
  28122. .......
  28123. Full stack backtrace:
  28124. (gdb)
  28125. -stack-list-frames
  28126. ^done,stack=
  28127. [frame={level="0",addr="0x0001076c",func="foo",
  28128. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11",
  28129. arch="i386:x86_64"},
  28130. frame={level="1",addr="0x000107a4",func="foo",
  28131. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28132. arch="i386:x86_64"},
  28133. frame={level="2",addr="0x000107a4",func="foo",
  28134. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28135. arch="i386:x86_64"},
  28136. frame={level="3",addr="0x000107a4",func="foo",
  28137. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28138. arch="i386:x86_64"},
  28139. frame={level="4",addr="0x000107a4",func="foo",
  28140. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28141. arch="i386:x86_64"},
  28142. frame={level="5",addr="0x000107a4",func="foo",
  28143. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28144. arch="i386:x86_64"},
  28145. frame={level="6",addr="0x000107a4",func="foo",
  28146. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28147. arch="i386:x86_64"},
  28148. frame={level="7",addr="0x000107a4",func="foo",
  28149. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28150. arch="i386:x86_64"},
  28151. frame={level="8",addr="0x000107a4",func="foo",
  28152. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28153. arch="i386:x86_64"},
  28154. frame={level="9",addr="0x000107a4",func="foo",
  28155. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28156. arch="i386:x86_64"},
  28157. frame={level="10",addr="0x000107a4",func="foo",
  28158. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28159. arch="i386:x86_64"},
  28160. frame={level="11",addr="0x00010738",func="main",
  28161. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4",
  28162. arch="i386:x86_64"}]
  28163. (gdb)
  28164. Show frames between LOW_FRAME and HIGH_FRAME:
  28165. (gdb)
  28166. -stack-list-frames 3 5
  28167. ^done,stack=
  28168. [frame={level="3",addr="0x000107a4",func="foo",
  28169. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28170. arch="i386:x86_64"},
  28171. frame={level="4",addr="0x000107a4",func="foo",
  28172. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28173. arch="i386:x86_64"},
  28174. frame={level="5",addr="0x000107a4",func="foo",
  28175. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28176. arch="i386:x86_64"}]
  28177. (gdb)
  28178. Show a single frame:
  28179. (gdb)
  28180. -stack-list-frames 3 3
  28181. ^done,stack=
  28182. [frame={level="3",addr="0x000107a4",func="foo",
  28183. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  28184. arch="i386:x86_64"}]
  28185. (gdb)
  28186. The '-stack-list-locals' Command
  28187. --------------------------------
  28188. Synopsis
  28189. ........
  28190. -stack-list-locals [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  28191. Display the local variable names for the selected frame. If
  28192. PRINT-VALUES is 0 or '--no-values', print only the names of the
  28193. variables; if it is 1 or '--all-values', print also their values; and if
  28194. it is 2 or '--simple-values', print the name, type and value for simple
  28195. data types, and the name and type for arrays, structures and unions. In
  28196. this last case, a frontend can immediately display the value of simple
  28197. data types and create variable objects for other data types when the
  28198. user wishes to explore their values in more detail. If the option
  28199. '--no-frame-filters' is supplied, then Python frame filters will not be
  28200. executed.
  28201. If the '--skip-unavailable' option is specified, local variables that
  28202. are not available are not listed. Partially available local variables
  28203. are still displayed, however.
  28204. This command is deprecated in favor of the '-stack-list-variables'
  28205. command.
  28206. GDB Command
  28207. ...........
  28208. 'info locals' in GDB, 'gdb_get_locals' in 'gdbtk'.
  28209. Example
  28210. .......
  28211. (gdb)
  28212. -stack-list-locals 0
  28213. ^done,locals=[name="A",name="B",name="C"]
  28214. (gdb)
  28215. -stack-list-locals --all-values
  28216. ^done,locals=[{name="A",value="1"},{name="B",value="2"},
  28217. {name="C",value="{1, 2, 3}"}]
  28218. -stack-list-locals --simple-values
  28219. ^done,locals=[{name="A",type="int",value="1"},
  28220. {name="B",type="int",value="2"},{name="C",type="int [3]"}]
  28221. (gdb)
  28222. The '-stack-list-variables' Command
  28223. -----------------------------------
  28224. Synopsis
  28225. ........
  28226. -stack-list-variables [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  28227. Display the names of local variables and function arguments for the
  28228. selected frame. If PRINT-VALUES is 0 or '--no-values', print only the
  28229. names of the variables; if it is 1 or '--all-values', print also their
  28230. values; and if it is 2 or '--simple-values', print the name, type and
  28231. value for simple data types, and the name and type for arrays,
  28232. structures and unions. If the option '--no-frame-filters' is supplied,
  28233. then Python frame filters will not be executed.
  28234. If the '--skip-unavailable' option is specified, local variables and
  28235. arguments that are not available are not listed. Partially available
  28236. arguments and local variables are still displayed, however.
  28237. Example
  28238. .......
  28239. (gdb)
  28240. -stack-list-variables --thread 1 --frame 0 --all-values
  28241. ^done,variables=[{name="x",value="11"},{name="s",value="{a = 1, b = 2}"}]
  28242. (gdb)
  28243. The '-stack-select-frame' Command
  28244. ---------------------------------
  28245. Synopsis
  28246. ........
  28247. -stack-select-frame FRAMENUM
  28248. Change the selected frame. Select a different frame FRAMENUM on the
  28249. stack.
  28250. This command in deprecated in favor of passing the '--frame' option
  28251. to every command.
  28252. GDB Command
  28253. ...........
  28254. The corresponding GDB commands are 'frame', 'up', 'down',
  28255. 'select-frame', 'up-silent', and 'down-silent'.
  28256. Example
  28257. .......
  28258. (gdb)
  28259. -stack-select-frame 2
  28260. ^done
  28261. (gdb)
  28262. 
  28263. File: gdb.info, Node: GDB/MI Variable Objects, Next: GDB/MI Data Manipulation, Prev: GDB/MI Stack Manipulation, Up: GDB/MI
  28264. 27.15 GDB/MI Variable Objects
  28265. =============================
  28266. Introduction to Variable Objects
  28267. --------------------------------
  28268. Variable objects are "object-oriented" MI interface for examining and
  28269. changing values of expressions. Unlike some other MI interfaces that
  28270. work with expressions, variable objects are specifically designed for
  28271. simple and efficient presentation in the frontend. A variable object is
  28272. identified by string name. When a variable object is created, the
  28273. frontend specifies the expression for that variable object. The
  28274. expression can be a simple variable, or it can be an arbitrary complex
  28275. expression, and can even involve CPU registers. After creating a
  28276. variable object, the frontend can invoke other variable object
  28277. operations--for example to obtain or change the value of a variable
  28278. object, or to change display format.
  28279. Variable objects have hierarchical tree structure. Any variable
  28280. object that corresponds to a composite type, such as structure in C, has
  28281. a number of child variable objects, for example corresponding to each
  28282. element of a structure. A child variable object can itself have
  28283. children, recursively. Recursion ends when we reach leaf variable
  28284. objects, which always have built-in types. Child variable objects are
  28285. created only by explicit request, so if a frontend is not interested in
  28286. the children of a particular variable object, no child will be created.
  28287. For a leaf variable object it is possible to obtain its value as a
  28288. string, or set the value from a string. String value can be also
  28289. obtained for a non-leaf variable object, but it's generally a string
  28290. that only indicates the type of the object, and does not list its
  28291. contents. Assignment to a non-leaf variable object is not allowed.
  28292. A frontend does not need to read the values of all variable objects
  28293. each time the program stops. Instead, MI provides an update command
  28294. that lists all variable objects whose values has changed since the last
  28295. update operation. This considerably reduces the amount of data that
  28296. must be transferred to the frontend. As noted above, children variable
  28297. objects are created on demand, and only leaf variable objects have a
  28298. real value. As result, gdb will read target memory only for leaf
  28299. variables that frontend has created.
  28300. The automatic update is not always desirable. For example, a
  28301. frontend might want to keep a value of some expression for future
  28302. reference, and never update it. For another example, fetching memory is
  28303. relatively slow for embedded targets, so a frontend might want to
  28304. disable automatic update for the variables that are either not visible
  28305. on the screen, or "closed". This is possible using so called "frozen
  28306. variable objects". Such variable objects are never implicitly updated.
  28307. Variable objects can be either "fixed" or "floating". For the fixed
  28308. variable object, the expression is parsed when the variable object is
  28309. created, including associating identifiers to specific variables. The
  28310. meaning of expression never changes. For a floating variable object the
  28311. values of variables whose names appear in the expressions are
  28312. re-evaluated every time in the context of the current frame. Consider
  28313. this example:
  28314. void do_work(...)
  28315. {
  28316. struct work_state state;
  28317. if (...)
  28318. do_work(...);
  28319. }
  28320. If a fixed variable object for the 'state' variable is created in
  28321. this function, and we enter the recursive call, the variable object will
  28322. report the value of 'state' in the top-level 'do_work' invocation. On
  28323. the other hand, a floating variable object will report the value of
  28324. 'state' in the current frame.
  28325. If an expression specified when creating a fixed variable object
  28326. refers to a local variable, the variable object becomes bound to the
  28327. thread and frame in which the variable object is created. When such
  28328. variable object is updated, GDB makes sure that the thread/frame
  28329. combination the variable object is bound to still exists, and
  28330. re-evaluates the variable object in context of that thread/frame.
  28331. The following is the complete set of GDB/MI operations defined to
  28332. access this functionality:
  28333. *Operation* *Description*
  28334. '-enable-pretty-printing' enable Python-based pretty-printing
  28335. '-var-create' create a variable object
  28336. '-var-delete' delete the variable object and/or its
  28337. children
  28338. '-var-set-format' set the display format of this variable
  28339. '-var-show-format' show the display format of this variable
  28340. '-var-info-num-children' tells how many children this object has
  28341. '-var-list-children' return a list of the object's children
  28342. '-var-info-type' show the type of this variable object
  28343. '-var-info-expression' print parent-relative expression that
  28344. this variable object represents
  28345. '-var-info-path-expression' print full expression that this variable
  28346. object represents
  28347. '-var-show-attributes' is this variable editable? does it exist
  28348. here?
  28349. '-var-evaluate-expression' get the value of this variable
  28350. '-var-assign' set the value of this variable
  28351. '-var-update' update the variable and its children
  28352. '-var-set-frozen' set frozenness attribute
  28353. '-var-set-update-range' set range of children to display on
  28354. update
  28355. In the next subsection we describe each operation in detail and
  28356. suggest how it can be used.
  28357. Description And Use of Operations on Variable Objects
  28358. -----------------------------------------------------
  28359. The '-enable-pretty-printing' Command
  28360. -------------------------------------
  28361. -enable-pretty-printing
  28362. GDB allows Python-based visualizers to affect the output of the MI
  28363. variable object commands. However, because there was no way to
  28364. implement this in a fully backward-compatible way, a front end must
  28365. request that this functionality be enabled.
  28366. Once enabled, this feature cannot be disabled.
  28367. Note that if Python support has not been compiled into GDB, this
  28368. command will still succeed (and do nothing).
  28369. This feature is currently (as of GDB 7.0) experimental, and may work
  28370. differently in future versions of GDB.
  28371. The '-var-create' Command
  28372. -------------------------
  28373. Synopsis
  28374. ........
  28375. -var-create {NAME | "-"}
  28376. {FRAME-ADDR | "*" | "@"} EXPRESSION
  28377. This operation creates a variable object, which allows the monitoring
  28378. of a variable, the result of an expression, a memory cell or a CPU
  28379. register.
  28380. The NAME parameter is the string by which the object can be
  28381. referenced. It must be unique. If '-' is specified, the varobj system
  28382. will generate a string "varNNNNNN" automatically. It will be unique
  28383. provided that one does not specify NAME of that format. The command
  28384. fails if a duplicate name is found.
  28385. The frame under which the expression should be evaluated can be
  28386. specified by FRAME-ADDR. A '*' indicates that the current frame should
  28387. be used. A '@' indicates that a floating variable object must be
  28388. created.
  28389. EXPRESSION is any expression valid on the current language set (must
  28390. not begin with a '*'), or one of the following:
  28391. * '*ADDR', where ADDR is the address of a memory cell
  28392. * '*ADDR-ADDR' -- a memory address range (TBD)
  28393. * '$REGNAME' -- a CPU register name
  28394. A varobj's contents may be provided by a Python-based pretty-printer.
  28395. In this case the varobj is known as a "dynamic varobj". Dynamic varobjs
  28396. have slightly different semantics in some cases. If the
  28397. '-enable-pretty-printing' command is not sent, then GDB will never
  28398. create a dynamic varobj. This ensures backward compatibility for
  28399. existing clients.
  28400. Result
  28401. ......
  28402. This operation returns attributes of the newly-created varobj. These
  28403. are:
  28404. 'name'
  28405. The name of the varobj.
  28406. 'numchild'
  28407. The number of children of the varobj. This number is not
  28408. necessarily reliable for a dynamic varobj. Instead, you must
  28409. examine the 'has_more' attribute.
  28410. 'value'
  28411. The varobj's scalar value. For a varobj whose type is some sort of
  28412. aggregate (e.g., a 'struct'), or for a dynamic varobj, this value
  28413. will not be interesting.
  28414. 'type'
  28415. The varobj's type. This is a string representation of the type, as
  28416. would be printed by the GDB CLI. If 'print object' (*note set print
  28417. object: Print Settings.) is set to 'on', the _actual_ (derived)
  28418. type of the object is shown rather than the _declared_ one.
  28419. 'thread-id'
  28420. If a variable object is bound to a specific thread, then this is
  28421. the thread's global identifier.
  28422. 'has_more'
  28423. For a dynamic varobj, this indicates whether there appear to be any
  28424. children available. For a non-dynamic varobj, this will be 0.
  28425. 'dynamic'
  28426. This attribute will be present and have the value '1' if the varobj
  28427. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  28428. this attribute will not be present.
  28429. 'displayhint'
  28430. A dynamic varobj can supply a display hint to the front end. The
  28431. value comes directly from the Python pretty-printer object's
  28432. 'display_hint' method. *Note Pretty Printing API::.
  28433. Typical output will look like this:
  28434. name="NAME",numchild="N",type="TYPE",thread-id="M",
  28435. has_more="HAS_MORE"
  28436. The '-var-delete' Command
  28437. -------------------------
  28438. Synopsis
  28439. ........
  28440. -var-delete [ -c ] NAME
  28441. Deletes a previously created variable object and all of its children.
  28442. With the '-c' option, just deletes the children.
  28443. Returns an error if the object NAME is not found.
  28444. The '-var-set-format' Command
  28445. -----------------------------
  28446. Synopsis
  28447. ........
  28448. -var-set-format NAME FORMAT-SPEC
  28449. Sets the output format for the value of the object NAME to be
  28450. FORMAT-SPEC.
  28451. The syntax for the FORMAT-SPEC is as follows:
  28452. FORMAT-SPEC ==>
  28453. {binary | decimal | hexadecimal | octal | natural | zero-hexadecimal}
  28454. The natural format is the default format choosen automatically based
  28455. on the variable type (like decimal for an 'int', hex for pointers,
  28456. etc.).
  28457. The zero-hexadecimal format has a representation similar to
  28458. hexadecimal but with padding zeroes to the left of the value. For
  28459. example, a 32-bit hexadecimal value of 0x1234 would be represented as
  28460. 0x00001234 in the zero-hexadecimal format.
  28461. For a variable with children, the format is set only on the variable
  28462. itself, and the children are not affected.
  28463. The '-var-show-format' Command
  28464. ------------------------------
  28465. Synopsis
  28466. ........
  28467. -var-show-format NAME
  28468. Returns the format used to display the value of the object NAME.
  28469. FORMAT ==>
  28470. FORMAT-SPEC
  28471. The '-var-info-num-children' Command
  28472. ------------------------------------
  28473. Synopsis
  28474. ........
  28475. -var-info-num-children NAME
  28476. Returns the number of children of a variable object NAME:
  28477. numchild=N
  28478. Note that this number is not completely reliable for a dynamic
  28479. varobj. It will return the current number of children, but more
  28480. children may be available.
  28481. The '-var-list-children' Command
  28482. --------------------------------
  28483. Synopsis
  28484. ........
  28485. -var-list-children [PRINT-VALUES] NAME [FROM TO]
  28486. Return a list of the children of the specified variable object and
  28487. create variable objects for them, if they do not already exist. With a
  28488. single argument or if PRINT-VALUES has a value of 0 or '--no-values',
  28489. print only the names of the variables; if PRINT-VALUES is 1 or
  28490. '--all-values', also print their values; and if it is 2 or
  28491. '--simple-values' print the name and value for simple data types and
  28492. just the name for arrays, structures and unions.
  28493. FROM and TO, if specified, indicate the range of children to report.
  28494. If FROM or TO is less than zero, the range is reset and all children
  28495. will be reported. Otherwise, children starting at FROM (zero-based) and
  28496. up to and excluding TO will be reported.
  28497. If a child range is requested, it will only affect the current call
  28498. to '-var-list-children', but not future calls to '-var-update'. For
  28499. this, you must instead use '-var-set-update-range'. The intent of this
  28500. approach is to enable a front end to implement any update approach it
  28501. likes; for example, scrolling a view may cause the front end to request
  28502. more children with '-var-list-children', and then the front end could
  28503. call '-var-set-update-range' with a different range to ensure that
  28504. future updates are restricted to just the visible items.
  28505. For each child the following results are returned:
  28506. NAME
  28507. Name of the variable object created for this child.
  28508. EXP
  28509. The expression to be shown to the user by the front end to
  28510. designate this child. For example this may be the name of a
  28511. structure member.
  28512. For a dynamic varobj, this value cannot be used to form an
  28513. expression. There is no way to do this at all with a dynamic
  28514. varobj.
  28515. For C/C++ structures there are several pseudo children returned to
  28516. designate access qualifiers. For these pseudo children EXP is
  28517. 'public', 'private', or 'protected'. In this case the type and
  28518. value are not present.
  28519. A dynamic varobj will not report the access qualifying
  28520. pseudo-children, regardless of the language. This information is
  28521. not available at all with a dynamic varobj.
  28522. NUMCHILD
  28523. Number of children this child has. For a dynamic varobj, this will
  28524. be 0.
  28525. TYPE
  28526. The type of the child. If 'print object' (*note set print object:
  28527. Print Settings.) is set to 'on', the _actual_ (derived) type of the
  28528. object is shown rather than the _declared_ one.
  28529. VALUE
  28530. If values were requested, this is the value.
  28531. THREAD-ID
  28532. If this variable object is associated with a thread, this is the
  28533. thread's global thread id. Otherwise this result is not present.
  28534. FROZEN
  28535. If the variable object is frozen, this variable will be present
  28536. with a value of 1.
  28537. DISPLAYHINT
  28538. A dynamic varobj can supply a display hint to the front end. The
  28539. value comes directly from the Python pretty-printer object's
  28540. 'display_hint' method. *Note Pretty Printing API::.
  28541. DYNAMIC
  28542. This attribute will be present and have the value '1' if the varobj
  28543. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  28544. this attribute will not be present.
  28545. The result may have its own attributes:
  28546. 'displayhint'
  28547. A dynamic varobj can supply a display hint to the front end. The
  28548. value comes directly from the Python pretty-printer object's
  28549. 'display_hint' method. *Note Pretty Printing API::.
  28550. 'has_more'
  28551. This is an integer attribute which is nonzero if there are children
  28552. remaining after the end of the selected range.
  28553. Example
  28554. .......
  28555. (gdb)
  28556. -var-list-children n
  28557. ^done,numchild=N,children=[child={name=NAME,exp=EXP,
  28558. numchild=N,type=TYPE},(repeats N times)]
  28559. (gdb)
  28560. -var-list-children --all-values n
  28561. ^done,numchild=N,children=[child={name=NAME,exp=EXP,
  28562. numchild=N,value=VALUE,type=TYPE},(repeats N times)]
  28563. The '-var-info-type' Command
  28564. ----------------------------
  28565. Synopsis
  28566. ........
  28567. -var-info-type NAME
  28568. Returns the type of the specified variable NAME. The type is
  28569. returned as a string in the same format as it is output by the GDB CLI:
  28570. type=TYPENAME
  28571. The '-var-info-expression' Command
  28572. ----------------------------------
  28573. Synopsis
  28574. ........
  28575. -var-info-expression NAME
  28576. Returns a string that is suitable for presenting this variable object
  28577. in user interface. The string is generally not valid expression in the
  28578. current language, and cannot be evaluated.
  28579. For example, if 'a' is an array, and variable object 'A' was created
  28580. for 'a', then we'll get this output:
  28581. (gdb) -var-info-expression A.1
  28582. ^done,lang="C",exp="1"
  28583. Here, the value of 'lang' is the language name, which can be found in
  28584. *note Supported Languages::.
  28585. Note that the output of the '-var-list-children' command also
  28586. includes those expressions, so the '-var-info-expression' command is of
  28587. limited use.
  28588. The '-var-info-path-expression' Command
  28589. ---------------------------------------
  28590. Synopsis
  28591. ........
  28592. -var-info-path-expression NAME
  28593. Returns an expression that can be evaluated in the current context
  28594. and will yield the same value that a variable object has. Compare this
  28595. with the '-var-info-expression' command, which result can be used only
  28596. for UI presentation. Typical use of the '-var-info-path-expression'
  28597. command is creating a watchpoint from a variable object.
  28598. This command is currently not valid for children of a dynamic varobj,
  28599. and will give an error when invoked on one.
  28600. For example, suppose 'C' is a C++ class, derived from class 'Base',
  28601. and that the 'Base' class has a member called 'm_size'. Assume a
  28602. variable 'c' is has the type of 'C' and a variable object 'C' was
  28603. created for variable 'c'. Then, we'll get this output:
  28604. (gdb) -var-info-path-expression C.Base.public.m_size
  28605. ^done,path_expr=((Base)c).m_size)
  28606. The '-var-show-attributes' Command
  28607. ----------------------------------
  28608. Synopsis
  28609. ........
  28610. -var-show-attributes NAME
  28611. List attributes of the specified variable object NAME:
  28612. status=ATTR [ ( ,ATTR )* ]
  28613. where ATTR is '{ { editable | noneditable } | TBD }'.
  28614. The '-var-evaluate-expression' Command
  28615. --------------------------------------
  28616. Synopsis
  28617. ........
  28618. -var-evaluate-expression [-f FORMAT-SPEC] NAME
  28619. Evaluates the expression that is represented by the specified
  28620. variable object and returns its value as a string. The format of the
  28621. string can be specified with the '-f' option. The possible values of
  28622. this option are the same as for '-var-set-format' (*note
  28623. -var-set-format::). If the '-f' option is not specified, the current
  28624. display format will be used. The current display format can be changed
  28625. using the '-var-set-format' command.
  28626. value=VALUE
  28627. Note that one must invoke '-var-list-children' for a variable before
  28628. the value of a child variable can be evaluated.
  28629. The '-var-assign' Command
  28630. -------------------------
  28631. Synopsis
  28632. ........
  28633. -var-assign NAME EXPRESSION
  28634. Assigns the value of EXPRESSION to the variable object specified by
  28635. NAME. The object must be 'editable'. If the variable's value is
  28636. altered by the assign, the variable will show up in any subsequent
  28637. '-var-update' list.
  28638. Example
  28639. .......
  28640. (gdb)
  28641. -var-assign var1 3
  28642. ^done,value="3"
  28643. (gdb)
  28644. -var-update *
  28645. ^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
  28646. (gdb)
  28647. The '-var-update' Command
  28648. -------------------------
  28649. Synopsis
  28650. ........
  28651. -var-update [PRINT-VALUES] {NAME | "*"}
  28652. Reevaluate the expressions corresponding to the variable object NAME
  28653. and all its direct and indirect children, and return the list of
  28654. variable objects whose values have changed; NAME must be a root variable
  28655. object. Here, "changed" means that the result of
  28656. '-var-evaluate-expression' before and after the '-var-update' is
  28657. different. If '*' is used as the variable object names, all existing
  28658. variable objects are updated, except for frozen ones (*note
  28659. -var-set-frozen::). The option PRINT-VALUES determines whether both
  28660. names and values, or just names are printed. The possible values of
  28661. this option are the same as for '-var-list-children' (*note
  28662. -var-list-children::). It is recommended to use the '--all-values'
  28663. option, to reduce the number of MI commands needed on each program stop.
  28664. With the '*' parameter, if a variable object is bound to a currently
  28665. running thread, it will not be updated, without any diagnostic.
  28666. If '-var-set-update-range' was previously used on a varobj, then only
  28667. the selected range of children will be reported.
  28668. '-var-update' reports all the changed varobjs in a tuple named
  28669. 'changelist'.
  28670. Each item in the change list is itself a tuple holding:
  28671. 'name'
  28672. The name of the varobj.
  28673. 'value'
  28674. If values were requested for this update, then this field will be
  28675. present and will hold the value of the varobj.
  28676. 'in_scope'
  28677. This field is a string which may take one of three values:
  28678. '"true"'
  28679. The variable object's current value is valid.
  28680. '"false"'
  28681. The variable object does not currently hold a valid value but
  28682. it may hold one in the future if its associated expression
  28683. comes back into scope.
  28684. '"invalid"'
  28685. The variable object no longer holds a valid value. This can
  28686. occur when the executable file being debugged has changed,
  28687. either through recompilation or by using the GDB 'file'
  28688. command. The front end should normally choose to delete these
  28689. variable objects.
  28690. In the future new values may be added to this list so the front
  28691. should be prepared for this possibility. *Note GDB/MI Development
  28692. and Front Ends: GDB/MI Development and Front Ends.
  28693. 'type_changed'
  28694. This is only present if the varobj is still valid. If the type
  28695. changed, then this will be the string 'true'; otherwise it will be
  28696. 'false'.
  28697. When a varobj's type changes, its children are also likely to have
  28698. become incorrect. Therefore, the varobj's children are
  28699. automatically deleted when this attribute is 'true'. Also, the
  28700. varobj's update range, when set using the '-var-set-update-range'
  28701. command, is unset.
  28702. 'new_type'
  28703. If the varobj's type changed, then this field will be present and
  28704. will hold the new type.
  28705. 'new_num_children'
  28706. For a dynamic varobj, if the number of children changed, or if the
  28707. type changed, this will be the new number of children.
  28708. The 'numchild' field in other varobj responses is generally not
  28709. valid for a dynamic varobj - it will show the number of children
  28710. that GDB knows about, but because dynamic varobjs lazily
  28711. instantiate their children, this will not reflect the number of
  28712. children which may be available.
  28713. The 'new_num_children' attribute only reports changes to the number
  28714. of children known by GDB. This is the only way to detect whether
  28715. an update has removed children (which necessarily can only happen
  28716. at the end of the update range).
  28717. 'displayhint'
  28718. The display hint, if any.
  28719. 'has_more'
  28720. This is an integer value, which will be 1 if there are more
  28721. children available outside the varobj's update range.
  28722. 'dynamic'
  28723. This attribute will be present and have the value '1' if the varobj
  28724. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  28725. this attribute will not be present.
  28726. 'new_children'
  28727. If new children were added to a dynamic varobj within the selected
  28728. update range (as set by '-var-set-update-range'), then they will be
  28729. listed in this attribute.
  28730. Example
  28731. .......
  28732. (gdb)
  28733. -var-assign var1 3
  28734. ^done,value="3"
  28735. (gdb)
  28736. -var-update --all-values var1
  28737. ^done,changelist=[{name="var1",value="3",in_scope="true",
  28738. type_changed="false"}]
  28739. (gdb)
  28740. The '-var-set-frozen' Command
  28741. -----------------------------
  28742. Synopsis
  28743. ........
  28744. -var-set-frozen NAME FLAG
  28745. Set the frozenness flag on the variable object NAME. The FLAG
  28746. parameter should be either '1' to make the variable frozen or '0' to
  28747. make it unfrozen. If a variable object is frozen, then neither itself,
  28748. nor any of its children, are implicitly updated by '-var-update' of a
  28749. parent variable or by '-var-update *'. Only '-var-update' of the
  28750. variable itself will update its value and values of its children. After
  28751. a variable object is unfrozen, it is implicitly updated by all
  28752. subsequent '-var-update' operations. Unfreezing a variable does not
  28753. update it, only subsequent '-var-update' does.
  28754. Example
  28755. .......
  28756. (gdb)
  28757. -var-set-frozen V 1
  28758. ^done
  28759. (gdb)
  28760. The '-var-set-update-range' command
  28761. -----------------------------------
  28762. Synopsis
  28763. ........
  28764. -var-set-update-range NAME FROM TO
  28765. Set the range of children to be returned by future invocations of
  28766. '-var-update'.
  28767. FROM and TO indicate the range of children to report. If FROM or TO
  28768. is less than zero, the range is reset and all children will be reported.
  28769. Otherwise, children starting at FROM (zero-based) and up to and
  28770. excluding TO will be reported.
  28771. Example
  28772. .......
  28773. (gdb)
  28774. -var-set-update-range V 1 2
  28775. ^done
  28776. The '-var-set-visualizer' command
  28777. ---------------------------------
  28778. Synopsis
  28779. ........
  28780. -var-set-visualizer NAME VISUALIZER
  28781. Set a visualizer for the variable object NAME.
  28782. VISUALIZER is the visualizer to use. The special value 'None' means
  28783. to disable any visualizer in use.
  28784. If not 'None', VISUALIZER must be a Python expression. This
  28785. expression must evaluate to a callable object which accepts a single
  28786. argument. GDB will call this object with the value of the varobj NAME
  28787. as an argument (this is done so that the same Python pretty-printing
  28788. code can be used for both the CLI and MI). When called, this object must
  28789. return an object which conforms to the pretty-printing interface (*note
  28790. Pretty Printing API::).
  28791. The pre-defined function 'gdb.default_visualizer' may be used to
  28792. select a visualizer by following the built-in process (*note Selecting
  28793. Pretty-Printers::). This is done automatically when a varobj is
  28794. created, and so ordinarily is not needed.
  28795. This feature is only available if Python support is enabled. The MI
  28796. command '-list-features' (*note GDB/MI Support Commands::) can be used
  28797. to check this.
  28798. Example
  28799. .......
  28800. Resetting the visualizer:
  28801. (gdb)
  28802. -var-set-visualizer V None
  28803. ^done
  28804. Reselecting the default (type-based) visualizer:
  28805. (gdb)
  28806. -var-set-visualizer V gdb.default_visualizer
  28807. ^done
  28808. Suppose 'SomeClass' is a visualizer class. A lambda expression can
  28809. be used to instantiate this class for a varobj:
  28810. (gdb)
  28811. -var-set-visualizer V "lambda val: SomeClass()"
  28812. ^done
  28813. 
  28814. File: gdb.info, Node: GDB/MI Data Manipulation, Next: GDB/MI Tracepoint Commands, Prev: GDB/MI Variable Objects, Up: GDB/MI
  28815. 27.16 GDB/MI Data Manipulation
  28816. ==============================
  28817. This section describes the GDB/MI commands that manipulate data: examine
  28818. memory and registers, evaluate expressions, etc.
  28819. For details about what an addressable memory unit is, *note
  28820. addressable memory unit::.
  28821. The '-data-disassemble' Command
  28822. -------------------------------
  28823. Synopsis
  28824. ........
  28825. -data-disassemble
  28826. [ -s START-ADDR -e END-ADDR ]
  28827. | [ -a ADDR ]
  28828. | [ -f FILENAME -l LINENUM [ -n LINES ] ]
  28829. -- MODE
  28830. Where:
  28831. 'START-ADDR'
  28832. is the beginning address (or '$pc')
  28833. 'END-ADDR'
  28834. is the end address
  28835. 'ADDR'
  28836. is an address anywhere within (or the name of) the function to
  28837. disassemble. If an address is specified, the whole function
  28838. surrounding that address will be disassembled. If a name is
  28839. specified, the whole function with that name will be disassembled.
  28840. 'FILENAME'
  28841. is the name of the file to disassemble
  28842. 'LINENUM'
  28843. is the line number to disassemble around
  28844. 'LINES'
  28845. is the number of disassembly lines to be produced. If it is -1,
  28846. the whole function will be disassembled, in case no END-ADDR is
  28847. specified. If END-ADDR is specified as a non-zero value, and LINES
  28848. is lower than the number of disassembly lines between START-ADDR
  28849. and END-ADDR, only LINES lines are displayed; if LINES is higher
  28850. than the number of lines between START-ADDR and END-ADDR, only the
  28851. lines up to END-ADDR are displayed.
  28852. 'MODE'
  28853. is one of:
  28854. * 0 disassembly only
  28855. * 1 mixed source and disassembly (deprecated)
  28856. * 2 disassembly with raw opcodes
  28857. * 3 mixed source and disassembly with raw opcodes (deprecated)
  28858. * 4 mixed source and disassembly
  28859. * 5 mixed source and disassembly with raw opcodes
  28860. Modes 1 and 3 are deprecated. The output is "source centric" which
  28861. hasn't proved useful in practice. *Note Machine Code::, for a
  28862. discussion of the difference between '/m' and '/s' output of the
  28863. 'disassemble' command.
  28864. Result
  28865. ......
  28866. The result of the '-data-disassemble' command will be a list named
  28867. 'asm_insns', the contents of this list depend on the MODE used with the
  28868. '-data-disassemble' command.
  28869. For modes 0 and 2 the 'asm_insns' list contains tuples with the
  28870. following fields:
  28871. 'address'
  28872. The address at which this instruction was disassembled.
  28873. 'func-name'
  28874. The name of the function this instruction is within.
  28875. 'offset'
  28876. The decimal offset in bytes from the start of 'func-name'.
  28877. 'inst'
  28878. The text disassembly for this 'address'.
  28879. 'opcodes'
  28880. This field is only present for modes 2, 3 and 5. This contains the
  28881. raw opcode bytes for the 'inst' field.
  28882. For modes 1, 3, 4 and 5 the 'asm_insns' list contains tuples named
  28883. 'src_and_asm_line', each of which has the following fields:
  28884. 'line'
  28885. The line number within 'file'.
  28886. 'file'
  28887. The file name from the compilation unit. This might be an absolute
  28888. file name or a relative file name depending on the compile command
  28889. used.
  28890. 'fullname'
  28891. Absolute file name of 'file'. It is converted to a canonical form
  28892. using the source file search path (*note Specifying Source
  28893. Directories: Source Path.) and after resolving all the symbolic
  28894. links.
  28895. If the source file is not found this field will contain the path as
  28896. present in the debug information.
  28897. 'line_asm_insn'
  28898. This is a list of tuples containing the disassembly for 'line' in
  28899. 'file'. The fields of each tuple are the same as for
  28900. '-data-disassemble' in MODE 0 and 2, so 'address', 'func-name',
  28901. 'offset', 'inst', and optionally 'opcodes'.
  28902. Note that whatever included in the 'inst' field, is not manipulated
  28903. directly by GDB/MI, i.e., it is not possible to adjust its format.
  28904. GDB Command
  28905. ...........
  28906. The corresponding GDB command is 'disassemble'.
  28907. Example
  28908. .......
  28909. Disassemble from the current value of '$pc' to '$pc + 20':
  28910. (gdb)
  28911. -data-disassemble -s $pc -e "$pc + 20" -- 0
  28912. ^done,
  28913. asm_insns=[
  28914. {address="0x000107c0",func-name="main",offset="4",
  28915. inst="mov 2, %o0"},
  28916. {address="0x000107c4",func-name="main",offset="8",
  28917. inst="sethi %hi(0x11800), %o2"},
  28918. {address="0x000107c8",func-name="main",offset="12",
  28919. inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"},
  28920. {address="0x000107cc",func-name="main",offset="16",
  28921. inst="sethi %hi(0x11800), %o2"},
  28922. {address="0x000107d0",func-name="main",offset="20",
  28923. inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}]
  28924. (gdb)
  28925. Disassemble the whole 'main' function. Line 32 is part of 'main'.
  28926. -data-disassemble -f basics.c -l 32 -- 0
  28927. ^done,asm_insns=[
  28928. {address="0x000107bc",func-name="main",offset="0",
  28929. inst="save %sp, -112, %sp"},
  28930. {address="0x000107c0",func-name="main",offset="4",
  28931. inst="mov 2, %o0"},
  28932. {address="0x000107c4",func-name="main",offset="8",
  28933. inst="sethi %hi(0x11800), %o2"},
  28934. [...]
  28935. {address="0x0001081c",func-name="main",offset="96",inst="ret "},
  28936. {address="0x00010820",func-name="main",offset="100",inst="restore "}]
  28937. (gdb)
  28938. Disassemble 3 instructions from the start of 'main':
  28939. (gdb)
  28940. -data-disassemble -f basics.c -l 32 -n 3 -- 0
  28941. ^done,asm_insns=[
  28942. {address="0x000107bc",func-name="main",offset="0",
  28943. inst="save %sp, -112, %sp"},
  28944. {address="0x000107c0",func-name="main",offset="4",
  28945. inst="mov 2, %o0"},
  28946. {address="0x000107c4",func-name="main",offset="8",
  28947. inst="sethi %hi(0x11800), %o2"}]
  28948. (gdb)
  28949. Disassemble 3 instructions from the start of 'main' in mixed mode:
  28950. (gdb)
  28951. -data-disassemble -f basics.c -l 32 -n 3 -- 1
  28952. ^done,asm_insns=[
  28953. src_and_asm_line={line="31",
  28954. file="../../../src/gdb/testsuite/gdb.mi/basics.c",
  28955. fullname="/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c",
  28956. line_asm_insn=[{address="0x000107bc",
  28957. func-name="main",offset="0",inst="save %sp, -112, %sp"}]},
  28958. src_and_asm_line={line="32",
  28959. file="../../../src/gdb/testsuite/gdb.mi/basics.c",
  28960. fullname="/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c",
  28961. line_asm_insn=[{address="0x000107c0",
  28962. func-name="main",offset="4",inst="mov 2, %o0"},
  28963. {address="0x000107c4",func-name="main",offset="8",
  28964. inst="sethi %hi(0x11800), %o2"}]}]
  28965. (gdb)
  28966. The '-data-evaluate-expression' Command
  28967. ---------------------------------------
  28968. Synopsis
  28969. ........
  28970. -data-evaluate-expression EXPR
  28971. Evaluate EXPR as an expression. The expression could contain an
  28972. inferior function call. The function call will execute synchronously.
  28973. If the expression contains spaces, it must be enclosed in double quotes.
  28974. GDB Command
  28975. ...........
  28976. The corresponding GDB commands are 'print', 'output', and 'call'. In
  28977. 'gdbtk' only, there's a corresponding 'gdb_eval' command.
  28978. Example
  28979. .......
  28980. In the following example, the numbers that precede the commands are the
  28981. "tokens" described in *note GDB/MI Command Syntax: GDB/MI Command
  28982. Syntax. Notice how GDB/MI returns the same tokens in its output.
  28983. 211-data-evaluate-expression A
  28984. 211^done,value="1"
  28985. (gdb)
  28986. 311-data-evaluate-expression &A
  28987. 311^done,value="0xefffeb7c"
  28988. (gdb)
  28989. 411-data-evaluate-expression A+3
  28990. 411^done,value="4"
  28991. (gdb)
  28992. 511-data-evaluate-expression "A + 3"
  28993. 511^done,value="4"
  28994. (gdb)
  28995. The '-data-list-changed-registers' Command
  28996. ------------------------------------------
  28997. Synopsis
  28998. ........
  28999. -data-list-changed-registers
  29000. Display a list of the registers that have changed.
  29001. GDB Command
  29002. ...........
  29003. GDB doesn't have a direct analog for this command; 'gdbtk' has the
  29004. corresponding command 'gdb_changed_register_list'.
  29005. Example
  29006. .......
  29007. On a PPC MBX board:
  29008. (gdb)
  29009. -exec-continue
  29010. ^running
  29011. (gdb)
  29012. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={
  29013. func="main",args=[],file="try.c",fullname="/home/foo/bar/try.c",
  29014. line="5",arch="powerpc"}
  29015. (gdb)
  29016. -data-list-changed-registers
  29017. ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
  29018. "10","11","13","14","15","16","17","18","19","20","21","22","23",
  29019. "24","25","26","27","28","30","31","64","65","66","67","69"]
  29020. (gdb)
  29021. The '-data-list-register-names' Command
  29022. ---------------------------------------
  29023. Synopsis
  29024. ........
  29025. -data-list-register-names [ ( REGNO )+ ]
  29026. Show a list of register names for the current target. If no
  29027. arguments are given, it shows a list of the names of all the registers.
  29028. If integer numbers are given as arguments, it will print a list of the
  29029. names of the registers corresponding to the arguments. To ensure
  29030. consistency between a register name and its number, the output list may
  29031. include empty register names.
  29032. GDB Command
  29033. ...........
  29034. GDB does not have a command which corresponds to
  29035. '-data-list-register-names'. In 'gdbtk' there is a corresponding
  29036. command 'gdb_regnames'.
  29037. Example
  29038. .......
  29039. For the PPC MBX board:
  29040. (gdb)
  29041. -data-list-register-names
  29042. ^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
  29043. "r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
  29044. "r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
  29045. "r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
  29046. "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
  29047. "f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
  29048. "", "pc","ps","cr","lr","ctr","xer"]
  29049. (gdb)
  29050. -data-list-register-names 1 2 3
  29051. ^done,register-names=["r1","r2","r3"]
  29052. (gdb)
  29053. The '-data-list-register-values' Command
  29054. ----------------------------------------
  29055. Synopsis
  29056. ........
  29057. -data-list-register-values
  29058. [ --skip-unavailable ] FMT [ ( REGNO )*]
  29059. Display the registers' contents. The format according to which the
  29060. registers' contents are to be returned is given by FMT, followed by an
  29061. optional list of numbers specifying the registers to display. A missing
  29062. list of numbers indicates that the contents of all the registers must be
  29063. returned. The '--skip-unavailable' option indicates that only the
  29064. available registers are to be returned.
  29065. Allowed formats for FMT are:
  29066. 'x'
  29067. Hexadecimal
  29068. 'o'
  29069. Octal
  29070. 't'
  29071. Binary
  29072. 'd'
  29073. Decimal
  29074. 'r'
  29075. Raw
  29076. 'N'
  29077. Natural
  29078. GDB Command
  29079. ...........
  29080. The corresponding GDB commands are 'info reg', 'info all-reg', and (in
  29081. 'gdbtk') 'gdb_fetch_registers'.
  29082. Example
  29083. .......
  29084. For a PPC MBX board (note: line breaks are for readability only, they
  29085. don't appear in the actual output):
  29086. (gdb)
  29087. -data-list-register-values r 64 65
  29088. ^done,register-values=[{number="64",value="0xfe00a300"},
  29089. {number="65",value="0x00029002"}]
  29090. (gdb)
  29091. -data-list-register-values x
  29092. ^done,register-values=[{number="0",value="0xfe0043c8"},
  29093. {number="1",value="0x3fff88"},{number="2",value="0xfffffffe"},
  29094. {number="3",value="0x0"},{number="4",value="0xa"},
  29095. {number="5",value="0x3fff68"},{number="6",value="0x3fff58"},
  29096. {number="7",value="0xfe011e98"},{number="8",value="0x2"},
  29097. {number="9",value="0xfa202820"},{number="10",value="0xfa202808"},
  29098. {number="11",value="0x1"},{number="12",value="0x0"},
  29099. {number="13",value="0x4544"},{number="14",value="0xffdfffff"},
  29100. {number="15",value="0xffffffff"},{number="16",value="0xfffffeff"},
  29101. {number="17",value="0xefffffed"},{number="18",value="0xfffffffe"},
  29102. {number="19",value="0xffffffff"},{number="20",value="0xffffffff"},
  29103. {number="21",value="0xffffffff"},{number="22",value="0xfffffff7"},
  29104. {number="23",value="0xffffffff"},{number="24",value="0xffffffff"},
  29105. {number="25",value="0xffffffff"},{number="26",value="0xfffffffb"},
  29106. {number="27",value="0xffffffff"},{number="28",value="0xf7bfffff"},
  29107. {number="29",value="0x0"},{number="30",value="0xfe010000"},
  29108. {number="31",value="0x0"},{number="32",value="0x0"},
  29109. {number="33",value="0x0"},{number="34",value="0x0"},
  29110. {number="35",value="0x0"},{number="36",value="0x0"},
  29111. {number="37",value="0x0"},{number="38",value="0x0"},
  29112. {number="39",value="0x0"},{number="40",value="0x0"},
  29113. {number="41",value="0x0"},{number="42",value="0x0"},
  29114. {number="43",value="0x0"},{number="44",value="0x0"},
  29115. {number="45",value="0x0"},{number="46",value="0x0"},
  29116. {number="47",value="0x0"},{number="48",value="0x0"},
  29117. {number="49",value="0x0"},{number="50",value="0x0"},
  29118. {number="51",value="0x0"},{number="52",value="0x0"},
  29119. {number="53",value="0x0"},{number="54",value="0x0"},
  29120. {number="55",value="0x0"},{number="56",value="0x0"},
  29121. {number="57",value="0x0"},{number="58",value="0x0"},
  29122. {number="59",value="0x0"},{number="60",value="0x0"},
  29123. {number="61",value="0x0"},{number="62",value="0x0"},
  29124. {number="63",value="0x0"},{number="64",value="0xfe00a300"},
  29125. {number="65",value="0x29002"},{number="66",value="0x202f04b5"},
  29126. {number="67",value="0xfe0043b0"},{number="68",value="0xfe00b3e4"},
  29127. {number="69",value="0x20002b03"}]
  29128. (gdb)
  29129. The '-data-read-memory' Command
  29130. -------------------------------
  29131. This command is deprecated, use '-data-read-memory-bytes' instead.
  29132. Synopsis
  29133. ........
  29134. -data-read-memory [ -o BYTE-OFFSET ]
  29135. ADDRESS WORD-FORMAT WORD-SIZE
  29136. NR-ROWS NR-COLS [ ASCHAR ]
  29137. where:
  29138. 'ADDRESS'
  29139. An expression specifying the address of the first memory word to be
  29140. read. Complex expressions containing embedded white space should
  29141. be quoted using the C convention.
  29142. 'WORD-FORMAT'
  29143. The format to be used to print the memory words. The notation is
  29144. the same as for GDB's 'print' command (*note Output Formats: Output
  29145. Formats.).
  29146. 'WORD-SIZE'
  29147. The size of each memory word in bytes.
  29148. 'NR-ROWS'
  29149. The number of rows in the output table.
  29150. 'NR-COLS'
  29151. The number of columns in the output table.
  29152. 'ASCHAR'
  29153. If present, indicates that each row should include an ASCII dump.
  29154. The value of ASCHAR is used as a padding character when a byte is
  29155. not a member of the printable ASCII character set (printable ASCII
  29156. characters are those whose code is between 32 and 126,
  29157. inclusively).
  29158. 'BYTE-OFFSET'
  29159. An offset to add to the ADDRESS before fetching memory.
  29160. This command displays memory contents as a table of NR-ROWS by
  29161. NR-COLS words, each word being WORD-SIZE bytes. In total, 'NR-ROWS *
  29162. NR-COLS * WORD-SIZE' bytes are read (returned as 'total-bytes'). Should
  29163. less than the requested number of bytes be returned by the target, the
  29164. missing words are identified using 'N/A'. The number of bytes read from
  29165. the target is returned in 'nr-bytes' and the starting address used to
  29166. read memory in 'addr'.
  29167. The address of the next/previous row or page is available in
  29168. 'next-row' and 'prev-row', 'next-page' and 'prev-page'.
  29169. GDB Command
  29170. ...........
  29171. The corresponding GDB command is 'x'. 'gdbtk' has 'gdb_get_mem' memory
  29172. read command.
  29173. Example
  29174. .......
  29175. Read six bytes of memory starting at 'bytes+6' but then offset by '-6'
  29176. bytes. Format as three rows of two columns. One byte per word.
  29177. Display each word in hex.
  29178. (gdb)
  29179. 9-data-read-memory -o -6 -- bytes+6 x 1 3 2
  29180. 9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
  29181. next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
  29182. prev-page="0x0000138a",memory=[
  29183. {addr="0x00001390",data=["0x00","0x01"]},
  29184. {addr="0x00001392",data=["0x02","0x03"]},
  29185. {addr="0x00001394",data=["0x04","0x05"]}]
  29186. (gdb)
  29187. Read two bytes of memory starting at address 'shorts + 64' and
  29188. display as a single word formatted in decimal.
  29189. (gdb)
  29190. 5-data-read-memory shorts+64 d 2 1 1
  29191. 5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
  29192. next-row="0x00001512",prev-row="0x0000150e",
  29193. next-page="0x00001512",prev-page="0x0000150e",memory=[
  29194. {addr="0x00001510",data=["128"]}]
  29195. (gdb)
  29196. Read thirty two bytes of memory starting at 'bytes+16' and format as
  29197. eight rows of four columns. Include a string encoding with 'x' used as
  29198. the non-printable character.
  29199. (gdb)
  29200. 4-data-read-memory bytes+16 x 1 8 4 x
  29201. 4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
  29202. next-row="0x000013c0",prev-row="0x0000139c",
  29203. next-page="0x000013c0",prev-page="0x00001380",memory=[
  29204. {addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"},
  29205. {addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"},
  29206. {addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"},
  29207. {addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"},
  29208. {addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"},
  29209. {addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"},
  29210. {addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"},
  29211. {addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"}]
  29212. (gdb)
  29213. The '-data-read-memory-bytes' Command
  29214. -------------------------------------
  29215. Synopsis
  29216. ........
  29217. -data-read-memory-bytes [ -o OFFSET ]
  29218. ADDRESS COUNT
  29219. where:
  29220. 'ADDRESS'
  29221. An expression specifying the address of the first addressable
  29222. memory unit to be read. Complex expressions containing embedded
  29223. white space should be quoted using the C convention.
  29224. 'COUNT'
  29225. The number of addressable memory units to read. This should be an
  29226. integer literal.
  29227. 'OFFSET'
  29228. The offset relative to ADDRESS at which to start reading. This
  29229. should be an integer literal. This option is provided so that a
  29230. frontend is not required to first evaluate address and then perform
  29231. address arithmetics itself.
  29232. This command attempts to read all accessible memory regions in the
  29233. specified range. First, all regions marked as unreadable in the memory
  29234. map (if one is defined) will be skipped. *Note Memory Region
  29235. Attributes::. Second, GDB will attempt to read the remaining regions.
  29236. For each one, if reading full region results in an errors, GDB will try
  29237. to read a subset of the region.
  29238. In general, every single memory unit in the region may be readable or
  29239. not, and the only way to read every readable unit is to try a read at
  29240. every address, which is not practical. Therefore, GDB will attempt to
  29241. read all accessible memory units at either beginning or the end of the
  29242. region, using a binary division scheme. This heuristic works well for
  29243. reading across a memory map boundary. Note that if a region has a
  29244. readable range that is neither at the beginning or the end, GDB will not
  29245. read it.
  29246. The result record (*note GDB/MI Result Records::) that is output of
  29247. the command includes a field named 'memory' whose content is a list of
  29248. tuples. Each tuple represent a successfully read memory block and has
  29249. the following fields:
  29250. 'begin'
  29251. The start address of the memory block, as hexadecimal literal.
  29252. 'end'
  29253. The end address of the memory block, as hexadecimal literal.
  29254. 'offset'
  29255. The offset of the memory block, as hexadecimal literal, relative to
  29256. the start address passed to '-data-read-memory-bytes'.
  29257. 'contents'
  29258. The contents of the memory block, in hex.
  29259. GDB Command
  29260. ...........
  29261. The corresponding GDB command is 'x'.
  29262. Example
  29263. .......
  29264. (gdb)
  29265. -data-read-memory-bytes &a 10
  29266. ^done,memory=[{begin="0xbffff154",offset="0x00000000",
  29267. end="0xbffff15e",
  29268. contents="01000000020000000300"}]
  29269. (gdb)
  29270. The '-data-write-memory-bytes' Command
  29271. --------------------------------------
  29272. Synopsis
  29273. ........
  29274. -data-write-memory-bytes ADDRESS CONTENTS
  29275. -data-write-memory-bytes ADDRESS CONTENTS [COUNT]
  29276. where:
  29277. 'ADDRESS'
  29278. An expression specifying the address of the first addressable
  29279. memory unit to be written. Complex expressions containing embedded
  29280. white space should be quoted using the C convention.
  29281. 'CONTENTS'
  29282. The hex-encoded data to write. It is an error if CONTENTS does not
  29283. represent an integral number of addressable memory units.
  29284. 'COUNT'
  29285. Optional argument indicating the number of addressable memory units
  29286. to be written. If COUNT is greater than CONTENTS' length, GDB will
  29287. repeatedly write CONTENTS until it fills COUNT memory units.
  29288. GDB Command
  29289. ...........
  29290. There's no corresponding GDB command.
  29291. Example
  29292. .......
  29293. (gdb)
  29294. -data-write-memory-bytes &a "aabbccdd"
  29295. ^done
  29296. (gdb)
  29297. (gdb)
  29298. -data-write-memory-bytes &a "aabbccdd" 16e
  29299. ^done
  29300. (gdb)
  29301. 
  29302. File: gdb.info, Node: GDB/MI Tracepoint Commands, Next: GDB/MI Symbol Query, Prev: GDB/MI Data Manipulation, Up: GDB/MI
  29303. 27.17 GDB/MI Tracepoint Commands
  29304. ================================
  29305. The commands defined in this section implement MI support for
  29306. tracepoints. For detailed introduction, see *note Tracepoints::.
  29307. The '-trace-find' Command
  29308. -------------------------
  29309. Synopsis
  29310. ........
  29311. -trace-find MODE [PARAMETERS...]
  29312. Find a trace frame using criteria defined by MODE and PARAMETERS.
  29313. The following table lists permissible modes and their parameters. For
  29314. details of operation, see *note tfind::.
  29315. 'none'
  29316. No parameters are required. Stops examining trace frames.
  29317. 'frame-number'
  29318. An integer is required as parameter. Selects tracepoint frame with
  29319. that index.
  29320. 'tracepoint-number'
  29321. An integer is required as parameter. Finds next trace frame that
  29322. corresponds to tracepoint with the specified number.
  29323. 'pc'
  29324. An address is required as parameter. Finds next trace frame that
  29325. corresponds to any tracepoint at the specified address.
  29326. 'pc-inside-range'
  29327. Two addresses are required as parameters. Finds next trace frame
  29328. that corresponds to a tracepoint at an address inside the specified
  29329. range. Both bounds are considered to be inside the range.
  29330. 'pc-outside-range'
  29331. Two addresses are required as parameters. Finds next trace frame
  29332. that corresponds to a tracepoint at an address outside the
  29333. specified range. Both bounds are considered to be inside the
  29334. range.
  29335. 'line'
  29336. Line specification is required as parameter. *Note Specify
  29337. Location::. Finds next trace frame that corresponds to a
  29338. tracepoint at the specified location.
  29339. If 'none' was passed as MODE, the response does not have fields.
  29340. Otherwise, the response may have the following fields:
  29341. 'found'
  29342. This field has either '0' or '1' as the value, depending on whether
  29343. a matching tracepoint was found.
  29344. 'traceframe'
  29345. The index of the found traceframe. This field is present iff the
  29346. 'found' field has value of '1'.
  29347. 'tracepoint'
  29348. The index of the found tracepoint. This field is present iff the
  29349. 'found' field has value of '1'.
  29350. 'frame'
  29351. The information about the frame corresponding to the found trace
  29352. frame. This field is present only if a trace frame was found.
  29353. *Note GDB/MI Frame Information::, for description of this field.
  29354. GDB Command
  29355. ...........
  29356. The corresponding GDB command is 'tfind'.
  29357. -trace-define-variable
  29358. ----------------------
  29359. Synopsis
  29360. ........
  29361. -trace-define-variable NAME [ VALUE ]
  29362. Create trace variable NAME if it does not exist. If VALUE is
  29363. specified, sets the initial value of the specified trace variable to
  29364. that value. Note that the NAME should start with the '$' character.
  29365. GDB Command
  29366. ...........
  29367. The corresponding GDB command is 'tvariable'.
  29368. The '-trace-frame-collected' Command
  29369. ------------------------------------
  29370. Synopsis
  29371. ........
  29372. -trace-frame-collected
  29373. [--var-print-values VAR_PVAL]
  29374. [--comp-print-values COMP_PVAL]
  29375. [--registers-format REGFORMAT]
  29376. [--memory-contents]
  29377. This command returns the set of collected objects, register names,
  29378. trace state variable names, memory ranges and computed expressions that
  29379. have been collected at a particular trace frame. The optional
  29380. parameters to the command affect the output format in different ways.
  29381. See the output description table below for more details.
  29382. The reported names can be used in the normal manner to create varobjs
  29383. and inspect the objects themselves. The items returned by this command
  29384. are categorized so that it is clear which is a variable, which is a
  29385. register, which is a trace state variable, which is a memory range and
  29386. which is a computed expression.
  29387. For instance, if the actions were
  29388. collect myVar, myArray[myIndex], myObj.field, myPtr->field, myCount + 2
  29389. collect *(int*)0xaf02bef0@40
  29390. the object collected in its entirety would be 'myVar'. The object
  29391. 'myArray' would be partially collected, because only the element at
  29392. index 'myIndex' would be collected. The remaining objects would be
  29393. computed expressions.
  29394. An example output would be:
  29395. (gdb)
  29396. -trace-frame-collected
  29397. ^done,
  29398. explicit-variables=[{name="myVar",value="1"}],
  29399. computed-expressions=[{name="myArray[myIndex]",value="0"},
  29400. {name="myObj.field",value="0"},
  29401. {name="myPtr->field",value="1"},
  29402. {name="myCount + 2",value="3"},
  29403. {name="$tvar1 + 1",value="43970027"}],
  29404. registers=[{number="0",value="0x7fe2c6e79ec8"},
  29405. {number="1",value="0x0"},
  29406. {number="2",value="0x4"},
  29407. ...
  29408. {number="125",value="0x0"}],
  29409. tvars=[{name="$tvar1",current="43970026"}],
  29410. memory=[{address="0x0000000000602264",length="4"},
  29411. {address="0x0000000000615bc0",length="4"}]
  29412. (gdb)
  29413. Where:
  29414. 'explicit-variables'
  29415. The set of objects that have been collected in their entirety (as
  29416. opposed to collecting just a few elements of an array or a few
  29417. struct members). For each object, its name and value are printed.
  29418. The '--var-print-values' option affects how or whether the value
  29419. field is output. If VAR_PVAL is 0, then print only the names; if
  29420. it is 1, print also their values; and if it is 2, print the name,
  29421. type and value for simple data types, and the name and type for
  29422. arrays, structures and unions.
  29423. 'computed-expressions'
  29424. The set of computed expressions that have been collected at the
  29425. current trace frame. The '--comp-print-values' option affects this
  29426. set like the '--var-print-values' option affects the
  29427. 'explicit-variables' set. See above.
  29428. 'registers'
  29429. The registers that have been collected at the current trace frame.
  29430. For each register collected, the name and current value are
  29431. returned. The value is formatted according to the
  29432. '--registers-format' option. See the '-data-list-register-values'
  29433. command for a list of the allowed formats. The default is 'x'.
  29434. 'tvars'
  29435. The trace state variables that have been collected at the current
  29436. trace frame. For each trace state variable collected, the name and
  29437. current value are returned.
  29438. 'memory'
  29439. The set of memory ranges that have been collected at the current
  29440. trace frame. Its content is a list of tuples. Each tuple
  29441. represents a collected memory range and has the following fields:
  29442. 'address'
  29443. The start address of the memory range, as hexadecimal literal.
  29444. 'length'
  29445. The length of the memory range, as decimal literal.
  29446. 'contents'
  29447. The contents of the memory block, in hex. This field is only
  29448. present if the '--memory-contents' option is specified.
  29449. GDB Command
  29450. ...........
  29451. There is no corresponding GDB command.
  29452. Example
  29453. .......
  29454. -trace-list-variables
  29455. ---------------------
  29456. Synopsis
  29457. ........
  29458. -trace-list-variables
  29459. Return a table of all defined trace variables. Each element of the
  29460. table has the following fields:
  29461. 'name'
  29462. The name of the trace variable. This field is always present.
  29463. 'initial'
  29464. The initial value. This is a 64-bit signed integer. This field is
  29465. always present.
  29466. 'current'
  29467. The value the trace variable has at the moment. This is a 64-bit
  29468. signed integer. This field is absent iff current value is not
  29469. defined, for example if the trace was never run, or is presently
  29470. running.
  29471. GDB Command
  29472. ...........
  29473. The corresponding GDB command is 'tvariables'.
  29474. Example
  29475. .......
  29476. (gdb)
  29477. -trace-list-variables
  29478. ^done,trace-variables={nr_rows="1",nr_cols="3",
  29479. hdr=[{width="15",alignment="-1",col_name="name",colhdr="Name"},
  29480. {width="11",alignment="-1",col_name="initial",colhdr="Initial"},
  29481. {width="11",alignment="-1",col_name="current",colhdr="Current"}],
  29482. body=[variable={name="$trace_timestamp",initial="0"}
  29483. variable={name="$foo",initial="10",current="15"}]}
  29484. (gdb)
  29485. -trace-save
  29486. -----------
  29487. Synopsis
  29488. ........
  29489. -trace-save [ -r ] [ -ctf ] FILENAME
  29490. Saves the collected trace data to FILENAME. Without the '-r' option,
  29491. the data is downloaded from the target and saved in a local file. With
  29492. the '-r' option the target is asked to perform the save.
  29493. By default, this command will save the trace in the tfile format.
  29494. You can supply the optional '-ctf' argument to save it the CTF format.
  29495. See *note Trace Files:: for more information about CTF.
  29496. GDB Command
  29497. ...........
  29498. The corresponding GDB command is 'tsave'.
  29499. -trace-start
  29500. ------------
  29501. Synopsis
  29502. ........
  29503. -trace-start
  29504. Starts a tracing experiment. The result of this command does not
  29505. have any fields.
  29506. GDB Command
  29507. ...........
  29508. The corresponding GDB command is 'tstart'.
  29509. -trace-status
  29510. -------------
  29511. Synopsis
  29512. ........
  29513. -trace-status
  29514. Obtains the status of a tracing experiment. The result may include
  29515. the following fields:
  29516. 'supported'
  29517. May have a value of either '0', when no tracing operations are
  29518. supported, '1', when all tracing operations are supported, or
  29519. 'file' when examining trace file. In the latter case, examining of
  29520. trace frame is possible but new tracing experiement cannot be
  29521. started. This field is always present.
  29522. 'running'
  29523. May have a value of either '0' or '1' depending on whether tracing
  29524. experiement is in progress on target. This field is present if
  29525. 'supported' field is not '0'.
  29526. 'stop-reason'
  29527. Report the reason why the tracing was stopped last time. This
  29528. field may be absent iff tracing was never stopped on target yet.
  29529. The value of 'request' means the tracing was stopped as result of
  29530. the '-trace-stop' command. The value of 'overflow' means the
  29531. tracing buffer is full. The value of 'disconnection' means tracing
  29532. was automatically stopped when GDB has disconnected. The value of
  29533. 'passcount' means tracing was stopped when a tracepoint was passed
  29534. a maximal number of times for that tracepoint. This field is
  29535. present if 'supported' field is not '0'.
  29536. 'stopping-tracepoint'
  29537. The number of tracepoint whose passcount as exceeded. This field
  29538. is present iff the 'stop-reason' field has the value of
  29539. 'passcount'.
  29540. 'frames'
  29541. 'frames-created'
  29542. The 'frames' field is a count of the total number of trace frames
  29543. in the trace buffer, while 'frames-created' is the total created
  29544. during the run, including ones that were discarded, such as when a
  29545. circular trace buffer filled up. Both fields are optional.
  29546. 'buffer-size'
  29547. 'buffer-free'
  29548. These fields tell the current size of the tracing buffer and the
  29549. remaining space. These fields are optional.
  29550. 'circular'
  29551. The value of the circular trace buffer flag. '1' means that the
  29552. trace buffer is circular and old trace frames will be discarded if
  29553. necessary to make room, '0' means that the trace buffer is linear
  29554. and may fill up.
  29555. 'disconnected'
  29556. The value of the disconnected tracing flag. '1' means that tracing
  29557. will continue after GDB disconnects, '0' means that the trace run
  29558. will stop.
  29559. 'trace-file'
  29560. The filename of the trace file being examined. This field is
  29561. optional, and only present when examining a trace file.
  29562. GDB Command
  29563. ...........
  29564. The corresponding GDB command is 'tstatus'.
  29565. -trace-stop
  29566. -----------
  29567. Synopsis
  29568. ........
  29569. -trace-stop
  29570. Stops a tracing experiment. The result of this command has the same
  29571. fields as '-trace-status', except that the 'supported' and 'running'
  29572. fields are not output.
  29573. GDB Command
  29574. ...........
  29575. The corresponding GDB command is 'tstop'.
  29576. 
  29577. File: gdb.info, Node: GDB/MI Symbol Query, Next: GDB/MI File Commands, Prev: GDB/MI Tracepoint Commands, Up: GDB/MI
  29578. 27.18 GDB/MI Symbol Query Commands
  29579. ==================================
  29580. The '-symbol-info-functions' Command
  29581. ------------------------------------
  29582. Synopsis
  29583. ........
  29584. -symbol-info-functions [--include-nondebug]
  29585. [--type TYPE_REGEXP]
  29586. [--name NAME_REGEXP]
  29587. [--max-results LIMIT]
  29588. Return a list containing the names and types for all global functions
  29589. taken from the debug information. The functions are grouped by source
  29590. file, and shown with the line number on which each function is defined.
  29591. The '--include-nondebug' option causes the output to include code
  29592. symbols from the symbol table.
  29593. The options '--type' and '--name' allow the symbols returned to be
  29594. filtered based on either the name of the function, or the type signature
  29595. of the function.
  29596. The option '--max-results' restricts the command to return no more
  29597. than LIMIT results. If exactly LIMIT results are returned then there
  29598. might be additional results available if a higher limit is used.
  29599. GDB Command
  29600. ...........
  29601. The corresponding GDB command is 'info functions'.
  29602. Example
  29603. .......
  29604. (gdb)
  29605. -symbol-info-functions
  29606. ^done,symbols=
  29607. {debug=
  29608. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29609. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29610. symbols=[{line="36", name="f4", type="void (int *)",
  29611. description="void f4(int *);"},
  29612. {line="42", name="main", type="int ()",
  29613. description="int main();"},
  29614. {line="30", name="f1", type="my_int_t (int, int)",
  29615. description="static my_int_t f1(int, int);"}]},
  29616. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29617. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29618. symbols=[{line="33", name="f2", type="float (another_float_t)",
  29619. description="float f2(another_float_t);"},
  29620. {line="39", name="f3", type="int (another_int_t)",
  29621. description="int f3(another_int_t);"},
  29622. {line="27", name="f1", type="another_float_t (int)",
  29623. description="static another_float_t f1(int);"}]}]}
  29624. (gdb)
  29625. -symbol-info-functions --name f1
  29626. ^done,symbols=
  29627. {debug=
  29628. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29629. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29630. symbols=[{line="30", name="f1", type="my_int_t (int, int)",
  29631. description="static my_int_t f1(int, int);"}]},
  29632. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29633. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29634. symbols=[{line="27", name="f1", type="another_float_t (int)",
  29635. description="static another_float_t f1(int);"}]}]}
  29636. (gdb)
  29637. -symbol-info-functions --type void
  29638. ^done,symbols=
  29639. {debug=
  29640. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29641. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29642. symbols=[{line="36", name="f4", type="void (int *)",
  29643. description="void f4(int *);"}]}]}
  29644. (gdb)
  29645. -symbol-info-functions --include-nondebug
  29646. ^done,symbols=
  29647. {debug=
  29648. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29649. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29650. symbols=[{line="36", name="f4", type="void (int *)",
  29651. description="void f4(int *);"},
  29652. {line="42", name="main", type="int ()",
  29653. description="int main();"},
  29654. {line="30", name="f1", type="my_int_t (int, int)",
  29655. description="static my_int_t f1(int, int);"}]},
  29656. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29657. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29658. symbols=[{line="33", name="f2", type="float (another_float_t)",
  29659. description="float f2(another_float_t);"},
  29660. {line="39", name="f3", type="int (another_int_t)",
  29661. description="int f3(another_int_t);"},
  29662. {line="27", name="f1", type="another_float_t (int)",
  29663. description="static another_float_t f1(int);"}]}],
  29664. nondebug=
  29665. [{address="0x0000000000400398",name="_init"},
  29666. {address="0x00000000004003b0",name="_start"},
  29667. ...
  29668. ]}
  29669. The '-symbol-info-module-functions' Command
  29670. -------------------------------------------
  29671. Synopsis
  29672. ........
  29673. -symbol-info-module-functions [--module MODULE_REGEXP]
  29674. [--name NAME_REGEXP]
  29675. [--type TYPE_REGEXP]
  29676. Return a list containing the names of all known functions within all
  29677. know Fortran modules. The functions are grouped by source file and
  29678. containing module, and shown with the line number on which each function
  29679. is defined.
  29680. The option '--module' only returns results for modules matching
  29681. MODULE_REGEXP. The option '--name' only returns functions whose name
  29682. matches NAME_REGEXP, and '--type' only returns functions whose type
  29683. matches TYPE_REGEXP.
  29684. GDB Command
  29685. ...........
  29686. The corresponding GDB command is 'info module functions'.
  29687. Example
  29688. .......
  29689. (gdb)
  29690. -symbol-info-module-functions
  29691. ^done,symbols=
  29692. [{module="mod1",
  29693. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29694. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29695. symbols=[{line="21",name="mod1::check_all",type="void (void)",
  29696. description="void mod1::check_all(void);"}]}]},
  29697. {module="mod2",
  29698. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29699. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29700. symbols=[{line="30",name="mod2::check_var_i",type="void (void)",
  29701. description="void mod2::check_var_i(void);"}]}]},
  29702. {module="mod3",
  29703. files=[{filename="/projec/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29704. fullname="/projec/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29705. symbols=[{line="21",name="mod3::check_all",type="void (void)",
  29706. description="void mod3::check_all(void);"},
  29707. {line="27",name="mod3::check_mod2",type="void (void)",
  29708. description="void mod3::check_mod2(void);"}]}]},
  29709. {module="modmany",
  29710. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29711. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29712. symbols=[{line="35",name="modmany::check_some",type="void (void)",
  29713. description="void modmany::check_some(void);"}]}]},
  29714. {module="moduse",
  29715. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29716. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29717. symbols=[{line="44",name="moduse::check_all",type="void (void)",
  29718. description="void moduse::check_all(void);"},
  29719. {line="49",name="moduse::check_var_x",type="void (void)",
  29720. description="void moduse::check_var_x(void);"}]}]}]
  29721. The '-symbol-info-module-variables' Command
  29722. -------------------------------------------
  29723. Synopsis
  29724. ........
  29725. -symbol-info-module-variables [--module MODULE_REGEXP]
  29726. [--name NAME_REGEXP]
  29727. [--type TYPE_REGEXP]
  29728. Return a list containing the names of all known variables within all
  29729. know Fortran modules. The variables are grouped by source file and
  29730. containing module, and shown with the line number on which each variable
  29731. is defined.
  29732. The option '--module' only returns results for modules matching
  29733. MODULE_REGEXP. The option '--name' only returns variables whose name
  29734. matches NAME_REGEXP, and '--type' only returns variables whose type
  29735. matches TYPE_REGEXP.
  29736. GDB Command
  29737. ...........
  29738. The corresponding GDB command is 'info module variables'.
  29739. Example
  29740. .......
  29741. (gdb)
  29742. -symbol-info-module-variables
  29743. ^done,symbols=
  29744. [{module="mod1",
  29745. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29746. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29747. symbols=[{line="18",name="mod1::var_const",type="integer(kind=4)",
  29748. description="integer(kind=4) mod1::var_const;"},
  29749. {line="17",name="mod1::var_i",type="integer(kind=4)",
  29750. description="integer(kind=4) mod1::var_i;"}]}]},
  29751. {module="mod2",
  29752. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29753. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29754. symbols=[{line="28",name="mod2::var_i",type="integer(kind=4)",
  29755. description="integer(kind=4) mod2::var_i;"}]}]},
  29756. {module="mod3",
  29757. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29758. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29759. symbols=[{line="18",name="mod3::mod1",type="integer(kind=4)",
  29760. description="integer(kind=4) mod3::mod1;"},
  29761. {line="17",name="mod3::mod2",type="integer(kind=4)",
  29762. description="integer(kind=4) mod3::mod2;"},
  29763. {line="19",name="mod3::var_i",type="integer(kind=4)",
  29764. description="integer(kind=4) mod3::var_i;"}]}]},
  29765. {module="modmany",
  29766. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29767. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29768. symbols=[{line="33",name="modmany::var_a",type="integer(kind=4)",
  29769. description="integer(kind=4) modmany::var_a;"},
  29770. {line="33",name="modmany::var_b",type="integer(kind=4)",
  29771. description="integer(kind=4) modmany::var_b;"},
  29772. {line="33",name="modmany::var_c",type="integer(kind=4)",
  29773. description="integer(kind=4) modmany::var_c;"},
  29774. {line="33",name="modmany::var_i",type="integer(kind=4)",
  29775. description="integer(kind=4) modmany::var_i;"}]}]},
  29776. {module="moduse",
  29777. files=[{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29778. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29779. symbols=[{line="42",name="moduse::var_x",type="integer(kind=4)",
  29780. description="integer(kind=4) moduse::var_x;"},
  29781. {line="42",name="moduse::var_y",type="integer(kind=4)",
  29782. description="integer(kind=4) moduse::var_y;"}]}]}]
  29783. The '-symbol-info-modules' Command
  29784. ----------------------------------
  29785. Synopsis
  29786. ........
  29787. -symbol-info-modules [--name NAME_REGEXP]
  29788. [--max-results LIMIT]
  29789. Return a list containing the names of all known Fortran modules. The
  29790. modules are grouped by source file, and shown with the line number on
  29791. which each modules is defined.
  29792. The option '--name' allows the modules returned to be filtered based
  29793. the name of the module.
  29794. The option '--max-results' restricts the command to return no more
  29795. than LIMIT results. If exactly LIMIT results are returned then there
  29796. might be additional results available if a higher limit is used.
  29797. GDB Command
  29798. ...........
  29799. The corresponding GDB command is 'info modules'.
  29800. Example
  29801. .......
  29802. (gdb)
  29803. -symbol-info-modules
  29804. ^done,symbols=
  29805. {debug=
  29806. [{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29807. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29808. symbols=[{line="16",name="mod1"},
  29809. {line="22",name="mod2"}]},
  29810. {filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29811. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29812. symbols=[{line="16",name="mod3"},
  29813. {line="22",name="modmany"},
  29814. {line="26",name="moduse"}]}]}
  29815. (gdb)
  29816. -symbol-info-modules --name mod[123]
  29817. ^done,symbols=
  29818. {debug=
  29819. [{filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29820. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90",
  29821. symbols=[{line="16",name="mod1"},
  29822. {line="22",name="mod2"}]},
  29823. {filename="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29824. fullname="/project/gdb/testsuite/gdb.mi/mi-fortran-modules.f90",
  29825. symbols=[{line="16",name="mod3"}]}]}
  29826. The '-symbol-info-types' Command
  29827. --------------------------------
  29828. Synopsis
  29829. ........
  29830. -symbol-info-types [--name NAME_REGEXP]
  29831. [--max-results LIMIT]
  29832. Return a list of all defined types. The types are grouped by source
  29833. file, and shown with the line number on which each user defined type is
  29834. defined. Some base types are not defined in the source code but are
  29835. added to the debug information by the compiler, for example 'int',
  29836. 'float', etc.; these types do not have an associated line number.
  29837. The option '--name' allows the list of types returned to be filtered
  29838. by name.
  29839. The option '--max-results' restricts the command to return no more
  29840. than LIMIT results. If exactly LIMIT results are returned then there
  29841. might be additional results available if a higher limit is used.
  29842. GDB Command
  29843. ...........
  29844. The corresponding GDB command is 'info types'.
  29845. Example
  29846. .......
  29847. (gdb)
  29848. -symbol-info-types
  29849. ^done,symbols=
  29850. {debug=
  29851. [{filename="gdb.mi/mi-sym-info-1.c",
  29852. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29853. symbols=[{name="float"},
  29854. {name="int"},
  29855. {line="27",name="typedef int my_int_t;"}]},
  29856. {filename="gdb.mi/mi-sym-info-2.c",
  29857. fullname="/project/gdb.mi/mi-sym-info-2.c",
  29858. symbols=[{line="24",name="typedef float another_float_t;"},
  29859. {line="23",name="typedef int another_int_t;"},
  29860. {name="float"},
  29861. {name="int"}]}]}
  29862. (gdb)
  29863. -symbol-info-types --name _int_
  29864. ^done,symbols=
  29865. {debug=
  29866. [{filename="gdb.mi/mi-sym-info-1.c",
  29867. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29868. symbols=[{line="27",name="typedef int my_int_t;"}]},
  29869. {filename="gdb.mi/mi-sym-info-2.c",
  29870. fullname="/project/gdb.mi/mi-sym-info-2.c",
  29871. symbols=[{line="23",name="typedef int another_int_t;"}]}]}
  29872. The '-symbol-info-variables' Command
  29873. ------------------------------------
  29874. Synopsis
  29875. ........
  29876. -symbol-info-variables [--include-nondebug]
  29877. [--type TYPE_REGEXP]
  29878. [--name NAME_REGEXP]
  29879. [--max-results LIMIT]
  29880. Return a list containing the names and types for all global variables
  29881. taken from the debug information. The variables are grouped by source
  29882. file, and shown with the line number on which each variable is defined.
  29883. The '--include-nondebug' option causes the output to include data
  29884. symbols from the symbol table.
  29885. The options '--type' and '--name' allow the symbols returned to be
  29886. filtered based on either the name of the variable, or the type of the
  29887. variable.
  29888. The option '--max-results' restricts the command to return no more
  29889. than LIMIT results. If exactly LIMIT results are returned then there
  29890. might be additional results available if a higher limit is used.
  29891. GDB Command
  29892. ...........
  29893. The corresponding GDB command is 'info variables'.
  29894. Example
  29895. .......
  29896. (gdb)
  29897. -symbol-info-variables
  29898. ^done,symbols=
  29899. {debug=
  29900. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29901. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29902. symbols=[{line="25",name="global_f1",type="float",
  29903. description="static float global_f1;"},
  29904. {line="24",name="global_i1",type="int",
  29905. description="static int global_i1;"}]},
  29906. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29907. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29908. symbols=[{line="21",name="global_f2",type="int",
  29909. description="int global_f2;"},
  29910. {line="20",name="global_i2",type="int",
  29911. description="int global_i2;"},
  29912. {line="19",name="global_f1",type="float",
  29913. description="static float global_f1;"},
  29914. {line="18",name="global_i1",type="int",
  29915. description="static int global_i1;"}]}]}
  29916. (gdb)
  29917. -symbol-info-variables --name f1
  29918. ^done,symbols=
  29919. {debug=
  29920. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29921. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29922. symbols=[{line="25",name="global_f1",type="float",
  29923. description="static float global_f1;"}]},
  29924. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29925. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29926. symbols=[{line="19",name="global_f1",type="float",
  29927. description="static float global_f1;"}]}]}
  29928. (gdb)
  29929. -symbol-info-variables --type float
  29930. ^done,symbols=
  29931. {debug=
  29932. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29933. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29934. symbols=[{line="25",name="global_f1",type="float",
  29935. description="static float global_f1;"}]},
  29936. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29937. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29938. symbols=[{line="19",name="global_f1",type="float",
  29939. description="static float global_f1;"}]}]}
  29940. (gdb)
  29941. -symbol-info-variables --include-nondebug
  29942. ^done,symbols=
  29943. {debug=
  29944. [{filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29945. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-1.c",
  29946. symbols=[{line="25",name="global_f1",type="float",
  29947. description="static float global_f1;"},
  29948. {line="24",name="global_i1",type="int",
  29949. description="static int global_i1;"}]},
  29950. {filename="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29951. fullname="/project/gdb/testsuite/gdb.mi/mi-sym-info-2.c",
  29952. symbols=[{line="21",name="global_f2",type="int",
  29953. description="int global_f2;"},
  29954. {line="20",name="global_i2",type="int",
  29955. description="int global_i2;"},
  29956. {line="19",name="global_f1",type="float",
  29957. description="static float global_f1;"},
  29958. {line="18",name="global_i1",type="int",
  29959. description="static int global_i1;"}]}],
  29960. nondebug=
  29961. [{address="0x00000000004005d0",name="_IO_stdin_used"},
  29962. {address="0x00000000004005d8",name="__dso_handle"}
  29963. ...
  29964. ]}
  29965. The '-symbol-list-lines' Command
  29966. --------------------------------
  29967. Synopsis
  29968. ........
  29969. -symbol-list-lines FILENAME
  29970. Print the list of lines that contain code and their associated
  29971. program addresses for the given source filename. The entries are sorted
  29972. in ascending PC order.
  29973. GDB Command
  29974. ...........
  29975. There is no corresponding GDB command.
  29976. Example
  29977. .......
  29978. (gdb)
  29979. -symbol-list-lines basics.c
  29980. ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
  29981. (gdb)
  29982. 
  29983. File: gdb.info, Node: GDB/MI File Commands, Next: GDB/MI Target Manipulation, Prev: GDB/MI Symbol Query, Up: GDB/MI
  29984. 27.19 GDB/MI File Commands
  29985. ==========================
  29986. This section describes the GDB/MI commands to specify executable file
  29987. names and to read in and obtain symbol table information.
  29988. The '-file-exec-and-symbols' Command
  29989. ------------------------------------
  29990. Synopsis
  29991. ........
  29992. -file-exec-and-symbols FILE
  29993. Specify the executable file to be debugged. This file is the one
  29994. from which the symbol table is also read. If no file is specified, the
  29995. command clears the executable and symbol information. If breakpoints
  29996. are set when using this command with no arguments, GDB will produce
  29997. error messages. Otherwise, no output is produced, except a completion
  29998. notification.
  29999. GDB Command
  30000. ...........
  30001. The corresponding GDB command is 'file'.
  30002. Example
  30003. .......
  30004. (gdb)
  30005. -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  30006. ^done
  30007. (gdb)
  30008. The '-file-exec-file' Command
  30009. -----------------------------
  30010. Synopsis
  30011. ........
  30012. -file-exec-file FILE
  30013. Specify the executable file to be debugged. Unlike
  30014. '-file-exec-and-symbols', the symbol table is _not_ read from this file.
  30015. If used without argument, GDB clears the information about the
  30016. executable file. No output is produced, except a completion
  30017. notification.
  30018. GDB Command
  30019. ...........
  30020. The corresponding GDB command is 'exec-file'.
  30021. Example
  30022. .......
  30023. (gdb)
  30024. -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  30025. ^done
  30026. (gdb)
  30027. The '-file-list-exec-source-file' Command
  30028. -----------------------------------------
  30029. Synopsis
  30030. ........
  30031. -file-list-exec-source-file
  30032. List the line number, the current source file, and the absolute path
  30033. to the current source file for the current executable. The macro
  30034. information field has a value of '1' or '0' depending on whether or not
  30035. the file includes preprocessor macro information.
  30036. GDB Command
  30037. ...........
  30038. The GDB equivalent is 'info source'
  30039. Example
  30040. .......
  30041. (gdb)
  30042. 123-file-list-exec-source-file
  30043. 123^done,line="1",file="foo.c",fullname="/home/bar/foo.c,macro-info="1"
  30044. (gdb)
  30045. The '-file-list-exec-source-files' Command
  30046. ------------------------------------------
  30047. Synopsis
  30048. ........
  30049. -file-list-exec-source-files
  30050. List the source files for the current executable.
  30051. It will always output both the filename and fullname (absolute file
  30052. name) of a source file.
  30053. GDB Command
  30054. ...........
  30055. The GDB equivalent is 'info sources'. 'gdbtk' has an analogous command
  30056. 'gdb_listfiles'.
  30057. Example
  30058. .......
  30059. (gdb)
  30060. -file-list-exec-source-files
  30061. ^done,files=[
  30062. {file=foo.c,fullname=/home/foo.c},
  30063. {file=/home/bar.c,fullname=/home/bar.c},
  30064. {file=gdb_could_not_find_fullpath.c}]
  30065. (gdb)
  30066. The '-file-list-shared-libraries' Command
  30067. -----------------------------------------
  30068. Synopsis
  30069. ........
  30070. -file-list-shared-libraries [ REGEXP ]
  30071. List the shared libraries in the program. With a regular expression
  30072. REGEXP, only those libraries whose names match REGEXP are listed.
  30073. GDB Command
  30074. ...........
  30075. The corresponding GDB command is 'info shared'. The fields have a
  30076. similar meaning to the '=library-loaded' notification. The 'ranges'
  30077. field specifies the multiple segments belonging to this library. Each
  30078. range has the following fields:
  30079. 'from'
  30080. The address defining the inclusive lower bound of the segment.
  30081. 'to'
  30082. The address defining the exclusive upper bound of the segment.
  30083. Example
  30084. .......
  30085. (gdb)
  30086. -file-list-exec-source-files
  30087. ^done,shared-libraries=[
  30088. {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"}]},
  30089. {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"}]}]
  30090. (gdb)
  30091. The '-file-symbol-file' Command
  30092. -------------------------------
  30093. Synopsis
  30094. ........
  30095. -file-symbol-file FILE
  30096. Read symbol table info from the specified FILE argument. When used
  30097. without arguments, clears GDB's symbol table info. No output is
  30098. produced, except for a completion notification.
  30099. GDB Command
  30100. ...........
  30101. The corresponding GDB command is 'symbol-file'.
  30102. Example
  30103. .......
  30104. (gdb)
  30105. -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  30106. ^done
  30107. (gdb)
  30108. 
  30109. File: gdb.info, Node: GDB/MI Target Manipulation, Next: GDB/MI File Transfer Commands, Prev: GDB/MI File Commands, Up: GDB/MI
  30110. 27.20 GDB/MI Target Manipulation Commands
  30111. =========================================
  30112. The '-target-attach' Command
  30113. ----------------------------
  30114. Synopsis
  30115. ........
  30116. -target-attach PID | GID | FILE
  30117. Attach to a process PID or a file FILE outside of GDB, or a thread
  30118. group GID. If attaching to a thread group, the id previously returned
  30119. by '-list-thread-groups --available' must be used.
  30120. GDB Command
  30121. ...........
  30122. The corresponding GDB command is 'attach'.
  30123. Example
  30124. .......
  30125. (gdb)
  30126. -target-attach 34
  30127. =thread-created,id="1"
  30128. *stopped,thread-id="1",frame={addr="0xb7f7e410",func="bar",args=[]}
  30129. ^done
  30130. (gdb)
  30131. The '-target-detach' Command
  30132. ----------------------------
  30133. Synopsis
  30134. ........
  30135. -target-detach [ PID | GID ]
  30136. Detach from the remote target which normally resumes its execution.
  30137. If either PID or GID is specified, detaches from either the specified
  30138. process, or specified thread group. There's no output.
  30139. GDB Command
  30140. ...........
  30141. The corresponding GDB command is 'detach'.
  30142. Example
  30143. .......
  30144. (gdb)
  30145. -target-detach
  30146. ^done
  30147. (gdb)
  30148. The '-target-disconnect' Command
  30149. --------------------------------
  30150. Synopsis
  30151. ........
  30152. -target-disconnect
  30153. Disconnect from the remote target. There's no output and the target
  30154. is generally not resumed.
  30155. GDB Command
  30156. ...........
  30157. The corresponding GDB command is 'disconnect'.
  30158. Example
  30159. .......
  30160. (gdb)
  30161. -target-disconnect
  30162. ^done
  30163. (gdb)
  30164. The '-target-download' Command
  30165. ------------------------------
  30166. Synopsis
  30167. ........
  30168. -target-download
  30169. Loads the executable onto the remote target. It prints out an update
  30170. message every half second, which includes the fields:
  30171. 'section'
  30172. The name of the section.
  30173. 'section-sent'
  30174. The size of what has been sent so far for that section.
  30175. 'section-size'
  30176. The size of the section.
  30177. 'total-sent'
  30178. The total size of what was sent so far (the current and the
  30179. previous sections).
  30180. 'total-size'
  30181. The size of the overall executable to download.
  30182. Each message is sent as status record (*note GDB/MI Output Syntax:
  30183. GDB/MI Output Syntax.).
  30184. In addition, it prints the name and size of the sections, as they are
  30185. downloaded. These messages include the following fields:
  30186. 'section'
  30187. The name of the section.
  30188. 'section-size'
  30189. The size of the section.
  30190. 'total-size'
  30191. The size of the overall executable to download.
  30192. At the end, a summary is printed.
  30193. GDB Command
  30194. ...........
  30195. The corresponding GDB command is 'load'.
  30196. Example
  30197. .......
  30198. Note: each status message appears on a single line. Here the messages
  30199. have been broken down so that they can fit onto a page.
  30200. (gdb)
  30201. -target-download
  30202. +download,{section=".text",section-size="6668",total-size="9880"}
  30203. +download,{section=".text",section-sent="512",section-size="6668",
  30204. total-sent="512",total-size="9880"}
  30205. +download,{section=".text",section-sent="1024",section-size="6668",
  30206. total-sent="1024",total-size="9880"}
  30207. +download,{section=".text",section-sent="1536",section-size="6668",
  30208. total-sent="1536",total-size="9880"}
  30209. +download,{section=".text",section-sent="2048",section-size="6668",
  30210. total-sent="2048",total-size="9880"}
  30211. +download,{section=".text",section-sent="2560",section-size="6668",
  30212. total-sent="2560",total-size="9880"}
  30213. +download,{section=".text",section-sent="3072",section-size="6668",
  30214. total-sent="3072",total-size="9880"}
  30215. +download,{section=".text",section-sent="3584",section-size="6668",
  30216. total-sent="3584",total-size="9880"}
  30217. +download,{section=".text",section-sent="4096",section-size="6668",
  30218. total-sent="4096",total-size="9880"}
  30219. +download,{section=".text",section-sent="4608",section-size="6668",
  30220. total-sent="4608",total-size="9880"}
  30221. +download,{section=".text",section-sent="5120",section-size="6668",
  30222. total-sent="5120",total-size="9880"}
  30223. +download,{section=".text",section-sent="5632",section-size="6668",
  30224. total-sent="5632",total-size="9880"}
  30225. +download,{section=".text",section-sent="6144",section-size="6668",
  30226. total-sent="6144",total-size="9880"}
  30227. +download,{section=".text",section-sent="6656",section-size="6668",
  30228. total-sent="6656",total-size="9880"}
  30229. +download,{section=".init",section-size="28",total-size="9880"}
  30230. +download,{section=".fini",section-size="28",total-size="9880"}
  30231. +download,{section=".data",section-size="3156",total-size="9880"}
  30232. +download,{section=".data",section-sent="512",section-size="3156",
  30233. total-sent="7236",total-size="9880"}
  30234. +download,{section=".data",section-sent="1024",section-size="3156",
  30235. total-sent="7748",total-size="9880"}
  30236. +download,{section=".data",section-sent="1536",section-size="3156",
  30237. total-sent="8260",total-size="9880"}
  30238. +download,{section=".data",section-sent="2048",section-size="3156",
  30239. total-sent="8772",total-size="9880"}
  30240. +download,{section=".data",section-sent="2560",section-size="3156",
  30241. total-sent="9284",total-size="9880"}
  30242. +download,{section=".data",section-sent="3072",section-size="3156",
  30243. total-sent="9796",total-size="9880"}
  30244. ^done,address="0x10004",load-size="9880",transfer-rate="6586",
  30245. write-rate="429"
  30246. (gdb)
  30247. GDB Command
  30248. ...........
  30249. No equivalent.
  30250. Example
  30251. .......
  30252. N.A.
  30253. The '-target-flash-erase' Command
  30254. ---------------------------------
  30255. Synopsis
  30256. ........
  30257. -target-flash-erase
  30258. Erases all known flash memory regions on the target.
  30259. The corresponding GDB command is 'flash-erase'.
  30260. The output is a list of flash regions that have been erased, with
  30261. starting addresses and memory region sizes.
  30262. (gdb)
  30263. -target-flash-erase
  30264. ^done,erased-regions={address="0x0",size="0x40000"}
  30265. (gdb)
  30266. The '-target-select' Command
  30267. ----------------------------
  30268. Synopsis
  30269. ........
  30270. -target-select TYPE PARAMETERS ...
  30271. Connect GDB to the remote target. This command takes two args:
  30272. 'TYPE'
  30273. The type of target, for instance 'remote', etc.
  30274. 'PARAMETERS'
  30275. Device names, host names and the like. *Note Commands for Managing
  30276. Targets: Target Commands, for more details.
  30277. The output is a connection notification, followed by the address at
  30278. which the target program is, in the following form:
  30279. ^connected,addr="ADDRESS",func="FUNCTION NAME",
  30280. args=[ARG LIST]
  30281. GDB Command
  30282. ...........
  30283. The corresponding GDB command is 'target'.
  30284. Example
  30285. .......
  30286. (gdb)
  30287. -target-select remote /dev/ttya
  30288. ^connected,addr="0xfe00a300",func="??",args=[]
  30289. (gdb)
  30290. 
  30291. File: gdb.info, Node: GDB/MI File Transfer Commands, Next: GDB/MI Ada Exceptions Commands, Prev: GDB/MI Target Manipulation, Up: GDB/MI
  30292. 27.21 GDB/MI File Transfer Commands
  30293. ===================================
  30294. The '-target-file-put' Command
  30295. ------------------------------
  30296. Synopsis
  30297. ........
  30298. -target-file-put HOSTFILE TARGETFILE
  30299. Copy file HOSTFILE from the host system (the machine running GDB) to
  30300. TARGETFILE on the target system.
  30301. GDB Command
  30302. ...........
  30303. The corresponding GDB command is 'remote put'.
  30304. Example
  30305. .......
  30306. (gdb)
  30307. -target-file-put localfile remotefile
  30308. ^done
  30309. (gdb)
  30310. The '-target-file-get' Command
  30311. ------------------------------
  30312. Synopsis
  30313. ........
  30314. -target-file-get TARGETFILE HOSTFILE
  30315. Copy file TARGETFILE from the target system to HOSTFILE on the host
  30316. system.
  30317. GDB Command
  30318. ...........
  30319. The corresponding GDB command is 'remote get'.
  30320. Example
  30321. .......
  30322. (gdb)
  30323. -target-file-get remotefile localfile
  30324. ^done
  30325. (gdb)
  30326. The '-target-file-delete' Command
  30327. ---------------------------------
  30328. Synopsis
  30329. ........
  30330. -target-file-delete TARGETFILE
  30331. Delete TARGETFILE from the target system.
  30332. GDB Command
  30333. ...........
  30334. The corresponding GDB command is 'remote delete'.
  30335. Example
  30336. .......
  30337. (gdb)
  30338. -target-file-delete remotefile
  30339. ^done
  30340. (gdb)
  30341. 
  30342. File: gdb.info, Node: GDB/MI Ada Exceptions Commands, Next: GDB/MI Support Commands, Prev: GDB/MI File Transfer Commands, Up: GDB/MI
  30343. 27.22 Ada Exceptions GDB/MI Commands
  30344. ====================================
  30345. The '-info-ada-exceptions' Command
  30346. ----------------------------------
  30347. Synopsis
  30348. ........
  30349. -info-ada-exceptions [ REGEXP]
  30350. List all Ada exceptions defined within the program being debugged.
  30351. With a regular expression REGEXP, only those exceptions whose names
  30352. match REGEXP are listed.
  30353. GDB Command
  30354. ...........
  30355. The corresponding GDB command is 'info exceptions'.
  30356. Result
  30357. ......
  30358. The result is a table of Ada exceptions. The following columns are
  30359. defined for each exception:
  30360. 'name'
  30361. The name of the exception.
  30362. 'address'
  30363. The address of the exception.
  30364. Example
  30365. .......
  30366. -info-ada-exceptions aint
  30367. ^done,ada-exceptions={nr_rows="2",nr_cols="2",
  30368. hdr=[{width="1",alignment="-1",col_name="name",colhdr="Name"},
  30369. {width="1",alignment="-1",col_name="address",colhdr="Address"}],
  30370. body=[{name="constraint_error",address="0x0000000000613da0"},
  30371. {name="const.aint_global_e",address="0x0000000000613b00"}]}
  30372. Catching Ada Exceptions
  30373. -----------------------
  30374. The commands describing how to ask GDB to stop when a program raises an
  30375. exception are described at *note Ada Exception GDB/MI Catchpoint
  30376. Commands::.
  30377. 
  30378. File: gdb.info, Node: GDB/MI Support Commands, Next: GDB/MI Miscellaneous Commands, Prev: GDB/MI Ada Exceptions Commands, Up: GDB/MI
  30379. 27.23 GDB/MI Support Commands
  30380. =============================
  30381. Since new commands and features get regularly added to GDB/MI, some
  30382. commands are available to help front-ends query the debugger about
  30383. support for these capabilities. Similarly, it is also possible to query
  30384. GDB about target support of certain features.
  30385. The '-info-gdb-mi-command' Command
  30386. ----------------------------------
  30387. Synopsis
  30388. ........
  30389. -info-gdb-mi-command CMD_NAME
  30390. Query support for the GDB/MI command named CMD_NAME.
  30391. Note that the dash ('-') starting all GDB/MI commands is technically
  30392. not part of the command name (*note GDB/MI Input Syntax::), and thus
  30393. should be omitted in CMD_NAME. However, for ease of use, this command
  30394. also accepts the form with the leading dash.
  30395. GDB Command
  30396. ...........
  30397. There is no corresponding GDB command.
  30398. Result
  30399. ......
  30400. The result is a tuple. There is currently only one field:
  30401. 'exists'
  30402. This field is equal to '"true"' if the GDB/MI command exists,
  30403. '"false"' otherwise.
  30404. Example
  30405. .......
  30406. Here is an example where the GDB/MI command does not exist:
  30407. -info-gdb-mi-command unsupported-command
  30408. ^done,command={exists="false"}
  30409. And here is an example where the GDB/MI command is known to the
  30410. debugger:
  30411. -info-gdb-mi-command symbol-list-lines
  30412. ^done,command={exists="true"}
  30413. The '-list-features' Command
  30414. ----------------------------
  30415. Returns a list of particular features of the MI protocol that this
  30416. version of gdb implements. A feature can be a command, or a new field
  30417. in an output of some command, or even an important bugfix. While a
  30418. frontend can sometimes detect presence of a feature at runtime, it is
  30419. easier to perform detection at debugger startup.
  30420. The command returns a list of strings, with each string naming an
  30421. available feature. Each returned string is just a name, it does not
  30422. have any internal structure. The list of possible feature names is
  30423. given below.
  30424. Example output:
  30425. (gdb) -list-features
  30426. ^done,result=["feature1","feature2"]
  30427. The current list of features is:
  30428. 'frozen-varobjs'
  30429. Indicates support for the '-var-set-frozen' command, as well as
  30430. possible presence of the 'frozen' field in the output of
  30431. '-varobj-create'.
  30432. 'pending-breakpoints'
  30433. Indicates support for the '-f' option to the '-break-insert'
  30434. command.
  30435. 'python'
  30436. Indicates Python scripting support, Python-based pretty-printing
  30437. commands, and possible presence of the 'display_hint' field in the
  30438. output of '-var-list-children'
  30439. 'thread-info'
  30440. Indicates support for the '-thread-info' command.
  30441. 'data-read-memory-bytes'
  30442. Indicates support for the '-data-read-memory-bytes' and the
  30443. '-data-write-memory-bytes' commands.
  30444. 'breakpoint-notifications'
  30445. Indicates that changes to breakpoints and breakpoints created via
  30446. the CLI will be announced via async records.
  30447. 'ada-task-info'
  30448. Indicates support for the '-ada-task-info' command.
  30449. 'language-option'
  30450. Indicates that all GDB/MI commands accept the '--language' option
  30451. (*note Context management::).
  30452. 'info-gdb-mi-command'
  30453. Indicates support for the '-info-gdb-mi-command' command.
  30454. 'undefined-command-error-code'
  30455. Indicates support for the "undefined-command" error code in error
  30456. result records, produced when trying to execute an undefined GDB/MI
  30457. command (*note GDB/MI Result Records::).
  30458. 'exec-run-start-option'
  30459. Indicates that the '-exec-run' command supports the '--start'
  30460. option (*note GDB/MI Program Execution::).
  30461. 'data-disassemble-a-option'
  30462. Indicates that the '-data-disassemble' command supports the '-a'
  30463. option (*note GDB/MI Data Manipulation::).
  30464. The '-list-target-features' Command
  30465. -----------------------------------
  30466. Returns a list of particular features that are supported by the target.
  30467. Those features affect the permitted MI commands, but unlike the features
  30468. reported by the '-list-features' command, the features depend on which
  30469. target GDB is using at the moment. Whenever a target can change, due to
  30470. commands such as '-target-select', '-target-attach' or '-exec-run', the
  30471. list of target features may change, and the frontend should obtain it
  30472. again. Example output:
  30473. (gdb) -list-target-features
  30474. ^done,result=["async"]
  30475. The current list of features is:
  30476. 'async'
  30477. Indicates that the target is capable of asynchronous command
  30478. execution, which means that GDB will accept further commands while
  30479. the target is running.
  30480. 'reverse'
  30481. Indicates that the target is capable of reverse execution. *Note
  30482. Reverse Execution::, for more information.
  30483. 
  30484. File: gdb.info, Node: GDB/MI Miscellaneous Commands, Prev: GDB/MI Support Commands, Up: GDB/MI
  30485. 27.24 Miscellaneous GDB/MI Commands
  30486. ===================================
  30487. The '-gdb-exit' Command
  30488. -----------------------
  30489. Synopsis
  30490. ........
  30491. -gdb-exit
  30492. Exit GDB immediately.
  30493. GDB Command
  30494. ...........
  30495. Approximately corresponds to 'quit'.
  30496. Example
  30497. .......
  30498. (gdb)
  30499. -gdb-exit
  30500. ^exit
  30501. The '-gdb-set' Command
  30502. ----------------------
  30503. Synopsis
  30504. ........
  30505. -gdb-set
  30506. Set an internal GDB variable.
  30507. GDB Command
  30508. ...........
  30509. The corresponding GDB command is 'set'.
  30510. Example
  30511. .......
  30512. (gdb)
  30513. -gdb-set $foo=3
  30514. ^done
  30515. (gdb)
  30516. The '-gdb-show' Command
  30517. -----------------------
  30518. Synopsis
  30519. ........
  30520. -gdb-show
  30521. Show the current value of a GDB variable.
  30522. GDB Command
  30523. ...........
  30524. The corresponding GDB command is 'show'.
  30525. Example
  30526. .......
  30527. (gdb)
  30528. -gdb-show annotate
  30529. ^done,value="0"
  30530. (gdb)
  30531. The '-gdb-version' Command
  30532. --------------------------
  30533. Synopsis
  30534. ........
  30535. -gdb-version
  30536. Show version information for GDB. Used mostly in testing.
  30537. GDB Command
  30538. ...........
  30539. The GDB equivalent is 'show version'. GDB by default shows this
  30540. information when you start an interactive session.
  30541. Example
  30542. .......
  30543. (gdb)
  30544. -gdb-version
  30545. ~GNU gdb 5.2.1
  30546. ~Copyright 2000 Free Software Foundation, Inc.
  30547. ~GDB is free software, covered by the GNU General Public License, and
  30548. ~you are welcome to change it and/or distribute copies of it under
  30549. ~ certain conditions.
  30550. ~Type "show copying" to see the conditions.
  30551. ~There is absolutely no warranty for GDB. Type "show warranty" for
  30552. ~ details.
  30553. ~This GDB was configured as
  30554. "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
  30555. ^done
  30556. (gdb)
  30557. The '-list-thread-groups' Command
  30558. ---------------------------------
  30559. Synopsis
  30560. --------
  30561. -list-thread-groups [ --available ] [ --recurse 1 ] [ GROUP ... ]
  30562. Lists thread groups (*note Thread groups::). When a single thread
  30563. group is passed as the argument, lists the children of that group. When
  30564. several thread group are passed, lists information about those thread
  30565. groups. Without any parameters, lists information about all top-level
  30566. thread groups.
  30567. Normally, thread groups that are being debugged are reported. With
  30568. the '--available' option, GDB reports thread groups available on the
  30569. target.
  30570. The output of this command may have either a 'threads' result or a
  30571. 'groups' result. The 'thread' result has a list of tuples as value,
  30572. with each tuple describing a thread (*note GDB/MI Thread Information::).
  30573. The 'groups' result has a list of tuples as value, each tuple describing
  30574. a thread group. If top-level groups are requested (that is, no
  30575. parameter is passed), or when several groups are passed, the output
  30576. always has a 'groups' result. The format of the 'group' result is
  30577. described below.
  30578. To reduce the number of roundtrips it's possible to list thread
  30579. groups together with their children, by passing the '--recurse' option
  30580. and the recursion depth. Presently, only recursion depth of 1 is
  30581. permitted. If this option is present, then every reported thread group
  30582. will also include its children, either as 'group' or 'threads' field.
  30583. In general, any combination of option and parameters is permitted,
  30584. with the following caveats:
  30585. * When a single thread group is passed, the output will typically be
  30586. the 'threads' result. Because threads may not contain anything,
  30587. the 'recurse' option will be ignored.
  30588. * When the '--available' option is passed, limited information may be
  30589. available. In particular, the list of threads of a process might
  30590. be inaccessible. Further, specifying specific thread groups might
  30591. not give any performance advantage over listing all thread groups.
  30592. The frontend should assume that '-list-thread-groups --available'
  30593. is always an expensive operation and cache the results.
  30594. The 'groups' result is a list of tuples, where each tuple may have
  30595. the following fields:
  30596. 'id'
  30597. Identifier of the thread group. This field is always present. The
  30598. identifier is an opaque string; frontends should not try to convert
  30599. it to an integer, even though it might look like one.
  30600. 'type'
  30601. The type of the thread group. At present, only 'process' is a
  30602. valid type.
  30603. 'pid'
  30604. The target-specific process identifier. This field is only present
  30605. for thread groups of type 'process' and only if the process exists.
  30606. 'exit-code'
  30607. The exit code of this group's last exited thread, formatted in
  30608. octal. This field is only present for thread groups of type
  30609. 'process' and only if the process is not running.
  30610. 'num_children'
  30611. The number of children this thread group has. This field may be
  30612. absent for an available thread group.
  30613. 'threads'
  30614. This field has a list of tuples as value, each tuple describing a
  30615. thread. It may be present if the '--recurse' option is specified,
  30616. and it's actually possible to obtain the threads.
  30617. 'cores'
  30618. This field is a list of integers, each identifying a core that one
  30619. thread of the group is running on. This field may be absent if
  30620. such information is not available.
  30621. 'executable'
  30622. The name of the executable file that corresponds to this thread
  30623. group. The field is only present for thread groups of type
  30624. 'process', and only if there is a corresponding executable file.
  30625. Example
  30626. -------
  30627. gdb
  30628. -list-thread-groups
  30629. ^done,groups=[{id="17",type="process",pid="yyy",num_children="2"}]
  30630. -list-thread-groups 17
  30631. ^done,threads=[{id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
  30632. frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",args=[]},state="running"},
  30633. {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
  30634. frame={level="0",addr="0x0804891f",func="foo",args=[{name="i",value="10"}],
  30635. file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"},state="running"}]]
  30636. -list-thread-groups --available
  30637. ^done,groups=[{id="17",type="process",pid="yyy",num_children="2",cores=[1,2]}]
  30638. -list-thread-groups --available --recurse 1
  30639. ^done,groups=[{id="17", types="process",pid="yyy",num_children="2",cores=[1,2],
  30640. threads=[{id="1",target-id="Thread 0xb7e14b90",cores=[1]},
  30641. {id="2",target-id="Thread 0xb7e14b90",cores=[2]}]},..]
  30642. -list-thread-groups --available --recurse 1 17 18
  30643. ^done,groups=[{id="17", types="process",pid="yyy",num_children="2",cores=[1,2],
  30644. threads=[{id="1",target-id="Thread 0xb7e14b90",cores=[1]},
  30645. {id="2",target-id="Thread 0xb7e14b90",cores=[2]}]},...]
  30646. The '-info-os' Command
  30647. ----------------------
  30648. Synopsis
  30649. ........
  30650. -info-os [ TYPE ]
  30651. If no argument is supplied, the command returns a table of available
  30652. operating-system-specific information types. If one of these types is
  30653. supplied as an argument TYPE, then the command returns a table of data
  30654. of that type.
  30655. The types of information available depend on the target operating
  30656. system.
  30657. GDB Command
  30658. ...........
  30659. The corresponding GDB command is 'info os'.
  30660. Example
  30661. .......
  30662. When run on a GNU/Linux system, the output will look something like
  30663. this:
  30664. gdb
  30665. -info-os
  30666. ^done,OSDataTable={nr_rows="10",nr_cols="3",
  30667. hdr=[{width="10",alignment="-1",col_name="col0",colhdr="Type"},
  30668. {width="10",alignment="-1",col_name="col1",colhdr="Description"},
  30669. {width="10",alignment="-1",col_name="col2",colhdr="Title"}],
  30670. body=[item={col0="cpus",col1="Listing of all cpus/cores on the system",
  30671. col2="CPUs"},
  30672. item={col0="files",col1="Listing of all file descriptors",
  30673. col2="File descriptors"},
  30674. item={col0="modules",col1="Listing of all loaded kernel modules",
  30675. col2="Kernel modules"},
  30676. item={col0="msg",col1="Listing of all message queues",
  30677. col2="Message queues"},
  30678. item={col0="processes",col1="Listing of all processes",
  30679. col2="Processes"},
  30680. item={col0="procgroups",col1="Listing of all process groups",
  30681. col2="Process groups"},
  30682. item={col0="semaphores",col1="Listing of all semaphores",
  30683. col2="Semaphores"},
  30684. item={col0="shm",col1="Listing of all shared-memory regions",
  30685. col2="Shared-memory regions"},
  30686. item={col0="sockets",col1="Listing of all internet-domain sockets",
  30687. col2="Sockets"},
  30688. item={col0="threads",col1="Listing of all threads",
  30689. col2="Threads"}]
  30690. gdb
  30691. -info-os processes
  30692. ^done,OSDataTable={nr_rows="190",nr_cols="4",
  30693. hdr=[{width="10",alignment="-1",col_name="col0",colhdr="pid"},
  30694. {width="10",alignment="-1",col_name="col1",colhdr="user"},
  30695. {width="10",alignment="-1",col_name="col2",colhdr="command"},
  30696. {width="10",alignment="-1",col_name="col3",colhdr="cores"}],
  30697. body=[item={col0="1",col1="root",col2="/sbin/init",col3="0"},
  30698. item={col0="2",col1="root",col2="[kthreadd]",col3="1"},
  30699. item={col0="3",col1="root",col2="[ksoftirqd/0]",col3="0"},
  30700. ...
  30701. item={col0="26446",col1="stan",col2="bash",col3="0"},
  30702. item={col0="28152",col1="stan",col2="bash",col3="1"}]}
  30703. (gdb)
  30704. (Note that the MI output here includes a '"Title"' column that does
  30705. not appear in command-line 'info os'; this column is useful for MI
  30706. clients that want to enumerate the types of data, such as in a popup
  30707. menu, but is needless clutter on the command line, and 'info os' omits
  30708. it.)
  30709. The '-add-inferior' Command
  30710. ---------------------------
  30711. Synopsis
  30712. --------
  30713. -add-inferior
  30714. Creates a new inferior (*note Inferiors and Programs::). The created
  30715. inferior is not associated with any executable. Such association may be
  30716. established with the '-file-exec-and-symbols' command (*note GDB/MI File
  30717. Commands::). The command response has a single field, 'inferior', whose
  30718. value is the identifier of the thread group corresponding to the new
  30719. inferior.
  30720. Example
  30721. -------
  30722. gdb
  30723. -add-inferior
  30724. ^done,inferior="i3"
  30725. The '-interpreter-exec' Command
  30726. -------------------------------
  30727. Synopsis
  30728. --------
  30729. -interpreter-exec INTERPRETER COMMAND
  30730. Execute the specified COMMAND in the given INTERPRETER.
  30731. GDB Command
  30732. -----------
  30733. The corresponding GDB command is 'interpreter-exec'.
  30734. Example
  30735. -------
  30736. (gdb)
  30737. -interpreter-exec console "break main"
  30738. &"During symbol reading, couldn't parse type; debugger out of date?.\n"
  30739. &"During symbol reading, bad structure-type format.\n"
  30740. ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
  30741. ^done
  30742. (gdb)
  30743. The '-inferior-tty-set' Command
  30744. -------------------------------
  30745. Synopsis
  30746. --------
  30747. -inferior-tty-set /dev/pts/1
  30748. Set terminal for future runs of the program being debugged.
  30749. GDB Command
  30750. -----------
  30751. The corresponding GDB command is 'set inferior-tty' /dev/pts/1.
  30752. Example
  30753. -------
  30754. (gdb)
  30755. -inferior-tty-set /dev/pts/1
  30756. ^done
  30757. (gdb)
  30758. The '-inferior-tty-show' Command
  30759. --------------------------------
  30760. Synopsis
  30761. --------
  30762. -inferior-tty-show
  30763. Show terminal for future runs of program being debugged.
  30764. GDB Command
  30765. -----------
  30766. The corresponding GDB command is 'show inferior-tty'.
  30767. Example
  30768. -------
  30769. (gdb)
  30770. -inferior-tty-set /dev/pts/1
  30771. ^done
  30772. (gdb)
  30773. -inferior-tty-show
  30774. ^done,inferior_tty_terminal="/dev/pts/1"
  30775. (gdb)
  30776. The '-enable-timings' Command
  30777. -----------------------------
  30778. Synopsis
  30779. --------
  30780. -enable-timings [yes | no]
  30781. Toggle the printing of the wallclock, user and system times for an MI
  30782. command as a field in its output. This command is to help frontend
  30783. developers optimize the performance of their code. No argument is
  30784. equivalent to 'yes'.
  30785. GDB Command
  30786. -----------
  30787. No equivalent.
  30788. Example
  30789. -------
  30790. (gdb)
  30791. -enable-timings
  30792. ^done
  30793. (gdb)
  30794. -break-insert main
  30795. ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  30796. addr="0x080484ed",func="main",file="myprog.c",
  30797. fullname="/home/nickrob/myprog.c",line="73",thread-groups=["i1"],
  30798. times="0"},
  30799. time={wallclock="0.05185",user="0.00800",system="0.00000"}
  30800. (gdb)
  30801. -enable-timings no
  30802. ^done
  30803. (gdb)
  30804. -exec-run
  30805. ^running
  30806. (gdb)
  30807. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
  30808. frame={addr="0x080484ed",func="main",args=[{name="argc",value="1"},
  30809. {name="argv",value="0xbfb60364"}],file="myprog.c",
  30810. fullname="/home/nickrob/myprog.c",line="73",arch="i386:x86_64"}
  30811. (gdb)
  30812. The '-complete' Command
  30813. -----------------------
  30814. Synopsis
  30815. --------
  30816. -complete COMMAND
  30817. Show a list of completions for partially typed CLI COMMAND.
  30818. This command is intended for GDB/MI frontends that cannot use two
  30819. separate CLI and MI channels -- for example: because of lack of PTYs
  30820. like on Windows or because GDB is used remotely via a SSH connection.
  30821. Result
  30822. ------
  30823. The result consists of two or three fields:
  30824. 'completion'
  30825. This field contains the completed COMMAND. If COMMAND has no known
  30826. completions, this field is omitted.
  30827. 'matches'
  30828. This field contains a (possibly empty) array of matches. It is
  30829. always present.
  30830. 'max_completions_reached'
  30831. This field contains '1' if number of known completions is above
  30832. 'max-completions' limit (*note Completion::), otherwise it contains
  30833. '0'. It is always present.
  30834. GDB Command
  30835. -----------
  30836. The corresponding GDB command is 'complete'.
  30837. Example
  30838. -------
  30839. (gdb)
  30840. -complete br
  30841. ^done,completion="break",
  30842. matches=["break","break-range"],
  30843. max_completions_reached="0"
  30844. (gdb)
  30845. -complete "b ma"
  30846. ^done,completion="b ma",
  30847. matches=["b madvise","b main"],max_completions_reached="0"
  30848. (gdb)
  30849. -complete "b push_b"
  30850. ^done,completion="b push_back(",
  30851. matches=[
  30852. "b A::push_back(void*)",
  30853. "b std::string::push_back(char)",
  30854. "b std::vector<int, std::allocator<int> >::push_back(int&&)"],
  30855. max_completions_reached="0"
  30856. (gdb)
  30857. -complete "nonexist"
  30858. ^done,matches=[],max_completions_reached="0"
  30859. (gdb)
  30860. 
  30861. File: gdb.info, Node: Annotations, Next: JIT Interface, Prev: GDB/MI, Up: Top
  30862. 28 GDB Annotations
  30863. ******************
  30864. This chapter describes annotations in GDB. Annotations were designed to
  30865. interface GDB to graphical user interfaces or other similar programs
  30866. which want to interact with GDB at a relatively high level.
  30867. The annotation mechanism has largely been superseded by GDB/MI (*note
  30868. GDB/MI::).
  30869. * Menu:
  30870. * Annotations Overview:: What annotations are; the general syntax.
  30871. * Server Prefix:: Issuing a command without affecting user state.
  30872. * Prompting:: Annotations marking GDB's need for input.
  30873. * Errors:: Annotations for error messages.
  30874. * Invalidation:: Some annotations describe things now invalid.
  30875. * Annotations for Running::
  30876. Whether the program is running, how it stopped, etc.
  30877. * Source Annotations:: Annotations describing source code.
  30878. 
  30879. File: gdb.info, Node: Annotations Overview, Next: Server Prefix, Up: Annotations
  30880. 28.1 What is an Annotation?
  30881. ===========================
  30882. Annotations start with a newline character, two 'control-z' characters,
  30883. and the name of the annotation. If there is no additional information
  30884. associated with this annotation, the name of the annotation is followed
  30885. immediately by a newline. If there is additional information, the name
  30886. of the annotation is followed by a space, the additional information,
  30887. and a newline. The additional information cannot contain newline
  30888. characters.
  30889. Any output not beginning with a newline and two 'control-z'
  30890. characters denotes literal output from GDB. Currently there is no need
  30891. for GDB to output a newline followed by two 'control-z' characters, but
  30892. if there was such a need, the annotations could be extended with an
  30893. 'escape' annotation which means those three characters as output.
  30894. The annotation LEVEL, which is specified using the '--annotate'
  30895. command line option (*note Mode Options::), controls how much
  30896. information GDB prints together with its prompt, values of expressions,
  30897. source lines, and other types of output. Level 0 is for no annotations,
  30898. level 1 is for use when GDB is run as a subprocess of GNU Emacs, level 3
  30899. is the maximum annotation suitable for programs that control GDB, and
  30900. level 2 annotations have been made obsolete (*note Limitations of the
  30901. Annotation Interface: (annotate)Limitations.).
  30902. 'set annotate LEVEL'
  30903. The GDB command 'set annotate' sets the level of annotations to the
  30904. specified LEVEL.
  30905. 'show annotate'
  30906. Show the current annotation level.
  30907. This chapter describes level 3 annotations.
  30908. A simple example of starting up GDB with annotations is:
  30909. $ gdb --annotate=3
  30910. GNU gdb 6.0
  30911. Copyright 2003 Free Software Foundation, Inc.
  30912. GDB is free software, covered by the GNU General Public License,
  30913. and you are welcome to change it and/or distribute copies of it
  30914. under certain conditions.
  30915. Type "show copying" to see the conditions.
  30916. There is absolutely no warranty for GDB. Type "show warranty"
  30917. for details.
  30918. This GDB was configured as "i386-pc-linux-gnu"
  30919. ^Z^Zpre-prompt
  30920. (gdb)
  30921. ^Z^Zprompt
  30922. quit
  30923. ^Z^Zpost-prompt
  30924. $
  30925. Here 'quit' is input to GDB; the rest is output from GDB. The three
  30926. lines beginning '^Z^Z' (where '^Z' denotes a 'control-z' character) are
  30927. annotations; the rest is output from GDB.
  30928. 
  30929. File: gdb.info, Node: Server Prefix, Next: Prompting, Prev: Annotations Overview, Up: Annotations
  30930. 28.2 The Server Prefix
  30931. ======================
  30932. If you prefix a command with 'server ' then it will not affect the
  30933. command history, nor will it affect GDB's notion of which command to
  30934. repeat if <RET> is pressed on a line by itself. This means that
  30935. commands can be run behind a user's back by a front-end in a transparent
  30936. manner.
  30937. The 'server ' prefix does not affect the recording of values into the
  30938. value history; to print a value without recording it into the value
  30939. history, use the 'output' command instead of the 'print' command.
  30940. Using this prefix also disables confirmation requests (*note
  30941. confirmation requests::).
  30942. 
  30943. File: gdb.info, Node: Prompting, Next: Errors, Prev: Server Prefix, Up: Annotations
  30944. 28.3 Annotation for GDB Input
  30945. =============================
  30946. When GDB prompts for input, it annotates this fact so it is possible to
  30947. know when to send output, when the output from a given command is over,
  30948. etc.
  30949. Different kinds of input each have a different "input type". Each
  30950. input type has three annotations: a 'pre-' annotation, which denotes the
  30951. beginning of any prompt which is being output, a plain annotation, which
  30952. denotes the end of the prompt, and then a 'post-' annotation which
  30953. denotes the end of any echo which may (or may not) be associated with
  30954. the input. For example, the 'prompt' input type features the following
  30955. annotations:
  30956. ^Z^Zpre-prompt
  30957. ^Z^Zprompt
  30958. ^Z^Zpost-prompt
  30959. The input types are
  30960. 'prompt'
  30961. When GDB is prompting for a command (the main GDB prompt).
  30962. 'commands'
  30963. When GDB prompts for a set of commands, like in the 'commands'
  30964. command. The annotations are repeated for each command which is
  30965. input.
  30966. 'overload-choice'
  30967. When GDB wants the user to select between various overloaded
  30968. functions.
  30969. 'query'
  30970. When GDB wants the user to confirm a potentially dangerous
  30971. operation.
  30972. 'prompt-for-continue'
  30973. When GDB is asking the user to press return to continue. Note:
  30974. Don't expect this to work well; instead use 'set height 0' to
  30975. disable prompting. This is because the counting of lines is buggy
  30976. in the presence of annotations.
  30977. 
  30978. File: gdb.info, Node: Errors, Next: Invalidation, Prev: Prompting, Up: Annotations
  30979. 28.4 Errors
  30980. ===========
  30981. ^Z^Zquit
  30982. This annotation occurs right before GDB responds to an interrupt.
  30983. ^Z^Zerror
  30984. This annotation occurs right before GDB responds to an error.
  30985. Quit and error annotations indicate that any annotations which GDB
  30986. was in the middle of may end abruptly. For example, if a
  30987. 'value-history-begin' annotation is followed by a 'error', one cannot
  30988. expect to receive the matching 'value-history-end'. One cannot expect
  30989. not to receive it either, however; an error annotation does not
  30990. necessarily mean that GDB is immediately returning all the way to the
  30991. top level.
  30992. A quit or error annotation may be preceded by
  30993. ^Z^Zerror-begin
  30994. Any output between that and the quit or error annotation is the error
  30995. message.
  30996. Warning messages are not yet annotated.
  30997. 
  30998. File: gdb.info, Node: Invalidation, Next: Annotations for Running, Prev: Errors, Up: Annotations
  30999. 28.5 Invalidation Notices
  31000. =========================
  31001. The following annotations say that certain pieces of state may have
  31002. changed.
  31003. '^Z^Zframes-invalid'
  31004. The frames (for example, output from the 'backtrace' command) may
  31005. have changed.
  31006. '^Z^Zbreakpoints-invalid'
  31007. The breakpoints may have changed. For example, the user just added
  31008. or deleted a breakpoint.
  31009. 
  31010. File: gdb.info, Node: Annotations for Running, Next: Source Annotations, Prev: Invalidation, Up: Annotations
  31011. 28.6 Running the Program
  31012. ========================
  31013. When the program starts executing due to a GDB command such as 'step' or
  31014. 'continue',
  31015. ^Z^Zstarting
  31016. is output. When the program stops,
  31017. ^Z^Zstopped
  31018. is output. Before the 'stopped' annotation, a variety of annotations
  31019. describe how the program stopped.
  31020. '^Z^Zexited EXIT-STATUS'
  31021. The program exited, and EXIT-STATUS is the exit status (zero for
  31022. successful exit, otherwise nonzero).
  31023. '^Z^Zsignalled'
  31024. The program exited with a signal. After the '^Z^Zsignalled', the
  31025. annotation continues:
  31026. INTRO-TEXT
  31027. ^Z^Zsignal-name
  31028. NAME
  31029. ^Z^Zsignal-name-end
  31030. MIDDLE-TEXT
  31031. ^Z^Zsignal-string
  31032. STRING
  31033. ^Z^Zsignal-string-end
  31034. END-TEXT
  31035. where NAME is the name of the signal, such as 'SIGILL' or
  31036. 'SIGSEGV', and STRING is the explanation of the signal, such as
  31037. 'Illegal Instruction' or 'Segmentation fault'. The arguments
  31038. INTRO-TEXT, MIDDLE-TEXT, and END-TEXT are for the user's benefit
  31039. and have no particular format.
  31040. '^Z^Zsignal'
  31041. The syntax of this annotation is just like 'signalled', but GDB is
  31042. just saying that the program received the signal, not that it was
  31043. terminated with it.
  31044. '^Z^Zbreakpoint NUMBER'
  31045. The program hit breakpoint number NUMBER.
  31046. '^Z^Zwatchpoint NUMBER'
  31047. The program hit watchpoint number NUMBER.
  31048. 
  31049. File: gdb.info, Node: Source Annotations, Prev: Annotations for Running, Up: Annotations
  31050. 28.7 Displaying Source
  31051. ======================
  31052. The following annotation is used instead of displaying source code:
  31053. ^Z^Zsource FILENAME:LINE:CHARACTER:MIDDLE:ADDR
  31054. where FILENAME is an absolute file name indicating which source file,
  31055. LINE is the line number within that file (where 1 is the first line in
  31056. the file), CHARACTER is the character position within the file (where 0
  31057. is the first character in the file) (for most debug formats this will
  31058. necessarily point to the beginning of a line), MIDDLE is 'middle' if
  31059. ADDR is in the middle of the line, or 'beg' if ADDR is at the beginning
  31060. of the line, and ADDR is the address in the target program associated
  31061. with the source which is being displayed. The ADDR is in the form '0x'
  31062. followed by one or more lowercase hex digits (note that this does not
  31063. depend on the language).
  31064. 
  31065. File: gdb.info, Node: JIT Interface, Next: In-Process Agent, Prev: Annotations, Up: Top
  31066. 29 JIT Compilation Interface
  31067. ****************************
  31068. This chapter documents GDB's "just-in-time" (JIT) compilation interface.
  31069. A JIT compiler is a program or library that generates native executable
  31070. code at runtime and executes it, usually in order to achieve good
  31071. performance while maintaining platform independence.
  31072. Programs that use JIT compilation are normally difficult to debug
  31073. because portions of their code are generated at runtime, instead of
  31074. being loaded from object files, which is where GDB normally finds the
  31075. program's symbols and debug information. In order to debug programs
  31076. that use JIT compilation, GDB has an interface that allows the program
  31077. to register in-memory symbol files with GDB at runtime.
  31078. If you are using GDB to debug a program that uses this interface,
  31079. then it should work transparently so long as you have not stripped the
  31080. binary. If you are developing a JIT compiler, then the interface is
  31081. documented in the rest of this chapter. At this time, the only known
  31082. client of this interface is the LLVM JIT.
  31083. Broadly speaking, the JIT interface mirrors the dynamic loader
  31084. interface. The JIT compiler communicates with GDB by writing data into
  31085. a global variable and calling a function at a well-known symbol. When
  31086. GDB attaches, it reads a linked list of symbol files from the global
  31087. variable to find existing code, and puts a breakpoint in the function so
  31088. that it can find out about additional code.
  31089. * Menu:
  31090. * Declarations:: Relevant C struct declarations
  31091. * Registering Code:: Steps to register code
  31092. * Unregistering Code:: Steps to unregister code
  31093. * Custom Debug Info:: Emit debug information in a custom format
  31094. 
  31095. File: gdb.info, Node: Declarations, Next: Registering Code, Up: JIT Interface
  31096. 29.1 JIT Declarations
  31097. =====================
  31098. These are the relevant struct declarations that a C program should
  31099. include to implement the interface:
  31100. typedef enum
  31101. {
  31102. JIT_NOACTION = 0,
  31103. JIT_REGISTER_FN,
  31104. JIT_UNREGISTER_FN
  31105. } jit_actions_t;
  31106. struct jit_code_entry
  31107. {
  31108. struct jit_code_entry *next_entry;
  31109. struct jit_code_entry *prev_entry;
  31110. const char *symfile_addr;
  31111. uint64_t symfile_size;
  31112. };
  31113. struct jit_descriptor
  31114. {
  31115. uint32_t version;
  31116. /* This type should be jit_actions_t, but we use uint32_t
  31117. to be explicit about the bitwidth. */
  31118. uint32_t action_flag;
  31119. struct jit_code_entry *relevant_entry;
  31120. struct jit_code_entry *first_entry;
  31121. };
  31122. /* GDB puts a breakpoint in this function. */
  31123. void __attribute__((noinline)) __jit_debug_register_code() { };
  31124. /* Make sure to specify the version statically, because the
  31125. debugger may check the version before we can set it. */
  31126. struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
  31127. If the JIT is multi-threaded, then it is important that the JIT
  31128. synchronize any modifications to this global data properly, which can
  31129. easily be done by putting a global mutex around modifications to these
  31130. structures.
  31131. 
  31132. File: gdb.info, Node: Registering Code, Next: Unregistering Code, Prev: Declarations, Up: JIT Interface
  31133. 29.2 Registering Code
  31134. =====================
  31135. To register code with GDB, the JIT should follow this protocol:
  31136. * Generate an object file in memory with symbols and other desired
  31137. debug information. The file must include the virtual addresses of
  31138. the sections.
  31139. * Create a code entry for the file, which gives the start and size of
  31140. the symbol file.
  31141. * Add it to the linked list in the JIT descriptor.
  31142. * Point the relevant_entry field of the descriptor at the entry.
  31143. * Set 'action_flag' to 'JIT_REGISTER' and call
  31144. '__jit_debug_register_code'.
  31145. When GDB is attached and the breakpoint fires, GDB uses the
  31146. 'relevant_entry' pointer so it doesn't have to walk the list looking for
  31147. new code. However, the linked list must still be maintained in order to
  31148. allow GDB to attach to a running process and still find the symbol
  31149. files.
  31150. 
  31151. File: gdb.info, Node: Unregistering Code, Next: Custom Debug Info, Prev: Registering Code, Up: JIT Interface
  31152. 29.3 Unregistering Code
  31153. =======================
  31154. If code is freed, then the JIT should use the following protocol:
  31155. * Remove the code entry corresponding to the code from the linked
  31156. list.
  31157. * Point the 'relevant_entry' field of the descriptor at the code
  31158. entry.
  31159. * Set 'action_flag' to 'JIT_UNREGISTER' and call
  31160. '__jit_debug_register_code'.
  31161. If the JIT frees or recompiles code without unregistering it, then
  31162. GDB and the JIT will leak the memory used for the associated symbol
  31163. files.
  31164. 
  31165. File: gdb.info, Node: Custom Debug Info, Prev: Unregistering Code, Up: JIT Interface
  31166. 29.4 Custom Debug Info
  31167. ======================
  31168. Generating debug information in platform-native file formats (like ELF
  31169. or COFF) may be an overkill for JIT compilers; especially if all the
  31170. debug info is used for is displaying a meaningful backtrace. The issue
  31171. can be resolved by having the JIT writers decide on a debug info format
  31172. and also provide a reader that parses the debug info generated by the
  31173. JIT compiler. This section gives a brief overview on writing such a
  31174. parser. More specific details can be found in the source file
  31175. 'gdb/jit-reader.in', which is also installed as a header at
  31176. 'INCLUDEDIR/gdb/jit-reader.h' for easy inclusion.
  31177. The reader is implemented as a shared object (so this functionality
  31178. is not available on platforms which don't allow loading shared objects
  31179. at runtime). Two GDB commands, 'jit-reader-load' and
  31180. 'jit-reader-unload' are provided, to be used to load and unload the
  31181. readers from a preconfigured directory. Once loaded, the shared object
  31182. is used the parse the debug information emitted by the JIT compiler.
  31183. * Menu:
  31184. * Using JIT Debug Info Readers:: How to use supplied readers correctly
  31185. * Writing JIT Debug Info Readers:: Creating a debug-info reader
  31186. 
  31187. File: gdb.info, Node: Using JIT Debug Info Readers, Next: Writing JIT Debug Info Readers, Up: Custom Debug Info
  31188. 29.4.1 Using JIT Debug Info Readers
  31189. -----------------------------------
  31190. Readers can be loaded and unloaded using the 'jit-reader-load' and
  31191. 'jit-reader-unload' commands.
  31192. 'jit-reader-load READER'
  31193. Load the JIT reader named READER, which is a shared object
  31194. specified as either an absolute or a relative file name. In the
  31195. latter case, GDB will try to load the reader from a pre-configured
  31196. directory, usually 'LIBDIR/gdb/' on a UNIX system (here LIBDIR is
  31197. the system library directory, often '/usr/local/lib').
  31198. Only one reader can be active at a time; trying to load a second
  31199. reader when one is already loaded will result in GDB reporting an
  31200. error. A new JIT reader can be loaded by first unloading the
  31201. current one using 'jit-reader-unload' and then invoking
  31202. 'jit-reader-load'.
  31203. 'jit-reader-unload'
  31204. Unload the currently loaded JIT reader.
  31205. 
  31206. File: gdb.info, Node: Writing JIT Debug Info Readers, Prev: Using JIT Debug Info Readers, Up: Custom Debug Info
  31207. 29.4.2 Writing JIT Debug Info Readers
  31208. -------------------------------------
  31209. As mentioned, a reader is essentially a shared object conforming to a
  31210. certain ABI. This ABI is described in 'jit-reader.h'.
  31211. 'jit-reader.h' defines the structures, macros and functions required
  31212. to write a reader. It is installed (along with GDB), in
  31213. 'INCLUDEDIR/gdb' where INCLUDEDIR is the system include directory.
  31214. Readers need to be released under a GPL compatible license. A reader
  31215. can be declared as released under such a license by placing the macro
  31216. 'GDB_DECLARE_GPL_COMPATIBLE_READER' in a source file.
  31217. The entry point for readers is the symbol 'gdb_init_reader', which is
  31218. expected to be a function with the prototype
  31219. extern struct gdb_reader_funcs *gdb_init_reader (void);
  31220. 'struct gdb_reader_funcs' contains a set of pointers to callback
  31221. functions. These functions are executed to read the debug info
  31222. generated by the JIT compiler ('read'), to unwind stack frames
  31223. ('unwind') and to create canonical frame IDs ('get_frame_id'). It also
  31224. has a callback that is called when the reader is being unloaded
  31225. ('destroy'). The struct looks like this
  31226. struct gdb_reader_funcs
  31227. {
  31228. /* Must be set to GDB_READER_INTERFACE_VERSION. */
  31229. int reader_version;
  31230. /* For use by the reader. */
  31231. void *priv_data;
  31232. gdb_read_debug_info *read;
  31233. gdb_unwind_frame *unwind;
  31234. gdb_get_frame_id *get_frame_id;
  31235. gdb_destroy_reader *destroy;
  31236. };
  31237. The callbacks are provided with another set of callbacks by GDB to do
  31238. their job. For 'read', these callbacks are passed in a 'struct
  31239. gdb_symbol_callbacks' and for 'unwind' and 'get_frame_id', in a 'struct
  31240. gdb_unwind_callbacks'. 'struct gdb_symbol_callbacks' has callbacks to
  31241. create new object files and new symbol tables inside those object files.
  31242. 'struct gdb_unwind_callbacks' has callbacks to read registers off the
  31243. current frame and to write out the values of the registers in the
  31244. previous frame. Both have a callback ('target_read') to read bytes off
  31245. the target's address space.
  31246. 
  31247. File: gdb.info, Node: In-Process Agent, Next: GDB Bugs, Prev: JIT Interface, Up: Top
  31248. 30 In-Process Agent
  31249. *******************
  31250. The traditional debugging model is conceptually low-speed, but works
  31251. fine, because most bugs can be reproduced in debugging-mode execution.
  31252. However, as multi-core or many-core processors are becoming mainstream,
  31253. and multi-threaded programs become more and more popular, there should
  31254. be more and more bugs that only manifest themselves at normal-mode
  31255. execution, for example, thread races, because debugger's interference
  31256. with the program's timing may conceal the bugs. On the other hand, in
  31257. some applications, it is not feasible for the debugger to interrupt the
  31258. program's execution long enough for the developer to learn anything
  31259. helpful about its behavior. If the program's correctness depends on its
  31260. real-time behavior, delays introduced by a debugger might cause the
  31261. program to fail, even when the code itself is correct. It is useful to
  31262. be able to observe the program's behavior without interrupting it.
  31263. Therefore, traditional debugging model is too intrusive to reproduce
  31264. some bugs. In order to reduce the interference with the program, we can
  31265. reduce the number of operations performed by debugger. The "In-Process
  31266. Agent", a shared library, is running within the same process with
  31267. inferior, and is able to perform some debugging operations itself. As a
  31268. result, debugger is only involved when necessary, and performance of
  31269. debugging can be improved accordingly. Note that interference with
  31270. program can be reduced but can't be removed completely, because the
  31271. in-process agent will still stop or slow down the program.
  31272. The in-process agent can interpret and execute Agent Expressions
  31273. (*note Agent Expressions::) during performing debugging operations. The
  31274. agent expressions can be used for different purposes, such as collecting
  31275. data in tracepoints, and condition evaluation in breakpoints.
  31276. You can control whether the in-process agent is used as an aid for
  31277. debugging with the following commands:
  31278. 'set agent on'
  31279. Causes the in-process agent to perform some operations on behalf of
  31280. the debugger. Just which operations requested by the user will be
  31281. done by the in-process agent depends on the its capabilities. For
  31282. example, if you request to evaluate breakpoint conditions in the
  31283. in-process agent, and the in-process agent has such capability as
  31284. well, then breakpoint conditions will be evaluated in the
  31285. in-process agent.
  31286. 'set agent off'
  31287. Disables execution of debugging operations by the in-process agent.
  31288. All of the operations will be performed by GDB.
  31289. 'show agent'
  31290. Display the current setting of execution of debugging operations by
  31291. the in-process agent.
  31292. * Menu:
  31293. * In-Process Agent Protocol::
  31294. 
  31295. File: gdb.info, Node: In-Process Agent Protocol, Up: In-Process Agent
  31296. 30.1 In-Process Agent Protocol
  31297. ==============================
  31298. The in-process agent is able to communicate with both GDB and GDBserver
  31299. (*note In-Process Agent::). This section documents the protocol used
  31300. for communications between GDB or GDBserver and the IPA. In general, GDB
  31301. or GDBserver sends commands (*note IPA Protocol Commands::) and data to
  31302. in-process agent, and then in-process agent replies back with the return
  31303. result of the command, or some other information. The data sent to
  31304. in-process agent is composed of primitive data types, such as 4-byte or
  31305. 8-byte type, and composite types, which are called objects (*note IPA
  31306. Protocol Objects::).
  31307. * Menu:
  31308. * IPA Protocol Objects::
  31309. * IPA Protocol Commands::
  31310. 
  31311. File: gdb.info, Node: IPA Protocol Objects, Next: IPA Protocol Commands, Up: In-Process Agent Protocol
  31312. 30.1.1 IPA Protocol Objects
  31313. ---------------------------
  31314. The commands sent to and results received from agent may contain some
  31315. complex data types called "objects".
  31316. The in-process agent is running on the same machine with GDB or
  31317. GDBserver, so it doesn't have to handle as much differences between two
  31318. ends as remote protocol (*note Remote Protocol::) tries to handle.
  31319. However, there are still some differences of two ends in two processes:
  31320. 1. word size. On some 64-bit machines, GDB or GDBserver can be
  31321. compiled as a 64-bit executable, while in-process agent is a 32-bit
  31322. one.
  31323. 2. ABI. Some machines may have multiple types of ABI, GDB or GDBserver
  31324. is compiled with one, and in-process agent is compiled with the
  31325. other one.
  31326. Here are the IPA Protocol Objects:
  31327. 1. agent expression object. It represents an agent expression (*note
  31328. Agent Expressions::).
  31329. 2. tracepoint action object. It represents a tracepoint action (*note
  31330. Tracepoint Action Lists: Tracepoint Actions.) to collect registers,
  31331. memory, static trace data and to evaluate expression.
  31332. 3. tracepoint object. It represents a tracepoint (*note
  31333. Tracepoints::).
  31334. The following table describes important attributes of each IPA
  31335. protocol object:
  31336. Name Size Description
  31337. ---------------------------------------------------------------------------
  31338. _agent expression
  31339. object_
  31340. length 4 length of bytes code
  31341. byte code LENGTH contents of byte code
  31342. _tracepoint action
  31343. for collecting
  31344. memory_
  31345. 'M' 1 type of tracepoint action
  31346. addr 8 if BASEREG is '-1', ADDR is the
  31347. address of the lowest byte to
  31348. collect, otherwise ADDR is the
  31349. offset of BASEREG for memory
  31350. collecting.
  31351. len 8 length of memory for collecting
  31352. basereg 4 the register number containing the
  31353. starting memory address for
  31354. collecting.
  31355. _tracepoint action
  31356. for collecting
  31357. registers_
  31358. 'R' 1 type of tracepoint action
  31359. _tracepoint action
  31360. for collecting
  31361. static trace data_
  31362. 'L' 1 type of tracepoint action
  31363. _tracepoint action
  31364. for expression
  31365. evaluation_
  31366. 'X' 1 type of tracepoint action
  31367. agent expression length of *note agent expression object::
  31368. _tracepoint object_
  31369. number 4 number of tracepoint
  31370. address 8 address of tracepoint inserted on
  31371. type 4 type of tracepoint
  31372. enabled 1 enable or disable of tracepoint
  31373. step_count 8 step
  31374. pass_count 8 pass
  31375. numactions 4 number of tracepoint actions
  31376. hit count 8 hit count
  31377. trace frame usage 8 trace frame usage
  31378. compiled_cond 8 compiled condition
  31379. orig_size 8 orig size
  31380. condition 4 if zero if condition is NULL,
  31381. condition is otherwise is
  31382. NULL *note agent expression object::
  31383. otherwise
  31384. length of
  31385. *note agent expression object::
  31386. actions variable numactions number of
  31387. *note tracepoint action object::
  31388. 
  31389. File: gdb.info, Node: IPA Protocol Commands, Prev: IPA Protocol Objects, Up: In-Process Agent Protocol
  31390. 30.1.2 IPA Protocol Commands
  31391. ----------------------------
  31392. The spaces in each command are delimiters to ease reading this commands
  31393. specification. They don't exist in real commands.
  31394. 'FastTrace:TRACEPOINT_OBJECT GDB_JUMP_PAD_HEAD'
  31395. Installs a new fast tracepoint described by TRACEPOINT_OBJECT
  31396. (*note tracepoint object::). The GDB_JUMP_PAD_HEAD, 8-byte long,
  31397. is the head of "jumppad", which is used to jump to data collection
  31398. routine in IPA finally.
  31399. Replies:
  31400. 'OK TARGET_ADDRESS GDB_JUMP_PAD_HEAD FJUMP_SIZE FJUMP'
  31401. TARGET_ADDRESS is address of tracepoint in the inferior. The
  31402. GDB_JUMP_PAD_HEAD is updated head of jumppad. Both of
  31403. TARGET_ADDRESS and GDB_JUMP_PAD_HEAD are 8-byte long. The
  31404. FJUMP contains a sequence of instructions jump to jumppad
  31405. entry. The FJUMP_SIZE, 4-byte long, is the size of FJUMP.
  31406. 'E NN'
  31407. for an error
  31408. 'close'
  31409. Closes the in-process agent. This command is sent when GDB or
  31410. GDBserver is about to kill inferiors.
  31411. 'qTfSTM'
  31412. *Note qTfSTM::.
  31413. 'qTsSTM'
  31414. *Note qTsSTM::.
  31415. 'qTSTMat'
  31416. *Note qTSTMat::.
  31417. 'probe_marker_at:ADDRESS'
  31418. Asks in-process agent to probe the marker at ADDRESS.
  31419. Replies:
  31420. 'E NN'
  31421. for an error
  31422. 'unprobe_marker_at:ADDRESS'
  31423. Asks in-process agent to unprobe the marker at ADDRESS.
  31424. 
  31425. File: gdb.info, Node: GDB Bugs, Next: Command Line Editing, Prev: In-Process Agent, Up: Top
  31426. 31 Reporting Bugs in GDB
  31427. ************************
  31428. Your bug reports play an essential role in making GDB reliable.
  31429. Reporting a bug may help you by bringing a solution to your problem,
  31430. or it may not. But in any case the principal function of a bug report
  31431. is to help the entire community by making the next version of GDB work
  31432. better. Bug reports are your contribution to the maintenance of GDB.
  31433. In order for a bug report to serve its purpose, you must include the
  31434. information that enables us to fix the bug.
  31435. * Menu:
  31436. * Bug Criteria:: Have you found a bug?
  31437. * Bug Reporting:: How to report bugs
  31438. 
  31439. File: gdb.info, Node: Bug Criteria, Next: Bug Reporting, Up: GDB Bugs
  31440. 31.1 Have You Found a Bug?
  31441. ==========================
  31442. If you are not sure whether you have found a bug, here are some
  31443. guidelines:
  31444. * If the debugger gets a fatal signal, for any input whatever, that
  31445. is a GDB bug. Reliable debuggers never crash.
  31446. * If GDB produces an error message for valid input, that is a bug.
  31447. (Note that if you're cross debugging, the problem may also be
  31448. somewhere in the connection to the target.)
  31449. * If GDB does not produce an error message for invalid input, that is
  31450. a bug. However, you should note that your idea of "invalid input"
  31451. might be our idea of "an extension" or "support for traditional
  31452. practice".
  31453. * If you are an experienced user of debugging tools, your suggestions
  31454. for improvement of GDB are welcome in any case.
  31455. 
  31456. File: gdb.info, Node: Bug Reporting, Prev: Bug Criteria, Up: GDB Bugs
  31457. 31.2 How to Report Bugs
  31458. =======================
  31459. A number of companies and individuals offer support for GNU products.
  31460. If you obtained GDB from a support organization, we recommend you
  31461. contact that organization first.
  31462. You can find contact information for many support companies and
  31463. individuals in the file 'etc/SERVICE' in the GNU Emacs distribution.
  31464. In any event, we also recommend that you submit bug reports for GDB.
  31465. The preferred method is to submit them directly using GDB's Bugs web
  31466. page (http://www.gnu.org/software/gdb/bugs/). Alternatively, the e-mail
  31467. gateway <bug-gdb@gnu.org> can be used.
  31468. *Do not send bug reports to 'info-gdb', or to 'help-gdb', or to any
  31469. newsgroups.* Most users of GDB do not want to receive bug reports.
  31470. Those that do have arranged to receive 'bug-gdb'.
  31471. The mailing list 'bug-gdb' has a newsgroup 'gnu.gdb.bug' which serves
  31472. as a repeater. The mailing list and the newsgroup carry exactly the
  31473. same messages. Often people think of posting bug reports to the
  31474. newsgroup instead of mailing them. This appears to work, but it has one
  31475. problem which can be crucial: a newsgroup posting often lacks a mail
  31476. path back to the sender. Thus, if we need to ask for more information,
  31477. we may be unable to reach you. For this reason, it is better to send
  31478. bug reports to the mailing list.
  31479. The fundamental principle of reporting bugs usefully is this: *report
  31480. all the facts*. If you are not sure whether to state a fact or leave it
  31481. out, state it!
  31482. Often people omit facts because they think they know what causes the
  31483. problem and assume that some details do not matter. Thus, you might
  31484. assume that the name of the variable you use in an example does not
  31485. matter. Well, probably it does not, but one cannot be sure. Perhaps
  31486. the bug is a stray memory reference which happens to fetch from the
  31487. location where that name is stored in memory; perhaps, if the name were
  31488. different, the contents of that location would fool the debugger into
  31489. doing the right thing despite the bug. Play it safe and give a
  31490. specific, complete example. That is the easiest thing for you to do,
  31491. and the most helpful.
  31492. Keep in mind that the purpose of a bug report is to enable us to fix
  31493. the bug. It may be that the bug has been reported previously, but
  31494. neither you nor we can know that unless your bug report is complete and
  31495. self-contained.
  31496. Sometimes people give a few sketchy facts and ask, "Does this ring a
  31497. bell?" Those bug reports are useless, and we urge everyone to _refuse
  31498. to respond to them_ except to chide the sender to report bugs properly.
  31499. To enable us to fix the bug, you should include all these things:
  31500. * The version of GDB. GDB announces it if you start with no
  31501. arguments; you can also print it at any time using 'show version'.
  31502. Without this, we will not know whether there is any point in
  31503. looking for the bug in the current version of GDB.
  31504. * The type of machine you are using, and the operating system name
  31505. and version number.
  31506. * The details of the GDB build-time configuration. GDB shows these
  31507. details if you invoke it with the '--configuration' command-line
  31508. option, or if you type 'show configuration' at GDB's prompt.
  31509. * What compiler (and its version) was used to compile GDB--e.g.
  31510. "gcc-2.8.1".
  31511. * What compiler (and its version) was used to compile the program you
  31512. are debugging--e.g. "gcc-2.8.1", or "HP92453-01 A.10.32.03 HP C
  31513. Compiler". For GCC, you can say 'gcc --version' to get this
  31514. information; for other compilers, see the documentation for those
  31515. compilers.
  31516. * The command arguments you gave the compiler to compile your example
  31517. and observe the bug. For example, did you use '-O'? To guarantee
  31518. you will not omit something important, list them all. A copy of
  31519. the Makefile (or the output from make) is sufficient.
  31520. If we were to try to guess the arguments, we would probably guess
  31521. wrong and then we might not encounter the bug.
  31522. * A complete input script, and all necessary source files, that will
  31523. reproduce the bug.
  31524. * A description of what behavior you observe that you believe is
  31525. incorrect. For example, "It gets a fatal signal."
  31526. Of course, if the bug is that GDB gets a fatal signal, then we will
  31527. certainly notice it. But if the bug is incorrect output, we might
  31528. not notice unless it is glaringly wrong. You might as well not
  31529. give us a chance to make a mistake.
  31530. Even if the problem you experience is a fatal signal, you should
  31531. still say so explicitly. Suppose something strange is going on,
  31532. such as, your copy of GDB is out of synch, or you have encountered
  31533. a bug in the C library on your system. (This has happened!) Your
  31534. copy might crash and ours would not. If you told us to expect a
  31535. crash, then when ours fails to crash, we would know that the bug
  31536. was not happening for us. If you had not told us to expect a
  31537. crash, then we would not be able to draw any conclusion from our
  31538. observations.
  31539. To collect all this information, you can use a session recording
  31540. program such as 'script', which is available on many Unix systems.
  31541. Just run your GDB session inside 'script' and then include the
  31542. 'typescript' file with your bug report.
  31543. Another way to record a GDB session is to run GDB inside Emacs and
  31544. then save the entire buffer to a file.
  31545. * If you wish to suggest changes to the GDB source, send us context
  31546. diffs. If you even discuss something in the GDB source, refer to
  31547. it by context, not by line number.
  31548. The line numbers in our development sources will not match those in
  31549. your sources. Your line numbers would convey no useful information
  31550. to us.
  31551. Here are some things that are not necessary:
  31552. * A description of the envelope of the bug.
  31553. Often people who encounter a bug spend a lot of time investigating
  31554. which changes to the input file will make the bug go away and which
  31555. changes will not affect it.
  31556. This is often time consuming and not very useful, because the way
  31557. we will find the bug is by running a single example under the
  31558. debugger with breakpoints, not by pure deduction from a series of
  31559. examples. We recommend that you save your time for something else.
  31560. Of course, if you can find a simpler example to report _instead_ of
  31561. the original one, that is a convenience for us. Errors in the
  31562. output will be easier to spot, running under the debugger will take
  31563. less time, and so on.
  31564. However, simplification is not vital; if you do not want to do
  31565. this, report the bug anyway and send us the entire test case you
  31566. used.
  31567. * A patch for the bug.
  31568. A patch for the bug does help us if it is a good one. But do not
  31569. omit the necessary information, such as the test case, on the
  31570. assumption that a patch is all we need. We might see problems with
  31571. your patch and decide to fix the problem another way, or we might
  31572. not understand it at all.
  31573. Sometimes with a program as complicated as GDB it is very hard to
  31574. construct an example that will make the program follow a certain
  31575. path through the code. If you do not send us the example, we will
  31576. not be able to construct one, so we will not be able to verify that
  31577. the bug is fixed.
  31578. And if we cannot understand what bug you are trying to fix, or why
  31579. your patch should be an improvement, we will not install it. A
  31580. test case will help us to understand.
  31581. * A guess about what the bug is or what it depends on.
  31582. Such guesses are usually wrong. Even we cannot guess right about
  31583. such things without first using the debugger to find the facts.
  31584. 
  31585. File: gdb.info, Node: Command Line Editing, Next: Using History Interactively, Prev: GDB Bugs, Up: Top
  31586. 32 Command Line Editing
  31587. ***********************
  31588. This chapter describes the basic features of the GNU command line
  31589. editing interface.
  31590. * Menu:
  31591. * Introduction and Notation:: Notation used in this text.
  31592. * Readline Interaction:: The minimum set of commands for editing a line.
  31593. * Readline Init File:: Customizing Readline from a user's view.
  31594. * Bindable Readline Commands:: A description of most of the Readline commands
  31595. available for binding
  31596. * Readline vi Mode:: A short description of how to make Readline
  31597. behave like the vi editor.
  31598. 
  31599. File: gdb.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
  31600. 32.1 Introduction to Line Editing
  31601. =================================
  31602. The following paragraphs describe the notation used to represent
  31603. keystrokes.
  31604. The text 'C-k' is read as 'Control-K' and describes the character
  31605. produced when the <k> key is pressed while the Control key is depressed.
  31606. The text 'M-k' is read as 'Meta-K' and describes the character
  31607. produced when the Meta key (if you have one) is depressed, and the <k>
  31608. key is pressed. The Meta key is labeled <ALT> on many keyboards. On
  31609. keyboards with two keys labeled <ALT> (usually to either side of the
  31610. space bar), the <ALT> on the left side is generally set to work as a
  31611. Meta key. The <ALT> key on the right may also be configured to work as
  31612. a Meta key or may be configured as some other modifier, such as a
  31613. Compose key for typing accented characters.
  31614. If you do not have a Meta or <ALT> key, or another key working as a
  31615. Meta key, the identical keystroke can be generated by typing <ESC>
  31616. _first_, and then typing <k>. Either process is known as "metafying"
  31617. the <k> key.
  31618. The text 'M-C-k' is read as 'Meta-Control-k' and describes the
  31619. character produced by "metafying" 'C-k'.
  31620. In addition, several keys have their own names. Specifically, <DEL>,
  31621. <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves when seen
  31622. in this text, or in an init file (*note Readline Init File::). If your
  31623. keyboard lacks a <LFD> key, typing <C-j> will produce the desired
  31624. character. The <RET> key may be labeled <Return> or <Enter> on some
  31625. keyboards.
  31626. 
  31627. File: gdb.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
  31628. 32.2 Readline Interaction
  31629. =========================
  31630. Often during an interactive session you type in a long line of text,
  31631. only to notice that the first word on the line is misspelled. The
  31632. Readline library gives you a set of commands for manipulating the text
  31633. as you type it in, allowing you to just fix your typo, and not forcing
  31634. you to retype the majority of the line. Using these editing commands,
  31635. you move the cursor to the place that needs correction, and delete or
  31636. insert the text of the corrections. Then, when you are satisfied with
  31637. the line, you simply press <RET>. You do not have to be at the end of
  31638. the line to press <RET>; the entire line is accepted regardless of the
  31639. location of the cursor within the line.
  31640. * Menu:
  31641. * Readline Bare Essentials:: The least you need to know about Readline.
  31642. * Readline Movement Commands:: Moving about the input line.
  31643. * Readline Killing Commands:: How to delete text, and how to get it back!
  31644. * Readline Arguments:: Giving numeric arguments to commands.
  31645. * Searching:: Searching through previous lines.
  31646. 
  31647. File: gdb.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
  31648. 32.2.1 Readline Bare Essentials
  31649. -------------------------------
  31650. In order to enter characters into the line, simply type them. The typed
  31651. character appears where the cursor was, and then the cursor moves one
  31652. space to the right. If you mistype a character, you can use your erase
  31653. character to back up and delete the mistyped character.
  31654. Sometimes you may mistype a character, and not notice the error until
  31655. you have typed several other characters. In that case, you can type
  31656. 'C-b' to move the cursor to the left, and then correct your mistake.
  31657. Afterwards, you can move the cursor to the right with 'C-f'.
  31658. When you add text in the middle of a line, you will notice that
  31659. characters to the right of the cursor are 'pushed over' to make room for
  31660. the text that you have inserted. Likewise, when you delete text behind
  31661. the cursor, characters to the right of the cursor are 'pulled back' to
  31662. fill in the blank space created by the removal of the text. A list of
  31663. the bare essentials for editing the text of an input line follows.
  31664. 'C-b'
  31665. Move back one character.
  31666. 'C-f'
  31667. Move forward one character.
  31668. <DEL> or <Backspace>
  31669. Delete the character to the left of the cursor.
  31670. 'C-d'
  31671. Delete the character underneath the cursor.
  31672. Printing characters
  31673. Insert the character into the line at the cursor.
  31674. 'C-_' or 'C-x C-u'
  31675. Undo the last editing command. You can undo all the way back to an
  31676. empty line.
  31677. (Depending on your configuration, the <Backspace> key be set to delete
  31678. the character to the left of the cursor and the <DEL> key set to delete
  31679. the character underneath the cursor, like 'C-d', rather than the
  31680. character to the left of the cursor.)
  31681. 
  31682. File: gdb.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
  31683. 32.2.2 Readline Movement Commands
  31684. ---------------------------------
  31685. The above table describes the most basic keystrokes that you need in
  31686. order to do editing of the input line. For your convenience, many other
  31687. commands have been added in addition to 'C-b', 'C-f', 'C-d', and <DEL>.
  31688. Here are some commands for moving more rapidly about the line.
  31689. 'C-a'
  31690. Move to the start of the line.
  31691. 'C-e'
  31692. Move to the end of the line.
  31693. 'M-f'
  31694. Move forward a word, where a word is composed of letters and
  31695. digits.
  31696. 'M-b'
  31697. Move backward a word.
  31698. 'C-l'
  31699. Clear the screen, reprinting the current line at the top.
  31700. Notice how 'C-f' moves forward a character, while 'M-f' moves forward
  31701. a word. It is a loose convention that control keystrokes operate on
  31702. characters while meta keystrokes operate on words.
  31703. 
  31704. File: gdb.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
  31705. 32.2.3 Readline Killing Commands
  31706. --------------------------------
  31707. "Killing" text means to delete the text from the line, but to save it
  31708. away for later use, usually by "yanking" (re-inserting) it back into the
  31709. line. ('Cut' and 'paste' are more recent jargon for 'kill' and 'yank'.)
  31710. If the description for a command says that it 'kills' text, then you
  31711. can be sure that you can get the text back in a different (or the same)
  31712. place later.
  31713. When you use a kill command, the text is saved in a "kill-ring". Any
  31714. number of consecutive kills save all of the killed text together, so
  31715. that when you yank it back, you get it all. The kill ring is not line
  31716. specific; the text that you killed on a previously typed line is
  31717. available to be yanked back later, when you are typing another line.
  31718. Here is the list of commands for killing text.
  31719. 'C-k'
  31720. Kill the text from the current cursor position to the end of the
  31721. line.
  31722. 'M-d'
  31723. Kill from the cursor to the end of the current word, or, if between
  31724. words, to the end of the next word. Word boundaries are the same
  31725. as those used by 'M-f'.
  31726. 'M-<DEL>'
  31727. Kill from the cursor the start of the current word, or, if between
  31728. words, to the start of the previous word. Word boundaries are the
  31729. same as those used by 'M-b'.
  31730. 'C-w'
  31731. Kill from the cursor to the previous whitespace. This is different
  31732. than 'M-<DEL>' because the word boundaries differ.
  31733. Here is how to "yank" the text back into the line. Yanking means to
  31734. copy the most-recently-killed text from the kill buffer.
  31735. 'C-y'
  31736. Yank the most recently killed text back into the buffer at the
  31737. cursor.
  31738. 'M-y'
  31739. Rotate the kill-ring, and yank the new top. You can only do this
  31740. if the prior command is 'C-y' or 'M-y'.
  31741. 
  31742. File: gdb.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction
  31743. 32.2.4 Readline Arguments
  31744. -------------------------
  31745. You can pass numeric arguments to Readline commands. Sometimes the
  31746. argument acts as a repeat count, other times it is the sign of the
  31747. argument that is significant. If you pass a negative argument to a
  31748. command which normally acts in a forward direction, that command will
  31749. act in a backward direction. For example, to kill text back to the
  31750. start of the line, you might type 'M-- C-k'.
  31751. The general way to pass numeric arguments to a command is to type
  31752. meta digits before the command. If the first 'digit' typed is a minus
  31753. sign ('-'), then the sign of the argument will be negative. Once you
  31754. have typed one meta digit to get the argument started, you can type the
  31755. remainder of the digits, and then the command. For example, to give the
  31756. 'C-d' command an argument of 10, you could type 'M-1 0 C-d', which will
  31757. delete the next ten characters on the input line.
  31758. 
  31759. File: gdb.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction
  31760. 32.2.5 Searching for Commands in the History
  31761. --------------------------------------------
  31762. Readline provides commands for searching through the command history for
  31763. lines containing a specified string. There are two search modes:
  31764. "incremental" and "non-incremental".
  31765. Incremental searches begin before the user has finished typing the
  31766. search string. As each character of the search string is typed,
  31767. Readline displays the next entry from the history matching the string
  31768. typed so far. An incremental search requires only as many characters as
  31769. needed to find the desired history entry. To search backward in the
  31770. history for a particular string, type 'C-r'. Typing 'C-s' searches
  31771. forward through the history. The characters present in the value of the
  31772. 'isearch-terminators' variable are used to terminate an incremental
  31773. search. If that variable has not been assigned a value, the <ESC> and
  31774. 'C-J' characters will terminate an incremental search. 'C-g' will abort
  31775. an incremental search and restore the original line. When the search is
  31776. terminated, the history entry containing the search string becomes the
  31777. current line.
  31778. To find other matching entries in the history list, type 'C-r' or
  31779. 'C-s' as appropriate. This will search backward or forward in the
  31780. history for the next entry matching the search string typed so far. Any
  31781. other key sequence bound to a Readline command will terminate the search
  31782. and execute that command. For instance, a <RET> will terminate the
  31783. search and accept the line, thereby executing the command from the
  31784. history list. A movement command will terminate the search, make the
  31785. last line found the current line, and begin editing.
  31786. Readline remembers the last incremental search string. If two 'C-r's
  31787. are typed without any intervening characters defining a new search
  31788. string, any remembered search string is used.
  31789. Non-incremental searches read the entire search string before
  31790. starting to search for matching history lines. The search string may be
  31791. typed by the user or be part of the contents of the current line.
  31792. 
  31793. File: gdb.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
  31794. 32.3 Readline Init File
  31795. =======================
  31796. Although the Readline library comes with a set of Emacs-like keybindings
  31797. installed by default, it is possible to use a different set of
  31798. keybindings. Any user can customize programs that use Readline by
  31799. putting commands in an "inputrc" file, conventionally in his home
  31800. directory. The name of this file is taken from the value of the
  31801. environment variable 'INPUTRC'. If that variable is unset, the default
  31802. is '~/.inputrc'. If that file does not exist or cannot be read, the
  31803. ultimate default is '/etc/inputrc'.
  31804. When a program which uses the Readline library starts up, the init
  31805. file is read, and the key bindings are set.
  31806. In addition, the 'C-x C-r' command re-reads this init file, thus
  31807. incorporating any changes that you might have made to it.
  31808. * Menu:
  31809. * Readline Init File Syntax:: Syntax for the commands in the inputrc file.
  31810. * Conditional Init Constructs:: Conditional key bindings in the inputrc file.
  31811. * Sample Init File:: An example inputrc file.
  31812. 
  31813. File: gdb.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File
  31814. 32.3.1 Readline Init File Syntax
  31815. --------------------------------
  31816. There are only a few basic constructs allowed in the Readline init file.
  31817. Blank lines are ignored. Lines beginning with a '#' are comments.
  31818. Lines beginning with a '$' indicate conditional constructs (*note
  31819. Conditional Init Constructs::). Other lines denote variable settings
  31820. and key bindings.
  31821. Variable Settings
  31822. You can modify the run-time behavior of Readline by altering the
  31823. values of variables in Readline using the 'set' command within the
  31824. init file. The syntax is simple:
  31825. set VARIABLE VALUE
  31826. Here, for example, is how to change from the default Emacs-like key
  31827. binding to use 'vi' line editing commands:
  31828. set editing-mode vi
  31829. Variable names and values, where appropriate, are recognized
  31830. without regard to case. Unrecognized variable names are ignored.
  31831. Boolean variables (those that can be set to on or off) are set to
  31832. on if the value is null or empty, ON (case-insensitive), or 1. Any
  31833. other value results in the variable being set to off.
  31834. A great deal of run-time behavior is changeable with the following
  31835. variables.
  31836. 'bell-style'
  31837. Controls what happens when Readline wants to ring the terminal
  31838. bell. If set to 'none', Readline never rings the bell. If
  31839. set to 'visible', Readline uses a visible bell if one is
  31840. available. If set to 'audible' (the default), Readline
  31841. attempts to ring the terminal's bell.
  31842. 'bind-tty-special-chars'
  31843. If set to 'on' (the default), Readline attempts to bind the
  31844. control characters treated specially by the kernel's terminal
  31845. driver to their Readline equivalents.
  31846. 'blink-matching-paren'
  31847. If set to 'on', Readline attempts to briefly move the cursor
  31848. to an opening parenthesis when a closing parenthesis is
  31849. inserted. The default is 'off'.
  31850. 'colored-completion-prefix'
  31851. If set to 'on', when listing completions, Readline displays
  31852. the common prefix of the set of possible completions using a
  31853. different color. The color definitions are taken from the
  31854. value of the 'LS_COLORS' environment variable. The default is
  31855. 'off'.
  31856. 'colored-stats'
  31857. If set to 'on', Readline displays possible completions using
  31858. different colors to indicate their file type. The color
  31859. definitions are taken from the value of the 'LS_COLORS'
  31860. environment variable. The default is 'off'.
  31861. 'comment-begin'
  31862. The string to insert at the beginning of the line when the
  31863. 'insert-comment' command is executed. The default value is
  31864. '"#"'.
  31865. 'completion-display-width'
  31866. The number of screen columns used to display possible matches
  31867. when performing completion. The value is ignored if it is
  31868. less than 0 or greater than the terminal screen width. A
  31869. value of 0 will cause matches to be displayed one per line.
  31870. The default value is -1.
  31871. 'completion-ignore-case'
  31872. If set to 'on', Readline performs filename matching and
  31873. completion in a case-insensitive fashion. The default value
  31874. is 'off'.
  31875. 'completion-map-case'
  31876. If set to 'on', and COMPLETION-IGNORE-CASE is enabled,
  31877. Readline treats hyphens ('-') and underscores ('_') as
  31878. equivalent when performing case-insensitive filename matching
  31879. and completion. The default value is 'off'.
  31880. 'completion-prefix-display-length'
  31881. The length in characters of the common prefix of a list of
  31882. possible completions that is displayed without modification.
  31883. When set to a value greater than zero, common prefixes longer
  31884. than this value are replaced with an ellipsis when displaying
  31885. possible completions.
  31886. 'completion-query-items'
  31887. The number of possible completions that determines when the
  31888. user is asked whether the list of possibilities should be
  31889. displayed. If the number of possible completions is greater
  31890. than this value, Readline will ask the user whether or not he
  31891. wishes to view them; otherwise, they are simply listed. This
  31892. variable must be set to an integer value greater than or equal
  31893. to 0. A negative value means Readline should never ask. The
  31894. default limit is '100'.
  31895. 'convert-meta'
  31896. If set to 'on', Readline will convert characters with the
  31897. eighth bit set to an ASCII key sequence by stripping the
  31898. eighth bit and prefixing an <ESC> character, converting them
  31899. to a meta-prefixed key sequence. The default value is 'on',
  31900. but will be set to 'off' if the locale is one that contains
  31901. eight-bit characters.
  31902. 'disable-completion'
  31903. If set to 'On', Readline will inhibit word completion.
  31904. Completion characters will be inserted into the line as if
  31905. they had been mapped to 'self-insert'. The default is 'off'.
  31906. 'echo-control-characters'
  31907. When set to 'on', on operating systems that indicate they
  31908. support it, readline echoes a character corresponding to a
  31909. signal generated from the keyboard. The default is 'on'.
  31910. 'editing-mode'
  31911. The 'editing-mode' variable controls which default set of key
  31912. bindings is used. By default, Readline starts up in Emacs
  31913. editing mode, where the keystrokes are most similar to Emacs.
  31914. This variable can be set to either 'emacs' or 'vi'.
  31915. 'emacs-mode-string'
  31916. If the SHOW-MODE-IN-PROMPT variable is enabled, this string is
  31917. displayed immediately before the last line of the primary
  31918. prompt when emacs editing mode is active. The value is
  31919. expanded like a key binding, so the standard set of meta- and
  31920. control prefixes and backslash escape sequences is available.
  31921. Use the '\1' and '\2' escapes to begin and end sequences of
  31922. non-printing characters, which can be used to embed a terminal
  31923. control sequence into the mode string. The default is '@'.
  31924. 'enable-bracketed-paste'
  31925. When set to 'On', Readline will configure the terminal in a
  31926. way that will enable it to insert each paste into the editing
  31927. buffer as a single string of characters, instead of treating
  31928. each character as if it had been read from the keyboard. This
  31929. can prevent pasted characters from being interpreted as
  31930. editing commands. The default is 'off'.
  31931. 'enable-keypad'
  31932. When set to 'on', Readline will try to enable the application
  31933. keypad when it is called. Some systems need this to enable
  31934. the arrow keys. The default is 'off'.
  31935. 'enable-meta-key'
  31936. When set to 'on', Readline will try to enable any meta
  31937. modifier key the terminal claims to support when it is called.
  31938. On many terminals, the meta key is used to send eight-bit
  31939. characters. The default is 'on'.
  31940. 'expand-tilde'
  31941. If set to 'on', tilde expansion is performed when Readline
  31942. attempts word completion. The default is 'off'.
  31943. 'history-preserve-point'
  31944. If set to 'on', the history code attempts to place the point
  31945. (the current cursor position) at the same location on each
  31946. history line retrieved with 'previous-history' or
  31947. 'next-history'. The default is 'off'.
  31948. 'history-size'
  31949. Set the maximum number of history entries saved in the history
  31950. list. If set to zero, any existing history entries are
  31951. deleted and no new entries are saved. If set to a value less
  31952. than zero, the number of history entries is not limited. By
  31953. default, the number of history entries is not limited. If an
  31954. attempt is made to set HISTORY-SIZE to a non-numeric value,
  31955. the maximum number of history entries will be set to 500.
  31956. 'horizontal-scroll-mode'
  31957. This variable can be set to either 'on' or 'off'. Setting it
  31958. to 'on' means that the text of the lines being edited will
  31959. scroll horizontally on a single screen line when they are
  31960. longer than the width of the screen, instead of wrapping onto
  31961. a new screen line. By default, this variable is set to 'off'.
  31962. 'input-meta'
  31963. If set to 'on', Readline will enable eight-bit input (it will
  31964. not clear the eighth bit in the characters it reads),
  31965. regardless of what the terminal claims it can support. The
  31966. default value is 'off', but Readline will set it to 'on' if
  31967. the locale contains eight-bit characters. The name
  31968. 'meta-flag' is a synonym for this variable.
  31969. 'isearch-terminators'
  31970. The string of characters that should terminate an incremental
  31971. search without subsequently executing the character as a
  31972. command (*note Searching::). If this variable has not been
  31973. given a value, the characters <ESC> and 'C-J' will terminate
  31974. an incremental search.
  31975. 'keymap'
  31976. Sets Readline's idea of the current keymap for key binding
  31977. commands. Built-in 'keymap' names are 'emacs',
  31978. 'emacs-standard', 'emacs-meta', 'emacs-ctlx', 'vi', 'vi-move',
  31979. 'vi-command', and 'vi-insert'. 'vi' is equivalent to
  31980. 'vi-command' ('vi-move' is also a synonym); 'emacs' is
  31981. equivalent to 'emacs-standard'. Applications may add
  31982. additional names. The default value is 'emacs'. The value of
  31983. the 'editing-mode' variable also affects the default keymap.
  31984. 'keyseq-timeout'
  31985. Specifies the duration Readline will wait for a character when
  31986. reading an ambiguous key sequence (one that can form a
  31987. complete key sequence using the input read so far, or can take
  31988. additional input to complete a longer key sequence). If no
  31989. input is received within the timeout, Readline will use the
  31990. shorter but complete key sequence. Readline uses this value
  31991. to determine whether or not input is available on the current
  31992. input source ('rl_instream' by default). The value is
  31993. specified in milliseconds, so a value of 1000 means that
  31994. Readline will wait one second for additional input. If this
  31995. variable is set to a value less than or equal to zero, or to a
  31996. non-numeric value, Readline will wait until another key is
  31997. pressed to decide which key sequence to complete. The default
  31998. value is '500'.
  31999. 'mark-directories'
  32000. If set to 'on', completed directory names have a slash
  32001. appended. The default is 'on'.
  32002. 'mark-modified-lines'
  32003. This variable, when set to 'on', causes Readline to display an
  32004. asterisk ('*') at the start of history lines which have been
  32005. modified. This variable is 'off' by default.
  32006. 'mark-symlinked-directories'
  32007. If set to 'on', completed names which are symbolic links to
  32008. directories have a slash appended (subject to the value of
  32009. 'mark-directories'). The default is 'off'.
  32010. 'match-hidden-files'
  32011. This variable, when set to 'on', causes Readline to match
  32012. files whose names begin with a '.' (hidden files) when
  32013. performing filename completion. If set to 'off', the leading
  32014. '.' must be supplied by the user in the filename to be
  32015. completed. This variable is 'on' by default.
  32016. 'menu-complete-display-prefix'
  32017. If set to 'on', menu completion displays the common prefix of
  32018. the list of possible completions (which may be empty) before
  32019. cycling through the list. The default is 'off'.
  32020. 'output-meta'
  32021. If set to 'on', Readline will display characters with the
  32022. eighth bit set directly rather than as a meta-prefixed escape
  32023. sequence. The default is 'off', but Readline will set it to
  32024. 'on' if the locale contains eight-bit characters.
  32025. 'page-completions'
  32026. If set to 'on', Readline uses an internal 'more'-like pager to
  32027. display a screenful of possible completions at a time. This
  32028. variable is 'on' by default.
  32029. 'print-completions-horizontally'
  32030. If set to 'on', Readline will display completions with matches
  32031. sorted horizontally in alphabetical order, rather than down
  32032. the screen. The default is 'off'.
  32033. 'revert-all-at-newline'
  32034. If set to 'on', Readline will undo all changes to history
  32035. lines before returning when 'accept-line' is executed. By
  32036. default, history lines may be modified and retain individual
  32037. undo lists across calls to 'readline'. The default is 'off'.
  32038. 'show-all-if-ambiguous'
  32039. This alters the default behavior of the completion functions.
  32040. If set to 'on', words which have more than one possible
  32041. completion cause the matches to be listed immediately instead
  32042. of ringing the bell. The default value is 'off'.
  32043. 'show-all-if-unmodified'
  32044. This alters the default behavior of the completion functions
  32045. in a fashion similar to SHOW-ALL-IF-AMBIGUOUS. If set to
  32046. 'on', words which have more than one possible completion
  32047. without any possible partial completion (the possible
  32048. completions don't share a common prefix) cause the matches to
  32049. be listed immediately instead of ringing the bell. The
  32050. default value is 'off'.
  32051. 'show-mode-in-prompt'
  32052. If set to 'on', add a string to the beginning of the prompt
  32053. indicating the editing mode: emacs, vi command, or vi
  32054. insertion. The mode strings are user-settable (e.g.,
  32055. EMACS-MODE-STRING). The default value is 'off'.
  32056. 'skip-completed-text'
  32057. If set to 'on', this alters the default completion behavior
  32058. when inserting a single match into the line. It's only active
  32059. when performing completion in the middle of a word. If
  32060. enabled, readline does not insert characters from the
  32061. completion that match characters after point in the word being
  32062. completed, so portions of the word following the cursor are
  32063. not duplicated. For instance, if this is enabled, attempting
  32064. completion when the cursor is after the 'e' in 'Makefile' will
  32065. result in 'Makefile' rather than 'Makefilefile', assuming
  32066. there is a single possible completion. The default value is
  32067. 'off'.
  32068. 'vi-cmd-mode-string'
  32069. If the SHOW-MODE-IN-PROMPT variable is enabled, this string is
  32070. displayed immediately before the last line of the primary
  32071. prompt when vi editing mode is active and in command mode.
  32072. The value is expanded like a key binding, so the standard set
  32073. of meta- and control prefixes and backslash escape sequences
  32074. is available. Use the '\1' and '\2' escapes to begin and end
  32075. sequences of non-printing characters, which can be used to
  32076. embed a terminal control sequence into the mode string. The
  32077. default is '(cmd)'.
  32078. 'vi-ins-mode-string'
  32079. If the SHOW-MODE-IN-PROMPT variable is enabled, this string is
  32080. displayed immediately before the last line of the primary
  32081. prompt when vi editing mode is active and in insertion mode.
  32082. The value is expanded like a key binding, so the standard set
  32083. of meta- and control prefixes and backslash escape sequences
  32084. is available. Use the '\1' and '\2' escapes to begin and end
  32085. sequences of non-printing characters, which can be used to
  32086. embed a terminal control sequence into the mode string. The
  32087. default is '(ins)'.
  32088. 'visible-stats'
  32089. If set to 'on', a character denoting a file's type is appended
  32090. to the filename when listing possible completions. The
  32091. default is 'off'.
  32092. Key Bindings
  32093. The syntax for controlling key bindings in the init file is simple.
  32094. First you need to find the name of the command that you want to
  32095. change. The following sections contain tables of the command name,
  32096. the default keybinding, if any, and a short description of what the
  32097. command does.
  32098. Once you know the name of the command, simply place on a line in
  32099. the init file the name of the key you wish to bind the command to,
  32100. a colon, and then the name of the command. There can be no space
  32101. between the key name and the colon - that will be interpreted as
  32102. part of the key name. The name of the key can be expressed in
  32103. different ways, depending on what you find most comfortable.
  32104. In addition to command names, readline allows keys to be bound to a
  32105. string that is inserted when the key is pressed (a MACRO).
  32106. KEYNAME: FUNCTION-NAME or MACRO
  32107. KEYNAME is the name of a key spelled out in English. For
  32108. example:
  32109. Control-u: universal-argument
  32110. Meta-Rubout: backward-kill-word
  32111. Control-o: "> output"
  32112. In the example above, 'C-u' is bound to the function
  32113. 'universal-argument', 'M-DEL' is bound to the function
  32114. 'backward-kill-word', and 'C-o' is bound to run the macro
  32115. expressed on the right hand side (that is, to insert the text
  32116. '> output' into the line).
  32117. A number of symbolic character names are recognized while
  32118. processing this key binding syntax: DEL, ESC, ESCAPE, LFD,
  32119. NEWLINE, RET, RETURN, RUBOUT, SPACE, SPC, and TAB.
  32120. "KEYSEQ": FUNCTION-NAME or MACRO
  32121. KEYSEQ differs from KEYNAME above in that strings denoting an
  32122. entire key sequence can be specified, by placing the key
  32123. sequence in double quotes. Some GNU Emacs style key escapes
  32124. can be used, as in the following example, but the special
  32125. character names are not recognized.
  32126. "\C-u": universal-argument
  32127. "\C-x\C-r": re-read-init-file
  32128. "\e[11~": "Function Key 1"
  32129. In the above example, 'C-u' is again bound to the function
  32130. 'universal-argument' (just as it was in the first example),
  32131. ''C-x' 'C-r'' is bound to the function 're-read-init-file',
  32132. and '<ESC> <[> <1> <1> <~>' is bound to insert the text
  32133. 'Function Key 1'.
  32134. The following GNU Emacs style escape sequences are available when
  32135. specifying key sequences:
  32136. '\C-'
  32137. control prefix
  32138. '\M-'
  32139. meta prefix
  32140. '\e'
  32141. an escape character
  32142. '\\'
  32143. backslash
  32144. '\"'
  32145. <">, a double quotation mark
  32146. '\''
  32147. <'>, a single quote or apostrophe
  32148. In addition to the GNU Emacs style escape sequences, a second set
  32149. of backslash escapes is available:
  32150. '\a'
  32151. alert (bell)
  32152. '\b'
  32153. backspace
  32154. '\d'
  32155. delete
  32156. '\f'
  32157. form feed
  32158. '\n'
  32159. newline
  32160. '\r'
  32161. carriage return
  32162. '\t'
  32163. horizontal tab
  32164. '\v'
  32165. vertical tab
  32166. '\NNN'
  32167. the eight-bit character whose value is the octal value NNN
  32168. (one to three digits)
  32169. '\xHH'
  32170. the eight-bit character whose value is the hexadecimal value
  32171. HH (one or two hex digits)
  32172. When entering the text of a macro, single or double quotes must be
  32173. used to indicate a macro definition. Unquoted text is assumed to
  32174. be a function name. In the macro body, the backslash escapes
  32175. described above are expanded. Backslash will quote any other
  32176. character in the macro text, including '"' and '''. For example,
  32177. the following binding will make ''C-x' \' insert a single '\' into
  32178. the line:
  32179. "\C-x\\": "\\"
  32180. 
  32181. File: gdb.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File
  32182. 32.3.2 Conditional Init Constructs
  32183. ----------------------------------
  32184. Readline implements a facility similar in spirit to the conditional
  32185. compilation features of the C preprocessor which allows key bindings and
  32186. variable settings to be performed as the result of tests. There are
  32187. four parser directives used.
  32188. '$if'
  32189. The '$if' construct allows bindings to be made based on the editing
  32190. mode, the terminal being used, or the application using Readline.
  32191. The text of the test, after any comparison operator, extends to the
  32192. end of the line; unless otherwise noted, no characters are required
  32193. to isolate it.
  32194. 'mode'
  32195. The 'mode=' form of the '$if' directive is used to test
  32196. whether Readline is in 'emacs' or 'vi' mode. This may be used
  32197. in conjunction with the 'set keymap' command, for instance, to
  32198. set bindings in the 'emacs-standard' and 'emacs-ctlx' keymaps
  32199. only if Readline is starting out in 'emacs' mode.
  32200. 'term'
  32201. The 'term=' form may be used to include terminal-specific key
  32202. bindings, perhaps to bind the key sequences output by the
  32203. terminal's function keys. The word on the right side of the
  32204. '=' is tested against both the full name of the terminal and
  32205. the portion of the terminal name before the first '-'. This
  32206. allows 'sun' to match both 'sun' and 'sun-cmd', for instance.
  32207. 'version'
  32208. The 'version' test may be used to perform comparisons against
  32209. specific Readline versions. The 'version' expands to the
  32210. current Readline version. The set of comparison operators
  32211. includes '=' (and '=='), '!=', '<=', '>=', '<', and '>'. The
  32212. version number supplied on the right side of the operator
  32213. consists of a major version number, an optional decimal point,
  32214. and an optional minor version (e.g., '7.1'). If the minor
  32215. version is omitted, it is assumed to be '0'. The operator may
  32216. be separated from the string 'version' and from the version
  32217. number argument by whitespace. The following example sets a
  32218. variable if the Readline version being used is 7.0 or newer:
  32219. $if version >= 7.0
  32220. set show-mode-in-prompt on
  32221. $endif
  32222. 'application'
  32223. The APPLICATION construct is used to include
  32224. application-specific settings. Each program using the
  32225. Readline library sets the APPLICATION NAME, and you can test
  32226. for a particular value. This could be used to bind key
  32227. sequences to functions useful for a specific program. For
  32228. instance, the following command adds a key sequence that
  32229. quotes the current or previous word in Bash:
  32230. $if Bash
  32231. # Quote the current or previous word
  32232. "\C-xq": "\eb\"\ef\""
  32233. $endif
  32234. 'variable'
  32235. The VARIABLE construct provides simple equality tests for
  32236. Readline variables and values. The permitted comparison
  32237. operators are '=', '==', and '!='. The variable name must be
  32238. separated from the comparison operator by whitespace; the
  32239. operator may be separated from the value on the right hand
  32240. side by whitespace. Both string and boolean variables may be
  32241. tested. Boolean variables must be tested against the values
  32242. ON and OFF. The following example is equivalent to the
  32243. 'mode=emacs' test described above:
  32244. $if editing-mode == emacs
  32245. set show-mode-in-prompt on
  32246. $endif
  32247. '$endif'
  32248. This command, as seen in the previous example, terminates an '$if'
  32249. command.
  32250. '$else'
  32251. Commands in this branch of the '$if' directive are executed if the
  32252. test fails.
  32253. '$include'
  32254. This directive takes a single filename as an argument and reads
  32255. commands and bindings from that file. For example, the following
  32256. directive reads from '/etc/inputrc':
  32257. $include /etc/inputrc
  32258. 
  32259. File: gdb.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File
  32260. 32.3.3 Sample Init File
  32261. -----------------------
  32262. Here is an example of an INPUTRC file. This illustrates key binding,
  32263. variable assignment, and conditional syntax.
  32264. # This file controls the behaviour of line input editing for
  32265. # programs that use the GNU Readline library. Existing
  32266. # programs include FTP, Bash, and GDB.
  32267. #
  32268. # You can re-read the inputrc file with C-x C-r.
  32269. # Lines beginning with '#' are comments.
  32270. #
  32271. # First, include any system-wide bindings and variable
  32272. # assignments from /etc/Inputrc
  32273. $include /etc/Inputrc
  32274. #
  32275. # Set various bindings for emacs mode.
  32276. set editing-mode emacs
  32277. $if mode=emacs
  32278. Meta-Control-h: backward-kill-word Text after the function name is ignored
  32279. #
  32280. # Arrow keys in keypad mode
  32281. #
  32282. #"\M-OD": backward-char
  32283. #"\M-OC": forward-char
  32284. #"\M-OA": previous-history
  32285. #"\M-OB": next-history
  32286. #
  32287. # Arrow keys in ANSI mode
  32288. #
  32289. "\M-[D": backward-char
  32290. "\M-[C": forward-char
  32291. "\M-[A": previous-history
  32292. "\M-[B": next-history
  32293. #
  32294. # Arrow keys in 8 bit keypad mode
  32295. #
  32296. #"\M-\C-OD": backward-char
  32297. #"\M-\C-OC": forward-char
  32298. #"\M-\C-OA": previous-history
  32299. #"\M-\C-OB": next-history
  32300. #
  32301. # Arrow keys in 8 bit ANSI mode
  32302. #
  32303. #"\M-\C-[D": backward-char
  32304. #"\M-\C-[C": forward-char
  32305. #"\M-\C-[A": previous-history
  32306. #"\M-\C-[B": next-history
  32307. C-q: quoted-insert
  32308. $endif
  32309. # An old-style binding. This happens to be the default.
  32310. TAB: complete
  32311. # Macros that are convenient for shell interaction
  32312. $if Bash
  32313. # edit the path
  32314. "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
  32315. # prepare to type a quoted word --
  32316. # insert open and close double quotes
  32317. # and move to just after the open quote
  32318. "\C-x\"": "\"\"\C-b"
  32319. # insert a backslash (testing backslash escapes
  32320. # in sequences and macros)
  32321. "\C-x\\": "\\"
  32322. # Quote the current or previous word
  32323. "\C-xq": "\eb\"\ef\""
  32324. # Add a binding to refresh the line, which is unbound
  32325. "\C-xr": redraw-current-line
  32326. # Edit variable on current line.
  32327. "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
  32328. $endif
  32329. # use a visible bell if one is available
  32330. set bell-style visible
  32331. # don't strip characters to 7 bits when reading
  32332. set input-meta on
  32333. # allow iso-latin1 characters to be inserted rather
  32334. # than converted to prefix-meta sequences
  32335. set convert-meta off
  32336. # display characters with the eighth bit set directly
  32337. # rather than as meta-prefixed characters
  32338. set output-meta on
  32339. # if there are more than 150 possible completions for
  32340. # a word, ask the user if he wants to see all of them
  32341. set completion-query-items 150
  32342. # For FTP
  32343. $if Ftp
  32344. "\C-xg": "get \M-?"
  32345. "\C-xt": "put \M-?"
  32346. "\M-.": yank-last-arg
  32347. $endif
  32348. 
  32349. File: gdb.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing
  32350. 32.4 Bindable Readline Commands
  32351. ===============================
  32352. * Menu:
  32353. * Commands For Moving:: Moving about the line.
  32354. * Commands For History:: Getting at previous lines.
  32355. * Commands For Text:: Commands for changing text.
  32356. * Commands For Killing:: Commands for killing and yanking.
  32357. * Numeric Arguments:: Specifying numeric arguments, repeat counts.
  32358. * Commands For Completion:: Getting Readline to do the typing for you.
  32359. * Keyboard Macros:: Saving and re-executing typed characters
  32360. * Miscellaneous Commands:: Other miscellaneous commands.
  32361. This section describes Readline commands that may be bound to key
  32362. sequences. Command names without an accompanying key sequence are
  32363. unbound by default.
  32364. In the following descriptions, "point" refers to the current cursor
  32365. position, and "mark" refers to a cursor position saved by the 'set-mark'
  32366. command. The text between the point and mark is referred to as the
  32367. "region".
  32368. 
  32369. File: gdb.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
  32370. 32.4.1 Commands For Moving
  32371. --------------------------
  32372. 'beginning-of-line (C-a)'
  32373. Move to the start of the current line.
  32374. 'end-of-line (C-e)'
  32375. Move to the end of the line.
  32376. 'forward-char (C-f)'
  32377. Move forward a character.
  32378. 'backward-char (C-b)'
  32379. Move back a character.
  32380. 'forward-word (M-f)'
  32381. Move forward to the end of the next word. Words are composed of
  32382. letters and digits.
  32383. 'backward-word (M-b)'
  32384. Move back to the start of the current or previous word. Words are
  32385. composed of letters and digits.
  32386. 'previous-screen-line ()'
  32387. Attempt to move point to the same physical screen column on the
  32388. previous physical screen line. This will not have the desired
  32389. effect if the current Readline line does not take up more than one
  32390. physical line or if point is not greater than the length of the
  32391. prompt plus the screen width.
  32392. 'next-screen-line ()'
  32393. Attempt to move point to the same physical screen column on the
  32394. next physical screen line. This will not have the desired effect
  32395. if the current Readline line does not take up more than one
  32396. physical line or if the length of the current Readline line is not
  32397. greater than the length of the prompt plus the screen width.
  32398. 'clear-screen (C-l)'
  32399. Clear the screen and redraw the current line, leaving the current
  32400. line at the top of the screen.
  32401. 'redraw-current-line ()'
  32402. Refresh the current line. By default, this is unbound.
  32403. 
  32404. File: gdb.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands
  32405. 32.4.2 Commands For Manipulating The History
  32406. --------------------------------------------
  32407. 'accept-line (Newline or Return)'
  32408. Accept the line regardless of where the cursor is. If this line is
  32409. non-empty, it may be added to the history list for future recall
  32410. with 'add_history()'. If this line is a modified history line, the
  32411. history line is restored to its original state.
  32412. 'previous-history (C-p)'
  32413. Move 'back' through the history list, fetching the previous
  32414. command.
  32415. 'next-history (C-n)'
  32416. Move 'forward' through the history list, fetching the next command.
  32417. 'beginning-of-history (M-<)'
  32418. Move to the first line in the history.
  32419. 'end-of-history (M->)'
  32420. Move to the end of the input history, i.e., the line currently
  32421. being entered.
  32422. 'reverse-search-history (C-r)'
  32423. Search backward starting at the current line and moving 'up'
  32424. through the history as necessary. This is an incremental search.
  32425. 'forward-search-history (C-s)'
  32426. Search forward starting at the current line and moving 'down'
  32427. through the history as necessary. This is an incremental search.
  32428. 'non-incremental-reverse-search-history (M-p)'
  32429. Search backward starting at the current line and moving 'up'
  32430. through the history as necessary using a non-incremental search for
  32431. a string supplied by the user. The search string may match
  32432. anywhere in a history line.
  32433. 'non-incremental-forward-search-history (M-n)'
  32434. Search forward starting at the current line and moving 'down'
  32435. through the history as necessary using a non-incremental search for
  32436. a string supplied by the user. The search string may match
  32437. anywhere in a history line.
  32438. 'history-search-forward ()'
  32439. Search forward through the history for the string of characters
  32440. between the start of the current line and the point. The search
  32441. string must match at the beginning of a history line. This is a
  32442. non-incremental search. By default, this command is unbound.
  32443. 'history-search-backward ()'
  32444. Search backward through the history for the string of characters
  32445. between the start of the current line and the point. The search
  32446. string must match at the beginning of a history line. This is a
  32447. non-incremental search. By default, this command is unbound.
  32448. 'history-substring-search-forward ()'
  32449. Search forward through the history for the string of characters
  32450. between the start of the current line and the point. The search
  32451. string may match anywhere in a history line. This is a
  32452. non-incremental search. By default, this command is unbound.
  32453. 'history-substring-search-backward ()'
  32454. Search backward through the history for the string of characters
  32455. between the start of the current line and the point. The search
  32456. string may match anywhere in a history line. This is a
  32457. non-incremental search. By default, this command is unbound.
  32458. 'yank-nth-arg (M-C-y)'
  32459. Insert the first argument to the previous command (usually the
  32460. second word on the previous line) at point. With an argument N,
  32461. insert the Nth word from the previous command (the words in the
  32462. previous command begin with word 0). A negative argument inserts
  32463. the Nth word from the end of the previous command. Once the
  32464. argument N is computed, the argument is extracted as if the '!N'
  32465. history expansion had been specified.
  32466. 'yank-last-arg (M-. or M-_)'
  32467. Insert last argument to the previous command (the last word of the
  32468. previous history entry). With a numeric argument, behave exactly
  32469. like 'yank-nth-arg'. Successive calls to 'yank-last-arg' move back
  32470. through the history list, inserting the last word (or the word
  32471. specified by the argument to the first call) of each line in turn.
  32472. Any numeric argument supplied to these successive calls determines
  32473. the direction to move through the history. A negative argument
  32474. switches the direction through the history (back or forward). The
  32475. history expansion facilities are used to extract the last argument,
  32476. as if the '!$' history expansion had been specified.
  32477. 
  32478. File: gdb.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands
  32479. 32.4.3 Commands For Changing Text
  32480. ---------------------------------
  32481. 'end-of-file (usually C-d)'
  32482. The character indicating end-of-file as set, for example, by
  32483. 'stty'. If this character is read when there are no characters on
  32484. the line, and point is at the beginning of the line, Readline
  32485. interprets it as the end of input and returns EOF.
  32486. 'delete-char (C-d)'
  32487. Delete the character at point. If this function is bound to the
  32488. same character as the tty EOF character, as 'C-d' commonly is, see
  32489. above for the effects.
  32490. 'backward-delete-char (Rubout)'
  32491. Delete the character behind the cursor. A numeric argument means
  32492. to kill the characters instead of deleting them.
  32493. 'forward-backward-delete-char ()'
  32494. Delete the character under the cursor, unless the cursor is at the
  32495. end of the line, in which case the character behind the cursor is
  32496. deleted. By default, this is not bound to a key.
  32497. 'quoted-insert (C-q or C-v)'
  32498. Add the next character typed to the line verbatim. This is how to
  32499. insert key sequences like 'C-q', for example.
  32500. 'tab-insert (M-<TAB>)'
  32501. Insert a tab character.
  32502. 'self-insert (a, b, A, 1, !, ...)'
  32503. Insert yourself.
  32504. 'bracketed-paste-begin ()'
  32505. This function is intended to be bound to the "bracketed paste"
  32506. escape sequence sent by some terminals, and such a binding is
  32507. assigned by default. It allows Readline to insert the pasted text
  32508. as a single unit without treating each character as if it had been
  32509. read from the keyboard. The characters are inserted as if each one
  32510. was bound to 'self-insert' instead of executing any editing
  32511. commands.
  32512. 'transpose-chars (C-t)'
  32513. Drag the character before the cursor forward over the character at
  32514. the cursor, moving the cursor forward as well. If the insertion
  32515. point is at the end of the line, then this transposes the last two
  32516. characters of the line. Negative arguments have no effect.
  32517. 'transpose-words (M-t)'
  32518. Drag the word before point past the word after point, moving point
  32519. past that word as well. If the insertion point is at the end of
  32520. the line, this transposes the last two words on the line.
  32521. 'upcase-word (M-u)'
  32522. Uppercase the current (or following) word. With a negative
  32523. argument, uppercase the previous word, but do not move the cursor.
  32524. 'downcase-word (M-l)'
  32525. Lowercase the current (or following) word. With a negative
  32526. argument, lowercase the previous word, but do not move the cursor.
  32527. 'capitalize-word (M-c)'
  32528. Capitalize the current (or following) word. With a negative
  32529. argument, capitalize the previous word, but do not move the cursor.
  32530. 'overwrite-mode ()'
  32531. Toggle overwrite mode. With an explicit positive numeric argument,
  32532. switches to overwrite mode. With an explicit non-positive numeric
  32533. argument, switches to insert mode. This command affects only
  32534. 'emacs' mode; 'vi' mode does overwrite differently. Each call to
  32535. 'readline()' starts in insert mode.
  32536. In overwrite mode, characters bound to 'self-insert' replace the
  32537. text at point rather than pushing the text to the right.
  32538. Characters bound to 'backward-delete-char' replace the character
  32539. before point with a space.
  32540. By default, this command is unbound.
  32541. 
  32542. File: gdb.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
  32543. 32.4.4 Killing And Yanking
  32544. --------------------------
  32545. 'kill-line (C-k)'
  32546. Kill the text from point to the end of the line.
  32547. 'backward-kill-line (C-x Rubout)'
  32548. Kill backward from the cursor to the beginning of the current line.
  32549. 'unix-line-discard (C-u)'
  32550. Kill backward from the cursor to the beginning of the current line.
  32551. 'kill-whole-line ()'
  32552. Kill all characters on the current line, no matter where point is.
  32553. By default, this is unbound.
  32554. 'kill-word (M-d)'
  32555. Kill from point to the end of the current word, or if between
  32556. words, to the end of the next word. Word boundaries are the same
  32557. as 'forward-word'.
  32558. 'backward-kill-word (M-<DEL>)'
  32559. Kill the word behind point. Word boundaries are the same as
  32560. 'backward-word'.
  32561. 'unix-word-rubout (C-w)'
  32562. Kill the word behind point, using white space as a word boundary.
  32563. The killed text is saved on the kill-ring.
  32564. 'unix-filename-rubout ()'
  32565. Kill the word behind point, using white space and the slash
  32566. character as the word boundaries. The killed text is saved on the
  32567. kill-ring.
  32568. 'delete-horizontal-space ()'
  32569. Delete all spaces and tabs around point. By default, this is
  32570. unbound.
  32571. 'kill-region ()'
  32572. Kill the text in the current region. By default, this command is
  32573. unbound.
  32574. 'copy-region-as-kill ()'
  32575. Copy the text in the region to the kill buffer, so it can be yanked
  32576. right away. By default, this command is unbound.
  32577. 'copy-backward-word ()'
  32578. Copy the word before point to the kill buffer. The word boundaries
  32579. are the same as 'backward-word'. By default, this command is
  32580. unbound.
  32581. 'copy-forward-word ()'
  32582. Copy the word following point to the kill buffer. The word
  32583. boundaries are the same as 'forward-word'. By default, this
  32584. command is unbound.
  32585. 'yank (C-y)'
  32586. Yank the top of the kill ring into the buffer at point.
  32587. 'yank-pop (M-y)'
  32588. Rotate the kill-ring, and yank the new top. You can only do this
  32589. if the prior command is 'yank' or 'yank-pop'.
  32590. 
  32591. File: gdb.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands
  32592. 32.4.5 Specifying Numeric Arguments
  32593. -----------------------------------
  32594. 'digit-argument (M-0, M-1, ... M--)'
  32595. Add this digit to the argument already accumulating, or start a new
  32596. argument. 'M--' starts a negative argument.
  32597. 'universal-argument ()'
  32598. This is another way to specify an argument. If this command is
  32599. followed by one or more digits, optionally with a leading minus
  32600. sign, those digits define the argument. If the command is followed
  32601. by digits, executing 'universal-argument' again ends the numeric
  32602. argument, but is otherwise ignored. As a special case, if this
  32603. command is immediately followed by a character that is neither a
  32604. digit nor minus sign, the argument count for the next command is
  32605. multiplied by four. The argument count is initially one, so
  32606. executing this function the first time makes the argument count
  32607. four, a second time makes the argument count sixteen, and so on.
  32608. By default, this is not bound to a key.
  32609. 
  32610. File: gdb.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands
  32611. 32.4.6 Letting Readline Type For You
  32612. ------------------------------------
  32613. 'complete (<TAB>)'
  32614. Attempt to perform completion on the text before point. The actual
  32615. completion performed is application-specific. The default is
  32616. filename completion.
  32617. 'possible-completions (M-?)'
  32618. List the possible completions of the text before point. When
  32619. displaying completions, Readline sets the number of columns used
  32620. for display to the value of 'completion-display-width', the value
  32621. of the environment variable 'COLUMNS', or the screen width, in that
  32622. order.
  32623. 'insert-completions (M-*)'
  32624. Insert all completions of the text before point that would have
  32625. been generated by 'possible-completions'.
  32626. 'menu-complete ()'
  32627. Similar to 'complete', but replaces the word to be completed with a
  32628. single match from the list of possible completions. Repeated
  32629. execution of 'menu-complete' steps through the list of possible
  32630. completions, inserting each match in turn. At the end of the list
  32631. of completions, the bell is rung (subject to the setting of
  32632. 'bell-style') and the original text is restored. An argument of N
  32633. moves N positions forward in the list of matches; a negative
  32634. argument may be used to move backward through the list. This
  32635. command is intended to be bound to <TAB>, but is unbound by
  32636. default.
  32637. 'menu-complete-backward ()'
  32638. Identical to 'menu-complete', but moves backward through the list
  32639. of possible completions, as if 'menu-complete' had been given a
  32640. negative argument.
  32641. 'delete-char-or-list ()'
  32642. Deletes the character under the cursor if not at the beginning or
  32643. end of the line (like 'delete-char'). If at the end of the line,
  32644. behaves identically to 'possible-completions'. This command is
  32645. unbound by default.
  32646. 
  32647. File: gdb.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands
  32648. 32.4.7 Keyboard Macros
  32649. ----------------------
  32650. 'start-kbd-macro (C-x ()'
  32651. Begin saving the characters typed into the current keyboard macro.
  32652. 'end-kbd-macro (C-x ))'
  32653. Stop saving the characters typed into the current keyboard macro
  32654. and save the definition.
  32655. 'call-last-kbd-macro (C-x e)'
  32656. Re-execute the last keyboard macro defined, by making the
  32657. characters in the macro appear as if typed at the keyboard.
  32658. 'print-last-kbd-macro ()'
  32659. Print the last keboard macro defined in a format suitable for the
  32660. INPUTRC file.
  32661. 
  32662. File: gdb.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands
  32663. 32.4.8 Some Miscellaneous Commands
  32664. ----------------------------------
  32665. 're-read-init-file (C-x C-r)'
  32666. Read in the contents of the INPUTRC file, and incorporate any
  32667. bindings or variable assignments found there.
  32668. 'abort (C-g)'
  32669. Abort the current editing command and ring the terminal's bell
  32670. (subject to the setting of 'bell-style').
  32671. 'do-lowercase-version (M-A, M-B, M-X, ...)'
  32672. If the metafied character X is upper case, run the command that is
  32673. bound to the corresponding metafied lower case character. The
  32674. behavior is undefined if X is already lower case.
  32675. 'prefix-meta (<ESC>)'
  32676. Metafy the next character typed. This is for keyboards without a
  32677. meta key. Typing '<ESC> f' is equivalent to typing 'M-f'.
  32678. 'undo (C-_ or C-x C-u)'
  32679. Incremental undo, separately remembered for each line.
  32680. 'revert-line (M-r)'
  32681. Undo all changes made to this line. This is like executing the
  32682. 'undo' command enough times to get back to the beginning.
  32683. 'tilde-expand (M-~)'
  32684. Perform tilde expansion on the current word.
  32685. 'set-mark (C-@)'
  32686. Set the mark to the point. If a numeric argument is supplied, the
  32687. mark is set to that position.
  32688. 'exchange-point-and-mark (C-x C-x)'
  32689. Swap the point with the mark. The current cursor position is set
  32690. to the saved position, and the old cursor position is saved as the
  32691. mark.
  32692. 'character-search (C-])'
  32693. A character is read and point is moved to the next occurrence of
  32694. that character. A negative count searches for previous
  32695. occurrences.
  32696. 'character-search-backward (M-C-])'
  32697. A character is read and point is moved to the previous occurrence
  32698. of that character. A negative count searches for subsequent
  32699. occurrences.
  32700. 'skip-csi-sequence ()'
  32701. Read enough characters to consume a multi-key sequence such as
  32702. those defined for keys like Home and End. Such sequences begin
  32703. with a Control Sequence Indicator (CSI), usually ESC-[. If this
  32704. sequence is bound to "\e[", keys producing such sequences will have
  32705. no effect unless explicitly bound to a readline command, instead of
  32706. inserting stray characters into the editing buffer. This is
  32707. unbound by default, but usually bound to ESC-[.
  32708. 'insert-comment (M-#)'
  32709. Without a numeric argument, the value of the 'comment-begin'
  32710. variable is inserted at the beginning of the current line. If a
  32711. numeric argument is supplied, this command acts as a toggle: if the
  32712. characters at the beginning of the line do not match the value of
  32713. 'comment-begin', the value is inserted, otherwise the characters in
  32714. 'comment-begin' are deleted from the beginning of the line. In
  32715. either case, the line is accepted as if a newline had been typed.
  32716. 'dump-functions ()'
  32717. Print all of the functions and their key bindings to the Readline
  32718. output stream. If a numeric argument is supplied, the output is
  32719. formatted in such a way that it can be made part of an INPUTRC
  32720. file. This command is unbound by default.
  32721. 'dump-variables ()'
  32722. Print all of the settable variables and their values to the
  32723. Readline output stream. If a numeric argument is supplied, the
  32724. output is formatted in such a way that it can be made part of an
  32725. INPUTRC file. This command is unbound by default.
  32726. 'dump-macros ()'
  32727. Print all of the Readline key sequences bound to macros and the
  32728. strings they output. If a numeric argument is supplied, the output
  32729. is formatted in such a way that it can be made part of an INPUTRC
  32730. file. This command is unbound by default.
  32731. 'emacs-editing-mode (C-e)'
  32732. When in 'vi' command mode, this causes a switch to 'emacs' editing
  32733. mode.
  32734. 'vi-editing-mode (M-C-j)'
  32735. When in 'emacs' editing mode, this causes a switch to 'vi' editing
  32736. mode.
  32737. 
  32738. File: gdb.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing
  32739. 32.5 Readline vi Mode
  32740. =====================
  32741. While the Readline library does not have a full set of 'vi' editing
  32742. functions, it does contain enough to allow simple editing of the line.
  32743. The Readline 'vi' mode behaves as specified in the POSIX standard.
  32744. In order to switch interactively between 'emacs' and 'vi' editing
  32745. modes, use the command 'M-C-j' (bound to emacs-editing-mode when in 'vi'
  32746. mode and to vi-editing-mode in 'emacs' mode). The Readline default is
  32747. 'emacs' mode.
  32748. When you enter a line in 'vi' mode, you are already placed in
  32749. 'insertion' mode, as if you had typed an 'i'. Pressing <ESC> switches
  32750. you into 'command' mode, where you can edit the text of the line with
  32751. the standard 'vi' movement keys, move to previous history lines with 'k'
  32752. and subsequent lines with 'j', and so forth.
  32753. 
  32754. File: gdb.info, Node: Using History Interactively, Next: In Memoriam, Prev: Command Line Editing, Up: Top
  32755. 33 Using History Interactively
  32756. ******************************
  32757. This chapter describes how to use the GNU History Library interactively,
  32758. from a user's standpoint. It should be considered a user's guide. For
  32759. information on using the GNU History Library in your own programs, *note
  32760. (history)Programming with GNU History::.
  32761. * Menu:
  32762. * History Interaction:: What it feels like using History as a user.
  32763. 
  32764. File: gdb.info, Node: History Interaction, Up: Using History Interactively
  32765. 33.1 History Expansion
  32766. ======================
  32767. The History library provides a history expansion feature that is similar
  32768. to the history expansion provided by 'csh'. This section describes the
  32769. syntax used to manipulate the history information.
  32770. History expansions introduce words from the history list into the
  32771. input stream, making it easy to repeat commands, insert the arguments to
  32772. a previous command into the current input line, or fix errors in
  32773. previous commands quickly.
  32774. History expansion takes place in two parts. The first is to
  32775. determine which line from the history list should be used during
  32776. substitution. The second is to select portions of that line for
  32777. inclusion into the current one. The line selected from the history is
  32778. called the "event", and the portions of that line that are acted upon
  32779. are called "words". Various "modifiers" are available to manipulate the
  32780. selected words. The line is broken into words in the same fashion that
  32781. Bash does, so that several words surrounded by quotes are considered one
  32782. word. History expansions are introduced by the appearance of the
  32783. history expansion character, which is '!' by default.
  32784. History expansion implements shell-like quoting conventions: a
  32785. backslash can be used to remove the special handling for the next
  32786. character; single quotes enclose verbatim sequences of characters, and
  32787. can be used to inhibit history expansion; and characters enclosed within
  32788. double quotes may be subject to history expansion, since backslash can
  32789. escape the history expansion character, but single quotes may not, since
  32790. they are not treated specially within double quotes.
  32791. * Menu:
  32792. * Event Designators:: How to specify which history line to use.
  32793. * Word Designators:: Specifying which words are of interest.
  32794. * Modifiers:: Modifying the results of substitution.
  32795. 
  32796. File: gdb.info, Node: Event Designators, Next: Word Designators, Up: History Interaction
  32797. 33.1.1 Event Designators
  32798. ------------------------
  32799. An event designator is a reference to a command line entry in the
  32800. history list. Unless the reference is absolute, events are relative to
  32801. the current position in the history list.
  32802. '!'
  32803. Start a history substitution, except when followed by a space, tab,
  32804. the end of the line, or '='.
  32805. '!N'
  32806. Refer to command line N.
  32807. '!-N'
  32808. Refer to the command N lines back.
  32809. '!!'
  32810. Refer to the previous command. This is a synonym for '!-1'.
  32811. '!STRING'
  32812. Refer to the most recent command preceding the current position in
  32813. the history list starting with STRING.
  32814. '!?STRING[?]'
  32815. Refer to the most recent command preceding the current position in
  32816. the history list containing STRING. The trailing '?' may be
  32817. omitted if the STRING is followed immediately by a newline.
  32818. '^STRING1^STRING2^'
  32819. Quick Substitution. Repeat the last command, replacing STRING1
  32820. with STRING2. Equivalent to '!!:s/STRING1/STRING2/'.
  32821. '!#'
  32822. The entire command line typed so far.
  32823. 
  32824. File: gdb.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction
  32825. 33.1.2 Word Designators
  32826. -----------------------
  32827. Word designators are used to select desired words from the event. A ':'
  32828. separates the event specification from the word designator. It may be
  32829. omitted if the word designator begins with a '^', '$', '*', '-', or '%'.
  32830. Words are numbered from the beginning of the line, with the first word
  32831. being denoted by 0 (zero). Words are inserted into the current line
  32832. separated by single spaces.
  32833. For example,
  32834. '!!'
  32835. designates the preceding command. When you type this, the
  32836. preceding command is repeated in toto.
  32837. '!!:$'
  32838. designates the last argument of the preceding command. This may be
  32839. shortened to '!$'.
  32840. '!fi:2'
  32841. designates the second argument of the most recent command starting
  32842. with the letters 'fi'.
  32843. Here are the word designators:
  32844. '0 (zero)'
  32845. The '0'th word. For many applications, this is the command word.
  32846. 'N'
  32847. The Nth word.
  32848. '^'
  32849. The first argument; that is, word 1.
  32850. '$'
  32851. The last argument.
  32852. '%'
  32853. The word matched by the most recent '?STRING?' search.
  32854. 'X-Y'
  32855. A range of words; '-Y' abbreviates '0-Y'.
  32856. '*'
  32857. All of the words, except the '0'th. This is a synonym for '1-$'.
  32858. It is not an error to use '*' if there is just one word in the
  32859. event; the empty string is returned in that case.
  32860. 'X*'
  32861. Abbreviates 'X-$'
  32862. 'X-'
  32863. Abbreviates 'X-$' like 'X*', but omits the last word.
  32864. If a word designator is supplied without an event specification, the
  32865. previous command is used as the event.
  32866. 
  32867. File: gdb.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
  32868. 33.1.3 Modifiers
  32869. ----------------
  32870. After the optional word designator, you can add a sequence of one or
  32871. more of the following modifiers, each preceded by a ':'.
  32872. 'h'
  32873. Remove a trailing pathname component, leaving only the head.
  32874. 't'
  32875. Remove all leading pathname components, leaving the tail.
  32876. 'r'
  32877. Remove a trailing suffix of the form '.SUFFIX', leaving the
  32878. basename.
  32879. 'e'
  32880. Remove all but the trailing suffix.
  32881. 'p'
  32882. Print the new command but do not execute it.
  32883. 's/OLD/NEW/'
  32884. Substitute NEW for the first occurrence of OLD in the event line.
  32885. Any delimiter may be used in place of '/'. The delimiter may be
  32886. quoted in OLD and NEW with a single backslash. If '&' appears in
  32887. NEW, it is replaced by OLD. A single backslash will quote the '&'.
  32888. The final delimiter is optional if it is the last character on the
  32889. input line.
  32890. '&'
  32891. Repeat the previous substitution.
  32892. 'g'
  32893. 'a'
  32894. Cause changes to be applied over the entire event line. Used in
  32895. conjunction with 's', as in 'gs/OLD/NEW/', or with '&'.
  32896. 'G'
  32897. Apply the following 's' modifier once to each word in the event.
  32898. 
  32899. File: gdb.info, Node: In Memoriam, Next: Formatting Documentation, Prev: Using History Interactively, Up: Top
  32900. Appendix A In Memoriam
  32901. **********************
  32902. The GDB project mourns the loss of the following long-time contributors:
  32903. 'Fred Fish'
  32904. Fred was a long-standing contributor to GDB (1991-2006), and to
  32905. Free Software in general. Outside of GDB, he was known in the
  32906. Amiga world for his series of Fish Disks, and the GeekGadget
  32907. project.
  32908. 'Michael Snyder'
  32909. Michael was one of the Global Maintainers of the GDB project, with
  32910. contributions recorded as early as 1996, until 2011. In addition
  32911. to his day to day participation, he was a large driving force
  32912. behind adding Reverse Debugging to GDB.
  32913. Beyond their technical contributions to the project, they were also
  32914. enjoyable members of the Free Software Community. We will miss them.
  32915. 
  32916. File: gdb.info, Node: Formatting Documentation, Next: Installing GDB, Prev: In Memoriam, Up: Top
  32917. Appendix B Formatting Documentation
  32918. ***********************************
  32919. The GDB 4 release includes an already-formatted reference card, ready
  32920. for printing with PostScript or Ghostscript, in the 'gdb' subdirectory
  32921. of the main source directory(1). If you can use PostScript or
  32922. Ghostscript with your printer, you can print the reference card
  32923. immediately with 'refcard.ps'.
  32924. The release also includes the source for the reference card. You can
  32925. format it, using TeX, by typing:
  32926. make refcard.dvi
  32927. The GDB reference card is designed to print in "landscape" mode on US
  32928. "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
  32929. high. You will need to specify this form of printing as an option to
  32930. your DVI output program.
  32931. All the documentation for GDB comes as part of the machine-readable
  32932. distribution. The documentation is written in Texinfo format, which is
  32933. a documentation system that uses a single source file to produce both
  32934. on-line information and a printed manual. You can use one of the Info
  32935. formatting commands to create the on-line version of the documentation
  32936. and TeX (or 'texi2roff') to typeset the printed version.
  32937. GDB includes an already formatted copy of the on-line Info version of
  32938. this manual in the 'gdb' subdirectory. The main Info file is
  32939. 'gdb-9.1/gdb/gdb.info', and it refers to subordinate files matching
  32940. 'gdb.info*' in the same directory. If necessary, you can print out
  32941. these files, or read them with any editor; but they are easier to read
  32942. using the 'info' subsystem in GNU Emacs or the standalone 'info'
  32943. program, available as part of the GNU Texinfo distribution.
  32944. If you want to format these Info files yourself, you need one of the
  32945. Info formatting programs, such as 'texinfo-format-buffer' or 'makeinfo'.
  32946. If you have 'makeinfo' installed, and are in the top level GDB source
  32947. directory ('gdb-9.1', in the case of version 9.1), you can make the Info
  32948. file by typing:
  32949. cd gdb
  32950. make gdb.info
  32951. If you want to typeset and print copies of this manual, you need TeX,
  32952. a program to print its DVI output files, and 'texinfo.tex', the Texinfo
  32953. definitions file.
  32954. TeX is a typesetting program; it does not print files directly, but
  32955. produces output files called DVI files. To print a typeset document,
  32956. you need a program to print DVI files. If your system has TeX
  32957. installed, chances are it has such a program. The precise command to
  32958. use depends on your system; 'lpr -d' is common; another (for PostScript
  32959. devices) is 'dvips'. The DVI print command may require a file name
  32960. without any extension or a '.dvi' extension.
  32961. TeX also requires a macro definitions file called 'texinfo.tex'.
  32962. This file tells TeX how to typeset a document written in Texinfo format.
  32963. On its own, TeX cannot either read or typeset a Texinfo file.
  32964. 'texinfo.tex' is distributed with GDB and is located in the
  32965. 'gdb-VERSION-NUMBER/texinfo' directory.
  32966. If you have TeX and a DVI printer program installed, you can typeset
  32967. and print this manual. First switch to the 'gdb' subdirectory of the
  32968. main source directory (for example, to 'gdb-9.1/gdb') and type:
  32969. make gdb.dvi
  32970. Then give 'gdb.dvi' to your DVI printing program.
  32971. ---------- Footnotes ----------
  32972. (1) In 'gdb-9.1/gdb/refcard.ps' of the version 9.1 release.
  32973. 
  32974. File: gdb.info, Node: Installing GDB, Next: Maintenance Commands, Prev: Formatting Documentation, Up: Top
  32975. Appendix C Installing GDB
  32976. *************************
  32977. * Menu:
  32978. * Requirements:: Requirements for building GDB
  32979. * Running Configure:: Invoking the GDB 'configure' script
  32980. * Separate Objdir:: Compiling GDB in another directory
  32981. * Config Names:: Specifying names for hosts and targets
  32982. * Configure Options:: Summary of options for configure
  32983. * System-wide configuration:: Having a system-wide init file
  32984. 
  32985. File: gdb.info, Node: Requirements, Next: Running Configure, Up: Installing GDB
  32986. C.1 Requirements for Building GDB
  32987. =================================
  32988. Building GDB requires various tools and packages to be available. Other
  32989. packages will be used only if they are found.
  32990. Tools/Packages Necessary for Building GDB
  32991. =========================================
  32992. C++11 compiler
  32993. GDB is written in C++11. It should be buildable with any recent
  32994. C++11 compiler, e.g. GCC.
  32995. GNU make
  32996. GDB's build system relies on features only found in the GNU make
  32997. program. Other variants of 'make' will not work.
  32998. Tools/Packages Optional for Building GDB
  32999. ========================================
  33000. Expat
  33001. GDB can use the Expat XML parsing library. This library may be
  33002. included with your operating system distribution; if it is not, you
  33003. can get the latest version from <http://expat.sourceforge.net>.
  33004. The 'configure' script will search for this library in several
  33005. standard locations; if it is installed in an unusual path, you can
  33006. use the '--with-libexpat-prefix' option to specify its location.
  33007. Expat is used for:
  33008. * Remote protocol memory maps (*note Memory Map Format::)
  33009. * Target descriptions (*note Target Descriptions::)
  33010. * Remote shared library lists (*Note Library List Format::, or
  33011. alternatively *note Library List Format for SVR4 Targets::)
  33012. * MS-Windows shared libraries (*note Shared Libraries::)
  33013. * Traceframe info (*note Traceframe Info Format::)
  33014. * Branch trace (*note Branch Trace Format::, *note Branch Trace
  33015. Configuration Format::)
  33016. Guile
  33017. GDB can be scripted using GNU Guile. *Note Guile::. By default,
  33018. GDB will be compiled if the Guile libraries are installed and are
  33019. found by 'configure'. You can use the '--with-guile' option to
  33020. request Guile, and pass either the Guile version number or the file
  33021. name of the relevant 'pkg-config' program to choose a particular
  33022. version of Guile.
  33023. iconv
  33024. GDB's features related to character sets (*note Character Sets::)
  33025. require a functioning 'iconv' implementation. If you are on a GNU
  33026. system, then this is provided by the GNU C Library. Some other
  33027. systems also provide a working 'iconv'.
  33028. If GDB is using the 'iconv' program which is installed in a
  33029. non-standard place, you will need to tell GDB where to find it.
  33030. This is done with '--with-iconv-bin' which specifies the directory
  33031. that contains the 'iconv' program. This program is run in order to
  33032. make a list of the available character sets.
  33033. On systems without 'iconv', you can install GNU Libiconv. If
  33034. Libiconv is installed in a standard place, GDB will automatically
  33035. use it if it is needed. If you have previously installed Libiconv
  33036. in a non-standard place, you can use the '--with-libiconv-prefix'
  33037. option to 'configure'.
  33038. GDB's top-level 'configure' and 'Makefile' will arrange to build
  33039. Libiconv if a directory named 'libiconv' appears in the top-most
  33040. source directory. If Libiconv is built this way, and if the
  33041. operating system does not provide a suitable 'iconv'
  33042. implementation, then the just-built library will automatically be
  33043. used by GDB. One easy way to set this up is to download GNU
  33044. Libiconv, unpack it inside the top-level directory of the GDB
  33045. source tree, and then rename the directory holding the Libiconv
  33046. source code to 'libiconv'.
  33047. lzma
  33048. GDB can support debugging sections that are compressed with the
  33049. LZMA library. *Note MiniDebugInfo::. If this library is not
  33050. included with your operating system, you can find it in the xz
  33051. package at <http://tukaani.org/xz/>. If the LZMA library is
  33052. available in the usual place, then the 'configure' script will use
  33053. it automatically. If it is installed in an unusual path, you can
  33054. use the '--with-lzma-prefix' option to specify its location.
  33055. MPFR
  33056. GDB can use the GNU MPFR multiple-precision floating-point library.
  33057. This library may be included with your operating system
  33058. distribution; if it is not, you can get the latest version from
  33059. <http://www.mpfr.org>. The 'configure' script will search for this
  33060. library in several standard locations; if it is installed in an
  33061. unusual path, you can use the '--with-libmpfr-prefix' option to
  33062. specify its location.
  33063. GNU MPFR is used to emulate target floating-point arithmetic during
  33064. expression evaluation when the target uses different floating-point
  33065. formats than the host. If GNU MPFR it is not available, GDB will
  33066. fall back to using host floating-point arithmetic.
  33067. Python
  33068. GDB can be scripted using Python language. *Note Python::. By
  33069. default, GDB will be compiled if the Python libraries are installed
  33070. and are found by 'configure'. You can use the '--with-python'
  33071. option to request Python, and pass either the file name of the
  33072. relevant 'python' executable, or the name of the directory in which
  33073. Python is installed, to choose a particular installation of Python.
  33074. zlib
  33075. GDB will use the 'zlib' library, if available, to read compressed
  33076. debug sections. Some linkers, such as GNU gold, are capable of
  33077. producing binaries with compressed debug sections. If GDB is
  33078. compiled with 'zlib', it will be able to read the debug information
  33079. in such binaries.
  33080. The 'zlib' library is likely included with your operating system
  33081. distribution; if it is not, you can get the latest version from
  33082. <http://zlib.net>.
  33083. 
  33084. File: gdb.info, Node: Running Configure, Next: Separate Objdir, Prev: Requirements, Up: Installing GDB
  33085. C.2 Invoking the GDB 'configure' Script
  33086. =======================================
  33087. GDB comes with a 'configure' script that automates the process of
  33088. preparing GDB for installation; you can then use 'make' to build the
  33089. 'gdb' program.
  33090. The GDB distribution includes all the source code you need for GDB in
  33091. a single directory, whose name is usually composed by appending the
  33092. version number to 'gdb'.
  33093. For example, the GDB version 9.1 distribution is in the 'gdb-9.1'
  33094. directory. That directory contains:
  33095. 'gdb-9.1/configure (and supporting files)'
  33096. script for configuring GDB and all its supporting libraries
  33097. 'gdb-9.1/gdb'
  33098. the source specific to GDB itself
  33099. 'gdb-9.1/bfd'
  33100. source for the Binary File Descriptor library
  33101. 'gdb-9.1/include'
  33102. GNU include files
  33103. 'gdb-9.1/libiberty'
  33104. source for the '-liberty' free software library
  33105. 'gdb-9.1/opcodes'
  33106. source for the library of opcode tables and disassemblers
  33107. 'gdb-9.1/readline'
  33108. source for the GNU command-line interface
  33109. There may be other subdirectories as well.
  33110. The simplest way to configure and build GDB is to run 'configure'
  33111. from the 'gdb-VERSION-NUMBER' source directory, which in this example is
  33112. the 'gdb-9.1' directory.
  33113. First switch to the 'gdb-VERSION-NUMBER' source directory if you are
  33114. not already in it; then run 'configure'. Pass the identifier for the
  33115. platform on which GDB will run as an argument.
  33116. For example:
  33117. cd gdb-9.1
  33118. ./configure
  33119. make
  33120. Running 'configure' and then running 'make' builds the included
  33121. supporting libraries, then 'gdb' itself. The configured source files,
  33122. and the binaries, are left in the corresponding source directories.
  33123. 'configure' is a Bourne-shell ('/bin/sh') script; if your system does
  33124. not recognize this automatically when you run a different shell, you may
  33125. need to run 'sh' on it explicitly:
  33126. sh configure
  33127. You should run the 'configure' script from the top directory in the
  33128. source tree, the 'gdb-VERSION-NUMBER' directory. If you run 'configure'
  33129. from one of the subdirectories, you will configure only that
  33130. subdirectory. That is usually not what you want. In particular, if you
  33131. run the first 'configure' from the 'gdb' subdirectory of the
  33132. 'gdb-VERSION-NUMBER' directory, you will omit the configuration of
  33133. 'bfd', 'readline', and other sibling directories of the 'gdb'
  33134. subdirectory. This leads to build errors about missing include files
  33135. such as 'bfd/bfd.h'.
  33136. You can install 'GDB' anywhere. The best way to do this is to pass
  33137. the '--prefix' option to 'configure', and then install it with 'make
  33138. install'.
  33139. 
  33140. File: gdb.info, Node: Separate Objdir, Next: Config Names, Prev: Running Configure, Up: Installing GDB
  33141. C.3 Compiling GDB in Another Directory
  33142. ======================================
  33143. If you want to run GDB versions for several host or target machines, you
  33144. need a different 'gdb' compiled for each combination of host and target.
  33145. 'configure' is designed to make this easy by allowing you to generate
  33146. each configuration in a separate subdirectory, rather than in the source
  33147. directory. If your 'make' program handles the 'VPATH' feature (GNU
  33148. 'make' does), running 'make' in each of these directories builds the
  33149. 'gdb' program specified there.
  33150. To build 'gdb' in a separate directory, run 'configure' with the
  33151. '--srcdir' option to specify where to find the source. (You also need
  33152. to specify a path to find 'configure' itself from your working
  33153. directory. If the path to 'configure' would be the same as the argument
  33154. to '--srcdir', you can leave out the '--srcdir' option; it is assumed.)
  33155. For example, with version 9.1, you can build GDB in a separate
  33156. directory for a Sun 4 like this:
  33157. cd gdb-9.1
  33158. mkdir ../gdb-sun4
  33159. cd ../gdb-sun4
  33160. ../gdb-9.1/configure
  33161. make
  33162. When 'configure' builds a configuration using a remote source
  33163. directory, it creates a tree for the binaries with the same structure
  33164. (and using the same names) as the tree under the source directory. In
  33165. the example, you'd find the Sun 4 library 'libiberty.a' in the directory
  33166. 'gdb-sun4/libiberty', and GDB itself in 'gdb-sun4/gdb'.
  33167. Make sure that your path to the 'configure' script has just one
  33168. instance of 'gdb' in it. If your path to 'configure' looks like
  33169. '../gdb-9.1/gdb/configure', you are configuring only one subdirectory of
  33170. GDB, not the whole package. This leads to build errors about missing
  33171. include files such as 'bfd/bfd.h'.
  33172. One popular reason to build several GDB configurations in separate
  33173. directories is to configure GDB for cross-compiling (where GDB runs on
  33174. one machine--the "host"--while debugging programs that run on another
  33175. machine--the "target"). You specify a cross-debugging target by giving
  33176. the '--target=TARGET' option to 'configure'.
  33177. When you run 'make' to build a program or library, you must run it in
  33178. a configured directory--whatever directory you were in when you called
  33179. 'configure' (or one of its subdirectories).
  33180. The 'Makefile' that 'configure' generates in each source directory
  33181. also runs recursively. If you type 'make' in a source directory such as
  33182. 'gdb-9.1' (or in a separate configured directory configured with
  33183. '--srcdir=DIRNAME/gdb-9.1'), you will build all the required libraries,
  33184. and then build GDB.
  33185. When you have multiple hosts or targets configured in separate
  33186. directories, you can run 'make' on them in parallel (for example, if
  33187. they are NFS-mounted on each of the hosts); they will not interfere with
  33188. each other.
  33189. 
  33190. File: gdb.info, Node: Config Names, Next: Configure Options, Prev: Separate Objdir, Up: Installing GDB
  33191. C.4 Specifying Names for Hosts and Targets
  33192. ==========================================
  33193. The specifications used for hosts and targets in the 'configure' script
  33194. are based on a three-part naming scheme, but some short predefined
  33195. aliases are also supported. The full naming scheme encodes three pieces
  33196. of information in the following pattern:
  33197. ARCHITECTURE-VENDOR-OS
  33198. For example, you can use the alias 'sun4' as a HOST argument, or as
  33199. the value for TARGET in a '--target=TARGET' option. The equivalent full
  33200. name is 'sparc-sun-sunos4'.
  33201. The 'configure' script accompanying GDB does not provide any query
  33202. facility to list all supported host and target names or aliases.
  33203. 'configure' calls the Bourne shell script 'config.sub' to map
  33204. abbreviations to full names; you can read the script, if you wish, or
  33205. you can use it to test your guesses on abbreviations--for example:
  33206. % sh config.sub i386-linux
  33207. i386-pc-linux-gnu
  33208. % sh config.sub alpha-linux
  33209. alpha-unknown-linux-gnu
  33210. % sh config.sub hp9k700
  33211. hppa1.1-hp-hpux
  33212. % sh config.sub sun4
  33213. sparc-sun-sunos4.1.1
  33214. % sh config.sub sun3
  33215. m68k-sun-sunos4.1.1
  33216. % sh config.sub i986v
  33217. Invalid configuration `i986v': machine `i986v' not recognized
  33218. 'config.sub' is also distributed in the GDB source directory ('gdb-9.1',
  33219. for version 9.1).
  33220. 
  33221. File: gdb.info, Node: Configure Options, Next: System-wide configuration, Prev: Config Names, Up: Installing GDB
  33222. C.5 'configure' Options
  33223. =======================
  33224. Here is a summary of the 'configure' options and arguments that are most
  33225. often useful for building GDB. 'configure' also has several other
  33226. options not listed here. *note (autoconf.info)Running configure
  33227. scripts::, for a full explanation of 'configure'.
  33228. configure [--help]
  33229. [--prefix=DIR]
  33230. [--exec-prefix=DIR]
  33231. [--srcdir=DIRNAME]
  33232. [--target=TARGET]
  33233. You may introduce options with a single '-' rather than '--' if you
  33234. prefer; but you may abbreviate option names if you use '--'.
  33235. '--help'
  33236. Display a quick summary of how to invoke 'configure'.
  33237. '--prefix=DIR'
  33238. Configure the source to install programs and files under directory
  33239. 'DIR'.
  33240. '--exec-prefix=DIR'
  33241. Configure the source to install programs under directory 'DIR'.
  33242. '--srcdir=DIRNAME'
  33243. Use this option to make configurations in directories separate from
  33244. the GDB source directories. Among other things, you can use this
  33245. to build (or maintain) several configurations simultaneously, in
  33246. separate directories. 'configure' writes configuration-specific
  33247. files in the current directory, but arranges for them to use the
  33248. source in the directory DIRNAME. 'configure' creates directories
  33249. under the working directory in parallel to the source directories
  33250. below DIRNAME.
  33251. '--target=TARGET'
  33252. Configure GDB for cross-debugging programs running on the specified
  33253. TARGET. Without this option, GDB is configured to debug programs
  33254. that run on the same machine (HOST) as GDB itself.
  33255. There is no convenient way to generate a list of all available
  33256. targets. Also see the '--enable-targets' option, below.
  33257. There are many other options that are specific to GDB. This lists
  33258. just the most common ones; there are some very specialized options not
  33259. described here.
  33260. '--enable-targets=[TARGET]...'
  33261. '--enable-targets=all'
  33262. Configure GDB for cross-debugging programs running on the specified
  33263. list of targets. The special value 'all' configures GDB for
  33264. debugging programs running on any target it supports.
  33265. '--with-gdb-datadir=PATH'
  33266. Set the GDB-specific data directory. GDB will look here for
  33267. certain supporting files or scripts. This defaults to the 'gdb'
  33268. subdirectory of 'datadir' (which can be set using '--datadir').
  33269. '--with-relocated-sources=DIR'
  33270. Sets up the default source path substitution rule so that directory
  33271. names recorded in debug information will be automatically adjusted
  33272. for any directory under DIR. DIR should be a subdirectory of GDB's
  33273. configured prefix, the one mentioned in the '--prefix' or
  33274. '--exec-prefix' options to configure. This option is useful if GDB
  33275. is supposed to be moved to a different place after it is built.
  33276. '--enable-64-bit-bfd'
  33277. Enable 64-bit support in BFD on 32-bit hosts.
  33278. '--disable-gdbmi'
  33279. Build GDB without the GDB/MI machine interface (*note GDB/MI::).
  33280. '--enable-tui'
  33281. Build GDB with the text-mode full-screen user interface (TUI).
  33282. Requires a curses library (ncurses and cursesX are also supported).
  33283. '--with-curses'
  33284. Use the curses library instead of the termcap library, for
  33285. text-mode terminal operations.
  33286. '--with-libunwind-ia64'
  33287. Use the libunwind library for unwinding function call stack on ia64
  33288. target platforms. See http://www.nongnu.org/libunwind/index.html
  33289. for details.
  33290. '--with-system-readline'
  33291. Use the readline library installed on the host, rather than the
  33292. library supplied as part of GDB. Readline 7 or newer is required;
  33293. this is enforced by the build system.
  33294. '--with-system-zlib'
  33295. Use the zlib library installed on the host, rather than the library
  33296. supplied as part of GDB.
  33297. '--with-expat'
  33298. Build GDB with Expat, a library for XML parsing. (Done by default
  33299. if libexpat is installed and found at configure time.) This
  33300. library is used to read XML files supplied with GDB. If it is
  33301. unavailable, some features, such as remote protocol memory maps,
  33302. target descriptions, and shared library lists, that are based on
  33303. XML files, will not be available in GDB. If your host does not
  33304. have libexpat installed, you can get the latest version from
  33305. 'http://expat.sourceforge.net'.
  33306. '--with-libiconv-prefix[=DIR]'
  33307. Build GDB with GNU libiconv, a character set encoding conversion
  33308. library. This is not done by default, as on GNU systems the
  33309. 'iconv' that is built in to the C library is sufficient. If your
  33310. host does not have a working 'iconv', you can get the latest
  33311. version of GNU iconv from 'https://www.gnu.org/software/libiconv/'.
  33312. GDB's build system also supports building GNU libiconv as part of
  33313. the overall build. *Note Requirements::.
  33314. '--with-lzma'
  33315. Build GDB with LZMA, a compression library. (Done by default if
  33316. liblzma is installed and found at configure time.) LZMA is used by
  33317. GDB's "mini debuginfo" feature, which is only useful on platforms
  33318. using the ELF object file format. If your host does not have
  33319. liblzma installed, you can get the latest version from
  33320. 'https://tukaani.org/xz/'.
  33321. '--with-mpfr'
  33322. Build GDB with GNU MPFR, a library for multiple-precision
  33323. floating-point computation with correct rounding. (Done by default
  33324. if GNU MPFR is installed and found at configure time.) This
  33325. library is used to emulate target floating-point arithmetic during
  33326. expression evaluation when the target uses different floating-point
  33327. formats than the host. If GNU MPFR is not available, GDB will fall
  33328. back to using host floating-point arithmetic. If your host does
  33329. not have GNU MPFR installed, you can get the latest version from
  33330. 'http://www.mpfr.org'.
  33331. '--with-python[=PYTHON]'
  33332. Build GDB with Python scripting support. (Done by default if
  33333. libpython is present and found at configure time.) Python makes
  33334. GDB scripting much more powerful than the restricted CLI scripting
  33335. language. If your host does not have Python installed, you can
  33336. find it on 'http://www.python.org/download/'. The oldest version
  33337. of Python supported by GDB is 2.6. The optional argument PYTHON is
  33338. used to find the Python headers and libraries. It can be either
  33339. the name of a Python executable, or the name of the directory in
  33340. which Python is installed.
  33341. '--with-guile[=GUILE]''
  33342. Build GDB with GNU Guile scripting support. (Done by default if
  33343. libguile is present and found at configure time.) If your host
  33344. does not have Guile installed, you can find it at
  33345. 'https://www.gnu.org/software/guile/'. The optional argument GUILE
  33346. can be a version number, which will cause 'configure' to try to use
  33347. that version of Guile; or the file name of a 'pkg-config'
  33348. executable, which will be queried to find the information needed to
  33349. compile and link against Guile.
  33350. '--without-included-regex'
  33351. Don't use the regex library included with GDB (as part of the
  33352. libiberty library). This is the default on hosts with version 2 of
  33353. the GNU C library.
  33354. '--with-sysroot=DIR'
  33355. Use DIR as the default system root directory for libraries whose
  33356. file names begin with '/lib'' or '/usr/lib''. (The value of DIR
  33357. can be modified at run time by using the 'set sysroot' command.)
  33358. If DIR is under the GDB configured prefix (set with '--prefix' or
  33359. '--exec-prefix options', the default system root will be
  33360. automatically adjusted if and when GDB is moved to a different
  33361. location.
  33362. '--with-system-gdbinit=FILE'
  33363. Configure GDB to automatically load a system-wide init file. FILE
  33364. should be an absolute file name. If FILE is in a directory under
  33365. the configured prefix, and GDB is moved to another location after
  33366. being built, the location of the system-wide init file will be
  33367. adjusted accordingly.
  33368. '--with-system-gdbinit-dir=DIRECTORY'
  33369. Configure GDB to automatically load init files from a system-wide
  33370. directory. DIRECTORY should be an absolute directory name. If
  33371. DIRECTORY is in a directory under the configured prefix, and GDB is
  33372. moved to another location after being built, the location of the
  33373. system-wide init directory will be adjusted accordingly.
  33374. '--enable-build-warnings'
  33375. When building the GDB sources, ask the compiler to warn about any
  33376. code which looks even vaguely suspicious. It passes many different
  33377. warning flags, depending on the exact version of the compiler you
  33378. are using.
  33379. '--enable-werror'
  33380. Treat compiler warnings as werrors. It adds the '-Werror' flag to
  33381. the compiler, which will fail the compilation if the compiler
  33382. outputs any warning messages.
  33383. '--enable-ubsan'
  33384. Enable the GCC undefined behavior sanitizer. This is disabled by
  33385. default, but passing '--enable-ubsan=yes' or '--enable-ubsan=auto'
  33386. to 'configure' will enable it. The undefined behavior sanitizer
  33387. checks for C++ undefined behavior. It has a performance cost, so
  33388. if you are looking at GDB's performance, you should disable it.
  33389. The undefined behavior sanitizer was first introduced in GCC 4.9.
  33390. 
  33391. File: gdb.info, Node: System-wide configuration, Prev: Configure Options, Up: Installing GDB
  33392. C.6 System-wide configuration and settings
  33393. ==========================================
  33394. GDB can be configured to have a system-wide init file and a system-wide
  33395. init file directory; this file and files in that directory (if they have
  33396. a recognized file extension) will be read and executed at startup (*note
  33397. What GDB does during startup: Startup.).
  33398. Here are the corresponding configure options:
  33399. '--with-system-gdbinit=FILE'
  33400. Specify that the default location of the system-wide init file is
  33401. FILE.
  33402. '--with-system-gdbinit-dir=DIRECTORY'
  33403. Specify that the default location of the system-wide init file
  33404. directory is DIRECTORY.
  33405. If GDB has been configured with the option '--prefix=$prefix', they
  33406. may be subject to relocation. Two possible cases:
  33407. * If the default location of this init file/directory contains
  33408. '$prefix', it will be subject to relocation. Suppose that the
  33409. configure options are '--prefix=$prefix
  33410. --with-system-gdbinit=$prefix/etc/gdbinit'; if GDB is moved from
  33411. '$prefix' to '$install', the system init file is looked for as
  33412. '$install/etc/gdbinit' instead of '$prefix/etc/gdbinit'.
  33413. * By contrast, if the default location does not contain the prefix,
  33414. it will not be relocated. E.g. if GDB has been configured with
  33415. '--prefix=/usr/local --with-system-gdbinit=/usr/share/gdb/gdbinit',
  33416. then GDB will always look for '/usr/share/gdb/gdbinit', wherever
  33417. GDB is installed.
  33418. If the configured location of the system-wide init file (as given by
  33419. the '--with-system-gdbinit' option at configure time) is in the
  33420. data-directory (as specified by '--with-gdb-datadir' at configure time)
  33421. or in one of its subdirectories, then GDB will look for the system-wide
  33422. init file in the directory specified by the '--data-directory'
  33423. command-line option. Note that the system-wide init file is only read
  33424. once, during GDB initialization. If the data-directory is changed after
  33425. GDB has started with the 'set data-directory' command, the file will not
  33426. be reread.
  33427. This applies similarly to the system-wide directory specified in
  33428. '--with-system-gdbinit-dir'.
  33429. Any supported scripting language can be used for these init files, as
  33430. long as the file extension matches the scripting language. To be
  33431. interpreted as regular GDB commands, the files needs to have a '.gdb'
  33432. extension.
  33433. * Menu:
  33434. * System-wide Configuration Scripts:: Installed System-wide Configuration Scripts
  33435. 
  33436. File: gdb.info, Node: System-wide Configuration Scripts, Up: System-wide configuration
  33437. C.6.1 Installed System-wide Configuration Scripts
  33438. -------------------------------------------------
  33439. The 'system-gdbinit' directory, located inside the data-directory (as
  33440. specified by '--with-gdb-datadir' at configure time) contains a number
  33441. of scripts which can be used as system-wide init files. To
  33442. automatically source those scripts at startup, GDB should be configured
  33443. with '--with-system-gdbinit'. Otherwise, any user should be able to
  33444. source them by hand as needed.
  33445. The following scripts are currently available:
  33446. * 'elinos.py' This script is useful when debugging a program on an
  33447. ELinOS target. It takes advantage of the environment variables
  33448. defined in a standard ELinOS environment in order to determine the
  33449. location of the system shared libraries, and then sets the
  33450. 'solib-absolute-prefix' and 'solib-search-path' variables
  33451. appropriately.
  33452. * 'wrs-linux.py' This script is useful when debugging a program on a
  33453. target running Wind River Linux. It expects the 'ENV_PREFIX' to be
  33454. set to the host-side sysroot used by the target system.
  33455. 
  33456. File: gdb.info, Node: Maintenance Commands, Next: Remote Protocol, Prev: Installing GDB, Up: Top
  33457. Appendix D Maintenance Commands
  33458. *******************************
  33459. In addition to commands intended for GDB users, GDB includes a number of
  33460. commands intended for GDB developers, that are not documented elsewhere
  33461. in this manual. These commands are provided here for reference. (For
  33462. commands that turn on debugging messages, see *note Debugging Output::.)
  33463. 'maint agent [-at LOCATION,] EXPRESSION'
  33464. 'maint agent-eval [-at LOCATION,] EXPRESSION'
  33465. Translate the given EXPRESSION into remote agent bytecodes. This
  33466. command is useful for debugging the Agent Expression mechanism
  33467. (*note Agent Expressions::). The 'agent' version produces an
  33468. expression useful for data collection, such as by tracepoints,
  33469. while 'maint agent-eval' produces an expression that evaluates
  33470. directly to a result. For instance, a collection expression for
  33471. 'globa + globb' will include bytecodes to record four bytes of
  33472. memory at each of the addresses of 'globa' and 'globb', while
  33473. discarding the result of the addition, while an evaluation
  33474. expression will do the addition and return the sum. If '-at' is
  33475. given, generate remote agent bytecode for LOCATION. If not,
  33476. generate remote agent bytecode for current frame PC address.
  33477. 'maint agent-printf FORMAT,EXPR,...'
  33478. Translate the given format string and list of argument expressions
  33479. into remote agent bytecodes and display them as a disassembled
  33480. list. This command is useful for debugging the agent version of
  33481. dynamic printf (*note Dynamic Printf::).
  33482. 'maint info breakpoints'
  33483. Using the same format as 'info breakpoints', display both the
  33484. breakpoints you've set explicitly, and those GDB is using for
  33485. internal purposes. Internal breakpoints are shown with negative
  33486. breakpoint numbers. The type column identifies what kind of
  33487. breakpoint is shown:
  33488. 'breakpoint'
  33489. Normal, explicitly set breakpoint.
  33490. 'watchpoint'
  33491. Normal, explicitly set watchpoint.
  33492. 'longjmp'
  33493. Internal breakpoint, used to handle correctly stepping through
  33494. 'longjmp' calls.
  33495. 'longjmp resume'
  33496. Internal breakpoint at the target of a 'longjmp'.
  33497. 'until'
  33498. Temporary internal breakpoint used by the GDB 'until' command.
  33499. 'finish'
  33500. Temporary internal breakpoint used by the GDB 'finish'
  33501. command.
  33502. 'shlib events'
  33503. Shared library events.
  33504. 'maint info btrace'
  33505. Pint information about raw branch tracing data.
  33506. 'maint btrace packet-history'
  33507. Print the raw branch trace packets that are used to compute the
  33508. execution history for the 'record btrace' command. Both the
  33509. information and the format in which it is printed depend on the
  33510. btrace recording format.
  33511. 'bts'
  33512. For the BTS recording format, print a list of blocks of
  33513. sequential code. For each block, the following information is
  33514. printed:
  33515. Block number
  33516. Newer blocks have higher numbers. The oldest block has
  33517. number zero.
  33518. Lowest 'PC'
  33519. Highest 'PC'
  33520. 'pt'
  33521. For the Intel Processor Trace recording format, print a list
  33522. of Intel Processor Trace packets. For each packet, the
  33523. following information is printed:
  33524. Packet number
  33525. Newer packets have higher numbers. The oldest packet has
  33526. number zero.
  33527. Trace offset
  33528. The packet's offset in the trace stream.
  33529. Packet opcode and payload
  33530. 'maint btrace clear-packet-history'
  33531. Discards the cached packet history printed by the 'maint btrace
  33532. packet-history' command. The history will be computed again when
  33533. needed.
  33534. 'maint btrace clear'
  33535. Discard the branch trace data. The data will be fetched anew and
  33536. the branch trace will be recomputed when needed.
  33537. This implicitly truncates the branch trace to a single branch trace
  33538. buffer. When updating branch trace incrementally, the branch trace
  33539. available to GDB may be bigger than a single branch trace buffer.
  33540. 'maint set btrace pt skip-pad'
  33541. 'maint show btrace pt skip-pad'
  33542. Control whether GDB will skip PAD packets when computing the packet
  33543. history.
  33544. 'set displaced-stepping'
  33545. 'show displaced-stepping'
  33546. Control whether or not GDB will do "displaced stepping" if the
  33547. target supports it. Displaced stepping is a way to single-step
  33548. over breakpoints without removing them from the inferior, by
  33549. executing an out-of-line copy of the instruction that was
  33550. originally at the breakpoint location. It is also known as
  33551. out-of-line single-stepping.
  33552. 'set displaced-stepping on'
  33553. If the target architecture supports it, GDB will use displaced
  33554. stepping to step over breakpoints.
  33555. 'set displaced-stepping off'
  33556. GDB will not use displaced stepping to step over breakpoints,
  33557. even if such is supported by the target architecture.
  33558. 'set displaced-stepping auto'
  33559. This is the default mode. GDB will use displaced stepping
  33560. only if non-stop mode is active (*note Non-Stop Mode::) and
  33561. the target architecture supports displaced stepping.
  33562. 'maint check-psymtabs'
  33563. Check the consistency of currently expanded psymtabs versus
  33564. symtabs. Use this to check, for example, whether a symbol is in
  33565. one but not the other.
  33566. 'maint check-symtabs'
  33567. Check the consistency of currently expanded symtabs.
  33568. 'maint expand-symtabs [REGEXP]'
  33569. Expand symbol tables. If REGEXP is specified, only expand symbol
  33570. tables for file names matching REGEXP.
  33571. 'maint set catch-demangler-crashes [on|off]'
  33572. 'maint show catch-demangler-crashes'
  33573. Control whether GDB should attempt to catch crashes in the symbol
  33574. name demangler. The default is to attempt to catch crashes. If
  33575. enabled, the first time a crash is caught, a core file is created,
  33576. the offending symbol is displayed and the user is presented with
  33577. the option to terminate the current session.
  33578. 'maint cplus first_component NAME'
  33579. Print the first C++ class/namespace component of NAME.
  33580. 'maint cplus namespace'
  33581. Print the list of possible C++ namespaces.
  33582. 'maint deprecate COMMAND [REPLACEMENT]'
  33583. 'maint undeprecate COMMAND'
  33584. Deprecate or undeprecate the named COMMAND. Deprecated commands
  33585. cause GDB to issue a warning when you use them. The optional
  33586. argument REPLACEMENT says which newer command should be used in
  33587. favor of the deprecated one; if it is given, GDB will mention the
  33588. replacement as part of the warning.
  33589. 'maint dump-me'
  33590. Cause a fatal signal in the debugger and force it to dump its core.
  33591. This is supported only on systems which support aborting a program
  33592. with the 'SIGQUIT' signal.
  33593. 'maint internal-error [MESSAGE-TEXT]'
  33594. 'maint internal-warning [MESSAGE-TEXT]'
  33595. 'maint demangler-warning [MESSAGE-TEXT]'
  33596. Cause GDB to call the internal function 'internal_error',
  33597. 'internal_warning' or 'demangler_warning' and hence behave as
  33598. though an internal problem has been detected. In addition to
  33599. reporting the internal problem, these functions give the user the
  33600. opportunity to either quit GDB or (for 'internal_error' and
  33601. 'internal_warning') create a core file of the current GDB session.
  33602. These commands take an optional parameter MESSAGE-TEXT that is used
  33603. as the text of the error or warning message.
  33604. Here's an example of using 'internal-error':
  33605. (gdb) maint internal-error testing, 1, 2
  33606. .../maint.c:121: internal-error: testing, 1, 2
  33607. A problem internal to GDB has been detected. Further
  33608. debugging may prove unreliable.
  33609. Quit this debugging session? (y or n) n
  33610. Create a core file? (y or n) n
  33611. (gdb)
  33612. 'maint set internal-error ACTION [ask|yes|no]'
  33613. 'maint show internal-error ACTION'
  33614. 'maint set internal-warning ACTION [ask|yes|no]'
  33615. 'maint show internal-warning ACTION'
  33616. 'maint set demangler-warning ACTION [ask|yes|no]'
  33617. 'maint show demangler-warning ACTION'
  33618. When GDB reports an internal problem (error or warning) it gives
  33619. the user the opportunity to both quit GDB and create a core file of
  33620. the current GDB session. These commands let you override the
  33621. default behaviour for each particular ACTION, described in the
  33622. table below.
  33623. 'quit'
  33624. You can specify that GDB should always (yes) or never (no)
  33625. quit. The default is to ask the user what to do.
  33626. 'corefile'
  33627. You can specify that GDB should always (yes) or never (no)
  33628. create a core file. The default is to ask the user what to
  33629. do. Note that there is no 'corefile' option for
  33630. 'demangler-warning': demangler warnings always create a core
  33631. file and this cannot be disabled.
  33632. 'maint packet TEXT'
  33633. If GDB is talking to an inferior via the serial protocol, then this
  33634. command sends the string TEXT to the inferior, and displays the
  33635. response packet. GDB supplies the initial '$' character, the
  33636. terminating '#' character, and the checksum.
  33637. 'maint print architecture [FILE]'
  33638. Print the entire architecture configuration. The optional argument
  33639. FILE names the file where the output goes.
  33640. 'maint print c-tdesc'
  33641. Print the target description (*note Target Descriptions::) as a C
  33642. source file. By default, the target description is for the current
  33643. target, but if the optional argument FILE is provided, that file is
  33644. used to produce the description. The FILE should be an XML
  33645. document, of the form described in *note Target Description
  33646. Format::. The created source file is built into GDB when GDB is
  33647. built again. This command is used by developers after they add or
  33648. modify XML target descriptions.
  33649. 'maint check xml-descriptions DIR'
  33650. Check that the target descriptions dynamically created by GDB equal
  33651. the descriptions created from XML files found in DIR.
  33652. 'maint check libthread-db'
  33653. Run integrity checks on the current inferior's thread debugging
  33654. library. This exercises all 'libthread_db' functionality used by
  33655. GDB on GNU/Linux systems, and by extension also exercises the
  33656. 'proc_service' functions provided by GDB that 'libthread_db' uses.
  33657. Note that parts of the test may be skipped on some platforms when
  33658. debugging core files.
  33659. 'maint print dummy-frames'
  33660. Prints the contents of GDB's internal dummy-frame stack.
  33661. (gdb) b add
  33662. ...
  33663. (gdb) print add(2,3)
  33664. Breakpoint 2, add (a=2, b=3) at ...
  33665. 58 return (a + b);
  33666. The program being debugged stopped while in a function called from GDB.
  33667. ...
  33668. (gdb) maint print dummy-frames
  33669. 0xa8206d8: id={stack=0xbfffe734,code=0xbfffe73f,!special}, ptid=process 9353
  33670. (gdb)
  33671. Takes an optional file parameter.
  33672. 'maint print registers [FILE]'
  33673. 'maint print raw-registers [FILE]'
  33674. 'maint print cooked-registers [FILE]'
  33675. 'maint print register-groups [FILE]'
  33676. 'maint print remote-registers [FILE]'
  33677. Print GDB's internal register data structures.
  33678. The command 'maint print raw-registers' includes the contents of
  33679. the raw register cache; the command 'maint print cooked-registers'
  33680. includes the (cooked) value of all registers, including registers
  33681. which aren't available on the target nor visible to user; the
  33682. command 'maint print register-groups' includes the groups that each
  33683. register is a member of; and the command 'maint print
  33684. remote-registers' includes the remote target's register numbers and
  33685. offsets in the 'G' packets.
  33686. These commands take an optional parameter, a file name to which to
  33687. write the information.
  33688. 'maint print reggroups [FILE]'
  33689. Print GDB's internal register group data structures. The optional
  33690. argument FILE tells to what file to write the information.
  33691. The register groups info looks like this:
  33692. (gdb) maint print reggroups
  33693. Group Type
  33694. general user
  33695. float user
  33696. all user
  33697. vector user
  33698. system user
  33699. save internal
  33700. restore internal
  33701. 'flushregs'
  33702. This command forces GDB to flush its internal register cache.
  33703. 'maint print objfiles [REGEXP]'
  33704. Print a dump of all known object files. If REGEXP is specified,
  33705. only print object files whose names match REGEXP. For each object
  33706. file, this command prints its name, address in memory, and all of
  33707. its psymtabs and symtabs.
  33708. 'maint print user-registers'
  33709. List all currently available "user registers". User registers
  33710. typically provide alternate names for actual hardware registers.
  33711. They include the four "standard" registers '$fp', '$pc', '$sp', and
  33712. '$ps'. *Note standard registers::. User registers can be used in
  33713. expressions in the same way as the canonical register names, but
  33714. only the latter are listed by the 'info registers' and 'maint print
  33715. registers' commands.
  33716. 'maint print section-scripts [REGEXP]'
  33717. Print a dump of scripts specified in the '.debug_gdb_section'
  33718. section. If REGEXP is specified, only print scripts loaded by
  33719. object files matching REGEXP. For each script, this command prints
  33720. its name as specified in the objfile, and the full path if known.
  33721. *Note dotdebug_gdb_scripts section::.
  33722. 'maint print statistics'
  33723. This command prints, for each object file in the program, various
  33724. data about that object file followed by the byte cache ("bcache")
  33725. statistics for the object file. The objfile data includes the
  33726. number of minimal, partial, full, and stabs symbols, the number of
  33727. types defined by the objfile, the number of as yet unexpanded psym
  33728. tables, the number of line tables and string tables, and the amount
  33729. of memory used by the various tables. The bcache statistics
  33730. include the counts, sizes, and counts of duplicates of all and
  33731. unique objects, max, average, and median entry size, total memory
  33732. used and its overhead and savings, and various measures of the hash
  33733. table size and chain lengths.
  33734. 'maint print target-stack'
  33735. A "target" is an interface between the debugger and a particular
  33736. kind of file or process. Targets can be stacked in "strata", so
  33737. that more than one target can potentially respond to a request. In
  33738. particular, memory accesses will walk down the stack of targets
  33739. until they find a target that is interested in handling that
  33740. particular address.
  33741. This command prints a short description of each layer that was
  33742. pushed on the "target stack", starting from the top layer down to
  33743. the bottom one.
  33744. 'maint print type EXPR'
  33745. Print the type chain for a type specified by EXPR. The argument
  33746. can be either a type name or a symbol. If it is a symbol, the type
  33747. of that symbol is described. The type chain produced by this
  33748. command is a recursive definition of the data type as stored in
  33749. GDB's data structures, including its flags and contained types.
  33750. 'maint selftest [FILTER]'
  33751. Run any self tests that were compiled in to GDB. This will print a
  33752. message showing how many tests were run, and how many failed. If a
  33753. FILTER is passed, only the tests with FILTER in their name will by
  33754. ran.
  33755. 'maint info selftests'
  33756. List the selftests compiled in to GDB.
  33757. 'maint set dwarf always-disassemble'
  33758. 'maint show dwarf always-disassemble'
  33759. Control the behavior of 'info address' when using DWARF debugging
  33760. information.
  33761. The default is 'off', which means that GDB should try to describe a
  33762. variable's location in an easily readable format. When 'on', GDB
  33763. will instead display the DWARF location expression in an
  33764. assembly-like format. Note that some locations are too complex for
  33765. GDB to describe simply; in this case you will always see the
  33766. disassembly form.
  33767. Here is an example of the resulting disassembly:
  33768. (gdb) info addr argc
  33769. Symbol "argc" is a complex DWARF expression:
  33770. 1: DW_OP_fbreg 0
  33771. For more information on these expressions, see the DWARF standard
  33772. (http://www.dwarfstd.org/).
  33773. 'maint set dwarf max-cache-age'
  33774. 'maint show dwarf max-cache-age'
  33775. Control the DWARF compilation unit cache.
  33776. In object files with inter-compilation-unit references, such as
  33777. those produced by the GCC option '-feliminate-dwarf2-dups', the
  33778. DWARF reader needs to frequently refer to previously read
  33779. compilation units. This setting controls how long a compilation
  33780. unit will remain in the cache if it is not referenced. A higher
  33781. limit means that cached compilation units will be stored in memory
  33782. longer, and more total memory will be used. Setting it to zero
  33783. disables caching, which will slow down GDB startup, but reduce
  33784. memory consumption.
  33785. 'maint set dwarf unwinders'
  33786. 'maint show dwarf unwinders'
  33787. Control use of the DWARF frame unwinders.
  33788. Many targets that support DWARF debugging use GDB's DWARF frame
  33789. unwinders to build the backtrace. Many of these targets will also
  33790. have a second mechanism for building the backtrace for use in cases
  33791. where DWARF information is not available, this second mechanism is
  33792. often an analysis of a function's prologue.
  33793. In order to extend testing coverage of the second level stack
  33794. unwinding mechanisms it is helpful to be able to disable the DWARF
  33795. stack unwinders, this can be done with this switch.
  33796. In normal use of GDB disabling the DWARF unwinders is not
  33797. advisable, there are cases that are better handled through DWARF
  33798. than prologue analysis, and the debug experience is likely to be
  33799. better with the DWARF frame unwinders enabled.
  33800. If DWARF frame unwinders are not supported for a particular target
  33801. architecture, then enabling this flag does not cause them to be
  33802. used.
  33803. 'maint set worker-threads'
  33804. 'maint show worker-threads'
  33805. Control the number of worker threads that may be used by GDB. On
  33806. capable hosts, GDB may use multiple threads to speed up certain
  33807. CPU-intensive operations, such as demangling symbol names. While
  33808. the number of threads used by GDB may vary, this command can be
  33809. used to set an upper bound on this number. The default is '0'
  33810. (disabled). A value of 'unlimited' lets GDB choose a reasonable
  33811. number. Note that this only controls worker threads started by GDB
  33812. itself; libraries used by GDB may start threads of their own.
  33813. 'maint set profile'
  33814. 'maint show profile'
  33815. Control profiling of GDB.
  33816. Profiling will be disabled until you use the 'maint set profile'
  33817. command to enable it. When you enable profiling, the system will
  33818. begin collecting timing and execution count data; when you disable
  33819. profiling or exit GDB, the results will be written to a log file.
  33820. Remember that if you use profiling, GDB will overwrite the
  33821. profiling log file (often called 'gmon.out'). If you have a record
  33822. of important profiling data in a 'gmon.out' file, be sure to move
  33823. it to a safe location.
  33824. Configuring with '--enable-profiling' arranges for GDB to be
  33825. compiled with the '-pg' compiler option.
  33826. 'maint set show-debug-regs'
  33827. 'maint show show-debug-regs'
  33828. Control whether to show variables that mirror the hardware debug
  33829. registers. Use 'on' to enable, 'off' to disable. If enabled, the
  33830. debug registers values are shown when GDB inserts or removes a
  33831. hardware breakpoint or watchpoint, and when the inferior triggers a
  33832. hardware-assisted breakpoint or watchpoint.
  33833. 'maint set show-all-tib'
  33834. 'maint show show-all-tib'
  33835. Control whether to show all non zero areas within a 1k block
  33836. starting at thread local base, when using the 'info w32
  33837. thread-information-block' command.
  33838. 'maint set target-async'
  33839. 'maint show target-async'
  33840. This controls whether GDB targets operate in synchronous or
  33841. asynchronous mode (*note Background Execution::). Normally the
  33842. default is asynchronous, if it is available; but this can be
  33843. changed to more easily debug problems occurring only in synchronous
  33844. mode.
  33845. 'maint set target-non-stop'
  33846. 'maint show target-non-stop'
  33847. This controls whether GDB targets always operate in non-stop mode
  33848. even if 'set non-stop' is 'off' (*note Non-Stop Mode::). The
  33849. default is 'auto', meaning non-stop mode is enabled if supported by
  33850. the target.
  33851. 'maint set target-non-stop auto'
  33852. This is the default mode. GDB controls the target in non-stop
  33853. mode if the target supports it.
  33854. 'maint set target-non-stop on'
  33855. GDB controls the target in non-stop mode even if the target
  33856. does not indicate support.
  33857. 'maint set target-non-stop off'
  33858. GDB does not control the target in non-stop mode even if the
  33859. target supports it.
  33860. 'maint set tui-resize-message'
  33861. 'maint show tui-resize-message'
  33862. Control whether GDB displays a message each time the terminal is
  33863. resized when in TUI mode. The default is 'off', which means that
  33864. GDB is silent during resizes. When 'on', GDB will display a
  33865. message after a resize is completed; the message will include a
  33866. number indicating how many times the terminal has been resized.
  33867. This setting is intended for use by the test suite, where it would
  33868. otherwise be difficult to determine when a resize and refresh has
  33869. been completed.
  33870. 'maint set per-command'
  33871. 'maint show per-command'
  33872. GDB can display the resources used by each command. This is useful
  33873. in debugging performance problems.
  33874. 'maint set per-command space [on|off]'
  33875. 'maint show per-command space'
  33876. Enable or disable the printing of the memory used by GDB for
  33877. each command. If enabled, GDB will display how much memory
  33878. each command took, following the command's own output. This
  33879. can also be requested by invoking GDB with the '--statistics'
  33880. command-line switch (*note Mode Options::).
  33881. 'maint set per-command time [on|off]'
  33882. 'maint show per-command time'
  33883. Enable or disable the printing of the execution time of GDB
  33884. for each command. If enabled, GDB will display how much time
  33885. it took to execute each command, following the command's own
  33886. output. Both CPU time and wallclock time are printed.
  33887. Printing both is useful when trying to determine whether the
  33888. cost is CPU or, e.g., disk/network latency. Note that the CPU
  33889. time printed is for GDB only, it does not include the
  33890. execution time of the inferior because there's no mechanism
  33891. currently to compute how much time was spent by GDB and how
  33892. much time was spent by the program been debugged. This can
  33893. also be requested by invoking GDB with the '--statistics'
  33894. command-line switch (*note Mode Options::).
  33895. 'maint set per-command symtab [on|off]'
  33896. 'maint show per-command symtab'
  33897. Enable or disable the printing of basic symbol table
  33898. statistics for each command. If enabled, GDB will display the
  33899. following information:
  33900. a. number of symbol tables
  33901. b. number of primary symbol tables
  33902. c. number of blocks in the blockvector
  33903. 'maint set check-libthread-db [on|off]'
  33904. 'maint show check-libthread-db'
  33905. Control whether GDB should run integrity checks on inferior
  33906. specific thread debugging libraries as they are loaded. The
  33907. default is not to perform such checks. If any check fails GDB will
  33908. unload the library and continue searching for a suitable candidate
  33909. as described in *note set libthread-db-search-path::. For more
  33910. information about the tests, see *note maint check libthread-db::.
  33911. 'maint space VALUE'
  33912. An alias for 'maint set per-command space'. A non-zero value
  33913. enables it, zero disables it.
  33914. 'maint time VALUE'
  33915. An alias for 'maint set per-command time'. A non-zero value
  33916. enables it, zero disables it.
  33917. 'maint translate-address [SECTION] ADDR'
  33918. Find the symbol stored at the location specified by the address
  33919. ADDR and an optional section name SECTION. If found, GDB prints
  33920. the name of the closest symbol and an offset from the symbol's
  33921. location to the specified address. This is similar to the 'info
  33922. address' command (*note Symbols::), except that this command also
  33923. allows to find symbols in other sections.
  33924. If section was not specified, the section in which the symbol was
  33925. found is also printed. For dynamically linked executables, the
  33926. name of executable or shared library containing the symbol is
  33927. printed as well.
  33928. 'maint test-options require-delimiter'
  33929. 'maint test-options unknown-is-error'
  33930. 'maint test-options unknown-is-operand'
  33931. These commands are used by the testsuite to validate the command
  33932. options framework. The 'require-delimiter' variant requires a
  33933. double-dash delimiter to indicate end of options. The
  33934. 'unknown-is-error' and 'unknown-is-operand' do not. The
  33935. 'unknown-is-error' variant throws an error on unknown option, while
  33936. 'unknown-is-operand' treats unknown options as the start of the
  33937. command's operands. When run, the commands output the result of
  33938. the processed options. When completed, the commands store the
  33939. internal result of completion in a variable exposed by the 'maint
  33940. show test-options-completion-result' command.
  33941. 'maint show test-options-completion-result'
  33942. Shows the result of completing the 'maint test-options'
  33943. subcommands. This is used by the testsuite to validate completion
  33944. support in the command options framework.
  33945. 'maint set test-settings KIND'
  33946. 'maint show test-settings KIND'
  33947. These are representative commands for each KIND of setting type GDB
  33948. supports. They are used by the testsuite for exercising the
  33949. settings infrastructure.
  33950. 'maint with SETTING [VALUE] [-- COMMAND]'
  33951. Like the 'with' command, but works with 'maintenance set'
  33952. variables. This is used by the testsuite to exercise the 'with'
  33953. command's infrastructure.
  33954. The following command is useful for non-interactive invocations of
  33955. GDB, such as in the test suite.
  33956. 'set watchdog NSEC'
  33957. Set the maximum number of seconds GDB will wait for the target
  33958. operation to finish. If this time expires, GDB reports and error
  33959. and the command is aborted.
  33960. 'show watchdog'
  33961. Show the current setting of the target wait timeout.
  33962. 
  33963. File: gdb.info, Node: Remote Protocol, Next: Agent Expressions, Prev: Maintenance Commands, Up: Top
  33964. Appendix E GDB Remote Serial Protocol
  33965. *************************************
  33966. * Menu:
  33967. * Overview::
  33968. * Packets::
  33969. * Stop Reply Packets::
  33970. * General Query Packets::
  33971. * Architecture-Specific Protocol Details::
  33972. * Tracepoint Packets::
  33973. * Host I/O Packets::
  33974. * Interrupts::
  33975. * Notification Packets::
  33976. * Remote Non-Stop::
  33977. * Packet Acknowledgment::
  33978. * Examples::
  33979. * File-I/O Remote Protocol Extension::
  33980. * Library List Format::
  33981. * Library List Format for SVR4 Targets::
  33982. * Memory Map Format::
  33983. * Thread List Format::
  33984. * Traceframe Info Format::
  33985. * Branch Trace Format::
  33986. * Branch Trace Configuration Format::
  33987. 
  33988. File: gdb.info, Node: Overview, Next: Packets, Up: Remote Protocol
  33989. E.1 Overview
  33990. ============
  33991. There may be occasions when you need to know something about the
  33992. protocol--for example, if there is only one serial port to your target
  33993. machine, you might want your program to do something special if it
  33994. recognizes a packet meant for GDB.
  33995. In the examples below, '->' and '<-' are used to indicate transmitted
  33996. and received data, respectively.
  33997. All GDB commands and responses (other than acknowledgments and
  33998. notifications, see *note Notification Packets::) are sent as a PACKET.
  33999. A PACKET is introduced with the character '$', the actual PACKET-DATA,
  34000. and the terminating character '#' followed by a two-digit CHECKSUM:
  34001. $PACKET-DATA#CHECKSUM
  34002. The two-digit CHECKSUM is computed as the modulo 256 sum of all
  34003. characters between the leading '$' and the trailing '#' (an eight bit
  34004. unsigned checksum).
  34005. Implementors should note that prior to GDB 5.0 the protocol
  34006. specification also included an optional two-digit SEQUENCE-ID:
  34007. $SEQUENCE-ID:PACKET-DATA#CHECKSUM
  34008. That SEQUENCE-ID was appended to the acknowledgment. GDB has never
  34009. output SEQUENCE-IDs. Stubs that handle packets added since GDB 5.0 must
  34010. not accept SEQUENCE-ID.
  34011. When either the host or the target machine receives a packet, the
  34012. first response expected is an acknowledgment: either '+' (to indicate
  34013. the package was received correctly) or '-' (to request retransmission):
  34014. -> $PACKET-DATA#CHECKSUM
  34015. <- +
  34016. The '+'/'-' acknowledgments can be disabled once a connection is
  34017. established. *Note Packet Acknowledgment::, for details.
  34018. The host (GDB) sends COMMANDs, and the target (the debugging stub
  34019. incorporated in your program) sends a RESPONSE. In the case of step and
  34020. continue COMMANDs, the response is only sent when the operation has
  34021. completed, and the target has again stopped all threads in all attached
  34022. processes. This is the default all-stop mode behavior, but the remote
  34023. protocol also supports GDB's non-stop execution mode; see *note Remote
  34024. Non-Stop::, for details.
  34025. PACKET-DATA consists of a sequence of characters with the exception
  34026. of '#' and '$' (see 'X' packet for additional exceptions).
  34027. Fields within the packet should be separated using ',' ';' or ':'.
  34028. Except where otherwise noted all numbers are represented in HEX with
  34029. leading zeros suppressed.
  34030. Implementors should note that prior to GDB 5.0, the character ':'
  34031. could not appear as the third character in a packet (as it would
  34032. potentially conflict with the SEQUENCE-ID).
  34033. Binary data in most packets is encoded either as two hexadecimal
  34034. digits per byte of binary data. This allowed the traditional remote
  34035. protocol to work over connections which were only seven-bit clean. Some
  34036. packets designed more recently assume an eight-bit clean connection, and
  34037. use a more efficient encoding to send and receive binary data.
  34038. The binary data representation uses '7d' (ASCII '}') as an escape
  34039. character. Any escaped byte is transmitted as the escape character
  34040. followed by the original character XORed with '0x20'. For example, the
  34041. byte '0x7d' would be transmitted as the two bytes '0x7d 0x5d'. The
  34042. bytes '0x23' (ASCII '#'), '0x24' (ASCII '$'), and '0x7d' (ASCII '}')
  34043. must always be escaped. Responses sent by the stub must also escape
  34044. '0x2a' (ASCII '*'), so that it is not interpreted as the start of a
  34045. run-length encoded sequence (described next).
  34046. Response DATA can be run-length encoded to save space. Run-length
  34047. encoding replaces runs of identical characters with one instance of the
  34048. repeated character, followed by a '*' and a repeat count. The repeat
  34049. count is itself sent encoded, to avoid binary characters in DATA: a
  34050. value of N is sent as 'N+29'. For a repeat count greater or equal to 3,
  34051. this produces a printable ASCII character, e.g. a space (ASCII code 32)
  34052. for a repeat count of 3. (This is because run-length encoding starts to
  34053. win for counts 3 or more.) Thus, for example, '0* ' is a run-length
  34054. encoding of "0000": the space character after '*' means repeat the
  34055. leading '0' '32 - 29 = 3' more times.
  34056. The printable characters '#' and '$' or with a numeric value greater
  34057. than 126 must not be used. Runs of six repeats ('#') or seven repeats
  34058. ('$') can be expanded using a repeat count of only five ('"'). For
  34059. example, '00000000' can be encoded as '0*"00'.
  34060. The error response returned for some packets includes a two character
  34061. error number. That number is not well defined.
  34062. For any COMMAND not supported by the stub, an empty response ('$#00')
  34063. should be returned. That way it is possible to extend the protocol. A
  34064. newer GDB can tell if a packet is supported based on that response.
  34065. At a minimum, a stub is required to support the 'g' and 'G' commands
  34066. for register access, and the 'm' and 'M' commands for memory access.
  34067. Stubs that only control single-threaded targets can implement run
  34068. control with the 'c' (continue), and 's' (step) commands. Stubs that
  34069. support multi-threading targets should support the 'vCont' command. All
  34070. other commands are optional.
  34071. 
  34072. File: gdb.info, Node: Packets, Next: Stop Reply Packets, Prev: Overview, Up: Remote Protocol
  34073. E.2 Packets
  34074. ===========
  34075. The following table provides a complete list of all currently defined
  34076. COMMANDs and their corresponding response DATA. *Note File-I/O Remote
  34077. Protocol Extension::, for details about the File I/O extension of the
  34078. remote protocol.
  34079. Each packet's description has a template showing the packet's overall
  34080. syntax, followed by an explanation of the packet's meaning. We include
  34081. spaces in some of the templates for clarity; these are not part of the
  34082. packet's syntax. No GDB packet uses spaces to separate its components.
  34083. For example, a template like 'foo BAR BAZ' describes a packet beginning
  34084. with the three ASCII bytes 'foo', followed by a BAR, followed directly
  34085. by a BAZ. GDB does not transmit a space character between the 'foo' and
  34086. the BAR, or between the BAR and the BAZ.
  34087. Several packets and replies include a THREAD-ID field to identify a
  34088. thread. Normally these are positive numbers with a target-specific
  34089. interpretation, formatted as big-endian hex strings. A THREAD-ID can
  34090. also be a literal '-1' to indicate all threads, or '0' to pick any
  34091. thread.
  34092. In addition, the remote protocol supports a multiprocess feature in
  34093. which the THREAD-ID syntax is extended to optionally include both
  34094. process and thread ID fields, as 'pPID.TID'. The PID (process) and TID
  34095. (thread) components each have the format described above: a positive
  34096. number with target-specific interpretation formatted as a big-endian hex
  34097. string, literal '-1' to indicate all processes or threads
  34098. (respectively), or '0' to indicate an arbitrary process or thread.
  34099. Specifying just a process, as 'pPID', is equivalent to 'pPID.-1'. It is
  34100. an error to specify all processes but a specific thread, such as
  34101. 'p-1.TID'. Note that the 'p' prefix is _not_ used for those packets and
  34102. replies explicitly documented to include a process ID, rather than a
  34103. THREAD-ID.
  34104. The multiprocess THREAD-ID syntax extensions are only used if both
  34105. GDB and the stub report support for the 'multiprocess' feature using
  34106. 'qSupported'. *Note multiprocess extensions::, for more information.
  34107. Note that all packet forms beginning with an upper- or lower-case
  34108. letter, other than those described here, are reserved for future use.
  34109. Here are the packet descriptions.
  34110. '!'
  34111. Enable extended mode. In extended mode, the remote server is made
  34112. persistent. The 'R' packet is used to restart the program being
  34113. debugged.
  34114. Reply:
  34115. 'OK'
  34116. The remote target both supports and has enabled extended mode.
  34117. '?'
  34118. Indicate the reason the target halted. The reply is the same as
  34119. for step and continue. This packet has a special interpretation
  34120. when the target is in non-stop mode; see *note Remote Non-Stop::.
  34121. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34122. 'A ARGLEN,ARGNUM,ARG,...'
  34123. Initialized 'argv[]' array passed into program. ARGLEN specifies
  34124. the number of bytes in the hex encoded byte stream ARG. See
  34125. 'gdbserver' for more details.
  34126. Reply:
  34127. 'OK'
  34128. The arguments were set.
  34129. 'E NN'
  34130. An error occurred.
  34131. 'b BAUD'
  34132. (Don't use this packet; its behavior is not well-defined.) Change
  34133. the serial line speed to BAUD.
  34134. JTC: _When does the transport layer state change? When it's
  34135. received, or after the ACK is transmitted. In either case, there
  34136. are problems if the command or the acknowledgment packet is
  34137. dropped._
  34138. Stan: _If people really wanted to add something like this, and get
  34139. it working for the first time, they ought to modify ser-unix.c to
  34140. send some kind of out-of-band message to a specially-setup stub and
  34141. have the switch happen "in between" packets, so that from remote
  34142. protocol's point of view, nothing actually happened._
  34143. 'B ADDR,MODE'
  34144. Set (MODE is 'S') or clear (MODE is 'C') a breakpoint at ADDR.
  34145. Don't use this packet. Use the 'Z' and 'z' packets instead (*note
  34146. insert breakpoint or watchpoint packet::).
  34147. 'bc'
  34148. Backward continue. Execute the target system in reverse. No
  34149. parameter. *Note Reverse Execution::, for more information.
  34150. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34151. 'bs'
  34152. Backward single step. Execute one instruction in reverse. No
  34153. parameter. *Note Reverse Execution::, for more information.
  34154. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34155. 'c [ADDR]'
  34156. Continue at ADDR, which is the address to resume. If ADDR is
  34157. omitted, resume at current address.
  34158. This packet is deprecated for multi-threading support. *Note vCont
  34159. packet::.
  34160. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34161. 'C SIG[;ADDR]'
  34162. Continue with signal SIG (hex signal number). If ';ADDR' is
  34163. omitted, resume at same address.
  34164. This packet is deprecated for multi-threading support. *Note vCont
  34165. packet::.
  34166. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34167. 'd'
  34168. Toggle debug flag.
  34169. Don't use this packet; instead, define a general set packet (*note
  34170. General Query Packets::).
  34171. 'D'
  34172. 'D;PID'
  34173. The first form of the packet is used to detach GDB from the remote
  34174. system. It is sent to the remote target before GDB disconnects via
  34175. the 'detach' command.
  34176. The second form, including a process ID, is used when multiprocess
  34177. protocol extensions are enabled (*note multiprocess extensions::),
  34178. to detach only a specific process. The PID is specified as a
  34179. big-endian hex string.
  34180. Reply:
  34181. 'OK'
  34182. for success
  34183. 'E NN'
  34184. for an error
  34185. 'F RC,EE,CF;XX'
  34186. A reply from GDB to an 'F' packet sent by the target. This is part
  34187. of the File-I/O protocol extension. *Note File-I/O Remote Protocol
  34188. Extension::, for the specification.
  34189. 'g'
  34190. Read general registers.
  34191. Reply:
  34192. 'XX...'
  34193. Each byte of register data is described by two hex digits.
  34194. The bytes with the register are transmitted in target byte
  34195. order. The size of each register and their position within
  34196. the 'g' packet are determined by the GDB internal gdbarch
  34197. functions 'DEPRECATED_REGISTER_RAW_SIZE' and
  34198. 'gdbarch_register_name'.
  34199. When reading registers from a trace frame (*note Using the
  34200. Collected Data: Analyze Collected Data.), the stub may also
  34201. return a string of literal 'x''s in place of the register data
  34202. digits, to indicate that the corresponding register has not
  34203. been collected, thus its value is unavailable. For example,
  34204. for an architecture with 4 registers of 4 bytes each, the
  34205. following reply indicates to GDB that registers 0 and 2 have
  34206. not been collected, while registers 1 and 3 have been
  34207. collected, and both have zero value:
  34208. -> g
  34209. <- xxxxxxxx00000000xxxxxxxx00000000
  34210. 'E NN'
  34211. for an error.
  34212. 'G XX...'
  34213. Write general registers. *Note read registers packet::, for a
  34214. description of the XX... data.
  34215. Reply:
  34216. 'OK'
  34217. for success
  34218. 'E NN'
  34219. for an error
  34220. 'H OP THREAD-ID'
  34221. Set thread for subsequent operations ('m', 'M', 'g', 'G', et.al.).
  34222. Depending on the operation to be performed, OP should be 'c' for
  34223. step and continue operations (note that this is deprecated,
  34224. supporting the 'vCont' command is a better option), and 'g' for
  34225. other operations. The thread designator THREAD-ID has the format
  34226. and interpretation described in *note thread-id syntax::.
  34227. Reply:
  34228. 'OK'
  34229. for success
  34230. 'E NN'
  34231. for an error
  34232. 'i [ADDR[,NNN]]'
  34233. Step the remote target by a single clock cycle. If ',NNN' is
  34234. present, cycle step NNN cycles. If ADDR is present, cycle step
  34235. starting at that address.
  34236. 'I'
  34237. Signal, then cycle step. *Note step with signal packet::. *Note
  34238. cycle step packet::.
  34239. 'k'
  34240. Kill request.
  34241. The exact effect of this packet is not specified.
  34242. For a bare-metal target, it may power cycle or reset the target
  34243. system. For that reason, the 'k' packet has no reply.
  34244. For a single-process target, it may kill that process if possible.
  34245. A multiple-process target may choose to kill just one process, or
  34246. all that are under GDB's control. For more precise control, use
  34247. the vKill packet (*note vKill packet::).
  34248. If the target system immediately closes the connection in response
  34249. to 'k', GDB does not consider the lack of packet acknowledgment to
  34250. be an error, and assumes the kill was successful.
  34251. If connected using 'target extended-remote', and the target does
  34252. not close the connection in response to a kill request, GDB probes
  34253. the target state as if a new connection was opened (*note ?
  34254. packet::).
  34255. 'm ADDR,LENGTH'
  34256. Read LENGTH addressable memory units starting at address ADDR
  34257. (*note addressable memory unit::). Note that ADDR may not be
  34258. aligned to any particular boundary.
  34259. The stub need not use any particular size or alignment when
  34260. gathering data from memory for the response; even if ADDR is
  34261. word-aligned and LENGTH is a multiple of the word size, the stub is
  34262. free to use byte accesses, or not. For this reason, this packet
  34263. may not be suitable for accessing memory-mapped I/O devices.
  34264. Reply:
  34265. 'XX...'
  34266. Memory contents; each byte is transmitted as a two-digit
  34267. hexadecimal number. The reply may contain fewer addressable
  34268. memory units than requested if the server was able to read
  34269. only part of the region of memory.
  34270. 'E NN'
  34271. NN is errno
  34272. 'M ADDR,LENGTH:XX...'
  34273. Write LENGTH addressable memory units starting at address ADDR
  34274. (*note addressable memory unit::). The data is given by XX...;
  34275. each byte is transmitted as a two-digit hexadecimal number.
  34276. Reply:
  34277. 'OK'
  34278. for success
  34279. 'E NN'
  34280. for an error (this includes the case where only part of the
  34281. data was written).
  34282. 'p N'
  34283. Read the value of register N; N is in hex. *Note read registers
  34284. packet::, for a description of how the returned register value is
  34285. encoded.
  34286. Reply:
  34287. 'XX...'
  34288. the register's value
  34289. 'E NN'
  34290. for an error
  34291. ''
  34292. Indicating an unrecognized QUERY.
  34293. 'P N...=R...'
  34294. Write register N... with value R.... The register number N is in
  34295. hexadecimal, and R... contains two hex digits for each byte in the
  34296. register (target byte order).
  34297. Reply:
  34298. 'OK'
  34299. for success
  34300. 'E NN'
  34301. for an error
  34302. 'q NAME PARAMS...'
  34303. 'Q NAME PARAMS...'
  34304. General query ('q') and set ('Q'). These packets are described
  34305. fully in *note General Query Packets::.
  34306. 'r'
  34307. Reset the entire system.
  34308. Don't use this packet; use the 'R' packet instead.
  34309. 'R XX'
  34310. Restart the program being debugged. The XX, while needed, is
  34311. ignored. This packet is only available in extended mode (*note
  34312. extended mode::).
  34313. The 'R' packet has no reply.
  34314. 's [ADDR]'
  34315. Single step, resuming at ADDR. If ADDR is omitted, resume at same
  34316. address.
  34317. This packet is deprecated for multi-threading support. *Note vCont
  34318. packet::.
  34319. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34320. 'S SIG[;ADDR]'
  34321. Step with signal. This is analogous to the 'C' packet, but
  34322. requests a single-step, rather than a normal resumption of
  34323. execution.
  34324. This packet is deprecated for multi-threading support. *Note vCont
  34325. packet::.
  34326. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34327. 't ADDR:PP,MM'
  34328. Search backwards starting at address ADDR for a match with pattern
  34329. PP and mask MM, both of which are are 4 byte long. There must be
  34330. at least 3 digits in ADDR.
  34331. 'T THREAD-ID'
  34332. Find out if the thread THREAD-ID is alive. *Note thread-id
  34333. syntax::.
  34334. Reply:
  34335. 'OK'
  34336. thread is still alive
  34337. 'E NN'
  34338. thread is dead
  34339. 'v'
  34340. Packets starting with 'v' are identified by a multi-letter name, up
  34341. to the first ';' or '?' (or the end of the packet).
  34342. 'vAttach;PID'
  34343. Attach to a new process with the specified process ID PID. The
  34344. process ID is a hexadecimal integer identifying the process. In
  34345. all-stop mode, all threads in the attached process are stopped; in
  34346. non-stop mode, it may be attached without being stopped if that is
  34347. supported by the target.
  34348. This packet is only available in extended mode (*note extended
  34349. mode::).
  34350. Reply:
  34351. 'E NN'
  34352. for an error
  34353. 'Any stop packet'
  34354. for success in all-stop mode (*note Stop Reply Packets::)
  34355. 'OK'
  34356. for success in non-stop mode (*note Remote Non-Stop::)
  34357. 'vCont[;ACTION[:THREAD-ID]]...'
  34358. Resume the inferior, specifying different actions for each thread.
  34359. For each inferior thread, the leftmost action with a matching
  34360. THREAD-ID is applied. Threads that don't match any action remain
  34361. in their current state. Thread IDs are specified using the syntax
  34362. described in *note thread-id syntax::. If multiprocess extensions
  34363. (*note multiprocess extensions::) are supported, actions can be
  34364. specified to match all threads in a process by using the 'pPID.-1'
  34365. form of the THREAD-ID. An action with no THREAD-ID matches all
  34366. threads. Specifying no actions is an error.
  34367. Currently supported actions are:
  34368. 'c'
  34369. Continue.
  34370. 'C SIG'
  34371. Continue with signal SIG. The signal SIG should be two hex
  34372. digits.
  34373. 's'
  34374. Step.
  34375. 'S SIG'
  34376. Step with signal SIG. The signal SIG should be two hex
  34377. digits.
  34378. 't'
  34379. Stop.
  34380. 'r START,END'
  34381. Step once, and then keep stepping as long as the thread stops
  34382. at addresses between START (inclusive) and END (exclusive).
  34383. The remote stub reports a stop reply when either the thread
  34384. goes out of the range or is stopped due to an unrelated
  34385. reason, such as hitting a breakpoint. *Note range stepping::.
  34386. If the range is empty (START == END), then the action becomes
  34387. equivalent to the 's' action. In other words, single-step
  34388. once, and report the stop (even if the stepped instruction
  34389. jumps to START).
  34390. (A stop reply may be sent at any point even if the PC is still
  34391. within the stepping range; for example, it is valid to
  34392. implement this packet in a degenerate way as a single
  34393. instruction step operation.)
  34394. The optional argument ADDR normally associated with the 'c', 'C',
  34395. 's', and 'S' packets is not supported in 'vCont'.
  34396. The 't' action is only relevant in non-stop mode (*note Remote
  34397. Non-Stop::) and may be ignored by the stub otherwise. A stop reply
  34398. should be generated for any affected thread not already stopped.
  34399. When a thread is stopped by means of a 't' action, the
  34400. corresponding stop reply should indicate that the thread has
  34401. stopped with signal '0', regardless of whether the target uses some
  34402. other signal as an implementation detail.
  34403. The server must ignore 'c', 'C', 's', 'S', and 'r' actions for
  34404. threads that are already running. Conversely, the server must
  34405. ignore 't' actions for threads that are already stopped.
  34406. _Note:_ In non-stop mode, a thread is considered running until GDB
  34407. acknowledges an asynchronous stop notification for it with the
  34408. 'vStopped' packet (*note Remote Non-Stop::).
  34409. The stub must support 'vCont' if it reports support for
  34410. multiprocess extensions (*note multiprocess extensions::).
  34411. Reply: *Note Stop Reply Packets::, for the reply specifications.
  34412. 'vCont?'
  34413. Request a list of actions supported by the 'vCont' packet.
  34414. Reply:
  34415. 'vCont[;ACTION...]'
  34416. The 'vCont' packet is supported. Each ACTION is a supported
  34417. command in the 'vCont' packet.
  34418. ''
  34419. The 'vCont' packet is not supported.
  34420. 'vCtrlC'
  34421. Interrupt remote target as if a control-C was pressed on the remote
  34422. terminal. This is the equivalent to reacting to the '^C' ('\003',
  34423. the control-C character) character in all-stop mode while the
  34424. target is running, except this works in non-stop mode. *Note
  34425. interrupting remote targets::, for more info on the all-stop
  34426. variant.
  34427. Reply:
  34428. 'E NN'
  34429. for an error
  34430. 'OK'
  34431. for success
  34432. 'vFile:OPERATION:PARAMETER...'
  34433. Perform a file operation on the target system. For details, see
  34434. *note Host I/O Packets::.
  34435. 'vFlashErase:ADDR,LENGTH'
  34436. Direct the stub to erase LENGTH bytes of flash starting at ADDR.
  34437. The region may enclose any number of flash blocks, but its start
  34438. and end must fall on block boundaries, as indicated by the flash
  34439. block size appearing in the memory map (*note Memory Map Format::).
  34440. GDB groups flash memory programming operations together, and sends
  34441. a 'vFlashDone' request after each group; the stub is allowed to
  34442. delay erase operation until the 'vFlashDone' packet is received.
  34443. Reply:
  34444. 'OK'
  34445. for success
  34446. 'E NN'
  34447. for an error
  34448. 'vFlashWrite:ADDR:XX...'
  34449. Direct the stub to write data to flash address ADDR. The data is
  34450. passed in binary form using the same encoding as for the 'X' packet
  34451. (*note Binary Data::). The memory ranges specified by
  34452. 'vFlashWrite' packets preceding a 'vFlashDone' packet must not
  34453. overlap, and must appear in order of increasing addresses (although
  34454. 'vFlashErase' packets for higher addresses may already have been
  34455. received; the ordering is guaranteed only between 'vFlashWrite'
  34456. packets). If a packet writes to an address that was neither erased
  34457. by a preceding 'vFlashErase' packet nor by some other
  34458. target-specific method, the results are unpredictable.
  34459. Reply:
  34460. 'OK'
  34461. for success
  34462. 'E.memtype'
  34463. for vFlashWrite addressing non-flash memory
  34464. 'E NN'
  34465. for an error
  34466. 'vFlashDone'
  34467. Indicate to the stub that flash programming operation is finished.
  34468. The stub is permitted to delay or batch the effects of a group of
  34469. 'vFlashErase' and 'vFlashWrite' packets until a 'vFlashDone' packet
  34470. is received. The contents of the affected regions of flash memory
  34471. are unpredictable until the 'vFlashDone' request is completed.
  34472. 'vKill;PID'
  34473. Kill the process with the specified process ID PID, which is a
  34474. hexadecimal integer identifying the process. This packet is used
  34475. in preference to 'k' when multiprocess protocol extensions are
  34476. supported; see *note multiprocess extensions::.
  34477. Reply:
  34478. 'E NN'
  34479. for an error
  34480. 'OK'
  34481. for success
  34482. 'vMustReplyEmpty'
  34483. The correct reply to an unknown 'v' packet is to return the empty
  34484. string, however, some older versions of 'gdbserver' would
  34485. incorrectly return 'OK' for unknown 'v' packets.
  34486. The 'vMustReplyEmpty' is used as a feature test to check how
  34487. 'gdbserver' handles unknown packets, it is important that this
  34488. packet be handled in the same way as other unknown 'v' packets. If
  34489. this packet is handled differently to other unknown 'v' packets
  34490. then it is possible that GDB may run into problems in other areas,
  34491. specifically around use of 'vFile:setfs:'.
  34492. 'vRun;FILENAME[;ARGUMENT]...'
  34493. Run the program FILENAME, passing it each ARGUMENT on its command
  34494. line. The file and arguments are hex-encoded strings. If FILENAME
  34495. is an empty string, the stub may use a default program (e.g. the
  34496. last program run). The program is created in the stopped state.
  34497. This packet is only available in extended mode (*note extended
  34498. mode::).
  34499. Reply:
  34500. 'E NN'
  34501. for an error
  34502. 'Any stop packet'
  34503. for success (*note Stop Reply Packets::)
  34504. 'vStopped'
  34505. *Note Notification Packets::.
  34506. 'X ADDR,LENGTH:XX...'
  34507. Write data to memory, where the data is transmitted in binary.
  34508. Memory is specified by its address ADDR and number of addressable
  34509. memory units LENGTH (*note addressable memory unit::); 'XX...' is
  34510. binary data (*note Binary Data::).
  34511. Reply:
  34512. 'OK'
  34513. for success
  34514. 'E NN'
  34515. for an error
  34516. 'z TYPE,ADDR,KIND'
  34517. 'Z TYPE,ADDR,KIND'
  34518. Insert ('Z') or remove ('z') a TYPE breakpoint or watchpoint
  34519. starting at address ADDRESS of kind KIND.
  34520. Each breakpoint and watchpoint packet TYPE is documented
  34521. separately.
  34522. _Implementation notes: A remote target shall return an empty string
  34523. for an unrecognized breakpoint or watchpoint packet TYPE. A remote
  34524. target shall support either both or neither of a given 'ZTYPE...'
  34525. and 'zTYPE...' packet pair. To avoid potential problems with
  34526. duplicate packets, the operations should be implemented in an
  34527. idempotent way._
  34528. 'z0,ADDR,KIND'
  34529. 'Z0,ADDR,KIND[;COND_LIST...][;cmds:PERSIST,CMD_LIST...]'
  34530. Insert ('Z0') or remove ('z0') a software breakpoint at address
  34531. ADDR of type KIND.
  34532. A software breakpoint is implemented by replacing the instruction
  34533. at ADDR with a software breakpoint or trap instruction. The KIND
  34534. is target-specific and typically indicates the size of the
  34535. breakpoint in bytes that should be inserted. E.g., the ARM and
  34536. MIPS can insert either a 2 or 4 byte breakpoint. Some
  34537. architectures have additional meanings for KIND (*note
  34538. Architecture-Specific Protocol Details::); if no
  34539. architecture-specific value is being used, it should be '0'. KIND
  34540. is hex-encoded. COND_LIST is an optional list of conditional
  34541. expressions in bytecode form that should be evaluated on the
  34542. target's side. These are the conditions that should be taken into
  34543. consideration when deciding if the breakpoint trigger should be
  34544. reported back to GDB.
  34545. See also the 'swbreak' stop reason (*note swbreak stop reason::)
  34546. for how to best report a software breakpoint event to GDB.
  34547. The COND_LIST parameter is comprised of a series of expressions,
  34548. concatenated without separators. Each expression has the following
  34549. form:
  34550. 'X LEN,EXPR'
  34551. LEN is the length of the bytecode expression and EXPR is the
  34552. actual conditional expression in bytecode form.
  34553. The optional CMD_LIST parameter introduces commands that may be run
  34554. on the target, rather than being reported back to GDB. The
  34555. parameter starts with a numeric flag PERSIST; if the flag is
  34556. nonzero, then the breakpoint may remain active and the commands
  34557. continue to be run even when GDB disconnects from the target.
  34558. Following this flag is a series of expressions concatenated with no
  34559. separators. Each expression has the following form:
  34560. 'X LEN,EXPR'
  34561. LEN is the length of the bytecode expression and EXPR is the
  34562. actual commands expression in bytecode form.
  34563. _Implementation note: It is possible for a target to copy or move
  34564. code that contains software breakpoints (e.g., when implementing
  34565. overlays). The behavior of this packet, in the presence of such a
  34566. target, is not defined._
  34567. Reply:
  34568. 'OK'
  34569. success
  34570. ''
  34571. not supported
  34572. 'E NN'
  34573. for an error
  34574. 'z1,ADDR,KIND'
  34575. 'Z1,ADDR,KIND[;COND_LIST...][;cmds:PERSIST,CMD_LIST...]'
  34576. Insert ('Z1') or remove ('z1') a hardware breakpoint at address
  34577. ADDR.
  34578. A hardware breakpoint is implemented using a mechanism that is not
  34579. dependent on being able to modify the target's memory. The KIND,
  34580. COND_LIST, and CMD_LIST arguments have the same meaning as in 'Z0'
  34581. packets.
  34582. _Implementation note: A hardware breakpoint is not affected by code
  34583. movement._
  34584. Reply:
  34585. 'OK'
  34586. success
  34587. ''
  34588. not supported
  34589. 'E NN'
  34590. for an error
  34591. 'z2,ADDR,KIND'
  34592. 'Z2,ADDR,KIND'
  34593. Insert ('Z2') or remove ('z2') a write watchpoint at ADDR. The
  34594. number of bytes to watch is specified by KIND.
  34595. Reply:
  34596. 'OK'
  34597. success
  34598. ''
  34599. not supported
  34600. 'E NN'
  34601. for an error
  34602. 'z3,ADDR,KIND'
  34603. 'Z3,ADDR,KIND'
  34604. Insert ('Z3') or remove ('z3') a read watchpoint at ADDR. The
  34605. number of bytes to watch is specified by KIND.
  34606. Reply:
  34607. 'OK'
  34608. success
  34609. ''
  34610. not supported
  34611. 'E NN'
  34612. for an error
  34613. 'z4,ADDR,KIND'
  34614. 'Z4,ADDR,KIND'
  34615. Insert ('Z4') or remove ('z4') an access watchpoint at ADDR. The
  34616. number of bytes to watch is specified by KIND.
  34617. Reply:
  34618. 'OK'
  34619. success
  34620. ''
  34621. not supported
  34622. 'E NN'
  34623. for an error
  34624. 
  34625. File: gdb.info, Node: Stop Reply Packets, Next: General Query Packets, Prev: Packets, Up: Remote Protocol
  34626. E.3 Stop Reply Packets
  34627. ======================
  34628. The 'C', 'c', 'S', 's', 'vCont', 'vAttach', 'vRun', 'vStopped', and '?'
  34629. packets can receive any of the below as a reply. Except for '?' and
  34630. 'vStopped', that reply is only returned when the target halts. In the
  34631. below the exact meaning of "signal number" is defined by the header
  34632. 'include/gdb/signals.h' in the GDB source code.
  34633. In non-stop mode, the server will simply reply 'OK' to commands such
  34634. as 'vCont'; any stop will be the subject of a future notification.
  34635. *Note Remote Non-Stop::.
  34636. As in the description of request packets, we include spaces in the
  34637. reply templates for clarity; these are not part of the reply packet's
  34638. syntax. No GDB stop reply packet uses spaces to separate its
  34639. components.
  34640. 'S AA'
  34641. The program received signal number AA (a two-digit hexadecimal
  34642. number). This is equivalent to a 'T' response with no N:R pairs.
  34643. 'T AA N1:R1;N2:R2;...'
  34644. The program received signal number AA (a two-digit hexadecimal
  34645. number). This is equivalent to an 'S' response, except that the
  34646. 'N:R' pairs can carry values of important registers and other
  34647. information directly in the stop reply packet, reducing round-trip
  34648. latency. Single-step and breakpoint traps are reported this way.
  34649. Each 'N:R' pair is interpreted as follows:
  34650. * If N is a hexadecimal number, it is a register number, and the
  34651. corresponding R gives that register's value. The data R is a
  34652. series of bytes in target byte order, with each byte given by
  34653. a two-digit hex number.
  34654. * If N is 'thread', then R is the THREAD-ID of the stopped
  34655. thread, as specified in *note thread-id syntax::.
  34656. * If N is 'core', then R is the hexadecimal number of the core
  34657. on which the stop event was detected.
  34658. * If N is a recognized "stop reason", it describes a more
  34659. specific event that stopped the target. The currently defined
  34660. stop reasons are listed below. The AA should be '05', the
  34661. trap signal. At most one stop reason should be present.
  34662. * Otherwise, GDB should ignore this 'N:R' pair and go on to the
  34663. next; this allows us to extend the protocol in the future.
  34664. The currently defined stop reasons are:
  34665. 'watch'
  34666. 'rwatch'
  34667. 'awatch'
  34668. The packet indicates a watchpoint hit, and R is the data
  34669. address, in hex.
  34670. 'syscall_entry'
  34671. 'syscall_return'
  34672. The packet indicates a syscall entry or return, and R is the
  34673. syscall number, in hex.
  34674. 'library'
  34675. The packet indicates that the loaded libraries have changed.
  34676. GDB should use 'qXfer:libraries:read' to fetch a new list of
  34677. loaded libraries. The R part is ignored.
  34678. 'replaylog'
  34679. The packet indicates that the target cannot continue replaying
  34680. logged execution events, because it has reached the end (or
  34681. the beginning when executing backward) of the log. The value
  34682. of R will be either 'begin' or 'end'. *Note Reverse
  34683. Execution::, for more information.
  34684. 'swbreak'
  34685. The packet indicates a software breakpoint instruction was
  34686. executed, irrespective of whether it was GDB that planted the
  34687. breakpoint or the breakpoint is hardcoded in the program. The
  34688. R part must be left empty.
  34689. On some architectures, such as x86, at the architecture level,
  34690. when a breakpoint instruction executes the program counter
  34691. points at the breakpoint address plus an offset. On such
  34692. targets, the stub is responsible for adjusting the PC to point
  34693. back at the breakpoint address.
  34694. This packet should not be sent by default; older GDB versions
  34695. did not support it. GDB requests it, by supplying an
  34696. appropriate 'qSupported' feature (*note qSupported::). The
  34697. remote stub must also supply the appropriate 'qSupported'
  34698. feature indicating support.
  34699. This packet is required for correct non-stop mode operation.
  34700. 'hwbreak'
  34701. The packet indicates the target stopped for a hardware
  34702. breakpoint. The R part must be left empty.
  34703. The same remarks about 'qSupported' and non-stop mode above
  34704. apply.
  34705. 'fork'
  34706. The packet indicates that 'fork' was called, and R is the
  34707. thread ID of the new child process. Refer to *note thread-id
  34708. syntax:: for the format of the THREAD-ID field. This packet
  34709. is only applicable to targets that support fork events.
  34710. This packet should not be sent by default; older GDB versions
  34711. did not support it. GDB requests it, by supplying an
  34712. appropriate 'qSupported' feature (*note qSupported::). The
  34713. remote stub must also supply the appropriate 'qSupported'
  34714. feature indicating support.
  34715. 'vfork'
  34716. The packet indicates that 'vfork' was called, and R is the
  34717. thread ID of the new child process. Refer to *note thread-id
  34718. syntax:: for the format of the THREAD-ID field. This packet
  34719. is only applicable to targets that support vfork events.
  34720. This packet should not be sent by default; older GDB versions
  34721. did not support it. GDB requests it, by supplying an
  34722. appropriate 'qSupported' feature (*note qSupported::). The
  34723. remote stub must also supply the appropriate 'qSupported'
  34724. feature indicating support.
  34725. 'vforkdone'
  34726. The packet indicates that a child process created by a vfork
  34727. has either called 'exec' or terminated, so that the address
  34728. spaces of the parent and child process are no longer shared.
  34729. The R part is ignored. This packet is only applicable to
  34730. targets that support vforkdone events.
  34731. This packet should not be sent by default; older GDB versions
  34732. did not support it. GDB requests it, by supplying an
  34733. appropriate 'qSupported' feature (*note qSupported::). The
  34734. remote stub must also supply the appropriate 'qSupported'
  34735. feature indicating support.
  34736. 'exec'
  34737. The packet indicates that 'execve' was called, and R is the
  34738. absolute pathname of the file that was executed, in hex. This
  34739. packet is only applicable to targets that support exec events.
  34740. This packet should not be sent by default; older GDB versions
  34741. did not support it. GDB requests it, by supplying an
  34742. appropriate 'qSupported' feature (*note qSupported::). The
  34743. remote stub must also supply the appropriate 'qSupported'
  34744. feature indicating support.
  34745. 'create'
  34746. The packet indicates that the thread was just created. The
  34747. new thread is stopped until GDB sets it running with a
  34748. resumption packet (*note vCont packet::). This packet should
  34749. not be sent by default; GDB requests it with the *note
  34750. QThreadEvents:: packet. See also the 'w' (*note thread exit
  34751. event::) remote reply below. The R part is ignored.
  34752. 'W AA'
  34753. 'W AA ; process:PID'
  34754. The process exited, and AA is the exit status. This is only
  34755. applicable to certain targets.
  34756. The second form of the response, including the process ID of the
  34757. exited process, can be used only when GDB has reported support for
  34758. multiprocess protocol extensions; see *note multiprocess
  34759. extensions::. Both AA and PID are formatted as big-endian hex
  34760. strings.
  34761. 'X AA'
  34762. 'X AA ; process:PID'
  34763. The process terminated with signal AA.
  34764. The second form of the response, including the process ID of the
  34765. terminated process, can be used only when GDB has reported support
  34766. for multiprocess protocol extensions; see *note multiprocess
  34767. extensions::. Both AA and PID are formatted as big-endian hex
  34768. strings.
  34769. 'w AA ; TID'
  34770. The thread exited, and AA is the exit status. This response should
  34771. not be sent by default; GDB requests it with the *note
  34772. QThreadEvents:: packet. See also *note thread create event::
  34773. above. AA is formatted as a big-endian hex string.
  34774. 'N'
  34775. There are no resumed threads left in the target. In other words,
  34776. even though the process is alive, the last resumed thread has
  34777. exited. For example, say the target process has two threads:
  34778. thread 1 and thread 2. The client leaves thread 1 stopped, and
  34779. resumes thread 2, which subsequently exits. At this point, even
  34780. though the process is still alive, and thus no 'W' stop reply is
  34781. sent, no thread is actually executing either. The 'N' stop reply
  34782. thus informs the client that it can stop waiting for stop replies.
  34783. This packet should not be sent by default; older GDB versions did
  34784. not support it. GDB requests it, by supplying an appropriate
  34785. 'qSupported' feature (*note qSupported::). The remote stub must
  34786. also supply the appropriate 'qSupported' feature indicating
  34787. support.
  34788. 'O XX...'
  34789. 'XX...' is hex encoding of ASCII data, to be written as the
  34790. program's console output. This can happen at any time while the
  34791. program is running and the debugger should continue to wait for
  34792. 'W', 'T', etc. This reply is not permitted in non-stop mode.
  34793. 'F CALL-ID,PARAMETER...'
  34794. CALL-ID is the identifier which says which host system call should
  34795. be called. This is just the name of the function. Translation
  34796. into the correct system call is only applicable as it's defined in
  34797. GDB. *Note File-I/O Remote Protocol Extension::, for a list of
  34798. implemented system calls.
  34799. 'PARAMETER...' is a list of parameters as defined for this very
  34800. system call.
  34801. The target replies with this packet when it expects GDB to call a
  34802. host system call on behalf of the target. GDB replies with an
  34803. appropriate 'F' packet and keeps up waiting for the next reply
  34804. packet from the target. The latest 'C', 'c', 'S' or 's' action is
  34805. expected to be continued. *Note File-I/O Remote Protocol
  34806. Extension::, for more details.
  34807. 
  34808. File: gdb.info, Node: General Query Packets, Next: Architecture-Specific Protocol Details, Prev: Stop Reply Packets, Up: Remote Protocol
  34809. E.4 General Query Packets
  34810. =========================
  34811. Packets starting with 'q' are "general query packets"; packets starting
  34812. with 'Q' are "general set packets". General query and set packets are a
  34813. semi-unified form for retrieving and sending information to and from the
  34814. stub.
  34815. The initial letter of a query or set packet is followed by a name
  34816. indicating what sort of thing the packet applies to. For example, GDB
  34817. may use a 'qSymbol' packet to exchange symbol definitions with the stub.
  34818. These packet names follow some conventions:
  34819. * The name must not contain commas, colons or semicolons.
  34820. * Most GDB query and set packets have a leading upper case letter.
  34821. * The names of custom vendor packets should use a company prefix, in
  34822. lower case, followed by a period. For example, packets designed at
  34823. the Acme Corporation might begin with 'qacme.foo' (for querying
  34824. foos) or 'Qacme.bar' (for setting bars).
  34825. The name of a query or set packet should be separated from any
  34826. parameters by a ':'; the parameters themselves should be separated by
  34827. ',' or ';'. Stubs must be careful to match the full packet name, and
  34828. check for a separator or the end of the packet, in case two packet names
  34829. share a common prefix. New packets should not begin with 'qC', 'qP', or
  34830. 'qL'(1).
  34831. Like the descriptions of the other packets, each description here has
  34832. a template showing the packet's overall syntax, followed by an
  34833. explanation of the packet's meaning. We include spaces in some of the
  34834. templates for clarity; these are not part of the packet's syntax. No
  34835. GDB packet uses spaces to separate its components.
  34836. Here are the currently defined query and set packets:
  34837. 'QAgent:1'
  34838. 'QAgent:0'
  34839. Turn on or off the agent as a helper to perform some debugging
  34840. operations delegated from GDB (*note Control Agent::).
  34841. 'QAllow:OP:VAL...'
  34842. Specify which operations GDB expects to request of the target, as a
  34843. semicolon-separated list of operation name and value pairs.
  34844. Possible values for OP include 'WriteReg', 'WriteMem',
  34845. 'InsertBreak', 'InsertTrace', 'InsertFastTrace', and 'Stop'. VAL
  34846. is either 0, indicating that GDB will not request the operation, or
  34847. 1, indicating that it may. (The target can then use this to set up
  34848. its own internals optimally, for instance if the debugger never
  34849. expects to insert breakpoints, it may not need to install its own
  34850. trap handler.)
  34851. 'qC'
  34852. Return the current thread ID.
  34853. Reply:
  34854. 'QC THREAD-ID'
  34855. Where THREAD-ID is a thread ID as documented in *note
  34856. thread-id syntax::.
  34857. '(anything else)'
  34858. Any other reply implies the old thread ID.
  34859. 'qCRC:ADDR,LENGTH'
  34860. Compute the CRC checksum of a block of memory using CRC-32 defined
  34861. in IEEE 802.3. The CRC is computed byte at a time, taking the most
  34862. significant bit of each byte first. The initial pattern code
  34863. '0xffffffff' is used to ensure leading zeros affect the CRC.
  34864. _Note:_ This is the same CRC used in validating separate debug
  34865. files (*note Debugging Information in Separate Files: Separate
  34866. Debug Files.). However the algorithm is slightly different. When
  34867. validating separate debug files, the CRC is computed taking the
  34868. _least_ significant bit of each byte first, and the final result is
  34869. inverted to detect trailing zeros.
  34870. Reply:
  34871. 'E NN'
  34872. An error (such as memory fault)
  34873. 'C CRC32'
  34874. The specified memory region's checksum is CRC32.
  34875. 'QDisableRandomization:VALUE'
  34876. Some target operating systems will randomize the virtual address
  34877. space of the inferior process as a security feature, but provide a
  34878. feature to disable such randomization, e.g. to allow for a more
  34879. deterministic debugging experience. On such systems, this packet
  34880. with a VALUE of 1 directs the target to disable address space
  34881. randomization for processes subsequently started via 'vRun'
  34882. packets, while a packet with a VALUE of 0 tells the target to
  34883. enable address space randomization.
  34884. This packet is only available in extended mode (*note extended
  34885. mode::).
  34886. Reply:
  34887. 'OK'
  34888. The request succeeded.
  34889. 'E NN'
  34890. An error occurred. The error number NN is given as hex
  34891. digits.
  34892. ''
  34893. An empty reply indicates that 'QDisableRandomization' is not
  34894. supported by the stub.
  34895. This packet is not probed by default; the remote stub must request
  34896. it, by supplying an appropriate 'qSupported' response (*note
  34897. qSupported::). This should only be done on targets that actually
  34898. support disabling address space randomization.
  34899. 'QStartupWithShell:VALUE'
  34900. On UNIX-like targets, it is possible to start the inferior using a
  34901. shell program. This is the default behavior on both GDB and
  34902. 'gdbserver' (*note set startup-with-shell::). This packet is used
  34903. to inform 'gdbserver' whether it should start the inferior using a
  34904. shell or not.
  34905. If VALUE is '0', 'gdbserver' will not use a shell to start the
  34906. inferior. If VALUE is '1', 'gdbserver' will use a shell to start
  34907. the inferior. All other values are considered an error.
  34908. This packet is only available in extended mode (*note extended
  34909. mode::).
  34910. Reply:
  34911. 'OK'
  34912. The request succeeded.
  34913. 'E NN'
  34914. An error occurred. The error number NN is given as hex
  34915. digits.
  34916. This packet is not probed by default; the remote stub must request
  34917. it, by supplying an appropriate 'qSupported' response (*note
  34918. qSupported::). This should only be done on targets that actually
  34919. support starting the inferior using a shell.
  34920. Use of this packet is controlled by the 'set startup-with-shell'
  34921. command; *note set startup-with-shell::.
  34922. 'QEnvironmentHexEncoded:HEX-VALUE'
  34923. On UNIX-like targets, it is possible to set environment variables
  34924. that will be passed to the inferior during the startup process.
  34925. This packet is used to inform 'gdbserver' of an environment
  34926. variable that has been defined by the user on GDB (*note set
  34927. environment::).
  34928. The packet is composed by HEX-VALUE, an hex encoded representation
  34929. of the NAME=VALUE format representing an environment variable. The
  34930. name of the environment variable is represented by NAME, and the
  34931. value to be assigned to the environment variable is represented by
  34932. VALUE. If the variable has no value (i.e., the value is 'null'),
  34933. then VALUE will not be present.
  34934. This packet is only available in extended mode (*note extended
  34935. mode::).
  34936. Reply:
  34937. 'OK'
  34938. The request succeeded.
  34939. This packet is not probed by default; the remote stub must request
  34940. it, by supplying an appropriate 'qSupported' response (*note
  34941. qSupported::). This should only be done on targets that actually
  34942. support passing environment variables to the starting inferior.
  34943. This packet is related to the 'set environment' command; *note set
  34944. environment::.
  34945. 'QEnvironmentUnset:HEX-VALUE'
  34946. On UNIX-like targets, it is possible to unset environment variables
  34947. before starting the inferior in the remote target. This packet is
  34948. used to inform 'gdbserver' of an environment variable that has been
  34949. unset by the user on GDB (*note unset environment::).
  34950. The packet is composed by HEX-VALUE, an hex encoded representation
  34951. of the name of the environment variable to be unset.
  34952. This packet is only available in extended mode (*note extended
  34953. mode::).
  34954. Reply:
  34955. 'OK'
  34956. The request succeeded.
  34957. This packet is not probed by default; the remote stub must request
  34958. it, by supplying an appropriate 'qSupported' response (*note
  34959. qSupported::). This should only be done on targets that actually
  34960. support passing environment variables to the starting inferior.
  34961. This packet is related to the 'unset environment' command; *note
  34962. unset environment::.
  34963. 'QEnvironmentReset'
  34964. On UNIX-like targets, this packet is used to reset the state of
  34965. environment variables in the remote target before starting the
  34966. inferior. In this context, reset means unsetting all environment
  34967. variables that were previously set by the user (i.e., were not
  34968. initially present in the environment). It is sent to 'gdbserver'
  34969. before the 'QEnvironmentHexEncoded' (*note
  34970. QEnvironmentHexEncoded::) and the 'QEnvironmentUnset' (*note
  34971. QEnvironmentUnset::) packets.
  34972. This packet is only available in extended mode (*note extended
  34973. mode::).
  34974. Reply:
  34975. 'OK'
  34976. The request succeeded.
  34977. This packet is not probed by default; the remote stub must request
  34978. it, by supplying an appropriate 'qSupported' response (*note
  34979. qSupported::). This should only be done on targets that actually
  34980. support passing environment variables to the starting inferior.
  34981. 'QSetWorkingDir:[DIRECTORY]'
  34982. This packet is used to inform the remote server of the intended
  34983. current working directory for programs that are going to be
  34984. executed.
  34985. The packet is composed by DIRECTORY, an hex encoded representation
  34986. of the directory that the remote inferior will use as its current
  34987. working directory. If DIRECTORY is an empty string, the remote
  34988. server should reset the inferior's current working directory to its
  34989. original, empty value.
  34990. This packet is only available in extended mode (*note extended
  34991. mode::).
  34992. Reply:
  34993. 'OK'
  34994. The request succeeded.
  34995. 'qfThreadInfo'
  34996. 'qsThreadInfo'
  34997. Obtain a list of all active thread IDs from the target (OS). Since
  34998. there may be too many active threads to fit into one reply packet,
  34999. this query works iteratively: it may require more than one
  35000. query/reply sequence to obtain the entire list of threads. The
  35001. first query of the sequence will be the 'qfThreadInfo' query;
  35002. subsequent queries in the sequence will be the 'qsThreadInfo'
  35003. query.
  35004. NOTE: This packet replaces the 'qL' query (see below).
  35005. Reply:
  35006. 'm THREAD-ID'
  35007. A single thread ID
  35008. 'm THREAD-ID,THREAD-ID...'
  35009. a comma-separated list of thread IDs
  35010. 'l'
  35011. (lower case letter 'L') denotes end of list.
  35012. In response to each query, the target will reply with a list of one
  35013. or more thread IDs, separated by commas. GDB will respond to each
  35014. reply with a request for more thread ids (using the 'qs' form of
  35015. the query), until the target responds with 'l' (lower-case ell, for
  35016. "last"). Refer to *note thread-id syntax::, for the format of the
  35017. THREAD-ID fields.
  35018. _Note: GDB will send the 'qfThreadInfo' query during the initial
  35019. connection with the remote target, and the very first thread ID
  35020. mentioned in the reply will be stopped by GDB in a subsequent
  35021. message. Therefore, the stub should ensure that the first thread
  35022. ID in the 'qfThreadInfo' reply is suitable for being stopped by
  35023. GDB._
  35024. 'qGetTLSAddr:THREAD-ID,OFFSET,LM'
  35025. Fetch the address associated with thread local storage specified by
  35026. THREAD-ID, OFFSET, and LM.
  35027. THREAD-ID is the thread ID associated with the thread for which to
  35028. fetch the TLS address. *Note thread-id syntax::.
  35029. OFFSET is the (big endian, hex encoded) offset associated with the
  35030. thread local variable. (This offset is obtained from the debug
  35031. information associated with the variable.)
  35032. LM is the (big endian, hex encoded) OS/ABI-specific encoding of the
  35033. load module associated with the thread local storage. For example,
  35034. a GNU/Linux system will pass the link map address of the shared
  35035. object associated with the thread local storage under
  35036. consideration. Other operating environments may choose to
  35037. represent the load module differently, so the precise meaning of
  35038. this parameter will vary.
  35039. Reply:
  35040. 'XX...'
  35041. Hex encoded (big endian) bytes representing the address of the
  35042. thread local storage requested.
  35043. 'E NN'
  35044. An error occurred. The error number NN is given as hex
  35045. digits.
  35046. ''
  35047. An empty reply indicates that 'qGetTLSAddr' is not supported
  35048. by the stub.
  35049. 'qGetTIBAddr:THREAD-ID'
  35050. Fetch address of the Windows OS specific Thread Information Block.
  35051. THREAD-ID is the thread ID associated with the thread.
  35052. Reply:
  35053. 'XX...'
  35054. Hex encoded (big endian) bytes representing the linear address
  35055. of the thread information block.
  35056. 'E NN'
  35057. An error occured. This means that either the thread was not
  35058. found, or the address could not be retrieved.
  35059. ''
  35060. An empty reply indicates that 'qGetTIBAddr' is not supported
  35061. by the stub.
  35062. 'qL STARTFLAG THREADCOUNT NEXTTHREAD'
  35063. Obtain thread information from RTOS. Where: STARTFLAG (one hex
  35064. digit) is one to indicate the first query and zero to indicate a
  35065. subsequent query; THREADCOUNT (two hex digits) is the maximum
  35066. number of threads the response packet can contain; and NEXTTHREAD
  35067. (eight hex digits), for subsequent queries (STARTFLAG is zero), is
  35068. returned in the response as ARGTHREAD.
  35069. Don't use this packet; use the 'qfThreadInfo' query instead (see
  35070. above).
  35071. Reply:
  35072. 'qM COUNT DONE ARGTHREAD THREAD...'
  35073. Where: COUNT (two hex digits) is the number of threads being
  35074. returned; DONE (one hex digit) is zero to indicate more
  35075. threads and one indicates no further threads; ARGTHREADID
  35076. (eight hex digits) is NEXTTHREAD from the request packet;
  35077. THREAD... is a sequence of thread IDs, THREADID (eight hex
  35078. digits), from the target. See
  35079. 'remote.c:parse_threadlist_response()'.
  35080. 'qOffsets'
  35081. Get section offsets that the target used when relocating the
  35082. downloaded image.
  35083. Reply:
  35084. 'Text=XXX;Data=YYY[;Bss=ZZZ]'
  35085. Relocate the 'Text' section by XXX from its original address.
  35086. Relocate the 'Data' section by YYY from its original address.
  35087. If the object file format provides segment information (e.g.
  35088. ELF 'PT_LOAD' program headers), GDB will relocate entire
  35089. segments by the supplied offsets.
  35090. _Note: while a 'Bss' offset may be included in the response,
  35091. GDB ignores this and instead applies the 'Data' offset to the
  35092. 'Bss' section._
  35093. 'TextSeg=XXX[;DataSeg=YYY]'
  35094. Relocate the first segment of the object file, which
  35095. conventionally contains program code, to a starting address of
  35096. XXX. If 'DataSeg' is specified, relocate the second segment,
  35097. which conventionally contains modifiable data, to a starting
  35098. address of YYY. GDB will report an error if the object file
  35099. does not contain segment information, or does not contain at
  35100. least as many segments as mentioned in the reply. Extra
  35101. segments are kept at fixed offsets relative to the last
  35102. relocated segment.
  35103. 'qP MODE THREAD-ID'
  35104. Returns information on THREAD-ID. Where: MODE is a hex encoded 32
  35105. bit mode; THREAD-ID is a thread ID (*note thread-id syntax::).
  35106. Don't use this packet; use the 'qThreadExtraInfo' query instead
  35107. (see below).
  35108. Reply: see 'remote.c:remote_unpack_thread_info_response()'.
  35109. 'QNonStop:1'
  35110. 'QNonStop:0'
  35111. Enter non-stop ('QNonStop:1') or all-stop ('QNonStop:0') mode.
  35112. *Note Remote Non-Stop::, for more information.
  35113. Reply:
  35114. 'OK'
  35115. The request succeeded.
  35116. 'E NN'
  35117. An error occurred. The error number NN is given as hex
  35118. digits.
  35119. ''
  35120. An empty reply indicates that 'QNonStop' is not supported by
  35121. the stub.
  35122. This packet is not probed by default; the remote stub must request
  35123. it, by supplying an appropriate 'qSupported' response (*note
  35124. qSupported::). Use of this packet is controlled by the 'set
  35125. non-stop' command; *note Non-Stop Mode::.
  35126. 'QCatchSyscalls:1 [;SYSNO]...'
  35127. 'QCatchSyscalls:0'
  35128. Enable ('QCatchSyscalls:1') or disable ('QCatchSyscalls:0')
  35129. catching syscalls from the inferior process.
  35130. For 'QCatchSyscalls:1', each listed syscall SYSNO (encoded in hex)
  35131. should be reported to GDB. If no syscall SYSNO is listed, every
  35132. system call should be reported.
  35133. Note that if a syscall not in the list is reported, GDB will still
  35134. filter the event according to its own list from all corresponding
  35135. 'catch syscall' commands. However, it is more efficient to only
  35136. report the requested syscalls.
  35137. Multiple 'QCatchSyscalls:1' packets do not combine; any earlier
  35138. 'QCatchSyscalls:1' list is completely replaced by the new list.
  35139. If the inferior process execs, the state of 'QCatchSyscalls' is
  35140. kept for the new process too. On targets where exec may affect
  35141. syscall numbers, for example with exec between 32 and 64-bit
  35142. processes, the client should send a new packet with the new syscall
  35143. list.
  35144. Reply:
  35145. 'OK'
  35146. The request succeeded.
  35147. 'E NN'
  35148. An error occurred. NN are hex digits.
  35149. ''
  35150. An empty reply indicates that 'QCatchSyscalls' is not
  35151. supported by the stub.
  35152. Use of this packet is controlled by the 'set remote catch-syscalls'
  35153. command (*note set remote catch-syscalls: Remote Configuration.).
  35154. This packet is not probed by default; the remote stub must request
  35155. it, by supplying an appropriate 'qSupported' response (*note
  35156. qSupported::).
  35157. 'QPassSignals: SIGNAL [;SIGNAL]...'
  35158. Each listed SIGNAL should be passed directly to the inferior
  35159. process. Signals are numbered identically to continue packets and
  35160. stop replies (*note Stop Reply Packets::). Each SIGNAL list item
  35161. should be strictly greater than the previous item. These signals
  35162. do not need to stop the inferior, or be reported to GDB. All other
  35163. signals should be reported to GDB. Multiple 'QPassSignals' packets
  35164. do not combine; any earlier 'QPassSignals' list is completely
  35165. replaced by the new list. This packet improves performance when
  35166. using 'handle SIGNAL nostop noprint pass'.
  35167. Reply:
  35168. 'OK'
  35169. The request succeeded.
  35170. 'E NN'
  35171. An error occurred. The error number NN is given as hex
  35172. digits.
  35173. ''
  35174. An empty reply indicates that 'QPassSignals' is not supported
  35175. by the stub.
  35176. Use of this packet is controlled by the 'set remote pass-signals'
  35177. command (*note set remote pass-signals: Remote Configuration.).
  35178. This packet is not probed by default; the remote stub must request
  35179. it, by supplying an appropriate 'qSupported' response (*note
  35180. qSupported::).
  35181. 'QProgramSignals: SIGNAL [;SIGNAL]...'
  35182. Each listed SIGNAL may be delivered to the inferior process.
  35183. Others should be silently discarded.
  35184. In some cases, the remote stub may need to decide whether to
  35185. deliver a signal to the program or not without GDB involvement.
  35186. One example of that is while detaching -- the program's threads may
  35187. have stopped for signals that haven't yet had a chance of being
  35188. reported to GDB, and so the remote stub can use the signal list
  35189. specified by this packet to know whether to deliver or ignore those
  35190. pending signals.
  35191. This does not influence whether to deliver a signal as requested by
  35192. a resumption packet (*note vCont packet::).
  35193. Signals are numbered identically to continue packets and stop
  35194. replies (*note Stop Reply Packets::). Each SIGNAL list item should
  35195. be strictly greater than the previous item. Multiple
  35196. 'QProgramSignals' packets do not combine; any earlier
  35197. 'QProgramSignals' list is completely replaced by the new list.
  35198. Reply:
  35199. 'OK'
  35200. The request succeeded.
  35201. 'E NN'
  35202. An error occurred. The error number NN is given as hex
  35203. digits.
  35204. ''
  35205. An empty reply indicates that 'QProgramSignals' is not
  35206. supported by the stub.
  35207. Use of this packet is controlled by the 'set remote
  35208. program-signals' command (*note set remote program-signals: Remote
  35209. Configuration.). This packet is not probed by default; the remote
  35210. stub must request it, by supplying an appropriate 'qSupported'
  35211. response (*note qSupported::).
  35212. 'QThreadEvents:1'
  35213. 'QThreadEvents:0'
  35214. Enable ('QThreadEvents:1') or disable ('QThreadEvents:0') reporting
  35215. of thread create and exit events. *Note thread create event::, for
  35216. the reply specifications. For example, this is used in non-stop
  35217. mode when GDB stops a set of threads and synchronously waits for
  35218. the their corresponding stop replies. Without exit events, if one
  35219. of the threads exits, GDB would hang forever not knowing that it
  35220. should no longer expect a stop for that same thread. GDB does not
  35221. enable this feature unless the stub reports that it supports it by
  35222. including 'QThreadEvents+' in its 'qSupported' reply.
  35223. Reply:
  35224. 'OK'
  35225. The request succeeded.
  35226. 'E NN'
  35227. An error occurred. The error number NN is given as hex
  35228. digits.
  35229. ''
  35230. An empty reply indicates that 'QThreadEvents' is not supported
  35231. by the stub.
  35232. Use of this packet is controlled by the 'set remote thread-events'
  35233. command (*note set remote thread-events: Remote Configuration.).
  35234. 'qRcmd,COMMAND'
  35235. COMMAND (hex encoded) is passed to the local interpreter for
  35236. execution. Invalid commands should be reported using the output
  35237. string. Before the final result packet, the target may also
  35238. respond with a number of intermediate 'OOUTPUT' console output
  35239. packets. _Implementors should note that providing access to a
  35240. stubs's interpreter may have security implications_.
  35241. Reply:
  35242. 'OK'
  35243. A command response with no output.
  35244. 'OUTPUT'
  35245. A command response with the hex encoded output string OUTPUT.
  35246. 'E NN'
  35247. Indicate a badly formed request.
  35248. ''
  35249. An empty reply indicates that 'qRcmd' is not recognized.
  35250. (Note that the 'qRcmd' packet's name is separated from the command
  35251. by a ',', not a ':', contrary to the naming conventions above.
  35252. Please don't use this packet as a model for new packets.)
  35253. 'qSearch:memory:ADDRESS;LENGTH;SEARCH-PATTERN'
  35254. Search LENGTH bytes at ADDRESS for SEARCH-PATTERN. Both ADDRESS
  35255. and LENGTH are encoded in hex; SEARCH-PATTERN is a sequence of
  35256. bytes, also hex encoded.
  35257. Reply:
  35258. '0'
  35259. The pattern was not found.
  35260. '1,address'
  35261. The pattern was found at ADDRESS.
  35262. 'E NN'
  35263. A badly formed request or an error was encountered while
  35264. searching memory.
  35265. ''
  35266. An empty reply indicates that 'qSearch:memory' is not
  35267. recognized.
  35268. 'QStartNoAckMode'
  35269. Request that the remote stub disable the normal '+'/'-' protocol
  35270. acknowledgments (*note Packet Acknowledgment::).
  35271. Reply:
  35272. 'OK'
  35273. The stub has switched to no-acknowledgment mode. GDB
  35274. acknowledges this response, but neither the stub nor GDB shall
  35275. send or expect further '+'/'-' acknowledgments in the current
  35276. connection.
  35277. ''
  35278. An empty reply indicates that the stub does not support
  35279. no-acknowledgment mode.
  35280. 'qSupported [:GDBFEATURE [;GDBFEATURE]... ]'
  35281. Tell the remote stub about features supported by GDB, and query the
  35282. stub for features it supports. This packet allows GDB and the
  35283. remote stub to take advantage of each others' features.
  35284. 'qSupported' also consolidates multiple feature probes at startup,
  35285. to improve GDB performance--a single larger packet performs better
  35286. than multiple smaller probe packets on high-latency links. Some
  35287. features may enable behavior which must not be on by default, e.g.
  35288. because it would confuse older clients or stubs. Other features
  35289. may describe packets which could be automatically probed for, but
  35290. are not. These features must be reported before GDB will use them.
  35291. This "default unsupported" behavior is not appropriate for all
  35292. packets, but it helps to keep the initial connection time under
  35293. control with new versions of GDB which support increasing numbers
  35294. of packets.
  35295. Reply:
  35296. 'STUBFEATURE [;STUBFEATURE]...'
  35297. The stub supports or does not support each returned
  35298. STUBFEATURE, depending on the form of each STUBFEATURE (see
  35299. below for the possible forms).
  35300. ''
  35301. An empty reply indicates that 'qSupported' is not recognized,
  35302. or that no features needed to be reported to GDB.
  35303. The allowed forms for each feature (either a GDBFEATURE in the
  35304. 'qSupported' packet, or a STUBFEATURE in the response) are:
  35305. 'NAME=VALUE'
  35306. The remote protocol feature NAME is supported, and associated
  35307. with the specified VALUE. The format of VALUE depends on the
  35308. feature, but it must not include a semicolon.
  35309. 'NAME+'
  35310. The remote protocol feature NAME is supported, and does not
  35311. need an associated value.
  35312. 'NAME-'
  35313. The remote protocol feature NAME is not supported.
  35314. 'NAME?'
  35315. The remote protocol feature NAME may be supported, and GDB
  35316. should auto-detect support in some other way when it is
  35317. needed. This form will not be used for GDBFEATURE
  35318. notifications, but may be used for STUBFEATURE responses.
  35319. Whenever the stub receives a 'qSupported' request, the supplied set
  35320. of GDB features should override any previous request. This allows
  35321. GDB to put the stub in a known state, even if the stub had
  35322. previously been communicating with a different version of GDB.
  35323. The following values of GDBFEATURE (for the packet sent by GDB) are
  35324. defined:
  35325. 'multiprocess'
  35326. This feature indicates whether GDB supports multiprocess
  35327. extensions to the remote protocol. GDB does not use such
  35328. extensions unless the stub also reports that it supports them
  35329. by including 'multiprocess+' in its 'qSupported' reply. *Note
  35330. multiprocess extensions::, for details.
  35331. 'xmlRegisters'
  35332. This feature indicates that GDB supports the XML target
  35333. description. If the stub sees 'xmlRegisters=' with target
  35334. specific strings separated by a comma, it will report register
  35335. description.
  35336. 'qRelocInsn'
  35337. This feature indicates whether GDB supports the 'qRelocInsn'
  35338. packet (*note Relocate instruction reply packet: Tracepoint
  35339. Packets.).
  35340. 'swbreak'
  35341. This feature indicates whether GDB supports the swbreak stop
  35342. reason in stop replies. *Note swbreak stop reason::, for
  35343. details.
  35344. 'hwbreak'
  35345. This feature indicates whether GDB supports the hwbreak stop
  35346. reason in stop replies. *Note swbreak stop reason::, for
  35347. details.
  35348. 'fork-events'
  35349. This feature indicates whether GDB supports fork event
  35350. extensions to the remote protocol. GDB does not use such
  35351. extensions unless the stub also reports that it supports them
  35352. by including 'fork-events+' in its 'qSupported' reply.
  35353. 'vfork-events'
  35354. This feature indicates whether GDB supports vfork event
  35355. extensions to the remote protocol. GDB does not use such
  35356. extensions unless the stub also reports that it supports them
  35357. by including 'vfork-events+' in its 'qSupported' reply.
  35358. 'exec-events'
  35359. This feature indicates whether GDB supports exec event
  35360. extensions to the remote protocol. GDB does not use such
  35361. extensions unless the stub also reports that it supports them
  35362. by including 'exec-events+' in its 'qSupported' reply.
  35363. 'vContSupported'
  35364. This feature indicates whether GDB wants to know the supported
  35365. actions in the reply to 'vCont?' packet.
  35366. Stubs should ignore any unknown values for GDBFEATURE. Any GDB
  35367. which sends a 'qSupported' packet supports receiving packets of
  35368. unlimited length (earlier versions of GDB may reject overly long
  35369. responses). Additional values for GDBFEATURE may be defined in the
  35370. future to let the stub take advantage of new features in GDB, e.g.
  35371. incompatible improvements in the remote protocol--the
  35372. 'multiprocess' feature is an example of such a feature. The stub's
  35373. reply should be independent of the GDBFEATURE entries sent by GDB;
  35374. first GDB describes all the features it supports, and then the stub
  35375. replies with all the features it supports.
  35376. Similarly, GDB will silently ignore unrecognized stub feature
  35377. responses, as long as each response uses one of the standard forms.
  35378. Some features are flags. A stub which supports a flag feature
  35379. should respond with a '+' form response. Other features require
  35380. values, and the stub should respond with an '=' form response.
  35381. Each feature has a default value, which GDB will use if
  35382. 'qSupported' is not available or if the feature is not mentioned in
  35383. the 'qSupported' response. The default values are fixed; a stub is
  35384. free to omit any feature responses that match the defaults.
  35385. Not all features can be probed, but for those which can, the
  35386. probing mechanism is useful: in some cases, a stub's internal
  35387. architecture may not allow the protocol layer to know some
  35388. information about the underlying target in advance. This is
  35389. especially common in stubs which may be configured for multiple
  35390. targets.
  35391. These are the currently defined stub features and their properties:
  35392. Feature Name Value Default Probe
  35393. Required Allowed
  35394. 'PacketSize' Yes '-' No
  35395. 'qXfer:auxv:read' No '-' Yes
  35396. 'qXfer:btrace:read' No '-' Yes
  35397. 'qXfer:btrace-conf:read' No '-' Yes
  35398. 'qXfer:exec-file:read' No '-' Yes
  35399. 'qXfer:features:read' No '-' Yes
  35400. 'qXfer:libraries:read' No '-' Yes
  35401. 'qXfer:libraries-svr4:read'No '-' Yes
  35402. 'augmented-libraries-svr4-read'No '-' No
  35403. 'qXfer:memory-map:read' No '-' Yes
  35404. 'qXfer:sdata:read' No '-' Yes
  35405. 'qXfer:siginfo:read' No '-' Yes
  35406. 'qXfer:siginfo:write' No '-' Yes
  35407. 'qXfer:threads:read' No '-' Yes
  35408. 'qXfer:traceframe-info:read'No '-' Yes
  35409. 'qXfer:uib:read' No '-' Yes
  35410. 'qXfer:fdpic:read' No '-' Yes
  35411. 'Qbtrace:off' Yes '-' Yes
  35412. 'Qbtrace:bts' Yes '-' Yes
  35413. 'Qbtrace:pt' Yes '-' Yes
  35414. 'Qbtrace-conf:bts:size' Yes '-' Yes
  35415. 'Qbtrace-conf:pt:size' Yes '-' Yes
  35416. 'QNonStop' No '-' Yes
  35417. 'QCatchSyscalls' No '-' Yes
  35418. 'QPassSignals' No '-' Yes
  35419. 'QStartNoAckMode' No '-' Yes
  35420. 'multiprocess' No '-' No
  35421. 'ConditionalBreakpoints' No '-' No
  35422. 'ConditionalTracepoints' No '-' No
  35423. 'ReverseContinue' No '-' No
  35424. 'ReverseStep' No '-' No
  35425. 'TracepointSource' No '-' No
  35426. 'QAgent' No '-' No
  35427. 'QAllow' No '-' No
  35428. 'QDisableRandomization' No '-' No
  35429. 'EnableDisableTracepoints'No '-' No
  35430. 'QTBuffer:size' No '-' No
  35431. 'tracenz' No '-' No
  35432. 'BreakpointCommands' No '-' No
  35433. 'swbreak' No '-' No
  35434. 'hwbreak' No '-' No
  35435. 'fork-events' No '-' No
  35436. 'vfork-events' No '-' No
  35437. 'exec-events' No '-' No
  35438. 'QThreadEvents' No '-' No
  35439. 'no-resumed' No '-' No
  35440. These are the currently defined stub features, in more detail:
  35441. 'PacketSize=BYTES'
  35442. The remote stub can accept packets up to at least BYTES in
  35443. length. GDB will send packets up to this size for bulk
  35444. transfers, and will never send larger packets. This is a
  35445. limit on the data characters in the packet, including the
  35446. frame and checksum. There is no trailing NUL byte in a remote
  35447. protocol packet; if the stub stores packets in a
  35448. NUL-terminated format, it should allow an extra byte in its
  35449. buffer for the NUL. If this stub feature is not supported, GDB
  35450. guesses based on the size of the 'g' packet response.
  35451. 'qXfer:auxv:read'
  35452. The remote stub understands the 'qXfer:auxv:read' packet
  35453. (*note qXfer auxiliary vector read::).
  35454. 'qXfer:btrace:read'
  35455. The remote stub understands the 'qXfer:btrace:read' packet
  35456. (*note qXfer btrace read::).
  35457. 'qXfer:btrace-conf:read'
  35458. The remote stub understands the 'qXfer:btrace-conf:read'
  35459. packet (*note qXfer btrace-conf read::).
  35460. 'qXfer:exec-file:read'
  35461. The remote stub understands the 'qXfer:exec-file:read' packet
  35462. (*note qXfer executable filename read::).
  35463. 'qXfer:features:read'
  35464. The remote stub understands the 'qXfer:features:read' packet
  35465. (*note qXfer target description read::).
  35466. 'qXfer:libraries:read'
  35467. The remote stub understands the 'qXfer:libraries:read' packet
  35468. (*note qXfer library list read::).
  35469. 'qXfer:libraries-svr4:read'
  35470. The remote stub understands the 'qXfer:libraries-svr4:read'
  35471. packet (*note qXfer svr4 library list read::).
  35472. 'augmented-libraries-svr4-read'
  35473. The remote stub understands the augmented form of the
  35474. 'qXfer:libraries-svr4:read' packet (*note qXfer svr4 library
  35475. list read::).
  35476. 'qXfer:memory-map:read'
  35477. The remote stub understands the 'qXfer:memory-map:read' packet
  35478. (*note qXfer memory map read::).
  35479. 'qXfer:sdata:read'
  35480. The remote stub understands the 'qXfer:sdata:read' packet
  35481. (*note qXfer sdata read::).
  35482. 'qXfer:siginfo:read'
  35483. The remote stub understands the 'qXfer:siginfo:read' packet
  35484. (*note qXfer siginfo read::).
  35485. 'qXfer:siginfo:write'
  35486. The remote stub understands the 'qXfer:siginfo:write' packet
  35487. (*note qXfer siginfo write::).
  35488. 'qXfer:threads:read'
  35489. The remote stub understands the 'qXfer:threads:read' packet
  35490. (*note qXfer threads read::).
  35491. 'qXfer:traceframe-info:read'
  35492. The remote stub understands the 'qXfer:traceframe-info:read'
  35493. packet (*note qXfer traceframe info read::).
  35494. 'qXfer:uib:read'
  35495. The remote stub understands the 'qXfer:uib:read' packet (*note
  35496. qXfer unwind info block::).
  35497. 'qXfer:fdpic:read'
  35498. The remote stub understands the 'qXfer:fdpic:read' packet
  35499. (*note qXfer fdpic loadmap read::).
  35500. 'QNonStop'
  35501. The remote stub understands the 'QNonStop' packet (*note
  35502. QNonStop::).
  35503. 'QCatchSyscalls'
  35504. The remote stub understands the 'QCatchSyscalls' packet (*note
  35505. QCatchSyscalls::).
  35506. 'QPassSignals'
  35507. The remote stub understands the 'QPassSignals' packet (*note
  35508. QPassSignals::).
  35509. 'QStartNoAckMode'
  35510. The remote stub understands the 'QStartNoAckMode' packet and
  35511. prefers to operate in no-acknowledgment mode. *Note Packet
  35512. Acknowledgment::.
  35513. 'multiprocess'
  35514. The remote stub understands the multiprocess extensions to the
  35515. remote protocol syntax. The multiprocess extensions affect
  35516. the syntax of thread IDs in both packets and replies (*note
  35517. thread-id syntax::), and add process IDs to the 'D' packet and
  35518. 'W' and 'X' replies. Note that reporting this feature
  35519. indicates support for the syntactic extensions only, not that
  35520. the stub necessarily supports debugging of more than one
  35521. process at a time. The stub must not use multiprocess
  35522. extensions in packet replies unless GDB has also indicated it
  35523. supports them in its 'qSupported' request.
  35524. 'qXfer:osdata:read'
  35525. The remote stub understands the 'qXfer:osdata:read' packet
  35526. ((*note qXfer osdata read::).
  35527. 'ConditionalBreakpoints'
  35528. The target accepts and implements evaluation of conditional
  35529. expressions defined for breakpoints. The target will only
  35530. report breakpoint triggers when such conditions are true
  35531. (*note Break Conditions: Conditions.).
  35532. 'ConditionalTracepoints'
  35533. The remote stub accepts and implements conditional expressions
  35534. defined for tracepoints (*note Tracepoint Conditions::).
  35535. 'ReverseContinue'
  35536. The remote stub accepts and implements the reverse continue
  35537. packet (*note bc::).
  35538. 'ReverseStep'
  35539. The remote stub accepts and implements the reverse step packet
  35540. (*note bs::).
  35541. 'TracepointSource'
  35542. The remote stub understands the 'QTDPsrc' packet that supplies
  35543. the source form of tracepoint definitions.
  35544. 'QAgent'
  35545. The remote stub understands the 'QAgent' packet.
  35546. 'QAllow'
  35547. The remote stub understands the 'QAllow' packet.
  35548. 'QDisableRandomization'
  35549. The remote stub understands the 'QDisableRandomization'
  35550. packet.
  35551. 'StaticTracepoint'
  35552. The remote stub supports static tracepoints.
  35553. 'InstallInTrace'
  35554. The remote stub supports installing tracepoint in tracing.
  35555. 'EnableDisableTracepoints'
  35556. The remote stub supports the 'QTEnable' (*note QTEnable::) and
  35557. 'QTDisable' (*note QTDisable::) packets that allow tracepoints
  35558. to be enabled and disabled while a trace experiment is
  35559. running.
  35560. 'QTBuffer:size'
  35561. The remote stub supports the 'QTBuffer:size' (*note
  35562. QTBuffer-size::) packet that allows to change the size of the
  35563. trace buffer.
  35564. 'tracenz'
  35565. The remote stub supports the 'tracenz' bytecode for collecting
  35566. strings. See *note Bytecode Descriptions:: for details about
  35567. the bytecode.
  35568. 'BreakpointCommands'
  35569. The remote stub supports running a breakpoint's command list
  35570. itself, rather than reporting the hit to GDB.
  35571. 'Qbtrace:off'
  35572. The remote stub understands the 'Qbtrace:off' packet.
  35573. 'Qbtrace:bts'
  35574. The remote stub understands the 'Qbtrace:bts' packet.
  35575. 'Qbtrace:pt'
  35576. The remote stub understands the 'Qbtrace:pt' packet.
  35577. 'Qbtrace-conf:bts:size'
  35578. The remote stub understands the 'Qbtrace-conf:bts:size'
  35579. packet.
  35580. 'Qbtrace-conf:pt:size'
  35581. The remote stub understands the 'Qbtrace-conf:pt:size' packet.
  35582. 'swbreak'
  35583. The remote stub reports the 'swbreak' stop reason for memory
  35584. breakpoints.
  35585. 'hwbreak'
  35586. The remote stub reports the 'hwbreak' stop reason for hardware
  35587. breakpoints.
  35588. 'fork-events'
  35589. The remote stub reports the 'fork' stop reason for fork
  35590. events.
  35591. 'vfork-events'
  35592. The remote stub reports the 'vfork' stop reason for vfork
  35593. events and vforkdone events.
  35594. 'exec-events'
  35595. The remote stub reports the 'exec' stop reason for exec
  35596. events.
  35597. 'vContSupported'
  35598. The remote stub reports the supported actions in the reply to
  35599. 'vCont?' packet.
  35600. 'QThreadEvents'
  35601. The remote stub understands the 'QThreadEvents' packet.
  35602. 'no-resumed'
  35603. The remote stub reports the 'N' stop reply.
  35604. 'qSymbol::'
  35605. Notify the target that GDB is prepared to serve symbol lookup
  35606. requests. Accept requests from the target for the values of
  35607. symbols.
  35608. Reply:
  35609. 'OK'
  35610. The target does not need to look up any (more) symbols.
  35611. 'qSymbol:SYM_NAME'
  35612. The target requests the value of symbol SYM_NAME (hex
  35613. encoded). GDB may provide the value by using the
  35614. 'qSymbol:SYM_VALUE:SYM_NAME' message, described below.
  35615. 'qSymbol:SYM_VALUE:SYM_NAME'
  35616. Set the value of SYM_NAME to SYM_VALUE.
  35617. SYM_NAME (hex encoded) is the name of a symbol whose value the
  35618. target has previously requested.
  35619. SYM_VALUE (hex) is the value for symbol SYM_NAME. If GDB cannot
  35620. supply a value for SYM_NAME, then this field will be empty.
  35621. Reply:
  35622. 'OK'
  35623. The target does not need to look up any (more) symbols.
  35624. 'qSymbol:SYM_NAME'
  35625. The target requests the value of a new symbol SYM_NAME (hex
  35626. encoded). GDB will continue to supply the values of symbols
  35627. (if available), until the target ceases to request them.
  35628. 'qTBuffer'
  35629. 'QTBuffer'
  35630. 'QTDisconnected'
  35631. 'QTDP'
  35632. 'QTDPsrc'
  35633. 'QTDV'
  35634. 'qTfP'
  35635. 'qTfV'
  35636. 'QTFrame'
  35637. 'qTMinFTPILen'
  35638. *Note Tracepoint Packets::.
  35639. 'qThreadExtraInfo,THREAD-ID'
  35640. Obtain from the target OS a printable string description of thread
  35641. attributes for the thread THREAD-ID; see *note thread-id syntax::,
  35642. for the forms of THREAD-ID. This string may contain anything that
  35643. the target OS thinks is interesting for GDB to tell the user about
  35644. the thread. The string is displayed in GDB's 'info threads'
  35645. display. Some examples of possible thread extra info strings are
  35646. 'Runnable', or 'Blocked on Mutex'.
  35647. Reply:
  35648. 'XX...'
  35649. Where 'XX...' is a hex encoding of ASCII data, comprising the
  35650. printable string containing the extra information about the
  35651. thread's attributes.
  35652. (Note that the 'qThreadExtraInfo' packet's name is separated from
  35653. the command by a ',', not a ':', contrary to the naming conventions
  35654. above. Please don't use this packet as a model for new packets.)
  35655. 'QTNotes'
  35656. 'qTP'
  35657. 'QTSave'
  35658. 'qTsP'
  35659. 'qTsV'
  35660. 'QTStart'
  35661. 'QTStop'
  35662. 'QTEnable'
  35663. 'QTDisable'
  35664. 'QTinit'
  35665. 'QTro'
  35666. 'qTStatus'
  35667. 'qTV'
  35668. 'qTfSTM'
  35669. 'qTsSTM'
  35670. 'qTSTMat'
  35671. *Note Tracepoint Packets::.
  35672. 'qXfer:OBJECT:read:ANNEX:OFFSET,LENGTH'
  35673. Read uninterpreted bytes from the target's special data area
  35674. identified by the keyword OBJECT. Request LENGTH bytes starting at
  35675. OFFSET bytes into the data. The content and encoding of ANNEX is
  35676. specific to OBJECT; it can supply additional details about what
  35677. data to access.
  35678. Reply:
  35679. 'm DATA'
  35680. Data DATA (*note Binary Data::) has been read from the target.
  35681. There may be more data at a higher address (although it is
  35682. permitted to return 'm' even for the last valid block of data,
  35683. as long as at least one byte of data was read). It is
  35684. possible for DATA to have fewer bytes than the LENGTH in the
  35685. request.
  35686. 'l DATA'
  35687. Data DATA (*note Binary Data::) has been read from the target.
  35688. There is no more data to be read. It is possible for DATA to
  35689. have fewer bytes than the LENGTH in the request.
  35690. 'l'
  35691. The OFFSET in the request is at the end of the data. There is
  35692. no more data to be read.
  35693. 'E00'
  35694. The request was malformed, or ANNEX was invalid.
  35695. 'E NN'
  35696. The offset was invalid, or there was an error encountered
  35697. reading the data. The NN part is a hex-encoded 'errno' value.
  35698. ''
  35699. An empty reply indicates the OBJECT string was not recognized
  35700. by the stub, or that the object does not support reading.
  35701. Here are the specific requests of this form defined so far. All
  35702. the 'qXfer:OBJECT:read:...' requests use the same reply formats,
  35703. listed above.
  35704. 'qXfer:auxv:read::OFFSET,LENGTH'
  35705. Access the target's "auxiliary vector". *Note auxiliary
  35706. vector: OS Information. Note ANNEX must be empty.
  35707. This packet is not probed by default; the remote stub must
  35708. request it, by supplying an appropriate 'qSupported' response
  35709. (*note qSupported::).
  35710. 'qXfer:btrace:read:ANNEX:OFFSET,LENGTH'
  35711. Return a description of the current branch trace. *Note
  35712. Branch Trace Format::. The annex part of the generic 'qXfer'
  35713. packet may have one of the following values:
  35714. 'all'
  35715. Returns all available branch trace.
  35716. 'new'
  35717. Returns all available branch trace if the branch trace
  35718. changed since the last read request.
  35719. 'delta'
  35720. Returns the new branch trace since the last read request.
  35721. Adds a new block to the end of the trace that begins at
  35722. zero and ends at the source location of the first branch
  35723. in the trace buffer. This extra block is used to stitch
  35724. traces together.
  35725. If the trace buffer overflowed, returns an error
  35726. indicating the overflow.
  35727. This packet is not probed by default; the remote stub must
  35728. request it by supplying an appropriate 'qSupported' response
  35729. (*note qSupported::).
  35730. 'qXfer:btrace-conf:read::OFFSET,LENGTH'
  35731. Return a description of the current branch trace
  35732. configuration. *Note Branch Trace Configuration Format::.
  35733. This packet is not probed by default; the remote stub must
  35734. request it by supplying an appropriate 'qSupported' response
  35735. (*note qSupported::).
  35736. 'qXfer:exec-file:read:ANNEX:OFFSET,LENGTH'
  35737. Return the full absolute name of the file that was executed to
  35738. create a process running on the remote system. The annex
  35739. specifies the numeric process ID of the process to query,
  35740. encoded as a hexadecimal number. If the annex part is empty
  35741. the remote stub should return the filename corresponding to
  35742. the currently executing process.
  35743. This packet is not probed by default; the remote stub must
  35744. request it, by supplying an appropriate 'qSupported' response
  35745. (*note qSupported::).
  35746. 'qXfer:features:read:ANNEX:OFFSET,LENGTH'
  35747. Access the "target description". *Note Target Descriptions::.
  35748. The annex specifies which XML document to access. The main
  35749. description is always loaded from the 'target.xml' annex.
  35750. This packet is not probed by default; the remote stub must
  35751. request it, by supplying an appropriate 'qSupported' response
  35752. (*note qSupported::).
  35753. 'qXfer:libraries:read:ANNEX:OFFSET,LENGTH'
  35754. Access the target's list of loaded libraries. *Note Library
  35755. List Format::. The annex part of the generic 'qXfer' packet
  35756. must be empty (*note qXfer read::).
  35757. Targets which maintain a list of libraries in the program's
  35758. memory do not need to implement this packet; it is designed
  35759. for platforms where the operating system manages the list of
  35760. loaded libraries.
  35761. This packet is not probed by default; the remote stub must
  35762. request it, by supplying an appropriate 'qSupported' response
  35763. (*note qSupported::).
  35764. 'qXfer:libraries-svr4:read:ANNEX:OFFSET,LENGTH'
  35765. Access the target's list of loaded libraries when the target
  35766. is an SVR4 platform. *Note Library List Format for SVR4
  35767. Targets::. The annex part of the generic 'qXfer' packet must
  35768. be empty unless the remote stub indicated it supports the
  35769. augmented form of this packet by supplying an appropriate
  35770. 'qSupported' response (*note qXfer read::, *note
  35771. qSupported::).
  35772. This packet is optional for better performance on SVR4
  35773. targets. GDB uses memory read packets to read the SVR4
  35774. library list otherwise.
  35775. This packet is not probed by default; the remote stub must
  35776. request it, by supplying an appropriate 'qSupported' response
  35777. (*note qSupported::).
  35778. If the remote stub indicates it supports the augmented form of
  35779. this packet then the annex part of the generic 'qXfer' packet
  35780. may contain a semicolon-separated list of 'NAME=VALUE'
  35781. arguments. The currently supported arguments are:
  35782. 'start=ADDRESS'
  35783. A hexadecimal number specifying the address of the
  35784. 'struct link_map' to start reading the library list from.
  35785. If unset or zero then the first 'struct link_map' in the
  35786. library list will be chosen as the starting point.
  35787. 'prev=ADDRESS'
  35788. A hexadecimal number specifying the address of the
  35789. 'struct link_map' immediately preceding the 'struct
  35790. link_map' specified by the 'start' argument. If unset or
  35791. zero then the remote stub will expect that no 'struct
  35792. link_map' exists prior to the starting point.
  35793. Arguments that are not understood by the remote stub will be
  35794. silently ignored.
  35795. 'qXfer:memory-map:read::OFFSET,LENGTH'
  35796. Access the target's "memory-map". *Note Memory Map Format::.
  35797. The annex part of the generic 'qXfer' packet must be empty
  35798. (*note qXfer read::).
  35799. This packet is not probed by default; the remote stub must
  35800. request it, by supplying an appropriate 'qSupported' response
  35801. (*note qSupported::).
  35802. 'qXfer:sdata:read::OFFSET,LENGTH'
  35803. Read contents of the extra collected static tracepoint marker
  35804. information. The annex part of the generic 'qXfer' packet
  35805. must be empty (*note qXfer read::). *Note Tracepoint Action
  35806. Lists: Tracepoint Actions.
  35807. This packet is not probed by default; the remote stub must
  35808. request it, by supplying an appropriate 'qSupported' response
  35809. (*note qSupported::).
  35810. 'qXfer:siginfo:read::OFFSET,LENGTH'
  35811. Read contents of the extra signal information on the target
  35812. system. The annex part of the generic 'qXfer' packet must be
  35813. empty (*note qXfer read::).
  35814. This packet is not probed by default; the remote stub must
  35815. request it, by supplying an appropriate 'qSupported' response
  35816. (*note qSupported::).
  35817. 'qXfer:threads:read::OFFSET,LENGTH'
  35818. Access the list of threads on target. *Note Thread List
  35819. Format::. The annex part of the generic 'qXfer' packet must
  35820. be empty (*note qXfer read::).
  35821. This packet is not probed by default; the remote stub must
  35822. request it, by supplying an appropriate 'qSupported' response
  35823. (*note qSupported::).
  35824. 'qXfer:traceframe-info:read::OFFSET,LENGTH'
  35825. Return a description of the current traceframe's contents.
  35826. *Note Traceframe Info Format::. The annex part of the generic
  35827. 'qXfer' packet must be empty (*note qXfer read::).
  35828. This packet is not probed by default; the remote stub must
  35829. request it, by supplying an appropriate 'qSupported' response
  35830. (*note qSupported::).
  35831. 'qXfer:uib:read:PC:OFFSET,LENGTH'
  35832. Return the unwind information block for PC. This packet is
  35833. used on OpenVMS/ia64 to ask the kernel unwind information.
  35834. This packet is not probed by default.
  35835. 'qXfer:fdpic:read:ANNEX:OFFSET,LENGTH'
  35836. Read contents of 'loadmap's on the target system. The annex,
  35837. either 'exec' or 'interp', specifies which 'loadmap',
  35838. executable 'loadmap' or interpreter 'loadmap' to read.
  35839. This packet is not probed by default; the remote stub must
  35840. request it, by supplying an appropriate 'qSupported' response
  35841. (*note qSupported::).
  35842. 'qXfer:osdata:read::OFFSET,LENGTH'
  35843. Access the target's "operating system information". *Note
  35844. Operating System Information::.
  35845. 'qXfer:OBJECT:write:ANNEX:OFFSET:DATA...'
  35846. Write uninterpreted bytes into the target's special data area
  35847. identified by the keyword OBJECT, starting at OFFSET bytes into the
  35848. data. The binary-encoded data (*note Binary Data::) to be written
  35849. is given by DATA.... The content and encoding of ANNEX is specific
  35850. to OBJECT; it can supply additional details about what data to
  35851. access.
  35852. Reply:
  35853. 'NN'
  35854. NN (hex encoded) is the number of bytes written. This may be
  35855. fewer bytes than supplied in the request.
  35856. 'E00'
  35857. The request was malformed, or ANNEX was invalid.
  35858. 'E NN'
  35859. The offset was invalid, or there was an error encountered
  35860. writing the data. The NN part is a hex-encoded 'errno' value.
  35861. ''
  35862. An empty reply indicates the OBJECT string was not recognized
  35863. by the stub, or that the object does not support writing.
  35864. Here are the specific requests of this form defined so far. All
  35865. the 'qXfer:OBJECT:write:...' requests use the same reply formats,
  35866. listed above.
  35867. 'qXfer:siginfo:write::OFFSET:DATA...'
  35868. Write DATA to the extra signal information on the target
  35869. system. The annex part of the generic 'qXfer' packet must be
  35870. empty (*note qXfer write::).
  35871. This packet is not probed by default; the remote stub must
  35872. request it, by supplying an appropriate 'qSupported' response
  35873. (*note qSupported::).
  35874. 'qXfer:OBJECT:OPERATION:...'
  35875. Requests of this form may be added in the future. When a stub does
  35876. not recognize the OBJECT keyword, or its support for OBJECT does
  35877. not recognize the OPERATION keyword, the stub must respond with an
  35878. empty packet.
  35879. 'qAttached:PID'
  35880. Return an indication of whether the remote server attached to an
  35881. existing process or created a new process. When the multiprocess
  35882. protocol extensions are supported (*note multiprocess
  35883. extensions::), PID is an integer in hexadecimal format identifying
  35884. the target process. Otherwise, GDB will omit the PID field and the
  35885. query packet will be simplified as 'qAttached'.
  35886. This query is used, for example, to know whether the remote process
  35887. should be detached or killed when a GDB session is ended with the
  35888. 'quit' command.
  35889. Reply:
  35890. '1'
  35891. The remote server attached to an existing process.
  35892. '0'
  35893. The remote server created a new process.
  35894. 'E NN'
  35895. A badly formed request or an error was encountered.
  35896. 'Qbtrace:bts'
  35897. Enable branch tracing for the current thread using Branch Trace
  35898. Store.
  35899. Reply:
  35900. 'OK'
  35901. Branch tracing has been enabled.
  35902. 'E.errtext'
  35903. A badly formed request or an error was encountered.
  35904. 'Qbtrace:pt'
  35905. Enable branch tracing for the current thread using Intel Processor
  35906. Trace.
  35907. Reply:
  35908. 'OK'
  35909. Branch tracing has been enabled.
  35910. 'E.errtext'
  35911. A badly formed request or an error was encountered.
  35912. 'Qbtrace:off'
  35913. Disable branch tracing for the current thread.
  35914. Reply:
  35915. 'OK'
  35916. Branch tracing has been disabled.
  35917. 'E.errtext'
  35918. A badly formed request or an error was encountered.
  35919. 'Qbtrace-conf:bts:size=VALUE'
  35920. Set the requested ring buffer size for new threads that use the
  35921. btrace recording method in bts format.
  35922. Reply:
  35923. 'OK'
  35924. The ring buffer size has been set.
  35925. 'E.errtext'
  35926. A badly formed request or an error was encountered.
  35927. 'Qbtrace-conf:pt:size=VALUE'
  35928. Set the requested ring buffer size for new threads that use the
  35929. btrace recording method in pt format.
  35930. Reply:
  35931. 'OK'
  35932. The ring buffer size has been set.
  35933. 'E.errtext'
  35934. A badly formed request or an error was encountered.
  35935. ---------- Footnotes ----------
  35936. (1) The 'qP' and 'qL' packets predate these conventions, and have
  35937. arguments without any terminator for the packet name; we suspect they
  35938. are in widespread use in places that are difficult to upgrade. The 'qC'
  35939. packet has no arguments, but some existing stubs (e.g. RedBoot) are
  35940. known to not check for the end of the packet.
  35941. 
  35942. File: gdb.info, Node: Architecture-Specific Protocol Details, Next: Tracepoint Packets, Prev: General Query Packets, Up: Remote Protocol
  35943. E.5 Architecture-Specific Protocol Details
  35944. ==========================================
  35945. This section describes how the remote protocol is applied to specific
  35946. target architectures. Also see *note Standard Target Features::, for
  35947. details of XML target descriptions for each architecture.
  35948. * Menu:
  35949. * ARM-Specific Protocol Details::
  35950. * MIPS-Specific Protocol Details::
  35951. 
  35952. File: gdb.info, Node: ARM-Specific Protocol Details, Next: MIPS-Specific Protocol Details, Up: Architecture-Specific Protocol Details
  35953. E.5.1 ARM-specific Protocol Details
  35954. -----------------------------------
  35955. * Menu:
  35956. * ARM Breakpoint Kinds::
  35957. 
  35958. File: gdb.info, Node: ARM Breakpoint Kinds, Up: ARM-Specific Protocol Details
  35959. E.5.1.1 ARM Breakpoint Kinds
  35960. ............................
  35961. These breakpoint kinds are defined for the 'Z0' and 'Z1' packets.
  35962. 2
  35963. 16-bit Thumb mode breakpoint.
  35964. 3
  35965. 32-bit Thumb mode (Thumb-2) breakpoint.
  35966. 4
  35967. 32-bit ARM mode breakpoint.
  35968. 
  35969. File: gdb.info, Node: MIPS-Specific Protocol Details, Prev: ARM-Specific Protocol Details, Up: Architecture-Specific Protocol Details
  35970. E.5.2 MIPS-specific Protocol Details
  35971. ------------------------------------
  35972. * Menu:
  35973. * MIPS Register packet Format::
  35974. * MIPS Breakpoint Kinds::
  35975. 
  35976. File: gdb.info, Node: MIPS Register packet Format, Next: MIPS Breakpoint Kinds, Up: MIPS-Specific Protocol Details
  35977. E.5.2.1 MIPS Register Packet Format
  35978. ...................................
  35979. The following 'g'/'G' packets have previously been defined. In the
  35980. below, some thirty-two bit registers are transferred as sixty-four bits.
  35981. Those registers should be zero/sign extended (which?) to fill the space
  35982. allocated. Register bytes are transferred in target byte order. The
  35983. two nibbles within a register byte are transferred most-significant -
  35984. least-significant.
  35985. MIPS32
  35986. All registers are transferred as thirty-two bit quantities in the
  35987. order: 32 general-purpose; sr; lo; hi; bad; cause; pc; 32
  35988. floating-point registers; fsr; fir; fp.
  35989. MIPS64
  35990. All registers are transferred as sixty-four bit quantities
  35991. (including thirty-two bit registers such as 'sr'). The ordering is
  35992. the same as 'MIPS32'.
  35993. 
  35994. File: gdb.info, Node: MIPS Breakpoint Kinds, Prev: MIPS Register packet Format, Up: MIPS-Specific Protocol Details
  35995. E.5.2.2 MIPS Breakpoint Kinds
  35996. .............................
  35997. These breakpoint kinds are defined for the 'Z0' and 'Z1' packets.
  35998. 2
  35999. 16-bit MIPS16 mode breakpoint.
  36000. 3
  36001. 16-bit microMIPS mode breakpoint.
  36002. 4
  36003. 32-bit standard MIPS mode breakpoint.
  36004. 5
  36005. 32-bit microMIPS mode breakpoint.
  36006. 
  36007. File: gdb.info, Node: Tracepoint Packets, Next: Host I/O Packets, Prev: Architecture-Specific Protocol Details, Up: Remote Protocol
  36008. E.6 Tracepoint Packets
  36009. ======================
  36010. Here we describe the packets GDB uses to implement tracepoints (*note
  36011. Tracepoints::).
  36012. 'QTDP:N:ADDR:ENA:STEP:PASS[:FFLEN][:XLEN,BYTES][-]'
  36013. Create a new tracepoint, number N, at ADDR. If ENA is 'E', then
  36014. the tracepoint is enabled; if it is 'D', then the tracepoint is
  36015. disabled. The STEP gives the tracepoint's step count, and PASS
  36016. gives its pass count. If an 'F' is present, then the tracepoint is
  36017. to be a fast tracepoint, and the FLEN is the number of bytes that
  36018. the target should copy elsewhere to make room for the tracepoint.
  36019. If an 'X' is present, it introduces a tracepoint condition, which
  36020. consists of a hexadecimal length, followed by a comma and
  36021. hex-encoded bytes, in a manner similar to action encodings as
  36022. described below. If the trailing '-' is present, further 'QTDP'
  36023. packets will follow to specify this tracepoint's actions.
  36024. Replies:
  36025. 'OK'
  36026. The packet was understood and carried out.
  36027. 'qRelocInsn'
  36028. *Note Relocate instruction reply packet: Tracepoint Packets.
  36029. ''
  36030. The packet was not recognized.
  36031. 'QTDP:-N:ADDR:[S]ACTION...[-]'
  36032. Define actions to be taken when a tracepoint is hit. The N and
  36033. ADDR must be the same as in the initial 'QTDP' packet for this
  36034. tracepoint. This packet may only be sent immediately after another
  36035. 'QTDP' packet that ended with a '-'. If the trailing '-' is
  36036. present, further 'QTDP' packets will follow, specifying more
  36037. actions for this tracepoint.
  36038. In the series of action packets for a given tracepoint, at most one
  36039. can have an 'S' before its first ACTION. If such a packet is sent,
  36040. it and the following packets define "while-stepping" actions. Any
  36041. prior packets define ordinary actions -- that is, those taken when
  36042. the tracepoint is first hit. If no action packet has an 'S', then
  36043. all the packets in the series specify ordinary tracepoint actions.
  36044. The 'ACTION...' portion of the packet is a series of actions,
  36045. concatenated without separators. Each action has one of the
  36046. following forms:
  36047. 'R MASK'
  36048. Collect the registers whose bits are set in MASK, a
  36049. hexadecimal number whose I'th bit is set if register number I
  36050. should be collected. (The least significant bit is numbered
  36051. zero.) Note that MASK may be any number of digits long; it
  36052. may not fit in a 32-bit word.
  36053. 'M BASEREG,OFFSET,LEN'
  36054. Collect LEN bytes of memory starting at the address in
  36055. register number BASEREG, plus OFFSET. If BASEREG is '-1',
  36056. then the range has a fixed address: OFFSET is the address of
  36057. the lowest byte to collect. The BASEREG, OFFSET, and LEN
  36058. parameters are all unsigned hexadecimal values (the '-1' value
  36059. for BASEREG is a special case).
  36060. 'X LEN,EXPR'
  36061. Evaluate EXPR, whose length is LEN, and collect memory as it
  36062. directs. The agent expression EXPR is as described in *note
  36063. Agent Expressions::. Each byte of the expression is encoded
  36064. as a two-digit hex number in the packet; LEN is the number of
  36065. bytes in the expression (and thus one-half the number of hex
  36066. digits in the packet).
  36067. Any number of actions may be packed together in a single 'QTDP'
  36068. packet, as long as the packet does not exceed the maximum packet
  36069. length (400 bytes, for many stubs). There may be only one 'R'
  36070. action per tracepoint, and it must precede any 'M' or 'X' actions.
  36071. Any registers referred to by 'M' and 'X' actions must be collected
  36072. by a preceding 'R' action. (The "while-stepping" actions are
  36073. treated as if they were attached to a separate tracepoint, as far
  36074. as these restrictions are concerned.)
  36075. Replies:
  36076. 'OK'
  36077. The packet was understood and carried out.
  36078. 'qRelocInsn'
  36079. *Note Relocate instruction reply packet: Tracepoint Packets.
  36080. ''
  36081. The packet was not recognized.
  36082. 'QTDPsrc:N:ADDR:TYPE:START:SLEN:BYTES'
  36083. Specify a source string of tracepoint N at address ADDR. This is
  36084. useful to get accurate reproduction of the tracepoints originally
  36085. downloaded at the beginning of the trace run. The TYPE is the name
  36086. of the tracepoint part, such as 'cond' for the tracepoint's
  36087. conditional expression (see below for a list of types), while BYTES
  36088. is the string, encoded in hexadecimal.
  36089. START is the offset of the BYTES within the overall source string,
  36090. while SLEN is the total length of the source string. This is
  36091. intended for handling source strings that are longer than will fit
  36092. in a single packet.
  36093. The available string types are 'at' for the location, 'cond' for
  36094. the conditional, and 'cmd' for an action command. GDB sends a
  36095. separate packet for each command in the action list, in the same
  36096. order in which the commands are stored in the list.
  36097. The target does not need to do anything with source strings except
  36098. report them back as part of the replies to the 'qTfP'/'qTsP' query
  36099. packets.
  36100. Although this packet is optional, and GDB will only send it if the
  36101. target replies with 'TracepointSource' *Note General Query
  36102. Packets::, it makes both disconnected tracing and trace files much
  36103. easier to use. Otherwise the user must be careful that the
  36104. tracepoints in effect while looking at trace frames are identical
  36105. to the ones in effect during the trace run; even a small
  36106. discrepancy could cause 'tdump' not to work, or a particular trace
  36107. frame not be found.
  36108. 'QTDV:N:VALUE:BUILTIN:NAME'
  36109. Create a new trace state variable, number N, with an initial value
  36110. of VALUE, which is a 64-bit signed integer. Both N and VALUE are
  36111. encoded as hexadecimal values. GDB has the option of not using
  36112. this packet for initial values of zero; the target should simply
  36113. create the trace state variables as they are mentioned in
  36114. expressions. The value BUILTIN should be 1 (one) if the trace
  36115. state variable is builtin and 0 (zero) if it is not builtin. GDB
  36116. only sets BUILTIN to 1 if a previous 'qTfV' or 'qTsV' packet had it
  36117. set. The contents of NAME is the hex-encoded name (without the
  36118. leading '$') of the trace state variable.
  36119. 'QTFrame:N'
  36120. Select the N'th tracepoint frame from the buffer, and use the
  36121. register and memory contents recorded there to answer subsequent
  36122. request packets from GDB.
  36123. A successful reply from the stub indicates that the stub has found
  36124. the requested frame. The response is a series of parts,
  36125. concatenated without separators, describing the frame we selected.
  36126. Each part has one of the following forms:
  36127. 'F F'
  36128. The selected frame is number N in the trace frame buffer; F is
  36129. a hexadecimal number. If F is '-1', then there was no frame
  36130. matching the criteria in the request packet.
  36131. 'T T'
  36132. The selected trace frame records a hit of tracepoint number T;
  36133. T is a hexadecimal number.
  36134. 'QTFrame:pc:ADDR'
  36135. Like 'QTFrame:N', but select the first tracepoint frame after the
  36136. currently selected frame whose PC is ADDR; ADDR is a hexadecimal
  36137. number.
  36138. 'QTFrame:tdp:T'
  36139. Like 'QTFrame:N', but select the first tracepoint frame after the
  36140. currently selected frame that is a hit of tracepoint T; T is a
  36141. hexadecimal number.
  36142. 'QTFrame:range:START:END'
  36143. Like 'QTFrame:N', but select the first tracepoint frame after the
  36144. currently selected frame whose PC is between START (inclusive) and
  36145. END (inclusive); START and END are hexadecimal numbers.
  36146. 'QTFrame:outside:START:END'
  36147. Like 'QTFrame:range:START:END', but select the first frame
  36148. _outside_ the given range of addresses (exclusive).
  36149. 'qTMinFTPILen'
  36150. This packet requests the minimum length of instruction at which a
  36151. fast tracepoint (*note Set Tracepoints::) may be placed. For
  36152. instance, on the 32-bit x86 architecture, it is possible to use a
  36153. 4-byte jump, but it depends on the target system being able to
  36154. create trampolines in the first 64K of memory, which might or might
  36155. not be possible for that system. So the reply to this packet will
  36156. be 4 if it is able to arrange for that.
  36157. Replies:
  36158. '0'
  36159. The minimum instruction length is currently unknown.
  36160. 'LENGTH'
  36161. The minimum instruction length is LENGTH, where LENGTH is a
  36162. hexadecimal number greater or equal to 1. A reply of 1 means
  36163. that a fast tracepoint may be placed on any instruction
  36164. regardless of size.
  36165. 'E'
  36166. An error has occurred.
  36167. ''
  36168. An empty reply indicates that the request is not supported by
  36169. the stub.
  36170. 'QTStart'
  36171. Begin the tracepoint experiment. Begin collecting data from
  36172. tracepoint hits in the trace frame buffer. This packet supports
  36173. the 'qRelocInsn' reply (*note Relocate instruction reply packet:
  36174. Tracepoint Packets.).
  36175. 'QTStop'
  36176. End the tracepoint experiment. Stop collecting trace frames.
  36177. 'QTEnable:N:ADDR'
  36178. Enable tracepoint N at address ADDR in a started tracepoint
  36179. experiment. If the tracepoint was previously disabled, then
  36180. collection of data from it will resume.
  36181. 'QTDisable:N:ADDR'
  36182. Disable tracepoint N at address ADDR in a started tracepoint
  36183. experiment. No more data will be collected from the tracepoint
  36184. unless 'QTEnable:N:ADDR' is subsequently issued.
  36185. 'QTinit'
  36186. Clear the table of tracepoints, and empty the trace frame buffer.
  36187. 'QTro:START1,END1:START2,END2:...'
  36188. Establish the given ranges of memory as "transparent". The stub
  36189. will answer requests for these ranges from memory's current
  36190. contents, if they were not collected as part of the tracepoint hit.
  36191. GDB uses this to mark read-only regions of memory, like those
  36192. containing program code. Since these areas never change, they
  36193. should still have the same contents they did when the tracepoint
  36194. was hit, so there's no reason for the stub to refuse to provide
  36195. their contents.
  36196. 'QTDisconnected:VALUE'
  36197. Set the choice to what to do with the tracing run when GDB
  36198. disconnects from the target. A VALUE of 1 directs the target to
  36199. continue the tracing run, while 0 tells the target to stop tracing
  36200. if GDB is no longer in the picture.
  36201. 'qTStatus'
  36202. Ask the stub if there is a trace experiment running right now.
  36203. The reply has the form:
  36204. 'TRUNNING[;FIELD]...'
  36205. RUNNING is a single digit '1' if the trace is presently
  36206. running, or '0' if not. It is followed by semicolon-separated
  36207. optional fields that an agent may use to report additional
  36208. status.
  36209. If the trace is not running, the agent may report any of several
  36210. explanations as one of the optional fields:
  36211. 'tnotrun:0'
  36212. No trace has been run yet.
  36213. 'tstop[:TEXT]:0'
  36214. The trace was stopped by a user-originated stop command. The
  36215. optional TEXT field is a user-supplied string supplied as part
  36216. of the stop command (for instance, an explanation of why the
  36217. trace was stopped manually). It is hex-encoded.
  36218. 'tfull:0'
  36219. The trace stopped because the trace buffer filled up.
  36220. 'tdisconnected:0'
  36221. The trace stopped because GDB disconnected from the target.
  36222. 'tpasscount:TPNUM'
  36223. The trace stopped because tracepoint TPNUM exceeded its pass
  36224. count.
  36225. 'terror:TEXT:TPNUM'
  36226. The trace stopped because tracepoint TPNUM had an error. The
  36227. string TEXT is available to describe the nature of the error
  36228. (for instance, a divide by zero in the condition expression);
  36229. it is hex encoded.
  36230. 'tunknown:0'
  36231. The trace stopped for some other reason.
  36232. Additional optional fields supply statistical and other
  36233. information. Although not required, they are extremely useful for
  36234. users monitoring the progress of a trace run. If a trace has
  36235. stopped, and these numbers are reported, they must reflect the
  36236. state of the just-stopped trace.
  36237. 'tframes:N'
  36238. The number of trace frames in the buffer.
  36239. 'tcreated:N'
  36240. The total number of trace frames created during the run. This
  36241. may be larger than the trace frame count, if the buffer is
  36242. circular.
  36243. 'tsize:N'
  36244. The total size of the trace buffer, in bytes.
  36245. 'tfree:N'
  36246. The number of bytes still unused in the buffer.
  36247. 'circular:N'
  36248. The value of the circular trace buffer flag. '1' means that
  36249. the trace buffer is circular and old trace frames will be
  36250. discarded if necessary to make room, '0' means that the trace
  36251. buffer is linear and may fill up.
  36252. 'disconn:N'
  36253. The value of the disconnected tracing flag. '1' means that
  36254. tracing will continue after GDB disconnects, '0' means that
  36255. the trace run will stop.
  36256. 'qTP:TP:ADDR'
  36257. Ask the stub for the current state of tracepoint number TP at
  36258. address ADDR.
  36259. Replies:
  36260. 'VHITS:USAGE'
  36261. The tracepoint has been hit HITS times so far during the trace
  36262. run, and accounts for USAGE in the trace buffer. Note that
  36263. 'while-stepping' steps are not counted as separate hits, but
  36264. the steps' space consumption is added into the usage number.
  36265. 'qTV:VAR'
  36266. Ask the stub for the value of the trace state variable number VAR.
  36267. Replies:
  36268. 'VVALUE'
  36269. The value of the variable is VALUE. This will be the current
  36270. value of the variable if the user is examining a running
  36271. target, or a saved value if the variable was collected in the
  36272. trace frame that the user is looking at. Note that multiple
  36273. requests may result in different reply values, such as when
  36274. requesting values while the program is running.
  36275. 'U'
  36276. The value of the variable is unknown. This would occur, for
  36277. example, if the user is examining a trace frame in which the
  36278. requested variable was not collected.
  36279. 'qTfP'
  36280. 'qTsP'
  36281. These packets request data about tracepoints that are being used by
  36282. the target. GDB sends 'qTfP' to get the first piece of data, and
  36283. multiple 'qTsP' to get additional pieces. Replies to these packets
  36284. generally take the form of the 'QTDP' packets that define
  36285. tracepoints. (FIXME add detailed syntax)
  36286. 'qTfV'
  36287. 'qTsV'
  36288. These packets request data about trace state variables that are on
  36289. the target. GDB sends 'qTfV' to get the first vari of data, and
  36290. multiple 'qTsV' to get additional variables. Replies to these
  36291. packets follow the syntax of the 'QTDV' packets that define trace
  36292. state variables.
  36293. 'qTfSTM'
  36294. 'qTsSTM'
  36295. These packets request data about static tracepoint markers that
  36296. exist in the target program. GDB sends 'qTfSTM' to get the first
  36297. piece of data, and multiple 'qTsSTM' to get additional pieces.
  36298. Replies to these packets take the following form:
  36299. Reply:
  36300. 'm ADDRESS:ID:EXTRA'
  36301. A single marker
  36302. 'm ADDRESS:ID:EXTRA,ADDRESS:ID:EXTRA...'
  36303. a comma-separated list of markers
  36304. 'l'
  36305. (lower case letter 'L') denotes end of list.
  36306. 'E NN'
  36307. An error occurred. The error number NN is given as hex
  36308. digits.
  36309. ''
  36310. An empty reply indicates that the request is not supported by
  36311. the stub.
  36312. The ADDRESS is encoded in hex; ID and EXTRA are strings encoded in
  36313. hex.
  36314. In response to each query, the target will reply with a list of one
  36315. or more markers, separated by commas. GDB will respond to each
  36316. reply with a request for more markers (using the 'qs' form of the
  36317. query), until the target responds with 'l' (lower-case ell, for
  36318. "last").
  36319. 'qTSTMat:ADDRESS'
  36320. This packets requests data about static tracepoint markers in the
  36321. target program at ADDRESS. Replies to this packet follow the
  36322. syntax of the 'qTfSTM' and 'qTsSTM' packets that list static
  36323. tracepoint markers.
  36324. 'QTSave:FILENAME'
  36325. This packet directs the target to save trace data to the file name
  36326. FILENAME in the target's filesystem. The FILENAME is encoded as a
  36327. hex string; the interpretation of the file name (relative vs
  36328. absolute, wild cards, etc) is up to the target.
  36329. 'qTBuffer:OFFSET,LEN'
  36330. Return up to LEN bytes of the current contents of trace buffer,
  36331. starting at OFFSET. The trace buffer is treated as if it were a
  36332. contiguous collection of traceframes, as per the trace file format.
  36333. The reply consists as many hex-encoded bytes as the target can
  36334. deliver in a packet; it is not an error to return fewer than were
  36335. asked for. A reply consisting of just 'l' indicates that no bytes
  36336. are available.
  36337. 'QTBuffer:circular:VALUE'
  36338. This packet directs the target to use a circular trace buffer if
  36339. VALUE is 1, or a linear buffer if the value is 0.
  36340. 'QTBuffer:size:SIZE'
  36341. This packet directs the target to make the trace buffer be of size
  36342. SIZE if possible. A value of '-1' tells the target to use whatever
  36343. size it prefers.
  36344. 'QTNotes:[TYPE:TEXT][;TYPE:TEXT]...'
  36345. This packet adds optional textual notes to the trace run.
  36346. Allowable types include 'user', 'notes', and 'tstop', the TEXT
  36347. fields are arbitrary strings, hex-encoded.
  36348. E.6.1 Relocate instruction reply packet
  36349. ---------------------------------------
  36350. When installing fast tracepoints in memory, the target may need to
  36351. relocate the instruction currently at the tracepoint address to a
  36352. different address in memory. For most instructions, a simple copy is
  36353. enough, but, for example, call instructions that implicitly push the
  36354. return address on the stack, and relative branches or other PC-relative
  36355. instructions require offset adjustment, so that the effect of executing
  36356. the instruction at a different address is the same as if it had executed
  36357. in the original location.
  36358. In response to several of the tracepoint packets, the target may also
  36359. respond with a number of intermediate 'qRelocInsn' request packets
  36360. before the final result packet, to have GDB handle this relocation
  36361. operation. If a packet supports this mechanism, its documentation will
  36362. explicitly say so. See for example the above descriptions for the
  36363. 'QTStart' and 'QTDP' packets. The format of the request is:
  36364. 'qRelocInsn:FROM;TO'
  36365. This requests GDB to copy instruction at address FROM to address
  36366. TO, possibly adjusted so that executing the instruction at TO has
  36367. the same effect as executing it at FROM. GDB writes the adjusted
  36368. instruction to target memory starting at TO.
  36369. Replies:
  36370. 'qRelocInsn:ADJUSTED_SIZE'
  36371. Informs the stub the relocation is complete. The ADJUSTED_SIZE is
  36372. the length in bytes of resulting relocated instruction sequence.
  36373. 'E NN'
  36374. A badly formed request was detected, or an error was encountered
  36375. while relocating the instruction.
  36376. 
  36377. File: gdb.info, Node: Host I/O Packets, Next: Interrupts, Prev: Tracepoint Packets, Up: Remote Protocol
  36378. E.7 Host I/O Packets
  36379. ====================
  36380. The "Host I/O" packets allow GDB to perform I/O operations on the far
  36381. side of a remote link. For example, Host I/O is used to upload and
  36382. download files to a remote target with its own filesystem. Host I/O
  36383. uses the same constant values and data structure layout as the
  36384. target-initiated File-I/O protocol. However, the Host I/O packets are
  36385. structured differently. The target-initiated protocol relies on target
  36386. memory to store parameters and buffers. Host I/O requests are initiated
  36387. by GDB, and the target's memory is not involved. *Note File-I/O Remote
  36388. Protocol Extension::, for more details on the target-initiated protocol.
  36389. The Host I/O request packets all encode a single operation along with
  36390. its arguments. They have this format:
  36391. 'vFile:OPERATION: PARAMETER...'
  36392. OPERATION is the name of the particular request; the target should
  36393. compare the entire packet name up to the second colon when checking
  36394. for a supported operation. The format of PARAMETER depends on the
  36395. operation. Numbers are always passed in hexadecimal. Negative
  36396. numbers have an explicit minus sign (i.e. two's complement is not
  36397. used). Strings (e.g. filenames) are encoded as a series of
  36398. hexadecimal bytes. The last argument to a system call may be a
  36399. buffer of escaped binary data (*note Binary Data::).
  36400. The valid responses to Host I/O packets are:
  36401. 'F RESULT [, ERRNO] [; ATTACHMENT]'
  36402. RESULT is the integer value returned by this operation, usually
  36403. non-negative for success and -1 for errors. If an error has
  36404. occured, ERRNO will be included in the result specifying a value
  36405. defined by the File-I/O protocol (*note Errno Values::). For
  36406. operations which return data, ATTACHMENT supplies the data as a
  36407. binary buffer. Binary buffers in response packets are escaped in
  36408. the normal way (*note Binary Data::). See the individual packet
  36409. documentation for the interpretation of RESULT and ATTACHMENT.
  36410. ''
  36411. An empty response indicates that this operation is not recognized.
  36412. These are the supported Host I/O operations:
  36413. 'vFile:open: FILENAME, FLAGS, MODE'
  36414. Open a file at FILENAME and return a file descriptor for it, or
  36415. return -1 if an error occurs. The FILENAME is a string, FLAGS is
  36416. an integer indicating a mask of open flags (*note Open Flags::),
  36417. and MODE is an integer indicating a mask of mode bits to use if the
  36418. file is created (*note mode_t Values::). *Note open::, for details
  36419. of the open flags and mode values.
  36420. 'vFile:close: FD'
  36421. Close the open file corresponding to FD and return 0, or -1 if an
  36422. error occurs.
  36423. 'vFile:pread: FD, COUNT, OFFSET'
  36424. Read data from the open file corresponding to FD. Up to COUNT
  36425. bytes will be read from the file, starting at OFFSET relative to
  36426. the start of the file. The target may read fewer bytes; common
  36427. reasons include packet size limits and an end-of-file condition.
  36428. The number of bytes read is returned. Zero should only be returned
  36429. for a successful read at the end of the file, or if COUNT was zero.
  36430. The data read should be returned as a binary attachment on success.
  36431. If zero bytes were read, the response should include an empty
  36432. binary attachment (i.e. a trailing semicolon). The return value is
  36433. the number of target bytes read; the binary attachment may be
  36434. longer if some characters were escaped.
  36435. 'vFile:pwrite: FD, OFFSET, DATA'
  36436. Write DATA (a binary buffer) to the open file corresponding to FD.
  36437. Start the write at OFFSET from the start of the file. Unlike many
  36438. 'write' system calls, there is no separate COUNT argument; the
  36439. length of DATA in the packet is used. 'vFile:pwrite' returns the
  36440. number of bytes written, which may be shorter than the length of
  36441. DATA, or -1 if an error occurred.
  36442. 'vFile:fstat: FD'
  36443. Get information about the open file corresponding to FD. On
  36444. success the information is returned as a binary attachment and the
  36445. return value is the size of this attachment in bytes. If an error
  36446. occurs the return value is -1. The format of the returned binary
  36447. attachment is as described in *note struct stat::.
  36448. 'vFile:unlink: FILENAME'
  36449. Delete the file at FILENAME on the target. Return 0, or -1 if an
  36450. error occurs. The FILENAME is a string.
  36451. 'vFile:readlink: FILENAME'
  36452. Read value of symbolic link FILENAME on the target. Return the
  36453. number of bytes read, or -1 if an error occurs.
  36454. The data read should be returned as a binary attachment on success.
  36455. If zero bytes were read, the response should include an empty
  36456. binary attachment (i.e. a trailing semicolon). The return value is
  36457. the number of target bytes read; the binary attachment may be
  36458. longer if some characters were escaped.
  36459. 'vFile:setfs: PID'
  36460. Select the filesystem on which 'vFile' operations with FILENAME
  36461. arguments will operate. This is required for GDB to be able to
  36462. access files on remote targets where the remote stub does not share
  36463. a common filesystem with the inferior(s).
  36464. If PID is nonzero, select the filesystem as seen by process PID.
  36465. If PID is zero, select the filesystem as seen by the remote stub.
  36466. Return 0 on success, or -1 if an error occurs. If 'vFile:setfs:'
  36467. indicates success, the selected filesystem remains selected until
  36468. the next successful 'vFile:setfs:' operation.
  36469. 
  36470. File: gdb.info, Node: Interrupts, Next: Notification Packets, Prev: Host I/O Packets, Up: Remote Protocol
  36471. E.8 Interrupts
  36472. ==============
  36473. In all-stop mode, when a program on the remote target is running, GDB
  36474. may attempt to interrupt it by sending a 'Ctrl-C', 'BREAK' or a 'BREAK'
  36475. followed by 'g', control of which is specified via GDB's
  36476. 'interrupt-sequence'.
  36477. The precise meaning of 'BREAK' is defined by the transport mechanism
  36478. and may, in fact, be undefined. GDB does not currently define a 'BREAK'
  36479. mechanism for any of the network interfaces except for TCP, in which
  36480. case GDB sends the 'telnet' BREAK sequence.
  36481. 'Ctrl-C', on the other hand, is defined and implemented for all
  36482. transport mechanisms. It is represented by sending the single byte
  36483. '0x03' without any of the usual packet overhead described in the
  36484. Overview section (*note Overview::). When a '0x03' byte is transmitted
  36485. as part of a packet, it is considered to be packet data and does _not_
  36486. represent an interrupt. E.g., an 'X' packet (*note X packet::), used
  36487. for binary downloads, may include an unescaped '0x03' as part of its
  36488. packet.
  36489. 'BREAK' followed by 'g' is also known as Magic SysRq g. When Linux
  36490. kernel receives this sequence from serial port, it stops execution and
  36491. connects to gdb.
  36492. In non-stop mode, because packet resumptions are asynchronous (*note
  36493. vCont packet::), GDB is always free to send a remote command to the
  36494. remote stub, even when the target is running. For that reason, GDB
  36495. instead sends a regular packet (*note vCtrlC packet::) with the usual
  36496. packet framing instead of the single byte '0x03'.
  36497. Stubs are not required to recognize these interrupt mechanisms and
  36498. the precise meaning associated with receipt of the interrupt is
  36499. implementation defined. If the target supports debugging of multiple
  36500. threads and/or processes, it should attempt to interrupt all
  36501. currently-executing threads and processes. If the stub is successful at
  36502. interrupting the running program, it should send one of the stop reply
  36503. packets (*note Stop Reply Packets::) to GDB as a result of successfully
  36504. stopping the program in all-stop mode, and a stop reply for each stopped
  36505. thread in non-stop mode. Interrupts received while the program is
  36506. stopped are queued and the program will be interrupted when it is
  36507. resumed next time.
  36508. 
  36509. File: gdb.info, Node: Notification Packets, Next: Remote Non-Stop, Prev: Interrupts, Up: Remote Protocol
  36510. E.9 Notification Packets
  36511. ========================
  36512. The GDB remote serial protocol includes "notifications", packets that
  36513. require no acknowledgment. Both the GDB and the stub may send
  36514. notifications (although the only notifications defined at present are
  36515. sent by the stub). Notifications carry information without incurring
  36516. the round-trip latency of an acknowledgment, and so are useful for
  36517. low-impact communications where occasional packet loss is not a problem.
  36518. A notification packet has the form '% DATA # CHECKSUM', where DATA is
  36519. the content of the notification, and CHECKSUM is a checksum of DATA,
  36520. computed and formatted as for ordinary GDB packets. A notification's
  36521. DATA never contains '$', '%' or '#' characters. Upon receiving a
  36522. notification, the recipient sends no '+' or '-' to acknowledge the
  36523. notification's receipt or to report its corruption.
  36524. Every notification's DATA begins with a name, which contains no colon
  36525. characters, followed by a colon character.
  36526. Recipients should silently ignore corrupted notifications and
  36527. notifications they do not understand. Recipients should restart timeout
  36528. periods on receipt of a well-formed notification, whether or not they
  36529. understand it.
  36530. Senders should only send the notifications described here when this
  36531. protocol description specifies that they are permitted. In the future,
  36532. we may extend the protocol to permit existing notifications in new
  36533. contexts; this rule helps older senders avoid confusing newer
  36534. recipients.
  36535. (Older versions of GDB ignore bytes received until they see the '$'
  36536. byte that begins an ordinary packet, so new stubs may transmit
  36537. notifications without fear of confusing older clients. There are no
  36538. notifications defined for GDB to send at the moment, but we assume that
  36539. most older stubs would ignore them, as well.)
  36540. Each notification is comprised of three parts:
  36541. 'NAME:EVENT'
  36542. The notification packet is sent by the side that initiates the
  36543. exchange (currently, only the stub does that), with EVENT carrying
  36544. the specific information about the notification, and NAME
  36545. specifying the name of the notification.
  36546. 'ACK'
  36547. The acknowledge sent by the other side, usually GDB, to acknowledge
  36548. the exchange and request the event.
  36549. The purpose of an asynchronous notification mechanism is to report to
  36550. GDB that something interesting happened in the remote stub.
  36551. The remote stub may send notification NAME:EVENT at any time, but GDB
  36552. acknowledges the notification when appropriate. The notification event
  36553. is pending before GDB acknowledges. Only one notification at a time may
  36554. be pending; if additional events occur before GDB has acknowledged the
  36555. previous notification, they must be queued by the stub for later
  36556. synchronous transmission in response to ACK packets from GDB. Because
  36557. the notification mechanism is unreliable, the stub is permitted to
  36558. resend a notification if it believes GDB may not have received it.
  36559. Specifically, notifications may appear when GDB is not otherwise
  36560. reading input from the stub, or when GDB is expecting to read a normal
  36561. synchronous response or a '+'/'-' acknowledgment to a packet it has
  36562. sent. Notification packets are distinct from any other communication
  36563. from the stub so there is no ambiguity.
  36564. After receiving a notification, GDB shall acknowledge it by sending a
  36565. ACK packet as a regular, synchronous request to the stub. Such
  36566. acknowledgment is not required to happen immediately, as GDB is
  36567. permitted to send other, unrelated packets to the stub first, which the
  36568. stub should process normally.
  36569. Upon receiving a ACK packet, if the stub has other queued events to
  36570. report to GDB, it shall respond by sending a normal EVENT. GDB shall
  36571. then send another ACK packet to solicit further responses; again, it is
  36572. permitted to send other, unrelated packets as well which the stub should
  36573. process normally.
  36574. If the stub receives a ACK packet and there are no additional EVENT
  36575. to report, the stub shall return an 'OK' response. At this point, GDB
  36576. has finished processing a notification and the stub has completed
  36577. sending any queued events. GDB won't accept any new notifications until
  36578. the final 'OK' is received . If further notification events occur, the
  36579. stub shall send a new notification, GDB shall accept the notification,
  36580. and the process shall be repeated.
  36581. The process of asynchronous notification can be illustrated by the
  36582. following example:
  36583. <- %Stop:T0505:98e7ffbf;04:4ce6ffbf;08:b1b6e54c;thread:p7526.7526;core:0;
  36584. ...
  36585. -> vStopped
  36586. <- T0505:68f37db7;04:40f37db7;08:63850408;thread:p7526.7528;core:0;
  36587. -> vStopped
  36588. <- T0505:68e3fdb6;04:40e3fdb6;08:63850408;thread:p7526.7529;core:0;
  36589. -> vStopped
  36590. <- OK
  36591. The following notifications are defined:
  36592. NotificationAck Event Description
  36593. Stop vStopped REPLY. The REPLY has the Report an asynchronous
  36594. form of a stop reply, as stop event in non-stop
  36595. described in mode.
  36596. *note Stop Reply Packets::.
  36597. Refer to
  36598. *note Remote Non-Stop::,
  36599. for information on how
  36600. these notifications are
  36601. acknowledged by GDB.
  36602. 
  36603. File: gdb.info, Node: Remote Non-Stop, Next: Packet Acknowledgment, Prev: Notification Packets, Up: Remote Protocol
  36604. E.10 Remote Protocol Support for Non-Stop Mode
  36605. ==============================================
  36606. GDB's remote protocol supports non-stop debugging of multi-threaded
  36607. programs, as described in *note Non-Stop Mode::. If the stub supports
  36608. non-stop mode, it should report that to GDB by including 'QNonStop+' in
  36609. its 'qSupported' response (*note qSupported::).
  36610. GDB typically sends a 'QNonStop' packet only when establishing a new
  36611. connection with the stub. Entering non-stop mode does not alter the
  36612. state of any currently-running threads, but targets must stop all
  36613. threads in any already-attached processes when entering all-stop mode.
  36614. GDB uses the '?' packet as necessary to probe the target state after a
  36615. mode change.
  36616. In non-stop mode, when an attached process encounters an event that
  36617. would otherwise be reported with a stop reply, it uses the asynchronous
  36618. notification mechanism (*note Notification Packets::) to inform GDB. In
  36619. contrast to all-stop mode, where all threads in all processes are
  36620. stopped when a stop reply is sent, in non-stop mode only the thread
  36621. reporting the stop event is stopped. That is, when reporting a 'S' or
  36622. 'T' response to indicate completion of a step operation, hitting a
  36623. breakpoint, or a fault, only the affected thread is stopped; any other
  36624. still-running threads continue to run. When reporting a 'W' or 'X'
  36625. response, all running threads belonging to other attached processes
  36626. continue to run.
  36627. In non-stop mode, the target shall respond to the '?' packet as
  36628. follows. First, any incomplete stop reply notification/'vStopped'
  36629. sequence in progress is abandoned. The target must begin a new sequence
  36630. reporting stop events for all stopped threads, whether or not it has
  36631. previously reported those events to GDB. The first stop reply is sent
  36632. as a synchronous reply to the '?' packet, and subsequent stop replies
  36633. are sent as responses to 'vStopped' packets using the mechanism
  36634. described above. The target must not send asynchronous stop reply
  36635. notifications until the sequence is complete. If all threads are
  36636. running when the target receives the '?' packet, or if the target is not
  36637. attached to any process, it shall respond 'OK'.
  36638. If the stub supports non-stop mode, it should also support the
  36639. 'swbreak' stop reason if software breakpoints are supported, and the
  36640. 'hwbreak' stop reason if hardware breakpoints are supported (*note
  36641. swbreak stop reason::). This is because given the asynchronous nature
  36642. of non-stop mode, between the time a thread hits a breakpoint and the
  36643. time the event is finally processed by GDB, the breakpoint may have
  36644. already been removed from the target. Due to this, GDB needs to be able
  36645. to tell whether a trap stop was caused by a delayed breakpoint event,
  36646. which should be ignored, as opposed to a random trap signal, which
  36647. should be reported to the user. Note the 'swbreak' feature implies that
  36648. the target is responsible for adjusting the PC when a software
  36649. breakpoint triggers, if necessary, such as on the x86 architecture.
  36650. 
  36651. File: gdb.info, Node: Packet Acknowledgment, Next: Examples, Prev: Remote Non-Stop, Up: Remote Protocol
  36652. E.11 Packet Acknowledgment
  36653. ==========================
  36654. By default, when either the host or the target machine receives a
  36655. packet, the first response expected is an acknowledgment: either '+' (to
  36656. indicate the package was received correctly) or '-' (to request
  36657. retransmission). This mechanism allows the GDB remote protocol to
  36658. operate over unreliable transport mechanisms, such as a serial line.
  36659. In cases where the transport mechanism is itself reliable (such as a
  36660. pipe or TCP connection), the '+'/'-' acknowledgments are redundant. It
  36661. may be desirable to disable them in that case to reduce communication
  36662. overhead, or for other reasons. This can be accomplished by means of
  36663. the 'QStartNoAckMode' packet; *note QStartNoAckMode::.
  36664. When in no-acknowledgment mode, neither the stub nor GDB shall send
  36665. or expect '+'/'-' protocol acknowledgments. The packet and response
  36666. format still includes the normal checksum, as described in *note
  36667. Overview::, but the checksum may be ignored by the receiver.
  36668. If the stub supports 'QStartNoAckMode' and prefers to operate in
  36669. no-acknowledgment mode, it should report that to GDB by including
  36670. 'QStartNoAckMode+' in its response to 'qSupported'; *note qSupported::.
  36671. If GDB also supports 'QStartNoAckMode' and it has not been disabled via
  36672. the 'set remote noack-packet off' command (*note Remote
  36673. Configuration::), GDB may then send a 'QStartNoAckMode' packet to the
  36674. stub. Only then may the stub actually turn off packet acknowledgments.
  36675. GDB sends a final '+' acknowledgment of the stub's 'OK' response, which
  36676. can be safely ignored by the stub.
  36677. Note that 'set remote noack-packet' command only affects negotiation
  36678. between GDB and the stub when subsequent connections are made; it does
  36679. not affect the protocol acknowledgment state for any current connection.
  36680. Since '+'/'-' acknowledgments are enabled by default when a new
  36681. connection is established, there is also no protocol request to
  36682. re-enable the acknowledgments for the current connection, once disabled.
  36683. 
  36684. File: gdb.info, Node: Examples, Next: File-I/O Remote Protocol Extension, Prev: Packet Acknowledgment, Up: Remote Protocol
  36685. E.12 Examples
  36686. =============
  36687. Example sequence of a target being re-started. Notice how the restart
  36688. does not get any direct output:
  36689. -> R00
  36690. <- +
  36691. _target restarts_
  36692. -> ?
  36693. <- +
  36694. <- T001:1234123412341234
  36695. -> +
  36696. Example sequence of a target being stepped by a single instruction:
  36697. -> G1445...
  36698. <- +
  36699. -> s
  36700. <- +
  36701. _time passes_
  36702. <- T001:1234123412341234
  36703. -> +
  36704. -> g
  36705. <- +
  36706. <- 1455...
  36707. -> +
  36708. 
  36709. File: gdb.info, Node: File-I/O Remote Protocol Extension, Next: Library List Format, Prev: Examples, Up: Remote Protocol
  36710. E.13 File-I/O Remote Protocol Extension
  36711. =======================================
  36712. * Menu:
  36713. * File-I/O Overview::
  36714. * Protocol Basics::
  36715. * The F Request Packet::
  36716. * The F Reply Packet::
  36717. * The Ctrl-C Message::
  36718. * Console I/O::
  36719. * List of Supported Calls::
  36720. * Protocol-specific Representation of Datatypes::
  36721. * Constants::
  36722. * File-I/O Examples::
  36723. 
  36724. File: gdb.info, Node: File-I/O Overview, Next: Protocol Basics, Up: File-I/O Remote Protocol Extension
  36725. E.13.1 File-I/O Overview
  36726. ------------------------
  36727. The "File I/O remote protocol extension" (short: File-I/O) allows the
  36728. target to use the host's file system and console I/O to perform various
  36729. system calls. System calls on the target system are translated into a
  36730. remote protocol packet to the host system, which then performs the
  36731. needed actions and returns a response packet to the target system. This
  36732. simulates file system operations even on targets that lack file systems.
  36733. The protocol is defined to be independent of both the host and target
  36734. systems. It uses its own internal representation of datatypes and
  36735. values. Both GDB and the target's GDB stub are responsible for
  36736. translating the system-dependent value representations into the internal
  36737. protocol representations when data is transmitted.
  36738. The communication is synchronous. A system call is possible only
  36739. when GDB is waiting for a response from the 'C', 'c', 'S' or 's'
  36740. packets. While GDB handles the request for a system call, the target is
  36741. stopped to allow deterministic access to the target's memory. Therefore
  36742. File-I/O is not interruptible by target signals. On the other hand, it
  36743. is possible to interrupt File-I/O by a user interrupt ('Ctrl-C') within
  36744. GDB.
  36745. The target's request to perform a host system call does not finish
  36746. the latest 'C', 'c', 'S' or 's' action. That means, after finishing the
  36747. system call, the target returns to continuing the previous activity
  36748. (continue, step). No additional continue or step request from GDB is
  36749. required.
  36750. (gdb) continue
  36751. <- target requests 'system call X'
  36752. target is stopped, GDB executes system call
  36753. -> GDB returns result
  36754. ... target continues, GDB returns to wait for the target
  36755. <- target hits breakpoint and sends a Txx packet
  36756. The protocol only supports I/O on the console and to regular files on
  36757. the host file system. Character or block special devices, pipes, named
  36758. pipes, sockets or any other communication method on the host system are
  36759. not supported by this protocol.
  36760. File I/O is not supported in non-stop mode.
  36761. 
  36762. File: gdb.info, Node: Protocol Basics, Next: The F Request Packet, Prev: File-I/O Overview, Up: File-I/O Remote Protocol Extension
  36763. E.13.2 Protocol Basics
  36764. ----------------------
  36765. The File-I/O protocol uses the 'F' packet as the request as well as
  36766. reply packet. Since a File-I/O system call can only occur when GDB is
  36767. waiting for a response from the continuing or stepping target, the
  36768. File-I/O request is a reply that GDB has to expect as a result of a
  36769. previous 'C', 'c', 'S' or 's' packet. This 'F' packet contains all
  36770. information needed to allow GDB to call the appropriate host system
  36771. call:
  36772. * A unique identifier for the requested system call.
  36773. * All parameters to the system call. Pointers are given as addresses
  36774. in the target memory address space. Pointers to strings are given
  36775. as pointer/length pair. Numerical values are given as they are.
  36776. Numerical control flags are given in a protocol-specific
  36777. representation.
  36778. At this point, GDB has to perform the following actions.
  36779. * If the parameters include pointer values to data needed as input to
  36780. a system call, GDB requests this data from the target with a
  36781. standard 'm' packet request. This additional communication has to
  36782. be expected by the target implementation and is handled as any
  36783. other 'm' packet.
  36784. * GDB translates all value from protocol representation to host
  36785. representation as needed. Datatypes are coerced into the host
  36786. types.
  36787. * GDB calls the system call.
  36788. * It then coerces datatypes back to protocol representation.
  36789. * If the system call is expected to return data in buffer space
  36790. specified by pointer parameters to the call, the data is
  36791. transmitted to the target using a 'M' or 'X' packet. This packet
  36792. has to be expected by the target implementation and is handled as
  36793. any other 'M' or 'X' packet.
  36794. Eventually GDB replies with another 'F' packet which contains all
  36795. necessary information for the target to continue. This at least
  36796. contains
  36797. * Return value.
  36798. * 'errno', if has been changed by the system call.
  36799. * "Ctrl-C" flag.
  36800. After having done the needed type and value coercion, the target
  36801. continues the latest continue or step action.
  36802. 
  36803. File: gdb.info, Node: The F Request Packet, Next: The F Reply Packet, Prev: Protocol Basics, Up: File-I/O Remote Protocol Extension
  36804. E.13.3 The 'F' Request Packet
  36805. -----------------------------
  36806. The 'F' request packet has the following format:
  36807. 'FCALL-ID,PARAMETER...'
  36808. CALL-ID is the identifier to indicate the host system call to be
  36809. called. This is just the name of the function.
  36810. PARAMETER... are the parameters to the system call. Parameters are
  36811. hexadecimal integer values, either the actual values in case of
  36812. scalar datatypes, pointers to target buffer space in case of
  36813. compound datatypes and unspecified memory areas, or pointer/length
  36814. pairs in case of string parameters. These are appended to the
  36815. CALL-ID as a comma-delimited list. All values are transmitted in
  36816. ASCII string representation, pointer/length pairs separated by a
  36817. slash.
  36818. 
  36819. 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
  36820. E.13.4 The 'F' Reply Packet
  36821. ---------------------------
  36822. The 'F' reply packet has the following format:
  36823. 'FRETCODE,ERRNO,CTRL-C FLAG;CALL-SPECIFIC ATTACHMENT'
  36824. RETCODE is the return code of the system call as hexadecimal value.
  36825. ERRNO is the 'errno' set by the call, in protocol-specific
  36826. representation. This parameter can be omitted if the call was
  36827. successful.
  36828. CTRL-C FLAG is only sent if the user requested a break. In this
  36829. case, ERRNO must be sent as well, even if the call was successful.
  36830. The CTRL-C FLAG itself consists of the character 'C':
  36831. F0,0,C
  36832. or, if the call was interrupted before the host call has been
  36833. performed:
  36834. F-1,4,C
  36835. assuming 4 is the protocol-specific representation of 'EINTR'.
  36836. 
  36837. File: gdb.info, Node: The Ctrl-C Message, Next: Console I/O, Prev: The F Reply Packet, Up: File-I/O Remote Protocol Extension
  36838. E.13.5 The 'Ctrl-C' Message
  36839. ---------------------------
  36840. If the 'Ctrl-C' flag is set in the GDB reply packet (*note The F Reply
  36841. Packet::), the target should behave as if it had gotten a break message.
  36842. The meaning for the target is "system call interrupted by 'SIGINT'".
  36843. Consequentially, the target should actually stop (as with a break
  36844. message) and return to GDB with a 'T02' packet.
  36845. It's important for the target to know in which state the system call
  36846. was interrupted. There are two possible cases:
  36847. * The system call hasn't been performed on the host yet.
  36848. * The system call on the host has been finished.
  36849. These two states can be distinguished by the target by the value of
  36850. the returned 'errno'. If it's the protocol representation of 'EINTR',
  36851. the system call hasn't been performed. This is equivalent to the
  36852. 'EINTR' handling on POSIX systems. In any other case, the target may
  36853. presume that the system call has been finished -- successfully or not --
  36854. and should behave as if the break message arrived right after the system
  36855. call.
  36856. GDB must behave reliably. If the system call has not been called
  36857. yet, GDB may send the 'F' reply immediately, setting 'EINTR' as 'errno'
  36858. in the packet. If the system call on the host has been finished before
  36859. the user requests a break, the full action must be finished by GDB.
  36860. This requires sending 'M' or 'X' packets as necessary. The 'F' packet
  36861. may only be sent when either nothing has happened or the full action has
  36862. been completed.
  36863. 
  36864. File: gdb.info, Node: Console I/O, Next: List of Supported Calls, Prev: The Ctrl-C Message, Up: File-I/O Remote Protocol Extension
  36865. E.13.6 Console I/O
  36866. ------------------
  36867. By default and if not explicitly closed by the target system, the file
  36868. descriptors 0, 1 and 2 are connected to the GDB console. Output on the
  36869. GDB console is handled as any other file output operation ('write(1,
  36870. ...)' or 'write(2, ...)'). Console input is handled by GDB so that
  36871. after the target read request from file descriptor 0 all following
  36872. typing is buffered until either one of the following conditions is met:
  36873. * The user types 'Ctrl-c'. The behaviour is as explained above, and
  36874. the 'read' system call is treated as finished.
  36875. * The user presses <RET>. This is treated as end of input with a
  36876. trailing newline.
  36877. * The user types 'Ctrl-d'. This is treated as end of input. No
  36878. trailing character (neither newline nor 'Ctrl-D') is appended to
  36879. the input.
  36880. If the user has typed more characters than fit in the buffer given to
  36881. the 'read' call, the trailing characters are buffered in GDB until
  36882. either another 'read(0, ...)' is requested by the target, or debugging
  36883. is stopped at the user's request.
  36884. 
  36885. 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
  36886. E.13.7 List of Supported Calls
  36887. ------------------------------
  36888. * Menu:
  36889. * open::
  36890. * close::
  36891. * read::
  36892. * write::
  36893. * lseek::
  36894. * rename::
  36895. * unlink::
  36896. * stat/fstat::
  36897. * gettimeofday::
  36898. * isatty::
  36899. * system::
  36900. 
  36901. File: gdb.info, Node: open, Next: close, Up: List of Supported Calls
  36902. open
  36903. ....
  36904. Synopsis:
  36905. int open(const char *pathname, int flags);
  36906. int open(const char *pathname, int flags, mode_t mode);
  36907. Request:
  36908. 'Fopen,PATHPTR/LEN,FLAGS,MODE'
  36909. FLAGS is the bitwise 'OR' of the following values:
  36910. 'O_CREAT'
  36911. If the file does not exist it will be created. The host rules
  36912. apply as far as file ownership and time stamps are concerned.
  36913. 'O_EXCL'
  36914. When used with 'O_CREAT', if the file already exists it is an
  36915. error and open() fails.
  36916. 'O_TRUNC'
  36917. If the file already exists and the open mode allows writing
  36918. ('O_RDWR' or 'O_WRONLY' is given) it will be truncated to zero
  36919. length.
  36920. 'O_APPEND'
  36921. The file is opened in append mode.
  36922. 'O_RDONLY'
  36923. The file is opened for reading only.
  36924. 'O_WRONLY'
  36925. The file is opened for writing only.
  36926. 'O_RDWR'
  36927. The file is opened for reading and writing.
  36928. Other bits are silently ignored.
  36929. MODE is the bitwise 'OR' of the following values:
  36930. 'S_IRUSR'
  36931. User has read permission.
  36932. 'S_IWUSR'
  36933. User has write permission.
  36934. 'S_IRGRP'
  36935. Group has read permission.
  36936. 'S_IWGRP'
  36937. Group has write permission.
  36938. 'S_IROTH'
  36939. Others have read permission.
  36940. 'S_IWOTH'
  36941. Others have write permission.
  36942. Other bits are silently ignored.
  36943. Return value:
  36944. 'open' returns the new file descriptor or -1 if an error occurred.
  36945. Errors:
  36946. 'EEXIST'
  36947. PATHNAME already exists and 'O_CREAT' and 'O_EXCL' were used.
  36948. 'EISDIR'
  36949. PATHNAME refers to a directory.
  36950. 'EACCES'
  36951. The requested access is not allowed.
  36952. 'ENAMETOOLONG'
  36953. PATHNAME was too long.
  36954. 'ENOENT'
  36955. A directory component in PATHNAME does not exist.
  36956. 'ENODEV'
  36957. PATHNAME refers to a device, pipe, named pipe or socket.
  36958. 'EROFS'
  36959. PATHNAME refers to a file on a read-only filesystem and write
  36960. access was requested.
  36961. 'EFAULT'
  36962. PATHNAME is an invalid pointer value.
  36963. 'ENOSPC'
  36964. No space on device to create the file.
  36965. 'EMFILE'
  36966. The process already has the maximum number of files open.
  36967. 'ENFILE'
  36968. The limit on the total number of files open on the system has
  36969. been reached.
  36970. 'EINTR'
  36971. The call was interrupted by the user.
  36972. 
  36973. File: gdb.info, Node: close, Next: read, Prev: open, Up: List of Supported Calls
  36974. close
  36975. .....
  36976. Synopsis:
  36977. int close(int fd);
  36978. Request:
  36979. 'Fclose,FD'
  36980. Return value:
  36981. 'close' returns zero on success, or -1 if an error occurred.
  36982. Errors:
  36983. 'EBADF'
  36984. FD isn't a valid open file descriptor.
  36985. 'EINTR'
  36986. The call was interrupted by the user.
  36987. 
  36988. File: gdb.info, Node: read, Next: write, Prev: close, Up: List of Supported Calls
  36989. read
  36990. ....
  36991. Synopsis:
  36992. int read(int fd, void *buf, unsigned int count);
  36993. Request:
  36994. 'Fread,FD,BUFPTR,COUNT'
  36995. Return value:
  36996. On success, the number of bytes read is returned. Zero indicates
  36997. end of file. If count is zero, read returns zero as well. On
  36998. error, -1 is returned.
  36999. Errors:
  37000. 'EBADF'
  37001. FD is not a valid file descriptor or is not open for reading.
  37002. 'EFAULT'
  37003. BUFPTR is an invalid pointer value.
  37004. 'EINTR'
  37005. The call was interrupted by the user.
  37006. 
  37007. File: gdb.info, Node: write, Next: lseek, Prev: read, Up: List of Supported Calls
  37008. write
  37009. .....
  37010. Synopsis:
  37011. int write(int fd, const void *buf, unsigned int count);
  37012. Request:
  37013. 'Fwrite,FD,BUFPTR,COUNT'
  37014. Return value:
  37015. On success, the number of bytes written are returned. Zero
  37016. indicates nothing was written. On error, -1 is returned.
  37017. Errors:
  37018. 'EBADF'
  37019. FD is not a valid file descriptor or is not open for writing.
  37020. 'EFAULT'
  37021. BUFPTR is an invalid pointer value.
  37022. 'EFBIG'
  37023. An attempt was made to write a file that exceeds the
  37024. host-specific maximum file size allowed.
  37025. 'ENOSPC'
  37026. No space on device to write the data.
  37027. 'EINTR'
  37028. The call was interrupted by the user.
  37029. 
  37030. File: gdb.info, Node: lseek, Next: rename, Prev: write, Up: List of Supported Calls
  37031. lseek
  37032. .....
  37033. Synopsis:
  37034. long lseek (int fd, long offset, int flag);
  37035. Request:
  37036. 'Flseek,FD,OFFSET,FLAG'
  37037. FLAG is one of:
  37038. 'SEEK_SET'
  37039. The offset is set to OFFSET bytes.
  37040. 'SEEK_CUR'
  37041. The offset is set to its current location plus OFFSET bytes.
  37042. 'SEEK_END'
  37043. The offset is set to the size of the file plus OFFSET bytes.
  37044. Return value:
  37045. On success, the resulting unsigned offset in bytes from the
  37046. beginning of the file is returned. Otherwise, a value of -1 is
  37047. returned.
  37048. Errors:
  37049. 'EBADF'
  37050. FD is not a valid open file descriptor.
  37051. 'ESPIPE'
  37052. FD is associated with the GDB console.
  37053. 'EINVAL'
  37054. FLAG is not a proper value.
  37055. 'EINTR'
  37056. The call was interrupted by the user.
  37057. 
  37058. File: gdb.info, Node: rename, Next: unlink, Prev: lseek, Up: List of Supported Calls
  37059. rename
  37060. ......
  37061. Synopsis:
  37062. int rename(const char *oldpath, const char *newpath);
  37063. Request:
  37064. 'Frename,OLDPATHPTR/LEN,NEWPATHPTR/LEN'
  37065. Return value:
  37066. On success, zero is returned. On error, -1 is returned.
  37067. Errors:
  37068. 'EISDIR'
  37069. NEWPATH is an existing directory, but OLDPATH is not a
  37070. directory.
  37071. 'EEXIST'
  37072. NEWPATH is a non-empty directory.
  37073. 'EBUSY'
  37074. OLDPATH or NEWPATH is a directory that is in use by some
  37075. process.
  37076. 'EINVAL'
  37077. An attempt was made to make a directory a subdirectory of
  37078. itself.
  37079. 'ENOTDIR'
  37080. A component used as a directory in OLDPATH or new path is not
  37081. a directory. Or OLDPATH is a directory and NEWPATH exists but
  37082. is not a directory.
  37083. 'EFAULT'
  37084. OLDPATHPTR or NEWPATHPTR are invalid pointer values.
  37085. 'EACCES'
  37086. No access to the file or the path of the file.
  37087. 'ENAMETOOLONG'
  37088. OLDPATH or NEWPATH was too long.
  37089. 'ENOENT'
  37090. A directory component in OLDPATH or NEWPATH does not exist.
  37091. 'EROFS'
  37092. The file is on a read-only filesystem.
  37093. 'ENOSPC'
  37094. The device containing the file has no room for the new
  37095. directory entry.
  37096. 'EINTR'
  37097. The call was interrupted by the user.
  37098. 
  37099. File: gdb.info, Node: unlink, Next: stat/fstat, Prev: rename, Up: List of Supported Calls
  37100. unlink
  37101. ......
  37102. Synopsis:
  37103. int unlink(const char *pathname);
  37104. Request:
  37105. 'Funlink,PATHNAMEPTR/LEN'
  37106. Return value:
  37107. On success, zero is returned. On error, -1 is returned.
  37108. Errors:
  37109. 'EACCES'
  37110. No access to the file or the path of the file.
  37111. 'EPERM'
  37112. The system does not allow unlinking of directories.
  37113. 'EBUSY'
  37114. The file PATHNAME cannot be unlinked because it's being used
  37115. by another process.
  37116. 'EFAULT'
  37117. PATHNAMEPTR is an invalid pointer value.
  37118. 'ENAMETOOLONG'
  37119. PATHNAME was too long.
  37120. 'ENOENT'
  37121. A directory component in PATHNAME does not exist.
  37122. 'ENOTDIR'
  37123. A component of the path is not a directory.
  37124. 'EROFS'
  37125. The file is on a read-only filesystem.
  37126. 'EINTR'
  37127. The call was interrupted by the user.
  37128. 
  37129. File: gdb.info, Node: stat/fstat, Next: gettimeofday, Prev: unlink, Up: List of Supported Calls
  37130. stat/fstat
  37131. ..........
  37132. Synopsis:
  37133. int stat(const char *pathname, struct stat *buf);
  37134. int fstat(int fd, struct stat *buf);
  37135. Request:
  37136. 'Fstat,PATHNAMEPTR/LEN,BUFPTR'
  37137. 'Ffstat,FD,BUFPTR'
  37138. Return value:
  37139. On success, zero is returned. On error, -1 is returned.
  37140. Errors:
  37141. 'EBADF'
  37142. FD is not a valid open file.
  37143. 'ENOENT'
  37144. A directory component in PATHNAME does not exist or the path
  37145. is an empty string.
  37146. 'ENOTDIR'
  37147. A component of the path is not a directory.
  37148. 'EFAULT'
  37149. PATHNAMEPTR is an invalid pointer value.
  37150. 'EACCES'
  37151. No access to the file or the path of the file.
  37152. 'ENAMETOOLONG'
  37153. PATHNAME was too long.
  37154. 'EINTR'
  37155. The call was interrupted by the user.
  37156. 
  37157. File: gdb.info, Node: gettimeofday, Next: isatty, Prev: stat/fstat, Up: List of Supported Calls
  37158. gettimeofday
  37159. ............
  37160. Synopsis:
  37161. int gettimeofday(struct timeval *tv, void *tz);
  37162. Request:
  37163. 'Fgettimeofday,TVPTR,TZPTR'
  37164. Return value:
  37165. On success, 0 is returned, -1 otherwise.
  37166. Errors:
  37167. 'EINVAL'
  37168. TZ is a non-NULL pointer.
  37169. 'EFAULT'
  37170. TVPTR and/or TZPTR is an invalid pointer value.
  37171. 
  37172. File: gdb.info, Node: isatty, Next: system, Prev: gettimeofday, Up: List of Supported Calls
  37173. isatty
  37174. ......
  37175. Synopsis:
  37176. int isatty(int fd);
  37177. Request:
  37178. 'Fisatty,FD'
  37179. Return value:
  37180. Returns 1 if FD refers to the GDB console, 0 otherwise.
  37181. Errors:
  37182. 'EINTR'
  37183. The call was interrupted by the user.
  37184. Note that the 'isatty' call is treated as a special case: it returns
  37185. 1 to the target if the file descriptor is attached to the GDB console, 0
  37186. otherwise. Implementing through system calls would require implementing
  37187. 'ioctl' and would be more complex than needed.
  37188. 
  37189. File: gdb.info, Node: system, Prev: isatty, Up: List of Supported Calls
  37190. system
  37191. ......
  37192. Synopsis:
  37193. int system(const char *command);
  37194. Request:
  37195. 'Fsystem,COMMANDPTR/LEN'
  37196. Return value:
  37197. If LEN is zero, the return value indicates whether a shell is
  37198. available. A zero return value indicates a shell is not available.
  37199. For non-zero LEN, the value returned is -1 on error and the return
  37200. status of the command otherwise. Only the exit status of the
  37201. command is returned, which is extracted from the host's 'system'
  37202. return value by calling 'WEXITSTATUS(retval)'. In case '/bin/sh'
  37203. could not be executed, 127 is returned.
  37204. Errors:
  37205. 'EINTR'
  37206. The call was interrupted by the user.
  37207. GDB takes over the full task of calling the necessary host calls to
  37208. perform the 'system' call. The return value of 'system' on the host is
  37209. simplified before it's returned to the target. Any termination signal
  37210. information from the child process is discarded, and the return value
  37211. consists entirely of the exit status of the called command.
  37212. Due to security concerns, the 'system' call is by default refused by
  37213. GDB. The user has to allow this call explicitly with the 'set remote
  37214. system-call-allowed 1' command.
  37215. 'set remote system-call-allowed'
  37216. Control whether to allow the 'system' calls in the File I/O
  37217. protocol for the remote target. The default is zero (disabled).
  37218. 'show remote system-call-allowed'
  37219. Show whether the 'system' calls are allowed in the File I/O
  37220. protocol.
  37221. 
  37222. File: gdb.info, Node: Protocol-specific Representation of Datatypes, Next: Constants, Prev: List of Supported Calls, Up: File-I/O Remote Protocol Extension
  37223. E.13.8 Protocol-specific Representation of Datatypes
  37224. ----------------------------------------------------
  37225. * Menu:
  37226. * Integral Datatypes::
  37227. * Pointer Values::
  37228. * Memory Transfer::
  37229. * struct stat::
  37230. * struct timeval::
  37231. 
  37232. File: gdb.info, Node: Integral Datatypes, Next: Pointer Values, Up: Protocol-specific Representation of Datatypes
  37233. Integral Datatypes
  37234. ..................
  37235. The integral datatypes used in the system calls are 'int', 'unsigned
  37236. int', 'long', 'unsigned long', 'mode_t', and 'time_t'.
  37237. 'int', 'unsigned int', 'mode_t' and 'time_t' are implemented as 32
  37238. bit values in this protocol.
  37239. 'long' and 'unsigned long' are implemented as 64 bit types.
  37240. *Note Limits::, for corresponding MIN and MAX values (similar to
  37241. those in 'limits.h') to allow range checking on host and target.
  37242. 'time_t' datatypes are defined as seconds since the Epoch.
  37243. All integral datatypes transferred as part of a memory read or write
  37244. of a structured datatype e.g. a 'struct stat' have to be given in big
  37245. endian byte order.
  37246. 
  37247. File: gdb.info, Node: Pointer Values, Next: Memory Transfer, Prev: Integral Datatypes, Up: Protocol-specific Representation of Datatypes
  37248. Pointer Values
  37249. ..............
  37250. Pointers to target data are transmitted as they are. An exception is
  37251. made for pointers to buffers for which the length isn't transmitted as
  37252. part of the function call, namely strings. Strings are transmitted as a
  37253. pointer/length pair, both as hex values, e.g.
  37254. 1aaf/12
  37255. which is a pointer to data of length 18 bytes at position 0x1aaf. The
  37256. length is defined as the full string length in bytes, including the
  37257. trailing null byte. For example, the string '"hello world"' at address
  37258. 0x123456 is transmitted as
  37259. 123456/d
  37260. 
  37261. File: gdb.info, Node: Memory Transfer, Next: struct stat, Prev: Pointer Values, Up: Protocol-specific Representation of Datatypes
  37262. Memory Transfer
  37263. ...............
  37264. Structured data which is transferred using a memory read or write (for
  37265. example, a 'struct stat') is expected to be in a protocol-specific
  37266. format with all scalar multibyte datatypes being big endian.
  37267. Translation to this representation needs to be done both by the target
  37268. before the 'F' packet is sent, and by GDB before it transfers memory to
  37269. the target. Transferred pointers to structured data should point to the
  37270. already-coerced data at any time.
  37271. 
  37272. File: gdb.info, Node: struct stat, Next: struct timeval, Prev: Memory Transfer, Up: Protocol-specific Representation of Datatypes
  37273. struct stat
  37274. ...........
  37275. The buffer of type 'struct stat' used by the target and GDB is defined
  37276. as follows:
  37277. struct stat {
  37278. unsigned int st_dev; /* device */
  37279. unsigned int st_ino; /* inode */
  37280. mode_t st_mode; /* protection */
  37281. unsigned int st_nlink; /* number of hard links */
  37282. unsigned int st_uid; /* user ID of owner */
  37283. unsigned int st_gid; /* group ID of owner */
  37284. unsigned int st_rdev; /* device type (if inode device) */
  37285. unsigned long st_size; /* total size, in bytes */
  37286. unsigned long st_blksize; /* blocksize for filesystem I/O */
  37287. unsigned long st_blocks; /* number of blocks allocated */
  37288. time_t st_atime; /* time of last access */
  37289. time_t st_mtime; /* time of last modification */
  37290. time_t st_ctime; /* time of last change */
  37291. };
  37292. The integral datatypes conform to the definitions given in the
  37293. appropriate section (see *note Integral Datatypes::, for details) so
  37294. this structure is of size 64 bytes.
  37295. The values of several fields have a restricted meaning and/or range
  37296. of values.
  37297. 'st_dev'
  37298. A value of 0 represents a file, 1 the console.
  37299. 'st_ino'
  37300. No valid meaning for the target. Transmitted unchanged.
  37301. 'st_mode'
  37302. Valid mode bits are described in *note Constants::. Any other bits
  37303. have currently no meaning for the target.
  37304. 'st_uid'
  37305. 'st_gid'
  37306. 'st_rdev'
  37307. No valid meaning for the target. Transmitted unchanged.
  37308. 'st_atime'
  37309. 'st_mtime'
  37310. 'st_ctime'
  37311. These values have a host and file system dependent accuracy.
  37312. Especially on Windows hosts, the file system may not support exact
  37313. timing values.
  37314. The target gets a 'struct stat' of the above representation and is
  37315. responsible for coercing it to the target representation before
  37316. continuing.
  37317. Note that due to size differences between the host, target, and
  37318. protocol representations of 'struct stat' members, these members could
  37319. eventually get truncated on the target.
  37320. 
  37321. File: gdb.info, Node: struct timeval, Prev: struct stat, Up: Protocol-specific Representation of Datatypes
  37322. struct timeval
  37323. ..............
  37324. The buffer of type 'struct timeval' used by the File-I/O protocol is
  37325. defined as follows:
  37326. struct timeval {
  37327. time_t tv_sec; /* second */
  37328. long tv_usec; /* microsecond */
  37329. };
  37330. The integral datatypes conform to the definitions given in the
  37331. appropriate section (see *note Integral Datatypes::, for details) so
  37332. this structure is of size 8 bytes.
  37333. 
  37334. File: gdb.info, Node: Constants, Next: File-I/O Examples, Prev: Protocol-specific Representation of Datatypes, Up: File-I/O Remote Protocol Extension
  37335. E.13.9 Constants
  37336. ----------------
  37337. The following values are used for the constants inside of the protocol.
  37338. GDB and target are responsible for translating these values before and
  37339. after the call as needed.
  37340. * Menu:
  37341. * Open Flags::
  37342. * mode_t Values::
  37343. * Errno Values::
  37344. * Lseek Flags::
  37345. * Limits::
  37346. 
  37347. File: gdb.info, Node: Open Flags, Next: mode_t Values, Up: Constants
  37348. Open Flags
  37349. ..........
  37350. All values are given in hexadecimal representation.
  37351. O_RDONLY 0x0
  37352. O_WRONLY 0x1
  37353. O_RDWR 0x2
  37354. O_APPEND 0x8
  37355. O_CREAT 0x200
  37356. O_TRUNC 0x400
  37357. O_EXCL 0x800
  37358. 
  37359. File: gdb.info, Node: mode_t Values, Next: Errno Values, Prev: Open Flags, Up: Constants
  37360. mode_t Values
  37361. .............
  37362. All values are given in octal representation.
  37363. S_IFREG 0100000
  37364. S_IFDIR 040000
  37365. S_IRUSR 0400
  37366. S_IWUSR 0200
  37367. S_IXUSR 0100
  37368. S_IRGRP 040
  37369. S_IWGRP 020
  37370. S_IXGRP 010
  37371. S_IROTH 04
  37372. S_IWOTH 02
  37373. S_IXOTH 01
  37374. 
  37375. File: gdb.info, Node: Errno Values, Next: Lseek Flags, Prev: mode_t Values, Up: Constants
  37376. Errno Values
  37377. ............
  37378. All values are given in decimal representation.
  37379. EPERM 1
  37380. ENOENT 2
  37381. EINTR 4
  37382. EBADF 9
  37383. EACCES 13
  37384. EFAULT 14
  37385. EBUSY 16
  37386. EEXIST 17
  37387. ENODEV 19
  37388. ENOTDIR 20
  37389. EISDIR 21
  37390. EINVAL 22
  37391. ENFILE 23
  37392. EMFILE 24
  37393. EFBIG 27
  37394. ENOSPC 28
  37395. ESPIPE 29
  37396. EROFS 30
  37397. ENAMETOOLONG 91
  37398. EUNKNOWN 9999
  37399. 'EUNKNOWN' is used as a fallback error value if a host system returns
  37400. any error value not in the list of supported error numbers.
  37401. 
  37402. File: gdb.info, Node: Lseek Flags, Next: Limits, Prev: Errno Values, Up: Constants
  37403. Lseek Flags
  37404. ...........
  37405. SEEK_SET 0
  37406. SEEK_CUR 1
  37407. SEEK_END 2
  37408. 
  37409. File: gdb.info, Node: Limits, Prev: Lseek Flags, Up: Constants
  37410. Limits
  37411. ......
  37412. All values are given in decimal representation.
  37413. INT_MIN -2147483648
  37414. INT_MAX 2147483647
  37415. UINT_MAX 4294967295
  37416. LONG_MIN -9223372036854775808
  37417. LONG_MAX 9223372036854775807
  37418. ULONG_MAX 18446744073709551615
  37419. 
  37420. File: gdb.info, Node: File-I/O Examples, Prev: Constants, Up: File-I/O Remote Protocol Extension
  37421. E.13.10 File-I/O Examples
  37422. -------------------------
  37423. Example sequence of a write call, file descriptor 3, buffer is at target
  37424. address 0x1234, 6 bytes should be written:
  37425. <- Fwrite,3,1234,6
  37426. _request memory read from target_
  37427. -> m1234,6
  37428. <- XXXXXX
  37429. _return "6 bytes written"_
  37430. -> F6
  37431. Example sequence of a read call, file descriptor 3, buffer is at
  37432. target address 0x1234, 6 bytes should be read:
  37433. <- Fread,3,1234,6
  37434. _request memory write to target_
  37435. -> X1234,6:XXXXXX
  37436. _return "6 bytes read"_
  37437. -> F6
  37438. Example sequence of a read call, call fails on the host due to
  37439. invalid file descriptor ('EBADF'):
  37440. <- Fread,3,1234,6
  37441. -> F-1,9
  37442. Example sequence of a read call, user presses 'Ctrl-c' before syscall
  37443. on host is called:
  37444. <- Fread,3,1234,6
  37445. -> F-1,4,C
  37446. <- T02
  37447. Example sequence of a read call, user presses 'Ctrl-c' after syscall
  37448. on host is called:
  37449. <- Fread,3,1234,6
  37450. -> X1234,6:XXXXXX
  37451. <- T02
  37452. 
  37453. File: gdb.info, Node: Library List Format, Next: Library List Format for SVR4 Targets, Prev: File-I/O Remote Protocol Extension, Up: Remote Protocol
  37454. E.14 Library List Format
  37455. ========================
  37456. On some platforms, a dynamic loader (e.g. 'ld.so') runs in the same
  37457. process as your application to manage libraries. In this case, GDB can
  37458. use the loader's symbol table and normal memory operations to maintain a
  37459. list of shared libraries. On other platforms, the operating system
  37460. manages loaded libraries. GDB can not retrieve the list of currently
  37461. loaded libraries through memory operations, so it uses the
  37462. 'qXfer:libraries:read' packet (*note qXfer library list read::) instead.
  37463. The remote stub queries the target's operating system and reports which
  37464. libraries are loaded.
  37465. The 'qXfer:libraries:read' packet returns an XML document which lists
  37466. loaded libraries and their offsets. Each library has an associated name
  37467. and one or more segment or section base addresses, which report where
  37468. the library was loaded in memory.
  37469. For the common case of libraries that are fully linked binaries, the
  37470. library should have a list of segments. If the target supports dynamic
  37471. linking of a relocatable object file, its library XML element should
  37472. instead include a list of allocated sections. The segment or section
  37473. bases are start addresses, not relocation offsets; they do not depend on
  37474. the library's link-time base addresses.
  37475. GDB must be linked with the Expat library to support XML library
  37476. lists. *Note Expat::.
  37477. A simple memory map, with one loaded library relocated by a single
  37478. offset, looks like this:
  37479. <library-list>
  37480. <library name="/lib/libc.so.6">
  37481. <segment address="0x10000000"/>
  37482. </library>
  37483. </library-list>
  37484. Another simple memory map, with one loaded library with three
  37485. allocated sections (.text, .data, .bss), looks like this:
  37486. <library-list>
  37487. <library name="sharedlib.o">
  37488. <section address="0x10000000"/>
  37489. <section address="0x20000000"/>
  37490. <section address="0x30000000"/>
  37491. </library>
  37492. </library-list>
  37493. The format of a library list is described by this DTD:
  37494. <!-- library-list: Root element with versioning -->
  37495. <!ELEMENT library-list (library)*>
  37496. <!ATTLIST library-list version CDATA #FIXED "1.0">
  37497. <!ELEMENT library (segment*, section*)>
  37498. <!ATTLIST library name CDATA #REQUIRED>
  37499. <!ELEMENT segment EMPTY>
  37500. <!ATTLIST segment address CDATA #REQUIRED>
  37501. <!ELEMENT section EMPTY>
  37502. <!ATTLIST section address CDATA #REQUIRED>
  37503. In addition, segments and section descriptors cannot be mixed within
  37504. a single library element, and you must supply at least one segment or
  37505. section for each library.
  37506. 
  37507. File: gdb.info, Node: Library List Format for SVR4 Targets, Next: Memory Map Format, Prev: Library List Format, Up: Remote Protocol
  37508. E.15 Library List Format for SVR4 Targets
  37509. =========================================
  37510. On SVR4 platforms GDB can use the symbol table of a dynamic loader (e.g.
  37511. 'ld.so') and normal memory operations to maintain a list of shared
  37512. libraries. Still a special library list provided by this packet is more
  37513. efficient for the GDB remote protocol.
  37514. The 'qXfer:libraries-svr4:read' packet returns an XML document which
  37515. lists loaded libraries and their SVR4 linker parameters. For each
  37516. library on SVR4 target, the following parameters are reported:
  37517. - 'name', the absolute file name from the 'l_name' field of 'struct
  37518. link_map'.
  37519. - 'lm' with address of 'struct link_map' used for TLS (Thread Local
  37520. Storage) access.
  37521. - 'l_addr', the displacement as read from the field 'l_addr' of
  37522. 'struct link_map'. For prelinked libraries this is not an absolute
  37523. memory address. It is a displacement of absolute memory address
  37524. against address the file was prelinked to during the library load.
  37525. - 'l_ld', which is memory address of the 'PT_DYNAMIC' segment
  37526. Additionally the single 'main-lm' attribute specifies address of
  37527. 'struct link_map' used for the main executable. This parameter is used
  37528. for TLS access and its presence is optional.
  37529. GDB must be linked with the Expat library to support XML SVR4 library
  37530. lists. *Note Expat::.
  37531. A simple memory map, with two loaded libraries (which do not use
  37532. prelink), looks like this:
  37533. <library-list-svr4 version="1.0" main-lm="0xe4f8f8">
  37534. <library name="/lib/ld-linux.so.2" lm="0xe4f51c" l_addr="0xe2d000"
  37535. l_ld="0xe4eefc"/>
  37536. <library name="/lib/libc.so.6" lm="0xe4fbe8" l_addr="0x154000"
  37537. l_ld="0x152350"/>
  37538. </library-list-svr>
  37539. The format of an SVR4 library list is described by this DTD:
  37540. <!-- library-list-svr4: Root element with versioning -->
  37541. <!ELEMENT library-list-svr4 (library)*>
  37542. <!ATTLIST library-list-svr4 version CDATA #FIXED "1.0">
  37543. <!ATTLIST library-list-svr4 main-lm CDATA #IMPLIED>
  37544. <!ELEMENT library EMPTY>
  37545. <!ATTLIST library name CDATA #REQUIRED>
  37546. <!ATTLIST library lm CDATA #REQUIRED>
  37547. <!ATTLIST library l_addr CDATA #REQUIRED>
  37548. <!ATTLIST library l_ld CDATA #REQUIRED>
  37549. 
  37550. File: gdb.info, Node: Memory Map Format, Next: Thread List Format, Prev: Library List Format for SVR4 Targets, Up: Remote Protocol
  37551. E.16 Memory Map Format
  37552. ======================
  37553. To be able to write into flash memory, GDB needs to obtain a memory map
  37554. from the target. This section describes the format of the memory map.
  37555. The memory map is obtained using the 'qXfer:memory-map:read' (*note
  37556. qXfer memory map read::) packet and is an XML document that lists memory
  37557. regions.
  37558. GDB must be linked with the Expat library to support XML memory maps.
  37559. *Note Expat::.
  37560. The top-level structure of the document is shown below:
  37561. <?xml version="1.0"?>
  37562. <!DOCTYPE memory-map
  37563. PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
  37564. "http://sourceware.org/gdb/gdb-memory-map.dtd">
  37565. <memory-map>
  37566. region...
  37567. </memory-map>
  37568. Each region can be either:
  37569. * A region of RAM starting at ADDR and extending for LENGTH bytes
  37570. from there:
  37571. <memory type="ram" start="ADDR" length="LENGTH"/>
  37572. * A region of read-only memory:
  37573. <memory type="rom" start="ADDR" length="LENGTH"/>
  37574. * A region of flash memory, with erasure blocks BLOCKSIZE bytes in
  37575. length:
  37576. <memory type="flash" start="ADDR" length="LENGTH">
  37577. <property name="blocksize">BLOCKSIZE</property>
  37578. </memory>
  37579. Regions must not overlap. GDB assumes that areas of memory not
  37580. covered by the memory map are RAM, and uses the ordinary 'M' and 'X'
  37581. packets to write to addresses in such ranges.
  37582. The formal DTD for memory map format is given below:
  37583. <!-- ................................................... -->
  37584. <!-- Memory Map XML DTD ................................ -->
  37585. <!-- File: memory-map.dtd .............................. -->
  37586. <!-- .................................... .............. -->
  37587. <!-- memory-map.dtd -->
  37588. <!-- memory-map: Root element with versioning -->
  37589. <!ELEMENT memory-map (memory)*>
  37590. <!ATTLIST memory-map version CDATA #FIXED "1.0.0">
  37591. <!ELEMENT memory (property)*>
  37592. <!-- memory: Specifies a memory region,
  37593. and its type, or device. -->
  37594. <!ATTLIST memory type (ram|rom|flash) #REQUIRED
  37595. start CDATA #REQUIRED
  37596. length CDATA #REQUIRED>
  37597. <!-- property: Generic attribute tag -->
  37598. <!ELEMENT property (#PCDATA | property)*>
  37599. <!ATTLIST property name (blocksize) #REQUIRED>
  37600. 
  37601. File: gdb.info, Node: Thread List Format, Next: Traceframe Info Format, Prev: Memory Map Format, Up: Remote Protocol
  37602. E.17 Thread List Format
  37603. =======================
  37604. To efficiently update the list of threads and their attributes, GDB
  37605. issues the 'qXfer:threads:read' packet (*note qXfer threads read::) and
  37606. obtains the XML document with the following structure:
  37607. <?xml version="1.0"?>
  37608. <threads>
  37609. <thread id="id" core="0" name="name">
  37610. ... description ...
  37611. </thread>
  37612. </threads>
  37613. Each 'thread' element must have the 'id' attribute that identifies
  37614. the thread (*note thread-id syntax::). The 'core' attribute, if
  37615. present, specifies which processor core the thread was last executing
  37616. on. The 'name' attribute, if present, specifies the human-readable name
  37617. of the thread. The content of the of 'thread' element is interpreted as
  37618. human-readable auxiliary information. The 'handle' attribute, if
  37619. present, is a hex encoded representation of the thread handle.
  37620. 
  37621. File: gdb.info, Node: Traceframe Info Format, Next: Branch Trace Format, Prev: Thread List Format, Up: Remote Protocol
  37622. E.18 Traceframe Info Format
  37623. ===========================
  37624. To be able to know which objects in the inferior can be examined when
  37625. inspecting a tracepoint hit, GDB needs to obtain the list of memory
  37626. ranges, registers and trace state variables that have been collected in
  37627. a traceframe.
  37628. This list is obtained using the 'qXfer:traceframe-info:read' (*note
  37629. qXfer traceframe info read::) packet and is an XML document.
  37630. GDB must be linked with the Expat library to support XML traceframe
  37631. info discovery. *Note Expat::.
  37632. The top-level structure of the document is shown below:
  37633. <?xml version="1.0"?>
  37634. <!DOCTYPE traceframe-info
  37635. PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
  37636. "http://sourceware.org/gdb/gdb-traceframe-info.dtd">
  37637. <traceframe-info>
  37638. block...
  37639. </traceframe-info>
  37640. Each traceframe block can be either:
  37641. * A region of collected memory starting at ADDR and extending for
  37642. LENGTH bytes from there:
  37643. <memory start="ADDR" length="LENGTH"/>
  37644. * A block indicating trace state variable numbered NUMBER has been
  37645. collected:
  37646. <tvar id="NUMBER"/>
  37647. The formal DTD for the traceframe info format is given below:
  37648. <!ELEMENT traceframe-info (memory | tvar)* >
  37649. <!ATTLIST traceframe-info version CDATA #FIXED "1.0">
  37650. <!ELEMENT memory EMPTY>
  37651. <!ATTLIST memory start CDATA #REQUIRED
  37652. length CDATA #REQUIRED>
  37653. <!ELEMENT tvar>
  37654. <!ATTLIST tvar id CDATA #REQUIRED>
  37655. 
  37656. File: gdb.info, Node: Branch Trace Format, Next: Branch Trace Configuration Format, Prev: Traceframe Info Format, Up: Remote Protocol
  37657. E.19 Branch Trace Format
  37658. ========================
  37659. In order to display the branch trace of an inferior thread, GDB needs to
  37660. obtain the list of branches. This list is represented as list of
  37661. sequential code blocks that are connected via branches. The code in
  37662. each block has been executed sequentially.
  37663. This list is obtained using the 'qXfer:btrace:read' (*note qXfer
  37664. btrace read::) packet and is an XML document.
  37665. GDB must be linked with the Expat library to support XML traceframe
  37666. info discovery. *Note Expat::.
  37667. The top-level structure of the document is shown below:
  37668. <?xml version="1.0"?>
  37669. <!DOCTYPE btrace
  37670. PUBLIC "+//IDN gnu.org//DTD GDB Branch Trace V1.0//EN"
  37671. "http://sourceware.org/gdb/gdb-btrace.dtd">
  37672. <btrace>
  37673. block...
  37674. </btrace>
  37675. * A block of sequentially executed instructions starting at BEGIN and
  37676. ending at END:
  37677. <block begin="BEGIN" end="END"/>
  37678. The formal DTD for the branch trace format is given below:
  37679. <!ELEMENT btrace (block* | pt) >
  37680. <!ATTLIST btrace version CDATA #FIXED "1.0">
  37681. <!ELEMENT block EMPTY>
  37682. <!ATTLIST block begin CDATA #REQUIRED
  37683. end CDATA #REQUIRED>
  37684. <!ELEMENT pt (pt-config?, raw?)>
  37685. <!ELEMENT pt-config (cpu?)>
  37686. <!ELEMENT cpu EMPTY>
  37687. <!ATTLIST cpu vendor CDATA #REQUIRED
  37688. family CDATA #REQUIRED
  37689. model CDATA #REQUIRED
  37690. stepping CDATA #REQUIRED>
  37691. <!ELEMENT raw (#PCDATA)>
  37692. 
  37693. File: gdb.info, Node: Branch Trace Configuration Format, Prev: Branch Trace Format, Up: Remote Protocol
  37694. E.20 Branch Trace Configuration Format
  37695. ======================================
  37696. For each inferior thread, GDB can obtain the branch trace configuration
  37697. using the 'qXfer:btrace-conf:read' (*note qXfer btrace-conf read::)
  37698. packet.
  37699. The configuration describes the branch trace format and configuration
  37700. settings for that format. The following information is described:
  37701. 'bts'
  37702. This thread uses the "Branch Trace Store" (BTS) format.
  37703. 'size'
  37704. The size of the BTS ring buffer in bytes.
  37705. 'pt'
  37706. This thread uses the "Intel Processor Trace" (Intel PT) format.
  37707. 'size'
  37708. The size of the Intel PT ring buffer in bytes.
  37709. GDB must be linked with the Expat library to support XML branch trace
  37710. configuration discovery. *Note Expat::.
  37711. The formal DTD for the branch trace configuration format is given
  37712. below:
  37713. <!ELEMENT btrace-conf (bts?, pt?)>
  37714. <!ATTLIST btrace-conf version CDATA #FIXED "1.0">
  37715. <!ELEMENT bts EMPTY>
  37716. <!ATTLIST bts size CDATA #IMPLIED>
  37717. <!ELEMENT pt EMPTY>
  37718. <!ATTLIST pt size CDATA #IMPLIED>
  37719. 
  37720. File: gdb.info, Node: Agent Expressions, Next: Target Descriptions, Prev: Remote Protocol, Up: Top
  37721. Appendix F The GDB Agent Expression Mechanism
  37722. *********************************************
  37723. In some applications, it is not feasible for the debugger to interrupt
  37724. the program's execution long enough for the developer to learn anything
  37725. helpful about its behavior. If the program's correctness depends on its
  37726. real-time behavior, delays introduced by a debugger might cause the
  37727. program to fail, even when the code itself is correct. It is useful to
  37728. be able to observe the program's behavior without interrupting it.
  37729. Using GDB's 'trace' and 'collect' commands, the user can specify
  37730. locations in the program, and arbitrary expressions to evaluate when
  37731. those locations are reached. Later, using the 'tfind' command, she can
  37732. examine the values those expressions had when the program hit the trace
  37733. points. The expressions may also denote objects in memory -- structures
  37734. or arrays, for example -- whose values GDB should record; while visiting
  37735. a particular tracepoint, the user may inspect those objects as if they
  37736. were in memory at that moment. However, because GDB records these
  37737. values without interacting with the user, it can do so quickly and
  37738. unobtrusively, hopefully not disturbing the program's behavior.
  37739. When GDB is debugging a remote target, the GDB "agent" code running
  37740. on the target computes the values of the expressions itself. To avoid
  37741. having a full symbolic expression evaluator on the agent, GDB translates
  37742. expressions in the source language into a simpler bytecode language, and
  37743. then sends the bytecode to the agent; the agent then executes the
  37744. bytecode, and records the values for GDB to retrieve later.
  37745. The bytecode language is simple; there are forty-odd opcodes, the
  37746. bulk of which are the usual vocabulary of C operands (addition,
  37747. subtraction, shifts, and so on) and various sizes of literals and memory
  37748. reference operations. The bytecode interpreter operates strictly on
  37749. machine-level values -- various sizes of integers and floating point
  37750. numbers -- and requires no information about types or symbols; thus, the
  37751. interpreter's internal data structures are simple, and each bytecode
  37752. requires only a few native machine instructions to implement it. The
  37753. interpreter is small, and strict limits on the memory and time required
  37754. to evaluate an expression are easy to determine, making it suitable for
  37755. use by the debugging agent in real-time applications.
  37756. * Menu:
  37757. * General Bytecode Design:: Overview of the interpreter.
  37758. * Bytecode Descriptions:: What each one does.
  37759. * Using Agent Expressions:: How agent expressions fit into the big picture.
  37760. * Varying Target Capabilities:: How to discover what the target can do.
  37761. * Rationale:: Why we did it this way.
  37762. 
  37763. File: gdb.info, Node: General Bytecode Design, Next: Bytecode Descriptions, Up: Agent Expressions
  37764. F.1 General Bytecode Design
  37765. ===========================
  37766. The agent represents bytecode expressions as an array of bytes. Each
  37767. instruction is one byte long (thus the term "bytecode"). Some
  37768. instructions are followed by operand bytes; for example, the 'goto'
  37769. instruction is followed by a destination for the jump.
  37770. The bytecode interpreter is a stack-based machine; most instructions
  37771. pop their operands off the stack, perform some operation, and push the
  37772. result back on the stack for the next instruction to consume. Each
  37773. element of the stack may contain either a integer or a floating point
  37774. value; these values are as many bits wide as the largest integer that
  37775. can be directly manipulated in the source language. Stack elements
  37776. carry no record of their type; bytecode could push a value as an
  37777. integer, then pop it as a floating point value. However, GDB will not
  37778. generate code which does this. In C, one might define the type of a
  37779. stack element as follows:
  37780. union agent_val {
  37781. LONGEST l;
  37782. DOUBLEST d;
  37783. };
  37784. where 'LONGEST' and 'DOUBLEST' are 'typedef' names for the largest
  37785. integer and floating point types on the machine.
  37786. By the time the bytecode interpreter reaches the end of the
  37787. expression, the value of the expression should be the only value left on
  37788. the stack. For tracing applications, 'trace' bytecodes in the
  37789. expression will have recorded the necessary data, and the value on the
  37790. stack may be discarded. For other applications, like conditional
  37791. breakpoints, the value may be useful.
  37792. Separate from the stack, the interpreter has two registers:
  37793. 'pc'
  37794. The address of the next bytecode to execute.
  37795. 'start'
  37796. The address of the start of the bytecode expression, necessary for
  37797. interpreting the 'goto' and 'if_goto' instructions.
  37798. Neither of these registers is directly visible to the bytecode language
  37799. itself, but they are useful for defining the meanings of the bytecode
  37800. operations.
  37801. There are no instructions to perform side effects on the running
  37802. program, or call the program's functions; we assume that these
  37803. expressions are only used for unobtrusive debugging, not for patching
  37804. the running code.
  37805. Most bytecode instructions do not distinguish between the various
  37806. sizes of values, and operate on full-width values; the upper bits of the
  37807. values are simply ignored, since they do not usually make a difference
  37808. to the value computed. The exceptions to this rule are:
  37809. memory reference instructions ('ref'N)
  37810. There are distinct instructions to fetch different word sizes from
  37811. memory. Once on the stack, however, the values are treated as
  37812. full-size integers. They may need to be sign-extended; the 'ext'
  37813. instruction exists for this purpose.
  37814. the sign-extension instruction ('ext' N)
  37815. These clearly need to know which portion of their operand is to be
  37816. extended to occupy the full length of the word.
  37817. If the interpreter is unable to evaluate an expression completely for
  37818. some reason (a memory location is inaccessible, or a divisor is zero,
  37819. for example), we say that interpretation "terminates with an error".
  37820. This means that the problem is reported back to the interpreter's caller
  37821. in some helpful way. In general, code using agent expressions should
  37822. assume that they may attempt to divide by zero, fetch arbitrary memory
  37823. locations, and misbehave in other ways.
  37824. Even complicated C expressions compile to a few bytecode
  37825. instructions; for example, the expression 'x + y * z' would typically
  37826. produce code like the following, assuming that 'x' and 'y' live in
  37827. registers, and 'z' is a global variable holding a 32-bit 'int':
  37828. reg 1
  37829. reg 2
  37830. const32 address of z
  37831. ref32
  37832. ext 32
  37833. mul
  37834. add
  37835. end
  37836. In detail, these mean:
  37837. 'reg 1'
  37838. Push the value of register 1 (presumably holding 'x') onto the
  37839. stack.
  37840. 'reg 2'
  37841. Push the value of register 2 (holding 'y').
  37842. 'const32 address of z'
  37843. Push the address of 'z' onto the stack.
  37844. 'ref32'
  37845. Fetch a 32-bit word from the address at the top of the stack;
  37846. replace the address on the stack with the value. Thus, we replace
  37847. the address of 'z' with 'z''s value.
  37848. 'ext 32'
  37849. Sign-extend the value on the top of the stack from 32 bits to full
  37850. length. This is necessary because 'z' is a signed integer.
  37851. 'mul'
  37852. Pop the top two numbers on the stack, multiply them, and push their
  37853. product. Now the top of the stack contains the value of the
  37854. expression 'y * z'.
  37855. 'add'
  37856. Pop the top two numbers, add them, and push the sum. Now the top
  37857. of the stack contains the value of 'x + y * z'.
  37858. 'end'
  37859. Stop executing; the value left on the stack top is the value to be
  37860. recorded.
  37861. 
  37862. File: gdb.info, Node: Bytecode Descriptions, Next: Using Agent Expressions, Prev: General Bytecode Design, Up: Agent Expressions
  37863. F.2 Bytecode Descriptions
  37864. =========================
  37865. Each bytecode description has the following form:
  37866. 'add' (0x02): A B => A+B
  37867. Pop the top two stack items, A and B, as integers; push their sum,
  37868. as an integer.
  37869. In this example, 'add' is the name of the bytecode, and '(0x02)' is
  37870. the one-byte value used to encode the bytecode, in hexadecimal. The
  37871. phrase "A B => A+B" shows the stack before and after the bytecode
  37872. executes. Beforehand, the stack must contain at least two values, A and
  37873. B; since the top of the stack is to the right, B is on the top of the
  37874. stack, and A is underneath it. After execution, the bytecode will have
  37875. popped A and B from the stack, and replaced them with a single value,
  37876. A+B. There may be other values on the stack below those shown, but the
  37877. bytecode affects only those shown.
  37878. Here is another example:
  37879. 'const8' (0x22) N: => N
  37880. Push the 8-bit integer constant N on the stack, without sign
  37881. extension.
  37882. In this example, the bytecode 'const8' takes an operand N directly
  37883. from the bytecode stream; the operand follows the 'const8' bytecode
  37884. itself. We write any such operands immediately after the name of the
  37885. bytecode, before the colon, and describe the exact encoding of the
  37886. operand in the bytecode stream in the body of the bytecode description.
  37887. For the 'const8' bytecode, there are no stack items given before the
  37888. =>; this simply means that the bytecode consumes no values from the
  37889. stack. If a bytecode consumes no values, or produces no values, the
  37890. list on either side of the => may be empty.
  37891. If a value is written as A, B, or N, then the bytecode treats it as
  37892. an integer. If a value is written is ADDR, then the bytecode treats it
  37893. as an address.
  37894. We do not fully describe the floating point operations here; although
  37895. this design can be extended in a clean way to handle floating point
  37896. values, they are not of immediate interest to the customer, so we avoid
  37897. describing them, to save time.
  37898. 'float' (0x01): =>
  37899. Prefix for floating-point bytecodes. Not implemented yet.
  37900. 'add' (0x02): A B => A+B
  37901. Pop two integers from the stack, and push their sum, as an integer.
  37902. 'sub' (0x03): A B => A-B
  37903. Pop two integers from the stack, subtract the top value from the
  37904. next-to-top value, and push the difference.
  37905. 'mul' (0x04): A B => A*B
  37906. Pop two integers from the stack, multiply them, and push the
  37907. product on the stack. Note that, when one multiplies two N-bit
  37908. numbers yielding another N-bit number, it is irrelevant whether the
  37909. numbers are signed or not; the results are the same.
  37910. 'div_signed' (0x05): A B => A/B
  37911. Pop two signed integers from the stack; divide the next-to-top
  37912. value by the top value, and push the quotient. If the divisor is
  37913. zero, terminate with an error.
  37914. 'div_unsigned' (0x06): A B => A/B
  37915. Pop two unsigned integers from the stack; divide the next-to-top
  37916. value by the top value, and push the quotient. If the divisor is
  37917. zero, terminate with an error.
  37918. 'rem_signed' (0x07): A B => A MODULO B
  37919. Pop two signed integers from the stack; divide the next-to-top
  37920. value by the top value, and push the remainder. If the divisor is
  37921. zero, terminate with an error.
  37922. 'rem_unsigned' (0x08): A B => A MODULO B
  37923. Pop two unsigned integers from the stack; divide the next-to-top
  37924. value by the top value, and push the remainder. If the divisor is
  37925. zero, terminate with an error.
  37926. 'lsh' (0x09): A B => A<<B
  37927. Pop two integers from the stack; let A be the next-to-top value,
  37928. and B be the top value. Shift A left by B bits, and push the
  37929. result.
  37930. 'rsh_signed' (0x0a): A B => '(signed)'A>>B
  37931. Pop two integers from the stack; let A be the next-to-top value,
  37932. and B be the top value. Shift A right by B bits, inserting copies
  37933. of the top bit at the high end, and push the result.
  37934. 'rsh_unsigned' (0x0b): A B => A>>B
  37935. Pop two integers from the stack; let A be the next-to-top value,
  37936. and B be the top value. Shift A right by B bits, inserting zero
  37937. bits at the high end, and push the result.
  37938. 'log_not' (0x0e): A => !A
  37939. Pop an integer from the stack; if it is zero, push the value one;
  37940. otherwise, push the value zero.
  37941. 'bit_and' (0x0f): A B => A&B
  37942. Pop two integers from the stack, and push their bitwise 'and'.
  37943. 'bit_or' (0x10): A B => A|B
  37944. Pop two integers from the stack, and push their bitwise 'or'.
  37945. 'bit_xor' (0x11): A B => A^B
  37946. Pop two integers from the stack, and push their bitwise
  37947. exclusive-'or'.
  37948. 'bit_not' (0x12): A => ~A
  37949. Pop an integer from the stack, and push its bitwise complement.
  37950. 'equal' (0x13): A B => A=B
  37951. Pop two integers from the stack; if they are equal, push the value
  37952. one; otherwise, push the value zero.
  37953. 'less_signed' (0x14): A B => A<B
  37954. Pop two signed integers from the stack; if the next-to-top value is
  37955. less than the top value, push the value one; otherwise, push the
  37956. value zero.
  37957. 'less_unsigned' (0x15): A B => A<B
  37958. Pop two unsigned integers from the stack; if the next-to-top value
  37959. is less than the top value, push the value one; otherwise, push the
  37960. value zero.
  37961. 'ext' (0x16) N: A => A, sign-extended from N bits
  37962. Pop an unsigned value from the stack; treating it as an N-bit
  37963. twos-complement value, extend it to full length. This means that
  37964. all bits to the left of bit N-1 (where the least significant bit is
  37965. bit 0) are set to the value of bit N-1. Note that N may be larger
  37966. than or equal to the width of the stack elements of the bytecode
  37967. engine; in this case, the bytecode should have no effect.
  37968. The number of source bits to preserve, N, is encoded as a single
  37969. byte unsigned integer following the 'ext' bytecode.
  37970. 'zero_ext' (0x2a) N: A => A, zero-extended from N bits
  37971. Pop an unsigned value from the stack; zero all but the bottom N
  37972. bits.
  37973. The number of source bits to preserve, N, is encoded as a single
  37974. byte unsigned integer following the 'zero_ext' bytecode.
  37975. 'ref8' (0x17): ADDR => A
  37976. 'ref16' (0x18): ADDR => A
  37977. 'ref32' (0x19): ADDR => A
  37978. 'ref64' (0x1a): ADDR => A
  37979. Pop an address ADDR from the stack. For bytecode 'ref'N, fetch an
  37980. N-bit value from ADDR, using the natural target endianness. Push
  37981. the fetched value as an unsigned integer.
  37982. Note that ADDR may not be aligned in any particular way; the 'refN'
  37983. bytecodes should operate correctly for any address.
  37984. If attempting to access memory at ADDR would cause a processor
  37985. exception of some sort, terminate with an error.
  37986. 'ref_float' (0x1b): ADDR => D
  37987. 'ref_double' (0x1c): ADDR => D
  37988. 'ref_long_double' (0x1d): ADDR => D
  37989. 'l_to_d' (0x1e): A => D
  37990. 'd_to_l' (0x1f): D => A
  37991. Not implemented yet.
  37992. 'dup' (0x28): A => A A
  37993. Push another copy of the stack's top element.
  37994. 'swap' (0x2b): A B => B A
  37995. Exchange the top two items on the stack.
  37996. 'pop' (0x29): A =>
  37997. Discard the top value on the stack.
  37998. 'pick' (0x32) N: A ... B => A ... B A
  37999. Duplicate an item from the stack and push it on the top of the
  38000. stack. N, a single byte, indicates the stack item to copy. If N
  38001. is zero, this is the same as 'dup'; if N is one, it copies the item
  38002. under the top item, etc. If N exceeds the number of items on the
  38003. stack, terminate with an error.
  38004. 'rot' (0x33): A B C => C A B
  38005. Rotate the top three items on the stack. The top item (c) becomes
  38006. the third item, the next-to-top item (b) becomes the top item and
  38007. the third item (a) from the top becomes the next-to-top item.
  38008. 'if_goto' (0x20) OFFSET: A =>
  38009. Pop an integer off the stack; if it is non-zero, branch to the
  38010. given offset in the bytecode string. Otherwise, continue to the
  38011. next instruction in the bytecode stream. In other words, if A is
  38012. non-zero, set the 'pc' register to 'start' + OFFSET. Thus, an
  38013. offset of zero denotes the beginning of the expression.
  38014. The OFFSET is stored as a sixteen-bit unsigned value, stored
  38015. immediately following the 'if_goto' bytecode. It is always stored
  38016. most significant byte first, regardless of the target's normal
  38017. endianness. The offset is not guaranteed to fall at any particular
  38018. alignment within the bytecode stream; thus, on machines where
  38019. fetching a 16-bit on an unaligned address raises an exception, you
  38020. should fetch the offset one byte at a time.
  38021. 'goto' (0x21) OFFSET: =>
  38022. Branch unconditionally to OFFSET; in other words, set the 'pc'
  38023. register to 'start' + OFFSET.
  38024. The offset is stored in the same way as for the 'if_goto' bytecode.
  38025. 'const8' (0x22) N: => N
  38026. 'const16' (0x23) N: => N
  38027. 'const32' (0x24) N: => N
  38028. 'const64' (0x25) N: => N
  38029. Push the integer constant N on the stack, without sign extension.
  38030. To produce a small negative value, push a small twos-complement
  38031. value, and then sign-extend it using the 'ext' bytecode.
  38032. The constant N is stored in the appropriate number of bytes
  38033. following the 'const'B bytecode. The constant N is always stored
  38034. most significant byte first, regardless of the target's normal
  38035. endianness. The constant is not guaranteed to fall at any
  38036. particular alignment within the bytecode stream; thus, on machines
  38037. where fetching a 16-bit on an unaligned address raises an
  38038. exception, you should fetch N one byte at a time.
  38039. 'reg' (0x26) N: => A
  38040. Push the value of register number N, without sign extension. The
  38041. registers are numbered following GDB's conventions.
  38042. The register number N is encoded as a 16-bit unsigned integer
  38043. immediately following the 'reg' bytecode. It is always stored most
  38044. significant byte first, regardless of the target's normal
  38045. endianness. The register number is not guaranteed to fall at any
  38046. particular alignment within the bytecode stream; thus, on machines
  38047. where fetching a 16-bit on an unaligned address raises an
  38048. exception, you should fetch the register number one byte at a time.
  38049. 'getv' (0x2c) N: => V
  38050. Push the value of trace state variable number N, without sign
  38051. extension.
  38052. The variable number N is encoded as a 16-bit unsigned integer
  38053. immediately following the 'getv' bytecode. It is always stored
  38054. most significant byte first, regardless of the target's normal
  38055. endianness. The variable number is not guaranteed to fall at any
  38056. particular alignment within the bytecode stream; thus, on machines
  38057. where fetching a 16-bit on an unaligned address raises an
  38058. exception, you should fetch the register number one byte at a time.
  38059. 'setv' (0x2d) N: V => V
  38060. Set trace state variable number N to the value found on the top of
  38061. the stack. The stack is unchanged, so that the value is readily
  38062. available if the assignment is part of a larger expression. The
  38063. handling of N is as described for 'getv'.
  38064. 'trace' (0x0c): ADDR SIZE =>
  38065. Record the contents of the SIZE bytes at ADDR in a trace buffer,
  38066. for later retrieval by GDB.
  38067. 'trace_quick' (0x0d) SIZE: ADDR => ADDR
  38068. Record the contents of the SIZE bytes at ADDR in a trace buffer,
  38069. for later retrieval by GDB. SIZE is a single byte unsigned integer
  38070. following the 'trace' opcode.
  38071. This bytecode is equivalent to the sequence 'dup const8 SIZE
  38072. trace', but we provide it anyway to save space in bytecode strings.
  38073. 'trace16' (0x30) SIZE: ADDR => ADDR
  38074. Identical to trace_quick, except that SIZE is a 16-bit big-endian
  38075. unsigned integer, not a single byte. This should probably have
  38076. been named 'trace_quick16', for consistency.
  38077. 'tracev' (0x2e) N: => A
  38078. Record the value of trace state variable number N in the trace
  38079. buffer. The handling of N is as described for 'getv'.
  38080. 'tracenz' (0x2f) ADDR SIZE =>
  38081. Record the bytes at ADDR in a trace buffer, for later retrieval by
  38082. GDB. Stop at either the first zero byte, or when SIZE bytes have
  38083. been recorded, whichever occurs first.
  38084. 'printf' (0x34) NUMARGS STRING =>
  38085. Do a formatted print, in the style of the C function 'printf').
  38086. The value of NUMARGS is the number of arguments to expect on the
  38087. stack, while STRING is the format string, prefixed with a two-byte
  38088. length. The last byte of the string must be zero, and is included
  38089. in the length. The format string includes escaped sequences just
  38090. as it appears in C source, so for instance the format string
  38091. '"\t%d\n"' is six characters long, and the output will consist of a
  38092. tab character, a decimal number, and a newline. At the top of the
  38093. stack, above the values to be printed, this bytecode will pop a
  38094. "function" and "channel". If the function is nonzero, then the
  38095. target may treat it as a function and call it, passing the channel
  38096. as a first argument, as with the C function 'fprintf'. If the
  38097. function is zero, then the target may simply call a standard
  38098. formatted print function of its choice. In all, this bytecode pops
  38099. 2 + NUMARGS stack elements, and pushes nothing.
  38100. 'end' (0x27): =>
  38101. Stop executing bytecode; the result should be the top element of
  38102. the stack. If the purpose of the expression was to compute an
  38103. lvalue or a range of memory, then the next-to-top of the stack is
  38104. the lvalue's address, and the top of the stack is the lvalue's
  38105. size, in bytes.
  38106. 
  38107. File: gdb.info, Node: Using Agent Expressions, Next: Varying Target Capabilities, Prev: Bytecode Descriptions, Up: Agent Expressions
  38108. F.3 Using Agent Expressions
  38109. ===========================
  38110. Agent expressions can be used in several different ways by GDB, and the
  38111. debugger can generate different bytecode sequences as appropriate.
  38112. One possibility is to do expression evaluation on the target rather
  38113. than the host, such as for the conditional of a conditional tracepoint.
  38114. In such a case, GDB compiles the source expression into a bytecode
  38115. sequence that simply gets values from registers or memory, does
  38116. arithmetic, and returns a result.
  38117. Another way to use agent expressions is for tracepoint data
  38118. collection. GDB generates a different bytecode sequence for collection;
  38119. in addition to bytecodes that do the calculation, GDB adds 'trace'
  38120. bytecodes to save the pieces of memory that were used.
  38121. * The user selects trace points in the program's code at which GDB
  38122. should collect data.
  38123. * The user specifies expressions to evaluate at each trace point.
  38124. These expressions may denote objects in memory, in which case those
  38125. objects' contents are recorded as the program runs, or computed
  38126. values, in which case the values themselves are recorded.
  38127. * GDB transmits the tracepoints and their associated expressions to
  38128. the GDB agent, running on the debugging target.
  38129. * The agent arranges to be notified when a trace point is hit.
  38130. * When execution on the target reaches a trace point, the agent
  38131. evaluates the expressions associated with that trace point, and
  38132. records the resulting values and memory ranges.
  38133. * Later, when the user selects a given trace event and inspects the
  38134. objects and expression values recorded, GDB talks to the agent to
  38135. retrieve recorded data as necessary to meet the user's requests.
  38136. If the user asks to see an object whose contents have not been
  38137. recorded, GDB reports an error.
  38138. 
  38139. File: gdb.info, Node: Varying Target Capabilities, Next: Rationale, Prev: Using Agent Expressions, Up: Agent Expressions
  38140. F.4 Varying Target Capabilities
  38141. ===============================
  38142. Some targets don't support floating-point, and some would rather not
  38143. have to deal with 'long long' operations. Also, different targets will
  38144. have different stack sizes, and different bytecode buffer lengths.
  38145. Thus, GDB needs a way to ask the target about itself. We haven't
  38146. worked out the details yet, but in general, GDB should be able to send
  38147. the target a packet asking it to describe itself. The reply should be a
  38148. packet whose length is explicit, so we can add new information to the
  38149. packet in future revisions of the agent, without confusing old versions
  38150. of GDB, and it should contain a version number. It should contain at
  38151. least the following information:
  38152. * whether floating point is supported
  38153. * whether 'long long' is supported
  38154. * maximum acceptable size of bytecode stack
  38155. * maximum acceptable length of bytecode expressions
  38156. * which registers are actually available for collection
  38157. * whether the target supports disabled tracepoints
  38158. 
  38159. File: gdb.info, Node: Rationale, Prev: Varying Target Capabilities, Up: Agent Expressions
  38160. F.5 Rationale
  38161. =============
  38162. Some of the design decisions apparent above are arguable.
  38163. What about stack overflow/underflow?
  38164. GDB should be able to query the target to discover its stack size.
  38165. Given that information, GDB can determine at translation time
  38166. whether a given expression will overflow the stack. But this spec
  38167. isn't about what kinds of error-checking GDB ought to do.
  38168. Why are you doing everything in LONGEST?
  38169. Speed isn't important, but agent code size is; using LONGEST brings
  38170. in a bunch of support code to do things like division, etc. So
  38171. this is a serious concern.
  38172. First, note that you don't need different bytecodes for different
  38173. operand sizes. You can generate code without _knowing_ how big the
  38174. stack elements actually are on the target. If the target only
  38175. supports 32-bit ints, and you don't send any 64-bit bytecodes,
  38176. everything just works. The observation here is that the MIPS and
  38177. the Alpha have only fixed-size registers, and you can still get C's
  38178. semantics even though most instructions only operate on full-sized
  38179. words. You just need to make sure everything is properly
  38180. sign-extended at the right times. So there is no need for 32- and
  38181. 64-bit variants of the bytecodes. Just implement everything using
  38182. the largest size you support.
  38183. GDB should certainly check to see what sizes the target supports,
  38184. so the user can get an error earlier, rather than later. But this
  38185. information is not necessary for correctness.
  38186. Why don't you have '>' or '<=' operators?
  38187. I want to keep the interpreter small, and we don't need them. We
  38188. can combine the 'less_' opcodes with 'log_not', and swap the order
  38189. of the operands, yielding all four asymmetrical comparison
  38190. operators. For example, '(x <= y)' is '! (x > y)', which is '! (y
  38191. < x)'.
  38192. Why do you have 'log_not'?
  38193. Why do you have 'ext'?
  38194. Why do you have 'zero_ext'?
  38195. These are all easily synthesized from other instructions, but I
  38196. expect them to be used frequently, and they're simple, so I include
  38197. them to keep bytecode strings short.
  38198. 'log_not' is equivalent to 'const8 0 equal'; it's used in half the
  38199. relational operators.
  38200. 'ext N' is equivalent to 'const8 S-N lsh const8 S-N rsh_signed',
  38201. where S is the size of the stack elements; it follows 'refM' and
  38202. REG bytecodes when the value should be signed. See the next
  38203. bulleted item.
  38204. 'zero_ext N' is equivalent to 'constM MASK log_and'; it's used
  38205. whenever we push the value of a register, because we can't assume
  38206. the upper bits of the register aren't garbage.
  38207. Why not have sign-extending variants of the 'ref' operators?
  38208. Because that would double the number of 'ref' operators, and we
  38209. need the 'ext' bytecode anyway for accessing bitfields.
  38210. Why not have constant-address variants of the 'ref' operators?
  38211. Because that would double the number of 'ref' operators again, and
  38212. 'const32 ADDRESS ref32' is only one byte longer.
  38213. Why do the 'refN' operators have to support unaligned fetches?
  38214. GDB will generate bytecode that fetches multi-byte values at
  38215. unaligned addresses whenever the executable's debugging information
  38216. tells it to. Furthermore, GDB does not know the value the pointer
  38217. will have when GDB generates the bytecode, so it cannot determine
  38218. whether a particular fetch will be aligned or not.
  38219. In particular, structure bitfields may be several bytes long, but
  38220. follow no alignment rules; members of packed structures are not
  38221. necessarily aligned either.
  38222. In general, there are many cases where unaligned references occur
  38223. in correct C code, either at the programmer's explicit request, or
  38224. at the compiler's discretion. Thus, it is simpler to make the GDB
  38225. agent bytecodes work correctly in all circumstances than to make
  38226. GDB guess in each case whether the compiler did the usual thing.
  38227. Why are there no side-effecting operators?
  38228. Because our current client doesn't want them? That's a cheap
  38229. answer. I think the real answer is that I'm afraid of implementing
  38230. function calls. We should re-visit this issue after the present
  38231. contract is delivered.
  38232. Why aren't the 'goto' ops PC-relative?
  38233. The interpreter has the base address around anyway for PC bounds
  38234. checking, and it seemed simpler.
  38235. Why is there only one offset size for the 'goto' ops?
  38236. Offsets are currently sixteen bits. I'm not happy with this
  38237. situation either:
  38238. Suppose we have multiple branch ops with different offset sizes.
  38239. As I generate code left-to-right, all my jumps are forward jumps
  38240. (there are no loops in expressions), so I never know the target
  38241. when I emit the jump opcode. Thus, I have to either always assume
  38242. the largest offset size, or do jump relaxation on the code after I
  38243. generate it, which seems like a big waste of time.
  38244. I can imagine a reasonable expression being longer than 256 bytes.
  38245. I can't imagine one being longer than 64k. Thus, we need 16-bit
  38246. offsets. This kind of reasoning is so bogus, but relaxation is
  38247. pathetic.
  38248. The other approach would be to generate code right-to-left. Then
  38249. I'd always know my offset size. That might be fun.
  38250. Where is the function call bytecode?
  38251. When we add side-effects, we should add this.
  38252. Why does the 'reg' bytecode take a 16-bit register number?
  38253. Intel's IA-64 architecture has 128 general-purpose registers, and
  38254. 128 floating-point registers, and I'm sure it has some random
  38255. control registers.
  38256. Why do we need 'trace' and 'trace_quick'?
  38257. Because GDB needs to record all the memory contents and registers
  38258. an expression touches. If the user wants to evaluate an expression
  38259. 'x->y->z', the agent must record the values of 'x' and 'x->y' as
  38260. well as the value of 'x->y->z'.
  38261. Don't the 'trace' bytecodes make the interpreter less general?
  38262. They do mean that the interpreter contains special-purpose code,
  38263. but that doesn't mean the interpreter can only be used for that
  38264. purpose. If an expression doesn't use the 'trace' bytecodes, they
  38265. don't get in its way.
  38266. Why doesn't 'trace_quick' consume its arguments the way everything else does?
  38267. In general, you do want your operators to consume their arguments;
  38268. it's consistent, and generally reduces the amount of stack
  38269. rearrangement necessary. However, 'trace_quick' is a kludge to
  38270. save space; it only exists so we needn't write 'dup const8 SIZE
  38271. trace' before every memory reference. Therefore, it's okay for it
  38272. not to consume its arguments; it's meant for a specific context in
  38273. which we know exactly what it should do with the stack. If we're
  38274. going to have a kludge, it should be an effective kludge.
  38275. Why does 'trace16' exist?
  38276. That opcode was added by the customer that contracted Cygnus for
  38277. the data tracing work. I personally think it is unnecessary;
  38278. objects that large will be quite rare, so it is okay to use 'dup
  38279. const16 SIZE trace' in those cases.
  38280. Whatever we decide to do with 'trace16', we should at least leave
  38281. opcode 0x30 reserved, to remain compatible with the customer who
  38282. added it.
  38283. 
  38284. File: gdb.info, Node: Target Descriptions, Next: Operating System Information, Prev: Agent Expressions, Up: Top
  38285. Appendix G Target Descriptions
  38286. ******************************
  38287. One of the challenges of using GDB to debug embedded systems is that
  38288. there are so many minor variants of each processor architecture in use.
  38289. It is common practice for vendors to start with a standard processor
  38290. core -- ARM, PowerPC, or MIPS, for example -- and then make changes to
  38291. adapt it to a particular market niche. Some architectures have hundreds
  38292. of variants, available from dozens of vendors. This leads to a number
  38293. of problems:
  38294. * With so many different customized processors, it is difficult for
  38295. the GDB maintainers to keep up with the changes.
  38296. * Since individual variants may have short lifetimes or limited
  38297. audiences, it may not be worthwhile to carry information about
  38298. every variant in the GDB source tree.
  38299. * When GDB does support the architecture of the embedded system at
  38300. hand, the task of finding the correct architecture name to give the
  38301. 'set architecture' command can be error-prone.
  38302. To address these problems, the GDB remote protocol allows a target
  38303. system to not only identify itself to GDB, but to actually describe its
  38304. own features. This lets GDB support processor variants it has never
  38305. seen before -- to the extent that the descriptions are accurate, and
  38306. that GDB understands them.
  38307. GDB must be linked with the Expat library to support XML target
  38308. descriptions. *Note Expat::.
  38309. * Menu:
  38310. * Retrieving Descriptions:: How descriptions are fetched from a target.
  38311. * Target Description Format:: The contents of a target description.
  38312. * Predefined Target Types:: Standard types available for target
  38313. descriptions.
  38314. * Enum Target Types:: How to define enum target types.
  38315. * Standard Target Features:: Features GDB knows about.
  38316. 
  38317. File: gdb.info, Node: Retrieving Descriptions, Next: Target Description Format, Up: Target Descriptions
  38318. G.1 Retrieving Descriptions
  38319. ===========================
  38320. Target descriptions can be read from the target automatically, or
  38321. specified by the user manually. The default behavior is to read the
  38322. description from the target. GDB retrieves it via the remote protocol
  38323. using 'qXfer' requests (*note qXfer: General Query Packets.). The ANNEX
  38324. in the 'qXfer' packet will be 'target.xml'. The contents of the
  38325. 'target.xml' annex are an XML document, of the form described in *note
  38326. Target Description Format::.
  38327. Alternatively, you can specify a file to read for the target
  38328. description. If a file is set, the target will not be queried. The
  38329. commands to specify a file are:
  38330. 'set tdesc filename PATH'
  38331. Read the target description from PATH.
  38332. 'unset tdesc filename'
  38333. Do not read the XML target description from a file. GDB will use
  38334. the description supplied by the current target.
  38335. 'show tdesc filename'
  38336. Show the filename to read for a target description, if any.
  38337. 
  38338. File: gdb.info, Node: Target Description Format, Next: Predefined Target Types, Prev: Retrieving Descriptions, Up: Target Descriptions
  38339. G.2 Target Description Format
  38340. =============================
  38341. A target description annex is an XML (http://www.w3.org/XML/) document
  38342. which complies with the Document Type Definition provided in the GDB
  38343. sources in 'gdb/features/gdb-target.dtd'. This means you can use
  38344. generally available tools like 'xmllint' to check that your feature
  38345. descriptions are well-formed and valid. However, to help people
  38346. unfamiliar with XML write descriptions for their targets, we also
  38347. describe the grammar here.
  38348. Target descriptions can identify the architecture of the remote
  38349. target and (for some architectures) provide information about custom
  38350. register sets. They can also identify the OS ABI of the remote target.
  38351. GDB can use this information to autoconfigure for your target, or to
  38352. warn you if you connect to an unsupported target.
  38353. Here is a simple target description:
  38354. <target version="1.0">
  38355. <architecture>i386:x86-64</architecture>
  38356. </target>
  38357. This minimal description only says that the target uses the x86-64
  38358. architecture.
  38359. A target description has the following overall form, with [ ] marking
  38360. optional elements and ... marking repeatable elements. The elements are
  38361. explained further below.
  38362. <?xml version="1.0"?>
  38363. <!DOCTYPE target SYSTEM "gdb-target.dtd">
  38364. <target version="1.0">
  38365. [ARCHITECTURE]
  38366. [OSABI]
  38367. [COMPATIBLE]
  38368. [FEATURE...]
  38369. </target>
  38370. The description is generally insensitive to whitespace and line breaks,
  38371. under the usual common-sense rules. The XML version declaration and
  38372. document type declaration can generally be omitted (GDB does not require
  38373. them), but specifying them may be useful for XML validation tools. The
  38374. 'version' attribute for '<target>' may also be omitted, but we recommend
  38375. including it; if future versions of GDB use an incompatible revision of
  38376. 'gdb-target.dtd', they will detect and report the version mismatch.
  38377. G.2.1 Inclusion
  38378. ---------------
  38379. It can sometimes be valuable to split a target description up into
  38380. several different annexes, either for organizational purposes, or to
  38381. share files between different possible target descriptions. You can
  38382. divide a description into multiple files by replacing any element of the
  38383. target description with an inclusion directive of the form:
  38384. <xi:include href="DOCUMENT"/>
  38385. When GDB encounters an element of this form, it will retrieve the named
  38386. XML DOCUMENT, and replace the inclusion directive with the contents of
  38387. that document. If the current description was read using 'qXfer', then
  38388. so will be the included document; DOCUMENT will be interpreted as the
  38389. name of an annex. If the current description was read from a file, GDB
  38390. will look for DOCUMENT as a file in the same directory where it found
  38391. the original description.
  38392. G.2.2 Architecture
  38393. ------------------
  38394. An '<architecture>' element has this form:
  38395. <architecture>ARCH</architecture>
  38396. ARCH is one of the architectures from the set accepted by 'set
  38397. architecture' (*note Specifying a Debugging Target: Targets.).
  38398. G.2.3 OS ABI
  38399. ------------
  38400. This optional field was introduced in GDB version 7.0. Previous
  38401. versions of GDB ignore it.
  38402. An '<osabi>' element has this form:
  38403. <osabi>ABI-NAME</osabi>
  38404. ABI-NAME is an OS ABI name from the same selection accepted by
  38405. 'set osabi' (*note Configuring the Current ABI: ABI.).
  38406. G.2.4 Compatible Architecture
  38407. -----------------------------
  38408. This optional field was introduced in GDB version 7.0. Previous
  38409. versions of GDB ignore it.
  38410. A '<compatible>' element has this form:
  38411. <compatible>ARCH</compatible>
  38412. ARCH is one of the architectures from the set accepted by 'set
  38413. architecture' (*note Specifying a Debugging Target: Targets.).
  38414. A '<compatible>' element is used to specify that the target is able
  38415. to run binaries in some other than the main target architecture given by
  38416. the '<architecture>' element. For example, on the Cell Broadband
  38417. Engine, the main architecture is 'powerpc:common' or 'powerpc:common64',
  38418. but the system is able to run binaries in the 'spu' architecture as
  38419. well. The way to describe this capability with '<compatible>' is as
  38420. follows:
  38421. <architecture>powerpc:common</architecture>
  38422. <compatible>spu</compatible>
  38423. G.2.5 Features
  38424. --------------
  38425. Each '<feature>' describes some logical portion of the target system.
  38426. Features are currently used to describe available CPU registers and the
  38427. types of their contents. A '<feature>' element has this form:
  38428. <feature name="NAME">
  38429. [TYPE...]
  38430. REG...
  38431. </feature>
  38432. Each feature's name should be unique within the description. The name
  38433. of a feature does not matter unless GDB has some special knowledge of
  38434. the contents of that feature; if it does, the feature should have its
  38435. standard name. *Note Standard Target Features::.
  38436. G.2.6 Types
  38437. -----------
  38438. Any register's value is a collection of bits which GDB must interpret.
  38439. The default interpretation is a two's complement integer, but other
  38440. types can be requested by name in the register description. Some
  38441. predefined types are provided by GDB (*note Predefined Target Types::),
  38442. and the description can define additional composite and enum types.
  38443. Each type element must have an 'id' attribute, which gives a unique
  38444. (within the containing '<feature>') name to the type. Types must be
  38445. defined before they are used.
  38446. Some targets offer vector registers, which can be treated as arrays
  38447. of scalar elements. These types are written as '<vector>' elements,
  38448. specifying the array element type, TYPE, and the number of elements,
  38449. COUNT:
  38450. <vector id="ID" type="TYPE" count="COUNT"/>
  38451. If a register's value is usefully viewed in multiple ways, define it
  38452. with a union type containing the useful representations. The '<union>'
  38453. element contains one or more '<field>' elements, each of which has a
  38454. NAME and a TYPE:
  38455. <union id="ID">
  38456. <field name="NAME" type="TYPE"/>
  38457. ...
  38458. </union>
  38459. If a register's value is composed from several separate values,
  38460. define it with either a structure type or a flags type. A flags type
  38461. may only contain bitfields. A structure type may either contain only
  38462. bitfields or contain no bitfields. If the value contains only
  38463. bitfields, its total size in bytes must be specified.
  38464. Non-bitfield values have a NAME and TYPE.
  38465. <struct id="ID">
  38466. <field name="NAME" type="TYPE"/>
  38467. ...
  38468. </struct>
  38469. Both NAME and TYPE values are required. No implicit padding is
  38470. added.
  38471. Bitfield values have a NAME, START, END and TYPE.
  38472. <struct id="ID" size="SIZE">
  38473. <field name="NAME" start="START" end="END" type="TYPE"/>
  38474. ...
  38475. </struct>
  38476. <flags id="ID" size="SIZE">
  38477. <field name="NAME" start="START" end="END" type="TYPE"/>
  38478. ...
  38479. </flags>
  38480. The NAME value is required. Bitfield values may be named with the
  38481. empty string, '""', in which case the field is "filler" and its value is
  38482. not printed. Not all bits need to be specified, so "filler" fields are
  38483. optional.
  38484. The START and END values are required, and TYPE is optional. The
  38485. field's START must be less than or equal to its END, and zero represents
  38486. the least significant bit.
  38487. The default value of TYPE is 'bool' for single bit fields, and an
  38488. unsigned integer otherwise.
  38489. Which to choose? Structures or flags?
  38490. Registers defined with 'flags' have these advantages over defining
  38491. them with 'struct':
  38492. * Arithmetic may be performed on them as if they were integers.
  38493. * They are printed in a more readable fashion.
  38494. Registers defined with 'struct' have one advantage over defining them
  38495. with 'flags':
  38496. * One can fetch individual fields like in 'C'.
  38497. (gdb) print $my_struct_reg.field3
  38498. $1 = 42
  38499. G.2.7 Registers
  38500. ---------------
  38501. Each register is represented as an element with this form:
  38502. <reg name="NAME"
  38503. bitsize="SIZE"
  38504. [regnum="NUM"]
  38505. [save-restore="SAVE-RESTORE"]
  38506. [type="TYPE"]
  38507. [group="GROUP"]/>
  38508. The components are as follows:
  38509. NAME
  38510. The register's name; it must be unique within the target
  38511. description.
  38512. BITSIZE
  38513. The register's size, in bits.
  38514. REGNUM
  38515. The register's number. If omitted, a register's number is one
  38516. greater than that of the previous register (either in the current
  38517. feature or in a preceding feature); the first register in the
  38518. target description defaults to zero. This register number is used
  38519. to read or write the register; e.g. it is used in the remote 'p'
  38520. and 'P' packets, and registers appear in the 'g' and 'G' packets in
  38521. order of increasing register number.
  38522. SAVE-RESTORE
  38523. Whether the register should be preserved across inferior function
  38524. calls; this must be either 'yes' or 'no'. The default is 'yes',
  38525. which is appropriate for most registers except for some system
  38526. control registers; this is not related to the target's ABI.
  38527. TYPE
  38528. The type of the register. It may be a predefined type, a type
  38529. defined in the current feature, or one of the special types 'int'
  38530. and 'float'. 'int' is an integer type of the correct size for
  38531. BITSIZE, and 'float' is a floating point type (in the
  38532. architecture's normal floating point format) of the correct size
  38533. for BITSIZE. The default is 'int'.
  38534. GROUP
  38535. The register group to which this register belongs. It can be one
  38536. of the standard register groups 'general', 'float', 'vector' or an
  38537. arbitrary string. Group names should be limited to alphanumeric
  38538. characters. If a group name is made up of multiple words the words
  38539. may be separated by hyphens; e.g. 'special-group' or
  38540. 'ultra-special-group'. If no GROUP is specified, GDB will not
  38541. display the register in 'info registers'.
  38542. 
  38543. File: gdb.info, Node: Predefined Target Types, Next: Enum Target Types, Prev: Target Description Format, Up: Target Descriptions
  38544. G.3 Predefined Target Types
  38545. ===========================
  38546. Type definitions in the self-description can build up composite types
  38547. from basic building blocks, but can not define fundamental types.
  38548. Instead, standard identifiers are provided by GDB for the fundamental
  38549. types. The currently supported types are:
  38550. 'bool'
  38551. Boolean type, occupying a single bit.
  38552. 'int8'
  38553. 'int16'
  38554. 'int24'
  38555. 'int32'
  38556. 'int64'
  38557. 'int128'
  38558. Signed integer types holding the specified number of bits.
  38559. 'uint8'
  38560. 'uint16'
  38561. 'uint24'
  38562. 'uint32'
  38563. 'uint64'
  38564. 'uint128'
  38565. Unsigned integer types holding the specified number of bits.
  38566. 'code_ptr'
  38567. 'data_ptr'
  38568. Pointers to unspecified code and data. The program counter and any
  38569. dedicated return address register may be marked as code pointers;
  38570. printing a code pointer converts it into a symbolic address. The
  38571. stack pointer and any dedicated address registers may be marked as
  38572. data pointers.
  38573. 'ieee_single'
  38574. Single precision IEEE floating point.
  38575. 'ieee_double'
  38576. Double precision IEEE floating point.
  38577. 'arm_fpa_ext'
  38578. The 12-byte extended precision format used by ARM FPA registers.
  38579. 'i387_ext'
  38580. The 10-byte extended precision format used by x87 registers.
  38581. 'i386_eflags'
  38582. 32bit EFLAGS register used by x86.
  38583. 'i386_mxcsr'
  38584. 32bit MXCSR register used by x86.
  38585. 
  38586. File: gdb.info, Node: Enum Target Types, Next: Standard Target Features, Prev: Predefined Target Types, Up: Target Descriptions
  38587. G.4 Enum Target Types
  38588. =====================
  38589. Enum target types are useful in 'struct' and 'flags' register
  38590. descriptions. *Note Target Description Format::.
  38591. Enum types have a name, size and a list of name/value pairs.
  38592. <enum id="ID" size="SIZE">
  38593. <evalue name="NAME" value="VALUE"/>
  38594. ...
  38595. </enum>
  38596. Enums must be defined before they are used.
  38597. <enum id="levels_type" size="4">
  38598. <evalue name="low" value="0"/>
  38599. <evalue name="high" value="1"/>
  38600. </enum>
  38601. <flags id="flags_type" size="4">
  38602. <field name="X" start="0"/>
  38603. <field name="LEVEL" start="1" end="1" type="levels_type"/>
  38604. </flags>
  38605. <reg name="flags" bitsize="32" type="flags_type"/>
  38606. Given that description, a value of 3 for the 'flags' register would
  38607. be printed as:
  38608. (gdb) info register flags
  38609. flags 0x3 [ X LEVEL=high ]
  38610. 
  38611. File: gdb.info, Node: Standard Target Features, Prev: Enum Target Types, Up: Target Descriptions
  38612. G.5 Standard Target Features
  38613. ============================
  38614. A target description must contain either no registers or all the
  38615. target's registers. If the description contains no registers, then GDB
  38616. will assume a default register layout, selected based on the
  38617. architecture. If the description contains any registers, the default
  38618. layout will not be used; the standard registers must be described in the
  38619. target description, in such a way that GDB can recognize them.
  38620. This is accomplished by giving specific names to feature elements
  38621. which contain standard registers. GDB will look for features with those
  38622. names and verify that they contain the expected registers; if any known
  38623. feature is missing required registers, or if any required feature is
  38624. missing, GDB will reject the target description. You can add additional
  38625. registers to any of the standard features -- GDB will display them just
  38626. as if they were added to an unrecognized feature.
  38627. This section lists the known features and their expected contents.
  38628. Sample XML documents for these features are included in the GDB source
  38629. tree, in the directory 'gdb/features'.
  38630. Names recognized by GDB should include the name of the company or
  38631. organization which selected the name, and the overall architecture to
  38632. which the feature applies; so e.g. the feature containing ARM core
  38633. registers is named 'org.gnu.gdb.arm.core'.
  38634. The names of registers are not case sensitive for the purpose of
  38635. recognizing standard features, but GDB will only display registers using
  38636. the capitalization used in the description.
  38637. * Menu:
  38638. * AArch64 Features::
  38639. * ARC Features::
  38640. * ARM Features::
  38641. * i386 Features::
  38642. * MicroBlaze Features::
  38643. * MIPS Features::
  38644. * M68K Features::
  38645. * NDS32 Features::
  38646. * Nios II Features::
  38647. * OpenRISC 1000 Features::
  38648. * PowerPC Features::
  38649. * RISC-V Features::
  38650. * RX Features::
  38651. * S/390 and System z Features::
  38652. * Sparc Features::
  38653. * TIC6x Features::
  38654. 
  38655. File: gdb.info, Node: AArch64 Features, Next: ARC Features, Up: Standard Target Features
  38656. G.5.1 AArch64 Features
  38657. ----------------------
  38658. The 'org.gnu.gdb.aarch64.core' feature is required for AArch64 targets.
  38659. It should contain registers 'x0' through 'x30', 'sp', 'pc', and 'cpsr'.
  38660. The 'org.gnu.gdb.aarch64.fpu' feature is optional. If present, it
  38661. should contain registers 'v0' through 'v31', 'fpsr', and 'fpcr'.
  38662. The 'org.gnu.gdb.aarch64.sve' feature is optional. If present, it
  38663. should contain registers 'z0' through 'z31', 'p0' through 'p15', 'ffr'
  38664. and 'vg'.
  38665. The 'org.gnu.gdb.aarch64.pauth' feature is optional. If present, it
  38666. should contain registers 'pauth_dmask' and 'pauth_cmask'.
  38667. 
  38668. File: gdb.info, Node: ARC Features, Next: ARM Features, Prev: AArch64 Features, Up: Standard Target Features
  38669. G.5.2 ARC Features
  38670. ------------------
  38671. ARC processors are highly configurable, so even core registers and their
  38672. number are not completely predetermined. In addition flags and PC
  38673. registers which are important to GDB are not "core" registers in ARC. It
  38674. is required that one of the core registers features is present.
  38675. 'org.gnu.gdb.arc.aux-minimal' feature is mandatory.
  38676. The 'org.gnu.gdb.arc.core.v2' feature is required for ARC EM and ARC
  38677. HS targets with a normal register file. It should contain registers
  38678. 'r0' through 'r25', 'gp', 'fp', 'sp', 'r30', 'blink', 'lp_count' and
  38679. 'pcl'. This feature may contain register 'ilink' and any of extension
  38680. core registers 'r32' through 'r59/acch'. 'ilink' and extension core
  38681. registers are not available to read/write, when debugging GNU/Linux
  38682. applications, thus 'ilink' is made optional.
  38683. The 'org.gnu.gdb.arc.core-reduced.v2' feature is required for ARC EM
  38684. and ARC HS targets with a reduced register file. It should contain
  38685. registers 'r0' through 'r3', 'r10' through 'r15', 'gp', 'fp', 'sp',
  38686. 'r30', 'blink', 'lp_count' and 'pcl'. This feature may contain register
  38687. 'ilink' and any of extension core registers 'r32' through 'r59/acch'.
  38688. The 'org.gnu.gdb.arc.core.arcompact' feature is required for
  38689. ARCompact targets with a normal register file. It should contain
  38690. registers 'r0' through 'r25', 'gp', 'fp', 'sp', 'r30', 'blink',
  38691. 'lp_count' and 'pcl'. This feature may contain registers 'ilink1',
  38692. 'ilink2' and any of extension core registers 'r32' through 'r59/acch'.
  38693. 'ilink1' and 'ilink2' and extension core registers are not available
  38694. when debugging GNU/Linux applications. The only difference with
  38695. 'org.gnu.gdb.arc.core.v2' feature is in the names of 'ilink1' and
  38696. 'ilink2' registers and that 'r30' is mandatory in ARC v2, but 'ilink2'
  38697. is optional on ARCompact.
  38698. The 'org.gnu.gdb.arc.aux-minimal' feature is required for all ARC
  38699. targets. It should contain registers 'pc' and 'status32'.
  38700. 
  38701. File: gdb.info, Node: ARM Features, Next: i386 Features, Prev: ARC Features, Up: Standard Target Features
  38702. G.5.3 ARM Features
  38703. ------------------
  38704. The 'org.gnu.gdb.arm.core' feature is required for non-M-profile ARM
  38705. targets. It should contain registers 'r0' through 'r13', 'sp', 'lr',
  38706. 'pc', and 'cpsr'.
  38707. For M-profile targets (e.g. Cortex-M3), the 'org.gnu.gdb.arm.core'
  38708. feature is replaced by 'org.gnu.gdb.arm.m-profile'. It should contain
  38709. registers 'r0' through 'r13', 'sp', 'lr', 'pc', and 'xpsr'.
  38710. The 'org.gnu.gdb.arm.fpa' feature is optional. If present, it should
  38711. contain registers 'f0' through 'f7' and 'fps'.
  38712. The 'org.gnu.gdb.xscale.iwmmxt' feature is optional. If present, it
  38713. should contain at least registers 'wR0' through 'wR15' and 'wCGR0'
  38714. through 'wCGR3'. The 'wCID', 'wCon', 'wCSSF', and 'wCASF' registers are
  38715. optional.
  38716. The 'org.gnu.gdb.arm.vfp' feature is optional. If present, it should
  38717. contain at least registers 'd0' through 'd15'. If they are present,
  38718. 'd16' through 'd31' should also be included. GDB will synthesize the
  38719. single-precision registers from halves of the double-precision
  38720. registers.
  38721. The 'org.gnu.gdb.arm.neon' feature is optional. It does not need to
  38722. contain registers; it instructs GDB to display the VFP double-precision
  38723. registers as vectors and to synthesize the quad-precision registers from
  38724. pairs of double-precision registers. If this feature is present,
  38725. 'org.gnu.gdb.arm.vfp' must also be present and include 32
  38726. double-precision registers.
  38727. 
  38728. File: gdb.info, Node: i386 Features, Next: MicroBlaze Features, Prev: ARM Features, Up: Standard Target Features
  38729. G.5.4 i386 Features
  38730. -------------------
  38731. The 'org.gnu.gdb.i386.core' feature is required for i386/amd64 targets.
  38732. It should describe the following registers:
  38733. - 'eax' through 'edi' plus 'eip' for i386
  38734. - 'rax' through 'r15' plus 'rip' for amd64
  38735. - 'eflags', 'cs', 'ss', 'ds', 'es', 'fs', 'gs'
  38736. - 'st0' through 'st7'
  38737. - 'fctrl', 'fstat', 'ftag', 'fiseg', 'fioff', 'foseg', 'fooff' and
  38738. 'fop'
  38739. The register sets may be different, depending on the target.
  38740. The 'org.gnu.gdb.i386.sse' feature is optional. It should describe
  38741. registers:
  38742. - 'xmm0' through 'xmm7' for i386
  38743. - 'xmm0' through 'xmm15' for amd64
  38744. - 'mxcsr'
  38745. The 'org.gnu.gdb.i386.avx' feature is optional and requires the
  38746. 'org.gnu.gdb.i386.sse' feature. It should describe the upper 128 bits
  38747. of YMM registers:
  38748. - 'ymm0h' through 'ymm7h' for i386
  38749. - 'ymm0h' through 'ymm15h' for amd64
  38750. The 'org.gnu.gdb.i386.mpx' is an optional feature representing Intel
  38751. Memory Protection Extension (MPX). It should describe the following
  38752. registers:
  38753. - 'bnd0raw' through 'bnd3raw' for i386 and amd64.
  38754. - 'bndcfgu' and 'bndstatus' for i386 and amd64.
  38755. The 'org.gnu.gdb.i386.linux' feature is optional. It should describe
  38756. a single register, 'orig_eax'.
  38757. The 'org.gnu.gdb.i386.segments' feature is optional. It should
  38758. describe two system registers: 'fs_base' and 'gs_base'.
  38759. The 'org.gnu.gdb.i386.avx512' feature is optional and requires the
  38760. 'org.gnu.gdb.i386.avx' feature. It should describe additional XMM
  38761. registers:
  38762. - 'xmm16h' through 'xmm31h', only valid for amd64.
  38763. It should describe the upper 128 bits of additional YMM registers:
  38764. - 'ymm16h' through 'ymm31h', only valid for amd64.
  38765. It should describe the upper 256 bits of ZMM registers:
  38766. - 'zmm0h' through 'zmm7h' for i386.
  38767. - 'zmm0h' through 'zmm15h' for amd64.
  38768. It should describe the additional ZMM registers:
  38769. - 'zmm16h' through 'zmm31h', only valid for amd64.
  38770. The 'org.gnu.gdb.i386.pkeys' feature is optional. It should describe
  38771. a single register, 'pkru'. It is a 32-bit register valid for i386 and
  38772. amd64.
  38773. 
  38774. File: gdb.info, Node: MicroBlaze Features, Next: MIPS Features, Prev: i386 Features, Up: Standard Target Features
  38775. G.5.5 MicroBlaze Features
  38776. -------------------------
  38777. The 'org.gnu.gdb.microblaze.core' feature is required for MicroBlaze
  38778. targets. It should contain registers 'r0' through 'r31', 'rpc', 'rmsr',
  38779. 'rear', 'resr', 'rfsr', 'rbtr', 'rpvr', 'rpvr1' through 'rpvr11',
  38780. 'redr', 'rpid', 'rzpr', 'rtlbx', 'rtlbsx', 'rtlblo', and 'rtlbhi'.
  38781. The 'org.gnu.gdb.microblaze.stack-protect' feature is optional. If
  38782. present, it should contain registers 'rshr' and 'rslr'
  38783. 
  38784. File: gdb.info, Node: MIPS Features, Next: M68K Features, Prev: MicroBlaze Features, Up: Standard Target Features
  38785. G.5.6 MIPS Features
  38786. -------------------
  38787. The 'org.gnu.gdb.mips.cpu' feature is required for MIPS targets. It
  38788. should contain registers 'r0' through 'r31', 'lo', 'hi', and 'pc'. They
  38789. may be 32-bit or 64-bit depending on the target.
  38790. The 'org.gnu.gdb.mips.cp0' feature is also required. It should
  38791. contain at least the 'status', 'badvaddr', and 'cause' registers. They
  38792. may be 32-bit or 64-bit depending on the target.
  38793. The 'org.gnu.gdb.mips.fpu' feature is currently required, though it
  38794. may be optional in a future version of GDB. It should contain registers
  38795. 'f0' through 'f31', 'fcsr', and 'fir'. They may be 32-bit or 64-bit
  38796. depending on the target.
  38797. The 'org.gnu.gdb.mips.dsp' feature is optional. It should contain
  38798. registers 'hi1' through 'hi3', 'lo1' through 'lo3', and 'dspctl'. The
  38799. 'dspctl' register should be 32-bit and the rest may be 32-bit or 64-bit
  38800. depending on the target.
  38801. The 'org.gnu.gdb.mips.linux' feature is optional. It should contain
  38802. a single register, 'restart', which is used by the Linux kernel to
  38803. control restartable syscalls.
  38804. 
  38805. File: gdb.info, Node: M68K Features, Next: NDS32 Features, Prev: MIPS Features, Up: Standard Target Features
  38806. G.5.7 M68K Features
  38807. -------------------
  38808. ''org.gnu.gdb.m68k.core''
  38809. ''org.gnu.gdb.coldfire.core''
  38810. ''org.gnu.gdb.fido.core''
  38811. One of those features must be always present. The feature that is
  38812. present determines which flavor of m68k is used. The feature that
  38813. is present should contain registers 'd0' through 'd7', 'a0' through
  38814. 'a5', 'fp', 'sp', 'ps' and 'pc'.
  38815. ''org.gnu.gdb.coldfire.fp''
  38816. This feature is optional. If present, it should contain registers
  38817. 'fp0' through 'fp7', 'fpcontrol', 'fpstatus' and 'fpiaddr'.
  38818. 
  38819. File: gdb.info, Node: NDS32 Features, Next: Nios II Features, Prev: M68K Features, Up: Standard Target Features
  38820. G.5.8 NDS32 Features
  38821. --------------------
  38822. The 'org.gnu.gdb.nds32.core' feature is required for NDS32 targets. It
  38823. should contain at least registers 'r0' through 'r10', 'r15', 'fp', 'gp',
  38824. 'lp', 'sp', and 'pc'.
  38825. The 'org.gnu.gdb.nds32.fpu' feature is optional. If present, it
  38826. should contain 64-bit double-precision floating-point registers 'fd0'
  38827. through _fdN_, which should be 'fd3', 'fd7', 'fd15', or 'fd31' based on
  38828. the FPU configuration implemented.
  38829. _Note:_ The first sixteen 64-bit double-precision floating-point
  38830. registers are overlapped with the thirty-two 32-bit single-precision
  38831. floating-point registers. The 32-bit single-precision registers, if not
  38832. being listed explicitly, will be synthesized from halves of the
  38833. overlapping 64-bit double-precision registers. Listing 32-bit
  38834. single-precision registers explicitly is deprecated, and the support to
  38835. it could be totally removed some day.
  38836. 
  38837. File: gdb.info, Node: Nios II Features, Next: OpenRISC 1000 Features, Prev: NDS32 Features, Up: Standard Target Features
  38838. G.5.9 Nios II Features
  38839. ----------------------
  38840. The 'org.gnu.gdb.nios2.cpu' feature is required for Nios II targets. It
  38841. should contain the 32 core registers ('zero', 'at', 'r2' through 'r23',
  38842. 'et' through 'ra'), 'pc', and the 16 control registers ('status' through
  38843. 'mpuacc').
  38844. 
  38845. File: gdb.info, Node: OpenRISC 1000 Features, Next: PowerPC Features, Prev: Nios II Features, Up: Standard Target Features
  38846. G.5.10 Openrisc 1000 Features
  38847. -----------------------------
  38848. The 'org.gnu.gdb.or1k.group0' feature is required for OpenRISC 1000
  38849. targets. It should contain the 32 general purpose registers ('r0'
  38850. through 'r31'), 'ppc', 'npc' and 'sr'.
  38851. 
  38852. File: gdb.info, Node: PowerPC Features, Next: RISC-V Features, Prev: OpenRISC 1000 Features, Up: Standard Target Features
  38853. G.5.11 PowerPC Features
  38854. -----------------------
  38855. The 'org.gnu.gdb.power.core' feature is required for PowerPC targets.
  38856. It should contain registers 'r0' through 'r31', 'pc', 'msr', 'cr', 'lr',
  38857. 'ctr', and 'xer'. They may be 32-bit or 64-bit depending on the target.
  38858. The 'org.gnu.gdb.power.fpu' feature is optional. It should contain
  38859. registers 'f0' through 'f31' and 'fpscr'.
  38860. The 'org.gnu.gdb.power.altivec' feature is optional. It should
  38861. contain registers 'vr0' through 'vr31', 'vscr', and 'vrsave'. GDB will
  38862. define pseudo-registers 'v0' through 'v31' as aliases for the
  38863. corresponding 'vrX' registers.
  38864. The 'org.gnu.gdb.power.vsx' feature is optional. It should contain
  38865. registers 'vs0h' through 'vs31h'. GDB will combine these registers with
  38866. the floating point registers ('f0' through 'f31') and the altivec
  38867. registers ('vr0' through 'vr31') to present the 128-bit wide registers
  38868. 'vs0' through 'vs63', the set of vector-scalar registers for POWER7.
  38869. Therefore, this feature requires both 'org.gnu.gdb.power.fpu' and
  38870. 'org.gnu.gdb.power.altivec'.
  38871. The 'org.gnu.gdb.power.spe' feature is optional. It should contain
  38872. registers 'ev0h' through 'ev31h', 'acc', and 'spefscr'. SPE targets
  38873. should provide 32-bit registers in 'org.gnu.gdb.power.core' and provide
  38874. the upper halves in 'ev0h' through 'ev31h'. GDB will combine these to
  38875. present registers 'ev0' through 'ev31' to the user.
  38876. The 'org.gnu.gdb.power.ppr' feature is optional. It should contain
  38877. the 64-bit register 'ppr'.
  38878. The 'org.gnu.gdb.power.dscr' feature is optional. It should contain
  38879. the 64-bit register 'dscr'.
  38880. The 'org.gnu.gdb.power.tar' feature is optional. It should contain
  38881. the 64-bit register 'tar'.
  38882. The 'org.gnu.gdb.power.ebb' feature is optional. It should contain
  38883. registers 'bescr', 'ebbhr' and 'ebbrr', all 64-bit wide.
  38884. The 'org.gnu.gdb.power.linux.pmu' feature is optional. It should
  38885. contain registers 'mmcr0', 'mmcr2', 'siar', 'sdar' and 'sier', all
  38886. 64-bit wide. This is the subset of the isa 2.07 server PMU registers
  38887. provided by GNU/Linux.
  38888. The 'org.gnu.gdb.power.htm.spr' feature is optional. It should
  38889. contain registers 'tfhar', 'texasr' and 'tfiar', all 64-bit wide.
  38890. The 'org.gnu.gdb.power.htm.core' feature is optional. It should
  38891. contain the checkpointed general-purpose registers 'cr0' through 'cr31',
  38892. as well as the checkpointed registers 'clr' and 'cctr'. These registers
  38893. may all be either 32-bit or 64-bit depending on the target. It should
  38894. also contain the checkpointed registers 'ccr' and 'cxer', which should
  38895. both be 32-bit wide.
  38896. The 'org.gnu.gdb.power.htm.fpu' feature is optional. It should
  38897. contain the checkpointed 64-bit floating-point registers 'cf0' through
  38898. 'cf31', as well as the checkpointed 64-bit register 'cfpscr'.
  38899. The 'org.gnu.gdb.power.htm.altivec' feature is optional. It should
  38900. contain the checkpointed altivec registers 'cvr0' through 'cvr31', all
  38901. 128-bit wide. It should also contain the checkpointed registers 'cvscr'
  38902. and 'cvrsave', both 32-bit wide.
  38903. The 'org.gnu.gdb.power.htm.vsx' feature is optional. It should
  38904. contain registers 'cvs0h' through 'cvs31h'. GDB will combine these
  38905. registers with the checkpointed floating point registers ('cf0' through
  38906. 'cf31') and the checkpointed altivec registers ('cvr0' through 'cvr31')
  38907. to present the 128-bit wide checkpointed vector-scalar registers 'cvs0'
  38908. through 'cvs63'. Therefore, this feature requires both
  38909. 'org.gnu.gdb.power.htm.altivec' and 'org.gnu.gdb.power.htm.fpu'.
  38910. The 'org.gnu.gdb.power.htm.ppr' feature is optional. It should
  38911. contain the 64-bit checkpointed register 'cppr'.
  38912. The 'org.gnu.gdb.power.htm.dscr' feature is optional. It should
  38913. contain the 64-bit checkpointed register 'cdscr'.
  38914. The 'org.gnu.gdb.power.htm.tar' feature is optional. It should
  38915. contain the 64-bit checkpointed register 'ctar'.
  38916. 
  38917. File: gdb.info, Node: RISC-V Features, Next: RX Features, Prev: PowerPC Features, Up: Standard Target Features
  38918. G.5.12 RISC-V Features
  38919. ----------------------
  38920. The 'org.gnu.gdb.riscv.cpu' feature is required for RISC-V targets. It
  38921. should contain the registers 'x0' through 'x31', and 'pc'. Either the
  38922. architectural names ('x0', 'x1', etc) can be used, or the ABI names
  38923. ('zero', 'ra', etc).
  38924. The 'org.gnu.gdb.riscv.fpu' feature is optional. If present, it
  38925. should contain registers 'f0' through 'f31', 'fflags', 'frm', and
  38926. 'fcsr'. As with the cpu feature, either the architectural register
  38927. names, or the ABI names can be used.
  38928. The 'org.gnu.gdb.riscv.virtual' feature is optional. If present, it
  38929. should contain registers that are not backed by real registers on the
  38930. target, but are instead virtual, where the register value is derived
  38931. from other target state. In many ways these are like GDBs
  38932. pseudo-registers, except implemented by the target. Currently the only
  38933. register expected in this set is the one byte 'priv' register that
  38934. contains the target's privilege level in the least significant two bits.
  38935. The 'org.gnu.gdb.riscv.csr' feature is optional. If present, it
  38936. should contain all of the target's standard CSRs. Standard CSRs are
  38937. those defined in the RISC-V specification documents. There is some
  38938. overlap between this feature and the fpu feature; the 'fflags', 'frm',
  38939. and 'fcsr' registers could be in either feature. The expectation is
  38940. that these registers will be in the fpu feature if the target has
  38941. floating point hardware, but can be moved into the csr feature if the
  38942. target has the floating point control registers, but no other floating
  38943. point hardware.
  38944. 
  38945. File: gdb.info, Node: RX Features, Next: S/390 and System z Features, Prev: RISC-V Features, Up: Standard Target Features
  38946. G.5.13 RX Features
  38947. ------------------
  38948. The 'org.gnu.gdb.rx.core' feature is required for RX targets. It should
  38949. contain the registers 'r0' through 'r15', 'usp', 'isp', 'psw', 'pc',
  38950. 'intb', 'bpsw', 'bpc', 'fintv', 'fpsw', and 'acc'.
  38951. 
  38952. File: gdb.info, Node: S/390 and System z Features, Next: Sparc Features, Prev: RX Features, Up: Standard Target Features
  38953. G.5.14 S/390 and System z Features
  38954. ----------------------------------
  38955. The 'org.gnu.gdb.s390.core' feature is required for S/390 and System z
  38956. targets. It should contain the PSW and the 16 general registers. In
  38957. particular, System z targets should provide the 64-bit registers 'pswm',
  38958. 'pswa', and 'r0' through 'r15'. S/390 targets should provide the 32-bit
  38959. versions of these registers. A System z target that runs in 31-bit
  38960. addressing mode should provide 32-bit versions of 'pswm' and 'pswa', as
  38961. well as the general register's upper halves 'r0h' through 'r15h', and
  38962. their lower halves 'r0l' through 'r15l'.
  38963. The 'org.gnu.gdb.s390.fpr' feature is required. It should contain
  38964. the 64-bit registers 'f0' through 'f15', and 'fpc'.
  38965. The 'org.gnu.gdb.s390.acr' feature is required. It should contain
  38966. the 32-bit registers 'acr0' through 'acr15'.
  38967. The 'org.gnu.gdb.s390.linux' feature is optional. It should contain
  38968. the register 'orig_r2', which is 64-bit wide on System z targets and
  38969. 32-bit otherwise. In addition, the feature may contain the 'last_break'
  38970. register, whose width depends on the addressing mode, as well as the
  38971. 'system_call' register, which is always 32-bit wide.
  38972. The 'org.gnu.gdb.s390.tdb' feature is optional. It should contain
  38973. the 64-bit registers 'tdb0', 'tac', 'tct', 'atia', and 'tr0' through
  38974. 'tr15'.
  38975. The 'org.gnu.gdb.s390.vx' feature is optional. It should contain
  38976. 64-bit wide registers 'v0l' through 'v15l', which will be combined by
  38977. GDB with the floating point registers 'f0' through 'f15' to present the
  38978. 128-bit wide vector registers 'v0' through 'v15'. In addition, this
  38979. feature should contain the 128-bit wide vector registers 'v16' through
  38980. 'v31'.
  38981. The 'org.gnu.gdb.s390.gs' feature is optional. It should contain the
  38982. 64-bit wide guarded-storage-control registers 'gsd', 'gssm', and
  38983. 'gsepla'.
  38984. The 'org.gnu.gdb.s390.gsbc' feature is optional. It should contain
  38985. the 64-bit wide guarded-storage broadcast control registers 'bc_gsd',
  38986. 'bc_gssm', and 'bc_gsepla'.
  38987. 
  38988. File: gdb.info, Node: Sparc Features, Next: TIC6x Features, Prev: S/390 and System z Features, Up: Standard Target Features
  38989. G.5.15 Sparc Features
  38990. ---------------------
  38991. The 'org.gnu.gdb.sparc.cpu' feature is required for sparc32/sparc64
  38992. targets. It should describe the following registers:
  38993. - 'g0' through 'g7'
  38994. - 'o0' through 'o7'
  38995. - 'l0' through 'l7'
  38996. - 'i0' through 'i7'
  38997. They may be 32-bit or 64-bit depending on the target.
  38998. Also the 'org.gnu.gdb.sparc.fpu' feature is required for
  38999. sparc32/sparc64 targets. It should describe the following registers:
  39000. - 'f0' through 'f31'
  39001. - 'f32' through 'f62' for sparc64
  39002. The 'org.gnu.gdb.sparc.cp0' feature is required for sparc32/sparc64
  39003. targets. It should describe the following registers:
  39004. - 'y', 'psr', 'wim', 'tbr', 'pc', 'npc', 'fsr', and 'csr' for sparc32
  39005. - 'pc', 'npc', 'state', 'fsr', 'fprs', and 'y' for sparc64
  39006. 
  39007. File: gdb.info, Node: TIC6x Features, Prev: Sparc Features, Up: Standard Target Features
  39008. G.5.16 TMS320C6x Features
  39009. -------------------------
  39010. The 'org.gnu.gdb.tic6x.core' feature is required for TMS320C6x targets.
  39011. It should contain registers 'A0' through 'A15', registers 'B0' through
  39012. 'B15', 'CSR' and 'PC'.
  39013. The 'org.gnu.gdb.tic6x.gp' feature is optional. It should contain
  39014. registers 'A16' through 'A31' and 'B16' through 'B31'.
  39015. The 'org.gnu.gdb.tic6x.c6xp' feature is optional. It should contain
  39016. registers 'TSR', 'ILC' and 'RILC'.
  39017. 
  39018. File: gdb.info, Node: Operating System Information, Next: Trace File Format, Prev: Target Descriptions, Up: Top
  39019. Appendix H Operating System Information
  39020. ***************************************
  39021. * Menu:
  39022. * Process list::
  39023. Users of GDB often wish to obtain information about the state of the
  39024. operating system running on the target--for example the list of
  39025. processes, or the list of open files. This section describes the
  39026. mechanism that makes it possible. This mechanism is similar to the
  39027. target features mechanism (*note Target Descriptions::), but focuses on
  39028. a different aspect of target.
  39029. Operating system information is retrieved from the target via the
  39030. remote protocol, using 'qXfer' requests (*note qXfer osdata read::).
  39031. The object name in the request should be 'osdata', and the ANNEX
  39032. identifies the data to be fetched.
  39033. 
  39034. File: gdb.info, Node: Process list, Up: Operating System Information
  39035. H.1 Process list
  39036. ================
  39037. When requesting the process list, the ANNEX field in the 'qXfer' request
  39038. should be 'processes'. The returned data is an XML document. The
  39039. formal syntax of this document is defined in 'gdb/features/osdata.dtd'.
  39040. An example document is:
  39041. <?xml version="1.0"?>
  39042. <!DOCTYPE target SYSTEM "osdata.dtd">
  39043. <osdata type="processes">
  39044. <item>
  39045. <column name="pid">1</column>
  39046. <column name="user">root</column>
  39047. <column name="command">/sbin/init</column>
  39048. <column name="cores">1,2,3</column>
  39049. </item>
  39050. </osdata>
  39051. Each item should include a column whose name is 'pid'. The value of
  39052. that column should identify the process on the target. The 'user' and
  39053. 'command' columns are optional, and will be displayed by GDB. The
  39054. 'cores' column, if present, should contain a comma-separated list of
  39055. cores that this process is running on. Target may provide additional
  39056. columns, which GDB currently ignores.
  39057. 
  39058. File: gdb.info, Node: Trace File Format, Next: Index Section Format, Prev: Operating System Information, Up: Top
  39059. Appendix I Trace File Format
  39060. ****************************
  39061. The trace file comes in three parts: a header, a textual description
  39062. section, and a trace frame section with binary data.
  39063. The header has the form '\x7fTRACE0\n'. The first byte is '0x7f' so
  39064. as to indicate that the file contains binary data, while the '0' is a
  39065. version number that may have different values in the future.
  39066. The description section consists of multiple lines of ASCII text
  39067. separated by newline characters ('0xa'). The lines may include a
  39068. variety of optional descriptive or context-setting information, such as
  39069. tracepoint definitions or register set size. GDB will ignore any line
  39070. that it does not recognize. An empty line marks the end of this
  39071. section.
  39072. 'R SIZE'
  39073. Specifies the size of a register block in bytes. This is equal to
  39074. the size of a 'g' packet payload in the remote protocol. SIZE is
  39075. an ascii decimal number. There should be only one such line in a
  39076. single trace file.
  39077. 'status STATUS'
  39078. Trace status. STATUS has the same format as a 'qTStatus' remote
  39079. packet reply. There should be only one such line in a single trace
  39080. file.
  39081. 'tp PAYLOAD'
  39082. Tracepoint definition. The PAYLOAD has the same format as
  39083. 'qTfP'/'qTsP' remote packet reply payload. A single tracepoint may
  39084. take multiple lines of definition, corresponding to the multiple
  39085. reply packets.
  39086. 'tsv PAYLOAD'
  39087. Trace state variable definition. The PAYLOAD has the same format
  39088. as 'qTfV'/'qTsV' remote packet reply payload. A single variable
  39089. may take multiple lines of definition, corresponding to the
  39090. multiple reply packets.
  39091. 'tdesc PAYLOAD'
  39092. Target description in XML format. The PAYLOAD is a single line of
  39093. the XML file. All such lines should be concatenated together to
  39094. get the original XML file. This file is in the same format as
  39095. 'qXfer' 'features' payload, and corresponds to the main
  39096. 'target.xml' file. Includes are not allowed.
  39097. The trace frame section consists of a number of consecutive frames.
  39098. Each frame begins with a two-byte tracepoint number, followed by a
  39099. four-byte size giving the amount of data in the frame. The data in the
  39100. frame consists of a number of blocks, each introduced by a character
  39101. indicating its type (at least register, memory, and trace state
  39102. variable). The data in this section is raw binary, not a hexadecimal or
  39103. other encoding; its endianness matches the target's endianness.
  39104. 'R BYTES'
  39105. Register block. The number and ordering of bytes matches that of a
  39106. 'g' packet in the remote protocol. Note that these are the actual
  39107. bytes, in target order, not a hexadecimal encoding.
  39108. 'M ADDRESS LENGTH BYTES...'
  39109. Memory block. This is a contiguous block of memory, at the 8-byte
  39110. address ADDRESS, with a 2-byte length LENGTH, followed by LENGTH
  39111. bytes.
  39112. 'V NUMBER VALUE'
  39113. Trace state variable block. This records the 8-byte signed value
  39114. VALUE of trace state variable numbered NUMBER.
  39115. Future enhancements of the trace file format may include additional
  39116. types of blocks.
  39117. 
  39118. File: gdb.info, Node: Index Section Format, Next: Man Pages, Prev: Trace File Format, Up: Top
  39119. Appendix J '.gdb_index' section format
  39120. **************************************
  39121. This section documents the index section that is created by 'save
  39122. gdb-index' (*note Index Files::). The index section is DWARF-specific;
  39123. some knowledge of DWARF is assumed in this description.
  39124. The mapped index file format is designed to be directly 'mmap'able on
  39125. any architecture. In most cases, a datum is represented using a
  39126. little-endian 32-bit integer value, called an 'offset_type'. Big endian
  39127. machines must byte-swap the values before using them. Exceptions to
  39128. this rule are noted. The data is laid out such that alignment is always
  39129. respected.
  39130. A mapped index consists of several areas, laid out in order.
  39131. 1. The file header. This is a sequence of values, of 'offset_type'
  39132. unless otherwise noted:
  39133. 1. The version number, currently 8. Versions 1, 2 and 3 are
  39134. obsolete. Version 4 uses a different hashing function from
  39135. versions 5 and 6. Version 6 includes symbols for inlined
  39136. functions, whereas versions 4 and 5 do not. Version 7 adds
  39137. attributes to the CU indices in the symbol table. Version 8
  39138. specifies that symbols from DWARF type units
  39139. ('DW_TAG_type_unit') refer to the type unit's symbol table and
  39140. not the compilation unit ('DW_TAG_comp_unit') using the type.
  39141. GDB will only read version 4, 5, or 6 indices by specifying
  39142. 'set use-deprecated-index-sections on'. GDB has a workaround
  39143. for potentially broken version 7 indices so it is currently
  39144. not flagged as deprecated.
  39145. 2. The offset, from the start of the file, of the CU list.
  39146. 3. The offset, from the start of the file, of the types CU list.
  39147. Note that this area can be empty, in which case this offset
  39148. will be equal to the next offset.
  39149. 4. The offset, from the start of the file, of the address area.
  39150. 5. The offset, from the start of the file, of the symbol table.
  39151. 6. The offset, from the start of the file, of the constant pool.
  39152. 2. The CU list. This is a sequence of pairs of 64-bit little-endian
  39153. values, sorted by the CU offset. The first element in each pair is
  39154. the offset of a CU in the '.debug_info' section. The second
  39155. element in each pair is the length of that CU. References to a CU
  39156. elsewhere in the map are done using a CU index, which is just the
  39157. 0-based index into this table. Note that if there are type CUs,
  39158. then conceptually CUs and type CUs form a single list for the
  39159. purposes of CU indices.
  39160. 3. The types CU list. This is a sequence of triplets of 64-bit
  39161. little-endian values. In a triplet, the first value is the CU
  39162. offset, the second value is the type offset in the CU, and the
  39163. third value is the type signature. The types CU list is not
  39164. sorted.
  39165. 4. The address area. The address area consists of a sequence of
  39166. address entries. Each address entry has three elements:
  39167. 1. The low address. This is a 64-bit little-endian value.
  39168. 2. The high address. This is a 64-bit little-endian value. Like
  39169. 'DW_AT_high_pc', the value is one byte beyond the end.
  39170. 3. The CU index. This is an 'offset_type' value.
  39171. 5. The symbol table. This is an open-addressed hash table. The size
  39172. of the hash table is always a power of 2.
  39173. Each slot in the hash table consists of a pair of 'offset_type'
  39174. values. The first value is the offset of the symbol's name in the
  39175. constant pool. The second value is the offset of the CU vector in
  39176. the constant pool.
  39177. If both values are 0, then this slot in the hash table is empty.
  39178. This is ok because while 0 is a valid constant pool index, it
  39179. cannot be a valid index for both a string and a CU vector.
  39180. The hash value for a table entry is computed by applying an
  39181. iterative hash function to the symbol's name. Starting with an
  39182. initial value of 'r = 0', each (unsigned) character 'c' in the
  39183. string is incorporated into the hash using the formula depending on
  39184. the index version:
  39185. Version 4
  39186. The formula is 'r = r * 67 + c - 113'.
  39187. Versions 5 to 7
  39188. The formula is 'r = r * 67 + tolower (c) - 113'.
  39189. The terminating '\0' is not incorporated into the hash.
  39190. The step size used in the hash table is computed via '((hash * 17)
  39191. & (size - 1)) | 1', where 'hash' is the hash value, and 'size' is
  39192. the size of the hash table. The step size is used to find the next
  39193. candidate slot when handling a hash collision.
  39194. The names of C++ symbols in the hash table are canonicalized. We
  39195. don't currently have a simple description of the canonicalization
  39196. algorithm; if you intend to create new index sections, you must
  39197. read the code.
  39198. 6. The constant pool. This is simply a bunch of bytes. It is
  39199. organized so that alignment is correct: CU vectors are stored
  39200. first, followed by strings.
  39201. A CU vector in the constant pool is a sequence of 'offset_type'
  39202. values. The first value is the number of CU indices in the vector.
  39203. Each subsequent value is the index and symbol attributes of a CU in
  39204. the CU list. This element in the hash table is used to indicate
  39205. which CUs define the symbol and how the symbol is used. See below
  39206. for the format of each CU index+attributes entry.
  39207. A string in the constant pool is zero-terminated.
  39208. Attributes were added to CU index values in '.gdb_index' version 7.
  39209. If a symbol has multiple uses within a CU then there is one CU
  39210. index+attributes value for each use.
  39211. The format of each CU index+attributes entry is as follows (bit 0 =
  39212. LSB):
  39213. Bits 0-23
  39214. This is the index of the CU in the CU list.
  39215. Bits 24-27
  39216. These bits are reserved for future purposes and must be zero.
  39217. Bits 28-30
  39218. The kind of the symbol in the CU.
  39219. 0
  39220. This value is reserved and should not be used. By reserving
  39221. zero the full 'offset_type' value is backwards compatible with
  39222. previous versions of the index.
  39223. 1
  39224. The symbol is a type.
  39225. 2
  39226. The symbol is a variable or an enum value.
  39227. 3
  39228. The symbol is a function.
  39229. 4
  39230. Any other kind of symbol.
  39231. 5,6,7
  39232. These values are reserved.
  39233. Bit 31
  39234. This bit is zero if the value is global and one if it is static.
  39235. The determination of whether a symbol is global or static is
  39236. complicated. The authorative reference is the file 'dwarf2read.c'
  39237. in GDB sources.
  39238. This pseudo-code describes the computation of a symbol's kind and
  39239. global/static attributes in the index.
  39240. is_external = get_attribute (die, DW_AT_external);
  39241. language = get_attribute (cu_die, DW_AT_language);
  39242. switch (die->tag)
  39243. {
  39244. case DW_TAG_typedef:
  39245. case DW_TAG_base_type:
  39246. case DW_TAG_subrange_type:
  39247. kind = TYPE;
  39248. is_static = 1;
  39249. break;
  39250. case DW_TAG_enumerator:
  39251. kind = VARIABLE;
  39252. is_static = language != CPLUS;
  39253. break;
  39254. case DW_TAG_subprogram:
  39255. kind = FUNCTION;
  39256. is_static = ! (is_external || language == ADA);
  39257. break;
  39258. case DW_TAG_constant:
  39259. kind = VARIABLE;
  39260. is_static = ! is_external;
  39261. break;
  39262. case DW_TAG_variable:
  39263. kind = VARIABLE;
  39264. is_static = ! is_external;
  39265. break;
  39266. case DW_TAG_namespace:
  39267. kind = TYPE;
  39268. is_static = 0;
  39269. break;
  39270. case DW_TAG_class_type:
  39271. case DW_TAG_interface_type:
  39272. case DW_TAG_structure_type:
  39273. case DW_TAG_union_type:
  39274. case DW_TAG_enumeration_type:
  39275. kind = TYPE;
  39276. is_static = language != CPLUS;
  39277. break;
  39278. default:
  39279. assert (0);
  39280. }
  39281. 
  39282. File: gdb.info, Node: Man Pages, Next: Copying, Prev: Index Section Format, Up: Top
  39283. Appendix K Manual pages
  39284. ***********************
  39285. * Menu:
  39286. * gdb man:: The GNU Debugger man page
  39287. * gdbserver man:: Remote Server for the GNU Debugger man page
  39288. * gcore man:: Generate a core file of a running program
  39289. * gdbinit man:: gdbinit scripts
  39290. * gdb-add-index man:: Add index files to speed up GDB
  39291. 
  39292. File: gdb.info, Node: gdb man, Next: gdbserver man, Up: Man Pages
  39293. gdb man
  39294. =======
  39295. gdb ['-help'] ['-nh'] ['-nx'] ['-q'] ['-batch'] ['-cd='DIR] ['-f']
  39296. ['-b' BPS] ['-tty='DEV] ['-s' SYMFILE] ['-e' PROG] ['-se' PROG]
  39297. ['-c' CORE] ['-p' PROCID] ['-x' CMDS] ['-d' DIR] [PROG|PROG PROCID|PROG
  39298. CORE]
  39299. The purpose of a debugger such as GDB is to allow you to see what is
  39300. going on "inside" another program while it executes - or what another
  39301. program was doing at the moment it crashed.
  39302. GDB can do four main kinds of things (plus other things in support of
  39303. these) to help you catch bugs in the act:
  39304. * Start your program, specifying anything that might affect its
  39305. behavior.
  39306. * Make your program stop on specified conditions.
  39307. * Examine what has happened, when your program has stopped.
  39308. * Change things in your program, so you can experiment with
  39309. correcting the effects of one bug and go on to learn about another.
  39310. You can use GDB to debug programs written in C, C++, Fortran and
  39311. Modula-2.
  39312. GDB is invoked with the shell command 'gdb'. Once started, it reads
  39313. commands from the terminal until you tell it to exit with the GDB
  39314. command 'quit'. You can get online help from GDB itself by using the
  39315. command 'help'.
  39316. You can run 'gdb' with no arguments or options; but the most usual
  39317. way to start GDB is with one argument or two, specifying an executable
  39318. program as the argument:
  39319. gdb program
  39320. You can also start with both an executable program and a core file
  39321. specified:
  39322. gdb program core
  39323. You can, instead, specify a process ID as a second argument or use
  39324. option '-p', if you want to debug a running process:
  39325. gdb program 1234
  39326. gdb -p 1234
  39327. would attach GDB to process '1234'. With option '-p' you can omit the
  39328. PROGRAM filename.
  39329. Here are some of the most frequently needed GDB commands:
  39330. 'break [FILE:]FUNCTION'
  39331. Set a breakpoint at FUNCTION (in FILE).
  39332. 'run [ARGLIST]'
  39333. Start your program (with ARGLIST, if specified).
  39334. 'bt'
  39335. Backtrace: display the program stack.
  39336. 'print EXPR'
  39337. Display the value of an expression.
  39338. 'c'
  39339. Continue running your program (after stopping, e.g. at a
  39340. breakpoint).
  39341. 'next'
  39342. Execute next program line (after stopping); step _over_ any
  39343. function calls in the line.
  39344. 'edit [FILE:]FUNCTION'
  39345. look at the program line where it is presently stopped.
  39346. 'list [FILE:]FUNCTION'
  39347. type the text of the program in the vicinity of where it is
  39348. presently stopped.
  39349. 'step'
  39350. Execute next program line (after stopping); step _into_ any
  39351. function calls in the line.
  39352. 'help [NAME]'
  39353. Show information about GDB command NAME, or general information
  39354. about using GDB.
  39355. 'quit'
  39356. Exit from GDB.
  39357. Any arguments other than options specify an executable file and core
  39358. file (or process ID); that is, the first argument encountered with no
  39359. associated option flag is equivalent to a '-se' option, and the second,
  39360. if any, is equivalent to a '-c' option if it's the name of a file. Many
  39361. options have both long and short forms; both are shown here. The long
  39362. forms are also recognized if you truncate them, so long as enough of the
  39363. option is present to be unambiguous. (If you prefer, you can flag
  39364. option arguments with '+' rather than '-', though we illustrate the more
  39365. usual convention.)
  39366. All the options and command line arguments you give are processed in
  39367. sequential order. The order makes a difference when the '-x' option is
  39368. used.
  39369. '-help'
  39370. '-h'
  39371. List all options, with brief explanations.
  39372. '-symbols=FILE'
  39373. '-s FILE'
  39374. Read symbol table from file FILE.
  39375. '-write'
  39376. Enable writing into executable and core files.
  39377. '-exec=FILE'
  39378. '-e FILE'
  39379. Use file FILE as the executable file to execute when appropriate,
  39380. and for examining pure data in conjunction with a core dump.
  39381. '-se=FILE'
  39382. Read symbol table from file FILE and use it as the executable file.
  39383. '-core=FILE'
  39384. '-c FILE'
  39385. Use file FILE as a core dump to examine.
  39386. '-command=FILE'
  39387. '-x FILE'
  39388. Execute GDB commands from file FILE.
  39389. '-ex COMMAND'
  39390. Execute given GDB COMMAND.
  39391. '-directory=DIRECTORY'
  39392. '-d DIRECTORY'
  39393. Add DIRECTORY to the path to search for source files.
  39394. '-nh'
  39395. Do not execute commands from '~/.gdbinit'.
  39396. '-nx'
  39397. '-n'
  39398. Do not execute commands from any '.gdbinit' initialization files.
  39399. '-quiet'
  39400. '-q'
  39401. "Quiet". Do not print the introductory and copyright messages.
  39402. These messages are also suppressed in batch mode.
  39403. '-batch'
  39404. Run in batch mode. Exit with status '0' after processing all the
  39405. command files specified with '-x' (and '.gdbinit', if not
  39406. inhibited). Exit with nonzero status if an error occurs in
  39407. executing the GDB commands in the command files.
  39408. Batch mode may be useful for running GDB as a filter, for example
  39409. to download and run a program on another computer; in order to make
  39410. this more useful, the message
  39411. Program exited normally.
  39412. (which is ordinarily issued whenever a program running under GDB
  39413. control terminates) is not issued when running in batch mode.
  39414. '-cd=DIRECTORY'
  39415. Run GDB using DIRECTORY as its working directory, instead of the
  39416. current directory.
  39417. '-fullname'
  39418. '-f'
  39419. Emacs sets this option when it runs GDB as a subprocess. It tells
  39420. GDB to output the full file name and line number in a standard,
  39421. recognizable fashion each time a stack frame is displayed (which
  39422. includes each time the program stops). This recognizable format
  39423. looks like two '\032' characters, followed by the file name, line
  39424. number and character position separated by colons, and a newline.
  39425. The Emacs-to-GDB interface program uses the two '\032' characters
  39426. as a signal to display the source code for the frame.
  39427. '-b BPS'
  39428. Set the line speed (baud rate or bits per second) of any serial
  39429. interface used by GDB for remote debugging.
  39430. '-tty=DEVICE'
  39431. Run using DEVICE for your program's standard input and output.
  39432. 
  39433. File: gdb.info, Node: gdbserver man, Next: gcore man, Prev: gdb man, Up: Man Pages
  39434. gdbserver man
  39435. =============
  39436. gdbserver COMM PROG [ARGS...]
  39437. gdbserver -attach COMM PID
  39438. gdbserver -multi COMM
  39439. 'gdbserver' is a program that allows you to run GDB on a different
  39440. machine than the one which is running the program being debugged.
  39441. Usage (server (target) side)
  39442. ----------------------------
  39443. First, you need to have a copy of the program you want to debug put onto
  39444. the target system. The program can be stripped to save space if needed,
  39445. as 'gdbserver' doesn't care about symbols. All symbol handling is taken
  39446. care of by the GDB running on the host system.
  39447. To use the server, you log on to the target system, and run the
  39448. 'gdbserver' program. You must tell it (a) how to communicate with GDB,
  39449. (b) the name of your program, and (c) its arguments. The general syntax
  39450. is:
  39451. target> gdbserver COMM PROGRAM [ARGS ...]
  39452. For example, using a serial port, you might say:
  39453. target> gdbserver /dev/com1 emacs foo.txt
  39454. This tells 'gdbserver' to debug emacs with an argument of foo.txt,
  39455. and to communicate with GDB via '/dev/com1'. 'gdbserver' now waits
  39456. patiently for the host GDB to communicate with it.
  39457. To use a TCP connection, you could say:
  39458. target> gdbserver host:2345 emacs foo.txt
  39459. This says pretty much the same thing as the last example, except that
  39460. we are going to communicate with the 'host' GDB via TCP. The 'host:2345'
  39461. argument means that we are expecting to see a TCP connection from 'host'
  39462. to local TCP port 2345. (Currently, the 'host' part is ignored.) You
  39463. can choose any number you want for the port number as long as it does
  39464. not conflict with any existing TCP ports on the target system. This
  39465. same port number must be used in the host GDBs 'target remote' command,
  39466. which will be described shortly. Note that if you chose a port number
  39467. that conflicts with another service, 'gdbserver' will print an error
  39468. message and exit.
  39469. 'gdbserver' can also attach to running programs. This is
  39470. accomplished via the '--attach' argument. The syntax is:
  39471. target> gdbserver --attach COMM PID
  39472. PID is the process ID of a currently running process. It isn't
  39473. necessary to point 'gdbserver' at a binary for the running process.
  39474. To start 'gdbserver' without supplying an initial command to run or
  39475. process ID to attach, use the '--multi' command line option. In such
  39476. case you should connect using 'target extended-remote' to start the
  39477. program you want to debug.
  39478. target> gdbserver --multi COMM
  39479. Usage (host side)
  39480. -----------------
  39481. You need an unstripped copy of the target program on your host system,
  39482. since GDB needs to examine its symbol tables and such. Start up GDB as
  39483. you normally would, with the target program as the first argument. (You
  39484. may need to use the '--baud' option if the serial line is running at
  39485. anything except 9600 baud.) That is 'gdb TARGET-PROG', or 'gdb --baud
  39486. BAUD TARGET-PROG'. After that, the only new command you need to know
  39487. about is 'target remote' (or 'target extended-remote'). Its argument is
  39488. either a device name (usually a serial device, like '/dev/ttyb'), or a
  39489. 'HOST:PORT' descriptor. For example:
  39490. (gdb) target remote /dev/ttyb
  39491. communicates with the server via serial line '/dev/ttyb', and:
  39492. (gdb) target remote the-target:2345
  39493. communicates via a TCP connection to port 2345 on host 'the-target',
  39494. where you previously started up 'gdbserver' with the same port number.
  39495. Note that for TCP connections, you must start up 'gdbserver' prior to
  39496. using the 'target remote' command, otherwise you may get an error that
  39497. looks something like 'Connection refused'.
  39498. 'gdbserver' can also debug multiple inferiors at once, described in
  39499. *note Inferiors and Programs::. In such case use the 'extended-remote'
  39500. GDB command variant:
  39501. (gdb) target extended-remote the-target:2345
  39502. The 'gdbserver' option '--multi' may or may not be used in such case.
  39503. There are three different modes for invoking 'gdbserver':
  39504. * Debug a specific program specified by its program name:
  39505. gdbserver COMM PROG [ARGS...]
  39506. The COMM parameter specifies how should the server communicate with
  39507. GDB; it is either a device name (to use a serial line), a TCP port
  39508. number (':1234'), or '-' or 'stdio' to use stdin/stdout of
  39509. 'gdbserver'. Specify the name of the program to debug in PROG.
  39510. Any remaining arguments will be passed to the program verbatim.
  39511. When the program exits, GDB will close the connection, and
  39512. 'gdbserver' will exit.
  39513. * Debug a specific program by specifying the process ID of a running
  39514. program:
  39515. gdbserver --attach COMM PID
  39516. The COMM parameter is as described above. Supply the process ID of
  39517. a running program in PID; GDB will do everything else. Like with
  39518. the previous mode, when the process PID exits, GDB will close the
  39519. connection, and 'gdbserver' will exit.
  39520. * Multi-process mode - debug more than one program/process:
  39521. gdbserver --multi COMM
  39522. In this mode, GDB can instruct 'gdbserver' which command(s) to run.
  39523. Unlike the other 2 modes, GDB will not close the connection when a
  39524. process being debugged exits, so you can debug several processes in
  39525. the same session.
  39526. In each of the modes you may specify these options:
  39527. '--help'
  39528. List all options, with brief explanations.
  39529. '--version'
  39530. This option causes 'gdbserver' to print its version number and
  39531. exit.
  39532. '--attach'
  39533. 'gdbserver' will attach to a running program. The syntax is:
  39534. target> gdbserver --attach COMM PID
  39535. PID is the process ID of a currently running process. It isn't
  39536. necessary to point 'gdbserver' at a binary for the running process.
  39537. '--multi'
  39538. To start 'gdbserver' without supplying an initial command to run or
  39539. process ID to attach, use this command line option. Then you can
  39540. connect using 'target extended-remote' and start the program you
  39541. want to debug. The syntax is:
  39542. target> gdbserver --multi COMM
  39543. '--debug'
  39544. Instruct 'gdbserver' to display extra status information about the
  39545. debugging process. This option is intended for 'gdbserver'
  39546. development and for bug reports to the developers.
  39547. '--remote-debug'
  39548. Instruct 'gdbserver' to display remote protocol debug output. This
  39549. option is intended for 'gdbserver' development and for bug reports
  39550. to the developers.
  39551. '--debug-file=FILENAME'
  39552. Instruct 'gdbserver' to send any debug output to the given
  39553. FILENAME. This option is intended for 'gdbserver' development and
  39554. for bug reports to the developers.
  39555. '--debug-format=option1[,option2,...]'
  39556. Instruct 'gdbserver' to include extra information in each line of
  39557. debugging output. *Note Other Command-Line Arguments for
  39558. gdbserver::.
  39559. '--wrapper'
  39560. Specify a wrapper to launch programs for debugging. The option
  39561. should be followed by the name of the wrapper, then any
  39562. command-line arguments to pass to the wrapper, then '--' indicating
  39563. the end of the wrapper arguments.
  39564. '--once'
  39565. By default, 'gdbserver' keeps the listening TCP port open, so that
  39566. additional connections are possible. However, if you start
  39567. 'gdbserver' with the '--once' option, it will stop listening for
  39568. any further connection attempts after connecting to the first GDB
  39569. session.
  39570. 
  39571. File: gdb.info, Node: gcore man, Next: gdbinit man, Prev: gdbserver man, Up: Man Pages
  39572. gcore
  39573. =====
  39574. gcore [-a] [-o PREFIX] PID1 [PID2...PIDN]
  39575. Generate core dumps of one or more running programs with process IDs
  39576. PID1, PID2, etc. A core file produced by 'gcore' is equivalent to one
  39577. produced by the kernel when the process crashes (and when 'ulimit -c'
  39578. was used to set up an appropriate core dump limit). However, unlike
  39579. after a crash, after 'gcore' finishes its job the program remains
  39580. running without any change.
  39581. '-a'
  39582. Dump all memory mappings. The actual effect of this option depends
  39583. on the Operating System. On GNU/Linux, it will disable
  39584. 'use-coredump-filter' (*note set use-coredump-filter::) and enable
  39585. 'dump-excluded-mappings' (*note set dump-excluded-mappings::).
  39586. '-o PREFIX'
  39587. The optional argument PREFIX specifies the prefix to be used when
  39588. composing the file names of the core dumps. The file name is
  39589. composed as 'PREFIX.PID', where PID is the process ID of the
  39590. running program being analyzed by 'gcore'. If not specified,
  39591. PREFIX defaults to GCORE.
  39592. 
  39593. File: gdb.info, Node: gdbinit man, Next: gdb-add-index man, Prev: gcore man, Up: Man Pages
  39594. gdbinit
  39595. =======
  39596. ~/.gdbinit
  39597. ./.gdbinit
  39598. These files contain GDB commands to automatically execute during GDB
  39599. startup. The lines of contents are canned sequences of commands,
  39600. described in *note Sequences::.
  39601. Please read more in *note Startup::.
  39602. '(not enabled with --with-system-gdbinit during compilation)'
  39603. System-wide initialization file. It is executed unless user
  39604. specified GDB option '-nx' or '-n'. See more in
  39605. '(not enabled with --with-system-gdbinit-dir during compilation)'
  39606. System-wide initialization directory. All files in this directory
  39607. are executed on startup unless user specified GDB option '-nx' or
  39608. '-n', as long as they have a recognized file extension. See more
  39609. in *note System-wide configuration::.
  39610. '~/.gdbinit'
  39611. User initialization file. It is executed unless user specified GDB
  39612. options '-nx', '-n' or '-nh'.
  39613. './.gdbinit'
  39614. Initialization file for current directory. It may need to be
  39615. enabled with GDB security command 'set auto-load local-gdbinit'.
  39616. See more in *note Init File in the Current Directory::.
  39617. 
  39618. File: gdb.info, Node: gdb-add-index man, Prev: gdbinit man, Up: Man Pages
  39619. gdb-add-index
  39620. =============
  39621. gdb-add-index FILENAME
  39622. When GDB finds a symbol file, it scans the symbols in the file in
  39623. order to construct an internal symbol table. This lets most GDB
  39624. operations work quickly-at the cost of a delay early on. For large
  39625. programs, this delay can be quite lengthy, so GDB provides a way to
  39626. build an index, which speeds up startup.
  39627. To determine whether a file contains such an index, use the command
  39628. 'readelf -S filename': the index is stored in a section named
  39629. '.gdb_index'. The index file can only be produced on systems which use
  39630. ELF binaries and DWARF debug information (i.e., sections named
  39631. '.debug_*').
  39632. 'gdb-add-index' uses GDB and 'objdump' found in the 'PATH'
  39633. environment variable. If you want to use different versions of these
  39634. programs, you can specify them through the 'GDB' and 'OBJDUMP'
  39635. environment variables.
  39636. See more in *note Index Files::.
  39637. 
  39638. File: gdb.info, Node: Copying, Next: GNU Free Documentation License, Prev: Man Pages, Up: Top
  39639. Appendix L GNU GENERAL PUBLIC LICENSE
  39640. *************************************
  39641. Version 3, 29 June 2007
  39642. Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
  39643. Everyone is permitted to copy and distribute verbatim copies of this
  39644. license document, but changing it is not allowed.
  39645. Preamble
  39646. ========
  39647. The GNU General Public License is a free, copyleft license for software
  39648. and other kinds of works.
  39649. The licenses for most software and other practical works are designed
  39650. to take away your freedom to share and change the works. By contrast,
  39651. the GNU General Public License is intended to guarantee your freedom to
  39652. share and change all versions of a program--to make sure it remains free
  39653. software for all its users. We, the Free Software Foundation, use the
  39654. GNU General Public License for most of our software; it applies also to
  39655. any other work released this way by its authors. You can apply it to
  39656. your programs, too.
  39657. When we speak of free software, we are referring to freedom, not
  39658. price. Our General Public Licenses are designed to make sure that you
  39659. have the freedom to distribute copies of free software (and charge for
  39660. them if you wish), that you receive source code or can get it if you
  39661. want it, that you can change the software or use pieces of it in new
  39662. free programs, and that you know you can do these things.
  39663. To protect your rights, we need to prevent others from denying you
  39664. these rights or asking you to surrender the rights. Therefore, you have
  39665. certain responsibilities if you distribute copies of the software, or if
  39666. you modify it: responsibilities to respect the freedom of others.
  39667. For example, if you distribute copies of such a program, whether
  39668. gratis or for a fee, you must pass on to the recipients the same
  39669. freedoms that you received. You must make sure that they, too, receive
  39670. or can get the source code. And you must show them these terms so they
  39671. know their rights.
  39672. Developers that use the GNU GPL protect your rights with two steps:
  39673. (1) assert copyright on the software, and (2) offer you this License
  39674. giving you legal permission to copy, distribute and/or modify it.
  39675. For the developers' and authors' protection, the GPL clearly explains
  39676. that there is no warranty for this free software. For both users' and
  39677. authors' sake, the GPL requires that modified versions be marked as
  39678. changed, so that their problems will not be attributed erroneously to
  39679. authors of previous versions.
  39680. Some devices are designed to deny users access to install or run
  39681. modified versions of the software inside them, although the manufacturer
  39682. can do so. This is fundamentally incompatible with the aim of
  39683. protecting users' freedom to change the software. The systematic
  39684. pattern of such abuse occurs in the area of products for individuals to
  39685. use, which is precisely where it is most unacceptable. Therefore, we
  39686. have designed this version of the GPL to prohibit the practice for those
  39687. products. If such problems arise substantially in other domains, we
  39688. stand ready to extend this provision to those domains in future versions
  39689. of the GPL, as needed to protect the freedom of users.
  39690. Finally, every program is threatened constantly by software patents.
  39691. States should not allow patents to restrict development and use of
  39692. software on general-purpose computers, but in those that do, we wish to
  39693. avoid the special danger that patents applied to a free program could
  39694. make it effectively proprietary. To prevent this, the GPL assures that
  39695. patents cannot be used to render the program non-free.
  39696. The precise terms and conditions for copying, distribution and
  39697. modification follow.
  39698. TERMS AND CONDITIONS
  39699. ====================
  39700. 0. Definitions.
  39701. "This License" refers to version 3 of the GNU General Public
  39702. License.
  39703. "Copyright" also means copyright-like laws that apply to other
  39704. kinds of works, such as semiconductor masks.
  39705. "The Program" refers to any copyrightable work licensed under this
  39706. License. Each licensee is addressed as "you". "Licensees" and
  39707. "recipients" may be individuals or organizations.
  39708. To "modify" a work means to copy from or adapt all or part of the
  39709. work in a fashion requiring copyright permission, other than the
  39710. making of an exact copy. The resulting work is called a "modified
  39711. version" of the earlier work or a work "based on" the earlier work.
  39712. A "covered work" means either the unmodified Program or a work
  39713. based on the Program.
  39714. To "propagate" a work means to do anything with it that, without
  39715. permission, would make you directly or secondarily liable for
  39716. infringement under applicable copyright law, except executing it on
  39717. a computer or modifying a private copy. Propagation includes
  39718. copying, distribution (with or without modification), making
  39719. available to the public, and in some countries other activities as
  39720. well.
  39721. To "convey" a work means any kind of propagation that enables other
  39722. parties to make or receive copies. Mere interaction with a user
  39723. through a computer network, with no transfer of a copy, is not
  39724. conveying.
  39725. An interactive user interface displays "Appropriate Legal Notices"
  39726. to the extent that it includes a convenient and prominently visible
  39727. feature that (1) displays an appropriate copyright notice, and (2)
  39728. tells the user that there is no warranty for the work (except to
  39729. the extent that warranties are provided), that licensees may convey
  39730. the work under this License, and how to view a copy of this
  39731. License. If the interface presents a list of user commands or
  39732. options, such as a menu, a prominent item in the list meets this
  39733. criterion.
  39734. 1. Source Code.
  39735. The "source code" for a work means the preferred form of the work
  39736. for making modifications to it. "Object code" means any non-source
  39737. form of a work.
  39738. A "Standard Interface" means an interface that either is an
  39739. official standard defined by a recognized standards body, or, in
  39740. the case of interfaces specified for a particular programming
  39741. language, one that is widely used among developers working in that
  39742. language.
  39743. The "System Libraries" of an executable work include anything,
  39744. other than the work as a whole, that (a) is included in the normal
  39745. form of packaging a Major Component, but which is not part of that
  39746. Major Component, and (b) serves only to enable use of the work with
  39747. that Major Component, or to implement a Standard Interface for
  39748. which an implementation is available to the public in source code
  39749. form. A "Major Component", in this context, means a major
  39750. essential component (kernel, window system, and so on) of the
  39751. specific operating system (if any) on which the executable work
  39752. runs, or a compiler used to produce the work, or an object code
  39753. interpreter used to run it.
  39754. The "Corresponding Source" for a work in object code form means all
  39755. the source code needed to generate, install, and (for an executable
  39756. work) run the object code and to modify the work, including scripts
  39757. to control those activities. However, it does not include the
  39758. work's System Libraries, or general-purpose tools or generally
  39759. available free programs which are used unmodified in performing
  39760. those activities but which are not part of the work. For example,
  39761. Corresponding Source includes interface definition files associated
  39762. with source files for the work, and the source code for shared
  39763. libraries and dynamically linked subprograms that the work is
  39764. specifically designed to require, such as by intimate data
  39765. communication or control flow between those subprograms and other
  39766. parts of the work.
  39767. The Corresponding Source need not include anything that users can
  39768. regenerate automatically from other parts of the Corresponding
  39769. Source.
  39770. The Corresponding Source for a work in source code form is that
  39771. same work.
  39772. 2. Basic Permissions.
  39773. All rights granted under this License are granted for the term of
  39774. copyright on the Program, and are irrevocable provided the stated
  39775. conditions are met. This License explicitly affirms your unlimited
  39776. permission to run the unmodified Program. The output from running
  39777. a covered work is covered by this License only if the output, given
  39778. its content, constitutes a covered work. This License acknowledges
  39779. your rights of fair use or other equivalent, as provided by
  39780. copyright law.
  39781. You may make, run and propagate covered works that you do not
  39782. convey, without conditions so long as your license otherwise
  39783. remains in force. You may convey covered works to others for the
  39784. sole purpose of having them make modifications exclusively for you,
  39785. or provide you with facilities for running those works, provided
  39786. that you comply with the terms of this License in conveying all
  39787. material for which you do not control copyright. Those thus making
  39788. or running the covered works for you must do so exclusively on your
  39789. behalf, under your direction and control, on terms that prohibit
  39790. them from making any copies of your copyrighted material outside
  39791. their relationship with you.
  39792. Conveying under any other circumstances is permitted solely under
  39793. the conditions stated below. Sublicensing is not allowed; section
  39794. 10 makes it unnecessary.
  39795. 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
  39796. No covered work shall be deemed part of an effective technological
  39797. measure under any applicable law fulfilling obligations under
  39798. article 11 of the WIPO copyright treaty adopted on 20 December
  39799. 1996, or similar laws prohibiting or restricting circumvention of
  39800. such measures.
  39801. When you convey a covered work, you waive any legal power to forbid
  39802. circumvention of technological measures to the extent such
  39803. circumvention is effected by exercising rights under this License
  39804. with respect to the covered work, and you disclaim any intention to
  39805. limit operation or modification of the work as a means of
  39806. enforcing, against the work's users, your or third parties' legal
  39807. rights to forbid circumvention of technological measures.
  39808. 4. Conveying Verbatim Copies.
  39809. You may convey verbatim copies of the Program's source code as you
  39810. receive it, in any medium, provided that you conspicuously and
  39811. appropriately publish on each copy an appropriate copyright notice;
  39812. keep intact all notices stating that this License and any
  39813. non-permissive terms added in accord with section 7 apply to the
  39814. code; keep intact all notices of the absence of any warranty; and
  39815. give all recipients a copy of this License along with the Program.
  39816. You may charge any price or no price for each copy that you convey,
  39817. and you may offer support or warranty protection for a fee.
  39818. 5. Conveying Modified Source Versions.
  39819. You may convey a work based on the Program, or the modifications to
  39820. produce it from the Program, in the form of source code under the
  39821. terms of section 4, provided that you also meet all of these
  39822. conditions:
  39823. a. The work must carry prominent notices stating that you
  39824. modified it, and giving a relevant date.
  39825. b. The work must carry prominent notices stating that it is
  39826. released under this License and any conditions added under
  39827. section 7. This requirement modifies the requirement in
  39828. section 4 to "keep intact all notices".
  39829. c. You must license the entire work, as a whole, under this
  39830. License to anyone who comes into possession of a copy. This
  39831. License will therefore apply, along with any applicable
  39832. section 7 additional terms, to the whole of the work, and all
  39833. its parts, regardless of how they are packaged. This License
  39834. gives no permission to license the work in any other way, but
  39835. it does not invalidate such permission if you have separately
  39836. received it.
  39837. d. If the work has interactive user interfaces, each must display
  39838. Appropriate Legal Notices; however, if the Program has
  39839. interactive interfaces that do not display Appropriate Legal
  39840. Notices, your work need not make them do so.
  39841. A compilation of a covered work with other separate and independent
  39842. works, which are not by their nature extensions of the covered
  39843. work, and which are not combined with it such as to form a larger
  39844. program, in or on a volume of a storage or distribution medium, is
  39845. called an "aggregate" if the compilation and its resulting
  39846. copyright are not used to limit the access or legal rights of the
  39847. compilation's users beyond what the individual works permit.
  39848. Inclusion of a covered work in an aggregate does not cause this
  39849. License to apply to the other parts of the aggregate.
  39850. 6. Conveying Non-Source Forms.
  39851. You may convey a covered work in object code form under the terms
  39852. of sections 4 and 5, provided that you also convey the
  39853. machine-readable Corresponding Source under the terms of this
  39854. License, in one of these ways:
  39855. a. Convey the object code in, or embodied in, a physical product
  39856. (including a physical distribution medium), accompanied by the
  39857. Corresponding Source fixed on a durable physical medium
  39858. customarily used for software interchange.
  39859. b. Convey the object code in, or embodied in, a physical product
  39860. (including a physical distribution medium), accompanied by a
  39861. written offer, valid for at least three years and valid for as
  39862. long as you offer spare parts or customer support for that
  39863. product model, to give anyone who possesses the object code
  39864. either (1) a copy of the Corresponding Source for all the
  39865. software in the product that is covered by this License, on a
  39866. durable physical medium customarily used for software
  39867. interchange, for a price no more than your reasonable cost of
  39868. physically performing this conveying of source, or (2) access
  39869. to copy the Corresponding Source from a network server at no
  39870. charge.
  39871. c. Convey individual copies of the object code with a copy of the
  39872. written offer to provide the Corresponding Source. This
  39873. alternative is allowed only occasionally and noncommercially,
  39874. and only if you received the object code with such an offer,
  39875. in accord with subsection 6b.
  39876. d. Convey the object code by offering access from a designated
  39877. place (gratis or for a charge), and offer equivalent access to
  39878. the Corresponding Source in the same way through the same
  39879. place at no further charge. You need not require recipients
  39880. to copy the Corresponding Source along with the object code.
  39881. If the place to copy the object code is a network server, the
  39882. Corresponding Source may be on a different server (operated by
  39883. you or a third party) that supports equivalent copying
  39884. facilities, provided you maintain clear directions next to the
  39885. object code saying where to find the Corresponding Source.
  39886. Regardless of what server hosts the Corresponding Source, you
  39887. remain obligated to ensure that it is available for as long as
  39888. needed to satisfy these requirements.
  39889. e. Convey the object code using peer-to-peer transmission,
  39890. provided you inform other peers where the object code and
  39891. Corresponding Source of the work are being offered to the
  39892. general public at no charge under subsection 6d.
  39893. A separable portion of the object code, whose source code is
  39894. excluded from the Corresponding Source as a System Library, need
  39895. not be included in conveying the object code work.
  39896. A "User Product" is either (1) a "consumer product", which means
  39897. any tangible personal property which is normally used for personal,
  39898. family, or household purposes, or (2) anything designed or sold for
  39899. incorporation into a dwelling. In determining whether a product is
  39900. a consumer product, doubtful cases shall be resolved in favor of
  39901. coverage. For a particular product received by a particular user,
  39902. "normally used" refers to a typical or common use of that class of
  39903. product, regardless of the status of the particular user or of the
  39904. way in which the particular user actually uses, or expects or is
  39905. expected to use, the product. A product is a consumer product
  39906. regardless of whether the product has substantial commercial,
  39907. industrial or non-consumer uses, unless such uses represent the
  39908. only significant mode of use of the product.
  39909. "Installation Information" for a User Product means any methods,
  39910. procedures, authorization keys, or other information required to
  39911. install and execute modified versions of a covered work in that
  39912. User Product from a modified version of its Corresponding Source.
  39913. The information must suffice to ensure that the continued
  39914. functioning of the modified object code is in no case prevented or
  39915. interfered with solely because modification has been made.
  39916. If you convey an object code work under this section in, or with,
  39917. or specifically for use in, a User Product, and the conveying
  39918. occurs as part of a transaction in which the right of possession
  39919. and use of the User Product is transferred to the recipient in
  39920. perpetuity or for a fixed term (regardless of how the transaction
  39921. is characterized), the Corresponding Source conveyed under this
  39922. section must be accompanied by the Installation Information. But
  39923. this requirement does not apply if neither you nor any third party
  39924. retains the ability to install modified object code on the User
  39925. Product (for example, the work has been installed in ROM).
  39926. The requirement to provide Installation Information does not
  39927. include a requirement to continue to provide support service,
  39928. warranty, or updates for a work that has been modified or installed
  39929. by the recipient, or for the User Product in which it has been
  39930. modified or installed. Access to a network may be denied when the
  39931. modification itself materially and adversely affects the operation
  39932. of the network or violates the rules and protocols for
  39933. communication across the network.
  39934. Corresponding Source conveyed, and Installation Information
  39935. provided, in accord with this section must be in a format that is
  39936. publicly documented (and with an implementation available to the
  39937. public in source code form), and must require no special password
  39938. or key for unpacking, reading or copying.
  39939. 7. Additional Terms.
  39940. "Additional permissions" are terms that supplement the terms of
  39941. this License by making exceptions from one or more of its
  39942. conditions. Additional permissions that are applicable to the
  39943. entire Program shall be treated as though they were included in
  39944. this License, to the extent that they are valid under applicable
  39945. law. If additional permissions apply only to part of the Program,
  39946. that part may be used separately under those permissions, but the
  39947. entire Program remains governed by this License without regard to
  39948. the additional permissions.
  39949. When you convey a copy of a covered work, you may at your option
  39950. remove any additional permissions from that copy, or from any part
  39951. of it. (Additional permissions may be written to require their own
  39952. removal in certain cases when you modify the work.) You may place
  39953. additional permissions on material, added by you to a covered work,
  39954. for which you have or can give appropriate copyright permission.
  39955. Notwithstanding any other provision of this License, for material
  39956. you add to a covered work, you may (if authorized by the copyright
  39957. holders of that material) supplement the terms of this License with
  39958. terms:
  39959. a. Disclaiming warranty or limiting liability differently from
  39960. the terms of sections 15 and 16 of this License; or
  39961. b. Requiring preservation of specified reasonable legal notices
  39962. or author attributions in that material or in the Appropriate
  39963. Legal Notices displayed by works containing it; or
  39964. c. Prohibiting misrepresentation of the origin of that material,
  39965. or requiring that modified versions of such material be marked
  39966. in reasonable ways as different from the original version; or
  39967. d. Limiting the use for publicity purposes of names of licensors
  39968. or authors of the material; or
  39969. e. Declining to grant rights under trademark law for use of some
  39970. trade names, trademarks, or service marks; or
  39971. f. Requiring indemnification of licensors and authors of that
  39972. material by anyone who conveys the material (or modified
  39973. versions of it) with contractual assumptions of liability to
  39974. the recipient, for any liability that these contractual
  39975. assumptions directly impose on those licensors and authors.
  39976. All other non-permissive additional terms are considered "further
  39977. restrictions" within the meaning of section 10. If the Program as
  39978. you received it, or any part of it, contains a notice stating that
  39979. it is governed by this License along with a term that is a further
  39980. restriction, you may remove that term. If a license document
  39981. contains a further restriction but permits relicensing or conveying
  39982. under this License, you may add to a covered work material governed
  39983. by the terms of that license document, provided that the further
  39984. restriction does not survive such relicensing or conveying.
  39985. If you add terms to a covered work in accord with this section, you
  39986. must place, in the relevant source files, a statement of the
  39987. additional terms that apply to those files, or a notice indicating
  39988. where to find the applicable terms.
  39989. Additional terms, permissive or non-permissive, may be stated in
  39990. the form of a separately written license, or stated as exceptions;
  39991. the above requirements apply either way.
  39992. 8. Termination.
  39993. You may not propagate or modify a covered work except as expressly
  39994. provided under this License. Any attempt otherwise to propagate or
  39995. modify it is void, and will automatically terminate your rights
  39996. under this License (including any patent licenses granted under the
  39997. third paragraph of section 11).
  39998. However, if you cease all violation of this License, then your
  39999. license from a particular copyright holder is reinstated (a)
  40000. provisionally, unless and until the copyright holder explicitly and
  40001. finally terminates your license, and (b) permanently, if the
  40002. copyright holder fails to notify you of the violation by some
  40003. reasonable means prior to 60 days after the cessation.
  40004. Moreover, your license from a particular copyright holder is
  40005. reinstated permanently if the copyright holder notifies you of the
  40006. violation by some reasonable means, this is the first time you have
  40007. received notice of violation of this License (for any work) from
  40008. that copyright holder, and you cure the violation prior to 30 days
  40009. after your receipt of the notice.
  40010. Termination of your rights under this section does not terminate
  40011. the licenses of parties who have received copies or rights from you
  40012. under this License. If your rights have been terminated and not
  40013. permanently reinstated, you do not qualify to receive new licenses
  40014. for the same material under section 10.
  40015. 9. Acceptance Not Required for Having Copies.
  40016. You are not required to accept this License in order to receive or
  40017. run a copy of the Program. Ancillary propagation of a covered work
  40018. occurring solely as a consequence of using peer-to-peer
  40019. transmission to receive a copy likewise does not require
  40020. acceptance. However, nothing other than this License grants you
  40021. permission to propagate or modify any covered work. These actions
  40022. infringe copyright if you do not accept this License. Therefore,
  40023. by modifying or propagating a covered work, you indicate your
  40024. acceptance of this License to do so.
  40025. 10. Automatic Licensing of Downstream Recipients.
  40026. Each time you convey a covered work, the recipient automatically
  40027. receives a license from the original licensors, to run, modify and
  40028. propagate that work, subject to this License. You are not
  40029. responsible for enforcing compliance by third parties with this
  40030. License.
  40031. An "entity transaction" is a transaction transferring control of an
  40032. organization, or substantially all assets of one, or subdividing an
  40033. organization, or merging organizations. If propagation of a
  40034. covered work results from an entity transaction, each party to that
  40035. transaction who receives a copy of the work also receives whatever
  40036. licenses to the work the party's predecessor in interest had or
  40037. could give under the previous paragraph, plus a right to possession
  40038. of the Corresponding Source of the work from the predecessor in
  40039. interest, if the predecessor has it or can get it with reasonable
  40040. efforts.
  40041. You may not impose any further restrictions on the exercise of the
  40042. rights granted or affirmed under this License. For example, you
  40043. may not impose a license fee, royalty, or other charge for exercise
  40044. of rights granted under this License, and you may not initiate
  40045. litigation (including a cross-claim or counterclaim in a lawsuit)
  40046. alleging that any patent claim is infringed by making, using,
  40047. selling, offering for sale, or importing the Program or any portion
  40048. of it.
  40049. 11. Patents.
  40050. A "contributor" is a copyright holder who authorizes use under this
  40051. License of the Program or a work on which the Program is based.
  40052. The work thus licensed is called the contributor's "contributor
  40053. version".
  40054. A contributor's "essential patent claims" are all patent claims
  40055. owned or controlled by the contributor, whether already acquired or
  40056. hereafter acquired, that would be infringed by some manner,
  40057. permitted by this License, of making, using, or selling its
  40058. contributor version, but do not include claims that would be
  40059. infringed only as a consequence of further modification of the
  40060. contributor version. For purposes of this definition, "control"
  40061. includes the right to grant patent sublicenses in a manner
  40062. consistent with the requirements of this License.
  40063. Each contributor grants you a non-exclusive, worldwide,
  40064. royalty-free patent license under the contributor's essential
  40065. patent claims, to make, use, sell, offer for sale, import and
  40066. otherwise run, modify and propagate the contents of its contributor
  40067. version.
  40068. In the following three paragraphs, a "patent license" is any
  40069. express agreement or commitment, however denominated, not to
  40070. enforce a patent (such as an express permission to practice a
  40071. patent or covenant not to sue for patent infringement). To "grant"
  40072. such a patent license to a party means to make such an agreement or
  40073. commitment not to enforce a patent against the party.
  40074. If you convey a covered work, knowingly relying on a patent
  40075. license, and the Corresponding Source of the work is not available
  40076. for anyone to copy, free of charge and under the terms of this
  40077. License, through a publicly available network server or other
  40078. readily accessible means, then you must either (1) cause the
  40079. Corresponding Source to be so available, or (2) arrange to deprive
  40080. yourself of the benefit of the patent license for this particular
  40081. work, or (3) arrange, in a manner consistent with the requirements
  40082. of this License, to extend the patent license to downstream
  40083. recipients. "Knowingly relying" means you have actual knowledge
  40084. that, but for the patent license, your conveying the covered work
  40085. in a country, or your recipient's use of the covered work in a
  40086. country, would infringe one or more identifiable patents in that
  40087. country that you have reason to believe are valid.
  40088. If, pursuant to or in connection with a single transaction or
  40089. arrangement, you convey, or propagate by procuring conveyance of, a
  40090. covered work, and grant a patent license to some of the parties
  40091. receiving the covered work authorizing them to use, propagate,
  40092. modify or convey a specific copy of the covered work, then the
  40093. patent license you grant is automatically extended to all
  40094. recipients of the covered work and works based on it.
  40095. A patent license is "discriminatory" if it does not include within
  40096. the scope of its coverage, prohibits the exercise of, or is
  40097. conditioned on the non-exercise of one or more of the rights that
  40098. are specifically granted under this License. You may not convey a
  40099. covered work if you are a party to an arrangement with a third
  40100. party that is in the business of distributing software, under which
  40101. you make payment to the third party based on the extent of your
  40102. activity of conveying the work, and under which the third party
  40103. grants, to any of the parties who would receive the covered work
  40104. from you, a discriminatory patent license (a) in connection with
  40105. copies of the covered work conveyed by you (or copies made from
  40106. those copies), or (b) primarily for and in connection with specific
  40107. products or compilations that contain the covered work, unless you
  40108. entered into that arrangement, or that patent license was granted,
  40109. prior to 28 March 2007.
  40110. Nothing in this License shall be construed as excluding or limiting
  40111. any implied license or other defenses to infringement that may
  40112. otherwise be available to you under applicable patent law.
  40113. 12. No Surrender of Others' Freedom.
  40114. If conditions are imposed on you (whether by court order, agreement
  40115. or otherwise) that contradict the conditions of this License, they
  40116. do not excuse you from the conditions of this License. If you
  40117. cannot convey a covered work so as to satisfy simultaneously your
  40118. obligations under this License and any other pertinent obligations,
  40119. then as a consequence you may not convey it at all. For example,
  40120. if you agree to terms that obligate you to collect a royalty for
  40121. further conveying from those to whom you convey the Program, the
  40122. only way you could satisfy both those terms and this License would
  40123. be to refrain entirely from conveying the Program.
  40124. 13. Use with the GNU Affero General Public License.
  40125. Notwithstanding any other provision of this License, you have
  40126. permission to link or combine any covered work with a work licensed
  40127. under version 3 of the GNU Affero General Public License into a
  40128. single combined work, and to convey the resulting work. The terms
  40129. of this License will continue to apply to the part which is the
  40130. covered work, but the special requirements of the GNU Affero
  40131. General Public License, section 13, concerning interaction through
  40132. a network will apply to the combination as such.
  40133. 14. Revised Versions of this License.
  40134. The Free Software Foundation may publish revised and/or new
  40135. versions of the GNU General Public License from time to time. Such
  40136. new versions will be similar in spirit to the present version, but
  40137. may differ in detail to address new problems or concerns.
  40138. Each version is given a distinguishing version number. If the
  40139. Program specifies that a certain numbered version of the GNU
  40140. General Public License "or any later version" applies to it, you
  40141. have the option of following the terms and conditions either of
  40142. that numbered version or of any later version published by the Free
  40143. Software Foundation. If the Program does not specify a version
  40144. number of the GNU General Public License, you may choose any
  40145. version ever published by the Free Software Foundation.
  40146. If the Program specifies that a proxy can decide which future
  40147. versions of the GNU General Public License can be used, that
  40148. proxy's public statement of acceptance of a version permanently
  40149. authorizes you to choose that version for the Program.
  40150. Later license versions may give you additional or different
  40151. permissions. However, no additional obligations are imposed on any
  40152. author or copyright holder as a result of your choosing to follow a
  40153. later version.
  40154. 15. Disclaimer of Warranty.
  40155. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
  40156. APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
  40157. COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
  40158. WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
  40159. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  40160. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
  40161. RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
  40162. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
  40163. NECESSARY SERVICING, REPAIR OR CORRECTION.
  40164. 16. Limitation of Liability.
  40165. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  40166. WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
  40167. AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
  40168. DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
  40169. CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
  40170. THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
  40171. BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
  40172. PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  40173. PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
  40174. THE POSSIBILITY OF SUCH DAMAGES.
  40175. 17. Interpretation of Sections 15 and 16.
  40176. If the disclaimer of warranty and limitation of liability provided
  40177. above cannot be given local legal effect according to their terms,
  40178. reviewing courts shall apply local law that most closely
  40179. approximates an absolute waiver of all civil liability in
  40180. connection with the Program, unless a warranty or assumption of
  40181. liability accompanies a copy of the Program in return for a fee.
  40182. END OF TERMS AND CONDITIONS
  40183. ===========================
  40184. How to Apply These Terms to Your New Programs
  40185. =============================================
  40186. If you develop a new program, and you want it to be of the greatest
  40187. possible use to the public, the best way to achieve this is to make it
  40188. free software which everyone can redistribute and change under these
  40189. terms.
  40190. To do so, attach the following notices to the program. It is safest
  40191. to attach them to the start of each source file to most effectively
  40192. state the exclusion of warranty; and each file should have at least the
  40193. "copyright" line and a pointer to where the full notice is found.
  40194. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
  40195. Copyright (C) YEAR NAME OF AUTHOR
  40196. This program is free software: you can redistribute it and/or modify
  40197. it under the terms of the GNU General Public License as published by
  40198. the Free Software Foundation, either version 3 of the License, or (at
  40199. your option) any later version.
  40200. This program is distributed in the hope that it will be useful, but
  40201. WITHOUT ANY WARRANTY; without even the implied warranty of
  40202. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  40203. General Public License for more details.
  40204. You should have received a copy of the GNU General Public License
  40205. along with this program. If not, see <http://www.gnu.org/licenses/>.
  40206. Also add information on how to contact you by electronic and paper
  40207. mail.
  40208. If the program does terminal interaction, make it output a short
  40209. notice like this when it starts in an interactive mode:
  40210. PROGRAM Copyright (C) YEAR NAME OF AUTHOR
  40211. This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
  40212. This is free software, and you are welcome to redistribute it
  40213. under certain conditions; type 'show c' for details.
  40214. The hypothetical commands 'show w' and 'show c' should show the
  40215. appropriate parts of the General Public License. Of course, your
  40216. program's commands might be different; for a GUI interface, you would
  40217. use an "about box".
  40218. You should also get your employer (if you work as a programmer) or
  40219. school, if any, to sign a "copyright disclaimer" for the program, if
  40220. necessary. For more information on this, and how to apply and follow
  40221. the GNU GPL, see <http://www.gnu.org/licenses/>.
  40222. The GNU General Public License does not permit incorporating your
  40223. program into proprietary programs. If your program is a subroutine
  40224. library, you may consider it more useful to permit linking proprietary
  40225. applications with the library. If this is what you want to do, use the
  40226. GNU Lesser General Public License instead of this License. But first,
  40227. please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
  40228. 
  40229. File: gdb.info, Node: GNU Free Documentation License, Next: Concept Index, Prev: Copying, Up: Top
  40230. Appendix M GNU Free Documentation License
  40231. *****************************************
  40232. Version 1.3, 3 November 2008
  40233. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  40234. <http://fsf.org/>
  40235. Everyone is permitted to copy and distribute verbatim copies
  40236. of this license document, but changing it is not allowed.
  40237. 0. PREAMBLE
  40238. The purpose of this License is to make a manual, textbook, or other
  40239. functional and useful document "free" in the sense of freedom: to
  40240. assure everyone the effective freedom to copy and redistribute it,
  40241. with or without modifying it, either commercially or
  40242. noncommercially. Secondarily, this License preserves for the
  40243. author and publisher a way to get credit for their work, while not
  40244. being considered responsible for modifications made by others.
  40245. This License is a kind of "copyleft", which means that derivative
  40246. works of the document must themselves be free in the same sense.
  40247. It complements the GNU General Public License, which is a copyleft
  40248. license designed for free software.
  40249. We have designed this License in order to use it for manuals for
  40250. free software, because free software needs free documentation: a
  40251. free program should come with manuals providing the same freedoms
  40252. that the software does. But this License is not limited to
  40253. software manuals; it can be used for any textual work, regardless
  40254. of subject matter or whether it is published as a printed book. We
  40255. recommend this License principally for works whose purpose is
  40256. instruction or reference.
  40257. 1. APPLICABILITY AND DEFINITIONS
  40258. This License applies to any manual or other work, in any medium,
  40259. that contains a notice placed by the copyright holder saying it can
  40260. be distributed under the terms of this License. Such a notice
  40261. grants a world-wide, royalty-free license, unlimited in duration,
  40262. to use that work under the conditions stated herein. The
  40263. "Document", below, refers to any such manual or work. Any member
  40264. of the public is a licensee, and is addressed as "you". You accept
  40265. the license if you copy, modify or distribute the work in a way
  40266. requiring permission under copyright law.
  40267. A "Modified Version" of the Document means any work containing the
  40268. Document or a portion of it, either copied verbatim, or with
  40269. modifications and/or translated into another language.
  40270. A "Secondary Section" is a named appendix or a front-matter section
  40271. of the Document that deals exclusively with the relationship of the
  40272. publishers or authors of the Document to the Document's overall
  40273. subject (or to related matters) and contains nothing that could
  40274. fall directly within that overall subject. (Thus, if the Document
  40275. is in part a textbook of mathematics, a Secondary Section may not
  40276. explain any mathematics.) The relationship could be a matter of
  40277. historical connection with the subject or with related matters, or
  40278. of legal, commercial, philosophical, ethical or political position
  40279. regarding them.
  40280. The "Invariant Sections" are certain Secondary Sections whose
  40281. titles are designated, as being those of Invariant Sections, in the
  40282. notice that says that the Document is released under this License.
  40283. If a section does not fit the above definition of Secondary then it
  40284. is not allowed to be designated as Invariant. The Document may
  40285. contain zero Invariant Sections. If the Document does not identify
  40286. any Invariant Sections then there are none.
  40287. The "Cover Texts" are certain short passages of text that are
  40288. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  40289. that says that the Document is released under this License. A
  40290. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  40291. be at most 25 words.
  40292. A "Transparent" copy of the Document means a machine-readable copy,
  40293. represented in a format whose specification is available to the
  40294. general public, that is suitable for revising the document
  40295. straightforwardly with generic text editors or (for images composed
  40296. of pixels) generic paint programs or (for drawings) some widely
  40297. available drawing editor, and that is suitable for input to text
  40298. formatters or for automatic translation to a variety of formats
  40299. suitable for input to text formatters. A copy made in an otherwise
  40300. Transparent file format whose markup, or absence of markup, has
  40301. been arranged to thwart or discourage subsequent modification by
  40302. readers is not Transparent. An image format is not Transparent if
  40303. used for any substantial amount of text. A copy that is not
  40304. "Transparent" is called "Opaque".
  40305. Examples of suitable formats for Transparent copies include plain
  40306. ASCII without markup, Texinfo input format, LaTeX input format,
  40307. SGML or XML using a publicly available DTD, and standard-conforming
  40308. simple HTML, PostScript or PDF designed for human modification.
  40309. Examples of transparent image formats include PNG, XCF and JPG.
  40310. Opaque formats include proprietary formats that can be read and
  40311. edited only by proprietary word processors, SGML or XML for which
  40312. the DTD and/or processing tools are not generally available, and
  40313. the machine-generated HTML, PostScript or PDF produced by some word
  40314. processors for output purposes only.
  40315. The "Title Page" means, for a printed book, the title page itself,
  40316. plus such following pages as are needed to hold, legibly, the
  40317. material this License requires to appear in the title page. For
  40318. works in formats which do not have any title page as such, "Title
  40319. Page" means the text near the most prominent appearance of the
  40320. work's title, preceding the beginning of the body of the text.
  40321. The "publisher" means any person or entity that distributes copies
  40322. of the Document to the public.
  40323. A section "Entitled XYZ" means a named subunit of the Document
  40324. whose title either is precisely XYZ or contains XYZ in parentheses
  40325. following text that translates XYZ in another language. (Here XYZ
  40326. stands for a specific section name mentioned below, such as
  40327. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  40328. To "Preserve the Title" of such a section when you modify the
  40329. Document means that it remains a section "Entitled XYZ" according
  40330. to this definition.
  40331. The Document may include Warranty Disclaimers next to the notice
  40332. which states that this License applies to the Document. These
  40333. Warranty Disclaimers are considered to be included by reference in
  40334. this License, but only as regards disclaiming warranties: any other
  40335. implication that these Warranty Disclaimers may have is void and
  40336. has no effect on the meaning of this License.
  40337. 2. VERBATIM COPYING
  40338. You may copy and distribute the Document in any medium, either
  40339. commercially or noncommercially, provided that this License, the
  40340. copyright notices, and the license notice saying this License
  40341. applies to the Document are reproduced in all copies, and that you
  40342. add no other conditions whatsoever to those of this License. You
  40343. may not use technical measures to obstruct or control the reading
  40344. or further copying of the copies you make or distribute. However,
  40345. you may accept compensation in exchange for copies. If you
  40346. distribute a large enough number of copies you must also follow the
  40347. conditions in section 3.
  40348. You may also lend copies, under the same conditions stated above,
  40349. and you may publicly display copies.
  40350. 3. COPYING IN QUANTITY
  40351. If you publish printed copies (or copies in media that commonly
  40352. have printed covers) of the Document, numbering more than 100, and
  40353. the Document's license notice requires Cover Texts, you must
  40354. enclose the copies in covers that carry, clearly and legibly, all
  40355. these Cover Texts: Front-Cover Texts on the front cover, and
  40356. Back-Cover Texts on the back cover. Both covers must also clearly
  40357. and legibly identify you as the publisher of these copies. The
  40358. front cover must present the full title with all words of the title
  40359. equally prominent and visible. You may add other material on the
  40360. covers in addition. Copying with changes limited to the covers, as
  40361. long as they preserve the title of the Document and satisfy these
  40362. conditions, can be treated as verbatim copying in other respects.
  40363. If the required texts for either cover are too voluminous to fit
  40364. legibly, you should put the first ones listed (as many as fit
  40365. reasonably) on the actual cover, and continue the rest onto
  40366. adjacent pages.
  40367. If you publish or distribute Opaque copies of the Document
  40368. numbering more than 100, you must either include a machine-readable
  40369. Transparent copy along with each Opaque copy, or state in or with
  40370. each Opaque copy a computer-network location from which the general
  40371. network-using public has access to download using public-standard
  40372. network protocols a complete Transparent copy of the Document, free
  40373. of added material. If you use the latter option, you must take
  40374. reasonably prudent steps, when you begin distribution of Opaque
  40375. copies in quantity, to ensure that this Transparent copy will
  40376. remain thus accessible at the stated location until at least one
  40377. year after the last time you distribute an Opaque copy (directly or
  40378. through your agents or retailers) of that edition to the public.
  40379. It is requested, but not required, that you contact the authors of
  40380. the Document well before redistributing any large number of copies,
  40381. to give them a chance to provide you with an updated version of the
  40382. Document.
  40383. 4. MODIFICATIONS
  40384. You may copy and distribute a Modified Version of the Document
  40385. under the conditions of sections 2 and 3 above, provided that you
  40386. release the Modified Version under precisely this License, with the
  40387. Modified Version filling the role of the Document, thus licensing
  40388. distribution and modification of the Modified Version to whoever
  40389. possesses a copy of it. In addition, you must do these things in
  40390. the Modified Version:
  40391. A. Use in the Title Page (and on the covers, if any) a title
  40392. distinct from that of the Document, and from those of previous
  40393. versions (which should, if there were any, be listed in the
  40394. History section of the Document). You may use the same title
  40395. as a previous version if the original publisher of that
  40396. version gives permission.
  40397. B. List on the Title Page, as authors, one or more persons or
  40398. entities responsible for authorship of the modifications in
  40399. the Modified Version, together with at least five of the
  40400. principal authors of the Document (all of its principal
  40401. authors, if it has fewer than five), unless they release you
  40402. from this requirement.
  40403. C. State on the Title page the name of the publisher of the
  40404. Modified Version, as the publisher.
  40405. D. Preserve all the copyright notices of the Document.
  40406. E. Add an appropriate copyright notice for your modifications
  40407. adjacent to the other copyright notices.
  40408. F. Include, immediately after the copyright notices, a license
  40409. notice giving the public permission to use the Modified
  40410. Version under the terms of this License, in the form shown in
  40411. the Addendum below.
  40412. G. Preserve in that license notice the full lists of Invariant
  40413. Sections and required Cover Texts given in the Document's
  40414. license notice.
  40415. H. Include an unaltered copy of this License.
  40416. I. Preserve the section Entitled "History", Preserve its Title,
  40417. and add to it an item stating at least the title, year, new
  40418. authors, and publisher of the Modified Version as given on the
  40419. Title Page. If there is no section Entitled "History" in the
  40420. Document, create one stating the title, year, authors, and
  40421. publisher of the Document as given on its Title Page, then add
  40422. an item describing the Modified Version as stated in the
  40423. previous sentence.
  40424. J. Preserve the network location, if any, given in the Document
  40425. for public access to a Transparent copy of the Document, and
  40426. likewise the network locations given in the Document for
  40427. previous versions it was based on. These may be placed in the
  40428. "History" section. You may omit a network location for a work
  40429. that was published at least four years before the Document
  40430. itself, or if the original publisher of the version it refers
  40431. to gives permission.
  40432. K. For any section Entitled "Acknowledgements" or "Dedications",
  40433. Preserve the Title of the section, and preserve in the section
  40434. all the substance and tone of each of the contributor
  40435. acknowledgements and/or dedications given therein.
  40436. L. Preserve all the Invariant Sections of the Document, unaltered
  40437. in their text and in their titles. Section numbers or the
  40438. equivalent are not considered part of the section titles.
  40439. M. Delete any section Entitled "Endorsements". Such a section
  40440. may not be included in the Modified Version.
  40441. N. Do not retitle any existing section to be Entitled
  40442. "Endorsements" or to conflict in title with any Invariant
  40443. Section.
  40444. O. Preserve any Warranty Disclaimers.
  40445. If the Modified Version includes new front-matter sections or
  40446. appendices that qualify as Secondary Sections and contain no
  40447. material copied from the Document, you may at your option designate
  40448. some or all of these sections as invariant. To do this, add their
  40449. titles to the list of Invariant Sections in the Modified Version's
  40450. license notice. These titles must be distinct from any other
  40451. section titles.
  40452. You may add a section Entitled "Endorsements", provided it contains
  40453. nothing but endorsements of your Modified Version by various
  40454. parties--for example, statements of peer review or that the text
  40455. has been approved by an organization as the authoritative
  40456. definition of a standard.
  40457. You may add a passage of up to five words as a Front-Cover Text,
  40458. and a passage of up to 25 words as a Back-Cover Text, to the end of
  40459. the list of Cover Texts in the Modified Version. Only one passage
  40460. of Front-Cover Text and one of Back-Cover Text may be added by (or
  40461. through arrangements made by) any one entity. If the Document
  40462. already includes a cover text for the same cover, previously added
  40463. by you or by arrangement made by the same entity you are acting on
  40464. behalf of, you may not add another; but you may replace the old
  40465. one, on explicit permission from the previous publisher that added
  40466. the old one.
  40467. The author(s) and publisher(s) of the Document do not by this
  40468. License give permission to use their names for publicity for or to
  40469. assert or imply endorsement of any Modified Version.
  40470. 5. COMBINING DOCUMENTS
  40471. You may combine the Document with other documents released under
  40472. this License, under the terms defined in section 4 above for
  40473. modified versions, provided that you include in the combination all
  40474. of the Invariant Sections of all of the original documents,
  40475. unmodified, and list them all as Invariant Sections of your
  40476. combined work in its license notice, and that you preserve all
  40477. their Warranty Disclaimers.
  40478. The combined work need only contain one copy of this License, and
  40479. multiple identical Invariant Sections may be replaced with a single
  40480. copy. If there are multiple Invariant Sections with the same name
  40481. but different contents, make the title of each such section unique
  40482. by adding at the end of it, in parentheses, the name of the
  40483. original author or publisher of that section if known, or else a
  40484. unique number. Make the same adjustment to the section titles in
  40485. the list of Invariant Sections in the license notice of the
  40486. combined work.
  40487. In the combination, you must combine any sections Entitled
  40488. "History" in the various original documents, forming one section
  40489. Entitled "History"; likewise combine any sections Entitled
  40490. "Acknowledgements", and any sections Entitled "Dedications". You
  40491. must delete all sections Entitled "Endorsements."
  40492. 6. COLLECTIONS OF DOCUMENTS
  40493. You may make a collection consisting of the Document and other
  40494. documents released under this License, and replace the individual
  40495. copies of this License in the various documents with a single copy
  40496. that is included in the collection, provided that you follow the
  40497. rules of this License for verbatim copying of each of the documents
  40498. in all other respects.
  40499. You may extract a single document from such a collection, and
  40500. distribute it individually under this License, provided you insert
  40501. a copy of this License into the extracted document, and follow this
  40502. License in all other respects regarding verbatim copying of that
  40503. document.
  40504. 7. AGGREGATION WITH INDEPENDENT WORKS
  40505. A compilation of the Document or its derivatives with other
  40506. separate and independent documents or works, in or on a volume of a
  40507. storage or distribution medium, is called an "aggregate" if the
  40508. copyright resulting from the compilation is not used to limit the
  40509. legal rights of the compilation's users beyond what the individual
  40510. works permit. When the Document is included in an aggregate, this
  40511. License does not apply to the other works in the aggregate which
  40512. are not themselves derivative works of the Document.
  40513. If the Cover Text requirement of section 3 is applicable to these
  40514. copies of the Document, then if the Document is less than one half
  40515. of the entire aggregate, the Document's Cover Texts may be placed
  40516. on covers that bracket the Document within the aggregate, or the
  40517. electronic equivalent of covers if the Document is in electronic
  40518. form. Otherwise they must appear on printed covers that bracket
  40519. the whole aggregate.
  40520. 8. TRANSLATION
  40521. Translation is considered a kind of modification, so you may
  40522. distribute translations of the Document under the terms of section
  40523. 4. Replacing Invariant Sections with translations requires special
  40524. permission from their copyright holders, but you may include
  40525. translations of some or all Invariant Sections in addition to the
  40526. original versions of these Invariant Sections. You may include a
  40527. translation of this License, and all the license notices in the
  40528. Document, and any Warranty Disclaimers, provided that you also
  40529. include the original English version of this License and the
  40530. original versions of those notices and disclaimers. In case of a
  40531. disagreement between the translation and the original version of
  40532. this License or a notice or disclaimer, the original version will
  40533. prevail.
  40534. If a section in the Document is Entitled "Acknowledgements",
  40535. "Dedications", or "History", the requirement (section 4) to
  40536. Preserve its Title (section 1) will typically require changing the
  40537. actual title.
  40538. 9. TERMINATION
  40539. You may not copy, modify, sublicense, or distribute the Document
  40540. except as expressly provided under this License. Any attempt
  40541. otherwise to copy, modify, sublicense, or distribute it is void,
  40542. and will automatically terminate your rights under this License.
  40543. However, if you cease all violation of this License, then your
  40544. license from a particular copyright holder is reinstated (a)
  40545. provisionally, unless and until the copyright holder explicitly and
  40546. finally terminates your license, and (b) permanently, if the
  40547. copyright holder fails to notify you of the violation by some
  40548. reasonable means prior to 60 days after the cessation.
  40549. Moreover, your license from a particular copyright holder is
  40550. reinstated permanently if the copyright holder notifies you of the
  40551. violation by some reasonable means, this is the first time you have
  40552. received notice of violation of this License (for any work) from
  40553. that copyright holder, and you cure the violation prior to 30 days
  40554. after your receipt of the notice.
  40555. Termination of your rights under this section does not terminate
  40556. the licenses of parties who have received copies or rights from you
  40557. under this License. If your rights have been terminated and not
  40558. permanently reinstated, receipt of a copy of some or all of the
  40559. same material does not give you any rights to use it.
  40560. 10. FUTURE REVISIONS OF THIS LICENSE
  40561. The Free Software Foundation may publish new, revised versions of
  40562. the GNU Free Documentation License from time to time. Such new
  40563. versions will be similar in spirit to the present version, but may
  40564. differ in detail to address new problems or concerns. See
  40565. <http://www.gnu.org/copyleft/>.
  40566. Each version of the License is given a distinguishing version
  40567. number. If the Document specifies that a particular numbered
  40568. version of this License "or any later version" applies to it, you
  40569. have the option of following the terms and conditions either of
  40570. that specified version or of any later version that has been
  40571. published (not as a draft) by the Free Software Foundation. If the
  40572. Document does not specify a version number of this License, you may
  40573. choose any version ever published (not as a draft) by the Free
  40574. Software Foundation. If the Document specifies that a proxy can
  40575. decide which future versions of this License can be used, that
  40576. proxy's public statement of acceptance of a version permanently
  40577. authorizes you to choose that version for the Document.
  40578. 11. RELICENSING
  40579. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  40580. World Wide Web server that publishes copyrightable works and also
  40581. provides prominent facilities for anybody to edit those works. A
  40582. public wiki that anybody can edit is an example of such a server.
  40583. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  40584. site means any set of copyrightable works thus published on the MMC
  40585. site.
  40586. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  40587. license published by Creative Commons Corporation, a not-for-profit
  40588. corporation with a principal place of business in San Francisco,
  40589. California, as well as future copyleft versions of that license
  40590. published by that same organization.
  40591. "Incorporate" means to publish or republish a Document, in whole or
  40592. in part, as part of another Document.
  40593. An MMC is "eligible for relicensing" if it is licensed under this
  40594. License, and if all works that were first published under this
  40595. License somewhere other than this MMC, and subsequently
  40596. incorporated in whole or in part into the MMC, (1) had no cover
  40597. texts or invariant sections, and (2) were thus incorporated prior
  40598. to November 1, 2008.
  40599. The operator of an MMC Site may republish an MMC contained in the
  40600. site under CC-BY-SA on the same site at any time before August 1,
  40601. 2009, provided the MMC is eligible for relicensing.
  40602. ADDENDUM: How to use this License for your documents
  40603. ====================================================
  40604. To use this License in a document you have written, include a copy of
  40605. the License in the document and put the following copyright and license
  40606. notices just after the title page:
  40607. Copyright (C) YEAR YOUR NAME.
  40608. Permission is granted to copy, distribute and/or modify this document
  40609. under the terms of the GNU Free Documentation License, Version 1.3
  40610. or any later version published by the Free Software Foundation;
  40611. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  40612. Texts. A copy of the license is included in the section entitled ``GNU
  40613. Free Documentation License''.
  40614. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  40615. Texts, replace the "with...Texts." line with this:
  40616. with the Invariant Sections being LIST THEIR TITLES, with
  40617. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  40618. being LIST.
  40619. If you have Invariant Sections without Cover Texts, or some other
  40620. combination of the three, merge those two alternatives to suit the
  40621. situation.
  40622. If your document contains nontrivial examples of program code, we
  40623. recommend releasing these examples in parallel under your choice of free
  40624. software license, such as the GNU General Public License, to permit
  40625. their use in free software.
  40626. 
  40627. File: gdb.info, Node: Concept Index, Next: Command and Variable Index, Prev: GNU Free Documentation License, Up: Top
  40628. Concept Index
  40629. *************
  40630. �[index�]
  40631. * Menu:
  40632. * ! packet: Packets. (line 49)
  40633. * "No symbol "foo" in current context": Variables. (line 122)
  40634. * # in Modula-2: GDB/M2. (line 18)
  40635. * $: Value History. (line 13)
  40636. * $$: Value History. (line 13)
  40637. * $_ and info breakpoints: Set Breaks. (line 133)
  40638. * $_ and info line: Machine Code. (line 34)
  40639. * $_, $__, and value history: Memory. (line 119)
  40640. * &, background execution of commands: Background Execution.
  40641. (line 16)
  40642. * --annotate: Mode Options. (line 132)
  40643. * --args: Mode Options. (line 145)
  40644. * --attach, gdbserver option: Server. (line 86)
  40645. * --batch: Mode Options. (line 55)
  40646. * --batch-silent: Mode Options. (line 73)
  40647. * --baud: Mode Options. (line 151)
  40648. * --cd: Mode Options. (line 112)
  40649. * --command: File Options. (line 51)
  40650. * --configuration: Mode Options. (line 195)
  40651. * --core: File Options. (line 43)
  40652. * --data-directory: Mode Options. (line 117)
  40653. * --debug, gdbserver option: Server. (line 146)
  40654. * --debug-file, gdbserver option: Server. (line 148)
  40655. * --debug-format, gdbserver option: Server. (line 153)
  40656. * --directory: File Options. (line 77)
  40657. * --eval-command: File Options. (line 57)
  40658. * --exec: File Options. (line 35)
  40659. * --fullname: Mode Options. (line 122)
  40660. * --init-command: File Options. (line 67)
  40661. * --init-eval-command: File Options. (line 72)
  40662. * --interpreter: Mode Options. (line 170)
  40663. * --multi, gdbserver option: Connecting. (line 45)
  40664. * --nh: Mode Options. (line 45)
  40665. * --nowindows: Mode Options. (line 102)
  40666. * --nx: Mode Options. (line 11)
  40667. * --once, gdbserver option: Server. (line 126)
  40668. * --pid: File Options. (line 47)
  40669. * --quiet: Mode Options. (line 51)
  40670. * --readnever, command-line option: File Options. (line 87)
  40671. * --readnow: File Options. (line 81)
  40672. * --remote-debug, gdbserver option: Server. (line 147)
  40673. * --return-child-result: Mode Options. (line 85)
  40674. * --se: File Options. (line 39)
  40675. * --selftest: Server. (line 187)
  40676. * --silent: Mode Options. (line 51)
  40677. * --statistics: Mode Options. (line 187)
  40678. * --symbols: File Options. (line 31)
  40679. * --tty: Mode Options. (line 160)
  40680. * --tui: Mode Options. (line 163)
  40681. * --version: Mode Options. (line 191)
  40682. * --windows: Mode Options. (line 108)
  40683. * --with-gdb-datadir: Data Files. (line 19)
  40684. * --with-relocated-sources: Source Path. (line 149)
  40685. * --with-sysroot: Files. (line 453)
  40686. * --wrapper, gdbserver option: Server. (line 166)
  40687. * --write: Mode Options. (line 182)
  40688. * -b: Mode Options. (line 151)
  40689. * -c: File Options. (line 43)
  40690. * -d: File Options. (line 77)
  40691. * -D: Mode Options. (line 117)
  40692. * -e: File Options. (line 35)
  40693. * -ex: File Options. (line 57)
  40694. * -f: Mode Options. (line 122)
  40695. * -iex: File Options. (line 72)
  40696. * -info-gdb-mi-command: GDB/MI Support Commands.
  40697. (line 14)
  40698. * -ix: File Options. (line 67)
  40699. * -l: Mode Options. (line 155)
  40700. * -n: Mode Options. (line 11)
  40701. * -nw: Mode Options. (line 102)
  40702. * -p: File Options. (line 47)
  40703. * -q: Mode Options. (line 51)
  40704. * -r: File Options. (line 81)
  40705. * -readnever, option for symbol-file command: Files. (line 101)
  40706. * -s: File Options. (line 31)
  40707. * -t: Mode Options. (line 160)
  40708. * -w: Mode Options. (line 108)
  40709. * -x: File Options. (line 51)
  40710. * ., Modula-2 scope operator: M2 Scope. (line 6)
  40711. * .build-id directory: Separate Debug Files.
  40712. (line 6)
  40713. * .debug subdirectories: Separate Debug Files.
  40714. (line 6)
  40715. * .debug_gdb_scripts section: dotdebug_gdb_scripts section.
  40716. (line 6)
  40717. * .gdbinit: Startup. (line 69)
  40718. * .gdb_index section: Index Files. (line 6)
  40719. * .gdb_index section format: Index Section Format.
  40720. (line 6)
  40721. * .gnu_debugdata section: MiniDebugInfo. (line 6)
  40722. * .gnu_debuglink sections: Separate Debug Files.
  40723. (line 79)
  40724. * .note.gnu.build-id sections: Separate Debug Files.
  40725. (line 95)
  40726. * .o files, reading symbols from: Files. (line 146)
  40727. * /proc: Process Information.
  40728. (line 6)
  40729. * <architecture>: Target Description Format.
  40730. (line 72)
  40731. * <compatible>: Target Description Format.
  40732. (line 95)
  40733. * <feature>: Target Description Format.
  40734. (line 119)
  40735. * <flags>: Target Description Format.
  40736. (line 163)
  40737. * <not saved> values: Registers. (line 106)
  40738. * <osabi>: Target Description Format.
  40739. (line 82)
  40740. * <reg>: Target Description Format.
  40741. (line 222)
  40742. * <struct>: Target Description Format.
  40743. (line 163)
  40744. * <union>: Target Description Format.
  40745. (line 153)
  40746. * <vector>: Target Description Format.
  40747. (line 146)
  40748. * ? packet: Packets. (line 58)
  40749. * _NSPrintForDebugger, and printing Objective-C objects: The Print Command with Objective-C.
  40750. (line 11)
  40751. * {TYPE}: Expressions. (line 41)
  40752. * A packet: Packets. (line 65)
  40753. * AArch64 Pointer Authentication.: AArch64. (line 34)
  40754. * AArch64 support: AArch64. (line 6)
  40755. * AArch64 SVE.: AArch64. (line 19)
  40756. * abbreviation: Command Syntax. (line 13)
  40757. * acknowledgment, for GDB remote: Packet Acknowledgment.
  40758. (line 6)
  40759. * active targets: Active Targets. (line 6)
  40760. * Ada: Ada. (line 6)
  40761. * Ada exception catching: Set Catchpoints. (line 66)
  40762. * Ada exception handlers catching: Set Catchpoints. (line 92)
  40763. * Ada mode, general: Ada Mode Intro. (line 6)
  40764. * Ada settings: Ada Settings. (line 6)
  40765. * Ada task switching: Ada Tasks. (line 115)
  40766. * Ada tasking and core file debugging: Ada Tasks and Core Files.
  40767. (line 6)
  40768. * Ada, deviations from: Additions to Ada. (line 6)
  40769. * Ada, omissions from: Omissions from Ada. (line 6)
  40770. * Ada, problems: Ada Glitches. (line 6)
  40771. * Ada, tasking: Ada Tasks. (line 6)
  40772. * add new commands for external monitor: Connecting. (line 272)
  40773. * address locations: Address Locations. (line 6)
  40774. * address of a symbol: Symbols. (line 85)
  40775. * address size for remote targets: Remote Configuration.
  40776. (line 12)
  40777. * addressable memory unit: Memory. (line 133)
  40778. * aggregates (Ada): Omissions from Ada. (line 44)
  40779. * AIX shared library debugging: Debugging Output. (line 30)
  40780. * AIX threads: Debugging Output. (line 36)
  40781. * aliases for commands: Aliases. (line 6)
  40782. * alignment of remote memory accesses: Packets. (line 247)
  40783. * all-stop mode: All-Stop Mode. (line 6)
  40784. * Alpha stack: MIPS. (line 6)
  40785. * ambiguous expressions: Ambiguous Expressions.
  40786. (line 6)
  40787. * annotations: Annotations Overview.
  40788. (line 6)
  40789. * annotations for errors, warnings and interrupts: Errors. (line 6)
  40790. * annotations for invalidation messages: Invalidation. (line 6)
  40791. * annotations for prompts: Prompting. (line 6)
  40792. * annotations for running programs: Annotations for Running.
  40793. (line 6)
  40794. * annotations for source display: Source Annotations. (line 6)
  40795. * append data to a file: Dump/Restore Files. (line 6)
  40796. * Application Data Integrity: Sparc64. (line 5)
  40797. * apply a command to all frames (ignoring errors and empty output): Frame Apply.
  40798. (line 96)
  40799. * apply a command to all frames of all threads (ignoring errors and empty output): Threads.
  40800. (line 229)
  40801. * apply command to all threads (ignoring errors and empty output): Threads.
  40802. (line 222)
  40803. * apply command to several frames: Frame Apply. (line 6)
  40804. * apply command to several threads: Threads. (line 187)
  40805. * ARC EM: ARC. (line 6)
  40806. * ARC HS: ARC. (line 6)
  40807. * ARC specific commands: ARC. (line 6)
  40808. * ARC600: ARC. (line 6)
  40809. * ARC700: ARC. (line 6)
  40810. * architecture debugging info: Debugging Output. (line 23)
  40811. * argument count in user-defined commands: Define. (line 25)
  40812. * arguments (to your program): Arguments. (line 6)
  40813. * arguments, to gdbserver: Server. (line 34)
  40814. * arguments, to user-defined commands: Define. (line 6)
  40815. * ARM 32-bit mode: ARM. (line 16)
  40816. * ARM AArch64: Debugging Output. (line 17)
  40817. * array aggregates (Ada): Omissions from Ada. (line 44)
  40818. * arrays: Arrays. (line 6)
  40819. * arrays in expressions: Expressions. (line 13)
  40820. * artificial array: Arrays. (line 6)
  40821. * assembly instructions: Machine Code. (line 43)
  40822. * assignment: Assignment. (line 6)
  40823. * async output in GDB/MI: GDB/MI Output Syntax.
  40824. (line 98)
  40825. * async records in GDB/MI: GDB/MI Async Records.
  40826. (line 6)
  40827. * asynchronous execution: Background Execution.
  40828. (line 6)
  40829. * asynchronous execution, and process record and replay: Process Record and Replay.
  40830. (line 101)
  40831. * AT&T disassembly flavor: Machine Code. (line 237)
  40832. * attach: Attach. (line 6)
  40833. * attach to a program, gdbserver: Server. (line 86)
  40834. * auto-loading: Auto-loading. (line 6)
  40835. * auto-loading extensions: Auto-loading extensions.
  40836. (line 6)
  40837. * auto-loading init file in the current directory: Init File in the Current Directory.
  40838. (line 6)
  40839. * auto-loading libthread_db.so.1: libthread_db.so.1 file.
  40840. (line 6)
  40841. * auto-loading safe-path: Auto-loading safe path.
  40842. (line 6)
  40843. * auto-loading verbose mode: Auto-loading verbose mode.
  40844. (line 6)
  40845. * auto-retry, for remote TCP target: Remote Configuration.
  40846. (line 131)
  40847. * automatic display: Auto Display. (line 6)
  40848. * automatic hardware breakpoints: Set Breaks. (line 296)
  40849. * automatic overlay debugging: Automatic Overlay Debugging.
  40850. (line 6)
  40851. * automatic symbol index cache: Index Files. (line 75)
  40852. * automatic thread selection: All-Stop Mode. (line 28)
  40853. * auxiliary vector: OS Information. (line 9)
  40854. * AVR: AVR. (line 6)
  40855. * b packet: Packets. (line 76)
  40856. * B packet: Packets. (line 91)
  40857. * background execution: Background Execution.
  40858. (line 6)
  40859. * backtrace beyond main function: Backtrace. (line 155)
  40860. * backtrace limit: Backtrace. (line 192)
  40861. * base name differences: Files. (line 520)
  40862. * baud rate for remote targets: Remote Configuration.
  40863. (line 21)
  40864. * bc packet: Packets. (line 96)
  40865. * bcache statistics: Maintenance Commands.
  40866. (line 328)
  40867. * bits in remote address: Remote Configuration.
  40868. (line 12)
  40869. * blocks in guile: Blocks In Guile. (line 6)
  40870. * blocks in python: Blocks In Python. (line 6)
  40871. * bookmark: Checkpoint/Restart. (line 6)
  40872. * boundary violations, Intel MPX: Signals. (line 197)
  40873. * branch trace configuration format: Branch Trace Configuration Format.
  40874. (line 6)
  40875. * branch trace format: Branch Trace Format.
  40876. (line 6)
  40877. * branch trace store: Process Record and Replay.
  40878. (line 70)
  40879. * break in overloaded functions: Debugging C Plus Plus.
  40880. (line 9)
  40881. * break on a system call.: Set Catchpoints. (line 120)
  40882. * break on fork/exec: Set Catchpoints. (line 116)
  40883. * BREAK signal instead of Ctrl-C: Remote Configuration.
  40884. (line 36)
  40885. * breakpoint address adjusted: Breakpoint-related Warnings.
  40886. (line 6)
  40887. * breakpoint at static probe point: Linespec Locations. (line 65)
  40888. * breakpoint commands: Break Commands. (line 6)
  40889. * breakpoint commands for GDB/MI: GDB/MI Breakpoint Commands.
  40890. (line 6)
  40891. * breakpoint commands, in remote protocol: General Query Packets.
  40892. (line 983)
  40893. * breakpoint conditions: Conditions. (line 6)
  40894. * breakpoint kinds, ARM: ARM Breakpoint Kinds.
  40895. (line 6)
  40896. * breakpoint kinds, MIPS: MIPS Breakpoint Kinds.
  40897. (line 6)
  40898. * breakpoint lists: Breakpoints. (line 45)
  40899. * breakpoint numbers: Breakpoints. (line 38)
  40900. * breakpoint on events: Breakpoints. (line 30)
  40901. * breakpoint on memory address: Breakpoints. (line 17)
  40902. * breakpoint on variable modification: Breakpoints. (line 17)
  40903. * breakpoint ranges: Breakpoints. (line 45)
  40904. * breakpoint subroutine, remote: Stub Contents. (line 31)
  40905. * breakpointing Ada elaboration code: Stopping Before Main Program.
  40906. (line 6)
  40907. * breakpoints: Breakpoints. (line 6)
  40908. * breakpoints and tasks, in Ada: Ada Tasks. (line 135)
  40909. * breakpoints and threads: Thread-Specific Breakpoints.
  40910. (line 10)
  40911. * breakpoints at functions matching a regexp: Set Breaks. (line 90)
  40912. * breakpoints in guile: Breakpoints In Guile.
  40913. (line 6)
  40914. * breakpoints in overlays: Overlay Commands. (line 91)
  40915. * breakpoints in python: Breakpoints In Python.
  40916. (line 6)
  40917. * breakpoints, multiple locations: Set Breaks. (line 200)
  40918. * bs packet: Packets. (line 102)
  40919. * bug criteria: Bug Criteria. (line 6)
  40920. * bug reports: Bug Reporting. (line 6)
  40921. * bugs in GDB: GDB Bugs. (line 6)
  40922. * build ID sections: Separate Debug Files.
  40923. (line 95)
  40924. * build ID, and separate debugging files: Separate Debug Files.
  40925. (line 6)
  40926. * building GDB, requirements for: Requirements. (line 6)
  40927. * built-in simulator target: Target Commands. (line 73)
  40928. * builtin Go functions: Go. (line 31)
  40929. * builtin Go types: Go. (line 28)
  40930. * C and C++: C. (line 6)
  40931. * C and C++ checks: C Checks. (line 6)
  40932. * C and C++ constants: C Constants. (line 6)
  40933. * C and C++ defaults: C Defaults. (line 6)
  40934. * C and C++ operators: C Operators. (line 6)
  40935. * c packet: Packets. (line 109)
  40936. * C packet: Packets. (line 118)
  40937. * C++: C. (line 10)
  40938. * C++ compilers: C Plus Plus Expressions.
  40939. (line 8)
  40940. * C++ demangling: Debugging C Plus Plus.
  40941. (line 36)
  40942. * C++ exception handling: Debugging C Plus Plus.
  40943. (line 20)
  40944. * C++ overload debugging info: Debugging Output. (line 147)
  40945. * C++ scope resolution: Variables. (line 90)
  40946. * C++ symbol decoding style: Print Settings. (line 529)
  40947. * C++ symbol display: Debugging C Plus Plus.
  40948. (line 40)
  40949. * caching data of targets: Caching Target Data.
  40950. (line 6)
  40951. * caching of bfd objects: File Caching. (line 6)
  40952. * caching of opened files: File Caching. (line 6)
  40953. * call dummy stack unwinding: Calling. (line 36)
  40954. * call dummy stack unwinding on unhandled exception.: Calling.
  40955. (line 47)
  40956. * call overloaded functions: C Plus Plus Expressions.
  40957. (line 26)
  40958. * call stack: Stack. (line 9)
  40959. * call stack traces: Backtrace. (line 6)
  40960. * call-clobbered registers: Registers. (line 106)
  40961. * caller-saved registers: Registers. (line 106)
  40962. * calling functions: Calling. (line 6)
  40963. * calling functions in the program, disabling: Calling. (line 59)
  40964. * calling make: Shell Commands. (line 21)
  40965. * case sensitivity in symbol names: Symbols. (line 27)
  40966. * case-insensitive symbol names: Symbols. (line 27)
  40967. * casts, in expressions: Expressions. (line 26)
  40968. * casts, to view memory: Expressions. (line 41)
  40969. * catch Ada exceptions: Set Catchpoints. (line 66)
  40970. * catch Ada exceptions when handled: Set Catchpoints. (line 92)
  40971. * catch syscalls from inferior, remote request: General Query Packets.
  40972. (line 401)
  40973. * catchpoints: Breakpoints. (line 30)
  40974. * catchpoints, setting: Set Catchpoints. (line 6)
  40975. * change GDB's working directory: Working Directory. (line 32)
  40976. * change inferior's working directory: Working Directory. (line 13)
  40977. * character sets: Character Sets. (line 6)
  40978. * charset: Character Sets. (line 6)
  40979. * checkpoint: Checkpoint/Restart. (line 6)
  40980. * checkpoints and process id: Checkpoint/Restart. (line 76)
  40981. * checks, range: Type Checking. (line 44)
  40982. * checks, type: Checks. (line 23)
  40983. * checksum, for GDB remote: Overview. (line 21)
  40984. * choosing target byte order: Byte Order. (line 6)
  40985. * circular trace buffer: Starting and Stopping Trace Experiments.
  40986. (line 80)
  40987. * clearing breakpoints, watchpoints, catchpoints: Delete Breaks.
  40988. (line 6)
  40989. * close, file-i/o system call: close. (line 6)
  40990. * closest symbol and offset for an address: Symbols. (line 95)
  40991. * code address and its source line: Machine Code. (line 28)
  40992. * code compression, MIPS: MIPS. (line 49)
  40993. * COFF/PE exported symbols: Debugging Output. (line 50)
  40994. * collected data discarded: Starting and Stopping Trace Experiments.
  40995. (line 6)
  40996. * colon, doubled as scope operator: M2 Scope. (line 6)
  40997. * colon-colon, context for variables/functions: Variables. (line 44)
  40998. * colors: Output Styling. (line 6)
  40999. * command editing: Readline Bare Essentials.
  41000. (line 6)
  41001. * command files: Command Files. (line 6)
  41002. * command history: Command History. (line 6)
  41003. * command hooks: Hooks. (line 6)
  41004. * command interpreters: Interpreters. (line 6)
  41005. * command line editing: Editing. (line 6)
  41006. * command options: Command Options. (line 6)
  41007. * command options, boolean: Command Options. (line 21)
  41008. * command options, raw input: Command Options. (line 13)
  41009. * command scripts, debugging: Messages/Warnings. (line 65)
  41010. * command tracing: Messages/Warnings. (line 60)
  41011. * commands for C++: Debugging C Plus Plus.
  41012. (line 6)
  41013. * commands in guile: Commands In Guile. (line 6)
  41014. * commands in python: Commands In Python. (line 6)
  41015. * commands to access guile: Guile Commands. (line 6)
  41016. * commands to access python: Python Commands. (line 6)
  41017. * comment: Command Syntax. (line 37)
  41018. * COMMON blocks, Fortran: Special Fortran Commands.
  41019. (line 9)
  41020. * common targets: Target Commands. (line 46)
  41021. * compatibility, GDB/MI and CLI: GDB/MI Compatibility with CLI.
  41022. (line 6)
  41023. * compilation directory: Source Path. (line 40)
  41024. * compile C++ type conversion: Compiling and Injecting Code.
  41025. (line 90)
  41026. * compile command debugging info: Compiling and Injecting Code.
  41027. (line 82)
  41028. * compile command driver filename override: Compiling and Injecting Code.
  41029. (line 300)
  41030. * compile command options override: Compiling and Injecting Code.
  41031. (line 125)
  41032. * compiling code: Compiling and Injecting Code.
  41033. (line 6)
  41034. * completion: Completion. (line 6)
  41035. * completion of Guile commands: Commands In Guile. (line 100)
  41036. * completion of Python commands: Commands In Python. (line 70)
  41037. * completion of quoted strings: Completion. (line 83)
  41038. * completion of structure field names: Completion. (line 135)
  41039. * completion of union field names: Completion. (line 135)
  41040. * compressed debug sections: Requirements. (line 110)
  41041. * conditional breakpoints: Conditions. (line 6)
  41042. * conditional tracepoints: Tracepoint Conditions.
  41043. (line 6)
  41044. * configuring GDB: Running Configure. (line 6)
  41045. * confirmation: Messages/Warnings. (line 49)
  41046. * connection timeout, for remote TCP target: Remote Configuration.
  41047. (line 147)
  41048. * console i/o as part of file-i/o: Console I/O. (line 6)
  41049. * console interpreter: Interpreters. (line 21)
  41050. * console output in GDB/MI: GDB/MI Output Syntax.
  41051. (line 106)
  41052. * constants, in file-i/o protocol: Constants. (line 6)
  41053. * continuing: Continuing and Stepping.
  41054. (line 6)
  41055. * continuing threads: Thread Stops. (line 6)
  41056. * control C, and remote debugging: Bootstrapping. (line 25)
  41057. * controlling terminal: Input/Output. (line 23)
  41058. * convenience functions: Convenience Funs. (line 6)
  41059. * convenience functions in python: Functions In Python.
  41060. (line 6)
  41061. * convenience variables: Convenience Vars. (line 6)
  41062. * convenience variables for tracepoints: Tracepoint Variables.
  41063. (line 6)
  41064. * convenience variables, and trace state variables: Trace State Variables.
  41065. (line 17)
  41066. * convenience variables, initializing: Convenience Vars. (line 42)
  41067. * core dump file: Files. (line 6)
  41068. * core dump file target: Target Commands. (line 54)
  41069. * crash of debugger: Bug Criteria. (line 9)
  41070. * CRC algorithm definition: Separate Debug Files.
  41071. (line 140)
  41072. * CRC of memory block, remote request: General Query Packets.
  41073. (line 65)
  41074. * CRIS: CRIS. (line 6)
  41075. * CRIS mode: CRIS. (line 26)
  41076. * CRIS version: CRIS. (line 10)
  41077. * Ctrl-BREAK, MS-Windows: Cygwin Native. (line 9)
  41078. * ctrl-c message, in file-i/o protocol: The Ctrl-C Message. (line 6)
  41079. * current Ada task ID: Ada Tasks. (line 105)
  41080. * current directory: Source Path. (line 40)
  41081. * current Go package: Go. (line 11)
  41082. * current thread: Threads. (line 29)
  41083. * current thread, remote request: General Query Packets.
  41084. (line 55)
  41085. * custom JIT debug info: Custom Debug Info. (line 6)
  41086. * Cygwin DLL, debugging: Cygwin Native. (line 60)
  41087. * Cygwin-specific commands: Cygwin Native. (line 6)
  41088. * D: D. (line 6)
  41089. * d packet: Packets. (line 127)
  41090. * D packet: Packets. (line 134)
  41091. * Darwin: Darwin. (line 6)
  41092. * data breakpoints: Breakpoints. (line 17)
  41093. * data manipulation, in GDB/MI: GDB/MI Data Manipulation.
  41094. (line 6)
  41095. * dcache line-size: Caching Target Data.
  41096. (line 60)
  41097. * dcache size: Caching Target Data.
  41098. (line 57)
  41099. * dead names, GNU Hurd: Hurd Native. (line 84)
  41100. * debug expression parser: Debugging Output. (line 152)
  41101. * debug formats and C++: C Plus Plus Expressions.
  41102. (line 8)
  41103. * debug link sections: Separate Debug Files.
  41104. (line 79)
  41105. * debug remote protocol: Debugging Output. (line 159)
  41106. * debugger crash: Bug Criteria. (line 9)
  41107. * debugging agent: In-Process Agent. (line 6)
  41108. * debugging C++ programs: C Plus Plus Expressions.
  41109. (line 8)
  41110. * debugging information directory, global: Separate Debug Files.
  41111. (line 6)
  41112. * debugging information in separate files: Separate Debug Files.
  41113. (line 6)
  41114. * debugging libthread_db: Threads. (line 331)
  41115. * debugging multiple processes: Forks. (line 55)
  41116. * debugging optimized code: Optimized Code. (line 6)
  41117. * debugging stub, example: Remote Stub. (line 6)
  41118. * debugging target: Targets. (line 6)
  41119. * debugging the Cygwin DLL: Cygwin Native. (line 60)
  41120. * decimal floating point format: Decimal Floating Point.
  41121. (line 6)
  41122. * default behavior of commands, changing: Command Settings. (line 6)
  41123. * default collection action: Tracepoint Actions. (line 142)
  41124. * default data directory: Data Files. (line 19)
  41125. * default settings, changing: Command Settings. (line 6)
  41126. * default source path substitution: Source Path. (line 149)
  41127. * default system root: Files. (line 453)
  41128. * define trace state variable, remote request: Tracepoint Packets.
  41129. (line 121)
  41130. * defining macros interactively: Macros. (line 59)
  41131. * definition of a macro, showing: Macros. (line 47)
  41132. * delete breakpoints: Delete Breaks. (line 41)
  41133. * deleting breakpoints, watchpoints, catchpoints: Delete Breaks.
  41134. (line 6)
  41135. * deliver a signal to a program: Signaling. (line 6)
  41136. * demangle: Symbols. (line 114)
  41137. * demangler crashes: Maintenance Commands.
  41138. (line 146)
  41139. * demangler crashes <1>: Maintenance Commands.
  41140. (line 173)
  41141. * demangler crashes <2>: Maintenance Commands.
  41142. (line 197)
  41143. * demangling C++ names: Print Settings. (line 510)
  41144. * deprecated commands: Maintenance Commands.
  41145. (line 160)
  41146. * derived type of an object, printing: Print Settings. (line 541)
  41147. * descriptor tables display: DJGPP Native. (line 24)
  41148. * detach from task, GNU Hurd: Hurd Native. (line 59)
  41149. * detach from thread, GNU Hurd: Hurd Native. (line 109)
  41150. * direct memory access (DMA) on MS-DOS: DJGPP Native. (line 74)
  41151. * directories for source files: Source Path. (line 6)
  41152. * directory, compilation: Source Path. (line 40)
  41153. * directory, current: Source Path. (line 40)
  41154. * disable address space randomization, remote request: General Query Packets.
  41155. (line 84)
  41156. * disabling calling functions in the program: Calling. (line 59)
  41157. * disassembler options: Machine Code. (line 222)
  41158. * disconnected tracing: Starting and Stopping Trace Experiments.
  41159. (line 45)
  41160. * displaced stepping debugging info: Debugging Output. (line 75)
  41161. * displaced stepping support: Maintenance Commands.
  41162. (line 112)
  41163. * displaced stepping, and process record and replay: Process Record and Replay.
  41164. (line 96)
  41165. * display command history: Command History. (line 95)
  41166. * display derived types: Print Settings. (line 541)
  41167. * display disabled out of scope: Auto Display. (line 86)
  41168. * display GDB copyright: Help. (line 158)
  41169. * display of expressions: Auto Display. (line 6)
  41170. * display remote monitor communications: Target Commands. (line 107)
  41171. * display remote packets: Debugging Output. (line 159)
  41172. * DJGPP debugging: DJGPP Native. (line 6)
  41173. * DLLs with no debugging symbols: Non-debug DLL Symbols.
  41174. (line 6)
  41175. * do not print frame arguments: Print Settings. (line 154)
  41176. * documentation: Formatting Documentation.
  41177. (line 22)
  41178. * don't repeat command: Define. (line 111)
  41179. * don't repeat Guile command: Commands In Guile. (line 67)
  41180. * don't repeat Python command: Commands In Python. (line 42)
  41181. * DOS file-name semantics of file names.: Files. (line 476)
  41182. * DOS serial data link, remote debugging: DJGPP Native. (line 118)
  41183. * DOS serial port status: DJGPP Native. (line 139)
  41184. * DPMI: DJGPP Native. (line 6)
  41185. * dprintf: Dynamic Printf. (line 6)
  41186. * dump all data collected at tracepoint: tdump. (line 6)
  41187. * dump core from inferior: Core File Generation.
  41188. (line 6)
  41189. * dump data to a file: Dump/Restore Files. (line 6)
  41190. * dump/restore files: Dump/Restore Files. (line 6)
  41191. * DVC register: PowerPC Embedded. (line 6)
  41192. * DWARF compilation units cache: Maintenance Commands.
  41193. (line 394)
  41194. * DWARF DIEs: Debugging Output. (line 56)
  41195. * DWARF frame unwinders: Maintenance Commands.
  41196. (line 408)
  41197. * DWARF Line Tables: Debugging Output. (line 61)
  41198. * DWARF Reading: Debugging Output. (line 68)
  41199. * DWARF-2 CFI and CRIS: CRIS. (line 18)
  41200. * dynamic linking: Files. (line 123)
  41201. * dynamic printf: Dynamic Printf. (line 6)
  41202. * dynamic varobj: GDB/MI Variable Objects.
  41203. (line 166)
  41204. * editing: Editing. (line 15)
  41205. * editing command lines: Readline Bare Essentials.
  41206. (line 6)
  41207. * editing source files: Edit. (line 6)
  41208. * eight-bit characters in strings: Print Settings. (line 455)
  41209. * elaboration phase: Starting. (line 92)
  41210. * ELinOS system-wide configuration script: System-wide Configuration Scripts.
  41211. (line 15)
  41212. * Emacs: Emacs. (line 6)
  41213. * empty response, for unsupported packets: Overview. (line 97)
  41214. * enable/disable a breakpoint: Disabling. (line 6)
  41215. * enabling and disabling probes: Static Probe Points.
  41216. (line 52)
  41217. * entering numbers: Numbers. (line 6)
  41218. * environment (of your program): Environment. (line 6)
  41219. * errno values, in file-i/o protocol: Errno Values. (line 6)
  41220. * error on valid input: Bug Criteria. (line 12)
  41221. * event debugging info: Debugging Output. (line 81)
  41222. * event designators: Event Designators. (line 6)
  41223. * event handling: Set Catchpoints. (line 6)
  41224. * examine process image: Process Information.
  41225. (line 6)
  41226. * examining data: Data. (line 6)
  41227. * examining memory: Memory. (line 9)
  41228. * exception handlers: Set Catchpoints. (line 6)
  41229. * exceptions, guile: Guile Exception Handling.
  41230. (line 6)
  41231. * exceptions, python: Exception Handling. (line 6)
  41232. * exec events, remote reply: Stop Reply Packets. (line 141)
  41233. * executable file: Files. (line 16)
  41234. * executable file target: Target Commands. (line 50)
  41235. * executable file, for remote target: Remote Configuration.
  41236. (line 102)
  41237. * execute commands from a file: Command Files. (line 17)
  41238. * execute forward or backward in time: Reverse Execution. (line 92)
  41239. * execute remote command, remote request: General Query Packets.
  41240. (line 536)
  41241. * execution, foreground, background and asynchronous: Background Execution.
  41242. (line 6)
  41243. * exit status of shell commands: Convenience Vars. (line 187)
  41244. * exiting GDB: Quitting GDB. (line 6)
  41245. * expand macro once: Macros. (line 38)
  41246. * expanding preprocessor macros: Macros. (line 29)
  41247. * explicit locations: Explicit Locations. (line 6)
  41248. * explore type: Data. (line 234)
  41249. * explore value: Data. (line 227)
  41250. * exploring hierarchical data structures: Data. (line 125)
  41251. * expression debugging info: Debugging Output. (line 86)
  41252. * expression parser, debugging info: Debugging Output. (line 152)
  41253. * expressions: Expressions. (line 6)
  41254. * expressions in Ada: Ada. (line 11)
  41255. * expressions in C or C++: C. (line 6)
  41256. * expressions in C++: C Plus Plus Expressions.
  41257. (line 6)
  41258. * expressions in Modula-2: Modula-2. (line 12)
  41259. * extend GDB for remote targets: Connecting. (line 272)
  41260. * extending GDB: Extending GDB. (line 6)
  41261. * extra signal information: Signals. (line 156)
  41262. * F packet: Packets. (line 150)
  41263. * F reply packet: The F Reply Packet. (line 6)
  41264. * F request packet: The F Request Packet.
  41265. (line 6)
  41266. * fast tracepoints: Set Tracepoints. (line 24)
  41267. * fast tracepoints, setting: Create and Delete Tracepoints.
  41268. (line 50)
  41269. * fatal signal: Bug Criteria. (line 9)
  41270. * fatal signals: Signals. (line 15)
  41271. * features of the remote protocol: General Query Packets.
  41272. (line 589)
  41273. * file name canonicalization: Files. (line 520)
  41274. * file transfer: File Transfer. (line 6)
  41275. * file transfer, remote protocol: Host I/O Packets. (line 6)
  41276. * file-i/o examples: File-I/O Examples. (line 6)
  41277. * file-i/o overview: File-I/O Overview. (line 6)
  41278. * File-I/O remote protocol extension: File-I/O Remote Protocol Extension.
  41279. (line 6)
  41280. * file-i/o reply packet: The F Reply Packet. (line 6)
  41281. * file-i/o request packet: The F Request Packet.
  41282. (line 6)
  41283. * filename-display: Backtrace. (line 202)
  41284. * find trace snapshot: tfind. (line 6)
  41285. * flinching: Messages/Warnings. (line 49)
  41286. * float promotion: ABI. (line 34)
  41287. * floating point: Floating Point Hardware.
  41288. (line 6)
  41289. * floating point registers: Registers. (line 15)
  41290. * floating point, MIPS remote: MIPS Embedded. (line 13)
  41291. * focus of debugging: Threads. (line 29)
  41292. * foo: Symbol Errors. (line 54)
  41293. * foreground execution: Background Execution.
  41294. (line 6)
  41295. * fork events, remote reply: Stop Reply Packets. (line 104)
  41296. * fork, debugging programs which call: Forks. (line 6)
  41297. * format options: Print Settings. (line 6)
  41298. * formatted output: Output Formats. (line 6)
  41299. * Fortran: Summary. (line 40)
  41300. * Fortran Defaults: Fortran Defaults. (line 6)
  41301. * Fortran modules, information about: Symbols. (line 555)
  41302. * Fortran operators and expressions: Fortran Operators. (line 6)
  41303. * Fortran-specific support in GDB: Fortran. (line 6)
  41304. * FR-V shared-library debugging: Debugging Output. (line 193)
  41305. * frame debugging info: Debugging Output. (line 101)
  41306. * frame decorator api: Frame Decorator API.
  41307. (line 6)
  41308. * frame filters api: Frame Filter API. (line 6)
  41309. * frame information, printing: Print Settings. (line 314)
  41310. * frame level: Frames. (line 28)
  41311. * frame number: Frames. (line 28)
  41312. * frame pointer: Frames. (line 21)
  41313. * frame pointer register: Registers. (line 31)
  41314. * frame, definition: Frames. (line 6)
  41315. * frameless execution: Frames. (line 34)
  41316. * frames in guile: Frames In Guile. (line 6)
  41317. * frames in python: Frames In Python. (line 6)
  41318. * free memory information (MS-DOS): DJGPP Native. (line 19)
  41319. * FreeBSD: FreeBSD. (line 6)
  41320. * FreeBSD LWP debug messages: Debugging Output. (line 92)
  41321. * FreeBSD native target debug messages: Debugging Output. (line 97)
  41322. * fstat, file-i/o system call: stat/fstat. (line 6)
  41323. * Fujitsu: Remote Stub. (line 68)
  41324. * full symbol tables, listing GDB's internal: Symbols. (line 645)
  41325. * function call arguments, optimized out: Backtrace. (line 133)
  41326. * function entry/exit, wrong values of variables: Variables. (line 106)
  41327. * functions and variables by Fortran module: Symbols. (line 555)
  41328. * functions without line info, and stepping: Continuing and Stepping.
  41329. (line 92)
  41330. * g packet: Packets. (line 155)
  41331. * G packet: Packets. (line 183)
  41332. * g++, GNU C++ compiler: C. (line 10)
  41333. * garbled pointers: DJGPP Native. (line 42)
  41334. * GCC and C++: C Plus Plus Expressions.
  41335. (line 8)
  41336. * GDB bugs, reporting: Bug Reporting. (line 6)
  41337. * GDB internal error: Maintenance Commands.
  41338. (line 197)
  41339. * gdb module: Basic Python. (line 28)
  41340. * gdb objects: GDB Scheme Data Types.
  41341. (line 6)
  41342. * GDB reference card: Formatting Documentation.
  41343. (line 6)
  41344. * GDB startup: Startup. (line 6)
  41345. * GDB version number: Help. (line 148)
  41346. * gdb.ini: Startup. (line 69)
  41347. * gdb.printing: gdb.printing. (line 6)
  41348. * gdb.prompt: gdb.prompt. (line 6)
  41349. * gdb.types: gdb.types. (line 6)
  41350. * gdb.Value: Values From Inferior.
  41351. (line 6)
  41352. * GDB/MI development: GDB/MI Development and Front Ends.
  41353. (line 6)
  41354. * GDB/MI General Design: GDB/MI General Design.
  41355. (line 6)
  41356. * GDB/MI, async records: GDB/MI Async Records.
  41357. (line 6)
  41358. * GDB/MI, breakpoint commands: GDB/MI Breakpoint Commands.
  41359. (line 6)
  41360. * GDB/MI, compatibility with CLI: GDB/MI Compatibility with CLI.
  41361. (line 6)
  41362. * GDB/MI, data manipulation: GDB/MI Data Manipulation.
  41363. (line 6)
  41364. * GDB/MI, input syntax: GDB/MI Input Syntax.
  41365. (line 6)
  41366. * GDB/MI, its purpose: GDB/MI. (line 9)
  41367. * GDB/MI, output syntax: GDB/MI Output Syntax.
  41368. (line 6)
  41369. * GDB/MI, result records: GDB/MI Result Records.
  41370. (line 6)
  41371. * GDB/MI, simple examples: GDB/MI Simple Examples.
  41372. (line 6)
  41373. * GDB/MI, stream records: GDB/MI Stream Records.
  41374. (line 6)
  41375. * gdbarch debugging info: Debugging Output. (line 23)
  41376. * GDBHISTFILE, environment variable: Command History. (line 26)
  41377. * GDBHISTSIZE, environment variable: Command History. (line 45)
  41378. * gdbserver, command-line arguments: Server. (line 34)
  41379. * gdbserver, connecting: Connecting. (line 6)
  41380. * gdbserver, search path for libthread_db: Server. (line 254)
  41381. * gdbserver, send all debug output to a single file: Server. (line 148)
  41382. * gdbserver, target extended-remote mode: Connecting. (line 6)
  41383. * gdbserver, target remote mode: Connecting. (line 6)
  41384. * gdbserver, types of connections: Connecting. (line 6)
  41385. * GDT: DJGPP Native. (line 24)
  41386. * get thread information block address: General Query Packets.
  41387. (line 303)
  41388. * get thread-local storage address, remote request: General Query Packets.
  41389. (line 271)
  41390. * gettimeofday, file-i/o system call: gettimeofday. (line 6)
  41391. * getting structure elements using gdb.Field objects as subscripts: Values From Inferior.
  41392. (line 40)
  41393. * global debugging information directories: Separate Debug Files.
  41394. (line 6)
  41395. * global thread identifier (GDB): Threads. (line 88)
  41396. * global thread number: Threads. (line 88)
  41397. * GNAT descriptive types: Ada Glitches. (line 57)
  41398. * GNAT encoding: Ada Glitches. (line 57)
  41399. * GNU C++: C. (line 10)
  41400. * GNU Emacs: Emacs. (line 6)
  41401. * GNU Hurd debugging: Hurd Native. (line 6)
  41402. * GNU/Hurd debug messages: Debugging Output. (line 106)
  41403. * GNU/Linux LWP debug messages: Debugging Output. (line 121)
  41404. * GNU/Linux namespaces debug messages: Debugging Output. (line 125)
  41405. * Go (programming language): Go. (line 6)
  41406. * guile api: Guile API. (line 6)
  41407. * guile architectures: Architectures In Guile.
  41408. (line 6)
  41409. * guile auto-loading: Guile Auto-loading. (line 6)
  41410. * guile commands: Guile Commands. (line 6)
  41411. * guile commands <1>: Commands In Guile. (line 6)
  41412. * guile configuration: Guile Configuration.
  41413. (line 6)
  41414. * guile exceptions: Guile Exception Handling.
  41415. (line 6)
  41416. * guile gdb module: Basic Guile. (line 37)
  41417. * guile iterators: Iterators In Guile. (line 6)
  41418. * guile modules: Guile Modules. (line 6)
  41419. * guile pagination: Basic Guile. (line 6)
  41420. * guile parameters: Parameters In Guile.
  41421. (line 6)
  41422. * guile pretty printing api: Guile Pretty Printing API.
  41423. (line 6)
  41424. * guile scripting: Guile. (line 6)
  41425. * guile scripts directory: Guile Introduction. (line 16)
  41426. * guile stdout: Basic Guile. (line 6)
  41427. * guile, working with types: Types In Guile. (line 6)
  41428. * guile, working with values from inferior: Values From Inferior In Guile.
  41429. (line 6)
  41430. * H packet: Packets. (line 193)
  41431. * handling signals: Signals. (line 27)
  41432. * hardware breakpoints: Set Breaks. (line 61)
  41433. * hardware debug registers: Maintenance Commands.
  41434. (line 454)
  41435. * hardware watchpoints: Set Watchpoints. (line 31)
  41436. * hash mark while downloading: Target Commands. (line 98)
  41437. * heuristic-fence-post (Alpha, MIPS): MIPS. (line 14)
  41438. * history events: Event Designators. (line 8)
  41439. * history expansion: History Interaction.
  41440. (line 6)
  41441. * history expansion, turn on/off: Command History. (line 70)
  41442. * history file: Command History. (line 26)
  41443. * history number: Value History. (line 13)
  41444. * history of values printed by GDB: Value History. (line 6)
  41445. * history size: Command History. (line 45)
  41446. * history substitution: Command History. (line 26)
  41447. * hooks, for commands: Hooks. (line 6)
  41448. * hooks, post-command: Hooks. (line 11)
  41449. * hooks, pre-command: Hooks. (line 6)
  41450. * host character set: Character Sets. (line 6)
  41451. * Host I/O, remote protocol: Host I/O Packets. (line 6)
  41452. * how many arguments (user-defined commands): Define. (line 25)
  41453. * HPPA support: HPPA. (line 6)
  41454. * i packet: Packets. (line 207)
  41455. * I packet: Packets. (line 212)
  41456. * i/o: Input/Output. (line 6)
  41457. * I/O registers (Atmel AVR): AVR. (line 10)
  41458. * i386: Remote Stub. (line 56)
  41459. * i386-stub.c: Remote Stub. (line 56)
  41460. * IDT: DJGPP Native. (line 24)
  41461. * ignore count (of breakpoint): Conditions. (line 79)
  41462. * in-process agent protocol: In-Process Agent Protocol.
  41463. (line 6)
  41464. * incomplete type: Symbols. (line 346)
  41465. * indentation in structure display: Print Settings. (line 417)
  41466. * index files: Index Files. (line 6)
  41467. * index section format: Index Section Format.
  41468. (line 6)
  41469. * inferior: Inferiors and Programs.
  41470. (line 13)
  41471. * inferior debugging info: Debugging Output. (line 110)
  41472. * inferior events in Python: Events In Python. (line 6)
  41473. * inferior functions, calling: Calling. (line 6)
  41474. * inferior tty: Input/Output. (line 44)
  41475. * inferiors in Python: Inferiors In Python.
  41476. (line 6)
  41477. * infinite recursion in user-defined commands: Define. (line 128)
  41478. * info for known .debug_gdb_scripts-loaded scripts: Maintenance Commands.
  41479. (line 321)
  41480. * info for known object files: Maintenance Commands.
  41481. (line 306)
  41482. * info line, repeated calls: Machine Code. (line 40)
  41483. * info proc cmdline: Process Information.
  41484. (line 41)
  41485. * info proc cwd: Process Information.
  41486. (line 45)
  41487. * info proc exe: Process Information.
  41488. (line 49)
  41489. * info proc files: Process Information.
  41490. (line 53)
  41491. * information about static tracepoint markers: Listing Static Tracepoint Markers.
  41492. (line 6)
  41493. * information about tracepoints: Listing Tracepoints.
  41494. (line 6)
  41495. * inheritance: Debugging C Plus Plus.
  41496. (line 26)
  41497. * init file: Startup. (line 11)
  41498. * init file name: Startup. (line 69)
  41499. * initial frame: Frames. (line 12)
  41500. * initialization file, readline: Readline Init File. (line 6)
  41501. * injecting code: Compiling and Injecting Code.
  41502. (line 6)
  41503. * inline functions, debugging: Inline Functions. (line 6)
  41504. * innermost frame: Frames. (line 12)
  41505. * input syntax for GDB/MI: GDB/MI Input Syntax.
  41506. (line 6)
  41507. * installation: Installing GDB. (line 6)
  41508. * instructions, assembly: Machine Code. (line 43)
  41509. * integral datatypes, in file-i/o protocol: Integral Datatypes.
  41510. (line 6)
  41511. * Intel: Remote Stub. (line 56)
  41512. * Intel disassembly flavor: Machine Code. (line 237)
  41513. * Intel Memory Protection Extensions (MPX).: i386. (line 21)
  41514. * Intel MPX boundary violations: Signals. (line 197)
  41515. * Intel Processor Trace: Process Record and Replay.
  41516. (line 75)
  41517. * interaction, readline: Readline Interaction.
  41518. (line 6)
  41519. * internal commands: Maintenance Commands.
  41520. (line 6)
  41521. * internal errors, control of GDB behavior: Maintenance Commands.
  41522. (line 197)
  41523. * internal GDB breakpoints: Set Breaks. (line 374)
  41524. * interrupt: Quitting GDB. (line 13)
  41525. * interrupt debuggee on MS-Windows: Cygwin Native. (line 9)
  41526. * interrupt remote programs: Remote Configuration.
  41527. (line 36)
  41528. * interrupt remote programs <1>: Remote Configuration.
  41529. (line 108)
  41530. * interrupting remote programs: Connecting. (line 239)
  41531. * interrupting remote targets: Bootstrapping. (line 25)
  41532. * interrupts (remote protocol): Interrupts. (line 6)
  41533. * invalid input: Bug Criteria. (line 16)
  41534. * invoke another interpreter: Interpreters. (line 39)
  41535. * ipa protocol commands: IPA Protocol Commands.
  41536. (line 6)
  41537. * ipa protocol objects: IPA Protocol Objects.
  41538. (line 6)
  41539. * isatty, file-i/o system call: isatty. (line 6)
  41540. * JIT compilation interface: JIT Interface. (line 6)
  41541. * JIT debug info reader: Custom Debug Info. (line 6)
  41542. * just-in-time compilation: JIT Interface. (line 6)
  41543. * just-in-time compilation, debugging messages: Debugging Output.
  41544. (line 117)
  41545. * k packet: Packets. (line 216)
  41546. * kernel crash dump: BSD libkvm Interface.
  41547. (line 6)
  41548. * kernel memory image: BSD libkvm Interface.
  41549. (line 6)
  41550. * kill ring: Readline Killing Commands.
  41551. (line 18)
  41552. * killing text: Readline Killing Commands.
  41553. (line 6)
  41554. * languages: Languages. (line 6)
  41555. * last tracepoint number: Create and Delete Tracepoints.
  41556. (line 122)
  41557. * latest breakpoint: Set Breaks. (line 6)
  41558. * lazy strings in guile: Lazy Strings In Guile.
  41559. (line 6)
  41560. * lazy strings in python: Lazy Strings In Python.
  41561. (line 6)
  41562. * LDT: DJGPP Native. (line 24)
  41563. * leaving GDB: Quitting GDB. (line 6)
  41564. * libkvm: BSD libkvm Interface.
  41565. (line 6)
  41566. * library list format, remote protocol: Library List Format.
  41567. (line 6)
  41568. * library list format, remote protocol <1>: Library List Format for SVR4 Targets.
  41569. (line 6)
  41570. * limit hardware breakpoints and watchpoints: Remote Configuration.
  41571. (line 79)
  41572. * limit hardware watchpoints length: Remote Configuration.
  41573. (line 91)
  41574. * limit on number of printed array elements: Print Settings. (line 141)
  41575. * limits, in file-i/o protocol: Limits. (line 6)
  41576. * line tables in python: Line Tables In Python.
  41577. (line 6)
  41578. * line tables, listing GDB's internal: Symbols. (line 692)
  41579. * linespec locations: Linespec Locations. (line 6)
  41580. * Linux lightweight processes: Debugging Output. (line 121)
  41581. * list active threads, remote request: General Query Packets.
  41582. (line 238)
  41583. * list of supported file-i/o calls: List of Supported Calls.
  41584. (line 6)
  41585. * list output in GDB/MI: GDB/MI Output Syntax.
  41586. (line 117)
  41587. * list, how many lines to display: List. (line 30)
  41588. * listing GDB's internal line tables: Symbols. (line 692)
  41589. * listing GDB's internal symbol tables: Symbols. (line 645)
  41590. * listing machine instructions: Machine Code. (line 43)
  41591. * listing mapped overlays: Overlay Commands. (line 60)
  41592. * lists of breakpoints: Breakpoints. (line 45)
  41593. * load address, overlay's: How Overlays Work. (line 6)
  41594. * load shared library: Files. (line 327)
  41595. * load symbols from memory: Files. (line 193)
  41596. * local socket, target remote: Connecting. (line 140)
  41597. * local variables: Symbols. (line 415)
  41598. * locate address: Output Formats. (line 35)
  41599. * location: Specify Location. (line 6)
  41600. * lock scheduler: All-Stop Mode. (line 37)
  41601. * log output in GDB/MI: GDB/MI Output Syntax.
  41602. (line 113)
  41603. * logging file name: Logging Output. (line 12)
  41604. * logging GDB output: Logging Output. (line 6)
  41605. * lseek flags, in file-i/o protocol: Lseek Flags. (line 6)
  41606. * lseek, file-i/o system call: lseek. (line 6)
  41607. * m packet: Packets. (line 239)
  41608. * M packet: Packets. (line 259)
  41609. * m680x0: Remote Stub. (line 59)
  41610. * m68k-stub.c: Remote Stub. (line 59)
  41611. * Mach-O symbols processing: Debugging Output. (line 130)
  41612. * machine instructions: Machine Code. (line 43)
  41613. * macro definition, showing: Macros. (line 47)
  41614. * macro expansion, showing the results of preprocessor: Macros.
  41615. (line 29)
  41616. * macros, example of debugging with: Macros. (line 83)
  41617. * macros, from debug info: Macros. (line 47)
  41618. * macros, user-defined: Macros. (line 59)
  41619. * mailing lists: GDB/MI Development and Front Ends.
  41620. (line 78)
  41621. * maintenance commands: Maintenance Commands.
  41622. (line 6)
  41623. * Man pages: Man Pages. (line 6)
  41624. * managing frame filters: Frame Filter Management.
  41625. (line 6)
  41626. * manual overlay debugging: Overlay Commands. (line 23)
  41627. * map an overlay: Overlay Commands. (line 30)
  41628. * mapinfo list, QNX Neutrino: Process Information.
  41629. (line 130)
  41630. * mapped address: How Overlays Work. (line 6)
  41631. * mapped overlays: How Overlays Work. (line 6)
  41632. * markers, static tracepoints: Set Tracepoints. (line 28)
  41633. * maximum value for offset of closest symbol: Print Settings.
  41634. (line 70)
  41635. * member functions: C Plus Plus Expressions.
  41636. (line 16)
  41637. * memory address space mappings: Process Information.
  41638. (line 80)
  41639. * memory map format: Memory Map Format. (line 6)
  41640. * memory region attributes: Memory Region Attributes.
  41641. (line 6)
  41642. * memory tracing: Breakpoints. (line 17)
  41643. * memory transfer, in file-i/o protocol: Memory Transfer. (line 6)
  41644. * memory used by commands: Maintenance Commands.
  41645. (line 555)
  41646. * memory used for symbol tables: Files. (line 315)
  41647. * memory, alignment and size of remote accesses: Packets. (line 247)
  41648. * memory, viewing as typed object: Expressions. (line 41)
  41649. * mi interpreter: Interpreters. (line 26)
  41650. * mi1 interpreter: Interpreters. (line 37)
  41651. * mi2 interpreter: Interpreters. (line 34)
  41652. * mi3 interpreter: Interpreters. (line 31)
  41653. * minimal language: Unsupported Languages.
  41654. (line 6)
  41655. * minimal symbol dump: Symbols. (line 619)
  41656. * Minimal symbols and DLLs: Non-debug DLL Symbols.
  41657. (line 6)
  41658. * MIPS addresses, masking: MIPS. (line 80)
  41659. * MIPS remote floating point: MIPS Embedded. (line 13)
  41660. * MIPS stack: MIPS. (line 6)
  41661. * miscellaneous settings: Other Misc Settings.
  41662. (line 6)
  41663. * MMX registers (x86): Registers. (line 76)
  41664. * mode_t values, in file-i/o protocol: mode_t Values. (line 6)
  41665. * Modula-2: Summary. (line 29)
  41666. * Modula-2 built-ins: Built-In Func/Proc. (line 6)
  41667. * Modula-2 checks: M2 Checks. (line 6)
  41668. * Modula-2 constants: Built-In Func/Proc. (line 114)
  41669. * Modula-2 defaults: M2 Defaults. (line 6)
  41670. * Modula-2 operators: M2 Operators. (line 6)
  41671. * Modula-2 types: M2 Types. (line 6)
  41672. * Modula-2, deviations from: Deviations. (line 6)
  41673. * Modula-2, GDB support: Modula-2. (line 6)
  41674. * module functions and variables: Symbols. (line 555)
  41675. * modules: Symbols. (line 547)
  41676. * monitor commands, for gdbserver: Server. (line 218)
  41677. * Motorola 680x0: Remote Stub. (line 59)
  41678. * MS Windows debugging: Cygwin Native. (line 6)
  41679. * MS-DOS system info: DJGPP Native. (line 19)
  41680. * MS-DOS-specific commands: DJGPP Native. (line 6)
  41681. * multiple locations, breakpoints: Set Breaks. (line 200)
  41682. * multiple processes: Forks. (line 6)
  41683. * multiple targets: Active Targets. (line 6)
  41684. * multiple threads: Threads. (line 6)
  41685. * multiple threads, backtrace: Backtrace. (line 97)
  41686. * multiple-symbols menu: Ambiguous Expressions.
  41687. (line 51)
  41688. * multiprocess extensions, in remote protocol: General Query Packets.
  41689. (line 913)
  41690. * name a thread: Threads. (line 247)
  41691. * names of symbols: Symbols. (line 14)
  41692. * namespace in C++: C Plus Plus Expressions.
  41693. (line 20)
  41694. * native Cygwin debugging: Cygwin Native. (line 6)
  41695. * native DJGPP debugging: DJGPP Native. (line 6)
  41696. * native script auto-loading: Auto-loading sequences.
  41697. (line 6)
  41698. * native target: Target Commands. (line 85)
  41699. * negative breakpoint numbers: Set Breaks. (line 374)
  41700. * never read symbols: Files. (line 101)
  41701. * New SYSTAG message: Threads. (line 35)
  41702. * new user interface: Interpreters. (line 68)
  41703. * Newlib OS ABI and its influence on the longjmp handling: ABI.
  41704. (line 11)
  41705. * Nios II architecture: Nios II. (line 6)
  41706. * no debug info functions: Calling. (line 78)
  41707. * no debug info variables: Variables. (line 142)
  41708. * non-member C++ functions, set breakpoint in: Set Breaks. (line 113)
  41709. * non-stop mode: Non-Stop Mode. (line 6)
  41710. * non-stop mode, and process record and replay: Process Record and Replay.
  41711. (line 101)
  41712. * non-stop mode, and set displaced-stepping: Maintenance Commands.
  41713. (line 129)
  41714. * non-stop mode, remote request: General Query Packets.
  41715. (line 379)
  41716. * noninvasive task options: Hurd Native. (line 72)
  41717. * notation, readline: Readline Bare Essentials.
  41718. (line 6)
  41719. * notational conventions, for GDB/MI: GDB/MI. (line 25)
  41720. * notification packets: Notification Packets.
  41721. (line 6)
  41722. * notify output in GDB/MI: GDB/MI Output Syntax.
  41723. (line 102)
  41724. * NULL elements in arrays: Print Settings. (line 408)
  41725. * number of array elements to print: Print Settings. (line 141)
  41726. * number representation: Numbers. (line 6)
  41727. * numbers for breakpoints: Breakpoints. (line 38)
  41728. * object files, relocatable, reading symbols from: Files. (line 146)
  41729. * Objective-C: Objective-C. (line 6)
  41730. * Objective-C, classes and selectors: Symbols. (line 570)
  41731. * Objective-C, print objects: The Print Command with Objective-C.
  41732. (line 6)
  41733. * OBJFILE-gdb.gdb: objfile-gdbdotext file.
  41734. (line 6)
  41735. * OBJFILE-gdb.py: objfile-gdbdotext file.
  41736. (line 6)
  41737. * OBJFILE-gdb.scm: objfile-gdbdotext file.
  41738. (line 6)
  41739. * objfiles in guile: Objfiles In Guile. (line 6)
  41740. * objfiles in python: Objfiles In Python. (line 6)
  41741. * observer debugging info: Debugging Output. (line 142)
  41742. * octal escapes in strings: Print Settings. (line 455)
  41743. * online documentation: Help. (line 6)
  41744. * opaque data types: Symbols. (line 582)
  41745. * open flags, in file-i/o protocol: Open Flags. (line 6)
  41746. * open, file-i/o system call: open. (line 6)
  41747. * OpenCL C: OpenCL C. (line 6)
  41748. * OpenCL C Datatypes: OpenCL C Datatypes. (line 6)
  41749. * OpenCL C Expressions: OpenCL C Expressions.
  41750. (line 6)
  41751. * OpenCL C Operators: OpenCL C Operators. (line 6)
  41752. * OpenRISC 1000: OpenRISC 1000. (line 6)
  41753. * operate-and-get-next: Editing. (line 32)
  41754. * operating system information: Operating System Information.
  41755. (line 6)
  41756. * operating system information, process list: Process list. (line 6)
  41757. * optimized code, debugging: Optimized Code. (line 6)
  41758. * optimized code, wrong values of variables: Variables. (line 106)
  41759. * optimized out value in guile: Values From Inferior In Guile.
  41760. (line 102)
  41761. * optimized out value in Python: Values From Inferior.
  41762. (line 70)
  41763. * optimized out, in backtrace: Backtrace. (line 133)
  41764. * optional debugging messages: Debugging Output. (line 6)
  41765. * optional warnings: Messages/Warnings. (line 6)
  41766. * OS ABI: ABI. (line 11)
  41767. * OS information: OS Information. (line 6)
  41768. * out-of-line single-stepping: Maintenance Commands.
  41769. (line 112)
  41770. * outermost frame: Frames. (line 12)
  41771. * output formats: Output Formats. (line 6)
  41772. * output syntax of GDB/MI: GDB/MI Output Syntax.
  41773. (line 6)
  41774. * overlay area: How Overlays Work. (line 6)
  41775. * overlay example program: Overlay Sample Program.
  41776. (line 6)
  41777. * overlays: Overlays. (line 6)
  41778. * overlays, setting breakpoints in: Overlay Commands. (line 91)
  41779. * overloaded functions, calling: C Plus Plus Expressions.
  41780. (line 26)
  41781. * overloaded functions, overload resolution: Debugging C Plus Plus.
  41782. (line 59)
  41783. * overloading in C++: Debugging C Plus Plus.
  41784. (line 15)
  41785. * overloading, Ada: Overloading support for Ada.
  41786. (line 6)
  41787. * p packet: Packets. (line 271)
  41788. * P packet: Packets. (line 284)
  41789. * packet acknowledgment, for GDB remote: Packet Acknowledgment.
  41790. (line 6)
  41791. * packet size, remote protocol: General Query Packets.
  41792. (line 819)
  41793. * packets, notification: Notification Packets.
  41794. (line 6)
  41795. * packets, reporting on stdout: Debugging Output. (line 159)
  41796. * packets, tracepoint: Tracepoint Packets. (line 6)
  41797. * page size: Screen Size. (line 6)
  41798. * page tables display (MS-DOS): DJGPP Native. (line 55)
  41799. * pagination: Screen Size. (line 6)
  41800. * parameters in guile: Parameters In Guile.
  41801. (line 6)
  41802. * parameters in python: Parameters In Python.
  41803. (line 6)
  41804. * partial symbol dump: Symbols. (line 619)
  41805. * partial symbol tables, listing GDB's internal: Symbols. (line 645)
  41806. * Pascal: Summary. (line 35)
  41807. * Pascal objects, static members display: Print Settings. (line 570)
  41808. * Pascal support in GDB, limitations: Pascal. (line 6)
  41809. * pass signals to inferior, remote request: General Query Packets.
  41810. (line 440)
  41811. * patching binaries: Patching. (line 6)
  41812. * patching object files: Files. (line 26)
  41813. * pause current task (GNU Hurd): Hurd Native. (line 48)
  41814. * pause current thread (GNU Hurd): Hurd Native. (line 90)
  41815. * pauses in output: Screen Size. (line 6)
  41816. * pending breakpoints: Set Breaks. (line 245)
  41817. * physical address from linear address: DJGPP Native. (line 80)
  41818. * physname: Debugging Output. (line 41)
  41819. * pipe, target remote to: Connecting. (line 227)
  41820. * pipes: Starting. (line 64)
  41821. * pointer values, in file-i/o protocol: Pointer Values. (line 6)
  41822. * pointer, finding referent: Print Settings. (line 80)
  41823. * port rights, GNU Hurd: Hurd Native. (line 84)
  41824. * port sets, GNU Hurd: Hurd Native. (line 84)
  41825. * PowerPC architecture: PowerPC. (line 6)
  41826. * prefix for data files: Data Files. (line 6)
  41827. * prefix for executable and shared library file names: Files.
  41828. (line 386)
  41829. * premature return from system calls: Interrupted System Calls.
  41830. (line 6)
  41831. * preprocessor macro expansion, showing the results of: Macros.
  41832. (line 29)
  41833. * pretty print arrays: Print Settings. (line 115)
  41834. * pretty print C++ virtual function tables: Print Settings. (line 581)
  41835. * pretty-printer commands: Pretty-Printer Commands.
  41836. (line 6)
  41837. * print all frame argument values: Print Settings. (line 154)
  41838. * print an Objective-C object description: The Print Command with Objective-C.
  41839. (line 11)
  41840. * print array indexes: Print Settings. (line 125)
  41841. * print frame argument values for scalars only: Print Settings.
  41842. (line 154)
  41843. * print list of auto-loaded canned sequences of commands scripts: Auto-loading sequences.
  41844. (line 21)
  41845. * print list of auto-loaded Guile scripts: Guile Auto-loading.
  41846. (line 23)
  41847. * print list of auto-loaded Python scripts: Python Auto-loading.
  41848. (line 23)
  41849. * print messages on inferior start and exit: Inferiors and Programs.
  41850. (line 126)
  41851. * print messages on thread start and exit: Threads. (line 272)
  41852. * print messages when symbols are loaded: Symbols. (line 600)
  41853. * print settings: Print Settings. (line 6)
  41854. * print structures in indented form: Print Settings. (line 417)
  41855. * print/don't print memory addresses: Print Settings. (line 13)
  41856. * printing byte arrays: Output Formats. (line 60)
  41857. * printing data: Data. (line 6)
  41858. * printing frame argument values: Print Settings. (line 154)
  41859. * printing frame information: Print Settings. (line 314)
  41860. * printing nested structures: Print Settings. (line 362)
  41861. * printing strings: Output Formats. (line 60)
  41862. * probe static tracepoint marker: Create and Delete Tracepoints.
  41863. (line 75)
  41864. * probing markers, static tracepoints: Set Tracepoints. (line 28)
  41865. * process detailed status information: Process Information.
  41866. (line 88)
  41867. * process ID: Process Information.
  41868. (line 25)
  41869. * process info via /proc: Process Information.
  41870. (line 6)
  41871. * process list, QNX Neutrino: Process Information.
  41872. (line 126)
  41873. * process record and replay: Process Record and Replay.
  41874. (line 6)
  41875. * process status register: Registers. (line 31)
  41876. * processes, multiple: Forks. (line 6)
  41877. * procfs API calls: Process Information.
  41878. (line 105)
  41879. * profiling GDB: Maintenance Commands.
  41880. (line 438)
  41881. * program counter register: Registers. (line 31)
  41882. * program entry point: Backtrace. (line 155)
  41883. * programming in guile: Guile API. (line 6)
  41884. * programming in python: Python API. (line 6)
  41885. * progspaces in guile: Progspaces In Guile.
  41886. (line 6)
  41887. * progspaces in python: Progspaces In Python.
  41888. (line 6)
  41889. * prompt: Prompt. (line 6)
  41890. * protocol basics, file-i/o: Protocol Basics. (line 6)
  41891. * protocol, GDB remote serial: Overview. (line 14)
  41892. * protocol-specific representation of datatypes, in file-i/o protocol: Protocol-specific Representation of Datatypes.
  41893. (line 6)
  41894. * python api: Python API. (line 6)
  41895. * Python architectures: Architectures In Python.
  41896. (line 6)
  41897. * Python auto-loading: Python Auto-loading.
  41898. (line 6)
  41899. * python commands: Python Commands. (line 6)
  41900. * python commands <1>: Commands In Python. (line 6)
  41901. * python convenience functions: Functions In Python.
  41902. (line 6)
  41903. * python directory: Python. (line 12)
  41904. * python exceptions: Exception Handling. (line 6)
  41905. * python finish breakpoints: Finish Breakpoints in Python.
  41906. (line 6)
  41907. * python functions: Basic Python. (line 28)
  41908. * python module: Basic Python. (line 28)
  41909. * python modules: Python modules. (line 6)
  41910. * python pagination: Basic Python. (line 6)
  41911. * python parameters: Parameters In Python.
  41912. (line 6)
  41913. * python pretty printing api: Pretty Printing API.
  41914. (line 6)
  41915. * python scripting: Python. (line 6)
  41916. * python stdout: Basic Python. (line 6)
  41917. * Python, working with types: Types In Python. (line 6)
  41918. * python, working with values from inferior: Values From Inferior.
  41919. (line 6)
  41920. * q packet: Packets. (line 296)
  41921. * Q packet: Packets. (line 296)
  41922. * QAllow packet: General Query Packets.
  41923. (line 44)
  41924. * qAttached packet: General Query Packets.
  41925. (line 1381)
  41926. * qC packet: General Query Packets.
  41927. (line 55)
  41928. * QCatchSyscalls packet: General Query Packets.
  41929. (line 401)
  41930. * qCRC packet: General Query Packets.
  41931. (line 65)
  41932. * QDisableRandomization packet: General Query Packets.
  41933. (line 84)
  41934. * QEnvironmentHexEncoded packet: General Query Packets.
  41935. (line 144)
  41936. * QEnvironmentReset packet: General Query Packets.
  41937. (line 197)
  41938. * QEnvironmentUnset packet: General Query Packets.
  41939. (line 173)
  41940. * qfThreadInfo packet: General Query Packets.
  41941. (line 238)
  41942. * qGetTIBAddr packet: General Query Packets.
  41943. (line 303)
  41944. * qGetTLSAddr packet: General Query Packets.
  41945. (line 271)
  41946. * QNonStop packet: General Query Packets.
  41947. (line 379)
  41948. * qOffsets packet: General Query Packets.
  41949. (line 342)
  41950. * qP packet: General Query Packets.
  41951. (line 369)
  41952. * QPassSignals packet: General Query Packets.
  41953. (line 440)
  41954. * QProgramSignals packet: General Query Packets.
  41955. (line 469)
  41956. * qRcmd packet: General Query Packets.
  41957. (line 536)
  41958. * qSearch memory packet: General Query Packets.
  41959. (line 558)
  41960. * QSetWorkingDir packet: General Query Packets.
  41961. (line 219)
  41962. * QStartNoAckMode packet: General Query Packets.
  41963. (line 575)
  41964. * QStartupWithShell packet: General Query Packets.
  41965. (line 114)
  41966. * qsThreadInfo packet: General Query Packets.
  41967. (line 238)
  41968. * qSupported packet: General Query Packets.
  41969. (line 589)
  41970. * qSymbol packet: General Query Packets.
  41971. (line 1033)
  41972. * qTBuffer packet: Tracepoint Packets. (line 393)
  41973. * QTBuffer size packet: Tracepoint Packets. (line 406)
  41974. * QTDisable packet: Tracepoint Packets. (line 209)
  41975. * QTDisconnected packet: Tracepoint Packets. (line 228)
  41976. * QTDP packet: Tracepoint Packets. (line 10)
  41977. * QTDPsrc packet: Tracepoint Packets. (line 90)
  41978. * QTDV packet: Tracepoint Packets. (line 121)
  41979. * QTEnable packet: Tracepoint Packets. (line 204)
  41980. * qTfP packet: Tracepoint Packets. (line 335)
  41981. * QTFrame packet: Tracepoint Packets. (line 133)
  41982. * qTfSTM packet: Tracepoint Packets. (line 352)
  41983. * qTfV packet: Tracepoint Packets. (line 343)
  41984. * QThreadEvents packet: General Query Packets.
  41985. (line 509)
  41986. * qThreadExtraInfo packet: General Query Packets.
  41987. (line 1076)
  41988. * QTinit packet: Tracepoint Packets. (line 214)
  41989. * qTMinFTPILen packet: Tracepoint Packets. (line 171)
  41990. * QTNotes packet: Tracepoint Packets. (line 411)
  41991. * qTP packet: Tracepoint Packets. (line 307)
  41992. * QTro packet: Tracepoint Packets. (line 217)
  41993. * QTSave packet: Tracepoint Packets. (line 387)
  41994. * qTsP packet: Tracepoint Packets. (line 336)
  41995. * qTsSTM packet: Tracepoint Packets. (line 352)
  41996. * QTStart packet: Tracepoint Packets. (line 195)
  41997. * qTStatus packet: Tracepoint Packets. (line 234)
  41998. * qTSTMat packet: Tracepoint Packets. (line 381)
  41999. * QTStop packet: Tracepoint Packets. (line 201)
  42000. * qTsV packet: Tracepoint Packets. (line 344)
  42001. * qTV packet: Tracepoint Packets. (line 318)
  42002. * qualified thread ID: Threads. (line 52)
  42003. * query attached, remote request: General Query Packets.
  42004. (line 1381)
  42005. * quotes in commands: Completion. (line 83)
  42006. * quoting Ada internal identifiers: Additions to Ada. (line 76)
  42007. * quoting names: Symbols. (line 14)
  42008. * qXfer packet: General Query Packets.
  42009. (line 1113)
  42010. * r packet: Packets. (line 300)
  42011. * R packet: Packets. (line 305)
  42012. * range checking: Type Checking. (line 45)
  42013. * range stepping: Continuing and Stepping.
  42014. (line 217)
  42015. * ranged breakpoint: PowerPC Embedded. (line 33)
  42016. * ranges of breakpoints: Breakpoints. (line 45)
  42017. * Ravenscar Profile: Ravenscar Profile. (line 6)
  42018. * raw printing: Output Formats. (line 76)
  42019. * read special object, remote request: General Query Packets.
  42020. (line 1113)
  42021. * read, file-i/o system call: read. (line 6)
  42022. * read-only sections: Files. (line 265)
  42023. * reading symbols from relocatable object files: Files. (line 146)
  42024. * reading symbols immediately: Files. (line 94)
  42025. * readline: Editing. (line 6)
  42026. * Readline application name: Editing. (line 29)
  42027. * receive rights, GNU Hurd: Hurd Native. (line 84)
  42028. * recent tracepoint number: Create and Delete Tracepoints.
  42029. (line 122)
  42030. * record aggregates (Ada): Omissions from Ada. (line 44)
  42031. * record mode: Process Record and Replay.
  42032. (line 19)
  42033. * record serial communications on file: Remote Configuration.
  42034. (line 64)
  42035. * recording a session script: Bug Reporting. (line 108)
  42036. * recording inferior's execution and replaying it: Process Record and Replay.
  42037. (line 6)
  42038. * recordings in python: Recordings In Python.
  42039. (line 6)
  42040. * redirection: Input/Output. (line 6)
  42041. * reference card: Formatting Documentation.
  42042. (line 6)
  42043. * reference declarations: C Plus Plus Expressions.
  42044. (line 50)
  42045. * register packet format, MIPS: MIPS Register packet Format.
  42046. (line 6)
  42047. * registers: Registers. (line 6)
  42048. * regular expression: Set Breaks. (line 90)
  42049. * reloading the overlay table: Overlay Commands. (line 52)
  42050. * relocatable object files, reading symbols from: Files. (line 146)
  42051. * remote async notification debugging info: Debugging Output.
  42052. (line 136)
  42053. * remote connection commands: Connecting. (line 120)
  42054. * remote connection without stubs: Server. (line 6)
  42055. * remote debugging: Remote Debugging. (line 6)
  42056. * remote debugging, connecting: Connecting. (line 6)
  42057. * remote debugging, detach and program exit: Connecting. (line 19)
  42058. * remote debugging, symbol files: Connecting. (line 90)
  42059. * remote debugging, types of connections: Connecting. (line 6)
  42060. * remote memory comparison: Memory. (line 142)
  42061. * remote packets, enabling and disabling: Remote Configuration.
  42062. (line 159)
  42063. * remote programs, interrupting: Connecting. (line 239)
  42064. * remote protocol debugging: Debugging Output. (line 159)
  42065. * remote protocol, binary data: Overview. (line 63)
  42066. * remote protocol, field separator: Overview. (line 55)
  42067. * remote query requests: General Query Packets.
  42068. (line 6)
  42069. * remote serial debugging summary: Debug Session. (line 6)
  42070. * remote serial debugging, overview: Remote Stub. (line 14)
  42071. * remote serial protocol: Overview. (line 14)
  42072. * remote serial stub: Stub Contents. (line 6)
  42073. * remote serial stub list: Remote Stub. (line 53)
  42074. * remote serial stub, initialization: Stub Contents. (line 10)
  42075. * remote serial stub, main routine: Stub Contents. (line 15)
  42076. * remote stub, example: Remote Stub. (line 6)
  42077. * remote stub, support routines: Bootstrapping. (line 6)
  42078. * remote target: Target Commands. (line 58)
  42079. * remote target, file transfer: File Transfer. (line 6)
  42080. * remote target, limit break- and watchpoints: Remote Configuration.
  42081. (line 79)
  42082. * remote target, limit watchpoints length: Remote Configuration.
  42083. (line 91)
  42084. * remote timeout: Remote Configuration.
  42085. (line 72)
  42086. * remove actions from a tracepoint: Tracepoint Actions. (line 21)
  42087. * remove duplicate history: Command History. (line 54)
  42088. * rename, file-i/o system call: rename. (line 6)
  42089. * Renesas: Remote Stub. (line 62)
  42090. * repeated array elements: Print Settings. (line 348)
  42091. * repeating command sequences: Command Syntax. (line 41)
  42092. * repeating commands: Command Syntax. (line 21)
  42093. * replay log events, remote reply: Stop Reply Packets. (line 70)
  42094. * replay mode: Process Record and Replay.
  42095. (line 10)
  42096. * reporting bugs in GDB: GDB Bugs. (line 6)
  42097. * reprint the last value: Data. (line 112)
  42098. * reprint the last value <1>: Compiling and Injecting Code.
  42099. (line 74)
  42100. * reset environment, remote request: General Query Packets.
  42101. (line 197)
  42102. * resources used by commands: Maintenance Commands.
  42103. (line 509)
  42104. * response time, MIPS debugging: MIPS. (line 10)
  42105. * restart: Checkpoint/Restart. (line 6)
  42106. * restore data from a file: Dump/Restore Files. (line 6)
  42107. * restrictions on Go expressions: Go. (line 35)
  42108. * result records in GDB/MI: GDB/MI Result Records.
  42109. (line 6)
  42110. * resume threads of multiple processes simultaneously: All-Stop Mode.
  42111. (line 54)
  42112. * resuming execution: Continuing and Stepping.
  42113. (line 6)
  42114. * returning from a function: Returning. (line 6)
  42115. * reverse execution: Reverse Execution. (line 6)
  42116. * rewind program state: Checkpoint/Restart. (line 6)
  42117. * run to first instruction: Starting. (line 114)
  42118. * run to main procedure: Starting. (line 81)
  42119. * run until specified location: Continuing and Stepping.
  42120. (line 124)
  42121. * running: Starting. (line 6)
  42122. * running programs backward: Reverse Execution. (line 6)
  42123. * s packet: Packets. (line 312)
  42124. * S packet: Packets. (line 321)
  42125. * S12Z support: S12Z. (line 6)
  42126. * save breakpoints to a file for future sessions: Save Breakpoints.
  42127. (line 9)
  42128. * save command history: Command History. (line 36)
  42129. * save GDB output to a file: Logging Output. (line 6)
  42130. * save tracepoints for future sessions: save tracepoints. (line 6)
  42131. * scheduler locking mode: All-Stop Mode. (line 37)
  42132. * scope: M2 Scope. (line 6)
  42133. * screen size: Screen Size. (line 6)
  42134. * scripting commands: Command Files. (line 6)
  42135. * scripting with guile: Guile. (line 6)
  42136. * scripting with python: Python. (line 6)
  42137. * search for a thread: Threads. (line 258)
  42138. * search path for libthread_db: Threads. (line 293)
  42139. * searching memory: Searching Memory. (line 6)
  42140. * searching memory, in remote debugging: General Query Packets.
  42141. (line 558)
  42142. * searching source files: Search. (line 6)
  42143. * section offsets, remote request: General Query Packets.
  42144. (line 342)
  42145. * segment descriptor tables: DJGPP Native. (line 24)
  42146. * select Ctrl-C, BREAK or BREAK-g: Remote Configuration.
  42147. (line 108)
  42148. * select trace snapshot: tfind. (line 6)
  42149. * selected frame: Stack. (line 19)
  42150. * selecting guile pretty-printers: Selecting Guile Pretty-Printers.
  42151. (line 6)
  42152. * selecting python pretty-printers: Selecting Pretty-Printers.
  42153. (line 6)
  42154. * self tests: Maintenance Commands.
  42155. (line 360)
  42156. * self tests <1>: Maintenance Commands.
  42157. (line 366)
  42158. * semaphores on static probe points: Static Probe Points.
  42159. (line 20)
  42160. * send command to remote monitor: Connecting. (line 272)
  42161. * send command to simulator: Embedded Processors.
  42162. (line 9)
  42163. * send interrupt-sequence on start: Remote Configuration.
  42164. (line 121)
  42165. * send rights, GNU Hurd: Hurd Native. (line 84)
  42166. * send the output of a gdb command to a shell command: Shell Commands.
  42167. (line 25)
  42168. * sending files to remote systems: File Transfer. (line 6)
  42169. * separate debug sections: MiniDebugInfo. (line 6)
  42170. * separate debugging information files: Separate Debug Files.
  42171. (line 6)
  42172. * sequence-id, for GDB remote: Overview. (line 30)
  42173. * serial connections, debugging: Debugging Output. (line 159)
  42174. * serial line, target remote: Connecting. (line 129)
  42175. * serial protocol, GDB remote: Overview. (line 14)
  42176. * server prefix: Server Prefix. (line 6)
  42177. * server, command prefix: Command History. (line 20)
  42178. * set ABI for MIPS: MIPS. (line 32)
  42179. * set breakpoints in many functions: Set Breaks. (line 90)
  42180. * set breakpoints on all functions: Set Breaks. (line 117)
  42181. * set environment variable, remote request: General Query Packets.
  42182. (line 144)
  42183. * set fast tracepoint: Create and Delete Tracepoints.
  42184. (line 50)
  42185. * set inferior controlling terminal: Input/Output. (line 44)
  42186. * set static tracepoint: Create and Delete Tracepoints.
  42187. (line 75)
  42188. * set tdesc filename: Retrieving Descriptions.
  42189. (line 18)
  42190. * set tracepoint: Create and Delete Tracepoints.
  42191. (line 6)
  42192. * set working directory, remote request: General Query Packets.
  42193. (line 219)
  42194. * setting variables: Assignment. (line 6)
  42195. * setting watchpoints: Set Watchpoints. (line 6)
  42196. * settings: Command Settings. (line 39)
  42197. * SH: Remote Stub. (line 62)
  42198. * sh-stub.c: Remote Stub. (line 62)
  42199. * shared libraries: Files. (line 287)
  42200. * shared library events, remote reply: Stop Reply Packets. (line 65)
  42201. * shell command, exit code: Convenience Vars. (line 187)
  42202. * shell command, exit signal: Convenience Vars. (line 187)
  42203. * shell escape: Shell Commands. (line 10)
  42204. * show all convenience functions: Convenience Funs. (line 228)
  42205. * show all user variables and functions: Convenience Vars. (line 37)
  42206. * show inferior's working directory: Working Directory. (line 27)
  42207. * show last commands: Command History. (line 95)
  42208. * show tdesc filename: Retrieving Descriptions.
  42209. (line 25)
  42210. * signals: Signals. (line 6)
  42211. * signals the inferior may see, remote request: General Query Packets.
  42212. (line 469)
  42213. * SIGQUIT signal, dump core of GDB: Maintenance Commands.
  42214. (line 169)
  42215. * SingleKey keymap name: TUI Single Key Mode.
  42216. (line 53)
  42217. * size of remote memory accesses: Packets. (line 247)
  42218. * size of screen: Screen Size. (line 6)
  42219. * skipping over files via glob-style patterns: Skipping Over Functions and Files.
  42220. (line 55)
  42221. * skipping over functions and files: Skipping Over Functions and Files.
  42222. (line 6)
  42223. * skipping over functions via regular expressions: Skipping Over Functions and Files.
  42224. (line 68)
  42225. * snapshot of a process: Checkpoint/Restart. (line 6)
  42226. * software watchpoints: Set Watchpoints. (line 31)
  42227. * source file and line of a symbol: Print Settings. (line 50)
  42228. * source line and its code address: Machine Code. (line 6)
  42229. * source location: Specify Location. (line 6)
  42230. * source path: Source Path. (line 6)
  42231. * Sparc: Remote Stub. (line 65)
  42232. * sparc-stub.c: Remote Stub. (line 65)
  42233. * Sparc64 support: Sparc64. (line 6)
  42234. * sparcl-stub.c: Remote Stub. (line 68)
  42235. * SparcLite: Remote Stub. (line 68)
  42236. * Special Fortran commands: Special Fortran Commands.
  42237. (line 6)
  42238. * specifying location: Specify Location. (line 6)
  42239. * SSE registers (x86): Registers. (line 76)
  42240. * stack frame: Frames. (line 6)
  42241. * stack on Alpha: MIPS. (line 6)
  42242. * stack on MIPS: MIPS. (line 6)
  42243. * stack pointer register: Registers. (line 31)
  42244. * stacking targets: Active Targets. (line 6)
  42245. * standard registers: Registers. (line 31)
  42246. * start a new independent interpreter: Interpreters. (line 52)
  42247. * start a new trace experiment: Starting and Stopping Trace Experiments.
  42248. (line 6)
  42249. * starting: Starting. (line 6)
  42250. * startup code, and backtrace: Backtrace. (line 155)
  42251. * startup with shell, remote request: General Query Packets.
  42252. (line 114)
  42253. * stat, file-i/o system call: stat/fstat. (line 6)
  42254. * static members of C++ objects: Print Settings. (line 559)
  42255. * static members of Pascal objects: Print Settings. (line 570)
  42256. * static probe point, DTrace: Static Probe Points.
  42257. (line 6)
  42258. * static probe point, SystemTap: Static Probe Points.
  42259. (line 6)
  42260. * static tracepoints: Set Tracepoints. (line 28)
  42261. * static tracepoints, in remote protocol: General Query Packets.
  42262. (line 961)
  42263. * static tracepoints, setting: Create and Delete Tracepoints.
  42264. (line 75)
  42265. * status of trace data collection: Starting and Stopping Trace Experiments.
  42266. (line 27)
  42267. * status output in GDB/MI: GDB/MI Output Syntax.
  42268. (line 94)
  42269. * stepping: Continuing and Stepping.
  42270. (line 6)
  42271. * stepping and signal handlers: Signals. (line 106)
  42272. * stepping into functions with no line info: Continuing and Stepping.
  42273. (line 92)
  42274. * stop a running trace experiment: Starting and Stopping Trace Experiments.
  42275. (line 16)
  42276. * stop on C++ exceptions: Set Catchpoints. (line 16)
  42277. * stop reply packets: Stop Reply Packets. (line 6)
  42278. * stopped threads: Thread Stops. (line 6)
  42279. * stream records in GDB/MI: GDB/MI Stream Records.
  42280. (line 6)
  42281. * string tracing, in remote protocol: General Query Packets.
  42282. (line 978)
  42283. * struct gdb_reader_funcs: Writing JIT Debug Info Readers.
  42284. (line 22)
  42285. * struct gdb_symbol_callbacks: Writing JIT Debug Info Readers.
  42286. (line 43)
  42287. * struct gdb_unwind_callbacks: Writing JIT Debug Info Readers.
  42288. (line 43)
  42289. * struct return convention: i386. (line 7)
  42290. * struct stat, in file-i/o protocol: struct stat. (line 6)
  42291. * struct timeval, in file-i/o protocol: struct timeval. (line 6)
  42292. * struct/union returned in registers: i386. (line 7)
  42293. * structure field name completion: Completion. (line 135)
  42294. * stub example, remote debugging: Remote Stub. (line 6)
  42295. * stupid questions: Messages/Warnings. (line 49)
  42296. * styling: Output Styling. (line 6)
  42297. * Super-H: Super-H. (line 6)
  42298. * supported GDB/MI features, list: GDB/MI Support Commands.
  42299. (line 57)
  42300. * supported packets, remote query: General Query Packets.
  42301. (line 589)
  42302. * switching threads: Threads. (line 6)
  42303. * switching threads automatically: All-Stop Mode. (line 28)
  42304. * symbol cache size: Symbols. (line 698)
  42305. * symbol cache, flushing: Symbols. (line 714)
  42306. * symbol cache, printing its contents: Symbols. (line 706)
  42307. * symbol cache, printing usage statistics: Symbols. (line 710)
  42308. * symbol decoding style, C++: Print Settings. (line 529)
  42309. * symbol dump: Symbols. (line 619)
  42310. * symbol file functions: Debugging Output. (line 205)
  42311. * symbol files, remote debugging: Connecting. (line 90)
  42312. * symbol from address: Symbols. (line 95)
  42313. * symbol lookup: Debugging Output. (line 198)
  42314. * symbol lookup, remote request: General Query Packets.
  42315. (line 1033)
  42316. * symbol names: Symbols. (line 14)
  42317. * symbol table: Files. (line 6)
  42318. * symbol table creation: Debugging Output. (line 210)
  42319. * symbol tables in guile: Symbol Tables In Guile.
  42320. (line 6)
  42321. * symbol tables in python: Symbol Tables In Python.
  42322. (line 6)
  42323. * symbol tables, listing GDB's internal: Symbols. (line 645)
  42324. * symbol, source file and line: Print Settings. (line 50)
  42325. * symbols in guile: Symbols In Guile. (line 6)
  42326. * symbols in python: Symbols In Python. (line 6)
  42327. * symbols, never read: Files. (line 101)
  42328. * symbols, reading from relocatable object files: Files. (line 146)
  42329. * symbols, reading immediately: Files. (line 94)
  42330. * Synopsys ARC: ARC. (line 6)
  42331. * syscall DSO: Files. (line 193)
  42332. * system calls and thread breakpoints: Interrupted System Calls.
  42333. (line 6)
  42334. * system root, alternate: Files. (line 386)
  42335. * system, file-i/o system call: system. (line 6)
  42336. * system-wide configuration scripts: System-wide Configuration Scripts.
  42337. (line 6)
  42338. * system-wide init file: System-wide configuration.
  42339. (line 6)
  42340. * t packet: Packets. (line 331)
  42341. * T packet: Packets. (line 336)
  42342. * T packet reply: Stop Reply Packets. (line 26)
  42343. * tail call frames, debugging: Tail Call Frames. (line 6)
  42344. * target architecture: Targets. (line 17)
  42345. * target byte order: Byte Order. (line 6)
  42346. * target character set: Character Sets. (line 6)
  42347. * target debugging info: Debugging Output. (line 217)
  42348. * target descriptions: Target Descriptions.
  42349. (line 6)
  42350. * target descriptions, AArch64 features: AArch64 Features. (line 6)
  42351. * target descriptions, ARC Features: ARC Features. (line 6)
  42352. * target descriptions, ARM features: ARM Features. (line 6)
  42353. * target descriptions, enum types: Enum Target Types. (line 6)
  42354. * target descriptions, i386 features: i386 Features. (line 6)
  42355. * target descriptions, inclusion: Target Description Format.
  42356. (line 53)
  42357. * target descriptions, M68K features: M68K Features. (line 6)
  42358. * target descriptions, MicroBlaze features: MicroBlaze Features.
  42359. (line 6)
  42360. * target descriptions, MIPS features: MIPS Features. (line 6)
  42361. * target descriptions, NDS32 features: NDS32 Features. (line 6)
  42362. * target descriptions, Nios II features: Nios II Features. (line 6)
  42363. * target descriptions, OpenRISC 1000 features: OpenRISC 1000 Features.
  42364. (line 6)
  42365. * target descriptions, PowerPC features: PowerPC Features. (line 6)
  42366. * target descriptions, predefined types: Predefined Target Types.
  42367. (line 6)
  42368. * target descriptions, RISC-V Features: RISC-V Features. (line 6)
  42369. * target descriptions, RX Features: RX Features. (line 6)
  42370. * target descriptions, S/390 features: S/390 and System z Features.
  42371. (line 6)
  42372. * target descriptions, sparc32 features: Sparc Features. (line 6)
  42373. * target descriptions, sparc64 features: Sparc Features. (line 6)
  42374. * target descriptions, standard features: Standard Target Features.
  42375. (line 6)
  42376. * target descriptions, System z features: S/390 and System z Features.
  42377. (line 6)
  42378. * target descriptions, TIC6x features: TIC6x Features. (line 6)
  42379. * target descriptions, TMS320C6x features: TIC6x Features. (line 6)
  42380. * target descriptions, XML format: Target Description Format.
  42381. (line 6)
  42382. * target memory comparison: Memory. (line 142)
  42383. * target output in GDB/MI: GDB/MI Output Syntax.
  42384. (line 110)
  42385. * target stack description: Maintenance Commands.
  42386. (line 341)
  42387. * target-assisted range stepping: Continuing and Stepping.
  42388. (line 217)
  42389. * task attributes (GNU Hurd): Hurd Native. (line 48)
  42390. * task breakpoints, in Ada: Ada Tasks. (line 135)
  42391. * task exception port, GNU Hurd: Hurd Native. (line 67)
  42392. * task suspend count: Hurd Native. (line 59)
  42393. * task switching with program using Ravenscar Profile: Ravenscar Profile.
  42394. (line 10)
  42395. * TCP port, target remote: Connecting. (line 166)
  42396. * temporarily change settings: Command Settings. (line 39)
  42397. * terminal: Input/Output. (line 6)
  42398. * Text User Interface: TUI. (line 6)
  42399. * thread attributes info, remote request: General Query Packets.
  42400. (line 1076)
  42401. * thread breakpoints: Thread-Specific Breakpoints.
  42402. (line 10)
  42403. * thread breakpoints and system calls: Interrupted System Calls.
  42404. (line 6)
  42405. * thread create event, remote reply: Stop Reply Packets. (line 152)
  42406. * thread create/exit events, remote request: General Query Packets.
  42407. (line 509)
  42408. * thread default settings, GNU Hurd: Hurd Native. (line 130)
  42409. * thread exit event, remote reply: Stop Reply Packets. (line 181)
  42410. * thread ID lists: Threads. (line 65)
  42411. * thread identifier (GDB): Threads. (line 47)
  42412. * thread identifier (system): Threads. (line 35)
  42413. * thread info (Solaris): Threads. (line 167)
  42414. * thread information, remote request: General Query Packets.
  42415. (line 369)
  42416. * thread list format: Thread List Format. (line 6)
  42417. * thread number, per inferior: Threads. (line 47)
  42418. * thread properties, GNU Hurd: Hurd Native. (line 90)
  42419. * thread suspend count, GNU Hurd: Hurd Native. (line 109)
  42420. * THREAD-ID, in remote protocol: Packets. (line 20)
  42421. * threads and watchpoints: Set Watchpoints. (line 179)
  42422. * threads in python: Threads In Python. (line 6)
  42423. * threads of execution: Threads. (line 6)
  42424. * threads, automatic switching: All-Stop Mode. (line 28)
  42425. * threads, continuing: Thread Stops. (line 6)
  42426. * threads, stopped: Thread Stops. (line 6)
  42427. * time of command execution: Maintenance Commands.
  42428. (line 559)
  42429. * timeout for commands: Maintenance Commands.
  42430. (line 610)
  42431. * timeout for serial communications: Remote Configuration.
  42432. (line 72)
  42433. * timeout, for remote target connection: Remote Configuration.
  42434. (line 147)
  42435. * timestamping debugging info: Debugging Output. (line 224)
  42436. * trace experiment, status of: Starting and Stopping Trace Experiments.
  42437. (line 27)
  42438. * trace file format: Trace File Format. (line 6)
  42439. * trace files: Trace Files. (line 6)
  42440. * trace state variable value, remote request: Tracepoint Packets.
  42441. (line 318)
  42442. * trace state variables: Trace State Variables.
  42443. (line 6)
  42444. * traceback: Backtrace. (line 6)
  42445. * traceframe info format: Traceframe Info Format.
  42446. (line 6)
  42447. * tracepoint actions: Tracepoint Actions. (line 6)
  42448. * tracepoint conditions: Tracepoint Conditions.
  42449. (line 6)
  42450. * tracepoint data, display: tdump. (line 6)
  42451. * tracepoint deletion: Create and Delete Tracepoints.
  42452. (line 125)
  42453. * tracepoint number: Create and Delete Tracepoints.
  42454. (line 122)
  42455. * tracepoint packets: Tracepoint Packets. (line 6)
  42456. * tracepoint pass count: Tracepoint Passcounts.
  42457. (line 6)
  42458. * tracepoint restrictions: Tracepoint Restrictions.
  42459. (line 6)
  42460. * tracepoint status, remote request: Tracepoint Packets. (line 307)
  42461. * tracepoint variables: Tracepoint Variables.
  42462. (line 6)
  42463. * tracepoints: Tracepoints. (line 6)
  42464. * tracepoints support in gdbserver: Server. (line 272)
  42465. * trailing underscore, in Fortran symbols: Fortran. (line 9)
  42466. * translating between character sets: Character Sets. (line 6)
  42467. * TUI: TUI. (line 6)
  42468. * TUI commands: TUI Commands. (line 6)
  42469. * TUI configuration variables: TUI Configuration. (line 6)
  42470. * TUI key bindings: TUI Keys. (line 6)
  42471. * TUI single key mode: TUI Single Key Mode.
  42472. (line 6)
  42473. * type casting memory: Expressions. (line 41)
  42474. * type chain of a data type: Maintenance Commands.
  42475. (line 353)
  42476. * type checking: Checks. (line 24)
  42477. * type conversions in C++: C Plus Plus Expressions.
  42478. (line 26)
  42479. * type printer: Type Printing API. (line 9)
  42480. * type printing API for Python: Type Printing API. (line 6)
  42481. * types in guile: Types In Guile. (line 6)
  42482. * types in Python: Types In Python. (line 6)
  42483. * UDP port, target remote: Connecting. (line 215)
  42484. * union field name completion: Completion. (line 135)
  42485. * unions in structures, printing: Print Settings. (line 469)
  42486. * Unix domain socket: Connecting. (line 140)
  42487. * unknown address, locating: Output Formats. (line 35)
  42488. * unknown type: Symbols. (line 363)
  42489. * unlink, file-i/o system call: unlink. (line 6)
  42490. * unlinked object files: Files. (line 26)
  42491. * unload symbols from shared libraries: Files. (line 348)
  42492. * unmap an overlay: Overlay Commands. (line 39)
  42493. * unmapped overlays: How Overlays Work. (line 6)
  42494. * unset environment variable, remote request: General Query Packets.
  42495. (line 173)
  42496. * unset tdesc filename: Retrieving Descriptions.
  42497. (line 21)
  42498. * unsupported languages: Unsupported Languages.
  42499. (line 6)
  42500. * unwind stack in called functions: Calling. (line 36)
  42501. * unwind stack in called functions with unhandled exceptions: Calling.
  42502. (line 47)
  42503. * unwinding frames in Python: Unwinding Frames in Python.
  42504. (line 6)
  42505. * use only software watchpoints: Set Watchpoints. (line 108)
  42506. * user registers: Maintenance Commands.
  42507. (line 312)
  42508. * user-defined command: Define. (line 6)
  42509. * user-defined macros: Macros. (line 59)
  42510. * user-defined variables: Convenience Vars. (line 6)
  42511. * value history: Value History. (line 6)
  42512. * values from inferior, in guile: Values From Inferior In Guile.
  42513. (line 6)
  42514. * values from inferior, with Python: Values From Inferior.
  42515. (line 6)
  42516. * variable name conflict: Variables. (line 36)
  42517. * variable object debugging info: Debugging Output. (line 231)
  42518. * variable objects in GDB/MI: GDB/MI Variable Objects.
  42519. (line 9)
  42520. * variable values, wrong: Variables. (line 106)
  42521. * variables, readline: Readline Init File Syntax.
  42522. (line 34)
  42523. * variables, setting: Assignment. (line 16)
  42524. * vAttach packet: Packets. (line 350)
  42525. * vCont packet: Packets. (line 368)
  42526. * vCont? packet: Packets. (line 435)
  42527. * vCtrlC packet: Packets. (line 445)
  42528. * vector unit: Vector Unit. (line 6)
  42529. * vector, auxiliary: OS Information. (line 9)
  42530. * verbose operation: Messages/Warnings. (line 6)
  42531. * verify remote memory image: Memory. (line 142)
  42532. * verify target memory image: Memory. (line 142)
  42533. * vFile packet: Packets. (line 459)
  42534. * vFlashDone packet: Packets. (line 498)
  42535. * vFlashErase packet: Packets. (line 463)
  42536. * vFlashWrite packet: Packets. (line 478)
  42537. * vfork events, remote reply: Stop Reply Packets. (line 116)
  42538. * vforkdone events, remote reply: Stop Reply Packets. (line 128)
  42539. * virtual functions (C++) display: Print Settings. (line 581)
  42540. * vKill packet: Packets. (line 505)
  42541. * vMustReplyEmpty packet: Packets. (line 517)
  42542. * volatile registers: Registers. (line 106)
  42543. * vRun packet: Packets. (line 529)
  42544. * vStopped packet: Packets. (line 544)
  42545. * VTBL display: Print Settings. (line 581)
  42546. * watchdog timer: Maintenance Commands.
  42547. (line 610)
  42548. * watchpoints: Breakpoints. (line 17)
  42549. * watchpoints and threads: Set Watchpoints. (line 179)
  42550. * where to look for shared libraries: Files. (line 381)
  42551. * wild pointer, interpreting: Print Settings. (line 80)
  42552. * Wind River Linux system-wide configuration script: System-wide Configuration Scripts.
  42553. (line 22)
  42554. * word completion: Completion. (line 6)
  42555. * working directory: Source Path. (line 40)
  42556. * working directory (of your program): Working Directory. (line 6)
  42557. * working language: Languages. (line 13)
  42558. * write data into object, remote request: General Query Packets.
  42559. (line 1338)
  42560. * write, file-i/o system call: write. (line 6)
  42561. * writing a frame filter: Writing a Frame Filter.
  42562. (line 6)
  42563. * writing a Guile pretty-printer: Writing a Guile Pretty-Printer.
  42564. (line 6)
  42565. * writing a pretty-printer: Writing a Pretty-Printer.
  42566. (line 6)
  42567. * writing convenience functions: Functions In Python.
  42568. (line 6)
  42569. * writing into corefiles: Patching. (line 6)
  42570. * writing into executables: Patching. (line 6)
  42571. * writing into executables <1>: Compiling and Injecting Code.
  42572. (line 6)
  42573. * writing JIT debug info readers: Writing JIT Debug Info Readers.
  42574. (line 6)
  42575. * writing xmethods in Python: Writing an Xmethod. (line 6)
  42576. * wrong values: Variables. (line 106)
  42577. * x command, default address: Machine Code. (line 34)
  42578. * X packet: Packets. (line 547)
  42579. * Xilinx MicroBlaze: MicroBlaze. (line 6)
  42580. * XInclude: Target Description Format.
  42581. (line 53)
  42582. * XMD, Xilinx Microprocessor Debugger: MicroBlaze. (line 6)
  42583. * xmethod API: Xmethod API. (line 6)
  42584. * xmethods in Python: Xmethods In Python. (line 6)
  42585. * XML parser debugging: Debugging Output. (line 237)
  42586. * yanking text: Readline Killing Commands.
  42587. (line 6)
  42588. * z packet: Packets. (line 560)
  42589. * Z packets: Packets. (line 560)
  42590. * z0 packet: Packets. (line 575)
  42591. * Z0 packet: Packets. (line 575)
  42592. * z1 packet: Packets. (line 630)
  42593. * Z1 packet: Packets. (line 630)
  42594. * z2 packet: Packets. (line 651)
  42595. * Z2 packet: Packets. (line 651)
  42596. * z3 packet: Packets. (line 664)
  42597. * Z3 packet: Packets. (line 664)
  42598. * z4 packet: Packets. (line 677)
  42599. * Z4 packet: Packets. (line 677)
  42600. 
  42601. File: gdb.info, Node: Command and Variable Index, Prev: Concept Index, Up: Top
  42602. Command, Variable, and Function Index
  42603. *************************************
  42604. �[index�]
  42605. * Menu:
  42606. * !: Shell Commands. (line 10)
  42607. * # (a comment): Command Syntax. (line 37)
  42608. * $bpnum, convenience variable: Set Breaks. (line 6)
  42609. * $cdir, convenience variable: Source Path. (line 40)
  42610. * $cwd, convenience variable: Source Path. (line 40)
  42611. * $tpnum: Create and Delete Tracepoints.
  42612. (line 122)
  42613. * $tracepoint: Tracepoint Variables.
  42614. (line 10)
  42615. * $trace_file: Tracepoint Variables.
  42616. (line 16)
  42617. * $trace_frame: Tracepoint Variables.
  42618. (line 6)
  42619. * $trace_func: Tracepoint Variables.
  42620. (line 19)
  42621. * $trace_line: Tracepoint Variables.
  42622. (line 13)
  42623. * $_, convenience variable: Convenience Vars. (line 65)
  42624. * $_ada_exception, convenience variable: Set Catchpoints. (line 82)
  42625. * $_any_caller_is, convenience function: Convenience Funs. (line 182)
  42626. * $_any_caller_matches, convenience function: Convenience Funs.
  42627. (line 194)
  42628. * $_as_string, convenience function: Convenience Funs. (line 206)
  42629. * $_caller_is, convenience function: Convenience Funs. (line 152)
  42630. * $_caller_matches, convenience function: Convenience Funs. (line 175)
  42631. * $_cimag, convenience function: Convenience Funs. (line 217)
  42632. * $_creal, convenience function: Convenience Funs. (line 217)
  42633. * $_exception, convenience variable: Set Catchpoints. (line 21)
  42634. * $_exitcode, convenience variable: Convenience Vars. (line 80)
  42635. * $_exitsignal, convenience variable: Convenience Vars. (line 85)
  42636. * $_gdb_maint_setting, convenience function: Convenience Funs.
  42637. (line 129)
  42638. * $_gdb_maint_setting_str, convenience function: Convenience Funs.
  42639. (line 125)
  42640. * $_gdb_major, convenience variable: Convenience Vars. (line 178)
  42641. * $_gdb_minor, convenience variable: Convenience Vars. (line 178)
  42642. * $_gdb_setting, convenience function: Convenience Funs. (line 76)
  42643. * $_gdb_setting_str, convenience function: Convenience Funs. (line 63)
  42644. * $_gthread, convenience variable: Threads. (line 98)
  42645. * $_inferior, convenience variable: Inferiors and Programs.
  42646. (line 56)
  42647. * $_isvoid, convenience function: Convenience Funs. (line 15)
  42648. * $_memeq, convenience function: Convenience Funs. (line 136)
  42649. * $_probe_arg, convenience variable: Static Probe Points. (line 77)
  42650. * $_regex, convenience function: Convenience Funs. (line 140)
  42651. * $_sdata, collect: Tracepoint Actions. (line 86)
  42652. * $_sdata, inspect, convenience variable: Convenience Vars. (line 147)
  42653. * $_shell_exitcode, convenience variable: Convenience Vars. (line 187)
  42654. * $_shell_exitsignal, convenience variable: Convenience Vars. (line 187)
  42655. * $_siginfo, convenience variable: Convenience Vars. (line 153)
  42656. * $_streq, convenience function: Convenience Funs. (line 145)
  42657. * $_strlen, convenience function: Convenience Funs. (line 149)
  42658. * $_thread, convenience variable: Threads. (line 98)
  42659. * $_tlb, convenience variable: Convenience Vars. (line 159)
  42660. * $__, convenience variable: Convenience Vars. (line 74)
  42661. * (make-command: Commands In Guile. (line 15)
  42662. * (make-parameter: Parameters In Guile. (line 22)
  42663. * -ada-task-info: GDB/MI Ada Tasking Commands.
  42664. (line 9)
  42665. * -add-inferior: GDB/MI Miscellaneous Commands.
  42666. (line 295)
  42667. * -break-after: GDB/MI Breakpoint Commands.
  42668. (line 11)
  42669. * -break-commands: GDB/MI Breakpoint Commands.
  42670. (line 56)
  42671. * -break-condition: GDB/MI Breakpoint Commands.
  42672. (line 90)
  42673. * -break-delete: GDB/MI Breakpoint Commands.
  42674. (line 127)
  42675. * -break-disable: GDB/MI Breakpoint Commands.
  42676. (line 161)
  42677. * -break-enable: GDB/MI Breakpoint Commands.
  42678. (line 197)
  42679. * -break-info: GDB/MI Breakpoint Commands.
  42680. (line 232)
  42681. * -break-insert: GDB/MI Breakpoint Commands.
  42682. (line 256)
  42683. * -break-list: GDB/MI Breakpoint Commands.
  42684. (line 427)
  42685. * -break-passcount: GDB/MI Breakpoint Commands.
  42686. (line 499)
  42687. * -break-watch: GDB/MI Breakpoint Commands.
  42688. (line 511)
  42689. * -catch-assert: Ada Exception GDB/MI Catchpoint Commands.
  42690. (line 12)
  42691. * -catch-catch: C++ Exception GDB/MI Catchpoint Commands.
  42692. (line 98)
  42693. * -catch-exception: Ada Exception GDB/MI Catchpoint Commands.
  42694. (line 46)
  42695. * -catch-handlers: Ada Exception GDB/MI Catchpoint Commands.
  42696. (line 91)
  42697. * -catch-load: Shared Library GDB/MI Catchpoint Commands.
  42698. (line 9)
  42699. * -catch-rethrow: C++ Exception GDB/MI Catchpoint Commands.
  42700. (line 56)
  42701. * -catch-throw: C++ Exception GDB/MI Catchpoint Commands.
  42702. (line 13)
  42703. * -catch-unload: Shared Library GDB/MI Catchpoint Commands.
  42704. (line 36)
  42705. * -complete: GDB/MI Miscellaneous Commands.
  42706. (line 436)
  42707. * -data-disassemble: GDB/MI Data Manipulation.
  42708. (line 15)
  42709. * -data-evaluate-expression: GDB/MI Data Manipulation.
  42710. (line 192)
  42711. * -data-list-changed-registers: GDB/MI Data Manipulation.
  42712. (line 230)
  42713. * -data-list-register-names: GDB/MI Data Manipulation.
  42714. (line 266)
  42715. * -data-list-register-values: GDB/MI Data Manipulation.
  42716. (line 306)
  42717. * -data-read-memory: GDB/MI Data Manipulation.
  42718. (line 393)
  42719. * -data-read-memory-bytes: GDB/MI Data Manipulation.
  42720. (line 500)
  42721. * -data-write-memory-bytes: GDB/MI Data Manipulation.
  42722. (line 575)
  42723. * -dprintf-insert: GDB/MI Breakpoint Commands.
  42724. (line 363)
  42725. * -enable-frame-filters: GDB/MI Stack Manipulation.
  42726. (line 9)
  42727. * -enable-pretty-printing: GDB/MI Variable Objects.
  42728. (line 118)
  42729. * -enable-timings: GDB/MI Miscellaneous Commands.
  42730. (line 392)
  42731. * -environment-cd: GDB/MI Program Context.
  42732. (line 33)
  42733. * -environment-directory: GDB/MI Program Context.
  42734. (line 56)
  42735. * -environment-path: GDB/MI Program Context.
  42736. (line 100)
  42737. * -environment-pwd: GDB/MI Program Context.
  42738. (line 141)
  42739. * -exec-arguments: GDB/MI Program Context.
  42740. (line 9)
  42741. * -exec-continue: GDB/MI Program Execution.
  42742. (line 13)
  42743. * -exec-finish: GDB/MI Program Execution.
  42744. (line 53)
  42745. * -exec-interrupt: GDB/MI Program Execution.
  42746. (line 97)
  42747. * -exec-jump: GDB/MI Program Execution.
  42748. (line 147)
  42749. * -exec-next: GDB/MI Program Execution.
  42750. (line 171)
  42751. * -exec-next-instruction: GDB/MI Program Execution.
  42752. (line 202)
  42753. * -exec-return: GDB/MI Program Execution.
  42754. (line 238)
  42755. * -exec-run: GDB/MI Program Execution.
  42756. (line 283)
  42757. * -exec-step: GDB/MI Program Execution.
  42758. (line 353)
  42759. * -exec-step-instruction: GDB/MI Program Execution.
  42760. (line 395)
  42761. * -exec-until: GDB/MI Program Execution.
  42762. (line 436)
  42763. * -file-exec-and-symbols: GDB/MI File Commands.
  42764. (line 12)
  42765. * -file-exec-file: GDB/MI File Commands.
  42766. (line 40)
  42767. * -file-list-exec-source-file: GDB/MI File Commands.
  42768. (line 67)
  42769. * -file-list-exec-source-files: GDB/MI File Commands.
  42770. (line 93)
  42771. * -file-list-shared-libraries: GDB/MI File Commands.
  42772. (line 123)
  42773. * -file-symbol-file: GDB/MI File Commands.
  42774. (line 157)
  42775. * -gdb-exit: GDB/MI Miscellaneous Commands.
  42776. (line 9)
  42777. * -gdb-set: GDB/MI Miscellaneous Commands.
  42778. (line 31)
  42779. * -gdb-show: GDB/MI Miscellaneous Commands.
  42780. (line 54)
  42781. * -gdb-version: GDB/MI Miscellaneous Commands.
  42782. (line 77)
  42783. * -inferior-tty-set: GDB/MI Miscellaneous Commands.
  42784. (line 343)
  42785. * -inferior-tty-show: GDB/MI Miscellaneous Commands.
  42786. (line 366)
  42787. * -info-ada-exceptions: GDB/MI Ada Exceptions Commands.
  42788. (line 9)
  42789. * -info-gdb-mi-command: GDB/MI Support Commands.
  42790. (line 14)
  42791. * -info-os: GDB/MI Miscellaneous Commands.
  42792. (line 221)
  42793. * -interpreter-exec: GDB/MI Miscellaneous Commands.
  42794. (line 317)
  42795. * -list-features: GDB/MI Support Commands.
  42796. (line 57)
  42797. * -list-target-features: GDB/MI Support Commands.
  42798. (line 115)
  42799. * -list-thread-groups: GDB/MI Miscellaneous Commands.
  42800. (line 111)
  42801. * -stack-info-depth: GDB/MI Stack Manipulation.
  42802. (line 51)
  42803. * -stack-info-frame: GDB/MI Stack Manipulation.
  42804. (line 24)
  42805. * -stack-list-arguments: GDB/MI Stack Manipulation.
  42806. (line 89)
  42807. * -stack-list-frames: GDB/MI Stack Manipulation.
  42808. (line 188)
  42809. * -stack-list-locals: GDB/MI Stack Manipulation.
  42810. (line 305)
  42811. * -stack-list-variables: GDB/MI Stack Manipulation.
  42812. (line 351)
  42813. * -stack-select-frame: GDB/MI Stack Manipulation.
  42814. (line 379)
  42815. * -symbol-info-functions: GDB/MI Symbol Query. (line 9)
  42816. * -symbol-info-module-functions: GDB/MI Symbol Query. (line 109)
  42817. * -symbol-info-module-variables: GDB/MI Symbol Query. (line 170)
  42818. * -symbol-info-modules: GDB/MI Symbol Query. (line 241)
  42819. * -symbol-info-types: GDB/MI Symbol Query. (line 295)
  42820. * -symbol-info-variables: GDB/MI Symbol Query. (line 352)
  42821. * -symbol-list-lines: GDB/MI Symbol Query. (line 457)
  42822. * -target-attach: GDB/MI Target Manipulation.
  42823. (line 9)
  42824. * -target-detach: GDB/MI Target Manipulation.
  42825. (line 36)
  42826. * -target-disconnect: GDB/MI Target Manipulation.
  42827. (line 61)
  42828. * -target-download: GDB/MI Target Manipulation.
  42829. (line 85)
  42830. * -target-file-delete: GDB/MI File Transfer Commands.
  42831. (line 57)
  42832. * -target-file-get: GDB/MI File Transfer Commands.
  42833. (line 33)
  42834. * -target-file-put: GDB/MI File Transfer Commands.
  42835. (line 9)
  42836. * -target-flash-erase: GDB/MI Target Manipulation.
  42837. (line 192)
  42838. * -target-select: GDB/MI Target Manipulation.
  42839. (line 212)
  42840. * -thread-info: GDB/MI Thread Commands.
  42841. (line 9)
  42842. * -thread-list-ids: GDB/MI Thread Commands.
  42843. (line 58)
  42844. * -thread-select: GDB/MI Thread Commands.
  42845. (line 86)
  42846. * -trace-define-variable: GDB/MI Tracepoint Commands.
  42847. (line 80)
  42848. * -trace-find: GDB/MI Tracepoint Commands.
  42849. (line 12)
  42850. * -trace-frame-collected: GDB/MI Tracepoint Commands.
  42851. (line 97)
  42852. * -trace-list-variables: GDB/MI Tracepoint Commands.
  42853. (line 204)
  42854. * -trace-save: GDB/MI Tracepoint Commands.
  42855. (line 246)
  42856. * -trace-start: GDB/MI Tracepoint Commands.
  42857. (line 267)
  42858. * -trace-status: GDB/MI Tracepoint Commands.
  42859. (line 283)
  42860. * -trace-stop: GDB/MI Tracepoint Commands.
  42861. (line 354)
  42862. * -var-assign: GDB/MI Variable Objects.
  42863. (line 497)
  42864. * -var-create: GDB/MI Variable Objects.
  42865. (line 136)
  42866. * -var-delete: GDB/MI Variable Objects.
  42867. (line 224)
  42868. * -var-evaluate-expression: GDB/MI Variable Objects.
  42869. (line 476)
  42870. * -var-info-expression: GDB/MI Variable Objects.
  42871. (line 413)
  42872. * -var-info-num-children: GDB/MI Variable Objects.
  42873. (line 278)
  42874. * -var-info-path-expression: GDB/MI Variable Objects.
  42875. (line 438)
  42876. * -var-info-type: GDB/MI Variable Objects.
  42877. (line 400)
  42878. * -var-list-children: GDB/MI Variable Objects.
  42879. (line 294)
  42880. * -var-set-format: GDB/MI Variable Objects.
  42881. (line 237)
  42882. * -var-set-frozen: GDB/MI Variable Objects.
  42883. (line 641)
  42884. * -var-set-update-range: GDB/MI Variable Objects.
  42885. (line 667)
  42886. * -var-set-visualizer: GDB/MI Variable Objects.
  42887. (line 690)
  42888. * -var-show-attributes: GDB/MI Variable Objects.
  42889. (line 462)
  42890. * -var-show-format: GDB/MI Variable Objects.
  42891. (line 265)
  42892. * -var-update: GDB/MI Variable Objects.
  42893. (line 521)
  42894. * <gdb:arch>: Architectures In Guile.
  42895. (line 6)
  42896. * <gdb:block>: Blocks In Guile. (line 6)
  42897. * <gdb:breakpoint>: Breakpoints In Guile.
  42898. (line 6)
  42899. * <gdb:iterator>: Iterators In Guile. (line 6)
  42900. * <gdb:lazy-string>: Lazy Strings In Guile.
  42901. (line 6)
  42902. * <gdb:objfile>: Objfiles In Guile. (line 6)
  42903. * <gdb:progspace>: Progspaces In Guile. (line 6)
  42904. * <gdb:sal>: Symbol Tables In Guile.
  42905. (line 6)
  42906. * <gdb:symbol>: Symbols In Guile. (line 6)
  42907. * <gdb:symtab>: Symbol Tables In Guile.
  42908. (line 6)
  42909. * <gdb:type>: Types In Guile. (line 6)
  42910. * <gdb:value>: Values From Inferior In Guile.
  42911. (line 6)
  42912. * @, referencing memory as an array: Arrays. (line 6)
  42913. * ^connected: GDB/MI Result Records.
  42914. (line 22)
  42915. * ^done: GDB/MI Result Records.
  42916. (line 9)
  42917. * ^error: GDB/MI Result Records.
  42918. (line 25)
  42919. * ^exit: GDB/MI Result Records.
  42920. (line 36)
  42921. * ^running: GDB/MI Result Records.
  42922. (line 14)
  42923. * __init__ on TypePrinter: gdb.types. (line 82)
  42924. * |: Shell Commands. (line 25)
  42925. * abort (C-g): Miscellaneous Commands.
  42926. (line 10)
  42927. * accept-line (Newline or Return): Commands For History.
  42928. (line 6)
  42929. * actions: Tracepoint Actions. (line 6)
  42930. * ada-task-info: GDB/MI Support Commands.
  42931. (line 94)
  42932. * add-auto-load-safe-path: Auto-loading safe path.
  42933. (line 50)
  42934. * add-auto-load-scripts-directory: objfile-gdbdotext file.
  42935. (line 64)
  42936. * add-inferior: Inferiors and Programs.
  42937. (line 69)
  42938. * add-symbol-file: Files. (line 123)
  42939. * add-symbol-file-from-memory: Files. (line 193)
  42940. * adi assign: Sparc64. (line 45)
  42941. * adi examine: Sparc64. (line 27)
  42942. * advance LOCATION: Continuing and Stepping.
  42943. (line 187)
  42944. * alias: Aliases. (line 21)
  42945. * append: Dump/Restore Files. (line 34)
  42946. * append-pretty-printer!: Guile Printing Module.
  42947. (line 18)
  42948. * apropos: Help. (line 62)
  42949. * arch-bool-type: Architectures In Guile.
  42950. (line 84)
  42951. * arch-char-type: Architectures In Guile.
  42952. (line 36)
  42953. * arch-charset: Architectures In Guile.
  42954. (line 23)
  42955. * arch-disassemble: Disassembly In Guile.
  42956. (line 10)
  42957. * arch-double-type: Architectures In Guile.
  42958. (line 76)
  42959. * arch-float-type: Architectures In Guile.
  42960. (line 72)
  42961. * arch-int-type: Architectures In Guile.
  42962. (line 44)
  42963. * arch-int16-type: Architectures In Guile.
  42964. (line 104)
  42965. * arch-int32-type: Architectures In Guile.
  42966. (line 112)
  42967. * arch-int64-type: Architectures In Guile.
  42968. (line 120)
  42969. * arch-int8-type: Architectures In Guile.
  42970. (line 96)
  42971. * arch-long-type: Architectures In Guile.
  42972. (line 48)
  42973. * arch-longdouble-type: Architectures In Guile.
  42974. (line 80)
  42975. * arch-longlong-type: Architectures In Guile.
  42976. (line 88)
  42977. * arch-name: Architectures In Guile.
  42978. (line 20)
  42979. * arch-schar-type: Architectures In Guile.
  42980. (line 52)
  42981. * arch-short-type: Architectures In Guile.
  42982. (line 40)
  42983. * arch-uchar-type: Architectures In Guile.
  42984. (line 56)
  42985. * arch-uint-type: Architectures In Guile.
  42986. (line 64)
  42987. * arch-uint16-type: Architectures In Guile.
  42988. (line 108)
  42989. * arch-uint32-type: Architectures In Guile.
  42990. (line 116)
  42991. * arch-uint64-type: Architectures In Guile.
  42992. (line 124)
  42993. * arch-uint8-type: Architectures In Guile.
  42994. (line 100)
  42995. * arch-ulong-type: Architectures In Guile.
  42996. (line 68)
  42997. * arch-ulonglong-type: Architectures In Guile.
  42998. (line 92)
  42999. * arch-ushort-type: Architectures In Guile.
  43000. (line 60)
  43001. * arch-void-type: Architectures In Guile.
  43002. (line 32)
  43003. * arch-wide-charset: Architectures In Guile.
  43004. (line 26)
  43005. * arch?: Architectures In Guile.
  43006. (line 13)
  43007. * Architecture.disassemble: Architectures In Python.
  43008. (line 15)
  43009. * Architecture.name: Architectures In Python.
  43010. (line 12)
  43011. * attach: Attach. (line 6)
  43012. * attach&: Background Execution.
  43013. (line 25)
  43014. * awatch: Set Watchpoints. (line 83)
  43015. * b (break): Set Breaks. (line 6)
  43016. * backtrace: Backtrace. (line 11)
  43017. * backward-char (C-b): Commands For Moving. (line 15)
  43018. * backward-delete-char (Rubout): Commands For Text. (line 17)
  43019. * backward-kill-line (C-x Rubout): Commands For Killing.
  43020. (line 9)
  43021. * backward-kill-word (M-<DEL>): Commands For Killing.
  43022. (line 24)
  43023. * backward-word (M-b): Commands For Moving. (line 22)
  43024. * beginning-of-history (M-<): Commands For History.
  43025. (line 19)
  43026. * beginning-of-line (C-a): Commands For Moving. (line 6)
  43027. * bell-style: Readline Init File Syntax.
  43028. (line 35)
  43029. * bfd caching: File Caching. (line 14)
  43030. * bfd caching <1>: File Caching. (line 24)
  43031. * bfd caching <2>: File Caching. (line 27)
  43032. * bind-tty-special-chars: Readline Init File Syntax.
  43033. (line 42)
  43034. * blink-matching-paren: Readline Init File Syntax.
  43035. (line 47)
  43036. * block-end: Blocks In Guile. (line 70)
  43037. * block-function: Blocks In Guile. (line 73)
  43038. * block-global-block: Blocks In Guile. (line 87)
  43039. * block-global?: Blocks In Guile. (line 93)
  43040. * block-start: Blocks In Guile. (line 67)
  43041. * block-static-block: Blocks In Guile. (line 90)
  43042. * block-static?: Blocks In Guile. (line 97)
  43043. * block-superblock: Blocks In Guile. (line 83)
  43044. * block-symbols: Blocks In Guile. (line 101)
  43045. * block-symbols-progress?: Blocks In Guile. (line 112)
  43046. * block-valid?: Blocks In Guile. (line 59)
  43047. * Block.end: Blocks In Python. (line 86)
  43048. * Block.function: Blocks In Python. (line 90)
  43049. * Block.global_block: Blocks In Python. (line 105)
  43050. * Block.is_global: Blocks In Python. (line 113)
  43051. * Block.is_static: Blocks In Python. (line 117)
  43052. * Block.is_valid: Blocks In Python. (line 73)
  43053. * Block.start: Blocks In Python. (line 83)
  43054. * Block.static_block: Blocks In Python. (line 109)
  43055. * Block.superblock: Blocks In Python. (line 100)
  43056. * block?: Blocks In Guile. (line 55)
  43057. * BP_ACCESS_WATCHPOINT: Breakpoints In Python.
  43058. (line 74)
  43059. * BP_ACCESS_WATCHPOINT <1>: Breakpoints In Guile.
  43060. (line 71)
  43061. * BP_BREAKPOINT: Breakpoints In Python.
  43062. (line 62)
  43063. * BP_BREAKPOINT <1>: Breakpoints In Guile.
  43064. (line 57)
  43065. * BP_HARDWARE_WATCHPOINT: Breakpoints In Python.
  43066. (line 68)
  43067. * BP_HARDWARE_WATCHPOINT <1>: Breakpoints In Guile.
  43068. (line 63)
  43069. * BP_READ_WATCHPOINT: Breakpoints In Python.
  43070. (line 71)
  43071. * BP_READ_WATCHPOINT <1>: Breakpoints In Guile.
  43072. (line 67)
  43073. * BP_WATCHPOINT: Breakpoints In Python.
  43074. (line 65)
  43075. * BP_WATCHPOINT <1>: Breakpoints In Guile.
  43076. (line 60)
  43077. * bracketed-paste-begin (): Commands For Text. (line 36)
  43078. * break: Set Breaks. (line 6)
  43079. * break ... task TASKNO (Ada): Ada Tasks. (line 135)
  43080. * break ... thread THREAD-ID: Thread-Specific Breakpoints.
  43081. (line 10)
  43082. * break, and Objective-C: Method Names in Commands.
  43083. (line 9)
  43084. * break-range: PowerPC Embedded. (line 41)
  43085. * breakpoint annotation: Annotations for Running.
  43086. (line 47)
  43087. * breakpoint-commands: Breakpoints In Guile.
  43088. (line 236)
  43089. * breakpoint-condition: Breakpoints In Guile.
  43090. (line 194)
  43091. * breakpoint-enabled?: Breakpoints In Guile.
  43092. (line 144)
  43093. * breakpoint-expression: Breakpoints In Guile.
  43094. (line 139)
  43095. * breakpoint-hit-count: Breakpoints In Guile.
  43096. (line 169)
  43097. * breakpoint-ignore-count: Breakpoints In Guile.
  43098. (line 163)
  43099. * breakpoint-location: Breakpoints In Guile.
  43100. (line 134)
  43101. * breakpoint-notifications: GDB/MI Support Commands.
  43102. (line 91)
  43103. * breakpoint-number: Breakpoints In Guile.
  43104. (line 122)
  43105. * breakpoint-silent?: Breakpoints In Guile.
  43106. (line 151)
  43107. * breakpoint-stop: Breakpoints In Guile.
  43108. (line 202)
  43109. * breakpoint-task: Breakpoints In Guile.
  43110. (line 185)
  43111. * breakpoint-thread: Breakpoints In Guile.
  43112. (line 176)
  43113. * breakpoint-type: Breakpoints In Guile.
  43114. (line 126)
  43115. * breakpoint-valid?: Breakpoints In Guile.
  43116. (line 112)
  43117. * breakpoint-visible?: Breakpoints In Guile.
  43118. (line 130)
  43119. * Breakpoint.commands: Breakpoints In Python.
  43120. (line 211)
  43121. * Breakpoint.condition: Breakpoints In Python.
  43122. (line 206)
  43123. * Breakpoint.delete: Breakpoints In Python.
  43124. (line 128)
  43125. * Breakpoint.enabled: Breakpoints In Python.
  43126. (line 133)
  43127. * Breakpoint.expression: Breakpoints In Python.
  43128. (line 200)
  43129. * Breakpoint.hit_count: Breakpoints In Python.
  43130. (line 189)
  43131. * Breakpoint.ignore_count: Breakpoints In Python.
  43132. (line 161)
  43133. * Breakpoint.is_valid: Breakpoints In Python.
  43134. (line 120)
  43135. * Breakpoint.location: Breakpoints In Python.
  43136. (line 194)
  43137. * Breakpoint.number: Breakpoints In Python.
  43138. (line 165)
  43139. * Breakpoint.pending: Breakpoints In Python.
  43140. (line 146)
  43141. * Breakpoint.silent: Breakpoints In Python.
  43142. (line 138)
  43143. * Breakpoint.stop: Breakpoints In Python.
  43144. (line 89)
  43145. * Breakpoint.task: Breakpoints In Python.
  43146. (line 155)
  43147. * Breakpoint.temporary: Breakpoints In Python.
  43148. (line 180)
  43149. * Breakpoint.thread: Breakpoints In Python.
  43150. (line 150)
  43151. * Breakpoint.type: Breakpoints In Python.
  43152. (line 170)
  43153. * Breakpoint.visible: Breakpoints In Python.
  43154. (line 175)
  43155. * Breakpoint.__init__: Breakpoints In Python.
  43156. (line 16)
  43157. * Breakpoint.__init__ <1>: Breakpoints In Python.
  43158. (line 49)
  43159. * breakpoint?: Breakpoints In Guile.
  43160. (line 108)
  43161. * BreakpointEvent.breakpoint: Events In Python. (line 105)
  43162. * BreakpointEvent.breakpoints: Events In Python. (line 101)
  43163. * breakpoints: Breakpoints In Guile.
  43164. (line 104)
  43165. * breakpoints-invalid annotation: Invalidation. (line 14)
  43166. * bt (backtrace): Backtrace. (line 11)
  43167. * c (continue): Continuing and Stepping.
  43168. (line 16)
  43169. * c (SingleKey TUI key): TUI Single Key Mode. (line 10)
  43170. * C-L: TUI Keys. (line 79)
  43171. * C-x 1: TUI Keys. (line 22)
  43172. * C-x 2: TUI Keys. (line 32)
  43173. * C-x a: TUI Keys. (line 11)
  43174. * C-x A: TUI Keys. (line 12)
  43175. * C-x C-a: TUI Keys. (line 10)
  43176. * C-x o: TUI Keys. (line 43)
  43177. * C-x s: TUI Keys. (line 53)
  43178. * call: Calling. (line 11)
  43179. * call-last-kbd-macro (C-x e): Keyboard Macros. (line 13)
  43180. * capitalize-word (M-c): Commands For Text. (line 64)
  43181. * catch: Set Catchpoints. (line 10)
  43182. * catch assert: Set Catchpoints. (line 112)
  43183. * catch catch: Set Catchpoints. (line 16)
  43184. * catch exception: Set Catchpoints. (line 66)
  43185. * catch exception unhandled: Set Catchpoints. (line 87)
  43186. * catch exec: Set Catchpoints. (line 116)
  43187. * catch fork: Set Catchpoints. (line 261)
  43188. * catch handlers: Set Catchpoints. (line 92)
  43189. * catch load: Set Catchpoints. (line 268)
  43190. * catch rethrow: Set Catchpoints. (line 16)
  43191. * catch signal: Set Catchpoints. (line 273)
  43192. * catch syscall: Set Catchpoints. (line 120)
  43193. * catch throw: Set Catchpoints. (line 16)
  43194. * catch unload: Set Catchpoints. (line 268)
  43195. * catch vfork: Set Catchpoints. (line 264)
  43196. * cd: Working Directory. (line 32)
  43197. * cdir: Source Path. (line 40)
  43198. * character-search (C-]): Miscellaneous Commands.
  43199. (line 42)
  43200. * character-search-backward (M-C-]): Miscellaneous Commands.
  43201. (line 47)
  43202. * checkpoint: Checkpoint/Restart. (line 26)
  43203. * clear: Delete Breaks. (line 21)
  43204. * clear, and Objective-C: Method Names in Commands.
  43205. (line 9)
  43206. * clear-screen (C-l): Commands For Moving. (line 40)
  43207. * ClearObjFilesEvent.progspace: Events In Python. (line 125)
  43208. * clone-inferior: Inferiors and Programs.
  43209. (line 76)
  43210. * collect (tracepoints): Tracepoint Actions. (line 49)
  43211. * colon-colon, in Modula-2: M2 Scope. (line 6)
  43212. * colored-completion-prefix: Readline Init File Syntax.
  43213. (line 52)
  43214. * colored-stats: Readline Init File Syntax.
  43215. (line 59)
  43216. * Command.complete: Commands In Python. (line 70)
  43217. * Command.dont_repeat: Commands In Python. (line 42)
  43218. * Command.invoke: Commands In Python. (line 48)
  43219. * Command.__init__: Commands In Python. (line 10)
  43220. * command?: Commands In Guile. (line 63)
  43221. * commands: Break Commands. (line 11)
  43222. * commands annotation: Prompting. (line 27)
  43223. * COMMAND_BREAKPOINTS: Commands In Python. (line 142)
  43224. * COMMAND_BREAKPOINTS <1>: Commands In Guile. (line 177)
  43225. * COMMAND_DATA: Commands In Python. (line 113)
  43226. * COMMAND_DATA <1>: Commands In Guile. (line 148)
  43227. * COMMAND_FILES: Commands In Python. (line 124)
  43228. * COMMAND_FILES <1>: Commands In Guile. (line 159)
  43229. * COMMAND_MAINTENANCE: Commands In Python. (line 166)
  43230. * COMMAND_MAINTENANCE <1>: Commands In Guile. (line 201)
  43231. * COMMAND_NONE: Commands In Python. (line 103)
  43232. * COMMAND_NONE <1>: Commands In Guile. (line 137)
  43233. * COMMAND_OBSCURE: Commands In Python. (line 160)
  43234. * COMMAND_OBSCURE <1>: Commands In Guile. (line 195)
  43235. * COMMAND_RUNNING: Commands In Python. (line 107)
  43236. * COMMAND_RUNNING <1>: Commands In Guile. (line 142)
  43237. * COMMAND_STACK: Commands In Python. (line 118)
  43238. * COMMAND_STACK <1>: Commands In Guile. (line 153)
  43239. * COMMAND_STATUS: Commands In Python. (line 136)
  43240. * COMMAND_STATUS <1>: Commands In Guile. (line 171)
  43241. * COMMAND_SUPPORT: Commands In Python. (line 129)
  43242. * COMMAND_SUPPORT <1>: Commands In Guile. (line 164)
  43243. * COMMAND_TRACEPOINTS: Commands In Python. (line 148)
  43244. * COMMAND_TRACEPOINTS <1>: Commands In Guile. (line 183)
  43245. * COMMAND_USER: Commands In Python. (line 154)
  43246. * COMMAND_USER <1>: Commands In Guile. (line 189)
  43247. * comment-begin: Readline Init File Syntax.
  43248. (line 65)
  43249. * compare-sections: Memory. (line 149)
  43250. * compile code: Compiling and Injecting Code.
  43251. (line 11)
  43252. * compile file: Compiling and Injecting Code.
  43253. (line 56)
  43254. * complete: Help. (line 97)
  43255. * complete (<TAB>): Commands For Completion.
  43256. (line 6)
  43257. * COMPLETE_COMMAND: Commands In Python. (line 187)
  43258. * COMPLETE_COMMAND <1>: Commands In Guile. (line 222)
  43259. * COMPLETE_EXPRESSION: Commands In Python. (line 195)
  43260. * COMPLETE_EXPRESSION <1>: Commands In Guile. (line 230)
  43261. * COMPLETE_FILENAME: Commands In Python. (line 180)
  43262. * COMPLETE_FILENAME <1>: Commands In Guile. (line 215)
  43263. * COMPLETE_LOCATION: Commands In Python. (line 183)
  43264. * COMPLETE_LOCATION <1>: Commands In Guile. (line 218)
  43265. * COMPLETE_NONE: Commands In Python. (line 177)
  43266. * COMPLETE_NONE <1>: Commands In Guile. (line 212)
  43267. * COMPLETE_SYMBOL: Commands In Python. (line 191)
  43268. * COMPLETE_SYMBOL <1>: Commands In Guile. (line 226)
  43269. * completion-display-width: Readline Init File Syntax.
  43270. (line 70)
  43271. * completion-ignore-case: Readline Init File Syntax.
  43272. (line 77)
  43273. * completion-map-case: Readline Init File Syntax.
  43274. (line 82)
  43275. * completion-prefix-display-length: Readline Init File Syntax.
  43276. (line 88)
  43277. * completion-query-items: Readline Init File Syntax.
  43278. (line 95)
  43279. * condition: Conditions. (line 58)
  43280. * continue: Continuing and Stepping.
  43281. (line 16)
  43282. * continue&: Background Execution.
  43283. (line 40)
  43284. * convert-meta: Readline Init File Syntax.
  43285. (line 105)
  43286. * copy-backward-word (): Commands For Killing.
  43287. (line 49)
  43288. * copy-forward-word (): Commands For Killing.
  43289. (line 54)
  43290. * copy-region-as-kill (): Commands For Killing.
  43291. (line 45)
  43292. * core-file: Files. (line 107)
  43293. * ctf: Trace Files. (line 28)
  43294. * Ctrl-o (operate-and-get-next): Command Syntax. (line 41)
  43295. * current-arch: Architectures In Guile.
  43296. (line 17)
  43297. * current-objfile: Objfiles In Guile. (line 46)
  43298. * current-progspace: Progspaces In Guile. (line 26)
  43299. * cwd: Source Path. (line 40)
  43300. * d (delete): Delete Breaks. (line 41)
  43301. * d (SingleKey TUI key): TUI Single Key Mode. (line 13)
  43302. * data-directory: Guile Configuration. (line 9)
  43303. * data-disassemble-a-option: GDB/MI Support Commands.
  43304. (line 108)
  43305. * data-read-memory-bytes: GDB/MI Support Commands.
  43306. (line 88)
  43307. * default-visualizer: Guile Pretty Printing API.
  43308. (line 129)
  43309. * define: Define. (line 50)
  43310. * define-prefix: Define. (line 75)
  43311. * delete: Delete Breaks. (line 41)
  43312. * delete checkpoint CHECKPOINT-ID: Checkpoint/Restart. (line 53)
  43313. * delete display: Auto Display. (line 45)
  43314. * delete mem: Memory Region Attributes.
  43315. (line 34)
  43316. * delete tracepoint: Create and Delete Tracepoints.
  43317. (line 125)
  43318. * delete tvariable: Trace State Variables.
  43319. (line 42)
  43320. * delete-breakpoint!: Breakpoints In Guile.
  43321. (line 95)
  43322. * delete-char (C-d): Commands For Text. (line 12)
  43323. * delete-char-or-list (): Commands For Completion.
  43324. (line 39)
  43325. * delete-horizontal-space (): Commands For Killing.
  43326. (line 37)
  43327. * demangle: Symbols. (line 114)
  43328. * detach: Attach. (line 36)
  43329. * detach (remote): Connecting. (line 256)
  43330. * detach inferiors INFNO...: Inferiors and Programs.
  43331. (line 105)
  43332. * digit-argument (M-0, M-1, ... M--): Numeric Arguments. (line 6)
  43333. * dir: Source Path. (line 99)
  43334. * directory: Source Path. (line 99)
  43335. * dis (disable): Disabling. (line 37)
  43336. * disable: Disabling. (line 37)
  43337. * disable display: Auto Display. (line 56)
  43338. * disable frame-filter: Frame Filter Management.
  43339. (line 16)
  43340. * disable mem: Memory Region Attributes.
  43341. (line 38)
  43342. * disable pretty-printer: Pretty-Printer Commands.
  43343. (line 20)
  43344. * disable probes: Static Probe Points. (line 73)
  43345. * disable tracepoint: Enable and Disable Tracepoints.
  43346. (line 9)
  43347. * disable type-printer: Symbols. (line 411)
  43348. * disable-completion: Readline Init File Syntax.
  43349. (line 113)
  43350. * disassemble: Machine Code. (line 43)
  43351. * disconnect: Connecting. (line 265)
  43352. * display: Auto Display. (line 23)
  43353. * do (down): Selection. (line 74)
  43354. * do-lowercase-version (M-A, M-B, M-X, ...): Miscellaneous Commands.
  43355. (line 14)
  43356. * document: Define. (line 63)
  43357. * dont-repeat: Commands In Guile. (line 67)
  43358. * dont-repeat <1>: Define. (line 111)
  43359. * down: Selection. (line 74)
  43360. * Down: TUI Keys. (line 70)
  43361. * down-silently: Selection. (line 106)
  43362. * downcase-word (M-l): Commands For Text. (line 60)
  43363. * dprintf: Dynamic Printf. (line 26)
  43364. * dprintf-style agent: Dynamic Printf. (line 46)
  43365. * dprintf-style call: Dynamic Printf. (line 42)
  43366. * dprintf-style gdb: Dynamic Printf. (line 39)
  43367. * dump: Dump/Restore Files. (line 13)
  43368. * dump-functions (): Miscellaneous Commands.
  43369. (line 70)
  43370. * dump-macros (): Miscellaneous Commands.
  43371. (line 82)
  43372. * dump-variables (): Miscellaneous Commands.
  43373. (line 76)
  43374. * e (edit): Edit. (line 6)
  43375. * echo: Output. (line 12)
  43376. * echo-control-characters: Readline Init File Syntax.
  43377. (line 118)
  43378. * edit: Edit. (line 6)
  43379. * editing-mode: Readline Init File Syntax.
  43380. (line 123)
  43381. * else: Command Files. (line 74)
  43382. * emacs-editing-mode (C-e): Miscellaneous Commands.
  43383. (line 88)
  43384. * emacs-mode-string: Readline Init File Syntax.
  43385. (line 129)
  43386. * enable: Disabling. (line 44)
  43387. * enable display: Auto Display. (line 65)
  43388. * enable frame-filter: Frame Filter Management.
  43389. (line 26)
  43390. * enable mem: Memory Region Attributes.
  43391. (line 42)
  43392. * enable pretty-printer: Pretty-Printer Commands.
  43393. (line 25)
  43394. * enable probes: Static Probe Points. (line 60)
  43395. * enable tracepoint: Enable and Disable Tracepoints.
  43396. (line 19)
  43397. * enable type-printer: Symbols. (line 411)
  43398. * enable-bracketed-paste: Readline Init File Syntax.
  43399. (line 139)
  43400. * enable-keypad: Readline Init File Syntax.
  43401. (line 147)
  43402. * enabled: Xmethod API. (line 18)
  43403. * enabled of type_printer: Type Printing API. (line 13)
  43404. * end (breakpoint commands): Break Commands. (line 11)
  43405. * end (if/else/while commands): Command Files. (line 103)
  43406. * end (user-defined commands): Define. (line 63)
  43407. * end-kbd-macro (C-x )): Keyboard Macros. (line 9)
  43408. * end-of-file (usually C-d): Commands For Text. (line 6)
  43409. * end-of-history (M->): Commands For History.
  43410. (line 22)
  43411. * end-of-iteration: Iterators In Guile. (line 70)
  43412. * end-of-iteration?: Iterators In Guile. (line 73)
  43413. * end-of-line (C-e): Commands For Moving. (line 9)
  43414. * error annotation: Errors. (line 10)
  43415. * error-begin annotation: Errors. (line 22)
  43416. * error-port: I/O Ports in Guile. (line 12)
  43417. * eval: Output. (line 117)
  43418. * EventRegistry.connect: Events In Python. (line 19)
  43419. * EventRegistry.disconnect: Events In Python. (line 23)
  43420. * exception-args: Guile Exception Handling.
  43421. (line 103)
  43422. * exception-key: Guile Exception Handling.
  43423. (line 100)
  43424. * exception?: Guile Exception Handling.
  43425. (line 96)
  43426. * exceptionHandler: Bootstrapping. (line 38)
  43427. * exchange-point-and-mark (C-x C-x): Miscellaneous Commands.
  43428. (line 37)
  43429. * exec-file: Files. (line 39)
  43430. * exec-run-start-option: GDB/MI Support Commands.
  43431. (line 105)
  43432. * execute: Basic Guile. (line 68)
  43433. * exited annotation: Annotations for Running.
  43434. (line 18)
  43435. * ExitedEvent.exit_code: Events In Python. (line 67)
  43436. * ExitedEvent.inferior: Events In Python. (line 72)
  43437. * expand-tilde: Readline Init File Syntax.
  43438. (line 158)
  43439. * explore: Data. (line 125)
  43440. * f (frame): Selection. (line 11)
  43441. * f (SingleKey TUI key): TUI Single Key Mode. (line 16)
  43442. * faas: Frame Apply. (line 96)
  43443. * fg (resume foreground execution): Continuing and Stepping.
  43444. (line 16)
  43445. * field-artificial?: Types In Guile. (line 262)
  43446. * field-base-class?: Types In Guile. (line 266)
  43447. * field-bitpos: Types In Guile. (line 253)
  43448. * field-bitsize: Types In Guile. (line 257)
  43449. * field-enumval: Types In Guile. (line 250)
  43450. * field-name: Types In Guile. (line 243)
  43451. * field-type: Types In Guile. (line 246)
  43452. * field?: Types In Guile. (line 239)
  43453. * file: Files. (line 16)
  43454. * fin (finish): Continuing and Stepping.
  43455. (line 109)
  43456. * find: Searching Memory. (line 9)
  43457. * find-pc-line: Symbol Tables In Guile.
  43458. (line 71)
  43459. * finish: Continuing and Stepping.
  43460. (line 109)
  43461. * finish&: Background Execution.
  43462. (line 43)
  43463. * FinishBreakpoint.out_of_scope: Finish Breakpoints in Python.
  43464. (line 21)
  43465. * FinishBreakpoint.return_value: Finish Breakpoints in Python.
  43466. (line 38)
  43467. * FinishBreakpoint.__init__: Finish Breakpoints in Python.
  43468. (line 14)
  43469. * flash-erase: Target Commands. (line 140)
  43470. * flushregs: Maintenance Commands.
  43471. (line 303)
  43472. * flush_i_cache: Bootstrapping. (line 60)
  43473. * fo (forward-search): Search. (line 9)
  43474. * focus: TUI Commands. (line 55)
  43475. * forward-backward-delete-char (): Commands For Text. (line 21)
  43476. * forward-char (C-f): Commands For Moving. (line 12)
  43477. * forward-search: Search. (line 9)
  43478. * forward-search-history (C-s): Commands For History.
  43479. (line 30)
  43480. * forward-word (M-f): Commands For Moving. (line 18)
  43481. * frame address: Selection. (line 30)
  43482. * frame apply: Frame Apply. (line 6)
  43483. * frame function: Selection. (line 48)
  43484. * frame level: Selection. (line 16)
  43485. * frame view: Selection. (line 53)
  43486. * frame, selecting: Selection. (line 11)
  43487. * frame-arch: Frames In Guile. (line 35)
  43488. * frame-block: Frames In Guile. (line 121)
  43489. * frame-function: Frames In Guile. (line 125)
  43490. * frame-name: Frames In Guile. (line 32)
  43491. * frame-newer: Frames In Guile. (line 133)
  43492. * frame-older: Frames In Guile. (line 130)
  43493. * frame-pc: Frames In Guile. (line 118)
  43494. * frame-read-register: Frames In Guile. (line 140)
  43495. * frame-read-var: Frames In Guile. (line 144)
  43496. * frame-sal: Frames In Guile. (line 136)
  43497. * frame-select: Frames In Guile. (line 152)
  43498. * frame-type: Frames In Guile. (line 39)
  43499. * frame-unwind-stop-reason: Frames In Guile. (line 67)
  43500. * frame-valid?: Frames In Guile. (line 26)
  43501. * Frame.architecture: Frames In Python. (line 53)
  43502. * Frame.block: Frames In Python. (line 139)
  43503. * Frame.find_sal: Frames In Python. (line 155)
  43504. * Frame.function: Frames In Python. (line 145)
  43505. * Frame.is_valid: Frames In Python. (line 43)
  43506. * Frame.name: Frames In Python. (line 49)
  43507. * Frame.newer: Frames In Python. (line 152)
  43508. * Frame.older: Frames In Python. (line 149)
  43509. * Frame.pc: Frames In Python. (line 136)
  43510. * Frame.read_register: Frames In Python. (line 159)
  43511. * Frame.read_var: Frames In Python. (line 164)
  43512. * Frame.select: Frames In Python. (line 172)
  43513. * Frame.type: Frames In Python. (line 57)
  43514. * Frame.unwind_stop_reason: Frames In Python. (line 84)
  43515. * frame?: Frames In Guile. (line 22)
  43516. * FrameDecorator.address: Frame Decorator API. (line 60)
  43517. * FrameDecorator.elided: Frame Decorator API. (line 29)
  43518. * FrameDecorator.filename: Frame Decorator API. (line 70)
  43519. * FrameDecorator.frame_args: Frame Decorator API. (line 91)
  43520. * FrameDecorator.frame_locals: Frame Decorator API. (line 143)
  43521. * FrameDecorator.function: Frame Decorator API. (line 49)
  43522. * FrameDecorator.inferior_frame: Frame Decorator API. (line 176)
  43523. * FrameDecorator.line: Frame Decorator API. (line 81)
  43524. * FrameFilter.enabled: Frame Filter API. (line 122)
  43525. * FrameFilter.filter: Frame Filter API. (line 75)
  43526. * FrameFilter.name: Frame Filter API. (line 115)
  43527. * FrameFilter.priority: Frame Filter API. (line 131)
  43528. * frames-invalid annotation: Invalidation. (line 9)
  43529. * frozen-varobjs: GDB/MI Support Commands.
  43530. (line 75)
  43531. * ftrace: Create and Delete Tracepoints.
  43532. (line 50)
  43533. * Function: Functions In Python. (line 6)
  43534. * Function.invoke: Functions In Python. (line 19)
  43535. * Function.__init__: Functions In Python. (line 10)
  43536. * gcore: Core File Generation.
  43537. (line 17)
  43538. * gdb-object-kind: GDB Scheme Data Types.
  43539. (line 10)
  43540. * gdb-version: Guile Configuration. (line 17)
  43541. * gdb.Block: Blocks In Python. (line 6)
  43542. * gdb.block_for_pc: Blocks In Python. (line 64)
  43543. * gdb.block_for_pc <1>: Blocks In Python. (line 64)
  43544. * gdb.BP_ACCESS_WATCHPOINT: Breakpoints In Python.
  43545. (line 74)
  43546. * gdb.BP_BREAKPOINT: Breakpoints In Python.
  43547. (line 62)
  43548. * gdb.BP_HARDWARE_WATCHPOINT: Breakpoints In Python.
  43549. (line 68)
  43550. * gdb.BP_READ_WATCHPOINT: Breakpoints In Python.
  43551. (line 71)
  43552. * gdb.BP_WATCHPOINT: Breakpoints In Python.
  43553. (line 65)
  43554. * gdb.Breakpoint: Breakpoints In Python.
  43555. (line 6)
  43556. * gdb.breakpoints: Basic Python. (line 59)
  43557. * gdb.breakpoints <1>: Basic Python. (line 59)
  43558. * gdb.COMMAND_BREAKPOINTS: Commands In Python. (line 142)
  43559. * gdb.COMMAND_DATA: Commands In Python. (line 113)
  43560. * gdb.COMMAND_FILES: Commands In Python. (line 124)
  43561. * gdb.COMMAND_MAINTENANCE: Commands In Python. (line 166)
  43562. * gdb.COMMAND_NONE: Commands In Python. (line 103)
  43563. * gdb.COMMAND_OBSCURE: Commands In Python. (line 160)
  43564. * gdb.COMMAND_RUNNING: Commands In Python. (line 107)
  43565. * gdb.COMMAND_STACK: Commands In Python. (line 118)
  43566. * gdb.COMMAND_STATUS: Commands In Python. (line 136)
  43567. * gdb.COMMAND_SUPPORT: Commands In Python. (line 129)
  43568. * gdb.COMMAND_TRACEPOINTS: Commands In Python. (line 148)
  43569. * gdb.COMMAND_USER: Commands In Python. (line 154)
  43570. * gdb.COMPLETE_COMMAND: Commands In Python. (line 187)
  43571. * gdb.COMPLETE_EXPRESSION: Commands In Python. (line 195)
  43572. * gdb.COMPLETE_FILENAME: Commands In Python. (line 180)
  43573. * gdb.COMPLETE_LOCATION: Commands In Python. (line 183)
  43574. * gdb.COMPLETE_NONE: Commands In Python. (line 177)
  43575. * gdb.COMPLETE_SYMBOL: Commands In Python. (line 191)
  43576. * gdb.convenience_variable: Basic Python. (line 106)
  43577. * gdb.convenience_variable <1>: Basic Python. (line 106)
  43578. * gdb.current_objfile: Objfiles In Python. (line 15)
  43579. * gdb.current_objfile <1>: Objfiles In Python. (line 15)
  43580. * gdb.current_progspace: Progspaces In Python.
  43581. (line 14)
  43582. * gdb.current_progspace <1>: Progspaces In Python.
  43583. (line 14)
  43584. * gdb.current_recording: Recordings In Python.
  43585. (line 21)
  43586. * gdb.decode_line: Basic Python. (line 229)
  43587. * gdb.decode_line <1>: Basic Python. (line 229)
  43588. * gdb.default_visualizer: Pretty Printing API. (line 96)
  43589. * gdb.default_visualizer <1>: Pretty Printing API. (line 96)
  43590. * gdb.error: Exception Handling. (line 22)
  43591. * gdb.execute: Basic Python. (line 40)
  43592. * gdb.execute <1>: Basic Python. (line 40)
  43593. * gdb.find_pc_line: Basic Python. (line 132)
  43594. * gdb.find_pc_line <1>: Basic Python. (line 132)
  43595. * gdb.FinishBreakpoint: Finish Breakpoints in Python.
  43596. (line 6)
  43597. * gdb.flush: Basic Python. (line 193)
  43598. * gdb.flush <1>: Basic Python. (line 193)
  43599. * gdb.FrameDecorator: Frame Decorator API. (line 25)
  43600. * gdb.frame_stop_reason_string: Frames In Python. (line 29)
  43601. * gdb.Function: Functions In Python. (line 6)
  43602. * gdb.GdbError: Exception Handling. (line 48)
  43603. * gdb.history: Basic Python. (line 93)
  43604. * gdb.history <1>: Basic Python. (line 93)
  43605. * gdb.Inferior: Inferiors In Python. (line 6)
  43606. * gdb.InferiorCallPostEvent: Events In Python. (line 145)
  43607. * gdb.InferiorCallPreEvent: Events In Python. (line 135)
  43608. * gdb.inferiors: Inferiors In Python. (line 14)
  43609. * gdb.InferiorThread: Threads In Python. (line 6)
  43610. * gdb.invalidate_cached_frames: Frames In Python. (line 34)
  43611. * gdb.invalidate_cached_frames <1>: Frames In Python. (line 34)
  43612. * gdb.LazyString: Lazy Strings In Python.
  43613. (line 6)
  43614. * gdb.LineTable: Line Tables In Python.
  43615. (line 6)
  43616. * gdb.lookup_global_symbol: Symbols In Python. (line 33)
  43617. * gdb.lookup_global_symbol <1>: Symbols In Python. (line 33)
  43618. * gdb.lookup_objfile: Objfiles In Python. (line 28)
  43619. * gdb.lookup_objfile <1>: Objfiles In Python. (line 28)
  43620. * gdb.lookup_static_symbol: Symbols In Python. (line 45)
  43621. * gdb.lookup_static_symbol <1>: Symbols In Python. (line 45)
  43622. * gdb.lookup_static_symbols: Symbols In Python. (line 71)
  43623. * gdb.lookup_static_symbols <1>: Symbols In Python. (line 71)
  43624. * gdb.lookup_symbol: Symbols In Python. (line 13)
  43625. * gdb.lookup_symbol <1>: Symbols In Python. (line 13)
  43626. * gdb.lookup_type: Types In Python. (line 11)
  43627. * gdb.lookup_type <1>: Types In Python. (line 11)
  43628. * gdb.MemoryError: Exception Handling. (line 30)
  43629. * gdb.newest_frame: Frames In Python. (line 26)
  43630. * gdb.newest_frame <1>: Frames In Python. (line 26)
  43631. * gdb.Objfile: Objfiles In Python. (line 6)
  43632. * gdb.objfiles: Objfiles In Python. (line 21)
  43633. * gdb.objfiles <1>: Objfiles In Python. (line 21)
  43634. * gdb.Parameter: Parameters In Python.
  43635. (line 6)
  43636. * gdb.parameter: Basic Python. (line 82)
  43637. * gdb.parameter <1>: Basic Python. (line 82)
  43638. * gdb.PARAM_AUTO_BOOLEAN: Parameters In Python.
  43639. (line 116)
  43640. * gdb.PARAM_BOOLEAN: Parameters In Python.
  43641. (line 112)
  43642. * gdb.PARAM_ENUM: Parameters In Python.
  43643. (line 160)
  43644. * gdb.PARAM_FILENAME: Parameters In Python.
  43645. (line 142)
  43646. * gdb.PARAM_INTEGER: Parameters In Python.
  43647. (line 125)
  43648. * gdb.PARAM_OPTIONAL_FILENAME: Parameters In Python.
  43649. (line 139)
  43650. * gdb.PARAM_STRING: Parameters In Python.
  43651. (line 129)
  43652. * gdb.PARAM_STRING_NOESCAPE: Parameters In Python.
  43653. (line 135)
  43654. * gdb.PARAM_UINTEGER: Parameters In Python.
  43655. (line 121)
  43656. * gdb.PARAM_ZINTEGER: Parameters In Python.
  43657. (line 146)
  43658. * gdb.PARAM_ZUINTEGER: Parameters In Python.
  43659. (line 150)
  43660. * gdb.PARAM_ZUINTEGER_UNLIMITED: Parameters In Python.
  43661. (line 155)
  43662. * gdb.parse_and_eval: Basic Python. (line 122)
  43663. * gdb.parse_and_eval <1>: Basic Python. (line 122)
  43664. * gdb.post_event: Basic Python. (line 141)
  43665. * gdb.post_event <1>: Basic Python. (line 141)
  43666. * gdb.pretty_printers: Selecting Pretty-Printers.
  43667. (line 12)
  43668. * gdb.pretty_printers <1>: Selecting Pretty-Printers.
  43669. (line 12)
  43670. * gdb.Progspace: Progspaces In Python.
  43671. (line 6)
  43672. * gdb.progspaces: Progspaces In Python.
  43673. (line 20)
  43674. * gdb.progspaces <1>: Progspaces In Python.
  43675. (line 20)
  43676. * gdb.prompt_hook: Basic Python. (line 241)
  43677. * gdb.PYTHONDIR: Basic Python. (line 37)
  43678. * gdb.PYTHONDIR <1>: Basic Python. (line 37)
  43679. * gdb.rbreak: Basic Python. (line 66)
  43680. * gdb.search_memory: Inferiors In Python. (line 71)
  43681. * gdb.selected_frame: Frames In Python. (line 22)
  43682. * gdb.selected_frame <1>: Frames In Python. (line 22)
  43683. * gdb.selected_inferior: Inferiors In Python. (line 17)
  43684. * gdb.selected_thread: Threads In Python. (line 13)
  43685. * gdb.selected_thread <1>: Threads In Python. (line 13)
  43686. * gdb.set_convenience_variable: Basic Python. (line 113)
  43687. * gdb.set_convenience_variable <1>: Basic Python. (line 113)
  43688. * gdb.solib_name: Basic Python. (line 223)
  43689. * gdb.solib_name <1>: Basic Python. (line 223)
  43690. * gdb.start_recording: Recordings In Python.
  43691. (line 9)
  43692. * gdb.STDERR: Basic Python. (line 183)
  43693. * gdb.STDERR <1>: Basic Python. (line 203)
  43694. * gdb.STDLOG: Basic Python. (line 186)
  43695. * gdb.STDLOG <1>: Basic Python. (line 206)
  43696. * gdb.STDOUT: Basic Python. (line 180)
  43697. * gdb.STDOUT <1>: Basic Python. (line 200)
  43698. * gdb.stop_recording: Recordings In Python.
  43699. (line 25)
  43700. * gdb.string_to_argv: Commands In Python. (line 61)
  43701. * gdb.Symbol: Symbols In Python. (line 6)
  43702. * gdb.SYMBOL_COMMON_BLOCK_DOMAIN: Symbols In Python. (line 178)
  43703. * gdb.SYMBOL_LABEL_DOMAIN: Symbols In Python. (line 172)
  43704. * gdb.SYMBOL_LOC_ARG: Symbols In Python. (line 197)
  43705. * gdb.SYMBOL_LOC_BLOCK: Symbols In Python. (line 218)
  43706. * gdb.SYMBOL_LOC_COMPUTED: Symbols In Python. (line 232)
  43707. * gdb.SYMBOL_LOC_COMPUTED <1>: Symbols In Python. (line 235)
  43708. * gdb.SYMBOL_LOC_CONST: Symbols In Python. (line 188)
  43709. * gdb.SYMBOL_LOC_CONST_BYTES: Symbols In Python. (line 221)
  43710. * gdb.SYMBOL_LOC_LOCAL: Symbols In Python. (line 211)
  43711. * gdb.SYMBOL_LOC_OPTIMIZED_OUT: Symbols In Python. (line 229)
  43712. * gdb.SYMBOL_LOC_REF_ARG: Symbols In Python. (line 201)
  43713. * gdb.SYMBOL_LOC_REGISTER: Symbols In Python. (line 194)
  43714. * gdb.SYMBOL_LOC_REGPARM_ADDR: Symbols In Python. (line 206)
  43715. * gdb.SYMBOL_LOC_STATIC: Symbols In Python. (line 191)
  43716. * gdb.SYMBOL_LOC_TYPEDEF: Symbols In Python. (line 214)
  43717. * gdb.SYMBOL_LOC_UNDEF: Symbols In Python. (line 184)
  43718. * gdb.SYMBOL_LOC_UNRESOLVED: Symbols In Python. (line 224)
  43719. * gdb.SYMBOL_MODULE_DOMAIN: Symbols In Python. (line 175)
  43720. * gdb.SYMBOL_STRUCT_DOMAIN: Symbols In Python. (line 169)
  43721. * gdb.SYMBOL_UNDEF_DOMAIN: Symbols In Python. (line 160)
  43722. * gdb.SYMBOL_VAR_DOMAIN: Symbols In Python. (line 165)
  43723. * gdb.Symtab: Symbol Tables In Python.
  43724. (line 6)
  43725. * gdb.Symtab_and_line: Symbol Tables In Python.
  43726. (line 6)
  43727. * gdb.target_charset: Basic Python. (line 212)
  43728. * gdb.target_charset <1>: Basic Python. (line 212)
  43729. * gdb.target_wide_charset: Basic Python. (line 217)
  43730. * gdb.target_wide_charset <1>: Basic Python. (line 217)
  43731. * gdb.Type: Types In Python. (line 6)
  43732. * gdb.TYPE_CODE_ARRAY: Types In Python. (line 202)
  43733. * gdb.TYPE_CODE_BITSTRING: Types In Python. (line 240)
  43734. * gdb.TYPE_CODE_BOOL: Types In Python. (line 264)
  43735. * gdb.TYPE_CODE_CHAR: Types In Python. (line 261)
  43736. * gdb.TYPE_CODE_COMPLEX: Types In Python. (line 267)
  43737. * gdb.TYPE_CODE_DECFLOAT: Types In Python. (line 276)
  43738. * gdb.TYPE_CODE_ENUM: Types In Python. (line 211)
  43739. * gdb.TYPE_CODE_ERROR: Types In Python. (line 243)
  43740. * gdb.TYPE_CODE_FLAGS: Types In Python. (line 214)
  43741. * gdb.TYPE_CODE_FLT: Types In Python. (line 223)
  43742. * gdb.TYPE_CODE_FUNC: Types In Python. (line 217)
  43743. * gdb.TYPE_CODE_INT: Types In Python. (line 220)
  43744. * gdb.TYPE_CODE_INTERNAL_FUNCTION: Types In Python. (line 279)
  43745. * gdb.TYPE_CODE_MEMBERPTR: Types In Python. (line 252)
  43746. * gdb.TYPE_CODE_METHOD: Types In Python. (line 246)
  43747. * gdb.TYPE_CODE_METHODPTR: Types In Python. (line 249)
  43748. * gdb.TYPE_CODE_NAMESPACE: Types In Python. (line 273)
  43749. * gdb.TYPE_CODE_PTR: Types In Python. (line 199)
  43750. * gdb.TYPE_CODE_RANGE: Types In Python. (line 232)
  43751. * gdb.TYPE_CODE_REF: Types In Python. (line 255)
  43752. * gdb.TYPE_CODE_RVALUE_REF: Types In Python. (line 258)
  43753. * gdb.TYPE_CODE_SET: Types In Python. (line 229)
  43754. * gdb.TYPE_CODE_STRING: Types In Python. (line 235)
  43755. * gdb.TYPE_CODE_STRUCT: Types In Python. (line 205)
  43756. * gdb.TYPE_CODE_TYPEDEF: Types In Python. (line 270)
  43757. * gdb.TYPE_CODE_UNION: Types In Python. (line 208)
  43758. * gdb.TYPE_CODE_VOID: Types In Python. (line 226)
  43759. * gdb.unwinder.register_unwinder: Unwinding Frames in Python.
  43760. (line 157)
  43761. * gdb.UnwindInfo.add_saved_register: Unwinding Frames in Python.
  43762. (line 107)
  43763. * gdb.WP_ACCESS: Breakpoints In Python.
  43764. (line 86)
  43765. * gdb.WP_READ: Breakpoints In Python.
  43766. (line 80)
  43767. * gdb.WP_WRITE: Breakpoints In Python.
  43768. (line 83)
  43769. * gdb.write: Basic Python. (line 175)
  43770. * gdb.write <1>: Basic Python. (line 175)
  43771. * gdb:error: Guile Exception Handling.
  43772. (line 69)
  43773. * gdb:invalid-object: Guile Exception Handling.
  43774. (line 72)
  43775. * gdb:memory-error: Guile Exception Handling.
  43776. (line 80)
  43777. * gdb:pp-type-error: Guile Exception Handling.
  43778. (line 84)
  43779. * gdbserver: Server. (line 6)
  43780. * gdb_init_reader: Writing JIT Debug Info Readers.
  43781. (line 20)
  43782. * generate-core-file: Core File Generation.
  43783. (line 17)
  43784. * get-basic-type: Guile Types Module. (line 13)
  43785. * getDebugChar: Bootstrapping. (line 14)
  43786. * gnu_debuglink_crc32: Separate Debug Files.
  43787. (line 163)
  43788. * gr: Guile Commands. (line 8)
  43789. * gu: Guile Commands. (line 15)
  43790. * guile: Guile Commands. (line 15)
  43791. * guile-data-directory: Guile Configuration. (line 13)
  43792. * guile-repl: Guile Commands. (line 8)
  43793. * h (help): Help. (line 9)
  43794. * handle: Signals. (line 49)
  43795. * handle_exception: Stub Contents. (line 15)
  43796. * hbreak: Set Breaks. (line 61)
  43797. * help: Help. (line 6)
  43798. * help function: Convenience Funs. (line 228)
  43799. * help target: Target Commands. (line 19)
  43800. * help user-defined: Define. (line 116)
  43801. * history-append!: Basic Guile. (line 105)
  43802. * history-preserve-point: Readline Init File Syntax.
  43803. (line 162)
  43804. * history-ref: Basic Guile. (line 87)
  43805. * history-search-backward (): Commands For History.
  43806. (line 52)
  43807. * history-search-forward (): Commands For History.
  43808. (line 46)
  43809. * history-size: Readline Init File Syntax.
  43810. (line 168)
  43811. * history-substring-search-backward (): Commands For History.
  43812. (line 64)
  43813. * history-substring-search-forward (): Commands For History.
  43814. (line 58)
  43815. * hook: Hooks. (line 6)
  43816. * hookpost: Hooks. (line 11)
  43817. * horizontal-scroll-mode: Readline Init File Syntax.
  43818. (line 177)
  43819. * host-config: Guile Configuration. (line 20)
  43820. * i (info): Help. (line 120)
  43821. * i (SingleKey TUI key): TUI Single Key Mode. (line 34)
  43822. * if: Command Files. (line 74)
  43823. * ignore: Conditions. (line 90)
  43824. * inferior INFNO: Inferiors and Programs.
  43825. (line 51)
  43826. * Inferior.architecture: Inferiors In Python. (line 50)
  43827. * Inferior.is_valid: Inferiors In Python. (line 38)
  43828. * Inferior.num: Inferiors In Python. (line 22)
  43829. * Inferior.pid: Inferiors In Python. (line 25)
  43830. * Inferior.progspace: Inferiors In Python. (line 33)
  43831. * Inferior.read_memory: Inferiors In Python. (line 57)
  43832. * Inferior.read_memory <1>: Inferiors In Python. (line 57)
  43833. * Inferior.search_memory: Inferiors In Python. (line 71)
  43834. * Inferior.threads: Inferiors In Python. (line 45)
  43835. * Inferior.thread_from_handle: Inferiors In Python. (line 80)
  43836. * Inferior.thread_from_handle <1>: Inferiors In Python. (line 80)
  43837. * Inferior.thread_from_thread_handle: Inferiors In Python. (line 80)
  43838. * Inferior.was_attached: Inferiors In Python. (line 29)
  43839. * Inferior.write_memory: Inferiors In Python. (line 64)
  43840. * Inferior.write_memory <1>: Inferiors In Python. (line 64)
  43841. * InferiorCallPostEvent.address: Events In Python. (line 152)
  43842. * InferiorCallPostEvent.ptid: Events In Python. (line 149)
  43843. * InferiorCallPreEvent.address: Events In Python. (line 142)
  43844. * InferiorCallPreEvent.ptid: Events In Python. (line 139)
  43845. * InferiorThread.global_num: Threads In Python. (line 35)
  43846. * InferiorThread.handle: Threads In Python. (line 74)
  43847. * InferiorThread.inferior: Threads In Python. (line 48)
  43848. * InferiorThread.is_exited: Threads In Python. (line 71)
  43849. * InferiorThread.is_running: Threads In Python. (line 68)
  43850. * InferiorThread.is_stopped: Threads In Python. (line 65)
  43851. * InferiorThread.is_valid: Threads In Python. (line 54)
  43852. * InferiorThread.name: Threads In Python. (line 22)
  43853. * InferiorThread.num: Threads In Python. (line 32)
  43854. * InferiorThread.ptid: Threads In Python. (line 40)
  43855. * InferiorThread.switch: Threads In Python. (line 61)
  43856. * info: Help. (line 120)
  43857. * info address: Symbols. (line 85)
  43858. * info all-registers: Registers. (line 15)
  43859. * info args: Frame Info. (line 43)
  43860. * info auto-load: Auto-loading. (line 60)
  43861. * info auto-load gdb-scripts: Auto-loading sequences.
  43862. (line 21)
  43863. * info auto-load guile-scripts: Guile Auto-loading. (line 23)
  43864. * info auto-load libthread-db: libthread_db.so.1 file.
  43865. (line 29)
  43866. * info auto-load local-gdbinit: Init File in the Current Directory.
  43867. (line 22)
  43868. * info auto-load python-scripts: Python Auto-loading. (line 23)
  43869. * info auxv: OS Information. (line 20)
  43870. * info breakpoints: Set Breaks. (line 133)
  43871. * info checkpoints: Checkpoint/Restart. (line 31)
  43872. * info classes: Symbols. (line 570)
  43873. * info common: Special Fortran Commands.
  43874. (line 9)
  43875. * info copying: Help. (line 158)
  43876. * info dcache: Caching Target Data. (line 46)
  43877. * info display: Auto Display. (line 78)
  43878. * info dll: Files. (line 336)
  43879. * info dos: DJGPP Native. (line 15)
  43880. * info exceptions: Ada Exceptions. (line 8)
  43881. * info extensions: Show. (line 34)
  43882. * info f (info frame): Frame Info. (line 17)
  43883. * info files: Files. (line 211)
  43884. * info float: Floating Point Hardware.
  43885. (line 9)
  43886. * info frame: Frame Info. (line 17)
  43887. * info frame, show the source language: Show. (line 15)
  43888. * info frame-filter: Frame Filter Management.
  43889. (line 12)
  43890. * info functions: Symbols. (line 467)
  43891. * info handle: Signals. (line 33)
  43892. * info inferiors [ ID... ]: Inferiors and Programs.
  43893. (line 25)
  43894. * info io_registers, AVR: AVR. (line 10)
  43895. * info line: Machine Code. (line 14)
  43896. * info line, and Objective-C: Method Names in Commands.
  43897. (line 9)
  43898. * info locals: Frame Info. (line 67)
  43899. * info macro: Macros. (line 47)
  43900. * info macros: Macros. (line 54)
  43901. * info mem: Memory Region Attributes.
  43902. (line 45)
  43903. * info meminfo: Process Information. (line 130)
  43904. * info module: Symbols. (line 555)
  43905. * info modules: Symbols. (line 547)
  43906. * info os: OS Information. (line 37)
  43907. * info os cpus: OS Information. (line 43)
  43908. * info os files: OS Information. (line 51)
  43909. * info os modules: OS Information. (line 57)
  43910. * info os msg: OS Information. (line 64)
  43911. * info os processes: OS Information. (line 75)
  43912. * info os procgroups: OS Information. (line 84)
  43913. * info os semaphores: OS Information. (line 94)
  43914. * info os shm: OS Information. (line 102)
  43915. * info os sockets: OS Information. (line 112)
  43916. * info os threads: OS Information. (line 119)
  43917. * info pidlist: Process Information. (line 126)
  43918. * info pretty-printer: Pretty-Printer Commands.
  43919. (line 6)
  43920. * info probes: Static Probe Points. (line 32)
  43921. * info proc: Process Information. (line 25)
  43922. * info program: Stopping. (line 18)
  43923. * info record: Process Record and Replay.
  43924. (line 323)
  43925. * info registers: Registers. (line 11)
  43926. * info scope: Symbols. (line 415)
  43927. * info selectors: Symbols. (line 576)
  43928. * info serial: DJGPP Native. (line 139)
  43929. * info set: Help. (line 141)
  43930. * info share: Files. (line 330)
  43931. * info sharedlibrary: Files. (line 330)
  43932. * info signals: Signals. (line 33)
  43933. * info skip: Skipping Over Functions and Files.
  43934. (line 113)
  43935. * info source: Symbols. (line 436)
  43936. * info source, show the source language: Show. (line 21)
  43937. * info sources: Symbols. (line 452)
  43938. * info stack: Backtrace. (line 94)
  43939. * info static-tracepoint-markers: Listing Static Tracepoint Markers.
  43940. (line 6)
  43941. * info symbol: Symbols. (line 95)
  43942. * info target: Files. (line 211)
  43943. * info task TASKNO: Ada Tasks. (line 88)
  43944. * info tasks: Ada Tasks. (line 9)
  43945. * info terminal: Input/Output. (line 12)
  43946. * info threads: Threads. (line 115)
  43947. * info tp [N...]: Listing Tracepoints. (line 6)
  43948. * info tracepoints [N...]: Listing Tracepoints. (line 6)
  43949. * info tvariables: Trace State Variables.
  43950. (line 37)
  43951. * info type-printers: Symbols. (line 403)
  43952. * info types: Symbols. (line 378)
  43953. * info variables: Symbols. (line 512)
  43954. * info vector: Vector Unit. (line 9)
  43955. * info w32: Cygwin Native. (line 19)
  43956. * info warranty: Help. (line 162)
  43957. * info watchpoints [LIST...]: Set Watchpoints. (line 87)
  43958. * info win: TUI Commands. (line 26)
  43959. * info-gdb-mi-command: GDB/MI Support Commands.
  43960. (line 99)
  43961. * init-if-undefined: Convenience Vars. (line 42)
  43962. * input-meta: Readline Init File Syntax.
  43963. (line 184)
  43964. * input-port: I/O Ports in Guile. (line 6)
  43965. * insert-comment (M-#): Miscellaneous Commands.
  43966. (line 61)
  43967. * insert-completions (M-*): Commands For Completion.
  43968. (line 18)
  43969. * inspect: Data. (line 6)
  43970. * instantiate on type_printer: Type Printing API. (line 22)
  43971. * Instruction.data: Recordings In Python.
  43972. (line 69)
  43973. * Instruction.decoded: Recordings In Python.
  43974. (line 73)
  43975. * Instruction.pc: Recordings In Python.
  43976. (line 66)
  43977. * Instruction.size: Recordings In Python.
  43978. (line 76)
  43979. * interpreter-exec: Interpreters. (line 39)
  43980. * interrupt: Background Execution.
  43981. (line 59)
  43982. * isearch-terminators: Readline Init File Syntax.
  43983. (line 192)
  43984. * iterator->list: Iterators In Guile. (line 83)
  43985. * iterator-filter: Iterators In Guile. (line 94)
  43986. * iterator-for-each: Iterators In Guile. (line 90)
  43987. * iterator-map: Iterators In Guile. (line 86)
  43988. * iterator-next!: Iterators In Guile. (line 63)
  43989. * iterator-object: Iterators In Guile. (line 53)
  43990. * iterator-progress: Iterators In Guile. (line 57)
  43991. * iterator-until: Iterators In Guile. (line 98)
  43992. * iterator?: Iterators In Guile. (line 49)
  43993. * j (jump): Jumping. (line 10)
  43994. * jit-reader-load: Using JIT Debug Info Readers.
  43995. (line 6)
  43996. * jit-reader-unload: Using JIT Debug Info Readers.
  43997. (line 6)
  43998. * jump: Jumping. (line 10)
  43999. * jump, and Objective-C: Method Names in Commands.
  44000. (line 9)
  44001. * KeyboardInterrupt: Exception Handling. (line 34)
  44002. * keymap: Readline Init File Syntax.
  44003. (line 199)
  44004. * kill: Kill Process. (line 6)
  44005. * kill inferiors INFNO...: Inferiors and Programs.
  44006. (line 111)
  44007. * kill-line (C-k): Commands For Killing.
  44008. (line 6)
  44009. * kill-region (): Commands For Killing.
  44010. (line 41)
  44011. * kill-whole-line (): Commands For Killing.
  44012. (line 15)
  44013. * kill-word (M-d): Commands For Killing.
  44014. (line 19)
  44015. * kvm: BSD libkvm Interface.
  44016. (line 24)
  44017. * l (list): List. (line 6)
  44018. * language-option: GDB/MI Support Commands.
  44019. (line 96)
  44020. * layout: TUI Commands. (line 29)
  44021. * lazy-string->value: Lazy Strings In Guile.
  44022. (line 46)
  44023. * lazy-string-address: Lazy Strings In Guile.
  44024. (line 26)
  44025. * lazy-string-encoding: Lazy Strings In Guile.
  44026. (line 34)
  44027. * lazy-string-length: Lazy Strings In Guile.
  44028. (line 29)
  44029. * lazy-string-type: Lazy Strings In Guile.
  44030. (line 40)
  44031. * lazy-string?: Lazy Strings In Guile.
  44032. (line 22)
  44033. * LazyString.address: Lazy Strings In Python.
  44034. (line 26)
  44035. * LazyString.encoding: Lazy Strings In Python.
  44036. (line 36)
  44037. * LazyString.length: Lazy Strings In Python.
  44038. (line 30)
  44039. * LazyString.type: Lazy Strings In Python.
  44040. (line 43)
  44041. * LazyString.value: Lazy Strings In Python.
  44042. (line 20)
  44043. * Left: TUI Keys. (line 73)
  44044. * LineTable.has_line: Line Tables In Python.
  44045. (line 57)
  44046. * LineTable.line: Line Tables In Python.
  44047. (line 51)
  44048. * LineTable.source_lines: Line Tables In Python.
  44049. (line 62)
  44050. * LineTableEntry.line: Line Tables In Python.
  44051. (line 16)
  44052. * LineTableEntry.pc: Line Tables In Python.
  44053. (line 21)
  44054. * list: List. (line 6)
  44055. * list, and Objective-C: Method Names in Commands.
  44056. (line 9)
  44057. * load FILENAME OFFSET: Target Commands. (line 114)
  44058. * lookup-block: Blocks In Guile. (line 117)
  44059. * lookup-global-symbol: Symbols In Guile. (line 99)
  44060. * lookup-symbol: Symbols In Guile. (line 79)
  44061. * lookup-type: Types In Guile. (line 15)
  44062. * loop_break: Command Files. (line 93)
  44063. * loop_continue: Command Files. (line 97)
  44064. * macro define: Macros. (line 59)
  44065. * macro exp1: Macros. (line 36)
  44066. * macro expand: Macros. (line 29)
  44067. * macro list: Macros. (line 80)
  44068. * macro undef: Macros. (line 74)
  44069. * maint ada set ignore-descriptive-types: Ada Glitches. (line 73)
  44070. * maint ada show ignore-descriptive-types: Ada Glitches. (line 77)
  44071. * maint agent: Maintenance Commands.
  44072. (line 11)
  44073. * maint agent-eval: Maintenance Commands.
  44074. (line 11)
  44075. * maint agent-printf: Maintenance Commands.
  44076. (line 26)
  44077. * maint btrace clear: Maintenance Commands.
  44078. (line 99)
  44079. * maint btrace clear-packet-history: Maintenance Commands.
  44080. (line 94)
  44081. * maint btrace packet-history: Maintenance Commands.
  44082. (line 65)
  44083. * maint check libthread-db: Maintenance Commands.
  44084. (line 244)
  44085. * maint check xml-descriptions: Maintenance Commands.
  44086. (line 240)
  44087. * maint check-psymtabs: Maintenance Commands.
  44088. (line 134)
  44089. * maint check-symtabs: Maintenance Commands.
  44090. (line 139)
  44091. * maint cplus first_component: Maintenance Commands.
  44092. (line 154)
  44093. * maint cplus namespace: Maintenance Commands.
  44094. (line 157)
  44095. * maint demangler-warning: Maintenance Commands.
  44096. (line 173)
  44097. * maint deprecate: Maintenance Commands.
  44098. (line 160)
  44099. * maint dump-me: Maintenance Commands.
  44100. (line 168)
  44101. * maint expand-symtabs: Maintenance Commands.
  44102. (line 142)
  44103. * maint flush-symbol-cache: Symbols. (line 714)
  44104. * maint info bdccsr, S12Z: S12Z. (line 10)
  44105. * maint info bfds: File Caching. (line 10)
  44106. * maint info breakpoints: Maintenance Commands.
  44107. (line 32)
  44108. * maint info btrace: Maintenance Commands.
  44109. (line 62)
  44110. * maint info line-table: Symbols. (line 692)
  44111. * maint info program-spaces: Inferiors and Programs.
  44112. (line 148)
  44113. * maint info psymtabs: Symbols. (line 645)
  44114. * maint info sections: Files. (line 220)
  44115. * maint info selftests: Maintenance Commands.
  44116. (line 366)
  44117. * maint info sol-threads: Threads. (line 167)
  44118. * maint info symtabs: Symbols. (line 645)
  44119. * maint internal-error: Maintenance Commands.
  44120. (line 173)
  44121. * maint internal-warning: Maintenance Commands.
  44122. (line 173)
  44123. * maint packet: Maintenance Commands.
  44124. (line 220)
  44125. * maint print arc arc-instruction: ARC. (line 17)
  44126. * maint print architecture: Maintenance Commands.
  44127. (line 226)
  44128. * maint print c-tdesc [FILE]: Maintenance Commands.
  44129. (line 230)
  44130. * maint print cooked-registers: Maintenance Commands.
  44131. (line 268)
  44132. * maint print dummy-frames: Maintenance Commands.
  44133. (line 252)
  44134. * maint print msymbols: Symbols. (line 619)
  44135. * maint print objfiles: Maintenance Commands.
  44136. (line 306)
  44137. * maint print psymbols: Symbols. (line 619)
  44138. * maint print raw-registers: Maintenance Commands.
  44139. (line 268)
  44140. * maint print reggroups: Maintenance Commands.
  44141. (line 287)
  44142. * maint print register-groups: Maintenance Commands.
  44143. (line 268)
  44144. * maint print registers: Maintenance Commands.
  44145. (line 268)
  44146. * maint print remote-registers: Maintenance Commands.
  44147. (line 268)
  44148. * maint print section-scripts: Maintenance Commands.
  44149. (line 321)
  44150. * maint print statistics: Maintenance Commands.
  44151. (line 328)
  44152. * maint print symbol-cache: Symbols. (line 706)
  44153. * maint print symbol-cache-statistics: Symbols. (line 710)
  44154. * maint print symbols: Symbols. (line 619)
  44155. * maint print target-stack: Maintenance Commands.
  44156. (line 341)
  44157. * maint print type: Maintenance Commands.
  44158. (line 353)
  44159. * maint print unwind, HPPA: HPPA. (line 17)
  44160. * maint print user-registers: Maintenance Commands.
  44161. (line 312)
  44162. * maint selftest: Maintenance Commands.
  44163. (line 360)
  44164. * maint set bfd-sharing: File Caching. (line 14)
  44165. * maint set btrace pt skip-pad: Maintenance Commands.
  44166. (line 107)
  44167. * maint set catch-demangler-crashes: Maintenance Commands.
  44168. (line 146)
  44169. * maint set check-libthread-db: Maintenance Commands.
  44170. (line 546)
  44171. * maint set demangler-warning: Maintenance Commands.
  44172. (line 197)
  44173. * maint set dwarf always-disassemble: Maintenance Commands.
  44174. (line 369)
  44175. * maint set dwarf max-cache-age: Maintenance Commands.
  44176. (line 390)
  44177. * maint set dwarf unwinders: Maintenance Commands.
  44178. (line 404)
  44179. * maint set internal-error: Maintenance Commands.
  44180. (line 197)
  44181. * maint set internal-warning: Maintenance Commands.
  44182. (line 197)
  44183. * maint set per-command: Maintenance Commands.
  44184. (line 507)
  44185. * maint set profile: Maintenance Commands.
  44186. (line 438)
  44187. * maint set show-all-tib: Maintenance Commands.
  44188. (line 462)
  44189. * maint set show-debug-regs: Maintenance Commands.
  44190. (line 454)
  44191. * maint set symbol-cache-size: Symbols. (line 698)
  44192. * maint set target-async: Maintenance Commands.
  44193. (line 468)
  44194. * maint set target-non-stop MODE [on|off|auto]: Maintenance Commands.
  44195. (line 476)
  44196. * maint set test-settings: Maintenance Commands.
  44197. (line 595)
  44198. * maint set tui-resize-message: Maintenance Commands.
  44199. (line 496)
  44200. * maint set worker-threads: Maintenance Commands.
  44201. (line 427)
  44202. * maint show bfd-sharing: File Caching. (line 14)
  44203. * maint show btrace pt skip-pad: Maintenance Commands.
  44204. (line 108)
  44205. * maint show catch-demangler-crashes: Maintenance Commands.
  44206. (line 146)
  44207. * maint show check-libthread-db: Maintenance Commands.
  44208. (line 546)
  44209. * maint show demangler-warning: Maintenance Commands.
  44210. (line 197)
  44211. * maint show dwarf always-disassemble: Maintenance Commands.
  44212. (line 369)
  44213. * maint show dwarf max-cache-age: Maintenance Commands.
  44214. (line 390)
  44215. * maint show dwarf unwinders: Maintenance Commands.
  44216. (line 404)
  44217. * maint show internal-error: Maintenance Commands.
  44218. (line 197)
  44219. * maint show internal-warning: Maintenance Commands.
  44220. (line 197)
  44221. * maint show per-command: Maintenance Commands.
  44222. (line 507)
  44223. * maint show profile: Maintenance Commands.
  44224. (line 438)
  44225. * maint show show-all-tib: Maintenance Commands.
  44226. (line 462)
  44227. * maint show show-debug-regs: Maintenance Commands.
  44228. (line 454)
  44229. * maint show symbol-cache-size: Symbols. (line 703)
  44230. * maint show target-async: Maintenance Commands.
  44231. (line 468)
  44232. * maint show target-non-stop: Maintenance Commands.
  44233. (line 476)
  44234. * maint show test-options-completion-result: Maintenance Commands.
  44235. (line 590)
  44236. * maint show test-settings: Maintenance Commands.
  44237. (line 595)
  44238. * maint show tui-resize-message: Maintenance Commands.
  44239. (line 496)
  44240. * maint show worker-threads: Maintenance Commands.
  44241. (line 427)
  44242. * maint space: Maintenance Commands.
  44243. (line 555)
  44244. * maint test-options: Maintenance Commands.
  44245. (line 576)
  44246. * maint time: Maintenance Commands.
  44247. (line 559)
  44248. * maint translate-address: Maintenance Commands.
  44249. (line 563)
  44250. * maint undeprecate: Maintenance Commands.
  44251. (line 160)
  44252. * maint with: Maintenance Commands.
  44253. (line 601)
  44254. * make: Shell Commands. (line 21)
  44255. * make-block-symbols-iterator: Blocks In Guile. (line 105)
  44256. * make-breakpoint: Breakpoints In Guile.
  44257. (line 19)
  44258. * make-enum-hashtable: Guile Types Module. (line 37)
  44259. * make-exception: Guile Exception Handling.
  44260. (line 91)
  44261. * make-field-iterator: Types In Guile. (line 125)
  44262. * make-iterator: Iterators In Guile. (line 11)
  44263. * make-lazy-value: Values From Inferior In Guile.
  44264. (line 327)
  44265. * make-list-iterator: Iterators In Guile. (line 80)
  44266. * make-pretty-printer: Guile Pretty Printing API.
  44267. (line 15)
  44268. * make-pretty-printer-worker: Guile Pretty Printing API.
  44269. (line 42)
  44270. * make-value: Values From Inferior In Guile.
  44271. (line 45)
  44272. * mark-modified-lines: Readline Init File Syntax.
  44273. (line 229)
  44274. * mark-symlinked-directories: Readline Init File Syntax.
  44275. (line 234)
  44276. * match-hidden-files: Readline Init File Syntax.
  44277. (line 239)
  44278. * may-insert-breakpoints: Observer Mode. (line 50)
  44279. * may-insert-fast-tracepoints: Observer Mode. (line 69)
  44280. * may-insert-tracepoints: Observer Mode. (line 59)
  44281. * may-interrupt: Observer Mode. (line 79)
  44282. * may-write-memory: Observer Mode. (line 41)
  44283. * may-write-registers: Observer Mode. (line 32)
  44284. * mem: Memory Region Attributes.
  44285. (line 22)
  44286. * memory-port-range: Memory Ports in Guile.
  44287. (line 33)
  44288. * memory-port-read-buffer-size: Memory Ports in Guile.
  44289. (line 37)
  44290. * memory-port-write-buffer-size: Memory Ports in Guile.
  44291. (line 45)
  44292. * memory-port?: Memory Ports in Guile.
  44293. (line 29)
  44294. * MemoryChangedEvent.address: Events In Python. (line 162)
  44295. * MemoryChangedEvent.length: Events In Python. (line 165)
  44296. * memset: Bootstrapping. (line 70)
  44297. * menu-complete (): Commands For Completion.
  44298. (line 22)
  44299. * menu-complete-backward (): Commands For Completion.
  44300. (line 34)
  44301. * menu-complete-display-prefix: Readline Init File Syntax.
  44302. (line 246)
  44303. * meta-flag: Readline Init File Syntax.
  44304. (line 184)
  44305. * methods: Xmethod API. (line 22)
  44306. * monitor: Connecting. (line 272)
  44307. * n (next): Continuing and Stepping.
  44308. (line 77)
  44309. * n (SingleKey TUI key): TUI Single Key Mode. (line 19)
  44310. * name: Xmethod API. (line 15)
  44311. * name of type_printer: Type Printing API. (line 18)
  44312. * new-ui: Interpreters. (line 68)
  44313. * newest-frame: Frames In Guile. (line 160)
  44314. * NewInferiorEvent.inferior: Events In Python. (line 204)
  44315. * NewInferiorEvent.inferior <1>: Events In Python. (line 215)
  44316. * NewObjFileEvent.new_objfile: Events In Python. (line 115)
  44317. * NewThreadEvent.inferior_thread: Events In Python. (line 223)
  44318. * next: Continuing and Stepping.
  44319. (line 77)
  44320. * next&: Background Execution.
  44321. (line 34)
  44322. * next-history (C-n): Commands For History.
  44323. (line 16)
  44324. * next-screen-line (): Commands For Moving. (line 33)
  44325. * nexti: Continuing and Stepping.
  44326. (line 209)
  44327. * nexti&: Background Execution.
  44328. (line 37)
  44329. * ni (nexti): Continuing and Stepping.
  44330. (line 209)
  44331. * non-incremental-forward-search-history (M-n): Commands For History.
  44332. (line 40)
  44333. * non-incremental-reverse-search-history (M-p): Commands For History.
  44334. (line 34)
  44335. * nosharedlibrary: Files. (line 348)
  44336. * o (SingleKey TUI key): TUI Single Key Mode. (line 22)
  44337. * Objfile: Objfiles In Python. (line 6)
  44338. * objfile-filename: Objfiles In Guile. (line 28)
  44339. * objfile-pretty-printers: Objfiles In Guile. (line 36)
  44340. * objfile-progspace: Objfiles In Guile. (line 32)
  44341. * objfile-valid?: Objfiles In Guile. (line 21)
  44342. * Objfile.add_separate_debug_file: Objfiles In Python. (line 127)
  44343. * Objfile.build_id: Objfiles In Python. (line 69)
  44344. * Objfile.filename: Objfiles In Python. (line 49)
  44345. * Objfile.frame_filters: Objfiles In Python. (line 95)
  44346. * Objfile.is_valid: Objfiles In Python. (line 120)
  44347. * Objfile.lookup_global_symbol: Objfiles In Python. (line 136)
  44348. * Objfile.lookup_static_symbol: Objfiles In Python. (line 147)
  44349. * Objfile.owner: Objfiles In Python. (line 62)
  44350. * Objfile.pretty_printers: Objfiles In Python. (line 83)
  44351. * Objfile.progspace: Objfiles In Python. (line 79)
  44352. * Objfile.type_printers: Objfiles In Python. (line 91)
  44353. * Objfile.username: Objfiles In Python. (line 56)
  44354. * objfile?: Objfiles In Guile. (line 17)
  44355. * objfiles: Objfiles In Guile. (line 52)
  44356. * observer: Observer Mode. (line 22)
  44357. * open-memory: Memory Ports in Guile.
  44358. (line 11)
  44359. * output: Output. (line 35)
  44360. * output-meta: Readline Init File Syntax.
  44361. (line 251)
  44362. * output-port: I/O Ports in Guile. (line 9)
  44363. * overlay: Overlay Commands. (line 17)
  44364. * overload-choice annotation: Prompting. (line 32)
  44365. * overwrite-mode (): Commands For Text. (line 68)
  44366. * page-completions: Readline Init File Syntax.
  44367. (line 257)
  44368. * Parameter: Parameters In Python.
  44369. (line 6)
  44370. * Parameter <1>: Parameters In Guile. (line 6)
  44371. * parameter-value: Parameters In Guile. (line 103)
  44372. * Parameter.get_set_string: Parameters In Python.
  44373. (line 73)
  44374. * Parameter.get_show_string: Parameters In Python.
  44375. (line 102)
  44376. * Parameter.set_doc: Parameters In Python.
  44377. (line 53)
  44378. * Parameter.show_doc: Parameters In Python.
  44379. (line 59)
  44380. * Parameter.value: Parameters In Python.
  44381. (line 65)
  44382. * Parameter.__init__: Parameters In Python.
  44383. (line 18)
  44384. * parameter?: Parameters In Guile. (line 99)
  44385. * PARAM_AUTO_BOOLEAN: Parameters In Python.
  44386. (line 116)
  44387. * PARAM_AUTO_BOOLEAN <1>: Parameters In Guile. (line 120)
  44388. * PARAM_BOOLEAN: Parameters In Python.
  44389. (line 112)
  44390. * PARAM_BOOLEAN <1>: Parameters In Guile. (line 116)
  44391. * PARAM_ENUM: Parameters In Python.
  44392. (line 160)
  44393. * PARAM_ENUM <1>: Parameters In Guile. (line 156)
  44394. * PARAM_FILENAME: Parameters In Python.
  44395. (line 142)
  44396. * PARAM_FILENAME <1>: Parameters In Guile. (line 152)
  44397. * PARAM_INTEGER: Parameters In Python.
  44398. (line 125)
  44399. * PARAM_OPTIONAL_FILENAME: Parameters In Python.
  44400. (line 139)
  44401. * PARAM_OPTIONAL_FILENAME <1>: Parameters In Guile. (line 149)
  44402. * PARAM_STRING: Parameters In Python.
  44403. (line 129)
  44404. * PARAM_STRING <1>: Parameters In Guile. (line 139)
  44405. * PARAM_STRING_NOESCAPE: Parameters In Python.
  44406. (line 135)
  44407. * PARAM_STRING_NOESCAPE <1>: Parameters In Guile. (line 145)
  44408. * PARAM_UINTEGER: Parameters In Python.
  44409. (line 121)
  44410. * PARAM_UINTEGER <1>: Parameters In Guile. (line 125)
  44411. * PARAM_ZINTEGER: Parameters In Python.
  44412. (line 146)
  44413. * PARAM_ZINTEGER <1>: Parameters In Guile. (line 129)
  44414. * PARAM_ZUINTEGER: Parameters In Python.
  44415. (line 150)
  44416. * PARAM_ZUINTEGER <1>: Parameters In Guile. (line 132)
  44417. * PARAM_ZUINTEGER_UNLIMITED: Parameters In Python.
  44418. (line 155)
  44419. * PARAM_ZUINTEGER_UNLIMITED <1>: Parameters In Guile. (line 135)
  44420. * parse-and-eval: Basic Guile. (line 113)
  44421. * passcount: Tracepoint Passcounts.
  44422. (line 6)
  44423. * path: Environment. (line 14)
  44424. * pending-breakpoints: GDB/MI Support Commands.
  44425. (line 79)
  44426. * PendingFrame.create_unwind_info: Unwinding Frames in Python.
  44427. (line 67)
  44428. * PendingFrame.read_register: Unwinding Frames in Python.
  44429. (line 42)
  44430. * PgDn: TUI Keys. (line 64)
  44431. * PgUp: TUI Keys. (line 61)
  44432. * pi: Python Commands. (line 9)
  44433. * pipe: Shell Commands. (line 25)
  44434. * po (print-object): The Print Command with Objective-C.
  44435. (line 6)
  44436. * possible-completions (M-?): Commands For Completion.
  44437. (line 11)
  44438. * post-commands annotation: Prompting. (line 27)
  44439. * post-overload-choice annotation: Prompting. (line 32)
  44440. * post-prompt annotation: Prompting. (line 24)
  44441. * post-prompt-for-continue annotation: Prompting. (line 40)
  44442. * post-query annotation: Prompting. (line 36)
  44443. * pre-commands annotation: Prompting. (line 27)
  44444. * pre-overload-choice annotation: Prompting. (line 32)
  44445. * pre-prompt annotation: Prompting. (line 24)
  44446. * pre-prompt-for-continue annotation: Prompting. (line 40)
  44447. * pre-query annotation: Prompting. (line 36)
  44448. * prefix-meta (<ESC>): Miscellaneous Commands.
  44449. (line 19)
  44450. * prepend-pretty-printer!: Guile Printing Module.
  44451. (line 13)
  44452. * pretty-printer-enabled?: Guile Pretty Printing API.
  44453. (line 28)
  44454. * pretty-printer?: Guile Pretty Printing API.
  44455. (line 24)
  44456. * pretty-printers: Guile Pretty Printing API.
  44457. (line 35)
  44458. * pretty_printer.children: Pretty Printing API. (line 10)
  44459. * pretty_printer.display_hint: Pretty Printing API. (line 32)
  44460. * pretty_printer.to_string: Pretty Printing API. (line 64)
  44461. * previous-history (C-p): Commands For History.
  44462. (line 12)
  44463. * previous-screen-line (): Commands For Moving. (line 26)
  44464. * print: Data. (line 6)
  44465. * print-last-kbd-macro (): Keyboard Macros. (line 17)
  44466. * print-object: The Print Command with Objective-C.
  44467. (line 6)
  44468. * printf: Output. (line 46)
  44469. * proc-trace-entry: Process Information. (line 122)
  44470. * proc-trace-exit: Process Information. (line 122)
  44471. * proc-untrace-entry: Process Information. (line 122)
  44472. * proc-untrace-exit: Process Information. (line 122)
  44473. * Progspace: Progspaces In Python.
  44474. (line 6)
  44475. * progspace-filename: Progspaces In Guile. (line 34)
  44476. * progspace-objfiles: Progspaces In Guile. (line 44)
  44477. * progspace-pretty-printers: Progspaces In Guile. (line 52)
  44478. * progspace-valid?: Progspaces In Guile. (line 21)
  44479. * Progspace.block_for_pc: Progspaces In Python.
  44480. (line 47)
  44481. * Progspace.block_for_pc <1>: Progspaces In Python.
  44482. (line 47)
  44483. * Progspace.filename: Progspaces In Python.
  44484. (line 26)
  44485. * Progspace.find_pc_line: Progspaces In Python.
  44486. (line 52)
  44487. * Progspace.find_pc_line <1>: Progspaces In Python.
  44488. (line 52)
  44489. * Progspace.frame_filters: Progspaces In Python.
  44490. (line 41)
  44491. * Progspace.is_valid: Progspaces In Python.
  44492. (line 59)
  44493. * Progspace.is_valid <1>: Progspaces In Python.
  44494. (line 59)
  44495. * Progspace.objfiles: Progspaces In Python.
  44496. (line 66)
  44497. * Progspace.objfiles <1>: Progspaces In Python.
  44498. (line 66)
  44499. * Progspace.pretty_printers: Progspaces In Python.
  44500. (line 29)
  44501. * Progspace.solib_name: Progspaces In Python.
  44502. (line 70)
  44503. * Progspace.solib_name <1>: Progspaces In Python.
  44504. (line 70)
  44505. * Progspace.type_printers: Progspaces In Python.
  44506. (line 37)
  44507. * progspace?: Progspaces In Guile. (line 17)
  44508. * progspaces: Progspaces In Guile. (line 31)
  44509. * prompt annotation: Prompting. (line 24)
  44510. * prompt-for-continue annotation: Prompting. (line 40)
  44511. * ptype: Symbols. (line 298)
  44512. * putDebugChar: Bootstrapping. (line 20)
  44513. * pwd: Working Directory. (line 40)
  44514. * py: Python Commands. (line 23)
  44515. * python: GDB/MI Support Commands.
  44516. (line 82)
  44517. * python <1>: Python Commands. (line 23)
  44518. * python-interactive: Python Commands. (line 9)
  44519. * q (quit): Quitting GDB. (line 6)
  44520. * q (SingleKey TUI key): TUI Single Key Mode. (line 25)
  44521. * query annotation: Prompting. (line 36)
  44522. * queue-signal: Signaling. (line 36)
  44523. * quit annotation: Errors. (line 6)
  44524. * quit [EXPRESSION]: Quitting GDB. (line 6)
  44525. * quoted-insert (C-q or C-v): Commands For Text. (line 26)
  44526. * r (run): Starting. (line 6)
  44527. * r (SingleKey TUI key): TUI Single Key Mode. (line 28)
  44528. * rbreak: Set Breaks. (line 90)
  44529. * rc (reverse-continue): Reverse Execution. (line 36)
  44530. * re-read-init-file (C-x C-r): Miscellaneous Commands.
  44531. (line 6)
  44532. * readnow: Files. (line 94)
  44533. * rec: Process Record and Replay.
  44534. (line 43)
  44535. * rec btrace: Process Record and Replay.
  44536. (line 43)
  44537. * rec btrace bts: Process Record and Replay.
  44538. (line 43)
  44539. * rec btrace pt: Process Record and Replay.
  44540. (line 43)
  44541. * rec bts: Process Record and Replay.
  44542. (line 43)
  44543. * rec del: Process Record and Replay.
  44544. (line 357)
  44545. * rec full: Process Record and Replay.
  44546. (line 43)
  44547. * rec function-call-history: Process Record and Replay.
  44548. (line 423)
  44549. * rec instruction-history: Process Record and Replay.
  44550. (line 363)
  44551. * rec pt: Process Record and Replay.
  44552. (line 43)
  44553. * rec s: Process Record and Replay.
  44554. (line 106)
  44555. * recognize on type_recognizer: Type Printing API. (line 42)
  44556. * record: Process Record and Replay.
  44557. (line 43)
  44558. * record btrace: Process Record and Replay.
  44559. (line 43)
  44560. * record btrace bts: Process Record and Replay.
  44561. (line 43)
  44562. * record btrace pt: Process Record and Replay.
  44563. (line 43)
  44564. * record bts: Process Record and Replay.
  44565. (line 43)
  44566. * record delete: Process Record and Replay.
  44567. (line 357)
  44568. * record full: Process Record and Replay.
  44569. (line 43)
  44570. * record function-call-history: Process Record and Replay.
  44571. (line 423)
  44572. * record goto: Process Record and Replay.
  44573. (line 129)
  44574. * record instruction-history: Process Record and Replay.
  44575. (line 363)
  44576. * record pt: Process Record and Replay.
  44577. (line 43)
  44578. * record restore: Process Record and Replay.
  44579. (line 150)
  44580. * record save: Process Record and Replay.
  44581. (line 143)
  44582. * record stop: Process Record and Replay.
  44583. (line 106)
  44584. * Record.begin: Recordings In Python.
  44585. (line 40)
  44586. * Record.end: Recordings In Python.
  44587. (line 44)
  44588. * Record.format: Recordings In Python.
  44589. (line 36)
  44590. * Record.function_call_history: Recordings In Python.
  44591. (line 55)
  44592. * Record.goto: Recordings In Python.
  44593. (line 60)
  44594. * Record.instruction_history: Recordings In Python.
  44595. (line 52)
  44596. * Record.method: Recordings In Python.
  44597. (line 32)
  44598. * Record.replay_position: Recordings In Python.
  44599. (line 48)
  44600. * RecordFunctionSegment.instructions: Recordings In Python.
  44601. (line 126)
  44602. * RecordFunctionSegment.level: Recordings In Python.
  44603. (line 122)
  44604. * RecordFunctionSegment.next: Recordings In Python.
  44605. (line 140)
  44606. * RecordFunctionSegment.number: Recordings In Python.
  44607. (line 113)
  44608. * RecordFunctionSegment.prev: Recordings In Python.
  44609. (line 136)
  44610. * RecordFunctionSegment.symbol: Recordings In Python.
  44611. (line 118)
  44612. * RecordFunctionSegment.up: Recordings In Python.
  44613. (line 130)
  44614. * RecordGap.error_code: Recordings In Python.
  44615. (line 104)
  44616. * RecordGap.error_string: Recordings In Python.
  44617. (line 108)
  44618. * RecordGap.number: Recordings In Python.
  44619. (line 99)
  44620. * RecordInstruction.is_speculative: Recordings In Python.
  44621. (line 91)
  44622. * RecordInstruction.number: Recordings In Python.
  44623. (line 81)
  44624. * RecordInstruction.sal: Recordings In Python.
  44625. (line 86)
  44626. * redraw-current-line (): Commands For Moving. (line 44)
  44627. * refresh: TUI Commands. (line 77)
  44628. * register-breakpoint!: Breakpoints In Guile.
  44629. (line 87)
  44630. * register-command!: Commands In Guile. (line 58)
  44631. * register-parameter!: Parameters In Guile. (line 94)
  44632. * RegisterChangedEvent.frame: Events In Python. (line 172)
  44633. * RegisterChangedEvent.regnum: Events In Python. (line 175)
  44634. * register_xmethod_matcher: Xmethod API. (line 82)
  44635. * remote delete: File Transfer. (line 23)
  44636. * remote get: File Transfer. (line 19)
  44637. * remote put: File Transfer. (line 15)
  44638. * remove-inferiors: Inferiors and Programs.
  44639. (line 95)
  44640. * remove-symbol-file: Files. (line 174)
  44641. * restart CHECKPOINT-ID: Checkpoint/Restart. (line 41)
  44642. * restore: Dump/Restore Files. (line 40)
  44643. * RET (repeat last command): Command Syntax. (line 21)
  44644. * return: Returning. (line 6)
  44645. * reverse-continue: Reverse Execution. (line 36)
  44646. * reverse-finish: Reverse Execution. (line 83)
  44647. * reverse-next: Reverse Execution. (line 66)
  44648. * reverse-nexti: Reverse Execution. (line 75)
  44649. * reverse-search: Search. (line 16)
  44650. * reverse-search-history (C-r): Commands For History.
  44651. (line 26)
  44652. * reverse-step: Reverse Execution. (line 43)
  44653. * reverse-stepi: Reverse Execution. (line 58)
  44654. * revert-all-at-newline: Readline Init File Syntax.
  44655. (line 267)
  44656. * revert-line (M-r): Miscellaneous Commands.
  44657. (line 26)
  44658. * Right: TUI Keys. (line 76)
  44659. * rn (reverse-next): Reverse Execution. (line 66)
  44660. * rni (reverse-nexti): Reverse Execution. (line 75)
  44661. * rs (step): Reverse Execution. (line 43)
  44662. * rsi (reverse-stepi): Reverse Execution. (line 58)
  44663. * run: Starting. (line 6)
  44664. * run&: Background Execution.
  44665. (line 21)
  44666. * rwatch: Set Watchpoints. (line 79)
  44667. * s (SingleKey TUI key): TUI Single Key Mode. (line 31)
  44668. * s (step): Continuing and Stepping.
  44669. (line 45)
  44670. * sal-last: Symbol Tables In Guile.
  44671. (line 68)
  44672. * sal-line: Symbol Tables In Guile.
  44673. (line 62)
  44674. * sal-pc: Symbol Tables In Guile.
  44675. (line 65)
  44676. * sal-symtab: Symbol Tables In Guile.
  44677. (line 59)
  44678. * sal-valid?: Symbol Tables In Guile.
  44679. (line 53)
  44680. * sal?: Symbol Tables In Guile.
  44681. (line 49)
  44682. * save breakpoints: Save Breakpoints. (line 9)
  44683. * save gdb-index: Index Files. (line 30)
  44684. * save tracepoints: save tracepoints. (line 6)
  44685. * save-tracepoints: save tracepoints. (line 6)
  44686. * search: Search. (line 9)
  44687. * section: Files. (line 203)
  44688. * select-frame: Selection. (line 98)
  44689. * selected-frame: Frames In Guile. (line 156)
  44690. * self: Commands In Guile. (line 100)
  44691. * self-insert (a, b, A, 1, !, ...): Commands For Text. (line 33)
  44692. * set: Help. (line 129)
  44693. * set ada print-signatures: Overloading support for Ada.
  44694. (line 31)
  44695. * set ada trust-PAD-over-XVS: Ada Glitches. (line 42)
  44696. * set agent off: In-Process Agent. (line 47)
  44697. * set agent on: In-Process Agent. (line 38)
  44698. * set annotate: Annotations Overview.
  44699. (line 29)
  44700. * set architecture: Targets. (line 21)
  44701. * set args: Arguments. (line 21)
  44702. * set arm: ARM. (line 9)
  44703. * set auto-connect-native-target: Starting. (line 168)
  44704. * set auto-load gdb-scripts: Auto-loading sequences.
  44705. (line 13)
  44706. * set auto-load guile-scripts: Guile Auto-loading. (line 17)
  44707. * set auto-load libthread-db: libthread_db.so.1 file.
  44708. (line 21)
  44709. * set auto-load local-gdbinit: Init File in the Current Directory.
  44710. (line 14)
  44711. * set auto-load off: Auto-loading. (line 32)
  44712. * set auto-load python-scripts: Python Auto-loading. (line 17)
  44713. * set auto-load safe-path: Auto-loading safe path.
  44714. (line 32)
  44715. * set auto-load scripts-directory: objfile-gdbdotext file.
  44716. (line 37)
  44717. * set auto-solib-add: Files. (line 307)
  44718. * set backtrace: Backtrace. (line 166)
  44719. * set basenames-may-differ: Files. (line 536)
  44720. * set breakpoint always-inserted: Set Breaks. (line 325)
  44721. * set breakpoint auto-hw: Set Breaks. (line 305)
  44722. * set breakpoint condition-evaluation: Set Breaks. (line 346)
  44723. * set breakpoint pending: Set Breaks. (line 275)
  44724. * set can-use-hw-watchpoints: Set Watchpoints. (line 116)
  44725. * set case-sensitive: Symbols. (line 27)
  44726. * set charset: Character Sets. (line 46)
  44727. * set check range: Range Checking. (line 34)
  44728. * set check type: Type Checking. (line 35)
  44729. * set circular-trace-buffer: Starting and Stopping Trace Experiments.
  44730. (line 93)
  44731. * set code-cache: Caching Target Data. (line 36)
  44732. * set coerce-float-to-double: ABI. (line 45)
  44733. * set com1base: DJGPP Native. (line 122)
  44734. * set com1irq: DJGPP Native. (line 122)
  44735. * set com2base: DJGPP Native. (line 122)
  44736. * set com2irq: DJGPP Native. (line 122)
  44737. * set com3base: DJGPP Native. (line 122)
  44738. * set com3irq: DJGPP Native. (line 122)
  44739. * set com4base: DJGPP Native. (line 122)
  44740. * set com4irq: DJGPP Native. (line 122)
  44741. * set complaints: Messages/Warnings. (line 29)
  44742. * set confirm: Messages/Warnings. (line 49)
  44743. * set cp-abi: ABI. (line 57)
  44744. * set cwd: Working Directory. (line 13)
  44745. * set cygwin-exceptions: Cygwin Native. (line 60)
  44746. * set data-directory: Data Files. (line 12)
  44747. * set dcache line-size: Caching Target Data. (line 60)
  44748. * set dcache size: Caching Target Data. (line 57)
  44749. * set debug: Debugging Output. (line 17)
  44750. * set debug aarch64: AArch64. (line 10)
  44751. * set debug arc: ARC. (line 9)
  44752. * set debug auto-load: Auto-loading verbose mode.
  44753. (line 27)
  44754. * set debug bfd-cache LEVEL: File Caching. (line 24)
  44755. * set debug darwin: Darwin. (line 9)
  44756. * set debug entry-values: Tail Call Frames. (line 47)
  44757. * set debug hppa: HPPA. (line 10)
  44758. * set debug libthread-db: Threads. (line 331)
  44759. * set debug mach-o: Darwin. (line 16)
  44760. * set debug mips: MIPS. (line 100)
  44761. * set debug monitor: Target Commands. (line 107)
  44762. * set debug nios2: Nios II. (line 10)
  44763. * set debug skip: Skipping Over Functions and Files.
  44764. (line 149)
  44765. * set debug-file-directory: Separate Debug Files.
  44766. (line 70)
  44767. * set debugevents: Cygwin Native. (line 89)
  44768. * set debugexceptions: Cygwin Native. (line 100)
  44769. * set debugexec: Cygwin Native. (line 96)
  44770. * set debugmemory: Cygwin Native. (line 104)
  44771. * set default-collect: Tracepoint Actions. (line 142)
  44772. * set demangle-style: Print Settings. (line 529)
  44773. * set detach-on-fork: Forks. (line 58)
  44774. * set directories: Source Path. (line 178)
  44775. * set disable-randomization: Starting. (line 212)
  44776. * set disassemble-next-line: Machine Code. (line 249)
  44777. * set disassembler-options: Machine Code. (line 222)
  44778. * set disassembly-flavor: Machine Code. (line 237)
  44779. * set disconnected-dprintf: Dynamic Printf. (line 83)
  44780. * set disconnected-tracing: Starting and Stopping Trace Experiments.
  44781. (line 55)
  44782. * set displaced-stepping: Maintenance Commands.
  44783. (line 112)
  44784. * set dump-excluded-mappings: Core File Generation.
  44785. (line 60)
  44786. * set editing: Editing. (line 15)
  44787. * set endian: Byte Order. (line 13)
  44788. * set environment: Environment. (line 39)
  44789. * set exceptions, Hurd command: Hurd Native. (line 39)
  44790. * set exec-direction: Reverse Execution. (line 89)
  44791. * set exec-done-display: Debugging Output. (line 11)
  44792. * set exec-wrapper: Starting. (line 120)
  44793. * set extended-prompt: Prompt. (line 25)
  44794. * set extension-language: Show. (line 30)
  44795. * set follow-exec-mode: Forks. (line 105)
  44796. * set follow-fork-mode: Forks. (line 39)
  44797. * set frame-filter priority: Frame Filter Management.
  44798. (line 84)
  44799. * set gnutarget: Target Commands. (line 28)
  44800. * set guile print-stack: Guile Exception Handling.
  44801. (line 6)
  44802. * set hash, for remote monitors: Target Commands. (line 98)
  44803. * set height: Screen Size. (line 22)
  44804. * set history expansion: Command History. (line 82)
  44805. * set history filename: Command History. (line 26)
  44806. * set history remove-duplicates: Command History. (line 54)
  44807. * set history save: Command History. (line 36)
  44808. * set history size: Command History. (line 45)
  44809. * set host-charset: Character Sets. (line 33)
  44810. * set index-cache: Index Files. (line 81)
  44811. * set inferior-tty: Input/Output. (line 49)
  44812. * set input-radix: Numbers. (line 14)
  44813. * set interactive-mode: Other Misc Settings. (line 6)
  44814. * set language: Manually. (line 9)
  44815. * set libthread-db-search-path: Threads. (line 293)
  44816. * set listsize: List. (line 33)
  44817. * set logging: Logging Output. (line 9)
  44818. * set mach-exceptions: Darwin. (line 27)
  44819. * set max-completions: Completion. (line 70)
  44820. * set max-user-call-depth: Define. (line 128)
  44821. * set max-value-size: Value Sizes. (line 12)
  44822. * set may-call-functions: Calling. (line 59)
  44823. * set mem inaccessible-by-default: Memory Region Attributes.
  44824. (line 123)
  44825. * set mips abi: MIPS. (line 32)
  44826. * set mips compression: MIPS. (line 49)
  44827. * set mips mask-address: MIPS. (line 80)
  44828. * set mipsfpu: MIPS Embedded. (line 13)
  44829. * set mpx bound: i386. (line 60)
  44830. * set multiple-symbols: Ambiguous Expressions.
  44831. (line 50)
  44832. * set new-console: Cygwin Native. (line 72)
  44833. * set new-group: Cygwin Native. (line 81)
  44834. * set non-stop: Non-Stop Mode. (line 35)
  44835. * set opaque-type-resolution: Symbols. (line 582)
  44836. * set osabi: ABI. (line 11)
  44837. * set output-radix: Numbers. (line 30)
  44838. * set overload-resolution: Debugging C Plus Plus.
  44839. (line 59)
  44840. * set pagination: Screen Size. (line 41)
  44841. * set powerpc: PowerPC Embedded. (line 51)
  44842. * set print: Print Settings. (line 11)
  44843. * set print entry-values: Print Settings. (line 214)
  44844. * set print finish: Continuing and Stepping.
  44845. (line 117)
  44846. * set print frame-arguments: Print Settings. (line 154)
  44847. * set print frame-info: Print Settings. (line 314)
  44848. * set print inferior-events: Inferiors and Programs.
  44849. (line 126)
  44850. * set print symbol-loading: Symbols. (line 600)
  44851. * set print thread-events: Threads. (line 272)
  44852. * set print type methods: Symbols. (line 44)
  44853. * set print type nested-type-limit: Symbols. (line 57)
  44854. * set print type typedefs: Symbols. (line 68)
  44855. * set processor: Targets. (line 31)
  44856. * set procfs-file: Process Information. (line 111)
  44857. * set procfs-trace: Process Information. (line 105)
  44858. * set prompt: Prompt. (line 16)
  44859. * set python print-stack: Python Commands. (line 44)
  44860. * set radix: Numbers. (line 43)
  44861. * set range-stepping: Continuing and Stepping.
  44862. (line 228)
  44863. * set ravenscar task-switching off: Ravenscar Profile. (line 14)
  44864. * set ravenscar task-switching on: Ravenscar Profile. (line 10)
  44865. * set record: Process Record and Replay.
  44866. (line 413)
  44867. * set record btrace: Process Record and Replay.
  44868. (line 204)
  44869. * set record btrace bts: Process Record and Replay.
  44870. (line 277)
  44871. * set record btrace pt: Process Record and Replay.
  44872. (line 300)
  44873. * set record full: Process Record and Replay.
  44874. (line 154)
  44875. * set remote: Remote Configuration.
  44876. (line 6)
  44877. * set remote system-call-allowed: system. (line 37)
  44878. * set remote-mips64-transfers-32bit-regs: MIPS. (line 90)
  44879. * set remotecache: Caching Target Data. (line 20)
  44880. * set remoteflow: Remote Configuration.
  44881. (line 48)
  44882. * set schedule-multiple: All-Stop Mode. (line 67)
  44883. * set script-extension: Extending GDB. (line 29)
  44884. * set sh calling-convention: Super-H. (line 9)
  44885. * set shell: Cygwin Native. (line 108)
  44886. * set signal-thread: Hurd Native. (line 21)
  44887. * set signals, Hurd command: Hurd Native. (line 11)
  44888. * set sigs, Hurd command: Hurd Native. (line 11)
  44889. * set sigthread: Hurd Native. (line 21)
  44890. * set solib-absolute-prefix: Files. (line 386)
  44891. * set solib-search-path: Files. (line 462)
  44892. * set stack-cache: Caching Target Data. (line 28)
  44893. * set startup-with-shell: Starting. (line 145)
  44894. * set step-mode: Continuing and Stepping.
  44895. (line 91)
  44896. * set stop-on-solib-events: Files. (line 363)
  44897. * set stopped, Hurd command: Hurd Native. (line 31)
  44898. * set struct-convention: i386. (line 7)
  44899. * set style: Output Styling. (line 6)
  44900. * set substitute-path: Source Path. (line 185)
  44901. * set sysroot: Files. (line 386)
  44902. * set target-charset: Character Sets. (line 28)
  44903. * set target-file-system-kind (unix|dos-based|auto): Files. (line 476)
  44904. * set target-wide-charset: Character Sets. (line 61)
  44905. * set task, Hurd commands: Hurd Native. (line 48)
  44906. * set tcp: Remote Configuration.
  44907. (line 130)
  44908. * set thread, Hurd command: Hurd Native. (line 90)
  44909. * set trace-buffer-size: Starting and Stopping Trace Experiments.
  44910. (line 107)
  44911. * set trace-commands: Messages/Warnings. (line 65)
  44912. * set trace-notes: Starting and Stopping Trace Experiments.
  44913. (line 126)
  44914. * set trace-stop-notes: Starting and Stopping Trace Experiments.
  44915. (line 132)
  44916. * set trace-user: Starting and Stopping Trace Experiments.
  44917. (line 122)
  44918. * set trust-readonly-sections: Files. (line 265)
  44919. * set tui active-border-mode: TUI Configuration. (line 24)
  44920. * set tui border-kind: TUI Configuration. (line 9)
  44921. * set tui border-mode: TUI Configuration. (line 23)
  44922. * set tui compact-source: TUI Configuration. (line 54)
  44923. * set tui tab-width: TUI Configuration. (line 49)
  44924. * set unwind-on-terminating-exception: Calling. (line 47)
  44925. * set unwindonsignal: Calling. (line 36)
  44926. * set use-coredump-filter: Core File Generation.
  44927. (line 33)
  44928. * set variable: Assignment. (line 16)
  44929. * set varsize-limit: Ada Settings. (line 6)
  44930. * set verbose: Messages/Warnings. (line 15)
  44931. * set watchdog: Maintenance Commands.
  44932. (line 610)
  44933. * set width: Screen Size. (line 22)
  44934. * set write: Patching. (line 15)
  44935. * set-breakpoint-condition!: Breakpoints In Guile.
  44936. (line 198)
  44937. * set-breakpoint-enabled!: Breakpoints In Guile.
  44938. (line 147)
  44939. * set-breakpoint-hit-count!: Breakpoints In Guile.
  44940. (line 172)
  44941. * set-breakpoint-ignore-count!: Breakpoints In Guile.
  44942. (line 166)
  44943. * set-breakpoint-silent!: Breakpoints In Guile.
  44944. (line 158)
  44945. * set-breakpoint-stop!: Breakpoints In Guile.
  44946. (line 206)
  44947. * set-breakpoint-task!: Breakpoints In Guile.
  44948. (line 190)
  44949. * set-breakpoint-thread!: Breakpoints In Guile.
  44950. (line 180)
  44951. * set-iterator-progress!: Iterators In Guile. (line 60)
  44952. * set-mark (C-@): Miscellaneous Commands.
  44953. (line 33)
  44954. * set-memory-port-read-buffer-size!: Memory Ports in Guile.
  44955. (line 41)
  44956. * set-memory-port-write-buffer-size!: Memory Ports in Guile.
  44957. (line 49)
  44958. * set-objfile-pretty-printers!: Objfiles In Guile. (line 40)
  44959. * set-parameter-value!: Parameters In Guile. (line 107)
  44960. * set-pretty-printer-enabled!: Guile Pretty Printing API.
  44961. (line 31)
  44962. * set-pretty-printers!: Guile Pretty Printing API.
  44963. (line 38)
  44964. * set-progspace-pretty-printers!: Progspaces In Guile. (line 57)
  44965. * set_debug_traps: Stub Contents. (line 10)
  44966. * share: Files. (line 339)
  44967. * sharedlibrary: Files. (line 339)
  44968. * shell: Shell Commands. (line 10)
  44969. * show: Help. (line 134)
  44970. * show ada print-signatures: Overloading support for Ada.
  44971. (line 36)
  44972. * show ada trust-PAD-over-XVS: Ada Glitches. (line 42)
  44973. * show agent: In-Process Agent. (line 51)
  44974. * show annotate: Annotations Overview.
  44975. (line 34)
  44976. * show architecture: Targets. (line 21)
  44977. * show args: Arguments. (line 28)
  44978. * show arm: ARM. (line 13)
  44979. * show auto-load: Auto-loading. (line 45)
  44980. * show auto-load gdb-scripts: Auto-loading sequences.
  44981. (line 17)
  44982. * show auto-load guile-scripts: Guile Auto-loading. (line 20)
  44983. * show auto-load libthread-db: libthread_db.so.1 file.
  44984. (line 25)
  44985. * show auto-load local-gdbinit: Init File in the Current Directory.
  44986. (line 18)
  44987. * show auto-load python-scripts: Python Auto-loading. (line 20)
  44988. * show auto-load safe-path: Auto-loading safe path.
  44989. (line 46)
  44990. * show auto-load scripts-directory: objfile-gdbdotext file.
  44991. (line 61)
  44992. * show auto-solib-add: Files. (line 324)
  44993. * show backtrace: Backtrace. (line 173)
  44994. * show basenames-may-differ: Files. (line 539)
  44995. * show breakpoint always-inserted: Set Breaks. (line 325)
  44996. * show breakpoint auto-hw: Set Breaks. (line 305)
  44997. * show breakpoint condition-evaluation: Set Breaks. (line 346)
  44998. * show breakpoint pending: Set Breaks. (line 275)
  44999. * show can-use-hw-watchpoints: Set Watchpoints. (line 119)
  45000. * show case-sensitive: Symbols. (line 40)
  45001. * show charset: Character Sets. (line 52)
  45002. * show check range: Range Checking. (line 34)
  45003. * show check type: Type Checking. (line 35)
  45004. * show circular-trace-buffer: Starting and Stopping Trace Experiments.
  45005. (line 100)
  45006. * show code-cache: Caching Target Data. (line 42)
  45007. * show coerce-float-to-double: ABI. (line 54)
  45008. * show com1base: DJGPP Native. (line 134)
  45009. * show com1irq: DJGPP Native. (line 134)
  45010. * show com2base: DJGPP Native. (line 134)
  45011. * show com2irq: DJGPP Native. (line 134)
  45012. * show com3base: DJGPP Native. (line 134)
  45013. * show com3irq: DJGPP Native. (line 134)
  45014. * show com4base: DJGPP Native. (line 134)
  45015. * show com4irq: DJGPP Native. (line 134)
  45016. * show commands: Command History. (line 95)
  45017. * show complaints: Messages/Warnings. (line 35)
  45018. * show configuration: Help. (line 167)
  45019. * show confirm: Messages/Warnings. (line 57)
  45020. * show convenience: Convenience Vars. (line 37)
  45021. * show copying: Help. (line 158)
  45022. * show cp-abi: ABI. (line 57)
  45023. * show cwd: Working Directory. (line 27)
  45024. * show cygwin-exceptions: Cygwin Native. (line 68)
  45025. * show data-directory: Data Files. (line 16)
  45026. * show dcache line-size: Caching Target Data. (line 68)
  45027. * show dcache size: Caching Target Data. (line 64)
  45028. * show debug: Debugging Output. (line 20)
  45029. * show debug arc: ARC. (line 14)
  45030. * show debug auto-load: Auto-loading verbose mode.
  45031. (line 30)
  45032. * show debug bfd-cache: File Caching. (line 27)
  45033. * show debug darwin: Darwin. (line 13)
  45034. * show debug entry-values: Tail Call Frames. (line 55)
  45035. * show debug libthread-db: Threads. (line 331)
  45036. * show debug mach-o: Darwin. (line 23)
  45037. * show debug mips: MIPS. (line 104)
  45038. * show debug monitor: Target Commands. (line 111)
  45039. * show debug nios2: Nios II. (line 14)
  45040. * show debug skip: Skipping Over Functions and Files.
  45041. (line 153)
  45042. * show debug-file-directory: Separate Debug Files.
  45043. (line 75)
  45044. * show default-collect: Tracepoint Actions. (line 150)
  45045. * show detach-on-fork: Forks. (line 73)
  45046. * show directories: Source Path. (line 182)
  45047. * show disassemble-next-line: Machine Code. (line 249)
  45048. * show disassembler-options: Machine Code. (line 234)
  45049. * show disassembly-flavor: Machine Code. (line 246)
  45050. * show disconnected-dprintf: Dynamic Printf. (line 88)
  45051. * show disconnected-tracing: Starting and Stopping Trace Experiments.
  45052. (line 62)
  45053. * show displaced-stepping: Maintenance Commands.
  45054. (line 112)
  45055. * show editing: Editing. (line 22)
  45056. * show environment: Environment. (line 33)
  45057. * show exceptions, Hurd command: Hurd Native. (line 45)
  45058. * show exec-done-display: Debugging Output. (line 14)
  45059. * show extended-prompt: Prompt. (line 39)
  45060. * show follow-fork-mode: Forks. (line 52)
  45061. * show frame-filter priority: Frame Filter Management.
  45062. (line 91)
  45063. * show gnutarget: Target Commands. (line 40)
  45064. * show hash, for remote monitors: Target Commands. (line 104)
  45065. * show height: Screen Size. (line 22)
  45066. * show history: Command History. (line 87)
  45067. * show host-charset: Character Sets. (line 55)
  45068. * show index-cache: Index Files. (line 86)
  45069. * show inferior-tty: Input/Output. (line 54)
  45070. * show input-radix: Numbers. (line 35)
  45071. * show interactive-mode: Other Misc Settings. (line 20)
  45072. * show language: Show. (line 10)
  45073. * show libthread-db-search-path: Threads. (line 328)
  45074. * show listsize: List. (line 39)
  45075. * show logging: Logging Output. (line 26)
  45076. * show mach-exceptions: Darwin. (line 34)
  45077. * show max-completions: Completion. (line 78)
  45078. * show max-user-call-depth: Define. (line 128)
  45079. * show max-value-size: Value Sizes. (line 36)
  45080. * show may-call-functions: Calling. (line 73)
  45081. * show mem inaccessible-by-default: Memory Region Attributes.
  45082. (line 129)
  45083. * show mips abi: MIPS. (line 46)
  45084. * show mips compression: MIPS. (line 72)
  45085. * show mips mask-address: MIPS. (line 86)
  45086. * show mipsfpu: MIPS Embedded. (line 13)
  45087. * show mpx bound: i386. (line 57)
  45088. * show multiple-symbols: Ambiguous Expressions.
  45089. (line 70)
  45090. * show new-console: Cygwin Native. (line 77)
  45091. * show new-group: Cygwin Native. (line 86)
  45092. * show non-stop: Non-Stop Mode. (line 38)
  45093. * show opaque-type-resolution: Symbols. (line 597)
  45094. * show osabi: ABI. (line 11)
  45095. * show output-radix: Numbers. (line 38)
  45096. * show overload-resolution: Debugging C Plus Plus.
  45097. (line 76)
  45098. * show pagination: Screen Size. (line 47)
  45099. * show paths: Environment. (line 29)
  45100. * show print: Print Settings. (line 39)
  45101. * show print finish: Continuing and Stepping.
  45102. (line 117)
  45103. * show print inferior-events: Inferiors and Programs.
  45104. (line 134)
  45105. * show print symbol-loading: Symbols. (line 615)
  45106. * show print thread-events: Threads. (line 282)
  45107. * show print type methods: Symbols. (line 53)
  45108. * show print type nested-type-limit: Symbols. (line 64)
  45109. * show print type typedefs: Symbols. (line 81)
  45110. * show processor: Targets. (line 31)
  45111. * show procfs-file: Process Information. (line 116)
  45112. * show procfs-trace: Process Information. (line 108)
  45113. * show prompt: Prompt. (line 19)
  45114. * show radix: Numbers. (line 43)
  45115. * show range-stepping: Continuing and Stepping.
  45116. (line 228)
  45117. * show ravenscar task-switching: Ravenscar Profile. (line 22)
  45118. * show record: Process Record and Replay.
  45119. (line 419)
  45120. * show record btrace: Process Record and Replay.
  45121. (line 270)
  45122. * show record full: Process Record and Replay.
  45123. (line 172)
  45124. * show remote: Remote Configuration.
  45125. (line 6)
  45126. * show remote system-call-allowed: system. (line 41)
  45127. * show remote-mips64-transfers-32bit-regs: MIPS. (line 96)
  45128. * show remotecache: Caching Target Data. (line 25)
  45129. * show remoteflow: Remote Configuration.
  45130. (line 52)
  45131. * show script-extension: Extending GDB. (line 29)
  45132. * show sh calling-convention: Super-H. (line 22)
  45133. * show shell: Cygwin Native. (line 112)
  45134. * show signal-thread: Hurd Native. (line 27)
  45135. * show signals, Hurd command: Hurd Native. (line 17)
  45136. * show sigs, Hurd command: Hurd Native. (line 17)
  45137. * show sigthread: Hurd Native. (line 27)
  45138. * show solib-search-path: Files. (line 473)
  45139. * show stack-cache: Caching Target Data. (line 33)
  45140. * show stop-on-solib-events: Files. (line 369)
  45141. * show stopped, Hurd command: Hurd Native. (line 36)
  45142. * show struct-convention: i386. (line 15)
  45143. * show style: Output Styling. (line 6)
  45144. * show substitute-path: Source Path. (line 222)
  45145. * show sysroot: Files. (line 459)
  45146. * show target-charset: Character Sets. (line 58)
  45147. * show target-file-system-kind: Files. (line 476)
  45148. * show target-wide-charset: Character Sets. (line 67)
  45149. * show task, Hurd commands: Hurd Native. (line 56)
  45150. * show tcp: Remote Configuration.
  45151. (line 130)
  45152. * show thread, Hurd command: Hurd Native. (line 100)
  45153. * show trace-buffer-size: Starting and Stopping Trace Experiments.
  45154. (line 114)
  45155. * show trace-notes: Starting and Stopping Trace Experiments.
  45156. (line 129)
  45157. * show trace-stop-notes: Starting and Stopping Trace Experiments.
  45158. (line 137)
  45159. * show trace-user: Starting and Stopping Trace Experiments.
  45160. (line 124)
  45161. * show unwind-on-terminating-exception: Calling. (line 55)
  45162. * show unwindonsignal: Calling. (line 43)
  45163. * show user: Define. (line 121)
  45164. * show values: Value History. (line 47)
  45165. * show varsize-limit: Ada Settings. (line 26)
  45166. * show verbose: Messages/Warnings. (line 21)
  45167. * show version: Help. (line 148)
  45168. * show warranty: Help. (line 162)
  45169. * show width: Screen Size. (line 22)
  45170. * show write: Patching. (line 26)
  45171. * show-all-if-ambiguous: Readline Init File Syntax.
  45172. (line 273)
  45173. * show-all-if-unmodified: Readline Init File Syntax.
  45174. (line 279)
  45175. * show-mode-in-prompt: Readline Init File Syntax.
  45176. (line 288)
  45177. * si (stepi): Continuing and Stepping.
  45178. (line 196)
  45179. * signal: Signaling. (line 6)
  45180. * signal annotation: Annotations for Running.
  45181. (line 42)
  45182. * signal-event: Cygwin Native. (line 35)
  45183. * signal-name annotation: Annotations for Running.
  45184. (line 22)
  45185. * signal-name-end annotation: Annotations for Running.
  45186. (line 22)
  45187. * signal-string annotation: Annotations for Running.
  45188. (line 22)
  45189. * signal-string-end annotation: Annotations for Running.
  45190. (line 22)
  45191. * SignalEvent.stop_signal: Events In Python. (line 91)
  45192. * signalled annotation: Annotations for Running.
  45193. (line 22)
  45194. * silent: Break Commands. (line 43)
  45195. * sim, a command: Embedded Processors. (line 13)
  45196. * skip: Skipping Over Functions and Files.
  45197. (line 44)
  45198. * skip delete: Skipping Over Functions and Files.
  45199. (line 137)
  45200. * skip disable: Skipping Over Functions and Files.
  45201. (line 145)
  45202. * skip enable: Skipping Over Functions and Files.
  45203. (line 141)
  45204. * skip file: Skipping Over Functions and Files.
  45205. (line 100)
  45206. * skip function: Skipping Over Functions and Files.
  45207. (line 89)
  45208. * skip-completed-text: Readline Init File Syntax.
  45209. (line 294)
  45210. * skip-csi-sequence (): Miscellaneous Commands.
  45211. (line 52)
  45212. * source: Command Files. (line 17)
  45213. * source annotation: Source Annotations. (line 6)
  45214. * start: Starting. (line 80)
  45215. * start-kbd-macro (C-x (): Keyboard Macros. (line 6)
  45216. * starti: Starting. (line 113)
  45217. * starting annotation: Annotations for Running.
  45218. (line 6)
  45219. * STDERR: Basic Python. (line 183)
  45220. * STDERR <1>: Basic Python. (line 203)
  45221. * stdio-port?: I/O Ports in Guile. (line 15)
  45222. * STDLOG: Basic Python. (line 186)
  45223. * STDLOG <1>: Basic Python. (line 206)
  45224. * STDOUT: Basic Python. (line 180)
  45225. * STDOUT <1>: Basic Python. (line 200)
  45226. * step: Continuing and Stepping.
  45227. (line 45)
  45228. * step&: Background Execution.
  45229. (line 28)
  45230. * stepi: Continuing and Stepping.
  45231. (line 196)
  45232. * stepi&: Background Execution.
  45233. (line 31)
  45234. * stop, a pseudo-command: Hooks. (line 21)
  45235. * stopping annotation: Annotations for Running.
  45236. (line 6)
  45237. * strace: Create and Delete Tracepoints.
  45238. (line 75)
  45239. * string->argv: Commands In Guile. (line 73)
  45240. * symbol-addr-class: Symbols In Guile. (line 48)
  45241. * symbol-argument?: Symbols In Guile. (line 58)
  45242. * symbol-constant?: Symbols In Guile. (line 62)
  45243. * symbol-file: Files. (line 45)
  45244. * symbol-function?: Symbols In Guile. (line 65)
  45245. * symbol-line: Symbols In Guile. (line 32)
  45246. * symbol-linkage-name: Symbols In Guile. (line 39)
  45247. * symbol-name: Symbols In Guile. (line 36)
  45248. * symbol-needs-frame?: Symbols In Guile. (line 53)
  45249. * symbol-print-name: Symbols In Guile. (line 43)
  45250. * symbol-symtab: Symbols In Guile. (line 28)
  45251. * symbol-type: Symbols In Guile. (line 24)
  45252. * symbol-valid?: Symbols In Guile. (line 17)
  45253. * symbol-value: Symbols In Guile. (line 72)
  45254. * symbol-variable?: Symbols In Guile. (line 69)
  45255. * Symbol.addr_class: Symbols In Python. (line 119)
  45256. * Symbol.is_argument: Symbols In Python. (line 129)
  45257. * Symbol.is_constant: Symbols In Python. (line 132)
  45258. * Symbol.is_function: Symbols In Python. (line 135)
  45259. * Symbol.is_valid: Symbols In Python. (line 143)
  45260. * Symbol.is_variable: Symbols In Python. (line 138)
  45261. * Symbol.line: Symbols In Python. (line 102)
  45262. * Symbol.linkage_name: Symbols In Python. (line 110)
  45263. * Symbol.name: Symbols In Python. (line 106)
  45264. * Symbol.needs_frame: Symbols In Python. (line 124)
  45265. * Symbol.print_name: Symbols In Python. (line 114)
  45266. * Symbol.symtab: Symbols In Python. (line 97)
  45267. * Symbol.type: Symbols In Python. (line 92)
  45268. * Symbol.value: Symbols In Python. (line 150)
  45269. * symbol?: Symbols In Guile. (line 13)
  45270. * SYMBOL_COMMON_BLOCK_DOMAIN: Symbols In Python. (line 178)
  45271. * SYMBOL_FUNCTIONS_DOMAIN: Symbols In Guile. (line 133)
  45272. * SYMBOL_LABEL_DOMAIN: Symbols In Python. (line 172)
  45273. * SYMBOL_LABEL_DOMAIN <1>: Symbols In Guile. (line 126)
  45274. * SYMBOL_LOC_ARG: Symbols In Python. (line 197)
  45275. * SYMBOL_LOC_ARG <1>: Symbols In Guile. (line 155)
  45276. * SYMBOL_LOC_BLOCK: Symbols In Python. (line 218)
  45277. * SYMBOL_LOC_BLOCK <1>: Symbols In Guile. (line 176)
  45278. * SYMBOL_LOC_COMPUTED: Symbols In Python. (line 232)
  45279. * SYMBOL_LOC_COMPUTED <1>: Symbols In Python. (line 235)
  45280. * SYMBOL_LOC_COMPUTED <2>: Symbols In Guile. (line 190)
  45281. * SYMBOL_LOC_CONST: Symbols In Python. (line 188)
  45282. * SYMBOL_LOC_CONST <1>: Symbols In Guile. (line 146)
  45283. * SYMBOL_LOC_CONST_BYTES: Symbols In Python. (line 221)
  45284. * SYMBOL_LOC_CONST_BYTES <1>: Symbols In Guile. (line 179)
  45285. * SYMBOL_LOC_LOCAL: Symbols In Python. (line 211)
  45286. * SYMBOL_LOC_LOCAL <1>: Symbols In Guile. (line 169)
  45287. * SYMBOL_LOC_OPTIMIZED_OUT: Symbols In Python. (line 229)
  45288. * SYMBOL_LOC_OPTIMIZED_OUT <1>: Symbols In Guile. (line 187)
  45289. * SYMBOL_LOC_REF_ARG: Symbols In Python. (line 201)
  45290. * SYMBOL_LOC_REF_ARG <1>: Symbols In Guile. (line 159)
  45291. * SYMBOL_LOC_REGISTER: Symbols In Python. (line 194)
  45292. * SYMBOL_LOC_REGISTER <1>: Symbols In Guile. (line 152)
  45293. * SYMBOL_LOC_REGPARM_ADDR: Symbols In Python. (line 206)
  45294. * SYMBOL_LOC_REGPARM_ADDR <1>: Symbols In Guile. (line 164)
  45295. * SYMBOL_LOC_STATIC: Symbols In Python. (line 191)
  45296. * SYMBOL_LOC_STATIC <1>: Symbols In Guile. (line 149)
  45297. * SYMBOL_LOC_TYPEDEF: Symbols In Python. (line 214)
  45298. * SYMBOL_LOC_TYPEDEF <1>: Symbols In Guile. (line 172)
  45299. * SYMBOL_LOC_UNDEF: Symbols In Python. (line 184)
  45300. * SYMBOL_LOC_UNDEF <1>: Symbols In Guile. (line 142)
  45301. * SYMBOL_LOC_UNRESOLVED: Symbols In Python. (line 224)
  45302. * SYMBOL_LOC_UNRESOLVED <1>: Symbols In Guile. (line 182)
  45303. * SYMBOL_MODULE_DOMAIN: Symbols In Python. (line 175)
  45304. * SYMBOL_STRUCT_DOMAIN: Symbols In Python. (line 169)
  45305. * SYMBOL_STRUCT_DOMAIN <1>: Symbols In Guile. (line 123)
  45306. * SYMBOL_TYPES_DOMAIN: Symbols In Guile. (line 136)
  45307. * SYMBOL_UNDEF_DOMAIN: Symbols In Python. (line 160)
  45308. * SYMBOL_UNDEF_DOMAIN <1>: Symbols In Guile. (line 114)
  45309. * SYMBOL_VARIABLES_DOMAIN: Symbols In Guile. (line 129)
  45310. * SYMBOL_VAR_DOMAIN: Symbols In Python. (line 165)
  45311. * SYMBOL_VAR_DOMAIN <1>: Symbols In Guile. (line 119)
  45312. * symtab-filename: Symbol Tables In Guile.
  45313. (line 28)
  45314. * symtab-fullname: Symbol Tables In Guile.
  45315. (line 31)
  45316. * symtab-global-block: Symbol Tables In Guile.
  45317. (line 38)
  45318. * symtab-objfile: Symbol Tables In Guile.
  45319. (line 34)
  45320. * symtab-static-block: Symbol Tables In Guile.
  45321. (line 42)
  45322. * symtab-valid?: Symbol Tables In Guile.
  45323. (line 21)
  45324. * Symtab.filename: Symbol Tables In Python.
  45325. (line 43)
  45326. * Symtab.fullname: Symbol Tables In Python.
  45327. (line 66)
  45328. * Symtab.global_block: Symbol Tables In Python.
  45329. (line 69)
  45330. * Symtab.is_valid: Symbol Tables In Python.
  45331. (line 59)
  45332. * Symtab.linetable: Symbol Tables In Python.
  45333. (line 77)
  45334. * Symtab.objfile: Symbol Tables In Python.
  45335. (line 47)
  45336. * Symtab.producer: Symbol Tables In Python.
  45337. (line 51)
  45338. * Symtab.static_block: Symbol Tables In Python.
  45339. (line 73)
  45340. * symtab?: Symbol Tables In Guile.
  45341. (line 17)
  45342. * Symtab_and_line.is_valid: Symbol Tables In Python.
  45343. (line 34)
  45344. * Symtab_and_line.last: Symbol Tables In Python.
  45345. (line 24)
  45346. * Symtab_and_line.line: Symbol Tables In Python.
  45347. (line 28)
  45348. * Symtab_and_line.pc: Symbol Tables In Python.
  45349. (line 20)
  45350. * Symtab_and_line.symtab: Symbol Tables In Python.
  45351. (line 16)
  45352. * sysinfo: DJGPP Native. (line 19)
  45353. * taas: Threads. (line 222)
  45354. * tab-insert (M-<TAB>): Commands For Text. (line 30)
  45355. * tabset: TUI Configuration. (line 49)
  45356. * target: Target Commands. (line 49)
  45357. * target ctf: Trace Files. (line 28)
  45358. * target record: Process Record and Replay.
  45359. (line 43)
  45360. * target record-btrace: Process Record and Replay.
  45361. (line 43)
  45362. * target record-full: Process Record and Replay.
  45363. (line 43)
  45364. * target sim: OpenRISC 1000. (line 13)
  45365. * target tfile: Trace Files. (line 28)
  45366. * target-config: Guile Configuration. (line 24)
  45367. * task (Ada): Ada Tasks. (line 105)
  45368. * tbreak: Set Breaks. (line 54)
  45369. * tcatch: Set Catchpoints. (line 298)
  45370. * tdump: tdump. (line 6)
  45371. * teval (tracepoints): Tracepoint Actions. (line 118)
  45372. * tfaas: Threads. (line 229)
  45373. * tfile: Trace Files. (line 28)
  45374. * tfind: tfind. (line 6)
  45375. * thbreak: Set Breaks. (line 80)
  45376. * this, inside C++ member functions: C Plus Plus Expressions.
  45377. (line 20)
  45378. * thread apply: Threads. (line 187)
  45379. * thread find: Threads. (line 258)
  45380. * thread name: Threads. (line 247)
  45381. * thread THREAD-ID: Threads. (line 169)
  45382. * thread-info: GDB/MI Support Commands.
  45383. (line 86)
  45384. * ThreadEvent.inferior_thread: Events In Python. (line 54)
  45385. * throw-user-error: Commands In Guile. (line 81)
  45386. * tilde-expand (M-~): Miscellaneous Commands.
  45387. (line 30)
  45388. * trace: Create and Delete Tracepoints.
  45389. (line 6)
  45390. * transpose-chars (C-t): Commands For Text. (line 45)
  45391. * transpose-words (M-t): Commands For Text. (line 51)
  45392. * tsave: Trace Files. (line 12)
  45393. * tstart [ NOTES ]: Starting and Stopping Trace Experiments.
  45394. (line 6)
  45395. * tstatus: Starting and Stopping Trace Experiments.
  45396. (line 27)
  45397. * tstop [ NOTES ]: Starting and Stopping Trace Experiments.
  45398. (line 16)
  45399. * tty: Input/Output. (line 23)
  45400. * tui disable: TUI Commands. (line 23)
  45401. * tui enable: TUI Commands. (line 18)
  45402. * tui reg: TUI Commands. (line 80)
  45403. * tvariable: Trace State Variables.
  45404. (line 26)
  45405. * type-array: Types In Guile. (line 52)
  45406. * type-code: Types In Guile. (line 25)
  45407. * type-const: Types In Guile. (line 99)
  45408. * type-field: Types In Guile. (line 129)
  45409. * type-fields: Types In Guile. (line 115)
  45410. * type-has-field-deep?: Guile Types Module. (line 32)
  45411. * type-has-field?: Types In Guile. (line 142)
  45412. * type-name: Types In Guile. (line 34)
  45413. * type-num-fields: Types In Guile. (line 112)
  45414. * type-pointer: Types In Guile. (line 73)
  45415. * type-print-name: Types In Guile. (line 38)
  45416. * type-range: Types In Guile. (line 77)
  45417. * type-reference: Types In Guile. (line 81)
  45418. * type-sizeof: Types In Guile. (line 43)
  45419. * type-strip-typedefs: Types In Guile. (line 48)
  45420. * type-tag: Types In Guile. (line 29)
  45421. * type-target: Types In Guile. (line 85)
  45422. * type-unqualified: Types In Guile. (line 107)
  45423. * type-vector: Types In Guile. (line 60)
  45424. * type-volatile: Types In Guile. (line 103)
  45425. * Type.alignof: Types In Python. (line 32)
  45426. * Type.array: Types In Python. (line 112)
  45427. * Type.code: Types In Python. (line 38)
  45428. * Type.const: Types In Python. (line 133)
  45429. * Type.fields: Types In Python. (line 63)
  45430. * Type.name: Types In Python. (line 42)
  45431. * Type.objfile: Types In Python. (line 57)
  45432. * Type.optimized_out: Types In Python. (line 190)
  45433. * Type.pointer: Types In Python. (line 156)
  45434. * Type.range: Types In Python. (line 146)
  45435. * Type.reference: Types In Python. (line 152)
  45436. * Type.sizeof: Types In Python. (line 46)
  45437. * Type.strip_typedefs: Types In Python. (line 160)
  45438. * Type.tag: Types In Python. (line 51)
  45439. * Type.target: Types In Python. (line 164)
  45440. * Type.template_argument: Types In Python. (line 178)
  45441. * Type.unqualified: Types In Python. (line 141)
  45442. * Type.vector: Types In Python. (line 120)
  45443. * Type.volatile: Types In Python. (line 137)
  45444. * type?: Types In Guile. (line 11)
  45445. * TYPE_CODE_ARRAY: Types In Python. (line 202)
  45446. * TYPE_CODE_ARRAY <1>: Types In Guile. (line 153)
  45447. * TYPE_CODE_BITSTRING: Types In Python. (line 240)
  45448. * TYPE_CODE_BITSTRING <1>: Types In Guile. (line 191)
  45449. * TYPE_CODE_BOOL: Types In Python. (line 264)
  45450. * TYPE_CODE_BOOL <1>: Types In Guile. (line 212)
  45451. * TYPE_CODE_CHAR: Types In Python. (line 261)
  45452. * TYPE_CODE_CHAR <1>: Types In Guile. (line 209)
  45453. * TYPE_CODE_COMPLEX: Types In Python. (line 267)
  45454. * TYPE_CODE_COMPLEX <1>: Types In Guile. (line 215)
  45455. * TYPE_CODE_DECFLOAT: Types In Python. (line 276)
  45456. * TYPE_CODE_DECFLOAT <1>: Types In Guile. (line 224)
  45457. * TYPE_CODE_ENUM: Types In Python. (line 211)
  45458. * TYPE_CODE_ENUM <1>: Types In Guile. (line 162)
  45459. * TYPE_CODE_ERROR: Types In Python. (line 243)
  45460. * TYPE_CODE_ERROR <1>: Types In Guile. (line 194)
  45461. * TYPE_CODE_FLAGS: Types In Python. (line 214)
  45462. * TYPE_CODE_FLAGS <1>: Types In Guile. (line 165)
  45463. * TYPE_CODE_FLT: Types In Python. (line 223)
  45464. * TYPE_CODE_FLT <1>: Types In Guile. (line 174)
  45465. * TYPE_CODE_FUNC: Types In Python. (line 217)
  45466. * TYPE_CODE_FUNC <1>: Types In Guile. (line 168)
  45467. * TYPE_CODE_INT: Types In Python. (line 220)
  45468. * TYPE_CODE_INT <1>: Types In Guile. (line 171)
  45469. * TYPE_CODE_INTERNAL_FUNCTION: Types In Python. (line 279)
  45470. * TYPE_CODE_INTERNAL_FUNCTION <1>: Types In Guile. (line 227)
  45471. * TYPE_CODE_MEMBERPTR: Types In Python. (line 252)
  45472. * TYPE_CODE_MEMBERPTR <1>: Types In Guile. (line 203)
  45473. * TYPE_CODE_METHOD: Types In Python. (line 246)
  45474. * TYPE_CODE_METHOD <1>: Types In Guile. (line 197)
  45475. * TYPE_CODE_METHODPTR: Types In Python. (line 249)
  45476. * TYPE_CODE_METHODPTR <1>: Types In Guile. (line 200)
  45477. * TYPE_CODE_NAMESPACE: Types In Python. (line 273)
  45478. * TYPE_CODE_NAMESPACE <1>: Types In Guile. (line 221)
  45479. * TYPE_CODE_PTR: Types In Python. (line 199)
  45480. * TYPE_CODE_PTR <1>: Types In Guile. (line 150)
  45481. * TYPE_CODE_RANGE: Types In Python. (line 232)
  45482. * TYPE_CODE_RANGE <1>: Types In Guile. (line 183)
  45483. * TYPE_CODE_REF: Types In Python. (line 255)
  45484. * TYPE_CODE_REF <1>: Types In Guile. (line 206)
  45485. * TYPE_CODE_RVALUE_REF: Types In Python. (line 258)
  45486. * TYPE_CODE_SET: Types In Python. (line 229)
  45487. * TYPE_CODE_SET <1>: Types In Guile. (line 180)
  45488. * TYPE_CODE_STRING: Types In Python. (line 235)
  45489. * TYPE_CODE_STRING <1>: Types In Guile. (line 186)
  45490. * TYPE_CODE_STRUCT: Types In Python. (line 205)
  45491. * TYPE_CODE_STRUCT <1>: Types In Guile. (line 156)
  45492. * TYPE_CODE_TYPEDEF: Types In Python. (line 270)
  45493. * TYPE_CODE_TYPEDEF <1>: Types In Guile. (line 218)
  45494. * TYPE_CODE_UNION: Types In Python. (line 208)
  45495. * TYPE_CODE_UNION <1>: Types In Guile. (line 159)
  45496. * TYPE_CODE_VOID: Types In Python. (line 226)
  45497. * TYPE_CODE_VOID <1>: Types In Guile. (line 177)
  45498. * u (SingleKey TUI key): TUI Single Key Mode. (line 37)
  45499. * u (until): Continuing and Stepping.
  45500. (line 124)
  45501. * undefined-command-error-code: GDB/MI Support Commands.
  45502. (line 101)
  45503. * undisplay: Auto Display. (line 45)
  45504. * undo (C-_ or C-x C-u): Miscellaneous Commands.
  45505. (line 23)
  45506. * universal-argument (): Numeric Arguments. (line 10)
  45507. * unix-filename-rubout (): Commands For Killing.
  45508. (line 32)
  45509. * unix-line-discard (C-u): Commands For Killing.
  45510. (line 12)
  45511. * unix-word-rubout (C-w): Commands For Killing.
  45512. (line 28)
  45513. * unset environment: Environment. (line 65)
  45514. * unset substitute-path: Source Path. (line 214)
  45515. * until: Continuing and Stepping.
  45516. (line 124)
  45517. * until&: Background Execution.
  45518. (line 46)
  45519. * unwind-stop-reason-string: Frames In Guile. (line 163)
  45520. * up: Selection. (line 69)
  45521. * Up: TUI Keys. (line 67)
  45522. * up-silently: Selection. (line 106)
  45523. * upcase-word (M-u): Commands For Text. (line 56)
  45524. * update: TUI Commands. (line 106)
  45525. * v (SingleKey TUI key): TUI Single Key Mode. (line 40)
  45526. * value->bool: Values From Inferior In Guile.
  45527. (line 234)
  45528. * value->bytevector: Values From Inferior In Guile.
  45529. (line 246)
  45530. * value->integer: Values From Inferior In Guile.
  45531. (line 238)
  45532. * value->lazy-string: Values From Inferior In Guile.
  45533. (line 291)
  45534. * value->real: Values From Inferior In Guile.
  45535. (line 242)
  45536. * value->string: Values From Inferior In Guile.
  45537. (line 250)
  45538. * value-abs: Arithmetic In Guile. (line 35)
  45539. * value-add: Arithmetic In Guile. (line 15)
  45540. * value-address: Values From Inferior In Guile.
  45541. (line 106)
  45542. * value-call: Values From Inferior In Guile.
  45543. (line 228)
  45544. * value-cast: Values From Inferior In Guile.
  45545. (line 129)
  45546. * value-dereference: Values From Inferior In Guile.
  45547. (line 143)
  45548. * value-div: Arithmetic In Guile. (line 21)
  45549. * value-dynamic-cast: Values From Inferior In Guile.
  45550. (line 135)
  45551. * value-dynamic-type: Values From Inferior In Guile.
  45552. (line 114)
  45553. * value-fetch-lazy!: Values From Inferior In Guile.
  45554. (line 333)
  45555. * value-field: Values From Inferior In Guile.
  45556. (line 221)
  45557. * value-lazy?: Values From Inferior In Guile.
  45558. (line 316)
  45559. * value-logand: Arithmetic In Guile. (line 47)
  45560. * value-logior: Arithmetic In Guile. (line 49)
  45561. * value-lognot: Arithmetic In Guile. (line 45)
  45562. * value-logxor: Arithmetic In Guile. (line 51)
  45563. * value-lsh: Arithmetic In Guile. (line 37)
  45564. * value-max: Arithmetic In Guile. (line 43)
  45565. * value-min: Arithmetic In Guile. (line 41)
  45566. * value-mod: Arithmetic In Guile. (line 25)
  45567. * value-mul: Arithmetic In Guile. (line 19)
  45568. * value-neg: Arithmetic In Guile. (line 31)
  45569. * value-not: Arithmetic In Guile. (line 29)
  45570. * value-optimized-out?: Values From Inferior In Guile.
  45571. (line 102)
  45572. * value-pos: Arithmetic In Guile. (line 33)
  45573. * value-pow: Arithmetic In Guile. (line 27)
  45574. * value-print: Values From Inferior In Guile.
  45575. (line 342)
  45576. * value-referenced-value: Values From Inferior In Guile.
  45577. (line 196)
  45578. * value-reinterpret-cast: Values From Inferior In Guile.
  45579. (line 139)
  45580. * value-rem: Arithmetic In Guile. (line 23)
  45581. * value-rsh: Arithmetic In Guile. (line 39)
  45582. * value-sub: Arithmetic In Guile. (line 17)
  45583. * value-subscript: Values From Inferior In Guile.
  45584. (line 224)
  45585. * value-type: Values From Inferior In Guile.
  45586. (line 110)
  45587. * Value.address: Values From Inferior.
  45588. (line 65)
  45589. * Value.cast: Values From Inferior.
  45590. (line 148)
  45591. * Value.const_value: Values From Inferior.
  45592. (line 236)
  45593. * Value.dereference: Values From Inferior.
  45594. (line 154)
  45595. * Value.dynamic_cast: Values From Inferior.
  45596. (line 240)
  45597. * Value.dynamic_type: Values From Inferior.
  45598. (line 79)
  45599. * Value.fetch_lazy: Values From Inferior.
  45600. (line 386)
  45601. * Value.format_string: Values From Inferior.
  45602. (line 248)
  45603. * Value.is_lazy: Values From Inferior.
  45604. (line 94)
  45605. * Value.is_optimized_out: Values From Inferior.
  45606. (line 70)
  45607. * Value.lazy_string: Values From Inferior.
  45608. (line 364)
  45609. * Value.referenced_value: Values From Inferior.
  45610. (line 207)
  45611. * Value.reference_value: Values From Inferior.
  45612. (line 232)
  45613. * Value.reinterpret_cast: Values From Inferior.
  45614. (line 244)
  45615. * Value.string: Values From Inferior.
  45616. (line 332)
  45617. * Value.type: Values From Inferior.
  45618. (line 75)
  45619. * Value.__init__: Values From Inferior.
  45620. (line 107)
  45621. * Value.__init__ <1>: Values From Inferior.
  45622. (line 141)
  45623. * value<=?: Arithmetic In Guile. (line 57)
  45624. * value<?: Arithmetic In Guile. (line 55)
  45625. * value=?: Arithmetic In Guile. (line 53)
  45626. * value>=?: Arithmetic In Guile. (line 61)
  45627. * value>?: Arithmetic In Guile. (line 59)
  45628. * value?: Values From Inferior In Guile.
  45629. (line 41)
  45630. * vi-cmd-mode-string: Readline Init File Syntax.
  45631. (line 307)
  45632. * vi-editing-mode (M-C-j): Miscellaneous Commands.
  45633. (line 92)
  45634. * vi-ins-mode-string: Readline Init File Syntax.
  45635. (line 318)
  45636. * visible-stats: Readline Init File Syntax.
  45637. (line 329)
  45638. * w (SingleKey TUI key): TUI Single Key Mode. (line 43)
  45639. * w (with): Command Settings. (line 39)
  45640. * watch: Set Watchpoints. (line 42)
  45641. * watchpoint annotation: Annotations for Running.
  45642. (line 50)
  45643. * whatis: Symbols. (line 125)
  45644. * where: Backtrace. (line 94)
  45645. * while: Command Files. (line 85)
  45646. * while-stepping (tracepoints): Tracepoint Actions. (line 126)
  45647. * winheight: TUI Commands. (line 110)
  45648. * with command: Command Settings. (line 39)
  45649. * WP_ACCESS: Breakpoints In Python.
  45650. (line 86)
  45651. * WP_ACCESS <1>: Breakpoints In Guile.
  45652. (line 84)
  45653. * WP_READ: Breakpoints In Python.
  45654. (line 80)
  45655. * WP_READ <1>: Breakpoints In Guile.
  45656. (line 78)
  45657. * WP_WRITE: Breakpoints In Python.
  45658. (line 83)
  45659. * WP_WRITE <1>: Breakpoints In Guile.
  45660. (line 81)
  45661. * x (examine memory): Memory. (line 9)
  45662. * x(examine), and info line: Machine Code. (line 34)
  45663. * XMethod.__init__: Xmethod API. (line 38)
  45664. * XMethodMatcher.match: Xmethod API. (line 47)
  45665. * XMethodMatcher.__init__: Xmethod API. (line 43)
  45666. * XMethodWorker.get_arg_types: Xmethod API. (line 60)
  45667. * XMethodWorker.get_result_type: Xmethod API. (line 67)
  45668. * XMethodWorker.__call__: Xmethod API. (line 73)
  45669. * yank (C-y): Commands For Killing.
  45670. (line 59)
  45671. * yank-last-arg (M-. or M-_): Commands For History.
  45672. (line 79)
  45673. * yank-nth-arg (M-C-y): Commands For History.
  45674. (line 70)
  45675. * yank-pop (M-y): Commands For Killing.
  45676. (line 62)
  45677. 
  45678. Tag Table:
  45679. Node: Top1700
  45680. Node: Summary5156
  45681. Node: Free Software7017
  45682. Node: Free Documentation7757
  45683. Node: Contributors12691
  45684. Node: Sample Session21570
  45685. Node: Invocation28406
  45686. Node: Invoking GDB28949
  45687. Node: File Options31291
  45688. Ref: --readnever34362
  45689. Node: Mode Options34836
  45690. Ref: -nx35063
  45691. Ref: -nh36820
  45692. Node: Startup43144
  45693. Ref: Home Directory Init File43990
  45694. Ref: Option -init-eval-command44100
  45695. Ref: Init File in the Current Directory during Startup44440
  45696. Ref: Startup-Footnote-146636
  45697. Node: Quitting GDB46745
  45698. Node: Shell Commands47642
  45699. Ref: pipe48569
  45700. Node: Logging Output50083
  45701. Node: Commands51209
  45702. Node: Command Syntax51970
  45703. Node: Command Settings54142
  45704. Node: Completion57155
  45705. Ref: Completion-Footnote-164095
  45706. Node: Command Options64255
  45707. Node: Help66607
  45708. Node: Running73121
  45709. Node: Compilation74350
  45710. Node: Starting76429
  45711. Ref: set exec-wrapper82219
  45712. Ref: set startup-with-shell83308
  45713. Ref: set auto-connect-native-target84369
  45714. Node: Arguments88765
  45715. Node: Environment90034
  45716. Ref: set environment91916
  45717. Ref: unset environment93098
  45718. Node: Working Directory94104
  45719. Ref: set cwd command94676
  45720. Ref: cd command95616
  45721. Node: Input/Output96310
  45722. Node: Attach98370
  45723. Node: Kill Process100836
  45724. Node: Inferiors and Programs101817
  45725. Node: Threads109549
  45726. Ref: thread numbers111660
  45727. Ref: thread ID lists112550
  45728. Ref: global thread numbers113590
  45729. Ref: thread apply all117442
  45730. Ref: set libthread-db-search-path122281
  45731. Node: Forks124335
  45732. Node: Checkpoint/Restart130853
  45733. Ref: Checkpoint/Restart-Footnote-1135381
  45734. Node: Stopping135416
  45735. Node: Breakpoints136679
  45736. Node: Set Breaks139936
  45737. Node: Set Watchpoints158895
  45738. Node: Set Catchpoints168277
  45739. Ref: catch syscall173775
  45740. Node: Delete Breaks181540
  45741. Node: Disabling183476
  45742. Node: Conditions186856
  45743. Node: Break Commands192503
  45744. Node: Dynamic Printf195723
  45745. Node: Save Breakpoints200027
  45746. Node: Static Probe Points201202
  45747. Ref: Static Probe Points-Footnote-1205380
  45748. Ref: Static Probe Points-Footnote-2205540
  45749. Node: Error in Breakpoints205680
  45750. Node: Breakpoint-related Warnings206416
  45751. Node: Continuing and Stepping208743
  45752. Ref: range stepping218523
  45753. Node: Skipping Over Functions and Files219603
  45754. Node: Signals225452
  45755. Ref: stepping and signal handlers229886
  45756. Ref: stepping into signal handlers230682
  45757. Ref: extra signal information231915
  45758. Node: Thread Stops234381
  45759. Node: All-Stop Mode235480
  45760. Node: Non-Stop Mode239447
  45761. Node: Background Execution242860
  45762. Node: Thread-Specific Breakpoints245076
  45763. Node: Interrupted System Calls247092
  45764. Node: Observer Mode248606
  45765. Node: Reverse Execution252042
  45766. Ref: Reverse Execution-Footnote-1256960
  45767. Ref: Reverse Execution-Footnote-2257587
  45768. Node: Process Record and Replay257637
  45769. Node: Stack279026
  45770. Node: Frames280643
  45771. Node: Backtrace282981
  45772. Ref: backtrace-command283318
  45773. Ref: set backtrace past-main289765
  45774. Ref: set backtrace past-entry290093
  45775. Ref: set backtrace limit290660
  45776. Ref: Backtrace-Footnote-1291284
  45777. Node: Selection291472
  45778. Node: Frame Info296255
  45779. Node: Frame Apply300677
  45780. Ref: frame apply300863
  45781. Node: Frame Filter Management305096
  45782. Ref: disable frame-filter all305624
  45783. Node: Source309932
  45784. Node: List310998
  45785. Node: Specify Location313700
  45786. Node: Linespec Locations314321
  45787. Node: Explicit Locations317720
  45788. Node: Address Locations320932
  45789. Node: Edit322683
  45790. Ref: Edit-Footnote-1324159
  45791. Node: Search324394
  45792. Node: Source Path325202
  45793. Ref: set substitute-path334143
  45794. Node: Machine Code336363
  45795. Node: Data346707
  45796. Ref: print options347546
  45797. Node: Expressions357547
  45798. Node: Ambiguous Expressions359650
  45799. Node: Variables362880
  45800. Node: Arrays369478
  45801. Node: Output Formats372009
  45802. Ref: Output Formats-Footnote-1375382
  45803. Node: Memory375539
  45804. Ref: addressable memory unit381724
  45805. Node: Auto Display383218
  45806. Node: Print Settings387760
  45807. Ref: set print address388058
  45808. Ref: set print symbol391720
  45809. Ref: set print array392208
  45810. Ref: set print array-indexes392536
  45811. Ref: set print elements393022
  45812. Ref: set print frame-arguments393687
  45813. Ref: set print raw-frame-arguments395856
  45814. Ref: set print entry-values396272
  45815. Ref: set print frame-info400651
  45816. Ref: set print repeats402317
  45817. Ref: set print max-depth402959
  45818. Ref: set print null-stop404651
  45819. Ref: set print pretty404975
  45820. Ref: set print raw-values405562
  45821. Ref: set print union406579
  45822. Ref: set print object408885
  45823. Ref: set print static-members409679
  45824. Ref: set print vtbl410356
  45825. Node: Pretty Printing410740
  45826. Node: Pretty-Printer Introduction411254
  45827. Node: Pretty-Printer Example413009
  45828. Node: Pretty-Printer Commands413787
  45829. Node: Value History416718
  45830. Node: Convenience Vars419140
  45831. Node: Convenience Funs426782
  45832. Node: Registers435297
  45833. Ref: standard registers436505
  45834. Ref: Registers-Footnote-1441456
  45835. Node: Floating Point Hardware441851
  45836. Node: Vector Unit442383
  45837. Node: OS Information442770
  45838. Ref: linux info os infotypes444794
  45839. Node: Memory Region Attributes449385
  45840. Node: Dump/Restore Files454049
  45841. Node: Core File Generation456452
  45842. Ref: set use-coredump-filter458012
  45843. Ref: set dump-excluded-mappings459460
  45844. Node: Character Sets459742
  45845. Node: Caching Target Data466107
  45846. Ref: Caching Target Data-Footnote-1468835
  45847. Node: Searching Memory469073
  45848. Node: Value Sizes472216
  45849. Node: Optimized Code473868
  45850. Node: Inline Functions475545
  45851. Node: Tail Call Frames478172
  45852. Ref: set debug entry-values480309
  45853. Node: Macros484373
  45854. Ref: Macros-Footnote-1491949
  45855. Node: Tracepoints492102
  45856. Node: Set Tracepoints494164
  45857. Node: Create and Delete Tracepoints497102
  45858. Node: Enable and Disable Tracepoints503450
  45859. Node: Tracepoint Passcounts504690
  45860. Node: Tracepoint Conditions506101
  45861. Node: Trace State Variables507795
  45862. Node: Tracepoint Actions509990
  45863. Node: Listing Tracepoints516773
  45864. Node: Listing Static Tracepoint Markers518475
  45865. Node: Starting and Stopping Trace Experiments520323
  45866. Ref: disconnected tracing522068
  45867. Node: Tracepoint Restrictions526488
  45868. Node: Analyze Collected Data530257
  45869. Node: tfind531563
  45870. Node: tdump536045
  45871. Node: save tracepoints538560
  45872. Node: Tracepoint Variables539056
  45873. Node: Trace Files540184
  45874. Node: Overlays542560
  45875. Node: How Overlays Work543280
  45876. Ref: A code overlay545835
  45877. Node: Overlay Commands549248
  45878. Node: Automatic Overlay Debugging553430
  45879. Node: Overlay Sample Program555569
  45880. Node: Languages557306
  45881. Node: Setting558469
  45882. Node: Filenames560170
  45883. Node: Manually560981
  45884. Node: Automatically562190
  45885. Node: Show563251
  45886. Ref: show language563539
  45887. Node: Checks564573
  45888. Node: Type Checking565578
  45889. Node: Range Checking567407
  45890. Node: Supported Languages569808
  45891. Node: C571145
  45892. Node: C Operators572109
  45893. Node: C Constants576447
  45894. Node: C Plus Plus Expressions579326
  45895. Node: C Defaults582686
  45896. Node: C Checks583354
  45897. Node: Debugging C583914
  45898. Node: Debugging C Plus Plus584398
  45899. Node: Decimal Floating Point589285
  45900. Node: D590555
  45901. Node: Go590813
  45902. Node: Objective-C591907
  45903. Node: Method Names in Commands592370
  45904. Node: The Print Command with Objective-C594061
  45905. Node: OpenCL C594712
  45906. Node: OpenCL C Datatypes594987
  45907. Node: OpenCL C Expressions595362
  45908. Node: OpenCL C Operators595719
  45909. Node: Fortran595951
  45910. Node: Fortran Operators596672
  45911. Node: Fortran Defaults597717
  45912. Node: Special Fortran Commands598102
  45913. Node: Pascal598608
  45914. Node: Rust599119
  45915. Node: Modula-2602206
  45916. Node: M2 Operators603179
  45917. Node: Built-In Func/Proc606177
  45918. Node: M2 Constants609091
  45919. Node: M2 Types610692
  45920. Node: M2 Defaults613910
  45921. Node: Deviations614511
  45922. Node: M2 Checks615612
  45923. Node: M2 Scope616429
  45924. Node: GDB/M2617453
  45925. Node: Ada618366
  45926. Node: Ada Mode Intro619672
  45927. Node: Omissions from Ada621174
  45928. Node: Additions to Ada625529
  45929. Node: Overloading support for Ada629457
  45930. Node: Stopping Before Main Program631097
  45931. Node: Ada Exceptions631644
  45932. Node: Ada Tasks632843
  45933. Node: Ada Tasks and Core Files639334
  45934. Node: Ravenscar Profile640181
  45935. Node: Ada Settings641252
  45936. Node: Ada Glitches642674
  45937. Node: Unsupported Languages646682
  45938. Node: Symbols647372
  45939. Ref: quoting names647975
  45940. Node: Altering678890
  45941. Node: Assignment679928
  45942. Node: Jumping683034
  45943. Node: Signaling685108
  45944. Node: Returning688037
  45945. Node: Calling691388
  45946. Node: Patching696873
  45947. Node: Compiling and Injecting Code697987
  45948. Ref: set debug compile701614
  45949. Ref: set debug compile-cplus-types701864
  45950. Node: GDB Files711885
  45951. Node: Files712674
  45952. Ref: Shared Libraries726391
  45953. Ref: Files-Footnote-1738589
  45954. Node: File Caching738718
  45955. Node: Separate Debug Files739852
  45956. Ref: debug-file-directory743205
  45957. Node: MiniDebugInfo751820
  45958. Node: Index Files754271
  45959. Node: Symbol Errors758442
  45960. Node: Data Files762058
  45961. Node: Targets763014
  45962. Node: Active Targets764494
  45963. Node: Target Commands765568
  45964. Ref: load769957
  45965. Ref: flash-erase771150
  45966. Node: Byte Order771210
  45967. Node: Remote Debugging772649
  45968. Node: Connecting773911
  45969. Ref: --multi Option in Types of Remote Connnections776137
  45970. Ref: Attaching in Types of Remote Connections777552
  45971. Ref: Host and target files778053
  45972. Node: File Transfer786675
  45973. Node: Server787614
  45974. Ref: Running gdbserver789190
  45975. Ref: Attaching to a program791408
  45976. Ref: Other Command-Line Arguments for gdbserver793933
  45977. Ref: Monitor Commands for gdbserver797252
  45978. Ref: Server-Footnote-1802628
  45979. Node: Remote Configuration802748
  45980. Ref: set remotebreak804008
  45981. Ref: set remote hardware-watchpoint-limit805470
  45982. Ref: set remote hardware-breakpoint-limit805470
  45983. Ref: set remote hardware-watchpoint-length-limit805972
  45984. Ref: set remote exec-file806427
  45985. Node: Remote Stub818232
  45986. Node: Stub Contents821127
  45987. Node: Bootstrapping823234
  45988. Node: Debug Session827049
  45989. Node: Configurations829090
  45990. Node: Native829859
  45991. Node: BSD libkvm Interface830428
  45992. Node: Process Information831480
  45993. Node: DJGPP Native837029
  45994. Node: Cygwin Native843583
  45995. Node: Non-debug DLL Symbols848504
  45996. Node: Hurd Native852743
  45997. Node: Darwin857999
  45998. Node: FreeBSD859276
  45999. Node: Embedded OS859996
  46000. Node: Embedded Processors860407
  46001. Node: ARC861397
  46002. Node: ARM861944
  46003. Node: M68K864491
  46004. Node: MicroBlaze864664
  46005. Node: MIPS Embedded866113
  46006. Node: OpenRISC 1000867410
  46007. Node: PowerPC Embedded868316
  46008. Node: AVR871545
  46009. Node: CRIS871917
  46010. Node: Super-H872893
  46011. Node: Architectures873952
  46012. Node: AArch64874348
  46013. Node: i386875921
  46014. Ref: i386-Footnote-1880131
  46015. Node: Alpha880217
  46016. Node: MIPS880350
  46017. Node: HPPA884244
  46018. Node: PowerPC884766
  46019. Node: Nios II885502
  46020. Node: Sparc64885907
  46021. Node: S12Z888275
  46022. Node: Controlling GDB888568
  46023. Node: Prompt889511
  46024. Node: Editing891229
  46025. Node: Command History892539
  46026. Node: Screen Size896845
  46027. Node: Output Styling898861
  46028. Node: Numbers902944
  46029. Node: ABI904926
  46030. Node: Auto-loading908099
  46031. Ref: set auto-load off909474
  46032. Ref: show auto-load910110
  46033. Ref: info auto-load910889
  46034. Node: Init File in the Current Directory913856
  46035. Ref: set auto-load local-gdbinit914431
  46036. Ref: show auto-load local-gdbinit914613
  46037. Ref: info auto-load local-gdbinit914777
  46038. Node: libthread_db.so.1 file914925
  46039. Ref: set auto-load libthread-db915864
  46040. Ref: show auto-load libthread-db915995
  46041. Ref: info auto-load libthread-db916132
  46042. Node: Auto-loading safe path916316
  46043. Ref: set auto-load safe-path917622
  46044. Ref: show auto-load safe-path918361
  46045. Ref: add-auto-load-safe-path918484
  46046. Node: Auto-loading verbose mode921386
  46047. Ref: set debug auto-load922549
  46048. Ref: show debug auto-load922650
  46049. Node: Messages/Warnings922772
  46050. Ref: confirmation requests924206
  46051. Node: Debugging Output925410
  46052. Node: Other Misc Settings935827
  46053. Node: Extending GDB936851
  46054. Node: Sequences938704
  46055. Node: Define939365
  46056. Node: Hooks944850
  46057. Node: Command Files947216
  46058. Node: Output952289
  46059. Ref: eval957091
  46060. Node: Auto-loading sequences957253
  46061. Ref: set auto-load gdb-scripts957748
  46062. Ref: show auto-load gdb-scripts957872
  46063. Ref: info auto-load gdb-scripts958002
  46064. Node: Python958233
  46065. Node: Python Commands959519
  46066. Node: Python API961633
  46067. Node: Basic Python964238
  46068. Ref: prompt_hook975275
  46069. Node: Exception Handling975873
  46070. Node: Values From Inferior978775
  46071. Node: Types In Python996111
  46072. Node: Pretty Printing API1006103
  46073. Node: Selecting Pretty-Printers1010546
  46074. Node: Writing a Pretty-Printer1013273
  46075. Node: Type Printing API1018595
  46076. Node: Frame Filter API1021211
  46077. Node: Frame Decorator API1028523
  46078. Ref: frame_args1032264
  46079. Node: Writing a Frame Filter1035594
  46080. Node: Unwinding Frames in Python1047068
  46081. Node: Xmethods In Python1054707
  46082. Node: Xmethod API1057603
  46083. Node: Writing an Xmethod1061415
  46084. Node: Inferiors In Python1067250
  46085. Node: Events In Python1071009
  46086. Node: Threads In Python1080217
  46087. Node: Recordings In Python1083561
  46088. Node: Commands In Python1090895
  46089. Node: Parameters In Python1100308
  46090. Node: Functions In Python1107246
  46091. Node: Progspaces In Python1109463
  46092. Node: Objfiles In Python1114368
  46093. Node: Frames In Python1121030
  46094. Node: Blocks In Python1128036
  46095. Node: Symbols In Python1132703
  46096. Node: Symbol Tables In Python1142166
  46097. Node: Line Tables In Python1145387
  46098. Node: Breakpoints In Python1148224
  46099. Ref: python_breakpoint_thread1154547
  46100. Node: Finish Breakpoints in Python1157580
  46101. Node: Lazy Strings In Python1159686
  46102. Node: Architectures In Python1161914
  46103. Node: Python Auto-loading1164103
  46104. Ref: set auto-load python-scripts1164732
  46105. Ref: show auto-load python-scripts1164832
  46106. Ref: info auto-load python-scripts1164938
  46107. Node: Python modules1166072
  46108. Node: gdb.printing1166458
  46109. Node: gdb.types1167885
  46110. Node: gdb.prompt1170897
  46111. Node: Guile1172493
  46112. Node: Guile Introduction1173152
  46113. Node: Guile Commands1174023
  46114. Node: Guile API1175877
  46115. Node: Basic Guile1177874
  46116. Node: Guile Configuration1183556
  46117. Node: GDB Scheme Data Types1184532
  46118. Node: Guile Exception Handling1186364
  46119. Node: Values From Inferior In Guile1190398
  46120. Node: Arithmetic In Guile1205934
  46121. Node: Types In Guile1207565
  46122. Ref: Fields of a type in Guile1215506
  46123. Node: Guile Pretty Printing API1216894
  46124. Node: Selecting Guile Pretty-Printers1222623
  46125. Node: Writing a Guile Pretty-Printer1224999
  46126. Node: Commands In Guile1230184
  46127. Node: Parameters In Guile1240964
  46128. Ref: Parameters In Guile-Footnote-11247845
  46129. Node: Progspaces In Guile1247961
  46130. Node: Objfiles In Guile1250549
  46131. Node: Frames In Guile1252830
  46132. Node: Blocks In Guile1259408
  46133. Node: Symbols In Guile1264216
  46134. Node: Symbol Tables In Guile1271551
  46135. Node: Breakpoints In Guile1274514
  46136. Node: Lazy Strings In Guile1284775
  46137. Node: Architectures In Guile1287066
  46138. Node: Disassembly In Guile1291373
  46139. Node: I/O Ports in Guile1294575
  46140. Node: Memory Ports in Guile1295131
  46141. Node: Iterators In Guile1298397
  46142. Node: Guile Auto-loading1302686
  46143. Ref: set auto-load guile-scripts1303309
  46144. Ref: show auto-load guile-scripts1303407
  46145. Ref: info auto-load guile-scripts1303511
  46146. Node: Guile Modules1304470
  46147. Node: Guile Printing Module1304792
  46148. Node: Guile Types Module1305611
  46149. Node: Auto-loading extensions1306904
  46150. Node: objfile-gdbdotext file1308102
  46151. Ref: set auto-load scripts-directory1309538
  46152. Ref: with-auto-load-dir1309914
  46153. Ref: show auto-load scripts-directory1310732
  46154. Ref: add-auto-load-scripts-directory1310812
  46155. Node: dotdebug_gdb_scripts section1311288
  46156. Node: Which flavor to choose?1315038
  46157. Node: Multiple Extension Languages1316859
  46158. Node: Aliases1317923
  46159. Node: Interpreters1320788
  46160. Node: TUI1323939
  46161. Node: TUI Overview1324937
  46162. Node: TUI Keys1327370
  46163. Node: TUI Single Key Mode1330093
  46164. Node: TUI Commands1331276
  46165. Node: TUI Configuration1335043
  46166. Node: Emacs1337065
  46167. Node: GDB/MI1342502
  46168. Node: GDB/MI General Design1344476
  46169. Node: Context management1346996
  46170. Node: Asynchronous and non-stop modes1350783
  46171. Node: Thread groups1353756
  46172. Node: GDB/MI Command Syntax1356034
  46173. Node: GDB/MI Input Syntax1356277
  46174. Node: GDB/MI Output Syntax1357827
  46175. Node: GDB/MI Compatibility with CLI1361412
  46176. Node: GDB/MI Development and Front Ends1362149
  46177. Node: GDB/MI Output Records1365668
  46178. Node: GDB/MI Result Records1366074
  46179. Node: GDB/MI Stream Records1367424
  46180. Node: GDB/MI Async Records1368689
  46181. Node: GDB/MI Breakpoint Information1379126
  46182. Node: GDB/MI Frame Information1384762
  46183. Node: GDB/MI Thread Information1386044
  46184. Node: GDB/MI Ada Exception Information1387514
  46185. Node: GDB/MI Simple Examples1388064
  46186. Node: GDB/MI Command Description Format1390300
  46187. Node: GDB/MI Breakpoint Commands1391180
  46188. Ref: -break-insert1398288
  46189. Node: GDB/MI Catchpoint Commands1411862
  46190. Node: Shared Library GDB/MI Catchpoint Commands1412275
  46191. Node: Ada Exception GDB/MI Catchpoint Commands1413933
  46192. Node: C++ Exception GDB/MI Catchpoint Commands1417483
  46193. Node: GDB/MI Program Context1421499
  46194. Node: GDB/MI Thread Commands1425767
  46195. Node: GDB/MI Ada Tasking Commands1429068
  46196. Node: GDB/MI Program Execution1431340
  46197. Node: GDB/MI Stack Manipulation1443607
  46198. Ref: -stack-list-arguments1445531
  46199. Ref: -stack-list-frames1449361
  46200. Ref: -stack-list-locals1453690
  46201. Ref: -stack-list-variables1455180
  46202. Node: GDB/MI Variable Objects1456714
  46203. Ref: -var-set-format1466680
  46204. Ref: -var-list-children1468061
  46205. Ref: -var-update1476869
  46206. Ref: -var-set-frozen1479867
  46207. Ref: -var-set-update-range1480664
  46208. Ref: -var-set-visualizer1481193
  46209. Node: GDB/MI Data Manipulation1482683
  46210. Node: GDB/MI Tracepoint Commands1503171
  46211. Node: GDB/MI Symbol Query1514962
  46212. Ref: -symbol-info-functions1515231
  46213. Ref: -symbol-info-module-functions1519744
  46214. Ref: -symbol-info-module-variables1522724
  46215. Ref: -symbol-info-modules1526441
  46216. Ref: -symbol-info-types1528345
  46217. Ref: -symbol-info-variables1530338
  46218. Node: GDB/MI File Commands1535362
  46219. Node: GDB/MI Target Manipulation1539796
  46220. Node: GDB/MI File Transfer Commands1546454
  46221. Node: GDB/MI Ada Exceptions Commands1547777
  46222. Node: GDB/MI Support Commands1549130
  46223. Node: GDB/MI Miscellaneous Commands1553849
  46224. Ref: -interpreter-exec1564202
  46225. Node: Annotations1568174
  46226. Node: Annotations Overview1569093
  46227. Node: Server Prefix1571556
  46228. Node: Prompting1572290
  46229. Node: Errors1573807
  46230. Node: Invalidation1574703
  46231. Node: Annotations for Running1575182
  46232. Node: Source Annotations1576716
  46233. Node: JIT Interface1577645
  46234. Node: Declarations1579445
  46235. Node: Registering Code1580832
  46236. Node: Unregistering Code1581804
  46237. Node: Custom Debug Info1582431
  46238. Node: Using JIT Debug Info Readers1583727
  46239. Node: Writing JIT Debug Info Readers1584739
  46240. Node: In-Process Agent1586934
  46241. Ref: Control Agent1588877
  46242. Node: In-Process Agent Protocol1589744
  46243. Node: IPA Protocol Objects1590535
  46244. Ref: agent expression object1591533
  46245. Ref: tracepoint action object1591738
  46246. Ref: tracepoint object1591818
  46247. Node: IPA Protocol Commands1594348
  46248. Node: GDB Bugs1595818
  46249. Node: Bug Criteria1596550
  46250. Node: Bug Reporting1597427
  46251. Node: Command Line Editing1605256
  46252. Node: Introduction and Notation1605908
  46253. Node: Readline Interaction1607529
  46254. Node: Readline Bare Essentials1608718
  46255. Node: Readline Movement Commands1610499
  46256. Node: Readline Killing Commands1611457
  46257. Node: Readline Arguments1613373
  46258. Node: Searching1614415
  46259. Node: Readline Init File1616565
  46260. Node: Readline Init File Syntax1617716
  46261. Node: Conditional Init Constructs1637872
  46262. Node: Sample Init File1642066
  46263. Node: Bindable Readline Commands1645181
  46264. Node: Commands For Moving1646233
  46265. Node: Commands For History1647797
  46266. Node: Commands For Text1652059
  46267. Node: Commands For Killing1655498
  46268. Node: Numeric Arguments1657662
  46269. Node: Commands For Completion1658799
  46270. Node: Keyboard Macros1660765
  46271. Node: Miscellaneous Commands1661450
  46272. Node: Readline vi Mode1665369
  46273. Node: Using History Interactively1666279
  46274. Node: History Interaction1666794
  46275. Node: Event Designators1668690
  46276. Node: Word Designators1669827
  46277. Node: Modifiers1671462
  46278. Node: In Memoriam1672683
  46279. Node: Formatting Documentation1673566
  46280. Ref: Formatting Documentation-Footnote-11676878
  46281. Node: Installing GDB1676942
  46282. Node: Requirements1677514
  46283. Ref: Expat1678215
  46284. Ref: MPFR1681508
  46285. Node: Running Configure1683129
  46286. Node: Separate Objdir1685824
  46287. Node: Config Names1688702
  46288. Node: Configure Options1690147
  46289. Node: System-wide configuration1699498
  46290. Node: System-wide Configuration Scripts1702035
  46291. Node: Maintenance Commands1703219
  46292. Ref: maint info breakpoints1704874
  46293. Ref: maint check libthread-db1713339
  46294. Node: Remote Protocol1730014
  46295. Node: Overview1730706
  46296. Ref: Binary Data1733251
  46297. Node: Packets1735776
  46298. Ref: thread-id syntax1736676
  46299. Ref: extended mode1738121
  46300. Ref: ? packet1738379
  46301. Ref: bc1739845
  46302. Ref: bs1740055
  46303. Ref: read registers packet1741672
  46304. Ref: cycle step packet1743527
  46305. Ref: write register packet1746238
  46306. Ref: step with signal packet1747217
  46307. Ref: vCont packet1748693
  46308. Ref: vCtrlC packet1751927
  46309. Ref: vKill packet1754345
  46310. Ref: X packet1755879
  46311. Ref: insert breakpoint or watchpoint packet1756248
  46312. Node: Stop Reply Packets1760574
  46313. Ref: swbreak stop reason1763825
  46314. Ref: thread create event1767422
  46315. Ref: thread exit event1768625
  46316. Node: General Query Packets1770834
  46317. Ref: qCRC packet1773664
  46318. Ref: QEnvironmentHexEncoded1776817
  46319. Ref: QEnvironmentUnset1778047
  46320. Ref: QEnvironmentReset1778991
  46321. Ref: QSetWorkingDir packet1779935
  46322. Ref: QNonStop1786386
  46323. Ref: QCatchSyscalls1787062
  46324. Ref: QPassSignals1788599
  46325. Ref: QProgramSignals1789806
  46326. Ref: QThreadEvents1791373
  46327. Ref: qSearch memory1793391
  46328. Ref: QStartNoAckMode1793899
  46329. Ref: qSupported1794431
  46330. Ref: multiprocess extensions1809951
  46331. Ref: install tracepoint in tracing1811981
  46332. Ref: qXfer read1816504
  46333. Ref: qXfer auxiliary vector read1818111
  46334. Ref: qXfer btrace read1818459
  46335. Ref: qXfer btrace-conf read1819524
  46336. Ref: qXfer executable filename read1819875
  46337. Ref: qXfer target description read1820490
  46338. Ref: qXfer library list read1820924
  46339. Ref: qXfer svr4 library list read1821580
  46340. Ref: qXfer memory map read1823433
  46341. Ref: qXfer sdata read1823820
  46342. Ref: qXfer siginfo read1824286
  46343. Ref: qXfer threads read1824682
  46344. Ref: qXfer traceframe info read1825085
  46345. Ref: qXfer unwind info block1825503
  46346. Ref: qXfer fdpic loadmap read1825737
  46347. Ref: qXfer osdata read1826153
  46348. Ref: qXfer write1826307
  46349. Ref: qXfer siginfo write1827399
  46350. Ref: General Query Packets-Footnote-11830127
  46351. Node: Architecture-Specific Protocol Details1830454
  46352. Node: ARM-Specific Protocol Details1830963
  46353. Node: ARM Breakpoint Kinds1831211
  46354. Node: MIPS-Specific Protocol Details1831542
  46355. Node: MIPS Register packet Format1831825
  46356. Node: MIPS Breakpoint Kinds1832752
  46357. Node: Tracepoint Packets1833170
  46358. Ref: QTEnable1842484
  46359. Ref: QTDisable1842680
  46360. Ref: qTfSTM1848217
  46361. Ref: qTsSTM1848217
  46362. Ref: qTSTMat1849294
  46363. Ref: QTBuffer-size1850445
  46364. Node: Host I/O Packets1852418
  46365. Node: Interrupts1857999
  46366. Ref: interrupting remote targets1858143
  46367. Node: Notification Packets1860311
  46368. Node: Remote Non-Stop1865736
  46369. Node: Packet Acknowledgment1868852
  46370. Node: Examples1870967
  46371. Node: File-I/O Remote Protocol Extension1871561
  46372. Node: File-I/O Overview1872023
  46373. Node: Protocol Basics1874222
  46374. Node: The F Request Packet1876451
  46375. Node: The F Reply Packet1877352
  46376. Node: The Ctrl-C Message1878270
  46377. Node: Console I/O1879896
  46378. Node: List of Supported Calls1881112
  46379. Node: open1881474
  46380. Node: close1883982
  46381. Node: read1884365
  46382. Node: write1884974
  46383. Node: lseek1885745
  46384. Node: rename1886629
  46385. Node: unlink1888036
  46386. Node: stat/fstat1888983
  46387. Node: gettimeofday1889876
  46388. Node: isatty1890312
  46389. Node: system1890908
  46390. Node: Protocol-specific Representation of Datatypes1892450
  46391. Node: Integral Datatypes1892827
  46392. Node: Pointer Values1893634
  46393. Node: Memory Transfer1894338
  46394. Node: struct stat1894958
  46395. Node: struct timeval1897160
  46396. Node: Constants1897677
  46397. Node: Open Flags1898126
  46398. Node: mode_t Values1898467
  46399. Node: Errno Values1898959
  46400. Node: Lseek Flags1899769
  46401. Node: Limits1899954
  46402. Node: File-I/O Examples1900314
  46403. Node: Library List Format1901402
  46404. Node: Library List Format for SVR4 Targets1904184
  46405. Node: Memory Map Format1906651
  46406. Node: Thread List Format1909175
  46407. Node: Traceframe Info Format1910179
  46408. Node: Branch Trace Format1911865
  46409. Node: Branch Trace Configuration Format1913565
  46410. Node: Agent Expressions1914739
  46411. Node: General Bytecode Design1917560
  46412. Node: Bytecode Descriptions1922354
  46413. Node: Using Agent Expressions1935821
  46414. Node: Varying Target Capabilities1937798
  46415. Node: Rationale1938959
  46416. Node: Target Descriptions1946348
  46417. Node: Retrieving Descriptions1948291
  46418. Node: Target Description Format1949376
  46419. Node: Predefined Target Types1959251
  46420. Node: Enum Target Types1960696
  46421. Node: Standard Target Features1961691
  46422. Node: AArch64 Features1963691
  46423. Node: ARC Features1964397
  46424. Node: ARM Features1966458
  46425. Node: i386 Features1967972
  46426. Node: MicroBlaze Features1970187
  46427. Node: MIPS Features1970764
  46428. Node: M68K Features1971955
  46429. Node: NDS32 Features1972616
  46430. Node: Nios II Features1973640
  46431. Node: OpenRISC 1000 Features1974045
  46432. Node: PowerPC Features1974411
  46433. Node: RISC-V Features1978381
  46434. Node: RX Features1980071
  46435. Node: S/390 and System z Features1980433
  46436. Node: Sparc Features1982573
  46437. Node: TIC6x Features1983478
  46438. Node: Operating System Information1984027
  46439. Node: Process list1984863
  46440. Node: Trace File Format1985926
  46441. Node: Index Section Format1989140
  46442. Node: Man Pages1997066
  46443. Node: gdb man1997536
  46444. Node: gdbserver man2003510
  46445. Node: gcore man2010907
  46446. Node: gdbinit man2012029
  46447. Node: gdb-add-index man2013222
  46448. Ref: gdb-add-index2013331
  46449. Node: Copying2014205
  46450. Node: GNU Free Documentation License2051766
  46451. Node: Concept Index2076913
  46452. Node: Command and Variable Index2218044
  46453. 
  46454. End Tag Table