gdb.info 2.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571
  1. This is gdb.info, produced by makeinfo version 5.2 from gdb.texinfo.
  2. Copyright (C) 1988-2019 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 (Linaro_GDB-2019.12) Version
  20. 8.3.1.20191204-git.
  21. Copyright (C) 1988-2019 Free Software Foundation, Inc.
  22. Permission is granted to copy, distribute and/or modify this document
  23. under the terms of the GNU Free Documentation License, Version 1.3 or
  24. any later version published by the Free Software Foundation; with the
  25. Invariant Sections being "Free Software" and "Free Software Needs Free
  26. Documentation", with the Front-Cover Texts being "A GNU Manual," and
  27. with the Back-Cover Texts as in (a) below.
  28. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  29. this GNU Manual. Buying copies from GNU Press supports the FSF in
  30. developing GNU and promoting software freedom."
  31. 
  32. File: gdb.info, Node: Top, Next: Summary, Prev: (dir), Up: (dir)
  33. Debugging with GDB
  34. ******************
  35. This file describes GDB, the GNU symbolic debugger.
  36. This is the Tenth Edition, for GDB (Linaro_GDB-2019.12) Version
  37. 8.3.1.20191204-git.
  38. Copyright (C) 1988-2019 Free Software Foundation, Inc.
  39. This edition of the GDB manual is dedicated to the memory of Fred
  40. Fish. Fred was a long-standing contributor to GDB and to Free software
  41. in general. We will miss him.
  42. * Menu:
  43. * Summary:: Summary of GDB
  44. * Sample Session:: A sample GDB session
  45. * Invocation:: Getting in and out of GDB
  46. * Commands:: GDB commands
  47. * Running:: Running programs under GDB
  48. * Stopping:: Stopping and continuing
  49. * Reverse Execution:: Running programs backward
  50. * Process Record and Replay:: Recording inferior's execution and replaying it
  51. * Stack:: Examining the stack
  52. * Source:: Examining source files
  53. * Data:: Examining data
  54. * Optimized Code:: Debugging optimized code
  55. * Macros:: Preprocessor Macros
  56. * Tracepoints:: Debugging remote targets non-intrusively
  57. * Overlays:: Debugging programs that use overlays
  58. * Languages:: Using GDB with different languages
  59. * Symbols:: Examining the symbol table
  60. * Altering:: Altering execution
  61. * GDB Files:: GDB files
  62. * Targets:: Specifying a debugging target
  63. * Remote Debugging:: Debugging remote programs
  64. * Configurations:: Configuration-specific information
  65. * Controlling GDB:: Controlling GDB
  66. * Extending GDB:: Extending GDB
  67. * Interpreters:: Command Interpreters
  68. * TUI:: GDB Text User Interface
  69. * Emacs:: Using GDB under GNU Emacs
  70. * GDB/MI:: GDB's Machine Interface.
  71. * Annotations:: GDB's annotation interface.
  72. * JIT Interface:: Using the JIT debugging interface.
  73. * In-Process Agent:: In-Process Agent
  74. * GDB Bugs:: Reporting bugs in GDB
  75. * Command Line Editing:: Command Line Editing
  76. * Using History Interactively:: Using History Interactively
  77. * In Memoriam:: In Memoriam
  78. * Formatting Documentation:: How to format and print GDB documentation
  79. * Installing GDB:: Installing GDB
  80. * Maintenance Commands:: Maintenance Commands
  81. * Remote Protocol:: GDB Remote Serial Protocol
  82. * Agent Expressions:: The GDB Agent Expression Mechanism
  83. * Target Descriptions:: How targets can describe themselves to
  84. GDB
  85. * Operating System Information:: Getting additional information from
  86. the operating system
  87. * Trace File Format:: GDB trace file format
  88. * Index Section Format:: .gdb_index section format
  89. * Man Pages:: Manual pages
  90. * Copying:: GNU General Public License says
  91. how you can copy and share GDB
  92. * GNU Free Documentation License:: The license for this documentation
  93. * Concept Index:: Index of GDB concepts
  94. * Command and Variable Index:: Index of GDB commands, variables,
  95. functions, and Python data types
  96. 
  97. File: gdb.info, Node: Summary, Next: Sample Session, Up: Top
  98. Summary of GDB
  99. **************
  100. The purpose of a debugger such as GDB is to allow you to see what is
  101. going on "inside" another program while it executes--or what another
  102. program was doing at the moment it crashed.
  103. GDB can do four main kinds of things (plus other things in support of
  104. these) to help you catch bugs in the act:
  105. * Start your program, specifying anything that might affect its
  106. behavior.
  107. * Make your program stop on specified conditions.
  108. * Examine what has happened, when your program has stopped.
  109. * Change things in your program, so you can experiment with
  110. correcting the effects of one bug and go on to learn about another.
  111. You can use GDB to debug programs written in C and C++. For more
  112. information, see *note Supported Languages: Supported Languages. For
  113. more information, see *note C and C++: C.
  114. Support for D is partial. For information on D, see *note D: D.
  115. Support for Modula-2 is partial. For information on Modula-2, see
  116. *note Modula-2: Modula-2.
  117. Support for OpenCL C is partial. For information on OpenCL C, see
  118. *note OpenCL C: OpenCL C.
  119. Debugging Pascal programs which use sets, subranges, file variables,
  120. or nested functions does not currently work. GDB does not support
  121. entering expressions, printing values, or similar features using Pascal
  122. syntax.
  123. GDB can be used to debug programs written in Fortran, although it may
  124. be necessary to refer to some variables with a trailing underscore.
  125. GDB can be used to debug programs written in Objective-C, using
  126. either the Apple/NeXT or the GNU Objective-C runtime.
  127. * Menu:
  128. * Free Software:: Freely redistributable software
  129. * Free Documentation:: Free Software Needs Free Documentation
  130. * Contributors:: Contributors to GDB
  131. 
  132. File: gdb.info, Node: Free Software, Next: Free Documentation, Up: Summary
  133. Free Software
  134. =============
  135. GDB is "free software", protected by the GNU General Public License
  136. (GPL). The GPL gives you the freedom to copy or adapt a licensed
  137. program--but every person getting a copy also gets with it the freedom
  138. to modify that copy (which means that they must get access to the source
  139. code), and the freedom to distribute further copies. Typical software
  140. companies use copyrights to limit your freedoms; the Free Software
  141. Foundation uses the GPL to preserve these freedoms.
  142. Fundamentally, the General Public License is a license which says
  143. that you have these freedoms and that you cannot take these freedoms
  144. away from anyone else.
  145. 
  146. File: gdb.info, Node: Free Documentation, Next: Contributors, Prev: Free Software, Up: Summary
  147. Free Software Needs Free Documentation
  148. ======================================
  149. The biggest deficiency in the free software community today is not in
  150. the software--it is the lack of good free documentation that we can
  151. include with the free software. Many of our most important programs do
  152. not come with free reference manuals and free introductory texts.
  153. Documentation is an essential part of any software package; when an
  154. important free software package does not come with a free manual and a
  155. free tutorial, that is a major gap. We have many such gaps today.
  156. Consider Perl, for instance. The tutorial manuals that people
  157. normally use are non-free. How did this come about? Because the
  158. authors of those manuals published them with restrictive terms--no
  159. copying, no modification, source files not available--which exclude them
  160. from the free software world.
  161. That wasn't the first time this sort of thing happened, and it was
  162. far from the last. Many times we have heard a GNU user eagerly describe
  163. a manual that he is writing, his intended contribution to the community,
  164. only to learn that he had ruined everything by signing a publication
  165. contract to make it non-free.
  166. Free documentation, like free software, is a matter of freedom, not
  167. price. The problem with the non-free manual is not that publishers
  168. charge a price for printed copies--that in itself is fine. (The Free
  169. Software Foundation sells printed copies of manuals, too.) The problem
  170. is the restrictions on the use of the manual. Free manuals are
  171. available in source code form, and give you permission to copy and
  172. modify. Non-free manuals do not allow this.
  173. The criteria of freedom for a free manual are roughly the same as for
  174. free software. Redistribution (including the normal kinds of commercial
  175. redistribution) must be permitted, so that the manual can accompany
  176. every copy of the program, both on-line and on paper.
  177. Permission for modification of the technical content is crucial too.
  178. When people modify the software, adding or changing features, if they
  179. are conscientious they will change the manual too--so they can provide
  180. accurate and clear documentation for the modified program. A manual
  181. that leaves you no choice but to write a new manual to document a
  182. changed version of the program is not really available to our community.
  183. Some kinds of limits on the way modification is handled are
  184. acceptable. For example, requirements to preserve the original author's
  185. copyright notice, the distribution terms, or the list of authors, are
  186. ok. It is also no problem to require modified versions to include
  187. notice that they were modified. Even entire sections that may not be
  188. deleted or changed are acceptable, as long as they deal with
  189. nontechnical topics (like this one). These kinds of restrictions are
  190. acceptable because they don't obstruct the community's normal use of the
  191. manual.
  192. However, it must be possible to modify all the _technical_ content of
  193. the manual, and then distribute the result in all the usual media,
  194. through all the usual channels. Otherwise, the restrictions obstruct
  195. the use of the manual, it is not free, and we need another manual to
  196. replace it.
  197. Please spread the word about this issue. Our community continues to
  198. lose manuals to proprietary publishing. If we spread the word that free
  199. software needs free reference manuals and free tutorials, perhaps the
  200. next person who wants to contribute by writing documentation will
  201. realize, before it is too late, that only free manuals contribute to the
  202. free software community.
  203. If you are writing documentation, please insist on publishing it
  204. under the GNU Free Documentation License or another free documentation
  205. license. Remember that this decision requires your approval--you don't
  206. have to let the publisher decide. Some commercial publishers will use a
  207. free license if you insist, but they will not propose the option; it is
  208. up to you to raise the issue and say firmly that this is what you want.
  209. If the publisher you are dealing with refuses, please try other
  210. publishers. If you're not sure whether a proposed license is free,
  211. write to <licensing@gnu.org>.
  212. You can encourage commercial publishers to sell more free, copylefted
  213. manuals and tutorials by buying them, and particularly by buying copies
  214. from the publishers that paid for their writing or for major
  215. improvements. Meanwhile, try to avoid buying non-free documentation at
  216. all. Check the distribution terms of a manual before you buy it, and
  217. insist that whoever seeks your business must respect your freedom.
  218. Check the history of the book, and try to reward the publishers that
  219. have paid or pay the authors to work on it.
  220. The Free Software Foundation maintains a list of free documentation
  221. published by other publishers, at
  222. <http://www.fsf.org/doc/other-free-books.html>.
  223. 
  224. File: gdb.info, Node: Contributors, Prev: Free Documentation, Up: Summary
  225. Contributors to GDB
  226. ===================
  227. Richard Stallman was the original author of GDB, and of many other GNU
  228. programs. Many others have contributed to its development. This
  229. section attempts to credit major contributors. One of the virtues of
  230. free software is that everyone is free to contribute to it; with regret,
  231. we cannot actually acknowledge everyone here. The file 'ChangeLog' in
  232. the GDB distribution approximates a blow-by-blow account.
  233. Changes much prior to version 2.0 are lost in the mists of time.
  234. _Plea:_ Additions to this section are particularly welcome. If you
  235. or your friends (or enemies, to be evenhanded) have been unfairly
  236. omitted from this list, we would like to add your names!
  237. So that they may not regard their many labors as thankless, we
  238. particularly thank those who shepherded GDB through major releases:
  239. Andrew Cagney (releases 6.3, 6.2, 6.1, 6.0, 5.3, 5.2, 5.1 and 5.0); Jim
  240. Blandy (release 4.18); Jason Molenda (release 4.17); Stan Shebs (release
  241. 4.14); Fred Fish (releases 4.16, 4.15, 4.13, 4.12, 4.11, 4.10, and 4.9);
  242. Stu Grossman and John Gilmore (releases 4.8, 4.7, 4.6, 4.5, and 4.4);
  243. John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and 3.9); Jim Kingdon
  244. (releases 3.5, 3.4, and 3.3); and Randy Smith (releases 3.2, 3.1, and
  245. 3.0).
  246. Richard Stallman, assisted at various times by Peter TerMaat, Chris
  247. Hanson, and Richard Mlynarik, handled releases through 2.8.
  248. Michael Tiemann is the author of most of the GNU C++ support in GDB,
  249. with significant additional contributions from Per Bothner and Daniel
  250. Berlin. James Clark wrote the GNU C++ demangler. Early work on C++ was
  251. by Peter TerMaat (who also did much general update work leading to
  252. release 3.0).
  253. GDB uses the BFD subroutine library to examine multiple object-file
  254. formats; BFD was a joint project of David V. Henkel-Wallace, Rich
  255. Pixley, Steve Chamberlain, and John Gilmore.
  256. David Johnson wrote the original COFF support; Pace Willison did the
  257. original support for encapsulated COFF.
  258. Brent Benson of Harris Computer Systems contributed DWARF 2 support.
  259. Adam de Boor and Bradley Davis contributed the ISI Optimum V support.
  260. Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS
  261. support. Jean-Daniel Fekete contributed Sun 386i support. Chris Hanson
  262. improved the HP9000 support. Noboyuki Hikichi and Tomoyuki Hasei
  263. contributed Sony/News OS 3 support. David Johnson contributed Encore
  264. Umax support. Jyrki Kuoppala contributed Altos 3068 support. Jeff Law
  265. contributed HP PA and SOM support. Keith Packard contributed NS32K
  266. support. Doug Rabson contributed Acorn Risc Machine support. Bob Rusk
  267. contributed Harris Nighthawk CX-UX support. Chris Smith contributed
  268. Convex support (and Fortran debugging). Jonathan Stone contributed
  269. Pyramid support. Michael Tiemann contributed SPARC support. Tim Tucker
  270. contributed support for the Gould NP1 and Gould Powernode. Pace
  271. Willison contributed Intel 386 support. Jay Vosburgh contributed
  272. Symmetry support. Marko Mlinar contributed OpenRISC 1000 support.
  273. Andreas Schwab contributed M68K GNU/Linux support.
  274. Rich Schaefer and Peter Schauer helped with support of SunOS shared
  275. libraries.
  276. Jay Fenlason and Roland McGrath ensured that GDB and GAS agree about
  277. several machine instruction sets.
  278. Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped
  279. develop remote debugging. Intel Corporation, Wind River Systems, AMD,
  280. and ARM contributed remote debugging modules for the i960, VxWorks, A29K
  281. UDI, and RDI targets, respectively.
  282. Brian Fox is the author of the readline libraries providing
  283. command-line editing and command history.
  284. Andrew Beers of SUNY Buffalo wrote the language-switching code, the
  285. Modula-2 support, and contributed the Languages chapter of this manual.
  286. Fred Fish wrote most of the support for Unix System Vr4. He also
  287. enhanced the command-completion support to cover C++ overloaded symbols.
  288. Hitachi America (now Renesas America), Ltd. sponsored the support
  289. for H8/300, H8/500, and Super-H processors.
  290. NEC sponsored the support for the v850, Vr4xxx, and Vr5xxx
  291. processors.
  292. Mitsubishi (now Renesas) sponsored the support for D10V, D30V, and
  293. M32R/D processors.
  294. Toshiba sponsored the support for the TX39 Mips processor.
  295. Matsushita sponsored the support for the MN10200 and MN10300
  296. processors.
  297. Fujitsu sponsored the support for SPARClite and FR30 processors.
  298. Kung Hsu, Jeff Law, and Rick Sladkey added support for hardware
  299. watchpoints.
  300. Michael Snyder added support for tracepoints.
  301. Stu Grossman wrote gdbserver.
  302. Jim Kingdon, Peter Schauer, Ian Taylor, and Stu Grossman made nearly
  303. innumerable bug fixes and cleanups throughout GDB.
  304. The following people at the Hewlett-Packard Company contributed
  305. support for the PA-RISC 2.0 architecture, HP-UX 10.20, 10.30, and 11.0
  306. (narrow mode), HP's implementation of kernel threads, HP's aC++
  307. compiler, and the Text User Interface (nee Terminal User Interface): Ben
  308. Krepp, Richard Title, John Bishop, Susan Macchia, Kathy Mann, Satish
  309. Pai, India Paul, Steve Rehrauer, and Elena Zannoni. Kim Haase provided
  310. HP-specific information in this manual.
  311. DJ Delorie ported GDB to MS-DOS, for the DJGPP project. Robert
  312. Hoehne made significant contributions to the DJGPP port.
  313. Cygnus Solutions has sponsored GDB maintenance and much of its
  314. development since 1991. Cygnus engineers who have worked on GDB
  315. fulltime include Mark Alexander, Jim Blandy, Per Bothner, Kevin
  316. Buettner, Edith Epstein, Chris Faylor, Fred Fish, Martin Hunt, Jim
  317. Ingham, John Gilmore, Stu Grossman, Kung Hsu, Jim Kingdon, John Metzler,
  318. Fernando Nasser, Geoffrey Noer, Dawn Perchik, Rich Pixley, Zdenek
  319. Radouch, Keith Seitz, Stan Shebs, David Taylor, and Elena Zannoni. In
  320. addition, Dave Brolley, Ian Carmichael, Steve Chamberlain, Nick Clifton,
  321. JT Conklin, Stan Cox, DJ Delorie, Ulrich Drepper, Frank Eigler, Doug
  322. Evans, Sean Fagan, David Henkel-Wallace, Richard Henderson, Jeff
  323. Holcomb, Jeff Law, Jim Lemke, Tom Lord, Bob Manson, Michael Meissner,
  324. Jason Merrill, Catherine Moore, Drew Moseley, Ken Raeburn, Gavin
  325. Romig-Koch, Rob Savoye, Jamie Smith, Mike Stump, Ian Taylor, Angela
  326. Thomas, Michael Tiemann, Tom Tromey, Ron Unrau, Jim Wilson, and David
  327. Zuhn have made contributions both large and small.
  328. Andrew Cagney, Fernando Nasser, and Elena Zannoni, while working for
  329. Cygnus Solutions, implemented the original GDB/MI interface.
  330. Jim Blandy added support for preprocessor macros, while working for
  331. Red Hat.
  332. Andrew Cagney designed GDB's architecture vector. Many people
  333. including Andrew Cagney, Stephane Carrez, Randolph Chung, Nick Duffek,
  334. Richard Henderson, Mark Kettenis, Grace Sainsbury, Kei Sakamoto,
  335. Yoshinori Sato, Michael Snyder, Andreas Schwab, Jason Thorpe, Corinna
  336. Vinschen, Ulrich Weigand, and Elena Zannoni, helped with the migration
  337. of old architectures to this new framework.
  338. Andrew Cagney completely re-designed and re-implemented GDB's
  339. unwinder framework, this consisting of a fresh new design featuring
  340. frame IDs, independent frame sniffers, and the sentinel frame. Mark
  341. Kettenis implemented the DWARF 2 unwinder, Jeff Johnston the libunwind
  342. unwinder, and Andrew Cagney the dummy, sentinel, tramp, and trad
  343. unwinders. The architecture-specific changes, each involving a complete
  344. rewrite of the architecture's frame code, were carried out by Jim
  345. Blandy, Joel Brobecker, Kevin Buettner, Andrew Cagney, Stephane Carrez,
  346. Randolph Chung, Orjan Friberg, Richard Henderson, Daniel Jacobowitz,
  347. Jeff Johnston, Mark Kettenis, Theodore A. Roth, Kei Sakamoto, Yoshinori
  348. Sato, Michael Snyder, Corinna Vinschen, and Ulrich Weigand.
  349. Christian Zankel, Ross Morley, Bob Wilson, and Maxim Grigoriev from
  350. Tensilica, Inc. contributed support for Xtensa processors. Others who
  351. have worked on the Xtensa port of GDB in the past include Steve Tjiang,
  352. John Newlin, and Scott Foehner.
  353. Michael Eager and staff of Xilinx, Inc., contributed support for the
  354. Xilinx MicroBlaze architecture.
  355. Initial support for the FreeBSD/mips target and native configuration
  356. was developed by SRI International and the University of Cambridge
  357. Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
  358. ("CTSRD"), as part of the DARPA CRASH research programme.
  359. Initial support for the FreeBSD/riscv target and native configuration
  360. was developed by SRI International and the University of Cambridge
  361. Computer Laboratory (Department of Computer Science and Technology)
  362. under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the DARPA
  363. SSITH research programme.
  364. The original port to the OpenRISC 1000 is believed to be due to
  365. Alessandro Forin and Per Bothner. More recent ports have been the work
  366. of Jeremy Bennett, Franck Jullien, Stefan Wallentowitz and Stafford
  367. Horne.
  368. 
  369. File: gdb.info, Node: Sample Session, Next: Invocation, Prev: Summary, Up: Top
  370. 1 A Sample GDB Session
  371. **********************
  372. You can use this manual at your leisure to read all about GDB. However,
  373. a handful of commands are enough to get started using the debugger.
  374. This chapter illustrates those commands.
  375. One of the preliminary versions of GNU 'm4' (a generic macro
  376. processor) exhibits the following bug: sometimes, when we change its
  377. quote strings from the default, the commands used to capture one macro
  378. definition within another stop working. In the following short 'm4'
  379. session, we define a macro 'foo' which expands to '0000'; we then use
  380. the 'm4' built-in 'defn' to define 'bar' as the same thing. However,
  381. when we change the open quote string to '<QUOTE>' and the close quote
  382. string to '<UNQUOTE>', the same procedure fails to define a new synonym
  383. 'baz':
  384. $ cd gnu/m4
  385. $ ./m4
  386. define(foo,0000)
  387. foo
  388. 0000
  389. define(bar,defn('foo'))
  390. bar
  391. 0000
  392. changequote(<QUOTE>,<UNQUOTE>)
  393. define(baz,defn(<QUOTE>foo<UNQUOTE>))
  394. baz
  395. Ctrl-d
  396. m4: End of input: 0: fatal error: EOF in string
  397. Let us use GDB to try to see what is going on.
  398. $ gdb m4
  399. GDB is free software and you are welcome to distribute copies
  400. of it under certain conditions; type "show copying" to see
  401. the conditions.
  402. There is absolutely no warranty for GDB; type "show warranty"
  403. for details.
  404. GDB 8.3.1.20191204-git, Copyright 1999 Free Software Foundation, Inc...
  405. (gdb)
  406. GDB reads only enough symbol data to know where to find the rest when
  407. needed; as a result, the first prompt comes up very quickly. We now
  408. tell GDB to use a narrower display width than usual, so that examples
  409. fit in this manual.
  410. (gdb) set width 70
  411. We need to see how the 'm4' built-in 'changequote' works. Having looked
  412. at the source, we know the relevant subroutine is 'm4_changequote', so
  413. we set a breakpoint there with the GDB 'break' command.
  414. (gdb) break m4_changequote
  415. Breakpoint 1 at 0x62f4: file builtin.c, line 879.
  416. Using the 'run' command, we start 'm4' running under GDB control; as
  417. long as control does not reach the 'm4_changequote' subroutine, the
  418. program runs as usual:
  419. (gdb) run
  420. Starting program: /work/Editorial/gdb/gnu/m4/m4
  421. define(foo,0000)
  422. foo
  423. 0000
  424. To trigger the breakpoint, we call 'changequote'. GDB suspends
  425. execution of 'm4', displaying information about the context where it
  426. stops.
  427. changequote(<QUOTE>,<UNQUOTE>)
  428. Breakpoint 1, m4_changequote (argc=3, argv=0x33c70)
  429. at builtin.c:879
  430. 879 if (bad_argc(TOKEN_DATA_TEXT(argv[0]),argc,1,3))
  431. Now we use the command 'n' ('next') to advance execution to the next
  432. line of the current function.
  433. (gdb) n
  434. 882 set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1])\
  435. : nil,
  436. 'set_quotes' looks like a promising subroutine. We can go into it by
  437. using the command 's' ('step') instead of 'next'. 'step' goes to the
  438. next line to be executed in _any_ subroutine, so it steps into
  439. 'set_quotes'.
  440. (gdb) s
  441. set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
  442. at input.c:530
  443. 530 if (lquote != def_lquote)
  444. The display that shows the subroutine where 'm4' is now suspended (and
  445. its arguments) is called a stack frame display. It shows a summary of
  446. the stack. We can use the 'backtrace' command (which can also be
  447. spelled 'bt'), to see where we are in the stack as a whole: the
  448. 'backtrace' command displays a stack frame for each active subroutine.
  449. (gdb) bt
  450. #0 set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
  451. at input.c:530
  452. #1 0x6344 in m4_changequote (argc=3, argv=0x33c70)
  453. at builtin.c:882
  454. #2 0x8174 in expand_macro (sym=0x33320) at macro.c:242
  455. #3 0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30)
  456. at macro.c:71
  457. #4 0x79dc in expand_input () at macro.c:40
  458. #5 0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195
  459. We step through a few more lines to see what happens. The first two
  460. times, we can use 's'; the next two times we use 'n' to avoid falling
  461. into the 'xstrdup' subroutine.
  462. (gdb) s
  463. 0x3b5c 532 if (rquote != def_rquote)
  464. (gdb) s
  465. 0x3b80 535 lquote = (lq == nil || *lq == '\0') ? \
  466. def_lquote : xstrdup(lq);
  467. (gdb) n
  468. 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
  469. : xstrdup(rq);
  470. (gdb) n
  471. 538 len_lquote = strlen(rquote);
  472. The last line displayed looks a little odd; we can examine the variables
  473. 'lquote' and 'rquote' to see if they are in fact the new left and right
  474. quotes we specified. We use the command 'p' ('print') to see their
  475. values.
  476. (gdb) p lquote
  477. $1 = 0x35d40 "<QUOTE>"
  478. (gdb) p rquote
  479. $2 = 0x35d50 "<UNQUOTE>"
  480. 'lquote' and 'rquote' are indeed the new left and right quotes. To look
  481. at some context, we can display ten lines of source surrounding the
  482. current line with the 'l' ('list') command.
  483. (gdb) l
  484. 533 xfree(rquote);
  485. 534
  486. 535 lquote = (lq == nil || *lq == '\0') ? def_lquote\
  487. : xstrdup (lq);
  488. 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
  489. : xstrdup (rq);
  490. 537
  491. 538 len_lquote = strlen(rquote);
  492. 539 len_rquote = strlen(lquote);
  493. 540 }
  494. 541
  495. 542 void
  496. Let us step past the two lines that set 'len_lquote' and 'len_rquote',
  497. and then examine the values of those variables.
  498. (gdb) n
  499. 539 len_rquote = strlen(lquote);
  500. (gdb) n
  501. 540 }
  502. (gdb) p len_lquote
  503. $3 = 9
  504. (gdb) p len_rquote
  505. $4 = 7
  506. That certainly looks wrong, assuming 'len_lquote' and 'len_rquote' are
  507. meant to be the lengths of 'lquote' and 'rquote' respectively. We can
  508. set them to better values using the 'p' command, since it can print the
  509. value of any expression--and that expression can include subroutine
  510. calls and assignments.
  511. (gdb) p len_lquote=strlen(lquote)
  512. $5 = 7
  513. (gdb) p len_rquote=strlen(rquote)
  514. $6 = 9
  515. Is that enough to fix the problem of using the new quotes with the 'm4'
  516. built-in 'defn'? We can allow 'm4' to continue executing with the 'c'
  517. ('continue') command, and then try the example that caused trouble
  518. initially:
  519. (gdb) c
  520. Continuing.
  521. define(baz,defn(<QUOTE>foo<UNQUOTE>))
  522. baz
  523. 0000
  524. Success! The new quotes now work just as well as the default ones. The
  525. problem seems to have been just the two typos defining the wrong
  526. lengths. We allow 'm4' exit by giving it an EOF as input:
  527. Ctrl-d
  528. Program exited normally.
  529. The message 'Program exited normally.' is from GDB; it indicates 'm4'
  530. has finished executing. We can end our GDB session with the GDB 'quit'
  531. command.
  532. (gdb) quit
  533. 
  534. File: gdb.info, Node: Invocation, Next: Commands, Prev: Sample Session, Up: Top
  535. 2 Getting In and Out of GDB
  536. ***************************
  537. This chapter discusses how to start GDB, and how to get out of it. The
  538. essentials are:
  539. * type 'gdb' to start GDB.
  540. * type 'quit' or 'Ctrl-d' to exit.
  541. * Menu:
  542. * Invoking GDB:: How to start GDB
  543. * Quitting GDB:: How to quit GDB
  544. * Shell Commands:: How to use shell commands inside GDB
  545. * Logging Output:: How to log GDB's output to a file
  546. 
  547. File: gdb.info, Node: Invoking GDB, Next: Quitting GDB, Up: Invocation
  548. 2.1 Invoking GDB
  549. ================
  550. Invoke GDB by running the program 'gdb'. Once started, GDB reads
  551. commands from the terminal until you tell it to exit.
  552. You can also run 'gdb' with a variety of arguments and options, to
  553. specify more of your debugging environment at the outset.
  554. The command-line options described here are designed to cover a
  555. variety of situations; in some environments, some of these options may
  556. effectively be unavailable.
  557. The most usual way to start GDB is with one argument, specifying an
  558. executable program:
  559. gdb PROGRAM
  560. You can also start with both an executable program and a core file
  561. specified:
  562. gdb PROGRAM CORE
  563. You can, instead, specify a process ID as a second argument, if you
  564. want to debug a running process:
  565. gdb PROGRAM 1234
  566. would attach GDB to process '1234' (unless you also have a file named
  567. '1234'; GDB does check for a core file first).
  568. Taking advantage of the second command-line argument requires a
  569. fairly complete operating system; when you use GDB as a remote debugger
  570. attached to a bare board, there may not be any notion of "process", and
  571. there is often no way to get a core dump. GDB will warn you if it is
  572. unable to attach or to read core dumps.
  573. You can optionally have 'gdb' pass any arguments after the executable
  574. file to the inferior using '--args'. This option stops option
  575. processing.
  576. gdb --args gcc -O2 -c foo.c
  577. This will cause 'gdb' to debug 'gcc', and to set 'gcc''s command-line
  578. arguments (*note Arguments::) to '-O2 -c foo.c'.
  579. You can run 'gdb' without printing the front material, which
  580. describes GDB's non-warranty, by specifying '--silent' (or
  581. '-q'/'--quiet'):
  582. gdb --silent
  583. You can further control how GDB starts up by using command-line options.
  584. GDB itself can remind you of the options available.
  585. Type
  586. gdb -help
  587. to display all available options and briefly describe their use ('gdb
  588. -h' is a shorter equivalent).
  589. All options and command line arguments you give are processed in
  590. sequential order. The order makes a difference when the '-x' option is
  591. used.
  592. * Menu:
  593. * File Options:: Choosing files
  594. * Mode Options:: Choosing modes
  595. * Startup:: What GDB does during startup
  596. 
  597. File: gdb.info, Node: File Options, Next: Mode Options, Up: Invoking GDB
  598. 2.1.1 Choosing Files
  599. --------------------
  600. When GDB starts, it reads any arguments other than options as specifying
  601. an executable file and core file (or process ID). This is the same as if
  602. the arguments were specified by the '-se' and '-c' (or '-p') options
  603. respectively. (GDB reads the first argument that does not have an
  604. associated option flag as equivalent to the '-se' option followed by
  605. that argument; and the second argument that does not have an associated
  606. option flag, if any, as equivalent to the '-c'/'-p' option followed by
  607. that argument.) If the second argument begins with a decimal digit, GDB
  608. will first attempt to attach to it as a process, and if that fails,
  609. attempt to open it as a corefile. If you have a corefile whose name
  610. begins with a digit, you can prevent GDB from treating it as a pid by
  611. prefixing it with './', e.g. './12345'.
  612. If GDB has not been configured to included core file support, such as
  613. for most embedded targets, then it will complain about a second argument
  614. and ignore it.
  615. Many options have both long and short forms; both are shown in the
  616. following list. GDB also recognizes the long forms if you truncate
  617. them, so long as enough of the option is present to be unambiguous. (If
  618. you prefer, you can flag option arguments with '--' rather than '-',
  619. though we illustrate the more usual convention.)
  620. '-symbols FILE'
  621. '-s FILE'
  622. Read symbol table from file FILE.
  623. '-exec FILE'
  624. '-e FILE'
  625. Use file FILE as the executable file to execute when appropriate,
  626. and for examining pure data in conjunction with a core dump.
  627. '-se FILE'
  628. Read symbol table from file FILE and use it as the executable file.
  629. '-core FILE'
  630. '-c FILE'
  631. Use file FILE as a core dump to examine.
  632. '-pid NUMBER'
  633. '-p NUMBER'
  634. Connect to process ID NUMBER, as with the 'attach' command.
  635. '-command FILE'
  636. '-x FILE'
  637. Execute commands from file FILE. The contents of this file is
  638. evaluated exactly as the 'source' command would. *Note Command
  639. files: Command Files.
  640. '-eval-command COMMAND'
  641. '-ex COMMAND'
  642. Execute a single GDB command.
  643. This option may be used multiple times to call multiple commands.
  644. It may also be interleaved with '-command' as required.
  645. gdb -ex 'target sim' -ex 'load' \
  646. -x setbreakpoints -ex 'run' a.out
  647. '-init-command FILE'
  648. '-ix FILE'
  649. Execute commands from file FILE before loading the inferior (but
  650. after loading gdbinit files). *Note Startup::.
  651. '-init-eval-command COMMAND'
  652. '-iex COMMAND'
  653. Execute a single GDB command before loading the inferior (but after
  654. loading gdbinit files). *Note Startup::.
  655. '-directory DIRECTORY'
  656. '-d DIRECTORY'
  657. Add DIRECTORY to the path to search for source and script files.
  658. '-r'
  659. '-readnow'
  660. Read each symbol file's entire symbol table immediately, rather
  661. than the default, which is to read it incrementally as it is
  662. needed. This makes startup slower, but makes future operations
  663. faster.
  664. '--readnever'
  665. Do not read each symbol file's symbolic debug information. This
  666. makes startup faster but at the expense of not being able to
  667. perform symbolic debugging. DWARF unwind information is also not
  668. read, meaning backtraces may become incomplete or inaccurate. One
  669. use of this is when a user simply wants to do the following
  670. sequence: attach, dump core, detach. Loading the debugging
  671. information in this case is an unnecessary cause of delay.
  672. 
  673. File: gdb.info, Node: Mode Options, Next: Startup, Prev: File Options, Up: Invoking GDB
  674. 2.1.2 Choosing Modes
  675. --------------------
  676. You can run GDB in various alternative modes--for example, in batch mode
  677. or quiet mode.
  678. '-nx'
  679. '-n'
  680. Do not execute commands found in any initialization file. There
  681. are three init files, loaded in the following order:
  682. 'system.gdbinit'
  683. This is the system-wide init file. Its location is specified
  684. with the '--with-system-gdbinit' configure option (*note
  685. System-wide configuration::). It is loaded first when GDB
  686. starts, before command line options have been processed.
  687. '~/.gdbinit'
  688. This is the init file in your home directory. It is loaded
  689. next, after 'system.gdbinit', and before command options have
  690. been processed.
  691. './.gdbinit'
  692. This is the init file in the current directory. It is loaded
  693. last, after command line options other than '-x' and '-ex'
  694. have been processed. Command line options '-x' and '-ex' are
  695. processed last, after './.gdbinit' has been loaded.
  696. For further documentation on startup processing, *Note Startup::.
  697. For documentation on how to write command files, *Note Command
  698. Files: Command Files.
  699. '-nh'
  700. Do not execute commands found in '~/.gdbinit', the init file in
  701. your home directory. *Note Startup::.
  702. '-quiet'
  703. '-silent'
  704. '-q'
  705. "Quiet". Do not print the introductory and copyright messages.
  706. These messages are also suppressed in batch mode.
  707. '-batch'
  708. Run in batch mode. Exit with status '0' after processing all the
  709. command files specified with '-x' (and all commands from
  710. initialization files, if not inhibited with '-n'). Exit with
  711. nonzero status if an error occurs in executing the GDB commands in
  712. the command files. Batch mode also disables pagination, sets
  713. unlimited terminal width and height *note Screen Size::, and acts
  714. as if 'set confirm off' were in effect (*note Messages/Warnings::).
  715. Batch mode may be useful for running GDB as a filter, for example
  716. to download and run a program on another computer; in order to make
  717. this more useful, the message
  718. Program exited normally.
  719. (which is ordinarily issued whenever a program running under GDB
  720. control terminates) is not issued when running in batch mode.
  721. '-batch-silent'
  722. Run in batch mode exactly like '-batch', but totally silently. All
  723. GDB output to 'stdout' is prevented ('stderr' is unaffected). This
  724. is much quieter than '-silent' and would be useless for an
  725. interactive session.
  726. This is particularly useful when using targets that give 'Loading
  727. section' messages, for example.
  728. Note that targets that give their output via GDB, as opposed to
  729. writing directly to 'stdout', will also be made silent.
  730. '-return-child-result'
  731. The return code from GDB will be the return code from the child
  732. process (the process being debugged), with the following
  733. exceptions:
  734. * GDB exits abnormally. E.g., due to an incorrect argument or
  735. an internal error. In this case the exit code is the same as
  736. it would have been without '-return-child-result'.
  737. * The user quits with an explicit value. E.g., 'quit 1'.
  738. * The child process never runs, or is not allowed to terminate,
  739. in which case the exit code will be -1.
  740. This option is useful in conjunction with '-batch' or
  741. '-batch-silent', when GDB is being used as a remote program loader
  742. or simulator interface.
  743. '-nowindows'
  744. '-nw'
  745. "No windows". If GDB comes with a graphical user interface (GUI)
  746. built in, then this option tells GDB to only use the command-line
  747. interface. If no GUI is available, this option has no effect.
  748. '-windows'
  749. '-w'
  750. If GDB includes a GUI, then this option requires it to be used if
  751. possible.
  752. '-cd DIRECTORY'
  753. Run GDB using DIRECTORY as its working directory, instead of the
  754. current directory.
  755. '-data-directory DIRECTORY'
  756. '-D DIRECTORY'
  757. Run GDB using DIRECTORY as its data directory. The data directory
  758. is where GDB searches for its auxiliary files. *Note Data Files::.
  759. '-fullname'
  760. '-f'
  761. GNU Emacs sets this option when it runs GDB as a subprocess. It
  762. tells GDB to output the full file name and line number in a
  763. standard, recognizable fashion each time a stack frame is displayed
  764. (which includes each time your program stops). This recognizable
  765. format looks like two '\032' characters, followed by the file name,
  766. line number and character position separated by colons, and a
  767. newline. The Emacs-to-GDB interface program uses the two '\032'
  768. characters as a signal to display the source code for the frame.
  769. '-annotate LEVEL'
  770. This option sets the "annotation level" inside GDB. Its effect is
  771. identical to using 'set annotate LEVEL' (*note Annotations::). The
  772. annotation LEVEL controls how much information GDB prints together
  773. with its prompt, values of expressions, source lines, and other
  774. types of output. Level 0 is the normal, level 1 is for use when
  775. GDB is run as a subprocess of GNU Emacs, level 3 is the maximum
  776. annotation suitable for programs that control GDB, and level 2 has
  777. been deprecated.
  778. The annotation mechanism has largely been superseded by GDB/MI
  779. (*note GDB/MI::).
  780. '--args'
  781. Change interpretation of command line so that arguments following
  782. the executable file are passed as command line arguments to the
  783. inferior. This option stops option processing.
  784. '-baud BPS'
  785. '-b BPS'
  786. Set the line speed (baud rate or bits per second) of any serial
  787. interface used by GDB for remote debugging.
  788. '-l TIMEOUT'
  789. Set the timeout (in seconds) of any communication used by GDB for
  790. remote debugging.
  791. '-tty DEVICE'
  792. '-t DEVICE'
  793. Run using DEVICE for your program's standard input and output.
  794. '-tui'
  795. Activate the "Text User Interface" when starting. The Text User
  796. Interface manages several text windows on the terminal, showing
  797. source, assembly, registers and GDB command outputs (*note GDB Text
  798. User Interface: TUI.). Do not use this option if you run GDB from
  799. Emacs (*note Using GDB under GNU Emacs: Emacs.).
  800. '-interpreter INTERP'
  801. Use the interpreter INTERP for interface with the controlling
  802. program or device. This option is meant to be set by programs
  803. which communicate with GDB using it as a back end. *Note Command
  804. Interpreters: Interpreters.
  805. '--interpreter=mi' (or '--interpreter=mi2') causes GDB to use the
  806. "GDB/MI interface" (*note The GDB/MI Interface: GDB/MI.) included
  807. since GDB version 6.0. The previous GDB/MI interface, included in
  808. GDB version 5.3 and selected with '--interpreter=mi1', is
  809. deprecated. Earlier GDB/MI interfaces are no longer supported.
  810. '-write'
  811. Open the executable and core files for both reading and writing.
  812. This is equivalent to the 'set write on' command inside GDB (*note
  813. Patching::).
  814. '-statistics'
  815. This option causes GDB to print statistics about time and memory
  816. usage after it completes each command and returns to the prompt.
  817. '-version'
  818. This option causes GDB to print its version number and no-warranty
  819. blurb, and exit.
  820. '-configuration'
  821. This option causes GDB to print details about its build-time
  822. configuration parameters, and then exit. These details can be
  823. important when reporting GDB bugs (*note GDB Bugs::).
  824. 
  825. File: gdb.info, Node: Startup, Prev: Mode Options, Up: Invoking GDB
  826. 2.1.3 What GDB Does During Startup
  827. ----------------------------------
  828. Here's the description of what GDB does during session startup:
  829. 1. Sets up the command interpreter as specified by the command line
  830. (*note interpreter: Mode Options.).
  831. 2. Reads the system-wide "init file" (if '--with-system-gdbinit' was
  832. used when building GDB; *note System-wide configuration and
  833. settings: System-wide configuration.) and executes all the commands
  834. in that file.
  835. 3. Reads the init file (if any) in your home directory(1) and executes
  836. all the commands in that file.
  837. 4. Executes commands and command files specified by the '-iex' and
  838. '-ix' options in their specified order. Usually you should use the
  839. '-ex' and '-x' options instead, but this way you can apply settings
  840. before GDB init files get executed and before inferior gets loaded.
  841. 5. Processes command line options and operands.
  842. 6. Reads and executes the commands from init file (if any) in the
  843. current working directory as long as 'set auto-load local-gdbinit'
  844. is set to 'on' (*note Init File in the Current Directory::). This
  845. is only done if the current directory is different from your home
  846. directory. Thus, you can have more than one init file, one generic
  847. in your home directory, and another, specific to the program you
  848. are debugging, in the directory where you invoke GDB.
  849. 7. If the command line specified a program to debug, or a process to
  850. attach to, or a core file, GDB loads any auto-loaded scripts
  851. provided for the program or for its loaded shared libraries. *Note
  852. Auto-loading::.
  853. If you wish to disable the auto-loading during startup, you must do
  854. something like the following:
  855. $ gdb -iex "set auto-load python-scripts off" myprogram
  856. Option '-ex' does not work because the auto-loading is then turned
  857. off too late.
  858. 8. Executes commands and command files specified by the '-ex' and '-x'
  859. options in their specified order. *Note Command Files::, for more
  860. details about GDB command files.
  861. 9. Reads the command history recorded in the "history file". *Note
  862. Command History::, for more details about the command history and
  863. the files where GDB records it.
  864. Init files use the same syntax as "command files" (*note Command
  865. Files::) and are processed by GDB in the same way. The init file in
  866. your home directory can set options (such as 'set complaints') that
  867. affect subsequent processing of command line options and operands. Init
  868. files are not executed if you use the '-nx' option (*note Choosing
  869. Modes: Mode Options.).
  870. To display the list of init files loaded by gdb at startup, you can
  871. use 'gdb --help'.
  872. The GDB init files are normally called '.gdbinit'. The DJGPP port of
  873. GDB uses the name 'gdb.ini', due to the limitations of file names
  874. imposed by DOS filesystems. The Windows port of GDB uses the standard
  875. name, but if it finds a 'gdb.ini' file in your home directory, it warns
  876. you about that and suggests to rename the file to the standard name.
  877. ---------- Footnotes ----------
  878. (1) On DOS/Windows systems, the home directory is the one pointed to
  879. by the 'HOME' environment variable.
  880. 
  881. File: gdb.info, Node: Quitting GDB, Next: Shell Commands, Prev: Invoking GDB, Up: Invocation
  882. 2.2 Quitting GDB
  883. ================
  884. 'quit [EXPRESSION]'
  885. 'q'
  886. To exit GDB, use the 'quit' command (abbreviated 'q'), or type an
  887. end-of-file character (usually 'Ctrl-d'). If you do not supply
  888. EXPRESSION, GDB will terminate normally; otherwise it will
  889. terminate using the result of EXPRESSION as the error code.
  890. An interrupt (often 'Ctrl-c') does not exit from GDB, but rather
  891. terminates the action of any GDB command that is in progress and returns
  892. to GDB command level. It is safe to type the interrupt character at any
  893. time because GDB does not allow it to take effect until a time when it
  894. is safe.
  895. If you have been using GDB to control an attached process or device,
  896. you can release it with the 'detach' command (*note Debugging an
  897. Already-running Process: Attach.).
  898. 
  899. File: gdb.info, Node: Shell Commands, Next: Logging Output, Prev: Quitting GDB, Up: Invocation
  900. 2.3 Shell Commands
  901. ==================
  902. If you need to execute occasional shell commands during your debugging
  903. session, there is no need to leave or suspend GDB; you can just use the
  904. 'shell' command.
  905. 'shell COMMAND-STRING'
  906. '!COMMAND-STRING'
  907. Invoke a standard shell to execute COMMAND-STRING. Note that no
  908. space is needed between '!' and COMMAND-STRING. If it exists, the
  909. environment variable 'SHELL' determines which shell to run.
  910. Otherwise GDB uses the default shell ('/bin/sh' on Unix systems,
  911. 'COMMAND.COM' on MS-DOS, etc.).
  912. The utility 'make' is often needed in development environments. You
  913. do not have to use the 'shell' command for this purpose in GDB:
  914. 'make MAKE-ARGS'
  915. Execute the 'make' program with the specified arguments. This is
  916. equivalent to 'shell make MAKE-ARGS'.
  917. 
  918. File: gdb.info, Node: Logging Output, Prev: Shell Commands, Up: Invocation
  919. 2.4 Logging Output
  920. ==================
  921. You may want to save the output of GDB commands to a file. There are
  922. several commands to control GDB's logging.
  923. 'set logging on'
  924. Enable logging.
  925. 'set logging off'
  926. Disable logging.
  927. 'set logging file FILE'
  928. Change the name of the current logfile. The default logfile is
  929. 'gdb.txt'.
  930. 'set logging overwrite [on|off]'
  931. By default, GDB will append to the logfile. Set 'overwrite' if you
  932. want 'set logging on' to overwrite the logfile instead.
  933. 'set logging redirect [on|off]'
  934. By default, GDB output will go to both the terminal and the
  935. logfile. Set 'redirect' if you want output to go only to the log
  936. file.
  937. 'show logging'
  938. Show the current values of the logging settings.
  939. 
  940. File: gdb.info, Node: Commands, Next: Running, Prev: Invocation, Up: Top
  941. 3 GDB Commands
  942. **************
  943. You can abbreviate a GDB command to the first few letters of the command
  944. name, if that abbreviation is unambiguous; and you can repeat certain
  945. GDB commands by typing just <RET>. You can also use the <TAB> key to
  946. get GDB to fill out the rest of a word in a command (or to show you the
  947. alternatives available, if there is more than one possibility).
  948. * Menu:
  949. * Command Syntax:: How to give commands to GDB
  950. * Completion:: Command completion
  951. * Help:: How to ask GDB for help
  952. 
  953. File: gdb.info, Node: Command Syntax, Next: Completion, Up: Commands
  954. 3.1 Command Syntax
  955. ==================
  956. A GDB command is a single line of input. There is no limit on how long
  957. it can be. It starts with a command name, which is followed by
  958. arguments whose meaning depends on the command name. For example, the
  959. command 'step' accepts an argument which is the number of times to step,
  960. as in 'step 5'. You can also use the 'step' command with no arguments.
  961. Some commands do not allow any arguments.
  962. GDB command names may always be truncated if that abbreviation is
  963. unambiguous. Other possible command abbreviations are listed in the
  964. documentation for individual commands. In some cases, even ambiguous
  965. abbreviations are allowed; for example, 's' is specially defined as
  966. equivalent to 'step' even though there are other commands whose names
  967. start with 's'. You can test abbreviations by using them as arguments
  968. to the 'help' command.
  969. A blank line as input to GDB (typing just <RET>) means to repeat the
  970. previous command. Certain commands (for example, 'run') will not repeat
  971. this way; these are commands whose unintentional repetition might cause
  972. trouble and which you are unlikely to want to repeat. User-defined
  973. commands can disable this feature; see *note dont-repeat: Define.
  974. The 'list' and 'x' commands, when you repeat them with <RET>,
  975. construct new arguments rather than repeating exactly as typed. This
  976. permits easy scanning of source or memory.
  977. GDB can also use <RET> in another way: to partition lengthy output,
  978. in a way similar to the common utility 'more' (*note Screen Size: Screen
  979. Size.). Since it is easy to press one <RET> too many in this situation,
  980. GDB disables command repetition after any command that generates this
  981. sort of display.
  982. Any text from a '#' to the end of the line is a comment; it does
  983. nothing. This is useful mainly in command files (*note Command Files:
  984. Command Files.).
  985. The 'Ctrl-o' binding is useful for repeating a complex sequence of
  986. commands. This command accepts the current line, like <RET>, and then
  987. fetches the next line relative to the current line from the history for
  988. editing.
  989. 
  990. File: gdb.info, Node: Completion, Next: Help, Prev: Command Syntax, Up: Commands
  991. 3.2 Command Completion
  992. ======================
  993. GDB can fill in the rest of a word in a command for you, if there is
  994. only one possibility; it can also show you what the valid possibilities
  995. are for the next word in a command, at any time. This works for GDB
  996. commands, GDB subcommands, and the names of symbols in your program.
  997. Press the <TAB> key whenever you want GDB to fill out the rest of a
  998. word. If there is only one possibility, GDB fills in the word, and
  999. waits for you to finish the command (or press <RET> to enter it). For
  1000. example, if you type
  1001. (gdb) info bre <TAB>
  1002. GDB fills in the rest of the word 'breakpoints', since that is the only
  1003. 'info' subcommand beginning with 'bre':
  1004. (gdb) info breakpoints
  1005. You can either press <RET> at this point, to run the 'info breakpoints'
  1006. command, or backspace and enter something else, if 'breakpoints' does
  1007. not look like the command you expected. (If you were sure you wanted
  1008. 'info breakpoints' in the first place, you might as well just type <RET>
  1009. immediately after 'info bre', to exploit command abbreviations rather
  1010. than command completion).
  1011. If there is more than one possibility for the next word when you
  1012. press <TAB>, GDB sounds a bell. You can either supply more characters
  1013. and try again, or just press <TAB> a second time; GDB displays all the
  1014. possible completions for that word. For example, you might want to set
  1015. a breakpoint on a subroutine whose name begins with 'make_', but when
  1016. you type 'b make_<TAB>' GDB just sounds the bell. Typing <TAB> again
  1017. displays all the function names in your program that begin with those
  1018. characters, for example:
  1019. (gdb) b make_ <TAB>
  1020. GDB sounds bell; press <TAB> again, to see:
  1021. make_a_section_from_file make_environ
  1022. make_abs_section make_function_type
  1023. make_blockvector make_pointer_type
  1024. make_cleanup make_reference_type
  1025. make_command make_symbol_completion_list
  1026. (gdb) b make_
  1027. After displaying the available possibilities, GDB copies your partial
  1028. input ('b make_' in the example) so you can finish the command.
  1029. If you just want to see the list of alternatives in the first place,
  1030. you can press 'M-?' rather than pressing <TAB> twice. 'M-?' means
  1031. '<META> ?'. You can type this either by holding down a key designated
  1032. as the <META> shift on your keyboard (if there is one) while typing '?',
  1033. or as <ESC> followed by '?'.
  1034. If the number of possible completions is large, GDB will print as
  1035. much of the list as it has collected, as well as a message indicating
  1036. that the list may be truncated.
  1037. (gdb) b m<TAB><TAB>
  1038. main
  1039. <... the rest of the possible completions ...>
  1040. *** List may be truncated, max-completions reached. ***
  1041. (gdb) b m
  1042. This behavior can be controlled with the following commands:
  1043. 'set max-completions LIMIT'
  1044. 'set max-completions unlimited'
  1045. Set the maximum number of completion candidates. GDB will stop
  1046. looking for more completions once it collects this many candidates.
  1047. This is useful when completing on things like function names as
  1048. collecting all the possible candidates can be time consuming. The
  1049. default value is 200. A value of zero disables tab-completion.
  1050. Note that setting either no limit or a very large limit can make
  1051. completion slow.
  1052. 'show max-completions'
  1053. Show the maximum number of candidates that GDB will collect and
  1054. show during completion.
  1055. Sometimes the string you need, while logically a "word", may contain
  1056. parentheses or other characters that GDB normally excludes from its
  1057. notion of a word. To permit word completion to work in this situation,
  1058. you may enclose words in ''' (single quote marks) in GDB commands.
  1059. A likely situation where you might need this is in typing an
  1060. expression that involves a C++ symbol name with template parameters.
  1061. This is because when completing expressions, GDB treats the '<'
  1062. character as word delimiter, assuming that it's the less-than comparison
  1063. operator (*note C and C++ Operators: C Operators.).
  1064. For example, when you want to call a C++ template function
  1065. interactively using the 'print' or 'call' commands, you may need to
  1066. distinguish whether you mean the version of 'name' that was specialized
  1067. for 'int', 'name<int>()', or the version that was specialized for
  1068. 'float', 'name<float>()'. To use the word-completion facilities in this
  1069. situation, type a single quote ''' at the beginning of the function
  1070. name. This alerts GDB that it may need to consider more information
  1071. than usual when you press <TAB> or 'M-?' to request word completion:
  1072. (gdb) p 'func< M-?
  1073. func<int>() func<float>()
  1074. (gdb) p 'func<
  1075. When setting breakpoints however (*note Specify Location::), you
  1076. don't usually need to type a quote before the function name, because GDB
  1077. understands that you want to set a breakpoint on a function:
  1078. (gdb) b func< M-?
  1079. func<int>() func<float>()
  1080. (gdb) b func<
  1081. This is true even in the case of typing the name of C++ overloaded
  1082. functions (multiple definitions of the same function, distinguished by
  1083. argument type). For example, when you want to set a breakpoint you
  1084. don't need to distinguish whether you mean the version of 'name' that
  1085. takes an 'int' parameter, 'name(int)', or the version that takes a
  1086. 'float' parameter, 'name(float)'.
  1087. (gdb) b bubble( M-?
  1088. bubble(int) bubble(double)
  1089. (gdb) b bubble(dou M-?
  1090. bubble(double)
  1091. See *note quoting names:: for a description of other scenarios that
  1092. require quoting.
  1093. For more information about overloaded functions, see *note C++
  1094. Expressions: C Plus Plus Expressions. You can use the command 'set
  1095. overload-resolution off' to disable overload resolution; see *note GDB
  1096. Features for C++: Debugging C Plus Plus.
  1097. When completing in an expression which looks up a field in a
  1098. structure, GDB also tries(1) to limit completions to the field names
  1099. available in the type of the left-hand-side:
  1100. (gdb) p gdb_stdout.M-?
  1101. magic to_fputs to_rewind
  1102. to_data to_isatty to_write
  1103. to_delete to_put to_write_async_safe
  1104. to_flush to_read
  1105. This is because the 'gdb_stdout' is a variable of the type 'struct
  1106. ui_file' that is defined in GDB sources as follows:
  1107. struct ui_file
  1108. {
  1109. int *magic;
  1110. ui_file_flush_ftype *to_flush;
  1111. ui_file_write_ftype *to_write;
  1112. ui_file_write_async_safe_ftype *to_write_async_safe;
  1113. ui_file_fputs_ftype *to_fputs;
  1114. ui_file_read_ftype *to_read;
  1115. ui_file_delete_ftype *to_delete;
  1116. ui_file_isatty_ftype *to_isatty;
  1117. ui_file_rewind_ftype *to_rewind;
  1118. ui_file_put_ftype *to_put;
  1119. void *to_data;
  1120. }
  1121. ---------- Footnotes ----------
  1122. (1) The completer can be confused by certain kinds of invalid
  1123. expressions. Also, it only examines the static type of the expression,
  1124. not the dynamic type.
  1125. 
  1126. File: gdb.info, Node: Help, Prev: Completion, Up: Commands
  1127. 3.3 Getting Help
  1128. ================
  1129. You can always ask GDB itself for information on its commands, using the
  1130. command 'help'.
  1131. 'help'
  1132. 'h'
  1133. You can use 'help' (abbreviated 'h') with no arguments to display a
  1134. short list of named classes of commands:
  1135. (gdb) help
  1136. List of classes of commands:
  1137. aliases -- Aliases of other commands
  1138. breakpoints -- Making program stop at certain points
  1139. data -- Examining data
  1140. files -- Specifying and examining files
  1141. internals -- Maintenance commands
  1142. obscure -- Obscure features
  1143. running -- Running the program
  1144. stack -- Examining the stack
  1145. status -- Status inquiries
  1146. support -- Support facilities
  1147. tracepoints -- Tracing of program execution without
  1148. stopping the program
  1149. user-defined -- User-defined commands
  1150. Type "help" followed by a class name for a list of
  1151. commands in that class.
  1152. Type "help" followed by command name for full
  1153. documentation.
  1154. Command name abbreviations are allowed if unambiguous.
  1155. (gdb)
  1156. 'help CLASS'
  1157. Using one of the general help classes as an argument, you can get a
  1158. list of the individual commands in that class. For example, here
  1159. is the help display for the class 'status':
  1160. (gdb) help status
  1161. Status inquiries.
  1162. List of commands:
  1163. info -- Generic command for showing things
  1164. about the program being debugged
  1165. show -- Generic command for showing things
  1166. about the debugger
  1167. Type "help" followed by command name for full
  1168. documentation.
  1169. Command name abbreviations are allowed if unambiguous.
  1170. (gdb)
  1171. 'help COMMAND'
  1172. With a command name as 'help' argument, GDB displays a short
  1173. paragraph on how to use that command.
  1174. 'apropos ARGS'
  1175. The 'apropos' command searches through all of the GDB commands, and
  1176. their documentation, for the regular expression specified in ARGS.
  1177. It prints out all matches found. For example:
  1178. apropos alias
  1179. results in:
  1180. alias -- Define a new command that is an alias of an existing command
  1181. aliases -- Aliases of other commands
  1182. d -- Delete some breakpoints or auto-display expressions
  1183. del -- Delete some breakpoints or auto-display expressions
  1184. delete -- Delete some breakpoints or auto-display expressions
  1185. 'complete ARGS'
  1186. The 'complete ARGS' command lists all the possible completions for
  1187. the beginning of a command. Use ARGS to specify the beginning of
  1188. the command you want completed. For example:
  1189. complete i
  1190. results in:
  1191. if
  1192. ignore
  1193. info
  1194. inspect
  1195. This is intended for use by GNU Emacs.
  1196. In addition to 'help', you can use the GDB commands 'info' and 'show'
  1197. to inquire about the state of your program, or the state of GDB itself.
  1198. Each command supports many topics of inquiry; this manual introduces
  1199. each of them in the appropriate context. The listings under 'info' and
  1200. under 'show' in the Command, Variable, and Function Index point to all
  1201. the sub-commands. *Note Command and Variable Index::.
  1202. 'info'
  1203. This command (abbreviated 'i') is for describing the state of your
  1204. program. For example, you can show the arguments passed to a
  1205. function with 'info args', list the registers currently in use with
  1206. 'info registers', or list the breakpoints you have set with 'info
  1207. breakpoints'. You can get a complete list of the 'info'
  1208. sub-commands with 'help info'.
  1209. 'set'
  1210. You can assign the result of an expression to an environment
  1211. variable with 'set'. For example, you can set the GDB prompt to a
  1212. $-sign with 'set prompt $'.
  1213. 'show'
  1214. In contrast to 'info', 'show' is for describing the state of GDB
  1215. itself. You can change most of the things you can 'show', by using
  1216. the related command 'set'; for example, you can control what number
  1217. system is used for displays with 'set radix', or simply inquire
  1218. which is currently in use with 'show radix'.
  1219. To display all the settable parameters and their current values,
  1220. you can use 'show' with no arguments; you may also use 'info set'.
  1221. Both commands produce the same display.
  1222. Here are several miscellaneous 'show' subcommands, all of which are
  1223. exceptional in lacking corresponding 'set' commands:
  1224. 'show version'
  1225. Show what version of GDB is running. You should include this
  1226. information in GDB bug-reports. If multiple versions of GDB are in
  1227. use at your site, you may need to determine which version of GDB
  1228. you are running; as GDB evolves, new commands are introduced, and
  1229. old ones may wither away. Also, many system vendors ship variant
  1230. versions of GDB, and there are variant versions of GDB in GNU/Linux
  1231. distributions as well. The version number is the same as the one
  1232. announced when you start GDB.
  1233. 'show copying'
  1234. 'info copying'
  1235. Display information about permission for copying GDB.
  1236. 'show warranty'
  1237. 'info warranty'
  1238. Display the GNU "NO WARRANTY" statement, or a warranty, if your
  1239. version of GDB comes with one.
  1240. 'show configuration'
  1241. Display detailed information about the way GDB was configured when
  1242. it was built. This displays the optional arguments passed to the
  1243. 'configure' script and also configuration parameters detected
  1244. automatically by 'configure'. When reporting a GDB bug (*note GDB
  1245. Bugs::), it is important to include this information in your
  1246. report.
  1247. 
  1248. File: gdb.info, Node: Running, Next: Stopping, Prev: Commands, Up: Top
  1249. 4 Running Programs Under GDB
  1250. ****************************
  1251. When you run a program under GDB, you must first generate debugging
  1252. information when you compile it.
  1253. You may start GDB with its arguments, if any, in an environment of
  1254. your choice. If you are doing native debugging, you may redirect your
  1255. program's input and output, debug an already running process, or kill a
  1256. child process.
  1257. * Menu:
  1258. * Compilation:: Compiling for debugging
  1259. * Starting:: Starting your program
  1260. * Arguments:: Your program's arguments
  1261. * Environment:: Your program's environment
  1262. * Working Directory:: Your program's working directory
  1263. * Input/Output:: Your program's input and output
  1264. * Attach:: Debugging an already-running process
  1265. * Kill Process:: Killing the child process
  1266. * Inferiors and Programs:: Debugging multiple inferiors and programs
  1267. * Threads:: Debugging programs with multiple threads
  1268. * Forks:: Debugging forks
  1269. * Checkpoint/Restart:: Setting a _bookmark_ to return to later
  1270. 
  1271. File: gdb.info, Node: Compilation, Next: Starting, Up: Running
  1272. 4.1 Compiling for Debugging
  1273. ===========================
  1274. In order to debug a program effectively, you need to generate debugging
  1275. information when you compile it. This debugging information is stored
  1276. in the object file; it describes the data type of each variable or
  1277. function and the correspondence between source line numbers and
  1278. addresses in the executable code.
  1279. To request debugging information, specify the '-g' option when you
  1280. run the compiler.
  1281. Programs that are to be shipped to your customers are compiled with
  1282. optimizations, using the '-O' compiler option. However, some compilers
  1283. are unable to handle the '-g' and '-O' options together. Using those
  1284. compilers, you cannot generate optimized executables containing
  1285. debugging information.
  1286. GCC, the GNU C/C++ compiler, supports '-g' with or without '-O',
  1287. making it possible to debug optimized code. We recommend that you
  1288. _always_ use '-g' whenever you compile a program. You may think your
  1289. program is correct, but there is no sense in pushing your luck. For
  1290. more information, see *note Optimized Code::.
  1291. Older versions of the GNU C compiler permitted a variant option '-gg'
  1292. for debugging information. GDB no longer supports this format; if your
  1293. GNU C compiler has this option, do not use it.
  1294. GDB knows about preprocessor macros and can show you their expansion
  1295. (*note Macros::). Most compilers do not include information about
  1296. preprocessor macros in the debugging information if you specify the '-g'
  1297. flag alone. Version 3.1 and later of GCC, the GNU C compiler, provides
  1298. macro information if you are using the DWARF debugging format, and
  1299. specify the option '-g3'.
  1300. *Note Options for Debugging Your Program or GCC: (gcc)Debugging
  1301. Options, for more information on GCC options affecting debug
  1302. information.
  1303. You will have the best debugging experience if you use the latest
  1304. version of the DWARF debugging format that your compiler supports.
  1305. DWARF is currently the most expressive and best supported debugging
  1306. format in GDB.
  1307. 
  1308. File: gdb.info, Node: Starting, Next: Arguments, Prev: Compilation, Up: Running
  1309. 4.2 Starting your Program
  1310. =========================
  1311. 'run'
  1312. 'r'
  1313. Use the 'run' command to start your program under GDB. You must
  1314. first specify the program name with an argument to GDB (*note
  1315. Getting In and Out of GDB: Invocation.), or by using the 'file' or
  1316. 'exec-file' command (*note Commands to Specify Files: Files.).
  1317. If you are running your program in an execution environment that
  1318. supports processes, 'run' creates an inferior process and makes that
  1319. process run your program. In some environments without processes, 'run'
  1320. jumps to the start of your program. Other targets, like 'remote', are
  1321. always running. If you get an error message like this one:
  1322. The "remote" target does not support "run".
  1323. Try "help target" or "continue".
  1324. then use 'continue' to run your program. You may need 'load' first
  1325. (*note load::).
  1326. The execution of a program is affected by certain information it
  1327. receives from its superior. GDB provides ways to specify this
  1328. information, which you must do _before_ starting your program. (You can
  1329. change it after starting your program, but such changes only affect your
  1330. program the next time you start it.) This information may be divided
  1331. into four categories:
  1332. The _arguments._
  1333. Specify the arguments to give your program as the arguments of the
  1334. 'run' command. If a shell is available on your target, the shell
  1335. is used to pass the arguments, so that you may use normal
  1336. conventions (such as wildcard expansion or variable substitution)
  1337. in describing the arguments. In Unix systems, you can control
  1338. which shell is used with the 'SHELL' environment variable. If you
  1339. do not define 'SHELL', GDB uses the default shell ('/bin/sh'). You
  1340. can disable use of any shell with the 'set startup-with-shell'
  1341. command (see below for details).
  1342. The _environment._
  1343. Your program normally inherits its environment from GDB, but you
  1344. can use the GDB commands 'set environment' and 'unset environment'
  1345. to change parts of the environment that affect your program. *Note
  1346. Your Program's Environment: Environment.
  1347. The _working directory._
  1348. You can set your program's working directory with the command 'set
  1349. cwd'. If you do not set any working directory with this command,
  1350. your program will inherit GDB's working directory if native
  1351. debugging, or the remote server's working directory if remote
  1352. debugging. *Note Your Program's Working Directory: Working
  1353. Directory.
  1354. The _standard input and output._
  1355. Your program normally uses the same device for standard input and
  1356. standard output as GDB is using. You can redirect input and output
  1357. in the 'run' command line, or you can use the 'tty' command to set
  1358. a different device for your program. *Note Your Program's Input
  1359. and Output: Input/Output.
  1360. _Warning:_ While input and output redirection work, you cannot use
  1361. pipes to pass the output of the program you are debugging to
  1362. another program; if you attempt this, GDB is likely to wind up
  1363. debugging the wrong program.
  1364. When you issue the 'run' command, your program begins to execute
  1365. immediately. *Note Stopping and Continuing: Stopping, for discussion of
  1366. how to arrange for your program to stop. Once your program has stopped,
  1367. you may call functions in your program, using the 'print' or 'call'
  1368. commands. *Note Examining Data: Data.
  1369. If the modification time of your symbol file has changed since the
  1370. last time GDB read its symbols, GDB discards its symbol table, and reads
  1371. it again. When it does this, GDB tries to retain your current
  1372. breakpoints.
  1373. 'start'
  1374. The name of the main procedure can vary from language to language.
  1375. With C or C++, the main procedure name is always 'main', but other
  1376. languages such as Ada do not require a specific name for their main
  1377. procedure. The debugger provides a convenient way to start the
  1378. execution of the program and to stop at the beginning of the main
  1379. procedure, depending on the language used.
  1380. The 'start' command does the equivalent of setting a temporary
  1381. breakpoint at the beginning of the main procedure and then invoking
  1382. the 'run' command.
  1383. Some programs contain an "elaboration" phase where some startup
  1384. code is executed before the main procedure is called. This depends
  1385. on the languages used to write your program. In C++, for instance,
  1386. constructors for static and global objects are executed before
  1387. 'main' is called. It is therefore possible that the debugger stops
  1388. before reaching the main procedure. However, the temporary
  1389. breakpoint will remain to halt execution.
  1390. Specify the arguments to give to your program as arguments to the
  1391. 'start' command. These arguments will be given verbatim to the
  1392. underlying 'run' command. Note that the same arguments will be
  1393. reused if no argument is provided during subsequent calls to
  1394. 'start' or 'run'.
  1395. It is sometimes necessary to debug the program during elaboration.
  1396. In these cases, using the 'start' command would stop the execution
  1397. of your program too late, as the program would have already
  1398. completed the elaboration phase. Under these circumstances, either
  1399. insert breakpoints in your elaboration code before running your
  1400. program or use the 'starti' command.
  1401. 'starti'
  1402. The 'starti' command does the equivalent of setting a temporary
  1403. breakpoint at the first instruction of a program's execution and
  1404. then invoking the 'run' command. For programs containing an
  1405. elaboration phase, the 'starti' command will stop execution at the
  1406. start of the elaboration phase.
  1407. 'set exec-wrapper WRAPPER'
  1408. 'show exec-wrapper'
  1409. 'unset exec-wrapper'
  1410. When 'exec-wrapper' is set, the specified wrapper is used to launch
  1411. programs for debugging. GDB starts your program with a shell
  1412. command of the form 'exec WRAPPER PROGRAM'. Quoting is added to
  1413. PROGRAM and its arguments, but not to WRAPPER, so you should add
  1414. quotes if appropriate for your shell. The wrapper runs until it
  1415. executes your program, and then GDB takes control.
  1416. You can use any program that eventually calls 'execve' with its
  1417. arguments as a wrapper. Several standard Unix utilities do this,
  1418. e.g. 'env' and 'nohup'. Any Unix shell script ending with 'exec
  1419. "$@"' will also work.
  1420. For example, you can use 'env' to pass an environment variable to
  1421. the debugged program, without setting the variable in your shell's
  1422. environment:
  1423. (gdb) set exec-wrapper env 'LD_PRELOAD=libtest.so'
  1424. (gdb) run
  1425. This command is available when debugging locally on most targets,
  1426. excluding DJGPP, Cygwin, MS Windows, and QNX Neutrino.
  1427. 'set startup-with-shell'
  1428. 'set startup-with-shell on'
  1429. 'set startup-with-shell off'
  1430. 'show startup-with-shell'
  1431. On Unix systems, by default, if a shell is available on your
  1432. target, GDB) uses it to start your program. Arguments of the 'run'
  1433. command are passed to the shell, which does variable substitution,
  1434. expands wildcard characters and performs redirection of I/O. In
  1435. some circumstances, it may be useful to disable such use of a
  1436. shell, for example, when debugging the shell itself or diagnosing
  1437. startup failures such as:
  1438. (gdb) run
  1439. Starting program: ./a.out
  1440. During startup program terminated with signal SIGSEGV, Segmentation fault.
  1441. which indicates the shell or the wrapper specified with
  1442. 'exec-wrapper' crashed, not your program. Most often, this is
  1443. caused by something odd in your shell's non-interactive mode
  1444. initialization file--such as '.cshrc' for C-shell, $'.zshenv' for
  1445. the Z shell, or the file specified in the 'BASH_ENV' environment
  1446. variable for BASH.
  1447. 'set auto-connect-native-target'
  1448. 'set auto-connect-native-target on'
  1449. 'set auto-connect-native-target off'
  1450. 'show auto-connect-native-target'
  1451. By default, if not connected to any target yet (e.g., with 'target
  1452. remote'), the 'run' command starts your program as a native process
  1453. under GDB, on your local machine. If you're sure you don't want to
  1454. debug programs on your local machine, you can tell GDB to not
  1455. connect to the native target automatically with the 'set
  1456. auto-connect-native-target off' command.
  1457. If 'on', which is the default, and if GDB is not connected to a
  1458. target already, the 'run' command automaticaly connects to the
  1459. native target, if one is available.
  1460. If 'off', and if GDB is not connected to a target already, the
  1461. 'run' command fails with an error:
  1462. (gdb) run
  1463. Don't know how to run. Try "help target".
  1464. If GDB is already connected to a target, GDB always uses it with
  1465. the 'run' command.
  1466. In any case, you can explicitly connect to the native target with
  1467. the 'target native' command. For example,
  1468. (gdb) set auto-connect-native-target off
  1469. (gdb) run
  1470. Don't know how to run. Try "help target".
  1471. (gdb) target native
  1472. (gdb) run
  1473. Starting program: ./a.out
  1474. [Inferior 1 (process 10421) exited normally]
  1475. In case you connected explicitly to the 'native' target, GDB
  1476. remains connected even if all inferiors exit, ready for the next
  1477. 'run' command. Use the 'disconnect' command to disconnect.
  1478. Examples of other commands that likewise respect the
  1479. 'auto-connect-native-target' setting: 'attach', 'info proc', 'info
  1480. os'.
  1481. 'set disable-randomization'
  1482. 'set disable-randomization on'
  1483. This option (enabled by default in GDB) will turn off the native
  1484. randomization of the virtual address space of the started program.
  1485. This option is useful for multiple debugging sessions to make the
  1486. execution better reproducible and memory addresses reusable across
  1487. debugging sessions.
  1488. This feature is implemented only on certain targets, including
  1489. GNU/Linux. On GNU/Linux you can get the same behavior using
  1490. (gdb) set exec-wrapper setarch `uname -m` -R
  1491. 'set disable-randomization off'
  1492. Leave the behavior of the started executable unchanged. Some bugs
  1493. rear their ugly heads only when the program is loaded at certain
  1494. addresses. If your bug disappears when you run the program under
  1495. GDB, that might be because GDB by default disables the address
  1496. randomization on platforms, such as GNU/Linux, which do that for
  1497. stand-alone programs. Use 'set disable-randomization off' to try
  1498. to reproduce such elusive bugs.
  1499. On targets where it is available, virtual address space
  1500. randomization protects the programs against certain kinds of
  1501. security attacks. In these cases the attacker needs to know the
  1502. exact location of a concrete executable code. Randomizing its
  1503. location makes it impossible to inject jumps misusing a code at its
  1504. expected addresses.
  1505. Prelinking shared libraries provides a startup performance
  1506. advantage but it makes addresses in these libraries predictable for
  1507. privileged processes by having just unprivileged access at the
  1508. target system. Reading the shared library binary gives enough
  1509. information for assembling the malicious code misusing it. Still
  1510. even a prelinked shared library can get loaded at a new random
  1511. address just requiring the regular relocation process during the
  1512. startup. Shared libraries not already prelinked are always loaded
  1513. at a randomly chosen address.
  1514. Position independent executables (PIE) contain position independent
  1515. code similar to the shared libraries and therefore such executables
  1516. get loaded at a randomly chosen address upon startup. PIE
  1517. executables always load even already prelinked shared libraries at
  1518. a random address. You can build such executable using 'gcc -fPIE
  1519. -pie'.
  1520. Heap (malloc storage), stack and custom mmap areas are always
  1521. placed randomly (as long as the randomization is enabled).
  1522. 'show disable-randomization'
  1523. Show the current setting of the explicit disable of the native
  1524. randomization of the virtual address space of the started program.
  1525. 
  1526. File: gdb.info, Node: Arguments, Next: Environment, Prev: Starting, Up: Running
  1527. 4.3 Your Program's Arguments
  1528. ============================
  1529. The arguments to your program can be specified by the arguments of the
  1530. 'run' command. They are passed to a shell, which expands wildcard
  1531. characters and performs redirection of I/O, and thence to your program.
  1532. Your 'SHELL' environment variable (if it exists) specifies what shell
  1533. GDB uses. If you do not define 'SHELL', GDB uses the default shell
  1534. ('/bin/sh' on Unix).
  1535. On non-Unix systems, the program is usually invoked directly by GDB,
  1536. which emulates I/O redirection via the appropriate system calls, and the
  1537. wildcard characters are expanded by the startup code of the program, not
  1538. by the shell.
  1539. 'run' with no arguments uses the same arguments used by the previous
  1540. 'run', or those set by the 'set args' command.
  1541. 'set args'
  1542. Specify the arguments to be used the next time your program is run.
  1543. If 'set args' has no arguments, 'run' executes your program with no
  1544. arguments. Once you have run your program with arguments, using
  1545. 'set args' before the next 'run' is the only way to run it again
  1546. without arguments.
  1547. 'show args'
  1548. Show the arguments to give your program when it is started.
  1549. 
  1550. File: gdb.info, Node: Environment, Next: Working Directory, Prev: Arguments, Up: Running
  1551. 4.4 Your Program's Environment
  1552. ==============================
  1553. The "environment" consists of a set of environment variables and their
  1554. values. Environment variables conventionally record such things as your
  1555. user name, your home directory, your terminal type, and your search path
  1556. for programs to run. Usually you set up environment variables with the
  1557. shell and they are inherited by all the other programs you run. When
  1558. debugging, it can be useful to try running your program with a modified
  1559. environment without having to start GDB over again.
  1560. 'path DIRECTORY'
  1561. Add DIRECTORY to the front of the 'PATH' environment variable (the
  1562. search path for executables) that will be passed to your program.
  1563. The value of 'PATH' used by GDB does not change. You may specify
  1564. several directory names, separated by whitespace or by a
  1565. system-dependent separator character (':' on Unix, ';' on MS-DOS
  1566. and MS-Windows). If DIRECTORY is already in the path, it is moved
  1567. to the front, so it is searched sooner.
  1568. You can use the string '$cwd' to refer to whatever is the current
  1569. working directory at the time GDB searches the path. If you use
  1570. '.' instead, it refers to the directory where you executed the
  1571. 'path' command. GDB replaces '.' in the DIRECTORY argument (with
  1572. the current path) before adding DIRECTORY to the search path.
  1573. 'show paths'
  1574. Display the list of search paths for executables (the 'PATH'
  1575. environment variable).
  1576. 'show environment [VARNAME]'
  1577. Print the value of environment variable VARNAME to be given to your
  1578. program when it starts. If you do not supply VARNAME, print the
  1579. names and values of all environment variables to be given to your
  1580. program. You can abbreviate 'environment' as 'env'.
  1581. 'set environment VARNAME [=VALUE]'
  1582. Set environment variable VARNAME to VALUE. The value changes for
  1583. your program (and the shell GDB uses to launch it), not for GDB
  1584. itself. The VALUE may be any string; the values of environment
  1585. variables are just strings, and any interpretation is supplied by
  1586. your program itself. The VALUE parameter is optional; if it is
  1587. eliminated, the variable is set to a null value.
  1588. For example, this command:
  1589. set env USER = foo
  1590. tells the debugged program, when subsequently run, that its user is
  1591. named 'foo'. (The spaces around '=' are used for clarity here;
  1592. they are not actually required.)
  1593. Note that on Unix systems, GDB runs your program via a shell, which
  1594. also inherits the environment set with 'set environment'. If
  1595. necessary, you can avoid that by using the 'env' program as a
  1596. wrapper instead of using 'set environment'. *Note set
  1597. exec-wrapper::, for an example doing just that.
  1598. Environment variables that are set by the user are also transmitted
  1599. to 'gdbserver' to be used when starting the remote inferior. *note
  1600. QEnvironmentHexEncoded::.
  1601. 'unset environment VARNAME'
  1602. Remove variable VARNAME from the environment to be passed to your
  1603. program. This is different from 'set env VARNAME ='; 'unset
  1604. environment' removes the variable from the environment, rather than
  1605. assigning it an empty value.
  1606. Environment variables that are unset by the user are also unset on
  1607. 'gdbserver' when starting the remote inferior. *note
  1608. QEnvironmentUnset::.
  1609. _Warning:_ On Unix systems, GDB runs your program using the shell
  1610. indicated by your 'SHELL' environment variable if it exists (or
  1611. '/bin/sh' if not). If your 'SHELL' variable names a shell that runs an
  1612. initialization file when started non-interactively--such as '.cshrc' for
  1613. C-shell, $'.zshenv' for the Z shell, or the file specified in the
  1614. 'BASH_ENV' environment variable for BASH--any variables you set in that
  1615. file affect your program. You may wish to move setting of environment
  1616. variables to files that are only run when you sign on, such as '.login'
  1617. or '.profile'.
  1618. 
  1619. File: gdb.info, Node: Working Directory, Next: Input/Output, Prev: Environment, Up: Running
  1620. 4.5 Your Program's Working Directory
  1621. ====================================
  1622. Each time you start your program with 'run', the inferior will be
  1623. initialized with the current working directory specified by the 'set
  1624. cwd' command. If no directory has been specified by this command, then
  1625. the inferior will inherit GDB's current working directory as its working
  1626. directory if native debugging, or it will inherit the remote server's
  1627. current working directory if remote debugging.
  1628. 'set cwd [DIRECTORY]'
  1629. Set the inferior's working directory to DIRECTORY, which will be
  1630. 'glob'-expanded in order to resolve tildes ('~'). If no argument
  1631. has been specified, the command clears the setting and resets it to
  1632. an empty state. This setting has no effect on GDB's working
  1633. directory, and it only takes effect the next time you start the
  1634. inferior. The '~' in DIRECTORY is a short for the "home
  1635. directory", usually pointed to by the 'HOME' environment variable.
  1636. On MS-Windows, if 'HOME' is not defined, GDB uses the concatenation
  1637. of 'HOMEDRIVE' and 'HOMEPATH' as fallback.
  1638. You can also change GDB's current working directory by using the
  1639. 'cd' command. *Note cd command::.
  1640. 'show cwd'
  1641. Show the inferior's working directory. If no directory has been
  1642. specified by 'set cwd', then the default inferior's working
  1643. directory is the same as GDB's working directory.
  1644. 'cd [DIRECTORY]'
  1645. Set the GDB working directory to DIRECTORY. If not given,
  1646. DIRECTORY uses ''~''.
  1647. The GDB working directory serves as a default for the commands that
  1648. specify files for GDB to operate on. *Note Commands to Specify
  1649. Files: Files. *Note set cwd command::.
  1650. 'pwd'
  1651. Print the GDB working directory.
  1652. It is generally impossible to find the current working directory of
  1653. the process being debugged (since a program can change its directory
  1654. during its run). If you work on a system where GDB supports the 'info
  1655. proc' command (*note Process Information::), you can use the 'info proc'
  1656. command to find out the current working directory of the debuggee.
  1657. 
  1658. File: gdb.info, Node: Input/Output, Next: Attach, Prev: Working Directory, Up: Running
  1659. 4.6 Your Program's Input and Output
  1660. ===================================
  1661. By default, the program you run under GDB does input and output to the
  1662. same terminal that GDB uses. GDB switches the terminal to its own
  1663. terminal modes to interact with you, but it records the terminal modes
  1664. your program was using and switches back to them when you continue
  1665. running your program.
  1666. 'info terminal'
  1667. Displays information recorded by GDB about the terminal modes your
  1668. program is using.
  1669. You can redirect your program's input and/or output using shell
  1670. redirection with the 'run' command. For example,
  1671. run > outfile
  1672. starts your program, diverting its output to the file 'outfile'.
  1673. Another way to specify where your program should do input and output
  1674. is with the 'tty' command. This command accepts a file name as
  1675. argument, and causes this file to be the default for future 'run'
  1676. commands. It also resets the controlling terminal for the child
  1677. process, for future 'run' commands. For example,
  1678. tty /dev/ttyb
  1679. directs that processes started with subsequent 'run' commands default to
  1680. do input and output on the terminal '/dev/ttyb' and have that as their
  1681. controlling terminal.
  1682. An explicit redirection in 'run' overrides the 'tty' command's effect
  1683. on the input/output device, but not its effect on the controlling
  1684. terminal.
  1685. When you use the 'tty' command or redirect input in the 'run'
  1686. command, only the input _for your program_ is affected. The input for
  1687. GDB still comes from your terminal. 'tty' is an alias for 'set
  1688. inferior-tty'.
  1689. You can use the 'show inferior-tty' command to tell GDB to display
  1690. the name of the terminal that will be used for future runs of your
  1691. program.
  1692. 'set inferior-tty [ TTY ]'
  1693. Set the tty for the program being debugged to TTY. Omitting TTY
  1694. restores the default behavior, which is to use the same terminal as
  1695. GDB.
  1696. 'show inferior-tty'
  1697. Show the current tty for the program being debugged.
  1698. 
  1699. File: gdb.info, Node: Attach, Next: Kill Process, Prev: Input/Output, Up: Running
  1700. 4.7 Debugging an Already-running Process
  1701. ========================================
  1702. 'attach PROCESS-ID'
  1703. This command attaches to a running process--one that was started
  1704. outside GDB. ('info files' shows your active targets.) The
  1705. command takes as argument a process ID. The usual way to find out
  1706. the PROCESS-ID of a Unix process is with the 'ps' utility, or with
  1707. the 'jobs -l' shell command.
  1708. 'attach' does not repeat if you press <RET> a second time after
  1709. executing the command.
  1710. To use 'attach', your program must be running in an environment which
  1711. supports processes; for example, 'attach' does not work for programs on
  1712. bare-board targets that lack an operating system. You must also have
  1713. permission to send the process a signal.
  1714. When you use 'attach', the debugger finds the program running in the
  1715. process first by looking in the current working directory, then (if the
  1716. program is not found) by using the source file search path (*note
  1717. Specifying Source Directories: Source Path.). You can also use the
  1718. 'file' command to load the program. *Note Commands to Specify Files:
  1719. Files.
  1720. The first thing GDB does after arranging to debug the specified
  1721. process is to stop it. You can examine and modify an attached process
  1722. with all the GDB commands that are ordinarily available when you start
  1723. processes with 'run'. You can insert breakpoints; you can step and
  1724. continue; you can modify storage. If you would rather the process
  1725. continue running, you may use the 'continue' command after attaching GDB
  1726. to the process.
  1727. 'detach'
  1728. When you have finished debugging the attached process, you can use
  1729. the 'detach' command to release it from GDB control. Detaching the
  1730. process continues its execution. After the 'detach' command, that
  1731. process and GDB become completely independent once more, and you
  1732. are ready to 'attach' another process or start one with 'run'.
  1733. 'detach' does not repeat if you press <RET> again after executing
  1734. the command.
  1735. If you exit GDB while you have an attached process, you detach that
  1736. process. If you use the 'run' command, you kill that process. By
  1737. default, GDB asks for confirmation if you try to do either of these
  1738. things; you can control whether or not you need to confirm by using the
  1739. 'set confirm' command (*note Optional Warnings and Messages:
  1740. Messages/Warnings.).
  1741. 
  1742. File: gdb.info, Node: Kill Process, Next: Inferiors and Programs, Prev: Attach, Up: Running
  1743. 4.8 Killing the Child Process
  1744. =============================
  1745. 'kill'
  1746. Kill the child process in which your program is running under GDB.
  1747. This command is useful if you wish to debug a core dump instead of a
  1748. running process. GDB ignores any core dump file while your program is
  1749. running.
  1750. On some operating systems, a program cannot be executed outside GDB
  1751. while you have breakpoints set on it inside GDB. You can use the 'kill'
  1752. command in this situation to permit running your program outside the
  1753. debugger.
  1754. The 'kill' command is also useful if you wish to recompile and relink
  1755. your program, since on many systems it is impossible to modify an
  1756. executable file while it is running in a process. In this case, when
  1757. you next type 'run', GDB notices that the file has changed, and reads
  1758. the symbol table again (while trying to preserve your current breakpoint
  1759. settings).
  1760. 
  1761. File: gdb.info, Node: Inferiors and Programs, Next: Threads, Prev: Kill Process, Up: Running
  1762. 4.9 Debugging Multiple Inferiors and Programs
  1763. =============================================
  1764. GDB lets you run and debug multiple programs in a single session. In
  1765. addition, GDB on some systems may let you run several programs
  1766. simultaneously (otherwise you have to exit from one before starting
  1767. another). In the most general case, you can have multiple threads of
  1768. execution in each of multiple processes, launched from multiple
  1769. executables.
  1770. GDB represents the state of each program execution with an object
  1771. called an "inferior". An inferior typically corresponds to a process,
  1772. but is more general and applies also to targets that do not have
  1773. processes. Inferiors may be created before a process runs, and may be
  1774. retained after a process exits. Inferiors have unique identifiers that
  1775. are different from process ids. Usually each inferior will also have
  1776. its own distinct address space, although some embedded targets may have
  1777. several inferiors running in different parts of a single address space.
  1778. Each inferior may in turn have multiple threads running in it.
  1779. To find out what inferiors exist at any moment, use 'info inferiors':
  1780. 'info inferiors'
  1781. Print a list of all inferiors currently being managed by GDB. By
  1782. default all inferiors are printed, but the argument ID... - a space
  1783. separated list of inferior numbers - can be used to limit the
  1784. display to just the requested inferiors.
  1785. GDB displays for each inferior (in this order):
  1786. 1. the inferior number assigned by GDB
  1787. 2. the target system's inferior identifier
  1788. 3. the name of the executable the inferior is running.
  1789. An asterisk '*' preceding the GDB inferior number indicates the
  1790. current inferior.
  1791. For example,
  1792. (gdb) info inferiors
  1793. Num Description Executable
  1794. 2 process 2307 hello
  1795. * 1 process 3401 goodbye
  1796. To switch focus between inferiors, use the 'inferior' command:
  1797. 'inferior INFNO'
  1798. Make inferior number INFNO the current inferior. The argument
  1799. INFNO is the inferior number assigned by GDB, as shown in the first
  1800. field of the 'info inferiors' display.
  1801. The debugger convenience variable '$_inferior' contains the number of
  1802. the current inferior. You may find this useful in writing breakpoint
  1803. conditional expressions, command scripts, and so forth. *Note
  1804. Convenience Variables: Convenience Vars, for general information on
  1805. convenience variables.
  1806. You can get multiple executables into a debugging session via the
  1807. 'add-inferior' and 'clone-inferior' commands. On some systems GDB can
  1808. add inferiors to the debug session automatically by following calls to
  1809. 'fork' and 'exec'. To remove inferiors from the debugging session use
  1810. the 'remove-inferiors' command.
  1811. 'add-inferior [ -copies N ] [ -exec EXECUTABLE ]'
  1812. Adds N inferiors to be run using EXECUTABLE as the executable; N
  1813. defaults to 1. If no executable is specified, the inferiors begins
  1814. empty, with no program. You can still assign or change the program
  1815. assigned to the inferior at any time by using the 'file' command
  1816. with the executable name as its argument.
  1817. 'clone-inferior [ -copies N ] [ INFNO ]'
  1818. Adds N inferiors ready to execute the same program as inferior
  1819. INFNO; N defaults to 1, and INFNO defaults to the number of the
  1820. current inferior. This is a convenient command when you want to
  1821. run another instance of the inferior you are debugging.
  1822. (gdb) info inferiors
  1823. Num Description Executable
  1824. * 1 process 29964 helloworld
  1825. (gdb) clone-inferior
  1826. Added inferior 2.
  1827. 1 inferiors added.
  1828. (gdb) info inferiors
  1829. Num Description Executable
  1830. 2 <null> helloworld
  1831. * 1 process 29964 helloworld
  1832. You can now simply switch focus to inferior 2 and run it.
  1833. 'remove-inferiors INFNO...'
  1834. Removes the inferior or inferiors INFNO.... It is not possible to
  1835. remove an inferior that is running with this command. For those,
  1836. use the 'kill' or 'detach' command first.
  1837. To quit debugging one of the running inferiors that is not the
  1838. current inferior, you can either detach from it by using the 'detach inferior'
  1839. command (allowing it to run independently), or kill it using the 'kill inferiors'
  1840. command:
  1841. 'detach inferior INFNO...'
  1842. Detach from the inferior or inferiors identified by GDB inferior
  1843. number(s) INFNO.... Note that the inferior's entry still stays on
  1844. the list of inferiors shown by 'info inferiors', but its
  1845. Description will show '<null>'.
  1846. 'kill inferiors INFNO...'
  1847. Kill the inferior or inferiors identified by GDB inferior number(s)
  1848. INFNO.... Note that the inferior's entry still stays on the list
  1849. of inferiors shown by 'info inferiors', but its Description will
  1850. show '<null>'.
  1851. After the successful completion of a command such as 'detach',
  1852. 'detach inferiors', 'kill' or 'kill inferiors', or after a normal
  1853. process exit, the inferior is still valid and listed with 'info
  1854. inferiors', ready to be restarted.
  1855. To be notified when inferiors are started or exit under GDB's control
  1856. use 'set print inferior-events':
  1857. 'set print inferior-events'
  1858. 'set print inferior-events on'
  1859. 'set print inferior-events off'
  1860. The 'set print inferior-events' command allows you to enable or
  1861. disable printing of messages when GDB notices that new inferiors
  1862. have started or that inferiors have exited or have been detached.
  1863. By default, these messages will not be printed.
  1864. 'show print inferior-events'
  1865. Show whether messages will be printed when GDB detects that
  1866. inferiors have started, exited or have been detached.
  1867. Many commands will work the same with multiple programs as with a
  1868. single program: e.g., 'print myglobal' will simply display the value of
  1869. 'myglobal' in the current inferior.
  1870. Occasionaly, when debugging GDB itself, it may be useful to get more
  1871. info about the relationship of inferiors, programs, address spaces in a
  1872. debug session. You can do that with the 'maint info program-spaces'
  1873. command.
  1874. 'maint info program-spaces'
  1875. Print a list of all program spaces currently being managed by GDB.
  1876. GDB displays for each program space (in this order):
  1877. 1. the program space number assigned by GDB
  1878. 2. the name of the executable loaded into the program space, with
  1879. e.g., the 'file' command.
  1880. An asterisk '*' preceding the GDB program space number indicates
  1881. the current program space.
  1882. In addition, below each program space line, GDB prints extra
  1883. information that isn't suitable to display in tabular form. For
  1884. example, the list of inferiors bound to the program space.
  1885. (gdb) maint info program-spaces
  1886. Id Executable
  1887. * 1 hello
  1888. 2 goodbye
  1889. Bound inferiors: ID 1 (process 21561)
  1890. Here we can see that no inferior is running the program 'hello',
  1891. while 'process 21561' is running the program 'goodbye'. On some
  1892. targets, it is possible that multiple inferiors are bound to the
  1893. same program space. The most common example is that of debugging
  1894. both the parent and child processes of a 'vfork' call. For
  1895. example,
  1896. (gdb) maint info program-spaces
  1897. Id Executable
  1898. * 1 vfork-test
  1899. Bound inferiors: ID 2 (process 18050), ID 1 (process 18045)
  1900. Here, both inferior 2 and inferior 1 are running in the same
  1901. program space as a result of inferior 1 having executed a 'vfork'
  1902. call.
  1903. 
  1904. File: gdb.info, Node: Threads, Next: Forks, Prev: Inferiors and Programs, Up: Running
  1905. 4.10 Debugging Programs with Multiple Threads
  1906. =============================================
  1907. In some operating systems, such as GNU/Linux and Solaris, a single
  1908. program may have more than one "thread" of execution. The precise
  1909. semantics of threads differ from one operating system to another, but in
  1910. general the threads of a single program are akin to multiple
  1911. processes--except that they share one address space (that is, they can
  1912. all examine and modify the same variables). On the other hand, each
  1913. thread has its own registers and execution stack, and perhaps private
  1914. memory.
  1915. GDB provides these facilities for debugging multi-thread programs:
  1916. * automatic notification of new threads
  1917. * 'thread THREAD-ID', a command to switch among threads
  1918. * 'info threads', a command to inquire about existing threads
  1919. * 'thread apply [THREAD-ID-LIST | all] ARGS', a command to apply a
  1920. command to a list of threads
  1921. * thread-specific breakpoints
  1922. * 'set print thread-events', which controls printing of messages on
  1923. thread start and exit.
  1924. * 'set libthread-db-search-path PATH', which lets the user specify
  1925. which 'libthread_db' to use if the default choice isn't compatible
  1926. with the program.
  1927. The GDB thread debugging facility allows you to observe all threads
  1928. while your program runs--but whenever GDB takes control, one thread in
  1929. particular is always the focus of debugging. This thread is called the
  1930. "current thread". Debugging commands show program information from the
  1931. perspective of the current thread.
  1932. Whenever GDB detects a new thread in your program, it displays the
  1933. target system's identification for the thread with a message in the form
  1934. '[New SYSTAG]', where SYSTAG is a thread identifier whose form varies
  1935. depending on the particular system. For example, on GNU/Linux, you
  1936. might see
  1937. [New Thread 0x41e02940 (LWP 25582)]
  1938. when GDB notices a new thread. In contrast, on other systems, the
  1939. SYSTAG is simply something like 'process 368', with no further
  1940. qualifier.
  1941. For debugging purposes, GDB associates its own thread number --always
  1942. a single integer--with each thread of an inferior. This number is
  1943. unique between all threads of an inferior, but not unique between
  1944. threads of different inferiors.
  1945. You can refer to a given thread in an inferior using the qualified
  1946. INFERIOR-NUM.THREAD-NUM syntax, also known as "qualified thread ID",
  1947. with INFERIOR-NUM being the inferior number and THREAD-NUM being the
  1948. thread number of the given inferior. For example, thread '2.3' refers
  1949. to thread number 3 of inferior 2. If you omit INFERIOR-NUM (e.g.,
  1950. 'thread 3'), then GDB infers you're referring to a thread of the current
  1951. inferior.
  1952. Until you create a second inferior, GDB does not show the
  1953. INFERIOR-NUM part of thread IDs, even though you can always use the full
  1954. INFERIOR-NUM.THREAD-NUM form to refer to threads of inferior 1, the
  1955. initial inferior.
  1956. Some commands accept a space-separated "thread ID list" as argument.
  1957. A list element can be:
  1958. 1. A thread ID as shown in the first field of the 'info threads'
  1959. display, with or without an inferior qualifier. E.g., '2.1' or
  1960. '1'.
  1961. 2. A range of thread numbers, again with or without an inferior
  1962. qualifier, as in INF.THR1-THR2 or THR1-THR2. E.g., '1.2-4' or
  1963. '2-4'.
  1964. 3. All threads of an inferior, specified with a star wildcard, with or
  1965. without an inferior qualifier, as in INF.'*' (e.g., '1.*') or '*'.
  1966. The former refers to all threads of the given inferior, and the
  1967. latter form without an inferior qualifier refers to all threads of
  1968. the current inferior.
  1969. For example, if the current inferior is 1, and inferior 7 has one
  1970. thread with ID 7.1, the thread list '1 2-3 4.5 6.7-9 7.*' includes
  1971. threads 1 to 3 of inferior 1, thread 5 of inferior 4, threads 7 to 9 of
  1972. inferior 6 and all threads of inferior 7. That is, in expanded
  1973. qualified form, the same as '1.1 1.2 1.3 4.5 6.7 6.8 6.9 7.1'.
  1974. In addition to a _per-inferior_ number, each thread is also assigned
  1975. a unique _global_ number, also known as "global thread ID", a single
  1976. integer. Unlike the thread number component of the thread ID, no two
  1977. threads have the same global ID, even when you're debugging multiple
  1978. inferiors.
  1979. From GDB's perspective, a process always has at least one thread. In
  1980. other words, GDB assigns a thread number to the program's "main thread"
  1981. even if the program is not multi-threaded.
  1982. The debugger convenience variables '$_thread' and '$_gthread'
  1983. contain, respectively, the per-inferior thread number and the global
  1984. thread number of the current thread. You may find this useful in
  1985. writing breakpoint conditional expressions, command scripts, and so
  1986. forth. *Note Convenience Variables: Convenience Vars, for general
  1987. information on convenience variables.
  1988. If GDB detects the program is multi-threaded, it augments the usual
  1989. message about stopping at a breakpoint with the ID and name of the
  1990. thread that hit the breakpoint.
  1991. Thread 2 "client" hit Breakpoint 1, send_message () at client.c:68
  1992. Likewise when the program receives a signal:
  1993. Thread 1 "main" received signal SIGINT, Interrupt.
  1994. 'info threads [THREAD-ID-LIST]'
  1995. Display information about one or more threads. With no arguments
  1996. displays information about all threads. You can specify the list
  1997. of threads that you want to display using the thread ID list syntax
  1998. (*note thread ID lists::).
  1999. GDB displays for each thread (in this order):
  2000. 1. the per-inferior thread number assigned by GDB
  2001. 2. the global thread number assigned by GDB, if the '-gid' option
  2002. was specified
  2003. 3. the target system's thread identifier (SYSTAG)
  2004. 4. the thread's name, if one is known. A thread can either be
  2005. named by the user (see 'thread name', below), or, in some
  2006. cases, by the program itself.
  2007. 5. the current stack frame summary for that thread
  2008. An asterisk '*' to the left of the GDB thread number indicates the
  2009. current thread.
  2010. For example,
  2011. (gdb) info threads
  2012. Id Target Id Frame
  2013. * 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8)
  2014. 2 process 35 thread 23 0x34e5 in sigpause ()
  2015. 3 process 35 thread 27 0x34e5 in sigpause ()
  2016. at threadtest.c:68
  2017. If you're debugging multiple inferiors, GDB displays thread IDs using
  2018. the qualified INFERIOR-NUM.THREAD-NUM format. Otherwise, only
  2019. THREAD-NUM is shown.
  2020. If you specify the '-gid' option, GDB displays a column indicating
  2021. each thread's global thread ID:
  2022. (gdb) info threads
  2023. Id GId Target Id Frame
  2024. 1.1 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8)
  2025. 1.2 3 process 35 thread 23 0x34e5 in sigpause ()
  2026. 1.3 4 process 35 thread 27 0x34e5 in sigpause ()
  2027. * 2.1 2 process 65 thread 1 main (argc=1, argv=0x7ffffff8)
  2028. On Solaris, you can display more information about user threads with
  2029. a Solaris-specific command:
  2030. 'maint info sol-threads'
  2031. Display info on Solaris user threads.
  2032. 'thread THREAD-ID'
  2033. Make thread ID THREAD-ID the current thread. The command argument
  2034. THREAD-ID is the GDB thread ID, as shown in the first field of the
  2035. 'info threads' display, with or without an inferior qualifier
  2036. (e.g., '2.1' or '1').
  2037. GDB responds by displaying the system identifier of the thread you
  2038. selected, and its current stack frame summary:
  2039. (gdb) thread 2
  2040. [Switching to thread 2 (Thread 0xb7fdab70 (LWP 12747))]
  2041. #0 some_function (ignore=0x0) at example.c:8
  2042. 8 printf ("hello\n");
  2043. As with the '[New ...]' message, the form of the text after
  2044. 'Switching to' depends on your system's conventions for identifying
  2045. threads.
  2046. 'thread apply [THREAD-ID-LIST | all [-ascending]] [FLAG]... COMMAND'
  2047. The 'thread apply' command allows you to apply the named COMMAND to
  2048. one or more threads. Specify the threads that you want affected
  2049. using the thread ID list syntax (*note thread ID lists::), or
  2050. specify 'all' to apply to all threads. To apply a command to all
  2051. threads in descending order, type 'thread apply all COMMAND'. To
  2052. apply a command to all threads in ascending order, type 'thread
  2053. apply all -ascending COMMAND'.
  2054. The FLAG arguments control what output to produce and how to handle
  2055. errors raised when applying COMMAND to a thread. FLAG must start
  2056. with a '-' directly followed by one letter in 'qcs'. If several
  2057. flags are provided, they must be given individually, such as '-c
  2058. -q'.
  2059. By default, GDB displays some thread information before the output
  2060. produced by COMMAND, and an error raised during the execution of a
  2061. COMMAND will abort 'thread apply'. The following flags can be used
  2062. to fine-tune this behavior:
  2063. '-c'
  2064. The flag '-c', which stands for 'continue', causes any errors
  2065. in COMMAND to be displayed, and the execution of 'thread
  2066. apply' then continues.
  2067. '-s'
  2068. The flag '-s', which stands for 'silent', causes any errors or
  2069. empty output produced by a COMMAND to be silently ignored.
  2070. That is, the execution continues, but the thread information
  2071. and errors are not printed.
  2072. '-q'
  2073. The flag '-q' ('quiet') disables printing the thread
  2074. information.
  2075. Flags '-c' and '-s' cannot be used together.
  2076. 'taas COMMAND'
  2077. Shortcut for 'thread apply all -s COMMAND'. Applies COMMAND on all
  2078. threads, ignoring errors and empty output.
  2079. 'tfaas COMMAND'
  2080. Shortcut for 'thread apply all -s frame apply all -s COMMAND'.
  2081. Applies COMMAND on all frames of all threads, ignoring errors and
  2082. empty output. Note that the flag '-s' is specified twice: The
  2083. first '-s' ensures that 'thread apply' only shows the thread
  2084. information of the threads for which 'frame apply' produces some
  2085. output. The second '-s' is needed to ensure that 'frame apply'
  2086. shows the frame information of a frame only if the COMMAND
  2087. successfully produced some output.
  2088. It can for example be used to print a local variable or a function
  2089. argument without knowing the thread or frame where this variable or
  2090. argument is, using:
  2091. (gdb) tfaas p some_local_var_i_do_not_remember_where_it_is
  2092. 'thread name [NAME]'
  2093. This command assigns a name to the current thread. If no argument
  2094. is given, any existing user-specified name is removed. The thread
  2095. name appears in the 'info threads' display.
  2096. On some systems, such as GNU/Linux, GDB is able to determine the
  2097. name of the thread as given by the OS. On these systems, a name
  2098. specified with 'thread name' will override the system-give name,
  2099. and removing the user-specified name will cause GDB to once again
  2100. display the system-specified name.
  2101. 'thread find [REGEXP]'
  2102. Search for and display thread ids whose name or SYSTAG matches the
  2103. supplied regular expression.
  2104. As well as being the complement to the 'thread name' command, this
  2105. command also allows you to identify a thread by its target SYSTAG.
  2106. For instance, on GNU/Linux, the target SYSTAG is the LWP id.
  2107. (GDB) thread find 26688
  2108. Thread 4 has target id 'Thread 0x41e02940 (LWP 26688)'
  2109. (GDB) info thread 4
  2110. Id Target Id Frame
  2111. 4 Thread 0x41e02940 (LWP 26688) 0x00000031ca6cd372 in select ()
  2112. 'set print thread-events'
  2113. 'set print thread-events on'
  2114. 'set print thread-events off'
  2115. The 'set print thread-events' command allows you to enable or
  2116. disable printing of messages when GDB notices that new threads have
  2117. started or that threads have exited. By default, these messages
  2118. will be printed if detection of these events is supported by the
  2119. target. Note that these messages cannot be disabled on all
  2120. targets.
  2121. 'show print thread-events'
  2122. Show whether messages will be printed when GDB detects that threads
  2123. have started and exited.
  2124. *Note Stopping and Starting Multi-thread Programs: Thread Stops, for
  2125. more information about how GDB behaves when you stop and start programs
  2126. with multiple threads.
  2127. *Note Setting Watchpoints: Set Watchpoints, for information about
  2128. watchpoints in programs with multiple threads.
  2129. 'set libthread-db-search-path [PATH]'
  2130. If this variable is set, PATH is a colon-separated list of
  2131. directories GDB will use to search for 'libthread_db'. If you omit
  2132. PATH, 'libthread-db-search-path' will be reset to its default value
  2133. ('$sdir:$pdir' on GNU/Linux and Solaris systems). Internally, the
  2134. default value comes from the 'LIBTHREAD_DB_SEARCH_PATH' macro.
  2135. On GNU/Linux and Solaris systems, GDB uses a "helper"
  2136. 'libthread_db' library to obtain information about threads in the
  2137. inferior process. GDB will use 'libthread-db-search-path' to find
  2138. 'libthread_db'. GDB also consults first if inferior specific
  2139. thread debugging library loading is enabled by 'set auto-load
  2140. libthread-db' (*note libthread_db.so.1 file::).
  2141. A special entry '$sdir' for 'libthread-db-search-path' refers to
  2142. the default system directories that are normally searched for
  2143. loading shared libraries. The '$sdir' entry is the only kind not
  2144. needing to be enabled by 'set auto-load libthread-db' (*note
  2145. libthread_db.so.1 file::).
  2146. A special entry '$pdir' for 'libthread-db-search-path' refers to
  2147. the directory from which 'libpthread' was loaded in the inferior
  2148. process.
  2149. For any 'libthread_db' library GDB finds in above directories, GDB
  2150. attempts to initialize it with the current inferior process. If
  2151. this initialization fails (which could happen because of a version
  2152. mismatch between 'libthread_db' and 'libpthread'), GDB will unload
  2153. 'libthread_db', and continue with the next directory. If none of
  2154. 'libthread_db' libraries initialize successfully, GDB will issue a
  2155. warning and thread debugging will be disabled.
  2156. Setting 'libthread-db-search-path' is currently implemented only on
  2157. some platforms.
  2158. 'show libthread-db-search-path'
  2159. Display current libthread_db search path.
  2160. 'set debug libthread-db'
  2161. 'show debug libthread-db'
  2162. Turns on or off display of 'libthread_db'-related events. Use '1'
  2163. to enable, '0' to disable.
  2164. 
  2165. File: gdb.info, Node: Forks, Next: Checkpoint/Restart, Prev: Threads, Up: Running
  2166. 4.11 Debugging Forks
  2167. ====================
  2168. On most systems, GDB has no special support for debugging programs which
  2169. create additional processes using the 'fork' function. When a program
  2170. forks, GDB will continue to debug the parent process and the child
  2171. process will run unimpeded. If you have set a breakpoint in any code
  2172. which the child then executes, the child will get a 'SIGTRAP' signal
  2173. which (unless it catches the signal) will cause it to terminate.
  2174. However, if you want to debug the child process there is a workaround
  2175. which isn't too painful. Put a call to 'sleep' in the code which the
  2176. child process executes after the fork. It may be useful to sleep only
  2177. if a certain environment variable is set, or a certain file exists, so
  2178. that the delay need not occur when you don't want to run GDB on the
  2179. child. While the child is sleeping, use the 'ps' program to get its
  2180. process ID. Then tell GDB (a new invocation of GDB if you are also
  2181. debugging the parent process) to attach to the child process (*note
  2182. Attach::). From that point on you can debug the child process just like
  2183. any other process which you attached to.
  2184. On some systems, GDB provides support for debugging programs that
  2185. create additional processes using the 'fork' or 'vfork' functions. On
  2186. GNU/Linux platforms, this feature is supported with kernel version
  2187. 2.5.46 and later.
  2188. The fork debugging commands are supported in native mode and when
  2189. connected to 'gdbserver' in either 'target remote' mode or 'target
  2190. extended-remote' mode.
  2191. By default, when a program forks, GDB will continue to debug the
  2192. parent process and the child process will run unimpeded.
  2193. If you want to follow the child process instead of the parent
  2194. process, use the command 'set follow-fork-mode'.
  2195. 'set follow-fork-mode MODE'
  2196. Set the debugger response to a program call of 'fork' or 'vfork'.
  2197. A call to 'fork' or 'vfork' creates a new process. The MODE
  2198. argument can be:
  2199. 'parent'
  2200. The original process is debugged after a fork. The child
  2201. process runs unimpeded. This is the default.
  2202. 'child'
  2203. The new process is debugged after a fork. The parent process
  2204. runs unimpeded.
  2205. 'show follow-fork-mode'
  2206. Display the current debugger response to a 'fork' or 'vfork' call.
  2207. On Linux, if you want to debug both the parent and child processes,
  2208. use the command 'set detach-on-fork'.
  2209. 'set detach-on-fork MODE'
  2210. Tells gdb whether to detach one of the processes after a fork, or
  2211. retain debugger control over them both.
  2212. 'on'
  2213. The child process (or parent process, depending on the value
  2214. of 'follow-fork-mode') will be detached and allowed to run
  2215. independently. This is the default.
  2216. 'off'
  2217. Both processes will be held under the control of GDB. One
  2218. process (child or parent, depending on the value of
  2219. 'follow-fork-mode') is debugged as usual, while the other is
  2220. held suspended.
  2221. 'show detach-on-fork'
  2222. Show whether detach-on-fork mode is on/off.
  2223. If you choose to set 'detach-on-fork' mode off, then GDB will retain
  2224. control of all forked processes (including nested forks). You can list
  2225. the forked processes under the control of GDB by using the 'info inferiors'
  2226. command, and switch from one fork to another by using the 'inferior'
  2227. command (*note Debugging Multiple Inferiors and Programs: Inferiors and
  2228. Programs.).
  2229. To quit debugging one of the forked processes, you can either detach
  2230. from it by using the 'detach inferiors' command (allowing it to run
  2231. independently), or kill it using the 'kill inferiors' command. *Note
  2232. Debugging Multiple Inferiors and Programs: Inferiors and Programs.
  2233. If you ask to debug a child process and a 'vfork' is followed by an
  2234. 'exec', GDB executes the new target up to the first breakpoint in the
  2235. new target. If you have a breakpoint set on 'main' in your original
  2236. program, the breakpoint will also be set on the child process's 'main'.
  2237. On some systems, when a child process is spawned by 'vfork', you
  2238. cannot debug the child or parent until an 'exec' call completes.
  2239. If you issue a 'run' command to GDB after an 'exec' call executes,
  2240. the new target restarts. To restart the parent process, use the 'file'
  2241. command with the parent executable name as its argument. By default,
  2242. after an 'exec' call executes, GDB discards the symbols of the previous
  2243. executable image. You can change this behaviour with the 'set follow-exec-mode'
  2244. command.
  2245. 'set follow-exec-mode MODE'
  2246. Set debugger response to a program call of 'exec'. An 'exec' call
  2247. replaces the program image of a process.
  2248. 'follow-exec-mode' can be:
  2249. 'new'
  2250. GDB creates a new inferior and rebinds the process to this new
  2251. inferior. The program the process was running before the
  2252. 'exec' call can be restarted afterwards by restarting the
  2253. original inferior.
  2254. For example:
  2255. (gdb) info inferiors
  2256. (gdb) info inferior
  2257. Id Description Executable
  2258. * 1 <null> prog1
  2259. (gdb) run
  2260. process 12020 is executing new program: prog2
  2261. Program exited normally.
  2262. (gdb) info inferiors
  2263. Id Description Executable
  2264. 1 <null> prog1
  2265. * 2 <null> prog2
  2266. 'same'
  2267. GDB keeps the process bound to the same inferior. The new
  2268. executable image replaces the previous executable loaded in
  2269. the inferior. Restarting the inferior after the 'exec' call,
  2270. with e.g., the 'run' command, restarts the executable the
  2271. process was running after the 'exec' call. This is the
  2272. default mode.
  2273. For example:
  2274. (gdb) info inferiors
  2275. Id Description Executable
  2276. * 1 <null> prog1
  2277. (gdb) run
  2278. process 12020 is executing new program: prog2
  2279. Program exited normally.
  2280. (gdb) info inferiors
  2281. Id Description Executable
  2282. * 1 <null> prog2
  2283. 'follow-exec-mode' is supported in native mode and 'target
  2284. extended-remote' mode.
  2285. You can use the 'catch' command to make GDB stop whenever a 'fork',
  2286. 'vfork', or 'exec' call is made. *Note Setting Catchpoints: Set
  2287. Catchpoints.
  2288. 
  2289. File: gdb.info, Node: Checkpoint/Restart, Prev: Forks, Up: Running
  2290. 4.12 Setting a _Bookmark_ to Return to Later
  2291. ============================================
  2292. On certain operating systems(1), GDB is able to save a "snapshot" of a
  2293. program's state, called a "checkpoint", and come back to it later.
  2294. Returning to a checkpoint effectively undoes everything that has
  2295. happened in the program since the 'checkpoint' was saved. This includes
  2296. changes in memory, registers, and even (within some limits) system
  2297. state. Effectively, it is like going back in time to the moment when
  2298. the checkpoint was saved.
  2299. Thus, if you're stepping thru a program and you think you're getting
  2300. close to the point where things go wrong, you can save a checkpoint.
  2301. Then, if you accidentally go too far and miss the critical statement,
  2302. instead of having to restart your program from the beginning, you can
  2303. just go back to the checkpoint and start again from there.
  2304. This can be especially useful if it takes a lot of time or steps to
  2305. reach the point where you think the bug occurs.
  2306. To use the 'checkpoint'/'restart' method of debugging:
  2307. 'checkpoint'
  2308. Save a snapshot of the debugged program's current execution state.
  2309. The 'checkpoint' command takes no arguments, but each checkpoint is
  2310. assigned a small integer id, similar to a breakpoint id.
  2311. 'info checkpoints'
  2312. List the checkpoints that have been saved in the current debugging
  2313. session. For each checkpoint, the following information will be
  2314. listed:
  2315. 'Checkpoint ID'
  2316. 'Process ID'
  2317. 'Code Address'
  2318. 'Source line, or label'
  2319. 'restart CHECKPOINT-ID'
  2320. Restore the program state that was saved as checkpoint number
  2321. CHECKPOINT-ID. All program variables, registers, stack frames etc.
  2322. will be returned to the values that they had when the checkpoint
  2323. was saved. In essence, gdb will "wind back the clock" to the point
  2324. in time when the checkpoint was saved.
  2325. Note that breakpoints, GDB variables, command history etc. are not
  2326. affected by restoring a checkpoint. In general, a checkpoint only
  2327. restores things that reside in the program being debugged, not in
  2328. the debugger.
  2329. 'delete checkpoint CHECKPOINT-ID'
  2330. Delete the previously-saved checkpoint identified by CHECKPOINT-ID.
  2331. Returning to a previously saved checkpoint will restore the user
  2332. state of the program being debugged, plus a significant subset of the
  2333. system (OS) state, including file pointers. It won't "un-write" data
  2334. from a file, but it will rewind the file pointer to the previous
  2335. location, so that the previously written data can be overwritten. For
  2336. files opened in read mode, the pointer will also be restored so that the
  2337. previously read data can be read again.
  2338. Of course, characters that have been sent to a printer (or other
  2339. external device) cannot be "snatched back", and characters received from
  2340. eg. a serial device can be removed from internal program buffers, but
  2341. they cannot be "pushed back" into the serial pipeline, ready to be
  2342. received again. Similarly, the actual contents of files that have been
  2343. changed cannot be restored (at this time).
  2344. However, within those constraints, you actually can "rewind" your
  2345. program to a previously saved point in time, and begin debugging it
  2346. again -- and you can change the course of events so as to debug a
  2347. different execution path this time.
  2348. Finally, there is one bit of internal program state that will be
  2349. different when you return to a checkpoint -- the program's process id.
  2350. Each checkpoint will have a unique process id (or PID), and each will be
  2351. different from the program's original PID. If your program has saved a
  2352. local copy of its process id, this could potentially pose a problem.
  2353. 4.12.1 A Non-obvious Benefit of Using Checkpoints
  2354. -------------------------------------------------
  2355. On some systems such as GNU/Linux, address space randomization is
  2356. performed on new processes for security reasons. This makes it
  2357. difficult or impossible to set a breakpoint, or watchpoint, on an
  2358. absolute address if you have to restart the program, since the absolute
  2359. location of a symbol will change from one execution to the next.
  2360. A checkpoint, however, is an _identical_ copy of a process.
  2361. Therefore if you create a checkpoint at (eg.) the start of main, and
  2362. simply return to that checkpoint instead of restarting the process, you
  2363. can avoid the effects of address randomization and your symbols will all
  2364. stay in the same place.
  2365. ---------- Footnotes ----------
  2366. (1) Currently, only GNU/Linux.
  2367. 
  2368. File: gdb.info, Node: Stopping, Next: Reverse Execution, Prev: Running, Up: Top
  2369. 5 Stopping and Continuing
  2370. *************************
  2371. The principal purposes of using a debugger are so that you can stop your
  2372. program before it terminates; or so that, if your program runs into
  2373. trouble, you can investigate and find out why.
  2374. Inside GDB, your program may stop for any of several reasons, such as
  2375. a signal, a breakpoint, or reaching a new line after a GDB command such
  2376. as 'step'. You may then examine and change variables, set new
  2377. breakpoints or remove old ones, and then continue execution. Usually,
  2378. the messages shown by GDB provide ample explanation of the status of
  2379. your program--but you can also explicitly request this information at
  2380. any time.
  2381. 'info program'
  2382. Display information about the status of your program: whether it is
  2383. running or not, what process it is, and why it stopped.
  2384. * Menu:
  2385. * Breakpoints:: Breakpoints, watchpoints, and catchpoints
  2386. * Continuing and Stepping:: Resuming execution
  2387. * Skipping Over Functions and Files::
  2388. Skipping over functions and files
  2389. * Signals:: Signals
  2390. * Thread Stops:: Stopping and starting multi-thread programs
  2391. 
  2392. File: gdb.info, Node: Breakpoints, Next: Continuing and Stepping, Up: Stopping
  2393. 5.1 Breakpoints, Watchpoints, and Catchpoints
  2394. =============================================
  2395. A "breakpoint" makes your program stop whenever a certain point in the
  2396. program is reached. For each breakpoint, you can add conditions to
  2397. control in finer detail whether your program stops. You can set
  2398. breakpoints with the 'break' command and its variants (*note Setting
  2399. Breakpoints: Set Breaks.), to specify the place where your program
  2400. should stop by line number, function name or exact address in the
  2401. program.
  2402. On some systems, you can set breakpoints in shared libraries before
  2403. the executable is run.
  2404. A "watchpoint" is a special breakpoint that stops your program when
  2405. the value of an expression changes. The expression may be a value of a
  2406. variable, or it could involve values of one or more variables combined
  2407. by operators, such as 'a + b'. This is sometimes called "data
  2408. breakpoints". You must use a different command to set watchpoints
  2409. (*note Setting Watchpoints: Set Watchpoints.), but aside from that, you
  2410. can manage a watchpoint like any other breakpoint: you enable, disable,
  2411. and delete both breakpoints and watchpoints using the same commands.
  2412. You can arrange to have values from your program displayed
  2413. automatically whenever GDB stops at a breakpoint. *Note Automatic
  2414. Display: Auto Display.
  2415. A "catchpoint" is another special breakpoint that stops your program
  2416. when a certain kind of event occurs, such as the throwing of a C++
  2417. exception or the loading of a library. As with watchpoints, you use a
  2418. different command to set a catchpoint (*note Setting Catchpoints: Set
  2419. Catchpoints.), but aside from that, you can manage a catchpoint like any
  2420. other breakpoint. (To stop when your program receives a signal, use the
  2421. 'handle' command; see *note Signals: Signals.)
  2422. GDB assigns a number to each breakpoint, watchpoint, or catchpoint
  2423. when you create it; these numbers are successive integers starting with
  2424. one. In many of the commands for controlling various features of
  2425. breakpoints you use the breakpoint number to say which breakpoint you
  2426. want to change. Each breakpoint may be "enabled" or "disabled"; if
  2427. disabled, it has no effect on your program until you enable it again.
  2428. Some GDB commands accept a space-separated list of breakpoints on
  2429. which to operate. A list element can be either a single breakpoint
  2430. number, like '5', or a range of such numbers, like '5-7'. When a
  2431. breakpoint list is given to a command, all breakpoints in that list are
  2432. operated on.
  2433. * Menu:
  2434. * Set Breaks:: Setting breakpoints
  2435. * Set Watchpoints:: Setting watchpoints
  2436. * Set Catchpoints:: Setting catchpoints
  2437. * Delete Breaks:: Deleting breakpoints
  2438. * Disabling:: Disabling breakpoints
  2439. * Conditions:: Break conditions
  2440. * Break Commands:: Breakpoint command lists
  2441. * Dynamic Printf:: Dynamic printf
  2442. * Save Breakpoints:: How to save breakpoints in a file
  2443. * Static Probe Points:: Listing static probe points
  2444. * Error in Breakpoints:: "Cannot insert breakpoints"
  2445. * Breakpoint-related Warnings:: "Breakpoint address adjusted..."
  2446. 
  2447. File: gdb.info, Node: Set Breaks, Next: Set Watchpoints, Up: Breakpoints
  2448. 5.1.1 Setting Breakpoints
  2449. -------------------------
  2450. Breakpoints are set with the 'break' command (abbreviated 'b'). The
  2451. debugger convenience variable '$bpnum' records the number of the
  2452. breakpoint you've set most recently; see *note Convenience Variables:
  2453. Convenience Vars, for a discussion of what you can do with convenience
  2454. variables.
  2455. 'break LOCATION'
  2456. Set a breakpoint at the given LOCATION, which can specify a
  2457. function name, a line number, or an address of an instruction.
  2458. (*Note Specify Location::, for a list of all the possible ways to
  2459. specify a LOCATION.) The breakpoint will stop your program just
  2460. before it executes any of the code in the specified LOCATION.
  2461. When using source languages that permit overloading of symbols,
  2462. such as C++, a function name may refer to more than one possible
  2463. place to break. *Note Ambiguous Expressions: Ambiguous
  2464. Expressions, for a discussion of that situation.
  2465. It is also possible to insert a breakpoint that will stop the
  2466. program only if a specific thread (*note Thread-Specific
  2467. Breakpoints::) or a specific task (*note Ada Tasks::) hits that
  2468. breakpoint.
  2469. 'break'
  2470. When called without any arguments, 'break' sets a breakpoint at the
  2471. next instruction to be executed in the selected stack frame (*note
  2472. Examining the Stack: Stack.). In any selected frame but the
  2473. innermost, this makes your program stop as soon as control returns
  2474. to that frame. This is similar to the effect of a 'finish' command
  2475. in the frame inside the selected frame--except that 'finish' does
  2476. not leave an active breakpoint. If you use 'break' without an
  2477. argument in the innermost frame, GDB stops the next time it reaches
  2478. the current location; this may be useful inside loops.
  2479. GDB normally ignores breakpoints when it resumes execution, until
  2480. at least one instruction has been executed. If it did not do this,
  2481. you would be unable to proceed past a breakpoint without first
  2482. disabling the breakpoint. This rule applies whether or not the
  2483. breakpoint already existed when your program stopped.
  2484. 'break ... if COND'
  2485. Set a breakpoint with condition COND; evaluate the expression COND
  2486. each time the breakpoint is reached, and stop only if the value is
  2487. nonzero--that is, if COND evaluates as true. '...' stands for one
  2488. of the possible arguments described above (or no argument)
  2489. specifying where to break. *Note Break Conditions: Conditions, for
  2490. more information on breakpoint conditions.
  2491. 'tbreak ARGS'
  2492. Set a breakpoint enabled only for one stop. The ARGS are the same
  2493. as for the 'break' command, and the breakpoint is set in the same
  2494. way, but the breakpoint is automatically deleted after the first
  2495. time your program stops there. *Note Disabling Breakpoints:
  2496. Disabling.
  2497. 'hbreak ARGS'
  2498. Set a hardware-assisted breakpoint. The ARGS are the same as for
  2499. the 'break' command and the breakpoint is set in the same way, but
  2500. the breakpoint requires hardware support and some target hardware
  2501. may not have this support. The main purpose of this is EPROM/ROM
  2502. code debugging, so you can set a breakpoint at an instruction
  2503. without changing the instruction. This can be used with the new
  2504. trap-generation provided by SPARClite DSU and most x86-based
  2505. targets. These targets will generate traps when a program accesses
  2506. some data or instruction address that is assigned to the debug
  2507. registers. However the hardware breakpoint registers can take a
  2508. limited number of breakpoints. For example, on the DSU, only two
  2509. data breakpoints can be set at a time, and GDB will reject this
  2510. command if more than two are used. Delete or disable unused
  2511. hardware breakpoints before setting new ones (*note Disabling
  2512. Breakpoints: Disabling.). *Note Break Conditions: Conditions. For
  2513. remote targets, you can restrict the number of hardware breakpoints
  2514. GDB will use, see *note set remote hardware-breakpoint-limit::.
  2515. 'thbreak ARGS'
  2516. Set a hardware-assisted breakpoint enabled only for one stop. The
  2517. ARGS are the same as for the 'hbreak' command and the breakpoint is
  2518. set in the same way. However, like the 'tbreak' command, the
  2519. breakpoint is automatically deleted after the first time your
  2520. program stops there. Also, like the 'hbreak' command, the
  2521. breakpoint requires hardware support and some target hardware may
  2522. not have this support. *Note Disabling Breakpoints: Disabling.
  2523. See also *note Break Conditions: Conditions.
  2524. 'rbreak REGEX'
  2525. Set breakpoints on all functions matching the regular expression
  2526. REGEX. This command sets an unconditional breakpoint on all
  2527. matches, printing a list of all breakpoints it set. Once these
  2528. breakpoints are set, they are treated just like the breakpoints set
  2529. with the 'break' command. You can delete them, disable them, or
  2530. make them conditional the same way as any other breakpoint.
  2531. In programs using different languages, GDB chooses the syntax to
  2532. print the list of all breakpoints it sets according to the 'set
  2533. language' value: using 'set language auto' (see *note Set Language
  2534. Automatically: Automatically.) means to use the language of the
  2535. breakpoint's function, other values mean to use the manually
  2536. specified language (see *note Set Language Manually: Manually.).
  2537. The syntax of the regular expression is the standard one used with
  2538. tools like 'grep'. Note that this is different from the syntax
  2539. used by shells, so for instance 'foo*' matches all functions that
  2540. include an 'fo' followed by zero or more 'o's. There is an
  2541. implicit '.*' leading and trailing the regular expression you
  2542. supply, so to match only functions that begin with 'foo', use
  2543. '^foo'.
  2544. When debugging C++ programs, 'rbreak' is useful for setting
  2545. breakpoints on overloaded functions that are not members of any
  2546. special classes.
  2547. The 'rbreak' command can be used to set breakpoints in *all* the
  2548. functions in a program, like this:
  2549. (gdb) rbreak .
  2550. 'rbreak FILE:REGEX'
  2551. If 'rbreak' is called with a filename qualification, it limits the
  2552. search for functions matching the given regular expression to the
  2553. specified FILE. This can be used, for example, to set breakpoints
  2554. on every function in a given file:
  2555. (gdb) rbreak file.c:.
  2556. The colon separating the filename qualifier from the regex may
  2557. optionally be surrounded by spaces.
  2558. 'info breakpoints [LIST...]'
  2559. 'info break [LIST...]'
  2560. Print a table of all breakpoints, watchpoints, and catchpoints set
  2561. and not deleted. Optional argument N means print information only
  2562. about the specified breakpoint(s) (or watchpoint(s) or
  2563. catchpoint(s)). For each breakpoint, following columns are
  2564. printed:
  2565. _Breakpoint Numbers_
  2566. _Type_
  2567. Breakpoint, watchpoint, or catchpoint.
  2568. _Disposition_
  2569. Whether the breakpoint is marked to be disabled or deleted
  2570. when hit.
  2571. _Enabled or Disabled_
  2572. Enabled breakpoints are marked with 'y'. 'n' marks
  2573. breakpoints that are not enabled.
  2574. _Address_
  2575. Where the breakpoint is in your program, as a memory address.
  2576. For a pending breakpoint whose address is not yet known, this
  2577. field will contain '<PENDING>'. Such breakpoint won't fire
  2578. until a shared library that has the symbol or line referred by
  2579. breakpoint is loaded. See below for details. A breakpoint
  2580. with several locations will have '<MULTIPLE>' in this
  2581. field--see below for details.
  2582. _What_
  2583. Where the breakpoint is in the source for your program, as a
  2584. file and line number. For a pending breakpoint, the original
  2585. string passed to the breakpoint command will be listed as it
  2586. cannot be resolved until the appropriate shared library is
  2587. loaded in the future.
  2588. If a breakpoint is conditional, there are two evaluation modes:
  2589. "host" and "target". If mode is "host", breakpoint condition
  2590. evaluation is done by GDB on the host's side. If it is "target",
  2591. then the condition is evaluated by the target. The 'info break'
  2592. command shows the condition on the line following the affected
  2593. breakpoint, together with its condition evaluation mode in between
  2594. parentheses.
  2595. Breakpoint commands, if any, are listed after that. A pending
  2596. breakpoint is allowed to have a condition specified for it. The
  2597. condition is not parsed for validity until a shared library is
  2598. loaded that allows the pending breakpoint to resolve to a valid
  2599. location.
  2600. 'info break' with a breakpoint number N as argument lists only that
  2601. breakpoint. The convenience variable '$_' and the default
  2602. examining-address for the 'x' command are set to the address of the
  2603. last breakpoint listed (*note Examining Memory: Memory.).
  2604. 'info break' displays a count of the number of times the breakpoint
  2605. has been hit. This is especially useful in conjunction with the
  2606. 'ignore' command. You can ignore a large number of breakpoint
  2607. hits, look at the breakpoint info to see how many times the
  2608. breakpoint was hit, and then run again, ignoring one less than that
  2609. number. This will get you quickly to the last hit of that
  2610. breakpoint.
  2611. For a breakpoints with an enable count (xref) greater than 1, 'info
  2612. break' also displays that count.
  2613. GDB allows you to set any number of breakpoints at the same place in
  2614. your program. There is nothing silly or meaningless about this. When
  2615. the breakpoints are conditional, this is even useful (*note Break
  2616. Conditions: Conditions.).
  2617. It is possible that a breakpoint corresponds to several locations in
  2618. your program. Examples of this situation are:
  2619. * Multiple functions in the program may have the same name.
  2620. * For a C++ constructor, the GCC compiler generates several instances
  2621. of the function body, used in different cases.
  2622. * For a C++ template function, a given line in the function can
  2623. correspond to any number of instantiations.
  2624. * For an inlined function, a given source line can correspond to
  2625. several places where that function is inlined.
  2626. In all those cases, GDB will insert a breakpoint at all the relevant
  2627. locations.
  2628. A breakpoint with multiple locations is displayed in the breakpoint
  2629. table using several rows--one header row, followed by one row for each
  2630. breakpoint location. The header row has '<MULTIPLE>' in the address
  2631. column. The rows for individual locations contain the actual addresses
  2632. for locations, and show the functions to which those locations belong.
  2633. The number column for a location is of the form
  2634. BREAKPOINT-NUMBER.LOCATION-NUMBER.
  2635. For example:
  2636. Num Type Disp Enb Address What
  2637. 1 breakpoint keep y <MULTIPLE>
  2638. stop only if i==1
  2639. breakpoint already hit 1 time
  2640. 1.1 y 0x080486a2 in void foo<int>() at t.cc:8
  2641. 1.2 y 0x080486ca in void foo<double>() at t.cc:8
  2642. You cannot delete the individual locations from a breakpoint.
  2643. However, each location can be individually enabled or disabled by
  2644. passing BREAKPOINT-NUMBER.LOCATION-NUMBER as argument to the 'enable'
  2645. and 'disable' commands. It's also possible to 'enable' and 'disable' a
  2646. range of LOCATION-NUMBER locations using a BREAKPOINT-NUMBER and two
  2647. LOCATION-NUMBERs, in increasing order, separated by a hyphen, like
  2648. 'BREAKPOINT-NUMBER.LOCATION-NUMBER1-LOCATION-NUMBER2', in which case GDB
  2649. acts on all the locations in the range (inclusive). Disabling or
  2650. enabling the parent breakpoint (*note Disabling::) affects all of the
  2651. locations that belong to that breakpoint.
  2652. It's quite common to have a breakpoint inside a shared library.
  2653. Shared libraries can be loaded and unloaded explicitly, and possibly
  2654. repeatedly, as the program is executed. To support this use case, GDB
  2655. updates breakpoint locations whenever any shared library is loaded or
  2656. unloaded. Typically, you would set a breakpoint in a shared library at
  2657. the beginning of your debugging session, when the library is not loaded,
  2658. and when the symbols from the library are not available. When you try
  2659. to set breakpoint, GDB will ask you if you want to set a so called
  2660. "pending breakpoint"--breakpoint whose address is not yet resolved.
  2661. After the program is run, whenever a new shared library is loaded,
  2662. GDB reevaluates all the breakpoints. When a newly loaded shared library
  2663. contains the symbol or line referred to by some pending breakpoint, that
  2664. breakpoint is resolved and becomes an ordinary breakpoint. When a
  2665. library is unloaded, all breakpoints that refer to its symbols or source
  2666. lines become pending again.
  2667. This logic works for breakpoints with multiple locations, too. For
  2668. example, if you have a breakpoint in a C++ template function, and a
  2669. newly loaded shared library has an instantiation of that template, a new
  2670. location is added to the list of locations for the breakpoint.
  2671. Except for having unresolved address, pending breakpoints do not
  2672. differ from regular breakpoints. You can set conditions or commands,
  2673. enable and disable them and perform other breakpoint operations.
  2674. GDB provides some additional commands for controlling what happens
  2675. when the 'break' command cannot resolve breakpoint address specification
  2676. to an address:
  2677. 'set breakpoint pending auto'
  2678. This is the default behavior. When GDB cannot find the breakpoint
  2679. location, it queries you whether a pending breakpoint should be
  2680. created.
  2681. 'set breakpoint pending on'
  2682. This indicates that an unrecognized breakpoint location should
  2683. automatically result in a pending breakpoint being created.
  2684. 'set breakpoint pending off'
  2685. This indicates that pending breakpoints are not to be created. Any
  2686. unrecognized breakpoint location results in an error. This setting
  2687. does not affect any pending breakpoints previously created.
  2688. 'show breakpoint pending'
  2689. Show the current behavior setting for creating pending breakpoints.
  2690. The settings above only affect the 'break' command and its variants.
  2691. Once breakpoint is set, it will be automatically updated as shared
  2692. libraries are loaded and unloaded.
  2693. For some targets, GDB can automatically decide if hardware or
  2694. software breakpoints should be used, depending on whether the breakpoint
  2695. address is read-only or read-write. This applies to breakpoints set
  2696. with the 'break' command as well as to internal breakpoints set by
  2697. commands like 'next' and 'finish'. For breakpoints set with 'hbreak',
  2698. GDB will always use hardware breakpoints.
  2699. You can control this automatic behaviour with the following commands:
  2700. 'set breakpoint auto-hw on'
  2701. This is the default behavior. When GDB sets a breakpoint, it will
  2702. try to use the target memory map to decide if software or hardware
  2703. breakpoint must be used.
  2704. 'set breakpoint auto-hw off'
  2705. This indicates GDB should not automatically select breakpoint type.
  2706. If the target provides a memory map, GDB will warn when trying to
  2707. set software breakpoint at a read-only address.
  2708. GDB normally implements breakpoints by replacing the program code at
  2709. the breakpoint address with a special instruction, which, when executed,
  2710. given control to the debugger. By default, the program code is so
  2711. modified only when the program is resumed. As soon as the program
  2712. stops, GDB restores the original instructions. This behaviour guards
  2713. against leaving breakpoints inserted in the target should gdb abrubptly
  2714. disconnect. However, with slow remote targets, inserting and removing
  2715. breakpoint can reduce the performance. This behavior can be controlled
  2716. with the following commands::
  2717. 'set breakpoint always-inserted off'
  2718. All breakpoints, including newly added by the user, are inserted in
  2719. the target only when the target is resumed. All breakpoints are
  2720. removed from the target when it stops. This is the default mode.
  2721. 'set breakpoint always-inserted on'
  2722. Causes all breakpoints to be inserted in the target at all times.
  2723. If the user adds a new breakpoint, or changes an existing
  2724. breakpoint, the breakpoints in the target are updated immediately.
  2725. A breakpoint is removed from the target only when breakpoint itself
  2726. is deleted.
  2727. GDB handles conditional breakpoints by evaluating these conditions
  2728. when a breakpoint breaks. If the condition is true, then the process
  2729. being debugged stops, otherwise the process is resumed.
  2730. If the target supports evaluating conditions on its end, GDB may
  2731. download the breakpoint, together with its conditions, to it.
  2732. This feature can be controlled via the following commands:
  2733. 'set breakpoint condition-evaluation host'
  2734. This option commands GDB to evaluate the breakpoint conditions on
  2735. the host's side. Unconditional breakpoints are sent to the target
  2736. which in turn receives the triggers and reports them back to GDB
  2737. for condition evaluation. This is the standard evaluation mode.
  2738. 'set breakpoint condition-evaluation target'
  2739. This option commands GDB to download breakpoint conditions to the
  2740. target at the moment of their insertion. The target is responsible
  2741. for evaluating the conditional expression and reporting breakpoint
  2742. stop events back to GDB whenever the condition is true. Due to
  2743. limitations of target-side evaluation, some conditions cannot be
  2744. evaluated there, e.g., conditions that depend on local data that is
  2745. only known to the host. Examples include conditional expressions
  2746. involving convenience variables, complex types that cannot be
  2747. handled by the agent expression parser and expressions that are too
  2748. long to be sent over to the target, specially when the target is a
  2749. remote system. In these cases, the conditions will be evaluated by
  2750. GDB.
  2751. 'set breakpoint condition-evaluation auto'
  2752. This is the default mode. If the target supports evaluating
  2753. breakpoint conditions on its end, GDB will download breakpoint
  2754. conditions to the target (limitations mentioned previously apply).
  2755. If the target does not support breakpoint condition evaluation,
  2756. then GDB will fallback to evaluating all these conditions on the
  2757. host's side.
  2758. GDB itself sometimes sets breakpoints in your program for special
  2759. purposes, such as proper handling of 'longjmp' (in C programs). These
  2760. internal breakpoints are assigned negative numbers, starting with '-1';
  2761. 'info breakpoints' does not display them. You can see these breakpoints
  2762. with the GDB maintenance command 'maint info breakpoints' (*note maint
  2763. info breakpoints::).
  2764. 
  2765. File: gdb.info, Node: Set Watchpoints, Next: Set Catchpoints, Prev: Set Breaks, Up: Breakpoints
  2766. 5.1.2 Setting Watchpoints
  2767. -------------------------
  2768. You can use a watchpoint to stop execution whenever the value of an
  2769. expression changes, without having to predict a particular place where
  2770. this may happen. (This is sometimes called a "data breakpoint".) The
  2771. expression may be as simple as the value of a single variable, or as
  2772. complex as many variables combined by operators. Examples include:
  2773. * A reference to the value of a single variable.
  2774. * An address cast to an appropriate data type. For example, '*(int
  2775. *)0x12345678' will watch a 4-byte region at the specified address
  2776. (assuming an 'int' occupies 4 bytes).
  2777. * An arbitrarily complex expression, such as 'a*b + c/d'. The
  2778. expression can use any operators valid in the program's native
  2779. language (*note Languages::).
  2780. You can set a watchpoint on an expression even if the expression can
  2781. not be evaluated yet. For instance, you can set a watchpoint on
  2782. '*global_ptr' before 'global_ptr' is initialized. GDB will stop when
  2783. your program sets 'global_ptr' and the expression produces a valid
  2784. value. If the expression becomes valid in some other way than changing
  2785. a variable (e.g. if the memory pointed to by '*global_ptr' becomes
  2786. readable as the result of a 'malloc' call), GDB may not stop until the
  2787. next time the expression changes.
  2788. Depending on your system, watchpoints may be implemented in software
  2789. or hardware. GDB does software watchpointing by single-stepping your
  2790. program and testing the variable's value each time, which is hundreds of
  2791. times slower than normal execution. (But this may still be worth it, to
  2792. catch errors where you have no clue what part of your program is the
  2793. culprit.)
  2794. On some systems, such as most PowerPC or x86-based targets, GDB
  2795. includes support for hardware watchpoints, which do not slow down the
  2796. running of your program.
  2797. 'watch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  2798. Set a watchpoint for an expression. GDB will break when the
  2799. expression EXPR is written into by the program and its value
  2800. changes. The simplest (and the most popular) use of this command
  2801. is to watch the value of a single variable:
  2802. (gdb) watch foo
  2803. If the command includes a '[thread THREAD-ID]' argument, GDB breaks
  2804. only when the thread identified by THREAD-ID changes the value of
  2805. EXPR. If any other threads change the value of EXPR, GDB will not
  2806. break. Note that watchpoints restricted to a single thread in this
  2807. way only work with Hardware Watchpoints.
  2808. Ordinarily a watchpoint respects the scope of variables in EXPR
  2809. (see below). The '-location' argument tells GDB to instead watch
  2810. the memory referred to by EXPR. In this case, GDB will evaluate
  2811. EXPR, take the address of the result, and watch the memory at that
  2812. address. The type of the result is used to determine the size of
  2813. the watched memory. If the expression's result does not have an
  2814. address, then GDB will print an error.
  2815. The '[mask MASKVALUE]' argument allows creation of masked
  2816. watchpoints, if the current architecture supports this feature
  2817. (e.g., PowerPC Embedded architecture, see *note PowerPC
  2818. Embedded::.) A "masked watchpoint" specifies a mask in addition to
  2819. an address to watch. The mask specifies that some bits of an
  2820. address (the bits which are reset in the mask) should be ignored
  2821. when matching the address accessed by the inferior against the
  2822. watchpoint address. Thus, a masked watchpoint watches many
  2823. addresses simultaneously--those addresses whose unmasked bits are
  2824. identical to the unmasked bits in the watchpoint address. The
  2825. 'mask' argument implies '-location'. Examples:
  2826. (gdb) watch foo mask 0xffff00ff
  2827. (gdb) watch *0xdeadbeef mask 0xffffff00
  2828. 'rwatch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  2829. Set a watchpoint that will break when the value of EXPR is read by
  2830. the program.
  2831. 'awatch [-l|-location] EXPR [thread THREAD-ID] [mask MASKVALUE]'
  2832. Set a watchpoint that will break when EXPR is either read from or
  2833. written into by the program.
  2834. 'info watchpoints [LIST...]'
  2835. This command prints a list of watchpoints, using the same format as
  2836. 'info break' (*note Set Breaks::).
  2837. If you watch for a change in a numerically entered address you need
  2838. to dereference it, as the address itself is just a constant number which
  2839. will never change. GDB refuses to create a watchpoint that watches a
  2840. never-changing value:
  2841. (gdb) watch 0x600850
  2842. Cannot watch constant value 0x600850.
  2843. (gdb) watch *(int *) 0x600850
  2844. Watchpoint 1: *(int *) 6293584
  2845. GDB sets a "hardware watchpoint" if possible. Hardware watchpoints
  2846. execute very quickly, and the debugger reports a change in value at the
  2847. exact instruction where the change occurs. If GDB cannot set a hardware
  2848. watchpoint, it sets a software watchpoint, which executes more slowly
  2849. and reports the change in value at the next _statement_, not the
  2850. instruction, after the change occurs.
  2851. You can force GDB to use only software watchpoints with the 'set
  2852. can-use-hw-watchpoints 0' command. With this variable set to zero, GDB
  2853. will never try to use hardware watchpoints, even if the underlying
  2854. system supports them. (Note that hardware-assisted watchpoints that
  2855. were set _before_ setting 'can-use-hw-watchpoints' to zero will still
  2856. use the hardware mechanism of watching expression values.)
  2857. 'set can-use-hw-watchpoints'
  2858. Set whether or not to use hardware watchpoints.
  2859. 'show can-use-hw-watchpoints'
  2860. Show the current mode of using hardware watchpoints.
  2861. For remote targets, you can restrict the number of hardware
  2862. watchpoints GDB will use, see *note set remote
  2863. hardware-breakpoint-limit::.
  2864. When you issue the 'watch' command, GDB reports
  2865. Hardware watchpoint NUM: EXPR
  2866. if it was able to set a hardware watchpoint.
  2867. Currently, the 'awatch' and 'rwatch' commands can only set hardware
  2868. watchpoints, because accesses to data that don't change the value of the
  2869. watched expression cannot be detected without examining every
  2870. instruction as it is being executed, and GDB does not do that currently.
  2871. If GDB finds that it is unable to set a hardware breakpoint with the
  2872. 'awatch' or 'rwatch' command, it will print a message like this:
  2873. Expression cannot be implemented with read/access watchpoint.
  2874. Sometimes, GDB cannot set a hardware watchpoint because the data type
  2875. of the watched expression is wider than what a hardware watchpoint on
  2876. the target machine can handle. For example, some systems can only watch
  2877. regions that are up to 4 bytes wide; on such systems you cannot set
  2878. hardware watchpoints for an expression that yields a double-precision
  2879. floating-point number (which is typically 8 bytes wide). As a
  2880. work-around, it might be possible to break the large region into a
  2881. series of smaller ones and watch them with separate watchpoints.
  2882. If you set too many hardware watchpoints, GDB might be unable to
  2883. insert all of them when you resume the execution of your program. Since
  2884. the precise number of active watchpoints is unknown until such time as
  2885. the program is about to be resumed, GDB might not be able to warn you
  2886. about this when you set the watchpoints, and the warning will be printed
  2887. only when the program is resumed:
  2888. Hardware watchpoint NUM: Could not insert watchpoint
  2889. If this happens, delete or disable some of the watchpoints.
  2890. Watching complex expressions that reference many variables can also
  2891. exhaust the resources available for hardware-assisted watchpoints.
  2892. That's because GDB needs to watch every variable in the expression with
  2893. separately allocated resources.
  2894. If you call a function interactively using 'print' or 'call', any
  2895. watchpoints you have set will be inactive until GDB reaches another kind
  2896. of breakpoint or the call completes.
  2897. GDB automatically deletes watchpoints that watch local (automatic)
  2898. variables, or expressions that involve such variables, when they go out
  2899. of scope, that is, when the execution leaves the block in which these
  2900. variables were defined. In particular, when the program being debugged
  2901. terminates, _all_ local variables go out of scope, and so only
  2902. watchpoints that watch global variables remain set. If you rerun the
  2903. program, you will need to set all such watchpoints again. One way of
  2904. doing that would be to set a code breakpoint at the entry to the 'main'
  2905. function and when it breaks, set all the watchpoints.
  2906. In multi-threaded programs, watchpoints will detect changes to the
  2907. watched expression from every thread.
  2908. _Warning:_ In multi-threaded programs, software watchpoints have
  2909. only limited usefulness. If GDB creates a software watchpoint, it
  2910. can only watch the value of an expression _in a single thread_. If
  2911. you are confident that the expression can only change due to the
  2912. current thread's activity (and if you are also confident that no
  2913. other thread can become current), then you can use software
  2914. watchpoints as usual. However, GDB may not notice when a
  2915. non-current thread's activity changes the expression. (Hardware
  2916. watchpoints, in contrast, watch an expression in all threads.)
  2917. *Note set remote hardware-watchpoint-limit::.
  2918. 
  2919. File: gdb.info, Node: Set Catchpoints, Next: Delete Breaks, Prev: Set Watchpoints, Up: Breakpoints
  2920. 5.1.3 Setting Catchpoints
  2921. -------------------------
  2922. You can use "catchpoints" to cause the debugger to stop for certain
  2923. kinds of program events, such as C++ exceptions or the loading of a
  2924. shared library. Use the 'catch' command to set a catchpoint.
  2925. 'catch EVENT'
  2926. Stop when EVENT occurs. The EVENT can be any of the following:
  2927. 'throw [REGEXP]'
  2928. 'rethrow [REGEXP]'
  2929. 'catch [REGEXP]'
  2930. The throwing, re-throwing, or catching of a C++ exception.
  2931. If REGEXP is given, then only exceptions whose type matches
  2932. the regular expression will be caught.
  2933. The convenience variable '$_exception' is available at an
  2934. exception-related catchpoint, on some systems. This holds the
  2935. exception being thrown.
  2936. There are currently some limitations to C++ exception handling
  2937. in GDB:
  2938. * The support for these commands is system-dependent.
  2939. Currently, only systems using the 'gnu-v3' C++ ABI (*note
  2940. ABI::) are supported.
  2941. * The regular expression feature and the '$_exception'
  2942. convenience variable rely on the presence of some SDT
  2943. probes in 'libstdc++'. If these probes are not present,
  2944. then these features cannot be used. These probes were
  2945. first available in the GCC 4.8 release, but whether or
  2946. not they are available in your GCC also depends on how it
  2947. was built.
  2948. * The '$_exception' convenience variable is only valid at
  2949. the instruction at which an exception-related catchpoint
  2950. is set.
  2951. * When an exception-related catchpoint is hit, GDB stops at
  2952. a location in the system library which implements runtime
  2953. exception support for C++, usually 'libstdc++'. You can
  2954. use 'up' (*note Selection::) to get to your code.
  2955. * If you call a function interactively, GDB normally
  2956. returns control to you when the function has finished
  2957. executing. If the call raises an exception, however, the
  2958. call may bypass the mechanism that returns control to you
  2959. and cause your program either to abort or to simply
  2960. continue running until it hits a breakpoint, catches a
  2961. signal that GDB is listening for, or exits. This is the
  2962. case even if you set a catchpoint for the exception;
  2963. catchpoints on exceptions are disabled within interactive
  2964. calls. *Note Calling::, for information on controlling
  2965. this with 'set unwind-on-terminating-exception'.
  2966. * You cannot raise an exception interactively.
  2967. * You cannot install an exception handler interactively.
  2968. 'exception'
  2969. An Ada exception being raised. If an exception name is
  2970. specified at the end of the command (eg 'catch exception
  2971. Program_Error'), the debugger will stop only when this
  2972. specific exception is raised. Otherwise, the debugger stops
  2973. execution when any Ada exception is raised.
  2974. When inserting an exception catchpoint on a user-defined
  2975. exception whose name is identical to one of the exceptions
  2976. defined by the language, the fully qualified name must be used
  2977. as the exception name. Otherwise, GDB will assume that it
  2978. should stop on the pre-defined exception rather than the
  2979. user-defined one. For instance, assuming an exception called
  2980. 'Constraint_Error' is defined in package 'Pck', then the
  2981. command to use to catch such exceptions is 'catch exception
  2982. Pck.Constraint_Error'.
  2983. 'handlers'
  2984. An Ada exception being handled. If an exception name is
  2985. specified at the end of the command (eg 'catch handlers
  2986. Program_Error'), the debugger will stop only when this
  2987. specific exception is handled. Otherwise, the debugger stops
  2988. execution when any Ada exception is handled.
  2989. When inserting a handlers catchpoint on a user-defined
  2990. exception whose name is identical to one of the exceptions
  2991. defined by the language, the fully qualified name must be used
  2992. as the exception name. Otherwise, GDB will assume that it
  2993. should stop on the pre-defined exception rather than the
  2994. user-defined one. For instance, assuming an exception called
  2995. 'Constraint_Error' is defined in package 'Pck', then the
  2996. command to use to catch such exceptions handling is 'catch
  2997. handlers Pck.Constraint_Error'.
  2998. 'exception unhandled'
  2999. An exception that was raised but is not handled by the
  3000. program.
  3001. 'assert'
  3002. A failed Ada assertion.
  3003. 'exec'
  3004. A call to 'exec'.
  3005. 'syscall'
  3006. 'syscall [NAME | NUMBER | group:GROUPNAME | g:GROUPNAME] ...'
  3007. A call to or return from a system call, a.k.a. "syscall". A
  3008. syscall is a mechanism for application programs to request a
  3009. service from the operating system (OS) or one of the OS system
  3010. services. GDB can catch some or all of the syscalls issued by
  3011. the debuggee, and show the related information for each
  3012. syscall. If no argument is specified, calls to and returns
  3013. from all system calls will be caught.
  3014. NAME can be any system call name that is valid for the
  3015. underlying OS. Just what syscalls are valid depends on the OS.
  3016. On GNU and Unix systems, you can find the full list of valid
  3017. syscall names on '/usr/include/asm/unistd.h'.
  3018. Normally, GDB knows in advance which syscalls are valid for
  3019. each OS, so you can use the GDB command-line completion
  3020. facilities (*note command completion: Completion.) to list the
  3021. available choices.
  3022. You may also specify the system call numerically. A syscall's
  3023. number is the value passed to the OS's syscall dispatcher to
  3024. identify the requested service. When you specify the syscall
  3025. by its name, GDB uses its database of syscalls to convert the
  3026. name into the corresponding numeric code, but using the number
  3027. directly may be useful if GDB's database does not have the
  3028. complete list of syscalls on your system (e.g., because GDB
  3029. lags behind the OS upgrades).
  3030. You may specify a group of related syscalls to be caught at
  3031. once using the 'group:' syntax ('g:' is a shorter equivalent).
  3032. For instance, on some platforms GDB allows you to catch all
  3033. network related syscalls, by passing the argument
  3034. 'group:network' to 'catch syscall'. Note that not all syscall
  3035. groups are available in every system. You can use the command
  3036. completion facilities (*note command completion: Completion.)
  3037. to list the syscall groups available on your environment.
  3038. The example below illustrates how this command works if you
  3039. don't provide arguments to it:
  3040. (gdb) catch syscall
  3041. Catchpoint 1 (syscall)
  3042. (gdb) r
  3043. Starting program: /tmp/catch-syscall
  3044. Catchpoint 1 (call to syscall 'close'), \
  3045. 0xffffe424 in __kernel_vsyscall ()
  3046. (gdb) c
  3047. Continuing.
  3048. Catchpoint 1 (returned from syscall 'close'), \
  3049. 0xffffe424 in __kernel_vsyscall ()
  3050. (gdb)
  3051. Here is an example of catching a system call by name:
  3052. (gdb) catch syscall chroot
  3053. Catchpoint 1 (syscall 'chroot' [61])
  3054. (gdb) r
  3055. Starting program: /tmp/catch-syscall
  3056. Catchpoint 1 (call to syscall 'chroot'), \
  3057. 0xffffe424 in __kernel_vsyscall ()
  3058. (gdb) c
  3059. Continuing.
  3060. Catchpoint 1 (returned from syscall 'chroot'), \
  3061. 0xffffe424 in __kernel_vsyscall ()
  3062. (gdb)
  3063. An example of specifying a system call numerically. In the
  3064. case below, the syscall number has a corresponding entry in
  3065. the XML file, so GDB finds its name and prints it:
  3066. (gdb) catch syscall 252
  3067. Catchpoint 1 (syscall(s) 'exit_group')
  3068. (gdb) r
  3069. Starting program: /tmp/catch-syscall
  3070. Catchpoint 1 (call to syscall 'exit_group'), \
  3071. 0xffffe424 in __kernel_vsyscall ()
  3072. (gdb) c
  3073. Continuing.
  3074. Program exited normally.
  3075. (gdb)
  3076. Here is an example of catching a syscall group:
  3077. (gdb) catch syscall group:process
  3078. Catchpoint 1 (syscalls 'exit' [1] 'fork' [2] 'waitpid' [7]
  3079. 'execve' [11] 'wait4' [114] 'clone' [120] 'vfork' [190]
  3080. 'exit_group' [252] 'waitid' [284] 'unshare' [310])
  3081. (gdb) r
  3082. Starting program: /tmp/catch-syscall
  3083. Catchpoint 1 (call to syscall fork), 0x00007ffff7df4e27 in open64 ()
  3084. from /lib64/ld-linux-x86-64.so.2
  3085. (gdb) c
  3086. Continuing.
  3087. However, there can be situations when there is no
  3088. corresponding name in XML file for that syscall number. In
  3089. this case, GDB prints a warning message saying that it was not
  3090. able to find the syscall name, but the catchpoint will be set
  3091. anyway. See the example below:
  3092. (gdb) catch syscall 764
  3093. warning: The number '764' does not represent a known syscall.
  3094. Catchpoint 2 (syscall 764)
  3095. (gdb)
  3096. If you configure GDB using the '--without-expat' option, it
  3097. will not be able to display syscall names. Also, if your
  3098. architecture does not have an XML file describing its system
  3099. calls, you will not be able to see the syscall names. It is
  3100. important to notice that these two features are used for
  3101. accessing the syscall name database. In either case, you will
  3102. see a warning like this:
  3103. (gdb) catch syscall
  3104. warning: Could not open "syscalls/i386-linux.xml"
  3105. warning: Could not load the syscall XML file 'syscalls/i386-linux.xml'.
  3106. GDB will not be able to display syscall names.
  3107. Catchpoint 1 (syscall)
  3108. (gdb)
  3109. Of course, the file name will change depending on your
  3110. architecture and system.
  3111. Still using the example above, you can also try to catch a
  3112. syscall by its number. In this case, you would see something
  3113. like:
  3114. (gdb) catch syscall 252
  3115. Catchpoint 1 (syscall(s) 252)
  3116. Again, in this case GDB would not be able to display syscall's
  3117. names.
  3118. 'fork'
  3119. A call to 'fork'.
  3120. 'vfork'
  3121. A call to 'vfork'.
  3122. 'load [regexp]'
  3123. 'unload [regexp]'
  3124. The loading or unloading of a shared library. If REGEXP is
  3125. given, then the catchpoint will stop only if the regular
  3126. expression matches one of the affected libraries.
  3127. 'signal [SIGNAL... | 'all']'
  3128. The delivery of a signal.
  3129. With no arguments, this catchpoint will catch any signal that
  3130. is not used internally by GDB, specifically, all signals
  3131. except 'SIGTRAP' and 'SIGINT'.
  3132. With the argument 'all', all signals, including those used by
  3133. GDB, will be caught. This argument cannot be used with other
  3134. signal names.
  3135. Otherwise, the arguments are a list of signal names as given
  3136. to 'handle' (*note Signals::). Only signals specified in this
  3137. list will be caught.
  3138. One reason that 'catch signal' can be more useful than
  3139. 'handle' is that you can attach commands and conditions to the
  3140. catchpoint.
  3141. When a signal is caught by a catchpoint, the signal's 'stop'
  3142. and 'print' settings, as specified by 'handle', are ignored.
  3143. However, whether the signal is still delivered to the inferior
  3144. depends on the 'pass' setting; this can be changed in the
  3145. catchpoint's commands.
  3146. 'tcatch EVENT'
  3147. Set a catchpoint that is enabled only for one stop. The catchpoint
  3148. is automatically deleted after the first time the event is caught.
  3149. Use the 'info break' command to list the current catchpoints.
  3150. 
  3151. File: gdb.info, Node: Delete Breaks, Next: Disabling, Prev: Set Catchpoints, Up: Breakpoints
  3152. 5.1.4 Deleting Breakpoints
  3153. --------------------------
  3154. It is often necessary to eliminate a breakpoint, watchpoint, or
  3155. catchpoint once it has done its job and you no longer want your program
  3156. to stop there. This is called "deleting" the breakpoint. A breakpoint
  3157. that has been deleted no longer exists; it is forgotten.
  3158. With the 'clear' command you can delete breakpoints according to
  3159. where they are in your program. With the 'delete' command you can
  3160. delete individual breakpoints, watchpoints, or catchpoints by specifying
  3161. their breakpoint numbers.
  3162. It is not necessary to delete a breakpoint to proceed past it. GDB
  3163. automatically ignores breakpoints on the first instruction to be
  3164. executed when you continue execution without changing the execution
  3165. address.
  3166. 'clear'
  3167. Delete any breakpoints at the next instruction to be executed in
  3168. the selected stack frame (*note Selecting a Frame: Selection.).
  3169. When the innermost frame is selected, this is a good way to delete
  3170. a breakpoint where your program just stopped.
  3171. 'clear LOCATION'
  3172. Delete any breakpoints set at the specified LOCATION. *Note
  3173. Specify Location::, for the various forms of LOCATION; the most
  3174. useful ones are listed below:
  3175. 'clear FUNCTION'
  3176. 'clear FILENAME:FUNCTION'
  3177. Delete any breakpoints set at entry to the named FUNCTION.
  3178. 'clear LINENUM'
  3179. 'clear FILENAME:LINENUM'
  3180. Delete any breakpoints set at or within the code of the
  3181. specified LINENUM of the specified FILENAME.
  3182. 'delete [breakpoints] [LIST...]'
  3183. Delete the breakpoints, watchpoints, or catchpoints of the
  3184. breakpoint list specified as argument. If no argument is
  3185. specified, delete all breakpoints (GDB asks confirmation, unless
  3186. you have 'set confirm off'). You can abbreviate this command as
  3187. 'd'.
  3188. 
  3189. File: gdb.info, Node: Disabling, Next: Conditions, Prev: Delete Breaks, Up: Breakpoints
  3190. 5.1.5 Disabling Breakpoints
  3191. ---------------------------
  3192. Rather than deleting a breakpoint, watchpoint, or catchpoint, you might
  3193. prefer to "disable" it. This makes the breakpoint inoperative as if it
  3194. had been deleted, but remembers the information on the breakpoint so
  3195. that you can "enable" it again later.
  3196. You disable and enable breakpoints, watchpoints, and catchpoints with
  3197. the 'enable' and 'disable' commands, optionally specifying one or more
  3198. breakpoint numbers as arguments. Use 'info break' to print a list of
  3199. all breakpoints, watchpoints, and catchpoints if you do not know which
  3200. numbers to use.
  3201. Disabling and enabling a breakpoint that has multiple locations
  3202. affects all of its locations.
  3203. A breakpoint, watchpoint, or catchpoint can have any of several
  3204. different states of enablement:
  3205. * Enabled. The breakpoint stops your program. A breakpoint set with
  3206. the 'break' command starts out in this state.
  3207. * Disabled. The breakpoint has no effect on your program.
  3208. * Enabled once. The breakpoint stops your program, but then becomes
  3209. disabled.
  3210. * Enabled for a count. The breakpoint stops your program for the
  3211. next N times, then becomes disabled.
  3212. * Enabled for deletion. The breakpoint stops your program, but
  3213. immediately after it does so it is deleted permanently. A
  3214. breakpoint set with the 'tbreak' command starts out in this state.
  3215. You can use the following commands to enable or disable breakpoints,
  3216. watchpoints, and catchpoints:
  3217. 'disable [breakpoints] [LIST...]'
  3218. Disable the specified breakpoints--or all breakpoints, if none are
  3219. listed. A disabled breakpoint has no effect but is not forgotten.
  3220. All options such as ignore-counts, conditions and commands are
  3221. remembered in case the breakpoint is enabled again later. You may
  3222. abbreviate 'disable' as 'dis'.
  3223. 'enable [breakpoints] [LIST...]'
  3224. Enable the specified breakpoints (or all defined breakpoints).
  3225. They become effective once again in stopping your program.
  3226. 'enable [breakpoints] once LIST...'
  3227. Enable the specified breakpoints temporarily. GDB disables any of
  3228. these breakpoints immediately after stopping your program.
  3229. 'enable [breakpoints] count COUNT LIST...'
  3230. Enable the specified breakpoints temporarily. GDB records COUNT
  3231. with each of the specified breakpoints, and decrements a
  3232. breakpoint's count when it is hit. When any count reaches 0, GDB
  3233. disables that breakpoint. If a breakpoint has an ignore count
  3234. (*note Break Conditions: Conditions.), that will be decremented to
  3235. 0 before COUNT is affected.
  3236. 'enable [breakpoints] delete LIST...'
  3237. Enable the specified breakpoints to work once, then die. GDB
  3238. deletes any of these breakpoints as soon as your program stops
  3239. there. Breakpoints set by the 'tbreak' command start out in this
  3240. state.
  3241. Except for a breakpoint set with 'tbreak' (*note Setting Breakpoints:
  3242. Set Breaks.), breakpoints that you set are initially enabled;
  3243. subsequently, they become disabled or enabled only when you use one of
  3244. the commands above. (The command 'until' can set and delete a
  3245. breakpoint of its own, but it does not change the state of your other
  3246. breakpoints; see *note Continuing and Stepping: Continuing and
  3247. Stepping.)
  3248. 
  3249. File: gdb.info, Node: Conditions, Next: Break Commands, Prev: Disabling, Up: Breakpoints
  3250. 5.1.6 Break Conditions
  3251. ----------------------
  3252. The simplest sort of breakpoint breaks every time your program reaches a
  3253. specified place. You can also specify a "condition" for a breakpoint.
  3254. A condition is just a Boolean expression in your programming language
  3255. (*note Expressions: Expressions.). A breakpoint with a condition
  3256. evaluates the expression each time your program reaches it, and your
  3257. program stops only if the condition is _true_.
  3258. This is the converse of using assertions for program validation; in
  3259. that situation, you want to stop when the assertion is violated--that
  3260. is, when the condition is false. In C, if you want to test an assertion
  3261. expressed by the condition ASSERT, you should set the condition '!
  3262. ASSERT' on the appropriate breakpoint.
  3263. Conditions are also accepted for watchpoints; you may not need them,
  3264. since a watchpoint is inspecting the value of an expression anyhow--but
  3265. it might be simpler, say, to just set a watchpoint on a variable name,
  3266. and specify a condition that tests whether the new value is an
  3267. interesting one.
  3268. Break conditions can have side effects, and may even call functions
  3269. in your program. This can be useful, for example, to activate functions
  3270. that log program progress, or to use your own print functions to format
  3271. special data structures. The effects are completely predictable unless
  3272. there is another enabled breakpoint at the same address. (In that case,
  3273. GDB might see the other breakpoint first and stop your program without
  3274. checking the condition of this one.) Note that breakpoint commands are
  3275. usually more convenient and flexible than break conditions for the
  3276. purpose of performing side effects when a breakpoint is reached (*note
  3277. Breakpoint Command Lists: Break Commands.).
  3278. Breakpoint conditions can also be evaluated on the target's side if
  3279. the target supports it. Instead of evaluating the conditions locally,
  3280. GDB encodes the expression into an agent expression (*note Agent
  3281. Expressions::) suitable for execution on the target, independently of
  3282. GDB. Global variables become raw memory locations, locals become stack
  3283. accesses, and so forth.
  3284. In this case, GDB will only be notified of a breakpoint trigger when
  3285. its condition evaluates to true. This mechanism may provide faster
  3286. response times depending on the performance characteristics of the
  3287. target since it does not need to keep GDB informed about every
  3288. breakpoint trigger, even those with false conditions.
  3289. Break conditions can be specified when a breakpoint is set, by using
  3290. 'if' in the arguments to the 'break' command. *Note Setting
  3291. Breakpoints: Set Breaks. They can also be changed at any time with the
  3292. 'condition' command.
  3293. You can also use the 'if' keyword with the 'watch' command. The
  3294. 'catch' command does not recognize the 'if' keyword; 'condition' is the
  3295. only way to impose a further condition on a catchpoint.
  3296. 'condition BNUM EXPRESSION'
  3297. Specify EXPRESSION as the break condition for breakpoint,
  3298. watchpoint, or catchpoint number BNUM. After you set a condition,
  3299. breakpoint BNUM stops your program only if the value of EXPRESSION
  3300. is true (nonzero, in C). When you use 'condition', GDB checks
  3301. EXPRESSION immediately for syntactic correctness, and to determine
  3302. whether symbols in it have referents in the context of your
  3303. breakpoint. If EXPRESSION uses symbols not referenced in the
  3304. context of the breakpoint, GDB prints an error message:
  3305. No symbol "foo" in current context.
  3306. GDB does not actually evaluate EXPRESSION at the time the
  3307. 'condition' command (or a command that sets a breakpoint with a
  3308. condition, like 'break if ...') is given, however. *Note
  3309. Expressions: Expressions.
  3310. 'condition BNUM'
  3311. Remove the condition from breakpoint number BNUM. It becomes an
  3312. ordinary unconditional breakpoint.
  3313. A special case of a breakpoint condition is to stop only when the
  3314. breakpoint has been reached a certain number of times. This is so
  3315. useful that there is a special way to do it, using the "ignore count" of
  3316. the breakpoint. Every breakpoint has an ignore count, which is an
  3317. integer. Most of the time, the ignore count is zero, and therefore has
  3318. no effect. But if your program reaches a breakpoint whose ignore count
  3319. is positive, then instead of stopping, it just decrements the ignore
  3320. count by one and continues. As a result, if the ignore count value is
  3321. N, the breakpoint does not stop the next N times your program reaches
  3322. it.
  3323. 'ignore BNUM COUNT'
  3324. Set the ignore count of breakpoint number BNUM to COUNT. The next
  3325. COUNT times the breakpoint is reached, your program's execution
  3326. does not stop; other than to decrement the ignore count, GDB takes
  3327. no action.
  3328. To make the breakpoint stop the next time it is reached, specify a
  3329. count of zero.
  3330. When you use 'continue' to resume execution of your program from a
  3331. breakpoint, you can specify an ignore count directly as an argument
  3332. to 'continue', rather than using 'ignore'. *Note Continuing and
  3333. Stepping: Continuing and Stepping.
  3334. If a breakpoint has a positive ignore count and a condition, the
  3335. condition is not checked. Once the ignore count reaches zero, GDB
  3336. resumes checking the condition.
  3337. You could achieve the effect of the ignore count with a condition
  3338. such as '$foo-- <= 0' using a debugger convenience variable that is
  3339. decremented each time. *Note Convenience Variables: Convenience
  3340. Vars.
  3341. Ignore counts apply to breakpoints, watchpoints, and catchpoints.
  3342. 
  3343. File: gdb.info, Node: Break Commands, Next: Dynamic Printf, Prev: Conditions, Up: Breakpoints
  3344. 5.1.7 Breakpoint Command Lists
  3345. ------------------------------
  3346. You can give any breakpoint (or watchpoint or catchpoint) a series of
  3347. commands to execute when your program stops due to that breakpoint. For
  3348. example, you might want to print the values of certain expressions, or
  3349. enable other breakpoints.
  3350. 'commands [LIST...]'
  3351. '... COMMAND-LIST ...'
  3352. 'end'
  3353. Specify a list of commands for the given breakpoints. The commands
  3354. themselves appear on the following lines. Type a line containing
  3355. just 'end' to terminate the commands.
  3356. To remove all commands from a breakpoint, type 'commands' and
  3357. follow it immediately with 'end'; that is, give no commands.
  3358. With no argument, 'commands' refers to the last breakpoint,
  3359. watchpoint, or catchpoint set (not to the breakpoint most recently
  3360. encountered). If the most recent breakpoints were set with a
  3361. single command, then the 'commands' will apply to all the
  3362. breakpoints set by that command. This applies to breakpoints set
  3363. by 'rbreak', and also applies when a single 'break' command creates
  3364. multiple breakpoints (*note Ambiguous Expressions: Ambiguous
  3365. Expressions.).
  3366. Pressing <RET> as a means of repeating the last GDB command is
  3367. disabled within a COMMAND-LIST.
  3368. You can use breakpoint commands to start your program up again.
  3369. Simply use the 'continue' command, or 'step', or any other command that
  3370. resumes execution.
  3371. Any other commands in the command list, after a command that resumes
  3372. execution, are ignored. This is because any time you resume execution
  3373. (even with a simple 'next' or 'step'), you may encounter another
  3374. breakpoint--which could have its own command list, leading to
  3375. ambiguities about which list to execute.
  3376. If the first command you specify in a command list is 'silent', the
  3377. usual message about stopping at a breakpoint is not printed. This may
  3378. be desirable for breakpoints that are to print a specific message and
  3379. then continue. If none of the remaining commands print anything, you
  3380. see no sign that the breakpoint was reached. 'silent' is meaningful
  3381. only at the beginning of a breakpoint command list.
  3382. The commands 'echo', 'output', and 'printf' allow you to print
  3383. precisely controlled output, and are often useful in silent breakpoints.
  3384. *Note Commands for Controlled Output: Output.
  3385. For example, here is how you could use breakpoint commands to print
  3386. the value of 'x' at entry to 'foo' whenever 'x' is positive.
  3387. break foo if x>0
  3388. commands
  3389. silent
  3390. printf "x is %d\n",x
  3391. cont
  3392. end
  3393. One application for breakpoint commands is to compensate for one bug
  3394. so you can test for another. Put a breakpoint just after the erroneous
  3395. line of code, give it a condition to detect the case in which something
  3396. erroneous has been done, and give it commands to assign correct values
  3397. to any variables that need them. End with the 'continue' command so
  3398. that your program does not stop, and start with the 'silent' command so
  3399. that no output is produced. Here is an example:
  3400. break 403
  3401. commands
  3402. silent
  3403. set x = y + 4
  3404. cont
  3405. end
  3406. 
  3407. File: gdb.info, Node: Dynamic Printf, Next: Save Breakpoints, Prev: Break Commands, Up: Breakpoints
  3408. 5.1.8 Dynamic Printf
  3409. --------------------
  3410. The dynamic printf command 'dprintf' combines a breakpoint with
  3411. formatted printing of your program's data to give you the effect of
  3412. inserting 'printf' calls into your program on-the-fly, without having to
  3413. recompile it.
  3414. In its most basic form, the output goes to the GDB console. However,
  3415. you can set the variable 'dprintf-style' for alternate handling. For
  3416. instance, you can ask to format the output by calling your program's
  3417. 'printf' function. This has the advantage that the characters go to the
  3418. program's output device, so they can recorded in redirects to files and
  3419. so forth.
  3420. If you are doing remote debugging with a stub or agent, you can also
  3421. ask to have the printf handled by the remote agent. In addition to
  3422. ensuring that the output goes to the remote program's device along with
  3423. any other output the program might produce, you can also ask that the
  3424. dprintf remain active even after disconnecting from the remote target.
  3425. Using the stub/agent is also more efficient, as it can do everything
  3426. without needing to communicate with GDB.
  3427. 'dprintf LOCATION,TEMPLATE,EXPRESSION[,EXPRESSION...]'
  3428. Whenever execution reaches LOCATION, print the values of one or
  3429. more EXPRESSIONS under the control of the string TEMPLATE. To
  3430. print several values, separate them with commas.
  3431. 'set dprintf-style STYLE'
  3432. Set the dprintf output to be handled in one of several different
  3433. styles enumerated below. A change of style affects all existing
  3434. dynamic printfs immediately. (If you need individual control over
  3435. the print commands, simply define normal breakpoints with
  3436. explicitly-supplied command lists.)
  3437. 'gdb'
  3438. Handle the output using the GDB 'printf' command.
  3439. 'call'
  3440. Handle the output by calling a function in your program
  3441. (normally 'printf').
  3442. 'agent'
  3443. Have the remote debugging agent (such as 'gdbserver') handle
  3444. the output itself. This style is only available for agents
  3445. that support running commands on the target.
  3446. 'set dprintf-function FUNCTION'
  3447. Set the function to call if the dprintf style is 'call'. By
  3448. default its value is 'printf'. You may set it to any expression.
  3449. that GDB can evaluate to a function, as per the 'call' command.
  3450. 'set dprintf-channel CHANNEL'
  3451. Set a "channel" for dprintf. If set to a non-empty value, GDB will
  3452. evaluate it as an expression and pass the result as a first
  3453. argument to the 'dprintf-function', in the manner of 'fprintf' and
  3454. similar functions. Otherwise, the dprintf format string will be
  3455. the first argument, in the manner of 'printf'.
  3456. As an example, if you wanted 'dprintf' output to go to a logfile
  3457. that is a standard I/O stream assigned to the variable 'mylog', you
  3458. could do the following:
  3459. (gdb) set dprintf-style call
  3460. (gdb) set dprintf-function fprintf
  3461. (gdb) set dprintf-channel mylog
  3462. (gdb) dprintf 25,"at line 25, glob=%d\n",glob
  3463. Dprintf 1 at 0x123456: file main.c, line 25.
  3464. (gdb) info break
  3465. 1 dprintf keep y 0x00123456 in main at main.c:25
  3466. call (void) fprintf (mylog,"at line 25, glob=%d\n",glob)
  3467. continue
  3468. (gdb)
  3469. Note that the 'info break' displays the dynamic printf commands as
  3470. normal breakpoint commands; you can thus easily see the effect of
  3471. the variable settings.
  3472. 'set disconnected-dprintf on'
  3473. 'set disconnected-dprintf off'
  3474. Choose whether 'dprintf' commands should continue to run if GDB has
  3475. disconnected from the target. This only applies if the
  3476. 'dprintf-style' is 'agent'.
  3477. 'show disconnected-dprintf off'
  3478. Show the current choice for disconnected 'dprintf'.
  3479. GDB does not check the validity of function and channel, relying on
  3480. you to supply values that are meaningful for the contexts in which they
  3481. are being used. For instance, the function and channel may be the
  3482. values of local variables, but if that is the case, then all enabled
  3483. dynamic prints must be at locations within the scope of those locals.
  3484. If evaluation fails, GDB will report an error.
  3485. 
  3486. File: gdb.info, Node: Save Breakpoints, Next: Static Probe Points, Prev: Dynamic Printf, Up: Breakpoints
  3487. 5.1.9 How to save breakpoints to a file
  3488. ---------------------------------------
  3489. To save breakpoint definitions to a file use the 'save breakpoints'
  3490. command.
  3491. 'save breakpoints [FILENAME]'
  3492. This command saves all current breakpoint definitions together with
  3493. their commands and ignore counts, into a file 'FILENAME' suitable
  3494. for use in a later debugging session. This includes all types of
  3495. breakpoints (breakpoints, watchpoints, catchpoints, tracepoints).
  3496. To read the saved breakpoint definitions, use the 'source' command
  3497. (*note Command Files::). Note that watchpoints with expressions
  3498. involving local variables may fail to be recreated because it may
  3499. not be possible to access the context where the watchpoint is valid
  3500. anymore. Because the saved breakpoint definitions are simply a
  3501. sequence of GDB commands that recreate the breakpoints, you can
  3502. edit the file in your favorite editing program, and remove the
  3503. breakpoint definitions you're not interested in, or that can no
  3504. longer be recreated.
  3505. 
  3506. File: gdb.info, Node: Static Probe Points, Next: Error in Breakpoints, Prev: Save Breakpoints, Up: Breakpoints
  3507. 5.1.10 Static Probe Points
  3508. --------------------------
  3509. GDB supports "SDT" probes in the code. SDT stands for Statically
  3510. Defined Tracing, and the probes are designed to have a tiny runtime code
  3511. and data footprint, and no dynamic relocations.
  3512. Currently, the following types of probes are supported on
  3513. ELF-compatible systems:
  3514. * 'SystemTap' (<http://sourceware.org/systemtap/>) SDT probes(1).
  3515. 'SystemTap' probes are usable from assembly, C and C++
  3516. languages(2).
  3517. * 'DTrace' (<http://oss.oracle.com/projects/DTrace>) USDT probes.
  3518. 'DTrace' probes are usable from C and C++ languages.
  3519. Some 'SystemTap' probes have an associated semaphore variable; for
  3520. instance, this happens automatically if you defined your probe using a
  3521. DTrace-style '.d' file. If your probe has a semaphore, GDB will
  3522. automatically enable it when you specify a breakpoint using the
  3523. '-probe-stap' notation. But, if you put a breakpoint at a probe's
  3524. location by some other method (e.g., 'break file:line'), then GDB will
  3525. not automatically set the semaphore. 'DTrace' probes do not support
  3526. semaphores.
  3527. You can examine the available static static probes using 'info
  3528. probes', with optional arguments:
  3529. 'info probes [TYPE] [PROVIDER [NAME [OBJFILE]]]'
  3530. If given, TYPE is either 'stap' for listing 'SystemTap' probes or
  3531. 'dtrace' for listing 'DTrace' probes. If omitted all probes are
  3532. listed regardless of their types.
  3533. If given, PROVIDER is a regular expression used to match against
  3534. provider names when selecting which probes to list. If omitted,
  3535. probes by all probes from all providers are listed.
  3536. If given, NAME is a regular expression to match against probe names
  3537. when selecting which probes to list. If omitted, probe names are
  3538. not considered when deciding whether to display them.
  3539. If given, OBJFILE is a regular expression used to select which
  3540. object files (executable or shared libraries) to examine. If not
  3541. given, all object files are considered.
  3542. 'info probes all'
  3543. List the available static probes, from all types.
  3544. Some probe points can be enabled and/or disabled. The effect of
  3545. enabling or disabling a probe depends on the type of probe being
  3546. handled. Some 'DTrace' probes can be enabled or disabled, but
  3547. 'SystemTap' probes cannot be disabled.
  3548. You can enable (or disable) one or more probes using the following
  3549. commands, with optional arguments:
  3550. 'enable probes [PROVIDER [NAME [OBJFILE]]]'
  3551. If given, PROVIDER is a regular expression used to match against
  3552. provider names when selecting which probes to enable. If omitted,
  3553. all probes from all providers are enabled.
  3554. If given, NAME is a regular expression to match against probe names
  3555. when selecting which probes to enable. If omitted, probe names are
  3556. not considered when deciding whether to enable them.
  3557. If given, OBJFILE is a regular expression used to select which
  3558. object files (executable or shared libraries) to examine. If not
  3559. given, all object files are considered.
  3560. 'disable probes [PROVIDER [NAME [OBJFILE]]]'
  3561. See the 'enable probes' command above for a description of the
  3562. optional arguments accepted by this command.
  3563. A probe may specify up to twelve arguments. These are available at
  3564. the point at which the probe is defined--that is, when the current PC is
  3565. at the probe's location. The arguments are available using the
  3566. convenience variables (*note Convenience Vars::)
  3567. '$_probe_arg0'...'$_probe_arg11'. In 'SystemTap' probes each probe
  3568. argument is an integer of the appropriate size; types are not preserved.
  3569. In 'DTrace' probes types are preserved provided that they are recognized
  3570. as such by GDB; otherwise the value of the probe argument will be a long
  3571. integer. The convenience variable '$_probe_argc' holds the number of
  3572. arguments at the current probe point.
  3573. These variables are always available, but attempts to access them at
  3574. any location other than a probe point will cause GDB to give an error
  3575. message.
  3576. ---------- Footnotes ----------
  3577. (1) See
  3578. <http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps> for
  3579. more information on how to add 'SystemTap' SDT probes in your
  3580. applications.
  3581. (2) See
  3582. <http://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation> for
  3583. a good reference on how the SDT probes are implemented.
  3584. 
  3585. File: gdb.info, Node: Error in Breakpoints, Next: Breakpoint-related Warnings, Prev: Static Probe Points, Up: Breakpoints
  3586. 5.1.11 "Cannot insert breakpoints"
  3587. ----------------------------------
  3588. If you request too many active hardware-assisted breakpoints and
  3589. watchpoints, you will see this error message:
  3590. Stopped; cannot insert breakpoints.
  3591. You may have requested too many hardware breakpoints and watchpoints.
  3592. This message is printed when you attempt to resume the program, since
  3593. only then GDB knows exactly how many hardware breakpoints and
  3594. watchpoints it needs to insert.
  3595. When this message is printed, you need to disable or remove some of
  3596. the hardware-assisted breakpoints and watchpoints, and then continue.
  3597. 
  3598. File: gdb.info, Node: Breakpoint-related Warnings, Prev: Error in Breakpoints, Up: Breakpoints
  3599. 5.1.12 "Breakpoint address adjusted..."
  3600. ---------------------------------------
  3601. Some processor architectures place constraints on the addresses at which
  3602. breakpoints may be placed. For architectures thus constrained, GDB will
  3603. attempt to adjust the breakpoint's address to comply with the
  3604. constraints dictated by the architecture.
  3605. One example of such an architecture is the Fujitsu FR-V. The FR-V is
  3606. a VLIW architecture in which a number of RISC-like instructions may be
  3607. bundled together for parallel execution. The FR-V architecture
  3608. constrains the location of a breakpoint instruction within such a bundle
  3609. to the instruction with the lowest address. GDB honors this constraint
  3610. by adjusting a breakpoint's address to the first in the bundle.
  3611. It is not uncommon for optimized code to have bundles which contain
  3612. instructions from different source statements, thus it may happen that a
  3613. breakpoint's address will be adjusted from one source statement to
  3614. another. Since this adjustment may significantly alter GDB's breakpoint
  3615. related behavior from what the user expects, a warning is printed when
  3616. the breakpoint is first set and also when the breakpoint is hit.
  3617. A warning like the one below is printed when setting a breakpoint
  3618. that's been subject to address adjustment:
  3619. warning: Breakpoint address adjusted from 0x00010414 to 0x00010410.
  3620. Such warnings are printed both for user settable and GDB's internal
  3621. breakpoints. If you see one of these warnings, you should verify that a
  3622. breakpoint set at the adjusted address will have the desired affect. If
  3623. not, the breakpoint in question may be removed and other breakpoints may
  3624. be set which will have the desired behavior. E.g., it may be sufficient
  3625. to place the breakpoint at a later instruction. A conditional
  3626. breakpoint may also be useful in some cases to prevent the breakpoint
  3627. from triggering too often.
  3628. GDB will also issue a warning when stopping at one of these adjusted
  3629. breakpoints:
  3630. warning: Breakpoint 1 address previously adjusted from 0x00010414
  3631. to 0x00010410.
  3632. When this warning is encountered, it may be too late to take remedial
  3633. action except in cases where the breakpoint is hit earlier or more
  3634. frequently than expected.
  3635. 
  3636. File: gdb.info, Node: Continuing and Stepping, Next: Skipping Over Functions and Files, Prev: Breakpoints, Up: Stopping
  3637. 5.2 Continuing and Stepping
  3638. ===========================
  3639. "Continuing" means resuming program execution until your program
  3640. completes normally. In contrast, "stepping" means executing just one
  3641. more "step" of your program, where "step" may mean either one line of
  3642. source code, or one machine instruction (depending on what particular
  3643. command you use). Either when continuing or when stepping, your program
  3644. may stop even sooner, due to a breakpoint or a signal. (If it stops due
  3645. to a signal, you may want to use 'handle', or use 'signal 0' to resume
  3646. execution (*note Signals: Signals.), or you may step into the signal's
  3647. handler (*note stepping and signal handlers::).)
  3648. 'continue [IGNORE-COUNT]'
  3649. 'c [IGNORE-COUNT]'
  3650. 'fg [IGNORE-COUNT]'
  3651. Resume program execution, at the address where your program last
  3652. stopped; any breakpoints set at that address are bypassed. The
  3653. optional argument IGNORE-COUNT allows you to specify a further
  3654. number of times to ignore a breakpoint at this location; its effect
  3655. is like that of 'ignore' (*note Break Conditions: Conditions.).
  3656. The argument IGNORE-COUNT is meaningful only when your program
  3657. stopped due to a breakpoint. At other times, the argument to
  3658. 'continue' is ignored.
  3659. The synonyms 'c' and 'fg' (for "foreground", as the debugged
  3660. program is deemed to be the foreground program) are provided purely
  3661. for convenience, and have exactly the same behavior as 'continue'.
  3662. To resume execution at a different place, you can use 'return' (*note
  3663. Returning from a Function: Returning.) to go back to the calling
  3664. function; or 'jump' (*note Continuing at a Different Address: Jumping.)
  3665. to go to an arbitrary location in your program.
  3666. A typical technique for using stepping is to set a breakpoint (*note
  3667. Breakpoints; Watchpoints; and Catchpoints: Breakpoints.) at the
  3668. beginning of the function or the section of your program where a problem
  3669. is believed to lie, run your program until it stops at that breakpoint,
  3670. and then step through the suspect area, examining the variables that are
  3671. interesting, until you see the problem happen.
  3672. 'step'
  3673. Continue running your program until control reaches a different
  3674. source line, then stop it and return control to GDB. This command
  3675. is abbreviated 's'.
  3676. _Warning:_ If you use the 'step' command while control is
  3677. within a function that was compiled without debugging
  3678. information, execution proceeds until control reaches a
  3679. function that does have debugging information. Likewise, it
  3680. will not step into a function which is compiled without
  3681. debugging information. To step through functions without
  3682. debugging information, use the 'stepi' command, described
  3683. below.
  3684. The 'step' command only stops at the first instruction of a source
  3685. line. This prevents the multiple stops that could otherwise occur
  3686. in 'switch' statements, 'for' loops, etc. 'step' continues to stop
  3687. if a function that has debugging information is called within the
  3688. line. In other words, 'step' _steps inside_ any functions called
  3689. within the line.
  3690. Also, the 'step' command only enters a function if there is line
  3691. number information for the function. Otherwise it acts like the
  3692. 'next' command. This avoids problems when using 'cc -gl' on MIPS
  3693. machines. Previously, 'step' entered subroutines if there was any
  3694. debugging information about the routine.
  3695. 'step COUNT'
  3696. Continue running as in 'step', but do so COUNT times. If a
  3697. breakpoint is reached, or a signal not related to stepping occurs
  3698. before COUNT steps, stepping stops right away.
  3699. 'next [COUNT]'
  3700. Continue to the next source line in the current (innermost) stack
  3701. frame. This is similar to 'step', but function calls that appear
  3702. within the line of code are executed without stopping. Execution
  3703. stops when control reaches a different line of code at the original
  3704. stack level that was executing when you gave the 'next' command.
  3705. This command is abbreviated 'n'.
  3706. An argument COUNT is a repeat count, as for 'step'.
  3707. The 'next' command only stops at the first instruction of a source
  3708. line. This prevents multiple stops that could otherwise occur in
  3709. 'switch' statements, 'for' loops, etc.
  3710. 'set step-mode'
  3711. 'set step-mode on'
  3712. The 'set step-mode on' command causes the 'step' command to stop at
  3713. the first instruction of a function which contains no debug line
  3714. information rather than stepping over it.
  3715. This is useful in cases where you may be interested in inspecting
  3716. the machine instructions of a function which has no symbolic info
  3717. and do not want GDB to automatically skip over this function.
  3718. 'set step-mode off'
  3719. Causes the 'step' command to step over any functions which contains
  3720. no debug information. This is the default.
  3721. 'show step-mode'
  3722. Show whether GDB will stop in or step over functions without source
  3723. line debug information.
  3724. 'finish'
  3725. Continue running until just after function in the selected stack
  3726. frame returns. Print the returned value (if any). This command
  3727. can be abbreviated as 'fin'.
  3728. Contrast this with the 'return' command (*note Returning from a
  3729. Function: Returning.).
  3730. 'until'
  3731. 'u'
  3732. Continue running until a source line past the current line, in the
  3733. current stack frame, is reached. This command is used to avoid
  3734. single stepping through a loop more than once. It is like the
  3735. 'next' command, except that when 'until' encounters a jump, it
  3736. automatically continues execution until the program counter is
  3737. greater than the address of the jump.
  3738. This means that when you reach the end of a loop after single
  3739. stepping though it, 'until' makes your program continue execution
  3740. until it exits the loop. In contrast, a 'next' command at the end
  3741. of a loop simply steps back to the beginning of the loop, which
  3742. forces you to step through the next iteration.
  3743. 'until' always stops your program if it attempts to exit the
  3744. current stack frame.
  3745. 'until' may produce somewhat counterintuitive results if the order
  3746. of machine code does not match the order of the source lines. For
  3747. example, in the following excerpt from a debugging session, the 'f'
  3748. ('frame') command shows that execution is stopped at line '206';
  3749. yet when we use 'until', we get to line '195':
  3750. (gdb) f
  3751. #0 main (argc=4, argv=0xf7fffae8) at m4.c:206
  3752. 206 expand_input();
  3753. (gdb) until
  3754. 195 for ( ; argc > 0; NEXTARG) {
  3755. This happened because, for execution efficiency, the compiler had
  3756. generated code for the loop closure test at the end, rather than
  3757. the start, of the loop--even though the test in a C 'for'-loop is
  3758. written before the body of the loop. The 'until' command appeared
  3759. to step back to the beginning of the loop when it advanced to this
  3760. expression; however, it has not really gone to an earlier
  3761. statement--not in terms of the actual machine code.
  3762. 'until' with no argument works by means of single instruction
  3763. stepping, and hence is slower than 'until' with an argument.
  3764. 'until LOCATION'
  3765. 'u LOCATION'
  3766. Continue running your program until either the specified LOCATION
  3767. is reached, or the current stack frame returns. The location is
  3768. any of the forms described in *note Specify Location::. This form
  3769. of the command uses temporary breakpoints, and hence is quicker
  3770. than 'until' without an argument. The specified location is
  3771. actually reached only if it is in the current frame. This implies
  3772. that 'until' can be used to skip over recursive function
  3773. invocations. For instance in the code below, if the current
  3774. location is line '96', issuing 'until 99' will execute the program
  3775. up to line '99' in the same invocation of factorial, i.e., after
  3776. the inner invocations have returned.
  3777. 94 int factorial (int value)
  3778. 95 {
  3779. 96 if (value > 1) {
  3780. 97 value *= factorial (value - 1);
  3781. 98 }
  3782. 99 return (value);
  3783. 100 }
  3784. 'advance LOCATION'
  3785. Continue running the program up to the given LOCATION. An argument
  3786. is required, which should be of one of the forms described in *note
  3787. Specify Location::. Execution will also stop upon exit from the
  3788. current stack frame. This command is similar to 'until', but
  3789. 'advance' will not skip over recursive function calls, and the
  3790. target location doesn't have to be in the same frame as the current
  3791. one.
  3792. 'stepi'
  3793. 'stepi ARG'
  3794. 'si'
  3795. Execute one machine instruction, then stop and return to the
  3796. debugger.
  3797. It is often useful to do 'display/i $pc' when stepping by machine
  3798. instructions. This makes GDB automatically display the next
  3799. instruction to be executed, each time your program stops. *Note
  3800. Automatic Display: Auto Display.
  3801. An argument is a repeat count, as in 'step'.
  3802. 'nexti'
  3803. 'nexti ARG'
  3804. 'ni'
  3805. Execute one machine instruction, but if it is a function call,
  3806. proceed until the function returns.
  3807. An argument is a repeat count, as in 'next'.
  3808. By default, and if available, GDB makes use of target-assisted "range
  3809. stepping". In other words, whenever you use a stepping command (e.g.,
  3810. 'step', 'next'), GDB tells the target to step the corresponding range of
  3811. instruction addresses instead of issuing multiple single-steps. This
  3812. speeds up line stepping, particularly for remote targets. Ideally,
  3813. there should be no reason you would want to turn range stepping off.
  3814. However, it's possible that a bug in the debug info, a bug in the remote
  3815. stub (for remote targets), or even a bug in GDB could make line stepping
  3816. behave incorrectly when target-assisted range stepping is enabled. You
  3817. can use the following command to turn off range stepping if necessary:
  3818. 'set range-stepping'
  3819. 'show range-stepping'
  3820. Control whether range stepping is enabled.
  3821. If 'on', and the target supports it, GDB tells the target to step a
  3822. range of addresses itself, instead of issuing multiple
  3823. single-steps. If 'off', GDB always issues single-steps, even if
  3824. range stepping is supported by the target. The default is 'on'.
  3825. 
  3826. File: gdb.info, Node: Skipping Over Functions and Files, Next: Signals, Prev: Continuing and Stepping, Up: Stopping
  3827. 5.3 Skipping Over Functions and Files
  3828. =====================================
  3829. The program you are debugging may contain some functions which are
  3830. uninteresting to debug. The 'skip' command lets you tell GDB to skip a
  3831. function, all functions in a file or a particular function in a
  3832. particular file when stepping.
  3833. For example, consider the following C function:
  3834. 101 int func()
  3835. 102 {
  3836. 103 foo(boring());
  3837. 104 bar(boring());
  3838. 105 }
  3839. Suppose you wish to step into the functions 'foo' and 'bar', but you are
  3840. not interested in stepping through 'boring'. If you run 'step' at line
  3841. 103, you'll enter 'boring()', but if you run 'next', you'll step over
  3842. both 'foo' and 'boring'!
  3843. One solution is to 'step' into 'boring' and use the 'finish' command
  3844. to immediately exit it. But this can become tedious if 'boring' is
  3845. called from many places.
  3846. A more flexible solution is to execute 'skip boring'. This instructs
  3847. GDB never to step into 'boring'. Now when you execute 'step' at line
  3848. 103, you'll step over 'boring' and directly into 'foo'.
  3849. Functions may be skipped by providing either a function name,
  3850. linespec (*note Specify Location::), regular expression that matches the
  3851. function's name, file name or a 'glob'-style pattern that matches the
  3852. file name.
  3853. On Posix systems the form of the regular expression is "Extended
  3854. Regular Expressions". See for example 'man 7 regex' on GNU/Linux
  3855. systems. On non-Posix systems the form of the regular expression is
  3856. whatever is provided by the 'regcomp' function of the underlying system.
  3857. See for example 'man 7 glob' on GNU/Linux systems for a description of
  3858. 'glob'-style patterns.
  3859. 'skip [OPTIONS]'
  3860. The basic form of the 'skip' command takes zero or more options
  3861. that specify what to skip. The OPTIONS argument is any useful
  3862. combination of the following:
  3863. '-file FILE'
  3864. '-fi FILE'
  3865. Functions in FILE will be skipped over when stepping.
  3866. '-gfile FILE-GLOB-PATTERN'
  3867. '-gfi FILE-GLOB-PATTERN'
  3868. Functions in files matching FILE-GLOB-PATTERN will be skipped
  3869. over when stepping.
  3870. (gdb) skip -gfi utils/*.c
  3871. '-function LINESPEC'
  3872. '-fu LINESPEC'
  3873. Functions named by LINESPEC or the function containing the
  3874. line named by LINESPEC will be skipped over when stepping.
  3875. *Note Specify Location::.
  3876. '-rfunction REGEXP'
  3877. '-rfu REGEXP'
  3878. Functions whose name matches REGEXP will be skipped over when
  3879. stepping.
  3880. This form is useful for complex function names. For example,
  3881. there is generally no need to step into C++ 'std::string'
  3882. constructors or destructors. Plus with C++ templates it can
  3883. be hard to write out the full name of the function, and often
  3884. it doesn't matter what the template arguments are. Specifying
  3885. the function to be skipped as a regular expression makes this
  3886. easier.
  3887. (gdb) skip -rfu ^std::(allocator|basic_string)<.*>::~?\1 *\(
  3888. If you want to skip every templated C++ constructor and
  3889. destructor in the 'std' namespace you can do:
  3890. (gdb) skip -rfu ^std::([a-zA-z0-9_]+)<.*>::~?\1 *\(
  3891. If no options are specified, the function you're currently
  3892. debugging will be skipped.
  3893. 'skip function [LINESPEC]'
  3894. After running this command, the function named by LINESPEC or the
  3895. function containing the line named by LINESPEC will be skipped over
  3896. when stepping. *Note Specify Location::.
  3897. If you do not specify LINESPEC, the function you're currently
  3898. debugging will be skipped.
  3899. (If you have a function called 'file' that you want to skip, use
  3900. 'skip function file'.)
  3901. 'skip file [FILENAME]'
  3902. After running this command, any function whose source lives in
  3903. FILENAME will be skipped over when stepping.
  3904. (gdb) skip file boring.c
  3905. File boring.c will be skipped when stepping.
  3906. If you do not specify FILENAME, functions whose source lives in the
  3907. file you're currently debugging will be skipped.
  3908. Skips can be listed, deleted, disabled, and enabled, much like
  3909. breakpoints. These are the commands for managing your list of skips:
  3910. 'info skip [RANGE]'
  3911. Print details about the specified skip(s). If RANGE is not
  3912. specified, print a table with details about all functions and files
  3913. marked for skipping. 'info skip' prints the following information
  3914. about each skip:
  3915. _Identifier_
  3916. A number identifying this skip.
  3917. _Enabled or Disabled_
  3918. Enabled skips are marked with 'y'. Disabled skips are marked
  3919. with 'n'.
  3920. _Glob_
  3921. If the file name is a 'glob' pattern this is 'y'. Otherwise
  3922. it is 'n'.
  3923. _File_
  3924. The name or 'glob' pattern of the file to be skipped. If no
  3925. file is specified this is '<none>'.
  3926. _RE_
  3927. If the function name is a 'regular expression' this is 'y'.
  3928. Otherwise it is 'n'.
  3929. _Function_
  3930. The name or regular expression of the function to skip. If no
  3931. function is specified this is '<none>'.
  3932. 'skip delete [RANGE]'
  3933. Delete the specified skip(s). If RANGE is not specified, delete
  3934. all skips.
  3935. 'skip enable [RANGE]'
  3936. Enable the specified skip(s). If RANGE is not specified, enable
  3937. all skips.
  3938. 'skip disable [RANGE]'
  3939. Disable the specified skip(s). If RANGE is not specified, disable
  3940. all skips.
  3941. 'set debug skip [on|off]'
  3942. Set whether to print the debug output about skipping files and
  3943. functions.
  3944. 'show debug skip'
  3945. Show whether the debug output about skipping files and functions is
  3946. printed.
  3947. 
  3948. File: gdb.info, Node: Signals, Next: Thread Stops, Prev: Skipping Over Functions and Files, Up: Stopping
  3949. 5.4 Signals
  3950. ===========
  3951. A signal is an asynchronous event that can happen in a program. The
  3952. operating system defines the possible kinds of signals, and gives each
  3953. kind a name and a number. For example, in Unix 'SIGINT' is the signal a
  3954. program gets when you type an interrupt character (often 'Ctrl-c');
  3955. 'SIGSEGV' is the signal a program gets from referencing a place in
  3956. memory far away from all the areas in use; 'SIGALRM' occurs when the
  3957. alarm clock timer goes off (which happens only if your program has
  3958. requested an alarm).
  3959. Some signals, including 'SIGALRM', are a normal part of the
  3960. functioning of your program. Others, such as 'SIGSEGV', indicate
  3961. errors; these signals are "fatal" (they kill your program immediately)
  3962. if the program has not specified in advance some other way to handle the
  3963. signal. 'SIGINT' does not indicate an error in your program, but it is
  3964. normally fatal so it can carry out the purpose of the interrupt: to kill
  3965. the program.
  3966. GDB has the ability to detect any occurrence of a signal in your
  3967. program. You can tell GDB in advance what to do for each kind of
  3968. signal.
  3969. Normally, GDB is set up to let the non-erroneous signals like
  3970. 'SIGALRM' be silently passed to your program (so as not to interfere
  3971. with their role in the program's functioning) but to stop your program
  3972. immediately whenever an error signal happens. You can change these
  3973. settings with the 'handle' command.
  3974. 'info signals'
  3975. 'info handle'
  3976. Print a table of all the kinds of signals and how GDB has been told
  3977. to handle each one. You can use this to see the signal numbers of
  3978. all the defined types of signals.
  3979. 'info signals SIG'
  3980. Similar, but print information only about the specified signal
  3981. number.
  3982. 'info handle' is an alias for 'info signals'.
  3983. 'catch signal [SIGNAL... | 'all']'
  3984. Set a catchpoint for the indicated signals. *Note Set
  3985. Catchpoints::, for details about this command.
  3986. 'handle SIGNAL [KEYWORDS...]'
  3987. Change the way GDB handles signal SIGNAL. The SIGNAL can be the
  3988. number of a signal or its name (with or without the 'SIG' at the
  3989. beginning); a list of signal numbers of the form 'LOW-HIGH'; or the
  3990. word 'all', meaning all the known signals. Optional arguments
  3991. KEYWORDS, described below, say what change to make.
  3992. The keywords allowed by the 'handle' command can be abbreviated.
  3993. Their full names are:
  3994. 'nostop'
  3995. GDB should not stop your program when this signal happens. It may
  3996. still print a message telling you that the signal has come in.
  3997. 'stop'
  3998. GDB should stop your program when this signal happens. This
  3999. implies the 'print' keyword as well.
  4000. 'print'
  4001. GDB should print a message when this signal happens.
  4002. 'noprint'
  4003. GDB should not mention the occurrence of the signal at all. This
  4004. implies the 'nostop' keyword as well.
  4005. 'pass'
  4006. 'noignore'
  4007. GDB should allow your program to see this signal; your program can
  4008. handle the signal, or else it may terminate if the signal is fatal
  4009. and not handled. 'pass' and 'noignore' are synonyms.
  4010. 'nopass'
  4011. 'ignore'
  4012. GDB should not allow your program to see this signal. 'nopass' and
  4013. 'ignore' are synonyms.
  4014. When a signal stops your program, the signal is not visible to the
  4015. program until you continue. Your program sees the signal then, if
  4016. 'pass' is in effect for the signal in question _at that time_. In other
  4017. words, after GDB reports a signal, you can use the 'handle' command with
  4018. 'pass' or 'nopass' to control whether your program sees that signal when
  4019. you continue.
  4020. The default is set to 'nostop', 'noprint', 'pass' for non-erroneous
  4021. signals such as 'SIGALRM', 'SIGWINCH' and 'SIGCHLD', and to 'stop',
  4022. 'print', 'pass' for the erroneous signals.
  4023. You can also use the 'signal' command to prevent your program from
  4024. seeing a signal, or cause it to see a signal it normally would not see,
  4025. or to give it any signal at any time. For example, if your program
  4026. stopped due to some sort of memory reference error, you might store
  4027. correct values into the erroneous variables and continue, hoping to see
  4028. more execution; but your program would probably terminate immediately as
  4029. a result of the fatal signal once it saw the signal. To prevent this,
  4030. you can continue with 'signal 0'. *Note Giving your Program a Signal:
  4031. Signaling.
  4032. GDB optimizes for stepping the mainline code. If a signal that has
  4033. 'handle nostop' and 'handle pass' set arrives while a stepping command
  4034. (e.g., 'stepi', 'step', 'next') is in progress, GDB lets the signal
  4035. handler run and then resumes stepping the mainline code once the signal
  4036. handler returns. In other words, GDB steps over the signal handler.
  4037. This prevents signals that you've specified as not interesting (with
  4038. 'handle nostop') from changing the focus of debugging unexpectedly.
  4039. Note that the signal handler itself may still hit a breakpoint, stop for
  4040. another signal that has 'handle stop' in effect, or for any other event
  4041. that normally results in stopping the stepping command sooner. Also
  4042. note that GDB still informs you that the program received a signal if
  4043. 'handle print' is set.
  4044. If you set 'handle pass' for a signal, and your program sets up a
  4045. handler for it, then issuing a stepping command, such as 'step' or
  4046. 'stepi', when your program is stopped due to the signal will step _into_
  4047. the signal handler (if the target supports that).
  4048. Likewise, if you use the 'queue-signal' command to queue a signal to
  4049. be delivered to the current thread when execution of the thread resumes
  4050. (*note Giving your Program a Signal: Signaling.), then a stepping
  4051. command will step into the signal handler.
  4052. Here's an example, using 'stepi' to step to the first instruction of
  4053. 'SIGUSR1''s handler:
  4054. (gdb) handle SIGUSR1
  4055. Signal Stop Print Pass to program Description
  4056. SIGUSR1 Yes Yes Yes User defined signal 1
  4057. (gdb) c
  4058. Continuing.
  4059. Program received signal SIGUSR1, User defined signal 1.
  4060. main () sigusr1.c:28
  4061. 28 p = 0;
  4062. (gdb) si
  4063. sigusr1_handler () at sigusr1.c:9
  4064. 9 {
  4065. The same, but using 'queue-signal' instead of waiting for the program
  4066. to receive the signal first:
  4067. (gdb) n
  4068. 28 p = 0;
  4069. (gdb) queue-signal SIGUSR1
  4070. (gdb) si
  4071. sigusr1_handler () at sigusr1.c:9
  4072. 9 {
  4073. (gdb)
  4074. On some targets, GDB can inspect extra signal information associated
  4075. with the intercepted signal, before it is actually delivered to the
  4076. program being debugged. This information is exported by the convenience
  4077. variable '$_siginfo', and consists of data that is passed by the kernel
  4078. to the signal handler at the time of the receipt of a signal. The data
  4079. type of the information itself is target dependent. You can see the
  4080. data type using the 'ptype $_siginfo' command. On Unix systems, it
  4081. typically corresponds to the standard 'siginfo_t' type, as defined in
  4082. the 'signal.h' system header.
  4083. Here's an example, on a GNU/Linux system, printing the stray
  4084. referenced address that raised a segmentation fault.
  4085. (gdb) continue
  4086. Program received signal SIGSEGV, Segmentation fault.
  4087. 0x0000000000400766 in main ()
  4088. 69 *(int *)p = 0;
  4089. (gdb) ptype $_siginfo
  4090. type = struct {
  4091. int si_signo;
  4092. int si_errno;
  4093. int si_code;
  4094. union {
  4095. int _pad[28];
  4096. struct {...} _kill;
  4097. struct {...} _timer;
  4098. struct {...} _rt;
  4099. struct {...} _sigchld;
  4100. struct {...} _sigfault;
  4101. struct {...} _sigpoll;
  4102. } _sifields;
  4103. }
  4104. (gdb) ptype $_siginfo._sifields._sigfault
  4105. type = struct {
  4106. void *si_addr;
  4107. }
  4108. (gdb) p $_siginfo._sifields._sigfault.si_addr
  4109. $1 = (void *) 0x7ffff7ff7000
  4110. Depending on target support, '$_siginfo' may also be writable.
  4111. On some targets, a 'SIGSEGV' can be caused by a boundary violation,
  4112. i.e., accessing an address outside of the allowed range. In those cases
  4113. GDB may displays additional information, depending on how GDB has been
  4114. told to handle the signal. With 'handle stop SIGSEGV', GDB displays the
  4115. violation kind: "Upper" or "Lower", the memory address accessed and the
  4116. bounds, while with 'handle nostop SIGSEGV' no additional information is
  4117. displayed.
  4118. The usual output of a segfault is:
  4119. Program received signal SIGSEGV, Segmentation fault
  4120. 0x0000000000400d7c in upper () at i386-mpx-sigsegv.c:68
  4121. 68 value = *(p + len);
  4122. While a bound violation is presented as:
  4123. Program received signal SIGSEGV, Segmentation fault
  4124. Upper bound violation while accessing address 0x7fffffffc3b3
  4125. Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
  4126. 0x0000000000400d7c in upper () at i386-mpx-sigsegv.c:68
  4127. 68 value = *(p + len);
  4128. 
  4129. File: gdb.info, Node: Thread Stops, Prev: Signals, Up: Stopping
  4130. 5.5 Stopping and Starting Multi-thread Programs
  4131. ===============================================
  4132. GDB supports debugging programs with multiple threads (*note Debugging
  4133. Programs with Multiple Threads: Threads.). There are two modes of
  4134. controlling execution of your program within the debugger. In the
  4135. default mode, referred to as "all-stop mode", when any thread in your
  4136. program stops (for example, at a breakpoint or while being stepped), all
  4137. other threads in the program are also stopped by GDB. On some targets,
  4138. GDB also supports "non-stop mode", in which other threads can continue
  4139. to run freely while you examine the stopped thread in the debugger.
  4140. * Menu:
  4141. * All-Stop Mode:: All threads stop when GDB takes control
  4142. * Non-Stop Mode:: Other threads continue to execute
  4143. * Background Execution:: Running your program asynchronously
  4144. * Thread-Specific Breakpoints:: Controlling breakpoints
  4145. * Interrupted System Calls:: GDB may interfere with system calls
  4146. * Observer Mode:: GDB does not alter program behavior
  4147. 
  4148. File: gdb.info, Node: All-Stop Mode, Next: Non-Stop Mode, Up: Thread Stops
  4149. 5.5.1 All-Stop Mode
  4150. -------------------
  4151. In all-stop mode, whenever your program stops under GDB for any reason,
  4152. _all_ threads of execution stop, not just the current thread. This
  4153. allows you to examine the overall state of the program, including
  4154. switching between threads, without worrying that things may change
  4155. underfoot.
  4156. Conversely, whenever you restart the program, _all_ threads start
  4157. executing. _This is true even when single-stepping_ with commands like
  4158. 'step' or 'next'.
  4159. In particular, GDB cannot single-step all threads in lockstep. Since
  4160. thread scheduling is up to your debugging target's operating system (not
  4161. controlled by GDB), other threads may execute more than one statement
  4162. while the current thread completes a single step. Moreover, in general
  4163. other threads stop in the middle of a statement, rather than at a clean
  4164. statement boundary, when the program stops.
  4165. You might even find your program stopped in another thread after
  4166. continuing or even single-stepping. This happens whenever some other
  4167. thread runs into a breakpoint, a signal, or an exception before the
  4168. first thread completes whatever you requested.
  4169. Whenever GDB stops your program, due to a breakpoint or a signal, it
  4170. automatically selects the thread where that breakpoint or signal
  4171. happened. GDB alerts you to the context switch with a message such as
  4172. '[Switching to Thread N]' to identify the thread.
  4173. On some OSes, you can modify GDB's default behavior by locking the OS
  4174. scheduler to allow only a single thread to run.
  4175. 'set scheduler-locking MODE'
  4176. Set the scheduler locking mode. It applies to normal execution,
  4177. record mode, and replay mode. If it is 'off', then there is no
  4178. locking and any thread may run at any time. If 'on', then only the
  4179. current thread may run when the inferior is resumed. The 'step'
  4180. mode optimizes for single-stepping; it prevents other threads from
  4181. preempting the current thread while you are stepping, so that the
  4182. focus of debugging does not change unexpectedly. Other threads
  4183. never get a chance to run when you step, and they are completely
  4184. free to run when you use commands like 'continue', 'until', or
  4185. 'finish'. However, unless another thread hits a breakpoint during
  4186. its timeslice, GDB does not change the current thread away from the
  4187. thread that you are debugging. The 'replay' mode behaves like
  4188. 'off' in record mode and like 'on' in replay mode.
  4189. 'show scheduler-locking'
  4190. Display the current scheduler locking mode.
  4191. By default, when you issue one of the execution commands such as
  4192. 'continue', 'next' or 'step', GDB allows only threads of the current
  4193. inferior to run. For example, if GDB is attached to two inferiors, each
  4194. with two threads, the 'continue' command resumes only the two threads of
  4195. the current inferior. This is useful, for example, when you debug a
  4196. program that forks and you want to hold the parent stopped (so that, for
  4197. instance, it doesn't run to exit), while you debug the child. In other
  4198. situations, you may not be interested in inspecting the current state of
  4199. any of the processes GDB is attached to, and you may want to resume them
  4200. all until some breakpoint is hit. In the latter case, you can instruct
  4201. GDB to allow all threads of all the inferiors to run with the 'set schedule-multiple'
  4202. command.
  4203. 'set schedule-multiple'
  4204. Set the mode for allowing threads of multiple processes to be
  4205. resumed when an execution command is issued. When 'on', all
  4206. threads of all processes are allowed to run. When 'off', only the
  4207. threads of the current process are resumed. The default is 'off'.
  4208. The 'scheduler-locking' mode takes precedence when set to 'on', or
  4209. while you are stepping and set to 'step'.
  4210. 'show schedule-multiple'
  4211. Display the current mode for resuming the execution of threads of
  4212. multiple processes.
  4213. 
  4214. File: gdb.info, Node: Non-Stop Mode, Next: Background Execution, Prev: All-Stop Mode, Up: Thread Stops
  4215. 5.5.2 Non-Stop Mode
  4216. -------------------
  4217. For some multi-threaded targets, GDB supports an optional mode of
  4218. operation in which you can examine stopped program threads in the
  4219. debugger while other threads continue to execute freely. This minimizes
  4220. intrusion when debugging live systems, such as programs where some
  4221. threads have real-time constraints or must continue to respond to
  4222. external events. This is referred to as "non-stop" mode.
  4223. In non-stop mode, when a thread stops to report a debugging event,
  4224. _only_ that thread is stopped; GDB does not stop other threads as well,
  4225. in contrast to the all-stop mode behavior. Additionally, execution
  4226. commands such as 'continue' and 'step' apply by default only to the
  4227. current thread in non-stop mode, rather than all threads as in all-stop
  4228. mode. This allows you to control threads explicitly in ways that are
  4229. not possible in all-stop mode -- for example, stepping one thread while
  4230. allowing others to run freely, stepping one thread while holding all
  4231. others stopped, or stepping several threads independently and
  4232. simultaneously.
  4233. To enter non-stop mode, use this sequence of commands before you run
  4234. or attach to your program:
  4235. # If using the CLI, pagination breaks non-stop.
  4236. set pagination off
  4237. # Finally, turn it on!
  4238. set non-stop on
  4239. You can use these commands to manipulate the non-stop mode setting:
  4240. 'set non-stop on'
  4241. Enable selection of non-stop mode.
  4242. 'set non-stop off'
  4243. Disable selection of non-stop mode.
  4244. 'show non-stop'
  4245. Show the current non-stop enablement setting.
  4246. Note these commands only reflect whether non-stop mode is enabled,
  4247. not whether the currently-executing program is being run in non-stop
  4248. mode. In particular, the 'set non-stop' preference is only consulted
  4249. when GDB starts or connects to the target program, and it is generally
  4250. not possible to switch modes once debugging has started. Furthermore,
  4251. since not all targets support non-stop mode, even when you have enabled
  4252. non-stop mode, GDB may still fall back to all-stop operation by default.
  4253. In non-stop mode, all execution commands apply only to the current
  4254. thread by default. That is, 'continue' only continues one thread. To
  4255. continue all threads, issue 'continue -a' or 'c -a'.
  4256. You can use GDB's background execution commands (*note Background
  4257. Execution::) to run some threads in the background while you continue to
  4258. examine or step others from GDB. The MI execution commands (*note
  4259. GDB/MI Program Execution::) are always executed asynchronously in
  4260. non-stop mode.
  4261. Suspending execution is done with the 'interrupt' command when
  4262. running in the background, or 'Ctrl-c' during foreground execution. In
  4263. all-stop mode, this stops the whole process; but in non-stop mode the
  4264. interrupt applies only to the current thread. To stop the whole
  4265. program, use 'interrupt -a'.
  4266. Other execution commands do not currently support the '-a' option.
  4267. In non-stop mode, when a thread stops, GDB doesn't automatically make
  4268. that thread current, as it does in all-stop mode. This is because the
  4269. thread stop notifications are asynchronous with respect to GDB's command
  4270. interpreter, and it would be confusing if GDB unexpectedly changed to a
  4271. different thread just as you entered a command to operate on the
  4272. previously current thread.
  4273. 
  4274. File: gdb.info, Node: Background Execution, Next: Thread-Specific Breakpoints, Prev: Non-Stop Mode, Up: Thread Stops
  4275. 5.5.3 Background Execution
  4276. --------------------------
  4277. GDB's execution commands have two variants: the normal foreground
  4278. (synchronous) behavior, and a background (asynchronous) behavior. In
  4279. foreground execution, GDB waits for the program to report that some
  4280. thread has stopped before prompting for another command. In background
  4281. execution, GDB immediately gives a command prompt so that you can issue
  4282. other commands while your program runs.
  4283. If the target doesn't support async mode, GDB issues an error message
  4284. if you attempt to use the background execution commands.
  4285. To specify background execution, add a '&' to the command. For
  4286. example, the background form of the 'continue' command is 'continue&',
  4287. or just 'c&'. The execution commands that accept background execution
  4288. are:
  4289. 'run'
  4290. *Note Starting your Program: Starting.
  4291. 'attach'
  4292. *Note Debugging an Already-running Process: Attach.
  4293. 'step'
  4294. *Note step: Continuing and Stepping.
  4295. 'stepi'
  4296. *Note stepi: Continuing and Stepping.
  4297. 'next'
  4298. *Note next: Continuing and Stepping.
  4299. 'nexti'
  4300. *Note nexti: Continuing and Stepping.
  4301. 'continue'
  4302. *Note continue: Continuing and Stepping.
  4303. 'finish'
  4304. *Note finish: Continuing and Stepping.
  4305. 'until'
  4306. *Note until: Continuing and Stepping.
  4307. Background execution is especially useful in conjunction with
  4308. non-stop mode for debugging programs with multiple threads; see *note
  4309. Non-Stop Mode::. However, you can also use these commands in the normal
  4310. all-stop mode with the restriction that you cannot issue another
  4311. execution command until the previous one finishes. Examples of commands
  4312. that are valid in all-stop mode while the program is running include
  4313. 'help' and 'info break'.
  4314. You can interrupt your program while it is running in the background
  4315. by using the 'interrupt' command.
  4316. 'interrupt'
  4317. 'interrupt -a'
  4318. Suspend execution of the running program. In all-stop mode,
  4319. 'interrupt' stops the whole process, but in non-stop mode, it stops
  4320. only the current thread. To stop the whole program in non-stop
  4321. mode, use 'interrupt -a'.
  4322. 
  4323. File: gdb.info, Node: Thread-Specific Breakpoints, Next: Interrupted System Calls, Prev: Background Execution, Up: Thread Stops
  4324. 5.5.4 Thread-Specific Breakpoints
  4325. ---------------------------------
  4326. When your program has multiple threads (*note Debugging Programs with
  4327. Multiple Threads: Threads.), you can choose whether to set breakpoints
  4328. on all threads, or on a particular thread.
  4329. 'break LOCATION thread THREAD-ID'
  4330. 'break LOCATION thread THREAD-ID if ...'
  4331. LOCATION specifies source lines; there are several ways of writing
  4332. them (*note Specify Location::), but the effect is always to
  4333. specify some source line.
  4334. Use the qualifier 'thread THREAD-ID' with a breakpoint command to
  4335. specify that you only want GDB to stop the program when a
  4336. particular thread reaches this breakpoint. The THREAD-ID specifier
  4337. is one of the thread identifiers assigned by GDB, shown in the
  4338. first column of the 'info threads' display.
  4339. If you do not specify 'thread THREAD-ID' when you set a breakpoint,
  4340. the breakpoint applies to _all_ threads of your program.
  4341. You can use the 'thread' qualifier on conditional breakpoints as
  4342. well; in this case, place 'thread THREAD-ID' before or after the
  4343. breakpoint condition, like this:
  4344. (gdb) break frik.c:13 thread 28 if bartab > lim
  4345. Thread-specific breakpoints are automatically deleted when GDB
  4346. detects the corresponding thread is no longer in the thread list. For
  4347. example:
  4348. (gdb) c
  4349. Thread-specific breakpoint 3 deleted - thread 28 no longer in the thread list.
  4350. There are several ways for a thread to disappear, such as a regular
  4351. thread exit, but also when you detach from the process with the 'detach'
  4352. command (*note Debugging an Already-running Process: Attach.), or if GDB
  4353. loses the remote connection (*note Remote Debugging::), etc. Note that
  4354. with some targets, GDB is only able to detect a thread has exited when
  4355. the user explictly asks for the thread list with the 'info threads'
  4356. command.
  4357. 
  4358. File: gdb.info, Node: Interrupted System Calls, Next: Observer Mode, Prev: Thread-Specific Breakpoints, Up: Thread Stops
  4359. 5.5.5 Interrupted System Calls
  4360. ------------------------------
  4361. There is an unfortunate side effect when using GDB to debug
  4362. multi-threaded programs. If one thread stops for a breakpoint, or for
  4363. some other reason, and another thread is blocked in a system call, then
  4364. the system call may return prematurely. This is a consequence of the
  4365. interaction between multiple threads and the signals that GDB uses to
  4366. implement breakpoints and other events that stop execution.
  4367. To handle this problem, your program should check the return value of
  4368. each system call and react appropriately. This is good programming
  4369. style anyways.
  4370. For example, do not write code like this:
  4371. sleep (10);
  4372. The call to 'sleep' will return early if a different thread stops at
  4373. a breakpoint or for some other reason.
  4374. Instead, write this:
  4375. int unslept = 10;
  4376. while (unslept > 0)
  4377. unslept = sleep (unslept);
  4378. A system call is allowed to return early, so the system is still
  4379. conforming to its specification. But GDB does cause your multi-threaded
  4380. program to behave differently than it would without GDB.
  4381. Also, GDB uses internal breakpoints in the thread library to monitor
  4382. certain events such as thread creation and thread destruction. When
  4383. such an event happens, a system call in another thread may return
  4384. prematurely, even though your program does not appear to stop.
  4385. 
  4386. File: gdb.info, Node: Observer Mode, Prev: Interrupted System Calls, Up: Thread Stops
  4387. 5.5.6 Observer Mode
  4388. -------------------
  4389. If you want to build on non-stop mode and observe program behavior
  4390. without any chance of disruption by GDB, you can set variables to
  4391. disable all of the debugger's attempts to modify state, whether by
  4392. writing memory, inserting breakpoints, etc. These operate at a low
  4393. level, intercepting operations from all commands.
  4394. When all of these are set to 'off', then GDB is said to be "observer
  4395. mode". As a convenience, the variable 'observer' can be set to disable
  4396. these, plus enable non-stop mode.
  4397. Note that GDB will not prevent you from making nonsensical
  4398. combinations of these settings. For instance, if you have enabled
  4399. 'may-insert-breakpoints' but disabled 'may-write-memory', then
  4400. breakpoints that work by writing trap instructions into the code stream
  4401. will still not be able to be placed.
  4402. 'set observer on'
  4403. 'set observer off'
  4404. When set to 'on', this disables all the permission variables below
  4405. (except for 'insert-fast-tracepoints'), plus enables non-stop
  4406. debugging. Setting this to 'off' switches back to normal
  4407. debugging, though remaining in non-stop mode.
  4408. 'show observer'
  4409. Show whether observer mode is on or off.
  4410. 'set may-write-registers on'
  4411. 'set may-write-registers off'
  4412. This controls whether GDB will attempt to alter the values of
  4413. registers, such as with assignment expressions in 'print', or the
  4414. 'jump' command. It defaults to 'on'.
  4415. 'show may-write-registers'
  4416. Show the current permission to write registers.
  4417. 'set may-write-memory on'
  4418. 'set may-write-memory off'
  4419. This controls whether GDB will attempt to alter the contents of
  4420. memory, such as with assignment expressions in 'print'. It
  4421. defaults to 'on'.
  4422. 'show may-write-memory'
  4423. Show the current permission to write memory.
  4424. 'set may-insert-breakpoints on'
  4425. 'set may-insert-breakpoints off'
  4426. This controls whether GDB will attempt to insert breakpoints. This
  4427. affects all breakpoints, including internal breakpoints defined by
  4428. GDB. It defaults to 'on'.
  4429. 'show may-insert-breakpoints'
  4430. Show the current permission to insert breakpoints.
  4431. 'set may-insert-tracepoints on'
  4432. 'set may-insert-tracepoints off'
  4433. This controls whether GDB will attempt to insert (regular)
  4434. tracepoints at the beginning of a tracing experiment. It affects
  4435. only non-fast tracepoints, fast tracepoints being under the control
  4436. of 'may-insert-fast-tracepoints'. It defaults to 'on'.
  4437. 'show may-insert-tracepoints'
  4438. Show the current permission to insert tracepoints.
  4439. 'set may-insert-fast-tracepoints on'
  4440. 'set may-insert-fast-tracepoints off'
  4441. This controls whether GDB will attempt to insert fast tracepoints
  4442. at the beginning of a tracing experiment. It affects only fast
  4443. tracepoints, regular (non-fast) tracepoints being under the control
  4444. of 'may-insert-tracepoints'. It defaults to 'on'.
  4445. 'show may-insert-fast-tracepoints'
  4446. Show the current permission to insert fast tracepoints.
  4447. 'set may-interrupt on'
  4448. 'set may-interrupt off'
  4449. This controls whether GDB will attempt to interrupt or stop program
  4450. execution. When this variable is 'off', the 'interrupt' command
  4451. will have no effect, nor will 'Ctrl-c'. It defaults to 'on'.
  4452. 'show may-interrupt'
  4453. Show the current permission to interrupt or stop the program.
  4454. 
  4455. File: gdb.info, Node: Reverse Execution, Next: Process Record and Replay, Prev: Stopping, Up: Top
  4456. 6 Running programs backward
  4457. ***************************
  4458. When you are debugging a program, it is not unusual to realize that you
  4459. have gone too far, and some event of interest has already happened. If
  4460. the target environment supports it, GDB can allow you to "rewind" the
  4461. program by running it backward.
  4462. A target environment that supports reverse execution should be able
  4463. to "undo" the changes in machine state that have taken place as the
  4464. program was executing normally. Variables, registers etc. should revert
  4465. to their previous values. Obviously this requires a great deal of
  4466. sophistication on the part of the target environment; not all target
  4467. environments can support reverse execution.
  4468. When a program is executed in reverse, the instructions that have
  4469. most recently been executed are "un-executed", in reverse order. The
  4470. program counter runs backward, following the previous thread of
  4471. execution in reverse. As each instruction is "un-executed", the values
  4472. of memory and/or registers that were changed by that instruction are
  4473. reverted to their previous states. After executing a piece of source
  4474. code in reverse, all side effects of that code should be "undone", and
  4475. all variables should be returned to their prior values(1).
  4476. If you are debugging in a target environment that supports reverse
  4477. execution, GDB provides the following commands.
  4478. 'reverse-continue [IGNORE-COUNT]'
  4479. 'rc [IGNORE-COUNT]'
  4480. Beginning at the point where your program last stopped, start
  4481. executing in reverse. Reverse execution will stop for breakpoints
  4482. and synchronous exceptions (signals), just like normal execution.
  4483. Behavior of asynchronous signals depends on the target environment.
  4484. 'reverse-step [COUNT]'
  4485. Run the program backward until control reaches the start of a
  4486. different source line; then stop it, and return control to GDB.
  4487. Like the 'step' command, 'reverse-step' will only stop at the
  4488. beginning of a source line. It "un-executes" the previously
  4489. executed source line. If the previous source line included calls
  4490. to debuggable functions, 'reverse-step' will step (backward) into
  4491. the called function, stopping at the beginning of the _last_
  4492. statement in the called function (typically a return statement).
  4493. Also, as with the 'step' command, if non-debuggable functions are
  4494. called, 'reverse-step' will run thru them backward without
  4495. stopping.
  4496. 'reverse-stepi [COUNT]'
  4497. Reverse-execute one machine instruction. Note that the instruction
  4498. to be reverse-executed is _not_ the one pointed to by the program
  4499. counter, but the instruction executed prior to that one. For
  4500. instance, if the last instruction was a jump, 'reverse-stepi' will
  4501. take you back from the destination of the jump to the jump
  4502. instruction itself.
  4503. 'reverse-next [COUNT]'
  4504. Run backward to the beginning of the previous line executed in the
  4505. current (innermost) stack frame. If the line contains function
  4506. calls, they will be "un-executed" without stopping. Starting from
  4507. the first line of a function, 'reverse-next' will take you back to
  4508. the caller of that function, _before_ the function was called, just
  4509. as the normal 'next' command would take you from the last line of a
  4510. function back to its return to its caller (2).
  4511. 'reverse-nexti [COUNT]'
  4512. Like 'nexti', 'reverse-nexti' executes a single instruction in
  4513. reverse, except that called functions are "un-executed" atomically.
  4514. That is, if the previously executed instruction was a return from
  4515. another function, 'reverse-nexti' will continue to execute in
  4516. reverse until the call to that function (from the current stack
  4517. frame) is reached.
  4518. 'reverse-finish'
  4519. Just as the 'finish' command takes you to the point where the
  4520. current function returns, 'reverse-finish' takes you to the point
  4521. where it was called. Instead of ending up at the end of the
  4522. current function invocation, you end up at the beginning.
  4523. 'set exec-direction'
  4524. Set the direction of target execution.
  4525. 'set exec-direction reverse'
  4526. GDB will perform all execution commands in reverse, until the
  4527. exec-direction mode is changed to "forward". Affected commands
  4528. include 'step, stepi, next, nexti, continue, and finish'. The
  4529. 'return' command cannot be used in reverse mode.
  4530. 'set exec-direction forward'
  4531. GDB will perform all execution commands in the normal fashion.
  4532. This is the default.
  4533. ---------- Footnotes ----------
  4534. (1) Note that some side effects are easier to undo than others. For
  4535. instance, memory and registers are relatively easy, but device I/O is
  4536. hard. Some targets may be able undo things like device I/O, and some
  4537. may not.
  4538. The contract between GDB and the reverse executing target requires
  4539. only that the target do something reasonable when GDB tells it to
  4540. execute backwards, and then report the results back to GDB. Whatever
  4541. the target reports back to GDB, GDB will report back to the user. GDB
  4542. assumes that the memory and registers that the target reports are in a
  4543. consistant state, but GDB accepts whatever it is given.
  4544. (2) Unless the code is too heavily optimized.
  4545. 
  4546. File: gdb.info, Node: Process Record and Replay, Next: Stack, Prev: Reverse Execution, Up: Top
  4547. 7 Recording Inferior's Execution and Replaying It
  4548. *************************************************
  4549. On some platforms, GDB provides a special "process record and replay"
  4550. target that can record a log of the process execution, and replay it
  4551. later with both forward and reverse execution commands.
  4552. When this target is in use, if the execution log includes the record
  4553. for the next instruction, GDB will debug in "replay mode". In the
  4554. replay mode, the inferior does not really execute code instructions.
  4555. Instead, all the events that normally happen during code execution are
  4556. taken from the execution log. While code is not really executed in
  4557. replay mode, the values of registers (including the program counter
  4558. register) and the memory of the inferior are still changed as they
  4559. normally would. Their contents are taken from the execution log.
  4560. If the record for the next instruction is not in the execution log,
  4561. GDB will debug in "record mode". In this mode, the inferior executes
  4562. normally, and GDB records the execution log for future replay.
  4563. The process record and replay target supports reverse execution
  4564. (*note Reverse Execution::), even if the platform on which the inferior
  4565. runs does not. However, the reverse execution is limited in this case
  4566. by the range of the instructions recorded in the execution log. In
  4567. other words, reverse execution on platforms that don't support it
  4568. directly can only be done in the replay mode.
  4569. When debugging in the reverse direction, GDB will work in replay mode
  4570. as long as the execution log includes the record for the previous
  4571. instruction; otherwise, it will work in record mode, if the platform
  4572. supports reverse execution, or stop if not.
  4573. For architecture environments that support process record and replay,
  4574. GDB provides the following commands:
  4575. 'record METHOD'
  4576. This command starts the process record and replay target. The
  4577. recording method can be specified as parameter. Without a
  4578. parameter the command uses the 'full' recording method. The
  4579. following recording methods are available:
  4580. 'full'
  4581. Full record/replay recording using GDB's software record and
  4582. replay implementation. This method allows replaying and
  4583. reverse execution.
  4584. 'btrace FORMAT'
  4585. Hardware-supported instruction recording. This method does
  4586. not record data. Further, the data is collected in a ring
  4587. buffer so old data will be overwritten when the buffer is
  4588. full. It allows limited reverse execution. Variables and
  4589. registers are not available during reverse execution. In
  4590. remote debugging, recording continues on disconnect. Recorded
  4591. data can be inspected after reconnecting. The recording may
  4592. be stopped using 'record stop'.
  4593. The recording format can be specified as parameter. Without a
  4594. parameter the command chooses the recording format. The
  4595. following recording formats are available:
  4596. 'bts'
  4597. Use the "Branch Trace Store" (BTS) recording format. In
  4598. this format, the processor stores a from/to record for
  4599. each executed branch in the btrace ring buffer.
  4600. 'pt'
  4601. Use the "Intel Processor Trace" recording format. In
  4602. this format, the processor stores the execution trace in
  4603. a compressed form that is afterwards decoded by GDB.
  4604. The trace can be recorded with very low overhead. The
  4605. compressed trace format also allows small trace buffers
  4606. to already contain a big number of instructions compared
  4607. to BTS.
  4608. Decoding the recorded execution trace, on the other hand,
  4609. is more expensive than decoding BTS trace. This is
  4610. mostly due to the increased number of instructions to
  4611. process. You should increase the buffer-size with care.
  4612. Not all recording formats may be available on all processors.
  4613. The process record and replay target can only debug a process that
  4614. is already running. Therefore, you need first to start the process
  4615. with the 'run' or 'start' commands, and then start the recording
  4616. with the 'record METHOD' command.
  4617. Displaced stepping (*note displaced stepping: Maintenance
  4618. Commands.) will be automatically disabled when process record and
  4619. replay target is started. That's because the process record and
  4620. replay target doesn't support displaced stepping.
  4621. If the inferior is in the non-stop mode (*note Non-Stop Mode::) or
  4622. in the asynchronous execution mode (*note Background Execution::),
  4623. not all recording methods are available. The 'full' recording
  4624. method does not support these two modes.
  4625. 'record stop'
  4626. Stop the process record and replay target. When process record and
  4627. replay target stops, the entire execution log will be deleted and
  4628. the inferior will either be terminated, or will remain in its final
  4629. state.
  4630. When you stop the process record and replay target in record mode
  4631. (at the end of the execution log), the inferior will be stopped at
  4632. the next instruction that would have been recorded. In other
  4633. words, if you record for a while and then stop recording, the
  4634. inferior process will be left in the same state as if the recording
  4635. never happened.
  4636. On the other hand, if the process record and replay target is
  4637. stopped while in replay mode (that is, not at the end of the
  4638. execution log, but at some earlier point), the inferior process
  4639. will become "live" at that earlier state, and it will then be
  4640. possible to continue the usual "live" debugging of the process from
  4641. that state.
  4642. When the inferior process exits, or GDB detaches from it, process
  4643. record and replay target will automatically stop itself.
  4644. 'record goto'
  4645. Go to a specific location in the execution log. There are several
  4646. ways to specify the location to go to:
  4647. 'record goto begin'
  4648. 'record goto start'
  4649. Go to the beginning of the execution log.
  4650. 'record goto end'
  4651. Go to the end of the execution log.
  4652. 'record goto N'
  4653. Go to instruction number N in the execution log.
  4654. 'record save FILENAME'
  4655. Save the execution log to a file 'FILENAME'. Default filename is
  4656. 'gdb_record.PROCESS_ID', where PROCESS_ID is the process ID of the
  4657. inferior.
  4658. This command may not be available for all recording methods.
  4659. 'record restore FILENAME'
  4660. Restore the execution log from a file 'FILENAME'. File must have
  4661. been created with 'record save'.
  4662. 'set record full insn-number-max LIMIT'
  4663. 'set record full insn-number-max unlimited'
  4664. Set the limit of instructions to be recorded for the 'full'
  4665. recording method. Default value is 200000.
  4666. If LIMIT is a positive number, then GDB will start deleting
  4667. instructions from the log once the number of the record
  4668. instructions becomes greater than LIMIT. For every new recorded
  4669. instruction, GDB will delete the earliest recorded instruction to
  4670. keep the number of recorded instructions at the limit. (Since
  4671. deleting recorded instructions loses information, GDB lets you
  4672. control what happens when the limit is reached, by means of the
  4673. 'stop-at-limit' option, described below.)
  4674. If LIMIT is 'unlimited' or zero, GDB will never delete recorded
  4675. instructions from the execution log. The number of recorded
  4676. instructions is limited only by the available memory.
  4677. 'show record full insn-number-max'
  4678. Show the limit of instructions to be recorded with the 'full'
  4679. recording method.
  4680. 'set record full stop-at-limit'
  4681. Control the behavior of the 'full' recording method when the number
  4682. of recorded instructions reaches the limit. If ON (the default),
  4683. GDB will stop when the limit is reached for the first time and ask
  4684. you whether you want to stop the inferior or continue running it
  4685. and recording the execution log. If you decide to continue
  4686. recording, each new recorded instruction will cause the oldest one
  4687. to be deleted.
  4688. If this option is OFF, GDB will automatically delete the oldest
  4689. record to make room for each new one, without asking.
  4690. 'show record full stop-at-limit'
  4691. Show the current setting of 'stop-at-limit'.
  4692. 'set record full memory-query'
  4693. Control the behavior when GDB is unable to record memory changes
  4694. caused by an instruction for the 'full' recording method. If ON,
  4695. GDB will query whether to stop the inferior in that case.
  4696. If this option is OFF (the default), GDB will automatically ignore
  4697. the effect of such instructions on memory. Later, when GDB replays
  4698. this execution log, it will mark the log of this instruction as not
  4699. accessible, and it will not affect the replay results.
  4700. 'show record full memory-query'
  4701. Show the current setting of 'memory-query'.
  4702. The 'btrace' record target does not trace data. As a convenience,
  4703. when replaying, GDB reads read-only memory off the live program
  4704. directly, assuming that the addresses of the read-only areas don't
  4705. change. This for example makes it possible to disassemble code
  4706. while replaying, but not to print variables. In some cases, being
  4707. able to inspect variables might be useful. You can use the
  4708. following command for that:
  4709. 'set record btrace replay-memory-access'
  4710. Control the behavior of the 'btrace' recording method when
  4711. accessing memory during replay. If 'read-only' (the default), GDB
  4712. will only allow accesses to read-only memory. If 'read-write', GDB
  4713. will allow accesses to read-only and to read-write memory. Beware
  4714. that the accessed memory corresponds to the live target and not
  4715. necessarily to the current replay position.
  4716. 'set record btrace cpu IDENTIFIER'
  4717. Set the processor to be used for enabling workarounds for processor
  4718. errata when decoding the trace.
  4719. Processor errata are defects in processor operation, caused by its
  4720. design or manufacture. They can cause a trace not to match the
  4721. specification. This, in turn, may cause trace decode to fail. GDB
  4722. can detect erroneous trace packets and correct them, thus avoiding
  4723. the decoding failures. These corrections are known as "errata
  4724. workarounds", and are enabled based on the processor on which the
  4725. trace was recorded.
  4726. By default, GDB attempts to detect the processor automatically, and
  4727. apply the necessary workarounds for it. However, you may need to
  4728. specify the processor if GDB does not yet support it. This command
  4729. allows you to do that, and also allows to disable the workarounds.
  4730. The argument IDENTIFIER identifies the CPU and is of the form:
  4731. 'VENDOR:PROCESOR IDENTIFIER'. In addition, there are two special
  4732. identifiers, 'none' and 'auto' (default).
  4733. The following vendor identifiers and corresponding processor
  4734. identifiers are currently supported:
  4735. 'intel' FAMILY/MODEL[/STEPPING]
  4736. On GNU/Linux systems, the processor FAMILY, MODEL, and STEPPING can
  4737. be obtained from '/proc/cpuinfo'.
  4738. If IDENTIFIER is 'auto', enable errata workarounds for the
  4739. processor on which the trace was recorded. If IDENTIFIER is
  4740. 'none', errata workarounds are disabled.
  4741. For example, when using an old GDB on a new system, decode may fail
  4742. because GDB does not support the new processor. It often suffices
  4743. to specify an older processor that GDB supports.
  4744. (gdb) info record
  4745. Active record target: record-btrace
  4746. Recording format: Intel Processor Trace.
  4747. Buffer size: 16kB.
  4748. Failed to configure the Intel Processor Trace decoder: unknown cpu.
  4749. (gdb) set record btrace cpu intel:6/158
  4750. (gdb) info record
  4751. Active record target: record-btrace
  4752. Recording format: Intel Processor Trace.
  4753. Buffer size: 16kB.
  4754. Recorded 84872 instructions in 3189 functions (0 gaps) for thread 1 (...).
  4755. 'show record btrace replay-memory-access'
  4756. Show the current setting of 'replay-memory-access'.
  4757. 'show record btrace cpu'
  4758. Show the processor to be used for enabling trace decode errata
  4759. workarounds.
  4760. 'set record btrace bts buffer-size SIZE'
  4761. 'set record btrace bts buffer-size unlimited'
  4762. Set the requested ring buffer size for branch tracing in BTS
  4763. format. Default is 64KB.
  4764. If SIZE is a positive number, then GDB will try to allocate a
  4765. buffer of at least SIZE bytes for each new thread that uses the
  4766. btrace recording method and the BTS format. The actually obtained
  4767. buffer size may differ from the requested SIZE. Use the 'info
  4768. record' command to see the actual buffer size for each thread that
  4769. uses the btrace recording method and the BTS format.
  4770. If LIMIT is 'unlimited' or zero, GDB will try to allocate a buffer
  4771. of 4MB.
  4772. Bigger buffers mean longer traces. On the other hand, GDB will
  4773. also need longer to process the branch trace data before it can be
  4774. used.
  4775. 'show record btrace bts buffer-size SIZE'
  4776. Show the current setting of the requested ring buffer size for
  4777. branch tracing in BTS format.
  4778. 'set record btrace pt buffer-size SIZE'
  4779. 'set record btrace pt buffer-size unlimited'
  4780. Set the requested ring buffer size for branch tracing in Intel
  4781. Processor Trace format. Default is 16KB.
  4782. If SIZE is a positive number, then GDB will try to allocate a
  4783. buffer of at least SIZE bytes for each new thread that uses the
  4784. btrace recording method and the Intel Processor Trace format. The
  4785. actually obtained buffer size may differ from the requested SIZE.
  4786. Use the 'info record' command to see the actual buffer size for
  4787. each thread.
  4788. If LIMIT is 'unlimited' or zero, GDB will try to allocate a buffer
  4789. of 4MB.
  4790. Bigger buffers mean longer traces. On the other hand, GDB will
  4791. also need longer to process the branch trace data before it can be
  4792. used.
  4793. 'show record btrace pt buffer-size SIZE'
  4794. Show the current setting of the requested ring buffer size for
  4795. branch tracing in Intel Processor Trace format.
  4796. 'info record'
  4797. Show various statistics about the recording depending on the
  4798. recording method:
  4799. 'full'
  4800. For the 'full' recording method, it shows the state of process
  4801. record and its in-memory execution log buffer, including:
  4802. * Whether in record mode or replay mode.
  4803. * Lowest recorded instruction number (counting from when
  4804. the current execution log started recording
  4805. instructions).
  4806. * Highest recorded instruction number.
  4807. * Current instruction about to be replayed (if in replay
  4808. mode).
  4809. * Number of instructions contained in the execution log.
  4810. * Maximum number of instructions that may be contained in
  4811. the execution log.
  4812. 'btrace'
  4813. For the 'btrace' recording method, it shows:
  4814. * Recording format.
  4815. * Number of instructions that have been recorded.
  4816. * Number of blocks of sequential control-flow formed by the
  4817. recorded instructions.
  4818. * Whether in record mode or replay mode.
  4819. For the 'bts' recording format, it also shows:
  4820. * Size of the perf ring buffer.
  4821. For the 'pt' recording format, it also shows:
  4822. * Size of the perf ring buffer.
  4823. 'record delete'
  4824. When record target runs in replay mode ("in the past"), delete the
  4825. subsequent execution log and begin to record a new execution log
  4826. starting from the current address. This means you will abandon the
  4827. previously recorded "future" and begin recording a new "future".
  4828. 'record instruction-history'
  4829. Disassembles instructions from the recorded execution log. By
  4830. default, ten instructions are disassembled. This can be changed
  4831. using the 'set record instruction-history-size' command.
  4832. Instructions are printed in execution order.
  4833. It can also print mixed source+disassembly if you specify the the
  4834. '/m' or '/s' modifier, and print the raw instructions in hex as
  4835. well as in symbolic form by specifying the '/r' modifier.
  4836. The current position marker is printed for the instruction at the
  4837. current program counter value. This instruction can appear
  4838. multiple times in the trace and the current position marker will be
  4839. printed every time. To omit the current position marker, specify
  4840. the '/p' modifier.
  4841. To better align the printed instructions when the trace contains
  4842. instructions from more than one function, the function name may be
  4843. omitted by specifying the '/f' modifier.
  4844. Speculatively executed instructions are prefixed with '?'. This
  4845. feature is not available for all recording formats.
  4846. There are several ways to specify what part of the execution log to
  4847. disassemble:
  4848. 'record instruction-history INSN'
  4849. Disassembles ten instructions starting from instruction number
  4850. INSN.
  4851. 'record instruction-history INSN, +/-N'
  4852. Disassembles N instructions around instruction number INSN.
  4853. If N is preceded with '+', disassembles N instructions after
  4854. instruction number INSN. If N is preceded with '-',
  4855. disassembles N instructions before instruction number INSN.
  4856. 'record instruction-history'
  4857. Disassembles ten more instructions after the last disassembly.
  4858. 'record instruction-history -'
  4859. Disassembles ten more instructions before the last
  4860. disassembly.
  4861. 'record instruction-history BEGIN, END'
  4862. Disassembles instructions beginning with instruction number
  4863. BEGIN until instruction number END. The instruction number
  4864. END is included.
  4865. This command may not be available for all recording methods.
  4866. 'set record instruction-history-size SIZE'
  4867. 'set record instruction-history-size unlimited'
  4868. Define how many instructions to disassemble in the 'record
  4869. instruction-history' command. The default value is 10. A SIZE of
  4870. 'unlimited' means unlimited instructions.
  4871. 'show record instruction-history-size'
  4872. Show how many instructions to disassemble in the 'record
  4873. instruction-history' command.
  4874. 'record function-call-history'
  4875. Prints the execution history at function granularity. It prints
  4876. one line for each sequence of instructions that belong to the same
  4877. function giving the name of that function, the source lines for
  4878. this instruction sequence (if the '/l' modifier is specified), and
  4879. the instructions numbers that form the sequence (if the '/i'
  4880. modifier is specified). The function names are indented to reflect
  4881. the call stack depth if the '/c' modifier is specified. The '/l',
  4882. '/i', and '/c' modifiers can be given together.
  4883. (gdb) list 1, 10
  4884. 1 void foo (void)
  4885. 2 {
  4886. 3 }
  4887. 4
  4888. 5 void bar (void)
  4889. 6 {
  4890. 7 ...
  4891. 8 foo ();
  4892. 9 ...
  4893. 10 }
  4894. (gdb) record function-call-history /ilc
  4895. 1 bar inst 1,4 at foo.c:6,8
  4896. 2 foo inst 5,10 at foo.c:2,3
  4897. 3 bar inst 11,13 at foo.c:9,10
  4898. By default, ten lines are printed. This can be changed using the
  4899. 'set record function-call-history-size' command. Functions are
  4900. printed in execution order. There are several ways to specify what
  4901. to print:
  4902. 'record function-call-history FUNC'
  4903. Prints ten functions starting from function number FUNC.
  4904. 'record function-call-history FUNC, +/-N'
  4905. Prints N functions around function number FUNC. If N is
  4906. preceded with '+', prints N functions after function number
  4907. FUNC. If N is preceded with '-', prints N functions before
  4908. function number FUNC.
  4909. 'record function-call-history'
  4910. Prints ten more functions after the last ten-line print.
  4911. 'record function-call-history -'
  4912. Prints ten more functions before the last ten-line print.
  4913. 'record function-call-history BEGIN, END'
  4914. Prints functions beginning with function number BEGIN until
  4915. function number END. The function number END is included.
  4916. This command may not be available for all recording methods.
  4917. 'set record function-call-history-size SIZE'
  4918. 'set record function-call-history-size unlimited'
  4919. Define how many lines to print in the 'record
  4920. function-call-history' command. The default value is 10. A size
  4921. of 'unlimited' means unlimited lines.
  4922. 'show record function-call-history-size'
  4923. Show how many lines to print in the 'record function-call-history'
  4924. command.
  4925. 
  4926. File: gdb.info, Node: Stack, Next: Source, Prev: Process Record and Replay, Up: Top
  4927. 8 Examining the Stack
  4928. *********************
  4929. When your program has stopped, the first thing you need to know is where
  4930. it stopped and how it got there.
  4931. Each time your program performs a function call, information about
  4932. the call is generated. That information includes the location of the
  4933. call in your program, the arguments of the call, and the local variables
  4934. of the function being called. The information is saved in a block of
  4935. data called a "stack frame". The stack frames are allocated in a region
  4936. of memory called the "call stack".
  4937. When your program stops, the GDB commands for examining the stack
  4938. allow you to see all of this information.
  4939. One of the stack frames is "selected" by GDB and many GDB commands
  4940. refer implicitly to the selected frame. In particular, whenever you ask
  4941. GDB for the value of a variable in your program, the value is found in
  4942. the selected frame. There are special GDB commands to select whichever
  4943. frame you are interested in. *Note Selecting a Frame: Selection.
  4944. When your program stops, GDB automatically selects the currently
  4945. executing frame and describes it briefly, similar to the 'frame' command
  4946. (*note Information about a Frame: Frame Info.).
  4947. * Menu:
  4948. * Frames:: Stack frames
  4949. * Backtrace:: Backtraces
  4950. * Selection:: Selecting a frame
  4951. * Frame Info:: Information on a frame
  4952. * Frame Apply:: Applying a command to several frames
  4953. * Frame Filter Management:: Managing frame filters
  4954. 
  4955. File: gdb.info, Node: Frames, Next: Backtrace, Up: Stack
  4956. 8.1 Stack Frames
  4957. ================
  4958. The call stack is divided up into contiguous pieces called "stack
  4959. frames", or "frames" for short; each frame is the data associated with
  4960. one call to one function. The frame contains the arguments given to the
  4961. function, the function's local variables, and the address at which the
  4962. function is executing.
  4963. When your program is started, the stack has only one frame, that of
  4964. the function 'main'. This is called the "initial" frame or the
  4965. "outermost" frame. Each time a function is called, a new frame is made.
  4966. Each time a function returns, the frame for that function invocation is
  4967. eliminated. If a function is recursive, there can be many frames for
  4968. the same function. The frame for the function in which execution is
  4969. actually occurring is called the "innermost" frame. This is the most
  4970. recently created of all the stack frames that still exist.
  4971. Inside your program, stack frames are identified by their addresses.
  4972. A stack frame consists of many bytes, each of which has its own address;
  4973. each kind of computer has a convention for choosing one byte whose
  4974. address serves as the address of the frame. Usually this address is
  4975. kept in a register called the "frame pointer register" (*note $fp:
  4976. Registers.) while execution is going on in that frame.
  4977. GDB labels each existing stack frame with a "level", a number that is
  4978. zero for the innermost frame, one for the frame that called it, and so
  4979. on upward. These level numbers give you a way of designating stack
  4980. frames in GDB commands. The terms "frame number" and "frame level" can
  4981. be used interchangeably to describe this number.
  4982. Some compilers provide a way to compile functions so that they
  4983. operate without stack frames. (For example, the GCC option
  4984. '-fomit-frame-pointer'
  4985. generates functions without a frame.) This is occasionally done with
  4986. heavily used library functions to save the frame setup time. GDB has
  4987. limited facilities for dealing with these function invocations. If the
  4988. innermost function invocation has no stack frame, GDB nevertheless
  4989. regards it as though it had a separate frame, which is numbered zero as
  4990. usual, allowing correct tracing of the function call chain. However,
  4991. GDB has no provision for frameless functions elsewhere in the stack.
  4992. 
  4993. File: gdb.info, Node: Backtrace, Next: Selection, Prev: Frames, Up: Stack
  4994. 8.2 Backtraces
  4995. ==============
  4996. A backtrace is a summary of how your program got where it is. It shows
  4997. one line per frame, for many frames, starting with the currently
  4998. executing frame (frame zero), followed by its caller (frame one), and on
  4999. up the stack.
  5000. To print a backtrace of the entire stack, use the 'backtrace'
  5001. command, or its alias 'bt'. This command will print one line per frame
  5002. for frames in the stack. By default, all stack frames are printed. You
  5003. can stop the backtrace at any time by typing the system interrupt
  5004. character, normally 'Ctrl-c'.
  5005. 'backtrace [ARGS...]'
  5006. 'bt [ARGS...]'
  5007. Print the backtrace of the entire stack. The optional ARGS can be
  5008. one of the following:
  5009. 'N'
  5010. 'N'
  5011. Print only the innermost N frames, where N is a positive
  5012. number.
  5013. '-N'
  5014. '-N'
  5015. Print only the outermost N frames, where N is a positive
  5016. number.
  5017. 'full'
  5018. Print the values of the local variables also. This can be
  5019. combined with a number to limit the number of frames shown.
  5020. 'no-filters'
  5021. Do not run Python frame filters on this backtrace. *Note
  5022. Frame Filter API::, for more information. Additionally use
  5023. *note disable frame-filter all:: to turn off all frame
  5024. filters. This is only relevant when GDB has been configured
  5025. with 'Python' support.
  5026. 'hide'
  5027. A Python frame filter might decide to "elide" some frames.
  5028. Normally such elided frames are still printed, but they are
  5029. indented relative to the filtered frames that cause them to be
  5030. elided. The 'hide' option causes elided frames to not be
  5031. printed at all.
  5032. The names 'where' and 'info stack' (abbreviated 'info s') are
  5033. additional aliases for 'backtrace'.
  5034. In a multi-threaded program, GDB by default shows the backtrace only
  5035. for the current thread. To display the backtrace for several or all of
  5036. the threads, use the command 'thread apply' (*note thread apply:
  5037. Threads.). For example, if you type 'thread apply all backtrace', GDB
  5038. will display the backtrace for all the threads; this is handy when you
  5039. debug a core dump of a multi-threaded program.
  5040. Each line in the backtrace shows the frame number and the function
  5041. name. The program counter value is also shown--unless you use 'set
  5042. print address off'. The backtrace also shows the source file name and
  5043. line number, as well as the arguments to the function. The program
  5044. counter value is omitted if it is at the beginning of the code for that
  5045. line number.
  5046. Here is an example of a backtrace. It was made with the command 'bt
  5047. 3', so it shows the innermost three frames.
  5048. #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
  5049. at builtin.c:993
  5050. #1 0x6e38 in expand_macro (sym=0x2b600, data=...) at macro.c:242
  5051. #2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
  5052. at macro.c:71
  5053. (More stack frames follow...)
  5054. The display for frame zero does not begin with a program counter value,
  5055. indicating that your program has stopped at the beginning of the code
  5056. for line '993' of 'builtin.c'.
  5057. The value of parameter 'data' in frame 1 has been replaced by '...'. By
  5058. default, GDB prints the value of a parameter only if it is a scalar
  5059. (integer, pointer, enumeration, etc). See command 'set print
  5060. frame-arguments' in *note Print Settings:: for more details on how to
  5061. configure the way function parameter values are printed.
  5062. If your program was compiled with optimizations, some compilers will
  5063. optimize away arguments passed to functions if those arguments are never
  5064. used after the call. Such optimizations generate code that passes
  5065. arguments through registers, but doesn't store those arguments in the
  5066. stack frame. GDB has no way of displaying such arguments in stack
  5067. frames other than the innermost one. Here's what such a backtrace might
  5068. look like:
  5069. #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
  5070. at builtin.c:993
  5071. #1 0x6e38 in expand_macro (sym=<optimized out>) at macro.c:242
  5072. #2 0x6840 in expand_token (obs=0x0, t=<optimized out>, td=0xf7fffb08)
  5073. at macro.c:71
  5074. (More stack frames follow...)
  5075. The values of arguments that were not saved in their stack frames are
  5076. shown as '<optimized out>'.
  5077. If you need to display the values of such optimized-out arguments,
  5078. either deduce that from other variables whose values depend on the one
  5079. you are interested in, or recompile without optimizations.
  5080. Most programs have a standard user entry point--a place where system
  5081. libraries and startup code transition into user code. For C this is
  5082. 'main'(1). When GDB finds the entry function in a backtrace it will
  5083. terminate the backtrace, to avoid tracing into highly system-specific
  5084. (and generally uninteresting) code.
  5085. If you need to examine the startup code, or limit the number of
  5086. levels in a backtrace, you can change this behavior:
  5087. 'set backtrace past-main'
  5088. 'set backtrace past-main on'
  5089. Backtraces will continue past the user entry point.
  5090. 'set backtrace past-main off'
  5091. Backtraces will stop when they encounter the user entry point.
  5092. This is the default.
  5093. 'show backtrace past-main'
  5094. Display the current user entry point backtrace policy.
  5095. 'set backtrace past-entry'
  5096. 'set backtrace past-entry on'
  5097. Backtraces will continue past the internal entry point of an
  5098. application. This entry point is encoded by the linker when the
  5099. application is built, and is likely before the user entry point
  5100. 'main' (or equivalent) is called.
  5101. 'set backtrace past-entry off'
  5102. Backtraces will stop when they encounter the internal entry point
  5103. of an application. This is the default.
  5104. 'show backtrace past-entry'
  5105. Display the current internal entry point backtrace policy.
  5106. 'set backtrace limit N'
  5107. 'set backtrace limit 0'
  5108. 'set backtrace limit unlimited'
  5109. Limit the backtrace to N levels. A value of 'unlimited' or zero
  5110. means unlimited levels.
  5111. 'show backtrace limit'
  5112. Display the current limit on backtrace levels.
  5113. You can control how file names are displayed.
  5114. 'set filename-display'
  5115. 'set filename-display relative'
  5116. Display file names relative to the compilation directory. This is
  5117. the default.
  5118. 'set filename-display basename'
  5119. Display only basename of a filename.
  5120. 'set filename-display absolute'
  5121. Display an absolute filename.
  5122. 'show filename-display'
  5123. Show the current way to display filenames.
  5124. ---------- Footnotes ----------
  5125. (1) Note that embedded programs (the so-called "free-standing"
  5126. environment) are not required to have a 'main' function as the entry
  5127. point. They could even have multiple entry points.
  5128. 
  5129. File: gdb.info, Node: Selection, Next: Frame Info, Prev: Backtrace, Up: Stack
  5130. 8.3 Selecting a Frame
  5131. =====================
  5132. Most commands for examining the stack and other data in your program
  5133. work on whichever stack frame is selected at the moment. Here are the
  5134. commands for selecting a stack frame; all of them finish by printing a
  5135. brief description of the stack frame just selected.
  5136. 'frame [ FRAME-SELECTION-SPEC ]'
  5137. 'f [ FRAME-SELECTION-SPEC ]'
  5138. The 'frame' command allows different stack frames to be selected.
  5139. The FRAME-SELECTION-SPEC can be any of the following:
  5140. 'NUM'
  5141. 'level NUM'
  5142. Select frame level NUM. Recall that frame zero is the
  5143. innermost (currently executing) frame, frame one is the frame
  5144. that called the innermost one, and so on. The highest level
  5145. frame is usually the one for 'main'.
  5146. As this is the most common method of navigating the frame
  5147. stack, the string 'level' can be omitted. For example, the
  5148. following two commands are equivalent:
  5149. (gdb) frame 3
  5150. (gdb) frame level 3
  5151. 'address STACK-ADDRESS'
  5152. Select the frame with stack address STACK-ADDRESS. The
  5153. STACK-ADDRESS for a frame can be seen in the output of 'info
  5154. frame', for example:
  5155. (gdb) info frame
  5156. Stack level 1, frame at 0x7fffffffda30:
  5157. rip = 0x40066d in b (amd64-entry-value.cc:59); saved rip 0x4004c5
  5158. tail call frame, caller of frame at 0x7fffffffda30
  5159. source language c++.
  5160. Arglist at unknown address.
  5161. Locals at unknown address, Previous frame's sp is 0x7fffffffda30
  5162. The STACK-ADDRESS for this frame is '0x7fffffffda30' as
  5163. indicated by the line:
  5164. Stack level 1, frame at 0x7fffffffda30:
  5165. 'function FUNCTION-NAME'
  5166. Select the stack frame for function FUNCTION-NAME. If there
  5167. are multiple stack frames for function FUNCTION-NAME then the
  5168. inner most stack frame is selected.
  5169. 'view STACK-ADDRESS [ PC-ADDR ]'
  5170. View a frame that is not part of GDB's backtrace. The frame
  5171. viewed has stack address STACK-ADDR, and optionally, a program
  5172. counter address of PC-ADDR.
  5173. This is useful mainly if the chaining of stack frames has been
  5174. damaged by a bug, making it impossible for GDB to assign
  5175. numbers properly to all frames. In addition, this can be
  5176. useful when your program has multiple stacks and switches
  5177. between them.
  5178. When viewing a frame outside the current backtrace using
  5179. 'frame view' then you can always return to the original stack
  5180. using one of the previous stack frame selection instructions,
  5181. for example 'frame level 0'.
  5182. 'up N'
  5183. Move N frames up the stack; N defaults to 1. For positive numbers
  5184. N, this advances toward the outermost frame, to higher frame
  5185. numbers, to frames that have existed longer.
  5186. 'down N'
  5187. Move N frames down the stack; N defaults to 1. For positive
  5188. numbers N, this advances toward the innermost frame, to lower frame
  5189. numbers, to frames that were created more recently. You may
  5190. abbreviate 'down' as 'do'.
  5191. All of these commands end by printing two lines of output describing
  5192. the frame. The first line shows the frame number, the function name,
  5193. the arguments, and the source file and line number of execution in that
  5194. frame. The second line shows the text of that source line.
  5195. For example:
  5196. (gdb) up
  5197. #1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc)
  5198. at env.c:10
  5199. 10 read_input_file (argv[i]);
  5200. After such a printout, the 'list' command with no arguments prints
  5201. ten lines centered on the point of execution in the frame. You can also
  5202. edit the program at the point of execution with your favorite editing
  5203. program by typing 'edit'. *Note Printing Source Lines: List, for
  5204. details.
  5205. 'select-frame [ FRAME-SELECTION-SPEC ]'
  5206. The 'select-frame' command is a variant of 'frame' that does not
  5207. display the new frame after selecting it. This command is intended
  5208. primarily for use in GDB command scripts, where the output might be
  5209. unnecessary and distracting. The FRAME-SELECTION-SPEC is as for
  5210. the 'frame' command described in *note Selecting a Frame:
  5211. Selection.
  5212. 'up-silently N'
  5213. 'down-silently N'
  5214. These two commands are variants of 'up' and 'down', respectively;
  5215. they differ in that they do their work silently, without causing
  5216. display of the new frame. They are intended primarily for use in
  5217. GDB command scripts, where the output might be unnecessary and
  5218. distracting.
  5219. 
  5220. File: gdb.info, Node: Frame Info, Next: Frame Apply, Prev: Selection, Up: Stack
  5221. 8.4 Information About a Frame
  5222. =============================
  5223. There are several other commands to print information about the selected
  5224. stack frame.
  5225. 'frame'
  5226. 'f'
  5227. When used without any argument, this command does not change which
  5228. frame is selected, but prints a brief description of the currently
  5229. selected stack frame. It can be abbreviated 'f'. With an
  5230. argument, this command is used to select a stack frame. *Note
  5231. Selecting a Frame: Selection.
  5232. 'info frame'
  5233. 'info f'
  5234. This command prints a verbose description of the selected stack
  5235. frame, including:
  5236. * the address of the frame
  5237. * the address of the next frame down (called by this frame)
  5238. * the address of the next frame up (caller of this frame)
  5239. * the language in which the source code corresponding to this
  5240. frame is written
  5241. * the address of the frame's arguments
  5242. * the address of the frame's local variables
  5243. * the program counter saved in it (the address of execution in
  5244. the caller frame)
  5245. * which registers were saved in the frame
  5246. The verbose description is useful when something has gone wrong
  5247. that has made the stack format fail to fit the usual conventions.
  5248. 'info frame [ FRAME-SELECTION-SPEC ]'
  5249. 'info f [ FRAME-SELECTION-SPEC ]'
  5250. Print a verbose description of the frame selected by
  5251. FRAME-SELECTION-SPEC. The FRAME-SELECTION-SPEC is the same as for
  5252. the 'frame' command (*note Selecting a Frame: Selection.). The
  5253. selected frame remains unchanged by this command.
  5254. 'info args [-q]'
  5255. Print the arguments of the selected frame, each on a separate line.
  5256. The optional flag '-q', which stands for 'quiet', disables printing
  5257. header information and messages explaining why no argument have
  5258. been printed.
  5259. 'info args [-q] [-t TYPE_REGEXP] [REGEXP]'
  5260. Like 'info args', but only print the arguments selected with the
  5261. provided regexp(s).
  5262. If REGEXP is provided, print only the arguments whose names match
  5263. the regular expression REGEXP.
  5264. If TYPE_REGEXP is provided, print only the arguments whose types,
  5265. as printed by the 'whatis' command, match the regular expression
  5266. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  5267. enclosed in quote characters. If needed, use backslash to escape
  5268. the meaning of special characters or quotes.
  5269. If both REGEXP and TYPE_REGEXP are provided, an argument is printed
  5270. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  5271. 'info locals [-q]'
  5272. Print the local variables of the selected frame, each on a separate
  5273. line. These are all variables (declared either static or
  5274. automatic) accessible at the point of execution of the selected
  5275. frame.
  5276. The optional flag '-q', which stands for 'quiet', disables printing
  5277. header information and messages explaining why no local variables
  5278. have been printed.
  5279. 'info locals [-q] [-t TYPE_REGEXP] [REGEXP]'
  5280. Like 'info locals', but only print the local variables selected
  5281. with the provided regexp(s).
  5282. If REGEXP is provided, print only the local variables whose names
  5283. match the regular expression REGEXP.
  5284. If TYPE_REGEXP is provided, print only the local variables whose
  5285. types, as printed by the 'whatis' command, match the regular
  5286. expression TYPE_REGEXP. If TYPE_REGEXP contains space(s), it
  5287. should be enclosed in quote characters. If needed, use backslash
  5288. to escape the meaning of special characters or quotes.
  5289. If both REGEXP and TYPE_REGEXP are provided, a local variable is
  5290. printed only if its name matches REGEXP and its type matches
  5291. TYPE_REGEXP.
  5292. The command 'info locals -q -t TYPE_REGEXP' can usefully be
  5293. combined with the commands 'frame apply' and 'thread apply'. For
  5294. example, your program might use Resource Acquisition Is
  5295. Initialization types (RAII) such as 'lock_something_t': each local
  5296. variable of type 'lock_something_t' automatically places a lock
  5297. that is destroyed when the variable goes out of scope. You can
  5298. then list all acquired locks in your program by doing
  5299. thread apply all -s frame apply all -s info locals -q -t lock_something_t
  5300. or the equivalent shorter form
  5301. tfaas i lo -q -t lock_something_t
  5302. 
  5303. File: gdb.info, Node: Frame Apply, Next: Frame Filter Management, Prev: Frame Info, Up: Stack
  5304. 8.5 Applying a Command to Several Frames.
  5305. =========================================
  5306. 'frame apply [all | COUNT | -COUNT | level LEVEL...] [FLAG]... COMMAND'
  5307. The 'frame apply' command allows you to apply the named COMMAND to
  5308. one or more frames.
  5309. 'all'
  5310. Specify 'all' to apply COMMAND to all frames.
  5311. 'COUNT'
  5312. Use COUNT to apply COMMAND to the innermost COUNT frames,
  5313. where COUNT is a positive number.
  5314. '-COUNT'
  5315. Use -COUNT to apply COMMAND to the outermost COUNT frames,
  5316. where COUNT is a positive number.
  5317. 'level'
  5318. Use 'level' to apply COMMAND to the set of frames identified
  5319. by the LEVEL list. LEVEL is a frame level or a range of frame
  5320. levels as LEVEL1-LEVEL2. The frame level is the number shown
  5321. in the first field of the 'backtrace' command output. E.g.,
  5322. '2-4 6-8 3' indicates to apply COMMAND for the frames at
  5323. levels 2, 3, 4, 6, 7, 8, and then again on frame at level 3.
  5324. Note that the frames on which 'frame apply' applies a command are
  5325. also influenced by the 'set backtrace' settings such as 'set backtrace
  5326. past-main' and 'set backtrace limit N'. See *Note Backtraces:
  5327. Backtrace.
  5328. The FLAG arguments control what output to produce and how to handle
  5329. errors raised when applying COMMAND to a frame. FLAG must start with a
  5330. '-' directly followed by one letter in 'qcs'. If several flags are
  5331. provided, they must be given individually, such as '-c -q'.
  5332. By default, GDB displays some frame information before the output
  5333. produced by COMMAND, and an error raised during the execution of a
  5334. COMMAND will abort 'frame apply'. The following flags can be used to
  5335. fine-tune this behavior:
  5336. '-c'
  5337. The flag '-c', which stands for 'continue', causes any errors in
  5338. COMMAND to be displayed, and the execution of 'frame apply' then
  5339. continues.
  5340. '-s'
  5341. The flag '-s', which stands for 'silent', causes any errors or
  5342. empty output produced by a COMMAND to be silently ignored. That
  5343. is, the execution continues, but the frame information and errors
  5344. are not printed.
  5345. '-q'
  5346. The flag '-q' ('quiet') disables printing the frame information.
  5347. The following example shows how the flags '-c' and '-s' are working
  5348. when applying the command 'p j' to all frames, where variable 'j' can
  5349. only be successfully printed in the outermost '#1 main' frame.
  5350. (gdb) frame apply all p j
  5351. #0 some_function (i=5) at fun.c:4
  5352. No symbol "j" in current context.
  5353. (gdb) frame apply all -c p j
  5354. #0 some_function (i=5) at fun.c:4
  5355. No symbol "j" in current context.
  5356. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5357. $1 = 5
  5358. (gdb) frame apply all -s p j
  5359. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5360. $2 = 5
  5361. (gdb)
  5362. By default, 'frame apply', prints the frame location information
  5363. before the command output:
  5364. (gdb) frame apply all p $sp
  5365. #0 some_function (i=5) at fun.c:4
  5366. $4 = (void *) 0xffffd1e0
  5367. #1 0x565555fb in main (argc=1, argv=0xffffd2c4) at fun.c:11
  5368. $5 = (void *) 0xffffd1f0
  5369. (gdb)
  5370. If flag '-q' is given, no frame information is printed:
  5371. (gdb) frame apply all -q p $sp
  5372. $12 = (void *) 0xffffd1e0
  5373. $13 = (void *) 0xffffd1f0
  5374. (gdb)
  5375. 'faas COMMAND'
  5376. Shortcut for 'frame apply all -s COMMAND'. Applies COMMAND on all
  5377. frames, ignoring errors and empty output.
  5378. It can for example be used to print a local variable or a function
  5379. argument without knowing the frame where this variable or argument
  5380. is, using:
  5381. (gdb) faas p some_local_var_i_do_not_remember_where_it_is
  5382. Note that the command 'tfaas COMMAND' applies COMMAND on all frames
  5383. of all threads. See *Note Threads: Threads.
  5384. 
  5385. File: gdb.info, Node: Frame Filter Management, Prev: Frame Apply, Up: Stack
  5386. 8.6 Management of Frame Filters.
  5387. ================================
  5388. Frame filters are Python based utilities to manage and decorate the
  5389. output of frames. *Note Frame Filter API::, for further information.
  5390. Managing frame filters is performed by several commands available
  5391. within GDB, detailed here.
  5392. 'info frame-filter'
  5393. Print a list of installed frame filters from all dictionaries,
  5394. showing their name, priority and enabled status.
  5395. 'disable frame-filter FILTER-DICTIONARY FILTER-NAME'
  5396. Disable a frame filter in the dictionary matching FILTER-DICTIONARY
  5397. and FILTER-NAME. The FILTER-DICTIONARY may be 'all', 'global',
  5398. 'progspace', or the name of the object file where the frame filter
  5399. dictionary resides. When 'all' is specified, all frame filters
  5400. across all dictionaries are disabled. The FILTER-NAME is the name
  5401. of the frame filter and is used when 'all' is not the option for
  5402. FILTER-DICTIONARY. A disabled frame-filter is not deleted, it may
  5403. be enabled again later.
  5404. 'enable frame-filter FILTER-DICTIONARY FILTER-NAME'
  5405. Enable a frame filter in the dictionary matching FILTER-DICTIONARY
  5406. and FILTER-NAME. The FILTER-DICTIONARY may be 'all', 'global',
  5407. 'progspace' or the name of the object file where the frame filter
  5408. dictionary resides. When 'all' is specified, all frame filters
  5409. across all dictionaries are enabled. The FILTER-NAME is the name
  5410. of the frame filter and is used when 'all' is not the option for
  5411. FILTER-DICTIONARY.
  5412. Example:
  5413. (gdb) info frame-filter
  5414. global frame-filters:
  5415. Priority Enabled Name
  5416. 1000 No PrimaryFunctionFilter
  5417. 100 Yes Reverse
  5418. progspace /build/test frame-filters:
  5419. Priority Enabled Name
  5420. 100 Yes ProgspaceFilter
  5421. objfile /build/test frame-filters:
  5422. Priority Enabled Name
  5423. 999 Yes BuildProgra Filter
  5424. (gdb) disable frame-filter /build/test BuildProgramFilter
  5425. (gdb) info frame-filter
  5426. global frame-filters:
  5427. Priority Enabled Name
  5428. 1000 No PrimaryFunctionFilter
  5429. 100 Yes Reverse
  5430. progspace /build/test frame-filters:
  5431. Priority Enabled Name
  5432. 100 Yes ProgspaceFilter
  5433. objfile /build/test frame-filters:
  5434. Priority Enabled Name
  5435. 999 No BuildProgramFilter
  5436. (gdb) enable frame-filter global PrimaryFunctionFilter
  5437. (gdb) info frame-filter
  5438. global frame-filters:
  5439. Priority Enabled Name
  5440. 1000 Yes PrimaryFunctionFilter
  5441. 100 Yes Reverse
  5442. progspace /build/test frame-filters:
  5443. Priority Enabled Name
  5444. 100 Yes ProgspaceFilter
  5445. objfile /build/test frame-filters:
  5446. Priority Enabled Name
  5447. 999 No BuildProgramFilter
  5448. 'set frame-filter priority FILTER-DICTIONARY FILTER-NAME PRIORITY'
  5449. Set the PRIORITY of a frame filter in the dictionary matching
  5450. FILTER-DICTIONARY, and the frame filter name matching FILTER-NAME.
  5451. The FILTER-DICTIONARY may be 'global', 'progspace' or the name of
  5452. the object file where the frame filter dictionary resides. The
  5453. PRIORITY is an integer.
  5454. 'show frame-filter priority FILTER-DICTIONARY FILTER-NAME'
  5455. Show the PRIORITY of a frame filter in the dictionary matching
  5456. FILTER-DICTIONARY, and the frame filter name matching FILTER-NAME.
  5457. The FILTER-DICTIONARY may be 'global', 'progspace' or the name of
  5458. the object file where the frame filter dictionary resides.
  5459. Example:
  5460. (gdb) info frame-filter
  5461. global frame-filters:
  5462. Priority Enabled Name
  5463. 1000 Yes PrimaryFunctionFilter
  5464. 100 Yes Reverse
  5465. progspace /build/test frame-filters:
  5466. Priority Enabled Name
  5467. 100 Yes ProgspaceFilter
  5468. objfile /build/test frame-filters:
  5469. Priority Enabled Name
  5470. 999 No BuildProgramFilter
  5471. (gdb) set frame-filter priority global Reverse 50
  5472. (gdb) info frame-filter
  5473. global frame-filters:
  5474. Priority Enabled Name
  5475. 1000 Yes PrimaryFunctionFilter
  5476. 50 Yes Reverse
  5477. progspace /build/test frame-filters:
  5478. Priority Enabled Name
  5479. 100 Yes ProgspaceFilter
  5480. objfile /build/test frame-filters:
  5481. Priority Enabled Name
  5482. 999 No BuildProgramFilter
  5483. 
  5484. File: gdb.info, Node: Source, Next: Data, Prev: Stack, Up: Top
  5485. 9 Examining Source Files
  5486. ************************
  5487. GDB can print parts of your program's source, since the debugging
  5488. information recorded in the program tells GDB what source files were
  5489. used to build it. When your program stops, GDB spontaneously prints the
  5490. line where it stopped. Likewise, when you select a stack frame (*note
  5491. Selecting a Frame: Selection.), GDB prints the line where execution in
  5492. that frame has stopped. You can print other portions of source files by
  5493. explicit command.
  5494. If you use GDB through its GNU Emacs interface, you may prefer to use
  5495. Emacs facilities to view source; see *note Using GDB under GNU Emacs:
  5496. Emacs.
  5497. * Menu:
  5498. * List:: Printing source lines
  5499. * Specify Location:: How to specify code locations
  5500. * Edit:: Editing source files
  5501. * Search:: Searching source files
  5502. * Source Path:: Specifying source directories
  5503. * Machine Code:: Source and machine code
  5504. 
  5505. File: gdb.info, Node: List, Next: Specify Location, Up: Source
  5506. 9.1 Printing Source Lines
  5507. =========================
  5508. To print lines from a source file, use the 'list' command (abbreviated
  5509. 'l'). By default, ten lines are printed. There are several ways to
  5510. specify what part of the file you want to print; see *note Specify
  5511. Location::, for the full list.
  5512. Here are the forms of the 'list' command most commonly used:
  5513. 'list LINENUM'
  5514. Print lines centered around line number LINENUM in the current
  5515. source file.
  5516. 'list FUNCTION'
  5517. Print lines centered around the beginning of function FUNCTION.
  5518. 'list'
  5519. Print more lines. If the last lines printed were printed with a
  5520. 'list' command, this prints lines following the last lines printed;
  5521. however, if the last line printed was a solitary line printed as
  5522. part of displaying a stack frame (*note Examining the Stack:
  5523. Stack.), this prints lines centered around that line.
  5524. 'list -'
  5525. Print lines just before the lines last printed.
  5526. By default, GDB prints ten source lines with any of these forms of
  5527. the 'list' command. You can change this using 'set listsize':
  5528. 'set listsize COUNT'
  5529. 'set listsize unlimited'
  5530. Make the 'list' command display COUNT source lines (unless the
  5531. 'list' argument explicitly specifies some other number). Setting
  5532. COUNT to 'unlimited' or 0 means there's no limit.
  5533. 'show listsize'
  5534. Display the number of lines that 'list' prints.
  5535. Repeating a 'list' command with <RET> discards the argument, so it is
  5536. equivalent to typing just 'list'. This is more useful than listing the
  5537. same lines again. An exception is made for an argument of '-'; that
  5538. argument is preserved in repetition so that each repetition moves up in
  5539. the source file.
  5540. In general, the 'list' command expects you to supply zero, one or two
  5541. "locations". Locations specify source lines; there are several ways of
  5542. writing them (*note Specify Location::), but the effect is always to
  5543. specify some source line.
  5544. Here is a complete description of the possible arguments for 'list':
  5545. 'list LOCATION'
  5546. Print lines centered around the line specified by LOCATION.
  5547. 'list FIRST,LAST'
  5548. Print lines from FIRST to LAST. Both arguments are locations.
  5549. When a 'list' command has two locations, and the source file of the
  5550. second location is omitted, this refers to the same source file as
  5551. the first location.
  5552. 'list ,LAST'
  5553. Print lines ending with LAST.
  5554. 'list FIRST,'
  5555. Print lines starting with FIRST.
  5556. 'list +'
  5557. Print lines just after the lines last printed.
  5558. 'list -'
  5559. Print lines just before the lines last printed.
  5560. 'list'
  5561. As described in the preceding table.
  5562. 
  5563. File: gdb.info, Node: Specify Location, Next: Edit, Prev: List, Up: Source
  5564. 9.2 Specifying a Location
  5565. =========================
  5566. * Menu:
  5567. * Linespec Locations:: Linespec locations
  5568. * Explicit Locations:: Explicit locations
  5569. * Address Locations:: Address locations
  5570. Several GDB commands accept arguments that specify a location of your
  5571. program's code. Since GDB is a source-level debugger, a location
  5572. usually specifies some line in the source code. Locations may be
  5573. specified using three different formats: linespec locations, explicit
  5574. locations, or address locations.
  5575. 
  5576. File: gdb.info, Node: Linespec Locations, Next: Explicit Locations, Up: Specify Location
  5577. 9.2.1 Linespec Locations
  5578. ------------------------
  5579. A "linespec" is a colon-separated list of source location parameters
  5580. such as file name, function name, etc. Here are all the different ways
  5581. of specifying a linespec:
  5582. 'LINENUM'
  5583. Specifies the line number LINENUM of the current source file.
  5584. '-OFFSET'
  5585. '+OFFSET'
  5586. Specifies the line OFFSET lines before or after the "current line".
  5587. For the 'list' command, the current line is the last one printed;
  5588. for the breakpoint commands, this is the line at which execution
  5589. stopped in the currently selected "stack frame" (*note Frames:
  5590. Frames, for a description of stack frames.) When used as the
  5591. second of the two linespecs in a 'list' command, this specifies the
  5592. line OFFSET lines up or down from the first linespec.
  5593. 'FILENAME:LINENUM'
  5594. Specifies the line LINENUM in the source file FILENAME. If
  5595. FILENAME is a relative file name, then it will match any source
  5596. file name with the same trailing components. For example, if
  5597. FILENAME is 'gcc/expr.c', then it will match source file name of
  5598. '/build/trunk/gcc/expr.c', but not '/build/trunk/libcpp/expr.c' or
  5599. '/build/trunk/gcc/x-expr.c'.
  5600. 'FUNCTION'
  5601. Specifies the line that begins the body of the function FUNCTION.
  5602. For example, in C, this is the line with the open brace.
  5603. By default, in C++ and Ada, FUNCTION is interpreted as specifying
  5604. all functions named FUNCTION in all scopes. For C++, this means in
  5605. all namespaces and classes. For Ada, this means in all packages.
  5606. For example, assuming a program with C++ symbols named 'A::B::func'
  5607. and 'B::func', both commands 'break func' and 'break B::func' set a
  5608. breakpoint on both symbols.
  5609. Commands that accept a linespec let you override this with the
  5610. '-qualified' option. For example, 'break -qualified func' sets a
  5611. breakpoint on a free-function named 'func' ignoring any C++ class
  5612. methods and namespace functions called 'func'.
  5613. *Note Explicit Locations::.
  5614. 'FUNCTION:LABEL'
  5615. Specifies the line where LABEL appears in FUNCTION.
  5616. 'FILENAME:FUNCTION'
  5617. Specifies the line that begins the body of the function FUNCTION in
  5618. the file FILENAME. You only need the file name with a function
  5619. name to avoid ambiguity when there are identically named functions
  5620. in different source files.
  5621. 'LABEL'
  5622. Specifies the line at which the label named LABEL appears in the
  5623. function corresponding to the currently selected stack frame. If
  5624. there is no current selected stack frame (for instance, if the
  5625. inferior is not running), then GDB will not search for a label.
  5626. '-pstap|-probe-stap [OBJFILE:[PROVIDER:]]NAME'
  5627. The GNU/Linux tool 'SystemTap' provides a way for applications to
  5628. embed static probes. *Note Static Probe Points::, for more
  5629. information on finding and using static probes. This form of
  5630. linespec specifies the location of such a static probe.
  5631. If OBJFILE is given, only probes coming from that shared library or
  5632. executable matching OBJFILE as a regular expression are considered.
  5633. If PROVIDER is given, then only probes from that provider are
  5634. considered. If several probes match the spec, GDB will insert a
  5635. breakpoint at each one of those probes.
  5636. 
  5637. File: gdb.info, Node: Explicit Locations, Next: Address Locations, Prev: Linespec Locations, Up: Specify Location
  5638. 9.2.2 Explicit Locations
  5639. ------------------------
  5640. "Explicit locations" allow the user to directly specify the source
  5641. location's parameters using option-value pairs.
  5642. Explicit locations are useful when several functions, labels, or file
  5643. names have the same name (base name for files) in the program's sources.
  5644. In these cases, explicit locations point to the source line you meant
  5645. more accurately and unambiguously. Also, using explicit locations might
  5646. be faster in large programs.
  5647. For example, the linespec 'foo:bar' may refer to a function 'bar'
  5648. defined in the file named 'foo' or the label 'bar' in a function named
  5649. 'foo'. GDB must search either the file system or the symbol table to
  5650. know.
  5651. The list of valid explicit location options is summarized in the
  5652. following table:
  5653. '-source FILENAME'
  5654. The value specifies the source file name. To differentiate between
  5655. files with the same base name, prepend as many directories as is
  5656. necessary to uniquely identify the desired file, e.g.,
  5657. 'foo/bar/baz.c'. Otherwise GDB will use the first file it finds
  5658. with the given base name. This option requires the use of either
  5659. '-function' or '-line'.
  5660. '-function FUNCTION'
  5661. The value specifies the name of a function. Operations on function
  5662. locations unmodified by other options (such as '-label' or '-line')
  5663. refer to the line that begins the body of the function. In C, for
  5664. example, this is the line with the open brace.
  5665. By default, in C++ and Ada, FUNCTION is interpreted as specifying
  5666. all functions named FUNCTION in all scopes. For C++, this means in
  5667. all namespaces and classes. For Ada, this means in all packages.
  5668. For example, assuming a program with C++ symbols named 'A::B::func'
  5669. and 'B::func', both commands 'break -function func' and 'break -function B::func'
  5670. set a breakpoint on both symbols.
  5671. You can use the '-qualified' flag to override this (see below).
  5672. '-qualified'
  5673. This flag makes GDB interpret a function name specified with
  5674. '-function' as a complete fully-qualified name.
  5675. For example, assuming a C++ program with symbols named 'A::B::func'
  5676. and 'B::func', the 'break -qualified -function B::func' command
  5677. sets a breakpoint on 'B::func', only.
  5678. (Note: the '-qualified' option can precede a linespec as well
  5679. (*note Linespec Locations::), so the particular example above could
  5680. be simplified as 'break -qualified B::func'.)
  5681. '-label LABEL'
  5682. The value specifies the name of a label. When the function name is
  5683. not specified, the label is searched in the function of the
  5684. currently selected stack frame.
  5685. '-line NUMBER'
  5686. The value specifies a line offset for the location. The offset may
  5687. either be absolute ('-line 3') or relative ('-line +3'), depending
  5688. on the command. When specified without any other options, the line
  5689. offset is relative to the current line.
  5690. Explicit location options may be abbreviated by omitting any
  5691. non-unique trailing characters from the option name, e.g.,
  5692. 'break -s main.c -li 3'.
  5693. 
  5694. File: gdb.info, Node: Address Locations, Prev: Explicit Locations, Up: Specify Location
  5695. 9.2.3 Address Locations
  5696. -----------------------
  5697. "Address locations" indicate a specific program address. They have the
  5698. generalized form *ADDRESS.
  5699. For line-oriented commands, such as 'list' and 'edit', this specifies
  5700. a source line that contains ADDRESS. For 'break' and other
  5701. breakpoint-oriented commands, this can be used to set breakpoints in
  5702. parts of your program which do not have debugging information or source
  5703. files.
  5704. Here ADDRESS may be any expression valid in the current working
  5705. language (*note working language: Languages.) that specifies a code
  5706. address. In addition, as a convenience, GDB extends the semantics of
  5707. expressions used in locations to cover several situations that
  5708. frequently occur during debugging. Here are the various forms of
  5709. ADDRESS:
  5710. 'EXPRESSION'
  5711. Any expression valid in the current working language.
  5712. 'FUNCADDR'
  5713. An address of a function or procedure derived from its name. In C,
  5714. C++, Objective-C, Fortran, minimal, and assembly, this is simply
  5715. the function's name FUNCTION (and actually a special case of a
  5716. valid expression). In Pascal and Modula-2, this is '&FUNCTION'.
  5717. In Ada, this is 'FUNCTION'Address' (although the Pascal form also
  5718. works).
  5719. This form specifies the address of the function's first
  5720. instruction, before the stack frame and arguments have been set up.
  5721. ''FILENAME':FUNCADDR'
  5722. Like FUNCADDR above, but also specifies the name of the source file
  5723. explicitly. This is useful if the name of the function does not
  5724. specify the function unambiguously, e.g., if there are several
  5725. functions with identical names in different source files.
  5726. 
  5727. File: gdb.info, Node: Edit, Next: Search, Prev: Specify Location, Up: Source
  5728. 9.3 Editing Source Files
  5729. ========================
  5730. To edit the lines in a source file, use the 'edit' command. The editing
  5731. program of your choice is invoked with the current line set to the
  5732. active line in the program. Alternatively, there are several ways to
  5733. specify what part of the file you want to print if you want to see other
  5734. parts of the program:
  5735. 'edit LOCATION'
  5736. Edit the source file specified by 'location'. Editing starts at
  5737. that LOCATION, e.g., at the specified source line of the specified
  5738. file. *Note Specify Location::, for all the possible forms of the
  5739. LOCATION argument; here are the forms of the 'edit' command most
  5740. commonly used:
  5741. 'edit NUMBER'
  5742. Edit the current source file with NUMBER as the active line
  5743. number.
  5744. 'edit FUNCTION'
  5745. Edit the file containing FUNCTION at the beginning of its
  5746. definition.
  5747. 9.3.1 Choosing your Editor
  5748. --------------------------
  5749. You can customize GDB to use any editor you want (1). By default, it is
  5750. '/bin/ex', but you can change this by setting the environment variable
  5751. 'EDITOR' before using GDB. For example, to configure GDB to use the
  5752. 'vi' editor, you could use these commands with the 'sh' shell:
  5753. EDITOR=/usr/bin/vi
  5754. export EDITOR
  5755. gdb ...
  5756. or in the 'csh' shell,
  5757. setenv EDITOR /usr/bin/vi
  5758. gdb ...
  5759. ---------- Footnotes ----------
  5760. (1) The only restriction is that your editor (say 'ex'), recognizes
  5761. the following command-line syntax:
  5762. ex +NUMBER file
  5763. The optional numeric value +NUMBER specifies the number of the line
  5764. in the file where to start editing.
  5765. 
  5766. File: gdb.info, Node: Search, Next: Source Path, Prev: Edit, Up: Source
  5767. 9.4 Searching Source Files
  5768. ==========================
  5769. There are two commands for searching through the current source file for
  5770. a regular expression.
  5771. 'forward-search REGEXP'
  5772. 'search REGEXP'
  5773. The command 'forward-search REGEXP' checks each line, starting with
  5774. the one following the last line listed, for a match for REGEXP. It
  5775. lists the line that is found. You can use the synonym 'search
  5776. REGEXP' or abbreviate the command name as 'fo'.
  5777. 'reverse-search REGEXP'
  5778. The command 'reverse-search REGEXP' checks each line, starting with
  5779. the one before the last line listed and going backward, for a match
  5780. for REGEXP. It lists the line that is found. You can abbreviate
  5781. this command as 'rev'.
  5782. 
  5783. File: gdb.info, Node: Source Path, Next: Machine Code, Prev: Search, Up: Source
  5784. 9.5 Specifying Source Directories
  5785. =================================
  5786. Executable programs sometimes do not record the directories of the
  5787. source files from which they were compiled, just the names. Even when
  5788. they do, the directories could be moved between the compilation and your
  5789. debugging session. GDB has a list of directories to search for source
  5790. files; this is called the "source path". Each time GDB wants a source
  5791. file, it tries all the directories in the list, in the order they are
  5792. present in the list, until it finds a file with the desired name.
  5793. For example, suppose an executable references the file
  5794. '/usr/src/foo-1.0/lib/foo.c', and our source path is '/mnt/cross'. The
  5795. file is first looked up literally; if this fails,
  5796. '/mnt/cross/usr/src/foo-1.0/lib/foo.c' is tried; if this fails,
  5797. '/mnt/cross/foo.c' is opened; if this fails, an error message is
  5798. printed. GDB does not look up the parts of the source file name, such
  5799. as '/mnt/cross/src/foo-1.0/lib/foo.c'. Likewise, the subdirectories of
  5800. the source path are not searched: if the source path is '/mnt/cross',
  5801. and the binary refers to 'foo.c', GDB would not find it under
  5802. '/mnt/cross/usr/src/foo-1.0/lib'.
  5803. Plain file names, relative file names with leading directories, file
  5804. names containing dots, etc. are all treated as described above; for
  5805. instance, if the source path is '/mnt/cross', and the source file is
  5806. recorded as '../lib/foo.c', GDB would first try '../lib/foo.c', then
  5807. '/mnt/cross/../lib/foo.c', and after that--'/mnt/cross/foo.c'.
  5808. Note that the executable search path is _not_ used to locate the
  5809. source files.
  5810. Whenever you reset or rearrange the source path, GDB clears out any
  5811. information it has cached about where source files are found and where
  5812. each line is in the file.
  5813. When you start GDB, its source path includes only 'cdir' and 'cwd',
  5814. in that order. To add other directories, use the 'directory' command.
  5815. The search path is used to find both program source files and GDB
  5816. script files (read using the '-command' option and 'source' command).
  5817. In addition to the source path, GDB provides a set of commands that
  5818. manage a list of source path substitution rules. A "substitution rule"
  5819. specifies how to rewrite source directories stored in the program's
  5820. debug information in case the sources were moved to a different
  5821. directory between compilation and debugging. A rule is made of two
  5822. strings, the first specifying what needs to be rewritten in the path,
  5823. and the second specifying how it should be rewritten. In *note set
  5824. substitute-path::, we name these two parts FROM and TO respectively.
  5825. GDB does a simple string replacement of FROM with TO at the start of the
  5826. directory part of the source file name, and uses that result instead of
  5827. the original file name to look up the sources.
  5828. Using the previous example, suppose the 'foo-1.0' tree has been moved
  5829. from '/usr/src' to '/mnt/cross', then you can tell GDB to replace
  5830. '/usr/src' in all source path names with '/mnt/cross'. The first lookup
  5831. will then be '/mnt/cross/foo-1.0/lib/foo.c' in place of the original
  5832. location of '/usr/src/foo-1.0/lib/foo.c'. To define a source path
  5833. substitution rule, use the 'set substitute-path' command (*note set
  5834. substitute-path::).
  5835. To avoid unexpected substitution results, a rule is applied only if
  5836. the FROM part of the directory name ends at a directory separator. For
  5837. instance, a rule substituting '/usr/source' into '/mnt/cross' will be
  5838. applied to '/usr/source/foo-1.0' but not to '/usr/sourceware/foo-2.0'.
  5839. And because the substitution is applied only at the beginning of the
  5840. directory name, this rule will not be applied to
  5841. '/root/usr/source/baz.c' either.
  5842. In many cases, you can achieve the same result using the 'directory'
  5843. command. However, 'set substitute-path' can be more efficient in the
  5844. case where the sources are organized in a complex tree with multiple
  5845. subdirectories. With the 'directory' command, you need to add each
  5846. subdirectory of your project. If you moved the entire tree while
  5847. preserving its internal organization, then 'set substitute-path' allows
  5848. you to direct the debugger to all the sources with one single command.
  5849. 'set substitute-path' is also more than just a shortcut command. The
  5850. source path is only used if the file at the original location no longer
  5851. exists. On the other hand, 'set substitute-path' modifies the debugger
  5852. behavior to look at the rewritten location instead. So, if for any
  5853. reason a source file that is not relevant to your executable is located
  5854. at the original location, a substitution rule is the only method
  5855. available to point GDB at the new location.
  5856. You can configure a default source path substitution rule by
  5857. configuring GDB with the '--with-relocated-sources=DIR' option. The DIR
  5858. should be the name of a directory under GDB's configured prefix (set
  5859. with '--prefix' or '--exec-prefix'), and directory names in debug
  5860. information under DIR will be adjusted automatically if the installed
  5861. GDB is moved to a new location. This is useful if GDB, libraries or
  5862. executables with debug information and corresponding source code are
  5863. being moved together.
  5864. 'directory DIRNAME ...'
  5865. 'dir DIRNAME ...'
  5866. Add directory DIRNAME to the front of the source path. Several
  5867. directory names may be given to this command, separated by ':' (';'
  5868. on MS-DOS and MS-Windows, where ':' usually appears as part of
  5869. absolute file names) or whitespace. You may specify a directory
  5870. that is already in the source path; this moves it forward, so GDB
  5871. searches it sooner.
  5872. You can use the string '$cdir' to refer to the compilation
  5873. directory (if one is recorded), and '$cwd' to refer to the current
  5874. working directory. '$cwd' is not the same as '.'--the former
  5875. tracks the current working directory as it changes during your GDB
  5876. session, while the latter is immediately expanded to the current
  5877. directory at the time you add an entry to the source path.
  5878. 'directory'
  5879. Reset the source path to its default value ('$cdir:$cwd' on Unix
  5880. systems). This requires confirmation.
  5881. 'set directories PATH-LIST'
  5882. Set the source path to PATH-LIST. '$cdir:$cwd' are added if
  5883. missing.
  5884. 'show directories'
  5885. Print the source path: show which directories it contains.
  5886. 'set substitute-path FROM TO'
  5887. Define a source path substitution rule, and add it at the end of
  5888. the current list of existing substitution rules. If a rule with
  5889. the same FROM was already defined, then the old rule is also
  5890. deleted.
  5891. For example, if the file '/foo/bar/baz.c' was moved to
  5892. '/mnt/cross/baz.c', then the command
  5893. (gdb) set substitute-path /foo/bar /mnt/cross
  5894. will tell GDB to replace '/foo/bar' with '/mnt/cross', which will
  5895. allow GDB to find the file 'baz.c' even though it was moved.
  5896. In the case when more than one substitution rule have been defined,
  5897. the rules are evaluated one by one in the order where they have
  5898. been defined. The first one matching, if any, is selected to
  5899. perform the substitution.
  5900. For instance, if we had entered the following commands:
  5901. (gdb) set substitute-path /usr/src/include /mnt/include
  5902. (gdb) set substitute-path /usr/src /mnt/src
  5903. GDB would then rewrite '/usr/src/include/defs.h' into
  5904. '/mnt/include/defs.h' by using the first rule. However, it would
  5905. use the second rule to rewrite '/usr/src/lib/foo.c' into
  5906. '/mnt/src/lib/foo.c'.
  5907. 'unset substitute-path [path]'
  5908. If a path is specified, search the current list of substitution
  5909. rules for a rule that would rewrite that path. Delete that rule if
  5910. found. A warning is emitted by the debugger if no rule could be
  5911. found.
  5912. If no path is specified, then all substitution rules are deleted.
  5913. 'show substitute-path [path]'
  5914. If a path is specified, then print the source path substitution
  5915. rule which would rewrite that path, if any.
  5916. If no path is specified, then print all existing source path
  5917. substitution rules.
  5918. If your source path is cluttered with directories that are no longer
  5919. of interest, GDB may sometimes cause confusion by finding the wrong
  5920. versions of source. You can correct the situation as follows:
  5921. 1. Use 'directory' with no argument to reset the source path to its
  5922. default value.
  5923. 2. Use 'directory' with suitable arguments to reinstall the
  5924. directories you want in the source path. You can add all the
  5925. directories in one command.
  5926. 
  5927. File: gdb.info, Node: Machine Code, Prev: Source Path, Up: Source
  5928. 9.6 Source and Machine Code
  5929. ===========================
  5930. You can use the command 'info line' to map source lines to program
  5931. addresses (and vice versa), and the command 'disassemble' to display a
  5932. range of addresses as machine instructions. You can use the command
  5933. 'set disassemble-next-line' to set whether to disassemble next source
  5934. line when execution stops. When run under GNU Emacs mode, the 'info
  5935. line' command causes the arrow to point to the line specified. Also,
  5936. 'info line' prints addresses in symbolic form as well as hex.
  5937. 'info line'
  5938. 'info line LOCATION'
  5939. Print the starting and ending addresses of the compiled code for
  5940. source line LOCATION. You can specify source lines in any of the
  5941. ways documented in *note Specify Location::. With no LOCATION
  5942. information about the current source line is printed.
  5943. For example, we can use 'info line' to discover the location of the
  5944. object code for the first line of function 'm4_changequote':
  5945. (gdb) info line m4_changequote
  5946. Line 895 of "builtin.c" starts at pc 0x634c <m4_changequote> and \
  5947. ends at 0x6350 <m4_changequote+4>.
  5948. We can also inquire (using '*ADDR' as the form for LOCATION) what source
  5949. line covers a particular address:
  5950. (gdb) info line *0x63ff
  5951. Line 926 of "builtin.c" starts at pc 0x63e4 <m4_changequote+152> and \
  5952. ends at 0x6404 <m4_changequote+184>.
  5953. After 'info line', the default address for the 'x' command is changed
  5954. to the starting address of the line, so that 'x/i' is sufficient to
  5955. begin examining the machine code (*note Examining Memory: Memory.).
  5956. Also, this address is saved as the value of the convenience variable
  5957. '$_' (*note Convenience Variables: Convenience Vars.).
  5958. After 'info line', using 'info line' again without specifying a
  5959. location will display information about the next source line.
  5960. 'disassemble'
  5961. 'disassemble /m'
  5962. 'disassemble /s'
  5963. 'disassemble /r'
  5964. This specialized command dumps a range of memory as machine
  5965. instructions. It can also print mixed source+disassembly by
  5966. specifying the '/m' or '/s' modifier and print the raw instructions
  5967. in hex as well as in symbolic form by specifying the '/r' modifier.
  5968. The default memory range is the function surrounding the program
  5969. counter of the selected frame. A single argument to this command
  5970. is a program counter value; GDB dumps the function surrounding this
  5971. value. When two arguments are given, they should be separated by a
  5972. comma, possibly surrounded by whitespace. The arguments specify a
  5973. range of addresses to dump, in one of two forms:
  5974. 'START,END'
  5975. the addresses from START (inclusive) to END (exclusive)
  5976. 'START,+LENGTH'
  5977. the addresses from START (inclusive) to 'START+LENGTH'
  5978. (exclusive).
  5979. When 2 arguments are specified, the name of the function is also
  5980. printed (since there could be several functions in the given
  5981. range).
  5982. The argument(s) can be any expression yielding a numeric value,
  5983. such as '0x32c4', '&main+10' or '$pc - 8'.
  5984. If the range of memory being disassembled contains current program
  5985. counter, the instruction at that location is shown with a '=>'
  5986. marker.
  5987. The following example shows the disassembly of a range of addresses
  5988. of HP PA-RISC 2.0 code:
  5989. (gdb) disas 0x32c4, 0x32e4
  5990. Dump of assembler code from 0x32c4 to 0x32e4:
  5991. 0x32c4 <main+204>: addil 0,dp
  5992. 0x32c8 <main+208>: ldw 0x22c(sr0,r1),r26
  5993. 0x32cc <main+212>: ldil 0x3000,r31
  5994. 0x32d0 <main+216>: ble 0x3f8(sr4,r31)
  5995. 0x32d4 <main+220>: ldo 0(r31),rp
  5996. 0x32d8 <main+224>: addil -0x800,dp
  5997. 0x32dc <main+228>: ldo 0x588(r1),r26
  5998. 0x32e0 <main+232>: ldil 0x3000,r31
  5999. End of assembler dump.
  6000. Here is an example showing mixed source+assembly for Intel x86 with
  6001. '/m' or '/s', when the program is stopped just after function prologue
  6002. in a non-optimized function with no inline code.
  6003. (gdb) disas /m main
  6004. Dump of assembler code for function main:
  6005. 5 {
  6006. 0x08048330 <+0>: push %ebp
  6007. 0x08048331 <+1>: mov %esp,%ebp
  6008. 0x08048333 <+3>: sub $0x8,%esp
  6009. 0x08048336 <+6>: and $0xfffffff0,%esp
  6010. 0x08048339 <+9>: sub $0x10,%esp
  6011. 6 printf ("Hello.\n");
  6012. => 0x0804833c <+12>: movl $0x8048440,(%esp)
  6013. 0x08048343 <+19>: call 0x8048284 <puts@plt>
  6014. 7 return 0;
  6015. 8 }
  6016. 0x08048348 <+24>: mov $0x0,%eax
  6017. 0x0804834d <+29>: leave
  6018. 0x0804834e <+30>: ret
  6019. End of assembler dump.
  6020. The '/m' option is deprecated as its output is not useful when there
  6021. is either inlined code or re-ordered code. The '/s' option is the
  6022. preferred choice. Here is an example for AMD x86-64 showing the
  6023. difference between '/m' output and '/s' output. This example has one
  6024. inline function defined in a header file, and the code is compiled with
  6025. '-O2' optimization. Note how the '/m' output is missing the disassembly
  6026. of several instructions that are present in the '/s' output.
  6027. 'foo.h':
  6028. int
  6029. foo (int a)
  6030. {
  6031. if (a < 0)
  6032. return a * 2;
  6033. if (a == 0)
  6034. return 1;
  6035. return a + 10;
  6036. }
  6037. 'foo.c':
  6038. #include "foo.h"
  6039. volatile int x, y;
  6040. int
  6041. main ()
  6042. {
  6043. x = foo (y);
  6044. return 0;
  6045. }
  6046. (gdb) disas /m main
  6047. Dump of assembler code for function main:
  6048. 5 {
  6049. 6 x = foo (y);
  6050. 0x0000000000400400 <+0>: mov 0x200c2e(%rip),%eax # 0x601034 <y>
  6051. 0x0000000000400417 <+23>: mov %eax,0x200c13(%rip) # 0x601030 <x>
  6052. 7 return 0;
  6053. 8 }
  6054. 0x000000000040041d <+29>: xor %eax,%eax
  6055. 0x000000000040041f <+31>: retq
  6056. 0x0000000000400420 <+32>: add %eax,%eax
  6057. 0x0000000000400422 <+34>: jmp 0x400417 <main+23>
  6058. End of assembler dump.
  6059. (gdb) disas /s main
  6060. Dump of assembler code for function main:
  6061. foo.c:
  6062. 5 {
  6063. 6 x = foo (y);
  6064. 0x0000000000400400 <+0>: mov 0x200c2e(%rip),%eax # 0x601034 <y>
  6065. foo.h:
  6066. 4 if (a < 0)
  6067. 0x0000000000400406 <+6>: test %eax,%eax
  6068. 0x0000000000400408 <+8>: js 0x400420 <main+32>
  6069. 6 if (a == 0)
  6070. 7 return 1;
  6071. 8 return a + 10;
  6072. 0x000000000040040a <+10>: lea 0xa(%rax),%edx
  6073. 0x000000000040040d <+13>: test %eax,%eax
  6074. 0x000000000040040f <+15>: mov $0x1,%eax
  6075. 0x0000000000400414 <+20>: cmovne %edx,%eax
  6076. foo.c:
  6077. 6 x = foo (y);
  6078. 0x0000000000400417 <+23>: mov %eax,0x200c13(%rip) # 0x601030 <x>
  6079. 7 return 0;
  6080. 8 }
  6081. 0x000000000040041d <+29>: xor %eax,%eax
  6082. 0x000000000040041f <+31>: retq
  6083. foo.h:
  6084. 5 return a * 2;
  6085. 0x0000000000400420 <+32>: add %eax,%eax
  6086. 0x0000000000400422 <+34>: jmp 0x400417 <main+23>
  6087. End of assembler dump.
  6088. Here is another example showing raw instructions in hex for AMD
  6089. x86-64,
  6090. (gdb) disas /r 0x400281,+10
  6091. Dump of assembler code from 0x400281 to 0x40028b:
  6092. 0x0000000000400281: 38 36 cmp %dh,(%rsi)
  6093. 0x0000000000400283: 2d 36 34 2e 73 sub $0x732e3436,%eax
  6094. 0x0000000000400288: 6f outsl %ds:(%rsi),(%dx)
  6095. 0x0000000000400289: 2e 32 00 xor %cs:(%rax),%al
  6096. End of assembler dump.
  6097. Addresses cannot be specified as a location (*note Specify
  6098. Location::). So, for example, if you want to disassemble function 'bar'
  6099. in file 'foo.c', you must type 'disassemble 'foo.c'::bar' and not
  6100. 'disassemble foo.c:bar'.
  6101. Some architectures have more than one commonly-used set of
  6102. instruction mnemonics or other syntax.
  6103. For programs that were dynamically linked and use shared libraries,
  6104. instructions that call functions or branch to locations in the shared
  6105. libraries might show a seemingly bogus location--it's actually a
  6106. location of the relocation table. On some architectures, GDB might be
  6107. able to resolve these to actual function names.
  6108. 'set disassembler-options OPTION1[,OPTION2...]'
  6109. This command controls the passing of target specific information to
  6110. the disassembler. For a list of valid options, please refer to the
  6111. '-M'/'--disassembler-options' section of the 'objdump' manual
  6112. and/or the output of 'objdump --help' (*note objdump:
  6113. (binutils)objdump.). The default value is the empty string.
  6114. If it is necessary to specify more than one disassembler option,
  6115. then multiple options can be placed together into a comma separated
  6116. list. Currently this command is only supported on targets ARM,
  6117. MIPS, PowerPC and S/390.
  6118. 'show disassembler-options'
  6119. Show the current setting of the disassembler options.
  6120. 'set disassembly-flavor INSTRUCTION-SET'
  6121. Select the instruction set to use when disassembling the program
  6122. via the 'disassemble' or 'x/i' commands.
  6123. Currently this command is only defined for the Intel x86 family.
  6124. You can set INSTRUCTION-SET to either 'intel' or 'att'. The
  6125. default is 'att', the AT&T flavor used by default by Unix
  6126. assemblers for x86-based targets.
  6127. 'show disassembly-flavor'
  6128. Show the current setting of the disassembly flavor.
  6129. 'set disassemble-next-line'
  6130. 'show disassemble-next-line'
  6131. Control whether or not GDB will disassemble the next source line or
  6132. instruction when execution stops. If ON, GDB will display
  6133. disassembly of the next source line when execution of the program
  6134. being debugged stops. This is _in addition_ to displaying the
  6135. source line itself, which GDB always does if possible. If the next
  6136. source line cannot be displayed for some reason (e.g., if GDB
  6137. cannot find the source file, or there's no line info in the debug
  6138. info), GDB will display disassembly of the next _instruction_
  6139. instead of showing the next source line. If AUTO, GDB will display
  6140. disassembly of next instruction only if the source line cannot be
  6141. displayed. This setting causes GDB to display some feedback when
  6142. you step through a function with no line info or whose source file
  6143. is unavailable. The default is OFF, which means never display the
  6144. disassembly of the next line or instruction.
  6145. 
  6146. File: gdb.info, Node: Data, Next: Optimized Code, Prev: Source, Up: Top
  6147. 10 Examining Data
  6148. *****************
  6149. The usual way to examine data in your program is with the 'print'
  6150. command (abbreviated 'p'), or its synonym 'inspect'. It evaluates and
  6151. prints the value of an expression of the language your program is
  6152. written in (*note Using GDB with Different Languages: Languages.). It
  6153. may also print the expression using a Python-based pretty-printer (*note
  6154. Pretty Printing::).
  6155. 'print EXPR'
  6156. 'print /F EXPR'
  6157. EXPR is an expression (in the source language). By default the
  6158. value of EXPR is printed in a format appropriate to its data type;
  6159. you can choose a different format by specifying '/F', where F is a
  6160. letter specifying the format; see *note Output Formats: Output
  6161. Formats.
  6162. 'print'
  6163. 'print /F'
  6164. If you omit EXPR, GDB displays the last value again (from the
  6165. "value history"; *note Value History: Value History.). This allows
  6166. you to conveniently inspect the same value in an alternative
  6167. format.
  6168. A more low-level way of examining data is with the 'x' command. It
  6169. examines data in memory at a specified address and prints it in a
  6170. specified format. *Note Examining Memory: Memory.
  6171. If you are interested in information about types, or about how the
  6172. fields of a struct or a class are declared, use the 'ptype EXP' command
  6173. rather than 'print'. *Note Examining the Symbol Table: Symbols.
  6174. Another way of examining values of expressions and type information
  6175. is through the Python extension command 'explore' (available only if the
  6176. GDB build is configured with '--with-python'). It offers an interactive
  6177. way to start at the highest level (or, the most abstract level) of the
  6178. data type of an expression (or, the data type itself) and explore all
  6179. the way down to leaf scalar values/fields embedded in the higher level
  6180. data types.
  6181. 'explore ARG'
  6182. ARG is either an expression (in the source language), or a type
  6183. visible in the current context of the program being debugged.
  6184. The working of the 'explore' command can be illustrated with an
  6185. example. If a data type 'struct ComplexStruct' is defined in your C
  6186. program as
  6187. struct SimpleStruct
  6188. {
  6189. int i;
  6190. double d;
  6191. };
  6192. struct ComplexStruct
  6193. {
  6194. struct SimpleStruct *ss_p;
  6195. int arr[10];
  6196. };
  6197. followed by variable declarations as
  6198. struct SimpleStruct ss = { 10, 1.11 };
  6199. struct ComplexStruct cs = { &ss, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } };
  6200. then, the value of the variable 'cs' can be explored using the 'explore'
  6201. command as follows.
  6202. (gdb) explore cs
  6203. The value of `cs' is a struct/class of type `struct ComplexStruct' with
  6204. the following fields:
  6205. ss_p = <Enter 0 to explore this field of type `struct SimpleStruct *'>
  6206. arr = <Enter 1 to explore this field of type `int [10]'>
  6207. Enter the field number of choice:
  6208. Since the fields of 'cs' are not scalar values, you are being prompted
  6209. to chose the field you want to explore. Let's say you choose the field
  6210. 'ss_p' by entering '0'. Then, since this field is a pointer, you will
  6211. be asked if it is pointing to a single value. From the declaration of
  6212. 'cs' above, it is indeed pointing to a single value, hence you enter
  6213. 'y'. If you enter 'n', then you will be asked if it were pointing to an
  6214. array of values, in which case this field will be explored as if it were
  6215. an array.
  6216. `cs.ss_p' is a pointer to a value of type `struct SimpleStruct'
  6217. Continue exploring it as a pointer to a single value [y/n]: y
  6218. The value of `*(cs.ss_p)' is a struct/class of type `struct
  6219. SimpleStruct' with the following fields:
  6220. i = 10 .. (Value of type `int')
  6221. d = 1.1100000000000001 .. (Value of type `double')
  6222. Press enter to return to parent value:
  6223. If the field 'arr' of 'cs' was chosen for exploration by entering '1'
  6224. earlier, then since it is as array, you will be prompted to enter the
  6225. index of the element in the array that you want to explore.
  6226. `cs.arr' is an array of `int'.
  6227. Enter the index of the element you want to explore in `cs.arr': 5
  6228. `(cs.arr)[5]' is a scalar value of type `int'.
  6229. (cs.arr)[5] = 4
  6230. Press enter to return to parent value:
  6231. In general, at any stage of exploration, you can go deeper towards
  6232. the leaf values by responding to the prompts appropriately, or hit the
  6233. return key to return to the enclosing data structure (the higher level
  6234. data structure).
  6235. Similar to exploring values, you can use the 'explore' command to
  6236. explore types. Instead of specifying a value (which is typically a
  6237. variable name or an expression valid in the current context of the
  6238. program being debugged), you specify a type name. If you consider the
  6239. same example as above, your can explore the type 'struct ComplexStruct'
  6240. by passing the argument 'struct ComplexStruct' to the 'explore' command.
  6241. (gdb) explore struct ComplexStruct
  6242. By responding to the prompts appropriately in the subsequent interactive
  6243. session, you can explore the type 'struct ComplexStruct' in a manner
  6244. similar to how the value 'cs' was explored in the above example.
  6245. The 'explore' command also has two sub-commands, 'explore value' and
  6246. 'explore type'. The former sub-command is a way to explicitly specify
  6247. that value exploration of the argument is being invoked, while the
  6248. latter is a way to explicitly specify that type exploration of the
  6249. argument is being invoked.
  6250. 'explore value EXPR'
  6251. This sub-command of 'explore' explores the value of the expression
  6252. EXPR (if EXPR is an expression valid in the current context of the
  6253. program being debugged). The behavior of this command is identical
  6254. to that of the behavior of the 'explore' command being passed the
  6255. argument EXPR.
  6256. 'explore type ARG'
  6257. This sub-command of 'explore' explores the type of ARG (if ARG is a
  6258. type visible in the current context of program being debugged), or
  6259. the type of the value/expression ARG (if ARG is an expression valid
  6260. in the current context of the program being debugged). If ARG is a
  6261. type, then the behavior of this command is identical to that of the
  6262. 'explore' command being passed the argument ARG. If ARG is an
  6263. expression, then the behavior of this command will be identical to
  6264. that of the 'explore' command being passed the type of ARG as the
  6265. argument.
  6266. * Menu:
  6267. * Expressions:: Expressions
  6268. * Ambiguous Expressions:: Ambiguous Expressions
  6269. * Variables:: Program variables
  6270. * Arrays:: Artificial arrays
  6271. * Output Formats:: Output formats
  6272. * Memory:: Examining memory
  6273. * Auto Display:: Automatic display
  6274. * Print Settings:: Print settings
  6275. * Pretty Printing:: Python pretty printing
  6276. * Value History:: Value history
  6277. * Convenience Vars:: Convenience variables
  6278. * Convenience Funs:: Convenience functions
  6279. * Registers:: Registers
  6280. * Floating Point Hardware:: Floating point hardware
  6281. * Vector Unit:: Vector Unit
  6282. * OS Information:: Auxiliary data provided by operating system
  6283. * Memory Region Attributes:: Memory region attributes
  6284. * Dump/Restore Files:: Copy between memory and a file
  6285. * Core File Generation:: Cause a program dump its core
  6286. * Character Sets:: Debugging programs that use a different
  6287. character set than GDB does
  6288. * Caching Target Data:: Data caching for targets
  6289. * Searching Memory:: Searching memory for a sequence of bytes
  6290. * Value Sizes:: Managing memory allocated for values
  6291. 
  6292. File: gdb.info, Node: Expressions, Next: Ambiguous Expressions, Up: Data
  6293. 10.1 Expressions
  6294. ================
  6295. 'print' and many other GDB commands accept an expression and compute its
  6296. value. Any kind of constant, variable or operator defined by the
  6297. programming language you are using is valid in an expression in GDB.
  6298. This includes conditional expressions, function calls, casts, and string
  6299. constants. It also includes preprocessor macros, if you compiled your
  6300. program to include this information; see *note Compilation::.
  6301. GDB supports array constants in expressions input by the user. The
  6302. syntax is {ELEMENT, ELEMENT...}. For example, you can use the command
  6303. 'print {1, 2, 3}' to create an array of three integers. If you pass an
  6304. array to a function or assign it to a program variable, GDB copies the
  6305. array to memory that is 'malloc'ed in the target program.
  6306. Because C is so widespread, most of the expressions shown in examples
  6307. in this manual are in C. *Note Using GDB with Different Languages:
  6308. Languages, for information on how to use expressions in other languages.
  6309. In this section, we discuss operators that you can use in GDB
  6310. expressions regardless of your programming language.
  6311. Casts are supported in all languages, not just in C, because it is so
  6312. useful to cast a number into a pointer in order to examine a structure
  6313. at that address in memory.
  6314. GDB supports these operators, in addition to those common to
  6315. programming languages:
  6316. '@'
  6317. '@' is a binary operator for treating parts of memory as arrays.
  6318. *Note Artificial Arrays: Arrays, for more information.
  6319. '::'
  6320. '::' allows you to specify a variable in terms of the file or
  6321. function where it is defined. *Note Program Variables: Variables.
  6322. '{TYPE} ADDR'
  6323. Refers to an object of type TYPE stored at address ADDR in memory.
  6324. The address ADDR may be any expression whose value is an integer or
  6325. pointer (but parentheses are required around binary operators, just
  6326. as in a cast). This construct is allowed regardless of what kind
  6327. of data is normally supposed to reside at ADDR.
  6328. 
  6329. File: gdb.info, Node: Ambiguous Expressions, Next: Variables, Prev: Expressions, Up: Data
  6330. 10.2 Ambiguous Expressions
  6331. ==========================
  6332. Expressions can sometimes contain some ambiguous elements. For
  6333. instance, some programming languages (notably Ada, C++ and Objective-C)
  6334. permit a single function name to be defined several times, for
  6335. application in different contexts. This is called "overloading".
  6336. Another example involving Ada is generics. A "generic package" is
  6337. similar to C++ templates and is typically instantiated several times,
  6338. resulting in the same function name being defined in different contexts.
  6339. In some cases and depending on the language, it is possible to adjust
  6340. the expression to remove the ambiguity. For instance in C++, you can
  6341. specify the signature of the function you want to break on, as in 'break
  6342. FUNCTION(TYPES)'. In Ada, using the fully qualified name of your
  6343. function often makes the expression unambiguous as well.
  6344. When an ambiguity that needs to be resolved is detected, the debugger
  6345. has the capability to display a menu of numbered choices for each
  6346. possibility, and then waits for the selection with the prompt '>'. The
  6347. first option is always '[0] cancel', and typing '0 <RET>' aborts the
  6348. current command. If the command in which the expression was used allows
  6349. more than one choice to be selected, the next option in the menu is '[1]
  6350. all', and typing '1 <RET>' selects all possible choices.
  6351. For example, the following session excerpt shows an attempt to set a
  6352. breakpoint at the overloaded symbol 'String::after'. We choose three
  6353. particular definitions of that function name:
  6354. (gdb) b String::after
  6355. [0] cancel
  6356. [1] all
  6357. [2] file:String.cc; line number:867
  6358. [3] file:String.cc; line number:860
  6359. [4] file:String.cc; line number:875
  6360. [5] file:String.cc; line number:853
  6361. [6] file:String.cc; line number:846
  6362. [7] file:String.cc; line number:735
  6363. > 2 4 6
  6364. Breakpoint 1 at 0xb26c: file String.cc, line 867.
  6365. Breakpoint 2 at 0xb344: file String.cc, line 875.
  6366. Breakpoint 3 at 0xafcc: file String.cc, line 846.
  6367. Multiple breakpoints were set.
  6368. Use the "delete" command to delete unwanted
  6369. breakpoints.
  6370. (gdb)
  6371. 'set multiple-symbols MODE'
  6372. This option allows you to adjust the debugger behavior when an
  6373. expression is ambiguous.
  6374. By default, MODE is set to 'all'. If the command with which the
  6375. expression is used allows more than one choice, then GDB
  6376. automatically selects all possible choices. For instance,
  6377. inserting a breakpoint on a function using an ambiguous name
  6378. results in a breakpoint inserted on each possible match. However,
  6379. if a unique choice must be made, then GDB uses the menu to help you
  6380. disambiguate the expression. For instance, printing the address of
  6381. an overloaded function will result in the use of the menu.
  6382. When MODE is set to 'ask', the debugger always uses the menu when
  6383. an ambiguity is detected.
  6384. Finally, when MODE is set to 'cancel', the debugger reports an
  6385. error due to the ambiguity and the command is aborted.
  6386. 'show multiple-symbols'
  6387. Show the current value of the 'multiple-symbols' setting.
  6388. 
  6389. File: gdb.info, Node: Variables, Next: Arrays, Prev: Ambiguous Expressions, Up: Data
  6390. 10.3 Program Variables
  6391. ======================
  6392. The most common kind of expression to use is the name of a variable in
  6393. your program.
  6394. Variables in expressions are understood in the selected stack frame
  6395. (*note Selecting a Frame: Selection.); they must be either:
  6396. * global (or file-static)
  6397. or
  6398. * visible according to the scope rules of the programming language
  6399. from the point of execution in that frame
  6400. This means that in the function
  6401. foo (a)
  6402. int a;
  6403. {
  6404. bar (a);
  6405. {
  6406. int b = test ();
  6407. bar (b);
  6408. }
  6409. }
  6410. you can examine and use the variable 'a' whenever your program is
  6411. executing within the function 'foo', but you can only use or examine the
  6412. variable 'b' while your program is executing inside the block where 'b'
  6413. is declared.
  6414. There is an exception: you can refer to a variable or function whose
  6415. scope is a single source file even if the current execution point is not
  6416. in this file. But it is possible to have more than one such variable or
  6417. function with the same name (in different source files). If that
  6418. happens, referring to that name has unpredictable effects. If you wish,
  6419. you can specify a static variable in a particular function or file by
  6420. using the colon-colon ('::') notation:
  6421. FILE::VARIABLE
  6422. FUNCTION::VARIABLE
  6423. Here FILE or FUNCTION is the name of the context for the static
  6424. VARIABLE. In the case of file names, you can use quotes to make sure
  6425. GDB parses the file name as a single word--for example, to print a
  6426. global value of 'x' defined in 'f2.c':
  6427. (gdb) p 'f2.c'::x
  6428. The '::' notation is normally used for referring to static variables,
  6429. since you typically disambiguate uses of local variables in functions by
  6430. selecting the appropriate frame and using the simple name of the
  6431. variable. However, you may also use this notation to refer to local
  6432. variables in frames enclosing the selected frame:
  6433. void
  6434. foo (int a)
  6435. {
  6436. if (a < 10)
  6437. bar (a);
  6438. else
  6439. process (a); /* Stop here */
  6440. }
  6441. int
  6442. bar (int a)
  6443. {
  6444. foo (a + 5);
  6445. }
  6446. For example, if there is a breakpoint at the commented line, here is
  6447. what you might see when the program stops after executing the call
  6448. 'bar(0)':
  6449. (gdb) p a
  6450. $1 = 10
  6451. (gdb) p bar::a
  6452. $2 = 5
  6453. (gdb) up 2
  6454. #2 0x080483d0 in foo (a=5) at foobar.c:12
  6455. (gdb) p a
  6456. $3 = 5
  6457. (gdb) p bar::a
  6458. $4 = 0
  6459. These uses of '::' are very rarely in conflict with the very similar
  6460. use of the same notation in C++. When they are in conflict, the C++
  6461. meaning takes precedence; however, this can be overridden by quoting the
  6462. file or function name with single quotes.
  6463. For example, suppose the program is stopped in a method of a class
  6464. that has a field named 'includefile', and there is also an include file
  6465. named 'includefile' that defines a variable, 'some_global'.
  6466. (gdb) p includefile
  6467. $1 = 23
  6468. (gdb) p includefile::some_global
  6469. A syntax error in expression, near `'.
  6470. (gdb) p 'includefile'::some_global
  6471. $2 = 27
  6472. _Warning:_ Occasionally, a local variable may appear to have the
  6473. wrong value at certain points in a function--just after entry to a
  6474. new scope, and just before exit.
  6475. You may see this problem when you are stepping by machine
  6476. instructions. This is because, on most machines, it takes more than one
  6477. instruction to set up a stack frame (including local variable
  6478. definitions); if you are stepping by machine instructions, variables may
  6479. appear to have the wrong values until the stack frame is completely
  6480. built. On exit, it usually also takes more than one machine instruction
  6481. to destroy a stack frame; after you begin stepping through that group of
  6482. instructions, local variable definitions may be gone.
  6483. This may also happen when the compiler does significant
  6484. optimizations. To be sure of always seeing accurate values, turn off
  6485. all optimization when compiling.
  6486. Another possible effect of compiler optimizations is to optimize
  6487. unused variables out of existence, or assign variables to registers (as
  6488. opposed to memory addresses). Depending on the support for such cases
  6489. offered by the debug info format used by the compiler, GDB might not be
  6490. able to display values for such local variables. If that happens, GDB
  6491. will print a message like this:
  6492. No symbol "foo" in current context.
  6493. To solve such problems, either recompile without optimizations, or
  6494. use a different debug info format, if the compiler supports several such
  6495. formats. *Note Compilation::, for more information on choosing compiler
  6496. options. *Note C and C++: C, for more information about debug info
  6497. formats that are best suited to C++ programs.
  6498. If you ask to print an object whose contents are unknown to GDB,
  6499. e.g., because its data type is not completely specified by the debug
  6500. information, GDB will say '<incomplete type>'. *Note incomplete type:
  6501. Symbols, for more about this.
  6502. If you try to examine or use the value of a (global) variable for
  6503. which GDB has no type information, e.g., because the program includes no
  6504. debug information, GDB displays an error message. *Note unknown type:
  6505. Symbols, for more about unknown types. If you cast the variable to its
  6506. declared type, GDB gets the variable's value using the cast-to type as
  6507. the variable's type. For example, in a C program:
  6508. (gdb) p var
  6509. 'var' has unknown type; cast it to its declared type
  6510. (gdb) p (float) var
  6511. $1 = 3.14
  6512. If you append '@entry' string to a function parameter name you get
  6513. its value at the time the function got called. If the value is not
  6514. available an error message is printed. Entry values are available only
  6515. with some compilers. Entry values are normally also printed at the
  6516. function parameter list according to *note set print entry-values::.
  6517. Breakpoint 1, d (i=30) at gdb.base/entry-value.c:29
  6518. 29 i++;
  6519. (gdb) next
  6520. 30 e (i);
  6521. (gdb) print i
  6522. $1 = 31
  6523. (gdb) print i@entry
  6524. $2 = 30
  6525. Strings are identified as arrays of 'char' values without specified
  6526. signedness. Arrays of either 'signed char' or 'unsigned char' get
  6527. printed as arrays of 1 byte sized integers. '-fsigned-char' or
  6528. '-funsigned-char' GCC options have no effect as GDB defines literal
  6529. string type '"char"' as 'char' without a sign. For program code
  6530. char var0[] = "A";
  6531. signed char var1[] = "A";
  6532. You get during debugging
  6533. (gdb) print var0
  6534. $1 = "A"
  6535. (gdb) print var1
  6536. $2 = {65 'A', 0 '\0'}
  6537. 
  6538. File: gdb.info, Node: Arrays, Next: Output Formats, Prev: Variables, Up: Data
  6539. 10.4 Artificial Arrays
  6540. ======================
  6541. It is often useful to print out several successive objects of the same
  6542. type in memory; a section of an array, or an array of dynamically
  6543. determined size for which only a pointer exists in the program.
  6544. You can do this by referring to a contiguous span of memory as an
  6545. "artificial array", using the binary operator '@'. The left operand of
  6546. '@' should be the first element of the desired array and be an
  6547. individual object. The right operand should be the desired length of
  6548. the array. The result is an array value whose elements are all of the
  6549. type of the left argument. The first element is actually the left
  6550. argument; the second element comes from bytes of memory immediately
  6551. following those that hold the first element, and so on. Here is an
  6552. example. If a program says
  6553. int *array = (int *) malloc (len * sizeof (int));
  6554. you can print the contents of 'array' with
  6555. p *array@len
  6556. The left operand of '@' must reside in memory. Array values made
  6557. with '@' in this way behave just like other arrays in terms of
  6558. subscripting, and are coerced to pointers when used in expressions.
  6559. Artificial arrays most often appear in expressions via the value history
  6560. (*note Value History: Value History.), after printing one out.
  6561. Another way to create an artificial array is to use a cast. This
  6562. re-interprets a value as if it were an array. The value need not be in
  6563. memory:
  6564. (gdb) p/x (short[2])0x12345678
  6565. $1 = {0x1234, 0x5678}
  6566. As a convenience, if you leave the array length out (as in
  6567. '(TYPE[])VALUE') GDB calculates the size to fill the value (as
  6568. 'sizeof(VALUE)/sizeof(TYPE)':
  6569. (gdb) p/x (short[])0x12345678
  6570. $2 = {0x1234, 0x5678}
  6571. Sometimes the artificial array mechanism is not quite enough; in
  6572. moderately complex data structures, the elements of interest may not
  6573. actually be adjacent--for example, if you are interested in the values
  6574. of pointers in an array. One useful work-around in this situation is to
  6575. use a convenience variable (*note Convenience Variables: Convenience
  6576. Vars.) as a counter in an expression that prints the first interesting
  6577. value, and then repeat that expression via <RET>. For instance, suppose
  6578. you have an array 'dtab' of pointers to structures, and you are
  6579. interested in the values of a field 'fv' in each structure. Here is an
  6580. example of what you might type:
  6581. set $i = 0
  6582. p dtab[$i++]->fv
  6583. <RET>
  6584. <RET>
  6585. ...
  6586. 
  6587. File: gdb.info, Node: Output Formats, Next: Memory, Prev: Arrays, Up: Data
  6588. 10.5 Output Formats
  6589. ===================
  6590. By default, GDB prints a value according to its data type. Sometimes
  6591. this is not what you want. For example, you might want to print a
  6592. number in hex, or a pointer in decimal. Or you might want to view data
  6593. in memory at a certain address as a character string or as an
  6594. instruction. To do these things, specify an "output format" when you
  6595. print a value.
  6596. The simplest use of output formats is to say how to print a value
  6597. already computed. This is done by starting the arguments of the 'print'
  6598. command with a slash and a format letter. The format letters supported
  6599. are:
  6600. 'x'
  6601. Regard the bits of the value as an integer, and print the integer
  6602. in hexadecimal.
  6603. 'd'
  6604. Print as integer in signed decimal.
  6605. 'u'
  6606. Print as integer in unsigned decimal.
  6607. 'o'
  6608. Print as integer in octal.
  6609. 't'
  6610. Print as integer in binary. The letter 't' stands for "two". (1)
  6611. 'a'
  6612. Print as an address, both absolute in hexadecimal and as an offset
  6613. from the nearest preceding symbol. You can use this format used to
  6614. discover where (in what function) an unknown address is located:
  6615. (gdb) p/a 0x54320
  6616. $3 = 0x54320 <_initialize_vx+396>
  6617. The command 'info symbol 0x54320' yields similar results. *Note
  6618. info symbol: Symbols.
  6619. 'c'
  6620. Regard as an integer and print it as a character constant. This
  6621. prints both the numerical value and its character representation.
  6622. The character representation is replaced with the octal escape
  6623. '\nnn' for characters outside the 7-bit ASCII range.
  6624. Without this format, GDB displays 'char', 'unsigned char', and 'signed char'
  6625. data as character constants. Single-byte members of vectors are
  6626. displayed as integer data.
  6627. 'f'
  6628. Regard the bits of the value as a floating point number and print
  6629. using typical floating point syntax.
  6630. 's'
  6631. Regard as a string, if possible. With this format, pointers to
  6632. single-byte data are displayed as null-terminated strings and
  6633. arrays of single-byte data are displayed as fixed-length strings.
  6634. Other values are displayed in their natural types.
  6635. Without this format, GDB displays pointers to and arrays of 'char',
  6636. 'unsigned char', and 'signed char' as strings. Single-byte members
  6637. of a vector are displayed as an integer array.
  6638. 'z'
  6639. Like 'x' formatting, the value is treated as an integer and printed
  6640. as hexadecimal, but leading zeros are printed to pad the value to
  6641. the size of the integer type.
  6642. 'r'
  6643. Print using the 'raw' formatting. By default, GDB will use a
  6644. Python-based pretty-printer, if one is available (*note Pretty
  6645. Printing::). This typically results in a higher-level display of
  6646. the value's contents. The 'r' format bypasses any Python
  6647. pretty-printer which might exist.
  6648. For example, to print the program counter in hex (*note Registers::),
  6649. type
  6650. p/x $pc
  6651. Note that no space is required before the slash; this is because command
  6652. names in GDB cannot contain a slash.
  6653. To reprint the last value in the value history with a different
  6654. format, you can use the 'print' command with just a format and no
  6655. expression. For example, 'p/x' reprints the last value in hex.
  6656. ---------- Footnotes ----------
  6657. (1) 'b' cannot be used because these format letters are also used
  6658. with the 'x' command, where 'b' stands for "byte"; see *note Examining
  6659. Memory: Memory.
  6660. 
  6661. File: gdb.info, Node: Memory, Next: Auto Display, Prev: Output Formats, Up: Data
  6662. 10.6 Examining Memory
  6663. =====================
  6664. You can use the command 'x' (for "examine") to examine memory in any of
  6665. several formats, independently of your program's data types.
  6666. 'x/NFU ADDR'
  6667. 'x ADDR'
  6668. 'x'
  6669. Use the 'x' command to examine memory.
  6670. N, F, and U are all optional parameters that specify how much memory
  6671. to display and how to format it; ADDR is an expression giving the
  6672. address where you want to start displaying memory. If you use defaults
  6673. for NFU, you need not type the slash '/'. Several commands set
  6674. convenient defaults for ADDR.
  6675. N, the repeat count
  6676. The repeat count is a decimal integer; the default is 1. It
  6677. specifies how much memory (counting by units U) to display. If a
  6678. negative number is specified, memory is examined backward from
  6679. ADDR.
  6680. F, the display format
  6681. The display format is one of the formats used by 'print' ('x', 'd',
  6682. 'u', 'o', 't', 'a', 'c', 'f', 's'), and in addition 'i' (for
  6683. machine instructions). The default is 'x' (hexadecimal) initially.
  6684. The default changes each time you use either 'x' or 'print'.
  6685. U, the unit size
  6686. The unit size is any of
  6687. 'b'
  6688. Bytes.
  6689. 'h'
  6690. Halfwords (two bytes).
  6691. 'w'
  6692. Words (four bytes). This is the initial default.
  6693. 'g'
  6694. Giant words (eight bytes).
  6695. Each time you specify a unit size with 'x', that size becomes the
  6696. default unit the next time you use 'x'. For the 'i' format, the
  6697. unit size is ignored and is normally not written. For the 's'
  6698. format, the unit size defaults to 'b', unless it is explicitly
  6699. given. Use 'x /hs' to display 16-bit char strings and 'x /ws' to
  6700. display 32-bit strings. The next use of 'x /s' will again display
  6701. 8-bit strings. Note that the results depend on the programming
  6702. language of the current compilation unit. If the language is C,
  6703. the 's' modifier will use the UTF-16 encoding while 'w' will use
  6704. UTF-32. The encoding is set by the programming language and cannot
  6705. be altered.
  6706. ADDR, starting display address
  6707. ADDR is the address where you want GDB to begin displaying memory.
  6708. The expression need not have a pointer value (though it may); it is
  6709. always interpreted as an integer address of a byte of memory.
  6710. *Note Expressions: Expressions, for more information on
  6711. expressions. The default for ADDR is usually just after the last
  6712. address examined--but several other commands also set the default
  6713. address: 'info breakpoints' (to the address of the last breakpoint
  6714. listed), 'info line' (to the starting address of a line), and
  6715. 'print' (if you use it to display a value from memory).
  6716. For example, 'x/3uh 0x54320' is a request to display three halfwords
  6717. ('h') of memory, formatted as unsigned decimal integers ('u'), starting
  6718. at address '0x54320'. 'x/4xw $sp' prints the four words ('w') of memory
  6719. above the stack pointer (here, '$sp'; *note Registers: Registers.) in
  6720. hexadecimal ('x').
  6721. You can also specify a negative repeat count to examine memory
  6722. backward from the given address. For example, 'x/-3uh 0x54320' prints
  6723. three halfwords ('h') at '0x54314', '0x54328', and '0x5431c'.
  6724. Since the letters indicating unit sizes are all distinct from the
  6725. letters specifying output formats, you do not have to remember whether
  6726. unit size or format comes first; either order works. The output
  6727. specifications '4xw' and '4wx' mean exactly the same thing. (However,
  6728. the count N must come first; 'wx4' does not work.)
  6729. Even though the unit size U is ignored for the formats 's' and 'i',
  6730. you might still want to use a count N; for example, '3i' specifies that
  6731. you want to see three machine instructions, including any operands. For
  6732. convenience, especially when used with the 'display' command, the 'i'
  6733. format also prints branch delay slot instructions, if any, beyond the
  6734. count specified, which immediately follow the last instruction that is
  6735. within the count. The command 'disassemble' gives an alternative way of
  6736. inspecting machine instructions; see *note Source and Machine Code:
  6737. Machine Code.
  6738. If a negative repeat count is specified for the formats 's' or 'i',
  6739. the command displays null-terminated strings or instructions before the
  6740. given address as many as the absolute value of the given number. For
  6741. the 'i' format, we use line number information in the debug info to
  6742. accurately locate instruction boundaries while disassembling backward.
  6743. If line info is not available, the command stops examining memory with
  6744. an error message.
  6745. All the defaults for the arguments to 'x' are designed to make it
  6746. easy to continue scanning memory with minimal specifications each time
  6747. you use 'x'. For example, after you have inspected three machine
  6748. instructions with 'x/3i ADDR', you can inspect the next seven with just
  6749. 'x/7'. If you use <RET> to repeat the 'x' command, the repeat count N
  6750. is used again; the other arguments default as for successive uses of
  6751. 'x'.
  6752. When examining machine instructions, the instruction at current
  6753. program counter is shown with a '=>' marker. For example:
  6754. (gdb) x/5i $pc-6
  6755. 0x804837f <main+11>: mov %esp,%ebp
  6756. 0x8048381 <main+13>: push %ecx
  6757. 0x8048382 <main+14>: sub $0x4,%esp
  6758. => 0x8048385 <main+17>: movl $0x8048460,(%esp)
  6759. 0x804838c <main+24>: call 0x80482d4 <puts@plt>
  6760. The addresses and contents printed by the 'x' command are not saved
  6761. in the value history because there is often too much of them and they
  6762. would get in the way. Instead, GDB makes these values available for
  6763. subsequent use in expressions as values of the convenience variables
  6764. '$_' and '$__'. After an 'x' command, the last address examined is
  6765. available for use in expressions in the convenience variable '$_'. The
  6766. contents of that address, as examined, are available in the convenience
  6767. variable '$__'.
  6768. If the 'x' command has a repeat count, the address and contents saved
  6769. are from the last memory unit printed; this is not the same as the last
  6770. address printed if several units were printed on the last line of
  6771. output.
  6772. Most targets have an addressable memory unit size of 8 bits. This
  6773. means that to each memory address are associated 8 bits of data. Some
  6774. targets, however, have other addressable memory unit sizes. Within GDB
  6775. and this document, the term "addressable memory unit" (or "memory unit"
  6776. for short) is used when explicitly referring to a chunk of data of that
  6777. size. The word "byte" is used to refer to a chunk of data of 8 bits,
  6778. regardless of the addressable memory unit size of the target. For most
  6779. systems, addressable memory unit is a synonym of byte.
  6780. When you are debugging a program running on a remote target machine
  6781. (*note Remote Debugging::), you may wish to verify the program's image
  6782. in the remote machine's memory against the executable file you
  6783. downloaded to the target. Or, on any target, you may want to check
  6784. whether the program has corrupted its own read-only sections. The
  6785. 'compare-sections' command is provided for such situations.
  6786. 'compare-sections [SECTION-NAME|-r]'
  6787. Compare the data of a loadable section SECTION-NAME in the
  6788. executable file of the program being debugged with the same section
  6789. in the target machine's memory, and report any mismatches. With no
  6790. arguments, compares all loadable sections. With an argument of
  6791. '-r', compares all loadable read-only sections.
  6792. Note: for remote targets, this command can be accelerated if the
  6793. target supports computing the CRC checksum of a block of memory
  6794. (*note qCRC packet::).
  6795. 
  6796. File: gdb.info, Node: Auto Display, Next: Print Settings, Prev: Memory, Up: Data
  6797. 10.7 Automatic Display
  6798. ======================
  6799. If you find that you want to print the value of an expression frequently
  6800. (to see how it changes), you might want to add it to the "automatic
  6801. display list" so that GDB prints its value each time your program stops.
  6802. Each expression added to the list is given a number to identify it; to
  6803. remove an expression from the list, you specify that number. The
  6804. automatic display looks like this:
  6805. 2: foo = 38
  6806. 3: bar[5] = (struct hack *) 0x3804
  6807. This display shows item numbers, expressions and their current values.
  6808. As with displays you request manually using 'x' or 'print', you can
  6809. specify the output format you prefer; in fact, 'display' decides whether
  6810. to use 'print' or 'x' depending your format specification--it uses 'x'
  6811. if you specify either the 'i' or 's' format, or a unit size; otherwise
  6812. it uses 'print'.
  6813. 'display EXPR'
  6814. Add the expression EXPR to the list of expressions to display each
  6815. time your program stops. *Note Expressions: Expressions.
  6816. 'display' does not repeat if you press <RET> again after using it.
  6817. 'display/FMT EXPR'
  6818. For FMT specifying only a display format and not a size or count,
  6819. add the expression EXPR to the auto-display list but arrange to
  6820. display it each time in the specified format FMT. *Note Output
  6821. Formats: Output Formats.
  6822. 'display/FMT ADDR'
  6823. For FMT 'i' or 's', or including a unit-size or a number of units,
  6824. add the expression ADDR as a memory address to be examined each
  6825. time your program stops. Examining means in effect doing 'x/FMT
  6826. ADDR'. *Note Examining Memory: Memory.
  6827. For example, 'display/i $pc' can be helpful, to see the machine
  6828. instruction about to be executed each time execution stops ('$pc' is a
  6829. common name for the program counter; *note Registers: Registers.).
  6830. 'undisplay DNUMS...'
  6831. 'delete display DNUMS...'
  6832. Remove items from the list of expressions to display. Specify the
  6833. numbers of the displays that you want affected with the command
  6834. argument DNUMS. It can be a single display number, one of the
  6835. numbers shown in the first field of the 'info display' display; or
  6836. it could be a range of display numbers, as in '2-4'.
  6837. 'undisplay' does not repeat if you press <RET> after using it.
  6838. (Otherwise you would just get the error 'No display number ...'.)
  6839. 'disable display DNUMS...'
  6840. Disable the display of item numbers DNUMS. A disabled display item
  6841. is not printed automatically, but is not forgotten. It may be
  6842. enabled again later. Specify the numbers of the displays that you
  6843. want affected with the command argument DNUMS. It can be a single
  6844. display number, one of the numbers shown in the first field of the
  6845. 'info display' display; or it could be a range of display numbers,
  6846. as in '2-4'.
  6847. 'enable display DNUMS...'
  6848. Enable display of item numbers DNUMS. It becomes effective once
  6849. again in auto display of its expression, until you specify
  6850. otherwise. Specify the numbers of the displays that you want
  6851. affected with the command argument DNUMS. It can be a single
  6852. display number, one of the numbers shown in the first field of the
  6853. 'info display' display; or it could be a range of display numbers,
  6854. as in '2-4'.
  6855. 'display'
  6856. Display the current values of the expressions on the list, just as
  6857. is done when your program stops.
  6858. 'info display'
  6859. Print the list of expressions previously set up to display
  6860. automatically, each one with its item number, but without showing
  6861. the values. This includes disabled expressions, which are marked
  6862. as such. It also includes expressions which would not be displayed
  6863. right now because they refer to automatic variables not currently
  6864. available.
  6865. If a display expression refers to local variables, then it does not
  6866. make sense outside the lexical context for which it was set up. Such an
  6867. expression is disabled when execution enters a context where one of its
  6868. variables is not defined. For example, if you give the command 'display
  6869. last_char' while inside a function with an argument 'last_char', GDB
  6870. displays this argument while your program continues to stop inside that
  6871. function. When it stops elsewhere--where there is no variable
  6872. 'last_char'--the display is disabled automatically. The next time your
  6873. program stops where 'last_char' is meaningful, you can enable the
  6874. display expression once again.
  6875. 
  6876. File: gdb.info, Node: Print Settings, Next: Pretty Printing, Prev: Auto Display, Up: Data
  6877. 10.8 Print Settings
  6878. ===================
  6879. GDB provides the following ways to control how arrays, structures, and
  6880. symbols are printed.
  6881. These settings are useful for debugging programs in any language:
  6882. 'set print address'
  6883. 'set print address on'
  6884. GDB prints memory addresses showing the location of stack traces,
  6885. structure values, pointer values, breakpoints, and so forth, even
  6886. when it also displays the contents of those addresses. The default
  6887. is 'on'. For example, this is what a stack frame display looks
  6888. like with 'set print address on':
  6889. (gdb) f
  6890. #0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>")
  6891. at input.c:530
  6892. 530 if (lquote != def_lquote)
  6893. 'set print address off'
  6894. Do not print addresses when displaying their contents. For
  6895. example, this is the same stack frame displayed with 'set print
  6896. address off':
  6897. (gdb) set print addr off
  6898. (gdb) f
  6899. #0 set_quotes (lq="<<", rq=">>") at input.c:530
  6900. 530 if (lquote != def_lquote)
  6901. You can use 'set print address off' to eliminate all machine
  6902. dependent displays from the GDB interface. For example, with
  6903. 'print address off', you should get the same text for backtraces on
  6904. all machines--whether or not they involve pointer arguments.
  6905. 'show print address'
  6906. Show whether or not addresses are to be printed.
  6907. When GDB prints a symbolic address, it normally prints the closest
  6908. earlier symbol plus an offset. If that symbol does not uniquely
  6909. identify the address (for example, it is a name whose scope is a single
  6910. source file), you may need to clarify. One way to do this is with 'info
  6911. line', for example 'info line *0x4537'. Alternately, you can set GDB to
  6912. print the source file and line number when it prints a symbolic address:
  6913. 'set print symbol-filename on'
  6914. Tell GDB to print the source file name and line number of a symbol
  6915. in the symbolic form of an address.
  6916. 'set print symbol-filename off'
  6917. Do not print source file name and line number of a symbol. This is
  6918. the default.
  6919. 'show print symbol-filename'
  6920. Show whether or not GDB will print the source file name and line
  6921. number of a symbol in the symbolic form of an address.
  6922. Another situation where it is helpful to show symbol filenames and
  6923. line numbers is when disassembling code; GDB shows you the line number
  6924. and source file that corresponds to each instruction.
  6925. Also, you may wish to see the symbolic form only if the address being
  6926. printed is reasonably close to the closest earlier symbol:
  6927. 'set print max-symbolic-offset MAX-OFFSET'
  6928. 'set print max-symbolic-offset unlimited'
  6929. Tell GDB to only display the symbolic form of an address if the
  6930. offset between the closest earlier symbol and the address is less
  6931. than MAX-OFFSET. The default is 'unlimited', which tells GDB to
  6932. always print the symbolic form of an address if any symbol precedes
  6933. it. Zero is equivalent to 'unlimited'.
  6934. 'show print max-symbolic-offset'
  6935. Ask how large the maximum offset is that GDB prints in a symbolic
  6936. address.
  6937. If you have a pointer and you are not sure where it points, try 'set
  6938. print symbol-filename on'. Then you can determine the name and source
  6939. file location of the variable where it points, using 'p/a POINTER'.
  6940. This interprets the address in symbolic form. For example, here GDB
  6941. shows that a variable 'ptt' points at another variable 't', defined in
  6942. 'hi2.c':
  6943. (gdb) set print symbol-filename on
  6944. (gdb) p/a ptt
  6945. $4 = 0xe008 <t in hi2.c>
  6946. _Warning:_ For pointers that point to a local variable, 'p/a' does
  6947. not show the symbol name and filename of the referent, even with
  6948. the appropriate 'set print' options turned on.
  6949. You can also enable '/a'-like formatting all the time using 'set
  6950. print symbol on':
  6951. 'set print symbol on'
  6952. Tell GDB to print the symbol corresponding to an address, if one
  6953. exists.
  6954. 'set print symbol off'
  6955. Tell GDB not to print the symbol corresponding to an address. In
  6956. this mode, GDB will still print the symbol corresponding to
  6957. pointers to functions. This is the default.
  6958. 'show print symbol'
  6959. Show whether GDB will display the symbol corresponding to an
  6960. address.
  6961. Other settings control how different kinds of objects are printed:
  6962. 'set print array'
  6963. 'set print array on'
  6964. Pretty print arrays. This format is more convenient to read, but
  6965. uses more space. The default is off.
  6966. 'set print array off'
  6967. Return to compressed format for arrays.
  6968. 'show print array'
  6969. Show whether compressed or pretty format is selected for displaying
  6970. arrays.
  6971. 'set print array-indexes'
  6972. 'set print array-indexes on'
  6973. Print the index of each element when displaying arrays. May be
  6974. more convenient to locate a given element in the array or quickly
  6975. find the index of a given element in that printed array. The
  6976. default is off.
  6977. 'set print array-indexes off'
  6978. Stop printing element indexes when displaying arrays.
  6979. 'show print array-indexes'
  6980. Show whether the index of each element is printed when displaying
  6981. arrays.
  6982. 'set print elements NUMBER-OF-ELEMENTS'
  6983. 'set print elements unlimited'
  6984. Set a limit on how many elements of an array GDB will print. If
  6985. GDB is printing a large array, it stops printing after it has
  6986. printed the number of elements set by the 'set print elements'
  6987. command. This limit also applies to the display of strings. When
  6988. GDB starts, this limit is set to 200. Setting NUMBER-OF-ELEMENTS
  6989. to 'unlimited' or zero means that the number of elements to print
  6990. is unlimited.
  6991. 'show print elements'
  6992. Display the number of elements of a large array that GDB will
  6993. print. If the number is 0, then the printing is unlimited.
  6994. 'set print frame-arguments VALUE'
  6995. This command allows to control how the values of arguments are
  6996. printed when the debugger prints a frame (*note Frames::). The
  6997. possible values are:
  6998. 'all'
  6999. The values of all arguments are printed.
  7000. 'scalars'
  7001. Print the value of an argument only if it is a scalar. The
  7002. value of more complex arguments such as arrays, structures,
  7003. unions, etc, is replaced by '...'. This is the default. Here
  7004. is an example where only scalar arguments are shown:
  7005. #1 0x08048361 in call_me (i=3, s=..., ss=0xbf8d508c, u=..., e=green)
  7006. at frame-args.c:23
  7007. 'none'
  7008. None of the argument values are printed. Instead, the value
  7009. of each argument is replaced by '...'. In this case, the
  7010. example above now becomes:
  7011. #1 0x08048361 in call_me (i=..., s=..., ss=..., u=..., e=...)
  7012. at frame-args.c:23
  7013. By default, only scalar arguments are printed. This command can be
  7014. used to configure the debugger to print the value of all arguments,
  7015. regardless of their type. However, it is often advantageous to not
  7016. print the value of more complex parameters. For instance, it
  7017. reduces the amount of information printed in each frame, making the
  7018. backtrace more readable. Also, it improves performance when
  7019. displaying Ada frames, because the computation of large arguments
  7020. can sometimes be CPU-intensive, especially in large applications.
  7021. Setting 'print frame-arguments' to 'scalars' (the default) or
  7022. 'none' avoids this computation, thus speeding up the display of
  7023. each Ada frame.
  7024. 'show print frame-arguments'
  7025. Show how the value of arguments should be displayed when printing a
  7026. frame.
  7027. 'set print raw frame-arguments on'
  7028. Print frame arguments in raw, non pretty-printed, form.
  7029. 'set print raw frame-arguments off'
  7030. Print frame arguments in pretty-printed form, if there is a
  7031. pretty-printer for the value (*note Pretty Printing::), otherwise
  7032. print the value in raw form. This is the default.
  7033. 'show print raw frame-arguments'
  7034. Show whether to print frame arguments in raw form.
  7035. 'set print entry-values VALUE'
  7036. Set printing of frame argument values at function entry. In some
  7037. cases GDB can determine the value of function argument which was
  7038. passed by the function caller, even if the value was modified
  7039. inside the called function and therefore is different. With
  7040. optimized code, the current value could be unavailable, but the
  7041. entry value may still be known.
  7042. The default value is 'default' (see below for its description).
  7043. Older GDB behaved as with the setting 'no'. Compilers not
  7044. supporting this feature will behave in the 'default' setting the
  7045. same way as with the 'no' setting.
  7046. This functionality is currently supported only by DWARF 2 debugging
  7047. format and the compiler has to produce 'DW_TAG_call_site' tags.
  7048. With GCC, you need to specify '-O -g' during compilation, to get
  7049. this information.
  7050. The VALUE parameter can be one of the following:
  7051. 'no'
  7052. Print only actual parameter values, never print values from
  7053. function entry point.
  7054. #0 equal (val=5)
  7055. #0 different (val=6)
  7056. #0 lost (val=<optimized out>)
  7057. #0 born (val=10)
  7058. #0 invalid (val=<optimized out>)
  7059. 'only'
  7060. Print only parameter values from function entry point. The
  7061. actual parameter values are never printed.
  7062. #0 equal (val@entry=5)
  7063. #0 different (val@entry=5)
  7064. #0 lost (val@entry=5)
  7065. #0 born (val@entry=<optimized out>)
  7066. #0 invalid (val@entry=<optimized out>)
  7067. 'preferred'
  7068. Print only parameter values from function entry point. If
  7069. value from function entry point is not known while the actual
  7070. value is known, print the actual value for such parameter.
  7071. #0 equal (val@entry=5)
  7072. #0 different (val@entry=5)
  7073. #0 lost (val@entry=5)
  7074. #0 born (val=10)
  7075. #0 invalid (val@entry=<optimized out>)
  7076. 'if-needed'
  7077. Print actual parameter values. If actual parameter value is
  7078. not known while value from function entry point is known,
  7079. print the entry point value for such parameter.
  7080. #0 equal (val=5)
  7081. #0 different (val=6)
  7082. #0 lost (val@entry=5)
  7083. #0 born (val=10)
  7084. #0 invalid (val=<optimized out>)
  7085. 'both'
  7086. Always print both the actual parameter value and its value
  7087. from function entry point, even if values of one or both are
  7088. not available due to compiler optimizations.
  7089. #0 equal (val=5, val@entry=5)
  7090. #0 different (val=6, val@entry=5)
  7091. #0 lost (val=<optimized out>, val@entry=5)
  7092. #0 born (val=10, val@entry=<optimized out>)
  7093. #0 invalid (val=<optimized out>, val@entry=<optimized out>)
  7094. 'compact'
  7095. Print the actual parameter value if it is known and also its
  7096. value from function entry point if it is known. If neither is
  7097. known, print for the actual value '<optimized out>'. If not
  7098. in MI mode (*note GDB/MI::) and if both values are known and
  7099. identical, print the shortened 'param=param@entry=VALUE'
  7100. notation.
  7101. #0 equal (val=val@entry=5)
  7102. #0 different (val=6, val@entry=5)
  7103. #0 lost (val@entry=5)
  7104. #0 born (val=10)
  7105. #0 invalid (val=<optimized out>)
  7106. 'default'
  7107. Always print the actual parameter value. Print also its value
  7108. from function entry point, but only if it is known. If not in
  7109. MI mode (*note GDB/MI::) and if both values are known and
  7110. identical, print the shortened 'param=param@entry=VALUE'
  7111. notation.
  7112. #0 equal (val=val@entry=5)
  7113. #0 different (val=6, val@entry=5)
  7114. #0 lost (val=<optimized out>, val@entry=5)
  7115. #0 born (val=10)
  7116. #0 invalid (val=<optimized out>)
  7117. For analysis messages on possible failures of frame argument values
  7118. at function entry resolution see *note set debug entry-values::.
  7119. 'show print entry-values'
  7120. Show the method being used for printing of frame argument values at
  7121. function entry.
  7122. 'set print repeats NUMBER-OF-REPEATS'
  7123. 'set print repeats unlimited'
  7124. Set the threshold for suppressing display of repeated array
  7125. elements. When the number of consecutive identical elements of an
  7126. array exceeds the threshold, GDB prints the string '"<repeats N
  7127. times>"', where N is the number of identical repetitions, instead
  7128. of displaying the identical elements themselves. Setting the
  7129. threshold to 'unlimited' or zero will cause all elements to be
  7130. individually printed. The default threshold is 10.
  7131. 'show print repeats'
  7132. Display the current threshold for printing repeated identical
  7133. elements.
  7134. 'set print null-stop'
  7135. Cause GDB to stop printing the characters of an array when the
  7136. first NULL is encountered. This is useful when large arrays
  7137. actually contain only short strings. The default is off.
  7138. 'show print null-stop'
  7139. Show whether GDB stops printing an array on the first NULL
  7140. character.
  7141. 'set print pretty on'
  7142. Cause GDB to print structures in an indented format with one member
  7143. per line, like this:
  7144. $1 = {
  7145. next = 0x0,
  7146. flags = {
  7147. sweet = 1,
  7148. sour = 1
  7149. },
  7150. meat = 0x54 "Pork"
  7151. }
  7152. 'set print pretty off'
  7153. Cause GDB to print structures in a compact format, like this:
  7154. $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \
  7155. meat = 0x54 "Pork"}
  7156. This is the default format.
  7157. 'show print pretty'
  7158. Show which format GDB is using to print structures.
  7159. 'set print sevenbit-strings on'
  7160. Print using only seven-bit characters; if this option is set, GDB
  7161. displays any eight-bit characters (in strings or character values)
  7162. using the notation '\'NNN. This setting is best if you are working
  7163. in English (ASCII) and you use the high-order bit of characters as
  7164. a marker or "meta" bit.
  7165. 'set print sevenbit-strings off'
  7166. Print full eight-bit characters. This allows the use of more
  7167. international character sets, and is the default.
  7168. 'show print sevenbit-strings'
  7169. Show whether or not GDB is printing only seven-bit characters.
  7170. 'set print union on'
  7171. Tell GDB to print unions which are contained in structures and
  7172. other unions. This is the default setting.
  7173. 'set print union off'
  7174. Tell GDB not to print unions which are contained in structures and
  7175. other unions. GDB will print '"{...}"' instead.
  7176. 'show print union'
  7177. Ask GDB whether or not it will print unions which are contained in
  7178. structures and other unions.
  7179. For example, given the declarations
  7180. typedef enum {Tree, Bug} Species;
  7181. typedef enum {Big_tree, Acorn, Seedling} Tree_forms;
  7182. typedef enum {Caterpillar, Cocoon, Butterfly}
  7183. Bug_forms;
  7184. struct thing {
  7185. Species it;
  7186. union {
  7187. Tree_forms tree;
  7188. Bug_forms bug;
  7189. } form;
  7190. };
  7191. struct thing foo = {Tree, {Acorn}};
  7192. with 'set print union on' in effect 'p foo' would print
  7193. $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}}
  7194. and with 'set print union off' in effect it would print
  7195. $1 = {it = Tree, form = {...}}
  7196. 'set print union' affects programs written in C-like languages and
  7197. in Pascal.
  7198. These settings are of interest when debugging C++ programs:
  7199. 'set print demangle'
  7200. 'set print demangle on'
  7201. Print C++ names in their source form rather than in the encoded
  7202. ("mangled") form passed to the assembler and linker for type-safe
  7203. linkage. The default is on.
  7204. 'show print demangle'
  7205. Show whether C++ names are printed in mangled or demangled form.
  7206. 'set print asm-demangle'
  7207. 'set print asm-demangle on'
  7208. Print C++ names in their source form rather than their mangled
  7209. form, even in assembler code printouts such as instruction
  7210. disassemblies. The default is off.
  7211. 'show print asm-demangle'
  7212. Show whether C++ names in assembly listings are printed in mangled
  7213. or demangled form.
  7214. 'set demangle-style STYLE'
  7215. Choose among several encoding schemes used by different compilers
  7216. to represent C++ names. If you omit STYLE, you will see a list of
  7217. possible formats. The default value is AUTO, which lets GDB choose
  7218. a decoding style by inspecting your program.
  7219. 'show demangle-style'
  7220. Display the encoding style currently in use for decoding C++
  7221. symbols.
  7222. 'set print object'
  7223. 'set print object on'
  7224. When displaying a pointer to an object, identify the _actual_
  7225. (derived) type of the object rather than the _declared_ type, using
  7226. the virtual function table. Note that the virtual function table
  7227. is required--this feature can only work for objects that have
  7228. run-time type identification; a single virtual method in the
  7229. object's declared type is sufficient. Note that this setting is
  7230. also taken into account when working with variable objects via MI
  7231. (*note GDB/MI::).
  7232. 'set print object off'
  7233. Display only the declared type of objects, without reference to the
  7234. virtual function table. This is the default setting.
  7235. 'show print object'
  7236. Show whether actual, or declared, object types are displayed.
  7237. 'set print static-members'
  7238. 'set print static-members on'
  7239. Print static members when displaying a C++ object. The default is
  7240. on.
  7241. 'set print static-members off'
  7242. Do not print static members when displaying a C++ object.
  7243. 'show print static-members'
  7244. Show whether C++ static members are printed or not.
  7245. 'set print pascal_static-members'
  7246. 'set print pascal_static-members on'
  7247. Print static members when displaying a Pascal object. The default
  7248. is on.
  7249. 'set print pascal_static-members off'
  7250. Do not print static members when displaying a Pascal object.
  7251. 'show print pascal_static-members'
  7252. Show whether Pascal static members are printed or not.
  7253. 'set print vtbl'
  7254. 'set print vtbl on'
  7255. Pretty print C++ virtual function tables. The default is off.
  7256. (The 'vtbl' commands do not work on programs compiled with the HP
  7257. ANSI C++ compiler ('aCC').)
  7258. 'set print vtbl off'
  7259. Do not pretty print C++ virtual function tables.
  7260. 'show print vtbl'
  7261. Show whether C++ virtual function tables are pretty printed, or
  7262. not.
  7263. 
  7264. File: gdb.info, Node: Pretty Printing, Next: Value History, Prev: Print Settings, Up: Data
  7265. 10.9 Pretty Printing
  7266. ====================
  7267. GDB provides a mechanism to allow pretty-printing of values using Python
  7268. code. It greatly simplifies the display of complex objects. This
  7269. mechanism works for both MI and the CLI.
  7270. * Menu:
  7271. * Pretty-Printer Introduction:: Introduction to pretty-printers
  7272. * Pretty-Printer Example:: An example pretty-printer
  7273. * Pretty-Printer Commands:: Pretty-printer commands
  7274. 
  7275. File: gdb.info, Node: Pretty-Printer Introduction, Next: Pretty-Printer Example, Up: Pretty Printing
  7276. 10.9.1 Pretty-Printer Introduction
  7277. ----------------------------------
  7278. When GDB prints a value, it first sees if there is a pretty-printer
  7279. registered for the value. If there is then GDB invokes the
  7280. pretty-printer to print the value. Otherwise the value is printed
  7281. normally.
  7282. Pretty-printers are normally named. This makes them easy to manage.
  7283. The 'info pretty-printer' command will list all the installed
  7284. pretty-printers with their names. If a pretty-printer can handle
  7285. multiple data types, then its "subprinters" are the printers for the
  7286. individual data types. Each such subprinter has its own name. The
  7287. format of the name is PRINTER-NAME;SUBPRINTER-NAME.
  7288. Pretty-printers are installed by "registering" them with GDB.
  7289. Typically they are automatically loaded and registered when the
  7290. corresponding debug information is loaded, thus making them available
  7291. without having to do anything special.
  7292. There are three places where a pretty-printer can be registered.
  7293. * Pretty-printers registered globally are available when debugging
  7294. all inferiors.
  7295. * Pretty-printers registered with a program space are available only
  7296. when debugging that program. *Note Progspaces In Python::, for
  7297. more details on program spaces in Python.
  7298. * Pretty-printers registered with an objfile are loaded and unloaded
  7299. with the corresponding objfile (e.g., shared library). *Note
  7300. Objfiles In Python::, for more details on objfiles in Python.
  7301. *Note Selecting Pretty-Printers::, for further information on how
  7302. pretty-printers are selected,
  7303. *Note Writing a Pretty-Printer::, for implementing pretty printers
  7304. for new types.
  7305. 
  7306. File: gdb.info, Node: Pretty-Printer Example, Next: Pretty-Printer Commands, Prev: Pretty-Printer Introduction, Up: Pretty Printing
  7307. 10.9.2 Pretty-Printer Example
  7308. -----------------------------
  7309. Here is how a C++ 'std::string' looks without a pretty-printer:
  7310. (gdb) print s
  7311. $1 = {
  7312. static npos = 4294967295,
  7313. _M_dataplus = {
  7314. <std::allocator<char>> = {
  7315. <__gnu_cxx::new_allocator<char>> = {
  7316. <No data fields>}, <No data fields>
  7317. },
  7318. members of std::basic_string<char, std::char_traits<char>,
  7319. std::allocator<char> >::_Alloc_hider:
  7320. _M_p = 0x804a014 "abcd"
  7321. }
  7322. }
  7323. With a pretty-printer for 'std::string' only the contents are
  7324. printed:
  7325. (gdb) print s
  7326. $2 = "abcd"
  7327. 
  7328. File: gdb.info, Node: Pretty-Printer Commands, Prev: Pretty-Printer Example, Up: Pretty Printing
  7329. 10.9.3 Pretty-Printer Commands
  7330. ------------------------------
  7331. 'info pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7332. Print the list of installed pretty-printers. This includes
  7333. disabled pretty-printers, which are marked as such.
  7334. OBJECT-REGEXP is a regular expression matching the objects whose
  7335. pretty-printers to list. Objects can be 'global', the program
  7336. space's file (*note Progspaces In Python::), and the object files
  7337. within that program space (*note Objfiles In Python::). *Note
  7338. Selecting Pretty-Printers::, for details on how GDB looks up a
  7339. printer from these three objects.
  7340. NAME-REGEXP is a regular expression matching the name of the
  7341. printers to list.
  7342. 'disable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7343. Disable pretty-printers matching OBJECT-REGEXP and NAME-REGEXP. A
  7344. disabled pretty-printer is not forgotten, it may be enabled again
  7345. later.
  7346. 'enable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
  7347. Enable pretty-printers matching OBJECT-REGEXP and NAME-REGEXP.
  7348. Example:
  7349. Suppose we have three pretty-printers installed: one from library1.so
  7350. named 'foo' that prints objects of type 'foo', and another from
  7351. library2.so named 'bar' that prints two types of objects, 'bar1' and
  7352. 'bar2'.
  7353. (gdb) info pretty-printer
  7354. library1.so:
  7355. foo
  7356. library2.so:
  7357. bar
  7358. bar1
  7359. bar2
  7360. (gdb) info pretty-printer library2
  7361. library2.so:
  7362. bar
  7363. bar1
  7364. bar2
  7365. (gdb) disable pretty-printer library1
  7366. 1 printer disabled
  7367. 2 of 3 printers enabled
  7368. (gdb) info pretty-printer
  7369. library1.so:
  7370. foo [disabled]
  7371. library2.so:
  7372. bar
  7373. bar1
  7374. bar2
  7375. (gdb) disable pretty-printer library2 bar;bar1
  7376. 1 printer disabled
  7377. 1 of 3 printers enabled
  7378. (gdb) info pretty-printer library2
  7379. library1.so:
  7380. foo [disabled]
  7381. library2.so:
  7382. bar
  7383. bar1 [disabled]
  7384. bar2
  7385. (gdb) disable pretty-printer library2 bar
  7386. 1 printer disabled
  7387. 0 of 3 printers enabled
  7388. (gdb) info pretty-printer library2
  7389. library1.so:
  7390. foo [disabled]
  7391. library2.so:
  7392. bar [disabled]
  7393. bar1 [disabled]
  7394. bar2
  7395. Note that for 'bar' the entire printer can be disabled, as can each
  7396. individual subprinter.
  7397. 
  7398. File: gdb.info, Node: Value History, Next: Convenience Vars, Prev: Pretty Printing, Up: Data
  7399. 10.10 Value History
  7400. ===================
  7401. Values printed by the 'print' command are saved in the GDB "value
  7402. history". This allows you to refer to them in other expressions.
  7403. Values are kept until the symbol table is re-read or discarded (for
  7404. example with the 'file' or 'symbol-file' commands). When the symbol
  7405. table changes, the value history is discarded, since the values may
  7406. contain pointers back to the types defined in the symbol table.
  7407. The values printed are given "history numbers" by which you can refer
  7408. to them. These are successive integers starting with one. 'print'
  7409. shows you the history number assigned to a value by printing '$NUM = '
  7410. before the value; here NUM is the history number.
  7411. To refer to any previous value, use '$' followed by the value's
  7412. history number. The way 'print' labels its output is designed to remind
  7413. you of this. Just '$' refers to the most recent value in the history,
  7414. and '$$' refers to the value before that. '$$N' refers to the Nth value
  7415. from the end; '$$2' is the value just prior to '$$', '$$1' is equivalent
  7416. to '$$', and '$$0' is equivalent to '$'.
  7417. For example, suppose you have just printed a pointer to a structure
  7418. and want to see the contents of the structure. It suffices to type
  7419. p *$
  7420. If you have a chain of structures where the component 'next' points
  7421. to the next one, you can print the contents of the next one with this:
  7422. p *$.next
  7423. You can print successive links in the chain by repeating this
  7424. command--which you can do by just typing <RET>.
  7425. Note that the history records values, not expressions. If the value
  7426. of 'x' is 4 and you type these commands:
  7427. print x
  7428. set x=5
  7429. then the value recorded in the value history by the 'print' command
  7430. remains 4 even though the value of 'x' has changed.
  7431. 'show values'
  7432. Print the last ten values in the value history, with their item
  7433. numbers. This is like 'p $$9' repeated ten times, except that
  7434. 'show values' does not change the history.
  7435. 'show values N'
  7436. Print ten history values centered on history item number N.
  7437. 'show values +'
  7438. Print ten history values just after the values last printed. If no
  7439. more values are available, 'show values +' produces no display.
  7440. Pressing <RET> to repeat 'show values N' has exactly the same effect
  7441. as 'show values +'.
  7442. 
  7443. File: gdb.info, Node: Convenience Vars, Next: Convenience Funs, Prev: Value History, Up: Data
  7444. 10.11 Convenience Variables
  7445. ===========================
  7446. GDB provides "convenience variables" that you can use within GDB to hold
  7447. on to a value and refer to it later. These variables exist entirely
  7448. within GDB; they are not part of your program, and setting a convenience
  7449. variable has no direct effect on further execution of your program.
  7450. That is why you can use them freely.
  7451. Convenience variables are prefixed with '$'. Any name preceded by
  7452. '$' can be used for a convenience variable, unless it is one of the
  7453. predefined machine-specific register names (*note Registers:
  7454. Registers.). (Value history references, in contrast, are _numbers_
  7455. preceded by '$'. *Note Value History: Value History.)
  7456. You can save a value in a convenience variable with an assignment
  7457. expression, just as you would set a variable in your program. For
  7458. example:
  7459. set $foo = *object_ptr
  7460. would save in '$foo' the value contained in the object pointed to by
  7461. 'object_ptr'.
  7462. Using a convenience variable for the first time creates it, but its
  7463. value is 'void' until you assign a new value. You can alter the value
  7464. with another assignment at any time.
  7465. Convenience variables have no fixed types. You can assign a
  7466. convenience variable any type of value, including structures and arrays,
  7467. even if that variable already has a value of a different type. The
  7468. convenience variable, when used as an expression, has the type of its
  7469. current value.
  7470. 'show convenience'
  7471. Print a list of convenience variables used so far, and their
  7472. values, as well as a list of the convenience functions.
  7473. Abbreviated 'show conv'.
  7474. 'init-if-undefined $VARIABLE = EXPRESSION'
  7475. Set a convenience variable if it has not already been set. This is
  7476. useful for user-defined commands that keep some state. It is
  7477. similar, in concept, to using local static variables with
  7478. initializers in C (except that convenience variables are global).
  7479. It can also be used to allow users to override default values used
  7480. in a command script.
  7481. If the variable is already defined then the expression is not
  7482. evaluated so any side-effects do not occur.
  7483. One of the ways to use a convenience variable is as a counter to be
  7484. incremented or a pointer to be advanced. For example, to print a field
  7485. from successive elements of an array of structures:
  7486. set $i = 0
  7487. print bar[$i++]->contents
  7488. Repeat that command by typing <RET>.
  7489. Some convenience variables are created automatically by GDB and given
  7490. values likely to be useful.
  7491. '$_'
  7492. The variable '$_' is automatically set by the 'x' command to the
  7493. last address examined (*note Examining Memory: Memory.). Other
  7494. commands which provide a default address for 'x' to examine also
  7495. set '$_' to that address; these commands include 'info line' and
  7496. 'info breakpoint'. The type of '$_' is 'void *' except when set by
  7497. the 'x' command, in which case it is a pointer to the type of
  7498. '$__'.
  7499. '$__'
  7500. The variable '$__' is automatically set by the 'x' command to the
  7501. value found in the last address examined. Its type is chosen to
  7502. match the format in which the data was printed.
  7503. '$_exitcode'
  7504. When the program being debugged terminates normally, GDB
  7505. automatically sets this variable to the exit code of the program,
  7506. and resets '$_exitsignal' to 'void'.
  7507. '$_exitsignal'
  7508. When the program being debugged dies due to an uncaught signal, GDB
  7509. automatically sets this variable to that signal's number, and
  7510. resets '$_exitcode' to 'void'.
  7511. To distinguish between whether the program being debugged has
  7512. exited (i.e., '$_exitcode' is not 'void') or signalled (i.e.,
  7513. '$_exitsignal' is not 'void'), the convenience function '$_isvoid'
  7514. can be used (*note Convenience Functions: Convenience Funs.). For
  7515. example, considering the following source code:
  7516. #include <signal.h>
  7517. int
  7518. main (int argc, char *argv[])
  7519. {
  7520. raise (SIGALRM);
  7521. return 0;
  7522. }
  7523. A valid way of telling whether the program being debugged has
  7524. exited or signalled would be:
  7525. (gdb) define has_exited_or_signalled
  7526. Type commands for definition of ``has_exited_or_signalled''.
  7527. End with a line saying just ``end''.
  7528. >if $_isvoid ($_exitsignal)
  7529. >echo The program has exited\n
  7530. >else
  7531. >echo The program has signalled\n
  7532. >end
  7533. >end
  7534. (gdb) run
  7535. Starting program:
  7536. Program terminated with signal SIGALRM, Alarm clock.
  7537. The program no longer exists.
  7538. (gdb) has_exited_or_signalled
  7539. The program has signalled
  7540. As can be seen, GDB correctly informs that the program being
  7541. debugged has signalled, since it calls 'raise' and raises a
  7542. 'SIGALRM' signal. If the program being debugged had not called
  7543. 'raise', then GDB would report a normal exit:
  7544. (gdb) has_exited_or_signalled
  7545. The program has exited
  7546. '$_exception'
  7547. The variable '$_exception' is set to the exception object being
  7548. thrown at an exception-related catchpoint. *Note Set
  7549. Catchpoints::.
  7550. '$_probe_argc'
  7551. '$_probe_arg0...$_probe_arg11'
  7552. Arguments to a static probe. *Note Static Probe Points::.
  7553. '$_sdata'
  7554. The variable '$_sdata' contains extra collected static tracepoint
  7555. data. *Note Tracepoint Action Lists: Tracepoint Actions. Note
  7556. that '$_sdata' could be empty, if not inspecting a trace buffer, or
  7557. if extra static tracepoint data has not been collected.
  7558. '$_siginfo'
  7559. The variable '$_siginfo' contains extra signal information (*note
  7560. extra signal information::). Note that '$_siginfo' could be empty,
  7561. if the application has not yet received any signals. For example,
  7562. it will be empty before you execute the 'run' command.
  7563. '$_tlb'
  7564. The variable '$_tlb' is automatically set when debugging
  7565. applications running on MS-Windows in native mode or connected to
  7566. gdbserver that supports the 'qGetTIBAddr' request. *Note General
  7567. Query Packets::. This variable contains the address of the thread
  7568. information block.
  7569. '$_inferior'
  7570. The number of the current inferior. *Note Debugging Multiple
  7571. Inferiors and Programs: Inferiors and Programs.
  7572. '$_thread'
  7573. The thread number of the current thread. *Note thread numbers::.
  7574. '$_gthread'
  7575. The global number of the current thread. *Note global thread
  7576. numbers::.
  7577. 
  7578. File: gdb.info, Node: Convenience Funs, Next: Registers, Prev: Convenience Vars, Up: Data
  7579. 10.12 Convenience Functions
  7580. ===========================
  7581. GDB also supplies some "convenience functions". These have a syntax
  7582. similar to convenience variables. A convenience function can be used in
  7583. an expression just like an ordinary function; however, a convenience
  7584. function is implemented internally to GDB.
  7585. These functions do not require GDB to be configured with 'Python'
  7586. support, which means that they are always available.
  7587. '$_isvoid (EXPR)'
  7588. Return one if the expression EXPR is 'void'. Otherwise it returns
  7589. zero.
  7590. A 'void' expression is an expression where the type of the result
  7591. is 'void'. For example, you can examine a convenience variable
  7592. (see *note Convenience Variables: Convenience Vars.) to check
  7593. whether it is 'void':
  7594. (gdb) print $_exitcode
  7595. $1 = void
  7596. (gdb) print $_isvoid ($_exitcode)
  7597. $2 = 1
  7598. (gdb) run
  7599. Starting program: ./a.out
  7600. [Inferior 1 (process 29572) exited normally]
  7601. (gdb) print $_exitcode
  7602. $3 = 0
  7603. (gdb) print $_isvoid ($_exitcode)
  7604. $4 = 0
  7605. In the example above, we used '$_isvoid' to check whether
  7606. '$_exitcode' is 'void' before and after the execution of the
  7607. program being debugged. Before the execution there is no exit code
  7608. to be examined, therefore '$_exitcode' is 'void'. After the
  7609. execution the program being debugged returned zero, therefore
  7610. '$_exitcode' is zero, which means that it is not 'void' anymore.
  7611. The 'void' expression can also be a call of a function from the
  7612. program being debugged. For example, given the following function:
  7613. void
  7614. foo (void)
  7615. {
  7616. }
  7617. The result of calling it inside GDB is 'void':
  7618. (gdb) print foo ()
  7619. $1 = void
  7620. (gdb) print $_isvoid (foo ())
  7621. $2 = 1
  7622. (gdb) set $v = foo ()
  7623. (gdb) print $v
  7624. $3 = void
  7625. (gdb) print $_isvoid ($v)
  7626. $4 = 1
  7627. These functions require GDB to be configured with 'Python' support.
  7628. '$_memeq(BUF1, BUF2, LENGTH)'
  7629. Returns one if the LENGTH bytes at the addresses given by BUF1 and
  7630. BUF2 are equal. Otherwise it returns zero.
  7631. '$_regex(STR, REGEX)'
  7632. Returns one if the string STR matches the regular expression REGEX.
  7633. Otherwise it returns zero. The syntax of the regular expression is
  7634. that specified by 'Python''s regular expression support.
  7635. '$_streq(STR1, STR2)'
  7636. Returns one if the strings STR1 and STR2 are equal. Otherwise it
  7637. returns zero.
  7638. '$_strlen(STR)'
  7639. Returns the length of string STR.
  7640. '$_caller_is(NAME[, NUMBER_OF_FRAMES])'
  7641. Returns one if the calling function's name is equal to NAME.
  7642. Otherwise it returns zero.
  7643. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  7644. number of frames up in the stack to look. The default is 1.
  7645. Example:
  7646. (gdb) backtrace
  7647. #0 bottom_func ()
  7648. at testsuite/gdb.python/py-caller-is.c:21
  7649. #1 0x00000000004005a0 in middle_func ()
  7650. at testsuite/gdb.python/py-caller-is.c:27
  7651. #2 0x00000000004005ab in top_func ()
  7652. at testsuite/gdb.python/py-caller-is.c:33
  7653. #3 0x00000000004005b6 in main ()
  7654. at testsuite/gdb.python/py-caller-is.c:39
  7655. (gdb) print $_caller_is ("middle_func")
  7656. $1 = 1
  7657. (gdb) print $_caller_is ("top_func", 2)
  7658. $1 = 1
  7659. '$_caller_matches(REGEXP[, NUMBER_OF_FRAMES])'
  7660. Returns one if the calling function's name matches the regular
  7661. expression REGEXP. Otherwise it returns zero.
  7662. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  7663. number of frames up in the stack to look. The default is 1.
  7664. '$_any_caller_is(NAME[, NUMBER_OF_FRAMES])'
  7665. Returns one if any calling function's name is equal to NAME.
  7666. Otherwise it returns zero.
  7667. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  7668. number of frames up in the stack to look. The default is 1.
  7669. This function differs from '$_caller_is' in that this function
  7670. checks all stack frames from the immediate caller to the frame
  7671. specified by NUMBER_OF_FRAMES, whereas '$_caller_is' only checks
  7672. the frame specified by NUMBER_OF_FRAMES.
  7673. '$_any_caller_matches(REGEXP[, NUMBER_OF_FRAMES])'
  7674. Returns one if any calling function's name matches the regular
  7675. expression REGEXP. Otherwise it returns zero.
  7676. If the optional argument NUMBER_OF_FRAMES is provided, it is the
  7677. number of frames up in the stack to look. The default is 1.
  7678. This function differs from '$_caller_matches' in that this function
  7679. checks all stack frames from the immediate caller to the frame
  7680. specified by NUMBER_OF_FRAMES, whereas '$_caller_matches' only
  7681. checks the frame specified by NUMBER_OF_FRAMES.
  7682. '$_as_string(VALUE)'
  7683. Return the string representation of VALUE.
  7684. This function is useful to obtain the textual label (enumerator) of
  7685. an enumeration value. For example, assuming the variable NODE is
  7686. of an enumerated type:
  7687. (gdb) printf "Visiting node of type %s\n", $_as_string(node)
  7688. Visiting node of type NODE_INTEGER
  7689. GDB provides the ability to list and get help on convenience
  7690. functions.
  7691. 'help function'
  7692. Print a list of all convenience functions.
  7693. 
  7694. File: gdb.info, Node: Registers, Next: Floating Point Hardware, Prev: Convenience Funs, Up: Data
  7695. 10.13 Registers
  7696. ===============
  7697. You can refer to machine register contents, in expressions, as variables
  7698. with names starting with '$'. The names of registers are different for
  7699. each machine; use 'info registers' to see the names used on your
  7700. machine.
  7701. 'info registers'
  7702. Print the names and values of all registers except floating-point
  7703. and vector registers (in the selected stack frame).
  7704. 'info all-registers'
  7705. Print the names and values of all registers, including
  7706. floating-point and vector registers (in the selected stack frame).
  7707. 'info registers REGGROUP ...'
  7708. Print the name and value of the registers in each of the specified
  7709. REGGROUPs. The REGGOUP can be any of those returned by 'maint
  7710. print reggroups' (*note Maintenance Commands::).
  7711. 'info registers REGNAME ...'
  7712. Print the "relativized" value of each specified register REGNAME.
  7713. As discussed in detail below, register values are normally relative
  7714. to the selected stack frame. The REGNAME may be any register name
  7715. valid on the machine you are using, with or without the initial
  7716. '$'.
  7717. GDB has four "standard" register names that are available (in
  7718. expressions) on most machines--whenever they do not conflict with an
  7719. architecture's canonical mnemonics for registers. The register names
  7720. '$pc' and '$sp' are used for the program counter register and the stack
  7721. pointer. '$fp' is used for a register that contains a pointer to the
  7722. current stack frame, and '$ps' is used for a register that contains the
  7723. processor status. For example, you could print the program counter in
  7724. hex with
  7725. p/x $pc
  7726. or print the instruction to be executed next with
  7727. x/i $pc
  7728. or add four to the stack pointer(1) with
  7729. set $sp += 4
  7730. Whenever possible, these four standard register names are available
  7731. on your machine even though the machine has different canonical
  7732. mnemonics, so long as there is no conflict. The 'info registers'
  7733. command shows the canonical names. For example, on the SPARC, 'info
  7734. registers' displays the processor status register as '$psr' but you can
  7735. also refer to it as '$ps'; and on x86-based machines '$ps' is an alias
  7736. for the EFLAGS register.
  7737. GDB always considers the contents of an ordinary register as an
  7738. integer when the register is examined in this way. Some machines have
  7739. special registers which can hold nothing but floating point; these
  7740. registers are considered to have floating point values. There is no way
  7741. to refer to the contents of an ordinary register as floating point value
  7742. (although you can _print_ it as a floating point value with 'print/f
  7743. $REGNAME').
  7744. Some registers have distinct "raw" and "virtual" data formats. This
  7745. means that the data format in which the register contents are saved by
  7746. the operating system is not the same one that your program normally
  7747. sees. For example, the registers of the 68881 floating point
  7748. coprocessor are always saved in "extended" (raw) format, but all C
  7749. programs expect to work with "double" (virtual) format. In such cases,
  7750. GDB normally works with the virtual format only (the format that makes
  7751. sense for your program), but the 'info registers' command prints the
  7752. data in both formats.
  7753. Some machines have special registers whose contents can be
  7754. interpreted in several different ways. For example, modern x86-based
  7755. machines have SSE and MMX registers that can hold several values packed
  7756. together in several different formats. GDB refers to such registers in
  7757. 'struct' notation:
  7758. (gdb) print $xmm1
  7759. $1 = {
  7760. v4_float = {0, 3.43859137e-038, 1.54142831e-044, 1.821688e-044},
  7761. v2_double = {9.92129282474342e-303, 2.7585945287983262e-313},
  7762. v16_int8 = "\000\000\000\000\3706;\001\v\000\000\000\r\000\000",
  7763. v8_int16 = {0, 0, 14072, 315, 11, 0, 13, 0},
  7764. v4_int32 = {0, 20657912, 11, 13},
  7765. v2_int64 = {88725056443645952, 55834574859},
  7766. uint128 = 0x0000000d0000000b013b36f800000000
  7767. }
  7768. To set values of such registers, you need to tell GDB which view of the
  7769. register you wish to change, as if you were assigning value to a
  7770. 'struct' member:
  7771. (gdb) set $xmm1.uint128 = 0x000000000000000000000000FFFFFFFF
  7772. Normally, register values are relative to the selected stack frame
  7773. (*note Selecting a Frame: Selection.). This means that you get the
  7774. value that the register would contain if all stack frames farther in
  7775. were exited and their saved registers restored. In order to see the
  7776. true contents of hardware registers, you must select the innermost frame
  7777. (with 'frame 0').
  7778. Usually ABIs reserve some registers as not needed to be saved by the
  7779. callee (a.k.a.: "caller-saved", "call-clobbered" or "volatile"
  7780. registers). It may therefore not be possible for GDB to know the value
  7781. a register had before the call (in other words, in the outer frame), if
  7782. the register value has since been changed by the callee. GDB tries to
  7783. deduce where the inner frame saved ("callee-saved") registers, from the
  7784. debug info, unwind info, or the machine code generated by your compiler.
  7785. If some register is not saved, and GDB knows the register is
  7786. "caller-saved" (via its own knowledge of the ABI, or because the
  7787. debug/unwind info explicitly says the register's value is undefined),
  7788. GDB displays '<not saved>' as the register's value. With targets that
  7789. GDB has no knowledge of the register saving convention, if a register
  7790. was not saved by the callee, then its value and location in the outer
  7791. frame are assumed to be the same of the inner frame. This is usually
  7792. harmless, because if the register is call-clobbered, the caller either
  7793. does not care what is in the register after the call, or has code to
  7794. restore the value that it does care about. Note, however, that if you
  7795. change such a register in the outer frame, you may also be affecting the
  7796. inner frame. Also, the more "outer" the frame is you're looking at, the
  7797. more likely a call-clobbered register's value is to be wrong, in the
  7798. sense that it doesn't actually represent the value the register had just
  7799. before the call.
  7800. ---------- Footnotes ----------
  7801. (1) This is a way of removing one word from the stack, on machines
  7802. where stacks grow downward in memory (most machines, nowadays). This
  7803. assumes that the innermost stack frame is selected; setting '$sp' is not
  7804. allowed when other stack frames are selected. To pop entire frames off
  7805. the stack, regardless of machine architecture, use 'return'; see *note
  7806. Returning from a Function: Returning.
  7807. 
  7808. File: gdb.info, Node: Floating Point Hardware, Next: Vector Unit, Prev: Registers, Up: Data
  7809. 10.14 Floating Point Hardware
  7810. =============================
  7811. Depending on the configuration, GDB may be able to give you more
  7812. information about the status of the floating point hardware.
  7813. 'info float'
  7814. Display hardware-dependent information about the floating point
  7815. unit. The exact contents and layout vary depending on the floating
  7816. point chip. Currently, 'info float' is supported on the ARM and
  7817. x86 machines.
  7818. 
  7819. File: gdb.info, Node: Vector Unit, Next: OS Information, Prev: Floating Point Hardware, Up: Data
  7820. 10.15 Vector Unit
  7821. =================
  7822. Depending on the configuration, GDB may be able to give you more
  7823. information about the status of the vector unit.
  7824. 'info vector'
  7825. Display information about the vector unit. The exact contents and
  7826. layout vary depending on the hardware.
  7827. 
  7828. File: gdb.info, Node: OS Information, Next: Memory Region Attributes, Prev: Vector Unit, Up: Data
  7829. 10.16 Operating System Auxiliary Information
  7830. ============================================
  7831. GDB provides interfaces to useful OS facilities that can help you debug
  7832. your program.
  7833. Some operating systems supply an "auxiliary vector" to programs at
  7834. startup. This is akin to the arguments and environment that you specify
  7835. for a program, but contains a system-dependent variety of binary values
  7836. that tell system libraries important details about the hardware,
  7837. operating system, and process. Each value's purpose is identified by an
  7838. integer tag; the meanings are well-known but system-specific. Depending
  7839. on the configuration and operating system facilities, GDB may be able to
  7840. show you this information. For remote targets, this functionality may
  7841. further depend on the remote stub's support of the 'qXfer:auxv:read'
  7842. packet, see *note qXfer auxiliary vector read::.
  7843. 'info auxv'
  7844. Display the auxiliary vector of the inferior, which can be either a
  7845. live process or a core dump file. GDB prints each tag value
  7846. numerically, and also shows names and text descriptions for
  7847. recognized tags. Some values in the vector are numbers, some bit
  7848. masks, and some pointers to strings or other data. GDB displays
  7849. each value in the most appropriate form for a recognized tag, and
  7850. in hexadecimal for an unrecognized tag.
  7851. On some targets, GDB can access operating system-specific information
  7852. and show it to you. The types of information available will differ
  7853. depending on the type of operating system running on the target. The
  7854. mechanism used to fetch the data is described in *note Operating System
  7855. Information::. For remote targets, this functionality depends on the
  7856. remote stub's support of the 'qXfer:osdata:read' packet, see *note qXfer
  7857. osdata read::.
  7858. 'info os INFOTYPE'
  7859. Display OS information of the requested type.
  7860. On GNU/Linux, the following values of INFOTYPE are valid:
  7861. 'cpus'
  7862. Display the list of all CPUs/cores. For each CPU/core, GDB
  7863. prints the available fields from /proc/cpuinfo. For each
  7864. supported architecture different fields are available. Two
  7865. common entries are processor which gives CPU number and
  7866. bogomips; a system constant that is calculated during kernel
  7867. initialization.
  7868. 'files'
  7869. Display the list of open file descriptors on the target. For
  7870. each file descriptor, GDB prints the identifier of the process
  7871. owning the descriptor, the command of the owning process, the
  7872. value of the descriptor, and the target of the descriptor.
  7873. 'modules'
  7874. Display the list of all loaded kernel modules on the target.
  7875. For each module, GDB prints the module name, the size of the
  7876. module in bytes, the number of times the module is used, the
  7877. dependencies of the module, the status of the module, and the
  7878. address of the loaded module in memory.
  7879. 'msg'
  7880. Display the list of all System V message queues on the target.
  7881. For each message queue, GDB prints the message queue key, the
  7882. message queue identifier, the access permissions, the current
  7883. number of bytes on the queue, the current number of messages
  7884. on the queue, the processes that last sent and received a
  7885. message on the queue, the user and group of the owner and
  7886. creator of the message queue, the times at which a message was
  7887. last sent and received on the queue, and the time at which the
  7888. message queue was last changed.
  7889. 'processes'
  7890. Display the list of processes on the target. For each
  7891. process, GDB prints the process identifier, the name of the
  7892. user, the command corresponding to the process, and the list
  7893. of processor cores that the process is currently running on.
  7894. (To understand what these properties mean, for this and the
  7895. following info types, please consult the general GNU/Linux
  7896. documentation.)
  7897. 'procgroups'
  7898. Display the list of process groups on the target. For each
  7899. process, GDB prints the identifier of the process group that
  7900. it belongs to, the command corresponding to the process group
  7901. leader, the process identifier, and the command line of the
  7902. process. The list is sorted first by the process group
  7903. identifier, then by the process identifier, so that processes
  7904. belonging to the same process group are grouped together and
  7905. the process group leader is listed first.
  7906. 'semaphores'
  7907. Display the list of all System V semaphore sets on the target.
  7908. For each semaphore set, GDB prints the semaphore set key, the
  7909. semaphore set identifier, the access permissions, the number
  7910. of semaphores in the set, the user and group of the owner and
  7911. creator of the semaphore set, and the times at which the
  7912. semaphore set was operated upon and changed.
  7913. 'shm'
  7914. Display the list of all System V shared-memory regions on the
  7915. target. For each shared-memory region, GDB prints the region
  7916. key, the shared-memory identifier, the access permissions, the
  7917. size of the region, the process that created the region, the
  7918. process that last attached to or detached from the region, the
  7919. current number of live attaches to the region, and the times
  7920. at which the region was last attached to, detach from, and
  7921. changed.
  7922. 'sockets'
  7923. Display the list of Internet-domain sockets on the target.
  7924. For each socket, GDB prints the address and port of the local
  7925. and remote endpoints, the current state of the connection, the
  7926. creator of the socket, the IP address family of the socket,
  7927. and the type of the connection.
  7928. 'threads'
  7929. Display the list of threads running on the target. For each
  7930. thread, GDB prints the identifier of the process that the
  7931. thread belongs to, the command of the process, the thread
  7932. identifier, and the processor core that it is currently
  7933. running on. The main thread of a process is not listed.
  7934. 'info os'
  7935. If INFOTYPE is omitted, then list the possible values for INFOTYPE
  7936. and the kind of OS information available for each INFOTYPE. If the
  7937. target does not return a list of possible types, this command will
  7938. report an error.
  7939. 
  7940. File: gdb.info, Node: Memory Region Attributes, Next: Dump/Restore Files, Prev: OS Information, Up: Data
  7941. 10.17 Memory Region Attributes
  7942. ==============================
  7943. "Memory region attributes" allow you to describe special handling
  7944. required by regions of your target's memory. GDB uses attributes to
  7945. determine whether to allow certain types of memory accesses; whether to
  7946. use specific width accesses; and whether to cache target memory. By
  7947. default the description of memory regions is fetched from the target (if
  7948. the current target supports this), but the user can override the fetched
  7949. regions.
  7950. Defined memory regions can be individually enabled and disabled.
  7951. When a memory region is disabled, GDB uses the default attributes when
  7952. accessing memory in that region. Similarly, if no memory regions have
  7953. been defined, GDB uses the default attributes when accessing all memory.
  7954. When a memory region is defined, it is given a number to identify it;
  7955. to enable, disable, or remove a memory region, you specify that number.
  7956. 'mem LOWER UPPER ATTRIBUTES...'
  7957. Define a memory region bounded by LOWER and UPPER with attributes
  7958. ATTRIBUTES..., and add it to the list of regions monitored by GDB.
  7959. Note that UPPER == 0 is a special case: it is treated as the
  7960. target's maximum memory address. (0xffff on 16 bit targets,
  7961. 0xffffffff on 32 bit targets, etc.)
  7962. 'mem auto'
  7963. Discard any user changes to the memory regions and use
  7964. target-supplied regions, if available, or no regions if the target
  7965. does not support.
  7966. 'delete mem NUMS...'
  7967. Remove memory regions NUMS... from the list of regions monitored by
  7968. GDB.
  7969. 'disable mem NUMS...'
  7970. Disable monitoring of memory regions NUMS.... A disabled memory
  7971. region is not forgotten. It may be enabled again later.
  7972. 'enable mem NUMS...'
  7973. Enable monitoring of memory regions NUMS....
  7974. 'info mem'
  7975. Print a table of all defined memory regions, with the following
  7976. columns for each region:
  7977. _Memory Region Number_
  7978. _Enabled or Disabled._
  7979. Enabled memory regions are marked with 'y'. Disabled memory
  7980. regions are marked with 'n'.
  7981. _Lo Address_
  7982. The address defining the inclusive lower bound of the memory
  7983. region.
  7984. _Hi Address_
  7985. The address defining the exclusive upper bound of the memory
  7986. region.
  7987. _Attributes_
  7988. The list of attributes set for this memory region.
  7989. 10.17.1 Attributes
  7990. ------------------
  7991. 10.17.1.1 Memory Access Mode
  7992. ............................
  7993. The access mode attributes set whether GDB may make read or write
  7994. accesses to a memory region.
  7995. While these attributes prevent GDB from performing invalid memory
  7996. accesses, they do nothing to prevent the target system, I/O DMA, etc.
  7997. from accessing memory.
  7998. 'ro'
  7999. Memory is read only.
  8000. 'wo'
  8001. Memory is write only.
  8002. 'rw'
  8003. Memory is read/write. This is the default.
  8004. 10.17.1.2 Memory Access Size
  8005. ............................
  8006. The access size attribute tells GDB to use specific sized accesses in
  8007. the memory region. Often memory mapped device registers require
  8008. specific sized accesses. If no access size attribute is specified, GDB
  8009. may use accesses of any size.
  8010. '8'
  8011. Use 8 bit memory accesses.
  8012. '16'
  8013. Use 16 bit memory accesses.
  8014. '32'
  8015. Use 32 bit memory accesses.
  8016. '64'
  8017. Use 64 bit memory accesses.
  8018. 10.17.1.3 Data Cache
  8019. ....................
  8020. The data cache attributes set whether GDB will cache target memory.
  8021. While this generally improves performance by reducing debug protocol
  8022. overhead, it can lead to incorrect results because GDB does not know
  8023. about volatile variables or memory mapped device registers.
  8024. 'cache'
  8025. Enable GDB to cache target memory.
  8026. 'nocache'
  8027. Disable GDB from caching target memory. This is the default.
  8028. 10.17.2 Memory Access Checking
  8029. ------------------------------
  8030. GDB can be instructed to refuse accesses to memory that is not
  8031. explicitly described. This can be useful if accessing such regions has
  8032. undesired effects for a specific target, or to provide better error
  8033. checking. The following commands control this behaviour.
  8034. 'set mem inaccessible-by-default [on|off]'
  8035. If 'on' is specified, make GDB treat memory not explicitly
  8036. described by the memory ranges as non-existent and refuse accesses
  8037. to such memory. The checks are only performed if there's at least
  8038. one memory range defined. If 'off' is specified, make GDB treat
  8039. the memory not explicitly described by the memory ranges as RAM.
  8040. The default value is 'on'.
  8041. 'show mem inaccessible-by-default'
  8042. Show the current handling of accesses to unknown memory.
  8043. 
  8044. File: gdb.info, Node: Dump/Restore Files, Next: Core File Generation, Prev: Memory Region Attributes, Up: Data
  8045. 10.18 Copy Between Memory and a File
  8046. ====================================
  8047. You can use the commands 'dump', 'append', and 'restore' to copy data
  8048. between target memory and a file. The 'dump' and 'append' commands
  8049. write data to a file, and the 'restore' command reads data from a file
  8050. back into the inferior's memory. Files may be in binary, Motorola
  8051. S-record, Intel hex, Tektronix Hex, or Verilog Hex format; however, GDB
  8052. can only append to binary files, and cannot read from Verilog Hex files.
  8053. 'dump [FORMAT] memory FILENAME START_ADDR END_ADDR'
  8054. 'dump [FORMAT] value FILENAME EXPR'
  8055. Dump the contents of memory from START_ADDR to END_ADDR, or the
  8056. value of EXPR, to FILENAME in the given format.
  8057. The FORMAT parameter may be any one of:
  8058. 'binary'
  8059. Raw binary form.
  8060. 'ihex'
  8061. Intel hex format.
  8062. 'srec'
  8063. Motorola S-record format.
  8064. 'tekhex'
  8065. Tektronix Hex format.
  8066. 'verilog'
  8067. Verilog Hex format.
  8068. GDB uses the same definitions of these formats as the GNU binary
  8069. utilities, like 'objdump' and 'objcopy'. If FORMAT is omitted, GDB
  8070. dumps the data in raw binary form.
  8071. 'append [binary] memory FILENAME START_ADDR END_ADDR'
  8072. 'append [binary] value FILENAME EXPR'
  8073. Append the contents of memory from START_ADDR to END_ADDR, or the
  8074. value of EXPR, to the file FILENAME, in raw binary form. (GDB can
  8075. only append data to files in raw binary form.)
  8076. 'restore FILENAME [binary] BIAS START END'
  8077. Restore the contents of file FILENAME into memory. The 'restore'
  8078. command can automatically recognize any known BFD file format,
  8079. except for raw binary. To restore a raw binary file you must
  8080. specify the optional keyword 'binary' after the filename.
  8081. If BIAS is non-zero, its value will be added to the addresses
  8082. contained in the file. Binary files always start at address zero,
  8083. so they will be restored at address BIAS. Other bfd files have a
  8084. built-in location; they will be restored at offset BIAS from that
  8085. location.
  8086. If START and/or END are non-zero, then only data between file
  8087. offset START and file offset END will be restored. These offsets
  8088. are relative to the addresses in the file, before the BIAS argument
  8089. is applied.
  8090. 
  8091. File: gdb.info, Node: Core File Generation, Next: Character Sets, Prev: Dump/Restore Files, Up: Data
  8092. 10.19 How to Produce a Core File from Your Program
  8093. ==================================================
  8094. A "core file" or "core dump" is a file that records the memory image of
  8095. a running process and its process status (register values etc.). Its
  8096. primary use is post-mortem debugging of a program that crashed while it
  8097. ran outside a debugger. A program that crashes automatically produces a
  8098. core file, unless this feature is disabled by the user. *Note Files::,
  8099. for information on invoking GDB in the post-mortem debugging mode.
  8100. Occasionally, you may wish to produce a core file of the program you
  8101. are debugging in order to preserve a snapshot of its state. GDB has a
  8102. special command for that.
  8103. 'generate-core-file [FILE]'
  8104. 'gcore [FILE]'
  8105. Produce a core dump of the inferior process. The optional argument
  8106. FILE specifies the file name where to put the core dump. If not
  8107. specified, the file name defaults to 'core.PID', where PID is the
  8108. inferior process ID.
  8109. Note that this command is implemented only for some systems (as of
  8110. this writing, GNU/Linux, FreeBSD, Solaris, and S390).
  8111. On GNU/Linux, this command can take into account the value of the
  8112. file '/proc/PID/coredump_filter' when generating the core dump
  8113. (*note set use-coredump-filter::), and by default honors the
  8114. 'VM_DONTDUMP' flag for mappings where it is present in the file
  8115. '/proc/PID/smaps' (*note set dump-excluded-mappings::).
  8116. 'set use-coredump-filter on'
  8117. 'set use-coredump-filter off'
  8118. Enable or disable the use of the file '/proc/PID/coredump_filter'
  8119. when generating core dump files. This file is used by the Linux
  8120. kernel to decide what types of memory mappings will be dumped or
  8121. ignored when generating a core dump file. PID is the process ID of
  8122. a currently running process.
  8123. To make use of this feature, you have to write in the
  8124. '/proc/PID/coredump_filter' file a value, in hexadecimal, which is
  8125. a bit mask representing the memory mapping types. If a bit is set
  8126. in the bit mask, then the memory mappings of the corresponding
  8127. types will be dumped; otherwise, they will be ignored. This
  8128. configuration is inherited by child processes. For more
  8129. information about the bits that can be set in the
  8130. '/proc/PID/coredump_filter' file, please refer to the manpage of
  8131. 'core(5)'.
  8132. By default, this option is 'on'. If this option is turned 'off',
  8133. GDB does not read the 'coredump_filter' file and instead uses the
  8134. same default value as the Linux kernel in order to decide which
  8135. pages will be dumped in the core dump file. This value is
  8136. currently '0x33', which means that bits '0' (anonymous private
  8137. mappings), '1' (anonymous shared mappings), '4' (ELF headers) and
  8138. '5' (private huge pages) are active. This will cause these memory
  8139. mappings to be dumped automatically.
  8140. 'set dump-excluded-mappings on'
  8141. 'set dump-excluded-mappings off'
  8142. If 'on' is specified, GDB will dump memory mappings marked with the
  8143. 'VM_DONTDUMP' flag. This flag is represented in the file
  8144. '/proc/PID/smaps' with the acronym 'dd'.
  8145. The default value is 'off'.
  8146. 
  8147. File: gdb.info, Node: Character Sets, Next: Caching Target Data, Prev: Core File Generation, Up: Data
  8148. 10.20 Character Sets
  8149. ====================
  8150. If the program you are debugging uses a different character set to
  8151. represent characters and strings than the one GDB uses itself, GDB can
  8152. automatically translate between the character sets for you. The
  8153. character set GDB uses we call the "host character set"; the one the
  8154. inferior program uses we call the "target character set".
  8155. For example, if you are running GDB on a GNU/Linux system, which uses
  8156. the ISO Latin 1 character set, but you are using GDB's remote protocol
  8157. (*note Remote Debugging::) to debug a program running on an IBM
  8158. mainframe, which uses the EBCDIC character set, then the host character
  8159. set is Latin-1, and the target character set is EBCDIC. If you give GDB
  8160. the command 'set target-charset EBCDIC-US', then GDB translates between
  8161. EBCDIC and Latin 1 as you print character or string values, or use
  8162. character and string literals in expressions.
  8163. GDB has no way to automatically recognize which character set the
  8164. inferior program uses; you must tell it, using the 'set target-charset'
  8165. command, described below.
  8166. Here are the commands for controlling GDB's character set support:
  8167. 'set target-charset CHARSET'
  8168. Set the current target character set to CHARSET. To display the
  8169. list of supported target character sets, type
  8170. 'set target-charset <TAB><TAB>'.
  8171. 'set host-charset CHARSET'
  8172. Set the current host character set to CHARSET.
  8173. By default, GDB uses a host character set appropriate to the system
  8174. it is running on; you can override that default using the 'set
  8175. host-charset' command. On some systems, GDB cannot automatically
  8176. determine the appropriate host character set. In this case, GDB
  8177. uses 'UTF-8'.
  8178. GDB can only use certain character sets as its host character set.
  8179. If you type 'set host-charset <TAB><TAB>', GDB will list the host
  8180. character sets it supports.
  8181. 'set charset CHARSET'
  8182. Set the current host and target character sets to CHARSET. As
  8183. above, if you type 'set charset <TAB><TAB>', GDB will list the
  8184. names of the character sets that can be used for both host and
  8185. target.
  8186. 'show charset'
  8187. Show the names of the current host and target character sets.
  8188. 'show host-charset'
  8189. Show the name of the current host character set.
  8190. 'show target-charset'
  8191. Show the name of the current target character set.
  8192. 'set target-wide-charset CHARSET'
  8193. Set the current target's wide character set to CHARSET. This is
  8194. the character set used by the target's 'wchar_t' type. To display
  8195. the list of supported wide character sets, type
  8196. 'set target-wide-charset <TAB><TAB>'.
  8197. 'show target-wide-charset'
  8198. Show the name of the current target's wide character set.
  8199. Here is an example of GDB's character set support in action. Assume
  8200. that the following source code has been placed in the file
  8201. 'charset-test.c':
  8202. #include <stdio.h>
  8203. char ascii_hello[]
  8204. = {72, 101, 108, 108, 111, 44, 32, 119,
  8205. 111, 114, 108, 100, 33, 10, 0};
  8206. char ibm1047_hello[]
  8207. = {200, 133, 147, 147, 150, 107, 64, 166,
  8208. 150, 153, 147, 132, 90, 37, 0};
  8209. main ()
  8210. {
  8211. printf ("Hello, world!\n");
  8212. }
  8213. In this program, 'ascii_hello' and 'ibm1047_hello' are arrays
  8214. containing the string 'Hello, world!' followed by a newline, encoded in
  8215. the ASCII and IBM1047 character sets.
  8216. We compile the program, and invoke the debugger on it:
  8217. $ gcc -g charset-test.c -o charset-test
  8218. $ gdb -nw charset-test
  8219. GNU gdb 2001-12-19-cvs
  8220. Copyright 2001 Free Software Foundation, Inc.
  8221. ...
  8222. (gdb)
  8223. We can use the 'show charset' command to see what character sets GDB
  8224. is currently using to interpret and display characters and strings:
  8225. (gdb) show charset
  8226. The current host and target character set is `ISO-8859-1'.
  8227. (gdb)
  8228. For the sake of printing this manual, let's use ASCII as our initial
  8229. character set:
  8230. (gdb) set charset ASCII
  8231. (gdb) show charset
  8232. The current host and target character set is `ASCII'.
  8233. (gdb)
  8234. Let's assume that ASCII is indeed the correct character set for our
  8235. host system -- in other words, let's assume that if GDB prints
  8236. characters using the ASCII character set, our terminal will display them
  8237. properly. Since our current target character set is also ASCII, the
  8238. contents of 'ascii_hello' print legibly:
  8239. (gdb) print ascii_hello
  8240. $1 = 0x401698 "Hello, world!\n"
  8241. (gdb) print ascii_hello[0]
  8242. $2 = 72 'H'
  8243. (gdb)
  8244. GDB uses the target character set for character and string literals
  8245. you use in expressions:
  8246. (gdb) print '+'
  8247. $3 = 43 '+'
  8248. (gdb)
  8249. The ASCII character set uses the number 43 to encode the '+'
  8250. character.
  8251. GDB relies on the user to tell it which character set the target
  8252. program uses. If we print 'ibm1047_hello' while our target character
  8253. set is still ASCII, we get jibberish:
  8254. (gdb) print ibm1047_hello
  8255. $4 = 0x4016a8 "\310\205\223\223\226k@\246\226\231\223\204Z%"
  8256. (gdb) print ibm1047_hello[0]
  8257. $5 = 200 '\310'
  8258. (gdb)
  8259. If we invoke the 'set target-charset' followed by <TAB><TAB>, GDB
  8260. tells us the character sets it supports:
  8261. (gdb) set target-charset
  8262. ASCII EBCDIC-US IBM1047 ISO-8859-1
  8263. (gdb) set target-charset
  8264. We can select IBM1047 as our target character set, and examine the
  8265. program's strings again. Now the ASCII string is wrong, but GDB
  8266. translates the contents of 'ibm1047_hello' from the target character
  8267. set, IBM1047, to the host character set, ASCII, and they display
  8268. correctly:
  8269. (gdb) set target-charset IBM1047
  8270. (gdb) show charset
  8271. The current host character set is `ASCII'.
  8272. The current target character set is `IBM1047'.
  8273. (gdb) print ascii_hello
  8274. $6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012"
  8275. (gdb) print ascii_hello[0]
  8276. $7 = 72 '\110'
  8277. (gdb) print ibm1047_hello
  8278. $8 = 0x4016a8 "Hello, world!\n"
  8279. (gdb) print ibm1047_hello[0]
  8280. $9 = 200 'H'
  8281. (gdb)
  8282. As above, GDB uses the target character set for character and string
  8283. literals you use in expressions:
  8284. (gdb) print '+'
  8285. $10 = 78 '+'
  8286. (gdb)
  8287. The IBM1047 character set uses the number 78 to encode the '+'
  8288. character.
  8289. 
  8290. File: gdb.info, Node: Caching Target Data, Next: Searching Memory, Prev: Character Sets, Up: Data
  8291. 10.21 Caching Data of Targets
  8292. =============================
  8293. GDB caches data exchanged between the debugger and a target. Each cache
  8294. is associated with the address space of the inferior. *Note Inferiors
  8295. and Programs::, about inferior and address space. Such caching
  8296. generally improves performance in remote debugging (*note Remote
  8297. Debugging::), because it reduces the overhead of the remote protocol by
  8298. bundling memory reads and writes into large chunks. Unfortunately,
  8299. simply caching everything would lead to incorrect results, since GDB
  8300. does not necessarily know anything about volatile values, memory-mapped
  8301. I/O addresses, etc. Furthermore, in non-stop mode (*note Non-Stop
  8302. Mode::) memory can be changed _while_ a gdb command is executing.
  8303. Therefore, by default, GDB only caches data known to be on the stack(1)
  8304. or in the code segment. Other regions of memory can be explicitly
  8305. marked as cacheable; *note Memory Region Attributes::.
  8306. 'set remotecache on'
  8307. 'set remotecache off'
  8308. This option no longer does anything; it exists for compatibility
  8309. with old scripts.
  8310. 'show remotecache'
  8311. Show the current state of the obsolete remotecache flag.
  8312. 'set stack-cache on'
  8313. 'set stack-cache off'
  8314. Enable or disable caching of stack accesses. When 'on', use
  8315. caching. By default, this option is 'on'.
  8316. 'show stack-cache'
  8317. Show the current state of data caching for memory accesses.
  8318. 'set code-cache on'
  8319. 'set code-cache off'
  8320. Enable or disable caching of code segment accesses. When 'on', use
  8321. caching. By default, this option is 'on'. This improves
  8322. performance of disassembly in remote debugging.
  8323. 'show code-cache'
  8324. Show the current state of target memory cache for code segment
  8325. accesses.
  8326. 'info dcache [line]'
  8327. Print the information about the performance of data cache of the
  8328. current inferior's address space. The information displayed
  8329. includes the dcache width and depth, and for each cache line, its
  8330. number, address, and how many times it was referenced. This
  8331. command is useful for debugging the data cache operation.
  8332. If a line number is specified, the contents of that line will be
  8333. printed in hex.
  8334. 'set dcache size SIZE'
  8335. Set maximum number of entries in dcache (dcache depth above).
  8336. 'set dcache line-size LINE-SIZE'
  8337. Set number of bytes each dcache entry caches (dcache width above).
  8338. Must be a power of 2.
  8339. 'show dcache size'
  8340. Show maximum number of dcache entries. *Note info dcache: Caching
  8341. Target Data.
  8342. 'show dcache line-size'
  8343. Show default size of dcache lines.
  8344. ---------- Footnotes ----------
  8345. (1) In non-stop mode, it is moderately rare for a running thread to
  8346. modify the stack of a stopped thread in a way that would interfere with
  8347. a backtrace, and caching of stack reads provides a significant speed up
  8348. of remote backtraces.
  8349. 
  8350. File: gdb.info, Node: Searching Memory, Next: Value Sizes, Prev: Caching Target Data, Up: Data
  8351. 10.22 Search Memory
  8352. ===================
  8353. Memory can be searched for a particular sequence of bytes with the
  8354. 'find' command.
  8355. 'find [/SN] START_ADDR, +LEN, VAL1 [, VAL2, ...]'
  8356. 'find [/SN] START_ADDR, END_ADDR, VAL1 [, VAL2, ...]'
  8357. Search memory for the sequence of bytes specified by VAL1, VAL2,
  8358. etc. The search begins at address START_ADDR and continues for
  8359. either LEN bytes or through to END_ADDR inclusive.
  8360. S and N are optional parameters. They may be specified in either
  8361. order, apart or together.
  8362. S, search query size
  8363. The size of each search query value.
  8364. 'b'
  8365. bytes
  8366. 'h'
  8367. halfwords (two bytes)
  8368. 'w'
  8369. words (four bytes)
  8370. 'g'
  8371. giant words (eight bytes)
  8372. All values are interpreted in the current language. This means,
  8373. for example, that if the current source language is C/C++ then
  8374. searching for the string "hello" includes the trailing '\0'. The
  8375. null terminator can be removed from searching by using casts, e.g.:
  8376. '{char[5]}"hello"'.
  8377. If the value size is not specified, it is taken from the value's
  8378. type in the current language. This is useful when one wants to
  8379. specify the search pattern as a mixture of types. Note that this
  8380. means, for example, that in the case of C-like languages a search
  8381. for an untyped 0x42 will search for '(int) 0x42' which is typically
  8382. four bytes.
  8383. N, maximum number of finds
  8384. The maximum number of matches to print. The default is to print
  8385. all finds.
  8386. You can use strings as search values. Quote them with double-quotes
  8387. ('"'). The string value is copied into the search pattern byte by byte,
  8388. regardless of the endianness of the target and the size specification.
  8389. The address of each match found is printed as well as a count of the
  8390. number of matches found.
  8391. The address of the last value found is stored in convenience variable
  8392. '$_'. A count of the number of matches is stored in '$numfound'.
  8393. For example, if stopped at the 'printf' in this function:
  8394. void
  8395. hello ()
  8396. {
  8397. static char hello[] = "hello-hello";
  8398. static struct { char c; short s; int i; }
  8399. __attribute__ ((packed)) mixed
  8400. = { 'c', 0x1234, 0x87654321 };
  8401. printf ("%s\n", hello);
  8402. }
  8403. you get during debugging:
  8404. (gdb) find &hello[0], +sizeof(hello), "hello"
  8405. 0x804956d <hello.1620+6>
  8406. 1 pattern found
  8407. (gdb) find &hello[0], +sizeof(hello), 'h', 'e', 'l', 'l', 'o'
  8408. 0x8049567 <hello.1620>
  8409. 0x804956d <hello.1620+6>
  8410. 2 patterns found.
  8411. (gdb) find &hello[0], +sizeof(hello), {char[5]}"hello"
  8412. 0x8049567 <hello.1620>
  8413. 0x804956d <hello.1620+6>
  8414. 2 patterns found.
  8415. (gdb) find /b1 &hello[0], +sizeof(hello), 'h', 0x65, 'l'
  8416. 0x8049567 <hello.1620>
  8417. 1 pattern found
  8418. (gdb) find &mixed, +sizeof(mixed), (char) 'c', (short) 0x1234, (int) 0x87654321
  8419. 0x8049560 <mixed.1625>
  8420. 1 pattern found
  8421. (gdb) print $numfound
  8422. $1 = 1
  8423. (gdb) print $_
  8424. $2 = (void *) 0x8049560
  8425. 
  8426. File: gdb.info, Node: Value Sizes, Prev: Searching Memory, Up: Data
  8427. 10.23 Value Sizes
  8428. =================
  8429. Whenever GDB prints a value memory will be allocated within GDB to hold
  8430. the contents of the value. It is possible in some languages with
  8431. dynamic typing systems, that an invalid program may indicate a value
  8432. that is incorrectly large, this in turn may cause GDB to try and
  8433. allocate an overly large ammount of memory.
  8434. 'set max-value-size BYTES'
  8435. 'set max-value-size unlimited'
  8436. Set the maximum size of memory that GDB will allocate for the
  8437. contents of a value to BYTES, trying to display a value that
  8438. requires more memory than that will result in an error.
  8439. Setting this variable does not effect values that have already been
  8440. allocated within GDB, only future allocations.
  8441. There's a minimum size that 'max-value-size' can be set to in order
  8442. that GDB can still operate correctly, this minimum is currently 16
  8443. bytes.
  8444. The limit applies to the results of some subexpressions as well as
  8445. to complete expressions. For example, an expression denoting a
  8446. simple integer component, such as 'x.y.z', may fail if the size of
  8447. X.Y is dynamic and exceeds BYTES. On the other hand, GDB is
  8448. sometimes clever; the expression 'A[i]', where A is an array
  8449. variable with non-constant size, will generally succeed regardless
  8450. of the bounds on A, as long as the component size is less than
  8451. BYTES.
  8452. The default value of 'max-value-size' is currently 64k.
  8453. 'show max-value-size'
  8454. Show the maximum size of memory, in bytes, that GDB will allocate
  8455. for the contents of a value.
  8456. 
  8457. File: gdb.info, Node: Optimized Code, Next: Macros, Prev: Data, Up: Top
  8458. 11 Debugging Optimized Code
  8459. ***************************
  8460. Almost all compilers support optimization. With optimization disabled,
  8461. the compiler generates assembly code that corresponds directly to your
  8462. source code, in a simplistic way. As the compiler applies more powerful
  8463. optimizations, the generated assembly code diverges from your original
  8464. source code. With help from debugging information generated by the
  8465. compiler, GDB can map from the running program back to constructs from
  8466. your original source.
  8467. GDB is more accurate with optimization disabled. If you can
  8468. recompile without optimization, it is easier to follow the progress of
  8469. your program during debugging. But, there are many cases where you may
  8470. need to debug an optimized version.
  8471. When you debug a program compiled with '-g -O', remember that the
  8472. optimizer has rearranged your code; the debugger shows you what is
  8473. really there. Do not be too surprised when the execution path does not
  8474. exactly match your source file! An extreme example: if you define a
  8475. variable, but never use it, GDB never sees that variable--because the
  8476. compiler optimizes it out of existence.
  8477. Some things do not work as well with '-g -O' as with just '-g',
  8478. particularly on machines with instruction scheduling. If in doubt,
  8479. recompile with '-g' alone, and if this fixes the problem, please report
  8480. it to us as a bug (including a test case!). *Note Variables::, for more
  8481. information about debugging optimized code.
  8482. * Menu:
  8483. * Inline Functions:: How GDB presents inlining
  8484. * Tail Call Frames:: GDB analysis of jumps to functions
  8485. 
  8486. File: gdb.info, Node: Inline Functions, Next: Tail Call Frames, Up: Optimized Code
  8487. 11.1 Inline Functions
  8488. =====================
  8489. "Inlining" is an optimization that inserts a copy of the function body
  8490. directly at each call site, instead of jumping to a shared routine. GDB
  8491. displays inlined functions just like non-inlined functions. They appear
  8492. in backtraces. You can view their arguments and local variables, step
  8493. into them with 'step', skip them with 'next', and escape from them with
  8494. 'finish'. You can check whether a function was inlined by using the
  8495. 'info frame' command.
  8496. For GDB to support inlined functions, the compiler must record
  8497. information about inlining in the debug information -- GCC using the
  8498. DWARF 2 format does this, and several other compilers do also. GDB only
  8499. supports inlined functions when using DWARF 2. Versions of GCC before
  8500. 4.1 do not emit two required attributes ('DW_AT_call_file' and
  8501. 'DW_AT_call_line'); GDB does not display inlined function calls with
  8502. earlier versions of GCC. It instead displays the arguments and local
  8503. variables of inlined functions as local variables in the caller.
  8504. The body of an inlined function is directly included at its call
  8505. site; unlike a non-inlined function, there are no instructions devoted
  8506. to the call. GDB still pretends that the call site and the start of the
  8507. inlined function are different instructions. Stepping to the call site
  8508. shows the call site, and then stepping again shows the first line of the
  8509. inlined function, even though no additional instructions are executed.
  8510. This makes source-level debugging much clearer; you can see both the
  8511. context of the call and then the effect of the call. Only stepping by a
  8512. single instruction using 'stepi' or 'nexti' does not do this; single
  8513. instruction steps always show the inlined body.
  8514. There are some ways that GDB does not pretend that inlined function
  8515. calls are the same as normal calls:
  8516. * Setting breakpoints at the call site of an inlined function may not
  8517. work, because the call site does not contain any code. GDB may
  8518. incorrectly move the breakpoint to the next line of the enclosing
  8519. function, after the call. This limitation will be removed in a
  8520. future version of GDB; until then, set a breakpoint on an earlier
  8521. line or inside the inlined function instead.
  8522. * GDB cannot locate the return value of inlined calls after using the
  8523. 'finish' command. This is a limitation of compiler-generated
  8524. debugging information; after 'finish', you can step to the next
  8525. line and print a variable where your program stored the return
  8526. value.
  8527. 
  8528. File: gdb.info, Node: Tail Call Frames, Prev: Inline Functions, Up: Optimized Code
  8529. 11.2 Tail Call Frames
  8530. =====================
  8531. Function 'B' can call function 'C' in its very last statement. In
  8532. unoptimized compilation the call of 'C' is immediately followed by
  8533. return instruction at the end of 'B' code. Optimizing compiler may
  8534. replace the call and return in function 'B' into one jump to function
  8535. 'C' instead. Such use of a jump instruction is called "tail call".
  8536. During execution of function 'C', there will be no indication in the
  8537. function call stack frames that it was tail-called from 'B'. If
  8538. function 'A' regularly calls function 'B' which tail-calls function 'C',
  8539. then GDB will see 'A' as the caller of 'C'. However, in some cases GDB
  8540. can determine that 'C' was tail-called from 'B', and it will then create
  8541. fictitious call frame for that, with the return address set up as if 'B'
  8542. called 'C' normally.
  8543. This functionality is currently supported only by DWARF 2 debugging
  8544. format and the compiler has to produce 'DW_TAG_call_site' tags. With
  8545. GCC, you need to specify '-O -g' during compilation, to get this
  8546. information.
  8547. 'info frame' command (*note Frame Info::) will indicate the tail call
  8548. frame kind by text 'tail call frame' such as in this sample GDB output:
  8549. (gdb) x/i $pc - 2
  8550. 0x40066b <b(int, double)+11>: jmp 0x400640 <c(int, double)>
  8551. (gdb) info frame
  8552. Stack level 1, frame at 0x7fffffffda30:
  8553. rip = 0x40066d in b (amd64-entry-value.cc:59); saved rip 0x4004c5
  8554. tail call frame, caller of frame at 0x7fffffffda30
  8555. source language c++.
  8556. Arglist at unknown address.
  8557. Locals at unknown address, Previous frame's sp is 0x7fffffffda30
  8558. The detection of all the possible code path executions can find them
  8559. ambiguous. There is no execution history stored (possible *note Reverse
  8560. Execution:: is never used for this purpose) and the last known caller
  8561. could have reached the known callee by multiple different jump
  8562. sequences. In such case GDB still tries to show at least all the
  8563. unambiguous top tail callers and all the unambiguous bottom tail calees,
  8564. if any.
  8565. 'set debug entry-values'
  8566. When set to on, enables printing of analysis messages for both
  8567. frame argument values at function entry and tail calls. It will
  8568. show all the possible valid tail calls code paths it has
  8569. considered. It will also print the intersection of them with the
  8570. final unambiguous (possibly partial or even empty) code path
  8571. result.
  8572. 'show debug entry-values'
  8573. Show the current state of analysis messages printing for both frame
  8574. argument values at function entry and tail calls.
  8575. The analysis messages for tail calls can for example show why the
  8576. virtual tail call frame for function 'c' has not been recognized (due to
  8577. the indirect reference by variable 'x'):
  8578. static void __attribute__((noinline, noclone)) c (void);
  8579. void (*x) (void) = c;
  8580. static void __attribute__((noinline, noclone)) a (void) { x++; }
  8581. static void __attribute__((noinline, noclone)) c (void) { a (); }
  8582. int main (void) { x (); return 0; }
  8583. Breakpoint 1, DW_OP_entry_value resolving cannot find
  8584. DW_TAG_call_site 0x40039a in main
  8585. a () at t.c:3
  8586. 3 static void __attribute__((noinline, noclone)) a (void) { x++; }
  8587. (gdb) bt
  8588. #0 a () at t.c:3
  8589. #1 0x000000000040039a in main () at t.c:5
  8590. Another possibility is an ambiguous virtual tail call frames
  8591. resolution:
  8592. int i;
  8593. static void __attribute__((noinline, noclone)) f (void) { i++; }
  8594. static void __attribute__((noinline, noclone)) e (void) { f (); }
  8595. static void __attribute__((noinline, noclone)) d (void) { f (); }
  8596. static void __attribute__((noinline, noclone)) c (void) { d (); }
  8597. static void __attribute__((noinline, noclone)) b (void)
  8598. { if (i) c (); else e (); }
  8599. static void __attribute__((noinline, noclone)) a (void) { b (); }
  8600. int main (void) { a (); return 0; }
  8601. tailcall: initial: 0x4004d2(a) 0x4004ce(b) 0x4004b2(c) 0x4004a2(d)
  8602. tailcall: compare: 0x4004d2(a) 0x4004cc(b) 0x400492(e)
  8603. tailcall: reduced: 0x4004d2(a) |
  8604. (gdb) bt
  8605. #0 f () at t.c:2
  8606. #1 0x00000000004004d2 in a () at t.c:8
  8607. #2 0x0000000000400395 in main () at t.c:9
  8608. Frames #0 and #2 are real, #1 is a virtual tail call frame. The code
  8609. can have possible execution paths 'main->a->b->c->d->f' or
  8610. 'main->a->b->e->f', GDB cannot find which one from the inferior state.
  8611. 'initial:' state shows some random possible calling sequence GDB has
  8612. found. It then finds another possible calling sequcen - that one is
  8613. prefixed by 'compare:'. The non-ambiguous intersection of these two is
  8614. printed as the 'reduced:' calling sequence. That one could have many
  8615. futher 'compare:' and 'reduced:' statements as long as there remain any
  8616. non-ambiguous sequence entries.
  8617. For the frame of function 'b' in both cases there are different
  8618. possible '$pc' values ('0x4004cc' or '0x4004ce'), therefore this frame
  8619. is also ambigous. The only non-ambiguous frame is the one for function
  8620. 'a', therefore this one is displayed to the user while the ambiguous
  8621. frames are omitted.
  8622. There can be also reasons why printing of frame argument values at
  8623. function entry may fail:
  8624. int v;
  8625. static void __attribute__((noinline, noclone)) c (int i) { v++; }
  8626. static void __attribute__((noinline, noclone)) a (int i);
  8627. static void __attribute__((noinline, noclone)) b (int i) { a (i); }
  8628. static void __attribute__((noinline, noclone)) a (int i)
  8629. { if (i) b (i - 1); else c (0); }
  8630. int main (void) { a (5); return 0; }
  8631. (gdb) bt
  8632. #0 c (i=i@entry=0) at t.c:2
  8633. #1 0x0000000000400428 in a (DW_OP_entry_value resolving has found
  8634. function "a" at 0x400420 can call itself via tail calls
  8635. i=<optimized out>) at t.c:6
  8636. #2 0x000000000040036e in main () at t.c:7
  8637. GDB cannot find out from the inferior state if and how many times did
  8638. function 'a' call itself (via function 'b') as these calls would be tail
  8639. calls. Such tail calls would modify thue 'i' variable, therefore GDB
  8640. cannot be sure the value it knows would be right - GDB prints
  8641. '<optimized out>' instead.
  8642. 
  8643. File: gdb.info, Node: Macros, Next: Tracepoints, Prev: Optimized Code, Up: Top
  8644. 12 C Preprocessor Macros
  8645. ************************
  8646. Some languages, such as C and C++, provide a way to define and invoke
  8647. "preprocessor macros" which expand into strings of tokens. GDB can
  8648. evaluate expressions containing macro invocations, show the result of
  8649. macro expansion, and show a macro's definition, including where it was
  8650. defined.
  8651. You may need to compile your program specially to provide GDB with
  8652. information about preprocessor macros. Most compilers do not include
  8653. macros in their debugging information, even when you compile with the
  8654. '-g' flag. *Note Compilation::.
  8655. A program may define a macro at one point, remove that definition
  8656. later, and then provide a different definition after that. Thus, at
  8657. different points in the program, a macro may have different definitions,
  8658. or have no definition at all. If there is a current stack frame, GDB
  8659. uses the macros in scope at that frame's source code line. Otherwise,
  8660. GDB uses the macros in scope at the current listing location; see *note
  8661. List::.
  8662. Whenever GDB evaluates an expression, it always expands any macro
  8663. invocations present in the expression. GDB also provides the following
  8664. commands for working with macros explicitly.
  8665. 'macro expand EXPRESSION'
  8666. 'macro exp EXPRESSION'
  8667. Show the results of expanding all preprocessor macro invocations in
  8668. EXPRESSION. Since GDB simply expands macros, but does not parse
  8669. the result, EXPRESSION need not be a valid expression; it can be
  8670. any string of tokens.
  8671. 'macro expand-once EXPRESSION'
  8672. 'macro exp1 EXPRESSION'
  8673. (This command is not yet implemented.) Show the results of
  8674. expanding those preprocessor macro invocations that appear
  8675. explicitly in EXPRESSION. Macro invocations appearing in that
  8676. expansion are left unchanged. This command allows you to see the
  8677. effect of a particular macro more clearly, without being confused
  8678. by further expansions. Since GDB simply expands macros, but does
  8679. not parse the result, EXPRESSION need not be a valid expression; it
  8680. can be any string of tokens.
  8681. 'info macro [-a|-all] [--] MACRO'
  8682. Show the current definition or all definitions of the named MACRO,
  8683. and describe the source location or compiler command-line where
  8684. that definition was established. The optional double dash is to
  8685. signify the end of argument processing and the beginning of MACRO
  8686. for non C-like macros where the macro may begin with a hyphen.
  8687. 'info macros LOCATION'
  8688. Show all macro definitions that are in effect at the location
  8689. specified by LOCATION, and describe the source location or compiler
  8690. command-line where those definitions were established.
  8691. 'macro define MACRO REPLACEMENT-LIST'
  8692. 'macro define MACRO(ARGLIST) REPLACEMENT-LIST'
  8693. Introduce a definition for a preprocessor macro named MACRO,
  8694. invocations of which are replaced by the tokens given in
  8695. REPLACEMENT-LIST. The first form of this command defines an
  8696. "object-like" macro, which takes no arguments; the second form
  8697. defines a "function-like" macro, which takes the arguments given in
  8698. ARGLIST.
  8699. A definition introduced by this command is in scope in every
  8700. expression evaluated in GDB, until it is removed with the 'macro
  8701. undef' command, described below. The definition overrides all
  8702. definitions for MACRO present in the program being debugged, as
  8703. well as any previous user-supplied definition.
  8704. 'macro undef MACRO'
  8705. Remove any user-supplied definition for the macro named MACRO.
  8706. This command only affects definitions provided with the 'macro
  8707. define' command, described above; it cannot remove definitions
  8708. present in the program being debugged.
  8709. 'macro list'
  8710. List all the macros defined using the 'macro define' command.
  8711. Here is a transcript showing the above commands in action. First, we
  8712. show our source files:
  8713. $ cat sample.c
  8714. #include <stdio.h>
  8715. #include "sample.h"
  8716. #define M 42
  8717. #define ADD(x) (M + x)
  8718. main ()
  8719. {
  8720. #define N 28
  8721. printf ("Hello, world!\n");
  8722. #undef N
  8723. printf ("We're so creative.\n");
  8724. #define N 1729
  8725. printf ("Goodbye, world!\n");
  8726. }
  8727. $ cat sample.h
  8728. #define Q <
  8729. $
  8730. Now, we compile the program using the GNU C compiler, GCC. We pass
  8731. the '-gdwarf-2'(1) _and_ '-g3' flags to ensure the compiler includes
  8732. information about preprocessor macros in the debugging information.
  8733. $ gcc -gdwarf-2 -g3 sample.c -o sample
  8734. $
  8735. Now, we start GDB on our sample program:
  8736. $ gdb -nw sample
  8737. GNU gdb 2002-05-06-cvs
  8738. Copyright 2002 Free Software Foundation, Inc.
  8739. GDB is free software, ...
  8740. (gdb)
  8741. We can expand macros and examine their definitions, even when the
  8742. program is not running. GDB uses the current listing position to decide
  8743. which macro definitions are in scope:
  8744. (gdb) list main
  8745. 3
  8746. 4 #define M 42
  8747. 5 #define ADD(x) (M + x)
  8748. 6
  8749. 7 main ()
  8750. 8 {
  8751. 9 #define N 28
  8752. 10 printf ("Hello, world!\n");
  8753. 11 #undef N
  8754. 12 printf ("We're so creative.\n");
  8755. (gdb) info macro ADD
  8756. Defined at /home/jimb/gdb/macros/play/sample.c:5
  8757. #define ADD(x) (M + x)
  8758. (gdb) info macro Q
  8759. Defined at /home/jimb/gdb/macros/play/sample.h:1
  8760. included at /home/jimb/gdb/macros/play/sample.c:2
  8761. #define Q <
  8762. (gdb) macro expand ADD(1)
  8763. expands to: (42 + 1)
  8764. (gdb) macro expand-once ADD(1)
  8765. expands to: once (M + 1)
  8766. (gdb)
  8767. In the example above, note that 'macro expand-once' expands only the
  8768. macro invocation explicit in the original text -- the invocation of
  8769. 'ADD' -- but does not expand the invocation of the macro 'M', which was
  8770. introduced by 'ADD'.
  8771. Once the program is running, GDB uses the macro definitions in force
  8772. at the source line of the current stack frame:
  8773. (gdb) break main
  8774. Breakpoint 1 at 0x8048370: file sample.c, line 10.
  8775. (gdb) run
  8776. Starting program: /home/jimb/gdb/macros/play/sample
  8777. Breakpoint 1, main () at sample.c:10
  8778. 10 printf ("Hello, world!\n");
  8779. (gdb)
  8780. At line 10, the definition of the macro 'N' at line 9 is in force:
  8781. (gdb) info macro N
  8782. Defined at /home/jimb/gdb/macros/play/sample.c:9
  8783. #define N 28
  8784. (gdb) macro expand N Q M
  8785. expands to: 28 < 42
  8786. (gdb) print N Q M
  8787. $1 = 1
  8788. (gdb)
  8789. As we step over directives that remove 'N''s definition, and then
  8790. give it a new definition, GDB finds the definition (or lack thereof) in
  8791. force at each point:
  8792. (gdb) next
  8793. Hello, world!
  8794. 12 printf ("We're so creative.\n");
  8795. (gdb) info macro N
  8796. The symbol `N' has no definition as a C/C++ preprocessor macro
  8797. at /home/jimb/gdb/macros/play/sample.c:12
  8798. (gdb) next
  8799. We're so creative.
  8800. 14 printf ("Goodbye, world!\n");
  8801. (gdb) info macro N
  8802. Defined at /home/jimb/gdb/macros/play/sample.c:13
  8803. #define N 1729
  8804. (gdb) macro expand N Q M
  8805. expands to: 1729 < 42
  8806. (gdb) print N Q M
  8807. $2 = 0
  8808. (gdb)
  8809. In addition to source files, macros can be defined on the compilation
  8810. command line using the '-DNAME=VALUE' syntax. For macros defined in
  8811. such a way, GDB displays the location of their definition as line zero
  8812. of the source file submitted to the compiler.
  8813. (gdb) info macro __STDC__
  8814. Defined at /home/jimb/gdb/macros/play/sample.c:0
  8815. -D__STDC__=1
  8816. (gdb)
  8817. ---------- Footnotes ----------
  8818. (1) This is the minimum. Recent versions of GCC support '-gdwarf-3'
  8819. and '-gdwarf-4'; we recommend always choosing the most recent version of
  8820. DWARF.
  8821. 
  8822. File: gdb.info, Node: Tracepoints, Next: Overlays, Prev: Macros, Up: Top
  8823. 13 Tracepoints
  8824. **************
  8825. In some applications, it is not feasible for the debugger to interrupt
  8826. the program's execution long enough for the developer to learn anything
  8827. helpful about its behavior. If the program's correctness depends on its
  8828. real-time behavior, delays introduced by a debugger might cause the
  8829. program to change its behavior drastically, or perhaps fail, even when
  8830. the code itself is correct. It is useful to be able to observe the
  8831. program's behavior without interrupting it.
  8832. Using GDB's 'trace' and 'collect' commands, you can specify locations
  8833. in the program, called "tracepoints", and arbitrary expressions to
  8834. evaluate when those tracepoints are reached. Later, using the 'tfind'
  8835. command, you can examine the values those expressions had when the
  8836. program hit the tracepoints. The expressions may also denote objects in
  8837. memory--structures or arrays, for example--whose values GDB should
  8838. record; while visiting a particular tracepoint, you may inspect those
  8839. objects as if they were in memory at that moment. However, because GDB
  8840. records these values without interacting with you, it can do so quickly
  8841. and unobtrusively, hopefully not disturbing the program's behavior.
  8842. The tracepoint facility is currently available only for remote
  8843. targets. *Note Targets::. In addition, your remote target must know
  8844. how to collect trace data. This functionality is implemented in the
  8845. remote stub; however, none of the stubs distributed with GDB support
  8846. tracepoints as of this writing. The format of the remote packets used
  8847. to implement tracepoints are described in *note Tracepoint Packets::.
  8848. It is also possible to get trace data from a file, in a manner
  8849. reminiscent of corefiles; you specify the filename, and use 'tfind' to
  8850. search through the file. *Note Trace Files::, for more details.
  8851. This chapter describes the tracepoint commands and features.
  8852. * Menu:
  8853. * Set Tracepoints::
  8854. * Analyze Collected Data::
  8855. * Tracepoint Variables::
  8856. * Trace Files::
  8857. 
  8858. File: gdb.info, Node: Set Tracepoints, Next: Analyze Collected Data, Up: Tracepoints
  8859. 13.1 Commands to Set Tracepoints
  8860. ================================
  8861. Before running such a "trace experiment", an arbitrary number of
  8862. tracepoints can be set. A tracepoint is actually a special type of
  8863. breakpoint (*note Set Breaks::), so you can manipulate it using standard
  8864. breakpoint commands. For instance, as with breakpoints, tracepoint
  8865. numbers are successive integers starting from one, and many of the
  8866. commands associated with tracepoints take the tracepoint number as their
  8867. argument, to identify which tracepoint to work on.
  8868. For each tracepoint, you can specify, in advance, some arbitrary set
  8869. of data that you want the target to collect in the trace buffer when it
  8870. hits that tracepoint. The collected data can include registers, local
  8871. variables, or global data. Later, you can use GDB commands to examine
  8872. the values these data had at the time the tracepoint was hit.
  8873. Tracepoints do not support every breakpoint feature. Ignore counts
  8874. on tracepoints have no effect, and tracepoints cannot run GDB commands
  8875. when they are hit. Tracepoints may not be thread-specific either.
  8876. Some targets may support "fast tracepoints", which are inserted in a
  8877. different way (such as with a jump instead of a trap), that is faster
  8878. but possibly restricted in where they may be installed.
  8879. Regular and fast tracepoints are dynamic tracing facilities, meaning
  8880. that they can be used to insert tracepoints at (almost) any location in
  8881. the target. Some targets may also support controlling "static
  8882. tracepoints" from GDB. With static tracing, a set of instrumentation
  8883. points, also known as "markers", are embedded in the target program, and
  8884. can be activated or deactivated by name or address. These are usually
  8885. placed at locations which facilitate investigating what the target is
  8886. actually doing. GDB's support for static tracing includes being able to
  8887. list instrumentation points, and attach them with GDB defined high level
  8888. tracepoints that expose the whole range of convenience of GDB's
  8889. tracepoints support. Namely, support for collecting registers values
  8890. and values of global or local (to the instrumentation point) variables;
  8891. tracepoint conditions and trace state variables. The act of installing
  8892. a GDB static tracepoint on an instrumentation point, or marker, is
  8893. referred to as "probing" a static tracepoint marker.
  8894. 'gdbserver' supports tracepoints on some target systems. *Note
  8895. Tracepoints support in 'gdbserver': Server.
  8896. This section describes commands to set tracepoints and associated
  8897. conditions and actions.
  8898. * Menu:
  8899. * Create and Delete Tracepoints::
  8900. * Enable and Disable Tracepoints::
  8901. * Tracepoint Passcounts::
  8902. * Tracepoint Conditions::
  8903. * Trace State Variables::
  8904. * Tracepoint Actions::
  8905. * Listing Tracepoints::
  8906. * Listing Static Tracepoint Markers::
  8907. * Starting and Stopping Trace Experiments::
  8908. * Tracepoint Restrictions::
  8909. 
  8910. File: gdb.info, Node: Create and Delete Tracepoints, Next: Enable and Disable Tracepoints, Up: Set Tracepoints
  8911. 13.1.1 Create and Delete Tracepoints
  8912. ------------------------------------
  8913. 'trace LOCATION'
  8914. The 'trace' command is very similar to the 'break' command. Its
  8915. argument LOCATION can be any valid location. *Note Specify
  8916. Location::. The 'trace' command defines a tracepoint, which is a
  8917. point in the target program where the debugger will briefly stop,
  8918. collect some data, and then allow the program to continue. Setting
  8919. a tracepoint or changing its actions takes effect immediately if
  8920. the remote stub supports the 'InstallInTrace' feature (*note
  8921. install tracepoint in tracing::). If remote stub doesn't support
  8922. the 'InstallInTrace' feature, all these changes don't take effect
  8923. until the next 'tstart' command, and once a trace experiment is
  8924. running, further changes will not have any effect until the next
  8925. trace experiment starts. In addition, GDB supports "pending
  8926. tracepoints"--tracepoints whose address is not yet resolved. (This
  8927. is similar to pending breakpoints.) Pending tracepoints are not
  8928. downloaded to the target and not installed until they are resolved.
  8929. The resolution of pending tracepoints requires GDB support--when
  8930. debugging with the remote target, and GDB disconnects from the
  8931. remote stub (*note disconnected tracing::), pending tracepoints can
  8932. not be resolved (and downloaded to the remote stub) while GDB is
  8933. disconnected.
  8934. Here are some examples of using the 'trace' command:
  8935. (gdb) trace foo.c:121 // a source file and line number
  8936. (gdb) trace +2 // 2 lines forward
  8937. (gdb) trace my_function // first source line of function
  8938. (gdb) trace *my_function // EXACT start address of function
  8939. (gdb) trace *0x2117c4 // an address
  8940. You can abbreviate 'trace' as 'tr'.
  8941. 'trace LOCATION if COND'
  8942. Set a tracepoint with condition COND; evaluate the expression COND
  8943. each time the tracepoint is reached, and collect data only if the
  8944. value is nonzero--that is, if COND evaluates as true. *Note
  8945. Tracepoint Conditions: Tracepoint Conditions, for more information
  8946. on tracepoint conditions.
  8947. 'ftrace LOCATION [ if COND ]'
  8948. The 'ftrace' command sets a fast tracepoint. For targets that
  8949. support them, fast tracepoints will use a more efficient but
  8950. possibly less general technique to trigger data collection, such as
  8951. a jump instruction instead of a trap, or some sort of hardware
  8952. support. It may not be possible to create a fast tracepoint at the
  8953. desired location, in which case the command will exit with an
  8954. explanatory message.
  8955. GDB handles arguments to 'ftrace' exactly as for 'trace'.
  8956. On 32-bit x86-architecture systems, fast tracepoints normally need
  8957. to be placed at an instruction that is 5 bytes or longer, but can
  8958. be placed at 4-byte instructions if the low 64K of memory of the
  8959. target program is available to install trampolines. Some Unix-type
  8960. systems, such as GNU/Linux, exclude low addresses from the
  8961. program's address space; but for instance with the Linux kernel it
  8962. is possible to let GDB use this area by doing a 'sysctl' command to
  8963. set the 'mmap_min_addr' kernel parameter, as in
  8964. sudo sysctl -w vm.mmap_min_addr=32768
  8965. which sets the low address to 32K, which leaves plenty of room for
  8966. trampolines. The minimum address should be set to a page boundary.
  8967. 'strace LOCATION [ if COND ]'
  8968. The 'strace' command sets a static tracepoint. For targets that
  8969. support it, setting a static tracepoint probes a static
  8970. instrumentation point, or marker, found at LOCATION. It may not be
  8971. possible to set a static tracepoint at the desired location, in
  8972. which case the command will exit with an explanatory message.
  8973. GDB handles arguments to 'strace' exactly as for 'trace', with the
  8974. addition that the user can also specify '-m MARKER' as LOCATION.
  8975. This probes the marker identified by the MARKER string identifier.
  8976. This identifier depends on the static tracepoint backend library
  8977. your program is using. You can find all the marker identifiers in
  8978. the 'ID' field of the 'info static-tracepoint-markers' command
  8979. output. *Note Listing Static Tracepoint Markers: Listing Static
  8980. Tracepoint Markers. For example, in the following small program
  8981. using the UST tracing engine:
  8982. main ()
  8983. {
  8984. trace_mark(ust, bar33, "str %s", "FOOBAZ");
  8985. }
  8986. the marker id is composed of joining the first two arguments to the
  8987. 'trace_mark' call with a slash, which translates to:
  8988. (gdb) info static-tracepoint-markers
  8989. Cnt Enb ID Address What
  8990. 1 n ust/bar33 0x0000000000400ddc in main at stexample.c:22
  8991. Data: "str %s"
  8992. [etc...]
  8993. so you may probe the marker above with:
  8994. (gdb) strace -m ust/bar33
  8995. Static tracepoints accept an extra collect action -- 'collect
  8996. $_sdata'. This collects arbitrary user data passed in the probe
  8997. point call to the tracing library. In the UST example above,
  8998. you'll see that the third argument to 'trace_mark' is a printf-like
  8999. format string. The user data is then the result of running that
  9000. formating string against the following arguments. Note that 'info
  9001. static-tracepoint-markers' command output lists that format string
  9002. in the 'Data:' field.
  9003. You can inspect this data when analyzing the trace buffer, by
  9004. printing the $_sdata variable like any other variable available to
  9005. GDB. *Note Tracepoint Action Lists: Tracepoint Actions.
  9006. The convenience variable '$tpnum' records the tracepoint number of
  9007. the most recently set tracepoint.
  9008. 'delete tracepoint [NUM]'
  9009. Permanently delete one or more tracepoints. With no argument, the
  9010. default is to delete all tracepoints. Note that the regular
  9011. 'delete' command can remove tracepoints also.
  9012. Examples:
  9013. (gdb) delete trace 1 2 3 // remove three tracepoints
  9014. (gdb) delete trace // remove all tracepoints
  9015. You can abbreviate this command as 'del tr'.
  9016. 
  9017. File: gdb.info, Node: Enable and Disable Tracepoints, Next: Tracepoint Passcounts, Prev: Create and Delete Tracepoints, Up: Set Tracepoints
  9018. 13.1.2 Enable and Disable Tracepoints
  9019. -------------------------------------
  9020. These commands are deprecated; they are equivalent to plain 'disable'
  9021. and 'enable'.
  9022. 'disable tracepoint [NUM]'
  9023. Disable tracepoint NUM, or all tracepoints if no argument NUM is
  9024. given. A disabled tracepoint will have no effect during a trace
  9025. experiment, but it is not forgotten. You can re-enable a disabled
  9026. tracepoint using the 'enable tracepoint' command. If the command
  9027. is issued during a trace experiment and the debug target has
  9028. support for disabling tracepoints during a trace experiment, then
  9029. the change will be effective immediately. Otherwise, it will be
  9030. applied to the next trace experiment.
  9031. 'enable tracepoint [NUM]'
  9032. Enable tracepoint NUM, or all tracepoints. If this command is
  9033. issued during a trace experiment and the debug target supports
  9034. enabling tracepoints during a trace experiment, then the enabled
  9035. tracepoints will become effective immediately. Otherwise, they
  9036. will become effective the next time a trace experiment is run.
  9037. 
  9038. File: gdb.info, Node: Tracepoint Passcounts, Next: Tracepoint Conditions, Prev: Enable and Disable Tracepoints, Up: Set Tracepoints
  9039. 13.1.3 Tracepoint Passcounts
  9040. ----------------------------
  9041. 'passcount [N [NUM]]'
  9042. Set the "passcount" of a tracepoint. The passcount is a way to
  9043. automatically stop a trace experiment. If a tracepoint's passcount
  9044. is N, then the trace experiment will be automatically stopped on
  9045. the N'th time that tracepoint is hit. If the tracepoint number NUM
  9046. is not specified, the 'passcount' command sets the passcount of the
  9047. most recently defined tracepoint. If no passcount is given, the
  9048. trace experiment will run until stopped explicitly by the user.
  9049. Examples:
  9050. (gdb) passcount 5 2 // Stop on the 5th execution of
  9051. // tracepoint 2
  9052. (gdb) passcount 12 // Stop on the 12th execution of the
  9053. // most recently defined tracepoint.
  9054. (gdb) trace foo
  9055. (gdb) pass 3
  9056. (gdb) trace bar
  9057. (gdb) pass 2
  9058. (gdb) trace baz
  9059. (gdb) pass 1 // Stop tracing when foo has been
  9060. // executed 3 times OR when bar has
  9061. // been executed 2 times
  9062. // OR when baz has been executed 1 time.
  9063. 
  9064. File: gdb.info, Node: Tracepoint Conditions, Next: Trace State Variables, Prev: Tracepoint Passcounts, Up: Set Tracepoints
  9065. 13.1.4 Tracepoint Conditions
  9066. ----------------------------
  9067. The simplest sort of tracepoint collects data every time your program
  9068. reaches a specified place. You can also specify a "condition" for a
  9069. tracepoint. A condition is just a Boolean expression in your
  9070. programming language (*note Expressions: Expressions.). A tracepoint
  9071. with a condition evaluates the expression each time your program reaches
  9072. it, and data collection happens only if the condition is true.
  9073. Tracepoint conditions can be specified when a tracepoint is set, by
  9074. using 'if' in the arguments to the 'trace' command. *Note Setting
  9075. Tracepoints: Create and Delete Tracepoints. They can also be set or
  9076. changed at any time with the 'condition' command, just as with
  9077. breakpoints.
  9078. Unlike breakpoint conditions, GDB does not actually evaluate the
  9079. conditional expression itself. Instead, GDB encodes the expression into
  9080. an agent expression (*note Agent Expressions::) suitable for execution
  9081. on the target, independently of GDB. Global variables become raw memory
  9082. locations, locals become stack accesses, and so forth.
  9083. For instance, suppose you have a function that is usually called
  9084. frequently, but should not be called after an error has occurred. You
  9085. could use the following tracepoint command to collect data about calls
  9086. of that function that happen while the error code is propagating through
  9087. the program; an unconditional tracepoint could end up collecting
  9088. thousands of useless trace frames that you would have to search through.
  9089. (gdb) trace normal_operation if errcode > 0
  9090. 
  9091. File: gdb.info, Node: Trace State Variables, Next: Tracepoint Actions, Prev: Tracepoint Conditions, Up: Set Tracepoints
  9092. 13.1.5 Trace State Variables
  9093. ----------------------------
  9094. A "trace state variable" is a special type of variable that is created
  9095. and managed by target-side code. The syntax is the same as that for
  9096. GDB's convenience variables (a string prefixed with "$"), but they are
  9097. stored on the target. They must be created explicitly, using a
  9098. 'tvariable' command. They are always 64-bit signed integers.
  9099. Trace state variables are remembered by GDB, and downloaded to the
  9100. target along with tracepoint information when the trace experiment
  9101. starts. There are no intrinsic limits on the number of trace state
  9102. variables, beyond memory limitations of the target.
  9103. Although trace state variables are managed by the target, you can use
  9104. them in print commands and expressions as if they were convenience
  9105. variables; GDB will get the current value from the target while the
  9106. trace experiment is running. Trace state variables share the same
  9107. namespace as other "$" variables, which means that you cannot have trace
  9108. state variables with names like '$23' or '$pc', nor can you have a trace
  9109. state variable and a convenience variable with the same name.
  9110. 'tvariable $NAME [ = EXPRESSION ]'
  9111. The 'tvariable' command creates a new trace state variable named
  9112. '$NAME', and optionally gives it an initial value of EXPRESSION.
  9113. The EXPRESSION is evaluated when this command is entered; the
  9114. result will be converted to an integer if possible, otherwise GDB
  9115. will report an error. A subsequent 'tvariable' command specifying
  9116. the same name does not create a variable, but instead assigns the
  9117. supplied initial value to the existing variable of that name,
  9118. overwriting any previous initial value. The default initial value
  9119. is 0.
  9120. 'info tvariables'
  9121. List all the trace state variables along with their initial values.
  9122. Their current values may also be displayed, if the trace experiment
  9123. is currently running.
  9124. 'delete tvariable [ $NAME ... ]'
  9125. Delete the given trace state variables, or all of them if no
  9126. arguments are specified.
  9127. 
  9128. File: gdb.info, Node: Tracepoint Actions, Next: Listing Tracepoints, Prev: Trace State Variables, Up: Set Tracepoints
  9129. 13.1.6 Tracepoint Action Lists
  9130. ------------------------------
  9131. 'actions [NUM]'
  9132. This command will prompt for a list of actions to be taken when the
  9133. tracepoint is hit. If the tracepoint number NUM is not specified,
  9134. this command sets the actions for the one that was most recently
  9135. defined (so that you can define a tracepoint and then say 'actions'
  9136. without bothering about its number). You specify the actions
  9137. themselves on the following lines, one action at a time, and
  9138. terminate the actions list with a line containing just 'end'. So
  9139. far, the only defined actions are 'collect', 'teval', and
  9140. 'while-stepping'.
  9141. 'actions' is actually equivalent to 'commands' (*note Breakpoint
  9142. Command Lists: Break Commands.), except that only the defined
  9143. actions are allowed; any other GDB command is rejected.
  9144. To remove all actions from a tracepoint, type 'actions NUM' and
  9145. follow it immediately with 'end'.
  9146. (gdb) collect DATA // collect some data
  9147. (gdb) while-stepping 5 // single-step 5 times, collect data
  9148. (gdb) end // signals the end of actions.
  9149. In the following example, the action list begins with 'collect'
  9150. commands indicating the things to be collected when the tracepoint
  9151. is hit. Then, in order to single-step and collect additional data
  9152. following the tracepoint, a 'while-stepping' command is used,
  9153. followed by the list of things to be collected after each step in a
  9154. sequence of single steps. The 'while-stepping' command is
  9155. terminated by its own separate 'end' command. Lastly, the action
  9156. list is terminated by an 'end' command.
  9157. (gdb) trace foo
  9158. (gdb) actions
  9159. Enter actions for tracepoint 1, one per line:
  9160. > collect bar,baz
  9161. > collect $regs
  9162. > while-stepping 12
  9163. > collect $pc, arr[i]
  9164. > end
  9165. end
  9166. 'collect[/MODS] EXPR1, EXPR2, ...'
  9167. Collect values of the given expressions when the tracepoint is hit.
  9168. This command accepts a comma-separated list of any valid
  9169. expressions. In addition to global, static, or local variables,
  9170. the following special arguments are supported:
  9171. '$regs'
  9172. Collect all registers.
  9173. '$args'
  9174. Collect all function arguments.
  9175. '$locals'
  9176. Collect all local variables.
  9177. '$_ret'
  9178. Collect the return address. This is helpful if you want to
  9179. see more of a backtrace.
  9180. _Note:_ The return address location can not always be reliably
  9181. determined up front, and the wrong address / registers may end
  9182. up collected instead. On some architectures the reliability
  9183. is higher for tracepoints at function entry, while on others
  9184. it's the opposite. When this happens, backtracing will stop
  9185. because the return address is found unavailable (unless
  9186. another collect rule happened to match it).
  9187. '$_probe_argc'
  9188. Collects the number of arguments from the static probe at
  9189. which the tracepoint is located. *Note Static Probe Points::.
  9190. '$_probe_argN'
  9191. N is an integer between 0 and 11. Collects the Nth argument
  9192. from the static probe at which the tracepoint is located.
  9193. *Note Static Probe Points::.
  9194. '$_sdata'
  9195. Collect static tracepoint marker specific data. Only
  9196. available for static tracepoints. *Note Tracepoint Action
  9197. Lists: Tracepoint Actions. On the UST static tracepoints
  9198. library backend, an instrumentation point resembles a 'printf'
  9199. function call. The tracing library is able to collect user
  9200. specified data formatted to a character string using the
  9201. format provided by the programmer that instrumented the
  9202. program. Other backends have similar mechanisms. Here's an
  9203. example of a UST marker call:
  9204. const char master_name[] = "$your_name";
  9205. trace_mark(channel1, marker1, "hello %s", master_name)
  9206. In this case, collecting '$_sdata' collects the string 'hello
  9207. $yourname'. When analyzing the trace buffer, you can inspect
  9208. '$_sdata' like any other variable available to GDB.
  9209. You can give several consecutive 'collect' commands, each one with
  9210. a single argument, or one 'collect' command with several arguments
  9211. separated by commas; the effect is the same.
  9212. The optional MODS changes the usual handling of the arguments. 's'
  9213. requests that pointers to chars be handled as strings, in
  9214. particular collecting the contents of the memory being pointed at,
  9215. up to the first zero. The upper bound is by default the value of
  9216. the 'print elements' variable; if 's' is followed by a decimal
  9217. number, that is the upper bound instead. So for instance
  9218. 'collect/s25 mystr' collects as many as 25 characters at 'mystr'.
  9219. The command 'info scope' (*note info scope: Symbols.) is
  9220. particularly useful for figuring out what data to collect.
  9221. 'teval EXPR1, EXPR2, ...'
  9222. Evaluate the given expressions when the tracepoint is hit. This
  9223. command accepts a comma-separated list of expressions. The results
  9224. are discarded, so this is mainly useful for assigning values to
  9225. trace state variables (*note Trace State Variables::) without
  9226. adding those values to the trace buffer, as would be the case if
  9227. the 'collect' action were used.
  9228. 'while-stepping N'
  9229. Perform N single-step instruction traces after the tracepoint,
  9230. collecting new data after each step. The 'while-stepping' command
  9231. is followed by the list of what to collect while stepping (followed
  9232. by its own 'end' command):
  9233. > while-stepping 12
  9234. > collect $regs, myglobal
  9235. > end
  9236. >
  9237. Note that '$pc' is not automatically collected by 'while-stepping';
  9238. you need to explicitly collect that register if you need it. You
  9239. may abbreviate 'while-stepping' as 'ws' or 'stepping'.
  9240. 'set default-collect EXPR1, EXPR2, ...'
  9241. This variable is a list of expressions to collect at each
  9242. tracepoint hit. It is effectively an additional 'collect' action
  9243. prepended to every tracepoint action list. The expressions are
  9244. parsed individually for each tracepoint, so for instance a variable
  9245. named 'xyz' may be interpreted as a global for one tracepoint, and
  9246. a local for another, as appropriate to the tracepoint's location.
  9247. 'show default-collect'
  9248. Show the list of expressions that are collected by default at each
  9249. tracepoint hit.
  9250. 
  9251. File: gdb.info, Node: Listing Tracepoints, Next: Listing Static Tracepoint Markers, Prev: Tracepoint Actions, Up: Set Tracepoints
  9252. 13.1.7 Listing Tracepoints
  9253. --------------------------
  9254. 'info tracepoints [NUM...]'
  9255. Display information about the tracepoint NUM. If you don't specify
  9256. a tracepoint number, displays information about all the tracepoints
  9257. defined so far. The format is similar to that used for 'info
  9258. breakpoints'; in fact, 'info tracepoints' is the same command,
  9259. simply restricting itself to tracepoints.
  9260. A tracepoint's listing may include additional information specific
  9261. to tracing:
  9262. * its passcount as given by the 'passcount N' command
  9263. * the state about installed on target of each location
  9264. (gdb) info trace
  9265. Num Type Disp Enb Address What
  9266. 1 tracepoint keep y 0x0804ab57 in foo() at main.cxx:7
  9267. while-stepping 20
  9268. collect globfoo, $regs
  9269. end
  9270. collect globfoo2
  9271. end
  9272. pass count 1200
  9273. 2 tracepoint keep y <MULTIPLE>
  9274. collect $eip
  9275. 2.1 y 0x0804859c in func4 at change-loc.h:35
  9276. installed on target
  9277. 2.2 y 0xb7ffc480 in func4 at change-loc.h:35
  9278. installed on target
  9279. 2.3 y <PENDING> set_tracepoint
  9280. 3 tracepoint keep y 0x080485b1 in foo at change-loc.c:29
  9281. not installed on target
  9282. (gdb)
  9283. This command can be abbreviated 'info tp'.
  9284. 
  9285. File: gdb.info, Node: Listing Static Tracepoint Markers, Next: Starting and Stopping Trace Experiments, Prev: Listing Tracepoints, Up: Set Tracepoints
  9286. 13.1.8 Listing Static Tracepoint Markers
  9287. ----------------------------------------
  9288. 'info static-tracepoint-markers'
  9289. Display information about all static tracepoint markers defined in
  9290. the program.
  9291. For each marker, the following columns are printed:
  9292. _Count_
  9293. An incrementing counter, output to help readability. This is
  9294. not a stable identifier.
  9295. _ID_
  9296. The marker ID, as reported by the target.
  9297. _Enabled or Disabled_
  9298. Probed markers are tagged with 'y'. 'n' identifies marks that
  9299. are not enabled.
  9300. _Address_
  9301. Where the marker is in your program, as a memory address.
  9302. _What_
  9303. Where the marker is in the source for your program, as a file
  9304. and line number. If the debug information included in the
  9305. program does not allow GDB to locate the source of the marker,
  9306. this column will be left blank.
  9307. In addition, the following information may be printed for each
  9308. marker:
  9309. _Data_
  9310. User data passed to the tracing library by the marker call.
  9311. In the UST backend, this is the format string passed as
  9312. argument to the marker call.
  9313. _Static tracepoints probing the marker_
  9314. The list of static tracepoints attached to the marker.
  9315. (gdb) info static-tracepoint-markers
  9316. Cnt ID Enb Address What
  9317. 1 ust/bar2 y 0x0000000000400e1a in main at stexample.c:25
  9318. Data: number1 %d number2 %d
  9319. Probed by static tracepoints: #2
  9320. 2 ust/bar33 n 0x0000000000400c87 in main at stexample.c:24
  9321. Data: str %s
  9322. (gdb)
  9323. 
  9324. File: gdb.info, Node: Starting and Stopping Trace Experiments, Next: Tracepoint Restrictions, Prev: Listing Static Tracepoint Markers, Up: Set Tracepoints
  9325. 13.1.9 Starting and Stopping Trace Experiments
  9326. ----------------------------------------------
  9327. 'tstart'
  9328. This command starts the trace experiment, and begins collecting
  9329. data. It has the side effect of discarding all the data collected
  9330. in the trace buffer during the previous trace experiment. If any
  9331. arguments are supplied, they are taken as a note and stored with
  9332. the trace experiment's state. The notes may be arbitrary text, and
  9333. are especially useful with disconnected tracing in a multi-user
  9334. context; the notes can explain what the trace is doing, supply user
  9335. contact information, and so forth.
  9336. 'tstop'
  9337. This command stops the trace experiment. If any arguments are
  9338. supplied, they are recorded with the experiment as a note. This is
  9339. useful if you are stopping a trace started by someone else, for
  9340. instance if the trace is interfering with the system's behavior and
  9341. needs to be stopped quickly.
  9342. *Note*: a trace experiment and data collection may stop
  9343. automatically if any tracepoint's passcount is reached (*note
  9344. Tracepoint Passcounts::), or if the trace buffer becomes full.
  9345. 'tstatus'
  9346. This command displays the status of the current trace data
  9347. collection.
  9348. Here is an example of the commands we described so far:
  9349. (gdb) trace gdb_c_test
  9350. (gdb) actions
  9351. Enter actions for tracepoint #1, one per line.
  9352. > collect $regs,$locals,$args
  9353. > while-stepping 11
  9354. > collect $regs
  9355. > end
  9356. > end
  9357. (gdb) tstart
  9358. [time passes ...]
  9359. (gdb) tstop
  9360. You can choose to continue running the trace experiment even if GDB
  9361. disconnects from the target, voluntarily or involuntarily. For commands
  9362. such as 'detach', the debugger will ask what you want to do with the
  9363. trace. But for unexpected terminations (GDB crash, network outage), it
  9364. would be unfortunate to lose hard-won trace data, so the variable
  9365. 'disconnected-tracing' lets you decide whether the trace should continue
  9366. running without GDB.
  9367. 'set disconnected-tracing on'
  9368. 'set disconnected-tracing off'
  9369. Choose whether a tracing run should continue to run if GDB has
  9370. disconnected from the target. Note that 'detach' or 'quit' will
  9371. ask you directly what to do about a running trace no matter what
  9372. this variable's setting, so the variable is mainly useful for
  9373. handling unexpected situations, such as loss of the network.
  9374. 'show disconnected-tracing'
  9375. Show the current choice for disconnected tracing.
  9376. When you reconnect to the target, the trace experiment may or may not
  9377. still be running; it might have filled the trace buffer in the meantime,
  9378. or stopped for one of the other reasons. If it is running, it will
  9379. continue after reconnection.
  9380. Upon reconnection, the target will upload information about the
  9381. tracepoints in effect. GDB will then compare that information to the
  9382. set of tracepoints currently defined, and attempt to match them up,
  9383. allowing for the possibility that the numbers may have changed due to
  9384. creation and deletion in the meantime. If one of the target's
  9385. tracepoints does not match any in GDB, the debugger will create a new
  9386. tracepoint, so that you have a number with which to specify that
  9387. tracepoint. This matching-up process is necessarily heuristic, and it
  9388. may result in useless tracepoints being created; you may simply delete
  9389. them if they are of no use.
  9390. If your target agent supports a "circular trace buffer", then you can
  9391. run a trace experiment indefinitely without filling the trace buffer;
  9392. when space runs out, the agent deletes already-collected trace frames,
  9393. oldest first, until there is enough room to continue collecting. This
  9394. is especially useful if your tracepoints are being hit too often, and
  9395. your trace gets terminated prematurely because the buffer is full. To
  9396. ask for a circular trace buffer, simply set 'circular-trace-buffer' to
  9397. on. You can set this at any time, including during tracing; if the
  9398. agent can do it, it will change buffer handling on the fly, otherwise it
  9399. will not take effect until the next run.
  9400. 'set circular-trace-buffer on'
  9401. 'set circular-trace-buffer off'
  9402. Choose whether a tracing run should use a linear or circular buffer
  9403. for trace data. A linear buffer will not lose any trace data, but
  9404. may fill up prematurely, while a circular buffer will discard old
  9405. trace data, but it will have always room for the latest tracepoint
  9406. hits.
  9407. 'show circular-trace-buffer'
  9408. Show the current choice for the trace buffer. Note that this may
  9409. not match the agent's current buffer handling, nor is it guaranteed
  9410. to match the setting that might have been in effect during a past
  9411. run, for instance if you are looking at frames from a trace file.
  9412. 'set trace-buffer-size N'
  9413. 'set trace-buffer-size unlimited'
  9414. Request that the target use a trace buffer of N bytes. Not all
  9415. targets will honor the request; they may have a compiled-in size
  9416. for the trace buffer, or some other limitation. Set to a value of
  9417. 'unlimited' or '-1' to let the target use whatever size it likes.
  9418. This is also the default.
  9419. 'show trace-buffer-size'
  9420. Show the current requested size for the trace buffer. Note that
  9421. this will only match the actual size if the target supports
  9422. size-setting, and was able to handle the requested size. For
  9423. instance, if the target can only change buffer size between runs,
  9424. this variable will not reflect the change until the next run
  9425. starts. Use 'tstatus' to get a report of the actual buffer size.
  9426. 'set trace-user TEXT'
  9427. 'show trace-user'
  9428. 'set trace-notes TEXT'
  9429. Set the trace run's notes.
  9430. 'show trace-notes'
  9431. Show the trace run's notes.
  9432. 'set trace-stop-notes TEXT'
  9433. Set the trace run's stop notes. The handling of the note is as for
  9434. 'tstop' arguments; the set command is convenient way to fix a stop
  9435. note that is mistaken or incomplete.
  9436. 'show trace-stop-notes'
  9437. Show the trace run's stop notes.
  9438. 
  9439. File: gdb.info, Node: Tracepoint Restrictions, Prev: Starting and Stopping Trace Experiments, Up: Set Tracepoints
  9440. 13.1.10 Tracepoint Restrictions
  9441. -------------------------------
  9442. There are a number of restrictions on the use of tracepoints. As
  9443. described above, tracepoint data gathering occurs on the target without
  9444. interaction from GDB. Thus the full capabilities of the debugger are
  9445. not available during data gathering, and then at data examination time,
  9446. you will be limited by only having what was collected. The following
  9447. items describe some common problems, but it is not exhaustive, and you
  9448. may run into additional difficulties not mentioned here.
  9449. * Tracepoint expressions are intended to gather objects (lvalues).
  9450. Thus the full flexibility of GDB's expression evaluator is not
  9451. available. You cannot call functions, cast objects to aggregate
  9452. types, access convenience variables or modify values (except by
  9453. assignment to trace state variables). Some language features may
  9454. implicitly call functions (for instance Objective-C fields with
  9455. accessors), and therefore cannot be collected either.
  9456. * Collection of local variables, either individually or in bulk with
  9457. '$locals' or '$args', during 'while-stepping' may behave
  9458. erratically. The stepping action may enter a new scope (for
  9459. instance by stepping into a function), or the location of the
  9460. variable may change (for instance it is loaded into a register).
  9461. The tracepoint data recorded uses the location information for the
  9462. variables that is correct for the tracepoint location. When the
  9463. tracepoint is created, it is not possible, in general, to determine
  9464. where the steps of a 'while-stepping' sequence will advance the
  9465. program--particularly if a conditional branch is stepped.
  9466. * Collection of an incompletely-initialized or partially-destroyed
  9467. object may result in something that GDB cannot display, or displays
  9468. in a misleading way.
  9469. * When GDB displays a pointer to character it automatically
  9470. dereferences the pointer to also display characters of the string
  9471. being pointed to. However, collecting the pointer during tracing
  9472. does not automatically collect the string. You need to explicitly
  9473. dereference the pointer and provide size information if you want to
  9474. collect not only the pointer, but the memory pointed to. For
  9475. example, '*ptr@50' can be used to collect the 50 element array
  9476. pointed to by 'ptr'.
  9477. * It is not possible to collect a complete stack backtrace at a
  9478. tracepoint. Instead, you may collect the registers and a few
  9479. hundred bytes from the stack pointer with something like
  9480. '*(unsigned char *)$esp@300' (adjust to use the name of the actual
  9481. stack pointer register on your target architecture, and the amount
  9482. of stack you wish to capture). Then the 'backtrace' command will
  9483. show a partial backtrace when using a trace frame. The number of
  9484. stack frames that can be examined depends on the sizes of the
  9485. frames in the collected stack. Note that if you ask for a block so
  9486. large that it goes past the bottom of the stack, the target agent
  9487. may report an error trying to read from an invalid address.
  9488. * If you do not collect registers at a tracepoint, GDB can infer that
  9489. the value of '$pc' must be the same as the address of the
  9490. tracepoint and use that when you are looking at a trace frame for
  9491. that tracepoint. However, this cannot work if the tracepoint has
  9492. multiple locations (for instance if it was set in a function that
  9493. was inlined), or if it has a 'while-stepping' loop. In those cases
  9494. GDB will warn you that it can't infer '$pc', and default it to
  9495. zero.
  9496. 
  9497. File: gdb.info, Node: Analyze Collected Data, Next: Tracepoint Variables, Prev: Set Tracepoints, Up: Tracepoints
  9498. 13.2 Using the Collected Data
  9499. =============================
  9500. After the tracepoint experiment ends, you use GDB commands for examining
  9501. the trace data. The basic idea is that each tracepoint collects a trace
  9502. "snapshot" every time it is hit and another snapshot every time it
  9503. single-steps. All these snapshots are consecutively numbered from zero
  9504. and go into a buffer, and you can examine them later. The way you
  9505. examine them is to "focus" on a specific trace snapshot. When the
  9506. remote stub is focused on a trace snapshot, it will respond to all GDB
  9507. requests for memory and registers by reading from the buffer which
  9508. belongs to that snapshot, rather than from _real_ memory or registers of
  9509. the program being debugged. This means that *all* GDB commands
  9510. ('print', 'info registers', 'backtrace', etc.) will behave as if we
  9511. were currently debugging the program state as it was when the tracepoint
  9512. occurred. Any requests for data that are not in the buffer will fail.
  9513. * Menu:
  9514. * tfind:: How to select a trace snapshot
  9515. * tdump:: How to display all data for a snapshot
  9516. * save tracepoints:: How to save tracepoints for a future run
  9517. 
  9518. File: gdb.info, Node: tfind, Next: tdump, Up: Analyze Collected Data
  9519. 13.2.1 'tfind N'
  9520. ----------------
  9521. The basic command for selecting a trace snapshot from the buffer is
  9522. 'tfind N', which finds trace snapshot number N, counting from zero. If
  9523. no argument N is given, the next snapshot is selected.
  9524. Here are the various forms of using the 'tfind' command.
  9525. 'tfind start'
  9526. Find the first snapshot in the buffer. This is a synonym for
  9527. 'tfind 0' (since 0 is the number of the first snapshot).
  9528. 'tfind none'
  9529. Stop debugging trace snapshots, resume _live_ debugging.
  9530. 'tfind end'
  9531. Same as 'tfind none'.
  9532. 'tfind'
  9533. No argument means find the next trace snapshot or find the first
  9534. one if no trace snapshot is selected.
  9535. 'tfind -'
  9536. Find the previous trace snapshot before the current one. This
  9537. permits retracing earlier steps.
  9538. 'tfind tracepoint NUM'
  9539. Find the next snapshot associated with tracepoint NUM. Search
  9540. proceeds forward from the last examined trace snapshot. If no
  9541. argument NUM is given, it means find the next snapshot collected
  9542. for the same tracepoint as the current snapshot.
  9543. 'tfind pc ADDR'
  9544. Find the next snapshot associated with the value ADDR of the
  9545. program counter. Search proceeds forward from the last examined
  9546. trace snapshot. If no argument ADDR is given, it means find the
  9547. next snapshot with the same value of PC as the current snapshot.
  9548. 'tfind outside ADDR1, ADDR2'
  9549. Find the next snapshot whose PC is outside the given range of
  9550. addresses (exclusive).
  9551. 'tfind range ADDR1, ADDR2'
  9552. Find the next snapshot whose PC is between ADDR1 and ADDR2
  9553. (inclusive).
  9554. 'tfind line [FILE:]N'
  9555. Find the next snapshot associated with the source line N. If the
  9556. optional argument FILE is given, refer to line N in that source
  9557. file. Search proceeds forward from the last examined trace
  9558. snapshot. If no argument N is given, it means find the next line
  9559. other than the one currently being examined; thus saying 'tfind
  9560. line' repeatedly can appear to have the same effect as stepping
  9561. from line to line in a _live_ debugging session.
  9562. The default arguments for the 'tfind' commands are specifically
  9563. designed to make it easy to scan through the trace buffer. For
  9564. instance, 'tfind' with no argument selects the next trace snapshot, and
  9565. 'tfind -' with no argument selects the previous trace snapshot. So, by
  9566. giving one 'tfind' command, and then simply hitting <RET> repeatedly you
  9567. can examine all the trace snapshots in order. Or, by saying 'tfind -'
  9568. and then hitting <RET> repeatedly you can examine the snapshots in
  9569. reverse order. The 'tfind line' command with no argument selects the
  9570. snapshot for the next source line executed. The 'tfind pc' command with
  9571. no argument selects the next snapshot with the same program counter (PC)
  9572. as the current frame. The 'tfind tracepoint' command with no argument
  9573. selects the next trace snapshot collected by the same tracepoint as the
  9574. current one.
  9575. In addition to letting you scan through the trace buffer manually,
  9576. these commands make it easy to construct GDB scripts that scan through
  9577. the trace buffer and print out whatever collected data you are
  9578. interested in. Thus, if we want to examine the PC, FP, and SP registers
  9579. from each trace frame in the buffer, we can say this:
  9580. (gdb) tfind start
  9581. (gdb) while ($trace_frame != -1)
  9582. > printf "Frame %d, PC = %08X, SP = %08X, FP = %08X\n", \
  9583. $trace_frame, $pc, $sp, $fp
  9584. > tfind
  9585. > end
  9586. Frame 0, PC = 0020DC64, SP = 0030BF3C, FP = 0030BF44
  9587. Frame 1, PC = 0020DC6C, SP = 0030BF38, FP = 0030BF44
  9588. Frame 2, PC = 0020DC70, SP = 0030BF34, FP = 0030BF44
  9589. Frame 3, PC = 0020DC74, SP = 0030BF30, FP = 0030BF44
  9590. Frame 4, PC = 0020DC78, SP = 0030BF2C, FP = 0030BF44
  9591. Frame 5, PC = 0020DC7C, SP = 0030BF28, FP = 0030BF44
  9592. Frame 6, PC = 0020DC80, SP = 0030BF24, FP = 0030BF44
  9593. Frame 7, PC = 0020DC84, SP = 0030BF20, FP = 0030BF44
  9594. Frame 8, PC = 0020DC88, SP = 0030BF1C, FP = 0030BF44
  9595. Frame 9, PC = 0020DC8E, SP = 0030BF18, FP = 0030BF44
  9596. Frame 10, PC = 00203F6C, SP = 0030BE3C, FP = 0030BF14
  9597. Or, if we want to examine the variable 'X' at each source line in the
  9598. buffer:
  9599. (gdb) tfind start
  9600. (gdb) while ($trace_frame != -1)
  9601. > printf "Frame %d, X == %d\n", $trace_frame, X
  9602. > tfind line
  9603. > end
  9604. Frame 0, X = 1
  9605. Frame 7, X = 2
  9606. Frame 13, X = 255
  9607. 
  9608. File: gdb.info, Node: tdump, Next: save tracepoints, Prev: tfind, Up: Analyze Collected Data
  9609. 13.2.2 'tdump'
  9610. --------------
  9611. This command takes no arguments. It prints all the data collected at
  9612. the current trace snapshot.
  9613. (gdb) trace 444
  9614. (gdb) actions
  9615. Enter actions for tracepoint #2, one per line:
  9616. > collect $regs, $locals, $args, gdb_long_test
  9617. > end
  9618. (gdb) tstart
  9619. (gdb) tfind line 444
  9620. #0 gdb_test (p1=0x11, p2=0x22, p3=0x33, p4=0x44, p5=0x55, p6=0x66)
  9621. at gdb_test.c:444
  9622. 444 printp( "%s: arguments = 0x%X 0x%X 0x%X 0x%X 0x%X 0x%X\n", )
  9623. (gdb) tdump
  9624. Data collected at tracepoint 2, trace frame 1:
  9625. d0 0xc4aa0085 -995491707
  9626. d1 0x18 24
  9627. d2 0x80 128
  9628. d3 0x33 51
  9629. d4 0x71aea3d 119204413
  9630. d5 0x22 34
  9631. d6 0xe0 224
  9632. d7 0x380035 3670069
  9633. a0 0x19e24a 1696330
  9634. a1 0x3000668 50333288
  9635. a2 0x100 256
  9636. a3 0x322000 3284992
  9637. a4 0x3000698 50333336
  9638. a5 0x1ad3cc 1758156
  9639. fp 0x30bf3c 0x30bf3c
  9640. sp 0x30bf34 0x30bf34
  9641. ps 0x0 0
  9642. pc 0x20b2c8 0x20b2c8
  9643. fpcontrol 0x0 0
  9644. fpstatus 0x0 0
  9645. fpiaddr 0x0 0
  9646. p = 0x20e5b4 "gdb-test"
  9647. p1 = (void *) 0x11
  9648. p2 = (void *) 0x22
  9649. p3 = (void *) 0x33
  9650. p4 = (void *) 0x44
  9651. p5 = (void *) 0x55
  9652. p6 = (void *) 0x66
  9653. gdb_long_test = 17 '\021'
  9654. (gdb)
  9655. 'tdump' works by scanning the tracepoint's current collection actions
  9656. and printing the value of each expression listed. So 'tdump' can fail,
  9657. if after a run, you change the tracepoint's actions to mention variables
  9658. that were not collected during the run.
  9659. Also, for tracepoints with 'while-stepping' loops, 'tdump' uses the
  9660. collected value of '$pc' to distinguish between trace frames that were
  9661. collected at the tracepoint hit, and frames that were collected while
  9662. stepping. This allows it to correctly choose whether to display the
  9663. basic list of collections, or the collections from the body of the
  9664. while-stepping loop. However, if '$pc' was not collected, then 'tdump'
  9665. will always attempt to dump using the basic collection list, and may
  9666. fail if a while-stepping frame does not include all the same data that
  9667. is collected at the tracepoint hit.
  9668. 
  9669. File: gdb.info, Node: save tracepoints, Prev: tdump, Up: Analyze Collected Data
  9670. 13.2.3 'save tracepoints FILENAME'
  9671. ----------------------------------
  9672. This command saves all current tracepoint definitions together with
  9673. their actions and passcounts, into a file 'FILENAME' suitable for use in
  9674. a later debugging session. To read the saved tracepoint definitions,
  9675. use the 'source' command (*note Command Files::). The 'save-tracepoints'
  9676. command is a deprecated alias for 'save tracepoints'
  9677. 
  9678. File: gdb.info, Node: Tracepoint Variables, Next: Trace Files, Prev: Analyze Collected Data, Up: Tracepoints
  9679. 13.3 Convenience Variables for Tracepoints
  9680. ==========================================
  9681. '(int) $trace_frame'
  9682. The current trace snapshot (a.k.a. "frame") number, or -1 if no
  9683. snapshot is selected.
  9684. '(int) $tracepoint'
  9685. The tracepoint for the current trace snapshot.
  9686. '(int) $trace_line'
  9687. The line number for the current trace snapshot.
  9688. '(char []) $trace_file'
  9689. The source file for the current trace snapshot.
  9690. '(char []) $trace_func'
  9691. The name of the function containing '$tracepoint'.
  9692. Note: '$trace_file' is not suitable for use in 'printf', use 'output'
  9693. instead.
  9694. Here's a simple example of using these convenience variables for
  9695. stepping through all the trace snapshots and printing some of their
  9696. data. Note that these are not the same as trace state variables, which
  9697. are managed by the target.
  9698. (gdb) tfind start
  9699. (gdb) while $trace_frame != -1
  9700. > output $trace_file
  9701. > printf ", line %d (tracepoint #%d)\n", $trace_line, $tracepoint
  9702. > tfind
  9703. > end
  9704. 
  9705. File: gdb.info, Node: Trace Files, Prev: Tracepoint Variables, Up: Tracepoints
  9706. 13.4 Using Trace Files
  9707. ======================
  9708. In some situations, the target running a trace experiment may no longer
  9709. be available; perhaps it crashed, or the hardware was needed for a
  9710. different activity. To handle these cases, you can arrange to dump the
  9711. trace data into a file, and later use that file as a source of trace
  9712. data, via the 'target tfile' command.
  9713. 'tsave [ -r ] FILENAME'
  9714. 'tsave [-ctf] DIRNAME'
  9715. Save the trace data to FILENAME. By default, this command assumes
  9716. that FILENAME refers to the host filesystem, so if necessary GDB
  9717. will copy raw trace data up from the target and then save it. If
  9718. the target supports it, you can also supply the optional argument
  9719. '-r' ("remote") to direct the target to save the data directly into
  9720. FILENAME in its own filesystem, which may be more efficient if the
  9721. trace buffer is very large. (Note, however, that 'target tfile'
  9722. can only read from files accessible to the host.) By default, this
  9723. command will save trace frame in tfile format. You can supply the
  9724. optional argument '-ctf' to save data in CTF format. The "Common
  9725. Trace Format" (CTF) is proposed as a trace format that can be
  9726. shared by multiple debugging and tracing tools. Please go to
  9727. 'http://www.efficios.com/ctf' to get more information.
  9728. 'target tfile FILENAME'
  9729. 'target ctf DIRNAME'
  9730. Use the file named FILENAME or directory named DIRNAME as a source
  9731. of trace data. Commands that examine data work as they do with a
  9732. live target, but it is not possible to run any new trace
  9733. experiments. 'tstatus' will report the state of the trace run at
  9734. the moment the data was saved, as well as the current trace frame
  9735. you are examining. Both FILENAME and DIRNAME must be on a
  9736. filesystem accessible to the host.
  9737. (gdb) target ctf ctf.ctf
  9738. (gdb) tfind
  9739. Found trace frame 0, tracepoint 2
  9740. 39 ++a; /* set tracepoint 1 here */
  9741. (gdb) tdump
  9742. Data collected at tracepoint 2, trace frame 0:
  9743. i = 0
  9744. a = 0
  9745. b = 1 '\001'
  9746. c = {"123", "456", "789", "123", "456", "789"}
  9747. d = {{{a = 1, b = 2}, {a = 3, b = 4}}, {{a = 5, b = 6}, {a = 7, b = 8}}}
  9748. (gdb) p b
  9749. $1 = 1
  9750. 
  9751. File: gdb.info, Node: Overlays, Next: Languages, Prev: Tracepoints, Up: Top
  9752. 14 Debugging Programs That Use Overlays
  9753. ***************************************
  9754. If your program is too large to fit completely in your target system's
  9755. memory, you can sometimes use "overlays" to work around this problem.
  9756. GDB provides some support for debugging programs that use overlays.
  9757. * Menu:
  9758. * How Overlays Work:: A general explanation of overlays.
  9759. * Overlay Commands:: Managing overlays in GDB.
  9760. * Automatic Overlay Debugging:: GDB can find out which overlays are
  9761. mapped by asking the inferior.
  9762. * Overlay Sample Program:: A sample program using overlays.
  9763. 
  9764. File: gdb.info, Node: How Overlays Work, Next: Overlay Commands, Up: Overlays
  9765. 14.1 How Overlays Work
  9766. ======================
  9767. Suppose you have a computer whose instruction address space is only 64
  9768. kilobytes long, but which has much more memory which can be accessed by
  9769. other means: special instructions, segment registers, or memory
  9770. management hardware, for example. Suppose further that you want to
  9771. adapt a program which is larger than 64 kilobytes to run on this system.
  9772. One solution is to identify modules of your program which are
  9773. relatively independent, and need not call each other directly; call
  9774. these modules "overlays". Separate the overlays from the main program,
  9775. and place their machine code in the larger memory. Place your main
  9776. program in instruction memory, but leave at least enough space there to
  9777. hold the largest overlay as well.
  9778. Now, to call a function located in an overlay, you must first copy
  9779. that overlay's machine code from the large memory into the space set
  9780. aside for it in the instruction memory, and then jump to its entry point
  9781. there.
  9782. Data Instruction Larger
  9783. Address Space Address Space Address Space
  9784. +-----------+ +-----------+ +-----------+
  9785. | | | | | |
  9786. +-----------+ +-----------+ +-----------+<-- overlay 1
  9787. | program | | main | .----| overlay 1 | load address
  9788. | variables | | program | | +-----------+
  9789. | and heap | | | | | |
  9790. +-----------+ | | | +-----------+<-- overlay 2
  9791. | | +-----------+ | | | load address
  9792. +-----------+ | | | .-| overlay 2 |
  9793. | | | | | |
  9794. mapped --->+-----------+ | | +-----------+
  9795. address | | | | | |
  9796. | overlay | <-' | | |
  9797. | area | <---' +-----------+<-- overlay 3
  9798. | | <---. | | load address
  9799. +-----------+ `--| overlay 3 |
  9800. | | | |
  9801. +-----------+ | |
  9802. +-----------+
  9803. | |
  9804. +-----------+
  9805. A code overlay
  9806. The diagram (*note A code overlay::) shows a system with separate
  9807. data and instruction address spaces. To map an overlay, the program
  9808. copies its code from the larger address space to the instruction address
  9809. space. Since the overlays shown here all use the same mapped address,
  9810. only one may be mapped at a time. For a system with a single address
  9811. space for data and instructions, the diagram would be similar, except
  9812. that the program variables and heap would share an address space with
  9813. the main program and the overlay area.
  9814. An overlay loaded into instruction memory and ready for use is called
  9815. a "mapped" overlay; its "mapped address" is its address in the
  9816. instruction memory. An overlay not present (or only partially present)
  9817. in instruction memory is called "unmapped"; its "load address" is its
  9818. address in the larger memory. The mapped address is also called the
  9819. "virtual memory address", or "VMA"; the load address is also called the
  9820. "load memory address", or "LMA".
  9821. Unfortunately, overlays are not a completely transparent way to adapt
  9822. a program to limited instruction memory. They introduce a new set of
  9823. global constraints you must keep in mind as you design your program:
  9824. * Before calling or returning to a function in an overlay, your
  9825. program must make sure that overlay is actually mapped. Otherwise,
  9826. the call or return will transfer control to the right address, but
  9827. in the wrong overlay, and your program will probably crash.
  9828. * If the process of mapping an overlay is expensive on your system,
  9829. you will need to choose your overlays carefully to minimize their
  9830. effect on your program's performance.
  9831. * The executable file you load onto your system must contain each
  9832. overlay's instructions, appearing at the overlay's load address,
  9833. not its mapped address. However, each overlay's instructions must
  9834. be relocated and its symbols defined as if the overlay were at its
  9835. mapped address. You can use GNU linker scripts to specify
  9836. different load and relocation addresses for pieces of your program;
  9837. see *note (ld.info)Overlay Description::.
  9838. * The procedure for loading executable files onto your system must be
  9839. able to load their contents into the larger address space as well
  9840. as the instruction and data spaces.
  9841. The overlay system described above is rather simple, and could be
  9842. improved in many ways:
  9843. * If your system has suitable bank switch registers or memory
  9844. management hardware, you could use those facilities to make an
  9845. overlay's load area contents simply appear at their mapped address
  9846. in instruction space. This would probably be faster than copying
  9847. the overlay to its mapped area in the usual way.
  9848. * If your overlays are small enough, you could set aside more than
  9849. one overlay area, and have more than one overlay mapped at a time.
  9850. * You can use overlays to manage data, as well as instructions. In
  9851. general, data overlays are even less transparent to your design
  9852. than code overlays: whereas code overlays only require care when
  9853. you call or return to functions, data overlays require care every
  9854. time you access the data. Also, if you change the contents of a
  9855. data overlay, you must copy its contents back out to its load
  9856. address before you can copy a different data overlay into the same
  9857. mapped area.
  9858. 
  9859. File: gdb.info, Node: Overlay Commands, Next: Automatic Overlay Debugging, Prev: How Overlays Work, Up: Overlays
  9860. 14.2 Overlay Commands
  9861. =====================
  9862. To use GDB's overlay support, each overlay in your program must
  9863. correspond to a separate section of the executable file. The section's
  9864. virtual memory address and load memory address must be the overlay's
  9865. mapped and load addresses. Identifying overlays with sections allows
  9866. GDB to determine the appropriate address of a function or variable,
  9867. depending on whether the overlay is mapped or not.
  9868. GDB's overlay commands all start with the word 'overlay'; you can
  9869. abbreviate this as 'ov' or 'ovly'. The commands are:
  9870. 'overlay off'
  9871. Disable GDB's overlay support. When overlay support is disabled,
  9872. GDB assumes that all functions and variables are always present at
  9873. their mapped addresses. By default, GDB's overlay support is
  9874. disabled.
  9875. 'overlay manual'
  9876. Enable "manual" overlay debugging. In this mode, GDB relies on you
  9877. to tell it which overlays are mapped, and which are not, using the
  9878. 'overlay map-overlay' and 'overlay unmap-overlay' commands
  9879. described below.
  9880. 'overlay map-overlay OVERLAY'
  9881. 'overlay map OVERLAY'
  9882. Tell GDB that OVERLAY is now mapped; OVERLAY must be the name of
  9883. the object file section containing the overlay. When an overlay is
  9884. mapped, GDB assumes it can find the overlay's functions and
  9885. variables at their mapped addresses. GDB assumes that any other
  9886. overlays whose mapped ranges overlap that of OVERLAY are now
  9887. unmapped.
  9888. 'overlay unmap-overlay OVERLAY'
  9889. 'overlay unmap OVERLAY'
  9890. Tell GDB that OVERLAY is no longer mapped; OVERLAY must be the name
  9891. of the object file section containing the overlay. When an overlay
  9892. is unmapped, GDB assumes it can find the overlay's functions and
  9893. variables at their load addresses.
  9894. 'overlay auto'
  9895. Enable "automatic" overlay debugging. In this mode, GDB consults a
  9896. data structure the overlay manager maintains in the inferior to see
  9897. which overlays are mapped. For details, see *note Automatic
  9898. Overlay Debugging::.
  9899. 'overlay load-target'
  9900. 'overlay load'
  9901. Re-read the overlay table from the inferior. Normally, GDB
  9902. re-reads the table GDB automatically each time the inferior stops,
  9903. so this command should only be necessary if you have changed the
  9904. overlay mapping yourself using GDB. This command is only useful
  9905. when using automatic overlay debugging.
  9906. 'overlay list-overlays'
  9907. 'overlay list'
  9908. Display a list of the overlays currently mapped, along with their
  9909. mapped addresses, load addresses, and sizes.
  9910. Normally, when GDB prints a code address, it includes the name of the
  9911. function the address falls in:
  9912. (gdb) print main
  9913. $3 = {int ()} 0x11a0 <main>
  9914. When overlay debugging is enabled, GDB recognizes code in unmapped
  9915. overlays, and prints the names of unmapped functions with asterisks
  9916. around them. For example, if 'foo' is a function in an unmapped
  9917. overlay, GDB prints it this way:
  9918. (gdb) overlay list
  9919. No sections are mapped.
  9920. (gdb) print foo
  9921. $5 = {int (int)} 0x100000 <*foo*>
  9922. When 'foo''s overlay is mapped, GDB prints the function's name normally:
  9923. (gdb) overlay list
  9924. Section .ov.foo.text, loaded at 0x100000 - 0x100034,
  9925. mapped at 0x1016 - 0x104a
  9926. (gdb) print foo
  9927. $6 = {int (int)} 0x1016 <foo>
  9928. When overlay debugging is enabled, GDB can find the correct address
  9929. for functions and variables in an overlay, whether or not the overlay is
  9930. mapped. This allows most GDB commands, like 'break' and 'disassemble',
  9931. to work normally, even on unmapped code. However, GDB's breakpoint
  9932. support has some limitations:
  9933. * You can set breakpoints in functions in unmapped overlays, as long
  9934. as GDB can write to the overlay at its load address.
  9935. * GDB can not set hardware or simulator-based breakpoints in unmapped
  9936. overlays. However, if you set a breakpoint at the end of your
  9937. overlay manager (and tell GDB which overlays are now mapped, if you
  9938. are using manual overlay management), GDB will re-set its
  9939. breakpoints properly.
  9940. 
  9941. File: gdb.info, Node: Automatic Overlay Debugging, Next: Overlay Sample Program, Prev: Overlay Commands, Up: Overlays
  9942. 14.3 Automatic Overlay Debugging
  9943. ================================
  9944. GDB can automatically track which overlays are mapped and which are not,
  9945. given some simple co-operation from the overlay manager in the inferior.
  9946. If you enable automatic overlay debugging with the 'overlay auto'
  9947. command (*note Overlay Commands::), GDB looks in the inferior's memory
  9948. for certain variables describing the current state of the overlays.
  9949. Here are the variables your overlay manager must define to support
  9950. GDB's automatic overlay debugging:
  9951. '_ovly_table':
  9952. This variable must be an array of the following structures:
  9953. struct
  9954. {
  9955. /* The overlay's mapped address. */
  9956. unsigned long vma;
  9957. /* The size of the overlay, in bytes. */
  9958. unsigned long size;
  9959. /* The overlay's load address. */
  9960. unsigned long lma;
  9961. /* Non-zero if the overlay is currently mapped;
  9962. zero otherwise. */
  9963. unsigned long mapped;
  9964. }
  9965. '_novlys':
  9966. This variable must be a four-byte signed integer, holding the total
  9967. number of elements in '_ovly_table'.
  9968. To decide whether a particular overlay is mapped or not, GDB looks
  9969. for an entry in '_ovly_table' whose 'vma' and 'lma' members equal the
  9970. VMA and LMA of the overlay's section in the executable file. When GDB
  9971. finds a matching entry, it consults the entry's 'mapped' member to
  9972. determine whether the overlay is currently mapped.
  9973. In addition, your overlay manager may define a function called
  9974. '_ovly_debug_event'. If this function is defined, GDB will silently set
  9975. a breakpoint there. If the overlay manager then calls this function
  9976. whenever it has changed the overlay table, this will enable GDB to
  9977. accurately keep track of which overlays are in program memory, and
  9978. update any breakpoints that may be set in overlays. This will allow
  9979. breakpoints to work even if the overlays are kept in ROM or other
  9980. non-writable memory while they are not being executed.
  9981. 
  9982. File: gdb.info, Node: Overlay Sample Program, Prev: Automatic Overlay Debugging, Up: Overlays
  9983. 14.4 Overlay Sample Program
  9984. ===========================
  9985. When linking a program which uses overlays, you must place the overlays
  9986. at their load addresses, while relocating them to run at their mapped
  9987. addresses. To do this, you must write a linker script (*note
  9988. (ld.info)Overlay Description::). Unfortunately, since linker scripts
  9989. are specific to a particular host system, target architecture, and
  9990. target memory layout, this manual cannot provide portable sample code
  9991. demonstrating GDB's overlay support.
  9992. However, the GDB source distribution does contain an overlaid
  9993. program, with linker scripts for a few systems, as part of its test
  9994. suite. The program consists of the following files from
  9995. 'gdb/testsuite/gdb.base':
  9996. 'overlays.c'
  9997. The main program file.
  9998. 'ovlymgr.c'
  9999. A simple overlay manager, used by 'overlays.c'.
  10000. 'foo.c'
  10001. 'bar.c'
  10002. 'baz.c'
  10003. 'grbx.c'
  10004. Overlay modules, loaded and used by 'overlays.c'.
  10005. 'd10v.ld'
  10006. 'm32r.ld'
  10007. Linker scripts for linking the test program on the 'd10v-elf' and
  10008. 'm32r-elf' targets.
  10009. You can build the test program using the 'd10v-elf' GCC
  10010. cross-compiler like this:
  10011. $ d10v-elf-gcc -g -c overlays.c
  10012. $ d10v-elf-gcc -g -c ovlymgr.c
  10013. $ d10v-elf-gcc -g -c foo.c
  10014. $ d10v-elf-gcc -g -c bar.c
  10015. $ d10v-elf-gcc -g -c baz.c
  10016. $ d10v-elf-gcc -g -c grbx.c
  10017. $ d10v-elf-gcc -g overlays.o ovlymgr.o foo.o bar.o \
  10018. baz.o grbx.o -Wl,-Td10v.ld -o overlays
  10019. The build process is identical for any other architecture, except
  10020. that you must substitute the appropriate compiler and linker script for
  10021. the target system for 'd10v-elf-gcc' and 'd10v.ld'.
  10022. 
  10023. File: gdb.info, Node: Languages, Next: Symbols, Prev: Overlays, Up: Top
  10024. 15 Using GDB with Different Languages
  10025. *************************************
  10026. Although programming languages generally have common aspects, they are
  10027. rarely expressed in the same manner. For instance, in ANSI C,
  10028. dereferencing a pointer 'p' is accomplished by '*p', but in Modula-2, it
  10029. is accomplished by 'p^'. Values can also be represented (and displayed)
  10030. differently. Hex numbers in C appear as '0x1ae', while in Modula-2 they
  10031. appear as '1AEH'.
  10032. Language-specific information is built into GDB for some languages,
  10033. allowing you to express operations like the above in your program's
  10034. native language, and allowing GDB to output values in a manner
  10035. consistent with the syntax of your program's native language. The
  10036. language you use to build expressions is called the "working language".
  10037. * Menu:
  10038. * Setting:: Switching between source languages
  10039. * Show:: Displaying the language
  10040. * Checks:: Type and range checks
  10041. * Supported Languages:: Supported languages
  10042. * Unsupported Languages:: Unsupported languages
  10043. 
  10044. File: gdb.info, Node: Setting, Next: Show, Up: Languages
  10045. 15.1 Switching Between Source Languages
  10046. =======================================
  10047. There are two ways to control the working language--either have GDB set
  10048. it automatically, or select it manually yourself. You can use the 'set
  10049. language' command for either purpose. On startup, GDB defaults to
  10050. setting the language automatically. The working language is used to
  10051. determine how expressions you type are interpreted, how values are
  10052. printed, etc.
  10053. In addition to the working language, every source file that GDB knows
  10054. about has its own working language. For some object file formats, the
  10055. compiler might indicate which language a particular source file is in.
  10056. However, most of the time GDB infers the language from the name of the
  10057. file. The language of a source file controls whether C++ names are
  10058. demangled--this way 'backtrace' can show each frame appropriately for
  10059. its own language. There is no way to set the language of a source file
  10060. from within GDB, but you can set the language associated with a filename
  10061. extension. *Note Displaying the Language: Show.
  10062. This is most commonly a problem when you use a program, such as
  10063. 'cfront' or 'f2c', that generates C but is written in another language.
  10064. In that case, make the program use '#line' directives in its C output;
  10065. that way GDB will know the correct language of the source code of the
  10066. original program, and will display that source code, not the generated C
  10067. code.
  10068. * Menu:
  10069. * Filenames:: Filename extensions and languages.
  10070. * Manually:: Setting the working language manually
  10071. * Automatically:: Having GDB infer the source language
  10072. 
  10073. File: gdb.info, Node: Filenames, Next: Manually, Up: Setting
  10074. 15.1.1 List of Filename Extensions and Languages
  10075. ------------------------------------------------
  10076. If a source file name ends in one of the following extensions, then GDB
  10077. infers that its language is the one indicated.
  10078. '.ada'
  10079. '.ads'
  10080. '.adb'
  10081. '.a'
  10082. Ada source file.
  10083. '.c'
  10084. C source file
  10085. '.C'
  10086. '.cc'
  10087. '.cp'
  10088. '.cpp'
  10089. '.cxx'
  10090. '.c++'
  10091. C++ source file
  10092. '.d'
  10093. D source file
  10094. '.m'
  10095. Objective-C source file
  10096. '.f'
  10097. '.F'
  10098. Fortran source file
  10099. '.mod'
  10100. Modula-2 source file
  10101. '.s'
  10102. '.S'
  10103. Assembler source file. This actually behaves almost like C, but
  10104. GDB does not skip over function prologues when stepping.
  10105. In addition, you may set the language associated with a filename
  10106. extension. *Note Displaying the Language: Show.
  10107. 
  10108. File: gdb.info, Node: Manually, Next: Automatically, Prev: Filenames, Up: Setting
  10109. 15.1.2 Setting the Working Language
  10110. -----------------------------------
  10111. If you allow GDB to set the language automatically, expressions are
  10112. interpreted the same way in your debugging session and your program.
  10113. If you wish, you may set the language manually. To do this, issue
  10114. the command 'set language LANG', where LANG is the name of a language,
  10115. such as 'c' or 'modula-2'. For a list of the supported languages, type
  10116. 'set language'.
  10117. Setting the language manually prevents GDB from updating the working
  10118. language automatically. This can lead to confusion if you try to debug
  10119. a program when the working language is not the same as the source
  10120. language, when an expression is acceptable to both languages--but means
  10121. different things. For instance, if the current source file were written
  10122. in C, and GDB was parsing Modula-2, a command such as:
  10123. print a = b + c
  10124. might not have the effect you intended. In C, this means to add 'b' and
  10125. 'c' and place the result in 'a'. The result printed would be the value
  10126. of 'a'. In Modula-2, this means to compare 'a' to the result of 'b+c',
  10127. yielding a 'BOOLEAN' value.
  10128. 
  10129. File: gdb.info, Node: Automatically, Prev: Manually, Up: Setting
  10130. 15.1.3 Having GDB Infer the Source Language
  10131. -------------------------------------------
  10132. To have GDB set the working language automatically, use 'set language
  10133. local' or 'set language auto'. GDB then infers the working language.
  10134. That is, when your program stops in a frame (usually by encountering a
  10135. breakpoint), GDB sets the working language to the language recorded for
  10136. the function in that frame. If the language for a frame is unknown
  10137. (that is, if the function or block corresponding to the frame was
  10138. defined in a source file that does not have a recognized extension), the
  10139. current working language is not changed, and GDB issues a warning.
  10140. This may not seem necessary for most programs, which are written
  10141. entirely in one source language. However, program modules and libraries
  10142. written in one source language can be used by a main program written in
  10143. a different source language. Using 'set language auto' in this case
  10144. frees you from having to set the working language manually.
  10145. 
  10146. File: gdb.info, Node: Show, Next: Checks, Prev: Setting, Up: Languages
  10147. 15.2 Displaying the Language
  10148. ============================
  10149. The following commands help you find out which language is the working
  10150. language, and also what language source files were written in.
  10151. 'show language'
  10152. Display the current working language. This is the language you can
  10153. use with commands such as 'print' to build and compute expressions
  10154. that may involve variables in your program.
  10155. 'info frame'
  10156. Display the source language for this frame. This language becomes
  10157. the working language if you use an identifier from this frame.
  10158. *Note Information about a Frame: Frame Info, to identify the other
  10159. information listed here.
  10160. 'info source'
  10161. Display the source language of this source file. *Note Examining
  10162. the Symbol Table: Symbols, to identify the other information listed
  10163. here.
  10164. In unusual circumstances, you may have source files with extensions
  10165. not in the standard list. You can then set the extension associated
  10166. with a language explicitly:
  10167. 'set extension-language EXT LANGUAGE'
  10168. Tell GDB that source files with extension EXT are to be assumed as
  10169. written in the source language LANGUAGE.
  10170. 'info extensions'
  10171. List all the filename extensions and the associated languages.
  10172. 
  10173. File: gdb.info, Node: Checks, Next: Supported Languages, Prev: Show, Up: Languages
  10174. 15.3 Type and Range Checking
  10175. ============================
  10176. Some languages are designed to guard you against making seemingly common
  10177. errors through a series of compile- and run-time checks. These include
  10178. checking the type of arguments to functions and operators and making
  10179. sure mathematical overflows are caught at run time. Checks such as
  10180. these help to ensure a program's correctness once it has been compiled
  10181. by eliminating type mismatches and providing active checks for range
  10182. errors when your program is running.
  10183. By default GDB checks for these errors according to the rules of the
  10184. current source language. Although GDB does not check the statements in
  10185. your program, it can check expressions entered directly into GDB for
  10186. evaluation via the 'print' command, for example.
  10187. * Menu:
  10188. * Type Checking:: An overview of type checking
  10189. * Range Checking:: An overview of range checking
  10190. 
  10191. File: gdb.info, Node: Type Checking, Next: Range Checking, Up: Checks
  10192. 15.3.1 An Overview of Type Checking
  10193. -----------------------------------
  10194. Some languages, such as C and C++, are strongly typed, meaning that the
  10195. arguments to operators and functions have to be of the correct type,
  10196. otherwise an error occurs. These checks prevent type mismatch errors
  10197. from ever causing any run-time problems. For example,
  10198. int klass::my_method(char *b) { return b ? 1 : 2; }
  10199. (gdb) print obj.my_method (0)
  10200. $1 = 2
  10201. but
  10202. (gdb) print obj.my_method (0x1234)
  10203. Cannot resolve method klass::my_method to any overloaded instance
  10204. The second example fails because in C++ the integer constant '0x1234'
  10205. is not type-compatible with the pointer parameter type.
  10206. For the expressions you use in GDB commands, you can tell GDB to not
  10207. enforce strict type checking or to treat any mismatches as errors and
  10208. abandon the expression; When type checking is disabled, GDB successfully
  10209. evaluates expressions like the second example above.
  10210. Even if type checking is off, there may be other reasons related to
  10211. type that prevent GDB from evaluating an expression. For instance, GDB
  10212. does not know how to add an 'int' and a 'struct foo'. These particular
  10213. type errors have nothing to do with the language in use and usually
  10214. arise from expressions which make little sense to evaluate anyway.
  10215. GDB provides some additional commands for controlling type checking:
  10216. 'set check type on'
  10217. 'set check type off'
  10218. Set strict type checking on or off. If any type mismatches occur
  10219. in evaluating an expression while type checking is on, GDB prints a
  10220. message and aborts evaluation of the expression.
  10221. 'show check type'
  10222. Show the current setting of type checking and whether GDB is
  10223. enforcing strict type checking rules.
  10224. 
  10225. File: gdb.info, Node: Range Checking, Prev: Type Checking, Up: Checks
  10226. 15.3.2 An Overview of Range Checking
  10227. ------------------------------------
  10228. In some languages (such as Modula-2), it is an error to exceed the
  10229. bounds of a type; this is enforced with run-time checks. Such range
  10230. checking is meant to ensure program correctness by making sure
  10231. computations do not overflow, or indices on an array element access do
  10232. not exceed the bounds of the array.
  10233. For expressions you use in GDB commands, you can tell GDB to treat
  10234. range errors in one of three ways: ignore them, always treat them as
  10235. errors and abandon the expression, or issue warnings but evaluate the
  10236. expression anyway.
  10237. A range error can result from numerical overflow, from exceeding an
  10238. array index bound, or when you type a constant that is not a member of
  10239. any type. Some languages, however, do not treat overflows as an error.
  10240. In many implementations of C, mathematical overflow causes the result to
  10241. "wrap around" to lower values--for example, if M is the largest integer
  10242. value, and S is the smallest, then
  10243. M + 1 => S
  10244. This, too, is specific to individual languages, and in some cases
  10245. specific to individual compilers or machines. *Note Supported
  10246. Languages: Supported Languages, for further details on specific
  10247. languages.
  10248. GDB provides some additional commands for controlling the range
  10249. checker:
  10250. 'set check range auto'
  10251. Set range checking on or off based on the current working language.
  10252. *Note Supported Languages: Supported Languages, for the default
  10253. settings for each language.
  10254. 'set check range on'
  10255. 'set check range off'
  10256. Set range checking on or off, overriding the default setting for
  10257. the current working language. A warning is issued if the setting
  10258. does not match the language default. If a range error occurs and
  10259. range checking is on, then a message is printed and evaluation of
  10260. the expression is aborted.
  10261. 'set check range warn'
  10262. Output messages when the GDB range checker detects a range error,
  10263. but attempt to evaluate the expression anyway. Evaluating the
  10264. expression may still be impossible for other reasons, such as
  10265. accessing memory that the process does not own (a typical example
  10266. from many Unix systems).
  10267. 'show range'
  10268. Show the current setting of the range checker, and whether or not
  10269. it is being set automatically by GDB.
  10270. 
  10271. File: gdb.info, Node: Supported Languages, Next: Unsupported Languages, Prev: Checks, Up: Languages
  10272. 15.4 Supported Languages
  10273. ========================
  10274. GDB supports C, C++, D, Go, Objective-C, Fortran, OpenCL C, Pascal,
  10275. Rust, assembly, Modula-2, and Ada. Some GDB features may be used in
  10276. expressions regardless of the language you use: the GDB '@' and '::'
  10277. operators, and the '{type}addr' construct (*note Expressions:
  10278. Expressions.) can be used with the constructs of any supported language.
  10279. The following sections detail to what degree each source language is
  10280. supported by GDB. These sections are not meant to be language tutorials
  10281. or references, but serve only as a reference guide to what the GDB
  10282. expression parser accepts, and what input and output formats should look
  10283. like for different languages. There are many good books written on each
  10284. of these languages; please look to these for a language reference or
  10285. tutorial.
  10286. * Menu:
  10287. * C:: C and C++
  10288. * D:: D
  10289. * Go:: Go
  10290. * Objective-C:: Objective-C
  10291. * OpenCL C:: OpenCL C
  10292. * Fortran:: Fortran
  10293. * Pascal:: Pascal
  10294. * Rust:: Rust
  10295. * Modula-2:: Modula-2
  10296. * Ada:: Ada
  10297. 
  10298. File: gdb.info, Node: C, Next: D, Up: Supported Languages
  10299. 15.4.1 C and C++
  10300. ----------------
  10301. Since C and C++ are so closely related, many features of GDB apply to
  10302. both languages. Whenever this is the case, we discuss those languages
  10303. together.
  10304. The C++ debugging facilities are jointly implemented by the C++
  10305. compiler and GDB. Therefore, to debug your C++ code effectively, you
  10306. must compile your C++ programs with a supported C++ compiler, such as
  10307. GNU 'g++', or the HP ANSI C++ compiler ('aCC').
  10308. * Menu:
  10309. * C Operators:: C and C++ operators
  10310. * C Constants:: C and C++ constants
  10311. * C Plus Plus Expressions:: C++ expressions
  10312. * C Defaults:: Default settings for C and C++
  10313. * C Checks:: C and C++ type and range checks
  10314. * Debugging C:: GDB and C
  10315. * Debugging C Plus Plus:: GDB features for C++
  10316. * Decimal Floating Point:: Numbers in Decimal Floating Point format
  10317. 
  10318. File: gdb.info, Node: C Operators, Next: C Constants, Up: C
  10319. 15.4.1.1 C and C++ Operators
  10320. ............................
  10321. Operators must be defined on values of specific types. For instance,
  10322. '+' is defined on numbers, but not on structures. Operators are often
  10323. defined on groups of types.
  10324. For the purposes of C and C++, the following definitions hold:
  10325. * _Integral types_ include 'int' with any of its storage-class
  10326. specifiers; 'char'; 'enum'; and, for C++, 'bool'.
  10327. * _Floating-point types_ include 'float', 'double', and 'long double'
  10328. (if supported by the target platform).
  10329. * _Pointer types_ include all types defined as '(TYPE *)'.
  10330. * _Scalar types_ include all of the above.
  10331. The following operators are supported. They are listed here in order of
  10332. increasing precedence:
  10333. ','
  10334. The comma or sequencing operator. Expressions in a comma-separated
  10335. list are evaluated from left to right, with the result of the
  10336. entire expression being the last expression evaluated.
  10337. '='
  10338. Assignment. The value of an assignment expression is the value
  10339. assigned. Defined on scalar types.
  10340. 'OP='
  10341. Used in an expression of the form 'A OP= B', and translated to
  10342. 'A = A OP B'. 'OP=' and '=' have the same precedence. The
  10343. operator OP is any one of the operators '|', '^', '&', '<<', '>>',
  10344. '+', '-', '*', '/', '%'.
  10345. '?:'
  10346. The ternary operator. 'A ? B : C' can be thought of as: if A then
  10347. B else C. The argument A should be of an integral type.
  10348. '||'
  10349. Logical OR. Defined on integral types.
  10350. '&&'
  10351. Logical AND. Defined on integral types.
  10352. '|'
  10353. Bitwise OR. Defined on integral types.
  10354. '^'
  10355. Bitwise exclusive-OR. Defined on integral types.
  10356. '&'
  10357. Bitwise AND. Defined on integral types.
  10358. '==, !='
  10359. Equality and inequality. Defined on scalar types. The value of
  10360. these expressions is 0 for false and non-zero for true.
  10361. '<, >, <=, >='
  10362. Less than, greater than, less than or equal, greater than or equal.
  10363. Defined on scalar types. The value of these expressions is 0 for
  10364. false and non-zero for true.
  10365. '<<, >>'
  10366. left shift, and right shift. Defined on integral types.
  10367. '@'
  10368. The GDB "artificial array" operator (*note Expressions:
  10369. Expressions.).
  10370. '+, -'
  10371. Addition and subtraction. Defined on integral types,
  10372. floating-point types and pointer types.
  10373. '*, /, %'
  10374. Multiplication, division, and modulus. Multiplication and division
  10375. are defined on integral and floating-point types. Modulus is
  10376. defined on integral types.
  10377. '++, --'
  10378. Increment and decrement. When appearing before a variable, the
  10379. operation is performed before the variable is used in an
  10380. expression; when appearing after it, the variable's value is used
  10381. before the operation takes place.
  10382. '*'
  10383. Pointer dereferencing. Defined on pointer types. Same precedence
  10384. as '++'.
  10385. '&'
  10386. Address operator. Defined on variables. Same precedence as '++'.
  10387. For debugging C++, GDB implements a use of '&' beyond what is
  10388. allowed in the C++ language itself: you can use '&(&REF)' to
  10389. examine the address where a C++ reference variable (declared with
  10390. '&REF') is stored.
  10391. '-'
  10392. Negative. Defined on integral and floating-point types. Same
  10393. precedence as '++'.
  10394. '!'
  10395. Logical negation. Defined on integral types. Same precedence as
  10396. '++'.
  10397. '~'
  10398. Bitwise complement operator. Defined on integral types. Same
  10399. precedence as '++'.
  10400. '., ->'
  10401. Structure member, and pointer-to-structure member. For
  10402. convenience, GDB regards the two as equivalent, choosing whether to
  10403. dereference a pointer based on the stored type information.
  10404. Defined on 'struct' and 'union' data.
  10405. '.*, ->*'
  10406. Dereferences of pointers to members.
  10407. '[]'
  10408. Array indexing. 'A[I]' is defined as '*(A+I)'. Same precedence as
  10409. '->'.
  10410. '()'
  10411. Function parameter list. Same precedence as '->'.
  10412. '::'
  10413. C++ scope resolution operator. Defined on 'struct', 'union', and
  10414. 'class' types.
  10415. '::'
  10416. Doubled colons also represent the GDB scope operator (*note
  10417. Expressions: Expressions.). Same precedence as '::', above.
  10418. If an operator is redefined in the user code, GDB usually attempts to
  10419. invoke the redefined version instead of using the operator's predefined
  10420. meaning.
  10421. 
  10422. File: gdb.info, Node: C Constants, Next: C Plus Plus Expressions, Prev: C Operators, Up: C
  10423. 15.4.1.2 C and C++ Constants
  10424. ............................
  10425. GDB allows you to express the constants of C and C++ in the following
  10426. ways:
  10427. * Integer constants are a sequence of digits. Octal constants are
  10428. specified by a leading '0' (i.e. zero), and hexadecimal constants
  10429. by a leading '0x' or '0X'. Constants may also end with a letter
  10430. 'l', specifying that the constant should be treated as a 'long'
  10431. value.
  10432. * Floating point constants are a sequence of digits, followed by a
  10433. decimal point, followed by a sequence of digits, and optionally
  10434. followed by an exponent. An exponent is of the form:
  10435. 'e[[+]|-]NNN', where NNN is another sequence of digits. The '+' is
  10436. optional for positive exponents. A floating-point constant may
  10437. also end with a letter 'f' or 'F', specifying that the constant
  10438. should be treated as being of the 'float' (as opposed to the
  10439. default 'double') type; or with a letter 'l' or 'L', which
  10440. specifies a 'long double' constant.
  10441. * Enumerated constants consist of enumerated identifiers, or their
  10442. integral equivalents.
  10443. * Character constants are a single character surrounded by single
  10444. quotes ('''), or a number--the ordinal value of the corresponding
  10445. character (usually its ASCII value). Within quotes, the single
  10446. character may be represented by a letter or by "escape sequences",
  10447. which are of the form '\NNN', where NNN is the octal representation
  10448. of the character's ordinal value; or of the form '\X', where 'X' is
  10449. a predefined special character--for example, '\n' for newline.
  10450. Wide character constants can be written by prefixing a character
  10451. constant with 'L', as in C. For example, 'L'x'' is the wide form of
  10452. 'x'. The target wide character set is used when computing the
  10453. value of this constant (*note Character Sets::).
  10454. * String constants are a sequence of character constants surrounded
  10455. by double quotes ('"'). Any valid character constant (as described
  10456. above) may appear. Double quotes within the string must be
  10457. preceded by a backslash, so for instance '"a\"b'c"' is a string of
  10458. five characters.
  10459. Wide string constants can be written by prefixing a string constant
  10460. with 'L', as in C. The target wide character set is used when
  10461. computing the value of this constant (*note Character Sets::).
  10462. * Pointer constants are an integral value. You can also write
  10463. pointers to constants using the C operator '&'.
  10464. * Array constants are comma-separated lists surrounded by braces '{'
  10465. and '}'; for example, '{1,2,3}' is a three-element array of
  10466. integers, '{{1,2}, {3,4}, {5,6}}' is a three-by-two array, and
  10467. '{&"hi", &"there", &"fred"}' is a three-element array of pointers.
  10468. 
  10469. File: gdb.info, Node: C Plus Plus Expressions, Next: C Defaults, Prev: C Constants, Up: C
  10470. 15.4.1.3 C++ Expressions
  10471. ........................
  10472. GDB expression handling can interpret most C++ expressions.
  10473. _Warning:_ GDB can only debug C++ code if you use the proper
  10474. compiler and the proper debug format. Currently, GDB works best
  10475. when debugging C++ code that is compiled with the most recent
  10476. version of GCC possible. The DWARF debugging format is preferred;
  10477. GCC defaults to this on most popular platforms. Other compilers
  10478. and/or debug formats are likely to work badly or not at all when
  10479. using GDB to debug C++ code. *Note Compilation::.
  10480. 1. Member function calls are allowed; you can use expressions like
  10481. count = aml->GetOriginal(x, y)
  10482. 2. While a member function is active (in the selected stack frame),
  10483. your expressions have the same namespace available as the member
  10484. function; that is, GDB allows implicit references to the class
  10485. instance pointer 'this' following the same rules as C++. 'using'
  10486. declarations in the current scope are also respected by GDB.
  10487. 3. You can call overloaded functions; GDB resolves the function call
  10488. to the right definition, with some restrictions. GDB does not
  10489. perform overload resolution involving user-defined type
  10490. conversions, calls to constructors, or instantiations of templates
  10491. that do not exist in the program. It also cannot handle ellipsis
  10492. argument lists or default arguments.
  10493. It does perform integral conversions and promotions, floating-point
  10494. promotions, arithmetic conversions, pointer conversions,
  10495. conversions of class objects to base classes, and standard
  10496. conversions such as those of functions or arrays to pointers; it
  10497. requires an exact match on the number of function arguments.
  10498. Overload resolution is always performed, unless you have specified
  10499. 'set overload-resolution off'. *Note GDB Features for C++:
  10500. Debugging C Plus Plus.
  10501. You must specify 'set overload-resolution off' in order to use an
  10502. explicit function signature to call an overloaded function, as in
  10503. p 'foo(char,int)'('x', 13)
  10504. The GDB command-completion facility can simplify this; see *note
  10505. Command Completion: Completion.
  10506. 4. GDB understands variables declared as C++ lvalue or rvalue
  10507. references; you can use them in expressions just as you do in C++
  10508. source--they are automatically dereferenced.
  10509. In the parameter list shown when GDB displays a frame, the values
  10510. of reference variables are not displayed (unlike other variables);
  10511. this avoids clutter, since references are often used for large
  10512. structures. The _address_ of a reference variable is always shown,
  10513. unless you have specified 'set print address off'.
  10514. 5. GDB supports the C++ name resolution operator '::'--your
  10515. expressions can use it just as expressions in your program do.
  10516. Since one scope may be defined in another, you can use '::'
  10517. repeatedly if necessary, for example in an expression like
  10518. 'SCOPE1::SCOPE2::NAME'. GDB also allows resolving name scope by
  10519. reference to source files, in both C and C++ debugging (*note
  10520. Program Variables: Variables.).
  10521. 6. GDB performs argument-dependent lookup, following the C++
  10522. specification.
  10523. 
  10524. File: gdb.info, Node: C Defaults, Next: C Checks, Prev: C Plus Plus Expressions, Up: C
  10525. 15.4.1.4 C and C++ Defaults
  10526. ...........................
  10527. If you allow GDB to set range checking automatically, it defaults to
  10528. 'off' whenever the working language changes to C or C++. This happens
  10529. regardless of whether you or GDB selects the working language.
  10530. If you allow GDB to set the language automatically, it recognizes
  10531. source files whose names end with '.c', '.C', or '.cc', etc, and when
  10532. GDB enters code compiled from one of these files, it sets the working
  10533. language to C or C++. *Note Having GDB Infer the Source Language:
  10534. Automatically, for further details.
  10535. 
  10536. File: gdb.info, Node: C Checks, Next: Debugging C, Prev: C Defaults, Up: C
  10537. 15.4.1.5 C and C++ Type and Range Checks
  10538. ........................................
  10539. By default, when GDB parses C or C++ expressions, strict type checking
  10540. is used. However, if you turn type checking off, GDB will allow certain
  10541. non-standard conversions, such as promoting integer constants to
  10542. pointers.
  10543. Range checking, if turned on, is done on mathematical operations.
  10544. Array indices are not checked, since they are often used to index a
  10545. pointer that is not itself an array.
  10546. 
  10547. File: gdb.info, Node: Debugging C, Next: Debugging C Plus Plus, Prev: C Checks, Up: C
  10548. 15.4.1.6 GDB and C
  10549. ..................
  10550. The 'set print union' and 'show print union' commands apply to the
  10551. 'union' type. When set to 'on', any 'union' that is inside a 'struct'
  10552. or 'class' is also printed. Otherwise, it appears as '{...}'.
  10553. The '@' operator aids in the debugging of dynamic arrays, formed with
  10554. pointers and a memory allocation function. *Note Expressions:
  10555. Expressions.
  10556. 
  10557. File: gdb.info, Node: Debugging C Plus Plus, Next: Decimal Floating Point, Prev: Debugging C, Up: C
  10558. 15.4.1.7 GDB Features for C++
  10559. .............................
  10560. Some GDB commands are particularly useful with C++, and some are
  10561. designed specifically for use with C++. Here is a summary:
  10562. 'breakpoint menus'
  10563. When you want a breakpoint in a function whose name is overloaded,
  10564. GDB has the capability to display a menu of possible breakpoint
  10565. locations to help you specify which function definition you want.
  10566. *Note Ambiguous Expressions: Ambiguous Expressions.
  10567. 'rbreak REGEX'
  10568. Setting breakpoints using regular expressions is helpful for
  10569. setting breakpoints on overloaded functions that are not members of
  10570. any special classes. *Note Setting Breakpoints: Set Breaks.
  10571. 'catch throw'
  10572. 'catch rethrow'
  10573. 'catch catch'
  10574. Debug C++ exception handling using these commands. *Note Setting
  10575. Catchpoints: Set Catchpoints.
  10576. 'ptype TYPENAME'
  10577. Print inheritance relationships as well as other information for
  10578. type TYPENAME. *Note Examining the Symbol Table: Symbols.
  10579. 'info vtbl EXPRESSION.'
  10580. The 'info vtbl' command can be used to display the virtual method
  10581. tables of the object computed by EXPRESSION. This shows one entry
  10582. per virtual table; there may be multiple virtual tables when
  10583. multiple inheritance is in use.
  10584. 'demangle NAME'
  10585. Demangle NAME. *Note Symbols::, for a more complete description of
  10586. the 'demangle' command.
  10587. 'set print demangle'
  10588. 'show print demangle'
  10589. 'set print asm-demangle'
  10590. 'show print asm-demangle'
  10591. Control whether C++ symbols display in their source form, both when
  10592. displaying code as C++ source and when displaying disassemblies.
  10593. *Note Print Settings: Print Settings.
  10594. 'set print object'
  10595. 'show print object'
  10596. Choose whether to print derived (actual) or declared types of
  10597. objects. *Note Print Settings: Print Settings.
  10598. 'set print vtbl'
  10599. 'show print vtbl'
  10600. Control the format for printing virtual function tables. *Note
  10601. Print Settings: Print Settings. (The 'vtbl' commands do not work
  10602. on programs compiled with the HP ANSI C++ compiler ('aCC').)
  10603. 'set overload-resolution on'
  10604. Enable overload resolution for C++ expression evaluation. The
  10605. default is on. For overloaded functions, GDB evaluates the
  10606. arguments and searches for a function whose signature matches the
  10607. argument types, using the standard C++ conversion rules (see *note
  10608. C++ Expressions: C Plus Plus Expressions, for details). If it
  10609. cannot find a match, it emits a message.
  10610. 'set overload-resolution off'
  10611. Disable overload resolution for C++ expression evaluation. For
  10612. overloaded functions that are not class member functions, GDB
  10613. chooses the first function of the specified name that it finds in
  10614. the symbol table, whether or not its arguments are of the correct
  10615. type. For overloaded functions that are class member functions,
  10616. GDB searches for a function whose signature _exactly_ matches the
  10617. argument types.
  10618. 'show overload-resolution'
  10619. Show the current setting of overload resolution.
  10620. 'Overloaded symbol names'
  10621. You can specify a particular definition of an overloaded symbol,
  10622. using the same notation that is used to declare such symbols in
  10623. C++: type 'SYMBOL(TYPES)' rather than just SYMBOL. You can also
  10624. use the GDB command-line word completion facilities to list the
  10625. available choices, or to finish the type list for you. *Note
  10626. Command Completion: Completion, for details on how to do this.
  10627. 'Breakpoints in functions with ABI tags'
  10628. The GNU C++ compiler introduced the notion of ABI "tags", which
  10629. correspond to changes in the ABI of a type, function, or variable
  10630. that would not otherwise be reflected in a mangled name. See
  10631. <https://developers.redhat.com/blog/2015/02/05/gcc5-and-the-c11-abi/>
  10632. for more detail.
  10633. The ABI tags are visible in C++ demangled names. For example, a
  10634. function that returns a std::string:
  10635. std::string function(int);
  10636. when compiled for the C++11 ABI is marked with the 'cxx11' ABI tag,
  10637. and GDB displays the symbol like this:
  10638. function[abi:cxx11](int)
  10639. You can set a breakpoint on such functions simply as if they had no
  10640. tag. For example:
  10641. (gdb) b function(int)
  10642. Breakpoint 2 at 0x40060d: file main.cc, line 10.
  10643. (gdb) info breakpoints
  10644. Num Type Disp Enb Address What
  10645. 1 breakpoint keep y 0x0040060d in function[abi:cxx11](int)
  10646. at main.cc:10
  10647. On the rare occasion you need to disambiguate between different ABI
  10648. tags, you can do so by simply including the ABI tag in the function
  10649. name, like:
  10650. (gdb) b ambiguous[abi:other_tag](int)
  10651. 
  10652. File: gdb.info, Node: Decimal Floating Point, Prev: Debugging C Plus Plus, Up: C
  10653. 15.4.1.8 Decimal Floating Point format
  10654. ......................................
  10655. GDB can examine, set and perform computations with numbers in decimal
  10656. floating point format, which in the C language correspond to the
  10657. '_Decimal32', '_Decimal64' and '_Decimal128' types as specified by the
  10658. extension to support decimal floating-point arithmetic.
  10659. There are two encodings in use, depending on the architecture: BID
  10660. (Binary Integer Decimal) for x86 and x86-64, and DPD (Densely Packed
  10661. Decimal) for PowerPC and S/390. GDB will use the appropriate encoding
  10662. for the configured target.
  10663. Because of a limitation in 'libdecnumber', the library used by GDB to
  10664. manipulate decimal floating point numbers, it is not possible to convert
  10665. (using a cast, for example) integers wider than 32-bit to decimal float.
  10666. In addition, in order to imitate GDB's behaviour with binary floating
  10667. point computations, error checking in decimal float operations ignores
  10668. underflow, overflow and divide by zero exceptions.
  10669. In the PowerPC architecture, GDB provides a set of pseudo-registers
  10670. to inspect '_Decimal128' values stored in floating point registers. See
  10671. *note PowerPC: PowerPC. for more details.
  10672. 
  10673. File: gdb.info, Node: D, Next: Go, Prev: C, Up: Supported Languages
  10674. 15.4.2 D
  10675. --------
  10676. GDB can be used to debug programs written in D and compiled with GDC,
  10677. LDC or DMD compilers. Currently GDB supports only one D specific
  10678. feature -- dynamic arrays.
  10679. 
  10680. File: gdb.info, Node: Go, Next: Objective-C, Prev: D, Up: Supported Languages
  10681. 15.4.3 Go
  10682. ---------
  10683. GDB can be used to debug programs written in Go and compiled with
  10684. 'gccgo' or '6g' compilers.
  10685. Here is a summary of the Go-specific features and restrictions:
  10686. 'The current Go package'
  10687. The name of the current package does not need to be specified when
  10688. specifying global variables and functions.
  10689. For example, given the program:
  10690. package main
  10691. var myglob = "Shall we?"
  10692. func main () {
  10693. // ...
  10694. }
  10695. When stopped inside 'main' either of these work:
  10696. (gdb) p myglob
  10697. (gdb) p main.myglob
  10698. 'Builtin Go types'
  10699. The 'string' type is recognized by GDB and is printed as a string.
  10700. 'Builtin Go functions'
  10701. The GDB expression parser recognizes the 'unsafe.Sizeof' function
  10702. and handles it internally.
  10703. 'Restrictions on Go expressions'
  10704. All Go operators are supported except '&^'. The Go '_' "blank
  10705. identifier" is not supported. Automatic dereferencing of pointers
  10706. is not supported.
  10707. 
  10708. File: gdb.info, Node: Objective-C, Next: OpenCL C, Prev: Go, Up: Supported Languages
  10709. 15.4.4 Objective-C
  10710. ------------------
  10711. This section provides information about some commands and command
  10712. options that are useful for debugging Objective-C code. See also *note
  10713. info classes: Symbols, and *note info selectors: Symbols, for a few more
  10714. commands specific to Objective-C support.
  10715. * Menu:
  10716. * Method Names in Commands::
  10717. * The Print Command with Objective-C::
  10718. 
  10719. File: gdb.info, Node: Method Names in Commands, Next: The Print Command with Objective-C, Up: Objective-C
  10720. 15.4.4.1 Method Names in Commands
  10721. .................................
  10722. The following commands have been extended to accept Objective-C method
  10723. names as line specifications:
  10724. * 'clear'
  10725. * 'break'
  10726. * 'info line'
  10727. * 'jump'
  10728. * 'list'
  10729. A fully qualified Objective-C method name is specified as
  10730. -[CLASS METHODNAME]
  10731. where the minus sign is used to indicate an instance method and a
  10732. plus sign (not shown) is used to indicate a class method. The class
  10733. name CLASS and method name METHODNAME are enclosed in brackets, similar
  10734. to the way messages are specified in Objective-C source code. For
  10735. example, to set a breakpoint at the 'create' instance method of class
  10736. 'Fruit' in the program currently being debugged, enter:
  10737. break -[Fruit create]
  10738. To list ten program lines around the 'initialize' class method,
  10739. enter:
  10740. list +[NSText initialize]
  10741. In the current version of GDB, the plus or minus sign is required.
  10742. In future versions of GDB, the plus or minus sign will be optional, but
  10743. you can use it to narrow the search. It is also possible to specify
  10744. just a method name:
  10745. break create
  10746. You must specify the complete method name, including any colons. If
  10747. your program's source files contain more than one 'create' method,
  10748. you'll be presented with a numbered list of classes that implement that
  10749. method. Indicate your choice by number, or type '0' to exit if none
  10750. apply.
  10751. As another example, to clear a breakpoint established at the
  10752. 'makeKeyAndOrderFront:' method of the 'NSWindow' class, enter:
  10753. clear -[NSWindow makeKeyAndOrderFront:]
  10754. 
  10755. File: gdb.info, Node: The Print Command with Objective-C, Prev: Method Names in Commands, Up: Objective-C
  10756. 15.4.4.2 The Print Command With Objective-C
  10757. ...........................................
  10758. The print command has also been extended to accept methods. For
  10759. example:
  10760. print -[OBJECT hash]
  10761. will tell GDB to send the 'hash' message to OBJECT and print the result.
  10762. Also, an additional command has been added, 'print-object' or 'po' for
  10763. short, which is meant to print the description of an object. However,
  10764. this command may only work with certain Objective-C libraries that have
  10765. a particular hook function, '_NSPrintForDebugger', defined.
  10766. 
  10767. File: gdb.info, Node: OpenCL C, Next: Fortran, Prev: Objective-C, Up: Supported Languages
  10768. 15.4.5 OpenCL C
  10769. ---------------
  10770. This section provides information about GDBs OpenCL C support.
  10771. * Menu:
  10772. * OpenCL C Datatypes::
  10773. * OpenCL C Expressions::
  10774. * OpenCL C Operators::
  10775. 
  10776. File: gdb.info, Node: OpenCL C Datatypes, Next: OpenCL C Expressions, Up: OpenCL C
  10777. 15.4.5.1 OpenCL C Datatypes
  10778. ...........................
  10779. GDB supports the builtin scalar and vector datatypes specified by OpenCL
  10780. 1.1. In addition the half- and double-precision floating point data
  10781. types of the 'cl_khr_fp16' and 'cl_khr_fp64' OpenCL extensions are also
  10782. known to GDB.
  10783. 
  10784. File: gdb.info, Node: OpenCL C Expressions, Next: OpenCL C Operators, Prev: OpenCL C Datatypes, Up: OpenCL C
  10785. 15.4.5.2 OpenCL C Expressions
  10786. .............................
  10787. GDB supports accesses to vector components including the access as
  10788. lvalue where possible. Since OpenCL C is based on C99 most C
  10789. expressions supported by GDB can be used as well.
  10790. 
  10791. File: gdb.info, Node: OpenCL C Operators, Prev: OpenCL C Expressions, Up: OpenCL C
  10792. 15.4.5.3 OpenCL C Operators
  10793. ...........................
  10794. GDB supports the operators specified by OpenCL 1.1 for scalar and vector
  10795. data types.
  10796. 
  10797. File: gdb.info, Node: Fortran, Next: Pascal, Prev: OpenCL C, Up: Supported Languages
  10798. 15.4.6 Fortran
  10799. --------------
  10800. GDB can be used to debug programs written in Fortran, but it currently
  10801. supports only the features of Fortran 77 language.
  10802. Some Fortran compilers (GNU Fortran 77 and Fortran 95 compilers among
  10803. them) append an underscore to the names of variables and functions.
  10804. When you debug programs compiled by those compilers, you will need to
  10805. refer to variables and functions with a trailing underscore.
  10806. * Menu:
  10807. * Fortran Operators:: Fortran operators and expressions
  10808. * Fortran Defaults:: Default settings for Fortran
  10809. * Special Fortran Commands:: Special GDB commands for Fortran
  10810. 
  10811. File: gdb.info, Node: Fortran Operators, Next: Fortran Defaults, Up: Fortran
  10812. 15.4.6.1 Fortran Operators and Expressions
  10813. ..........................................
  10814. Operators must be defined on values of specific types. For instance,
  10815. '+' is defined on numbers, but not on characters or other non-
  10816. arithmetic types. Operators are often defined on groups of types.
  10817. '**'
  10818. The exponentiation operator. It raises the first operand to the
  10819. power of the second one.
  10820. ':'
  10821. The range operator. Normally used in the form of array(low:high)
  10822. to represent a section of array.
  10823. '%'
  10824. The access component operator. Normally used to access elements in
  10825. derived types. Also suitable for unions. As unions aren't part of
  10826. regular Fortran, this can only happen when accessing a register
  10827. that uses a gdbarch-defined union type.
  10828. 
  10829. File: gdb.info, Node: Fortran Defaults, Next: Special Fortran Commands, Prev: Fortran Operators, Up: Fortran
  10830. 15.4.6.2 Fortran Defaults
  10831. .........................
  10832. Fortran symbols are usually case-insensitive, so GDB by default uses
  10833. case-insensitive matches for Fortran symbols. You can change that with
  10834. the 'set case-insensitive' command, see *note Symbols::, for the
  10835. details.
  10836. 
  10837. File: gdb.info, Node: Special Fortran Commands, Prev: Fortran Defaults, Up: Fortran
  10838. 15.4.6.3 Special Fortran Commands
  10839. .................................
  10840. GDB has some commands to support Fortran-specific features, such as
  10841. displaying common blocks.
  10842. 'info common [COMMON-NAME]'
  10843. This command prints the values contained in the Fortran 'COMMON'
  10844. block whose name is COMMON-NAME. With no argument, the names of
  10845. all 'COMMON' blocks visible at the current program location are
  10846. printed.
  10847. 
  10848. File: gdb.info, Node: Pascal, Next: Rust, Prev: Fortran, Up: Supported Languages
  10849. 15.4.7 Pascal
  10850. -------------
  10851. Debugging Pascal programs which use sets, subranges, file variables, or
  10852. nested functions does not currently work. GDB does not support entering
  10853. expressions, printing values, or similar features using Pascal syntax.
  10854. The Pascal-specific command 'set print pascal_static-members'
  10855. controls whether static members of Pascal objects are displayed. *Note
  10856. pascal_static-members: Print Settings.
  10857. 
  10858. File: gdb.info, Node: Rust, Next: Modula-2, Prev: Pascal, Up: Supported Languages
  10859. 15.4.8 Rust
  10860. -----------
  10861. GDB supports the Rust Programming Language (https://www.rust-lang.org/).
  10862. Type- and value-printing, and expression parsing, are reasonably
  10863. complete. However, there are a few peculiarities and holes to be aware
  10864. of.
  10865. * Linespecs (*note Specify Location::) are never relative to the
  10866. current crate. Instead, they act as if there were a global
  10867. namespace of crates, somewhat similar to the way 'extern crate'
  10868. behaves.
  10869. That is, if GDB is stopped at a breakpoint in a function in crate
  10870. 'A', module 'B', then 'break B::f' will attempt to set a breakpoint
  10871. in a function named 'f' in a crate named 'B'.
  10872. As a consequence of this approach, linespecs also cannot refer to
  10873. items using 'self::' or 'super::'.
  10874. * Because GDB implements Rust name-lookup semantics in expressions,
  10875. it will sometimes prepend the current crate to a name. For
  10876. example, if GDB is stopped at a breakpoint in the crate 'K', then
  10877. 'print ::x::y' will try to find the symbol 'K::x::y'.
  10878. However, since it is useful to be able to refer to other crates
  10879. when debugging, GDB provides the 'extern' extension to circumvent
  10880. this. To use the extension, just put 'extern' before a path
  10881. expression to refer to the otherwise unavailable "global" scope.
  10882. In the above example, if you wanted to refer to the symbol 'y' in
  10883. the crate 'x', you would use 'print extern x::y'.
  10884. * The Rust expression evaluator does not support "statement-like"
  10885. expressions such as 'if' or 'match', or lambda expressions.
  10886. * Tuple expressions are not implemented.
  10887. * The Rust expression evaluator does not currently implement the
  10888. 'Drop' trait. Objects that may be created by the evaluator will
  10889. never be destroyed.
  10890. * GDB does not implement type inference for generics. In order to
  10891. call generic functions or otherwise refer to generic items, you
  10892. will have to specify the type parameters manually.
  10893. * GDB currently uses the C++ demangler for Rust. In most cases this
  10894. does not cause any problems. However, in an expression context,
  10895. completing a generic function name will give syntactically invalid
  10896. results. This happens because Rust requires the '::' operator
  10897. between the function name and its generic arguments. For example,
  10898. GDB might provide a completion like 'crate::f<u32>', where the
  10899. parser would require 'crate::f::<u32>'.
  10900. * As of this writing, the Rust compiler (version 1.8) has a few holes
  10901. in the debugging information it generates. These holes prevent
  10902. certain features from being implemented by GDB:
  10903. * Method calls cannot be made via traits.
  10904. * Operator overloading is not implemented.
  10905. * When debugging in a monomorphized function, you cannot use the
  10906. generic type names.
  10907. * The type 'Self' is not available.
  10908. * 'use' statements are not available, so some names may not be
  10909. available in the crate.
  10910. 
  10911. File: gdb.info, Node: Modula-2, Next: Ada, Prev: Rust, Up: Supported Languages
  10912. 15.4.9 Modula-2
  10913. ---------------
  10914. The extensions made to GDB to support Modula-2 only support output from
  10915. the GNU Modula-2 compiler (which is currently being developed). Other
  10916. Modula-2 compilers are not currently supported, and attempting to debug
  10917. executables produced by them is most likely to give an error as GDB
  10918. reads in the executable's symbol table.
  10919. * Menu:
  10920. * M2 Operators:: Built-in operators
  10921. * Built-In Func/Proc:: Built-in functions and procedures
  10922. * M2 Constants:: Modula-2 constants
  10923. * M2 Types:: Modula-2 types
  10924. * M2 Defaults:: Default settings for Modula-2
  10925. * Deviations:: Deviations from standard Modula-2
  10926. * M2 Checks:: Modula-2 type and range checks
  10927. * M2 Scope:: The scope operators '::' and '.'
  10928. * GDB/M2:: GDB and Modula-2
  10929. 
  10930. File: gdb.info, Node: M2 Operators, Next: Built-In Func/Proc, Up: Modula-2
  10931. 15.4.9.1 Operators
  10932. ..................
  10933. Operators must be defined on values of specific types. For instance,
  10934. '+' is defined on numbers, but not on structures. Operators are often
  10935. defined on groups of types. For the purposes of Modula-2, the following
  10936. definitions hold:
  10937. * _Integral types_ consist of 'INTEGER', 'CARDINAL', and their
  10938. subranges.
  10939. * _Character types_ consist of 'CHAR' and its subranges.
  10940. * _Floating-point types_ consist of 'REAL'.
  10941. * _Pointer types_ consist of anything declared as 'POINTER TO TYPE'.
  10942. * _Scalar types_ consist of all of the above.
  10943. * _Set types_ consist of 'SET' and 'BITSET' types.
  10944. * _Boolean types_ consist of 'BOOLEAN'.
  10945. The following operators are supported, and appear in order of increasing
  10946. precedence:
  10947. ','
  10948. Function argument or array index separator.
  10949. ':='
  10950. Assignment. The value of VAR ':=' VALUE is VALUE.
  10951. '<, >'
  10952. Less than, greater than on integral, floating-point, or enumerated
  10953. types.
  10954. '<=, >='
  10955. Less than or equal to, greater than or equal to on integral,
  10956. floating-point and enumerated types, or set inclusion on set types.
  10957. Same precedence as '<'.
  10958. '=, <>, #'
  10959. Equality and two ways of expressing inequality, valid on scalar
  10960. types. Same precedence as '<'. In GDB scripts, only '<>' is
  10961. available for inequality, since '#' conflicts with the script
  10962. comment character.
  10963. 'IN'
  10964. Set membership. Defined on set types and the types of their
  10965. members. Same precedence as '<'.
  10966. 'OR'
  10967. Boolean disjunction. Defined on boolean types.
  10968. 'AND, &'
  10969. Boolean conjunction. Defined on boolean types.
  10970. '@'
  10971. The GDB "artificial array" operator (*note Expressions:
  10972. Expressions.).
  10973. '+, -'
  10974. Addition and subtraction on integral and floating-point types, or
  10975. union and difference on set types.
  10976. '*'
  10977. Multiplication on integral and floating-point types, or set
  10978. intersection on set types.
  10979. '/'
  10980. Division on floating-point types, or symmetric set difference on
  10981. set types. Same precedence as '*'.
  10982. 'DIV, MOD'
  10983. Integer division and remainder. Defined on integral types. Same
  10984. precedence as '*'.
  10985. '-'
  10986. Negative. Defined on 'INTEGER' and 'REAL' data.
  10987. '^'
  10988. Pointer dereferencing. Defined on pointer types.
  10989. 'NOT'
  10990. Boolean negation. Defined on boolean types. Same precedence as
  10991. '^'.
  10992. '.'
  10993. 'RECORD' field selector. Defined on 'RECORD' data. Same
  10994. precedence as '^'.
  10995. '[]'
  10996. Array indexing. Defined on 'ARRAY' data. Same precedence as '^'.
  10997. '()'
  10998. Procedure argument list. Defined on 'PROCEDURE' objects. Same
  10999. precedence as '^'.
  11000. '::, .'
  11001. GDB and Modula-2 scope operators.
  11002. _Warning:_ Set expressions and their operations are not yet
  11003. supported, so GDB treats the use of the operator 'IN', or the use
  11004. of operators '+', '-', '*', '/', '=', , '<>', '#', '<=', and '>='
  11005. on sets as an error.
  11006. 
  11007. File: gdb.info, Node: Built-In Func/Proc, Next: M2 Constants, Prev: M2 Operators, Up: Modula-2
  11008. 15.4.9.2 Built-in Functions and Procedures
  11009. ..........................................
  11010. Modula-2 also makes available several built-in procedures and functions.
  11011. In describing these, the following metavariables are used:
  11012. A
  11013. represents an 'ARRAY' variable.
  11014. C
  11015. represents a 'CHAR' constant or variable.
  11016. I
  11017. represents a variable or constant of integral type.
  11018. M
  11019. represents an identifier that belongs to a set. Generally used in
  11020. the same function with the metavariable S. The type of S should be
  11021. 'SET OF MTYPE' (where MTYPE is the type of M).
  11022. N
  11023. represents a variable or constant of integral or floating-point
  11024. type.
  11025. R
  11026. represents a variable or constant of floating-point type.
  11027. T
  11028. represents a type.
  11029. V
  11030. represents a variable.
  11031. X
  11032. represents a variable or constant of one of many types. See the
  11033. explanation of the function for details.
  11034. All Modula-2 built-in procedures also return a result, described
  11035. below.
  11036. 'ABS(N)'
  11037. Returns the absolute value of N.
  11038. 'CAP(C)'
  11039. If C is a lower case letter, it returns its upper case equivalent,
  11040. otherwise it returns its argument.
  11041. 'CHR(I)'
  11042. Returns the character whose ordinal value is I.
  11043. 'DEC(V)'
  11044. Decrements the value in the variable V by one. Returns the new
  11045. value.
  11046. 'DEC(V,I)'
  11047. Decrements the value in the variable V by I. Returns the new
  11048. value.
  11049. 'EXCL(M,S)'
  11050. Removes the element M from the set S. Returns the new set.
  11051. 'FLOAT(I)'
  11052. Returns the floating point equivalent of the integer I.
  11053. 'HIGH(A)'
  11054. Returns the index of the last member of A.
  11055. 'INC(V)'
  11056. Increments the value in the variable V by one. Returns the new
  11057. value.
  11058. 'INC(V,I)'
  11059. Increments the value in the variable V by I. Returns the new
  11060. value.
  11061. 'INCL(M,S)'
  11062. Adds the element M to the set S if it is not already there.
  11063. Returns the new set.
  11064. 'MAX(T)'
  11065. Returns the maximum value of the type T.
  11066. 'MIN(T)'
  11067. Returns the minimum value of the type T.
  11068. 'ODD(I)'
  11069. Returns boolean TRUE if I is an odd number.
  11070. 'ORD(X)'
  11071. Returns the ordinal value of its argument. For example, the
  11072. ordinal value of a character is its ASCII value (on machines
  11073. supporting the ASCII character set). The argument X must be of an
  11074. ordered type, which include integral, character and enumerated
  11075. types.
  11076. 'SIZE(X)'
  11077. Returns the size of its argument. The argument X can be a variable
  11078. or a type.
  11079. 'TRUNC(R)'
  11080. Returns the integral part of R.
  11081. 'TSIZE(X)'
  11082. Returns the size of its argument. The argument X can be a variable
  11083. or a type.
  11084. 'VAL(T,I)'
  11085. Returns the member of the type T whose ordinal value is I.
  11086. _Warning:_ Sets and their operations are not yet supported, so GDB
  11087. treats the use of procedures 'INCL' and 'EXCL' as an error.
  11088. 
  11089. File: gdb.info, Node: M2 Constants, Next: M2 Types, Prev: Built-In Func/Proc, Up: Modula-2
  11090. 15.4.9.3 Constants
  11091. ..................
  11092. GDB allows you to express the constants of Modula-2 in the following
  11093. ways:
  11094. * Integer constants are simply a sequence of digits. When used in an
  11095. expression, a constant is interpreted to be type-compatible with
  11096. the rest of the expression. Hexadecimal integers are specified by
  11097. a trailing 'H', and octal integers by a trailing 'B'.
  11098. * Floating point constants appear as a sequence of digits, followed
  11099. by a decimal point and another sequence of digits. An optional
  11100. exponent can then be specified, in the form 'E[+|-]NNN', where
  11101. '[+|-]NNN' is the desired exponent. All of the digits of the
  11102. floating point constant must be valid decimal (base 10) digits.
  11103. * Character constants consist of a single character enclosed by a
  11104. pair of like quotes, either single (''') or double ('"'). They may
  11105. also be expressed by their ordinal value (their ASCII value,
  11106. usually) followed by a 'C'.
  11107. * String constants consist of a sequence of characters enclosed by a
  11108. pair of like quotes, either single (''') or double ('"'). Escape
  11109. sequences in the style of C are also allowed. *Note C and C++
  11110. Constants: C Constants, for a brief explanation of escape
  11111. sequences.
  11112. * Enumerated constants consist of an enumerated identifier.
  11113. * Boolean constants consist of the identifiers 'TRUE' and 'FALSE'.
  11114. * Pointer constants consist of integral values only.
  11115. * Set constants are not yet supported.
  11116. 
  11117. File: gdb.info, Node: M2 Types, Next: M2 Defaults, Prev: M2 Constants, Up: Modula-2
  11118. 15.4.9.4 Modula-2 Types
  11119. .......................
  11120. Currently GDB can print the following data types in Modula-2 syntax:
  11121. array types, record types, set types, pointer types, procedure types,
  11122. enumerated types, subrange types and base types. You can also print the
  11123. contents of variables declared using these type. This section gives a
  11124. number of simple source code examples together with sample GDB sessions.
  11125. The first example contains the following section of code:
  11126. VAR
  11127. s: SET OF CHAR ;
  11128. r: [20..40] ;
  11129. and you can request GDB to interrogate the type and value of 'r' and
  11130. 's'.
  11131. (gdb) print s
  11132. {'A'..'C', 'Z'}
  11133. (gdb) ptype s
  11134. SET OF CHAR
  11135. (gdb) print r
  11136. 21
  11137. (gdb) ptype r
  11138. [20..40]
  11139. Likewise if your source code declares 's' as:
  11140. VAR
  11141. s: SET ['A'..'Z'] ;
  11142. then you may query the type of 's' by:
  11143. (gdb) ptype s
  11144. type = SET ['A'..'Z']
  11145. Note that at present you cannot interactively manipulate set expressions
  11146. using the debugger.
  11147. The following example shows how you might declare an array in
  11148. Modula-2 and how you can interact with GDB to print its type and
  11149. contents:
  11150. VAR
  11151. s: ARRAY [-10..10] OF CHAR ;
  11152. (gdb) ptype s
  11153. ARRAY [-10..10] OF CHAR
  11154. Note that the array handling is not yet complete and although the
  11155. type is printed correctly, expression handling still assumes that all
  11156. arrays have a lower bound of zero and not '-10' as in the example above.
  11157. Here are some more type related Modula-2 examples:
  11158. TYPE
  11159. colour = (blue, red, yellow, green) ;
  11160. t = [blue..yellow] ;
  11161. VAR
  11162. s: t ;
  11163. BEGIN
  11164. s := blue ;
  11165. The GDB interaction shows how you can query the data type and value of a
  11166. variable.
  11167. (gdb) print s
  11168. $1 = blue
  11169. (gdb) ptype t
  11170. type = [blue..yellow]
  11171. In this example a Modula-2 array is declared and its contents displayed.
  11172. Observe that the contents are written in the same way as their 'C'
  11173. counterparts.
  11174. VAR
  11175. s: ARRAY [1..5] OF CARDINAL ;
  11176. BEGIN
  11177. s[1] := 1 ;
  11178. (gdb) print s
  11179. $1 = {1, 0, 0, 0, 0}
  11180. (gdb) ptype s
  11181. type = ARRAY [1..5] OF CARDINAL
  11182. The Modula-2 language interface to GDB also understands pointer types
  11183. as shown in this example:
  11184. VAR
  11185. s: POINTER TO ARRAY [1..5] OF CARDINAL ;
  11186. BEGIN
  11187. NEW(s) ;
  11188. s^[1] := 1 ;
  11189. and you can request that GDB describes the type of 's'.
  11190. (gdb) ptype s
  11191. type = POINTER TO ARRAY [1..5] OF CARDINAL
  11192. GDB handles compound types as we can see in this example. Here we
  11193. combine array types, record types, pointer types and subrange types:
  11194. TYPE
  11195. foo = RECORD
  11196. f1: CARDINAL ;
  11197. f2: CHAR ;
  11198. f3: myarray ;
  11199. END ;
  11200. myarray = ARRAY myrange OF CARDINAL ;
  11201. myrange = [-2..2] ;
  11202. VAR
  11203. s: POINTER TO ARRAY myrange OF foo ;
  11204. and you can ask GDB to describe the type of 's' as shown below.
  11205. (gdb) ptype s
  11206. type = POINTER TO ARRAY [-2..2] OF foo = RECORD
  11207. f1 : CARDINAL;
  11208. f2 : CHAR;
  11209. f3 : ARRAY [-2..2] OF CARDINAL;
  11210. END
  11211. 
  11212. File: gdb.info, Node: M2 Defaults, Next: Deviations, Prev: M2 Types, Up: Modula-2
  11213. 15.4.9.5 Modula-2 Defaults
  11214. ..........................
  11215. If type and range checking are set automatically by GDB, they both
  11216. default to 'on' whenever the working language changes to Modula-2. This
  11217. happens regardless of whether you or GDB selected the working language.
  11218. If you allow GDB to set the language automatically, then entering
  11219. code compiled from a file whose name ends with '.mod' sets the working
  11220. language to Modula-2. *Note Having GDB Infer the Source Language:
  11221. Automatically, for further details.
  11222. 
  11223. File: gdb.info, Node: Deviations, Next: M2 Checks, Prev: M2 Defaults, Up: Modula-2
  11224. 15.4.9.6 Deviations from Standard Modula-2
  11225. ..........................................
  11226. A few changes have been made to make Modula-2 programs easier to debug.
  11227. This is done primarily via loosening its type strictness:
  11228. * Unlike in standard Modula-2, pointer constants can be formed by
  11229. integers. This allows you to modify pointer variables during
  11230. debugging. (In standard Modula-2, the actual address contained in
  11231. a pointer variable is hidden from you; it can only be modified
  11232. through direct assignment to another pointer variable or expression
  11233. that returned a pointer.)
  11234. * C escape sequences can be used in strings and characters to
  11235. represent non-printable characters. GDB prints out strings with
  11236. these escape sequences embedded. Single non-printable characters
  11237. are printed using the 'CHR(NNN)' format.
  11238. * The assignment operator (':=') returns the value of its right-hand
  11239. argument.
  11240. * All built-in procedures both modify _and_ return their argument.
  11241. 
  11242. File: gdb.info, Node: M2 Checks, Next: M2 Scope, Prev: Deviations, Up: Modula-2
  11243. 15.4.9.7 Modula-2 Type and Range Checks
  11244. .......................................
  11245. _Warning:_ in this release, GDB does not yet perform type or range
  11246. checking.
  11247. GDB considers two Modula-2 variables type equivalent if:
  11248. * They are of types that have been declared equivalent via a 'TYPE T1
  11249. = T2' statement
  11250. * They have been declared on the same line. (Note: This is true of
  11251. the GNU Modula-2 compiler, but it may not be true of other
  11252. compilers.)
  11253. As long as type checking is enabled, any attempt to combine variables
  11254. whose types are not equivalent is an error.
  11255. Range checking is done on all mathematical operations, assignment,
  11256. array index bounds, and all built-in functions and procedures.
  11257. 
  11258. File: gdb.info, Node: M2 Scope, Next: GDB/M2, Prev: M2 Checks, Up: Modula-2
  11259. 15.4.9.8 The Scope Operators '::' and '.'
  11260. .........................................
  11261. There are a few subtle differences between the Modula-2 scope operator
  11262. ('.') and the GDB scope operator ('::'). The two have similar syntax:
  11263. MODULE . ID
  11264. SCOPE :: ID
  11265. where SCOPE is the name of a module or a procedure, MODULE the name of a
  11266. module, and ID is any declared identifier within your program, except
  11267. another module.
  11268. Using the '::' operator makes GDB search the scope specified by SCOPE
  11269. for the identifier ID. If it is not found in the specified scope, then
  11270. GDB searches all scopes enclosing the one specified by SCOPE.
  11271. Using the '.' operator makes GDB search the current scope for the
  11272. identifier specified by ID that was imported from the definition module
  11273. specified by MODULE. With this operator, it is an error if the
  11274. identifier ID was not imported from definition module MODULE, or if ID
  11275. is not an identifier in MODULE.
  11276. 
  11277. File: gdb.info, Node: GDB/M2, Prev: M2 Scope, Up: Modula-2
  11278. 15.4.9.9 GDB and Modula-2
  11279. .........................
  11280. Some GDB commands have little use when debugging Modula-2 programs.
  11281. Five subcommands of 'set print' and 'show print' apply specifically to C
  11282. and C++: 'vtbl', 'demangle', 'asm-demangle', 'object', and 'union'. The
  11283. first four apply to C++, and the last to the C 'union' type, which has
  11284. no direct analogue in Modula-2.
  11285. The '@' operator (*note Expressions: Expressions.), while available
  11286. with any language, is not useful with Modula-2. Its intent is to aid
  11287. the debugging of "dynamic arrays", which cannot be created in Modula-2
  11288. as they can in C or C++. However, because an address can be specified
  11289. by an integral constant, the construct '{TYPE}ADREXP' is still useful.
  11290. In GDB scripts, the Modula-2 inequality operator '#' is interpreted
  11291. as the beginning of a comment. Use '<>' instead.
  11292. 
  11293. File: gdb.info, Node: Ada, Prev: Modula-2, Up: Supported Languages
  11294. 15.4.10 Ada
  11295. -----------
  11296. The extensions made to GDB for Ada only support output from the GNU Ada
  11297. (GNAT) compiler. Other Ada compilers are not currently supported, and
  11298. attempting to debug executables produced by them is most likely to be
  11299. difficult.
  11300. * Menu:
  11301. * Ada Mode Intro:: General remarks on the Ada syntax
  11302. and semantics supported by Ada mode
  11303. in GDB.
  11304. * Omissions from Ada:: Restrictions on the Ada expression syntax.
  11305. * Additions to Ada:: Extensions of the Ada expression syntax.
  11306. * Overloading support for Ada:: Support for expressions involving overloaded
  11307. subprograms.
  11308. * Stopping Before Main Program:: Debugging the program during elaboration.
  11309. * Ada Exceptions:: Ada Exceptions
  11310. * Ada Tasks:: Listing and setting breakpoints in tasks.
  11311. * Ada Tasks and Core Files:: Tasking Support when Debugging Core Files
  11312. * Ravenscar Profile:: Tasking Support when using the Ravenscar
  11313. Profile
  11314. * Ada Settings:: New settable GDB parameters for Ada.
  11315. * Ada Glitches:: Known peculiarities of Ada mode.
  11316. 
  11317. File: gdb.info, Node: Ada Mode Intro, Next: Omissions from Ada, Up: Ada
  11318. 15.4.10.1 Introduction
  11319. ......................
  11320. The Ada mode of GDB supports a fairly large subset of Ada expression
  11321. syntax, with some extensions. The philosophy behind the design of this
  11322. subset is
  11323. * That GDB should provide basic literals and access to operations for
  11324. arithmetic, dereferencing, field selection, indexing, and
  11325. subprogram calls, leaving more sophisticated computations to
  11326. subprograms written into the program (which therefore may be called
  11327. from GDB).
  11328. * That type safety and strict adherence to Ada language restrictions
  11329. are not particularly important to the GDB user.
  11330. * That brevity is important to the GDB user.
  11331. Thus, for brevity, the debugger acts as if all names declared in
  11332. user-written packages are directly visible, even if they are not visible
  11333. according to Ada rules, thus making it unnecessary to fully qualify most
  11334. names with their packages, regardless of context. Where this causes
  11335. ambiguity, GDB asks the user's intent.
  11336. The debugger will start in Ada mode if it detects an Ada main
  11337. program. As for other languages, it will enter Ada mode when stopped in
  11338. a program that was translated from an Ada source file.
  11339. While in Ada mode, you may use '--' for comments. This is useful
  11340. mostly for documenting command files. The standard GDB comment ('#')
  11341. still works at the beginning of a line in Ada mode, but not in the
  11342. middle (to allow based literals).
  11343. 
  11344. File: gdb.info, Node: Omissions from Ada, Next: Additions to Ada, Prev: Ada Mode Intro, Up: Ada
  11345. 15.4.10.2 Omissions from Ada
  11346. ............................
  11347. Here are the notable omissions from the subset:
  11348. * Only a subset of the attributes are supported:
  11349. - 'First, 'Last, and 'Length on array objects (not on types and
  11350. subtypes).
  11351. - 'Min and 'Max.
  11352. - 'Pos and 'Val.
  11353. - 'Tag.
  11354. - 'Range on array objects (not subtypes), but only as the right
  11355. operand of the membership ('in') operator.
  11356. - 'Access, 'Unchecked_Access, and 'Unrestricted_Access (a GNAT
  11357. extension).
  11358. - 'Address.
  11359. * The names in 'Characters.Latin_1' are not available and
  11360. concatenation is not implemented. Thus, escape characters in
  11361. strings are not currently available.
  11362. * Equality tests ('=' and '/=') on arrays test for bitwise equality
  11363. of representations. They will generally work correctly for strings
  11364. and arrays whose elements have integer or enumeration types. They
  11365. may not work correctly for arrays whose element types have
  11366. user-defined equality, for arrays of real values (in particular,
  11367. IEEE-conformant floating point, because of negative zeroes and
  11368. NaNs), and for arrays whose elements contain unused bits with
  11369. indeterminate values.
  11370. * The other component-by-component array operations ('and', 'or',
  11371. 'xor', 'not', and relational tests other than equality) are not
  11372. implemented.
  11373. * There is limited support for array and record aggregates. They are
  11374. permitted only on the right sides of assignments, as in these
  11375. examples:
  11376. (gdb) set An_Array := (1, 2, 3, 4, 5, 6)
  11377. (gdb) set An_Array := (1, others => 0)
  11378. (gdb) set An_Array := (0|4 => 1, 1..3 => 2, 5 => 6)
  11379. (gdb) set A_2D_Array := ((1, 2, 3), (4, 5, 6), (7, 8, 9))
  11380. (gdb) set A_Record := (1, "Peter", True);
  11381. (gdb) set A_Record := (Name => "Peter", Id => 1, Alive => True)
  11382. Changing a discriminant's value by assigning an aggregate has an
  11383. undefined effect if that discriminant is used within the record.
  11384. However, you can first modify discriminants by directly assigning
  11385. to them (which normally would not be allowed in Ada), and then
  11386. performing an aggregate assignment. For example, given a variable
  11387. 'A_Rec' declared to have a type such as:
  11388. type Rec (Len : Small_Integer := 0) is record
  11389. Id : Integer;
  11390. Vals : IntArray (1 .. Len);
  11391. end record;
  11392. you can assign a value with a different size of 'Vals' with two
  11393. assignments:
  11394. (gdb) set A_Rec.Len := 4
  11395. (gdb) set A_Rec := (Id => 42, Vals => (1, 2, 3, 4))
  11396. As this example also illustrates, GDB is very loose about the usual
  11397. rules concerning aggregates. You may leave out some of the
  11398. components of an array or record aggregate (such as the 'Len'
  11399. component in the assignment to 'A_Rec' above); they will retain
  11400. their original values upon assignment. You may freely use dynamic
  11401. values as indices in component associations. You may even use
  11402. overlapping or redundant component associations, although which
  11403. component values are assigned in such cases is not defined.
  11404. * Calls to dispatching subprograms are not implemented.
  11405. * The overloading algorithm is much more limited (i.e., less
  11406. selective) than that of real Ada. It makes only limited use of the
  11407. context in which a subexpression appears to resolve its meaning,
  11408. and it is much looser in its rules for allowing type matches. As a
  11409. result, some function calls will be ambiguous, and the user will be
  11410. asked to choose the proper resolution.
  11411. * The 'new' operator is not implemented.
  11412. * Entry calls are not implemented.
  11413. * Aside from printing, arithmetic operations on the native VAX
  11414. floating-point formats are not supported.
  11415. * It is not possible to slice a packed array.
  11416. * The names 'True' and 'False', when not part of a qualified name,
  11417. are interpreted as if implicitly prefixed by 'Standard', regardless
  11418. of context. Should your program redefine these names in a package
  11419. or procedure (at best a dubious practice), you will have to use
  11420. fully qualified names to access their new definitions.
  11421. 
  11422. File: gdb.info, Node: Additions to Ada, Next: Overloading support for Ada, Prev: Omissions from Ada, Up: Ada
  11423. 15.4.10.3 Additions to Ada
  11424. ..........................
  11425. As it does for other languages, GDB makes certain generic extensions to
  11426. Ada (*note Expressions::):
  11427. * If the expression E is a variable residing in memory (typically a
  11428. local variable or array element) and N is a positive integer, then
  11429. 'E@N' displays the values of E and the N-1 adjacent variables
  11430. following it in memory as an array. In Ada, this operator is
  11431. generally not necessary, since its prime use is in displaying parts
  11432. of an array, and slicing will usually do this in Ada. However,
  11433. there are occasional uses when debugging programs in which certain
  11434. debugging information has been optimized away.
  11435. * 'B::VAR' means "the variable named VAR that appears in function or
  11436. file B." When B is a file name, you must typically surround it in
  11437. single quotes.
  11438. * The expression '{TYPE} ADDR' means "the variable of type TYPE that
  11439. appears at address ADDR."
  11440. * A name starting with '$' is a convenience variable (*note
  11441. Convenience Vars::) or a machine register (*note Registers::).
  11442. In addition, GDB provides a few other shortcuts and outright
  11443. additions specific to Ada:
  11444. * The assignment statement is allowed as an expression, returning its
  11445. right-hand operand as its value. Thus, you may enter
  11446. (gdb) set x := y + 3
  11447. (gdb) print A(tmp := y + 1)
  11448. * The semicolon is allowed as an "operator," returning as its value
  11449. the value of its right-hand operand. This allows, for example,
  11450. complex conditional breaks:
  11451. (gdb) break f
  11452. (gdb) condition 1 (report(i); k += 1; A(k) > 100)
  11453. * Rather than use catenation and symbolic character names to
  11454. introduce special characters into strings, one may instead use a
  11455. special bracket notation, which is also used to print strings. A
  11456. sequence of characters of the form '["XX"]' within a string or
  11457. character literal denotes the (single) character whose numeric
  11458. encoding is XX in hexadecimal. The sequence of characters '["""]'
  11459. also denotes a single quotation mark in strings. For example,
  11460. "One line.["0a"]Next line.["0a"]"
  11461. contains an ASCII newline character ('Ada.Characters.Latin_1.LF')
  11462. after each period.
  11463. * The subtype used as a prefix for the attributes 'Pos, 'Min, and
  11464. 'Max is optional (and is ignored in any case). For example, it is
  11465. valid to write
  11466. (gdb) print 'max(x, y)
  11467. * When printing arrays, GDB uses positional notation when the array
  11468. has a lower bound of 1, and uses a modified named notation
  11469. otherwise. For example, a one-dimensional array of three integers
  11470. with a lower bound of 3 might print as
  11471. (3 => 10, 17, 1)
  11472. That is, in contrast to valid Ada, only the first component has a
  11473. '=>' clause.
  11474. * You may abbreviate attributes in expressions with any unique,
  11475. multi-character subsequence of their names (an exact match gets
  11476. preference). For example, you may use a'len, a'gth, or a'lh in
  11477. place of a'length.
  11478. * Since Ada is case-insensitive, the debugger normally maps
  11479. identifiers you type to lower case. The GNAT compiler uses
  11480. upper-case characters for some of its internal identifiers, which
  11481. are normally of no interest to users. For the rare occasions when
  11482. you actually have to look at them, enclose them in angle brackets
  11483. to avoid the lower-case mapping. For example,
  11484. (gdb) print <JMPBUF_SAVE>[0]
  11485. * Printing an object of class-wide type or dereferencing an
  11486. access-to-class-wide value will display all the components of the
  11487. object's specific type (as indicated by its run-time tag).
  11488. Likewise, component selection on such a value will operate on the
  11489. specific type of the object.
  11490. 
  11491. File: gdb.info, Node: Overloading support for Ada, Next: Stopping Before Main Program, Prev: Additions to Ada, Up: Ada
  11492. 15.4.10.4 Overloading support for Ada
  11493. .....................................
  11494. The debugger supports limited overloading. Given a subprogram call in
  11495. which the function symbol has multiple definitions, it will use the
  11496. number of actual parameters and some information about their types to
  11497. attempt to narrow the set of definitions. It also makes very limited
  11498. use of context, preferring procedures to functions in the context of the
  11499. 'call' command, and functions to procedures elsewhere.
  11500. If, after narrowing, the set of matching definitions still contains
  11501. more than one definition, GDB will display a menu to query which one it
  11502. should use, for instance:
  11503. (gdb) print f(1)
  11504. Multiple matches for f
  11505. [0] cancel
  11506. [1] foo.f (integer) return boolean at foo.adb:23
  11507. [2] foo.f (foo.new_integer) return boolean at foo.adb:28
  11508. >
  11509. In this case, just select one menu entry either to cancel expression
  11510. evaluation (type '0' and press <RET>) or to continue evaluation with a
  11511. specific instance (type the corresponding number and press <RET>).
  11512. Here are a couple of commands to customize GDB's behavior in this
  11513. case:
  11514. 'set ada print-signatures'
  11515. Control whether parameter types and return types are displayed in
  11516. overloads selection menus. It is 'on' by default. *Note
  11517. Overloading support for Ada::.
  11518. 'show ada print-signatures'
  11519. Show the current setting for displaying parameter types and return
  11520. types in overloads selection menu. *Note Overloading support for
  11521. Ada::.
  11522. 
  11523. File: gdb.info, Node: Stopping Before Main Program, Next: Ada Exceptions, Prev: Overloading support for Ada, Up: Ada
  11524. 15.4.10.5 Stopping at the Very Beginning
  11525. ........................................
  11526. It is sometimes necessary to debug the program during elaboration, and
  11527. before reaching the main procedure. As defined in the Ada Reference
  11528. Manual, the elaboration code is invoked from a procedure called
  11529. 'adainit'. To run your program up to the beginning of elaboration,
  11530. simply use the following two commands: 'tbreak adainit' and 'run'.
  11531. 
  11532. File: gdb.info, Node: Ada Exceptions, Next: Ada Tasks, Prev: Stopping Before Main Program, Up: Ada
  11533. 15.4.10.6 Ada Exceptions
  11534. ........................
  11535. A command is provided to list all Ada exceptions:
  11536. 'info exceptions'
  11537. 'info exceptions REGEXP'
  11538. The 'info exceptions' command allows you to list all Ada exceptions
  11539. defined within the program being debugged, as well as their
  11540. addresses. With a regular expression, REGEXP, as argument, only
  11541. those exceptions whose names match REGEXP are listed.
  11542. Below is a small example, showing how the command can be used, first
  11543. without argument, and next with a regular expression passed as an
  11544. argument.
  11545. (gdb) info exceptions
  11546. All defined Ada exceptions:
  11547. constraint_error: 0x613da0
  11548. program_error: 0x613d20
  11549. storage_error: 0x613ce0
  11550. tasking_error: 0x613ca0
  11551. const.aint_global_e: 0x613b00
  11552. (gdb) info exceptions const.aint
  11553. All Ada exceptions matching regular expression "const.aint":
  11554. constraint_error: 0x613da0
  11555. const.aint_global_e: 0x613b00
  11556. It is also possible to ask GDB to stop your program's execution when
  11557. an exception is raised. For more details, see *note Set Catchpoints::.
  11558. 
  11559. File: gdb.info, Node: Ada Tasks, Next: Ada Tasks and Core Files, Prev: Ada Exceptions, Up: Ada
  11560. 15.4.10.7 Extensions for Ada Tasks
  11561. ..................................
  11562. Support for Ada tasks is analogous to that for threads (*note
  11563. Threads::). GDB provides the following task-related commands:
  11564. 'info tasks'
  11565. This command shows a list of current Ada tasks, as in the following
  11566. example:
  11567. (gdb) info tasks
  11568. ID TID P-ID Pri State Name
  11569. 1 8088000 0 15 Child Activation Wait main_task
  11570. 2 80a4000 1 15 Accept Statement b
  11571. 3 809a800 1 15 Child Activation Wait a
  11572. * 4 80ae800 3 15 Runnable c
  11573. In this listing, the asterisk before the last task indicates it to
  11574. be the task currently being inspected.
  11575. ID
  11576. Represents GDB's internal task number.
  11577. TID
  11578. The Ada task ID.
  11579. P-ID
  11580. The parent's task ID (GDB's internal task number).
  11581. Pri
  11582. The base priority of the task.
  11583. State
  11584. Current state of the task.
  11585. 'Unactivated'
  11586. The task has been created but has not been activated. It
  11587. cannot be executing.
  11588. 'Runnable'
  11589. The task is not blocked for any reason known to Ada. (It
  11590. may be waiting for a mutex, though.) It is conceptually
  11591. "executing" in normal mode.
  11592. 'Terminated'
  11593. The task is terminated, in the sense of ARM 9.3 (5). Any
  11594. dependents that were waiting on terminate alternatives
  11595. have been awakened and have terminated themselves.
  11596. 'Child Activation Wait'
  11597. The task is waiting for created tasks to complete
  11598. activation.
  11599. 'Accept Statement'
  11600. The task is waiting on an accept or selective wait
  11601. statement.
  11602. 'Waiting on entry call'
  11603. The task is waiting on an entry call.
  11604. 'Async Select Wait'
  11605. The task is waiting to start the abortable part of an
  11606. asynchronous select statement.
  11607. 'Delay Sleep'
  11608. The task is waiting on a select statement with only a
  11609. delay alternative open.
  11610. 'Child Termination Wait'
  11611. The task is sleeping having completed a master within
  11612. itself, and is waiting for the tasks dependent on that
  11613. master to become terminated or waiting on a terminate
  11614. Phase.
  11615. 'Wait Child in Term Alt'
  11616. The task is sleeping waiting for tasks on terminate
  11617. alternatives to finish terminating.
  11618. 'Accepting RV with TASKNO'
  11619. The task is accepting a rendez-vous with the task TASKNO.
  11620. Name
  11621. Name of the task in the program.
  11622. 'info task TASKNO'
  11623. This command shows detailled informations on the specified task, as
  11624. in the following example:
  11625. (gdb) info tasks
  11626. ID TID P-ID Pri State Name
  11627. 1 8077880 0 15 Child Activation Wait main_task
  11628. * 2 807c468 1 15 Runnable task_1
  11629. (gdb) info task 2
  11630. Ada Task: 0x807c468
  11631. Name: task_1
  11632. Thread: 0
  11633. LWP: 0x1fac
  11634. Parent: 1 (main_task)
  11635. Base Priority: 15
  11636. State: Runnable
  11637. 'task'
  11638. This command prints the ID of the current task.
  11639. (gdb) info tasks
  11640. ID TID P-ID Pri State Name
  11641. 1 8077870 0 15 Child Activation Wait main_task
  11642. * 2 807c458 1 15 Runnable t
  11643. (gdb) task
  11644. [Current task is 2]
  11645. 'task TASKNO'
  11646. This command is like the 'thread THREAD-ID' command (*note
  11647. Threads::). It switches the context of debugging from the current
  11648. task to the given task.
  11649. (gdb) info tasks
  11650. ID TID P-ID Pri State Name
  11651. 1 8077870 0 15 Child Activation Wait main_task
  11652. * 2 807c458 1 15 Runnable t
  11653. (gdb) task 1
  11654. [Switching to task 1]
  11655. #0 0x8067726 in pthread_cond_wait ()
  11656. (gdb) bt
  11657. #0 0x8067726 in pthread_cond_wait ()
  11658. #1 0x8056714 in system.os_interface.pthread_cond_wait ()
  11659. #2 0x805cb63 in system.task_primitives.operations.sleep ()
  11660. #3 0x806153e in system.tasking.stages.activate_tasks ()
  11661. #4 0x804aacc in un () at un.adb:5
  11662. 'break LOCATION task TASKNO'
  11663. 'break LOCATION task TASKNO if ...'
  11664. These commands are like the 'break ... thread ...' command (*note
  11665. Thread Stops::). The LOCATION argument specifies source lines, as
  11666. described in *note Specify Location::.
  11667. Use the qualifier 'task TASKNO' with a breakpoint command to
  11668. specify that you only want GDB to stop the program when a
  11669. particular Ada task reaches this breakpoint. The TASKNO is one of
  11670. the numeric task identifiers assigned by GDB, shown in the first
  11671. column of the 'info tasks' display.
  11672. If you do not specify 'task TASKNO' when you set a breakpoint, the
  11673. breakpoint applies to _all_ tasks of your program.
  11674. You can use the 'task' qualifier on conditional breakpoints as
  11675. well; in this case, place 'task TASKNO' before the breakpoint
  11676. condition (before the 'if').
  11677. For example,
  11678. (gdb) info tasks
  11679. ID TID P-ID Pri State Name
  11680. 1 140022020 0 15 Child Activation Wait main_task
  11681. 2 140045060 1 15 Accept/Select Wait t2
  11682. 3 140044840 1 15 Runnable t1
  11683. * 4 140056040 1 15 Runnable t3
  11684. (gdb) b 15 task 2
  11685. Breakpoint 5 at 0x120044cb0: file test_task_debug.adb, line 15.
  11686. (gdb) cont
  11687. Continuing.
  11688. task # 1 running
  11689. task # 2 running
  11690. Breakpoint 5, test_task_debug () at test_task_debug.adb:15
  11691. 15 flush;
  11692. (gdb) info tasks
  11693. ID TID P-ID Pri State Name
  11694. 1 140022020 0 15 Child Activation Wait main_task
  11695. * 2 140045060 1 15 Runnable t2
  11696. 3 140044840 1 15 Runnable t1
  11697. 4 140056040 1 15 Delay Sleep t3
  11698. 
  11699. File: gdb.info, Node: Ada Tasks and Core Files, Next: Ravenscar Profile, Prev: Ada Tasks, Up: Ada
  11700. 15.4.10.8 Tasking Support when Debugging Core Files
  11701. ...................................................
  11702. When inspecting a core file, as opposed to debugging a live program,
  11703. tasking support may be limited or even unavailable, depending on the
  11704. platform being used. For instance, on x86-linux, the list of tasks is
  11705. available, but task switching is not supported.
  11706. On certain platforms, the debugger needs to perform some memory
  11707. writes in order to provide Ada tasking support. When inspecting a core
  11708. file, this means that the core file must be opened with read-write
  11709. privileges, using the command '"set write on"' (*note Patching::).
  11710. Under these circumstances, you should make a backup copy of the core
  11711. file before inspecting it with GDB.
  11712. 
  11713. File: gdb.info, Node: Ravenscar Profile, Next: Ada Settings, Prev: Ada Tasks and Core Files, Up: Ada
  11714. 15.4.10.9 Tasking Support when using the Ravenscar Profile
  11715. ..........................................................
  11716. The "Ravenscar Profile" is a subset of the Ada tasking features,
  11717. specifically designed for systems with safety-critical real-time
  11718. requirements.
  11719. 'set ravenscar task-switching on'
  11720. Allows task switching when debugging a program that uses the
  11721. Ravenscar Profile. This is the default.
  11722. 'set ravenscar task-switching off'
  11723. Turn off task switching when debugging a program that uses the
  11724. Ravenscar Profile. This is mostly intended to disable the code
  11725. that adds support for the Ravenscar Profile, in case a bug in
  11726. either GDB or in the Ravenscar runtime is preventing GDB from
  11727. working properly. To be effective, this command should be run
  11728. before the program is started.
  11729. 'show ravenscar task-switching'
  11730. Show whether it is possible to switch from task to task in a
  11731. program using the Ravenscar Profile.
  11732. 
  11733. File: gdb.info, Node: Ada Settings, Next: Ada Glitches, Prev: Ravenscar Profile, Up: Ada
  11734. 15.4.10.10 Ada Settings
  11735. .......................
  11736. 'set varsize-limit SIZE'
  11737. Prevent GDB from attempting to evaluate objects whose size is above
  11738. the given limit (SIZE) when those sizes are computed from run-time
  11739. quantities. This is typically the case when the object has a
  11740. variable size, such as an array whose bounds are not known at
  11741. compile time for example. Setting SIZE to 'unlimited' removes the
  11742. size limitation. By default, the limit is about 65KB.
  11743. The purpose of having such a limit is to prevent GDB from trying to
  11744. grab enormous chunks of virtual memory when asked to evaluate a
  11745. quantity whose bounds have been corrupted or have not yet been
  11746. fully initialized. The limit applies to the results of some
  11747. subexpressions as well as to complete expressions. For example, an
  11748. expression denoting a simple integer component, such as 'x.y.z',
  11749. may fail if the size of 'x.y' is variable and exceeds 'size'. On
  11750. the other hand, GDB is sometimes clever; the expression 'A(i)',
  11751. where 'A' is an array variable with non-constant size, will
  11752. generally succeed regardless of the bounds on 'A', as long as the
  11753. component size is less than SIZE.
  11754. 'show varsize-limit'
  11755. Show the limit on types whose size is determined by run-time
  11756. quantities.
  11757. 
  11758. File: gdb.info, Node: Ada Glitches, Prev: Ada Settings, Up: Ada
  11759. 15.4.10.11 Known Peculiarities of Ada Mode
  11760. ..........................................
  11761. Besides the omissions listed previously (*note Omissions from Ada::), we
  11762. know of several problems with and limitations of Ada mode in GDB, some
  11763. of which will be fixed with planned future releases of the debugger and
  11764. the GNU Ada compiler.
  11765. * Static constants that the compiler chooses not to materialize as
  11766. objects in storage are invisible to the debugger.
  11767. * Named parameter associations in function argument lists are ignored
  11768. (the argument lists are treated as positional).
  11769. * Many useful library packages are currently invisible to the
  11770. debugger.
  11771. * Fixed-point arithmetic, conversions, input, and output is carried
  11772. out using floating-point arithmetic, and may give results that only
  11773. approximate those on the host machine.
  11774. * The GNAT compiler never generates the prefix 'Standard' for any of
  11775. the standard symbols defined by the Ada language. GDB knows about
  11776. this: it will strip the prefix from names when you use it, and will
  11777. never look for a name you have so qualified among local symbols,
  11778. nor match against symbols in other packages or subprograms. If you
  11779. have defined entities anywhere in your program other than
  11780. parameters and local variables whose simple names match names in
  11781. 'Standard', GNAT's lack of qualification here can cause confusion.
  11782. When this happens, you can usually resolve the confusion by
  11783. qualifying the problematic names with package 'Standard'
  11784. explicitly.
  11785. Older versions of the compiler sometimes generate erroneous debugging
  11786. information, resulting in the debugger incorrectly printing the value of
  11787. affected entities. In some cases, the debugger is able to work around
  11788. an issue automatically. In other cases, the debugger is able to work
  11789. around the issue, but the work-around has to be specifically enabled.
  11790. 'set ada trust-PAD-over-XVS on'
  11791. Configure GDB to strictly follow the GNAT encoding when computing
  11792. the value of Ada entities, particularly when 'PAD' and 'PAD___XVS'
  11793. types are involved (see 'ada/exp_dbug.ads' in the GCC sources for a
  11794. complete description of the encoding used by the GNAT compiler).
  11795. This is the default.
  11796. 'set ada trust-PAD-over-XVS off'
  11797. This is related to the encoding using by the GNAT compiler. If GDB
  11798. sometimes prints the wrong value for certain entities, changing
  11799. 'ada trust-PAD-over-XVS' to 'off' activates a work-around which may
  11800. fix the issue. It is always safe to set 'ada trust-PAD-over-XVS'
  11801. to 'off', but this incurs a slight performance penalty, so it is
  11802. recommended to leave this setting to 'on' unless necessary.
  11803. Internally, the debugger also relies on the compiler following a
  11804. number of conventions known as the 'GNAT Encoding', all documented in
  11805. 'gcc/ada/exp_dbug.ads' in the GCC sources. This encoding describes how
  11806. the debugging information should be generated for certain types. In
  11807. particular, this convention makes use of "descriptive types", which are
  11808. artificial types generated purely to help the debugger.
  11809. These encodings were defined at a time when the debugging information
  11810. format used was not powerful enough to describe some of the more complex
  11811. types available in Ada. Since DWARF allows us to express nearly all Ada
  11812. features, the long-term goal is to slowly replace these descriptive
  11813. types by their pure DWARF equivalent. To facilitate that transition, a
  11814. new maintenance option is available to force the debugger to ignore
  11815. those descriptive types. It allows the user to quickly evaluate how
  11816. well GDB works without them.
  11817. 'maintenance ada set ignore-descriptive-types [on|off]'
  11818. Control whether the debugger should ignore descriptive types. The
  11819. default is not to ignore descriptives types ('off').
  11820. 'maintenance ada show ignore-descriptive-types'
  11821. Show if descriptive types are ignored by GDB.
  11822. 
  11823. File: gdb.info, Node: Unsupported Languages, Prev: Supported Languages, Up: Languages
  11824. 15.5 Unsupported Languages
  11825. ==========================
  11826. In addition to the other fully-supported programming languages, GDB also
  11827. provides a pseudo-language, called 'minimal'. It does not represent a
  11828. real programming language, but provides a set of capabilities close to
  11829. what the C or assembly languages provide. This should allow most simple
  11830. operations to be performed while debugging an application that uses a
  11831. language currently not supported by GDB.
  11832. If the language is set to 'auto', GDB will automatically select this
  11833. language if the current frame corresponds to an unsupported language.
  11834. 
  11835. File: gdb.info, Node: Symbols, Next: Altering, Prev: Languages, Up: Top
  11836. 16 Examining the Symbol Table
  11837. *****************************
  11838. The commands described in this chapter allow you to inquire about the
  11839. symbols (names of variables, functions and types) defined in your
  11840. program. This information is inherent in the text of your program and
  11841. does not change as your program executes. GDB finds it in your
  11842. program's symbol table, in the file indicated when you started GDB
  11843. (*note Choosing Files: File Options.), or by one of the file-management
  11844. commands (*note Commands to Specify Files: Files.).
  11845. Occasionally, you may need to refer to symbols that contain unusual
  11846. characters, which GDB ordinarily treats as word delimiters. The most
  11847. frequent case is in referring to static variables in other source files
  11848. (*note Program Variables: Variables.). File names are recorded in
  11849. object files as debugging symbols, but GDB would ordinarily parse a
  11850. typical file name, like 'foo.c', as the three words 'foo' '.' 'c'. To
  11851. allow GDB to recognize 'foo.c' as a single symbol, enclose it in single
  11852. quotes; for example,
  11853. p 'foo.c'::x
  11854. looks up the value of 'x' in the scope of the file 'foo.c'.
  11855. 'set case-sensitive on'
  11856. 'set case-sensitive off'
  11857. 'set case-sensitive auto'
  11858. Normally, when GDB looks up symbols, it matches their names with
  11859. case sensitivity determined by the current source language.
  11860. Occasionally, you may wish to control that. The command 'set
  11861. case-sensitive' lets you do that by specifying 'on' for
  11862. case-sensitive matches or 'off' for case-insensitive ones. If you
  11863. specify 'auto', case sensitivity is reset to the default suitable
  11864. for the source language. The default is case-sensitive matches for
  11865. all languages except for Fortran, for which the default is
  11866. case-insensitive matches.
  11867. 'show case-sensitive'
  11868. This command shows the current setting of case sensitivity for
  11869. symbols lookups.
  11870. 'set print type methods'
  11871. 'set print type methods on'
  11872. 'set print type methods off'
  11873. Normally, when GDB prints a class, it displays any methods declared
  11874. in that class. You can control this behavior either by passing the
  11875. appropriate flag to 'ptype', or using 'set print type methods'.
  11876. Specifying 'on' will cause GDB to display the methods; this is the
  11877. default. Specifying 'off' will cause GDB to omit the methods.
  11878. 'show print type methods'
  11879. This command shows the current setting of method display when
  11880. printing classes.
  11881. 'set print type nested-type-limit LIMIT'
  11882. 'set print type nested-type-limit unlimited'
  11883. Set the limit of displayed nested types that the type printer will
  11884. show. A LIMIT of 'unlimited' or '-1' will show all nested
  11885. definitions. By default, the type printer will not show any nested
  11886. types defined in classes.
  11887. 'show print type nested-type-limit'
  11888. This command shows the current display limit of nested types when
  11889. printing classes.
  11890. 'set print type typedefs'
  11891. 'set print type typedefs on'
  11892. 'set print type typedefs off'
  11893. Normally, when GDB prints a class, it displays any typedefs defined
  11894. in that class. You can control this behavior either by passing the
  11895. appropriate flag to 'ptype', or using 'set print type typedefs'.
  11896. Specifying 'on' will cause GDB to display the typedef definitions;
  11897. this is the default. Specifying 'off' will cause GDB to omit the
  11898. typedef definitions. Note that this controls whether the typedef
  11899. definition itself is printed, not whether typedef names are
  11900. substituted when printing other types.
  11901. 'show print type typedefs'
  11902. This command shows the current setting of typedef display when
  11903. printing classes.
  11904. 'info address SYMBOL'
  11905. Describe where the data for SYMBOL is stored. For a register
  11906. variable, this says which register it is kept in. For a
  11907. non-register local variable, this prints the stack-frame offset at
  11908. which the variable is always stored.
  11909. Note the contrast with 'print &SYMBOL', which does not work at all
  11910. for a register variable, and for a stack local variable prints the
  11911. exact address of the current instantiation of the variable.
  11912. 'info symbol ADDR'
  11913. Print the name of a symbol which is stored at the address ADDR. If
  11914. no symbol is stored exactly at ADDR, GDB prints the nearest symbol
  11915. and an offset from it:
  11916. (gdb) info symbol 0x54320
  11917. _initialize_vx + 396 in section .text
  11918. This is the opposite of the 'info address' command. You can use it
  11919. to find out the name of a variable or a function given its address.
  11920. For dynamically linked executables, the name of executable or
  11921. shared library containing the symbol is also printed:
  11922. (gdb) info symbol 0x400225
  11923. _start + 5 in section .text of /tmp/a.out
  11924. (gdb) info symbol 0x2aaaac2811cf
  11925. __read_nocancel + 6 in section .text of /usr/lib64/libc.so.6
  11926. 'demangle [-l LANGUAGE] [--] NAME'
  11927. Demangle NAME. If LANGUAGE is provided it is the name of the
  11928. language to demangle NAME in. Otherwise NAME is demangled in the
  11929. current language.
  11930. The '--' option specifies the end of options, and is useful when
  11931. NAME begins with a dash.
  11932. The parameter 'demangle-style' specifies how to interpret the kind
  11933. of mangling used. *Note Print Settings::.
  11934. 'whatis[/FLAGS] [ARG]'
  11935. Print the data type of ARG, which can be either an expression or a
  11936. name of a data type. With no argument, print the data type of '$',
  11937. the last value in the value history.
  11938. If ARG is an expression (*note Expressions: Expressions.), it is
  11939. not actually evaluated, and any side-effecting operations (such as
  11940. assignments or function calls) inside it do not take place.
  11941. If ARG is a variable or an expression, 'whatis' prints its literal
  11942. type as it is used in the source code. If the type was defined
  11943. using a 'typedef', 'whatis' will _not_ print the data type
  11944. underlying the 'typedef'. If the type of the variable or the
  11945. expression is a compound data type, such as 'struct' or 'class',
  11946. 'whatis' never prints their fields or methods. It just prints the
  11947. 'struct'/'class' name (a.k.a. its "tag"). If you want to see the
  11948. members of such a compound data type, use 'ptype'.
  11949. If ARG is a type name that was defined using 'typedef', 'whatis'
  11950. "unrolls" only one level of that 'typedef'. Unrolling means that
  11951. 'whatis' will show the underlying type used in the 'typedef'
  11952. declaration of ARG. However, if that underlying type is also a
  11953. 'typedef', 'whatis' will not unroll it.
  11954. For C code, the type names may also have the form 'class
  11955. CLASS-NAME', 'struct STRUCT-TAG', 'union UNION-TAG' or 'enum
  11956. ENUM-TAG'.
  11957. FLAGS can be used to modify how the type is displayed. Available
  11958. flags are:
  11959. 'r'
  11960. Display in "raw" form. Normally, GDB substitutes template
  11961. parameters and typedefs defined in a class when printing the
  11962. class' members. The '/r' flag disables this.
  11963. 'm'
  11964. Do not print methods defined in the class.
  11965. 'M'
  11966. Print methods defined in the class. This is the default, but
  11967. the flag exists in case you change the default with 'set print
  11968. type methods'.
  11969. 't'
  11970. Do not print typedefs defined in the class. Note that this
  11971. controls whether the typedef definition itself is printed, not
  11972. whether typedef names are substituted when printing other
  11973. types.
  11974. 'T'
  11975. Print typedefs defined in the class. This is the default, but
  11976. the flag exists in case you change the default with 'set print
  11977. type typedefs'.
  11978. 'o'
  11979. Print the offsets and sizes of fields in a struct, similar to
  11980. what the 'pahole' tool does. This option implies the '/tm'
  11981. flags.
  11982. For example, given the following declarations:
  11983. struct tuv
  11984. {
  11985. int a1;
  11986. char *a2;
  11987. int a3;
  11988. };
  11989. struct xyz
  11990. {
  11991. int f1;
  11992. char f2;
  11993. void *f3;
  11994. struct tuv f4;
  11995. };
  11996. union qwe
  11997. {
  11998. struct tuv fff1;
  11999. struct xyz fff2;
  12000. };
  12001. struct tyu
  12002. {
  12003. int a1 : 1;
  12004. int a2 : 3;
  12005. int a3 : 23;
  12006. char a4 : 2;
  12007. int64_t a5;
  12008. int a6 : 5;
  12009. int64_t a7 : 3;
  12010. };
  12011. Issuing a 'ptype /o struct tuv' command would print:
  12012. (gdb) ptype /o struct tuv
  12013. /* offset | size */ type = struct tuv {
  12014. /* 0 | 4 */ int a1;
  12015. /* XXX 4-byte hole */
  12016. /* 8 | 8 */ char *a2;
  12017. /* 16 | 4 */ int a3;
  12018. /* total size (bytes): 24 */
  12019. }
  12020. Notice the format of the first column of comments. There, you
  12021. can find two parts separated by the '|' character: the
  12022. _offset_, which indicates where the field is located inside
  12023. the struct, in bytes, and the _size_ of the field. Another
  12024. interesting line is the marker of a _hole_ in the struct,
  12025. indicating that it may be possible to pack the struct and make
  12026. it use less space by reorganizing its fields.
  12027. It is also possible to print offsets inside an union:
  12028. (gdb) ptype /o union qwe
  12029. /* offset | size */ type = union qwe {
  12030. /* 24 */ struct tuv {
  12031. /* 0 | 4 */ int a1;
  12032. /* XXX 4-byte hole */
  12033. /* 8 | 8 */ char *a2;
  12034. /* 16 | 4 */ int a3;
  12035. /* total size (bytes): 24 */
  12036. } fff1;
  12037. /* 40 */ struct xyz {
  12038. /* 0 | 4 */ int f1;
  12039. /* 4 | 1 */ char f2;
  12040. /* XXX 3-byte hole */
  12041. /* 8 | 8 */ void *f3;
  12042. /* 16 | 24 */ struct tuv {
  12043. /* 16 | 4 */ int a1;
  12044. /* XXX 4-byte hole */
  12045. /* 24 | 8 */ char *a2;
  12046. /* 32 | 4 */ int a3;
  12047. /* total size (bytes): 24 */
  12048. } f4;
  12049. /* total size (bytes): 40 */
  12050. } fff2;
  12051. /* total size (bytes): 40 */
  12052. }
  12053. In this case, since 'struct tuv' and 'struct xyz' occupy the
  12054. same space (because we are dealing with an union), the offset
  12055. is not printed for them. However, you can still examine the
  12056. offset of each of these structures' fields.
  12057. Another useful scenario is printing the offsets of a struct
  12058. containing bitfields:
  12059. (gdb) ptype /o struct tyu
  12060. /* offset | size */ type = struct tyu {
  12061. /* 0:31 | 4 */ int a1 : 1;
  12062. /* 0:28 | 4 */ int a2 : 3;
  12063. /* 0: 5 | 4 */ int a3 : 23;
  12064. /* 3: 3 | 1 */ signed char a4 : 2;
  12065. /* XXX 3-bit hole */
  12066. /* XXX 4-byte hole */
  12067. /* 8 | 8 */ int64_t a5;
  12068. /* 16:27 | 4 */ int a6 : 5;
  12069. /* 16:56 | 8 */ int64_t a7 : 3;
  12070. /* total size (bytes): 24 */
  12071. }
  12072. Note how the offset information is now extended to also
  12073. include how many bits are left to be used in each bitfield.
  12074. 'ptype[/FLAGS] [ARG]'
  12075. 'ptype' accepts the same arguments as 'whatis', but prints a
  12076. detailed description of the type, instead of just the name of the
  12077. type. *Note Expressions: Expressions.
  12078. Contrary to 'whatis', 'ptype' always unrolls any 'typedef's in its
  12079. argument declaration, whether the argument is a variable,
  12080. expression, or a data type. This means that 'ptype' of a variable
  12081. or an expression will not print literally its type as present in
  12082. the source code--use 'whatis' for that. 'typedef's at the pointer
  12083. or reference targets are also unrolled. Only 'typedef's of fields,
  12084. methods and inner 'class typedef's of 'struct's, 'class'es and
  12085. 'union's are not unrolled even with 'ptype'.
  12086. For example, for this variable declaration:
  12087. typedef double real_t;
  12088. struct complex { real_t real; double imag; };
  12089. typedef struct complex complex_t;
  12090. complex_t var;
  12091. real_t *real_pointer_var;
  12092. the two commands give this output:
  12093. (gdb) whatis var
  12094. type = complex_t
  12095. (gdb) ptype var
  12096. type = struct complex {
  12097. real_t real;
  12098. double imag;
  12099. }
  12100. (gdb) whatis complex_t
  12101. type = struct complex
  12102. (gdb) whatis struct complex
  12103. type = struct complex
  12104. (gdb) ptype struct complex
  12105. type = struct complex {
  12106. real_t real;
  12107. double imag;
  12108. }
  12109. (gdb) whatis real_pointer_var
  12110. type = real_t *
  12111. (gdb) ptype real_pointer_var
  12112. type = double *
  12113. As with 'whatis', using 'ptype' without an argument refers to the
  12114. type of '$', the last value in the value history.
  12115. Sometimes, programs use opaque data types or incomplete
  12116. specifications of complex data structure. If the debug information
  12117. included in the program does not allow GDB to display a full
  12118. declaration of the data type, it will say '<incomplete type>'. For
  12119. example, given these declarations:
  12120. struct foo;
  12121. struct foo *fooptr;
  12122. but no definition for 'struct foo' itself, GDB will say:
  12123. (gdb) ptype foo
  12124. $1 = <incomplete type>
  12125. "Incomplete type" is C terminology for data types that are not
  12126. completely specified.
  12127. Othertimes, information about a variable's type is completely
  12128. absent from the debug information included in the program. This
  12129. most often happens when the program or library where the variable
  12130. is defined includes no debug information at all. GDB knows the
  12131. variable exists from inspecting the linker/loader symbol table
  12132. (e.g., the ELF dynamic symbol table), but such symbols do not
  12133. contain type information. Inspecting the type of a (global)
  12134. variable for which GDB has no type information shows:
  12135. (gdb) ptype var
  12136. type = <data variable, no debug info>
  12137. *Note no debug info variables: Variables, for how to print the
  12138. values of such variables.
  12139. 'info types REGEXP'
  12140. 'info types'
  12141. Print a brief description of all types whose names match the
  12142. regular expression REGEXP (or all types in your program, if you
  12143. supply no argument). Each complete typename is matched as though
  12144. it were a complete line; thus, 'i type value' gives information on
  12145. all types in your program whose names include the string 'value',
  12146. but 'i type ^value$' gives information only on types whose complete
  12147. name is 'value'.
  12148. In programs using different languages, GDB chooses the syntax to
  12149. print the type description according to the 'set language' value:
  12150. using 'set language auto' (see *note Set Language Automatically:
  12151. Automatically.) means to use the language of the type, other values
  12152. mean to use the manually specified language (see *note Set Language
  12153. Manually: Manually.).
  12154. This command differs from 'ptype' in two ways: first, like
  12155. 'whatis', it does not print a detailed description; second, it
  12156. lists all source files and line numbers where a type is defined.
  12157. 'info type-printers'
  12158. Versions of GDB that ship with Python scripting enabled may have
  12159. "type printers" available. When using 'ptype' or 'whatis', these
  12160. printers are consulted when the name of a type is needed. *Note
  12161. Type Printing API::, for more information on writing type printers.
  12162. 'info type-printers' displays all the available type printers.
  12163. 'enable type-printer NAME...'
  12164. 'disable type-printer NAME...'
  12165. These commands can be used to enable or disable type printers.
  12166. 'info scope LOCATION'
  12167. List all the variables local to a particular scope. This command
  12168. accepts a LOCATION argument--a function name, a source line, or an
  12169. address preceded by a '*', and prints all the variables local to
  12170. the scope defined by that location. (*Note Specify Location::, for
  12171. details about supported forms of LOCATION.) For example:
  12172. (gdb) info scope command_line_handler
  12173. Scope for command_line_handler:
  12174. Symbol rl is an argument at stack/frame offset 8, length 4.
  12175. Symbol linebuffer is in static storage at address 0x150a18, length 4.
  12176. Symbol linelength is in static storage at address 0x150a1c, length 4.
  12177. Symbol p is a local variable in register $esi, length 4.
  12178. Symbol p1 is a local variable in register $ebx, length 4.
  12179. Symbol nline is a local variable in register $edx, length 4.
  12180. Symbol repeat is a local variable at frame offset -8, length 4.
  12181. This command is especially useful for determining what data to
  12182. collect during a "trace experiment", see *note collect: Tracepoint
  12183. Actions.
  12184. 'info source'
  12185. Show information about the current source file--that is, the source
  12186. file for the function containing the current point of execution:
  12187. * the name of the source file, and the directory containing it,
  12188. * the directory it was compiled in,
  12189. * its length, in lines,
  12190. * which programming language it is written in,
  12191. * if the debug information provides it, the program that
  12192. compiled the file (which may include, e.g., the compiler
  12193. version and command line arguments),
  12194. * whether the executable includes debugging information for that
  12195. file, and if so, what format the information is in (e.g.,
  12196. STABS, Dwarf 2, etc.), and
  12197. * whether the debugging information includes information about
  12198. preprocessor macros.
  12199. 'info sources'
  12200. Print the names of all source files in your program for which there
  12201. is debugging information, organized into two lists: files whose
  12202. symbols have already been read, and files whose symbols will be
  12203. read when needed.
  12204. 'info functions [-q]'
  12205. Print the names and data types of all defined functions. Similarly
  12206. to 'info types', this command groups its output by source files and
  12207. annotates each function definition with its source line number.
  12208. In programs using different languages, GDB chooses the syntax to
  12209. print the function name and type according to the 'set language'
  12210. value: using 'set language auto' (see *note Set Language
  12211. Automatically: Automatically.) means to use the language of the
  12212. function, other values mean to use the manually specified language
  12213. (see *note Set Language Manually: Manually.).
  12214. The optional flag '-q', which stands for 'quiet', disables printing
  12215. header information and messages explaining why no functions have
  12216. been printed.
  12217. 'info functions [-q] [-t TYPE_REGEXP] [REGEXP]'
  12218. Like 'info functions', but only print the names and data types of
  12219. the functions selected with the provided regexp(s).
  12220. If REGEXP is provided, print only the functions whose names match
  12221. the regular expression REGEXP. Thus, 'info fun step' finds all
  12222. functions whose names include 'step'; 'info fun ^step' finds those
  12223. whose names start with 'step'. If a function name contains
  12224. characters that conflict with the regular expression language (e.g.
  12225. 'operator*()'), they may be quoted with a backslash.
  12226. If TYPE_REGEXP is provided, print only the functions whose types,
  12227. as printed by the 'whatis' command, match the regular expression
  12228. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  12229. enclosed in quote characters. If needed, use backslash to escape
  12230. the meaning of special characters or quotes. Thus, 'info fun -t
  12231. '^int ('' finds the functions that return an integer; 'info fun -t
  12232. '(.*int.*'' finds the functions that have an argument type
  12233. containing int; 'info fun -t '^int (' ^step' finds the functions
  12234. whose names start with 'step' and that return int.
  12235. If both REGEXP and TYPE_REGEXP are provided, a function is printed
  12236. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  12237. 'info variables [-q]'
  12238. Print the names and data types of all variables that are defined
  12239. outside of functions (i.e. excluding local variables). The printed
  12240. variables are grouped by source files and annotated with their
  12241. respective source line numbers.
  12242. In programs using different languages, GDB chooses the syntax to
  12243. print the variable name and type according to the 'set language'
  12244. value: using 'set language auto' (see *note Set Language
  12245. Automatically: Automatically.) means to use the language of the
  12246. variable, other values mean to use the manually specified language
  12247. (see *note Set Language Manually: Manually.).
  12248. The optional flag '-q', which stands for 'quiet', disables printing
  12249. header information and messages explaining why no variables have
  12250. been printed.
  12251. 'info variables [-q] [-t TYPE_REGEXP] [REGEXP]'
  12252. Like 'info variables', but only print the variables selected with
  12253. the provided regexp(s).
  12254. If REGEXP is provided, print only the variables whose names match
  12255. the regular expression REGEXP.
  12256. If TYPE_REGEXP is provided, print only the variables whose types,
  12257. as printed by the 'whatis' command, match the regular expression
  12258. TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
  12259. enclosed in quote characters. If needed, use backslash to escape
  12260. the meaning of special characters or quotes.
  12261. If both REGEXP and TYPE_REGEXP are provided, an argument is printed
  12262. only if its name matches REGEXP and its type matches TYPE_REGEXP.
  12263. 'info classes'
  12264. 'info classes REGEXP'
  12265. Display all Objective-C classes in your program, or (with the
  12266. REGEXP argument) all those matching a particular regular
  12267. expression.
  12268. 'info selectors'
  12269. 'info selectors REGEXP'
  12270. Display all Objective-C selectors in your program, or (with the
  12271. REGEXP argument) all those matching a particular regular
  12272. expression.
  12273. 'set opaque-type-resolution on'
  12274. Tell GDB to resolve opaque types. An opaque type is a type
  12275. declared as a pointer to a 'struct', 'class', or 'union'--for
  12276. example, 'struct MyType *'--that is used in one source file
  12277. although the full declaration of 'struct MyType' is in another
  12278. source file. The default is on.
  12279. A change in the setting of this subcommand will not take effect
  12280. until the next time symbols for a file are loaded.
  12281. 'set opaque-type-resolution off'
  12282. Tell GDB not to resolve opaque types. In this case, the type is
  12283. printed as follows:
  12284. {<no data fields>}
  12285. 'show opaque-type-resolution'
  12286. Show whether opaque types are resolved or not.
  12287. 'set print symbol-loading'
  12288. 'set print symbol-loading full'
  12289. 'set print symbol-loading brief'
  12290. 'set print symbol-loading off'
  12291. The 'set print symbol-loading' command allows you to control the
  12292. printing of messages when GDB loads symbol information. By default
  12293. a message is printed for the executable and one for each shared
  12294. library, and normally this is what you want. However, when
  12295. debugging apps with large numbers of shared libraries these
  12296. messages can be annoying. When set to 'brief' a message is printed
  12297. for each executable, and when GDB loads a collection of shared
  12298. libraries at once it will only print one message regardless of the
  12299. number of shared libraries. When set to 'off' no messages are
  12300. printed.
  12301. 'show print symbol-loading'
  12302. Show whether messages will be printed when a GDB command entered
  12303. from the keyboard causes symbol information to be loaded.
  12304. 'maint print symbols [-pc ADDRESS] [FILENAME]'
  12305. 'maint print symbols [-objfile OBJFILE] [-source SOURCE] [--] [FILENAME]'
  12306. 'maint print psymbols [-objfile OBJFILE] [-pc ADDRESS] [--] [FILENAME]'
  12307. 'maint print psymbols [-objfile OBJFILE] [-source SOURCE] [--] [FILENAME]'
  12308. 'maint print msymbols [-objfile OBJFILE] [--] [FILENAME]'
  12309. Write a dump of debugging symbol data into the file FILENAME or the
  12310. terminal if FILENAME is unspecified. If '-objfile OBJFILE' is
  12311. specified, only dump symbols for that objfile. If '-pc ADDRESS' is
  12312. specified, only dump symbols for the file with code at that
  12313. address. Note that ADDRESS may be a symbol like 'main'. If
  12314. '-source SOURCE' is specified, only dump symbols for that source
  12315. file.
  12316. These commands are used to debug the GDB symbol-reading code.
  12317. These commands do not modify internal GDB state, therefore 'maint
  12318. print symbols' will only print symbols for already expanded symbol
  12319. tables. You can use the command 'info sources' to find out which
  12320. files these are. If you use 'maint print psymbols' instead, the
  12321. dump shows information about symbols that GDB only knows
  12322. partially--that is, symbols defined in files that GDB has skimmed,
  12323. but not yet read completely. Finally, 'maint print msymbols' just
  12324. dumps "minimal symbols", e.g., "ELF symbols".
  12325. *Note Commands to Specify Files: Files, for a discussion of how GDB
  12326. reads symbols (in the description of 'symbol-file').
  12327. 'maint info symtabs [ REGEXP ]'
  12328. 'maint info psymtabs [ REGEXP ]'
  12329. List the 'struct symtab' or 'struct partial_symtab' structures
  12330. whose names match REGEXP. If REGEXP is not given, list them all.
  12331. The output includes expressions which you can copy into a GDB
  12332. debugging this one to examine a particular structure in more
  12333. detail. For example:
  12334. (gdb) maint info psymtabs dwarf2read
  12335. { objfile /home/gnu/build/gdb/gdb
  12336. ((struct objfile *) 0x82e69d0)
  12337. { psymtab /home/gnu/src/gdb/dwarf2read.c
  12338. ((struct partial_symtab *) 0x8474b10)
  12339. readin no
  12340. fullname (null)
  12341. text addresses 0x814d3c8 -- 0x8158074
  12342. globals (* (struct partial_symbol **) 0x8507a08 @ 9)
  12343. statics (* (struct partial_symbol **) 0x40e95b78 @ 2882)
  12344. dependencies (none)
  12345. }
  12346. }
  12347. (gdb) maint info symtabs
  12348. (gdb)
  12349. We see that there is one partial symbol table whose filename
  12350. contains the string 'dwarf2read', belonging to the 'gdb'
  12351. executable; and we see that GDB has not read in any symtabs yet at
  12352. all. If we set a breakpoint on a function, that will cause GDB to
  12353. read the symtab for the compilation unit containing that function:
  12354. (gdb) break dwarf2_psymtab_to_symtab
  12355. Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c,
  12356. line 1574.
  12357. (gdb) maint info symtabs
  12358. { objfile /home/gnu/build/gdb/gdb
  12359. ((struct objfile *) 0x82e69d0)
  12360. { symtab /home/gnu/src/gdb/dwarf2read.c
  12361. ((struct symtab *) 0x86c1f38)
  12362. dirname (null)
  12363. fullname (null)
  12364. blockvector ((struct blockvector *) 0x86c1bd0) (primary)
  12365. linetable ((struct linetable *) 0x8370fa0)
  12366. debugformat DWARF 2
  12367. }
  12368. }
  12369. (gdb)
  12370. 'maint info line-table [ REGEXP ]'
  12371. List the 'struct linetable' from all 'struct symtab' instances
  12372. whose name matches REGEXP. If REGEXP is not given, list the
  12373. 'struct linetable' from all 'struct symtab'.
  12374. 'maint set symbol-cache-size SIZE'
  12375. Set the size of the symbol cache to SIZE. The default size is
  12376. intended to be good enough for debugging most applications. This
  12377. option exists to allow for experimenting with different sizes.
  12378. 'maint show symbol-cache-size'
  12379. Show the size of the symbol cache.
  12380. 'maint print symbol-cache'
  12381. Print the contents of the symbol cache. This is useful when
  12382. debugging symbol cache issues.
  12383. 'maint print symbol-cache-statistics'
  12384. Print symbol cache usage statistics. This helps determine how well
  12385. the cache is being utilized.
  12386. 'maint flush-symbol-cache'
  12387. Flush the contents of the symbol cache, all entries are removed.
  12388. This command is useful when debugging the symbol cache. It is also
  12389. useful when collecting performance data.
  12390. 
  12391. File: gdb.info, Node: Altering, Next: GDB Files, Prev: Symbols, Up: Top
  12392. 17 Altering Execution
  12393. *********************
  12394. Once you think you have found an error in your program, you might want
  12395. to find out for certain whether correcting the apparent error would lead
  12396. to correct results in the rest of the run. You can find the answer by
  12397. experiment, using the GDB features for altering execution of the
  12398. program.
  12399. For example, you can store new values into variables or memory
  12400. locations, give your program a signal, restart it at a different
  12401. address, or even return prematurely from a function.
  12402. * Menu:
  12403. * Assignment:: Assignment to variables
  12404. * Jumping:: Continuing at a different address
  12405. * Signaling:: Giving your program a signal
  12406. * Returning:: Returning from a function
  12407. * Calling:: Calling your program's functions
  12408. * Patching:: Patching your program
  12409. * Compiling and Injecting Code:: Compiling and injecting code in GDB
  12410. 
  12411. File: gdb.info, Node: Assignment, Next: Jumping, Up: Altering
  12412. 17.1 Assignment to Variables
  12413. ============================
  12414. To alter the value of a variable, evaluate an assignment expression.
  12415. *Note Expressions: Expressions. For example,
  12416. print x=4
  12417. stores the value 4 into the variable 'x', and then prints the value of
  12418. the assignment expression (which is 4). *Note Using GDB with Different
  12419. Languages: Languages, for more information on operators in supported
  12420. languages.
  12421. If you are not interested in seeing the value of the assignment, use
  12422. the 'set' command instead of the 'print' command. 'set' is really the
  12423. same as 'print' except that the expression's value is not printed and is
  12424. not put in the value history (*note Value History: Value History.). The
  12425. expression is evaluated only for its effects.
  12426. If the beginning of the argument string of the 'set' command appears
  12427. identical to a 'set' subcommand, use the 'set variable' command instead
  12428. of just 'set'. This command is identical to 'set' except for its lack
  12429. of subcommands. For example, if your program has a variable 'width',
  12430. you get an error if you try to set a new value with just 'set width=13',
  12431. because GDB has the command 'set width':
  12432. (gdb) whatis width
  12433. type = double
  12434. (gdb) p width
  12435. $4 = 13
  12436. (gdb) set width=47
  12437. Invalid syntax in expression.
  12438. The invalid expression, of course, is '=47'. In order to actually set
  12439. the program's variable 'width', use
  12440. (gdb) set var width=47
  12441. Because the 'set' command has many subcommands that can conflict with
  12442. the names of program variables, it is a good idea to use the 'set
  12443. variable' command instead of just 'set'. For example, if your program
  12444. has a variable 'g', you run into problems if you try to set a new value
  12445. with just 'set g=4', because GDB has the command 'set gnutarget',
  12446. abbreviated 'set g':
  12447. (gdb) whatis g
  12448. type = double
  12449. (gdb) p g
  12450. $1 = 1
  12451. (gdb) set g=4
  12452. (gdb) p g
  12453. $2 = 1
  12454. (gdb) r
  12455. The program being debugged has been started already.
  12456. Start it from the beginning? (y or n) y
  12457. Starting program: /home/smith/cc_progs/a.out
  12458. "/home/smith/cc_progs/a.out": can't open to read symbols:
  12459. Invalid bfd target.
  12460. (gdb) show g
  12461. The current BFD target is "=4".
  12462. The program variable 'g' did not change, and you silently set the
  12463. 'gnutarget' to an invalid value. In order to set the variable 'g', use
  12464. (gdb) set var g=4
  12465. GDB allows more implicit conversions in assignments than C; you can
  12466. freely store an integer value into a pointer variable or vice versa, and
  12467. you can convert any structure to any other structure that is the same
  12468. length or shorter.
  12469. To store values into arbitrary places in memory, use the '{...}'
  12470. construct to generate a value of specified type at a specified address
  12471. (*note Expressions: Expressions.). For example, '{int}0x83040' refers
  12472. to memory location '0x83040' as an integer (which implies a certain size
  12473. and representation in memory), and
  12474. set {int}0x83040 = 4
  12475. stores the value 4 into that memory location.
  12476. 
  12477. File: gdb.info, Node: Jumping, Next: Signaling, Prev: Assignment, Up: Altering
  12478. 17.2 Continuing at a Different Address
  12479. ======================================
  12480. Ordinarily, when you continue your program, you do so at the place where
  12481. it stopped, with the 'continue' command. You can instead continue at an
  12482. address of your own choosing, with the following commands:
  12483. 'jump LOCATION'
  12484. 'j LOCATION'
  12485. Resume execution at LOCATION. Execution stops again immediately if
  12486. there is a breakpoint there. *Note Specify Location::, for a
  12487. description of the different forms of LOCATION. It is common
  12488. practice to use the 'tbreak' command in conjunction with 'jump'.
  12489. *Note Setting Breakpoints: Set Breaks.
  12490. The 'jump' command does not change the current stack frame, or the
  12491. stack pointer, or the contents of any memory location or any
  12492. register other than the program counter. If LOCATION is in a
  12493. different function from the one currently executing, the results
  12494. may be bizarre if the two functions expect different patterns of
  12495. arguments or of local variables. For this reason, the 'jump'
  12496. command requests confirmation if the specified line is not in the
  12497. function currently executing. However, even bizarre results are
  12498. predictable if you are well acquainted with the machine-language
  12499. code of your program.
  12500. On many systems, you can get much the same effect as the 'jump'
  12501. command by storing a new value into the register '$pc'. The difference
  12502. is that this does not start your program running; it only changes the
  12503. address of where it _will_ run when you continue. For example,
  12504. set $pc = 0x485
  12505. makes the next 'continue' command or stepping command execute at address
  12506. '0x485', rather than at the address where your program stopped. *Note
  12507. Continuing and Stepping: Continuing and Stepping.
  12508. The most common occasion to use the 'jump' command is to back
  12509. up--perhaps with more breakpoints set--over a portion of a program that
  12510. has already executed, in order to examine its execution in more detail.
  12511. 
  12512. File: gdb.info, Node: Signaling, Next: Returning, Prev: Jumping, Up: Altering
  12513. 17.3 Giving your Program a Signal
  12514. =================================
  12515. 'signal SIGNAL'
  12516. Resume execution where your program is stopped, but immediately
  12517. give it the signal SIGNAL. The SIGNAL can be the name or the
  12518. number of a signal. For example, on many systems 'signal 2' and
  12519. 'signal SIGINT' are both ways of sending an interrupt signal.
  12520. Alternatively, if SIGNAL is zero, continue execution without giving
  12521. a signal. This is useful when your program stopped on account of a
  12522. signal and would ordinarily see the signal when resumed with the
  12523. 'continue' command; 'signal 0' causes it to resume without a
  12524. signal.
  12525. _Note:_ When resuming a multi-threaded program, SIGNAL is delivered
  12526. to the currently selected thread, not the thread that last reported
  12527. a stop. This includes the situation where a thread was stopped due
  12528. to a signal. So if you want to continue execution suppressing the
  12529. signal that stopped a thread, you should select that same thread
  12530. before issuing the 'signal 0' command. If you issue the 'signal 0'
  12531. command with another thread as the selected one, GDB detects that
  12532. and asks for confirmation.
  12533. Invoking the 'signal' command is not the same as invoking the
  12534. 'kill' utility from the shell. Sending a signal with 'kill' causes
  12535. GDB to decide what to do with the signal depending on the signal
  12536. handling tables (*note Signals::). The 'signal' command passes the
  12537. signal directly to your program.
  12538. 'signal' does not repeat when you press <RET> a second time after
  12539. executing the command.
  12540. 'queue-signal SIGNAL'
  12541. Queue SIGNAL to be delivered immediately to the current thread when
  12542. execution of the thread resumes. The SIGNAL can be the name or the
  12543. number of a signal. For example, on many systems 'signal 2' and
  12544. 'signal SIGINT' are both ways of sending an interrupt signal. The
  12545. handling of the signal must be set to pass the signal to the
  12546. program, otherwise GDB will report an error. You can control the
  12547. handling of signals from GDB with the 'handle' command (*note
  12548. Signals::).
  12549. Alternatively, if SIGNAL is zero, any currently queued signal for
  12550. the current thread is discarded and when execution resumes no
  12551. signal will be delivered. This is useful when your program stopped
  12552. on account of a signal and would ordinarily see the signal when
  12553. resumed with the 'continue' command.
  12554. This command differs from the 'signal' command in that the signal
  12555. is just queued, execution is not resumed. And 'queue-signal'
  12556. cannot be used to pass a signal whose handling state has been set
  12557. to 'nopass' (*note Signals::).
  12558. *Note stepping into signal handlers::, for information on how
  12559. stepping commands behave when the thread has a signal queued.
  12560. 
  12561. File: gdb.info, Node: Returning, Next: Calling, Prev: Signaling, Up: Altering
  12562. 17.4 Returning from a Function
  12563. ==============================
  12564. 'return'
  12565. 'return EXPRESSION'
  12566. You can cancel execution of a function call with the 'return'
  12567. command. If you give an EXPRESSION argument, its value is used as
  12568. the function's return value.
  12569. When you use 'return', GDB discards the selected stack frame (and all
  12570. frames within it). You can think of this as making the discarded frame
  12571. return prematurely. If you wish to specify a value to be returned, give
  12572. that value as the argument to 'return'.
  12573. This pops the selected stack frame (*note Selecting a Frame:
  12574. Selection.), and any other frames inside of it, leaving its caller as
  12575. the innermost remaining frame. That frame becomes selected. The
  12576. specified value is stored in the registers used for returning values of
  12577. functions.
  12578. The 'return' command does not resume execution; it leaves the program
  12579. stopped in the state that would exist if the function had just returned.
  12580. In contrast, the 'finish' command (*note Continuing and Stepping:
  12581. Continuing and Stepping.) resumes execution until the selected stack
  12582. frame returns naturally.
  12583. GDB needs to know how the EXPRESSION argument should be set for the
  12584. inferior. The concrete registers assignment depends on the OS ABI and
  12585. the type being returned by the selected stack frame. For example it is
  12586. common for OS ABI to return floating point values in FPU registers while
  12587. integer values in CPU registers. Still some ABIs return even floating
  12588. point values in CPU registers. Larger integer widths (such as 'long
  12589. long int') also have specific placement rules. GDB already knows the OS
  12590. ABI from its current target so it needs to find out also the type being
  12591. returned to make the assignment into the right register(s).
  12592. Normally, the selected stack frame has debug info. GDB will always
  12593. use the debug info instead of the implicit type of EXPRESSION when the
  12594. debug info is available. For example, if you type 'return -1', and the
  12595. function in the current stack frame is declared to return a 'long long
  12596. int', GDB transparently converts the implicit 'int' value of -1 into a
  12597. 'long long int':
  12598. Breakpoint 1, func () at gdb.base/return-nodebug.c:29
  12599. 29 return 31;
  12600. (gdb) return -1
  12601. Make func return now? (y or n) y
  12602. #0 0x004004f6 in main () at gdb.base/return-nodebug.c:43
  12603. 43 printf ("result=%lld\n", func ());
  12604. (gdb)
  12605. However, if the selected stack frame does not have a debug info,
  12606. e.g., if the function was compiled without debug info, GDB has to find
  12607. out the type to return from user. Specifying a different type by
  12608. mistake may set the value in different inferior registers than the
  12609. caller code expects. For example, typing 'return -1' with its implicit
  12610. type 'int' would set only a part of a 'long long int' result for a debug
  12611. info less function (on 32-bit architectures). Therefore the user is
  12612. required to specify the return type by an appropriate cast explicitly:
  12613. Breakpoint 2, 0x0040050b in func ()
  12614. (gdb) return -1
  12615. Return value type not available for selected stack frame.
  12616. Please use an explicit cast of the value to return.
  12617. (gdb) return (long long int) -1
  12618. Make selected stack frame return now? (y or n) y
  12619. #0 0x00400526 in main ()
  12620. (gdb)
  12621. 
  12622. File: gdb.info, Node: Calling, Next: Patching, Prev: Returning, Up: Altering
  12623. 17.5 Calling Program Functions
  12624. ==============================
  12625. 'print EXPR'
  12626. Evaluate the expression EXPR and display the resulting value. The
  12627. expression may include calls to functions in the program being
  12628. debugged.
  12629. 'call EXPR'
  12630. Evaluate the expression EXPR without displaying 'void' returned
  12631. values.
  12632. You can use this variant of the 'print' command if you want to
  12633. execute a function from your program that does not return anything
  12634. (a.k.a. "a void function"), but without cluttering the output with
  12635. 'void' returned values that GDB will otherwise print. If the
  12636. result is not void, it is printed and saved in the value history.
  12637. It is possible for the function you call via the 'print' or 'call'
  12638. command to generate a signal (e.g., if there's a bug in the function, or
  12639. if you passed it incorrect arguments). What happens in that case is
  12640. controlled by the 'set unwindonsignal' command.
  12641. Similarly, with a C++ program it is possible for the function you
  12642. call via the 'print' or 'call' command to generate an exception that is
  12643. not handled due to the constraints of the dummy frame. In this case,
  12644. any exception that is raised in the frame, but has an out-of-frame
  12645. exception handler will not be found. GDB builds a dummy-frame for the
  12646. inferior function call, and the unwinder cannot seek for exception
  12647. handlers outside of this dummy-frame. What happens in that case is
  12648. controlled by the 'set unwind-on-terminating-exception' command.
  12649. 'set unwindonsignal'
  12650. Set unwinding of the stack if a signal is received while in a
  12651. function that GDB called in the program being debugged. If set to
  12652. on, GDB unwinds the stack it created for the call and restores the
  12653. context to what it was before the call. If set to off (the
  12654. default), GDB stops in the frame where the signal was received.
  12655. 'show unwindonsignal'
  12656. Show the current setting of stack unwinding in the functions called
  12657. by GDB.
  12658. 'set unwind-on-terminating-exception'
  12659. Set unwinding of the stack if a C++ exception is raised, but left
  12660. unhandled while in a function that GDB called in the program being
  12661. debugged. If set to on (the default), GDB unwinds the stack it
  12662. created for the call and restores the context to what it was before
  12663. the call. If set to off, GDB the exception is delivered to the
  12664. default C++ exception handler and the inferior terminated.
  12665. 'show unwind-on-terminating-exception'
  12666. Show the current setting of stack unwinding in the functions called
  12667. by GDB.
  12668. 17.5.1 Calling functions with no debug info
  12669. -------------------------------------------
  12670. Sometimes, a function you wish to call is missing debug information. In
  12671. such case, GDB does not know the type of the function, including the
  12672. types of the function's parameters. To avoid calling the inferior
  12673. function incorrectly, which could result in the called function
  12674. functioning erroneously and even crash, GDB refuses to call the function
  12675. unless you tell it the type of the function.
  12676. For prototyped (i.e. ANSI/ISO style) functions, there are two ways to
  12677. do that. The simplest is to cast the call to the function's declared
  12678. return type. For example:
  12679. (gdb) p getenv ("PATH")
  12680. 'getenv' has unknown return type; cast the call to its declared return type
  12681. (gdb) p (char *) getenv ("PATH")
  12682. $1 = 0x7fffffffe7ba "/usr/local/bin:/"...
  12683. Casting the return type of a no-debug function is equivalent to
  12684. casting the function to a pointer to a prototyped function that has a
  12685. prototype that matches the types of the passed-in arguments, and calling
  12686. that. I.e., the call above is equivalent to:
  12687. (gdb) p ((char * (*) (const char *)) getenv) ("PATH")
  12688. and given this prototyped C or C++ function with float parameters:
  12689. float multiply (float v1, float v2) { return v1 * v2; }
  12690. these calls are equivalent:
  12691. (gdb) p (float) multiply (2.0f, 3.0f)
  12692. (gdb) p ((float (*) (float, float)) multiply) (2.0f, 3.0f)
  12693. If the function you wish to call is declared as unprototyped (i.e.
  12694. old K&R style), you must use the cast-to-function-pointer syntax, so
  12695. that GDB knows that it needs to apply default argument promotions
  12696. (promote float arguments to double). *Note float promotion: ABI. For
  12697. example, given this unprototyped C function with float parameters, and
  12698. no debug info:
  12699. float
  12700. multiply_noproto (v1, v2)
  12701. float v1, v2;
  12702. {
  12703. return v1 * v2;
  12704. }
  12705. you call it like this:
  12706. (gdb) p ((float (*) ()) multiply_noproto) (2.0f, 3.0f)
  12707. 
  12708. File: gdb.info, Node: Patching, Next: Compiling and Injecting Code, Prev: Calling, Up: Altering
  12709. 17.6 Patching Programs
  12710. ======================
  12711. By default, GDB opens the file containing your program's executable code
  12712. (or the corefile) read-only. This prevents accidental alterations to
  12713. machine code; but it also prevents you from intentionally patching your
  12714. program's binary.
  12715. If you'd like to be able to patch the binary, you can specify that
  12716. explicitly with the 'set write' command. For example, you might want to
  12717. turn on internal debugging flags, or even to make emergency repairs.
  12718. 'set write on'
  12719. 'set write off'
  12720. If you specify 'set write on', GDB opens executable and core files
  12721. for both reading and writing; if you specify 'set write off' (the
  12722. default), GDB opens them read-only.
  12723. If you have already loaded a file, you must load it again (using
  12724. the 'exec-file' or 'core-file' command) after changing 'set write',
  12725. for your new setting to take effect.
  12726. 'show write'
  12727. Display whether executable files and core files are opened for
  12728. writing as well as reading.
  12729. 
  12730. File: gdb.info, Node: Compiling and Injecting Code, Prev: Patching, Up: Altering
  12731. 17.7 Compiling and injecting code in GDB
  12732. ========================================
  12733. GDB supports on-demand compilation and code injection into programs
  12734. running under GDB. GCC 5.0 or higher built with 'libcc1.so' must be
  12735. installed for this functionality to be enabled. This functionality is
  12736. implemented with the following commands.
  12737. 'compile code SOURCE-CODE'
  12738. 'compile code -raw -- SOURCE-CODE'
  12739. Compile SOURCE-CODE with the compiler language found as the current
  12740. language in GDB (*note Languages::). If compilation and injection
  12741. is not supported with the current language specified in GDB, or the
  12742. compiler does not support this feature, an error message will be
  12743. printed. If SOURCE-CODE compiles and links successfully, GDB will
  12744. load the object-code emitted, and execute it within the context of
  12745. the currently selected inferior. It is important to note that the
  12746. compiled code is executed immediately. After execution, the
  12747. compiled code is removed from GDB and any new types or variables
  12748. you have defined will be deleted.
  12749. The command allows you to specify SOURCE-CODE in two ways. The
  12750. simplest method is to provide a single line of code to the command.
  12751. E.g.:
  12752. compile code printf ("hello world\n");
  12753. If you specify options on the command line as well as source code,
  12754. they may conflict. The '--' delimiter can be used to separate
  12755. options from actual source code. E.g.:
  12756. compile code -r -- printf ("hello world\n");
  12757. Alternatively you can enter source code as multiple lines of text.
  12758. To enter this mode, invoke the 'compile code' command without any
  12759. text following the command. This will start the multiple-line
  12760. editor and allow you to type as many lines of source code as
  12761. required. When you have completed typing, enter 'end' on its own
  12762. line to exit the editor.
  12763. compile code
  12764. >printf ("hello\n");
  12765. >printf ("world\n");
  12766. >end
  12767. Specifying '-raw', prohibits GDB from wrapping the provided
  12768. SOURCE-CODE in a callable scope. In this case, you must specify
  12769. the entry point of the code by defining a function named
  12770. '_gdb_expr_'. The '-raw' code cannot access variables of the
  12771. inferior. Using '-raw' option may be needed for example when
  12772. SOURCE-CODE requires '#include' lines which may conflict with
  12773. inferior symbols otherwise.
  12774. 'compile file FILENAME'
  12775. 'compile file -raw FILENAME'
  12776. Like 'compile code', but take the source code from FILENAME.
  12777. compile file /home/user/example.c
  12778. 'compile print EXPR'
  12779. 'compile print /F EXPR'
  12780. Compile and execute EXPR with the compiler language found as the
  12781. current language in GDB (*note Languages::). By default the value
  12782. of EXPR is printed in a format appropriate to its data type; you
  12783. can choose a different format by specifying '/F', where F is a
  12784. letter specifying the format; see *note Output Formats: Output
  12785. Formats.
  12786. 'compile print'
  12787. 'compile print /F'
  12788. Alternatively you can enter the expression (source code producing
  12789. it) as multiple lines of text. To enter this mode, invoke the
  12790. 'compile print' command without any text following the command.
  12791. This will start the multiple-line editor.
  12792. The process of compiling and injecting the code can be inspected using:
  12793. 'set debug compile'
  12794. Turns on or off display of GDB process of compiling and injecting
  12795. the code. The default is off.
  12796. 'show debug compile'
  12797. Displays the current state of displaying GDB process of compiling
  12798. and injecting the code.
  12799. 'set debug compile-cplus-types'
  12800. Turns on or off the display of C++ type conversion debugging
  12801. information. The default is off.
  12802. 'show debug compile-cplus-types'
  12803. Displays the current state of displaying debugging information for
  12804. C++ type conversion.
  12805. 17.7.1 Compilation options for the 'compile' command
  12806. ----------------------------------------------------
  12807. GDB needs to specify the right compilation options for the code to be
  12808. injected, in part to make its ABI compatible with the inferior and in
  12809. part to make the injected code compatible with GDB's injecting process.
  12810. The options used, in increasing precedence:
  12811. target architecture and OS options ('gdbarch')
  12812. These options depend on target processor type and target operating
  12813. system, usually they specify at least 32-bit ('-m32') or 64-bit
  12814. ('-m64') compilation option.
  12815. compilation options recorded in the target
  12816. GCC (since version 4.7) stores the options used for compilation
  12817. into 'DW_AT_producer' part of DWARF debugging information according
  12818. to the GCC option '-grecord-gcc-switches'. One has to explicitly
  12819. specify '-g' during inferior compilation otherwise GCC produces no
  12820. DWARF. This feature is only relevant for platforms where '-g'
  12821. produces DWARF by default, otherwise one may try to enforce DWARF
  12822. by using '-gdwarf-4'.
  12823. compilation options set by 'set compile-args'
  12824. You can override compilation options using the following command:
  12825. 'set compile-args'
  12826. Set compilation options used for compiling and injecting code with
  12827. the 'compile' commands. These options override any conflicting
  12828. ones from the target architecture and/or options stored during
  12829. inferior compilation.
  12830. 'show compile-args'
  12831. Displays the current state of compilation options override. This
  12832. does not show all the options actually used during compilation, use
  12833. *note set debug compile:: for that.
  12834. 17.7.2 Caveats when using the 'compile' command
  12835. -----------------------------------------------
  12836. There are a few caveats to keep in mind when using the 'compile'
  12837. command. As the caveats are different per language, the table below
  12838. highlights specific issues on a per language basis.
  12839. C code examples and caveats
  12840. When the language in GDB is set to 'C', the compiler will attempt
  12841. to compile the source code with a 'C' compiler. The source code
  12842. provided to the 'compile' command will have much the same access to
  12843. variables and types as it normally would if it were part of the
  12844. program currently being debugged in GDB.
  12845. Below is a sample program that forms the basis of the examples that
  12846. follow. This program has been compiled and loaded into GDB, much
  12847. like any other normal debugging session.
  12848. void function1 (void)
  12849. {
  12850. int i = 42;
  12851. printf ("function 1\n");
  12852. }
  12853. void function2 (void)
  12854. {
  12855. int j = 12;
  12856. function1 ();
  12857. }
  12858. int main(void)
  12859. {
  12860. int k = 6;
  12861. int *p;
  12862. function2 ();
  12863. return 0;
  12864. }
  12865. For the purposes of the examples in this section, the program above
  12866. has been compiled, loaded into GDB, stopped at the function 'main',
  12867. and GDB is awaiting input from the user.
  12868. To access variables and types for any program in GDB, the program
  12869. must be compiled and packaged with debug information. The
  12870. 'compile' command is not an exception to this rule. Without debug
  12871. information, you can still use the 'compile' command, but you will
  12872. be very limited in what variables and types you can access.
  12873. So with that in mind, the example above has been compiled with
  12874. debug information enabled. The 'compile' command will have access
  12875. to all variables and types (except those that may have been
  12876. optimized out). Currently, as GDB has stopped the program in the
  12877. 'main' function, the 'compile' command would have access to the
  12878. variable 'k'. You could invoke the 'compile' command and type some
  12879. source code to set the value of 'k'. You can also read it, or do
  12880. anything with that variable you would normally do in 'C'. Be aware
  12881. that changes to inferior variables in the 'compile' command are
  12882. persistent. In the following example:
  12883. compile code k = 3;
  12884. the variable 'k' is now 3. It will retain that value until
  12885. something else in the example program changes it, or another
  12886. 'compile' command changes it.
  12887. Normal scope and access rules apply to source code compiled and
  12888. injected by the 'compile' command. In the example, the variables
  12889. 'j' and 'k' are not accessible yet, because the program is
  12890. currently stopped in the 'main' function, where these variables are
  12891. not in scope. Therefore, the following command
  12892. compile code j = 3;
  12893. will result in a compilation error message.
  12894. Once the program is continued, execution will bring these variables
  12895. in scope, and they will become accessible; then the code you
  12896. specify via the 'compile' command will be able to access them.
  12897. You can create variables and types with the 'compile' command as
  12898. part of your source code. Variables and types that are created as
  12899. part of the 'compile' command are not visible to the rest of the
  12900. program for the duration of its run. This example is valid:
  12901. compile code int ff = 5; printf ("ff is %d\n", ff);
  12902. However, if you were to type the following into GDB after that
  12903. command has completed:
  12904. compile code printf ("ff is %d\n'', ff);
  12905. a compiler error would be raised as the variable 'ff' no longer
  12906. exists. Object code generated and injected by the 'compile'
  12907. command is removed when its execution ends. Caution is advised
  12908. when assigning to program variables values of variables created by
  12909. the code submitted to the 'compile' command. This example is
  12910. valid:
  12911. compile code int ff = 5; k = ff;
  12912. The value of the variable 'ff' is assigned to 'k'. The variable
  12913. 'k' does not require the existence of 'ff' to maintain the value it
  12914. has been assigned. However, pointers require particular care in
  12915. assignment. If the source code compiled with the 'compile' command
  12916. changed the address of a pointer in the example program, perhaps to
  12917. a variable created in the 'compile' command, that pointer would
  12918. point to an invalid location when the command exits. The following
  12919. example would likely cause issues with your debugged program:
  12920. compile code int ff = 5; p = &ff;
  12921. In this example, 'p' would point to 'ff' when the 'compile' command
  12922. is executing the source code provided to it. However, as variables
  12923. in the (example) program persist with their assigned values, the
  12924. variable 'p' would point to an invalid location when the command
  12925. exists. A general rule should be followed in that you should
  12926. either assign 'NULL' to any assigned pointers, or restore a valid
  12927. location to the pointer before the command exits.
  12928. Similar caution must be exercised with any structs, unions, and
  12929. typedefs defined in 'compile' command. Types defined in the
  12930. 'compile' command will no longer be available in the next 'compile'
  12931. command. Therefore, if you cast a variable to a type defined in
  12932. the 'compile' command, care must be taken to ensure that any future
  12933. need to resolve the type can be achieved.
  12934. (gdb) compile code static struct a { int a; } v = { 42 }; argv = &v;
  12935. (gdb) compile code printf ("%d\n", ((struct a *) argv)->a);
  12936. gdb command line:1:36: error: dereferencing pointer to incomplete type ‘struct a’
  12937. Compilation failed.
  12938. (gdb) compile code struct a { int a; }; printf ("%d\n", ((struct a *) argv)->a);
  12939. 42
  12940. Variables that have been optimized away by the compiler are not
  12941. accessible to the code submitted to the 'compile' command. Access
  12942. to those variables will generate a compiler error which GDB will
  12943. print to the console.
  12944. 17.7.3 Compiler search for the 'compile' command
  12945. ------------------------------------------------
  12946. GDB needs to find GCC for the inferior being debugged which may not be
  12947. obvious for remote targets of different architecture than where GDB is
  12948. running. Environment variable 'PATH' on GDB host is searched for GCC
  12949. binary matching the target architecture and operating system. This
  12950. search can be overriden by 'set compile-gcc' GDB command below. 'PATH'
  12951. is taken from shell that executed GDB, it is not the value set by GDB
  12952. command 'set environment'). *Note Environment::.
  12953. Specifically 'PATH' is searched for binaries matching regular
  12954. expression 'ARCH(-[^-]*)?-OS-gcc' according to the inferior target being
  12955. debugged. ARCH is processor name -- multiarch is supported, so for
  12956. example both 'i386' and 'x86_64' targets look for pattern
  12957. '(x86_64|i.86)' and both 's390' and 's390x' targets look for pattern
  12958. 's390x?'. OS is currently supported only for pattern 'linux(-gnu)?'.
  12959. On Posix hosts the compiler driver GDB needs to find also shared
  12960. library 'libcc1.so' from the compiler. It is searched in default shared
  12961. library search path (overridable with usual environment variable
  12962. 'LD_LIBRARY_PATH'), unrelated to 'PATH' or 'set compile-gcc' settings.
  12963. Contrary to it 'libcc1plugin.so' is found according to the installation
  12964. of the found compiler -- as possibly specified by the 'set compile-gcc'
  12965. command.
  12966. 'set compile-gcc'
  12967. Set compilation command used for compiling and injecting code with
  12968. the 'compile' commands. If this option is not set (it is set to an
  12969. empty string), the search described above will occur -- that is the
  12970. default.
  12971. 'show compile-gcc'
  12972. Displays the current compile command GCC driver filename. If set,
  12973. it is the main command 'gcc', found usually for example under name
  12974. 'x86_64-linux-gnu-gcc'.
  12975. 
  12976. File: gdb.info, Node: GDB Files, Next: Targets, Prev: Altering, Up: Top
  12977. 18 GDB Files
  12978. ************
  12979. GDB needs to know the file name of the program to be debugged, both in
  12980. order to read its symbol table and in order to start your program. To
  12981. debug a core dump of a previous run, you must also tell GDB the name of
  12982. the core dump file.
  12983. * Menu:
  12984. * Files:: Commands to specify files
  12985. * File Caching:: Information about GDB's file caching
  12986. * Separate Debug Files:: Debugging information in separate files
  12987. * MiniDebugInfo:: Debugging information in a special section
  12988. * Index Files:: Index files speed up GDB
  12989. * Symbol Errors:: Errors reading symbol files
  12990. * Data Files:: GDB data files
  12991. 
  12992. File: gdb.info, Node: Files, Next: File Caching, Up: GDB Files
  12993. 18.1 Commands to Specify Files
  12994. ==============================
  12995. You may want to specify executable and core dump file names. The usual
  12996. way to do this is at start-up time, using the arguments to GDB's
  12997. start-up commands (*note Getting In and Out of GDB: Invocation.).
  12998. Occasionally it is necessary to change to a different file during a
  12999. GDB session. Or you may run GDB and forget to specify a file you want
  13000. to use. Or you are debugging a remote target via 'gdbserver' (*note
  13001. file: Server.). In these situations the GDB commands to specify new
  13002. files are useful.
  13003. 'file FILENAME'
  13004. Use FILENAME as the program to be debugged. It is read for its
  13005. symbols and for the contents of pure memory. It is also the
  13006. program executed when you use the 'run' command. If you do not
  13007. specify a directory and the file is not found in the GDB working
  13008. directory, GDB uses the environment variable 'PATH' as a list of
  13009. directories to search, just as the shell does when looking for a
  13010. program to run. You can change the value of this variable, for
  13011. both GDB and your program, using the 'path' command.
  13012. You can load unlinked object '.o' files into GDB using the 'file'
  13013. command. You will not be able to "run" an object file, but you can
  13014. disassemble functions and inspect variables. Also, if the
  13015. underlying BFD functionality supports it, you could use 'gdb
  13016. -write' to patch object files using this technique. Note that GDB
  13017. can neither interpret nor modify relocations in this case, so
  13018. branches and some initialized variables will appear to go to the
  13019. wrong place. But this feature is still handy from time to time.
  13020. 'file'
  13021. 'file' with no argument makes GDB discard any information it has on
  13022. both executable file and the symbol table.
  13023. 'exec-file [ FILENAME ]'
  13024. Specify that the program to be run (but not the symbol table) is
  13025. found in FILENAME. GDB searches the environment variable 'PATH' if
  13026. necessary to locate your program. Omitting FILENAME means to
  13027. discard information on the executable file.
  13028. 'symbol-file [ FILENAME [ -o OFFSET ]]'
  13029. Read symbol table information from file FILENAME. 'PATH' is
  13030. searched when necessary. Use the 'file' command to get both symbol
  13031. table and program to run from the same file.
  13032. If an optional OFFSET is specified, it is added to the start
  13033. address of each section in the symbol file. This is useful if the
  13034. program is relocated at runtime, such as the Linux kernel with
  13035. kASLR enabled.
  13036. 'symbol-file' with no argument clears out GDB information on your
  13037. program's symbol table.
  13038. The 'symbol-file' command causes GDB to forget the contents of some
  13039. breakpoints and auto-display expressions. This is because they may
  13040. contain pointers to the internal data recording symbols and data
  13041. types, which are part of the old symbol table data being discarded
  13042. inside GDB.
  13043. 'symbol-file' does not repeat if you press <RET> again after
  13044. executing it once.
  13045. When GDB is configured for a particular environment, it understands
  13046. debugging information in whatever format is the standard generated
  13047. for that environment; you may use either a GNU compiler, or other
  13048. compilers that adhere to the local conventions. Best results are
  13049. usually obtained from GNU compilers; for example, using 'GCC' you
  13050. can generate debugging information for optimized code.
  13051. For most kinds of object files, with the exception of old SVR3
  13052. systems using COFF, the 'symbol-file' command does not normally
  13053. read the symbol table in full right away. Instead, it scans the
  13054. symbol table quickly to find which source files and which symbols
  13055. are present. The details are read later, one source file at a
  13056. time, as they are needed.
  13057. The purpose of this two-stage reading strategy is to make GDB start
  13058. up faster. For the most part, it is invisible except for
  13059. occasional pauses while the symbol table details for a particular
  13060. source file are being read. (The 'set verbose' command can turn
  13061. these pauses into messages if desired. *Note Optional Warnings and
  13062. Messages: Messages/Warnings.)
  13063. We have not implemented the two-stage strategy for COFF yet. When
  13064. the symbol table is stored in COFF format, 'symbol-file' reads the
  13065. symbol table data in full right away. Note that "stabs-in-COFF"
  13066. still does the two-stage strategy, since the debug info is actually
  13067. in stabs format.
  13068. 'symbol-file [ -readnow ] FILENAME'
  13069. 'file [ -readnow ] FILENAME'
  13070. You can override the GDB two-stage strategy for reading symbol
  13071. tables by using the '-readnow' option with any of the commands that
  13072. load symbol table information, if you want to be sure GDB has the
  13073. entire symbol table available.
  13074. 'symbol-file [ -readnever ] FILENAME'
  13075. 'file [ -readnever ] FILENAME'
  13076. You can instruct GDB to never read the symbolic information
  13077. contained in FILENAME by using the '-readnever' option. *Note
  13078. --readnever::.
  13079. 'core-file [FILENAME]'
  13080. 'core'
  13081. Specify the whereabouts of a core dump file to be used as the
  13082. "contents of memory". Traditionally, core files contain only some
  13083. parts of the address space of the process that generated them; GDB
  13084. can access the executable file itself for other parts.
  13085. 'core-file' with no argument specifies that no core file is to be
  13086. used.
  13087. Note that the core file is ignored when your program is actually
  13088. running under GDB. So, if you have been running your program and
  13089. you wish to debug a core file instead, you must kill the subprocess
  13090. in which the program is running. To do this, use the 'kill'
  13091. command (*note Killing the Child Process: Kill Process.).
  13092. 'add-symbol-file FILENAME [ -readnow | -readnever ] [ -o OFFSET ] [ TEXTADDRESS ] [ -s SECTION ADDRESS ... ]'
  13093. The 'add-symbol-file' command reads additional symbol table
  13094. information from the file FILENAME. You would use this command
  13095. when FILENAME has been dynamically loaded (by some other means)
  13096. into the program that is running. The TEXTADDRESS parameter gives
  13097. the memory address at which the file's text section has been
  13098. loaded. You can additionally specify the base address of other
  13099. sections using an arbitrary number of '-s SECTION ADDRESS' pairs.
  13100. If a section is omitted, GDB will use its default addresses as
  13101. found in FILENAME. Any ADDRESS or TEXTADDRESS can be given as an
  13102. expression.
  13103. If an optional OFFSET is specified, it is added to the start
  13104. address of each section, except those for which the address was
  13105. specified explicitly.
  13106. The symbol table of the file FILENAME is added to the symbol table
  13107. originally read with the 'symbol-file' command. You can use the
  13108. 'add-symbol-file' command any number of times; the new symbol data
  13109. thus read is kept in addition to the old.
  13110. Changes can be reverted using the command 'remove-symbol-file'.
  13111. Although FILENAME is typically a shared library file, an executable
  13112. file, or some other object file which has been fully relocated for
  13113. loading into a process, you can also load symbolic information from
  13114. relocatable '.o' files, as long as:
  13115. * the file's symbolic information refers only to linker symbols
  13116. defined in that file, not to symbols defined by other object
  13117. files,
  13118. * every section the file's symbolic information refers to has
  13119. actually been loaded into the inferior, as it appears in the
  13120. file, and
  13121. * you can determine the address at which every section was
  13122. loaded, and provide these to the 'add-symbol-file' command.
  13123. Some embedded operating systems, like Sun Chorus and VxWorks, can
  13124. load relocatable files into an already running program; such
  13125. systems typically make the requirements above easy to meet.
  13126. However, it's important to recognize that many native systems use
  13127. complex link procedures ('.linkonce' section factoring and C++
  13128. constructor table assembly, for example) that make the requirements
  13129. difficult to meet. In general, one cannot assume that using
  13130. 'add-symbol-file' to read a relocatable object file's symbolic
  13131. information will have the same effect as linking the relocatable
  13132. object file into the program in the normal way.
  13133. 'add-symbol-file' does not repeat if you press <RET> after using
  13134. it.
  13135. 'remove-symbol-file FILENAME'
  13136. 'remove-symbol-file -a ADDRESS'
  13137. Remove a symbol file added via the 'add-symbol-file' command. The
  13138. file to remove can be identified by its FILENAME or by an ADDRESS
  13139. that lies within the boundaries of this symbol file in memory.
  13140. Example:
  13141. (gdb) add-symbol-file /home/user/gdb/mylib.so 0x7ffff7ff9480
  13142. add symbol table from file "/home/user/gdb/mylib.so" at
  13143. .text_addr = 0x7ffff7ff9480
  13144. (y or n) y
  13145. Reading symbols from /home/user/gdb/mylib.so...done.
  13146. (gdb) remove-symbol-file -a 0x7ffff7ff9480
  13147. Remove symbol table from file "/home/user/gdb/mylib.so"? (y or n) y
  13148. (gdb)
  13149. 'remove-symbol-file' does not repeat if you press <RET> after using
  13150. it.
  13151. 'add-symbol-file-from-memory ADDRESS'
  13152. Load symbols from the given ADDRESS in a dynamically loaded object
  13153. file whose image is mapped directly into the inferior's memory.
  13154. For example, the Linux kernel maps a 'syscall DSO' into each
  13155. process's address space; this DSO provides kernel-specific code for
  13156. some system calls. The argument can be any expression whose
  13157. evaluation yields the address of the file's shared object file
  13158. header. For this command to work, you must have used 'symbol-file'
  13159. or 'exec-file' commands in advance.
  13160. 'section SECTION ADDR'
  13161. The 'section' command changes the base address of the named SECTION
  13162. of the exec file to ADDR. This can be used if the exec file does
  13163. not contain section addresses, (such as in the 'a.out' format), or
  13164. when the addresses specified in the file itself are wrong. Each
  13165. section must be changed separately. The 'info files' command,
  13166. described below, lists all the sections and their addresses.
  13167. 'info files'
  13168. 'info target'
  13169. 'info files' and 'info target' are synonymous; both print the
  13170. current target (*note Specifying a Debugging Target: Targets.),
  13171. including the names of the executable and core dump files currently
  13172. in use by GDB, and the files from which symbols were loaded. The
  13173. command 'help target' lists all possible targets rather than
  13174. current ones.
  13175. 'maint info sections'
  13176. Another command that can give you extra information about program
  13177. sections is 'maint info sections'. In addition to the section
  13178. information displayed by 'info files', this command displays the
  13179. flags and file offset of each section in the executable and core
  13180. dump files. In addition, 'maint info sections' provides the
  13181. following command options (which may be arbitrarily combined):
  13182. 'ALLOBJ'
  13183. Display sections for all loaded object files, including shared
  13184. libraries.
  13185. 'SECTIONS'
  13186. Display info only for named SECTIONS.
  13187. 'SECTION-FLAGS'
  13188. Display info only for sections for which SECTION-FLAGS are
  13189. true. The section flags that GDB currently knows about are:
  13190. 'ALLOC'
  13191. Section will have space allocated in the process when
  13192. loaded. Set for all sections except those containing
  13193. debug information.
  13194. 'LOAD'
  13195. Section will be loaded from the file into the child
  13196. process memory. Set for pre-initialized code and data,
  13197. clear for '.bss' sections.
  13198. 'RELOC'
  13199. Section needs to be relocated before loading.
  13200. 'READONLY'
  13201. Section cannot be modified by the child process.
  13202. 'CODE'
  13203. Section contains executable code only.
  13204. 'DATA'
  13205. Section contains data only (no executable code).
  13206. 'ROM'
  13207. Section will reside in ROM.
  13208. 'CONSTRUCTOR'
  13209. Section contains data for constructor/destructor lists.
  13210. 'HAS_CONTENTS'
  13211. Section is not empty.
  13212. 'NEVER_LOAD'
  13213. An instruction to the linker to not output the section.
  13214. 'COFF_SHARED_LIBRARY'
  13215. A notification to the linker that the section contains
  13216. COFF shared library information.
  13217. 'IS_COMMON'
  13218. Section contains common symbols.
  13219. 'set trust-readonly-sections on'
  13220. Tell GDB that readonly sections in your object file really are
  13221. read-only (i.e. that their contents will not change). In that
  13222. case, GDB can fetch values from these sections out of the object
  13223. file, rather than from the target program. For some targets
  13224. (notably embedded ones), this can be a significant enhancement to
  13225. debugging performance.
  13226. The default is off.
  13227. 'set trust-readonly-sections off'
  13228. Tell GDB not to trust readonly sections. This means that the
  13229. contents of the section might change while the program is running,
  13230. and must therefore be fetched from the target when needed.
  13231. 'show trust-readonly-sections'
  13232. Show the current setting of trusting readonly sections.
  13233. All file-specifying commands allow both absolute and relative file
  13234. names as arguments. GDB always converts the file name to an absolute
  13235. file name and remembers it that way.
  13236. GDB supports GNU/Linux, MS-Windows, SunOS, Darwin/Mach-O, SVr4, IBM
  13237. RS/6000 AIX, QNX Neutrino, FDPIC (FR-V), and DSBT (TIC6X) shared
  13238. libraries.
  13239. On MS-Windows GDB must be linked with the Expat library to support
  13240. shared libraries. *Note Expat::.
  13241. GDB automatically loads symbol definitions from shared libraries when
  13242. you use the 'run' command, or when you examine a core file. (Before you
  13243. issue the 'run' command, GDB does not understand references to a
  13244. function in a shared library, however--unless you are debugging a core
  13245. file).
  13246. There are times, however, when you may wish to not automatically load
  13247. symbol definitions from shared libraries, such as when they are
  13248. particularly large or there are many of them.
  13249. To control the automatic loading of shared library symbols, use the
  13250. commands:
  13251. 'set auto-solib-add MODE'
  13252. If MODE is 'on', symbols from all shared object libraries will be
  13253. loaded automatically when the inferior begins execution, you attach
  13254. to an independently started inferior, or when the dynamic linker
  13255. informs GDB that a new library has been loaded. If MODE is 'off',
  13256. symbols must be loaded manually, using the 'sharedlibrary' command.
  13257. The default value is 'on'.
  13258. If your program uses lots of shared libraries with debug info that
  13259. takes large amounts of memory, you can decrease the GDB memory
  13260. footprint by preventing it from automatically loading the symbols
  13261. from shared libraries. To that end, type 'set auto-solib-add off'
  13262. before running the inferior, then load each library whose debug
  13263. symbols you do need with 'sharedlibrary REGEXP', where REGEXP is a
  13264. regular expression that matches the libraries whose symbols you
  13265. want to be loaded.
  13266. 'show auto-solib-add'
  13267. Display the current autoloading mode.
  13268. To explicitly load shared library symbols, use the 'sharedlibrary'
  13269. command:
  13270. 'info share REGEX'
  13271. 'info sharedlibrary REGEX'
  13272. Print the names of the shared libraries which are currently loaded
  13273. that match REGEX. If REGEX is omitted then print all shared
  13274. libraries that are loaded.
  13275. 'info dll REGEX'
  13276. This is an alias of 'info sharedlibrary'.
  13277. 'sharedlibrary REGEX'
  13278. 'share REGEX'
  13279. Load shared object library symbols for files matching a Unix
  13280. regular expression. As with files loaded automatically, it only
  13281. loads shared libraries required by your program for a core file or
  13282. after typing 'run'. If REGEX is omitted all shared libraries
  13283. required by your program are loaded.
  13284. 'nosharedlibrary'
  13285. Unload all shared object library symbols. This discards all
  13286. symbols that have been loaded from all shared libraries. Symbols
  13287. from shared libraries that were loaded by explicit user requests
  13288. are not discarded.
  13289. Sometimes you may wish that GDB stops and gives you control when any
  13290. of shared library events happen. The best way to do this is to use
  13291. 'catch load' and 'catch unload' (*note Set Catchpoints::).
  13292. GDB also supports the the 'set stop-on-solib-events' command for
  13293. this. This command exists for historical reasons. It is less useful
  13294. than setting a catchpoint, because it does not allow for conditions or
  13295. commands as a catchpoint does.
  13296. 'set stop-on-solib-events'
  13297. This command controls whether GDB should give you control when the
  13298. dynamic linker notifies it about some shared library event. The
  13299. most common event of interest is loading or unloading of a new
  13300. shared library.
  13301. 'show stop-on-solib-events'
  13302. Show whether GDB stops and gives you control when shared library
  13303. events happen.
  13304. Shared libraries are also supported in many cross or remote debugging
  13305. configurations. GDB needs to have access to the target's libraries;
  13306. this can be accomplished either by providing copies of the libraries on
  13307. the host system, or by asking GDB to automatically retrieve the
  13308. libraries from the target. If copies of the target libraries are
  13309. provided, they need to be the same as the target libraries, although the
  13310. copies on the target can be stripped as long as the copies on the host
  13311. are not.
  13312. For remote debugging, you need to tell GDB where the target libraries
  13313. are, so that it can load the correct copies--otherwise, it may try to
  13314. load the host's libraries. GDB has two variables to specify the search
  13315. directories for target libraries.
  13316. 'set sysroot PATH'
  13317. Use PATH as the system root for the program being debugged. Any
  13318. absolute shared library paths will be prefixed with PATH; many
  13319. runtime loaders store the absolute paths to the shared library in
  13320. the target program's memory. When starting processes remotely, and
  13321. when attaching to already-running processes (local or remote),
  13322. their executable filenames will be prefixed with PATH if reported
  13323. to GDB as absolute by the operating system. If you use 'set
  13324. sysroot' to find executables and shared libraries, they need to be
  13325. laid out in the same way that they are on the target, with e.g. a
  13326. '/bin', '/lib' and '/usr/lib' hierarchy under PATH.
  13327. If PATH starts with the sequence 'target:' and the target system is
  13328. remote then GDB will retrieve the target binaries from the remote
  13329. system. This is only supported when using a remote target that
  13330. supports the 'remote get' command (*note Sending files to a remote
  13331. system: File Transfer.). The part of PATH following the initial
  13332. 'target:' (if present) is used as system root prefix on the remote
  13333. file system. If PATH starts with the sequence 'remote:' this is
  13334. converted to the sequence 'target:' by 'set sysroot'(1). If you
  13335. want to specify a local system root using a directory that happens
  13336. to be named 'target:' or 'remote:', you need to use some equivalent
  13337. variant of the name like './target:'.
  13338. For targets with an MS-DOS based filesystem, such as MS-Windows and
  13339. SymbianOS, GDB tries prefixing a few variants of the target
  13340. absolute file name with PATH. But first, on Unix hosts, GDB
  13341. converts all backslash directory separators into forward slashes,
  13342. because the backslash is not a directory separator on Unix:
  13343. c:\foo\bar.dll => c:/foo/bar.dll
  13344. Then, GDB attempts prefixing the target file name with PATH, and
  13345. looks for the resulting file name in the host file system:
  13346. c:/foo/bar.dll => /path/to/sysroot/c:/foo/bar.dll
  13347. If that does not find the binary, GDB tries removing the ':'
  13348. character from the drive spec, both for convenience, and, for the
  13349. case of the host file system not supporting file names with colons:
  13350. c:/foo/bar.dll => /path/to/sysroot/c/foo/bar.dll
  13351. This makes it possible to have a system root that mirrors a target
  13352. with more than one drive. E.g., you may want to setup your local
  13353. copies of the target system shared libraries like so (note 'c' vs
  13354. 'z'):
  13355. /path/to/sysroot/c/sys/bin/foo.dll
  13356. /path/to/sysroot/c/sys/bin/bar.dll
  13357. /path/to/sysroot/z/sys/bin/bar.dll
  13358. and point the system root at '/path/to/sysroot', so that GDB can
  13359. find the correct copies of both 'c:\sys\bin\foo.dll', and
  13360. 'z:\sys\bin\bar.dll'.
  13361. If that still does not find the binary, GDB tries removing the
  13362. whole drive spec from the target file name:
  13363. c:/foo/bar.dll => /path/to/sysroot/foo/bar.dll
  13364. This last lookup makes it possible to not care about the drive
  13365. name, if you don't want or need to.
  13366. The 'set solib-absolute-prefix' command is an alias for 'set
  13367. sysroot'.
  13368. You can set the default system root by using the configure-time
  13369. '--with-sysroot' option. If the system root is inside GDB's
  13370. configured binary prefix (set with '--prefix' or '--exec-prefix'),
  13371. then the default system root will be updated automatically if the
  13372. installed GDB is moved to a new location.
  13373. 'show sysroot'
  13374. Display the current executable and shared library prefix.
  13375. 'set solib-search-path PATH'
  13376. If this variable is set, PATH is a colon-separated list of
  13377. directories to search for shared libraries. 'solib-search-path' is
  13378. used after 'sysroot' fails to locate the library, or if the path to
  13379. the library is relative instead of absolute. If you want to use
  13380. 'solib-search-path' instead of 'sysroot', be sure to set 'sysroot'
  13381. to a nonexistent directory to prevent GDB from finding your host's
  13382. libraries. 'sysroot' is preferred; setting it to a nonexistent
  13383. directory may interfere with automatic loading of shared library
  13384. symbols.
  13385. 'show solib-search-path'
  13386. Display the current shared library search path.
  13387. 'set target-file-system-kind KIND'
  13388. Set assumed file system kind for target reported file names.
  13389. Shared library file names as reported by the target system may not
  13390. make sense as is on the system GDB is running on. For example,
  13391. when remote debugging a target that has MS-DOS based file system
  13392. semantics, from a Unix host, the target may be reporting to GDB a
  13393. list of loaded shared libraries with file names such as
  13394. 'c:\Windows\kernel32.dll'. On Unix hosts, there's no concept of
  13395. drive letters, so the 'c:\' prefix is not normally understood as
  13396. indicating an absolute file name, and neither is the backslash
  13397. normally considered a directory separator character. In that case,
  13398. the native file system would interpret this whole absolute file
  13399. name as a relative file name with no directory components. This
  13400. would make it impossible to point GDB at a copy of the remote
  13401. target's shared libraries on the host using 'set sysroot', and
  13402. impractical with 'set solib-search-path'. Setting
  13403. 'target-file-system-kind' to 'dos-based' tells GDB to interpret
  13404. such file names similarly to how the target would, and to map them
  13405. to file names valid on GDB's native file system semantics. The
  13406. value of KIND can be '"auto"', in addition to one of the supported
  13407. file system kinds. In that case, GDB tries to determine the
  13408. appropriate file system variant based on the current target's
  13409. operating system (*note Configuring the Current ABI: ABI.). The
  13410. supported file system settings are:
  13411. 'unix'
  13412. Instruct GDB to assume the target file system is of Unix kind.
  13413. Only file names starting the forward slash ('/') character are
  13414. considered absolute, and the directory separator character is
  13415. also the forward slash.
  13416. 'dos-based'
  13417. Instruct GDB to assume the target file system is DOS based.
  13418. File names starting with either a forward slash, or a drive
  13419. letter followed by a colon (e.g., 'c:'), are considered
  13420. absolute, and both the slash ('/') and the backslash ('\\')
  13421. characters are considered directory separators.
  13422. 'auto'
  13423. Instruct GDB to use the file system kind associated with the
  13424. target operating system (*note Configuring the Current ABI:
  13425. ABI.). This is the default.
  13426. When processing file names provided by the user, GDB frequently needs
  13427. to compare them to the file names recorded in the program's debug info.
  13428. Normally, GDB compares just the "base names" of the files as strings,
  13429. which is reasonably fast even for very large programs. (The base name
  13430. of a file is the last portion of its name, after stripping all the
  13431. leading directories.) This shortcut in comparison is based upon the
  13432. assumption that files cannot have more than one base name. This is
  13433. usually true, but references to files that use symlinks or similar
  13434. filesystem facilities violate that assumption. If your program records
  13435. files using such facilities, or if you provide file names to GDB using
  13436. symlinks etc., you can set 'basenames-may-differ' to 'true' to instruct
  13437. GDB to completely canonicalize each pair of file names it needs to
  13438. compare. This will make file-name comparisons accurate, but at a price
  13439. of a significant slowdown.
  13440. 'set basenames-may-differ'
  13441. Set whether a source file may have multiple base names.
  13442. 'show basenames-may-differ'
  13443. Show whether a source file may have multiple base names.
  13444. ---------- Footnotes ----------
  13445. (1) Historically the functionality to retrieve binaries from the
  13446. remote system was provided by prefixing PATH with 'remote:'
  13447. 
  13448. File: gdb.info, Node: File Caching, Next: Separate Debug Files, Prev: Files, Up: GDB Files
  13449. 18.2 File Caching
  13450. =================
  13451. To speed up file loading, and reduce memory usage, GDB will reuse the
  13452. 'bfd' objects used to track open files. *Note BFD: (bfd)Top. The
  13453. following commands allow visibility and control of the caching behavior.
  13454. 'maint info bfds'
  13455. This prints information about each 'bfd' object that is known to
  13456. GDB.
  13457. 'maint set bfd-sharing'
  13458. 'maint show bfd-sharing'
  13459. Control whether 'bfd' objects can be shared. When sharing is
  13460. enabled GDB reuses already open 'bfd' objects rather than reopening
  13461. the same file. Turning sharing off does not cause already shared
  13462. 'bfd' objects to be unshared, but all future files that are opened
  13463. will create a new 'bfd' object. Similarly, re-enabling sharing
  13464. does not cause multiple existing 'bfd' objects to be collapsed into
  13465. a single shared 'bfd' object.
  13466. 'set debug bfd-cache LEVEL'
  13467. Turns on debugging of the bfd cache, setting the level to LEVEL.
  13468. 'show debug bfd-cache'
  13469. Show the current debugging level of the bfd cache.
  13470. 
  13471. File: gdb.info, Node: Separate Debug Files, Next: MiniDebugInfo, Prev: File Caching, Up: GDB Files
  13472. 18.3 Debugging Information in Separate Files
  13473. ============================================
  13474. GDB allows you to put a program's debugging information in a file
  13475. separate from the executable itself, in a way that allows GDB to find
  13476. and load the debugging information automatically. Since debugging
  13477. information can be very large--sometimes larger than the executable code
  13478. itself--some systems distribute debugging information for their
  13479. executables in separate files, which users can install only when they
  13480. need to debug a problem.
  13481. GDB supports two ways of specifying the separate debug info file:
  13482. * The executable contains a "debug link" that specifies the name of
  13483. the separate debug info file. The separate debug file's name is
  13484. usually 'EXECUTABLE.debug', where EXECUTABLE is the name of the
  13485. corresponding executable file without leading directories (e.g.,
  13486. 'ls.debug' for '/usr/bin/ls'). In addition, the debug link
  13487. specifies a 32-bit "Cyclic Redundancy Check" (CRC) checksum for the
  13488. debug file, which GDB uses to validate that the executable and the
  13489. debug file came from the same build.
  13490. * The executable contains a "build ID", a unique bit string that is
  13491. also present in the corresponding debug info file. (This is
  13492. supported only on some operating systems, when using the ELF or PE
  13493. file formats for binary files and the GNU Binutils.) For more
  13494. details about this feature, see the description of the '--build-id'
  13495. command-line option in *note Command Line Options: (ld)Options.
  13496. The debug info file's name is not specified explicitly by the build
  13497. ID, but can be computed from the build ID, see below.
  13498. Depending on the way the debug info file is specified, GDB uses two
  13499. different methods of looking for the debug file:
  13500. * For the "debug link" method, GDB looks up the named file in the
  13501. directory of the executable file, then in a subdirectory of that
  13502. directory named '.debug', and finally under each one of the global
  13503. debug directories, in a subdirectory whose name is identical to the
  13504. leading directories of the executable's absolute file name. (On
  13505. MS-Windows/MS-DOS, the drive letter of the executable's leading
  13506. directories is converted to a one-letter subdirectory, i.e.
  13507. 'd:/usr/bin/' is converted to '/d/usr/bin/', because Windows
  13508. filesystems disallow colons in file names.)
  13509. * For the "build ID" method, GDB looks in the '.build-id'
  13510. subdirectory of each one of the global debug directories for a file
  13511. named 'NN/NNNNNNNN.debug', where NN are the first 2 hex characters
  13512. of the build ID bit string, and NNNNNNNN are the rest of the bit
  13513. string. (Real build ID strings are 32 or more hex characters, not
  13514. 10.)
  13515. So, for example, suppose you ask GDB to debug '/usr/bin/ls', which
  13516. has a debug link that specifies the file 'ls.debug', and a build ID
  13517. whose value in hex is 'abcdef1234'. If the list of the global debug
  13518. directories includes '/usr/lib/debug', then GDB will look for the
  13519. following debug information files, in the indicated order:
  13520. - '/usr/lib/debug/.build-id/ab/cdef1234.debug'
  13521. - '/usr/bin/ls.debug'
  13522. - '/usr/bin/.debug/ls.debug'
  13523. - '/usr/lib/debug/usr/bin/ls.debug'.
  13524. Global debugging info directories default to what is set by GDB
  13525. configure option '--with-separate-debug-dir'. During GDB run you can
  13526. also set the global debugging info directories, and view the list GDB is
  13527. currently using.
  13528. 'set debug-file-directory DIRECTORIES'
  13529. Set the directories which GDB searches for separate debugging
  13530. information files to DIRECTORY. Multiple path components can be
  13531. set concatenating them by a path separator.
  13532. 'show debug-file-directory'
  13533. Show the directories GDB searches for separate debugging
  13534. information files.
  13535. A debug link is a special section of the executable file named
  13536. '.gnu_debuglink'. The section must contain:
  13537. * A filename, with any leading directory components removed, followed
  13538. by a zero byte,
  13539. * zero to three bytes of padding, as needed to reach the next
  13540. four-byte boundary within the section, and
  13541. * a four-byte CRC checksum, stored in the same endianness used for
  13542. the executable file itself. The checksum is computed on the
  13543. debugging information file's full contents by the function given
  13544. below, passing zero as the CRC argument.
  13545. Any executable file format can carry a debug link, as long as it can
  13546. contain a section named '.gnu_debuglink' with the contents described
  13547. above.
  13548. The build ID is a special section in the executable file (and in
  13549. other ELF binary files that GDB may consider). This section is often
  13550. named '.note.gnu.build-id', but that name is not mandatory. It contains
  13551. unique identification for the built files--the ID remains the same
  13552. across multiple builds of the same build tree. The default algorithm
  13553. SHA1 produces 160 bits (40 hexadecimal characters) of the content for
  13554. the build ID string. The same section with an identical value is
  13555. present in the original built binary with symbols, in its stripped
  13556. variant, and in the separate debugging information file.
  13557. The debugging information file itself should be an ordinary
  13558. executable, containing a full set of linker symbols, sections, and
  13559. debugging information. The sections of the debugging information file
  13560. should have the same names, addresses, and sizes as the original file,
  13561. but they need not contain any data--much like a '.bss' section in an
  13562. ordinary executable.
  13563. The GNU binary utilities (Binutils) package includes the 'objcopy'
  13564. utility that can produce the separated executable / debugging
  13565. information file pairs using the following commands:
  13566. objcopy --only-keep-debug foo foo.debug
  13567. strip -g foo
  13568. These commands remove the debugging information from the executable file
  13569. 'foo' and place it in the file 'foo.debug'. You can use the first,
  13570. second or both methods to link the two files:
  13571. * The debug link method needs the following additional command to
  13572. also leave behind a debug link in 'foo':
  13573. objcopy --add-gnu-debuglink=foo.debug foo
  13574. Ulrich Drepper's 'elfutils' package, starting with version 0.53,
  13575. contains a version of the 'strip' command such that the command
  13576. 'strip foo -f foo.debug' has the same functionality as the two
  13577. 'objcopy' commands and the 'ln -s' command above, together.
  13578. * Build ID gets embedded into the main executable using 'ld
  13579. --build-id' or the GCC counterpart 'gcc -Wl,--build-id'. Build ID
  13580. support plus compatibility fixes for debug files separation are
  13581. present in GNU binary utilities (Binutils) package since version
  13582. 2.18.
  13583. The CRC used in '.gnu_debuglink' is the CRC-32 defined in IEEE 802.3
  13584. using the polynomial:
  13585. x^{32} + x^{26} + x^{23} + x^{22} + x^{16} + x^{12} + x^{11}
  13586. + x^{10} + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1
  13587. The function is computed byte at a time, taking the least significant
  13588. bit of each byte first. The initial pattern '0xffffffff' is used, to
  13589. ensure leading zeros affect the CRC and the final result is inverted to
  13590. ensure trailing zeros also affect the CRC.
  13591. _Note:_ This is the same CRC polynomial as used in handling the
  13592. "Remote Serial Protocol" 'qCRC' packet (*note qCRC packet::). However
  13593. in the case of the Remote Serial Protocol, the CRC is computed _most_
  13594. significant bit first, and the result is not inverted, so trailing zeros
  13595. have no effect on the CRC value.
  13596. To complete the description, we show below the code of the function
  13597. which produces the CRC used in '.gnu_debuglink'. Inverting the
  13598. initially supplied 'crc' argument means that an initial call to this
  13599. function passing in zero will start computing the CRC using
  13600. '0xffffffff'.
  13601. unsigned long
  13602. gnu_debuglink_crc32 (unsigned long crc,
  13603. unsigned char *buf, size_t len)
  13604. {
  13605. static const unsigned long crc32_table[256] =
  13606. {
  13607. 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
  13608. 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
  13609. 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
  13610. 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
  13611. 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
  13612. 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
  13613. 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
  13614. 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
  13615. 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
  13616. 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
  13617. 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
  13618. 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
  13619. 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
  13620. 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
  13621. 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
  13622. 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
  13623. 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
  13624. 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
  13625. 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
  13626. 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
  13627. 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
  13628. 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
  13629. 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
  13630. 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
  13631. 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
  13632. 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
  13633. 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
  13634. 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
  13635. 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
  13636. 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
  13637. 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
  13638. 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
  13639. 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
  13640. 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
  13641. 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
  13642. 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
  13643. 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
  13644. 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
  13645. 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
  13646. 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
  13647. 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
  13648. 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
  13649. 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
  13650. 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
  13651. 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
  13652. 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
  13653. 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
  13654. 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
  13655. 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
  13656. 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
  13657. 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
  13658. 0x2d02ef8d
  13659. };
  13660. unsigned char *end;
  13661. crc = ~crc & 0xffffffff;
  13662. for (end = buf + len; buf < end; ++buf)
  13663. crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
  13664. return ~crc & 0xffffffff;
  13665. }
  13666. This computation does not apply to the "build ID" method.
  13667. 
  13668. File: gdb.info, Node: MiniDebugInfo, Next: Index Files, Prev: Separate Debug Files, Up: GDB Files
  13669. 18.4 Debugging information in a special section
  13670. ===============================================
  13671. Some systems ship pre-built executables and libraries that have a
  13672. special '.gnu_debugdata' section. This feature is called
  13673. "MiniDebugInfo". This section holds an LZMA-compressed object and is
  13674. used to supply extra symbols for backtraces.
  13675. The intent of this section is to provide extra minimal debugging
  13676. information for use in simple backtraces. It is not intended to be a
  13677. replacement for full separate debugging information (*note Separate
  13678. Debug Files::). The example below shows the intended use; however, GDB
  13679. does not currently put restrictions on what sort of debugging
  13680. information might be included in the section.
  13681. GDB has support for this extension. If the section exists, then it
  13682. is used provided that no other source of debugging information can be
  13683. found, and that GDB was configured with LZMA support.
  13684. This section can be easily created using 'objcopy' and other standard
  13685. utilities:
  13686. # Extract the dynamic symbols from the main binary, there is no need
  13687. # to also have these in the normal symbol table.
  13688. nm -D BINARY --format=posix --defined-only \
  13689. | awk '{ print $1 }' | sort > dynsyms
  13690. # Extract all the text (i.e. function) symbols from the debuginfo.
  13691. # (Note that we actually also accept "D" symbols, for the benefit
  13692. # of platforms like PowerPC64 that use function descriptors.)
  13693. nm BINARY --format=posix --defined-only \
  13694. | awk '{ if ($2 == "T" || $2 == "t" || $2 == "D") print $1 }' \
  13695. | sort > funcsyms
  13696. # Keep all the function symbols not already in the dynamic symbol
  13697. # table.
  13698. comm -13 dynsyms funcsyms > keep_symbols
  13699. # Separate full debug info into debug binary.
  13700. objcopy --only-keep-debug BINARY debug
  13701. # Copy the full debuginfo, keeping only a minimal set of symbols and
  13702. # removing some unnecessary sections.
  13703. objcopy -S --remove-section .gdb_index --remove-section .comment \
  13704. --keep-symbols=keep_symbols debug mini_debuginfo
  13705. # Drop the full debug info from the original binary.
  13706. strip --strip-all -R .comment BINARY
  13707. # Inject the compressed data into the .gnu_debugdata section of the
  13708. # original binary.
  13709. xz mini_debuginfo
  13710. objcopy --add-section .gnu_debugdata=mini_debuginfo.xz BINARY
  13711. 
  13712. File: gdb.info, Node: Index Files, Next: Symbol Errors, Prev: MiniDebugInfo, Up: GDB Files
  13713. 18.5 Index Files Speed Up GDB
  13714. =============================
  13715. When GDB finds a symbol file, it scans the symbols in the file in order
  13716. to construct an internal symbol table. This lets most GDB operations
  13717. work quickly--at the cost of a delay early on. For large programs, this
  13718. delay can be quite lengthy, so GDB provides a way to build an index,
  13719. which speeds up startup.
  13720. For convenience, GDB comes with a program, 'gdb-add-index', which can
  13721. be used to add the index to a symbol file. It takes the symbol file as
  13722. its only argument:
  13723. $ gdb-add-index symfile
  13724. *Note gdb-add-index::.
  13725. It is also possible to do the work manually. Here is what
  13726. 'gdb-add-index' does behind the curtains.
  13727. The index is stored as a section in the symbol file. GDB can write
  13728. the index to a file, then you can put it into the symbol file using
  13729. 'objcopy'.
  13730. To create an index file, use the 'save gdb-index' command:
  13731. 'save gdb-index [-dwarf-5] DIRECTORY'
  13732. Create index files for all symbol files currently known by GDB.
  13733. For each known SYMBOL-FILE, this command by default creates it
  13734. produces a single file 'SYMBOL-FILE.gdb-index'. If you invoke this
  13735. command with the '-dwarf-5' option, it produces 2 files:
  13736. 'SYMBOL-FILE.debug_names' and 'SYMBOL-FILE.debug_str'. The files
  13737. are created in the given DIRECTORY.
  13738. Once you have created an index file you can merge it into your symbol
  13739. file, here named 'symfile', using 'objcopy':
  13740. $ objcopy --add-section .gdb_index=symfile.gdb-index \
  13741. --set-section-flags .gdb_index=readonly symfile symfile
  13742. Or for '-dwarf-5':
  13743. $ objcopy --dump-section .debug_str=symfile.debug_str.new symfile
  13744. $ cat symfile.debug_str >>symfile.debug_str.new
  13745. $ objcopy --add-section .debug_names=symfile.gdb-index \
  13746. --set-section-flags .debug_names=readonly \
  13747. --update-section .debug_str=symfile.debug_str.new symfile symfile
  13748. GDB will normally ignore older versions of '.gdb_index' sections that
  13749. have been deprecated. Usually they are deprecated because they are
  13750. missing a new feature or have performance issues. To tell GDB to use a
  13751. deprecated index section anyway specify 'set
  13752. use-deprecated-index-sections on'. The default is 'off'. This can
  13753. speed up startup, but may result in some functionality being lost.
  13754. *Note Index Section Format::.
  13755. _Warning:_ Setting 'use-deprecated-index-sections' to 'on' must be
  13756. done before gdb reads the file. The following will not work:
  13757. $ gdb -ex "set use-deprecated-index-sections on" <program>
  13758. Instead you must do, for example,
  13759. $ gdb -iex "set use-deprecated-index-sections on" <program>
  13760. There are currently some limitation on indices. They only work when
  13761. for DWARF debugging information, not stabs. And, they do not currently
  13762. work for programs using Ada.
  13763. 18.5.1 Automatic symbol index cache
  13764. -----------------------------------
  13765. It is possible for GDB to automatically save a copy of this index in a
  13766. cache on disk and retrieve it from there when loading the same binary in
  13767. the future. This feature can be turned on with 'set index-cache on'.
  13768. The following commands can be used to tweak the behavior of the index
  13769. cache.
  13770. 'set index-cache on'
  13771. 'set index-cache off'
  13772. Enable or disable the use of the symbol index cache.
  13773. 'set index-cache directory DIRECTORY'
  13774. 'show index-cache directory'
  13775. Set/show the directory where index files will be saved.
  13776. The default value for this directory depends on the host platform.
  13777. On most systems, the index is cached in the 'gdb' subdirectory of
  13778. the directory pointed to by the 'XDG_CACHE_HOME' environment
  13779. variable, if it is defined, else in the '.cache/gdb' subdirectory
  13780. of your home directory. However, on some systems, the default may
  13781. differ according to local convention.
  13782. There is no limit on the disk space used by index cache. It is
  13783. perfectly safe to delete the content of that directory to free up
  13784. disk space.
  13785. 'show index-cache stats'
  13786. Print the number of cache hits and misses since the launch of GDB.
  13787. 
  13788. File: gdb.info, Node: Symbol Errors, Next: Data Files, Prev: Index Files, Up: GDB Files
  13789. 18.6 Errors Reading Symbol Files
  13790. ================================
  13791. While reading a symbol file, GDB occasionally encounters problems, such
  13792. as symbol types it does not recognize, or known bugs in compiler output.
  13793. By default, GDB does not notify you of such problems, since they are
  13794. relatively common and primarily of interest to people debugging
  13795. compilers. If you are interested in seeing information about
  13796. ill-constructed symbol tables, you can either ask GDB to print only one
  13797. message about each such type of problem, no matter how many times the
  13798. problem occurs; or you can ask GDB to print more messages, to see how
  13799. many times the problems occur, with the 'set complaints' command (*note
  13800. Optional Warnings and Messages: Messages/Warnings.).
  13801. The messages currently printed, and their meanings, include:
  13802. 'inner block not inside outer block in SYMBOL'
  13803. The symbol information shows where symbol scopes begin and end
  13804. (such as at the start of a function or a block of statements).
  13805. This error indicates that an inner scope block is not fully
  13806. contained in its outer scope blocks.
  13807. GDB circumvents the problem by treating the inner block as if it
  13808. had the same scope as the outer block. In the error message,
  13809. SYMBOL may be shown as "'(don't know)'" if the outer block is not a
  13810. function.
  13811. 'block at ADDRESS out of order'
  13812. The symbol information for symbol scope blocks should occur in
  13813. order of increasing addresses. This error indicates that it does
  13814. not do so.
  13815. GDB does not circumvent this problem, and has trouble locating
  13816. symbols in the source file whose symbols it is reading. (You can
  13817. often determine what source file is affected by specifying 'set
  13818. verbose on'. *Note Optional Warnings and Messages:
  13819. Messages/Warnings.)
  13820. 'bad block start address patched'
  13821. The symbol information for a symbol scope block has a start address
  13822. smaller than the address of the preceding source line. This is
  13823. known to occur in the SunOS 4.1.1 (and earlier) C compiler.
  13824. GDB circumvents the problem by treating the symbol scope block as
  13825. starting on the previous source line.
  13826. 'bad string table offset in symbol N'
  13827. Symbol number N contains a pointer into the string table which is
  13828. larger than the size of the string table.
  13829. GDB circumvents the problem by considering the symbol to have the
  13830. name 'foo', which may cause other problems if many symbols end up
  13831. with this name.
  13832. 'unknown symbol type 0xNN'
  13833. The symbol information contains new data types that GDB does not
  13834. yet know how to read. '0xNN' is the symbol type of the
  13835. uncomprehended information, in hexadecimal.
  13836. GDB circumvents the error by ignoring this symbol information.
  13837. This usually allows you to debug your program, though certain
  13838. symbols are not accessible. If you encounter such a problem and
  13839. feel like debugging it, you can debug 'gdb' with itself, breakpoint
  13840. on 'complain', then go up to the function 'read_dbx_symtab' and
  13841. examine '*bufp' to see the symbol.
  13842. 'stub type has NULL name'
  13843. GDB could not find the full definition for a struct or class.
  13844. 'const/volatile indicator missing (ok if using g++ v1.x), got...'
  13845. The symbol information for a C++ member function is missing some
  13846. information that recent versions of the compiler should have output
  13847. for it.
  13848. 'info mismatch between compiler and debugger'
  13849. GDB could not parse a type specification output by the compiler.
  13850. 
  13851. File: gdb.info, Node: Data Files, Prev: Symbol Errors, Up: GDB Files
  13852. 18.7 GDB Data Files
  13853. ===================
  13854. GDB will sometimes read an auxiliary data file. These files are kept in
  13855. a directory known as the "data directory".
  13856. You can set the data directory's name, and view the name GDB is
  13857. currently using.
  13858. 'set data-directory DIRECTORY'
  13859. Set the directory which GDB searches for auxiliary data files to
  13860. DIRECTORY.
  13861. 'show data-directory'
  13862. Show the directory GDB searches for auxiliary data files.
  13863. You can set the default data directory by using the configure-time
  13864. '--with-gdb-datadir' option. If the data directory is inside GDB's
  13865. configured binary prefix (set with '--prefix' or '--exec-prefix'), then
  13866. the default data directory will be updated automatically if the
  13867. installed GDB is moved to a new location.
  13868. The data directory may also be specified with the '--data-directory'
  13869. command line option. *Note Mode Options::.
  13870. 
  13871. File: gdb.info, Node: Targets, Next: Remote Debugging, Prev: GDB Files, Up: Top
  13872. 19 Specifying a Debugging Target
  13873. ********************************
  13874. A "target" is the execution environment occupied by your program.
  13875. Often, GDB runs in the same host environment as your program; in that
  13876. case, the debugging target is specified as a side effect when you use
  13877. the 'file' or 'core' commands. When you need more flexibility--for
  13878. example, running GDB on a physically separate host, or controlling a
  13879. standalone system over a serial port or a realtime system over a TCP/IP
  13880. connection--you can use the 'target' command to specify one of the
  13881. target types configured for GDB (*note Commands for Managing Targets:
  13882. Target Commands.).
  13883. It is possible to build GDB for several different "target
  13884. architectures". When GDB is built like that, you can choose one of the
  13885. available architectures with the 'set architecture' command.
  13886. 'set architecture ARCH'
  13887. This command sets the current target architecture to ARCH. The
  13888. value of ARCH can be '"auto"', in addition to one of the supported
  13889. architectures.
  13890. 'show architecture'
  13891. Show the current target architecture.
  13892. 'set processor'
  13893. 'processor'
  13894. These are alias commands for, respectively, 'set architecture' and
  13895. 'show architecture'.
  13896. * Menu:
  13897. * Active Targets:: Active targets
  13898. * Target Commands:: Commands for managing targets
  13899. * Byte Order:: Choosing target byte order
  13900. 
  13901. File: gdb.info, Node: Active Targets, Next: Target Commands, Up: Targets
  13902. 19.1 Active Targets
  13903. ===================
  13904. There are multiple classes of targets such as: processes, executable
  13905. files or recording sessions. Core files belong to the process class,
  13906. making core file and process mutually exclusive. Otherwise, GDB can
  13907. work concurrently on multiple active targets, one in each class. This
  13908. allows you to (for example) start a process and inspect its activity,
  13909. while still having access to the executable file after the process
  13910. finishes. Or if you start process recording (*note Reverse Execution::)
  13911. and 'reverse-step' there, you are presented a virtual layer of the
  13912. recording target, while the process target remains stopped at the
  13913. chronologically last point of the process execution.
  13914. Use the 'core-file' and 'exec-file' commands to select a new core
  13915. file or executable target (*note Commands to Specify Files: Files.). To
  13916. specify as a target a process that is already running, use the 'attach'
  13917. command (*note Debugging an Already-running Process: Attach.).
  13918. 
  13919. File: gdb.info, Node: Target Commands, Next: Byte Order, Prev: Active Targets, Up: Targets
  13920. 19.2 Commands for Managing Targets
  13921. ==================================
  13922. 'target TYPE PARAMETERS'
  13923. Connects the GDB host environment to a target machine or process.
  13924. A target is typically a protocol for talking to debugging
  13925. facilities. You use the argument TYPE to specify the type or
  13926. protocol of the target machine.
  13927. Further PARAMETERS are interpreted by the target protocol, but
  13928. typically include things like device names or host names to connect
  13929. with, process numbers, and baud rates.
  13930. The 'target' command does not repeat if you press <RET> again after
  13931. executing the command.
  13932. 'help target'
  13933. Displays the names of all targets available. To display targets
  13934. currently selected, use either 'info target' or 'info files' (*note
  13935. Commands to Specify Files: Files.).
  13936. 'help target NAME'
  13937. Describe a particular target, including any parameters necessary to
  13938. select it.
  13939. 'set gnutarget ARGS'
  13940. GDB uses its own library BFD to read your files. GDB knows whether
  13941. it is reading an "executable", a "core", or a ".o" file; however,
  13942. you can specify the file format with the 'set gnutarget' command.
  13943. Unlike most 'target' commands, with 'gnutarget' the 'target' refers
  13944. to a program, not a machine.
  13945. _Warning:_ To specify a file format with 'set gnutarget', you
  13946. must know the actual BFD name.
  13947. *Note Commands to Specify Files: Files.
  13948. 'show gnutarget'
  13949. Use the 'show gnutarget' command to display what file format
  13950. 'gnutarget' is set to read. If you have not set 'gnutarget', GDB
  13951. will determine the file format for each file automatically, and
  13952. 'show gnutarget' displays 'The current BFD target is "auto"'.
  13953. Here are some common targets (available, or not, depending on the GDB
  13954. configuration):
  13955. 'target exec PROGRAM'
  13956. An executable file. 'target exec PROGRAM' is the same as
  13957. 'exec-file PROGRAM'.
  13958. 'target core FILENAME'
  13959. A core dump file. 'target core FILENAME' is the same as 'core-file
  13960. FILENAME'.
  13961. 'target remote MEDIUM'
  13962. A remote system connected to GDB via a serial line or network
  13963. connection. This command tells GDB to use its own remote protocol
  13964. over MEDIUM for debugging. *Note Remote Debugging::.
  13965. For example, if you have a board connected to '/dev/ttya' on the
  13966. machine running GDB, you could say:
  13967. target remote /dev/ttya
  13968. 'target remote' supports the 'load' command. This is only useful
  13969. if you have some other way of getting the stub to the target
  13970. system, and you can put it somewhere in memory where it won't get
  13971. clobbered by the download.
  13972. 'target sim [SIMARGS] ...'
  13973. Builtin CPU simulator. GDB includes simulators for most
  13974. architectures. In general,
  13975. target sim
  13976. load
  13977. run
  13978. works; however, you cannot assume that a specific memory map,
  13979. device drivers, or even basic I/O is available, although some
  13980. simulators do provide these. For info about any processor-specific
  13981. simulator details, see the appropriate section in *note Embedded
  13982. Processors: Embedded Processors.
  13983. 'target native'
  13984. Setup for local/native process debugging. Useful to make the 'run'
  13985. command spawn native processes (likewise 'attach', etc.) even when
  13986. 'set auto-connect-native-target' is 'off' (*note set
  13987. auto-connect-native-target::).
  13988. Different targets are available on different configurations of GDB;
  13989. your configuration may have more or fewer targets.
  13990. Many remote targets require you to download the executable's code
  13991. once you've successfully established a connection. You may wish to
  13992. control various aspects of this process.
  13993. 'set hash'
  13994. This command controls whether a hash mark '#' is displayed while
  13995. downloading a file to the remote monitor. If on, a hash mark is
  13996. displayed after each S-record is successfully downloaded to the
  13997. monitor.
  13998. 'show hash'
  13999. Show the current status of displaying the hash mark.
  14000. 'set debug monitor'
  14001. Enable or disable display of communications messages between GDB
  14002. and the remote monitor.
  14003. 'show debug monitor'
  14004. Show the current status of displaying communications between GDB
  14005. and the remote monitor.
  14006. 'load FILENAME OFFSET'
  14007. Depending on what remote debugging facilities are configured into
  14008. GDB, the 'load' command may be available. Where it exists, it is
  14009. meant to make FILENAME (an executable) available for debugging on
  14010. the remote system--by downloading, or dynamic linking, for example.
  14011. 'load' also records the FILENAME symbol table in GDB, like the
  14012. 'add-symbol-file' command.
  14013. If your GDB does not have a 'load' command, attempting to execute
  14014. it gets the error message "'You can't do that when your target is
  14015. ...'"
  14016. The file is loaded at whatever address is specified in the
  14017. executable. For some object file formats, you can specify the load
  14018. address when you link the program; for other formats, like a.out,
  14019. the object file format specifies a fixed address.
  14020. It is also possible to tell GDB to load the executable file at a
  14021. specific offset described by the optional argument OFFSET. When
  14022. OFFSET is provided, FILENAME must also be provided.
  14023. Depending on the remote side capabilities, GDB may be able to load
  14024. programs into flash memory.
  14025. 'load' does not repeat if you press <RET> again after using it.
  14026. 'flash-erase'
  14027. Erases all known flash memory regions on the target.
  14028. 
  14029. File: gdb.info, Node: Byte Order, Prev: Target Commands, Up: Targets
  14030. 19.3 Choosing Target Byte Order
  14031. ===============================
  14032. Some types of processors, such as the MIPS, PowerPC, and Renesas SH,
  14033. offer the ability to run either big-endian or little-endian byte orders.
  14034. Usually the executable or symbol will include a bit to designate the
  14035. endian-ness, and you will not need to worry about which to use.
  14036. However, you may still find it useful to adjust GDB's idea of processor
  14037. endian-ness manually.
  14038. 'set endian big'
  14039. Instruct GDB to assume the target is big-endian.
  14040. 'set endian little'
  14041. Instruct GDB to assume the target is little-endian.
  14042. 'set endian auto'
  14043. Instruct GDB to use the byte order associated with the executable.
  14044. 'show endian'
  14045. Display GDB's current idea of the target byte order.
  14046. If the 'set endian auto' mode is in effect and no executable has been
  14047. selected, then the endianness used is the last one chosen either by one
  14048. of the 'set endian big' and 'set endian little' commands or by inferring
  14049. from the last executable used. If no endianness has been previously
  14050. chosen, then the default for this mode is inferred from the target GDB
  14051. has been built for, and is 'little' if the name of the target CPU has an
  14052. 'el' suffix and 'big' otherwise.
  14053. Note that these commands merely adjust interpretation of symbolic
  14054. data on the host, and that they have absolutely no effect on the target
  14055. system.
  14056. 
  14057. File: gdb.info, Node: Remote Debugging, Next: Configurations, Prev: Targets, Up: Top
  14058. 20 Debugging Remote Programs
  14059. ****************************
  14060. If you are trying to debug a program running on a machine that cannot
  14061. run GDB in the usual way, it is often useful to use remote debugging.
  14062. For example, you might use remote debugging on an operating system
  14063. kernel, or on a small system which does not have a general purpose
  14064. operating system powerful enough to run a full-featured debugger.
  14065. Some configurations of GDB have special serial or TCP/IP interfaces
  14066. to make this work with particular debugging targets. In addition, GDB
  14067. comes with a generic serial protocol (specific to GDB, but not specific
  14068. to any particular target system) which you can use if you write the
  14069. remote stubs--the code that runs on the remote system to communicate
  14070. with GDB.
  14071. Other remote targets may be available in your configuration of GDB;
  14072. use 'help target' to list them.
  14073. * Menu:
  14074. * Connecting:: Connecting to a remote target
  14075. * File Transfer:: Sending files to a remote system
  14076. * Server:: Using the gdbserver program
  14077. * Remote Configuration:: Remote configuration
  14078. * Remote Stub:: Implementing a remote stub
  14079. 
  14080. File: gdb.info, Node: Connecting, Next: File Transfer, Up: Remote Debugging
  14081. 20.1 Connecting to a Remote Target
  14082. ==================================
  14083. This section describes how to connect to a remote target, including the
  14084. types of connections and their differences, how to set up executable and
  14085. symbol files on the host and target, and the commands used for
  14086. connecting to and disconnecting from the remote target.
  14087. 20.1.1 Types of Remote Connections
  14088. ----------------------------------
  14089. GDB supports two types of remote connections, 'target remote' mode and
  14090. 'target extended-remote' mode. Note that many remote targets support
  14091. only 'target remote' mode. There are several major differences between
  14092. the two types of connections, enumerated here:
  14093. Result of detach or program exit
  14094. *With target remote mode:* When the debugged program exits or you
  14095. detach from it, GDB disconnects from the target. When using
  14096. 'gdbserver', 'gdbserver' will exit.
  14097. *With target extended-remote mode:* When the debugged program exits
  14098. or you detach from it, GDB remains connected to the target, even
  14099. though no program is running. You can rerun the program, attach to
  14100. a running program, or use 'monitor' commands specific to the
  14101. target.
  14102. When using 'gdbserver' in this case, it does not exit unless it was
  14103. invoked using the '--once' option. If the '--once' option was not
  14104. used, you can ask 'gdbserver' to exit using the 'monitor exit'
  14105. command (*note Monitor Commands for gdbserver::).
  14106. Specifying the program to debug
  14107. For both connection types you use the 'file' command to specify the
  14108. program on the host system. If you are using 'gdbserver' there are
  14109. some differences in how to specify the location of the program on
  14110. the target.
  14111. *With target remote mode:* You must either specify the program to
  14112. debug on the 'gdbserver' command line or use the '--attach' option
  14113. (*note Attaching to a Running Program: Attaching to a program.).
  14114. *With target extended-remote mode:* You may specify the program to
  14115. debug on the 'gdbserver' command line, or you can load the program
  14116. or attach to it using GDB commands after connecting to 'gdbserver'.
  14117. You can start 'gdbserver' without supplying an initial command to
  14118. run or process ID to attach. To do this, use the '--multi' command
  14119. line option. Then you can connect using 'target extended-remote'
  14120. and start the program you want to debug (see below for details on
  14121. using the 'run' command in this scenario). Note that the
  14122. conditions under which 'gdbserver' terminates depend on how GDB
  14123. connects to it ('target remote' or 'target extended-remote'). The
  14124. '--multi' option to 'gdbserver' has no influence on that.
  14125. The 'run' command
  14126. *With target remote mode:* The 'run' command is not supported.
  14127. Once a connection has been established, you can use all the usual
  14128. GDB commands to examine and change data. The remote program is
  14129. already running, so you can use commands like 'step' and
  14130. 'continue'.
  14131. *With target extended-remote mode:* The 'run' command is supported.
  14132. The 'run' command uses the value set by 'set remote exec-file'
  14133. (*note set remote exec-file::) to select the program to run.
  14134. Command line arguments are supported, except for wildcard expansion
  14135. and I/O redirection (*note Arguments::).
  14136. If you specify the program to debug on the command line, then the
  14137. 'run' command is not required to start execution, and you can
  14138. resume using commands like 'step' and 'continue' as with 'target
  14139. remote' mode.
  14140. Attaching
  14141. *With target remote mode:* The GDB command 'attach' is not
  14142. supported. To attach to a running program using 'gdbserver', you
  14143. must use the '--attach' option (*note Running gdbserver::).
  14144. *With target extended-remote mode:* To attach to a running program,
  14145. you may use the 'attach' command after the connection has been
  14146. established. If you are using 'gdbserver', you may also invoke
  14147. 'gdbserver' using the '--attach' option (*note Running
  14148. gdbserver::).
  14149. 20.1.2 Host and Target Files
  14150. ----------------------------
  14151. GDB, running on the host, needs access to symbol and debugging
  14152. information for your program running on the target. This requires
  14153. access to an unstripped copy of your program, and possibly any
  14154. associated symbol files. Note that this section applies equally to both
  14155. 'target remote' mode and 'target extended-remote' mode.
  14156. Some remote targets (*note qXfer executable filename read::, and
  14157. *note Host I/O Packets::) allow GDB to access program files over the
  14158. same connection used to communicate with GDB. With such a target, if
  14159. the remote program is unstripped, the only command you need is 'target
  14160. remote' (or 'target extended-remote').
  14161. If the remote program is stripped, or the target does not support
  14162. remote program file access, start up GDB using the name of the local
  14163. unstripped copy of your program as the first argument, or use the 'file'
  14164. command. Use 'set sysroot' to specify the location (on the host) of
  14165. target libraries (unless your GDB was compiled with the correct sysroot
  14166. using '--with-sysroot'). Alternatively, you may use 'set
  14167. solib-search-path' to specify how GDB locates target libraries.
  14168. The symbol file and target libraries must exactly match the
  14169. executable and libraries on the target, with one exception: the files on
  14170. the host system should not be stripped, even if the files on the target
  14171. system are. Mismatched or missing files will lead to confusing results
  14172. during debugging. On GNU/Linux targets, mismatched or missing files may
  14173. also prevent 'gdbserver' from debugging multi-threaded programs.
  14174. 20.1.3 Remote Connection Commands
  14175. ---------------------------------
  14176. GDB can communicate with the target over a serial line, a local Unix
  14177. domain socket, or over an IP network using TCP or UDP. In each case,
  14178. GDB uses the same protocol for debugging your program; only the medium
  14179. carrying the debugging packets varies. The 'target remote' and 'target
  14180. extended-remote' commands establish a connection to the target. Both
  14181. commands accept the same arguments, which indicate the medium to use:
  14182. 'target remote SERIAL-DEVICE'
  14183. 'target extended-remote SERIAL-DEVICE'
  14184. Use SERIAL-DEVICE to communicate with the target. For example, to
  14185. use a serial line connected to the device named '/dev/ttyb':
  14186. target remote /dev/ttyb
  14187. If you're using a serial line, you may want to give GDB the
  14188. '--baud' option, or use the 'set serial baud' command (*note set
  14189. serial baud: Remote Configuration.) before the 'target' command.
  14190. 'target remote LOCAL-SOCKET'
  14191. 'target extended-remote LOCAL-SOCKET'
  14192. Use LOCAL-SOCKET to communicate with the target. For example, to
  14193. use a local Unix domain socket bound to the file system entry
  14194. '/tmp/gdb-socket0':
  14195. target remote /tmp/gdb-socket0
  14196. Note that this command has the same form as the command to connect
  14197. to a serial line. GDB will automatically determine which kind of
  14198. file you have specified and will make the appropriate kind of
  14199. connection. This feature is not available if the host system does
  14200. not support Unix domain sockets.
  14201. 'target remote HOST:PORT'
  14202. 'target remote [HOST]:PORT'
  14203. 'target remote tcp:HOST:PORT'
  14204. 'target remote tcp:[HOST]:PORT'
  14205. 'target remote tcp4:HOST:PORT'
  14206. 'target remote tcp6:HOST:PORT'
  14207. 'target remote tcp6:[HOST]:PORT'
  14208. 'target extended-remote HOST:PORT'
  14209. 'target extended-remote [HOST]:PORT'
  14210. 'target extended-remote tcp:HOST:PORT'
  14211. 'target extended-remote tcp:[HOST]:PORT'
  14212. 'target extended-remote tcp4:HOST:PORT'
  14213. 'target extended-remote tcp6:HOST:PORT'
  14214. 'target extended-remote tcp6:[HOST]:PORT'
  14215. Debug using a TCP connection to PORT on HOST. The HOST may be
  14216. either a host name, a numeric IPv4 address, or a numeric IPv6
  14217. address (with or without the square brackets to separate the
  14218. address from the port); PORT must be a decimal number. The HOST
  14219. could be the target machine itself, if it is directly connected to
  14220. the net, or it might be a terminal server which in turn has a
  14221. serial line to the target.
  14222. For example, to connect to port 2828 on a terminal server named
  14223. 'manyfarms':
  14224. target remote manyfarms:2828
  14225. To connect to port 2828 on a terminal server whose address is
  14226. '2001:0db8:85a3:0000:0000:8a2e:0370:7334', you can either use the
  14227. square bracket syntax:
  14228. target remote [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:2828
  14229. or explicitly specify the IPv6 protocol:
  14230. target remote tcp6:2001:0db8:85a3:0000:0000:8a2e:0370:7334:2828
  14231. This last example may be confusing to the reader, because there is
  14232. no visible separation between the hostname and the port number.
  14233. Therefore, we recommend the user to provide IPv6 addresses using
  14234. square brackets for clarity. However, it is important to mention
  14235. that for GDB there is no ambiguity: the number after the last colon
  14236. is considered to be the port number.
  14237. If your remote target is actually running on the same machine as
  14238. your debugger session (e.g. a simulator for your target running on
  14239. the same host), you can omit the hostname. For example, to connect
  14240. to port 1234 on your local machine:
  14241. target remote :1234
  14242. Note that the colon is still required here.
  14243. 'target remote udp:HOST:PORT'
  14244. 'target remote udp:[HOST]:PORT'
  14245. 'target remote udp4:HOST:PORT'
  14246. 'target remote udp6:[HOST]:PORT'
  14247. 'target extended-remote udp:HOST:PORT'
  14248. 'target extended-remote udp:HOST:PORT'
  14249. 'target extended-remote udp:[HOST]:PORT'
  14250. 'target extended-remote udp4:HOST:PORT'
  14251. 'target extended-remote udp6:HOST:PORT'
  14252. 'target extended-remote udp6:[HOST]:PORT'
  14253. Debug using UDP packets to PORT on HOST. For example, to connect
  14254. to UDP port 2828 on a terminal server named 'manyfarms':
  14255. target remote udp:manyfarms:2828
  14256. When using a UDP connection for remote debugging, you should keep
  14257. in mind that the 'U' stands for "Unreliable". UDP can silently
  14258. drop packets on busy or unreliable networks, which will cause havoc
  14259. with your debugging session.
  14260. 'target remote | COMMAND'
  14261. 'target extended-remote | COMMAND'
  14262. Run COMMAND in the background and communicate with it using a pipe.
  14263. The COMMAND is a shell command, to be parsed and expanded by the
  14264. system's command shell, '/bin/sh'; it should expect remote protocol
  14265. packets on its standard input, and send replies on its standard
  14266. output. You could use this to run a stand-alone simulator that
  14267. speaks the remote debugging protocol, to make net connections using
  14268. programs like 'ssh', or for other similar tricks.
  14269. If COMMAND closes its standard output (perhaps by exiting), GDB
  14270. will try to send it a 'SIGTERM' signal. (If the program has
  14271. already exited, this will have no effect.)
  14272. Whenever GDB is waiting for the remote program, if you type the
  14273. interrupt character (often 'Ctrl-c'), GDB attempts to stop the program.
  14274. This may or may not succeed, depending in part on the hardware and the
  14275. serial drivers the remote system uses. If you type the interrupt
  14276. character once again, GDB displays this prompt:
  14277. Interrupted while waiting for the program.
  14278. Give up (and stop debugging it)? (y or n)
  14279. In 'target remote' mode, if you type 'y', GDB abandons the remote
  14280. debugging session. (If you decide you want to try again later, you can
  14281. use 'target remote' again to connect once more.) If you type 'n', GDB
  14282. goes back to waiting.
  14283. In 'target extended-remote' mode, typing 'n' will leave GDB connected
  14284. to the target.
  14285. 'detach'
  14286. When you have finished debugging the remote program, you can use
  14287. the 'detach' command to release it from GDB control. Detaching
  14288. from the target normally resumes its execution, but the results
  14289. will depend on your particular remote stub. After the 'detach'
  14290. command in 'target remote' mode, GDB is free to connect to another
  14291. target. In 'target extended-remote' mode, GDB is still connected
  14292. to the target.
  14293. 'disconnect'
  14294. The 'disconnect' command closes the connection to the target, and
  14295. the target is generally not resumed. It will wait for GDB (this
  14296. instance or another one) to connect and continue debugging. After
  14297. the 'disconnect' command, GDB is again free to connect to another
  14298. target.
  14299. 'monitor CMD'
  14300. This command allows you to send arbitrary commands directly to the
  14301. remote monitor. Since GDB doesn't care about the commands it sends
  14302. like this, this command is the way to extend GDB--you can add new
  14303. commands that only the external monitor will understand and
  14304. implement.
  14305. 
  14306. File: gdb.info, Node: File Transfer, Next: Server, Prev: Connecting, Up: Remote Debugging
  14307. 20.2 Sending files to a remote system
  14308. =====================================
  14309. Some remote targets offer the ability to transfer files over the same
  14310. connection used to communicate with GDB. This is convenient for targets
  14311. accessible through other means, e.g. GNU/Linux systems running
  14312. 'gdbserver' over a network interface. For other targets, e.g. embedded
  14313. devices with only a single serial port, this may be the only way to
  14314. upload or download files.
  14315. Not all remote targets support these commands.
  14316. 'remote put HOSTFILE TARGETFILE'
  14317. Copy file HOSTFILE from the host system (the machine running GDB)
  14318. to TARGETFILE on the target system.
  14319. 'remote get TARGETFILE HOSTFILE'
  14320. Copy file TARGETFILE from the target system to HOSTFILE on the host
  14321. system.
  14322. 'remote delete TARGETFILE'
  14323. Delete TARGETFILE from the target system.
  14324. 
  14325. File: gdb.info, Node: Server, Next: Remote Configuration, Prev: File Transfer, Up: Remote Debugging
  14326. 20.3 Using the 'gdbserver' Program
  14327. ==================================
  14328. 'gdbserver' is a control program for Unix-like systems, which allows you
  14329. to connect your program with a remote GDB via 'target remote' or 'target
  14330. extended-remote'--but without linking in the usual debugging stub.
  14331. 'gdbserver' is not a complete replacement for the debugging stubs,
  14332. because it requires essentially the same operating-system facilities
  14333. that GDB itself does. In fact, a system that can run 'gdbserver' to
  14334. connect to a remote GDB could also run GDB locally! 'gdbserver' is
  14335. sometimes useful nevertheless, because it is a much smaller program than
  14336. GDB itself. It is also easier to port than all of GDB, so you may be
  14337. able to get started more quickly on a new system by using 'gdbserver'.
  14338. Finally, if you develop code for real-time systems, you may find that
  14339. the tradeoffs involved in real-time operation make it more convenient to
  14340. do as much development work as possible on another system, for example
  14341. by cross-compiling. You can use 'gdbserver' to make a similar choice
  14342. for debugging.
  14343. GDB and 'gdbserver' communicate via either a serial line or a TCP
  14344. connection, using the standard GDB remote serial protocol.
  14345. _Warning:_ 'gdbserver' does not have any built-in security. Do not
  14346. run 'gdbserver' connected to any public network; a GDB connection
  14347. to 'gdbserver' provides access to the target system with the same
  14348. privileges as the user running 'gdbserver'.
  14349. 20.3.1 Running 'gdbserver'
  14350. --------------------------
  14351. Run 'gdbserver' on the target system. You need a copy of the program
  14352. you want to debug, including any libraries it requires. 'gdbserver'
  14353. does not need your program's symbol table, so you can strip the program
  14354. if necessary to save space. GDB on the host system does all the symbol
  14355. handling.
  14356. To use the server, you must tell it how to communicate with GDB; the
  14357. name of your program; and the arguments for your program. The usual
  14358. syntax is:
  14359. target> gdbserver COMM PROGRAM [ ARGS ... ]
  14360. COMM is either a device name (to use a serial line), or a TCP
  14361. hostname and portnumber, or '-' or 'stdio' to use stdin/stdout of
  14362. 'gdbserver'. For example, to debug Emacs with the argument 'foo.txt'
  14363. and communicate with GDB over the serial port '/dev/com1':
  14364. target> gdbserver /dev/com1 emacs foo.txt
  14365. 'gdbserver' waits passively for the host GDB to communicate with it.
  14366. To use a TCP connection instead of a serial line:
  14367. target> gdbserver host:2345 emacs foo.txt
  14368. The only difference from the previous example is the first argument,
  14369. specifying that you are communicating with the host GDB via TCP. The
  14370. 'host:2345' argument means that 'gdbserver' is to expect a TCP
  14371. connection from machine 'host' to local TCP port 2345. (Currently, the
  14372. 'host' part is ignored.) You can choose any number you want for the
  14373. port number as long as it does not conflict with any TCP ports already
  14374. in use on the target system (for example, '23' is reserved for
  14375. 'telnet').(1) You must use the same port number with the host GDB
  14376. 'target remote' command.
  14377. The 'stdio' connection is useful when starting 'gdbserver' with ssh:
  14378. (gdb) target remote | ssh -T hostname gdbserver - hello
  14379. The '-T' option to ssh is provided because we don't need a remote
  14380. pty, and we don't want escape-character handling. Ssh does this by
  14381. default when a command is provided, the flag is provided to make it
  14382. explicit. You could elide it if you want to.
  14383. Programs started with stdio-connected gdbserver have '/dev/null' for
  14384. 'stdin', and 'stdout','stderr' are sent back to gdb for display through
  14385. a pipe connected to gdbserver. Both 'stdout' and 'stderr' use the same
  14386. pipe.
  14387. 20.3.1.1 Attaching to a Running Program
  14388. .......................................
  14389. On some targets, 'gdbserver' can also attach to running programs. This
  14390. is accomplished via the '--attach' argument. The syntax is:
  14391. target> gdbserver --attach COMM PID
  14392. PID is the process ID of a currently running process. It isn't
  14393. necessary to point 'gdbserver' at a binary for the running process.
  14394. In 'target extended-remote' mode, you can also attach using the GDB
  14395. attach command (*note Attaching in Types of Remote Connections::).
  14396. You can debug processes by name instead of process ID if your target
  14397. has the 'pidof' utility:
  14398. target> gdbserver --attach COMM `pidof PROGRAM`
  14399. In case more than one copy of PROGRAM is running, or PROGRAM has
  14400. multiple threads, most versions of 'pidof' support the '-s' option to
  14401. only return the first process ID.
  14402. 20.3.1.2 TCP port allocation lifecycle of 'gdbserver'
  14403. .....................................................
  14404. This section applies only when 'gdbserver' is run to listen on a TCP
  14405. port.
  14406. 'gdbserver' normally terminates after all of its debugged processes
  14407. have terminated in 'target remote' mode. On the other hand, for 'target
  14408. extended-remote', 'gdbserver' stays running even with no processes left.
  14409. GDB normally terminates the spawned debugged process on its exit, which
  14410. normally also terminates 'gdbserver' in the 'target remote' mode.
  14411. Therefore, when the connection drops unexpectedly, and GDB cannot ask
  14412. 'gdbserver' to kill its debugged processes, 'gdbserver' stays running
  14413. even in the 'target remote' mode.
  14414. When 'gdbserver' stays running, GDB can connect to it again later.
  14415. Such reconnecting is useful for features like *note disconnected
  14416. tracing::. For completeness, at most one GDB can be connected at a
  14417. time.
  14418. By default, 'gdbserver' keeps the listening TCP port open, so that
  14419. subsequent connections are possible. However, if you start 'gdbserver'
  14420. with the '--once' option, it will stop listening for any further
  14421. connection attempts after connecting to the first GDB session. This
  14422. means no further connections to 'gdbserver' will be possible after the
  14423. first one. It also means 'gdbserver' will terminate after the first
  14424. connection with remote GDB has closed, even for unexpectedly closed
  14425. connections and even in the 'target extended-remote' mode. The '--once'
  14426. option allows reusing the same port number for connecting to multiple
  14427. instances of 'gdbserver' running on the same host, since each instance
  14428. closes its port after the first connection.
  14429. 20.3.1.3 Other Command-Line Arguments for 'gdbserver'
  14430. .....................................................
  14431. You can use the '--multi' option to start 'gdbserver' without specifying
  14432. a program to debug or a process to attach to. Then you can attach in
  14433. 'target extended-remote' mode and run or attach to a program. For more
  14434. information, *note --multi Option in Types of Remote Connnections::.
  14435. The '--debug' option tells 'gdbserver' to display extra status
  14436. information about the debugging process. The '--remote-debug' option
  14437. tells 'gdbserver' to display remote protocol debug output. These
  14438. options are intended for 'gdbserver' development and for bug reports to
  14439. the developers.
  14440. The '--debug-format=option1[,option2,...]' option tells 'gdbserver'
  14441. to include additional information in each output. Possible options are:
  14442. 'none'
  14443. Turn off all extra information in debugging output.
  14444. 'all'
  14445. Turn on all extra information in debugging output.
  14446. 'timestamps'
  14447. Include a timestamp in each line of debugging output.
  14448. Options are processed in order. Thus, for example, if 'none' appears
  14449. last then no additional information is added to debugging output.
  14450. The '--wrapper' option specifies a wrapper to launch programs for
  14451. debugging. The option should be followed by the name of the wrapper,
  14452. then any command-line arguments to pass to the wrapper, then '--'
  14453. indicating the end of the wrapper arguments.
  14454. 'gdbserver' runs the specified wrapper program with a combined
  14455. command line including the wrapper arguments, then the name of the
  14456. program to debug, then any arguments to the program. The wrapper runs
  14457. until it executes your program, and then GDB gains control.
  14458. You can use any program that eventually calls 'execve' with its
  14459. arguments as a wrapper. Several standard Unix utilities do this, e.g.
  14460. 'env' and 'nohup'. Any Unix shell script ending with 'exec "$@"' will
  14461. also work.
  14462. For example, you can use 'env' to pass an environment variable to the
  14463. debugged program, without setting the variable in 'gdbserver''s
  14464. environment:
  14465. $ gdbserver --wrapper env LD_PRELOAD=libtest.so -- :2222 ./testprog
  14466. The '--selftest' option runs the self tests in 'gdbserver':
  14467. $ gdbserver --selftest
  14468. Ran 2 unit tests, 0 failed
  14469. These tests are disabled in release.
  14470. 20.3.2 Connecting to 'gdbserver'
  14471. --------------------------------
  14472. The basic procedure for connecting to the remote target is:
  14473. * Run GDB on the host system.
  14474. * Make sure you have the necessary symbol files (*note Host and
  14475. target files::). Load symbols for your application using the
  14476. 'file' command before you connect. Use 'set sysroot' to locate
  14477. target libraries (unless your GDB was compiled with the correct
  14478. sysroot using '--with-sysroot').
  14479. * Connect to your target (*note Connecting to a Remote Target:
  14480. Connecting.). For TCP connections, you must start up 'gdbserver'
  14481. prior to using the 'target' command. Otherwise you may get an
  14482. error whose text depends on the host system, but which usually
  14483. looks something like 'Connection refused'. Don't use the 'load'
  14484. command in GDB when using 'target remote' mode, since the program
  14485. is already on the target.
  14486. 20.3.3 Monitor Commands for 'gdbserver'
  14487. ---------------------------------------
  14488. During a GDB session using 'gdbserver', you can use the 'monitor'
  14489. command to send special requests to 'gdbserver'. Here are the available
  14490. commands.
  14491. 'monitor help'
  14492. List the available monitor commands.
  14493. 'monitor set debug 0'
  14494. 'monitor set debug 1'
  14495. Disable or enable general debugging messages.
  14496. 'monitor set remote-debug 0'
  14497. 'monitor set remote-debug 1'
  14498. Disable or enable specific debugging messages associated with the
  14499. remote protocol (*note Remote Protocol::).
  14500. 'monitor set debug-format option1[,option2,...]'
  14501. Specify additional text to add to debugging messages. Possible
  14502. options are:
  14503. 'none'
  14504. Turn off all extra information in debugging output.
  14505. 'all'
  14506. Turn on all extra information in debugging output.
  14507. 'timestamps'
  14508. Include a timestamp in each line of debugging output.
  14509. Options are processed in order. Thus, for example, if 'none'
  14510. appears last then no additional information is added to debugging
  14511. output.
  14512. 'monitor set libthread-db-search-path [PATH]'
  14513. When this command is issued, PATH is a colon-separated list of
  14514. directories to search for 'libthread_db' (*note set
  14515. libthread-db-search-path: Threads.). If you omit PATH,
  14516. 'libthread-db-search-path' will be reset to its default value.
  14517. The special entry '$pdir' for 'libthread-db-search-path' is not
  14518. supported in 'gdbserver'.
  14519. 'monitor exit'
  14520. Tell gdbserver to exit immediately. This command should be
  14521. followed by 'disconnect' to close the debugging session.
  14522. 'gdbserver' will detach from any attached processes and kill any
  14523. processes it created. Use 'monitor exit' to terminate 'gdbserver'
  14524. at the end of a multi-process mode debug session.
  14525. 20.3.4 Tracepoints support in 'gdbserver'
  14526. -----------------------------------------
  14527. On some targets, 'gdbserver' supports tracepoints, fast tracepoints and
  14528. static tracepoints.
  14529. For fast or static tracepoints to work, a special library called the
  14530. "in-process agent" (IPA), must be loaded in the inferior process. This
  14531. library is built and distributed as an integral part of 'gdbserver'. In
  14532. addition, support for static tracepoints requires building the
  14533. in-process agent library with static tracepoints support. At present,
  14534. the UST (LTTng Userspace Tracer, <http://lttng.org/ust>) tracing engine
  14535. is supported. This support is automatically available if UST
  14536. development headers are found in the standard include path when
  14537. 'gdbserver' is built, or if 'gdbserver' was explicitly configured using
  14538. '--with-ust' to point at such headers. You can explicitly disable the
  14539. support using '--with-ust=no'.
  14540. There are several ways to load the in-process agent in your program:
  14541. 'Specifying it as dependency at link time'
  14542. You can link your program dynamically with the in-process agent
  14543. library. On most systems, this is accomplished by adding
  14544. '-linproctrace' to the link command.
  14545. 'Using the system's preloading mechanisms'
  14546. You can force loading the in-process agent at startup time by using
  14547. your system's support for preloading shared libraries. Many Unixes
  14548. support the concept of preloading user defined libraries. In most
  14549. cases, you do that by specifying 'LD_PRELOAD=libinproctrace.so' in
  14550. the environment. See also the description of 'gdbserver''s
  14551. '--wrapper' command line option.
  14552. 'Using GDB to force loading the agent at run time'
  14553. On some systems, you can force the inferior to load a shared
  14554. library, by calling a dynamic loader function in the inferior that
  14555. takes care of dynamically looking up and loading a shared library.
  14556. On most Unix systems, the function is 'dlopen'. You'll use the
  14557. 'call' command for that. For example:
  14558. (gdb) call dlopen ("libinproctrace.so", ...)
  14559. Note that on most Unix systems, for the 'dlopen' function to be
  14560. available, the program needs to be linked with '-ldl'.
  14561. On systems that have a userspace dynamic loader, like most Unix
  14562. systems, when you connect to 'gdbserver' using 'target remote', you'll
  14563. find that the program is stopped at the dynamic loader's entry point,
  14564. and no shared library has been loaded in the program's address space
  14565. yet, including the in-process agent. In that case, before being able to
  14566. use any of the fast or static tracepoints features, you need to let the
  14567. loader run and load the shared libraries. The simplest way to do that
  14568. is to run the program to the main procedure. E.g., if debugging a C or
  14569. C++ program, start 'gdbserver' like so:
  14570. $ gdbserver :9999 myprogram
  14571. Start GDB and connect to 'gdbserver' like so, and run to main:
  14572. $ gdb myprogram
  14573. (gdb) target remote myhost:9999
  14574. 0x00007f215893ba60 in ?? () from /lib64/ld-linux-x86-64.so.2
  14575. (gdb) b main
  14576. (gdb) continue
  14577. The in-process tracing agent library should now be loaded into the
  14578. process; you can confirm it with the 'info sharedlibrary' command, which
  14579. will list 'libinproctrace.so' as loaded in the process. You are now
  14580. ready to install fast tracepoints, list static tracepoint markers, probe
  14581. static tracepoints markers, and start tracing.
  14582. ---------- Footnotes ----------
  14583. (1) If you choose a port number that conflicts with another service,
  14584. 'gdbserver' prints an error message and exits.
  14585. 
  14586. File: gdb.info, Node: Remote Configuration, Next: Remote Stub, Prev: Server, Up: Remote Debugging
  14587. 20.4 Remote Configuration
  14588. =========================
  14589. This section documents the configuration options available when
  14590. debugging remote programs. For the options related to the File I/O
  14591. extensions of the remote protocol, see *note system-call-allowed:
  14592. system.
  14593. 'set remoteaddresssize BITS'
  14594. Set the maximum size of address in a memory packet to the specified
  14595. number of bits. GDB will mask off the address bits above that
  14596. number, when it passes addresses to the remote target. The default
  14597. value is the number of bits in the target's address.
  14598. 'show remoteaddresssize'
  14599. Show the current value of remote address size in bits.
  14600. 'set serial baud N'
  14601. Set the baud rate for the remote serial I/O to N baud. The value
  14602. is used to set the speed of the serial port used for debugging
  14603. remote targets.
  14604. 'show serial baud'
  14605. Show the current speed of the remote connection.
  14606. 'set serial parity PARITY'
  14607. Set the parity for the remote serial I/O. Supported values of
  14608. PARITY are: 'even', 'none', and 'odd'. The default is 'none'.
  14609. 'show serial parity'
  14610. Show the current parity of the serial port.
  14611. 'set remotebreak'
  14612. If set to on, GDB sends a 'BREAK' signal to the remote when you
  14613. type 'Ctrl-c' to interrupt the program running on the remote. If
  14614. set to off, GDB sends the 'Ctrl-C' character instead. The default
  14615. is off, since most remote systems expect to see 'Ctrl-C' as the
  14616. interrupt signal.
  14617. 'show remotebreak'
  14618. Show whether GDB sends 'BREAK' or 'Ctrl-C' to interrupt the remote
  14619. program.
  14620. 'set remoteflow on'
  14621. 'set remoteflow off'
  14622. Enable or disable hardware flow control ('RTS'/'CTS') on the serial
  14623. port used to communicate to the remote target.
  14624. 'show remoteflow'
  14625. Show the current setting of hardware flow control.
  14626. 'set remotelogbase BASE'
  14627. Set the base (a.k.a. radix) of logging serial protocol
  14628. communications to BASE. Supported values of BASE are: 'ascii',
  14629. 'octal', and 'hex'. The default is 'ascii'.
  14630. 'show remotelogbase'
  14631. Show the current setting of the radix for logging remote serial
  14632. protocol.
  14633. 'set remotelogfile FILE'
  14634. Record remote serial communications on the named FILE. The default
  14635. is not to record at all.
  14636. 'show remotelogfile'
  14637. Show the current setting of the file name on which to record the
  14638. serial communications.
  14639. 'set remotetimeout NUM'
  14640. Set the timeout limit to wait for the remote target to respond to
  14641. NUM seconds. The default is 2 seconds.
  14642. 'show remotetimeout'
  14643. Show the current number of seconds to wait for the remote target
  14644. responses.
  14645. 'set remote hardware-watchpoint-limit LIMIT'
  14646. 'set remote hardware-breakpoint-limit LIMIT'
  14647. Restrict GDB to using LIMIT remote hardware watchpoints or
  14648. breakpoints. The LIMIT can be set to 0 to disable hardware
  14649. watchpoints or breakpoints, and 'unlimited' for unlimited
  14650. watchpoints or breakpoints.
  14651. 'show remote hardware-watchpoint-limit'
  14652. 'show remote hardware-breakpoint-limit'
  14653. Show the current limit for the number of hardware watchpoints or
  14654. breakpoints that GDB can use.
  14655. 'set remote hardware-watchpoint-length-limit LIMIT'
  14656. Restrict GDB to using LIMIT bytes for the maximum length of a
  14657. remote hardware watchpoint. A LIMIT of 0 disables hardware
  14658. watchpoints and 'unlimited' allows watchpoints of any length.
  14659. 'show remote hardware-watchpoint-length-limit'
  14660. Show the current limit (in bytes) of the maximum length of a remote
  14661. hardware watchpoint.
  14662. 'set remote exec-file FILENAME'
  14663. 'show remote exec-file'
  14664. Select the file used for 'run' with 'target extended-remote'. This
  14665. should be set to a filename valid on the target system. If it is
  14666. not set, the target will use a default filename (e.g. the last
  14667. program run).
  14668. 'set remote interrupt-sequence'
  14669. Allow the user to select one of 'Ctrl-C', a 'BREAK' or 'BREAK-g' as
  14670. the sequence to the remote target in order to interrupt the
  14671. execution. 'Ctrl-C' is a default. Some system prefers 'BREAK'
  14672. which is high level of serial line for some certain time. Linux
  14673. kernel prefers 'BREAK-g', a.k.a Magic SysRq g. It is 'BREAK'
  14674. signal followed by character 'g'.
  14675. 'show interrupt-sequence'
  14676. Show which of 'Ctrl-C', 'BREAK' or 'BREAK-g' is sent by GDB to
  14677. interrupt the remote program. 'BREAK-g' is BREAK signal followed
  14678. by 'g' and also known as Magic SysRq g.
  14679. 'set remote interrupt-on-connect'
  14680. Specify whether interrupt-sequence is sent to remote target when
  14681. GDB connects to it. This is mostly needed when you debug Linux
  14682. kernel. Linux kernel expects 'BREAK' followed by 'g' which is
  14683. known as Magic SysRq g in order to connect GDB.
  14684. 'show interrupt-on-connect'
  14685. Show whether interrupt-sequence is sent to remote target when GDB
  14686. connects to it.
  14687. 'set tcp auto-retry on'
  14688. Enable auto-retry for remote TCP connections. This is useful if
  14689. the remote debugging agent is launched in parallel with GDB; there
  14690. is a race condition because the agent may not become ready to
  14691. accept the connection before GDB attempts to connect. When
  14692. auto-retry is enabled, if the initial attempt to connect fails, GDB
  14693. reattempts to establish the connection using the timeout specified
  14694. by 'set tcp connect-timeout'.
  14695. 'set tcp auto-retry off'
  14696. Do not auto-retry failed TCP connections.
  14697. 'show tcp auto-retry'
  14698. Show the current auto-retry setting.
  14699. 'set tcp connect-timeout SECONDS'
  14700. 'set tcp connect-timeout unlimited'
  14701. Set the timeout for establishing a TCP connection to the remote
  14702. target to SECONDS. The timeout affects both polling to retry
  14703. failed connections (enabled by 'set tcp auto-retry on') and waiting
  14704. for connections that are merely slow to complete, and represents an
  14705. approximate cumulative value. If SECONDS is 'unlimited', there is
  14706. no timeout and GDB will keep attempting to establish a connection
  14707. forever, unless interrupted with 'Ctrl-c'. The default is 15
  14708. seconds.
  14709. 'show tcp connect-timeout'
  14710. Show the current connection timeout setting.
  14711. The GDB remote protocol autodetects the packets supported by your
  14712. debugging stub. If you need to override the autodetection, you can use
  14713. these commands to enable or disable individual packets. Each packet can
  14714. be set to 'on' (the remote target supports this packet), 'off' (the
  14715. remote target does not support this packet), or 'auto' (detect remote
  14716. target support for this packet). They all default to 'auto'. For more
  14717. information about each packet, see *note Remote Protocol::.
  14718. During normal use, you should not have to use any of these commands.
  14719. If you do, that may be a bug in your remote debugging stub, or a bug in
  14720. GDB. You may want to report the problem to the GDB developers.
  14721. For each packet NAME, the command to enable or disable the packet is
  14722. 'set remote NAME-packet'. The available settings are:
  14723. Command Name Remote Packet Related Features
  14724. 'fetch-register' 'p' 'info registers'
  14725. 'set-register' 'P' 'set'
  14726. 'binary-download' 'X' 'load', 'set'
  14727. 'read-aux-vector' 'qXfer:auxv:read' 'info auxv'
  14728. 'symbol-lookup' 'qSymbol' Detecting
  14729. multiple threads
  14730. 'attach' 'vAttach' 'attach'
  14731. 'verbose-resume' 'vCont' Stepping or
  14732. resuming
  14733. multiple threads
  14734. 'run' 'vRun' 'run'
  14735. 'software-breakpoint''Z0' 'break'
  14736. 'hardware-breakpoint''Z1' 'hbreak'
  14737. 'write-watchpoint' 'Z2' 'watch'
  14738. 'read-watchpoint' 'Z3' 'rwatch'
  14739. 'access-watchpoint' 'Z4' 'awatch'
  14740. 'pid-to-exec-file' 'qXfer:exec-file:read' 'attach', 'run'
  14741. 'target-features' 'qXfer:features:read' 'set
  14742. architecture'
  14743. 'library-info' 'qXfer:libraries:read' 'info
  14744. sharedlibrary'
  14745. 'memory-map' 'qXfer:memory-map:read' 'info mem'
  14746. 'read-sdata-object' 'qXfer:sdata:read' 'print $_sdata'
  14747. 'read-spu-object' 'qXfer:spu:read' 'info spu'
  14748. 'write-spu-object' 'qXfer:spu:write' 'info spu'
  14749. 'read-siginfo-object''qXfer:siginfo:read' 'print
  14750. $_siginfo'
  14751. 'write-siginfo-object''qXfer:siginfo:write' 'set $_siginfo'
  14752. 'threads' 'qXfer:threads:read' 'info threads'
  14753. 'get-thread-local- 'qGetTLSAddr' Displaying
  14754. storage-address' '__thread'
  14755. variables
  14756. 'get-thread-information-block-address''qGetTIBAddr'Display
  14757. MS-Windows
  14758. Thread
  14759. Information
  14760. Block.
  14761. 'search-memory' 'qSearch:memory' 'find'
  14762. 'supported-packets' 'qSupported' Remote
  14763. communications
  14764. parameters
  14765. 'catch-syscalls' 'QCatchSyscalls' 'catch syscall'
  14766. 'pass-signals' 'QPassSignals' 'handle SIGNAL'
  14767. 'program-signals' 'QProgramSignals' 'handle SIGNAL'
  14768. 'hostio-close-packet''vFile:close' 'remote get',
  14769. 'remote put'
  14770. 'hostio-open-packet' 'vFile:open' 'remote get',
  14771. 'remote put'
  14772. 'hostio-pread-packet''vFile:pread' 'remote get',
  14773. 'remote put'
  14774. 'hostio-pwrite-packet''vFile:pwrite' 'remote get',
  14775. 'remote put'
  14776. 'hostio-unlink-packet''vFile:unlink' 'remote delete'
  14777. 'hostio-readlink-packet''vFile:readlink' Host I/O
  14778. 'hostio-fstat-packet''vFile:fstat' Host I/O
  14779. 'hostio-setfs-packet''vFile:setfs' Host I/O
  14780. 'noack-packet' 'QStartNoAckMode' Packet
  14781. acknowledgment
  14782. 'osdata' 'qXfer:osdata:read' 'info os'
  14783. 'query-attached' 'qAttached' Querying remote
  14784. process attach
  14785. state.
  14786. 'trace-buffer-size' 'QTBuffer:size' 'set
  14787. trace-buffer-size'
  14788. 'trace-status' 'qTStatus' 'tstatus'
  14789. 'traceframe-info' 'qXfer:traceframe-info:read'Traceframe info
  14790. 'install-in-trace' 'InstallInTrace' Install
  14791. tracepoint in
  14792. tracing
  14793. 'disable-randomization''QDisableRandomization''set
  14794. disable-randomization'
  14795. 'startup-with-shell' 'QStartupWithShell' 'set
  14796. startup-with-shell'
  14797. 'environment-hex-encoded''QEnvironmentHexEncoded''set
  14798. environment'
  14799. 'environment-unset' 'QEnvironmentUnset' 'unset
  14800. environment'
  14801. 'environment-reset' 'QEnvironmentReset' 'Reset the
  14802. inferior
  14803. environment
  14804. (i.e., unset
  14805. user-set
  14806. variables)'
  14807. 'set-working-dir' 'QSetWorkingDir' 'set cwd'
  14808. 'conditional-breakpoints-packet''Z0 and Z1' 'Support for
  14809. target-side
  14810. breakpoint
  14811. condition
  14812. evaluation'
  14813. 'multiprocess-extensions''multiprocess Debug multiple
  14814. extensions' processes and
  14815. remote process
  14816. PID awareness
  14817. 'swbreak-feature' 'swbreak stop reason' 'break'
  14818. 'hwbreak-feature' 'hwbreak stop reason' 'hbreak'
  14819. 'fork-event-feature' 'fork stop reason' 'fork'
  14820. 'vfork-event-feature''vfork stop reason' 'vfork'
  14821. 'exec-event-feature' 'exec stop reason' 'exec'
  14822. 'thread-events' 'QThreadEvents' Tracking thread
  14823. lifetime.
  14824. 'no-resumed-stop-reply''no resumed thread Tracking thread
  14825. left stop reply' lifetime.
  14826. 
  14827. File: gdb.info, Node: Remote Stub, Prev: Remote Configuration, Up: Remote Debugging
  14828. 20.5 Implementing a Remote Stub
  14829. ===============================
  14830. The stub files provided with GDB implement the target side of the
  14831. communication protocol, and the GDB side is implemented in the GDB
  14832. source file 'remote.c'. Normally, you can simply allow these
  14833. subroutines to communicate, and ignore the details. (If you're
  14834. implementing your own stub file, you can still ignore the details: start
  14835. with one of the existing stub files. 'sparc-stub.c' is the best
  14836. organized, and therefore the easiest to read.)
  14837. To debug a program running on another machine (the debugging "target"
  14838. machine), you must first arrange for all the usual prerequisites for the
  14839. program to run by itself. For example, for a C program, you need:
  14840. 1. A startup routine to set up the C runtime environment; these
  14841. usually have a name like 'crt0'. The startup routine may be
  14842. supplied by your hardware supplier, or you may have to write your
  14843. own.
  14844. 2. A C subroutine library to support your program's subroutine calls,
  14845. notably managing input and output.
  14846. 3. A way of getting your program to the other machine--for example, a
  14847. download program. These are often supplied by the hardware
  14848. manufacturer, but you may have to write your own from hardware
  14849. documentation.
  14850. The next step is to arrange for your program to use a serial port to
  14851. communicate with the machine where GDB is running (the "host" machine).
  14852. In general terms, the scheme looks like this:
  14853. _On the host,_
  14854. GDB already understands how to use this protocol; when everything
  14855. else is set up, you can simply use the 'target remote' command
  14856. (*note Specifying a Debugging Target: Targets.).
  14857. _On the target,_
  14858. you must link with your program a few special-purpose subroutines
  14859. that implement the GDB remote serial protocol. The file containing
  14860. these subroutines is called a "debugging stub".
  14861. On certain remote targets, you can use an auxiliary program
  14862. 'gdbserver' instead of linking a stub into your program. *Note
  14863. Using the 'gdbserver' Program: Server, for details.
  14864. The debugging stub is specific to the architecture of the remote
  14865. machine; for example, use 'sparc-stub.c' to debug programs on SPARC
  14866. boards.
  14867. These working remote stubs are distributed with GDB:
  14868. 'i386-stub.c'
  14869. For Intel 386 and compatible architectures.
  14870. 'm68k-stub.c'
  14871. For Motorola 680x0 architectures.
  14872. 'sh-stub.c'
  14873. For Renesas SH architectures.
  14874. 'sparc-stub.c'
  14875. For SPARC architectures.
  14876. 'sparcl-stub.c'
  14877. For Fujitsu SPARCLITE architectures.
  14878. The 'README' file in the GDB distribution may list other recently
  14879. added stubs.
  14880. * Menu:
  14881. * Stub Contents:: What the stub can do for you
  14882. * Bootstrapping:: What you must do for the stub
  14883. * Debug Session:: Putting it all together
  14884. 
  14885. File: gdb.info, Node: Stub Contents, Next: Bootstrapping, Up: Remote Stub
  14886. 20.5.1 What the Stub Can Do for You
  14887. -----------------------------------
  14888. The debugging stub for your architecture supplies these three
  14889. subroutines:
  14890. 'set_debug_traps'
  14891. This routine arranges for 'handle_exception' to run when your
  14892. program stops. You must call this subroutine explicitly in your
  14893. program's startup code.
  14894. 'handle_exception'
  14895. This is the central workhorse, but your program never calls it
  14896. explicitly--the setup code arranges for 'handle_exception' to run
  14897. when a trap is triggered.
  14898. 'handle_exception' takes control when your program stops during
  14899. execution (for example, on a breakpoint), and mediates
  14900. communications with GDB on the host machine. This is where the
  14901. communications protocol is implemented; 'handle_exception' acts as
  14902. the GDB representative on the target machine. It begins by sending
  14903. summary information on the state of your program, then continues to
  14904. execute, retrieving and transmitting any information GDB needs,
  14905. until you execute a GDB command that makes your program resume; at
  14906. that point, 'handle_exception' returns control to your own code on
  14907. the target machine.
  14908. 'breakpoint'
  14909. Use this auxiliary subroutine to make your program contain a
  14910. breakpoint. Depending on the particular situation, this may be the
  14911. only way for GDB to get control. For instance, if your target
  14912. machine has some sort of interrupt button, you won't need to call
  14913. this; pressing the interrupt button transfers control to
  14914. 'handle_exception'--in effect, to GDB. On some machines, simply
  14915. receiving characters on the serial port may also trigger a trap;
  14916. again, in that situation, you don't need to call 'breakpoint' from
  14917. your own program--simply running 'target remote' from the host GDB
  14918. session gets control.
  14919. Call 'breakpoint' if none of these is true, or if you simply want
  14920. to make certain your program stops at a predetermined point for the
  14921. start of your debugging session.
  14922. 
  14923. File: gdb.info, Node: Bootstrapping, Next: Debug Session, Prev: Stub Contents, Up: Remote Stub
  14924. 20.5.2 What You Must Do for the Stub
  14925. ------------------------------------
  14926. The debugging stubs that come with GDB are set up for a particular chip
  14927. architecture, but they have no information about the rest of your
  14928. debugging target machine.
  14929. First of all you need to tell the stub how to communicate with the
  14930. serial port.
  14931. 'int getDebugChar()'
  14932. Write this subroutine to read a single character from the serial
  14933. port. It may be identical to 'getchar' for your target system; a
  14934. different name is used to allow you to distinguish the two if you
  14935. wish.
  14936. 'void putDebugChar(int)'
  14937. Write this subroutine to write a single character to the serial
  14938. port. It may be identical to 'putchar' for your target system; a
  14939. different name is used to allow you to distinguish the two if you
  14940. wish.
  14941. If you want GDB to be able to stop your program while it is running,
  14942. you need to use an interrupt-driven serial driver, and arrange for it to
  14943. stop when it receives a '^C' ('\003', the control-C character). That is
  14944. the character which GDB uses to tell the remote system to stop.
  14945. Getting the debugging target to return the proper status to GDB
  14946. probably requires changes to the standard stub; one quick and dirty way
  14947. is to just execute a breakpoint instruction (the "dirty" part is that
  14948. GDB reports a 'SIGTRAP' instead of a 'SIGINT').
  14949. Other routines you need to supply are:
  14950. 'void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)'
  14951. Write this function to install EXCEPTION_ADDRESS in the exception
  14952. handling tables. You need to do this because the stub does not
  14953. have any way of knowing what the exception handling tables on your
  14954. target system are like (for example, the processor's table might be
  14955. in ROM, containing entries which point to a table in RAM). The
  14956. EXCEPTION_NUMBER specifies the exception which should be changed;
  14957. its meaning is architecture-dependent (for example, different
  14958. numbers might represent divide by zero, misaligned access, etc).
  14959. When this exception occurs, control should be transferred directly
  14960. to EXCEPTION_ADDRESS, and the processor state (stack, registers,
  14961. and so on) should be just as it is when a processor exception
  14962. occurs. So if you want to use a jump instruction to reach
  14963. EXCEPTION_ADDRESS, it should be a simple jump, not a jump to
  14964. subroutine.
  14965. For the 386, EXCEPTION_ADDRESS should be installed as an interrupt
  14966. gate so that interrupts are masked while the handler runs. The
  14967. gate should be at privilege level 0 (the most privileged level).
  14968. The SPARC and 68k stubs are able to mask interrupts themselves
  14969. without help from 'exceptionHandler'.
  14970. 'void flush_i_cache()'
  14971. On SPARC and SPARCLITE only, write this subroutine to flush the
  14972. instruction cache, if any, on your target machine. If there is no
  14973. instruction cache, this subroutine may be a no-op.
  14974. On target machines that have instruction caches, GDB requires this
  14975. function to make certain that the state of your program is stable.
  14976. You must also make sure this library routine is available:
  14977. 'void *memset(void *, int, int)'
  14978. This is the standard library function 'memset' that sets an area of
  14979. memory to a known value. If you have one of the free versions of
  14980. 'libc.a', 'memset' can be found there; otherwise, you must either
  14981. obtain it from your hardware manufacturer, or write your own.
  14982. If you do not use the GNU C compiler, you may need other standard
  14983. library subroutines as well; this varies from one stub to another, but
  14984. in general the stubs are likely to use any of the common library
  14985. subroutines which 'GCC' generates as inline code.
  14986. 
  14987. File: gdb.info, Node: Debug Session, Prev: Bootstrapping, Up: Remote Stub
  14988. 20.5.3 Putting it All Together
  14989. ------------------------------
  14990. In summary, when your program is ready to debug, you must follow these
  14991. steps.
  14992. 1. Make sure you have defined the supporting low-level routines (*note
  14993. What You Must Do for the Stub: Bootstrapping.):
  14994. 'getDebugChar', 'putDebugChar',
  14995. 'flush_i_cache', 'memset', 'exceptionHandler'.
  14996. 2. Insert these lines in your program's startup code, before the main
  14997. procedure is called:
  14998. set_debug_traps();
  14999. breakpoint();
  15000. On some machines, when a breakpoint trap is raised, the hardware
  15001. automatically makes the PC point to the instruction after the
  15002. breakpoint. If your machine doesn't do that, you may need to
  15003. adjust 'handle_exception' to arrange for it to return to the
  15004. instruction after the breakpoint on this first invocation, so that
  15005. your program doesn't keep hitting the initial breakpoint instead of
  15006. making progress.
  15007. 3. For the 680x0 stub only, you need to provide a variable called
  15008. 'exceptionHook'. Normally you just use:
  15009. void (*exceptionHook)() = 0;
  15010. but if before calling 'set_debug_traps', you set it to point to a
  15011. function in your program, that function is called when 'GDB'
  15012. continues after stopping on a trap (for example, bus error). The
  15013. function indicated by 'exceptionHook' is called with one parameter:
  15014. an 'int' which is the exception number.
  15015. 4. Compile and link together: your program, the GDB debugging stub for
  15016. your target architecture, and the supporting subroutines.
  15017. 5. Make sure you have a serial connection between your target machine
  15018. and the GDB host, and identify the serial port on the host.
  15019. 6. Download your program to your target machine (or get it there by
  15020. whatever means the manufacturer provides), and start it.
  15021. 7. Start GDB on the host, and connect to the target (*note Connecting
  15022. to a Remote Target: Connecting.).
  15023. 
  15024. File: gdb.info, Node: Configurations, Next: Controlling GDB, Prev: Remote Debugging, Up: Top
  15025. 21 Configuration-Specific Information
  15026. *************************************
  15027. While nearly all GDB commands are available for all native and cross
  15028. versions of the debugger, there are some exceptions. This chapter
  15029. describes things that are only available in certain configurations.
  15030. There are three major categories of configurations: native
  15031. configurations, where the host and target are the same, embedded
  15032. operating system configurations, which are usually the same for several
  15033. different processor architectures, and bare embedded processors, which
  15034. are quite different from each other.
  15035. * Menu:
  15036. * Native::
  15037. * Embedded OS::
  15038. * Embedded Processors::
  15039. * Architectures::
  15040. 
  15041. File: gdb.info, Node: Native, Next: Embedded OS, Up: Configurations
  15042. 21.1 Native
  15043. ===========
  15044. This section describes details specific to particular native
  15045. configurations.
  15046. * Menu:
  15047. * BSD libkvm Interface:: Debugging BSD kernel memory images
  15048. * Process Information:: Process information
  15049. * DJGPP Native:: Features specific to the DJGPP port
  15050. * Cygwin Native:: Features specific to the Cygwin port
  15051. * Hurd Native:: Features specific to GNU Hurd
  15052. * Darwin:: Features specific to Darwin
  15053. * FreeBSD:: Features specific to FreeBSD
  15054. 
  15055. File: gdb.info, Node: BSD libkvm Interface, Next: Process Information, Up: Native
  15056. 21.1.1 BSD libkvm Interface
  15057. ---------------------------
  15058. BSD-derived systems (FreeBSD/NetBSD/OpenBSD) have a kernel memory
  15059. interface that provides a uniform interface for accessing kernel virtual
  15060. memory images, including live systems and crash dumps. GDB uses this
  15061. interface to allow you to debug live kernels and kernel crash dumps on
  15062. many native BSD configurations. This is implemented as a special 'kvm'
  15063. debugging target. For debugging a live system, load the currently
  15064. running kernel into GDB and connect to the 'kvm' target:
  15065. (gdb) target kvm
  15066. For debugging crash dumps, provide the file name of the crash dump as
  15067. an argument:
  15068. (gdb) target kvm /var/crash/bsd.0
  15069. Once connected to the 'kvm' target, the following commands are
  15070. available:
  15071. 'kvm pcb'
  15072. Set current context from the "Process Control Block" (PCB) address.
  15073. 'kvm proc'
  15074. Set current context from proc address. This command isn't
  15075. available on modern FreeBSD systems.
  15076. 
  15077. File: gdb.info, Node: Process Information, Next: DJGPP Native, Prev: BSD libkvm Interface, Up: Native
  15078. 21.1.2 Process Information
  15079. --------------------------
  15080. Some operating systems provide interfaces to fetch additional
  15081. information about running processes beyond memory and per-thread
  15082. register state. If GDB is configured for an operating system with a
  15083. supported interface, the command 'info proc' is available to report
  15084. information about the process running your program, or about any process
  15085. running on your system.
  15086. One supported interface is a facility called '/proc' that can be used
  15087. to examine the image of a running process using file-system subroutines.
  15088. This facility is supported on GNU/Linux and Solaris systems.
  15089. On FreeBSD systems, system control nodes are used to query process
  15090. information.
  15091. In addition, some systems may provide additional process information
  15092. in core files. Note that a core file may include a subset of the
  15093. information available from a live process. Process information is
  15094. currently avaiable from cores created on GNU/Linux and FreeBSD systems.
  15095. 'info proc'
  15096. 'info proc PROCESS-ID'
  15097. Summarize available information about a process. If a process ID
  15098. is specified by PROCESS-ID, display information about that process;
  15099. otherwise display information about the program being debugged.
  15100. The summary includes the debugged process ID, the command line used
  15101. to invoke it, its current working directory, and its executable
  15102. file's absolute file name.
  15103. On some systems, PROCESS-ID can be of the form '[PID]/TID' which
  15104. specifies a certain thread ID within a process. If the optional
  15105. PID part is missing, it means a thread from the process being
  15106. debugged (the leading '/' still needs to be present, or else GDB
  15107. will interpret the number as a process ID rather than a thread ID).
  15108. 'info proc cmdline'
  15109. Show the original command line of the process. This command is
  15110. supported on GNU/Linux and FreeBSD.
  15111. 'info proc cwd'
  15112. Show the current working directory of the process. This command is
  15113. supported on GNU/Linux and FreeBSD.
  15114. 'info proc exe'
  15115. Show the name of executable of the process. This command is
  15116. supported on GNU/Linux and FreeBSD.
  15117. 'info proc files'
  15118. Show the file descriptors open by the process. For each open file
  15119. descriptor, GDB shows its number, type (file, directory, character
  15120. device, socket), file pointer offset, and the name of the resource
  15121. open on the descriptor. The resource name can be a file name (for
  15122. files, directories, and devices) or a protocol followed by socket
  15123. address (for network connections). This command is supported on
  15124. FreeBSD.
  15125. This example shows the open file descriptors for a process using a
  15126. tty for standard input and output as well as two network sockets:
  15127. (gdb) info proc files 22136
  15128. process 22136
  15129. Open files:
  15130. FD Type Offset Flags Name
  15131. text file - r-------- /usr/bin/ssh
  15132. ctty chr - rw------- /dev/pts/20
  15133. cwd dir - r-------- /usr/home/john
  15134. root dir - r-------- /
  15135. 0 chr 0x32933a4 rw------- /dev/pts/20
  15136. 1 chr 0x32933a4 rw------- /dev/pts/20
  15137. 2 chr 0x32933a4 rw------- /dev/pts/20
  15138. 3 socket 0x0 rw----n-- tcp4 10.0.1.2:53014 -> 10.0.1.10:22
  15139. 4 socket 0x0 rw------- unix stream:/tmp/ssh-FIt89oAzOn5f/agent.2456
  15140. 'info proc mappings'
  15141. Report the memory address space ranges accessible in a process. On
  15142. Solaris and FreeBSD systems, each memory range includes information
  15143. on whether the process has read, write, or execute access rights to
  15144. each range. On GNU/Linux and FreeBSD systems, each memory range
  15145. includes the object file which is mapped to that range.
  15146. 'info proc stat'
  15147. 'info proc status'
  15148. Show additional process-related information, including the user ID
  15149. and group ID; virtual memory usage; the signals that are pending,
  15150. blocked, and ignored; its TTY; its consumption of system and user
  15151. time; its stack size; its 'nice' value; etc. These commands are
  15152. supported on GNU/Linux and FreeBSD.
  15153. For GNU/Linux systems, see the 'proc' man page for more information
  15154. (type 'man 5 proc' from your shell prompt).
  15155. For FreeBSD systems, 'info proc stat' is an alias for 'info proc
  15156. status'.
  15157. 'info proc all'
  15158. Show all the information about the process described under all of
  15159. the above 'info proc' subcommands.
  15160. 'set procfs-trace'
  15161. This command enables and disables tracing of 'procfs' API calls.
  15162. 'show procfs-trace'
  15163. Show the current state of 'procfs' API call tracing.
  15164. 'set procfs-file FILE'
  15165. Tell GDB to write 'procfs' API trace to the named FILE. GDB
  15166. appends the trace info to the previous contents of the file. The
  15167. default is to display the trace on the standard output.
  15168. 'show procfs-file'
  15169. Show the file to which 'procfs' API trace is written.
  15170. 'proc-trace-entry'
  15171. 'proc-trace-exit'
  15172. 'proc-untrace-entry'
  15173. 'proc-untrace-exit'
  15174. These commands enable and disable tracing of entries into and exits
  15175. from the 'syscall' interface.
  15176. 'info pidlist'
  15177. For QNX Neutrino only, this command displays the list of all the
  15178. processes and all the threads within each process.
  15179. 'info meminfo'
  15180. For QNX Neutrino only, this command displays the list of all
  15181. mapinfos.
  15182. 
  15183. File: gdb.info, Node: DJGPP Native, Next: Cygwin Native, Prev: Process Information, Up: Native
  15184. 21.1.3 Features for Debugging DJGPP Programs
  15185. --------------------------------------------
  15186. DJGPP is a port of the GNU development tools to MS-DOS and MS-Windows.
  15187. DJGPP programs are 32-bit protected-mode programs that use the "DPMI"
  15188. (DOS Protected-Mode Interface) API to run on top of real-mode DOS
  15189. systems and their emulations.
  15190. GDB supports native debugging of DJGPP programs, and defines a few
  15191. commands specific to the DJGPP port. This subsection describes those
  15192. commands.
  15193. 'info dos'
  15194. This is a prefix of DJGPP-specific commands which print information
  15195. about the target system and important OS structures.
  15196. 'info dos sysinfo'
  15197. This command displays assorted information about the underlying
  15198. platform: the CPU type and features, the OS version and flavor, the
  15199. DPMI version, and the available conventional and DPMI memory.
  15200. 'info dos gdt'
  15201. 'info dos ldt'
  15202. 'info dos idt'
  15203. These 3 commands display entries from, respectively, Global, Local,
  15204. and Interrupt Descriptor Tables (GDT, LDT, and IDT). The descriptor
  15205. tables are data structures which store a descriptor for each
  15206. segment that is currently in use. The segment's selector is an
  15207. index into a descriptor table; the table entry for that index holds
  15208. the descriptor's base address and limit, and its attributes and
  15209. access rights.
  15210. A typical DJGPP program uses 3 segments: a code segment, a data
  15211. segment (used for both data and the stack), and a DOS segment
  15212. (which allows access to DOS/BIOS data structures and absolute
  15213. addresses in conventional memory). However, the DPMI host will
  15214. usually define additional segments in order to support the DPMI
  15215. environment.
  15216. These commands allow to display entries from the descriptor tables.
  15217. Without an argument, all entries from the specified table are
  15218. displayed. An argument, which should be an integer expression,
  15219. means display a single entry whose index is given by the argument.
  15220. For example, here's a convenient way to display information about
  15221. the debugged program's data segment:
  15222. (gdb) info dos ldt $ds
  15223. 0x13f: base=0x11970000 limit=0x0009ffff 32-Bit Data (Read/Write, Exp-up)
  15224. This comes in handy when you want to see whether a pointer is
  15225. outside the data segment's limit (i.e. "garbled").
  15226. 'info dos pde'
  15227. 'info dos pte'
  15228. These two commands display entries from, respectively, the Page
  15229. Directory and the Page Tables. Page Directories and Page Tables
  15230. are data structures which control how virtual memory addresses are
  15231. mapped into physical addresses. A Page Table includes an entry for
  15232. every page of memory that is mapped into the program's address
  15233. space; there may be several Page Tables, each one holding up to
  15234. 4096 entries. A Page Directory has up to 4096 entries, one each
  15235. for every Page Table that is currently in use.
  15236. Without an argument, 'info dos pde' displays the entire Page
  15237. Directory, and 'info dos pte' displays all the entries in all of
  15238. the Page Tables. An argument, an integer expression, given to the
  15239. 'info dos pde' command means display only that entry from the Page
  15240. Directory table. An argument given to the 'info dos pte' command
  15241. means display entries from a single Page Table, the one pointed to
  15242. by the specified entry in the Page Directory.
  15243. These commands are useful when your program uses "DMA" (Direct
  15244. Memory Access), which needs physical addresses to program the DMA
  15245. controller.
  15246. These commands are supported only with some DPMI servers.
  15247. 'info dos address-pte ADDR'
  15248. This command displays the Page Table entry for a specified linear
  15249. address. The argument ADDR is a linear address which should
  15250. already have the appropriate segment's base address added to it,
  15251. because this command accepts addresses which may belong to _any_
  15252. segment. For example, here's how to display the Page Table entry
  15253. for the page where a variable 'i' is stored:
  15254. (gdb) info dos address-pte __djgpp_base_address + (char *)&i
  15255. Page Table entry for address 0x11a00d30:
  15256. Base=0x02698000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0xd30
  15257. This says that 'i' is stored at offset '0xd30' from the page whose
  15258. physical base address is '0x02698000', and shows all the attributes
  15259. of that page.
  15260. Note that you must cast the addresses of variables to a 'char *',
  15261. since otherwise the value of '__djgpp_base_address', the base
  15262. address of all variables and functions in a DJGPP program, will be
  15263. added using the rules of C pointer arithmetics: if 'i' is declared
  15264. an 'int', GDB will add 4 times the value of '__djgpp_base_address'
  15265. to the address of 'i'.
  15266. Here's another example, it displays the Page Table entry for the
  15267. transfer buffer:
  15268. (gdb) info dos address-pte *((unsigned *)&_go32_info_block + 3)
  15269. Page Table entry for address 0x29110:
  15270. Base=0x00029000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0x110
  15271. (The '+ 3' offset is because the transfer buffer's address is the
  15272. 3rd member of the '_go32_info_block' structure.) The output
  15273. clearly shows that this DPMI server maps the addresses in
  15274. conventional memory 1:1, i.e. the physical ('0x00029000' + '0x110')
  15275. and linear ('0x29110') addresses are identical.
  15276. This command is supported only with some DPMI servers.
  15277. In addition to native debugging, the DJGPP port supports remote
  15278. debugging via a serial data link. The following commands are specific
  15279. to remote serial debugging in the DJGPP port of GDB.
  15280. 'set com1base ADDR'
  15281. This command sets the base I/O port address of the 'COM1' serial
  15282. port.
  15283. 'set com1irq IRQ'
  15284. This command sets the "Interrupt Request" ('IRQ') line to use for
  15285. the 'COM1' serial port.
  15286. There are similar commands 'set com2base', 'set com3irq', etc. for
  15287. setting the port address and the 'IRQ' lines for the other 3 COM
  15288. ports.
  15289. The related commands 'show com1base', 'show com1irq' etc. display
  15290. the current settings of the base address and the 'IRQ' lines used
  15291. by the COM ports.
  15292. 'info serial'
  15293. This command prints the status of the 4 DOS serial ports. For each
  15294. port, it prints whether it's active or not, its I/O base address
  15295. and IRQ number, whether it uses a 16550-style FIFO, its baudrate,
  15296. and the counts of various errors encountered so far.
  15297. 
  15298. File: gdb.info, Node: Cygwin Native, Next: Hurd Native, Prev: DJGPP Native, Up: Native
  15299. 21.1.4 Features for Debugging MS Windows PE Executables
  15300. -------------------------------------------------------
  15301. GDB supports native debugging of MS Windows programs, including DLLs
  15302. with and without symbolic debugging information.
  15303. MS-Windows programs that call 'SetConsoleMode' to switch off the
  15304. special meaning of the 'Ctrl-C' keystroke cannot be interrupted by
  15305. typing 'C-c'. For this reason, GDB on MS-Windows supports 'C-<BREAK>'
  15306. as an alternative interrupt key sequence, which can be used to interrupt
  15307. the debuggee even if it ignores 'C-c'.
  15308. There are various additional Cygwin-specific commands, described in
  15309. this section. Working with DLLs that have no debugging symbols is
  15310. described in *note Non-debug DLL Symbols::.
  15311. 'info w32'
  15312. This is a prefix of MS Windows-specific commands which print
  15313. information about the target system and important OS structures.
  15314. 'info w32 selector'
  15315. This command displays information returned by the Win32 API
  15316. 'GetThreadSelectorEntry' function. It takes an optional argument
  15317. that is evaluated to a long value to give the information about
  15318. this given selector. Without argument, this command displays
  15319. information about the six segment registers.
  15320. 'info w32 thread-information-block'
  15321. This command displays thread specific information stored in the
  15322. Thread Information Block (readable on the X86 CPU family using
  15323. '$fs' selector for 32-bit programs and '$gs' for 64-bit programs).
  15324. 'signal-event ID'
  15325. This command signals an event with user-provided ID. Used to
  15326. resume crashing process when attached to it using MS-Windows JIT
  15327. debugging (AeDebug).
  15328. To use it, create or edit the following keys in
  15329. 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug' and/or
  15330. 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows
  15331. NT\CurrentVersion\AeDebug' (for x86_64 versions):
  15332. - 'Debugger' (REG_SZ) -- a command to launch the debugger.
  15333. Suggested command is: 'FULLY-QUALIFIED-PATH-TO-GDB.EXE -ex
  15334. "attach %ld" -ex "signal-event %ld" -ex "continue"'.
  15335. The first '%ld' will be replaced by the process ID of the
  15336. crashing process, the second '%ld' will be replaced by the ID
  15337. of the event that blocks the crashing process, waiting for GDB
  15338. to attach.
  15339. - 'Auto' (REG_SZ) -- either '1' or '0'. '1' will make the
  15340. system run debugger specified by the Debugger key
  15341. automatically, '0' will cause a dialog box with "OK" and
  15342. "Cancel" buttons to appear, which allows the user to either
  15343. terminate the crashing process (OK) or debug it (Cancel).
  15344. 'set cygwin-exceptions MODE'
  15345. If MODE is 'on', GDB will break on exceptions that happen inside
  15346. the Cygwin DLL. If MODE is 'off', GDB will delay recognition of
  15347. exceptions, and may ignore some exceptions which seem to be caused
  15348. by internal Cygwin DLL "bookkeeping". This option is meant
  15349. primarily for debugging the Cygwin DLL itself; the default value is
  15350. 'off' to avoid annoying GDB users with false 'SIGSEGV' signals.
  15351. 'show cygwin-exceptions'
  15352. Displays whether GDB will break on exceptions that happen inside
  15353. the Cygwin DLL itself.
  15354. 'set new-console MODE'
  15355. If MODE is 'on' the debuggee will be started in a new console on
  15356. next start. If MODE is 'off', the debuggee will be started in the
  15357. same console as the debugger.
  15358. 'show new-console'
  15359. Displays whether a new console is used when the debuggee is
  15360. started.
  15361. 'set new-group MODE'
  15362. This boolean value controls whether the debuggee should start a new
  15363. group or stay in the same group as the debugger. This affects the
  15364. way the Windows OS handles 'Ctrl-C'.
  15365. 'show new-group'
  15366. Displays current value of new-group boolean.
  15367. 'set debugevents'
  15368. This boolean value adds debug output concerning kernel events
  15369. related to the debuggee seen by the debugger. This includes events
  15370. that signal thread and process creation and exit, DLL loading and
  15371. unloading, console interrupts, and debugging messages produced by
  15372. the Windows 'OutputDebugString' API call.
  15373. 'set debugexec'
  15374. This boolean value adds debug output concerning execute events
  15375. (such as resume thread) seen by the debugger.
  15376. 'set debugexceptions'
  15377. This boolean value adds debug output concerning exceptions in the
  15378. debuggee seen by the debugger.
  15379. 'set debugmemory'
  15380. This boolean value adds debug output concerning debuggee memory
  15381. reads and writes by the debugger.
  15382. 'set shell'
  15383. This boolean values specifies whether the debuggee is called via a
  15384. shell or directly (default value is on).
  15385. 'show shell'
  15386. Displays if the debuggee will be started with a shell.
  15387. * Menu:
  15388. * Non-debug DLL Symbols:: Support for DLLs without debugging symbols
  15389. 
  15390. File: gdb.info, Node: Non-debug DLL Symbols, Up: Cygwin Native
  15391. 21.1.4.1 Support for DLLs without Debugging Symbols
  15392. ...................................................
  15393. Very often on windows, some of the DLLs that your program relies on do
  15394. not include symbolic debugging information (for example,
  15395. 'kernel32.dll'). When GDB doesn't recognize any debugging symbols in a
  15396. DLL, it relies on the minimal amount of symbolic information contained
  15397. in the DLL's export table. This section describes working with such
  15398. symbols, known internally to GDB as "minimal symbols".
  15399. Note that before the debugged program has started execution, no DLLs
  15400. will have been loaded. The easiest way around this problem is simply to
  15401. start the program -- either by setting a breakpoint or letting the
  15402. program run once to completion.
  15403. 21.1.4.2 DLL Name Prefixes
  15404. ..........................
  15405. In keeping with the naming conventions used by the Microsoft debugging
  15406. tools, DLL export symbols are made available with a prefix based on the
  15407. DLL name, for instance 'KERNEL32!CreateFileA'. The plain name is also
  15408. entered into the symbol table, so 'CreateFileA' is often sufficient. In
  15409. some cases there will be name clashes within a program (particularly if
  15410. the executable itself includes full debugging symbols) necessitating the
  15411. use of the fully qualified name when referring to the contents of the
  15412. DLL. Use single-quotes around the name to avoid the exclamation mark
  15413. ("!") being interpreted as a language operator.
  15414. Note that the internal name of the DLL may be all upper-case, even
  15415. though the file name of the DLL is lower-case, or vice-versa. Since
  15416. symbols within GDB are _case-sensitive_ this may cause some confusion.
  15417. If in doubt, try the 'info functions' and 'info variables' commands or
  15418. even 'maint print msymbols' (*note Symbols::). Here's an example:
  15419. (gdb) info function CreateFileA
  15420. All functions matching regular expression "CreateFileA":
  15421. Non-debugging symbols:
  15422. 0x77e885f4 CreateFileA
  15423. 0x77e885f4 KERNEL32!CreateFileA
  15424. (gdb) info function !
  15425. All functions matching regular expression "!":
  15426. Non-debugging symbols:
  15427. 0x6100114c cygwin1!__assert
  15428. 0x61004034 cygwin1!_dll_crt0@0
  15429. 0x61004240 cygwin1!dll_crt0(per_process *)
  15430. [etc...]
  15431. 21.1.4.3 Working with Minimal Symbols
  15432. .....................................
  15433. Symbols extracted from a DLL's export table do not contain very much
  15434. type information. All that GDB can do is guess whether a symbol refers
  15435. to a function or variable depending on the linker section that contains
  15436. the symbol. Also note that the actual contents of the memory contained
  15437. in a DLL are not available unless the program is running. This means
  15438. that you cannot examine the contents of a variable or disassemble a
  15439. function within a DLL without a running program.
  15440. Variables are generally treated as pointers and dereferenced
  15441. automatically. For this reason, it is often necessary to prefix a
  15442. variable name with the address-of operator ("&") and provide explicit
  15443. type information in the command. Here's an example of the type of
  15444. problem:
  15445. (gdb) print 'cygwin1!__argv'
  15446. 'cygwin1!__argv' has unknown type; cast it to its declared type
  15447. (gdb) x 'cygwin1!__argv'
  15448. 'cygwin1!__argv' has unknown type; cast it to its declared type
  15449. And two possible solutions:
  15450. (gdb) print ((char **)'cygwin1!__argv')[0]
  15451. $2 = 0x22fd98 "/cygdrive/c/mydirectory/myprogram"
  15452. (gdb) x/2x &'cygwin1!__argv'
  15453. 0x610c0aa8 <cygwin1!__argv>: 0x10021608 0x00000000
  15454. (gdb) x/x 0x10021608
  15455. 0x10021608: 0x0022fd98
  15456. (gdb) x/s 0x0022fd98
  15457. 0x22fd98: "/cygdrive/c/mydirectory/myprogram"
  15458. Setting a break point within a DLL is possible even before the
  15459. program starts execution. However, under these circumstances, GDB can't
  15460. examine the initial instructions of the function in order to skip the
  15461. function's frame set-up code. You can work around this by using "*&" to
  15462. set the breakpoint at a raw memory address:
  15463. (gdb) break *&'python22!PyOS_Readline'
  15464. Breakpoint 1 at 0x1e04eff0
  15465. The author of these extensions is not entirely convinced that setting
  15466. a break point within a shared DLL like 'kernel32.dll' is completely
  15467. safe.
  15468. 
  15469. File: gdb.info, Node: Hurd Native, Next: Darwin, Prev: Cygwin Native, Up: Native
  15470. 21.1.5 Commands Specific to GNU Hurd Systems
  15471. --------------------------------------------
  15472. This subsection describes GDB commands specific to the GNU Hurd native
  15473. debugging.
  15474. 'set signals'
  15475. 'set sigs'
  15476. This command toggles the state of inferior signal interception by
  15477. GDB. Mach exceptions, such as breakpoint traps, are not affected
  15478. by this command. 'sigs' is a shorthand alias for 'signals'.
  15479. 'show signals'
  15480. 'show sigs'
  15481. Show the current state of intercepting inferior's signals.
  15482. 'set signal-thread'
  15483. 'set sigthread'
  15484. This command tells GDB which thread is the 'libc' signal thread.
  15485. That thread is run when a signal is delivered to a running process.
  15486. 'set sigthread' is the shorthand alias of 'set signal-thread'.
  15487. 'show signal-thread'
  15488. 'show sigthread'
  15489. These two commands show which thread will run when the inferior is
  15490. delivered a signal.
  15491. 'set stopped'
  15492. This commands tells GDB that the inferior process is stopped, as
  15493. with the 'SIGSTOP' signal. The stopped process can be continued by
  15494. delivering a signal to it.
  15495. 'show stopped'
  15496. This command shows whether GDB thinks the debuggee is stopped.
  15497. 'set exceptions'
  15498. Use this command to turn off trapping of exceptions in the
  15499. inferior. When exception trapping is off, neither breakpoints nor
  15500. single-stepping will work. To restore the default, set exception
  15501. trapping on.
  15502. 'show exceptions'
  15503. Show the current state of trapping exceptions in the inferior.
  15504. 'set task pause'
  15505. This command toggles task suspension when GDB has control. Setting
  15506. it to on takes effect immediately, and the task is suspended
  15507. whenever GDB gets control. Setting it to off will take effect the
  15508. next time the inferior is continued. If this option is set to off,
  15509. you can use 'set thread default pause on' or 'set thread pause on'
  15510. (see below) to pause individual threads.
  15511. 'show task pause'
  15512. Show the current state of task suspension.
  15513. 'set task detach-suspend-count'
  15514. This command sets the suspend count the task will be left with when
  15515. GDB detaches from it.
  15516. 'show task detach-suspend-count'
  15517. Show the suspend count the task will be left with when detaching.
  15518. 'set task exception-port'
  15519. 'set task excp'
  15520. This command sets the task exception port to which GDB will forward
  15521. exceptions. The argument should be the value of the "send rights"
  15522. of the task. 'set task excp' is a shorthand alias.
  15523. 'set noninvasive'
  15524. This command switches GDB to a mode that is the least invasive as
  15525. far as interfering with the inferior is concerned. This is the
  15526. same as using 'set task pause', 'set exceptions', and 'set signals'
  15527. to values opposite to the defaults.
  15528. 'info send-rights'
  15529. 'info receive-rights'
  15530. 'info port-rights'
  15531. 'info port-sets'
  15532. 'info dead-names'
  15533. 'info ports'
  15534. 'info psets'
  15535. These commands display information about, respectively, send
  15536. rights, receive rights, port rights, port sets, and dead names of a
  15537. task. There are also shorthand aliases: 'info ports' for 'info
  15538. port-rights' and 'info psets' for 'info port-sets'.
  15539. 'set thread pause'
  15540. This command toggles current thread suspension when GDB has
  15541. control. Setting it to on takes effect immediately, and the
  15542. current thread is suspended whenever GDB gets control. Setting it
  15543. to off will take effect the next time the inferior is continued.
  15544. Normally, this command has no effect, since when GDB has control,
  15545. the whole task is suspended. However, if you used 'set task pause
  15546. off' (see above), this command comes in handy to suspend only the
  15547. current thread.
  15548. 'show thread pause'
  15549. This command shows the state of current thread suspension.
  15550. 'set thread run'
  15551. This command sets whether the current thread is allowed to run.
  15552. 'show thread run'
  15553. Show whether the current thread is allowed to run.
  15554. 'set thread detach-suspend-count'
  15555. This command sets the suspend count GDB will leave on a thread when
  15556. detaching. This number is relative to the suspend count found by
  15557. GDB when it notices the thread; use 'set thread
  15558. takeover-suspend-count' to force it to an absolute value.
  15559. 'show thread detach-suspend-count'
  15560. Show the suspend count GDB will leave on the thread when detaching.
  15561. 'set thread exception-port'
  15562. 'set thread excp'
  15563. Set the thread exception port to which to forward exceptions. This
  15564. overrides the port set by 'set task exception-port' (see above).
  15565. 'set thread excp' is the shorthand alias.
  15566. 'set thread takeover-suspend-count'
  15567. Normally, GDB's thread suspend counts are relative to the value GDB
  15568. finds when it notices each thread. This command changes the
  15569. suspend counts to be absolute instead.
  15570. 'set thread default'
  15571. 'show thread default'
  15572. Each of the above 'set thread' commands has a 'set thread default'
  15573. counterpart (e.g., 'set thread default pause', 'set thread default
  15574. exception-port', etc.). The 'thread default' variety of commands
  15575. sets the default thread properties for all threads; you can then
  15576. change the properties of individual threads with the non-default
  15577. commands.
  15578. 
  15579. File: gdb.info, Node: Darwin, Next: FreeBSD, Prev: Hurd Native, Up: Native
  15580. 21.1.6 Darwin
  15581. -------------
  15582. GDB provides the following commands specific to the Darwin target:
  15583. 'set debug darwin NUM'
  15584. When set to a non zero value, enables debugging messages specific
  15585. to the Darwin support. Higher values produce more verbose output.
  15586. 'show debug darwin'
  15587. Show the current state of Darwin messages.
  15588. 'set debug mach-o NUM'
  15589. When set to a non zero value, enables debugging messages while GDB
  15590. is reading Darwin object files. ("Mach-O" is the file format used
  15591. on Darwin for object and executable files.) Higher values produce
  15592. more verbose output. This is a command to diagnose problems
  15593. internal to GDB and should not be needed in normal usage.
  15594. 'show debug mach-o'
  15595. Show the current state of Mach-O file messages.
  15596. 'set mach-exceptions on'
  15597. 'set mach-exceptions off'
  15598. On Darwin, faults are first reported as a Mach exception and are
  15599. then mapped to a Posix signal. Use this command to turn on
  15600. trapping of Mach exceptions in the inferior. This might be
  15601. sometimes useful to better understand the cause of a fault. The
  15602. default is off.
  15603. 'show mach-exceptions'
  15604. Show the current state of exceptions trapping.
  15605. 
  15606. File: gdb.info, Node: FreeBSD, Prev: Darwin, Up: Native
  15607. 21.1.7 FreeBSD
  15608. --------------
  15609. When the ABI of a system call is changed in the FreeBSD kernel, this is
  15610. implemented by leaving a compatibility system call using the old ABI at
  15611. the existing number and allocating a new system call number for the
  15612. version using the new ABI. As a convenience, when a system call is
  15613. caught by name (*note catch syscall::), compatibility system calls are
  15614. also caught.
  15615. For example, FreeBSD 12 introduced a new variant of the 'kevent'
  15616. system call and catching the 'kevent' system call by name catches both
  15617. variants:
  15618. (gdb) catch syscall kevent
  15619. Catchpoint 1 (syscalls 'freebsd11_kevent' [363] 'kevent' [560])
  15620. (gdb)
  15621. 
  15622. File: gdb.info, Node: Embedded OS, Next: Embedded Processors, Prev: Native, Up: Configurations
  15623. 21.2 Embedded Operating Systems
  15624. ===============================
  15625. This section describes configurations involving the debugging of
  15626. embedded operating systems that are available for several different
  15627. architectures.
  15628. GDB includes the ability to debug programs running on various
  15629. real-time operating systems.
  15630. 
  15631. File: gdb.info, Node: Embedded Processors, Next: Architectures, Prev: Embedded OS, Up: Configurations
  15632. 21.3 Embedded Processors
  15633. ========================
  15634. This section goes into details specific to particular embedded
  15635. configurations.
  15636. Whenever a specific embedded processor has a simulator, GDB allows to
  15637. send an arbitrary command to the simulator.
  15638. 'sim COMMAND'
  15639. Send an arbitrary COMMAND string to the simulator. Consult the
  15640. documentation for the specific simulator in use for information
  15641. about acceptable commands.
  15642. * Menu:
  15643. * ARC:: Synopsys ARC
  15644. * ARM:: ARM
  15645. * M68K:: Motorola M68K
  15646. * MicroBlaze:: Xilinx MicroBlaze
  15647. * MIPS Embedded:: MIPS Embedded
  15648. * OpenRISC 1000:: OpenRISC 1000 (or1k)
  15649. * PowerPC Embedded:: PowerPC Embedded
  15650. * AVR:: Atmel AVR
  15651. * CRIS:: CRIS
  15652. * Super-H:: Renesas Super-H
  15653. 
  15654. File: gdb.info, Node: ARC, Next: ARM, Up: Embedded Processors
  15655. 21.3.1 Synopsys ARC
  15656. -------------------
  15657. GDB provides the following ARC-specific commands:
  15658. 'set debug arc'
  15659. Control the level of ARC specific debug messages. Use 0 for no
  15660. messages (the default), 1 for debug messages, and 2 for even more
  15661. debug messages.
  15662. 'show debug arc'
  15663. Show the level of ARC specific debugging in operation.
  15664. 'maint print arc arc-instruction ADDRESS'
  15665. Print internal disassembler information about instruction at a
  15666. given address.
  15667. 
  15668. File: gdb.info, Node: ARM, Next: M68K, Prev: ARC, Up: Embedded Processors
  15669. 21.3.2 ARM
  15670. ----------
  15671. GDB provides the following ARM-specific commands:
  15672. 'set arm disassembler'
  15673. This commands selects from a list of disassembly styles. The
  15674. '"std"' style is the standard style.
  15675. 'show arm disassembler'
  15676. Show the current disassembly style.
  15677. 'set arm apcs32'
  15678. This command toggles ARM operation mode between 32-bit and 26-bit.
  15679. 'show arm apcs32'
  15680. Display the current usage of the ARM 32-bit mode.
  15681. 'set arm fpu FPUTYPE'
  15682. This command sets the ARM floating-point unit (FPU) type. The
  15683. argument FPUTYPE can be one of these:
  15684. 'auto'
  15685. Determine the FPU type by querying the OS ABI.
  15686. 'softfpa'
  15687. Software FPU, with mixed-endian doubles on little-endian ARM
  15688. processors.
  15689. 'fpa'
  15690. GCC-compiled FPA co-processor.
  15691. 'softvfp'
  15692. Software FPU with pure-endian doubles.
  15693. 'vfp'
  15694. VFP co-processor.
  15695. 'show arm fpu'
  15696. Show the current type of the FPU.
  15697. 'set arm abi'
  15698. This command forces GDB to use the specified ABI.
  15699. 'show arm abi'
  15700. Show the currently used ABI.
  15701. 'set arm fallback-mode (arm|thumb|auto)'
  15702. GDB uses the symbol table, when available, to determine whether
  15703. instructions are ARM or Thumb. This command controls GDB's default
  15704. behavior when the symbol table is not available. The default is
  15705. 'auto', which causes GDB to use the current execution mode (from
  15706. the 'T' bit in the 'CPSR' register).
  15707. 'show arm fallback-mode'
  15708. Show the current fallback instruction mode.
  15709. 'set arm force-mode (arm|thumb|auto)'
  15710. This command overrides use of the symbol table to determine whether
  15711. instructions are ARM or Thumb. The default is 'auto', which causes
  15712. GDB to use the symbol table and then the setting of 'set arm
  15713. fallback-mode'.
  15714. 'show arm force-mode'
  15715. Show the current forced instruction mode.
  15716. 'set debug arm'
  15717. Toggle whether to display ARM-specific debugging messages from the
  15718. ARM target support subsystem.
  15719. 'show debug arm'
  15720. Show whether ARM-specific debugging messages are enabled.
  15721. 'target sim [SIMARGS] ...'
  15722. The GDB ARM simulator accepts the following optional arguments.
  15723. '--swi-support=TYPE'
  15724. Tell the simulator which SWI interfaces to support. The
  15725. argument TYPE may be a comma separated list of the following
  15726. values. The default value is 'all'.
  15727. 'none'
  15728. 'demon'
  15729. 'angel'
  15730. 'redboot'
  15731. 'all'
  15732. 
  15733. File: gdb.info, Node: M68K, Next: MicroBlaze, Prev: ARM, Up: Embedded Processors
  15734. 21.3.3 M68k
  15735. -----------
  15736. The Motorola m68k configuration includes ColdFire support.
  15737. 
  15738. File: gdb.info, Node: MicroBlaze, Next: MIPS Embedded, Prev: M68K, Up: Embedded Processors
  15739. 21.3.4 MicroBlaze
  15740. -----------------
  15741. The MicroBlaze is a soft-core processor supported on various Xilinx
  15742. FPGAs, such as Spartan or Virtex series. Boards with these processors
  15743. usually have JTAG ports which connect to a host system running the
  15744. Xilinx Embedded Development Kit (EDK) or Software Development Kit (SDK).
  15745. This host system is used to download the configuration bitstream to the
  15746. target FPGA. The Xilinx Microprocessor Debugger (XMD) program
  15747. communicates with the target board using the JTAG interface and presents
  15748. a 'gdbserver' interface to the board. By default 'xmd' uses port
  15749. '1234'. (While it is possible to change this default port, it requires
  15750. the use of undocumented 'xmd' commands. Contact Xilinx support if you
  15751. need to do this.)
  15752. Use these GDB commands to connect to the MicroBlaze target processor.
  15753. 'target remote :1234'
  15754. Use this command to connect to the target if you are running GDB on
  15755. the same system as 'xmd'.
  15756. 'target remote XMD-HOST:1234'
  15757. Use this command to connect to the target if it is connected to
  15758. 'xmd' running on a different system named XMD-HOST.
  15759. 'load'
  15760. Use this command to download a program to the MicroBlaze target.
  15761. 'set debug microblaze N'
  15762. Enable MicroBlaze-specific debugging messages if non-zero.
  15763. 'show debug microblaze N'
  15764. Show MicroBlaze-specific debugging level.
  15765. 
  15766. File: gdb.info, Node: MIPS Embedded, Next: OpenRISC 1000, Prev: MicroBlaze, Up: Embedded Processors
  15767. 21.3.5 MIPS Embedded
  15768. --------------------
  15769. GDB supports these special commands for MIPS targets:
  15770. 'set mipsfpu double'
  15771. 'set mipsfpu single'
  15772. 'set mipsfpu none'
  15773. 'set mipsfpu auto'
  15774. 'show mipsfpu'
  15775. If your target board does not support the MIPS floating point
  15776. coprocessor, you should use the command 'set mipsfpu none' (if you
  15777. need this, you may wish to put the command in your GDB init file).
  15778. This tells GDB how to find the return value of functions which
  15779. return floating point values. It also allows GDB to avoid saving
  15780. the floating point registers when calling functions on the board.
  15781. If you are using a floating point coprocessor with only single
  15782. precision floating point support, as on the R4650 processor, use
  15783. the command 'set mipsfpu single'. The default double precision
  15784. floating point coprocessor may be selected using 'set mipsfpu
  15785. double'.
  15786. In previous versions the only choices were double precision or no
  15787. floating point, so 'set mipsfpu on' will select double precision
  15788. and 'set mipsfpu off' will select no floating point.
  15789. As usual, you can inquire about the 'mipsfpu' variable with 'show
  15790. mipsfpu'.
  15791. 
  15792. File: gdb.info, Node: OpenRISC 1000, Next: PowerPC Embedded, Prev: MIPS Embedded, Up: Embedded Processors
  15793. 21.3.6 OpenRISC 1000
  15794. --------------------
  15795. The OpenRISC 1000 provides a free RISC instruction set architecture. It
  15796. is mainly provided as a soft-core which can run on Xilinx, Altera and
  15797. other FPGA's.
  15798. GDB for OpenRISC supports the below commands when connecting to a
  15799. target:
  15800. 'target sim'
  15801. Runs the builtin CPU simulator which can run very basic programs
  15802. but does not support most hardware functions like MMU. For more
  15803. complex use cases the user is advised to run an external target,
  15804. and connect using 'target remote'.
  15805. Example: 'target sim'
  15806. 'set debug or1k'
  15807. Toggle whether to display OpenRISC-specific debugging messages from
  15808. the OpenRISC target support subsystem.
  15809. 'show debug or1k'
  15810. Show whether OpenRISC-specific debugging messages are enabled.
  15811. 
  15812. File: gdb.info, Node: PowerPC Embedded, Next: AVR, Prev: OpenRISC 1000, Up: Embedded Processors
  15813. 21.3.7 PowerPC Embedded
  15814. -----------------------
  15815. GDB supports using the DVC (Data Value Compare) register to implement in
  15816. hardware simple hardware watchpoint conditions of the form:
  15817. (gdb) watch ADDRESS|VARIABLE \
  15818. if ADDRESS|VARIABLE == CONSTANT EXPRESSION
  15819. The DVC register will be automatically used when GDB detects such
  15820. pattern in a condition expression, and the created watchpoint uses one
  15821. debug register (either the 'exact-watchpoints' option is on and the
  15822. variable is scalar, or the variable has a length of one byte). This
  15823. feature is available in native GDB running on a Linux kernel version
  15824. 2.6.34 or newer.
  15825. When running on PowerPC embedded processors, GDB automatically uses
  15826. ranged hardware watchpoints, unless the 'exact-watchpoints' option is
  15827. on, in which case watchpoints using only one debug register are created
  15828. when watching variables of scalar types.
  15829. You can create an artificial array to watch an arbitrary memory
  15830. region using one of the following commands (*note Expressions::):
  15831. (gdb) watch *((char *) ADDRESS)@LENGTH
  15832. (gdb) watch {char[LENGTH]} ADDRESS
  15833. PowerPC embedded processors support masked watchpoints. See the
  15834. discussion about the 'mask' argument in *note Set Watchpoints::.
  15835. PowerPC embedded processors support hardware accelerated "ranged
  15836. breakpoints". A ranged breakpoint stops execution of the inferior
  15837. whenever it executes an instruction at any address within the range it
  15838. specifies. To set a ranged breakpoint in GDB, use the 'break-range'
  15839. command.
  15840. GDB provides the following PowerPC-specific commands:
  15841. 'break-range START-LOCATION, END-LOCATION'
  15842. Set a breakpoint for an address range given by START-LOCATION and
  15843. END-LOCATION, which can specify a function name, a line number, an
  15844. offset of lines from the current line or from the start location,
  15845. or an address of an instruction (see *note Specify Location::, for
  15846. a list of all the possible ways to specify a LOCATION.) The
  15847. breakpoint will stop execution of the inferior whenever it executes
  15848. an instruction at any address within the specified range,
  15849. (including START-LOCATION and END-LOCATION.)
  15850. 'set powerpc soft-float'
  15851. 'show powerpc soft-float'
  15852. Force GDB to use (or not use) a software floating point calling
  15853. convention. By default, GDB selects the calling convention based
  15854. on the selected architecture and the provided executable file.
  15855. 'set powerpc vector-abi'
  15856. 'show powerpc vector-abi'
  15857. Force GDB to use the specified calling convention for vector
  15858. arguments and return values. The valid options are 'auto';
  15859. 'generic', to avoid vector registers even if they are present;
  15860. 'altivec', to use AltiVec registers; and 'spe' to use SPE
  15861. registers. By default, GDB selects the calling convention based on
  15862. the selected architecture and the provided executable file.
  15863. 'set powerpc exact-watchpoints'
  15864. 'show powerpc exact-watchpoints'
  15865. Allow GDB to use only one debug register when watching a variable
  15866. of scalar type, thus assuming that the variable is accessed through
  15867. the address of its first byte.
  15868. 
  15869. File: gdb.info, Node: AVR, Next: CRIS, Prev: PowerPC Embedded, Up: Embedded Processors
  15870. 21.3.8 Atmel AVR
  15871. ----------------
  15872. When configured for debugging the Atmel AVR, GDB supports the following
  15873. AVR-specific commands:
  15874. 'info io_registers'
  15875. This command displays information about the AVR I/O registers. For
  15876. each register, GDB prints its number and value.
  15877. 
  15878. File: gdb.info, Node: CRIS, Next: Super-H, Prev: AVR, Up: Embedded Processors
  15879. 21.3.9 CRIS
  15880. -----------
  15881. When configured for debugging CRIS, GDB provides the following
  15882. CRIS-specific commands:
  15883. 'set cris-version VER'
  15884. Set the current CRIS version to VER, either '10' or '32'. The CRIS
  15885. version affects register names and sizes. This command is useful
  15886. in case autodetection of the CRIS version fails.
  15887. 'show cris-version'
  15888. Show the current CRIS version.
  15889. 'set cris-dwarf2-cfi'
  15890. Set the usage of DWARF-2 CFI for CRIS debugging. The default is
  15891. 'on'. Change to 'off' when using 'gcc-cris' whose version is below
  15892. 'R59'.
  15893. 'show cris-dwarf2-cfi'
  15894. Show the current state of using DWARF-2 CFI.
  15895. 'set cris-mode MODE'
  15896. Set the current CRIS mode to MODE. It should only be changed when
  15897. debugging in guru mode, in which case it should be set to 'guru'
  15898. (the default is 'normal').
  15899. 'show cris-mode'
  15900. Show the current CRIS mode.
  15901. 
  15902. File: gdb.info, Node: Super-H, Prev: CRIS, Up: Embedded Processors
  15903. 21.3.10 Renesas Super-H
  15904. -----------------------
  15905. For the Renesas Super-H processor, GDB provides these commands:
  15906. 'set sh calling-convention CONVENTION'
  15907. Set the calling-convention used when calling functions from GDB.
  15908. Allowed values are 'gcc', which is the default setting, and
  15909. 'renesas'. With the 'gcc' setting, functions are called using the
  15910. GCC calling convention. If the DWARF-2 information of the called
  15911. function specifies that the function follows the Renesas calling
  15912. convention, the function is called using the Renesas calling
  15913. convention. If the calling convention is set to 'renesas', the
  15914. Renesas calling convention is always used, regardless of the
  15915. DWARF-2 information. This can be used to override the default of
  15916. 'gcc' if debug information is missing, or the compiler does not
  15917. emit the DWARF-2 calling convention entry for a function.
  15918. 'show sh calling-convention'
  15919. Show the current calling convention setting.
  15920. 
  15921. File: gdb.info, Node: Architectures, Prev: Embedded Processors, Up: Configurations
  15922. 21.4 Architectures
  15923. ==================
  15924. This section describes characteristics of architectures that affect all
  15925. uses of GDB with the architecture, both native and cross.
  15926. * Menu:
  15927. * AArch64::
  15928. * i386::
  15929. * Alpha::
  15930. * MIPS::
  15931. * HPPA:: HP PA architecture
  15932. * SPU:: Cell Broadband Engine SPU architecture
  15933. * PowerPC::
  15934. * Nios II::
  15935. * Sparc64::
  15936. * S12Z::
  15937. 
  15938. File: gdb.info, Node: AArch64, Next: i386, Up: Architectures
  15939. 21.4.1 AArch64
  15940. --------------
  15941. When GDB is debugging the AArch64 architecture, it provides the
  15942. following special commands:
  15943. 'set debug aarch64'
  15944. This command determines whether AArch64 architecture-specific
  15945. debugging messages are to be displayed.
  15946. 'show debug aarch64'
  15947. Show whether AArch64 debugging messages are displayed.
  15948. 21.4.1.1 AArch64 SVE.
  15949. .....................
  15950. When GDB is debugging the AArch64 architecture, if the Scalable Vector
  15951. Extension (SVE) is present, then GDB will provide the vector registers
  15952. '$z0' through '$z31', vector predicate registers '$p0' through '$p15',
  15953. and the '$ffr' register. In addition, the pseudo register '$vg' will be
  15954. provided. This is the vector granule for the current thread and
  15955. represents the number of 64-bit chunks in an SVE 'z' register.
  15956. If the vector length changes, then the '$vg' register will be
  15957. updated, but the lengths of the 'z' and 'p' registers will not change.
  15958. This is a known limitation of GDB and does not affect the execution of
  15959. the target process.
  15960. 
  15961. File: gdb.info, Node: i386, Next: Alpha, Prev: AArch64, Up: Architectures
  15962. 21.4.2 x86 Architecture-specific Issues
  15963. ---------------------------------------
  15964. 'set struct-convention MODE'
  15965. Set the convention used by the inferior to return 'struct's and
  15966. 'union's from functions to MODE. Possible values of MODE are
  15967. '"pcc"', '"reg"', and '"default"' (the default). '"default"' or
  15968. '"pcc"' means that 'struct's are returned on the stack, while
  15969. '"reg"' means that a 'struct' or a 'union' whose size is 1, 2, 4,
  15970. or 8 bytes will be returned in a register.
  15971. 'show struct-convention'
  15972. Show the current setting of the convention to return 'struct's from
  15973. functions.
  15974. 21.4.2.1 Intel "Memory Protection Extensions" (MPX).
  15975. ....................................................
  15976. Memory Protection Extension (MPX) adds the bound registers 'BND0' (1)
  15977. through 'BND3'. Bound registers store a pair of 64-bit values which are
  15978. the lower bound and upper bound. Bounds are effective addresses or
  15979. memory locations. The upper bounds are architecturally represented in
  15980. 1's complement form. A bound having lower bound = 0, and upper bound =
  15981. 0 (1's complement of all bits set) will allow access to the entire
  15982. address space.
  15983. 'BND0' through 'BND3' are represented in GDB as 'bnd0raw' through
  15984. 'bnd3raw'. Pseudo registers 'bnd0' through 'bnd3' display the upper
  15985. bound performing the complement of one operation on the upper bound
  15986. value, i.e. when upper bound in 'bnd0raw' is 0 in the GDB 'bnd0' it will
  15987. be '0xfff...'. In this sense it can also be noted that the upper bounds
  15988. are inclusive.
  15989. As an example, assume that the register BND0 holds bounds for a
  15990. pointer having access allowed for the range between 0x32 and 0x71. The
  15991. values present on bnd0raw and bnd registers are presented as follows:
  15992. bnd0raw = {0x32, 0xffffffff8e}
  15993. bnd0 = {lbound = 0x32, ubound = 0x71} : size 64
  15994. This way the raw value can be accessed via bnd0raw...bnd3raw. Any
  15995. change on bnd0...bnd3 or bnd0raw...bnd3raw is reflect on its
  15996. counterpart. When the bnd0...bnd3 registers are displayed via Python,
  15997. the display includes the memory size, in bits, accessible to the
  15998. pointer.
  15999. Bounds can also be stored in bounds tables, which are stored in
  16000. application memory. These tables store bounds for pointers by
  16001. specifying the bounds pointer's value along with its bounds. Evaluating
  16002. and changing bounds located in bound tables is therefore interesting
  16003. while investigating bugs on MPX context. GDB provides commands for this
  16004. purpose:
  16005. 'show mpx bound POINTER'
  16006. Display bounds of the given POINTER.
  16007. 'set mpx bound POINTER, LBOUND, UBOUND'
  16008. Set the bounds of a pointer in the bound table. This command takes
  16009. three parameters: POINTER is the pointers whose bounds are to be
  16010. changed, LBOUND and UBOUND are new values for lower and upper
  16011. bounds respectively.
  16012. When you call an inferior function on an Intel MPX enabled program,
  16013. GDB sets the inferior's bound registers to the init (disabled) state
  16014. before calling the function. As a consequence, bounds checks for the
  16015. pointer arguments passed to the function will always pass.
  16016. This is necessary because when you call an inferior function, the
  16017. program is usually in the middle of the execution of other function.
  16018. Since at that point bound registers are in an arbitrary state, not
  16019. clearing them would lead to random bound violations in the called
  16020. function.
  16021. You can still examine the influence of the bound registers on the
  16022. execution of the called function by stopping the execution of the called
  16023. function at its prologue, setting bound registers, and continuing the
  16024. execution. For example:
  16025. $ break *upper
  16026. Breakpoint 2 at 0x4009de: file i386-mpx-call.c, line 47.
  16027. $ print upper (a, b, c, d, 1)
  16028. Breakpoint 2, upper (a=0x0, b=0x6e0000005b, c=0x0, d=0x0, len=48)....
  16029. $ print $bnd0
  16030. {lbound = 0x0, ubound = ffffffff} : size -1
  16031. At this last step the value of bnd0 can be changed for investigation
  16032. of bound violations caused along the execution of the call. In order to
  16033. know how to set the bound registers or bound table for the call consult
  16034. the ABI.
  16035. ---------- Footnotes ----------
  16036. (1) The register named with capital letters represent the
  16037. architecture registers.
  16038. 
  16039. File: gdb.info, Node: Alpha, Next: MIPS, Prev: i386, Up: Architectures
  16040. 21.4.3 Alpha
  16041. ------------
  16042. See the following section.
  16043. 
  16044. File: gdb.info, Node: MIPS, Next: HPPA, Prev: Alpha, Up: Architectures
  16045. 21.4.4 MIPS
  16046. -----------
  16047. Alpha- and MIPS-based computers use an unusual stack frame, which
  16048. sometimes requires GDB to search backward in the object code to find the
  16049. beginning of a function.
  16050. To improve response time (especially for embedded applications, where
  16051. GDB may be restricted to a slow serial line for this search) you may
  16052. want to limit the size of this search, using one of these commands:
  16053. 'set heuristic-fence-post LIMIT'
  16054. Restrict GDB to examining at most LIMIT bytes in its search for the
  16055. beginning of a function. A value of 0 (the default) means there is
  16056. no limit. However, except for 0, the larger the limit the more
  16057. bytes 'heuristic-fence-post' must search and therefore the longer
  16058. it takes to run. You should only need to use this command when
  16059. debugging a stripped executable.
  16060. 'show heuristic-fence-post'
  16061. Display the current limit.
  16062. These commands are available _only_ when GDB is configured for debugging
  16063. programs on Alpha or MIPS processors.
  16064. Several MIPS-specific commands are available when debugging MIPS
  16065. programs:
  16066. 'set mips abi ARG'
  16067. Tell GDB which MIPS ABI is used by the inferior. Possible values
  16068. of ARG are:
  16069. 'auto'
  16070. The default ABI associated with the current binary (this is
  16071. the default).
  16072. 'o32'
  16073. 'o64'
  16074. 'n32'
  16075. 'n64'
  16076. 'eabi32'
  16077. 'eabi64'
  16078. 'show mips abi'
  16079. Show the MIPS ABI used by GDB to debug the inferior.
  16080. 'set mips compression ARG'
  16081. Tell GDB which MIPS compressed ISA (Instruction Set Architecture)
  16082. encoding is used by the inferior. GDB uses this for code
  16083. disassembly and other internal interpretation purposes. This
  16084. setting is only referred to when no executable has been associated
  16085. with the debugging session or the executable does not provide
  16086. information about the encoding it uses. Otherwise this setting is
  16087. automatically updated from information provided by the executable.
  16088. Possible values of ARG are 'mips16' and 'micromips'. The default
  16089. compressed ISA encoding is 'mips16', as executables containing
  16090. MIPS16 code frequently are not identified as such.
  16091. This setting is "sticky"; that is, it retains its value across
  16092. debugging sessions until reset either explicitly with this command
  16093. or implicitly from an executable.
  16094. The compiler and/or assembler typically add symbol table
  16095. annotations to identify functions compiled for the MIPS16 or
  16096. microMIPS ISAs. If these function-scope annotations are present,
  16097. GDB uses them in preference to the global compressed ISA encoding
  16098. setting.
  16099. 'show mips compression'
  16100. Show the MIPS compressed ISA encoding used by GDB to debug the
  16101. inferior.
  16102. 'set mipsfpu'
  16103. 'show mipsfpu'
  16104. *Note set mipsfpu: MIPS Embedded.
  16105. 'set mips mask-address ARG'
  16106. This command determines whether the most-significant 32 bits of
  16107. 64-bit MIPS addresses are masked off. The argument ARG can be
  16108. 'on', 'off', or 'auto'. The latter is the default setting, which
  16109. lets GDB determine the correct value.
  16110. 'show mips mask-address'
  16111. Show whether the upper 32 bits of MIPS addresses are masked off or
  16112. not.
  16113. 'set remote-mips64-transfers-32bit-regs'
  16114. This command controls compatibility with 64-bit MIPS targets that
  16115. transfer data in 32-bit quantities. If you have an old MIPS 64
  16116. target that transfers 32 bits for some registers, like SR and FSR,
  16117. and 64 bits for other registers, set this option to 'on'.
  16118. 'show remote-mips64-transfers-32bit-regs'
  16119. Show the current setting of compatibility with older MIPS 64
  16120. targets.
  16121. 'set debug mips'
  16122. This command turns on and off debugging messages for the
  16123. MIPS-specific target code in GDB.
  16124. 'show debug mips'
  16125. Show the current setting of MIPS debugging messages.
  16126. 
  16127. File: gdb.info, Node: HPPA, Next: SPU, Prev: MIPS, Up: Architectures
  16128. 21.4.5 HPPA
  16129. -----------
  16130. When GDB is debugging the HP PA architecture, it provides the following
  16131. special commands:
  16132. 'set debug hppa'
  16133. This command determines whether HPPA architecture-specific
  16134. debugging messages are to be displayed.
  16135. 'show debug hppa'
  16136. Show whether HPPA debugging messages are displayed.
  16137. 'maint print unwind ADDRESS'
  16138. This command displays the contents of the unwind table entry at the
  16139. given ADDRESS.
  16140. 
  16141. File: gdb.info, Node: SPU, Next: PowerPC, Prev: HPPA, Up: Architectures
  16142. 21.4.6 Cell Broadband Engine SPU architecture
  16143. ---------------------------------------------
  16144. When GDB is debugging the Cell Broadband Engine SPU architecture, it
  16145. provides the following special commands:
  16146. 'info spu event'
  16147. Display SPU event facility status. Shows current event mask and
  16148. pending event status.
  16149. 'info spu signal'
  16150. Display SPU signal notification facility status. Shows pending
  16151. signal-control word and signal notification mode of both signal
  16152. notification channels.
  16153. 'info spu mailbox'
  16154. Display SPU mailbox facility status. Shows all pending entries, in
  16155. order of processing, in each of the SPU Write Outbound, SPU Write
  16156. Outbound Interrupt, and SPU Read Inbound mailboxes.
  16157. 'info spu dma'
  16158. Display MFC DMA status. Shows all pending commands in the MFC DMA
  16159. queue. For each entry, opcode, tag, class IDs, effective and local
  16160. store addresses and transfer size are shown.
  16161. 'info spu proxydma'
  16162. Display MFC Proxy-DMA status. Shows all pending commands in the
  16163. MFC Proxy-DMA queue. For each entry, opcode, tag, class IDs,
  16164. effective and local store addresses and transfer size are shown.
  16165. When GDB is debugging a combined PowerPC/SPU application on the Cell
  16166. Broadband Engine, it provides in addition the following special
  16167. commands:
  16168. 'set spu stop-on-load ARG'
  16169. Set whether to stop for new SPE threads. When set to 'on', GDB
  16170. will give control to the user when a new SPE thread enters its
  16171. 'main' function. The default is 'off'.
  16172. 'show spu stop-on-load'
  16173. Show whether to stop for new SPE threads.
  16174. 'set spu auto-flush-cache ARG'
  16175. Set whether to automatically flush the software-managed cache.
  16176. When set to 'on', GDB will automatically cause the SPE
  16177. software-managed cache to be flushed whenever SPE execution stops.
  16178. This provides a consistent view of PowerPC memory that is accessed
  16179. via the cache. If an application does not use the software-managed
  16180. cache, this option has no effect.
  16181. 'show spu auto-flush-cache'
  16182. Show whether to automatically flush the software-managed cache.
  16183. 
  16184. File: gdb.info, Node: PowerPC, Next: Nios II, Prev: SPU, Up: Architectures
  16185. 21.4.7 PowerPC
  16186. --------------
  16187. When GDB is debugging the PowerPC architecture, it provides a set of
  16188. pseudo-registers to enable inspection of 128-bit wide Decimal Floating
  16189. Point numbers stored in the floating point registers. These values must
  16190. be stored in two consecutive registers, always starting at an even
  16191. register like 'f0' or 'f2'.
  16192. The pseudo-registers go from '$dl0' through '$dl15', and are formed
  16193. by joining the even/odd register pairs 'f0' and 'f1' for '$dl0', 'f2'
  16194. and 'f3' for '$dl1' and so on.
  16195. For POWER7 processors, GDB provides a set of pseudo-registers, the
  16196. 64-bit wide Extended Floating Point Registers ('f32' through 'f63').
  16197. 
  16198. File: gdb.info, Node: Nios II, Next: Sparc64, Prev: PowerPC, Up: Architectures
  16199. 21.4.8 Nios II
  16200. --------------
  16201. When GDB is debugging the Nios II architecture, it provides the
  16202. following special commands:
  16203. 'set debug nios2'
  16204. This command turns on and off debugging messages for the Nios II
  16205. target code in GDB.
  16206. 'show debug nios2'
  16207. Show the current setting of Nios II debugging messages.
  16208. 
  16209. File: gdb.info, Node: Sparc64, Next: S12Z, Prev: Nios II, Up: Architectures
  16210. 21.4.9 Sparc64
  16211. --------------
  16212. 21.4.9.1 ADI Support
  16213. ....................
  16214. The M7 processor supports an Application Data Integrity (ADI) feature
  16215. that detects invalid data accesses. When software allocates memory and
  16216. enables ADI on the allocated memory, it chooses a 4-bit version number,
  16217. sets the version in the upper 4 bits of the 64-bit pointer to that data,
  16218. and stores the 4-bit version in every cacheline of that data. Hardware
  16219. saves the latter in spare bits in the cache and memory hierarchy. On
  16220. each load and store, the processor compares the upper 4 VA (virtual
  16221. address) bits to the cacheline's version. If there is a mismatch, the
  16222. processor generates a version mismatch trap which can be either precise
  16223. or disrupting. The trap is an error condition which the kernel delivers
  16224. to the process as a SIGSEGV signal.
  16225. Note that only 64-bit applications can use ADI and need to be built
  16226. with ADI-enabled.
  16227. Values of the ADI version tags, which are in granularity of a
  16228. cacheline (64 bytes), can be viewed or modified.
  16229. 'adi (examine | x) [ / N ] ADDR'
  16230. The 'adi examine' command displays the value of one ADI version tag
  16231. per cacheline.
  16232. N is a decimal integer specifying the number in bytes; the default
  16233. is 1. It specifies how much ADI version information, at the ratio
  16234. of 1:ADI block size, to display.
  16235. ADDR is the address in user address space where you want GDB to
  16236. begin displaying the ADI version tags.
  16237. Below is an example of displaying ADI versions of variable
  16238. "shmaddr".
  16239. (gdb) adi x/100 shmaddr
  16240. 0xfff800010002c000: 0 0
  16241. 'adi (assign | a) [ / N ] ADDR = TAG'
  16242. The 'adi assign' command is used to assign new ADI version tag to
  16243. an address.
  16244. N is a decimal integer specifying the number in bytes; the default
  16245. is 1. It specifies how much ADI version information, at the ratio
  16246. of 1:ADI block size, to modify.
  16247. ADDR is the address in user address space where you want GDB to
  16248. begin modifying the ADI version tags.
  16249. TAG is the new ADI version tag.
  16250. For example, do the following to modify then verify ADI versions of
  16251. variable "shmaddr":
  16252. (gdb) adi a/100 shmaddr = 7
  16253. (gdb) adi x/100 shmaddr
  16254. 0xfff800010002c000: 7 7
  16255. 
  16256. File: gdb.info, Node: S12Z, Prev: Sparc64, Up: Architectures
  16257. 21.4.10 S12Z
  16258. ------------
  16259. When GDB is debugging the S12Z architecture, it provides the following
  16260. special command:
  16261. 'maint info bdccsr'
  16262. This command displays the current value of the microprocessor's
  16263. BDCCSR register.
  16264. 
  16265. File: gdb.info, Node: Controlling GDB, Next: Extending GDB, Prev: Configurations, Up: Top
  16266. 22 Controlling GDB
  16267. ******************
  16268. You can alter the way GDB interacts with you by using the 'set' command.
  16269. For commands controlling how GDB displays data, see *note Print
  16270. Settings: Print Settings. Other settings are described here.
  16271. * Menu:
  16272. * Prompt:: Prompt
  16273. * Editing:: Command editing
  16274. * Command History:: Command history
  16275. * Screen Size:: Screen size
  16276. * Output Styling:: Output styling
  16277. * Numbers:: Numbers
  16278. * ABI:: Configuring the current ABI
  16279. * Auto-loading:: Automatically loading associated files
  16280. * Messages/Warnings:: Optional warnings and messages
  16281. * Debugging Output:: Optional messages about internal happenings
  16282. * Other Misc Settings:: Other Miscellaneous Settings
  16283. 
  16284. File: gdb.info, Node: Prompt, Next: Editing, Up: Controlling GDB
  16285. 22.1 Prompt
  16286. ===========
  16287. GDB indicates its readiness to read a command by printing a string
  16288. called the "prompt". This string is normally '(gdb)'. You can change
  16289. the prompt string with the 'set prompt' command. For instance, when
  16290. debugging GDB with GDB, it is useful to change the prompt in one of the
  16291. GDB sessions so that you can always tell which one you are talking to.
  16292. _Note:_ 'set prompt' does not add a space for you after the prompt
  16293. you set. This allows you to set a prompt which ends in a space or a
  16294. prompt that does not.
  16295. 'set prompt NEWPROMPT'
  16296. Directs GDB to use NEWPROMPT as its prompt string henceforth.
  16297. 'show prompt'
  16298. Prints a line of the form: 'Gdb's prompt is: YOUR-PROMPT'
  16299. Versions of GDB that ship with Python scripting enabled have prompt
  16300. extensions. The commands for interacting with these extensions are:
  16301. 'set extended-prompt PROMPT'
  16302. Set an extended prompt that allows for substitutions. *Note
  16303. gdb.prompt::, for a list of escape sequences that can be used for
  16304. substitution. Any escape sequences specified as part of the prompt
  16305. string are replaced with the corresponding strings each time the
  16306. prompt is displayed.
  16307. For example:
  16308. set extended-prompt Current working directory: \w (gdb)
  16309. Note that when an extended-prompt is set, it takes control of the
  16310. PROMPT_HOOK hook. *Note prompt_hook::, for further information.
  16311. 'show extended-prompt'
  16312. Prints the extended prompt. Any escape sequences specified as part
  16313. of the prompt string with 'set extended-prompt', are replaced with
  16314. the corresponding strings each time the prompt is displayed.
  16315. 
  16316. File: gdb.info, Node: Editing, Next: Command History, Prev: Prompt, Up: Controlling GDB
  16317. 22.2 Command Editing
  16318. ====================
  16319. GDB reads its input commands via the "Readline" interface. This GNU
  16320. library provides consistent behavior for programs which provide a
  16321. command line interface to the user. Advantages are GNU Emacs-style or
  16322. "vi"-style inline editing of commands, 'csh'-like history substitution,
  16323. and a storage and recall of command history across debugging sessions.
  16324. You may control the behavior of command line editing in GDB with the
  16325. command 'set'.
  16326. 'set editing'
  16327. 'set editing on'
  16328. Enable command line editing (enabled by default).
  16329. 'set editing off'
  16330. Disable command line editing.
  16331. 'show editing'
  16332. Show whether command line editing is enabled.
  16333. *Note Command Line Editing::, for more details about the Readline
  16334. interface. Users unfamiliar with GNU Emacs or 'vi' are encouraged to
  16335. read that chapter.
  16336. 
  16337. File: gdb.info, Node: Command History, Next: Screen Size, Prev: Editing, Up: Controlling GDB
  16338. 22.3 Command History
  16339. ====================
  16340. GDB can keep track of the commands you type during your debugging
  16341. sessions, so that you can be certain of precisely what happened. Use
  16342. these commands to manage the GDB command history facility.
  16343. GDB uses the GNU History library, a part of the Readline package, to
  16344. provide the history facility. *Note Using History Interactively::, for
  16345. the detailed description of the History library.
  16346. To issue a command to GDB without affecting certain aspects of the
  16347. state which is seen by users, prefix it with 'server ' (*note Server
  16348. Prefix::). This means that this command will not affect the command
  16349. history, nor will it affect GDB's notion of which command to repeat if
  16350. <RET> is pressed on a line by itself.
  16351. The server prefix does not affect the recording of values into the
  16352. value history; to print a value without recording it into the value
  16353. history, use the 'output' command instead of the 'print' command.
  16354. Here is the description of GDB commands related to command history.
  16355. 'set history filename FNAME'
  16356. Set the name of the GDB command history file to FNAME. This is the
  16357. file where GDB reads an initial command history list, and where it
  16358. writes the command history from this session when it exits. You
  16359. can access this list through history expansion or through the
  16360. history command editing characters listed below. This file
  16361. defaults to the value of the environment variable 'GDBHISTFILE', or
  16362. to './.gdb_history' ('./_gdb_history' on MS-DOS) if this variable
  16363. is not set.
  16364. 'set history save'
  16365. 'set history save on'
  16366. Record command history in a file, whose name may be specified with
  16367. the 'set history filename' command. By default, this option is
  16368. disabled.
  16369. 'set history save off'
  16370. Stop recording command history in a file.
  16371. 'set history size SIZE'
  16372. 'set history size unlimited'
  16373. Set the number of commands which GDB keeps in its history list.
  16374. This defaults to the value of the environment variable
  16375. 'GDBHISTSIZE', or to 256 if this variable is not set. Non-numeric
  16376. values of 'GDBHISTSIZE' are ignored. If SIZE is 'unlimited' or if
  16377. 'GDBHISTSIZE' is either a negative number or the empty string, then
  16378. the number of commands GDB keeps in the history list is unlimited.
  16379. 'set history remove-duplicates COUNT'
  16380. 'set history remove-duplicates unlimited'
  16381. Control the removal of duplicate history entries in the command
  16382. history list. If COUNT is non-zero, GDB will look back at the last
  16383. COUNT history entries and remove the first entry that is a
  16384. duplicate of the current entry being added to the command history
  16385. list. If COUNT is 'unlimited' then this lookbehind is unbounded.
  16386. If COUNT is 0, then removal of duplicate history entries is
  16387. disabled.
  16388. Only history entries added during the current session are
  16389. considered for removal. This option is set to 0 by default.
  16390. History expansion assigns special meaning to the character '!'.
  16391. *Note Event Designators::, for more details.
  16392. Since '!' is also the logical not operator in C, history expansion is
  16393. off by default. If you decide to enable history expansion with the 'set
  16394. history expansion on' command, you may sometimes need to follow '!'
  16395. (when it is used as logical not, in an expression) with a space or a tab
  16396. to prevent it from being expanded. The readline history facilities do
  16397. not attempt substitution on the strings '!=' and '!(', even when history
  16398. expansion is enabled.
  16399. The commands to control history expansion are:
  16400. 'set history expansion on'
  16401. 'set history expansion'
  16402. Enable history expansion. History expansion is off by default.
  16403. 'set history expansion off'
  16404. Disable history expansion.
  16405. 'show history'
  16406. 'show history filename'
  16407. 'show history save'
  16408. 'show history size'
  16409. 'show history expansion'
  16410. These commands display the state of the GDB history parameters.
  16411. 'show history' by itself displays all four states.
  16412. 'show commands'
  16413. Display the last ten commands in the command history.
  16414. 'show commands N'
  16415. Print ten commands centered on command number N.
  16416. 'show commands +'
  16417. Print ten commands just after the commands last printed.
  16418. 
  16419. File: gdb.info, Node: Screen Size, Next: Output Styling, Prev: Command History, Up: Controlling GDB
  16420. 22.4 Screen Size
  16421. ================
  16422. Certain commands to GDB may produce large amounts of information output
  16423. to the screen. To help you read all of it, GDB pauses and asks you for
  16424. input at the end of each page of output. Type <RET> when you want to
  16425. see one more page of output, 'q' to discard the remaining output, or 'c'
  16426. to continue without paging for the rest of the current command. Also,
  16427. the screen width setting determines when to wrap lines of output.
  16428. Depending on what is being printed, GDB tries to break the line at a
  16429. readable place, rather than simply letting it overflow onto the
  16430. following line.
  16431. Normally GDB knows the size of the screen from the terminal driver
  16432. software. For example, on Unix GDB uses the termcap data base together
  16433. with the value of the 'TERM' environment variable and the 'stty rows'
  16434. and 'stty cols' settings. If this is not correct, you can override it
  16435. with the 'set height' and 'set width' commands:
  16436. 'set height LPP'
  16437. 'set height unlimited'
  16438. 'show height'
  16439. 'set width CPL'
  16440. 'set width unlimited'
  16441. 'show width'
  16442. These 'set' commands specify a screen height of LPP lines and a
  16443. screen width of CPL characters. The associated 'show' commands
  16444. display the current settings.
  16445. If you specify a height of either 'unlimited' or zero lines, GDB
  16446. does not pause during output no matter how long the output is.
  16447. This is useful if output is to a file or to an editor buffer.
  16448. Likewise, you can specify 'set width unlimited' or 'set width 0' to
  16449. prevent GDB from wrapping its output.
  16450. 'set pagination on'
  16451. 'set pagination off'
  16452. Turn the output pagination on or off; the default is on. Turning
  16453. pagination off is the alternative to 'set height unlimited'. Note
  16454. that running GDB with the '--batch' option (*note -batch: Mode
  16455. Options.) also automatically disables pagination.
  16456. 'show pagination'
  16457. Show the current pagination mode.
  16458. 
  16459. File: gdb.info, Node: Output Styling, Next: Numbers, Prev: Screen Size, Up: Controlling GDB
  16460. 22.5 Output Styling
  16461. ===================
  16462. GDB can style its output on a capable terminal. This is enabled by
  16463. default on most systems, but disabled by default when in batch mode
  16464. (*note Mode Options::). Various style settings are available; and
  16465. styles can also be disabled entirely.
  16466. 'set style enabled 'on|off''
  16467. Enable or disable all styling. The default is host-dependent, with
  16468. most hosts defaulting to 'on'.
  16469. 'show style enabled'
  16470. Show the current state of styling.
  16471. 'set style sources 'on|off''
  16472. Enable or disable source code styling. This affects whether source
  16473. code, such as the output of the 'list' command, is styled. Note
  16474. that source styling only works if styling in general is enabled,
  16475. and if GDB was linked with the GNU Source Highlight library. The
  16476. default is 'on'.
  16477. 'show style sources'
  16478. Show the current state of source code styling.
  16479. Subcommands of 'set style' control specific forms of styling. These
  16480. subcommands all follow the same pattern: each style-able object can be
  16481. styled with a foreground color, a background color, and an intensity.
  16482. For example, the style of file names can be controlled using the 'set
  16483. style filename' group of commands:
  16484. 'set style filename background COLOR'
  16485. Set the background to COLOR. Valid colors are 'none' (meaning the
  16486. terminal's default color), 'black', 'red', 'green', 'yellow',
  16487. 'blue', 'magenta', 'cyan', and'white'.
  16488. 'set style filename foreground COLOR'
  16489. Set the foreground to COLOR. Valid colors are 'none' (meaning the
  16490. terminal's default color), 'black', 'red', 'green', 'yellow',
  16491. 'blue', 'magenta', 'cyan', and'white'.
  16492. 'set style filename intensity VALUE'
  16493. Set the intensity to VALUE. Valid intensities are 'normal' (the
  16494. default), 'bold', and 'dim'.
  16495. The style-able objects are:
  16496. 'filename'
  16497. Control the styling of file names. By default, this style's
  16498. foreground color is green.
  16499. 'function'
  16500. Control the styling of function names. These are managed with the
  16501. 'set style function' family of commands. By default, this style's
  16502. foreground color is yellow.
  16503. 'variable'
  16504. Control the styling of variable names. These are managed with the
  16505. 'set style variable' family of commands. By default, this style's
  16506. foreground color is cyan.
  16507. 'address'
  16508. Control the styling of addresses. These are managed with the 'set
  16509. style address' family of commands. By default, this style's
  16510. foreground color is blue.
  16511. 
  16512. File: gdb.info, Node: Numbers, Next: ABI, Prev: Output Styling, Up: Controlling GDB
  16513. 22.6 Numbers
  16514. ============
  16515. You can always enter numbers in octal, decimal, or hexadecimal in GDB by
  16516. the usual conventions: octal numbers begin with '0', decimal numbers end
  16517. with '.', and hexadecimal numbers begin with '0x'. Numbers that neither
  16518. begin with '0' or '0x', nor end with a '.' are, by default, entered in
  16519. base 10; likewise, the default display for numbers--when no particular
  16520. format is specified--is base 10. You can change the default base for
  16521. both input and output with the commands described below.
  16522. 'set input-radix BASE'
  16523. Set the default base for numeric input. Supported choices for BASE
  16524. are decimal 8, 10, or 16. The base must itself be specified either
  16525. unambiguously or using the current input radix; for example, any of
  16526. set input-radix 012
  16527. set input-radix 10.
  16528. set input-radix 0xa
  16529. sets the input base to decimal. On the other hand, 'set
  16530. input-radix 10' leaves the input radix unchanged, no matter what it
  16531. was, since '10', being without any leading or trailing signs of its
  16532. base, is interpreted in the current radix. Thus, if the current
  16533. radix is 16, '10' is interpreted in hex, i.e. as 16 decimal, which
  16534. doesn't change the radix.
  16535. 'set output-radix BASE'
  16536. Set the default base for numeric display. Supported choices for
  16537. BASE are decimal 8, 10, or 16. The base must itself be specified
  16538. either unambiguously or using the current input radix.
  16539. 'show input-radix'
  16540. Display the current default base for numeric input.
  16541. 'show output-radix'
  16542. Display the current default base for numeric display.
  16543. 'set radix [BASE]'
  16544. 'show radix'
  16545. These commands set and show the default base for both input and
  16546. output of numbers. 'set radix' sets the radix of input and output
  16547. to the same base; without an argument, it resets the radix back to
  16548. its default value of 10.
  16549. 
  16550. File: gdb.info, Node: ABI, Next: Auto-loading, Prev: Numbers, Up: Controlling GDB
  16551. 22.7 Configuring the Current ABI
  16552. ================================
  16553. GDB can determine the "ABI" (Application Binary Interface) of your
  16554. application automatically. However, sometimes you need to override its
  16555. conclusions. Use these commands to manage GDB's view of the current
  16556. ABI.
  16557. One GDB configuration can debug binaries for multiple operating
  16558. system targets, either via remote debugging or native emulation. GDB
  16559. will autodetect the "OS ABI" (Operating System ABI) in use, but you can
  16560. override its conclusion using the 'set osabi' command. One example
  16561. where this is useful is in debugging of binaries which use an alternate
  16562. C library (e.g. UCLIBC for GNU/Linux) which does not have the same
  16563. identifying marks that the standard C library for your platform
  16564. provides.
  16565. When GDB is debugging the AArch64 architecture, it provides a
  16566. "Newlib" OS ABI. This is useful for handling 'setjmp' and 'longjmp' when
  16567. debugging binaries that use the NEWLIB C library. The "Newlib" OS ABI
  16568. can be selected by 'set osabi Newlib'.
  16569. 'show osabi'
  16570. Show the OS ABI currently in use.
  16571. 'set osabi'
  16572. With no argument, show the list of registered available OS ABI's.
  16573. 'set osabi ABI'
  16574. Set the current OS ABI to ABI.
  16575. Generally, the way that an argument of type 'float' is passed to a
  16576. function depends on whether the function is prototyped. For a
  16577. prototyped (i.e. ANSI/ISO style) function, 'float' arguments are passed
  16578. unchanged, according to the architecture's convention for 'float'. For
  16579. unprototyped (i.e. K&R style) functions, 'float' arguments are first
  16580. promoted to type 'double' and then passed.
  16581. Unfortunately, some forms of debug information do not reliably
  16582. indicate whether a function is prototyped. If GDB calls a function that
  16583. is not marked as prototyped, it consults 'set coerce-float-to-double'.
  16584. 'set coerce-float-to-double'
  16585. 'set coerce-float-to-double on'
  16586. Arguments of type 'float' will be promoted to 'double' when passed
  16587. to an unprototyped function. This is the default setting.
  16588. 'set coerce-float-to-double off'
  16589. Arguments of type 'float' will be passed directly to unprototyped
  16590. functions.
  16591. 'show coerce-float-to-double'
  16592. Show the current setting of promoting 'float' to 'double'.
  16593. GDB needs to know the ABI used for your program's C++ objects. The
  16594. correct C++ ABI depends on which C++ compiler was used to build your
  16595. application. GDB only fully supports programs with a single C++ ABI; if
  16596. your program contains code using multiple C++ ABI's or if GDB can not
  16597. identify your program's ABI correctly, you can tell GDB which ABI to
  16598. use. Currently supported ABI's include "gnu-v2", for 'g++' versions
  16599. before 3.0, "gnu-v3", for 'g++' versions 3.0 and later, and "hpaCC" for
  16600. the HP ANSI C++ compiler. Other C++ compilers may use the "gnu-v2" or
  16601. "gnu-v3" ABI's as well. The default setting is "auto".
  16602. 'show cp-abi'
  16603. Show the C++ ABI currently in use.
  16604. 'set cp-abi'
  16605. With no argument, show the list of supported C++ ABI's.
  16606. 'set cp-abi ABI'
  16607. 'set cp-abi auto'
  16608. Set the current C++ ABI to ABI, or return to automatic detection.
  16609. 
  16610. File: gdb.info, Node: Auto-loading, Next: Messages/Warnings, Prev: ABI, Up: Controlling GDB
  16611. 22.8 Automatically loading associated files
  16612. ===========================================
  16613. GDB sometimes reads files with commands and settings automatically,
  16614. without being explicitly told so by the user. We call this feature
  16615. "auto-loading". While auto-loading is useful for automatically adapting
  16616. GDB to the needs of your project, it can sometimes produce unexpected
  16617. results or introduce security risks (e.g., if the file comes from
  16618. untrusted sources).
  16619. * Menu:
  16620. * Init File in the Current Directory:: 'set/show/info auto-load local-gdbinit'
  16621. * libthread_db.so.1 file:: 'set/show/info auto-load libthread-db'
  16622. * Auto-loading safe path:: 'set/show/info auto-load safe-path'
  16623. * Auto-loading verbose mode:: 'set/show debug auto-load'
  16624. There are various kinds of files GDB can automatically load. In
  16625. addition to these files, GDB supports auto-loading code written in
  16626. various extension languages. *Note Auto-loading extensions::.
  16627. Note that loading of these associated files (including the local
  16628. '.gdbinit' file) requires accordingly configured 'auto-load safe-path'
  16629. (*note Auto-loading safe path::).
  16630. For these reasons, GDB includes commands and options to let you
  16631. control when to auto-load files and which files should be auto-loaded.
  16632. 'set auto-load off'
  16633. Globally disable loading of all auto-loaded files. You may want to
  16634. use this command with the '-iex' option (*note Option
  16635. -init-eval-command::) such as:
  16636. $ gdb -iex "set auto-load off" untrusted-executable corefile
  16637. Be aware that system init file (*note System-wide configuration::)
  16638. and init files from your home directory (*note Home Directory Init
  16639. File::) still get read (as they come from generally trusted
  16640. directories). To prevent GDB from auto-loading even those init
  16641. files, use the '-nx' option (*note Mode Options::), in addition to
  16642. 'set auto-load no'.
  16643. 'show auto-load'
  16644. Show whether auto-loading of each specific 'auto-load' file(s) is
  16645. enabled or disabled.
  16646. (gdb) show auto-load
  16647. gdb-scripts: Auto-loading of canned sequences of commands scripts is on.
  16648. libthread-db: Auto-loading of inferior specific libthread_db is on.
  16649. local-gdbinit: Auto-loading of .gdbinit script from current directory
  16650. is on.
  16651. python-scripts: Auto-loading of Python scripts is on.
  16652. safe-path: List of directories from which it is safe to auto-load files
  16653. is $debugdir:$datadir/auto-load.
  16654. scripts-directory: List of directories from which to load auto-loaded scripts
  16655. is $debugdir:$datadir/auto-load.
  16656. 'info auto-load'
  16657. Print whether each specific 'auto-load' file(s) have been
  16658. auto-loaded or not.
  16659. (gdb) info auto-load
  16660. gdb-scripts:
  16661. Loaded Script
  16662. Yes /home/user/gdb/gdb-gdb.gdb
  16663. libthread-db: No auto-loaded libthread-db.
  16664. local-gdbinit: Local .gdbinit file "/home/user/gdb/.gdbinit" has been
  16665. loaded.
  16666. python-scripts:
  16667. Loaded Script
  16668. Yes /home/user/gdb/gdb-gdb.py
  16669. These are GDB control commands for the auto-loading:
  16670. *Note set auto-load off::. Disable auto-loading globally.
  16671. *Note show auto-load::. Show setting of all kinds of
  16672. files.
  16673. *Note info auto-load::. Show state of all kinds of files.
  16674. *Note set auto-load gdb-scripts::. Control for GDB command scripts.
  16675. *Note show auto-load Show setting of GDB command
  16676. gdb-scripts::. scripts.
  16677. *Note info auto-load Show state of GDB command scripts.
  16678. gdb-scripts::.
  16679. *Note set auto-load Control for GDB Python scripts.
  16680. python-scripts::.
  16681. *Note show auto-load Show setting of GDB Python
  16682. python-scripts::. scripts.
  16683. *Note info auto-load Show state of GDB Python scripts.
  16684. python-scripts::.
  16685. *Note set auto-load Control for GDB Guile scripts.
  16686. guile-scripts::.
  16687. *Note show auto-load Show setting of GDB Guile scripts.
  16688. guile-scripts::.
  16689. *Note info auto-load Show state of GDB Guile scripts.
  16690. guile-scripts::.
  16691. *Note set auto-load Control for GDB auto-loaded
  16692. scripts-directory::. scripts location.
  16693. *Note show auto-load Show GDB auto-loaded scripts
  16694. scripts-directory::. location.
  16695. *Note Add directory for auto-loaded
  16696. add-auto-load-scripts-directory::. scripts location list.
  16697. *Note set auto-load Control for init file in the
  16698. local-gdbinit::. current directory.
  16699. *Note show auto-load Show setting of init file in the
  16700. local-gdbinit::. current directory.
  16701. *Note info auto-load Show state of init file in the
  16702. local-gdbinit::. current directory.
  16703. *Note set auto-load Control for thread debugging
  16704. libthread-db::. library.
  16705. *Note show auto-load Show setting of thread debugging
  16706. libthread-db::. library.
  16707. *Note info auto-load Show state of thread debugging
  16708. libthread-db::. library.
  16709. *Note set auto-load safe-path::. Control directories trusted for
  16710. automatic loading.
  16711. *Note show auto-load safe-path::. Show directories trusted for
  16712. automatic loading.
  16713. *Note add-auto-load-safe-path::. Add directory trusted for
  16714. automatic loading.
  16715. 
  16716. File: gdb.info, Node: Init File in the Current Directory, Next: libthread_db.so.1 file, Up: Auto-loading
  16717. 22.8.1 Automatically loading init file in the current directory
  16718. ---------------------------------------------------------------
  16719. By default, GDB reads and executes the canned sequences of commands from
  16720. init file (if any) in the current working directory, see *note Init File
  16721. in the Current Directory during Startup::.
  16722. Note that loading of this local '.gdbinit' file also requires
  16723. accordingly configured 'auto-load safe-path' (*note Auto-loading safe
  16724. path::).
  16725. 'set auto-load local-gdbinit [on|off]'
  16726. Enable or disable the auto-loading of canned sequences of commands
  16727. (*note Sequences::) found in init file in the current directory.
  16728. 'show auto-load local-gdbinit'
  16729. Show whether auto-loading of canned sequences of commands from init
  16730. file in the current directory is enabled or disabled.
  16731. 'info auto-load local-gdbinit'
  16732. Print whether canned sequences of commands from init file in the
  16733. current directory have been auto-loaded.
  16734. 
  16735. File: gdb.info, Node: libthread_db.so.1 file, Next: Auto-loading safe path, Prev: Init File in the Current Directory, Up: Auto-loading
  16736. 22.8.2 Automatically loading thread debugging library
  16737. -----------------------------------------------------
  16738. This feature is currently present only on GNU/Linux native hosts.
  16739. GDB reads in some cases thread debugging library from places specific
  16740. to the inferior (*note set libthread-db-search-path::).
  16741. The special 'libthread-db-search-path' entry '$sdir' is processed
  16742. without checking this 'set auto-load libthread-db' switch as system
  16743. libraries have to be trusted in general. In all other cases of
  16744. 'libthread-db-search-path' entries GDB checks first if 'set auto-load
  16745. libthread-db' is enabled before trying to open such thread debugging
  16746. library.
  16747. Note that loading of this debugging library also requires accordingly
  16748. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  16749. 'set auto-load libthread-db [on|off]'
  16750. Enable or disable the auto-loading of inferior specific thread
  16751. debugging library.
  16752. 'show auto-load libthread-db'
  16753. Show whether auto-loading of inferior specific thread debugging
  16754. library is enabled or disabled.
  16755. 'info auto-load libthread-db'
  16756. Print the list of all loaded inferior specific thread debugging
  16757. libraries and for each such library print list of inferior PIDs
  16758. using it.
  16759. 
  16760. File: gdb.info, Node: Auto-loading safe path, Next: Auto-loading verbose mode, Prev: libthread_db.so.1 file, Up: Auto-loading
  16761. 22.8.3 Security restriction for auto-loading
  16762. --------------------------------------------
  16763. As the files of inferior can come from untrusted source (such as
  16764. submitted by an application user) GDB does not always load any files
  16765. automatically. GDB provides the 'set auto-load safe-path' setting to
  16766. list directories trusted for loading files not explicitly requested by
  16767. user. Each directory can also be a shell wildcard pattern.
  16768. If the path is not set properly you will see a warning and the file
  16769. will not get loaded:
  16770. $ ./gdb -q ./gdb
  16771. Reading symbols from /home/user/gdb/gdb...done.
  16772. warning: File "/home/user/gdb/gdb-gdb.gdb" auto-loading has been
  16773. declined by your `auto-load safe-path' set
  16774. to "$debugdir:$datadir/auto-load".
  16775. warning: File "/home/user/gdb/gdb-gdb.py" auto-loading has been
  16776. declined by your `auto-load safe-path' set
  16777. to "$debugdir:$datadir/auto-load".
  16778. To instruct GDB to go ahead and use the init files anyway, invoke GDB
  16779. like this:
  16780. $ gdb -q -iex "set auto-load safe-path /home/user/gdb" ./gdb
  16781. The list of trusted directories is controlled by the following
  16782. commands:
  16783. 'set auto-load safe-path [DIRECTORIES]'
  16784. Set the list of directories (and their subdirectories) trusted for
  16785. automatic loading and execution of scripts. You can also enter a
  16786. specific trusted file. Each directory can also be a shell wildcard
  16787. pattern; wildcards do not match directory separator - see
  16788. 'FNM_PATHNAME' for system function 'fnmatch' (*note fnmatch:
  16789. (libc)Wildcard Matching.). If you omit DIRECTORIES, 'auto-load
  16790. safe-path' will be reset to its default value as specified during
  16791. GDB compilation.
  16792. The list of directories uses path separator (':' on GNU and Unix
  16793. systems, ';' on MS-Windows and MS-DOS) to separate directories,
  16794. similarly to the 'PATH' environment variable.
  16795. 'show auto-load safe-path'
  16796. Show the list of directories trusted for automatic loading and
  16797. execution of scripts.
  16798. 'add-auto-load-safe-path'
  16799. Add an entry (or list of entries) to the list of directories
  16800. trusted for automatic loading and execution of scripts. Multiple
  16801. entries may be delimited by the host platform path separator in
  16802. use.
  16803. This variable defaults to what '--with-auto-load-dir' has been
  16804. configured to (*note with-auto-load-dir::). '$debugdir' and '$datadir'
  16805. substitution applies the same as for *note set auto-load
  16806. scripts-directory::. The default 'set auto-load safe-path' value can be
  16807. also overriden by GDB configuration option '--with-auto-load-safe-path'.
  16808. Setting this variable to '/' disables this security protection,
  16809. corresponding GDB configuration option is
  16810. '--without-auto-load-safe-path'. This variable is supposed to be set to
  16811. the system directories writable by the system superuser only. Users can
  16812. add their source directories in init files in their home directories
  16813. (*note Home Directory Init File::). See also deprecated init file in
  16814. the current directory (*note Init File in the Current Directory during
  16815. Startup::).
  16816. To force GDB to load the files it declined to load in the previous
  16817. example, you could use one of the following ways:
  16818. '~/.gdbinit': 'add-auto-load-safe-path ~/src/gdb'
  16819. Specify this trusted directory (or a file) as additional component
  16820. of the list. You have to specify also any existing directories
  16821. displayed by by 'show auto-load safe-path' (such as '/usr:/bin' in
  16822. this example).
  16823. 'gdb -iex "set auto-load safe-path /usr:/bin:~/src/gdb" ...'
  16824. Specify this directory as in the previous case but just for a
  16825. single GDB session.
  16826. 'gdb -iex "set auto-load safe-path /" ...'
  16827. Disable auto-loading safety for a single GDB session. This assumes
  16828. all the files you debug during this GDB session will come from
  16829. trusted sources.
  16830. './configure --without-auto-load-safe-path'
  16831. During compilation of GDB you may disable any auto-loading safety.
  16832. This assumes all the files you will ever debug with this GDB come
  16833. from trusted sources.
  16834. On the other hand you can also explicitly forbid automatic files
  16835. loading which also suppresses any such warning messages:
  16836. 'gdb -iex "set auto-load no" ...'
  16837. You can use GDB command-line option for a single GDB session.
  16838. '~/.gdbinit': 'set auto-load no'
  16839. Disable auto-loading globally for the user (*note Home Directory
  16840. Init File::). While it is improbable, you could also use system
  16841. init file instead (*note System-wide configuration::).
  16842. This setting applies to the file names as entered by user. If no
  16843. entry matches GDB tries as a last resort to also resolve all the file
  16844. names into their canonical form (typically resolving symbolic links) and
  16845. compare the entries again. GDB already canonicalizes most of the
  16846. filenames on its own before starting the comparison so a canonical form
  16847. of directories is recommended to be entered.
  16848. 
  16849. File: gdb.info, Node: Auto-loading verbose mode, Prev: Auto-loading safe path, Up: Auto-loading
  16850. 22.8.4 Displaying files tried for auto-load
  16851. -------------------------------------------
  16852. For better visibility of all the file locations where you can place
  16853. scripts to be auto-loaded with inferior -- or to protect yourself
  16854. against accidental execution of untrusted scripts -- GDB provides a
  16855. feature for printing all the files attempted to be loaded. Both
  16856. existing and non-existing files may be printed.
  16857. For example the list of directories from which it is safe to
  16858. auto-load files (*note Auto-loading safe path::) applies also to
  16859. canonicalized filenames which may not be too obvious while setting it
  16860. up.
  16861. (gdb) set debug auto-load on
  16862. (gdb) file ~/src/t/true
  16863. auto-load: Loading canned sequences of commands script "/tmp/true-gdb.gdb"
  16864. for objfile "/tmp/true".
  16865. auto-load: Updating directories of "/usr:/opt".
  16866. auto-load: Using directory "/usr".
  16867. auto-load: Using directory "/opt".
  16868. warning: File "/tmp/true-gdb.gdb" auto-loading has been declined
  16869. by your `auto-load safe-path' set to "/usr:/opt".
  16870. 'set debug auto-load [on|off]'
  16871. Set whether to print the filenames attempted to be auto-loaded.
  16872. 'show debug auto-load'
  16873. Show whether printing of the filenames attempted to be auto-loaded
  16874. is turned on or off.
  16875. 
  16876. File: gdb.info, Node: Messages/Warnings, Next: Debugging Output, Prev: Auto-loading, Up: Controlling GDB
  16877. 22.9 Optional Warnings and Messages
  16878. ===================================
  16879. By default, GDB is silent about its inner workings. If you are running
  16880. on a slow machine, you may want to use the 'set verbose' command. This
  16881. makes GDB tell you when it does a lengthy internal operation, so you
  16882. will not think it has crashed.
  16883. Currently, the messages controlled by 'set verbose' are those which
  16884. announce that the symbol table for a source file is being read; see
  16885. 'symbol-file' in *note Commands to Specify Files: Files.
  16886. 'set verbose on'
  16887. Enables GDB output of certain informational messages.
  16888. 'set verbose off'
  16889. Disables GDB output of certain informational messages.
  16890. 'show verbose'
  16891. Displays whether 'set verbose' is on or off.
  16892. By default, if GDB encounters bugs in the symbol table of an object
  16893. file, it is silent; but if you are debugging a compiler, you may find
  16894. this information useful (*note Errors Reading Symbol Files: Symbol
  16895. Errors.).
  16896. 'set complaints LIMIT'
  16897. Permits GDB to output LIMIT complaints about each type of unusual
  16898. symbols before becoming silent about the problem. Set LIMIT to
  16899. zero to suppress all complaints; set it to a large number to
  16900. prevent complaints from being suppressed.
  16901. 'show complaints'
  16902. Displays how many symbol complaints GDB is permitted to produce.
  16903. By default, GDB is cautious, and asks what sometimes seems to be a
  16904. lot of stupid questions to confirm certain commands. For example, if
  16905. you try to run a program which is already running:
  16906. (gdb) run
  16907. The program being debugged has been started already.
  16908. Start it from the beginning? (y or n)
  16909. If you are willing to unflinchingly face the consequences of your own
  16910. commands, you can disable this "feature":
  16911. 'set confirm off'
  16912. Disables confirmation requests. Note that running GDB with the
  16913. '--batch' option (*note -batch: Mode Options.) also automatically
  16914. disables confirmation requests.
  16915. 'set confirm on'
  16916. Enables confirmation requests (the default).
  16917. 'show confirm'
  16918. Displays state of confirmation requests.
  16919. If you need to debug user-defined commands or sourced files you may
  16920. find it useful to enable "command tracing". In this mode each command
  16921. will be printed as it is executed, prefixed with one or more '+'
  16922. symbols, the quantity denoting the call depth of each command.
  16923. 'set trace-commands on'
  16924. Enable command tracing.
  16925. 'set trace-commands off'
  16926. Disable command tracing.
  16927. 'show trace-commands'
  16928. Display the current state of command tracing.
  16929. 
  16930. File: gdb.info, Node: Debugging Output, Next: Other Misc Settings, Prev: Messages/Warnings, Up: Controlling GDB
  16931. 22.10 Optional Messages about Internal Happenings
  16932. =================================================
  16933. GDB has commands that enable optional debugging messages from various
  16934. GDB subsystems; normally these commands are of interest to GDB
  16935. maintainers, or when reporting a bug. This section documents those
  16936. commands.
  16937. 'set exec-done-display'
  16938. Turns on or off the notification of asynchronous commands'
  16939. completion. When on, GDB will print a message when an asynchronous
  16940. command finishes its execution. The default is off.
  16941. 'show exec-done-display'
  16942. Displays the current setting of asynchronous command completion
  16943. notification.
  16944. 'set debug aarch64'
  16945. Turns on or off display of debugging messages related to ARM
  16946. AArch64. The default is off.
  16947. 'show debug aarch64'
  16948. Displays the current state of displaying debugging messages related
  16949. to ARM AArch64.
  16950. 'set debug arch'
  16951. Turns on or off display of gdbarch debugging info. The default is
  16952. off
  16953. 'show debug arch'
  16954. Displays the current state of displaying gdbarch debugging info.
  16955. 'set debug aix-solib'
  16956. Control display of debugging messages from the AIX shared library
  16957. support module. The default is off.
  16958. 'show debug aix-thread'
  16959. Show the current state of displaying AIX shared library debugging
  16960. messages.
  16961. 'set debug aix-thread'
  16962. Display debugging messages about inner workings of the AIX thread
  16963. module.
  16964. 'show debug aix-thread'
  16965. Show the current state of AIX thread debugging info display.
  16966. 'set debug check-physname'
  16967. Check the results of the "physname" computation. When reading
  16968. DWARF debugging information for C++, GDB attempts to compute each
  16969. entity's name. GDB can do this computation in two different ways,
  16970. depending on exactly what information is present. When enabled,
  16971. this setting causes GDB to compute the names both ways and display
  16972. any discrepancies.
  16973. 'show debug check-physname'
  16974. Show the current state of "physname" checking.
  16975. 'set debug coff-pe-read'
  16976. Control display of debugging messages related to reading of COFF/PE
  16977. exported symbols. The default is off.
  16978. 'show debug coff-pe-read'
  16979. Displays the current state of displaying debugging messages related
  16980. to reading of COFF/PE exported symbols.
  16981. 'set debug dwarf-die'
  16982. Dump DWARF DIEs after they are read in. The value is the number of
  16983. nesting levels to print. A value of zero turns off the display.
  16984. 'show debug dwarf-die'
  16985. Show the current state of DWARF DIE debugging.
  16986. 'set debug dwarf-line'
  16987. Turns on or off display of debugging messages related to reading
  16988. DWARF line tables. The default is 0 (off). A value of 1 provides
  16989. basic information. A value greater than 1 provides more verbose
  16990. information.
  16991. 'show debug dwarf-line'
  16992. Show the current state of DWARF line table debugging.
  16993. 'set debug dwarf-read'
  16994. Turns on or off display of debugging messages related to reading
  16995. DWARF debug info. The default is 0 (off). A value of 1 provides
  16996. basic information. A value greater than 1 provides more verbose
  16997. information.
  16998. 'show debug dwarf-read'
  16999. Show the current state of DWARF reader debugging.
  17000. 'set debug displaced'
  17001. Turns on or off display of GDB debugging info for the displaced
  17002. stepping support. The default is off.
  17003. 'show debug displaced'
  17004. Displays the current state of displaying GDB debugging info related
  17005. to displaced stepping.
  17006. 'set debug event'
  17007. Turns on or off display of GDB event debugging info. The default
  17008. is off.
  17009. 'show debug event'
  17010. Displays the current state of displaying GDB event debugging info.
  17011. 'set debug expression'
  17012. Turns on or off display of debugging info about GDB expression
  17013. parsing. The default is off.
  17014. 'show debug expression'
  17015. Displays the current state of displaying debugging info about GDB
  17016. expression parsing.
  17017. 'set debug fbsd-lwp'
  17018. Turns on or off debugging messages from the FreeBSD LWP debug
  17019. support.
  17020. 'show debug fbsd-lwp'
  17021. Show the current state of FreeBSD LWP debugging messages.
  17022. 'set debug fbsd-nat'
  17023. Turns on or off debugging messages from the FreeBSD native target.
  17024. 'show debug fbsd-nat'
  17025. Show the current state of FreeBSD native target debugging messages.
  17026. 'set debug frame'
  17027. Turns on or off display of GDB frame debugging info. The default
  17028. is off.
  17029. 'show debug frame'
  17030. Displays the current state of displaying GDB frame debugging info.
  17031. 'set debug gnu-nat'
  17032. Turn on or off debugging messages from the GNU/Hurd debug support.
  17033. 'show debug gnu-nat'
  17034. Show the current state of GNU/Hurd debugging messages.
  17035. 'set debug infrun'
  17036. Turns on or off display of GDB debugging info for running the
  17037. inferior. The default is off. 'infrun.c' contains GDB's runtime
  17038. state machine used for implementing operations such as
  17039. single-stepping the inferior.
  17040. 'show debug infrun'
  17041. Displays the current state of GDB inferior debugging.
  17042. 'set debug jit'
  17043. Turn on or off debugging messages from JIT debug support.
  17044. 'show debug jit'
  17045. Displays the current state of GDB JIT debugging.
  17046. 'set debug lin-lwp'
  17047. Turn on or off debugging messages from the Linux LWP debug support.
  17048. 'show debug lin-lwp'
  17049. Show the current state of Linux LWP debugging messages.
  17050. 'set debug linux-namespaces'
  17051. Turn on or off debugging messages from the Linux namespaces debug
  17052. support.
  17053. 'show debug linux-namespaces'
  17054. Show the current state of Linux namespaces debugging messages.
  17055. 'set debug mach-o'
  17056. Control display of debugging messages related to Mach-O symbols
  17057. processing. The default is off.
  17058. 'show debug mach-o'
  17059. Displays the current state of displaying debugging messages related
  17060. to reading of COFF/PE exported symbols.
  17061. 'set debug notification'
  17062. Turn on or off debugging messages about remote async notification.
  17063. The default is off.
  17064. 'show debug notification'
  17065. Displays the current state of remote async notification debugging
  17066. messages.
  17067. 'set debug observer'
  17068. Turns on or off display of GDB observer debugging. This includes
  17069. info such as the notification of observable events.
  17070. 'show debug observer'
  17071. Displays the current state of observer debugging.
  17072. 'set debug overload'
  17073. Turns on or off display of GDB C++ overload debugging info. This
  17074. includes info such as ranking of functions, etc. The default is
  17075. off.
  17076. 'show debug overload'
  17077. Displays the current state of displaying GDB C++ overload debugging
  17078. info.
  17079. 'set debug parser'
  17080. Turns on or off the display of expression parser debugging output.
  17081. Internally, this sets the 'yydebug' variable in the expression
  17082. parser. *Note Tracing Your Parser: (bison)Tracing, for details.
  17083. The default is off.
  17084. 'show debug parser'
  17085. Show the current state of expression parser debugging.
  17086. 'set debug remote'
  17087. Turns on or off display of reports on all packets sent back and
  17088. forth across the serial line to the remote machine. The info is
  17089. printed on the GDB standard output stream. The default is off.
  17090. 'show debug remote'
  17091. Displays the state of display of remote packets.
  17092. 'set debug separate-debug-file'
  17093. Turns on or off display of debug output about separate debug file
  17094. search.
  17095. 'show debug separate-debug-file'
  17096. Displays the state of separate debug file search debug output.
  17097. 'set debug serial'
  17098. Turns on or off display of GDB serial debugging info. The default
  17099. is off.
  17100. 'show debug serial'
  17101. Displays the current state of displaying GDB serial debugging info.
  17102. 'set debug solib-frv'
  17103. Turn on or off debugging messages for FR-V shared-library code.
  17104. 'show debug solib-frv'
  17105. Display the current state of FR-V shared-library code debugging
  17106. messages.
  17107. 'set debug symbol-lookup'
  17108. Turns on or off display of debugging messages related to symbol
  17109. lookup. The default is 0 (off). A value of 1 provides basic
  17110. information. A value greater than 1 provides more verbose
  17111. information.
  17112. 'show debug symbol-lookup'
  17113. Show the current state of symbol lookup debugging messages.
  17114. 'set debug symfile'
  17115. Turns on or off display of debugging messages related to symbol
  17116. file functions. The default is off. *Note Files::.
  17117. 'show debug symfile'
  17118. Show the current state of symbol file debugging messages.
  17119. 'set debug symtab-create'
  17120. Turns on or off display of debugging messages related to symbol
  17121. table creation. The default is 0 (off). A value of 1 provides
  17122. basic information. A value greater than 1 provides more verbose
  17123. information.
  17124. 'show debug symtab-create'
  17125. Show the current state of symbol table creation debugging.
  17126. 'set debug target'
  17127. Turns on or off display of GDB target debugging info. This info
  17128. includes what is going on at the target level of GDB, as it
  17129. happens. The default is 0. Set it to 1 to track events, and to 2
  17130. to also track the value of large memory transfers.
  17131. 'show debug target'
  17132. Displays the current state of displaying GDB target debugging info.
  17133. 'set debug timestamp'
  17134. Turns on or off display of timestamps with GDB debugging info.
  17135. When enabled, seconds and microseconds are displayed before each
  17136. debugging message.
  17137. 'show debug timestamp'
  17138. Displays the current state of displaying timestamps with GDB
  17139. debugging info.
  17140. 'set debug varobj'
  17141. Turns on or off display of GDB variable object debugging info. The
  17142. default is off.
  17143. 'show debug varobj'
  17144. Displays the current state of displaying GDB variable object
  17145. debugging info.
  17146. 'set debug xml'
  17147. Turn on or off debugging messages for built-in XML parsers.
  17148. 'show debug xml'
  17149. Displays the current state of XML debugging messages.
  17150. 
  17151. File: gdb.info, Node: Other Misc Settings, Prev: Debugging Output, Up: Controlling GDB
  17152. 22.11 Other Miscellaneous Settings
  17153. ==================================
  17154. 'set interactive-mode'
  17155. If 'on', forces GDB to assume that GDB was started in a terminal.
  17156. In practice, this means that GDB should wait for the user to answer
  17157. queries generated by commands entered at the command prompt. If
  17158. 'off', forces GDB to operate in the opposite mode, and it uses the
  17159. default answers to all queries. If 'auto' (the default), GDB tries
  17160. to determine whether its standard input is a terminal, and works in
  17161. interactive-mode if it is, non-interactively otherwise.
  17162. In the vast majority of cases, the debugger should be able to guess
  17163. correctly which mode should be used. But this setting can be
  17164. useful in certain specific cases, such as running a MinGW GDB
  17165. inside a cygwin window.
  17166. 'show interactive-mode'
  17167. Displays whether the debugger is operating in interactive mode or
  17168. not.
  17169. 
  17170. File: gdb.info, Node: Extending GDB, Next: Interpreters, Prev: Controlling GDB, Up: Top
  17171. 23 Extending GDB
  17172. ****************
  17173. GDB provides several mechanisms for extension. GDB also provides the
  17174. ability to automatically load extensions when it reads a file for
  17175. debugging. This allows the user to automatically customize GDB for the
  17176. program being debugged.
  17177. * Menu:
  17178. * Sequences:: Canned Sequences of GDB Commands
  17179. * Python:: Extending GDB using Python
  17180. * Guile:: Extending GDB using Guile
  17181. * Auto-loading extensions:: Automatically loading extensions
  17182. * Multiple Extension Languages:: Working with multiple extension languages
  17183. * Aliases:: Creating new spellings of existing commands
  17184. To facilitate the use of extension languages, GDB is capable of
  17185. evaluating the contents of a file. When doing so, GDB can recognize
  17186. which extension language is being used by looking at the filename
  17187. extension. Files with an unrecognized filename extension are always
  17188. treated as a GDB Command Files. *Note Command files: Command Files.
  17189. You can control how GDB evaluates these files with the following
  17190. setting:
  17191. 'set script-extension off'
  17192. All scripts are always evaluated as GDB Command Files.
  17193. 'set script-extension soft'
  17194. The debugger determines the scripting language based on filename
  17195. extension. If this scripting language is supported, GDB evaluates
  17196. the script using that language. Otherwise, it evaluates the file
  17197. as a GDB Command File.
  17198. 'set script-extension strict'
  17199. The debugger determines the scripting language based on filename
  17200. extension, and evaluates the script using that language. If the
  17201. language is not supported, then the evaluation fails.
  17202. 'show script-extension'
  17203. Display the current value of the 'script-extension' option.
  17204. 
  17205. File: gdb.info, Node: Sequences, Next: Python, Up: Extending GDB
  17206. 23.1 Canned Sequences of Commands
  17207. =================================
  17208. Aside from breakpoint commands (*note Breakpoint Command Lists: Break
  17209. Commands.), GDB provides two ways to store sequences of commands for
  17210. execution as a unit: user-defined commands and command files.
  17211. * Menu:
  17212. * Define:: How to define your own commands
  17213. * Hooks:: Hooks for user-defined commands
  17214. * Command Files:: How to write scripts of commands to be stored in a file
  17215. * Output:: Commands for controlled output
  17216. * Auto-loading sequences:: Controlling auto-loaded command files
  17217. 
  17218. File: gdb.info, Node: Define, Next: Hooks, Up: Sequences
  17219. 23.1.1 User-defined Commands
  17220. ----------------------------
  17221. A "user-defined command" is a sequence of GDB commands to which you
  17222. assign a new name as a command. This is done with the 'define' command.
  17223. User commands may accept an unlimited number of arguments separated by
  17224. whitespace. Arguments are accessed within the user command via
  17225. '$arg0...$argN'. A trivial example:
  17226. define adder
  17227. print $arg0 + $arg1 + $arg2
  17228. end
  17229. To execute the command use:
  17230. adder 1 2 3
  17231. This defines the command 'adder', which prints the sum of its three
  17232. arguments. Note the arguments are text substitutions, so they may
  17233. reference variables, use complex expressions, or even perform inferior
  17234. functions calls.
  17235. In addition, '$argc' may be used to find out how many arguments have
  17236. been passed.
  17237. define adder
  17238. if $argc == 2
  17239. print $arg0 + $arg1
  17240. end
  17241. if $argc == 3
  17242. print $arg0 + $arg1 + $arg2
  17243. end
  17244. end
  17245. Combining with the 'eval' command (*note eval::) makes it easier to
  17246. process a variable number of arguments:
  17247. define adder
  17248. set $i = 0
  17249. set $sum = 0
  17250. while $i < $argc
  17251. eval "set $sum = $sum + $arg%d", $i
  17252. set $i = $i + 1
  17253. end
  17254. print $sum
  17255. end
  17256. 'define COMMANDNAME'
  17257. Define a command named COMMANDNAME. If there is already a command
  17258. by that name, you are asked to confirm that you want to redefine
  17259. it. The argument COMMANDNAME may be a bare command name consisting
  17260. of letters, numbers, dashes, and underscores. It may also start
  17261. with any predefined prefix command. For example, 'define target
  17262. my-target' creates a user-defined 'target my-target' command.
  17263. The definition of the command is made up of other GDB command
  17264. lines, which are given following the 'define' command. The end of
  17265. these commands is marked by a line containing 'end'.
  17266. 'document COMMANDNAME'
  17267. Document the user-defined command COMMANDNAME, so that it can be
  17268. accessed by 'help'. The command COMMANDNAME must already be
  17269. defined. This command reads lines of documentation just as
  17270. 'define' reads the lines of the command definition, ending with
  17271. 'end'. After the 'document' command is finished, 'help' on command
  17272. COMMANDNAME displays the documentation you have written.
  17273. You may use the 'document' command again to change the
  17274. documentation of a command. Redefining the command with 'define'
  17275. does not change the documentation.
  17276. 'dont-repeat'
  17277. Used inside a user-defined command, this tells GDB that this
  17278. command should not be repeated when the user hits <RET> (*note
  17279. repeat last command: Command Syntax.).
  17280. 'help user-defined'
  17281. List all user-defined commands and all python commands defined in
  17282. class COMAND_USER. The first line of the documentation or docstring
  17283. is included (if any).
  17284. 'show user'
  17285. 'show user COMMANDNAME'
  17286. Display the GDB commands used to define COMMANDNAME (but not its
  17287. documentation). If no COMMANDNAME is given, display the
  17288. definitions for all user-defined commands. This does not work for
  17289. user-defined python commands.
  17290. 'show max-user-call-depth'
  17291. 'set max-user-call-depth'
  17292. The value of 'max-user-call-depth' controls how many recursion
  17293. levels are allowed in user-defined commands before GDB suspects an
  17294. infinite recursion and aborts the command. This does not apply to
  17295. user-defined python commands.
  17296. In addition to the above commands, user-defined commands frequently
  17297. use control flow commands, described in *note Command Files::.
  17298. When user-defined commands are executed, the commands of the
  17299. definition are not printed. An error in any command stops execution of
  17300. the user-defined command.
  17301. If used interactively, commands that would ask for confirmation
  17302. proceed without asking when used inside a user-defined command. Many
  17303. GDB commands that normally print messages to say what they are doing
  17304. omit the messages when used in a user-defined command.
  17305. 
  17306. File: gdb.info, Node: Hooks, Next: Command Files, Prev: Define, Up: Sequences
  17307. 23.1.2 User-defined Command Hooks
  17308. ---------------------------------
  17309. You may define "hooks", which are a special kind of user-defined
  17310. command. Whenever you run the command 'foo', if the user-defined
  17311. command 'hook-foo' exists, it is executed (with no arguments) before
  17312. that command.
  17313. A hook may also be defined which is run after the command you
  17314. executed. Whenever you run the command 'foo', if the user-defined
  17315. command 'hookpost-foo' exists, it is executed (with no arguments) after
  17316. that command. Post-execution hooks may exist simultaneously with
  17317. pre-execution hooks, for the same command.
  17318. It is valid for a hook to call the command which it hooks. If this
  17319. occurs, the hook is not re-executed, thereby avoiding infinite
  17320. recursion.
  17321. In addition, a pseudo-command, 'stop' exists. Defining ('hook-stop')
  17322. makes the associated commands execute every time execution stops in your
  17323. program: before breakpoint commands are run, displays are printed, or
  17324. the stack frame is printed.
  17325. For example, to ignore 'SIGALRM' signals while single-stepping, but
  17326. treat them normally during normal execution, you could define:
  17327. define hook-stop
  17328. handle SIGALRM nopass
  17329. end
  17330. define hook-run
  17331. handle SIGALRM pass
  17332. end
  17333. define hook-continue
  17334. handle SIGALRM pass
  17335. end
  17336. As a further example, to hook at the beginning and end of the 'echo'
  17337. command, and to add extra text to the beginning and end of the message,
  17338. you could define:
  17339. define hook-echo
  17340. echo <<<---
  17341. end
  17342. define hookpost-echo
  17343. echo --->>>\n
  17344. end
  17345. (gdb) echo Hello World
  17346. <<<---Hello World--->>>
  17347. (gdb)
  17348. You can define a hook for any single-word command in GDB, but not for
  17349. command aliases; you should define a hook for the basic command name,
  17350. e.g. 'backtrace' rather than 'bt'. You can hook a multi-word command by
  17351. adding 'hook-' or 'hookpost-' to the last word of the command, e.g.
  17352. 'define target hook-remote' to add a hook to 'target remote'.
  17353. If an error occurs during the execution of your hook, execution of
  17354. GDB commands stops and GDB issues a prompt (before the command that you
  17355. actually typed had a chance to run).
  17356. If you try to define a hook which does not match any known command,
  17357. you get a warning from the 'define' command.
  17358. 
  17359. File: gdb.info, Node: Command Files, Next: Output, Prev: Hooks, Up: Sequences
  17360. 23.1.3 Command Files
  17361. --------------------
  17362. A command file for GDB is a text file made of lines that are GDB
  17363. commands. Comments (lines starting with '#') may also be included. An
  17364. empty line in a command file does nothing; it does not mean to repeat
  17365. the last command, as it would from the terminal.
  17366. You can request the execution of a command file with the 'source'
  17367. command. Note that the 'source' command is also used to evaluate
  17368. scripts that are not Command Files. The exact behavior can be
  17369. configured using the 'script-extension' setting. *Note Extending GDB:
  17370. Extending GDB.
  17371. 'source [-s] [-v] FILENAME'
  17372. Execute the command file FILENAME.
  17373. The lines in a command file are generally executed sequentially,
  17374. unless the order of execution is changed by one of the _flow-control
  17375. commands_ described below. The commands are not printed as they are
  17376. executed. An error in any command terminates execution of the command
  17377. file and control is returned to the console.
  17378. GDB first searches for FILENAME in the current directory. If the
  17379. file is not found there, and FILENAME does not specify a directory, then
  17380. GDB also looks for the file on the source search path (specified with
  17381. the 'directory' command); except that '$cdir' is not searched because
  17382. the compilation directory is not relevant to scripts.
  17383. If '-s' is specified, then GDB searches for FILENAME on the search
  17384. path even if FILENAME specifies a directory. The search is done by
  17385. appending FILENAME to each element of the search path. So, for example,
  17386. if FILENAME is 'mylib/myscript' and the search path contains
  17387. '/home/user' then GDB will look for the script
  17388. '/home/user/mylib/myscript'. The search is also done if FILENAME is an
  17389. absolute path. For example, if FILENAME is '/tmp/myscript' and the
  17390. search path contains '/home/user' then GDB will look for the script
  17391. '/home/user/tmp/myscript'. For DOS-like systems, if FILENAME contains a
  17392. drive specification, it is stripped before concatenation. For example,
  17393. if FILENAME is 'd:myscript' and the search path contains 'c:/tmp' then
  17394. GDB will look for the script 'c:/tmp/myscript'.
  17395. If '-v', for verbose mode, is given then GDB displays each command as
  17396. it is executed. The option must be given before FILENAME, and is
  17397. interpreted as part of the filename anywhere else.
  17398. Commands that would ask for confirmation if used interactively
  17399. proceed without asking when used in a command file. Many GDB commands
  17400. that normally print messages to say what they are doing omit the
  17401. messages when called from command files.
  17402. GDB also accepts command input from standard input. In this mode,
  17403. normal output goes to standard output and error output goes to standard
  17404. error. Errors in a command file supplied on standard input do not
  17405. terminate execution of the command file--execution continues with the
  17406. next command.
  17407. gdb < cmds > log 2>&1
  17408. (The syntax above will vary depending on the shell used.) This
  17409. example will execute commands from the file 'cmds'. All output and
  17410. errors would be directed to 'log'.
  17411. Since commands stored on command files tend to be more general than
  17412. commands typed interactively, they frequently need to deal with
  17413. complicated situations, such as different or unexpected values of
  17414. variables and symbols, changes in how the program being debugged is
  17415. built, etc. GDB provides a set of flow-control commands to deal with
  17416. these complexities. Using these commands, you can write complex scripts
  17417. that loop over data structures, execute commands conditionally, etc.
  17418. 'if'
  17419. 'else'
  17420. This command allows to include in your script conditionally
  17421. executed commands. The 'if' command takes a single argument, which
  17422. is an expression to evaluate. It is followed by a series of
  17423. commands that are executed only if the expression is true (its
  17424. value is nonzero). There can then optionally be an 'else' line,
  17425. followed by a series of commands that are only executed if the
  17426. expression was false. The end of the list is marked by a line
  17427. containing 'end'.
  17428. 'while'
  17429. This command allows to write loops. Its syntax is similar to 'if':
  17430. the command takes a single argument, which is an expression to
  17431. evaluate, and must be followed by the commands to execute, one per
  17432. line, terminated by an 'end'. These commands are called the "body"
  17433. of the loop. The commands in the body of 'while' are executed
  17434. repeatedly as long as the expression evaluates to true.
  17435. 'loop_break'
  17436. This command exits the 'while' loop in whose body it is included.
  17437. Execution of the script continues after that 'while's 'end' line.
  17438. 'loop_continue'
  17439. This command skips the execution of the rest of the body of
  17440. commands in the 'while' loop in whose body it is included.
  17441. Execution branches to the beginning of the 'while' loop, where it
  17442. evaluates the controlling expression.
  17443. 'end'
  17444. Terminate the block of commands that are the body of 'if', 'else',
  17445. or 'while' flow-control commands.
  17446. 
  17447. File: gdb.info, Node: Output, Next: Auto-loading sequences, Prev: Command Files, Up: Sequences
  17448. 23.1.4 Commands for Controlled Output
  17449. -------------------------------------
  17450. During the execution of a command file or a user-defined command, normal
  17451. GDB output is suppressed; the only output that appears is what is
  17452. explicitly printed by the commands in the definition. This section
  17453. describes three commands useful for generating exactly the output you
  17454. want.
  17455. 'echo TEXT'
  17456. Print TEXT. Nonprinting characters can be included in TEXT using C
  17457. escape sequences, such as '\n' to print a newline. *No newline is
  17458. printed unless you specify one.* In addition to the standard C
  17459. escape sequences, a backslash followed by a space stands for a
  17460. space. This is useful for displaying a string with spaces at the
  17461. beginning or the end, since leading and trailing spaces are
  17462. otherwise trimmed from all arguments. To print ' and foo = ', use
  17463. the command 'echo \ and foo = \ '.
  17464. A backslash at the end of TEXT can be used, as in C, to continue
  17465. the command onto subsequent lines. For example,
  17466. echo This is some text\n\
  17467. which is continued\n\
  17468. onto several lines.\n
  17469. produces the same output as
  17470. echo This is some text\n
  17471. echo which is continued\n
  17472. echo onto several lines.\n
  17473. 'output EXPRESSION'
  17474. Print the value of EXPRESSION and nothing but that value: no
  17475. newlines, no '$NN = '. The value is not entered in the value
  17476. history either. *Note Expressions: Expressions, for more
  17477. information on expressions.
  17478. 'output/FMT EXPRESSION'
  17479. Print the value of EXPRESSION in format FMT. You can use the same
  17480. formats as for 'print'. *Note Output Formats: Output Formats, for
  17481. more information.
  17482. 'printf TEMPLATE, EXPRESSIONS...'
  17483. Print the values of one or more EXPRESSIONS under the control of
  17484. the string TEMPLATE. To print several values, make EXPRESSIONS be
  17485. a comma-separated list of individual expressions, which may be
  17486. either numbers or pointers. Their values are printed as specified
  17487. by TEMPLATE, exactly as a C program would do by executing the code
  17488. below:
  17489. printf (TEMPLATE, EXPRESSIONS...);
  17490. As in 'C' 'printf', ordinary characters in TEMPLATE are printed
  17491. verbatim, while "conversion specification" introduced by the '%'
  17492. character cause subsequent EXPRESSIONS to be evaluated, their
  17493. values converted and formatted according to type and style
  17494. information encoded in the conversion specifications, and then
  17495. printed.
  17496. For example, you can print two values in hex like this:
  17497. printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
  17498. 'printf' supports all the standard 'C' conversion specifications,
  17499. including the flags and modifiers between the '%' character and the
  17500. conversion letter, with the following exceptions:
  17501. * The argument-ordering modifiers, such as '2$', are not
  17502. supported.
  17503. * The modifier '*' is not supported for specifying precision or
  17504. width.
  17505. * The ''' flag (for separation of digits into groups according
  17506. to 'LC_NUMERIC'') is not supported.
  17507. * The type modifiers 'hh', 'j', 't', and 'z' are not supported.
  17508. * The conversion letter 'n' (as in '%n') is not supported.
  17509. * The conversion letters 'a' and 'A' are not supported.
  17510. Note that the 'll' type modifier is supported only if the
  17511. underlying 'C' implementation used to build GDB supports the 'long
  17512. long int' type, and the 'L' type modifier is supported only if
  17513. 'long double' type is available.
  17514. As in 'C', 'printf' supports simple backslash-escape sequences,
  17515. such as '\n', '\t', '\\', '\"', '\a', and '\f', that consist of
  17516. backslash followed by a single character. Octal and hexadecimal
  17517. escape sequences are not supported.
  17518. Additionally, 'printf' supports conversion specifications for DFP
  17519. ("Decimal Floating Point") types using the following length
  17520. modifiers together with a floating point specifier. letters:
  17521. * 'H' for printing 'Decimal32' types.
  17522. * 'D' for printing 'Decimal64' types.
  17523. * 'DD' for printing 'Decimal128' types.
  17524. If the underlying 'C' implementation used to build GDB has support
  17525. for the three length modifiers for DFP types, other modifiers such
  17526. as width and precision will also be available for GDB to use.
  17527. In case there is no such 'C' support, no additional modifiers will
  17528. be available and the value will be printed in the standard way.
  17529. Here's an example of printing DFP types using the above conversion
  17530. letters:
  17531. printf "D32: %Hf - D64: %Df - D128: %DDf\n",1.2345df,1.2E10dd,1.2E1dl
  17532. 'eval TEMPLATE, EXPRESSIONS...'
  17533. Convert the values of one or more EXPRESSIONS under the control of
  17534. the string TEMPLATE to a command line, and call it.
  17535. 
  17536. File: gdb.info, Node: Auto-loading sequences, Prev: Output, Up: Sequences
  17537. 23.1.5 Controlling auto-loading native GDB scripts
  17538. --------------------------------------------------
  17539. When a new object file is read (for example, due to the 'file' command,
  17540. or because the inferior has loaded a shared library), GDB will look for
  17541. the command file 'OBJFILE-gdb.gdb'. *Note Auto-loading extensions::.
  17542. Auto-loading can be enabled or disabled, and the list of auto-loaded
  17543. scripts can be printed.
  17544. 'set auto-load gdb-scripts [on|off]'
  17545. Enable or disable the auto-loading of canned sequences of commands
  17546. scripts.
  17547. 'show auto-load gdb-scripts'
  17548. Show whether auto-loading of canned sequences of commands scripts
  17549. is enabled or disabled.
  17550. 'info auto-load gdb-scripts [REGEXP]'
  17551. Print the list of all canned sequences of commands scripts that GDB
  17552. auto-loaded.
  17553. If REGEXP is supplied only canned sequences of commands scripts with
  17554. matching names are printed.
  17555. 
  17556. File: gdb.info, Node: Python, Next: Guile, Prev: Sequences, Up: Extending GDB
  17557. 23.2 Extending GDB using Python
  17558. ===============================
  17559. You can extend GDB using the Python programming language
  17560. (http://www.python.org/). This feature is available only if GDB was
  17561. configured using '--with-python'. GDB can be built against either
  17562. Python 2 or Python 3; which one you have depends on this configure-time
  17563. option.
  17564. Python scripts used by GDB should be installed in
  17565. 'DATA-DIRECTORY/python', where DATA-DIRECTORY is the data directory as
  17566. determined at GDB startup (*note Data Files::). This directory, known
  17567. as the "python directory", is automatically added to the Python Search
  17568. Path in order to allow the Python interpreter to locate all scripts
  17569. installed at this location.
  17570. Additionally, GDB commands and convenience functions which are
  17571. written in Python and are located in the
  17572. 'DATA-DIRECTORY/python/gdb/command' or
  17573. 'DATA-DIRECTORY/python/gdb/function' directories are automatically
  17574. imported when GDB starts.
  17575. * Menu:
  17576. * Python Commands:: Accessing Python from GDB.
  17577. * Python API:: Accessing GDB from Python.
  17578. * Python Auto-loading:: Automatically loading Python code.
  17579. * Python modules:: Python modules provided by GDB.
  17580. 
  17581. File: gdb.info, Node: Python Commands, Next: Python API, Up: Python
  17582. 23.2.1 Python Commands
  17583. ----------------------
  17584. GDB provides two commands for accessing the Python interpreter, and one
  17585. related setting:
  17586. 'python-interactive [COMMAND]'
  17587. 'pi [COMMAND]'
  17588. Without an argument, the 'python-interactive' command can be used
  17589. to start an interactive Python prompt. To return to GDB, type the
  17590. 'EOF' character (e.g., 'Ctrl-D' on an empty prompt).
  17591. Alternatively, a single-line Python command can be given as an
  17592. argument and evaluated. If the command is an expression, the
  17593. result will be printed; otherwise, nothing will be printed. For
  17594. example:
  17595. (gdb) python-interactive 2 + 3
  17596. 5
  17597. 'python [COMMAND]'
  17598. 'py [COMMAND]'
  17599. The 'python' command can be used to evaluate Python code.
  17600. If given an argument, the 'python' command will evaluate the
  17601. argument as a Python command. For example:
  17602. (gdb) python print 23
  17603. 23
  17604. If you do not provide an argument to 'python', it will act as a
  17605. multi-line command, like 'define'. In this case, the Python script
  17606. is made up of subsequent command lines, given after the 'python'
  17607. command. This command list is terminated using a line containing
  17608. 'end'. For example:
  17609. (gdb) python
  17610. Type python script
  17611. End with a line saying just "end".
  17612. >print 23
  17613. >end
  17614. 23
  17615. 'set python print-stack'
  17616. By default, GDB will print only the message component of a Python
  17617. exception when an error occurs in a Python script. This can be
  17618. controlled using 'set python print-stack': if 'full', then full
  17619. Python stack printing is enabled; if 'none', then Python stack and
  17620. message printing is disabled; if 'message', the default, only the
  17621. message component of the error is printed.
  17622. It is also possible to execute a Python script from the GDB
  17623. interpreter:
  17624. 'source script-name'
  17625. The script name must end with '.py' and GDB must be configured to
  17626. recognize the script language based on filename extension using the
  17627. 'script-extension' setting. *Note Extending GDB: Extending GDB.
  17628. 
  17629. File: gdb.info, Node: Python API, Next: Python Auto-loading, Prev: Python Commands, Up: Python
  17630. 23.2.2 Python API
  17631. -----------------
  17632. You can get quick online help for GDB's Python API by issuing the
  17633. command 'python help (gdb)'.
  17634. Functions and methods which have two or more optional arguments allow
  17635. them to be specified using keyword syntax. This allows passing some
  17636. optional arguments while skipping others. Example:
  17637. 'gdb.some_function ('foo', bar = 1, baz = 2)'.
  17638. * Menu:
  17639. * Basic Python:: Basic Python Functions.
  17640. * Exception Handling:: How Python exceptions are translated.
  17641. * Values From Inferior:: Python representation of values.
  17642. * Types In Python:: Python representation of types.
  17643. * Pretty Printing API:: Pretty-printing values.
  17644. * Selecting Pretty-Printers:: How GDB chooses a pretty-printer.
  17645. * Writing a Pretty-Printer:: Writing a Pretty-Printer.
  17646. * Type Printing API:: Pretty-printing types.
  17647. * Frame Filter API:: Filtering Frames.
  17648. * Frame Decorator API:: Decorating Frames.
  17649. * Writing a Frame Filter:: Writing a Frame Filter.
  17650. * Unwinding Frames in Python:: Writing frame unwinder.
  17651. * Xmethods In Python:: Adding and replacing methods of C++ classes.
  17652. * Xmethod API:: Xmethod types.
  17653. * Writing an Xmethod:: Writing an xmethod.
  17654. * Inferiors In Python:: Python representation of inferiors (processes)
  17655. * Events In Python:: Listening for events from GDB.
  17656. * Threads In Python:: Accessing inferior threads from Python.
  17657. * Recordings In Python:: Accessing recordings from Python.
  17658. * Commands In Python:: Implementing new commands in Python.
  17659. * Parameters In Python:: Adding new GDB parameters.
  17660. * Functions In Python:: Writing new convenience functions.
  17661. * Progspaces In Python:: Program spaces.
  17662. * Objfiles In Python:: Object files.
  17663. * Frames In Python:: Accessing inferior stack frames from Python.
  17664. * Blocks In Python:: Accessing blocks from Python.
  17665. * Symbols In Python:: Python representation of symbols.
  17666. * Symbol Tables In Python:: Python representation of symbol tables.
  17667. * Line Tables In Python:: Python representation of line tables.
  17668. * Breakpoints In Python:: Manipulating breakpoints using Python.
  17669. * Finish Breakpoints in Python:: Setting Breakpoints on function return
  17670. using Python.
  17671. * Lazy Strings In Python:: Python representation of lazy strings.
  17672. * Architectures In Python:: Python representation of architectures.
  17673. 
  17674. File: gdb.info, Node: Basic Python, Next: Exception Handling, Up: Python API
  17675. 23.2.2.1 Basic Python
  17676. .....................
  17677. At startup, GDB overrides Python's 'sys.stdout' and 'sys.stderr' to
  17678. print using GDB's output-paging streams. A Python program which outputs
  17679. to one of these streams may have its output interrupted by the user
  17680. (*note Screen Size::). In this situation, a Python 'KeyboardInterrupt'
  17681. exception is thrown.
  17682. Some care must be taken when writing Python code to run in GDB. Two
  17683. things worth noting in particular:
  17684. * GDB install handlers for 'SIGCHLD' and 'SIGINT'. Python code must
  17685. not override these, or even change the options using 'sigaction'.
  17686. If your program changes the handling of these signals, GDB will
  17687. most likely stop working correctly. Note that it is unfortunately
  17688. common for GUI toolkits to install a 'SIGCHLD' handler.
  17689. * GDB takes care to mark its internal file descriptors as
  17690. close-on-exec. However, this cannot be done in a thread-safe way
  17691. on all platforms. Your Python programs should be aware of this and
  17692. should both create new file descriptors with the close-on-exec flag
  17693. set and arrange to close unneeded file descriptors before starting
  17694. a child process.
  17695. GDB introduces a new Python module, named 'gdb'. All methods and
  17696. classes added by GDB are placed in this module. GDB automatically
  17697. 'import's the 'gdb' module for use in all scripts evaluated by the
  17698. 'python' command.
  17699. Some types of the 'gdb' module come with a textual representation
  17700. (accessible through the 'repr' or 'str' functions). These are offered
  17701. for debugging purposes only, expect them to change over time.
  17702. -- Variable: gdb.PYTHONDIR
  17703. A string containing the python directory (*note Python::).
  17704. -- Function: gdb.execute (command [, from_tty [, to_string]])
  17705. Evaluate COMMAND, a string, as a GDB CLI command. If a GDB
  17706. exception happens while COMMAND runs, it is translated as described
  17707. in *note Exception Handling: Exception Handling.
  17708. The FROM_TTY flag specifies whether GDB ought to consider this
  17709. command as having originated from the user invoking it
  17710. interactively. It must be a boolean value. If omitted, it
  17711. defaults to 'False'.
  17712. By default, any output produced by COMMAND is sent to GDB's
  17713. standard output (and to the log output if logging is turned on).
  17714. If the TO_STRING parameter is 'True', then output will be collected
  17715. by 'gdb.execute' and returned as a string. The default is 'False',
  17716. in which case the return value is 'None'. If TO_STRING is 'True',
  17717. the GDB virtual terminal will be temporarily set to unlimited width
  17718. and height, and its pagination will be disabled; *note Screen
  17719. Size::.
  17720. -- Function: gdb.breakpoints ()
  17721. Return a sequence holding all of GDB's breakpoints. *Note
  17722. Breakpoints In Python::, for more information. In GDB version 7.11
  17723. and earlier, this function returned 'None' if there were no
  17724. breakpoints. This peculiarity was subsequently fixed, and now
  17725. 'gdb.breakpoints' returns an empty sequence in this case.
  17726. -- Function: gdb.rbreak (regex [, minsyms [, throttle, [, symtabs ]]])
  17727. Return a Python list holding a collection of newly set
  17728. 'gdb.Breakpoint' objects matching function names defined by the
  17729. REGEX pattern. If the MINSYMS keyword is 'True', all system
  17730. functions (those not explicitly defined in the inferior) will also
  17731. be included in the match. The THROTTLE keyword takes an integer
  17732. that defines the maximum number of pattern matches for functions
  17733. matched by the REGEX pattern. If the number of matches exceeds the
  17734. integer value of THROTTLE, a 'RuntimeError' will be raised and no
  17735. breakpoints will be created. If THROTTLE is not defined then there
  17736. is no imposed limit on the maximum number of matches and
  17737. breakpoints to be created. The SYMTABS keyword takes a Python
  17738. iterable that yields a collection of 'gdb.Symtab' objects and will
  17739. restrict the search to those functions only contained within the
  17740. 'gdb.Symtab' objects.
  17741. -- Function: gdb.parameter (parameter)
  17742. Return the value of a GDB PARAMETER given by its name, a string;
  17743. the parameter name string may contain spaces if the parameter has a
  17744. multi-part name. For example, 'print object' is a valid parameter
  17745. name.
  17746. If the named parameter does not exist, this function throws a
  17747. 'gdb.error' (*note Exception Handling::). Otherwise, the
  17748. parameter's value is converted to a Python value of the appropriate
  17749. type, and returned.
  17750. -- Function: gdb.history (number)
  17751. Return a value from GDB's value history (*note Value History::).
  17752. The NUMBER argument indicates which history element to return. If
  17753. NUMBER is negative, then GDB will take its absolute value and count
  17754. backward from the last element (i.e., the most recent element) to
  17755. find the value to return. If NUMBER is zero, then GDB will return
  17756. the most recent element. If the element specified by NUMBER
  17757. doesn't exist in the value history, a 'gdb.error' exception will be
  17758. raised.
  17759. If no exception is raised, the return value is always an instance
  17760. of 'gdb.Value' (*note Values From Inferior::).
  17761. -- Function: gdb.convenience_variable (name)
  17762. Return the value of the convenience variable (*note Convenience
  17763. Vars::) named NAME. NAME must be a string. The name should not
  17764. include the '$' that is used to mark a convenience variable in an
  17765. expression. If the convenience variable does not exist, then
  17766. 'None' is returned.
  17767. -- Function: gdb.set_convenience_variable (name, value)
  17768. Set the value of the convenience variable (*note Convenience
  17769. Vars::) named NAME. NAME must be a string. The name should not
  17770. include the '$' that is used to mark a convenience variable in an
  17771. expression. If VALUE is 'None', then the convenience variable is
  17772. removed. Otherwise, if VALUE is not a 'gdb.Value' (*note Values
  17773. From Inferior::), it is is converted using the 'gdb.Value'
  17774. constructor.
  17775. -- Function: gdb.parse_and_eval (expression)
  17776. Parse EXPRESSION, which must be a string, as an expression in the
  17777. current language, evaluate it, and return the result as a
  17778. 'gdb.Value'.
  17779. This function can be useful when implementing a new command (*note
  17780. Commands In Python::), as it provides a way to parse the command's
  17781. argument as an expression. It is also useful simply to compute
  17782. values.
  17783. -- Function: gdb.find_pc_line (pc)
  17784. Return the 'gdb.Symtab_and_line' object corresponding to the PC
  17785. value. *Note Symbol Tables In Python::. If an invalid value of PC
  17786. is passed as an argument, then the 'symtab' and 'line' attributes
  17787. of the returned 'gdb.Symtab_and_line' object will be 'None' and 0
  17788. respectively. This is identical to
  17789. 'gdb.current_progspace().find_pc_line(pc)' and is included for
  17790. historical compatibility.
  17791. -- Function: gdb.post_event (event)
  17792. Put EVENT, a callable object taking no arguments, into GDB's
  17793. internal event queue. This callable will be invoked at some later
  17794. point, during GDB's event processing. Events posted using
  17795. 'post_event' will be run in the order in which they were posted;
  17796. however, there is no way to know when they will be processed
  17797. relative to other events inside GDB.
  17798. GDB is not thread-safe. If your Python program uses multiple
  17799. threads, you must be careful to only call GDB-specific functions in
  17800. the GDB thread. 'post_event' ensures this. For example:
  17801. (gdb) python
  17802. >import threading
  17803. >
  17804. >class Writer():
  17805. > def __init__(self, message):
  17806. > self.message = message;
  17807. > def __call__(self):
  17808. > gdb.write(self.message)
  17809. >
  17810. >class MyThread1 (threading.Thread):
  17811. > def run (self):
  17812. > gdb.post_event(Writer("Hello "))
  17813. >
  17814. >class MyThread2 (threading.Thread):
  17815. > def run (self):
  17816. > gdb.post_event(Writer("World\n"))
  17817. >
  17818. >MyThread1().start()
  17819. >MyThread2().start()
  17820. >end
  17821. (gdb) Hello World
  17822. -- Function: gdb.write (string [, stream])
  17823. Print a string to GDB's paginated output stream. The optional
  17824. STREAM determines the stream to print to. The default stream is
  17825. GDB's standard output stream. Possible stream values are:
  17826. 'gdb.STDOUT'
  17827. GDB's standard output stream.
  17828. 'gdb.STDERR'
  17829. GDB's standard error stream.
  17830. 'gdb.STDLOG'
  17831. GDB's log stream (*note Logging Output::).
  17832. Writing to 'sys.stdout' or 'sys.stderr' will automatically call
  17833. this function and will automatically direct the output to the
  17834. relevant stream.
  17835. -- Function: gdb.flush ()
  17836. Flush the buffer of a GDB paginated stream so that the contents are
  17837. displayed immediately. GDB will flush the contents of a stream
  17838. automatically when it encounters a newline in the buffer. The
  17839. optional STREAM determines the stream to flush. The default stream
  17840. is GDB's standard output stream. Possible stream values are:
  17841. 'gdb.STDOUT'
  17842. GDB's standard output stream.
  17843. 'gdb.STDERR'
  17844. GDB's standard error stream.
  17845. 'gdb.STDLOG'
  17846. GDB's log stream (*note Logging Output::).
  17847. Flushing 'sys.stdout' or 'sys.stderr' will automatically call this
  17848. function for the relevant stream.
  17849. -- Function: gdb.target_charset ()
  17850. Return the name of the current target character set (*note
  17851. Character Sets::). This differs from
  17852. 'gdb.parameter('target-charset')' in that 'auto' is never returned.
  17853. -- Function: gdb.target_wide_charset ()
  17854. Return the name of the current target wide character set (*note
  17855. Character Sets::). This differs from
  17856. 'gdb.parameter('target-wide-charset')' in that 'auto' is never
  17857. returned.
  17858. -- Function: gdb.solib_name (address)
  17859. Return the name of the shared library holding the given ADDRESS as
  17860. a string, or 'None'. This is identical to
  17861. 'gdb.current_progspace().solib_name(address)' and is included for
  17862. historical compatibility.
  17863. -- Function: gdb.decode_line ([expression])
  17864. Return locations of the line specified by EXPRESSION, or of the
  17865. current line if no argument was given. This function returns a
  17866. Python tuple containing two elements. The first element contains a
  17867. string holding any unparsed section of EXPRESSION (or 'None' if the
  17868. expression has been fully parsed). The second element contains
  17869. either 'None' or another tuple that contains all the locations that
  17870. match the expression represented as 'gdb.Symtab_and_line' objects
  17871. (*note Symbol Tables In Python::). If EXPRESSION is provided, it
  17872. is decoded the way that GDB's inbuilt 'break' or 'edit' commands do
  17873. (*note Specify Location::).
  17874. -- Function: gdb.prompt_hook (current_prompt)
  17875. If PROMPT_HOOK is callable, GDB will call the method assigned to
  17876. this operation before a prompt is displayed by GDB.
  17877. The parameter 'current_prompt' contains the current GDB prompt.
  17878. This method must return a Python string, or 'None'. If a string is
  17879. returned, the GDB prompt will be set to that string. If 'None' is
  17880. returned, GDB will continue to use the current prompt.
  17881. Some prompts cannot be substituted in GDB. Secondary prompts such
  17882. as those used by readline for command input, and annotation related
  17883. prompts are prohibited from being changed.
  17884. 
  17885. File: gdb.info, Node: Exception Handling, Next: Values From Inferior, Prev: Basic Python, Up: Python API
  17886. 23.2.2.2 Exception Handling
  17887. ...........................
  17888. When executing the 'python' command, Python exceptions uncaught within
  17889. the Python code are translated to calls to GDB error-reporting
  17890. mechanism. If the command that called 'python' does not handle the
  17891. error, GDB will terminate it and print an error message containing the
  17892. Python exception name, the associated value, and the Python call stack
  17893. backtrace at the point where the exception was raised. Example:
  17894. (gdb) python print foo
  17895. Traceback (most recent call last):
  17896. File "<string>", line 1, in <module>
  17897. NameError: name 'foo' is not defined
  17898. GDB errors that happen in GDB commands invoked by Python code are
  17899. converted to Python exceptions. The type of the Python exception
  17900. depends on the error.
  17901. 'gdb.error'
  17902. This is the base class for most exceptions generated by GDB. It is
  17903. derived from 'RuntimeError', for compatibility with earlier
  17904. versions of GDB.
  17905. If an error occurring in GDB does not fit into some more specific
  17906. category, then the generated exception will have this type.
  17907. 'gdb.MemoryError'
  17908. This is a subclass of 'gdb.error' which is thrown when an operation
  17909. tried to access invalid memory in the inferior.
  17910. 'KeyboardInterrupt'
  17911. User interrupt (via 'C-c' or by typing 'q' at a pagination prompt)
  17912. is translated to a Python 'KeyboardInterrupt' exception.
  17913. In all cases, your exception handler will see the GDB error message
  17914. as its value and the Python call stack backtrace at the Python statement
  17915. closest to where the GDB error occured as the traceback.
  17916. When implementing GDB commands in Python via 'gdb.Command', or
  17917. functions via 'gdb.Function', it is useful to be able to throw an
  17918. exception that doesn't cause a traceback to be printed. For example,
  17919. the user may have invoked the command incorrectly. GDB provides a
  17920. special exception class that can be used for this purpose.
  17921. 'gdb.GdbError'
  17922. When thrown from a command or function, this exception will cause
  17923. the command or function to fail, but the Python stack will not be
  17924. displayed. GDB does not throw this exception itself, but rather
  17925. recognizes it when thrown from user Python code. Example:
  17926. (gdb) python
  17927. >class HelloWorld (gdb.Command):
  17928. > """Greet the whole world."""
  17929. > def __init__ (self):
  17930. > super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
  17931. > def invoke (self, args, from_tty):
  17932. > argv = gdb.string_to_argv (args)
  17933. > if len (argv) != 0:
  17934. > raise gdb.GdbError ("hello-world takes no arguments")
  17935. > print "Hello, World!"
  17936. >HelloWorld ()
  17937. >end
  17938. (gdb) hello-world 42
  17939. hello-world takes no arguments
  17940. 
  17941. File: gdb.info, Node: Values From Inferior, Next: Types In Python, Prev: Exception Handling, Up: Python API
  17942. 23.2.2.3 Values From Inferior
  17943. .............................
  17944. GDB provides values it obtains from the inferior program in an object of
  17945. type 'gdb.Value'. GDB uses this object for its internal bookkeeping of
  17946. the inferior's values, and for fetching values when necessary.
  17947. Inferior values that are simple scalars can be used directly in
  17948. Python expressions that are valid for the value's data type. Here's an
  17949. example for an integer or floating-point value 'some_val':
  17950. bar = some_val + 2
  17951. As result of this, 'bar' will also be a 'gdb.Value' object whose values
  17952. are of the same type as those of 'some_val'. Valid Python operations
  17953. can also be performed on 'gdb.Value' objects representing a 'struct' or
  17954. 'class' object. For such cases, the overloaded operator (if present),
  17955. is used to perform the operation. For example, if 'val1' and 'val2' are
  17956. 'gdb.Value' objects representing instances of a 'class' which overloads
  17957. the '+' operator, then one can use the '+' operator in their Python
  17958. script as follows:
  17959. val3 = val1 + val2
  17960. The result of the operation 'val3' is also a 'gdb.Value' object
  17961. corresponding to the value returned by the overloaded '+' operator. In
  17962. general, overloaded operators are invoked for the following operations:
  17963. '+' (binary addition), '-' (binary subtraction), '*' (multiplication),
  17964. '/', '%', '<<', '>>', '|', '&', '^'.
  17965. Inferior values that are structures or instances of some class can be
  17966. accessed using the Python "dictionary syntax". For example, if
  17967. 'some_val' is a 'gdb.Value' instance holding a structure, you can access
  17968. its 'foo' element with:
  17969. bar = some_val['foo']
  17970. Again, 'bar' will also be a 'gdb.Value' object. Structure elements
  17971. can also be accessed by using 'gdb.Field' objects as subscripts (*note
  17972. Types In Python::, for more information on 'gdb.Field' objects). For
  17973. example, if 'foo_field' is a 'gdb.Field' object corresponding to element
  17974. 'foo' of the above structure, then 'bar' can also be accessed as
  17975. follows:
  17976. bar = some_val[foo_field]
  17977. A 'gdb.Value' that represents a function can be executed via inferior
  17978. function call. Any arguments provided to the call must match the
  17979. function's prototype, and must be provided in the order specified by
  17980. that prototype.
  17981. For example, 'some_val' is a 'gdb.Value' instance representing a
  17982. function that takes two integers as arguments. To execute this
  17983. function, call it like so:
  17984. result = some_val (10,20)
  17985. Any values returned from a function call will be stored as a
  17986. 'gdb.Value'.
  17987. The following attributes are provided:
  17988. -- Variable: Value.address
  17989. If this object is addressable, this read-only attribute holds a
  17990. 'gdb.Value' object representing the address. Otherwise, this
  17991. attribute holds 'None'.
  17992. -- Variable: Value.is_optimized_out
  17993. This read-only boolean attribute is true if the compiler optimized
  17994. out this value, thus it is not available for fetching from the
  17995. inferior.
  17996. -- Variable: Value.type
  17997. The type of this 'gdb.Value'. The value of this attribute is a
  17998. 'gdb.Type' object (*note Types In Python::).
  17999. -- Variable: Value.dynamic_type
  18000. The dynamic type of this 'gdb.Value'. This uses the object's
  18001. virtual table and the C++ run-time type information (RTTI) to
  18002. determine the dynamic type of the value. If this value is of class
  18003. type, it will return the class in which the value is embedded, if
  18004. any. If this value is of pointer or reference to a class type, it
  18005. will compute the dynamic type of the referenced object, and return
  18006. a pointer or reference to that type, respectively. In all other
  18007. cases, it will return the value's static type.
  18008. Note that this feature will only work when debugging a C++ program
  18009. that includes RTTI for the object in question. Otherwise, it will
  18010. just return the static type of the value as in 'ptype foo' (*note
  18011. ptype: Symbols.).
  18012. -- Variable: Value.is_lazy
  18013. The value of this read-only boolean attribute is 'True' if this
  18014. 'gdb.Value' has not yet been fetched from the inferior. GDB does
  18015. not fetch values until necessary, for efficiency. For example:
  18016. myval = gdb.parse_and_eval ('somevar')
  18017. The value of 'somevar' is not fetched at this time. It will be
  18018. fetched when the value is needed, or when the 'fetch_lazy' method
  18019. is invoked.
  18020. The following methods are provided:
  18021. -- Function: Value.__init__ (VAL)
  18022. Many Python values can be converted directly to a 'gdb.Value' via
  18023. this object initializer. Specifically:
  18024. Python boolean
  18025. A Python boolean is converted to the boolean type from the
  18026. current language.
  18027. Python integer
  18028. A Python integer is converted to the C 'long' type for the
  18029. current architecture.
  18030. Python long
  18031. A Python long is converted to the C 'long long' type for the
  18032. current architecture.
  18033. Python float
  18034. A Python float is converted to the C 'double' type for the
  18035. current architecture.
  18036. Python string
  18037. A Python string is converted to a target string in the current
  18038. target language using the current target encoding. If a
  18039. character cannot be represented in the current target
  18040. encoding, then an exception is thrown.
  18041. 'gdb.Value'
  18042. If 'val' is a 'gdb.Value', then a copy of the value is made.
  18043. 'gdb.LazyString'
  18044. If 'val' is a 'gdb.LazyString' (*note Lazy Strings In
  18045. Python::), then the lazy string's 'value' method is called,
  18046. and its result is used.
  18047. -- Function: Value.__init__ (VAL, [, type ])
  18048. This second form of the 'gdb.Value' constructor returns a
  18049. 'gdb.Value' of type TYPE where the value contents are taken from
  18050. the Python buffer object specified by VAL. The number of bytes in
  18051. the Python buffer object must be greater than or equal to the size
  18052. of TYPE.
  18053. -- Function: Value.cast (type)
  18054. Return a new instance of 'gdb.Value' that is the result of casting
  18055. this instance to the type described by TYPE, which must be a
  18056. 'gdb.Type' object. If the cast cannot be performed for some
  18057. reason, this method throws an exception.
  18058. -- Function: Value.dereference ()
  18059. For pointer data types, this method returns a new 'gdb.Value'
  18060. object whose contents is the object pointed to by the pointer. For
  18061. example, if 'foo' is a C pointer to an 'int', declared in your C
  18062. program as
  18063. int *foo;
  18064. then you can use the corresponding 'gdb.Value' to access what 'foo'
  18065. points to like this:
  18066. bar = foo.dereference ()
  18067. The result 'bar' will be a 'gdb.Value' object holding the value
  18068. pointed to by 'foo'.
  18069. A similar function 'Value.referenced_value' exists which also
  18070. returns 'gdb.Value' objects corresonding to the values pointed to
  18071. by pointer values (and additionally, values referenced by reference
  18072. values). However, the behavior of 'Value.dereference' differs from
  18073. 'Value.referenced_value' by the fact that the behavior of
  18074. 'Value.dereference' is identical to applying the C unary operator
  18075. '*' on a given value. For example, consider a reference to a
  18076. pointer 'ptrref', declared in your C++ program as
  18077. typedef int *intptr;
  18078. ...
  18079. int val = 10;
  18080. intptr ptr = &val;
  18081. intptr &ptrref = ptr;
  18082. Though 'ptrref' is a reference value, one can apply the method
  18083. 'Value.dereference' to the 'gdb.Value' object corresponding to it
  18084. and obtain a 'gdb.Value' which is identical to that corresponding
  18085. to 'val'. However, if you apply the method
  18086. 'Value.referenced_value', the result would be a 'gdb.Value' object
  18087. identical to that corresponding to 'ptr'.
  18088. py_ptrref = gdb.parse_and_eval ("ptrref")
  18089. py_val = py_ptrref.dereference ()
  18090. py_ptr = py_ptrref.referenced_value ()
  18091. The 'gdb.Value' object 'py_val' is identical to that corresponding
  18092. to 'val', and 'py_ptr' is identical to that corresponding to 'ptr'.
  18093. In general, 'Value.dereference' can be applied whenever the C unary
  18094. operator '*' can be applied to the corresponding C value. For
  18095. those cases where applying both 'Value.dereference' and
  18096. 'Value.referenced_value' is allowed, the results obtained need not
  18097. be identical (as we have seen in the above example). The results
  18098. are however identical when applied on 'gdb.Value' objects
  18099. corresponding to pointers ('gdb.Value' objects with type code
  18100. 'TYPE_CODE_PTR') in a C/C++ program.
  18101. -- Function: Value.referenced_value ()
  18102. For pointer or reference data types, this method returns a new
  18103. 'gdb.Value' object corresponding to the value referenced by the
  18104. pointer/reference value. For pointer data types,
  18105. 'Value.dereference' and 'Value.referenced_value' produce identical
  18106. results. The difference between these methods is that
  18107. 'Value.dereference' cannot get the values referenced by reference
  18108. values. For example, consider a reference to an 'int', declared in
  18109. your C++ program as
  18110. int val = 10;
  18111. int &ref = val;
  18112. then applying 'Value.dereference' to the 'gdb.Value' object
  18113. corresponding to 'ref' will result in an error, while applying
  18114. 'Value.referenced_value' will result in a 'gdb.Value' object
  18115. identical to that corresponding to 'val'.
  18116. py_ref = gdb.parse_and_eval ("ref")
  18117. er_ref = py_ref.dereference () # Results in error
  18118. py_val = py_ref.referenced_value () # Returns the referenced value
  18119. The 'gdb.Value' object 'py_val' is identical to that corresponding
  18120. to 'val'.
  18121. -- Function: Value.reference_value ()
  18122. Return a 'gdb.Value' object which is a reference to the value
  18123. encapsulated by this instance.
  18124. -- Function: Value.const_value ()
  18125. Return a 'gdb.Value' object which is a 'const' version of the value
  18126. encapsulated by this instance.
  18127. -- Function: Value.dynamic_cast (type)
  18128. Like 'Value.cast', but works as if the C++ 'dynamic_cast' operator
  18129. were used. Consult a C++ reference for details.
  18130. -- Function: Value.reinterpret_cast (type)
  18131. Like 'Value.cast', but works as if the C++ 'reinterpret_cast'
  18132. operator were used. Consult a C++ reference for details.
  18133. -- Function: Value.string ([encoding[, errors[, length]]])
  18134. If this 'gdb.Value' represents a string, then this method converts
  18135. the contents to a Python string. Otherwise, this method will throw
  18136. an exception.
  18137. Values are interpreted as strings according to the rules of the
  18138. current language. If the optional length argument is given, the
  18139. string will be converted to that length, and will include any
  18140. embedded zeroes that the string may contain. Otherwise, for
  18141. languages where the string is zero-terminated, the entire string
  18142. will be converted.
  18143. For example, in C-like languages, a value is a string if it is a
  18144. pointer to or an array of characters or ints of type 'wchar_t',
  18145. 'char16_t', or 'char32_t'.
  18146. If the optional ENCODING argument is given, it must be a string
  18147. naming the encoding of the string in the 'gdb.Value', such as
  18148. '"ascii"', '"iso-8859-6"' or '"utf-8"'. It accepts the same
  18149. encodings as the corresponding argument to Python's 'string.decode'
  18150. method, and the Python codec machinery will be used to convert the
  18151. string. If ENCODING is not given, or if ENCODING is the empty
  18152. string, then either the 'target-charset' (*note Character Sets::)
  18153. will be used, or a language-specific encoding will be used, if the
  18154. current language is able to supply one.
  18155. The optional ERRORS argument is the same as the corresponding
  18156. argument to Python's 'string.decode' method.
  18157. If the optional LENGTH argument is given, the string will be
  18158. fetched and converted to the given length.
  18159. -- Function: Value.lazy_string ([encoding [, length]])
  18160. If this 'gdb.Value' represents a string, then this method converts
  18161. the contents to a 'gdb.LazyString' (*note Lazy Strings In
  18162. Python::). Otherwise, this method will throw an exception.
  18163. If the optional ENCODING argument is given, it must be a string
  18164. naming the encoding of the 'gdb.LazyString'. Some examples are:
  18165. 'ascii', 'iso-8859-6' or 'utf-8'. If the ENCODING argument is an
  18166. encoding that GDB does recognize, GDB will raise an error.
  18167. When a lazy string is printed, the GDB encoding machinery is used
  18168. to convert the string during printing. If the optional ENCODING
  18169. argument is not provided, or is an empty string, GDB will
  18170. automatically select the encoding most suitable for the string
  18171. type. For further information on encoding in GDB please see *note
  18172. Character Sets::.
  18173. If the optional LENGTH argument is given, the string will be
  18174. fetched and encoded to the length of characters specified. If the
  18175. LENGTH argument is not provided, the string will be fetched and
  18176. encoded until a null of appropriate width is found.
  18177. -- Function: Value.fetch_lazy ()
  18178. If the 'gdb.Value' object is currently a lazy value
  18179. ('gdb.Value.is_lazy' is 'True'), then the value is fetched from the
  18180. inferior. Any errors that occur in the process will produce a
  18181. Python exception.
  18182. If the 'gdb.Value' object is not a lazy value, this method has no
  18183. effect.
  18184. This method does not return a value.
  18185. 
  18186. File: gdb.info, Node: Types In Python, Next: Pretty Printing API, Prev: Values From Inferior, Up: Python API
  18187. 23.2.2.4 Types In Python
  18188. ........................
  18189. GDB represents types from the inferior using the class 'gdb.Type'.
  18190. The following type-related functions are available in the 'gdb'
  18191. module:
  18192. -- Function: gdb.lookup_type (name [, block])
  18193. This function looks up a type by its NAME, which must be a string.
  18194. If BLOCK is given, then NAME is looked up in that scope.
  18195. Otherwise, it is searched for globally.
  18196. Ordinarily, this function will return an instance of 'gdb.Type'.
  18197. If the named type cannot be found, it will throw an exception.
  18198. If the type is a structure or class type, or an enum type, the fields
  18199. of that type can be accessed using the Python "dictionary syntax". For
  18200. example, if 'some_type' is a 'gdb.Type' instance holding a structure
  18201. type, you can access its 'foo' field with:
  18202. bar = some_type['foo']
  18203. 'bar' will be a 'gdb.Field' object; see below under the description
  18204. of the 'Type.fields' method for a description of the 'gdb.Field' class.
  18205. An instance of 'Type' has the following attributes:
  18206. -- Variable: Type.alignof
  18207. The alignment of this type, in bytes. Type alignment comes from
  18208. the debugging information; if it was not specified, then GDB will
  18209. use the relevant ABI to try to determine the alignment. In some
  18210. cases, even this is not possible, and zero will be returned.
  18211. -- Variable: Type.code
  18212. The type code for this type. The type code will be one of the
  18213. 'TYPE_CODE_' constants defined below.
  18214. -- Variable: Type.name
  18215. The name of this type. If this type has no name, then 'None' is
  18216. returned.
  18217. -- Variable: Type.sizeof
  18218. The size of this type, in target 'char' units. Usually, a target's
  18219. 'char' type will be an 8-bit byte. However, on some unusual
  18220. platforms, this type may have a different size.
  18221. -- Variable: Type.tag
  18222. The tag name for this type. The tag name is the name after
  18223. 'struct', 'union', or 'enum' in C and C++; not all languages have
  18224. this concept. If this type has no tag name, then 'None' is
  18225. returned.
  18226. The following methods are provided:
  18227. -- Function: Type.fields ()
  18228. For structure and union types, this method returns the fields.
  18229. Range types have two fields, the minimum and maximum values. Enum
  18230. types have one field per enum constant. Function and method types
  18231. have one field per parameter. The base types of C++ classes are
  18232. also represented as fields. If the type has no fields, or does not
  18233. fit into one of these categories, an empty sequence will be
  18234. returned.
  18235. Each field is a 'gdb.Field' object, with some pre-defined
  18236. attributes:
  18237. 'bitpos'
  18238. This attribute is not available for 'enum' or 'static' (as in
  18239. C++) fields. The value is the position, counting in bits,
  18240. from the start of the containing type.
  18241. 'enumval'
  18242. This attribute is only available for 'enum' fields, and its
  18243. value is the enumeration member's integer representation.
  18244. 'name'
  18245. The name of the field, or 'None' for anonymous fields.
  18246. 'artificial'
  18247. This is 'True' if the field is artificial, usually meaning
  18248. that it was provided by the compiler and not the user. This
  18249. attribute is always provided, and is 'False' if the field is
  18250. not artificial.
  18251. 'is_base_class'
  18252. This is 'True' if the field represents a base class of a C++
  18253. structure. This attribute is always provided, and is 'False'
  18254. if the field is not a base class of the type that is the
  18255. argument of 'fields', or if that type was not a C++ class.
  18256. 'bitsize'
  18257. If the field is packed, or is a bitfield, then this will have
  18258. a non-zero value, which is the size of the field in bits.
  18259. Otherwise, this will be zero; in this case the field's size is
  18260. given by its type.
  18261. 'type'
  18262. The type of the field. This is usually an instance of 'Type',
  18263. but it can be 'None' in some situations.
  18264. 'parent_type'
  18265. The type which contains this field. This is an instance of
  18266. 'gdb.Type'.
  18267. -- Function: Type.array (N1 [, N2])
  18268. Return a new 'gdb.Type' object which represents an array of this
  18269. type. If one argument is given, it is the inclusive upper bound of
  18270. the array; in this case the lower bound is zero. If two arguments
  18271. are given, the first argument is the lower bound of the array, and
  18272. the second argument is the upper bound of the array. An array's
  18273. length must not be negative, but the bounds can be.
  18274. -- Function: Type.vector (N1 [, N2])
  18275. Return a new 'gdb.Type' object which represents a vector of this
  18276. type. If one argument is given, it is the inclusive upper bound of
  18277. the vector; in this case the lower bound is zero. If two arguments
  18278. are given, the first argument is the lower bound of the vector, and
  18279. the second argument is the upper bound of the vector. A vector's
  18280. length must not be negative, but the bounds can be.
  18281. The difference between an 'array' and a 'vector' is that arrays
  18282. behave like in C: when used in expressions they decay to a pointer
  18283. to the first element whereas vectors are treated as first class
  18284. values.
  18285. -- Function: Type.const ()
  18286. Return a new 'gdb.Type' object which represents a 'const'-qualified
  18287. variant of this type.
  18288. -- Function: Type.volatile ()
  18289. Return a new 'gdb.Type' object which represents a
  18290. 'volatile'-qualified variant of this type.
  18291. -- Function: Type.unqualified ()
  18292. Return a new 'gdb.Type' object which represents an unqualified
  18293. variant of this type. That is, the result is neither 'const' nor
  18294. 'volatile'.
  18295. -- Function: Type.range ()
  18296. Return a Python 'Tuple' object that contains two elements: the low
  18297. bound of the argument type and the high bound of that type. If the
  18298. type does not have a range, GDB will raise a 'gdb.error' exception
  18299. (*note Exception Handling::).
  18300. -- Function: Type.reference ()
  18301. Return a new 'gdb.Type' object which represents a reference to this
  18302. type.
  18303. -- Function: Type.pointer ()
  18304. Return a new 'gdb.Type' object which represents a pointer to this
  18305. type.
  18306. -- Function: Type.strip_typedefs ()
  18307. Return a new 'gdb.Type' that represents the real type, after
  18308. removing all layers of typedefs.
  18309. -- Function: Type.target ()
  18310. Return a new 'gdb.Type' object which represents the target type of
  18311. this type.
  18312. For a pointer type, the target type is the type of the pointed-to
  18313. object. For an array type (meaning C-like arrays), the target type
  18314. is the type of the elements of the array. For a function or method
  18315. type, the target type is the type of the return value. For a
  18316. complex type, the target type is the type of the elements. For a
  18317. typedef, the target type is the aliased type.
  18318. If the type does not have a target, this method will throw an
  18319. exception.
  18320. -- Function: Type.template_argument (n [, block])
  18321. If this 'gdb.Type' is an instantiation of a template, this will
  18322. return a new 'gdb.Value' or 'gdb.Type' which represents the value
  18323. of the Nth template argument (indexed starting at 0).
  18324. If this 'gdb.Type' is not a template type, or if the type has fewer
  18325. than N template arguments, this will throw an exception.
  18326. Ordinarily, only C++ code will have template types.
  18327. If BLOCK is given, then NAME is looked up in that scope.
  18328. Otherwise, it is searched for globally.
  18329. -- Function: Type.optimized_out ()
  18330. Return 'gdb.Value' instance of this type whose value is optimized
  18331. out. This allows a frame decorator to indicate that the value of
  18332. an argument or a local variable is not known.
  18333. Each type has a code, which indicates what category this type falls
  18334. into. The available type categories are represented by constants
  18335. defined in the 'gdb' module:
  18336. 'gdb.TYPE_CODE_PTR'
  18337. The type is a pointer.
  18338. 'gdb.TYPE_CODE_ARRAY'
  18339. The type is an array.
  18340. 'gdb.TYPE_CODE_STRUCT'
  18341. The type is a structure.
  18342. 'gdb.TYPE_CODE_UNION'
  18343. The type is a union.
  18344. 'gdb.TYPE_CODE_ENUM'
  18345. The type is an enum.
  18346. 'gdb.TYPE_CODE_FLAGS'
  18347. A bit flags type, used for things such as status registers.
  18348. 'gdb.TYPE_CODE_FUNC'
  18349. The type is a function.
  18350. 'gdb.TYPE_CODE_INT'
  18351. The type is an integer type.
  18352. 'gdb.TYPE_CODE_FLT'
  18353. A floating point type.
  18354. 'gdb.TYPE_CODE_VOID'
  18355. The special type 'void'.
  18356. 'gdb.TYPE_CODE_SET'
  18357. A Pascal set type.
  18358. 'gdb.TYPE_CODE_RANGE'
  18359. A range type, that is, an integer type with bounds.
  18360. 'gdb.TYPE_CODE_STRING'
  18361. A string type. Note that this is only used for certain languages
  18362. with language-defined string types; C strings are not represented
  18363. this way.
  18364. 'gdb.TYPE_CODE_BITSTRING'
  18365. A string of bits. It is deprecated.
  18366. 'gdb.TYPE_CODE_ERROR'
  18367. An unknown or erroneous type.
  18368. 'gdb.TYPE_CODE_METHOD'
  18369. A method type, as found in C++.
  18370. 'gdb.TYPE_CODE_METHODPTR'
  18371. A pointer-to-member-function.
  18372. 'gdb.TYPE_CODE_MEMBERPTR'
  18373. A pointer-to-member.
  18374. 'gdb.TYPE_CODE_REF'
  18375. A reference type.
  18376. 'gdb.TYPE_CODE_RVALUE_REF'
  18377. A C++11 rvalue reference type.
  18378. 'gdb.TYPE_CODE_CHAR'
  18379. A character type.
  18380. 'gdb.TYPE_CODE_BOOL'
  18381. A boolean type.
  18382. 'gdb.TYPE_CODE_COMPLEX'
  18383. A complex float type.
  18384. 'gdb.TYPE_CODE_TYPEDEF'
  18385. A typedef to some other type.
  18386. 'gdb.TYPE_CODE_NAMESPACE'
  18387. A C++ namespace.
  18388. 'gdb.TYPE_CODE_DECFLOAT'
  18389. A decimal floating point type.
  18390. 'gdb.TYPE_CODE_INTERNAL_FUNCTION'
  18391. A function internal to GDB. This is the type used to represent
  18392. convenience functions.
  18393. Further support for types is provided in the 'gdb.types' Python
  18394. module (*note gdb.types::).
  18395. 
  18396. File: gdb.info, Node: Pretty Printing API, Next: Selecting Pretty-Printers, Prev: Types In Python, Up: Python API
  18397. 23.2.2.5 Pretty Printing API
  18398. ............................
  18399. A pretty-printer is just an object that holds a value and implements a
  18400. specific interface, defined here. An example output is provided (*note
  18401. Pretty Printing::).
  18402. -- Function: pretty_printer.children (self)
  18403. GDB will call this method on a pretty-printer to compute the
  18404. children of the pretty-printer's value.
  18405. This method must return an object conforming to the Python iterator
  18406. protocol. Each item returned by the iterator must be a tuple
  18407. holding two elements. The first element is the "name" of the
  18408. child; the second element is the child's value. The value can be
  18409. any Python object which is convertible to a GDB value.
  18410. This method is optional. If it does not exist, GDB will act as
  18411. though the value has no children.
  18412. -- Function: pretty_printer.display_hint (self)
  18413. The CLI may call this method and use its result to change the
  18414. formatting of a value. The result will also be supplied to an MI
  18415. consumer as a 'displayhint' attribute of the variable being
  18416. printed.
  18417. This method is optional. If it does exist, this method must return
  18418. a string.
  18419. Some display hints are predefined by GDB:
  18420. 'array'
  18421. Indicate that the object being printed is "array-like". The
  18422. CLI uses this to respect parameters such as 'set print
  18423. elements' and 'set print array'.
  18424. 'map'
  18425. Indicate that the object being printed is "map-like", and that
  18426. the children of this value can be assumed to alternate between
  18427. keys and values.
  18428. 'string'
  18429. Indicate that the object being printed is "string-like". If
  18430. the printer's 'to_string' method returns a Python string of
  18431. some kind, then GDB will call its internal language-specific
  18432. string-printing function to format the string. For the CLI
  18433. this means adding quotation marks, possibly escaping some
  18434. characters, respecting 'set print elements', and the like.
  18435. -- Function: pretty_printer.to_string (self)
  18436. GDB will call this method to display the string representation of
  18437. the value passed to the object's constructor.
  18438. When printing from the CLI, if the 'to_string' method exists, then
  18439. GDB will prepend its result to the values returned by 'children'.
  18440. Exactly how this formatting is done is dependent on the display
  18441. hint, and may change as more hints are added. Also, depending on
  18442. the print settings (*note Print Settings::), the CLI may print just
  18443. the result of 'to_string' in a stack trace, omitting the result of
  18444. 'children'.
  18445. If this method returns a string, it is printed verbatim.
  18446. Otherwise, if this method returns an instance of 'gdb.Value', then
  18447. GDB prints this value. This may result in a call to another
  18448. pretty-printer.
  18449. If instead the method returns a Python value which is convertible
  18450. to a 'gdb.Value', then GDB performs the conversion and prints the
  18451. resulting value. Again, this may result in a call to another
  18452. pretty-printer. Python scalars (integers, floats, and booleans)
  18453. and strings are convertible to 'gdb.Value'; other types are not.
  18454. Finally, if this method returns 'None' then no further operations
  18455. are peformed in this method and nothing is printed.
  18456. If the result is not one of these types, an exception is raised.
  18457. GDB provides a function which can be used to look up the default
  18458. pretty-printer for a 'gdb.Value':
  18459. -- Function: gdb.default_visualizer (value)
  18460. This function takes a 'gdb.Value' object as an argument. If a
  18461. pretty-printer for this value exists, then it is returned. If no
  18462. such printer exists, then this returns 'None'.
  18463. 
  18464. File: gdb.info, Node: Selecting Pretty-Printers, Next: Writing a Pretty-Printer, Prev: Pretty Printing API, Up: Python API
  18465. 23.2.2.6 Selecting Pretty-Printers
  18466. ..................................
  18467. The Python list 'gdb.pretty_printers' contains an array of functions or
  18468. callable objects that have been registered via addition as a
  18469. pretty-printer. Printers in this list are called 'global' printers,
  18470. they're available when debugging all inferiors. Each 'gdb.Progspace'
  18471. contains a 'pretty_printers' attribute. Each 'gdb.Objfile' also
  18472. contains a 'pretty_printers' attribute.
  18473. Each function on these lists is passed a single 'gdb.Value' argument
  18474. and should return a pretty-printer object conforming to the interface
  18475. definition above (*note Pretty Printing API::). If a function cannot
  18476. create a pretty-printer for the value, it should return 'None'.
  18477. GDB first checks the 'pretty_printers' attribute of each
  18478. 'gdb.Objfile' in the current program space and iteratively calls each
  18479. enabled lookup routine in the list for that 'gdb.Objfile' until it
  18480. receives a pretty-printer object. If no pretty-printer is found in the
  18481. objfile lists, GDB then searches the pretty-printer list of the current
  18482. program space, calling each enabled function until an object is
  18483. returned. After these lists have been exhausted, it tries the global
  18484. 'gdb.pretty_printers' list, again calling each enabled function until an
  18485. object is returned.
  18486. The order in which the objfiles are searched is not specified. For a
  18487. given list, functions are always invoked from the head of the list, and
  18488. iterated over sequentially until the end of the list, or a printer
  18489. object is returned.
  18490. For various reasons a pretty-printer may not work. For example, the
  18491. underlying data structure may have changed and the pretty-printer is out
  18492. of date.
  18493. The consequences of a broken pretty-printer are severe enough that
  18494. GDB provides support for enabling and disabling individual printers.
  18495. For example, if 'print frame-arguments' is on, a backtrace can become
  18496. highly illegible if any argument is printed with a broken printer.
  18497. Pretty-printers are enabled and disabled by attaching an 'enabled'
  18498. attribute to the registered function or callable object. If this
  18499. attribute is present and its value is 'False', the printer is disabled,
  18500. otherwise the printer is enabled.
  18501. 
  18502. File: gdb.info, Node: Writing a Pretty-Printer, Next: Type Printing API, Prev: Selecting Pretty-Printers, Up: Python API
  18503. 23.2.2.7 Writing a Pretty-Printer
  18504. .................................
  18505. A pretty-printer consists of two parts: a lookup function to detect if
  18506. the type is supported, and the printer itself.
  18507. Here is an example showing how a 'std::string' printer might be
  18508. written. *Note Pretty Printing API::, for details on the API this class
  18509. must provide.
  18510. class StdStringPrinter(object):
  18511. "Print a std::string"
  18512. def __init__(self, val):
  18513. self.val = val
  18514. def to_string(self):
  18515. return self.val['_M_dataplus']['_M_p']
  18516. def display_hint(self):
  18517. return 'string'
  18518. And here is an example showing how a lookup function for the printer
  18519. example above might be written.
  18520. def str_lookup_function(val):
  18521. lookup_tag = val.type.tag
  18522. if lookup_tag == None:
  18523. return None
  18524. regex = re.compile("^std::basic_string<char,.*>$")
  18525. if regex.match(lookup_tag):
  18526. return StdStringPrinter(val)
  18527. return None
  18528. The example lookup function extracts the value's type, and attempts
  18529. to match it to a type that it can pretty-print. If it is a type the
  18530. printer can pretty-print, it will return a printer object. If not, it
  18531. returns 'None'.
  18532. We recommend that you put your core pretty-printers into a Python
  18533. package. If your pretty-printers are for use with a library, we further
  18534. recommend embedding a version number into the package name. This
  18535. practice will enable GDB to load multiple versions of your
  18536. pretty-printers at the same time, because they will have different
  18537. names.
  18538. You should write auto-loaded code (*note Python Auto-loading::) such
  18539. that it can be evaluated multiple times without changing its meaning.
  18540. An ideal auto-load file will consist solely of 'import's of your printer
  18541. modules, followed by a call to a register pretty-printers with the
  18542. current objfile.
  18543. Taken as a whole, this approach will scale nicely to multiple
  18544. inferiors, each potentially using a different library version.
  18545. Embedding a version number in the Python package name will ensure that
  18546. GDB is able to load both sets of printers simultaneously. Then, because
  18547. the search for pretty-printers is done by objfile, and because your
  18548. auto-loaded code took care to register your library's printers with a
  18549. specific objfile, GDB will find the correct printers for the specific
  18550. version of the library used by each inferior.
  18551. To continue the 'std::string' example (*note Pretty Printing API::),
  18552. this code might appear in 'gdb.libstdcxx.v6':
  18553. def register_printers(objfile):
  18554. objfile.pretty_printers.append(str_lookup_function)
  18555. And then the corresponding contents of the auto-load file would be:
  18556. import gdb.libstdcxx.v6
  18557. gdb.libstdcxx.v6.register_printers(gdb.current_objfile())
  18558. The previous example illustrates a basic pretty-printer. There are a
  18559. few things that can be improved on. The printer doesn't have a name,
  18560. making it hard to identify in a list of installed printers. The lookup
  18561. function has a name, but lookup functions can have arbitrary, even
  18562. identical, names.
  18563. Second, the printer only handles one type, whereas a library
  18564. typically has several types. One could install a lookup function for
  18565. each desired type in the library, but one could also have a single
  18566. lookup function recognize several types. The latter is the conventional
  18567. way this is handled. If a pretty-printer can handle multiple data
  18568. types, then its "subprinters" are the printers for the individual data
  18569. types.
  18570. The 'gdb.printing' module provides a formal way of solving these
  18571. problems (*note gdb.printing::). Here is another example that handles
  18572. multiple types.
  18573. These are the types we are going to pretty-print:
  18574. struct foo { int a, b; };
  18575. struct bar { struct foo x, y; };
  18576. Here are the printers:
  18577. class fooPrinter:
  18578. """Print a foo object."""
  18579. def __init__(self, val):
  18580. self.val = val
  18581. def to_string(self):
  18582. return ("a=<" + str(self.val["a"]) +
  18583. "> b=<" + str(self.val["b"]) + ">")
  18584. class barPrinter:
  18585. """Print a bar object."""
  18586. def __init__(self, val):
  18587. self.val = val
  18588. def to_string(self):
  18589. return ("x=<" + str(self.val["x"]) +
  18590. "> y=<" + str(self.val["y"]) + ">")
  18591. This example doesn't need a lookup function, that is handled by the
  18592. 'gdb.printing' module. Instead a function is provided to build up the
  18593. object that handles the lookup.
  18594. import gdb.printing
  18595. def build_pretty_printer():
  18596. pp = gdb.printing.RegexpCollectionPrettyPrinter(
  18597. "my_library")
  18598. pp.add_printer('foo', '^foo$', fooPrinter)
  18599. pp.add_printer('bar', '^bar$', barPrinter)
  18600. return pp
  18601. And here is the autoload support:
  18602. import gdb.printing
  18603. import my_library
  18604. gdb.printing.register_pretty_printer(
  18605. gdb.current_objfile(),
  18606. my_library.build_pretty_printer())
  18607. Finally, when this printer is loaded into GDB, here is the
  18608. corresponding output of 'info pretty-printer':
  18609. (gdb) info pretty-printer
  18610. my_library.so:
  18611. my_library
  18612. foo
  18613. bar
  18614. 
  18615. File: gdb.info, Node: Type Printing API, Next: Frame Filter API, Prev: Writing a Pretty-Printer, Up: Python API
  18616. 23.2.2.8 Type Printing API
  18617. ..........................
  18618. GDB provides a way for Python code to customize type display. This is
  18619. mainly useful for substituting canonical typedef names for types.
  18620. A "type printer" is just a Python object conforming to a certain
  18621. protocol. A simple base class implementing the protocol is provided;
  18622. see *note gdb.types::. A type printer must supply at least:
  18623. -- Instance Variable of type_printer: enabled
  18624. A boolean which is True if the printer is enabled, and False
  18625. otherwise. This is manipulated by the 'enable type-printer' and
  18626. 'disable type-printer' commands.
  18627. -- Instance Variable of type_printer: name
  18628. The name of the type printer. This must be a string. This is used
  18629. by the 'enable type-printer' and 'disable type-printer' commands.
  18630. -- Method on type_printer: instantiate (self)
  18631. This is called by GDB at the start of type-printing. It is only
  18632. called if the type printer is enabled. This method must return a
  18633. new object that supplies a 'recognize' method, as described below.
  18634. When displaying a type, say via the 'ptype' command, GDB will compute
  18635. a list of type recognizers. This is done by iterating first over the
  18636. per-objfile type printers (*note Objfiles In Python::), followed by the
  18637. per-progspace type printers (*note Progspaces In Python::), and finally
  18638. the global type printers.
  18639. GDB will call the 'instantiate' method of each enabled type printer.
  18640. If this method returns 'None', then the result is ignored; otherwise, it
  18641. is appended to the list of recognizers.
  18642. Then, when GDB is going to display a type name, it iterates over the
  18643. list of recognizers. For each one, it calls the recognition function,
  18644. stopping if the function returns a non-'None' value. The recognition
  18645. function is defined as:
  18646. -- Method on type_recognizer: recognize (self, type)
  18647. If TYPE is not recognized, return 'None'. Otherwise, return a
  18648. string which is to be printed as the name of TYPE. The TYPE
  18649. argument will be an instance of 'gdb.Type' (*note Types In
  18650. Python::).
  18651. GDB uses this two-pass approach so that type printers can efficiently
  18652. cache information without holding on to it too long. For example, it
  18653. can be convenient to look up type information in a type printer and hold
  18654. it for a recognizer's lifetime; if a single pass were done then type
  18655. printers would have to make use of the event system in order to avoid
  18656. holding information that could become stale as the inferior changed.
  18657. 
  18658. File: gdb.info, Node: Frame Filter API, Next: Frame Decorator API, Prev: Type Printing API, Up: Python API
  18659. 23.2.2.9 Filtering Frames
  18660. .........................
  18661. Frame filters are Python objects that manipulate the visibility of a
  18662. frame or frames when a backtrace (*note Backtrace::) is printed by GDB.
  18663. Only commands that print a backtrace, or, in the case of GDB/MI
  18664. commands (*note GDB/MI::), those that return a collection of frames are
  18665. affected. The commands that work with frame filters are:
  18666. 'backtrace' (*note The backtrace command: backtrace-command.),
  18667. '-stack-list-frames' (*note The -stack-list-frames command:
  18668. -stack-list-frames.), '-stack-list-variables' (*note The
  18669. -stack-list-variables command: -stack-list-variables.),
  18670. '-stack-list-arguments' *note The -stack-list-arguments command:
  18671. -stack-list-arguments.) and '-stack-list-locals' (*note The
  18672. -stack-list-locals command: -stack-list-locals.).
  18673. A frame filter works by taking an iterator as an argument, applying
  18674. actions to the contents of that iterator, and returning another iterator
  18675. (or, possibly, the same iterator it was provided in the case where the
  18676. filter does not perform any operations). Typically, frame filters
  18677. utilize tools such as the Python's 'itertools' module to work with and
  18678. create new iterators from the source iterator. Regardless of how a
  18679. filter chooses to apply actions, it must not alter the underlying GDB
  18680. frame or frames, or attempt to alter the call-stack within GDB. This
  18681. preserves data integrity within GDB. Frame filters are executed on a
  18682. priority basis and care should be taken that some frame filters may have
  18683. been executed before, and that some frame filters will be executed
  18684. after.
  18685. An important consideration when designing frame filters, and well
  18686. worth reflecting upon, is that frame filters should avoid unwinding the
  18687. call stack if possible. Some stacks can run very deep, into the tens of
  18688. thousands in some cases. To search every frame when a frame filter
  18689. executes may be too expensive at that step. The frame filter cannot
  18690. know how many frames it has to iterate over, and it may have to iterate
  18691. through them all. This ends up duplicating effort as GDB performs this
  18692. iteration when it prints the frames. If the filter can defer unwinding
  18693. frames until frame decorators are executed, after the last filter has
  18694. executed, it should. *Note Frame Decorator API::, for more information
  18695. on decorators. Also, there are examples for both frame decorators and
  18696. filters in later chapters. *Note Writing a Frame Filter::, for more
  18697. information.
  18698. The Python dictionary 'gdb.frame_filters' contains key/object
  18699. pairings that comprise a frame filter. Frame filters in this dictionary
  18700. are called 'global' frame filters, and they are available when debugging
  18701. all inferiors. These frame filters must register with the dictionary
  18702. directly. In addition to the 'global' dictionary, there are other
  18703. dictionaries that are loaded with different inferiors via auto-loading
  18704. (*note Python Auto-loading::). The two other areas where frame filter
  18705. dictionaries can be found are: 'gdb.Progspace' which contains a
  18706. 'frame_filters' dictionary attribute, and each 'gdb.Objfile' object
  18707. which also contains a 'frame_filters' dictionary attribute.
  18708. When a command is executed from GDB that is compatible with frame
  18709. filters, GDB combines the 'global', 'gdb.Progspace' and all
  18710. 'gdb.Objfile' dictionaries currently loaded. All of the 'gdb.Objfile'
  18711. dictionaries are combined, as several frames, and thus several object
  18712. files, might be in use. GDB then prunes any frame filter whose
  18713. 'enabled' attribute is 'False'. This pruned list is then sorted
  18714. according to the 'priority' attribute in each filter.
  18715. Once the dictionaries are combined, pruned and sorted, GDB creates an
  18716. iterator which wraps each frame in the call stack in a 'FrameDecorator'
  18717. object, and calls each filter in order. The output from the previous
  18718. filter will always be the input to the next filter, and so on.
  18719. Frame filters have a mandatory interface which each frame filter must
  18720. implement, defined here:
  18721. -- Function: FrameFilter.filter (iterator)
  18722. GDB will call this method on a frame filter when it has reached the
  18723. order in the priority list for that filter.
  18724. For example, if there are four frame filters:
  18725. Name Priority
  18726. Filter1 5
  18727. Filter2 10
  18728. Filter3 100
  18729. Filter4 1
  18730. The order that the frame filters will be called is:
  18731. Filter3 -> Filter2 -> Filter1 -> Filter4
  18732. Note that the output from 'Filter3' is passed to the input of
  18733. 'Filter2', and so on.
  18734. This 'filter' method is passed a Python iterator. This iterator
  18735. contains a sequence of frame decorators that wrap each 'gdb.Frame',
  18736. or a frame decorator that wraps another frame decorator. The first
  18737. filter that is executed in the sequence of frame filters will
  18738. receive an iterator entirely comprised of default 'FrameDecorator'
  18739. objects. However, after each frame filter is executed, the
  18740. previous frame filter may have wrapped some or all of the frame
  18741. decorators with their own frame decorator. As frame decorators
  18742. must also conform to a mandatory interface, these decorators can be
  18743. assumed to act in a uniform manner (*note Frame Decorator API::).
  18744. This method must return an object conforming to the Python iterator
  18745. protocol. Each item in the iterator must be an object conforming
  18746. to the frame decorator interface. If a frame filter does not wish
  18747. to perform any operations on this iterator, it should return that
  18748. iterator untouched.
  18749. This method is not optional. If it does not exist, GDB will raise
  18750. and print an error.
  18751. -- Variable: FrameFilter.name
  18752. The 'name' attribute must be Python string which contains the name
  18753. of the filter displayed by GDB (*note Frame Filter Management::).
  18754. This attribute may contain any combination of letters or numbers.
  18755. Care should be taken to ensure that it is unique. This attribute
  18756. is mandatory.
  18757. -- Variable: FrameFilter.enabled
  18758. The 'enabled' attribute must be Python boolean. This attribute
  18759. indicates to GDB whether the frame filter is enabled, and should be
  18760. considered when frame filters are executed. If 'enabled' is
  18761. 'True', then the frame filter will be executed when any of the
  18762. backtrace commands detailed earlier in this chapter are executed.
  18763. If 'enabled' is 'False', then the frame filter will not be
  18764. executed. This attribute is mandatory.
  18765. -- Variable: FrameFilter.priority
  18766. The 'priority' attribute must be Python integer. This attribute
  18767. controls the order of execution in relation to other frame filters.
  18768. There are no imposed limits on the range of 'priority' other than
  18769. it must be a valid integer. The higher the 'priority' attribute,
  18770. the sooner the frame filter will be executed in relation to other
  18771. frame filters. Although 'priority' can be negative, it is
  18772. recommended practice to assume zero is the lowest priority that a
  18773. frame filter can be assigned. Frame filters that have the same
  18774. priority are executed in unsorted order in that priority slot.
  18775. This attribute is mandatory. 100 is a good default priority.
  18776. 
  18777. File: gdb.info, Node: Frame Decorator API, Next: Writing a Frame Filter, Prev: Frame Filter API, Up: Python API
  18778. 23.2.2.10 Decorating Frames
  18779. ...........................
  18780. Frame decorators are sister objects to frame filters (*note Frame Filter
  18781. API::). Frame decorators are applied by a frame filter and can only be
  18782. used in conjunction with frame filters.
  18783. The purpose of a frame decorator is to customize the printed content
  18784. of each 'gdb.Frame' in commands where frame filters are executed. This
  18785. concept is called decorating a frame. Frame decorators decorate a
  18786. 'gdb.Frame' with Python code contained within each API call. This
  18787. separates the actual data contained in a 'gdb.Frame' from the decorated
  18788. data produced by a frame decorator. This abstraction is necessary to
  18789. maintain integrity of the data contained in each 'gdb.Frame'.
  18790. Frame decorators have a mandatory interface, defined below.
  18791. GDB already contains a frame decorator called 'FrameDecorator'. This
  18792. contains substantial amounts of boilerplate code to decorate the content
  18793. of a 'gdb.Frame'. It is recommended that other frame decorators inherit
  18794. and extend this object, and only to override the methods needed.
  18795. 'FrameDecorator' is defined in the Python module
  18796. 'gdb.FrameDecorator', so your code can import it like:
  18797. from gdb.FrameDecorator import FrameDecorator
  18798. -- Function: FrameDecorator.elided (self)
  18799. The 'elided' method groups frames together in a hierarchical
  18800. system. An example would be an interpreter, where multiple
  18801. low-level frames make up a single call in the interpreted language.
  18802. In this example, the frame filter would elide the low-level frames
  18803. and present a single high-level frame, representing the call in the
  18804. interpreted language, to the user.
  18805. The 'elided' function must return an iterable and this iterable
  18806. must contain the frames that are being elided wrapped in a suitable
  18807. frame decorator. If no frames are being elided this function may
  18808. return an empty iterable, or 'None'. Elided frames are indented
  18809. from normal frames in a 'CLI' backtrace, or in the case of
  18810. 'GDB/MI', are placed in the 'children' field of the eliding frame.
  18811. It is the frame filter's task to also filter out the elided frames
  18812. from the source iterator. This will avoid printing the frame
  18813. twice.
  18814. -- Function: FrameDecorator.function (self)
  18815. This method returns the name of the function in the frame that is
  18816. to be printed.
  18817. This method must return a Python string describing the function, or
  18818. 'None'.
  18819. If this function returns 'None', GDB will not print any data for
  18820. this field.
  18821. -- Function: FrameDecorator.address (self)
  18822. This method returns the address of the frame that is to be printed.
  18823. This method must return a Python numeric integer type of sufficient
  18824. size to describe the address of the frame, or 'None'.
  18825. If this function returns a 'None', GDB will not print any data for
  18826. this field.
  18827. -- Function: FrameDecorator.filename (self)
  18828. This method returns the filename and path associated with this
  18829. frame.
  18830. This method must return a Python string containing the filename and
  18831. the path to the object file backing the frame, or 'None'.
  18832. If this function returns a 'None', GDB will not print any data for
  18833. this field.
  18834. -- Function: FrameDecorator.line (self):
  18835. This method returns the line number associated with the current
  18836. position within the function addressed by this frame.
  18837. This method must return a Python integer type, or 'None'.
  18838. If this function returns a 'None', GDB will not print any data for
  18839. this field.
  18840. -- Function: FrameDecorator.frame_args (self)
  18841. This method must return an iterable, or 'None'. Returning an empty
  18842. iterable, or 'None' means frame arguments will not be printed for
  18843. this frame. This iterable must contain objects that implement two
  18844. methods, described here.
  18845. This object must implement a 'argument' method which takes a single
  18846. 'self' parameter and must return a 'gdb.Symbol' (*note Symbols In
  18847. Python::), or a Python string. The object must also implement a
  18848. 'value' method which takes a single 'self' parameter and must
  18849. return a 'gdb.Value' (*note Values From Inferior::), a Python
  18850. value, or 'None'. If the 'value' method returns 'None', and the
  18851. 'argument' method returns a 'gdb.Symbol', GDB will look-up and
  18852. print the value of the 'gdb.Symbol' automatically.
  18853. A brief example:
  18854. class SymValueWrapper():
  18855. def __init__(self, symbol, value):
  18856. self.sym = symbol
  18857. self.val = value
  18858. def value(self):
  18859. return self.val
  18860. def symbol(self):
  18861. return self.sym
  18862. class SomeFrameDecorator()
  18863. ...
  18864. ...
  18865. def frame_args(self):
  18866. args = []
  18867. try:
  18868. block = self.inferior_frame.block()
  18869. except:
  18870. return None
  18871. # Iterate over all symbols in a block. Only add
  18872. # symbols that are arguments.
  18873. for sym in block:
  18874. if not sym.is_argument:
  18875. continue
  18876. args.append(SymValueWrapper(sym,None))
  18877. # Add example synthetic argument.
  18878. args.append(SymValueWrapper(``foo'', 42))
  18879. return args
  18880. -- Function: FrameDecorator.frame_locals (self)
  18881. This method must return an iterable or 'None'. Returning an empty
  18882. iterable, or 'None' means frame local arguments will not be printed
  18883. for this frame.
  18884. The object interface, the description of the various strategies for
  18885. reading frame locals, and the example are largely similar to those
  18886. described in the 'frame_args' function, (*note The frame filter
  18887. frame_args function: frame_args.). Below is a modified example:
  18888. class SomeFrameDecorator()
  18889. ...
  18890. ...
  18891. def frame_locals(self):
  18892. vars = []
  18893. try:
  18894. block = self.inferior_frame.block()
  18895. except:
  18896. return None
  18897. # Iterate over all symbols in a block. Add all
  18898. # symbols, except arguments.
  18899. for sym in block:
  18900. if sym.is_argument:
  18901. continue
  18902. vars.append(SymValueWrapper(sym,None))
  18903. # Add an example of a synthetic local variable.
  18904. vars.append(SymValueWrapper(``bar'', 99))
  18905. return vars
  18906. -- Function: FrameDecorator.inferior_frame (self):
  18907. This method must return the underlying 'gdb.Frame' that this frame
  18908. decorator is decorating. GDB requires the underlying frame for
  18909. internal frame information to determine how to print certain values
  18910. when printing a frame.
  18911. 
  18912. File: gdb.info, Node: Writing a Frame Filter, Next: Unwinding Frames in Python, Prev: Frame Decorator API, Up: Python API
  18913. 23.2.2.11 Writing a Frame Filter
  18914. ................................
  18915. There are three basic elements that a frame filter must implement: it
  18916. must correctly implement the documented interface (*note Frame Filter
  18917. API::), it must register itself with GDB, and finally, it must decide if
  18918. it is to work on the data provided by GDB. In all cases, whether it
  18919. works on the iterator or not, each frame filter must return an iterator.
  18920. A bare-bones frame filter follows the pattern in the following example.
  18921. import gdb
  18922. class FrameFilter():
  18923. def __init__(self):
  18924. # Frame filter attribute creation.
  18925. #
  18926. # 'name' is the name of the filter that GDB will display.
  18927. #
  18928. # 'priority' is the priority of the filter relative to other
  18929. # filters.
  18930. #
  18931. # 'enabled' is a boolean that indicates whether this filter is
  18932. # enabled and should be executed.
  18933. self.name = "Foo"
  18934. self.priority = 100
  18935. self.enabled = True
  18936. # Register this frame filter with the global frame_filters
  18937. # dictionary.
  18938. gdb.frame_filters[self.name] = self
  18939. def filter(self, frame_iter):
  18940. # Just return the iterator.
  18941. return frame_iter
  18942. The frame filter in the example above implements the three
  18943. requirements for all frame filters. It implements the API, self
  18944. registers, and makes a decision on the iterator (in this case, it just
  18945. returns the iterator untouched).
  18946. The first step is attribute creation and assignment, and as shown in
  18947. the comments the filter assigns the following attributes: 'name',
  18948. 'priority' and whether the filter should be enabled with the 'enabled'
  18949. attribute.
  18950. The second step is registering the frame filter with the dictionary
  18951. or dictionaries that the frame filter has interest in. As shown in the
  18952. comments, this filter just registers itself with the global dictionary
  18953. 'gdb.frame_filters'. As noted earlier, 'gdb.frame_filters' is a
  18954. dictionary that is initialized in the 'gdb' module when GDB starts.
  18955. What dictionary a filter registers with is an important consideration.
  18956. Generally, if a filter is specific to a set of code, it should be
  18957. registered either in the 'objfile' or 'progspace' dictionaries as they
  18958. are specific to the program currently loaded in GDB. The global
  18959. dictionary is always present in GDB and is never unloaded. Any filters
  18960. registered with the global dictionary will exist until GDB exits. To
  18961. avoid filters that may conflict, it is generally better to register
  18962. frame filters against the dictionaries that more closely align with the
  18963. usage of the filter currently in question. *Note Python Auto-loading::,
  18964. for further information on auto-loading Python scripts.
  18965. GDB takes a hands-off approach to frame filter registration,
  18966. therefore it is the frame filter's responsibility to ensure registration
  18967. has occurred, and that any exceptions are handled appropriately. In
  18968. particular, you may wish to handle exceptions relating to Python
  18969. dictionary key uniqueness. It is mandatory that the dictionary key is
  18970. the same as frame filter's 'name' attribute. When a user manages frame
  18971. filters (*note Frame Filter Management::), the names GDB will display
  18972. are those contained in the 'name' attribute.
  18973. The final step of this example is the implementation of the 'filter'
  18974. method. As shown in the example comments, we define the 'filter' method
  18975. and note that the method must take an iterator, and also must return an
  18976. iterator. In this bare-bones example, the frame filter is not very
  18977. useful as it just returns the iterator untouched. However this is a
  18978. valid operation for frame filters that have the 'enabled' attribute set,
  18979. but decide not to operate on any frames.
  18980. In the next example, the frame filter operates on all frames and
  18981. utilizes a frame decorator to perform some work on the frames. *Note
  18982. Frame Decorator API::, for further information on the frame decorator
  18983. interface.
  18984. This example works on inlined frames. It highlights frames which are
  18985. inlined by tagging them with an "[inlined]" tag. By applying a frame
  18986. decorator to all frames with the Python 'itertools imap' method, the
  18987. example defers actions to the frame decorator. Frame decorators are
  18988. only processed when GDB prints the backtrace.
  18989. This introduces a new decision making topic: whether to perform
  18990. decision making operations at the filtering step, or at the printing
  18991. step. In this example's approach, it does not perform any filtering
  18992. decisions at the filtering step beyond mapping a frame decorator to each
  18993. frame. This allows the actual decision making to be performed when each
  18994. frame is printed. This is an important consideration, and well worth
  18995. reflecting upon when designing a frame filter. An issue that frame
  18996. filters should avoid is unwinding the stack if possible. Some stacks
  18997. can run very deep, into the tens of thousands in some cases. To search
  18998. every frame to determine if it is inlined ahead of time may be too
  18999. expensive at the filtering step. The frame filter cannot know how many
  19000. frames it has to iterate over, and it would have to iterate through them
  19001. all. This ends up duplicating effort as GDB performs this iteration
  19002. when it prints the frames.
  19003. In this example decision making can be deferred to the printing step.
  19004. As each frame is printed, the frame decorator can examine each frame in
  19005. turn when GDB iterates. From a performance viewpoint, this is the most
  19006. appropriate decision to make as it avoids duplicating the effort that
  19007. the printing step would undertake anyway. Also, if there are many frame
  19008. filters unwinding the stack during filtering, it can substantially delay
  19009. the printing of the backtrace which will result in large memory usage,
  19010. and a poor user experience.
  19011. class InlineFilter():
  19012. def __init__(self):
  19013. self.name = "InlinedFrameFilter"
  19014. self.priority = 100
  19015. self.enabled = True
  19016. gdb.frame_filters[self.name] = self
  19017. def filter(self, frame_iter):
  19018. frame_iter = itertools.imap(InlinedFrameDecorator,
  19019. frame_iter)
  19020. return frame_iter
  19021. This frame filter is somewhat similar to the earlier example, except
  19022. that the 'filter' method applies a frame decorator object called
  19023. 'InlinedFrameDecorator' to each element in the iterator. The 'imap'
  19024. Python method is light-weight. It does not proactively iterate over the
  19025. iterator, but rather creates a new iterator which wraps the existing
  19026. one.
  19027. Below is the frame decorator for this example.
  19028. class InlinedFrameDecorator(FrameDecorator):
  19029. def __init__(self, fobj):
  19030. super(InlinedFrameDecorator, self).__init__(fobj)
  19031. def function(self):
  19032. frame = fobj.inferior_frame()
  19033. name = str(frame.name())
  19034. if frame.type() == gdb.INLINE_FRAME:
  19035. name = name + " [inlined]"
  19036. return name
  19037. This frame decorator only defines and overrides the 'function'
  19038. method. It lets the supplied 'FrameDecorator', which is shipped with
  19039. GDB, perform the other work associated with printing this frame.
  19040. The combination of these two objects create this output from a
  19041. backtrace:
  19042. #0 0x004004e0 in bar () at inline.c:11
  19043. #1 0x00400566 in max [inlined] (b=6, a=12) at inline.c:21
  19044. #2 0x00400566 in main () at inline.c:31
  19045. So in the case of this example, a frame decorator is applied to all
  19046. frames, regardless of whether they may be inlined or not. As GDB
  19047. iterates over the iterator produced by the frame filters, GDB executes
  19048. each frame decorator which then makes a decision on what to print in the
  19049. 'function' callback. Using a strategy like this is a way to defer
  19050. decisions on the frame content to printing time.
  19051. Eliding Frames
  19052. --------------
  19053. It might be that the above example is not desirable for representing
  19054. inlined frames, and a hierarchical approach may be preferred. If we
  19055. want to hierarchically represent frames, the 'elided' frame decorator
  19056. interface might be preferable.
  19057. This example approaches the issue with the 'elided' method. This
  19058. example is quite long, but very simplistic. It is out-of-scope for this
  19059. section to write a complete example that comprehensively covers all
  19060. approaches of finding and printing inlined frames. However, this
  19061. example illustrates the approach an author might use.
  19062. This example comprises of three sections.
  19063. class InlineFrameFilter():
  19064. def __init__(self):
  19065. self.name = "InlinedFrameFilter"
  19066. self.priority = 100
  19067. self.enabled = True
  19068. gdb.frame_filters[self.name] = self
  19069. def filter(self, frame_iter):
  19070. return ElidingInlineIterator(frame_iter)
  19071. This frame filter is very similar to the other examples. The only
  19072. difference is this frame filter is wrapping the iterator provided to it
  19073. ('frame_iter') with a custom iterator called 'ElidingInlineIterator'.
  19074. This again defers actions to when GDB prints the backtrace, as the
  19075. iterator is not traversed until printing.
  19076. The iterator for this example is as follows. It is in this section
  19077. of the example where decisions are made on the content of the backtrace.
  19078. class ElidingInlineIterator:
  19079. def __init__(self, ii):
  19080. self.input_iterator = ii
  19081. def __iter__(self):
  19082. return self
  19083. def next(self):
  19084. frame = next(self.input_iterator)
  19085. if frame.inferior_frame().type() != gdb.INLINE_FRAME:
  19086. return frame
  19087. try:
  19088. eliding_frame = next(self.input_iterator)
  19089. except StopIteration:
  19090. return frame
  19091. return ElidingFrameDecorator(eliding_frame, [frame])
  19092. This iterator implements the Python iterator protocol. When the
  19093. 'next' function is called (when GDB prints each frame), the iterator
  19094. checks if this frame decorator, 'frame', is wrapping an inlined frame.
  19095. If it is not, it returns the existing frame decorator untouched. If it
  19096. is wrapping an inlined frame, it assumes that the inlined frame was
  19097. contained within the next oldest frame, 'eliding_frame', which it
  19098. fetches. It then creates and returns a frame decorator,
  19099. 'ElidingFrameDecorator', which contains both the elided frame, and the
  19100. eliding frame.
  19101. class ElidingInlineDecorator(FrameDecorator):
  19102. def __init__(self, frame, elided_frames):
  19103. super(ElidingInlineDecorator, self).__init__(frame)
  19104. self.frame = frame
  19105. self.elided_frames = elided_frames
  19106. def elided(self):
  19107. return iter(self.elided_frames)
  19108. This frame decorator overrides one function and returns the inlined
  19109. frame in the 'elided' method. As before it lets 'FrameDecorator' do the
  19110. rest of the work involved in printing this frame. This produces the
  19111. following output.
  19112. #0 0x004004e0 in bar () at inline.c:11
  19113. #2 0x00400529 in main () at inline.c:25
  19114. #1 0x00400529 in max (b=6, a=12) at inline.c:15
  19115. In that output, 'max' which has been inlined into 'main' is printed
  19116. hierarchically. Another approach would be to combine the 'function'
  19117. method, and the 'elided' method to both print a marker in the inlined
  19118. frame, and also show the hierarchical relationship.
  19119. 
  19120. File: gdb.info, Node: Unwinding Frames in Python, Next: Xmethods In Python, Prev: Writing a Frame Filter, Up: Python API
  19121. 23.2.2.12 Unwinding Frames in Python
  19122. ....................................
  19123. In GDB terminology "unwinding" is the process of finding the previous
  19124. frame (that is, caller's) from the current one. An unwinder has three
  19125. methods. The first one checks if it can handle given frame ("sniff"
  19126. it). For the frames it can sniff an unwinder provides two additional
  19127. methods: it can return frame's ID, and it can fetch registers from the
  19128. previous frame. A running GDB mantains a list of the unwinders and
  19129. calls each unwinder's sniffer in turn until it finds the one that
  19130. recognizes the current frame. There is an API to register an unwinder.
  19131. The unwinders that come with GDB handle standard frames. However,
  19132. mixed language applications (for example, an application running Java
  19133. Virtual Machine) sometimes use frame layouts that cannot be handled by
  19134. the GDB unwinders. You can write Python code that can handle such
  19135. custom frames.
  19136. You implement a frame unwinder in Python as a class with which has
  19137. two attributes, 'name' and 'enabled', with obvious meanings, and a
  19138. single method '__call__', which examines a given frame and returns an
  19139. object (an instance of 'gdb.UnwindInfo class)' describing it. If an
  19140. unwinder does not recognize a frame, it should return 'None'. The code
  19141. in GDB that enables writing unwinders in Python uses this object to
  19142. return frame's ID and previous frame registers when GDB core asks for
  19143. them.
  19144. An unwinder should do as little work as possible. Some otherwise
  19145. innocuous operations can cause problems (even crashes, as this code is
  19146. not not well-hardened yet). For example, making an inferior call from
  19147. an unwinder is unadvisable, as an inferior call will reset GDB's stack
  19148. unwinding process, potentially causing re-entrant unwinding.
  19149. Unwinder Input
  19150. --------------
  19151. An object passed to an unwinder (a 'gdb.PendingFrame' instance) provides
  19152. a method to read frame's registers:
  19153. -- Function: PendingFrame.read_register (reg)
  19154. This method returns the contents of the register REG in the frame
  19155. as a 'gdb.Value' object. REG can be either a register number or a
  19156. register name; the values are platform-specific. They are usually
  19157. found in the corresponding 'PLATFORM-tdep.h' file in the GDB source
  19158. tree. If REG does not name a register for the current
  19159. architecture, this method will throw an exception.
  19160. Note that this method will always return a 'gdb.Value' for a valid
  19161. register name. This does not mean that the value will be valid.
  19162. For example, you may request a register that an earlier unwinder
  19163. could not unwind--the value will be unavailable. Instead, the
  19164. 'gdb.Value' returned from this method will be lazy; that is, its
  19165. underlying bits will not be fetched until it is first used. So,
  19166. attempting to use such a value will cause an exception at the point
  19167. of use.
  19168. The type of the returned 'gdb.Value' depends on the register and
  19169. the architecture. It is common for registers to have a scalar
  19170. type, like 'long long'; but many other types are possible, such as
  19171. pointer, pointer-to-function, floating point or vector types.
  19172. It also provides a factory method to create a 'gdb.UnwindInfo'
  19173. instance to be returned to GDB:
  19174. -- Function: PendingFrame.create_unwind_info (frame_id)
  19175. Returns a new 'gdb.UnwindInfo' instance identified by given
  19176. FRAME_ID. The argument is used to build GDB's frame ID using one
  19177. of functions provided by GDB. FRAME_ID's attributes determine
  19178. which function will be used, as follows:
  19179. 'sp, pc'
  19180. The frame is identified by the given stack address and PC. The
  19181. stack address must be chosen so that it is constant throughout
  19182. the lifetime of the frame, so a typical choice is the value of
  19183. the stack pointer at the start of the function--in the DWARF
  19184. standard, this would be the "Call Frame Address".
  19185. This is the most common case by far. The other cases are
  19186. documented for completeness but are only useful in specialized
  19187. situations.
  19188. 'sp, pc, special'
  19189. The frame is identified by the stack address, the PC, and a
  19190. "special" address. The special address is used on
  19191. architectures that can have frames that do not change the
  19192. stack, but which are still distinct, for example the IA-64,
  19193. which has a second stack for registers. Both SP and SPECIAL
  19194. must be constant throughout the lifetime of the frame.
  19195. 'sp'
  19196. The frame is identified by the stack address only. Any other
  19197. stack frame with a matching SP will be considered to match
  19198. this frame. Inside gdb, this is called a "wild frame". You
  19199. will never need this.
  19200. Each attribute value should be an instance of 'gdb.Value'.
  19201. Unwinder Output: UnwindInfo
  19202. ---------------------------
  19203. Use 'PendingFrame.create_unwind_info' method described above to create a
  19204. 'gdb.UnwindInfo' instance. Use the following method to specify caller
  19205. registers that have been saved in this frame:
  19206. -- Function: gdb.UnwindInfo.add_saved_register (reg, value)
  19207. REG identifies the register. It can be a number or a name, just as
  19208. for the 'PendingFrame.read_register' method above. VALUE is a
  19209. register value (a 'gdb.Value' object).
  19210. Unwinder Skeleton Code
  19211. ----------------------
  19212. GDB comes with the module containing the base 'Unwinder' class. Derive
  19213. your unwinder class from it and structure the code as follows:
  19214. from gdb.unwinders import Unwinder
  19215. class FrameId(object):
  19216. def __init__(self, sp, pc):
  19217. self.sp = sp
  19218. self.pc = pc
  19219. class MyUnwinder(Unwinder):
  19220. def __init__(....):
  19221. supe(MyUnwinder, self).__init___(<expects unwinder name argument>)
  19222. def __call__(pending_frame):
  19223. if not <we recognize frame>:
  19224. return None
  19225. # Create UnwindInfo. Usually the frame is identified by the stack
  19226. # pointer and the program counter.
  19227. sp = pending_frame.read_register(<SP number>)
  19228. pc = pending_frame.read_register(<PC number>)
  19229. unwind_info = pending_frame.create_unwind_info(FrameId(sp, pc))
  19230. # Find the values of the registers in the caller's frame and
  19231. # save them in the result:
  19232. unwind_info.add_saved_register(<register>, <value>)
  19233. ....
  19234. # Return the result:
  19235. return unwind_info
  19236. Registering a Unwinder
  19237. ----------------------
  19238. An object file, a program space, and the GDB proper can have unwinders
  19239. registered with it.
  19240. The 'gdb.unwinders' module provides the function to register a
  19241. unwinder:
  19242. -- Function: gdb.unwinder.register_unwinder (locus, unwinder,
  19243. replace=False)
  19244. LOCUS is specifies an object file or a program space to which
  19245. UNWINDER is added. Passing 'None' or 'gdb' adds UNWINDER to the
  19246. GDB's global unwinder list. The newly added UNWINDER will be
  19247. called before any other unwinder from the same locus. Two
  19248. unwinders in the same locus cannot have the same name. An attempt
  19249. to add a unwinder with already existing name raises an exception
  19250. unless REPLACE is 'True', in which case the old unwinder is
  19251. deleted.
  19252. Unwinder Precedence
  19253. -------------------
  19254. GDB first calls the unwinders from all the object files in no particular
  19255. order, then the unwinders from the current program space, and finally
  19256. the unwinders from GDB.
  19257. 
  19258. File: gdb.info, Node: Xmethods In Python, Next: Xmethod API, Prev: Unwinding Frames in Python, Up: Python API
  19259. 23.2.2.13 Xmethods In Python
  19260. ............................
  19261. "Xmethods" are additional methods or replacements for existing methods
  19262. of a C++ class. This feature is useful for those cases where a method
  19263. defined in C++ source code could be inlined or optimized out by the
  19264. compiler, making it unavailable to GDB. For such cases, one can define
  19265. an xmethod to serve as a replacement for the method defined in the C++
  19266. source code. GDB will then invoke the xmethod, instead of the C++
  19267. method, to evaluate expressions. One can also use xmethods when
  19268. debugging with core files. Moreover, when debugging live programs,
  19269. invoking an xmethod need not involve running the inferior (which can
  19270. potentially perturb its state). Hence, even if the C++ method is
  19271. available, it is better to use its replacement xmethod if one is
  19272. defined.
  19273. The xmethods feature in Python is available via the concepts of an
  19274. "xmethod matcher" and an "xmethod worker". To implement an xmethod, one
  19275. has to implement a matcher and a corresponding worker for it (more than
  19276. one worker can be implemented, each catering to a different overloaded
  19277. instance of the method). Internally, GDB invokes the 'match' method of
  19278. a matcher to match the class type and method name. On a match, the
  19279. 'match' method returns a list of matching _worker_ objects. Each worker
  19280. object typically corresponds to an overloaded instance of the xmethod.
  19281. They implement a 'get_arg_types' method which returns a sequence of
  19282. types corresponding to the arguments the xmethod requires. GDB uses
  19283. this sequence of types to perform overload resolution and picks a
  19284. winning xmethod worker. A winner is also selected from among the
  19285. methods GDB finds in the C++ source code. Next, the winning xmethod
  19286. worker and the winning C++ method are compared to select an overall
  19287. winner. In case of a tie between a xmethod worker and a C++ method, the
  19288. xmethod worker is selected as the winner. That is, if a winning xmethod
  19289. worker is found to be equivalent to the winning C++ method, then the
  19290. xmethod worker is treated as a replacement for the C++ method. GDB uses
  19291. the overall winner to invoke the method. If the winning xmethod worker
  19292. is the overall winner, then the corresponding xmethod is invoked via the
  19293. '__call__' method of the worker object.
  19294. If one wants to implement an xmethod as a replacement for an existing
  19295. C++ method, then they have to implement an equivalent xmethod which has
  19296. exactly the same name and takes arguments of exactly the same type as
  19297. the C++ method. If the user wants to invoke the C++ method even though
  19298. a replacement xmethod is available for that method, then they can
  19299. disable the xmethod.
  19300. *Note Xmethod API::, for API to implement xmethods in Python. *Note
  19301. Writing an Xmethod::, for implementing xmethods in Python.
  19302. 
  19303. File: gdb.info, Node: Xmethod API, Next: Writing an Xmethod, Prev: Xmethods In Python, Up: Python API
  19304. 23.2.2.14 Xmethod API
  19305. .....................
  19306. The GDB Python API provides classes, interfaces and functions to
  19307. implement, register and manipulate xmethods. *Note Xmethods In
  19308. Python::.
  19309. An xmethod matcher should be an instance of a class derived from
  19310. 'XMethodMatcher' defined in the module 'gdb.xmethod', or an object with
  19311. similar interface and attributes. An instance of 'XMethodMatcher' has
  19312. the following attributes:
  19313. -- Variable: name
  19314. The name of the matcher.
  19315. -- Variable: enabled
  19316. A boolean value indicating whether the matcher is enabled or
  19317. disabled.
  19318. -- Variable: methods
  19319. A list of named methods managed by the matcher. Each object in the
  19320. list is an instance of the class 'XMethod' defined in the module
  19321. 'gdb.xmethod', or any object with the following attributes:
  19322. 'name'
  19323. Name of the xmethod which should be unique for each xmethod
  19324. managed by the matcher.
  19325. 'enabled'
  19326. A boolean value indicating whether the xmethod is enabled or
  19327. disabled.
  19328. The class 'XMethod' is a convenience class with same attributes as
  19329. above along with the following constructor:
  19330. -- Function: XMethod.__init__ (self, name)
  19331. Constructs an enabled xmethod with name NAME.
  19332. The 'XMethodMatcher' class has the following methods:
  19333. -- Function: XMethodMatcher.__init__ (self, name)
  19334. Constructs an enabled xmethod matcher with name NAME. The
  19335. 'methods' attribute is initialized to 'None'.
  19336. -- Function: XMethodMatcher.match (self, class_type, method_name)
  19337. Derived classes should override this method. It should return a
  19338. xmethod worker object (or a sequence of xmethod worker objects)
  19339. matching the CLASS_TYPE and METHOD_NAME. CLASS_TYPE is a
  19340. 'gdb.Type' object, and METHOD_NAME is a string value. If the
  19341. matcher manages named methods as listed in its 'methods' attribute,
  19342. then only those worker objects whose corresponding entries in the
  19343. 'methods' list are enabled should be returned.
  19344. An xmethod worker should be an instance of a class derived from
  19345. 'XMethodWorker' defined in the module 'gdb.xmethod', or support the
  19346. following interface:
  19347. -- Function: XMethodWorker.get_arg_types (self)
  19348. This method returns a sequence of 'gdb.Type' objects corresponding
  19349. to the arguments that the xmethod takes. It can return an empty
  19350. sequence or 'None' if the xmethod does not take any arguments. If
  19351. the xmethod takes a single argument, then a single 'gdb.Type'
  19352. object corresponding to it can be returned.
  19353. -- Function: XMethodWorker.get_result_type (self, *args)
  19354. This method returns a 'gdb.Type' object representing the type of
  19355. the result of invoking this xmethod. The ARGS argument is the same
  19356. tuple of arguments that would be passed to the '__call__' method of
  19357. this worker.
  19358. -- Function: XMethodWorker.__call__ (self, *args)
  19359. This is the method which does the _work_ of the xmethod. The ARGS
  19360. arguments is the tuple of arguments to the xmethod. Each element
  19361. in this tuple is a gdb.Value object. The first element is always
  19362. the 'this' pointer value.
  19363. For GDB to lookup xmethods, the xmethod matchers should be registered
  19364. using the following function defined in the module 'gdb.xmethod':
  19365. -- Function: register_xmethod_matcher (locus, matcher, replace=False)
  19366. The 'matcher' is registered with 'locus', replacing an existing
  19367. matcher with the same name as 'matcher' if 'replace' is 'True'.
  19368. 'locus' can be a 'gdb.Objfile' object (*note Objfiles In Python::),
  19369. or a 'gdb.Progspace' object (*note Progspaces In Python::), or
  19370. 'None'. If it is 'None', then 'matcher' is registered globally.
  19371. 
  19372. File: gdb.info, Node: Writing an Xmethod, Next: Inferiors In Python, Prev: Xmethod API, Up: Python API
  19373. 23.2.2.15 Writing an Xmethod
  19374. ............................
  19375. Implementing xmethods in Python will require implementing xmethod
  19376. matchers and xmethod workers (*note Xmethods In Python::). Consider the
  19377. following C++ class:
  19378. class MyClass
  19379. {
  19380. public:
  19381. MyClass (int a) : a_(a) { }
  19382. int geta (void) { return a_; }
  19383. int operator+ (int b);
  19384. private:
  19385. int a_;
  19386. };
  19387. int
  19388. MyClass::operator+ (int b)
  19389. {
  19390. return a_ + b;
  19391. }
  19392. Let us define two xmethods for the class 'MyClass', one replacing the
  19393. method 'geta', and another adding an overloaded flavor of 'operator+'
  19394. which takes a 'MyClass' argument (the C++ code above already has an
  19395. overloaded 'operator+' which takes an 'int' argument). The xmethod
  19396. matcher can be defined as follows:
  19397. class MyClass_geta(gdb.xmethod.XMethod):
  19398. def __init__(self):
  19399. gdb.xmethod.XMethod.__init__(self, 'geta')
  19400. def get_worker(self, method_name):
  19401. if method_name == 'geta':
  19402. return MyClassWorker_geta()
  19403. class MyClass_sum(gdb.xmethod.XMethod):
  19404. def __init__(self):
  19405. gdb.xmethod.XMethod.__init__(self, 'sum')
  19406. def get_worker(self, method_name):
  19407. if method_name == 'operator+':
  19408. return MyClassWorker_plus()
  19409. class MyClassMatcher(gdb.xmethod.XMethodMatcher):
  19410. def __init__(self):
  19411. gdb.xmethod.XMethodMatcher.__init__(self, 'MyClassMatcher')
  19412. # List of methods 'managed' by this matcher
  19413. self.methods = [MyClass_geta(), MyClass_sum()]
  19414. def match(self, class_type, method_name):
  19415. if class_type.tag != 'MyClass':
  19416. return None
  19417. workers = []
  19418. for method in self.methods:
  19419. if method.enabled:
  19420. worker = method.get_worker(method_name)
  19421. if worker:
  19422. workers.append(worker)
  19423. return workers
  19424. Notice that the 'match' method of 'MyClassMatcher' returns a worker
  19425. object of type 'MyClassWorker_geta' for the 'geta' method, and a worker
  19426. object of type 'MyClassWorker_plus' for the 'operator+' method. This is
  19427. done indirectly via helper classes derived from 'gdb.xmethod.XMethod'.
  19428. One does not need to use the 'methods' attribute in a matcher as it is
  19429. optional. However, if a matcher manages more than one xmethod, it is a
  19430. good practice to list the xmethods in the 'methods' attribute of the
  19431. matcher. This will then facilitate enabling and disabling individual
  19432. xmethods via the 'enable/disable' commands. Notice also that a worker
  19433. object is returned only if the corresponding entry in the 'methods'
  19434. attribute of the matcher is enabled.
  19435. The implementation of the worker classes returned by the matcher
  19436. setup above is as follows:
  19437. class MyClassWorker_geta(gdb.xmethod.XMethodWorker):
  19438. def get_arg_types(self):
  19439. return None
  19440. def get_result_type(self, obj):
  19441. return gdb.lookup_type('int')
  19442. def __call__(self, obj):
  19443. return obj['a_']
  19444. class MyClassWorker_plus(gdb.xmethod.XMethodWorker):
  19445. def get_arg_types(self):
  19446. return gdb.lookup_type('MyClass')
  19447. def get_result_type(self, obj):
  19448. return gdb.lookup_type('int')
  19449. def __call__(self, obj, other):
  19450. return obj['a_'] + other['a_']
  19451. For GDB to actually lookup a xmethod, it has to be registered with
  19452. it. The matcher defined above is registered with GDB globally as
  19453. follows:
  19454. gdb.xmethod.register_xmethod_matcher(None, MyClassMatcher())
  19455. If an object 'obj' of type 'MyClass' is initialized in C++ code as
  19456. follows:
  19457. MyClass obj(5);
  19458. then, after loading the Python script defining the xmethod matchers and
  19459. workers into 'GDBN', invoking the method 'geta' or using the operator
  19460. '+' on 'obj' will invoke the xmethods defined above:
  19461. (gdb) p obj.geta()
  19462. $1 = 5
  19463. (gdb) p obj + obj
  19464. $2 = 10
  19465. Consider another example with a C++ template class:
  19466. template <class T>
  19467. class MyTemplate
  19468. {
  19469. public:
  19470. MyTemplate () : dsize_(10), data_ (new T [10]) { }
  19471. ~MyTemplate () { delete [] data_; }
  19472. int footprint (void)
  19473. {
  19474. return sizeof (T) * dsize_ + sizeof (MyTemplate<T>);
  19475. }
  19476. private:
  19477. int dsize_;
  19478. T *data_;
  19479. };
  19480. Let us implement an xmethod for the above class which serves as a
  19481. replacement for the 'footprint' method. The full code listing of the
  19482. xmethod workers and xmethod matchers is as follows:
  19483. class MyTemplateWorker_footprint(gdb.xmethod.XMethodWorker):
  19484. def __init__(self, class_type):
  19485. self.class_type = class_type
  19486. def get_arg_types(self):
  19487. return None
  19488. def get_result_type(self):
  19489. return gdb.lookup_type('int')
  19490. def __call__(self, obj):
  19491. return (self.class_type.sizeof +
  19492. obj['dsize_'] *
  19493. self.class_type.template_argument(0).sizeof)
  19494. class MyTemplateMatcher_footprint(gdb.xmethod.XMethodMatcher):
  19495. def __init__(self):
  19496. gdb.xmethod.XMethodMatcher.__init__(self, 'MyTemplateMatcher')
  19497. def match(self, class_type, method_name):
  19498. if (re.match('MyTemplate<[ \t\n]*[_a-zA-Z][ _a-zA-Z0-9]*>',
  19499. class_type.tag) and
  19500. method_name == 'footprint'):
  19501. return MyTemplateWorker_footprint(class_type)
  19502. Notice that, in this example, we have not used the 'methods'
  19503. attribute of the matcher as the matcher manages only one xmethod. The
  19504. user can enable/disable this xmethod by enabling/disabling the matcher
  19505. itself.
  19506. 
  19507. File: gdb.info, Node: Inferiors In Python, Next: Events In Python, Prev: Writing an Xmethod, Up: Python API
  19508. 23.2.2.16 Inferiors In Python
  19509. .............................
  19510. Programs which are being run under GDB are called inferiors (*note
  19511. Inferiors and Programs::). Python scripts can access information about
  19512. and manipulate inferiors controlled by GDB via objects of the
  19513. 'gdb.Inferior' class.
  19514. The following inferior-related functions are available in the 'gdb'
  19515. module:
  19516. -- Function: gdb.inferiors ()
  19517. Return a tuple containing all inferior objects.
  19518. -- Function: gdb.selected_inferior ()
  19519. Return an object representing the current inferior.
  19520. A 'gdb.Inferior' object has the following attributes:
  19521. -- Variable: Inferior.num
  19522. ID of inferior, as assigned by GDB.
  19523. -- Variable: Inferior.pid
  19524. Process ID of the inferior, as assigned by the underlying operating
  19525. system.
  19526. -- Variable: Inferior.was_attached
  19527. Boolean signaling whether the inferior was created using 'attach',
  19528. or started by GDB itself.
  19529. -- Variable: Inferior.progspace
  19530. The inferior's program space. *Note Progspaces In Python::.
  19531. A 'gdb.Inferior' object has the following methods:
  19532. -- Function: Inferior.is_valid ()
  19533. Returns 'True' if the 'gdb.Inferior' object is valid, 'False' if
  19534. not. A 'gdb.Inferior' object will become invalid if the inferior
  19535. no longer exists within GDB. All other 'gdb.Inferior' methods will
  19536. throw an exception if it is invalid at the time the method is
  19537. called.
  19538. -- Function: Inferior.threads ()
  19539. This method returns a tuple holding all the threads which are valid
  19540. when it is called. If there are no valid threads, the method will
  19541. return an empty tuple.
  19542. -- Function: Inferior.architecture ()
  19543. Return the 'gdb.Architecture' (*note Architectures In Python::) for
  19544. this inferior. This represents the architecture of the inferior as
  19545. a whole. Some platforms can have multiple architectures in a
  19546. single address space, so this may not match the architecture of a
  19547. particular frame (*note Frames In Python::).
  19548. -- Function: Inferior.read_memory (address, length)
  19549. Read LENGTH addressable memory units from the inferior, starting at
  19550. ADDRESS. Returns a buffer object, which behaves much like an array
  19551. or a string. It can be modified and given to the
  19552. 'Inferior.write_memory' function. In Python 3, the return value is
  19553. a 'memoryview' object.
  19554. -- Function: Inferior.write_memory (address, buffer [, length])
  19555. Write the contents of BUFFER to the inferior, starting at ADDRESS.
  19556. The BUFFER parameter must be a Python object which supports the
  19557. buffer protocol, i.e., a string, an array or the object returned
  19558. from 'Inferior.read_memory'. If given, LENGTH determines the
  19559. number of addressable memory units from BUFFER to be written.
  19560. -- Function: Inferior.search_memory (address, length, pattern)
  19561. Search a region of the inferior memory starting at ADDRESS with the
  19562. given LENGTH using the search pattern supplied in PATTERN. The
  19563. PATTERN parameter must be a Python object which supports the buffer
  19564. protocol, i.e., a string, an array or the object returned from
  19565. 'gdb.read_memory'. Returns a Python 'Long' containing the address
  19566. where the pattern was found, or 'None' if the pattern could not be
  19567. found.
  19568. -- Function: Inferior.thread_from_thread_handle (thread_handle)
  19569. Return the thread object corresponding to THREAD_HANDLE, a thread
  19570. library specific data structure such as 'pthread_t' for pthreads
  19571. library implementations.
  19572. 
  19573. File: gdb.info, Node: Events In Python, Next: Threads In Python, Prev: Inferiors In Python, Up: Python API
  19574. 23.2.2.17 Events In Python
  19575. ..........................
  19576. GDB provides a general event facility so that Python code can be
  19577. notified of various state changes, particularly changes that occur in
  19578. the inferior.
  19579. An "event" is just an object that describes some state change. The
  19580. type of the object and its attributes will vary depending on the details
  19581. of the change. All the existing events are described below.
  19582. In order to be notified of an event, you must register an event
  19583. handler with an "event registry". An event registry is an object in the
  19584. 'gdb.events' module which dispatches particular events. A registry
  19585. provides methods to register and unregister event handlers:
  19586. -- Function: EventRegistry.connect (object)
  19587. Add the given callable OBJECT to the registry. This object will be
  19588. called when an event corresponding to this registry occurs.
  19589. -- Function: EventRegistry.disconnect (object)
  19590. Remove the given OBJECT from the registry. Once removed, the
  19591. object will no longer receive notifications of events.
  19592. Here is an example:
  19593. def exit_handler (event):
  19594. print "event type: exit"
  19595. print "exit code: %d" % (event.exit_code)
  19596. gdb.events.exited.connect (exit_handler)
  19597. In the above example we connect our handler 'exit_handler' to the
  19598. registry 'events.exited'. Once connected, 'exit_handler' gets called
  19599. when the inferior exits. The argument "event" in this example is of
  19600. type 'gdb.ExitedEvent'. As you can see in the example the 'ExitedEvent'
  19601. object has an attribute which indicates the exit code of the inferior.
  19602. The following is a listing of the event registries that are available
  19603. and details of the events they emit:
  19604. 'events.cont'
  19605. Emits 'gdb.ThreadEvent'.
  19606. Some events can be thread specific when GDB is running in non-stop
  19607. mode. When represented in Python, these events all extend
  19608. 'gdb.ThreadEvent'. Note, this event is not emitted directly;
  19609. instead, events which are emitted by this or other modules might
  19610. extend this event. Examples of these events are
  19611. 'gdb.BreakpointEvent' and 'gdb.ContinueEvent'.
  19612. -- Variable: ThreadEvent.inferior_thread
  19613. In non-stop mode this attribute will be set to the specific
  19614. thread which was involved in the emitted event. Otherwise, it
  19615. will be set to 'None'.
  19616. Emits 'gdb.ContinueEvent' which extends 'gdb.ThreadEvent'.
  19617. This event indicates that the inferior has been continued after a
  19618. stop. For inherited attribute refer to 'gdb.ThreadEvent' above.
  19619. 'events.exited'
  19620. Emits 'events.ExitedEvent' which indicates that the inferior has
  19621. exited. 'events.ExitedEvent' has two attributes:
  19622. -- Variable: ExitedEvent.exit_code
  19623. An integer representing the exit code, if available, which the
  19624. inferior has returned. (The exit code could be unavailable
  19625. if, for example, GDB detaches from the inferior.) If the exit
  19626. code is unavailable, the attribute does not exist.
  19627. -- Variable: ExitedEvent.inferior
  19628. A reference to the inferior which triggered the 'exited'
  19629. event.
  19630. 'events.stop'
  19631. Emits 'gdb.StopEvent' which extends 'gdb.ThreadEvent'.
  19632. Indicates that the inferior has stopped. All events emitted by
  19633. this registry extend StopEvent. As a child of 'gdb.ThreadEvent',
  19634. 'gdb.StopEvent' will indicate the stopped thread when GDB is
  19635. running in non-stop mode. Refer to 'gdb.ThreadEvent' above for
  19636. more details.
  19637. Emits 'gdb.SignalEvent' which extends 'gdb.StopEvent'.
  19638. This event indicates that the inferior or one of its threads has
  19639. received as signal. 'gdb.SignalEvent' has the following
  19640. attributes:
  19641. -- Variable: SignalEvent.stop_signal
  19642. A string representing the signal received by the inferior. A
  19643. list of possible signal values can be obtained by running the
  19644. command 'info signals' in the GDB command prompt.
  19645. Also emits 'gdb.BreakpointEvent' which extends 'gdb.StopEvent'.
  19646. 'gdb.BreakpointEvent' event indicates that one or more breakpoints
  19647. have been hit, and has the following attributes:
  19648. -- Variable: BreakpointEvent.breakpoints
  19649. A sequence containing references to all the breakpoints (type
  19650. 'gdb.Breakpoint') that were hit. *Note Breakpoints In
  19651. Python::, for details of the 'gdb.Breakpoint' object.
  19652. -- Variable: BreakpointEvent.breakpoint
  19653. A reference to the first breakpoint that was hit. This
  19654. function is maintained for backward compatibility and is now
  19655. deprecated in favor of the 'gdb.BreakpointEvent.breakpoints'
  19656. attribute.
  19657. 'events.new_objfile'
  19658. Emits 'gdb.NewObjFileEvent' which indicates that a new object file
  19659. has been loaded by GDB. 'gdb.NewObjFileEvent' has one attribute:
  19660. -- Variable: NewObjFileEvent.new_objfile
  19661. A reference to the object file ('gdb.Objfile') which has been
  19662. loaded. *Note Objfiles In Python::, for details of the
  19663. 'gdb.Objfile' object.
  19664. 'events.clear_objfiles'
  19665. Emits 'gdb.ClearObjFilesEvent' which indicates that the list of
  19666. object files for a program space has been reset.
  19667. 'gdb.ClearObjFilesEvent' has one attribute:
  19668. -- Variable: ClearObjFilesEvent.progspace
  19669. A reference to the program space ('gdb.Progspace') whose
  19670. objfile list has been cleared. *Note Progspaces In Python::.
  19671. 'events.inferior_call'
  19672. Emits events just before and after a function in the inferior is
  19673. called by GDB. Before an inferior call, this emits an event of
  19674. type 'gdb.InferiorCallPreEvent', and after an inferior call, this
  19675. emits an event of type 'gdb.InferiorCallPostEvent'.
  19676. 'gdb.InferiorCallPreEvent'
  19677. Indicates that a function in the inferior is about to be
  19678. called.
  19679. -- Variable: InferiorCallPreEvent.ptid
  19680. The thread in which the call will be run.
  19681. -- Variable: InferiorCallPreEvent.address
  19682. The location of the function to be called.
  19683. 'gdb.InferiorCallPostEvent'
  19684. Indicates that a function in the inferior has just been
  19685. called.
  19686. -- Variable: InferiorCallPostEvent.ptid
  19687. The thread in which the call was run.
  19688. -- Variable: InferiorCallPostEvent.address
  19689. The location of the function that was called.
  19690. 'events.memory_changed'
  19691. Emits 'gdb.MemoryChangedEvent' which indicates that the memory of
  19692. the inferior has been modified by the GDB user, for instance via a
  19693. command like 'set *addr = value'. The event has the following
  19694. attributes:
  19695. -- Variable: MemoryChangedEvent.address
  19696. The start address of the changed region.
  19697. -- Variable: MemoryChangedEvent.length
  19698. Length in bytes of the changed region.
  19699. 'events.register_changed'
  19700. Emits 'gdb.RegisterChangedEvent' which indicates that a register in
  19701. the inferior has been modified by the GDB user.
  19702. -- Variable: RegisterChangedEvent.frame
  19703. A gdb.Frame object representing the frame in which the
  19704. register was modified.
  19705. -- Variable: RegisterChangedEvent.regnum
  19706. Denotes which register was modified.
  19707. 'events.breakpoint_created'
  19708. This is emitted when a new breakpoint has been created. The
  19709. argument that is passed is the new 'gdb.Breakpoint' object.
  19710. 'events.breakpoint_modified'
  19711. This is emitted when a breakpoint has been modified in some way.
  19712. The argument that is passed is the new 'gdb.Breakpoint' object.
  19713. 'events.breakpoint_deleted'
  19714. This is emitted when a breakpoint has been deleted. The argument
  19715. that is passed is the 'gdb.Breakpoint' object. When this event is
  19716. emitted, the 'gdb.Breakpoint' object will already be in its invalid
  19717. state; that is, the 'is_valid' method will return 'False'.
  19718. 'events.before_prompt'
  19719. This event carries no payload. It is emitted each time GDB
  19720. presents a prompt to the user.
  19721. 'events.new_inferior'
  19722. This is emitted when a new inferior is created. Note that the
  19723. inferior is not necessarily running; in fact, it may not even have
  19724. an associated executable.
  19725. The event is of type 'gdb.NewInferiorEvent'. This has a single
  19726. attribute:
  19727. -- Variable: NewInferiorEvent.inferior
  19728. The new inferior, a 'gdb.Inferior' object.
  19729. 'events.inferior_deleted'
  19730. This is emitted when an inferior has been deleted. Note that this
  19731. is not the same as process exit; it is notified when the inferior
  19732. itself is removed, say via 'remove-inferiors'.
  19733. The event is of type 'gdb.InferiorDeletedEvent'. This has a single
  19734. attribute:
  19735. -- Variable: NewInferiorEvent.inferior
  19736. The inferior that is being removed, a 'gdb.Inferior' object.
  19737. 'events.new_thread'
  19738. This is emitted when GDB notices a new thread. The event is of
  19739. type 'gdb.NewThreadEvent', which extends 'gdb.ThreadEvent'. This
  19740. has a single attribute:
  19741. -- Variable: NewThreadEvent.inferior_thread
  19742. The new thread.
  19743. 
  19744. File: gdb.info, Node: Threads In Python, Next: Recordings In Python, Prev: Events In Python, Up: Python API
  19745. 23.2.2.18 Threads In Python
  19746. ...........................
  19747. Python scripts can access information about, and manipulate inferior
  19748. threads controlled by GDB, via objects of the 'gdb.InferiorThread'
  19749. class.
  19750. The following thread-related functions are available in the 'gdb'
  19751. module:
  19752. -- Function: gdb.selected_thread ()
  19753. This function returns the thread object for the selected thread.
  19754. If there is no selected thread, this will return 'None'.
  19755. A 'gdb.InferiorThread' object has the following attributes:
  19756. -- Variable: InferiorThread.name
  19757. The name of the thread. If the user specified a name using 'thread
  19758. name', then this returns that name. Otherwise, if an OS-supplied
  19759. name is available, then it is returned. Otherwise, this returns
  19760. 'None'.
  19761. This attribute can be assigned to. The new value must be a string
  19762. object, which sets the new name, or 'None', which removes any
  19763. user-specified thread name.
  19764. -- Variable: InferiorThread.num
  19765. The per-inferior number of the thread, as assigned by GDB.
  19766. -- Variable: InferiorThread.global_num
  19767. The global ID of the thread, as assigned by GDB. You can use this
  19768. to make Python breakpoints thread-specific, for example (*note The
  19769. Breakpoint.thread attribute: python_breakpoint_thread.).
  19770. -- Variable: InferiorThread.ptid
  19771. ID of the thread, as assigned by the operating system. This
  19772. attribute is a tuple containing three integers. The first is the
  19773. Process ID (PID); the second is the Lightweight Process ID (LWPID),
  19774. and the third is the Thread ID (TID). Either the LWPID or TID may
  19775. be 0, which indicates that the operating system does not use that
  19776. identifier.
  19777. -- Variable: InferiorThread.inferior
  19778. The inferior this thread belongs to. This attribute is represented
  19779. as a 'gdb.Inferior' object. This attribute is not writable.
  19780. A 'gdb.InferiorThread' object has the following methods:
  19781. -- Function: InferiorThread.is_valid ()
  19782. Returns 'True' if the 'gdb.InferiorThread' object is valid, 'False'
  19783. if not. A 'gdb.InferiorThread' object will become invalid if the
  19784. thread exits, or the inferior that the thread belongs is deleted.
  19785. All other 'gdb.InferiorThread' methods will throw an exception if
  19786. it is invalid at the time the method is called.
  19787. -- Function: InferiorThread.switch ()
  19788. This changes GDB's currently selected thread to the one represented
  19789. by this object.
  19790. -- Function: InferiorThread.is_stopped ()
  19791. Return a Boolean indicating whether the thread is stopped.
  19792. -- Function: InferiorThread.is_running ()
  19793. Return a Boolean indicating whether the thread is running.
  19794. -- Function: InferiorThread.is_exited ()
  19795. Return a Boolean indicating whether the thread is exited.
  19796. 
  19797. File: gdb.info, Node: Recordings In Python, Next: Commands In Python, Prev: Threads In Python, Up: Python API
  19798. 23.2.2.19 Recordings In Python
  19799. ..............................
  19800. The following recordings-related functions (*note Process Record and
  19801. Replay::) are available in the 'gdb' module:
  19802. -- Function: gdb.start_recording ([method], [format])
  19803. Start a recording using the given METHOD and FORMAT. If no FORMAT
  19804. is given, the default format for the recording method is used. If
  19805. no METHOD is given, the default method will be used. Returns a
  19806. 'gdb.Record' object on success. Throw an exception on failure.
  19807. The following strings can be passed as METHOD:
  19808. * '"full"'
  19809. * '"btrace"': Possible values for FORMAT: '"pt"', '"bts"' or
  19810. leave out for default format.
  19811. -- Function: gdb.current_recording ()
  19812. Access a currently running recording. Return a 'gdb.Record' object
  19813. on success. Return 'None' if no recording is currently active.
  19814. -- Function: gdb.stop_recording ()
  19815. Stop the current recording. Throw an exception if no recording is
  19816. currently active. All record objects become invalid after this
  19817. call.
  19818. A 'gdb.Record' object has the following attributes:
  19819. -- Variable: Record.method
  19820. A string with the current recording method, e.g. 'full' or
  19821. 'btrace'.
  19822. -- Variable: Record.format
  19823. A string with the current recording format, e.g. 'bt', 'pts' or
  19824. 'None'.
  19825. -- Variable: Record.begin
  19826. A method specific instruction object representing the first
  19827. instruction in this recording.
  19828. -- Variable: Record.end
  19829. A method specific instruction object representing the current
  19830. instruction, that is not actually part of the recording.
  19831. -- Variable: Record.replay_position
  19832. The instruction representing the current replay position. If there
  19833. is no replay active, this will be 'None'.
  19834. -- Variable: Record.instruction_history
  19835. A list with all recorded instructions.
  19836. -- Variable: Record.function_call_history
  19837. A list with all recorded function call segments.
  19838. A 'gdb.Record' object has the following methods:
  19839. -- Function: Record.goto (instruction)
  19840. Move the replay position to the given INSTRUCTION.
  19841. The common 'gdb.Instruction' class that recording method specific
  19842. instruction objects inherit from, has the following attributes:
  19843. -- Variable: Instruction.pc
  19844. An integer representing this instruction's address.
  19845. -- Variable: Instruction.data
  19846. A buffer with the raw instruction data. In Python 3, the return
  19847. value is a 'memoryview' object.
  19848. -- Variable: Instruction.decoded
  19849. A human readable string with the disassembled instruction.
  19850. -- Variable: Instruction.size
  19851. The size of the instruction in bytes.
  19852. Additionally 'gdb.RecordInstruction' has the following attributes:
  19853. -- Variable: RecordInstruction.number
  19854. An integer identifying this instruction. 'number' corresponds to
  19855. the numbers seen in 'record instruction-history' (*note Process
  19856. Record and Replay::).
  19857. -- Variable: RecordInstruction.sal
  19858. A 'gdb.Symtab_and_line' object representing the associated symtab
  19859. and line of this instruction. May be 'None' if no debug
  19860. information is available.
  19861. -- Variable: RecordInstruction.is_speculative
  19862. A boolean indicating whether the instruction was executed
  19863. speculatively.
  19864. If an error occured during recording or decoding a recording, this
  19865. error is represented by a 'gdb.RecordGap' object in the instruction
  19866. list. It has the following attributes:
  19867. -- Variable: RecordGap.number
  19868. An integer identifying this gap. 'number' corresponds to the
  19869. numbers seen in 'record instruction-history' (*note Process Record
  19870. and Replay::).
  19871. -- Variable: RecordGap.error_code
  19872. A numerical representation of the reason for the gap. The value is
  19873. specific to the current recording method.
  19874. -- Variable: RecordGap.error_string
  19875. A human readable string with the reason for the gap.
  19876. A 'gdb.RecordFunctionSegment' object has the following attributes:
  19877. -- Variable: RecordFunctionSegment.number
  19878. An integer identifying this function segment. 'number' corresponds
  19879. to the numbers seen in 'record function-call-history' (*note
  19880. Process Record and Replay::).
  19881. -- Variable: RecordFunctionSegment.symbol
  19882. A 'gdb.Symbol' object representing the associated symbol. May be
  19883. 'None' if no debug information is available.
  19884. -- Variable: RecordFunctionSegment.level
  19885. An integer representing the function call's stack level. May be
  19886. 'None' if the function call is a gap.
  19887. -- Variable: RecordFunctionSegment.instructions
  19888. A list of 'gdb.RecordInstruction' or 'gdb.RecordGap' objects
  19889. associated with this function call.
  19890. -- Variable: RecordFunctionSegment.up
  19891. A 'gdb.RecordFunctionSegment' object representing the caller's
  19892. function segment. If the call has not been recorded, this will be
  19893. the function segment to which control returns. If neither the call
  19894. nor the return have been recorded, this will be 'None'.
  19895. -- Variable: RecordFunctionSegment.prev
  19896. A 'gdb.RecordFunctionSegment' object representing the previous
  19897. segment of this function call. May be 'None'.
  19898. -- Variable: RecordFunctionSegment.next
  19899. A 'gdb.RecordFunctionSegment' object representing the next segment
  19900. of this function call. May be 'None'.
  19901. The following example demonstrates the usage of these objects and
  19902. functions to create a function that will rewind a record to the last
  19903. time a function in a different file was executed. This would typically
  19904. be used to track the execution of user provided callback functions in a
  19905. library which typically are not visible in a back trace.
  19906. def bringback ():
  19907. rec = gdb.current_recording ()
  19908. if not rec:
  19909. return
  19910. insn = rec.instruction_history
  19911. if len (insn) == 0:
  19912. return
  19913. try:
  19914. position = insn.index (rec.replay_position)
  19915. except:
  19916. position = -1
  19917. try:
  19918. filename = insn[position].sal.symtab.fullname ()
  19919. except:
  19920. filename = None
  19921. for i in reversed (insn[:position]):
  19922. try:
  19923. current = i.sal.symtab.fullname ()
  19924. except:
  19925. current = None
  19926. if filename == current:
  19927. continue
  19928. rec.goto (i)
  19929. return
  19930. Another possible application is to write a function that counts the
  19931. number of code executions in a given line range. This line range can
  19932. contain parts of functions or span across several functions and is not
  19933. limited to be contiguous.
  19934. def countrange (filename, linerange):
  19935. count = 0
  19936. def filter_only (file_name):
  19937. for call in gdb.current_recording ().function_call_history:
  19938. try:
  19939. if file_name in call.symbol.symtab.fullname ():
  19940. yield call
  19941. except:
  19942. pass
  19943. for c in filter_only (filename):
  19944. for i in c.instructions:
  19945. try:
  19946. if i.sal.line in linerange:
  19947. count += 1
  19948. break;
  19949. except:
  19950. pass
  19951. return count
  19952. 
  19953. File: gdb.info, Node: Commands In Python, Next: Parameters In Python, Prev: Recordings In Python, Up: Python API
  19954. 23.2.2.20 Commands In Python
  19955. ............................
  19956. You can implement new GDB CLI commands in Python. A CLI command is
  19957. implemented using an instance of the 'gdb.Command' class, most commonly
  19958. using a subclass.
  19959. -- Function: Command.__init__ (name, COMMAND_CLASS [, COMPLETER_CLASS
  19960. [, PREFIX]])
  19961. The object initializer for 'Command' registers the new command with
  19962. GDB. This initializer is normally invoked from the subclass' own
  19963. '__init__' method.
  19964. NAME is the name of the command. If NAME consists of multiple
  19965. words, then the initial words are looked for as prefix commands.
  19966. In this case, if one of the prefix commands does not exist, an
  19967. exception is raised.
  19968. There is no support for multi-line commands.
  19969. COMMAND_CLASS should be one of the 'COMMAND_' constants defined
  19970. below. This argument tells GDB how to categorize the new command
  19971. in the help system.
  19972. COMPLETER_CLASS is an optional argument. If given, it should be
  19973. one of the 'COMPLETE_' constants defined below. This argument
  19974. tells GDB how to perform completion for this command. If not
  19975. given, GDB will attempt to complete using the object's 'complete'
  19976. method (see below); if no such method is found, an error will occur
  19977. when completion is attempted.
  19978. PREFIX is an optional argument. If 'True', then the new command is
  19979. a prefix command; sub-commands of this command may be registered.
  19980. The help text for the new command is taken from the Python
  19981. documentation string for the command's class, if there is one. If
  19982. no documentation string is provided, the default value "This
  19983. command is not documented." is used.
  19984. -- Function: Command.dont_repeat ()
  19985. By default, a GDB command is repeated when the user enters a blank
  19986. line at the command prompt. A command can suppress this behavior
  19987. by invoking the 'dont_repeat' method. This is similar to the user
  19988. command 'dont-repeat', see *note dont-repeat: Define.
  19989. -- Function: Command.invoke (argument, from_tty)
  19990. This method is called by GDB when this command is invoked.
  19991. ARGUMENT is a string. It is the argument to the command, after
  19992. leading and trailing whitespace has been stripped.
  19993. FROM_TTY is a boolean argument. When true, this means that the
  19994. command was entered by the user at the terminal; when false it
  19995. means that the command came from elsewhere.
  19996. If this method throws an exception, it is turned into a GDB 'error'
  19997. call. Otherwise, the return value is ignored.
  19998. To break ARGUMENT up into an argv-like string use
  19999. 'gdb.string_to_argv'. This function behaves identically to GDB's
  20000. internal argument lexer 'buildargv'. It is recommended to use this
  20001. for consistency. Arguments are separated by spaces and may be
  20002. quoted. Example:
  20003. print gdb.string_to_argv ("1 2\ \\\"3 '4 \"5' \"6 '7\"")
  20004. ['1', '2 "3', '4 "5', "6 '7"]
  20005. -- Function: Command.complete (text, word)
  20006. This method is called by GDB when the user attempts completion on
  20007. this command. All forms of completion are handled by this method,
  20008. that is, the <TAB> and <M-?> key bindings (*note Completion::), and
  20009. the 'complete' command (*note complete: Help.).
  20010. The arguments TEXT and WORD are both strings; TEXT holds the
  20011. complete command line up to the cursor's location, while WORD holds
  20012. the last word of the command line; this is computed using a
  20013. word-breaking heuristic.
  20014. The 'complete' method can return several values:
  20015. * If the return value is a sequence, the contents of the
  20016. sequence are used as the completions. It is up to 'complete'
  20017. to ensure that the contents actually do complete the word. A
  20018. zero-length sequence is allowed, it means that there were no
  20019. completions available. Only string elements of the sequence
  20020. are used; other elements in the sequence are ignored.
  20021. * If the return value is one of the 'COMPLETE_' constants
  20022. defined below, then the corresponding GDB-internal completion
  20023. function is invoked, and its result is used.
  20024. * All other results are treated as though there were no
  20025. available completions.
  20026. When a new command is registered, it must be declared as a member of
  20027. some general class of commands. This is used to classify top-level
  20028. commands in the on-line help system; note that prefix commands are not
  20029. listed under their own category but rather that of their top-level
  20030. command. The available classifications are represented by constants
  20031. defined in the 'gdb' module:
  20032. 'gdb.COMMAND_NONE'
  20033. The command does not belong to any particular class. A command in
  20034. this category will not be displayed in any of the help categories.
  20035. 'gdb.COMMAND_RUNNING'
  20036. The command is related to running the inferior. For example,
  20037. 'start', 'step', and 'continue' are in this category. Type 'help
  20038. running' at the GDB prompt to see a list of commands in this
  20039. category.
  20040. 'gdb.COMMAND_DATA'
  20041. The command is related to data or variables. For example, 'call',
  20042. 'find', and 'print' are in this category. Type 'help data' at the
  20043. GDB prompt to see a list of commands in this category.
  20044. 'gdb.COMMAND_STACK'
  20045. The command has to do with manipulation of the stack. For example,
  20046. 'backtrace', 'frame', and 'return' are in this category. Type
  20047. 'help stack' at the GDB prompt to see a list of commands in this
  20048. category.
  20049. 'gdb.COMMAND_FILES'
  20050. This class is used for file-related commands. For example, 'file',
  20051. 'list' and 'section' are in this category. Type 'help files' at
  20052. the GDB prompt to see a list of commands in this category.
  20053. 'gdb.COMMAND_SUPPORT'
  20054. This should be used for "support facilities", generally meaning
  20055. things that are useful to the user when interacting with GDB, but
  20056. not related to the state of the inferior. For example, 'help',
  20057. 'make', and 'shell' are in this category. Type 'help support' at
  20058. the GDB prompt to see a list of commands in this category.
  20059. 'gdb.COMMAND_STATUS'
  20060. The command is an 'info'-related command, that is, related to the
  20061. state of GDB itself. For example, 'info', 'macro', and 'show' are
  20062. in this category. Type 'help status' at the GDB prompt to see a
  20063. list of commands in this category.
  20064. 'gdb.COMMAND_BREAKPOINTS'
  20065. The command has to do with breakpoints. For example, 'break',
  20066. 'clear', and 'delete' are in this category. Type 'help
  20067. breakpoints' at the GDB prompt to see a list of commands in this
  20068. category.
  20069. 'gdb.COMMAND_TRACEPOINTS'
  20070. The command has to do with tracepoints. For example, 'trace',
  20071. 'actions', and 'tfind' are in this category. Type 'help
  20072. tracepoints' at the GDB prompt to see a list of commands in this
  20073. category.
  20074. 'gdb.COMMAND_USER'
  20075. The command is a general purpose command for the user, and
  20076. typically does not fit in one of the other categories. Type 'help
  20077. user-defined' at the GDB prompt to see a list of commands in this
  20078. category, as well as the list of gdb macros (*note Sequences::).
  20079. 'gdb.COMMAND_OBSCURE'
  20080. The command is only used in unusual circumstances, or is not of
  20081. general interest to users. For example, 'checkpoint', 'fork', and
  20082. 'stop' are in this category. Type 'help obscure' at the GDB prompt
  20083. to see a list of commands in this category.
  20084. 'gdb.COMMAND_MAINTENANCE'
  20085. The command is only useful to GDB maintainers. The 'maintenance'
  20086. and 'flushregs' commands are in this category. Type 'help
  20087. internals' at the GDB prompt to see a list of commands in this
  20088. category.
  20089. A new command can use a predefined completion function, either by
  20090. specifying it via an argument at initialization, or by returning it from
  20091. the 'complete' method. These predefined completion constants are all
  20092. defined in the 'gdb' module:
  20093. 'gdb.COMPLETE_NONE'
  20094. This constant means that no completion should be done.
  20095. 'gdb.COMPLETE_FILENAME'
  20096. This constant means that filename completion should be performed.
  20097. 'gdb.COMPLETE_LOCATION'
  20098. This constant means that location completion should be done. *Note
  20099. Specify Location::.
  20100. 'gdb.COMPLETE_COMMAND'
  20101. This constant means that completion should examine GDB command
  20102. names.
  20103. 'gdb.COMPLETE_SYMBOL'
  20104. This constant means that completion should be done using symbol
  20105. names as the source.
  20106. 'gdb.COMPLETE_EXPRESSION'
  20107. This constant means that completion should be done on expressions.
  20108. Often this means completing on symbol names, but some language
  20109. parsers also have support for completing on field names.
  20110. The following code snippet shows how a trivial CLI command can be
  20111. implemented in Python:
  20112. class HelloWorld (gdb.Command):
  20113. """Greet the whole world."""
  20114. def __init__ (self):
  20115. super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
  20116. def invoke (self, arg, from_tty):
  20117. print "Hello, World!"
  20118. HelloWorld ()
  20119. The last line instantiates the class, and is necessary to trigger the
  20120. registration of the command with GDB. Depending on how the Python code
  20121. is read into GDB, you may need to import the 'gdb' module explicitly.
  20122. 
  20123. File: gdb.info, Node: Parameters In Python, Next: Functions In Python, Prev: Commands In Python, Up: Python API
  20124. 23.2.2.21 Parameters In Python
  20125. ..............................
  20126. You can implement new GDB parameters using Python. A new parameter is
  20127. implemented as an instance of the 'gdb.Parameter' class.
  20128. Parameters are exposed to the user via the 'set' and 'show' commands.
  20129. *Note Help::.
  20130. There are many parameters that already exist and can be set in GDB.
  20131. Two examples are: 'set follow fork' and 'set charset'. Setting these
  20132. parameters influences certain behavior in GDB. Similarly, you can
  20133. define parameters that can be used to influence behavior in custom
  20134. Python scripts and commands.
  20135. -- Function: Parameter.__init__ (name, COMMAND-CLASS, PARAMETER-CLASS
  20136. [, ENUM-SEQUENCE])
  20137. The object initializer for 'Parameter' registers the new parameter
  20138. with GDB. This initializer is normally invoked from the subclass'
  20139. own '__init__' method.
  20140. NAME is the name of the new parameter. If NAME consists of
  20141. multiple words, then the initial words are looked for as prefix
  20142. parameters. An example of this can be illustrated with the 'set
  20143. print' set of parameters. If NAME is 'print foo', then 'print'
  20144. will be searched as the prefix parameter. In this case the
  20145. parameter can subsequently be accessed in GDB as 'set print foo'.
  20146. If NAME consists of multiple words, and no prefix parameter group
  20147. can be found, an exception is raised.
  20148. COMMAND-CLASS should be one of the 'COMMAND_' constants (*note
  20149. Commands In Python::). This argument tells GDB how to categorize
  20150. the new parameter in the help system.
  20151. PARAMETER-CLASS should be one of the 'PARAM_' constants defined
  20152. below. This argument tells GDB the type of the new parameter; this
  20153. information is used for input validation and completion.
  20154. If PARAMETER-CLASS is 'PARAM_ENUM', then ENUM-SEQUENCE must be a
  20155. sequence of strings. These strings represent the possible values
  20156. for the parameter.
  20157. If PARAMETER-CLASS is not 'PARAM_ENUM', then the presence of a
  20158. fourth argument will cause an exception to be thrown.
  20159. The help text for the new parameter is taken from the Python
  20160. documentation string for the parameter's class, if there is one.
  20161. If there is no documentation string, a default value is used.
  20162. -- Variable: Parameter.set_doc
  20163. If this attribute exists, and is a string, then its value is used
  20164. as the help text for this parameter's 'set' command. The value is
  20165. examined when 'Parameter.__init__' is invoked; subsequent changes
  20166. have no effect.
  20167. -- Variable: Parameter.show_doc
  20168. If this attribute exists, and is a string, then its value is used
  20169. as the help text for this parameter's 'show' command. The value is
  20170. examined when 'Parameter.__init__' is invoked; subsequent changes
  20171. have no effect.
  20172. -- Variable: Parameter.value
  20173. The 'value' attribute holds the underlying value of the parameter.
  20174. It can be read and assigned to just as any other attribute. GDB
  20175. does validation when assignments are made.
  20176. There are two methods that may be implemented in any 'Parameter'
  20177. class. These are:
  20178. -- Function: Parameter.get_set_string (self)
  20179. If this method exists, GDB will call it when a PARAMETER's value
  20180. has been changed via the 'set' API (for example, 'set foo off').
  20181. The 'value' attribute has already been populated with the new value
  20182. and may be used in output. This method must return a string. If
  20183. the returned string is not empty, GDB will present it to the user.
  20184. If this method raises the 'gdb.GdbError' exception (*note Exception
  20185. Handling::), then GDB will print the exception's string and the
  20186. 'set' command will fail. Note, however, that the 'value' attribute
  20187. will not be reset in this case. So, if your parameter must
  20188. validate values, it should store the old value internally and reset
  20189. the exposed value, like so:
  20190. class ExampleParam (gdb.Parameter):
  20191. def __init__ (self, name):
  20192. super (ExampleParam, self).__init__ (name,
  20193. gdb.COMMAND_DATA,
  20194. gdb.PARAM_BOOLEAN)
  20195. self.value = True
  20196. self.saved_value = True
  20197. def validate(self):
  20198. return False
  20199. def get_set_string (self):
  20200. if not self.validate():
  20201. self.value = self.saved_value
  20202. raise gdb.GdbError('Failed to validate')
  20203. self.saved_value = self.value
  20204. -- Function: Parameter.get_show_string (self, svalue)
  20205. GDB will call this method when a PARAMETER's 'show' API has been
  20206. invoked (for example, 'show foo'). The argument 'svalue' receives
  20207. the string representation of the current value. This method must
  20208. return a string.
  20209. When a new parameter is defined, its type must be specified. The
  20210. available types are represented by constants defined in the 'gdb'
  20211. module:
  20212. 'gdb.PARAM_BOOLEAN'
  20213. The value is a plain boolean. The Python boolean values, 'True'
  20214. and 'False' are the only valid values.
  20215. 'gdb.PARAM_AUTO_BOOLEAN'
  20216. The value has three possible states: true, false, and 'auto'. In
  20217. Python, true and false are represented using boolean constants, and
  20218. 'auto' is represented using 'None'.
  20219. 'gdb.PARAM_UINTEGER'
  20220. The value is an unsigned integer. The value of 0 should be
  20221. interpreted to mean "unlimited".
  20222. 'gdb.PARAM_INTEGER'
  20223. The value is a signed integer. The value of 0 should be
  20224. interpreted to mean "unlimited".
  20225. 'gdb.PARAM_STRING'
  20226. The value is a string. When the user modifies the string, any
  20227. escape sequences, such as '\t', '\f', and octal escapes, are
  20228. translated into corresponding characters and encoded into the
  20229. current host charset.
  20230. 'gdb.PARAM_STRING_NOESCAPE'
  20231. The value is a string. When the user modifies the string, escapes
  20232. are passed through untranslated.
  20233. 'gdb.PARAM_OPTIONAL_FILENAME'
  20234. The value is a either a filename (a string), or 'None'.
  20235. 'gdb.PARAM_FILENAME'
  20236. The value is a filename. This is just like
  20237. 'PARAM_STRING_NOESCAPE', but uses file names for completion.
  20238. 'gdb.PARAM_ZINTEGER'
  20239. The value is an integer. This is like 'PARAM_INTEGER', except 0 is
  20240. interpreted as itself.
  20241. 'gdb.PARAM_ZUINTEGER'
  20242. The value is an unsigned integer. This is like 'PARAM_INTEGER',
  20243. except 0 is interpreted as itself, and the value cannot be
  20244. negative.
  20245. 'gdb.PARAM_ZUINTEGER_UNLIMITED'
  20246. The value is a signed integer. This is like 'PARAM_ZUINTEGER',
  20247. except the special value -1 should be interpreted to mean
  20248. "unlimited". Other negative values are not allowed.
  20249. 'gdb.PARAM_ENUM'
  20250. The value is a string, which must be one of a collection string
  20251. constants provided when the parameter is created.
  20252. 
  20253. File: gdb.info, Node: Functions In Python, Next: Progspaces In Python, Prev: Parameters In Python, Up: Python API
  20254. 23.2.2.22 Writing new convenience functions
  20255. ...........................................
  20256. You can implement new convenience functions (*note Convenience Vars::)
  20257. in Python. A convenience function is an instance of a subclass of the
  20258. class 'gdb.Function'.
  20259. -- Function: Function.__init__ (name)
  20260. The initializer for 'Function' registers the new function with GDB.
  20261. The argument NAME is the name of the function, a string. The
  20262. function will be visible to the user as a convenience variable of
  20263. type 'internal function', whose name is the same as the given NAME.
  20264. The documentation for the new function is taken from the
  20265. documentation string for the new class.
  20266. -- Function: Function.invoke (*ARGS)
  20267. When a convenience function is evaluated, its arguments are
  20268. converted to instances of 'gdb.Value', and then the function's
  20269. 'invoke' method is called. Note that GDB does not predetermine the
  20270. arity of convenience functions. Instead, all available arguments
  20271. are passed to 'invoke', following the standard Python calling
  20272. convention. In particular, a convenience function can have default
  20273. values for parameters without ill effect.
  20274. The return value of this method is used as its value in the
  20275. enclosing expression. If an ordinary Python value is returned, it
  20276. is converted to a 'gdb.Value' following the usual rules.
  20277. The following code snippet shows how a trivial convenience function
  20278. can be implemented in Python:
  20279. class Greet (gdb.Function):
  20280. """Return string to greet someone.
  20281. Takes a name as argument."""
  20282. def __init__ (self):
  20283. super (Greet, self).__init__ ("greet")
  20284. def invoke (self, name):
  20285. return "Hello, %s!" % name.string ()
  20286. Greet ()
  20287. The last line instantiates the class, and is necessary to trigger the
  20288. registration of the function with GDB. Depending on how the Python code
  20289. is read into GDB, you may need to import the 'gdb' module explicitly.
  20290. Now you can use the function in an expression:
  20291. (gdb) print $greet("Bob")
  20292. $1 = "Hello, Bob!"
  20293. 
  20294. File: gdb.info, Node: Progspaces In Python, Next: Objfiles In Python, Prev: Functions In Python, Up: Python API
  20295. 23.2.2.23 Program Spaces In Python
  20296. ..................................
  20297. A program space, or "progspace", represents a symbolic view of an
  20298. address space. It consists of all of the objfiles of the program.
  20299. *Note Objfiles In Python::. *Note program spaces: Inferiors and
  20300. Programs, for more details about program spaces.
  20301. The following progspace-related functions are available in the 'gdb'
  20302. module:
  20303. -- Function: gdb.current_progspace ()
  20304. This function returns the program space of the currently selected
  20305. inferior. *Note Inferiors and Programs::. This is identical to
  20306. 'gdb.selected_inferior().progspace' (*note Inferiors In Python::)
  20307. and is included for historical compatibility.
  20308. -- Function: gdb.progspaces ()
  20309. Return a sequence of all the progspaces currently known to GDB.
  20310. Each progspace is represented by an instance of the 'gdb.Progspace'
  20311. class.
  20312. -- Variable: Progspace.filename
  20313. The file name of the progspace as a string.
  20314. -- Variable: Progspace.pretty_printers
  20315. The 'pretty_printers' attribute is a list of functions. It is used
  20316. to look up pretty-printers. A 'Value' is passed to each function
  20317. in order; if the function returns 'None', then the search
  20318. continues. Otherwise, the return value should be an object which
  20319. is used to format the value. *Note Pretty Printing API::, for more
  20320. information.
  20321. -- Variable: Progspace.type_printers
  20322. The 'type_printers' attribute is a list of type printer objects.
  20323. *Note Type Printing API::, for more information.
  20324. -- Variable: Progspace.frame_filters
  20325. The 'frame_filters' attribute is a dictionary of frame filter
  20326. objects. *Note Frame Filter API::, for more information.
  20327. A program space has the following methods:
  20328. -- Function: Progspace.block_for_pc (pc)
  20329. Return the innermost 'gdb.Block' containing the given PC value. If
  20330. the block cannot be found for the PC value specified, the function
  20331. will return 'None'.
  20332. -- Function: Progspace.find_pc_line (pc)
  20333. Return the 'gdb.Symtab_and_line' object corresponding to the PC
  20334. value. *Note Symbol Tables In Python::. If an invalid value of PC
  20335. is passed as an argument, then the 'symtab' and 'line' attributes
  20336. of the returned 'gdb.Symtab_and_line' object will be 'None' and 0
  20337. respectively.
  20338. -- Function: Progspace.is_valid ()
  20339. Returns 'True' if the 'gdb.Progspace' object is valid, 'False' if
  20340. not. A 'gdb.Progspace' object can become invalid if the program
  20341. space file it refers to is not referenced by any inferior. All
  20342. other 'gdb.Progspace' methods will throw an exception if it is
  20343. invalid at the time the method is called.
  20344. -- Function: Progspace.objfiles ()
  20345. Return a sequence of all the objfiles referenced by this program
  20346. space. *Note Objfiles In Python::.
  20347. -- Function: Progspace.solib_name (address)
  20348. Return the name of the shared library holding the given ADDRESS as
  20349. a string, or 'None'.
  20350. One may add arbitrary attributes to 'gdb.Progspace' objects in the
  20351. usual Python way. This is useful if, for example, one needs to do some
  20352. extra record keeping associated with the program space.
  20353. In this contrived example, we want to perform some processing when an
  20354. objfile with a certain symbol is loaded, but we only want to do this
  20355. once because it is expensive. To achieve this we record the results
  20356. with the program space because we can't predict when the desired objfile
  20357. will be loaded.
  20358. (gdb) python
  20359. def clear_objfiles_handler(event):
  20360. event.progspace.expensive_computation = None
  20361. def expensive(symbol):
  20362. """A mock routine to perform an "expensive" computation on symbol."""
  20363. print "Computing the answer to the ultimate question ..."
  20364. return 42
  20365. def new_objfile_handler(event):
  20366. objfile = event.new_objfile
  20367. progspace = objfile.progspace
  20368. if not hasattr(progspace, 'expensive_computation') or \
  20369. progspace.expensive_computation is None:
  20370. # We use 'main' for the symbol to keep the example simple.
  20371. # Note: There's no current way to constrain the lookup
  20372. # to one objfile.
  20373. symbol = gdb.lookup_global_symbol('main')
  20374. if symbol is not None:
  20375. progspace.expensive_computation = expensive(symbol)
  20376. gdb.events.clear_objfiles.connect(clear_objfiles_handler)
  20377. gdb.events.new_objfile.connect(new_objfile_handler)
  20378. end
  20379. (gdb) file /tmp/hello
  20380. Reading symbols from /tmp/hello...done.
  20381. Computing the answer to the ultimate question ...
  20382. (gdb) python print gdb.current_progspace().expensive_computation
  20383. 42
  20384. (gdb) run
  20385. Starting program: /tmp/hello
  20386. Hello.
  20387. [Inferior 1 (process 4242) exited normally]
  20388. 
  20389. File: gdb.info, Node: Objfiles In Python, Next: Frames In Python, Prev: Progspaces In Python, Up: Python API
  20390. 23.2.2.24 Objfiles In Python
  20391. ............................
  20392. GDB loads symbols for an inferior from various symbol-containing files
  20393. (*note Files::). These include the primary executable file, any shared
  20394. libraries used by the inferior, and any separate debug info files (*note
  20395. Separate Debug Files::). GDB calls these symbol-containing files
  20396. "objfiles".
  20397. The following objfile-related functions are available in the 'gdb'
  20398. module:
  20399. -- Function: gdb.current_objfile ()
  20400. When auto-loading a Python script (*note Python Auto-loading::),
  20401. GDB sets the "current objfile" to the corresponding objfile. This
  20402. function returns the current objfile. If there is no current
  20403. objfile, this function returns 'None'.
  20404. -- Function: gdb.objfiles ()
  20405. Return a sequence of objfiles referenced by the current program
  20406. space. *Note Objfiles In Python::, and *note Progspaces In
  20407. Python::. This is identical to
  20408. 'gdb.selected_inferior().progspace.objfiles()' and is included for
  20409. historical compatibility.
  20410. -- Function: gdb.lookup_objfile (name [, by_build_id])
  20411. Look up NAME, a file name or build ID, in the list of objfiles for
  20412. the current program space (*note Progspaces In Python::). If the
  20413. objfile is not found throw the Python 'ValueError' exception.
  20414. If NAME is a relative file name, then it will match any source file
  20415. name with the same trailing components. For example, if NAME is
  20416. 'gcc/expr.c', then it will match source file name of
  20417. '/build/trunk/gcc/expr.c', but not '/build/trunk/libcpp/expr.c' or
  20418. '/build/trunk/gcc/x-expr.c'.
  20419. If BY_BUILD_ID is provided and is 'True' then NAME is the build ID
  20420. of the objfile. Otherwise, NAME is a file name. This is supported
  20421. only on some operating systems, notably those which use the ELF
  20422. format for binary files and the GNU Binutils. For more details
  20423. about this feature, see the description of the '--build-id'
  20424. command-line option in *note Command Line Options: (ld)Options.
  20425. Each objfile is represented by an instance of the 'gdb.Objfile'
  20426. class.
  20427. -- Variable: Objfile.filename
  20428. The file name of the objfile as a string, with symbolic links
  20429. resolved.
  20430. The value is 'None' if the objfile is no longer valid. See the
  20431. 'gdb.Objfile.is_valid' method, described below.
  20432. -- Variable: Objfile.username
  20433. The file name of the objfile as specified by the user as a string.
  20434. The value is 'None' if the objfile is no longer valid. See the
  20435. 'gdb.Objfile.is_valid' method, described below.
  20436. -- Variable: Objfile.owner
  20437. For separate debug info objfiles this is the corresponding
  20438. 'gdb.Objfile' object that debug info is being provided for.
  20439. Otherwise this is 'None'. Separate debug info objfiles are added
  20440. with the 'gdb.Objfile.add_separate_debug_file' method, described
  20441. below.
  20442. -- Variable: Objfile.build_id
  20443. The build ID of the objfile as a string. If the objfile does not
  20444. have a build ID then the value is 'None'.
  20445. This is supported only on some operating systems, notably those
  20446. which use the ELF format for binary files and the GNU Binutils.
  20447. For more details about this feature, see the description of the
  20448. '--build-id' command-line option in *note Command Line Options:
  20449. (ld)Options.
  20450. -- Variable: Objfile.progspace
  20451. The containing program space of the objfile as a 'gdb.Progspace'
  20452. object. *Note Progspaces In Python::.
  20453. -- Variable: Objfile.pretty_printers
  20454. The 'pretty_printers' attribute is a list of functions. It is used
  20455. to look up pretty-printers. A 'Value' is passed to each function
  20456. in order; if the function returns 'None', then the search
  20457. continues. Otherwise, the return value should be an object which
  20458. is used to format the value. *Note Pretty Printing API::, for more
  20459. information.
  20460. -- Variable: Objfile.type_printers
  20461. The 'type_printers' attribute is a list of type printer objects.
  20462. *Note Type Printing API::, for more information.
  20463. -- Variable: Objfile.frame_filters
  20464. The 'frame_filters' attribute is a dictionary of frame filter
  20465. objects. *Note Frame Filter API::, for more information.
  20466. One may add arbitrary attributes to 'gdb.Objfile' objects in the
  20467. usual Python way. This is useful if, for example, one needs to do some
  20468. extra record keeping associated with the objfile.
  20469. In this contrived example we record the time when GDB loaded the
  20470. objfile.
  20471. (gdb) python
  20472. import datetime
  20473. def new_objfile_handler(event):
  20474. # Set the time_loaded attribute of the new objfile.
  20475. event.new_objfile.time_loaded = datetime.datetime.today()
  20476. gdb.events.new_objfile.connect(new_objfile_handler)
  20477. end
  20478. (gdb) file ./hello
  20479. Reading symbols from ./hello...done.
  20480. (gdb) python print gdb.objfiles()[0].time_loaded
  20481. 2014-10-09 11:41:36.770345
  20482. A 'gdb.Objfile' object has the following methods:
  20483. -- Function: Objfile.is_valid ()
  20484. Returns 'True' if the 'gdb.Objfile' object is valid, 'False' if
  20485. not. A 'gdb.Objfile' object can become invalid if the object file
  20486. it refers to is not loaded in GDB any longer. All other
  20487. 'gdb.Objfile' methods will throw an exception if it is invalid at
  20488. the time the method is called.
  20489. -- Function: Objfile.add_separate_debug_file (file)
  20490. Add FILE to the list of files that GDB will search for debug
  20491. information for the objfile. This is useful when the debug info
  20492. has been removed from the program and stored in a separate file.
  20493. GDB has built-in support for finding separate debug info files
  20494. (*note Separate Debug Files::), but if the file doesn't live in one
  20495. of the standard places that GDB searches then this function can be
  20496. used to add a debug info file from a different place.
  20497. 
  20498. File: gdb.info, Node: Frames In Python, Next: Blocks In Python, Prev: Objfiles In Python, Up: Python API
  20499. 23.2.2.25 Accessing inferior stack frames from Python
  20500. .....................................................
  20501. When the debugged program stops, GDB is able to analyze its call stack
  20502. (*note Stack frames: Frames.). The 'gdb.Frame' class represents a frame
  20503. in the stack. A 'gdb.Frame' object is only valid while its
  20504. corresponding frame exists in the inferior's stack. If you try to use
  20505. an invalid frame object, GDB will throw a 'gdb.error' exception (*note
  20506. Exception Handling::).
  20507. Two 'gdb.Frame' objects can be compared for equality with the '=='
  20508. operator, like:
  20509. (gdb) python print gdb.newest_frame() == gdb.selected_frame ()
  20510. True
  20511. The following frame-related functions are available in the 'gdb'
  20512. module:
  20513. -- Function: gdb.selected_frame ()
  20514. Return the selected frame object. (*note Selecting a Frame:
  20515. Selection.).
  20516. -- Function: gdb.newest_frame ()
  20517. Return the newest frame object for the selected thread.
  20518. -- Function: gdb.frame_stop_reason_string (reason)
  20519. Return a string explaining the reason why GDB stopped unwinding
  20520. frames, as expressed by the given REASON code (an integer, see the
  20521. 'unwind_stop_reason' method further down in this section).
  20522. -- Function: gdb.invalidate_cached_frames
  20523. GDB internally keeps a cache of the frames that have been unwound.
  20524. This function invalidates this cache.
  20525. This function should not generally be called by ordinary Python
  20526. code. It is documented for the sake of completeness.
  20527. A 'gdb.Frame' object has the following methods:
  20528. -- Function: Frame.is_valid ()
  20529. Returns true if the 'gdb.Frame' object is valid, false if not. A
  20530. frame object can become invalid if the frame it refers to doesn't
  20531. exist anymore in the inferior. All 'gdb.Frame' methods will throw
  20532. an exception if it is invalid at the time the method is called.
  20533. -- Function: Frame.name ()
  20534. Returns the function name of the frame, or 'None' if it can't be
  20535. obtained.
  20536. -- Function: Frame.architecture ()
  20537. Returns the 'gdb.Architecture' object corresponding to the frame's
  20538. architecture. *Note Architectures In Python::.
  20539. -- Function: Frame.type ()
  20540. Returns the type of the frame. The value can be one of:
  20541. 'gdb.NORMAL_FRAME'
  20542. An ordinary stack frame.
  20543. 'gdb.DUMMY_FRAME'
  20544. A fake stack frame that was created by GDB when performing an
  20545. inferior function call.
  20546. 'gdb.INLINE_FRAME'
  20547. A frame representing an inlined function. The function was
  20548. inlined into a 'gdb.NORMAL_FRAME' that is older than this one.
  20549. 'gdb.TAILCALL_FRAME'
  20550. A frame representing a tail call. *Note Tail Call Frames::.
  20551. 'gdb.SIGTRAMP_FRAME'
  20552. A signal trampoline frame. This is the frame created by the
  20553. OS when it calls into a signal handler.
  20554. 'gdb.ARCH_FRAME'
  20555. A fake stack frame representing a cross-architecture call.
  20556. 'gdb.SENTINEL_FRAME'
  20557. This is like 'gdb.NORMAL_FRAME', but it is only used for the
  20558. newest frame.
  20559. -- Function: Frame.unwind_stop_reason ()
  20560. Return an integer representing the reason why it's not possible to
  20561. find more frames toward the outermost frame. Use
  20562. 'gdb.frame_stop_reason_string' to convert the value returned by
  20563. this function to a string. The value can be one of:
  20564. 'gdb.FRAME_UNWIND_NO_REASON'
  20565. No particular reason (older frames should be available).
  20566. 'gdb.FRAME_UNWIND_NULL_ID'
  20567. The previous frame's analyzer returns an invalid result. This
  20568. is no longer used by GDB, and is kept only for backward
  20569. compatibility.
  20570. 'gdb.FRAME_UNWIND_OUTERMOST'
  20571. This frame is the outermost.
  20572. 'gdb.FRAME_UNWIND_UNAVAILABLE'
  20573. Cannot unwind further, because that would require knowing the
  20574. values of registers or memory that have not been collected.
  20575. 'gdb.FRAME_UNWIND_INNER_ID'
  20576. This frame ID looks like it ought to belong to a NEXT frame,
  20577. but we got it for a PREV frame. Normally, this is a sign of
  20578. unwinder failure. It could also indicate stack corruption.
  20579. 'gdb.FRAME_UNWIND_SAME_ID'
  20580. This frame has the same ID as the previous one. That means
  20581. that unwinding further would almost certainly give us another
  20582. frame with exactly the same ID, so break the chain. Normally,
  20583. this is a sign of unwinder failure. It could also indicate
  20584. stack corruption.
  20585. 'gdb.FRAME_UNWIND_NO_SAVED_PC'
  20586. The frame unwinder did not find any saved PC, but we needed
  20587. one to unwind further.
  20588. 'gdb.FRAME_UNWIND_MEMORY_ERROR'
  20589. The frame unwinder caused an error while trying to access
  20590. memory.
  20591. 'gdb.FRAME_UNWIND_FIRST_ERROR'
  20592. Any stop reason greater or equal to this value indicates some
  20593. kind of error. This special value facilitates writing code
  20594. that tests for errors in unwinding in a way that will work
  20595. correctly even if the list of the other values is modified in
  20596. future GDB versions. Using it, you could write:
  20597. reason = gdb.selected_frame().unwind_stop_reason ()
  20598. reason_str = gdb.frame_stop_reason_string (reason)
  20599. if reason >= gdb.FRAME_UNWIND_FIRST_ERROR:
  20600. print "An error occured: %s" % reason_str
  20601. -- Function: Frame.pc ()
  20602. Returns the frame's resume address.
  20603. -- Function: Frame.block ()
  20604. Return the frame's code block. *Note Blocks In Python::. If the
  20605. frame does not have a block - for example, if there is no debugging
  20606. information for the code in question - then this will throw an
  20607. exception.
  20608. -- Function: Frame.function ()
  20609. Return the symbol for the function corresponding to this frame.
  20610. *Note Symbols In Python::.
  20611. -- Function: Frame.older ()
  20612. Return the frame that called this frame.
  20613. -- Function: Frame.newer ()
  20614. Return the frame called by this frame.
  20615. -- Function: Frame.find_sal ()
  20616. Return the frame's symtab and line object. *Note Symbol Tables In
  20617. Python::.
  20618. -- Function: Frame.read_register (register)
  20619. Return the value of REGISTER in this frame. The REGISTER argument
  20620. must be a string (e.g., ''sp'' or ''rax''). Returns a 'Gdb.Value'
  20621. object. Throws an exception if REGISTER does not exist.
  20622. -- Function: Frame.read_var (variable [, block])
  20623. Return the value of VARIABLE in this frame. If the optional
  20624. argument BLOCK is provided, search for the variable from that
  20625. block; otherwise start at the frame's current block (which is
  20626. determined by the frame's current program counter). The VARIABLE
  20627. argument must be a string or a 'gdb.Symbol' object; BLOCK must be a
  20628. 'gdb.Block' object.
  20629. -- Function: Frame.select ()
  20630. Set this frame to be the selected frame. *Note Examining the
  20631. Stack: Stack.
  20632. 
  20633. File: gdb.info, Node: Blocks In Python, Next: Symbols In Python, Prev: Frames In Python, Up: Python API
  20634. 23.2.2.26 Accessing blocks from Python
  20635. ......................................
  20636. In GDB, symbols are stored in blocks. A block corresponds roughly to a
  20637. scope in the source code. Blocks are organized hierarchically, and are
  20638. represented individually in Python as a 'gdb.Block'. Blocks rely on
  20639. debugging information being available.
  20640. A frame has a block. Please see *note Frames In Python::, for a more
  20641. in-depth discussion of frames.
  20642. The outermost block is known as the "global block". The global block
  20643. typically holds public global variables and functions.
  20644. The block nested just inside the global block is the "static block".
  20645. The static block typically holds file-scoped variables and functions.
  20646. GDB provides a method to get a block's superblock, but there is
  20647. currently no way to examine the sub-blocks of a block, or to iterate
  20648. over all the blocks in a symbol table (*note Symbol Tables In Python::).
  20649. Here is a short example that should help explain blocks:
  20650. /* This is in the global block. */
  20651. int global;
  20652. /* This is in the static block. */
  20653. static int file_scope;
  20654. /* 'function' is in the global block, and 'argument' is
  20655. in a block nested inside of 'function'. */
  20656. int function (int argument)
  20657. {
  20658. /* 'local' is in a block inside 'function'. It may or may
  20659. not be in the same block as 'argument'. */
  20660. int local;
  20661. {
  20662. /* 'inner' is in a block whose superblock is the one holding
  20663. 'local'. */
  20664. int inner;
  20665. /* If this call is expanded by the compiler, you may see
  20666. a nested block here whose function is 'inline_function'
  20667. and whose superblock is the one holding 'inner'. */
  20668. inline_function ();
  20669. }
  20670. }
  20671. A 'gdb.Block' is iterable. The iterator returns the symbols (*note
  20672. Symbols In Python::) local to the block. Python programs should not
  20673. assume that a specific block object will always contain a given symbol,
  20674. since changes in GDB features and infrastructure may cause symbols move
  20675. across blocks in a symbol table.
  20676. The following block-related functions are available in the 'gdb'
  20677. module:
  20678. -- Function: gdb.block_for_pc (pc)
  20679. Return the innermost 'gdb.Block' containing the given PC value. If
  20680. the block cannot be found for the PC value specified, the function
  20681. will return 'None'. This is identical to
  20682. 'gdb.current_progspace().block_for_pc(pc)' and is included for
  20683. historical compatibility.
  20684. A 'gdb.Block' object has the following methods:
  20685. -- Function: Block.is_valid ()
  20686. Returns 'True' if the 'gdb.Block' object is valid, 'False' if not.
  20687. A block object can become invalid if the block it refers to doesn't
  20688. exist anymore in the inferior. All other 'gdb.Block' methods will
  20689. throw an exception if it is invalid at the time the method is
  20690. called. The block's validity is also checked during iteration over
  20691. symbols of the block.
  20692. A 'gdb.Block' object has the following attributes:
  20693. -- Variable: Block.start
  20694. The start address of the block. This attribute is not writable.
  20695. -- Variable: Block.end
  20696. One past the last address that appears in the block. This
  20697. attribute is not writable.
  20698. -- Variable: Block.function
  20699. The name of the block represented as a 'gdb.Symbol'. If the block
  20700. is not named, then this attribute holds 'None'. This attribute is
  20701. not writable.
  20702. For ordinary function blocks, the superblock is the static block.
  20703. However, you should note that it is possible for a function block
  20704. to have a superblock that is not the static block - for instance
  20705. this happens for an inlined function.
  20706. -- Variable: Block.superblock
  20707. The block containing this block. If this parent block does not
  20708. exist, this attribute holds 'None'. This attribute is not
  20709. writable.
  20710. -- Variable: Block.global_block
  20711. The global block associated with this block. This attribute is not
  20712. writable.
  20713. -- Variable: Block.static_block
  20714. The static block associated with this block. This attribute is not
  20715. writable.
  20716. -- Variable: Block.is_global
  20717. 'True' if the 'gdb.Block' object is a global block, 'False' if not.
  20718. This attribute is not writable.
  20719. -- Variable: Block.is_static
  20720. 'True' if the 'gdb.Block' object is a static block, 'False' if not.
  20721. This attribute is not writable.
  20722. 
  20723. File: gdb.info, Node: Symbols In Python, Next: Symbol Tables In Python, Prev: Blocks In Python, Up: Python API
  20724. 23.2.2.27 Python representation of Symbols
  20725. ..........................................
  20726. GDB represents every variable, function and type as an entry in a symbol
  20727. table. *Note Examining the Symbol Table: Symbols. Similarly, Python
  20728. represents these symbols in GDB with the 'gdb.Symbol' object.
  20729. The following symbol-related functions are available in the 'gdb'
  20730. module:
  20731. -- Function: gdb.lookup_symbol (name [, block [, domain]])
  20732. This function searches for a symbol by name. The search scope can
  20733. be restricted to the parameters defined in the optional domain and
  20734. block arguments.
  20735. NAME is the name of the symbol. It must be a string. The optional
  20736. BLOCK argument restricts the search to symbols visible in that
  20737. BLOCK. The BLOCK argument must be a 'gdb.Block' object. If
  20738. omitted, the block for the current frame is used. The optional
  20739. DOMAIN argument restricts the search to the domain type. The
  20740. DOMAIN argument must be a domain constant defined in the 'gdb'
  20741. module and described later in this chapter.
  20742. The result is a tuple of two elements. The first element is a
  20743. 'gdb.Symbol' object or 'None' if the symbol is not found. If the
  20744. symbol is found, the second element is 'True' if the symbol is a
  20745. field of a method's object (e.g., 'this' in C++), otherwise it is
  20746. 'False'. If the symbol is not found, the second element is
  20747. 'False'.
  20748. -- Function: gdb.lookup_global_symbol (name [, domain])
  20749. This function searches for a global symbol by name. The search
  20750. scope can be restricted to by the domain argument.
  20751. NAME is the name of the symbol. It must be a string. The optional
  20752. DOMAIN argument restricts the search to the domain type. The
  20753. DOMAIN argument must be a domain constant defined in the 'gdb'
  20754. module and described later in this chapter.
  20755. The result is a 'gdb.Symbol' object or 'None' if the symbol is not
  20756. found.
  20757. A 'gdb.Symbol' object has the following attributes:
  20758. -- Variable: Symbol.type
  20759. The type of the symbol or 'None' if no type is recorded. This
  20760. attribute is represented as a 'gdb.Type' object. *Note Types In
  20761. Python::. This attribute is not writable.
  20762. -- Variable: Symbol.symtab
  20763. The symbol table in which the symbol appears. This attribute is
  20764. represented as a 'gdb.Symtab' object. *Note Symbol Tables In
  20765. Python::. This attribute is not writable.
  20766. -- Variable: Symbol.line
  20767. The line number in the source code at which the symbol was defined.
  20768. This is an integer.
  20769. -- Variable: Symbol.name
  20770. The name of the symbol as a string. This attribute is not
  20771. writable.
  20772. -- Variable: Symbol.linkage_name
  20773. The name of the symbol, as used by the linker (i.e., may be
  20774. mangled). This attribute is not writable.
  20775. -- Variable: Symbol.print_name
  20776. The name of the symbol in a form suitable for output. This is
  20777. either 'name' or 'linkage_name', depending on whether the user
  20778. asked GDB to display demangled or mangled names.
  20779. -- Variable: Symbol.addr_class
  20780. The address class of the symbol. This classifies how to find the
  20781. value of a symbol. Each address class is a constant defined in the
  20782. 'gdb' module and described later in this chapter.
  20783. -- Variable: Symbol.needs_frame
  20784. This is 'True' if evaluating this symbol's value requires a frame
  20785. (*note Frames In Python::) and 'False' otherwise. Typically, local
  20786. variables will require a frame, but other symbols will not.
  20787. -- Variable: Symbol.is_argument
  20788. 'True' if the symbol is an argument of a function.
  20789. -- Variable: Symbol.is_constant
  20790. 'True' if the symbol is a constant.
  20791. -- Variable: Symbol.is_function
  20792. 'True' if the symbol is a function or a method.
  20793. -- Variable: Symbol.is_variable
  20794. 'True' if the symbol is a variable.
  20795. A 'gdb.Symbol' object has the following methods:
  20796. -- Function: Symbol.is_valid ()
  20797. Returns 'True' if the 'gdb.Symbol' object is valid, 'False' if not.
  20798. A 'gdb.Symbol' object can become invalid if the symbol it refers to
  20799. does not exist in GDB any longer. All other 'gdb.Symbol' methods
  20800. will throw an exception if it is invalid at the time the method is
  20801. called.
  20802. -- Function: Symbol.value ([frame])
  20803. Compute the value of the symbol, as a 'gdb.Value'. For functions,
  20804. this computes the address of the function, cast to the appropriate
  20805. type. If the symbol requires a frame in order to compute its
  20806. value, then FRAME must be given. If FRAME is not given, or if
  20807. FRAME is invalid, then this method will throw an exception.
  20808. The available domain categories in 'gdb.Symbol' are represented as
  20809. constants in the 'gdb' module:
  20810. 'gdb.SYMBOL_UNDEF_DOMAIN'
  20811. This is used when a domain has not been discovered or none of the
  20812. following domains apply. This usually indicates an error either in
  20813. the symbol information or in GDB's handling of symbols.
  20814. 'gdb.SYMBOL_VAR_DOMAIN'
  20815. This domain contains variables, function names, typedef names and
  20816. enum type values.
  20817. 'gdb.SYMBOL_STRUCT_DOMAIN'
  20818. This domain holds struct, union and enum type names.
  20819. 'gdb.SYMBOL_LABEL_DOMAIN'
  20820. This domain contains names of labels (for gotos).
  20821. 'gdb.SYMBOL_MODULE_DOMAIN'
  20822. This domain contains names of Fortran module types.
  20823. 'gdb.SYMBOL_COMMON_BLOCK_DOMAIN'
  20824. This domain contains names of Fortran common blocks.
  20825. The available address class categories in 'gdb.Symbol' are
  20826. represented as constants in the 'gdb' module:
  20827. 'gdb.SYMBOL_LOC_UNDEF'
  20828. If this is returned by address class, it indicates an error either
  20829. in the symbol information or in GDB's handling of symbols.
  20830. 'gdb.SYMBOL_LOC_CONST'
  20831. Value is constant int.
  20832. 'gdb.SYMBOL_LOC_STATIC'
  20833. Value is at a fixed address.
  20834. 'gdb.SYMBOL_LOC_REGISTER'
  20835. Value is in a register.
  20836. 'gdb.SYMBOL_LOC_ARG'
  20837. Value is an argument. This value is at the offset stored within
  20838. the symbol inside the frame's argument list.
  20839. 'gdb.SYMBOL_LOC_REF_ARG'
  20840. Value address is stored in the frame's argument list. Just like
  20841. 'LOC_ARG' except that the value's address is stored at the offset,
  20842. not the value itself.
  20843. 'gdb.SYMBOL_LOC_REGPARM_ADDR'
  20844. Value is a specified register. Just like 'LOC_REGISTER' except the
  20845. register holds the address of the argument instead of the argument
  20846. itself.
  20847. 'gdb.SYMBOL_LOC_LOCAL'
  20848. Value is a local variable.
  20849. 'gdb.SYMBOL_LOC_TYPEDEF'
  20850. Value not used. Symbols in the domain 'SYMBOL_STRUCT_DOMAIN' all
  20851. have this class.
  20852. 'gdb.SYMBOL_LOC_BLOCK'
  20853. Value is a block.
  20854. 'gdb.SYMBOL_LOC_CONST_BYTES'
  20855. Value is a byte-sequence.
  20856. 'gdb.SYMBOL_LOC_UNRESOLVED'
  20857. Value is at a fixed address, but the address of the variable has to
  20858. be determined from the minimal symbol table whenever the variable
  20859. is referenced.
  20860. 'gdb.SYMBOL_LOC_OPTIMIZED_OUT'
  20861. The value does not actually exist in the program.
  20862. 'gdb.SYMBOL_LOC_COMPUTED'
  20863. The value's address is a computed location.
  20864. 'gdb.SYMBOL_LOC_COMPUTED'
  20865. The value's address is a symbol. This is only used for Fortran
  20866. common blocks.
  20867. 
  20868. File: gdb.info, Node: Symbol Tables In Python, Next: Line Tables In Python, Prev: Symbols In Python, Up: Python API
  20869. 23.2.2.28 Symbol table representation in Python
  20870. ...............................................
  20871. Access to symbol table data maintained by GDB on the inferior is exposed
  20872. to Python via two objects: 'gdb.Symtab_and_line' and 'gdb.Symtab'.
  20873. Symbol table and line data for a frame is returned from the 'find_sal'
  20874. method in 'gdb.Frame' object. *Note Frames In Python::.
  20875. For more information on GDB's symbol table management, see *note
  20876. Examining the Symbol Table: Symbols, for more information.
  20877. A 'gdb.Symtab_and_line' object has the following attributes:
  20878. -- Variable: Symtab_and_line.symtab
  20879. The symbol table object ('gdb.Symtab') for this frame. This
  20880. attribute is not writable.
  20881. -- Variable: Symtab_and_line.pc
  20882. Indicates the start of the address range occupied by code for the
  20883. current source line. This attribute is not writable.
  20884. -- Variable: Symtab_and_line.last
  20885. Indicates the end of the address range occupied by code for the
  20886. current source line. This attribute is not writable.
  20887. -- Variable: Symtab_and_line.line
  20888. Indicates the current line number for this object. This attribute
  20889. is not writable.
  20890. A 'gdb.Symtab_and_line' object has the following methods:
  20891. -- Function: Symtab_and_line.is_valid ()
  20892. Returns 'True' if the 'gdb.Symtab_and_line' object is valid,
  20893. 'False' if not. A 'gdb.Symtab_and_line' object can become invalid
  20894. if the Symbol table and line object it refers to does not exist in
  20895. GDB any longer. All other 'gdb.Symtab_and_line' methods will throw
  20896. an exception if it is invalid at the time the method is called.
  20897. A 'gdb.Symtab' object has the following attributes:
  20898. -- Variable: Symtab.filename
  20899. The symbol table's source filename. This attribute is not
  20900. writable.
  20901. -- Variable: Symtab.objfile
  20902. The symbol table's backing object file. *Note Objfiles In
  20903. Python::. This attribute is not writable.
  20904. -- Variable: Symtab.producer
  20905. The name and possibly version number of the program that compiled
  20906. the code in the symbol table. The contents of this string is up to
  20907. the compiler. If no producer information is available then 'None'
  20908. is returned. This attribute is not writable.
  20909. A 'gdb.Symtab' object has the following methods:
  20910. -- Function: Symtab.is_valid ()
  20911. Returns 'True' if the 'gdb.Symtab' object is valid, 'False' if not.
  20912. A 'gdb.Symtab' object can become invalid if the symbol table it
  20913. refers to does not exist in GDB any longer. All other 'gdb.Symtab'
  20914. methods will throw an exception if it is invalid at the time the
  20915. method is called.
  20916. -- Function: Symtab.fullname ()
  20917. Return the symbol table's source absolute file name.
  20918. -- Function: Symtab.global_block ()
  20919. Return the global block of the underlying symbol table. *Note
  20920. Blocks In Python::.
  20921. -- Function: Symtab.static_block ()
  20922. Return the static block of the underlying symbol table. *Note
  20923. Blocks In Python::.
  20924. -- Function: Symtab.linetable ()
  20925. Return the line table associated with the symbol table. *Note Line
  20926. Tables In Python::.
  20927. 
  20928. File: gdb.info, Node: Line Tables In Python, Next: Breakpoints In Python, Prev: Symbol Tables In Python, Up: Python API
  20929. 23.2.2.29 Manipulating line tables using Python
  20930. ...............................................
  20931. Python code can request and inspect line table information from a symbol
  20932. table that is loaded in GDB. A line table is a mapping of source lines
  20933. to their executable locations in memory. To acquire the line table
  20934. information for a particular symbol table, use the 'linetable' function
  20935. (*note Symbol Tables In Python::).
  20936. A 'gdb.LineTable' is iterable. The iterator returns 'LineTableEntry'
  20937. objects that correspond to the source line and address for each line
  20938. table entry. 'LineTableEntry' objects have the following attributes:
  20939. -- Variable: LineTableEntry.line
  20940. The source line number for this line table entry. This number
  20941. corresponds to the actual line of source. This attribute is not
  20942. writable.
  20943. -- Variable: LineTableEntry.pc
  20944. The address that is associated with the line table entry where the
  20945. executable code for that source line resides in memory. This
  20946. attribute is not writable.
  20947. As there can be multiple addresses for a single source line, you may
  20948. receive multiple 'LineTableEntry' objects with matching 'line'
  20949. attributes, but with different 'pc' attributes. The iterator is sorted
  20950. in ascending 'pc' order. Here is a small example illustrating iterating
  20951. over a line table.
  20952. symtab = gdb.selected_frame().find_sal().symtab
  20953. linetable = symtab.linetable()
  20954. for line in linetable:
  20955. print "Line: "+str(line.line)+" Address: "+hex(line.pc)
  20956. This will have the following output:
  20957. Line: 33 Address: 0x4005c8L
  20958. Line: 37 Address: 0x4005caL
  20959. Line: 39 Address: 0x4005d2L
  20960. Line: 40 Address: 0x4005f8L
  20961. Line: 42 Address: 0x4005ffL
  20962. Line: 44 Address: 0x400608L
  20963. Line: 42 Address: 0x40060cL
  20964. Line: 45 Address: 0x400615L
  20965. In addition to being able to iterate over a 'LineTable', it also has
  20966. the following direct access methods:
  20967. -- Function: LineTable.line (line)
  20968. Return a Python 'Tuple' of 'LineTableEntry' objects for any entries
  20969. in the line table for the given LINE, which specifies the source
  20970. code line. If there are no entries for that source code LINE, the
  20971. Python 'None' is returned.
  20972. -- Function: LineTable.has_line (line)
  20973. Return a Python 'Boolean' indicating whether there is an entry in
  20974. the line table for this source line. Return 'True' if an entry is
  20975. found, or 'False' if not.
  20976. -- Function: LineTable.source_lines ()
  20977. Return a Python 'List' of the source line numbers in the symbol
  20978. table. Only lines with executable code locations are returned.
  20979. The contents of the 'List' will just be the source line entries
  20980. represented as Python 'Long' values.
  20981. 
  20982. File: gdb.info, Node: Breakpoints In Python, Next: Finish Breakpoints in Python, Prev: Line Tables In Python, Up: Python API
  20983. 23.2.2.30 Manipulating breakpoints using Python
  20984. ...............................................
  20985. Python code can manipulate breakpoints via the 'gdb.Breakpoint' class.
  20986. A breakpoint can be created using one of the two forms of the
  20987. 'gdb.Breakpoint' constructor. The first one accepts a string like one
  20988. would pass to the 'break' (*note Setting Breakpoints: Set Breaks.) and
  20989. 'watch' (*note Setting Watchpoints: Set Watchpoints.) commands, and can
  20990. be used to create both breakpoints and watchpoints. The second accepts
  20991. separate Python arguments similar to *note Explicit Locations::, and can
  20992. only be used to create breakpoints.
  20993. -- Function: Breakpoint.__init__ (spec [, type ][, wp_class ][,
  20994. internal ][, temporary ][, qualified ])
  20995. Create a new breakpoint according to SPEC, which is a string naming
  20996. the location of a breakpoint, or an expression that defines a
  20997. watchpoint. The string should describe a location in a format
  20998. recognized by the 'break' command (*note Setting Breakpoints: Set
  20999. Breaks.) or, in the case of a watchpoint, by the 'watch' command
  21000. (*note Setting Watchpoints: Set Watchpoints.).
  21001. The optional TYPE argument specifies the type of the breakpoint to
  21002. create, as defined below.
  21003. The optional WP_CLASS argument defines the class of watchpoint to
  21004. create, if TYPE is 'gdb.BP_WATCHPOINT'. If WP_CLASS is omitted, it
  21005. defaults to 'gdb.WP_WRITE'.
  21006. The optional INTERNAL argument allows the breakpoint to become
  21007. invisible to the user. The breakpoint will neither be reported
  21008. when created, nor will it be listed in the output from 'info
  21009. breakpoints' (but will be listed with the 'maint info breakpoints'
  21010. command).
  21011. The optional TEMPORARY argument makes the breakpoint a temporary
  21012. breakpoint. Temporary breakpoints are deleted after they have been
  21013. hit. Any further access to the Python breakpoint after it has been
  21014. hit will result in a runtime error (as that breakpoint has now been
  21015. automatically deleted).
  21016. The optional QUALIFIED argument is a boolean that allows
  21017. interpreting the function passed in 'spec' as a fully-qualified
  21018. name. It is equivalent to 'break''s '-qualified' flag (*note
  21019. Linespec Locations:: and *note Explicit Locations::).
  21020. -- Function: Breakpoint.__init__ ([ source ][, function ][, label ][,
  21021. line ], ][ internal ][, temporary ][, qualified ])
  21022. This second form of creating a new breakpoint specifies the
  21023. explicit location (*note Explicit Locations::) using keywords. The
  21024. new breakpoint will be created in the specified source file SOURCE,
  21025. at the specified FUNCTION, LABEL and LINE.
  21026. INTERNAL, TEMPORARY and QUALIFIED have the same usage as explained
  21027. previously.
  21028. The available types are represented by constants defined in the 'gdb'
  21029. module:
  21030. 'gdb.BP_BREAKPOINT'
  21031. Normal code breakpoint.
  21032. 'gdb.BP_WATCHPOINT'
  21033. Watchpoint breakpoint.
  21034. 'gdb.BP_HARDWARE_WATCHPOINT'
  21035. Hardware assisted watchpoint.
  21036. 'gdb.BP_READ_WATCHPOINT'
  21037. Hardware assisted read watchpoint.
  21038. 'gdb.BP_ACCESS_WATCHPOINT'
  21039. Hardware assisted access watchpoint.
  21040. The available watchpoint types represented by constants are defined
  21041. in the 'gdb' module:
  21042. 'gdb.WP_READ'
  21043. Read only watchpoint.
  21044. 'gdb.WP_WRITE'
  21045. Write only watchpoint.
  21046. 'gdb.WP_ACCESS'
  21047. Read/Write watchpoint.
  21048. -- Function: Breakpoint.stop (self)
  21049. The 'gdb.Breakpoint' class can be sub-classed and, in particular,
  21050. you may choose to implement the 'stop' method. If this method is
  21051. defined in a sub-class of 'gdb.Breakpoint', it will be called when
  21052. the inferior reaches any location of a breakpoint which
  21053. instantiates that sub-class. If the method returns 'True', the
  21054. inferior will be stopped at the location of the breakpoint,
  21055. otherwise the inferior will continue.
  21056. If there are multiple breakpoints at the same location with a
  21057. 'stop' method, each one will be called regardless of the return
  21058. status of the previous. This ensures that all 'stop' methods have
  21059. a chance to execute at that location. In this scenario if one of
  21060. the methods returns 'True' but the others return 'False', the
  21061. inferior will still be stopped.
  21062. You should not alter the execution state of the inferior (i.e.,
  21063. step, next, etc.), alter the current frame context (i.e., change
  21064. the current active frame), or alter, add or delete any breakpoint.
  21065. As a general rule, you should not alter any data within GDB or the
  21066. inferior at this time.
  21067. Example 'stop' implementation:
  21068. class MyBreakpoint (gdb.Breakpoint):
  21069. def stop (self):
  21070. inf_val = gdb.parse_and_eval("foo")
  21071. if inf_val == 3:
  21072. return True
  21073. return False
  21074. -- Function: Breakpoint.is_valid ()
  21075. Return 'True' if this 'Breakpoint' object is valid, 'False'
  21076. otherwise. A 'Breakpoint' object can become invalid if the user
  21077. deletes the breakpoint. In this case, the object still exists, but
  21078. the underlying breakpoint does not. In the cases of watchpoint
  21079. scope, the watchpoint remains valid even if execution of the
  21080. inferior leaves the scope of that watchpoint.
  21081. -- Function: Breakpoint.delete ()
  21082. Permanently deletes the GDB breakpoint. This also invalidates the
  21083. Python 'Breakpoint' object. Any further access to this object's
  21084. attributes or methods will raise an error.
  21085. -- Variable: Breakpoint.enabled
  21086. This attribute is 'True' if the breakpoint is enabled, and 'False'
  21087. otherwise. This attribute is writable. You can use it to enable
  21088. or disable the breakpoint.
  21089. -- Variable: Breakpoint.silent
  21090. This attribute is 'True' if the breakpoint is silent, and 'False'
  21091. otherwise. This attribute is writable.
  21092. Note that a breakpoint can also be silent if it has commands and
  21093. the first command is 'silent'. This is not reported by the
  21094. 'silent' attribute.
  21095. -- Variable: Breakpoint.pending
  21096. This attribute is 'True' if the breakpoint is pending, and 'False'
  21097. otherwise. *Note Set Breaks::. This attribute is read-only.
  21098. -- Variable: Breakpoint.thread
  21099. If the breakpoint is thread-specific, this attribute holds the
  21100. thread's global id. If the breakpoint is not thread-specific, this
  21101. attribute is 'None'. This attribute is writable.
  21102. -- Variable: Breakpoint.task
  21103. If the breakpoint is Ada task-specific, this attribute holds the
  21104. Ada task id. If the breakpoint is not task-specific (or the
  21105. underlying language is not Ada), this attribute is 'None'. This
  21106. attribute is writable.
  21107. -- Variable: Breakpoint.ignore_count
  21108. This attribute holds the ignore count for the breakpoint, an
  21109. integer. This attribute is writable.
  21110. -- Variable: Breakpoint.number
  21111. This attribute holds the breakpoint's number -- the identifier used
  21112. by the user to manipulate the breakpoint. This attribute is not
  21113. writable.
  21114. -- Variable: Breakpoint.type
  21115. This attribute holds the breakpoint's type -- the identifier used
  21116. to determine the actual breakpoint type or use-case. This
  21117. attribute is not writable.
  21118. -- Variable: Breakpoint.visible
  21119. This attribute tells whether the breakpoint is visible to the user
  21120. when set, or when the 'info breakpoints' command is run. This
  21121. attribute is not writable.
  21122. -- Variable: Breakpoint.temporary
  21123. This attribute indicates whether the breakpoint was created as a
  21124. temporary breakpoint. Temporary breakpoints are automatically
  21125. deleted after that breakpoint has been hit. Access to this
  21126. attribute, and all other attributes and functions other than the
  21127. 'is_valid' function, will result in an error after the breakpoint
  21128. has been hit (as it has been automatically deleted). This
  21129. attribute is not writable.
  21130. -- Variable: Breakpoint.hit_count
  21131. This attribute holds the hit count for the breakpoint, an integer.
  21132. This attribute is writable, but currently it can only be set to
  21133. zero.
  21134. -- Variable: Breakpoint.location
  21135. This attribute holds the location of the breakpoint, as specified
  21136. by the user. It is a string. If the breakpoint does not have a
  21137. location (that is, it is a watchpoint) the attribute's value is
  21138. 'None'. This attribute is not writable.
  21139. -- Variable: Breakpoint.expression
  21140. This attribute holds a breakpoint expression, as specified by the
  21141. user. It is a string. If the breakpoint does not have an
  21142. expression (the breakpoint is not a watchpoint) the attribute's
  21143. value is 'None'. This attribute is not writable.
  21144. -- Variable: Breakpoint.condition
  21145. This attribute holds the condition of the breakpoint, as specified
  21146. by the user. It is a string. If there is no condition, this
  21147. attribute's value is 'None'. This attribute is writable.
  21148. -- Variable: Breakpoint.commands
  21149. This attribute holds the commands attached to the breakpoint. If
  21150. there are commands, this attribute's value is a string holding all
  21151. the commands, separated by newlines. If there are no commands,
  21152. this attribute is 'None'. This attribute is writable.
  21153. 
  21154. File: gdb.info, Node: Finish Breakpoints in Python, Next: Lazy Strings In Python, Prev: Breakpoints In Python, Up: Python API
  21155. 23.2.2.31 Finish Breakpoints
  21156. ............................
  21157. A finish breakpoint is a temporary breakpoint set at the return address
  21158. of a frame, based on the 'finish' command. 'gdb.FinishBreakpoint'
  21159. extends 'gdb.Breakpoint'. The underlying breakpoint will be disabled
  21160. and deleted when the execution will run out of the breakpoint scope
  21161. (i.e. 'Breakpoint.stop' or 'FinishBreakpoint.out_of_scope' triggered).
  21162. Finish breakpoints are thread specific and must be create with the right
  21163. thread selected.
  21164. -- Function: FinishBreakpoint.__init__ ([frame] [, internal])
  21165. Create a finish breakpoint at the return address of the 'gdb.Frame'
  21166. object FRAME. If FRAME is not provided, this defaults to the
  21167. newest frame. The optional INTERNAL argument allows the breakpoint
  21168. to become invisible to the user. *Note Breakpoints In Python::,
  21169. for further details about this argument.
  21170. -- Function: FinishBreakpoint.out_of_scope (self)
  21171. In some circumstances (e.g. 'longjmp', C++ exceptions, GDB 'return'
  21172. command, ...), a function may not properly terminate, and thus
  21173. never hit the finish breakpoint. When GDB notices such a
  21174. situation, the 'out_of_scope' callback will be triggered.
  21175. You may want to sub-class 'gdb.FinishBreakpoint' and override this
  21176. method:
  21177. class MyFinishBreakpoint (gdb.FinishBreakpoint)
  21178. def stop (self):
  21179. print "normal finish"
  21180. return True
  21181. def out_of_scope ():
  21182. print "abnormal finish"
  21183. -- Variable: FinishBreakpoint.return_value
  21184. When GDB is stopped at a finish breakpoint and the frame used to
  21185. build the 'gdb.FinishBreakpoint' object had debug symbols, this
  21186. attribute will contain a 'gdb.Value' object corresponding to the
  21187. return value of the function. The value will be 'None' if the
  21188. function return type is 'void' or if the return value was not
  21189. computable. This attribute is not writable.
  21190. 
  21191. File: gdb.info, Node: Lazy Strings In Python, Next: Architectures In Python, Prev: Finish Breakpoints in Python, Up: Python API
  21192. 23.2.2.32 Python representation of lazy strings
  21193. ...............................................
  21194. A "lazy string" is a string whose contents is not retrieved or encoded
  21195. until it is needed.
  21196. A 'gdb.LazyString' is represented in GDB as an 'address' that points
  21197. to a region of memory, an 'encoding' that will be used to encode that
  21198. region of memory, and a 'length' to delimit the region of memory that
  21199. represents the string. The difference between a 'gdb.LazyString' and a
  21200. string wrapped within a 'gdb.Value' is that a 'gdb.LazyString' will be
  21201. treated differently by GDB when printing. A 'gdb.LazyString' is
  21202. retrieved and encoded during printing, while a 'gdb.Value' wrapping a
  21203. string is immediately retrieved and encoded on creation.
  21204. A 'gdb.LazyString' object has the following functions:
  21205. -- Function: LazyString.value ()
  21206. Convert the 'gdb.LazyString' to a 'gdb.Value'. This value will
  21207. point to the string in memory, but will lose all the delayed
  21208. retrieval, encoding and handling that GDB applies to a
  21209. 'gdb.LazyString'.
  21210. -- Variable: LazyString.address
  21211. This attribute holds the address of the string. This attribute is
  21212. not writable.
  21213. -- Variable: LazyString.length
  21214. This attribute holds the length of the string in characters. If
  21215. the length is -1, then the string will be fetched and encoded up to
  21216. the first null of appropriate width. This attribute is not
  21217. writable.
  21218. -- Variable: LazyString.encoding
  21219. This attribute holds the encoding that will be applied to the
  21220. string when the string is printed by GDB. If the encoding is not
  21221. set, or contains an empty string, then GDB will select the most
  21222. appropriate encoding when the string is printed. This attribute is
  21223. not writable.
  21224. -- Variable: LazyString.type
  21225. This attribute holds the type that is represented by the lazy
  21226. string's type. For a lazy string this is a pointer or array type.
  21227. To resolve this to the lazy string's character type, use the type's
  21228. 'target' method. *Note Types In Python::. This attribute is not
  21229. writable.
  21230. 
  21231. File: gdb.info, Node: Architectures In Python, Prev: Lazy Strings In Python, Up: Python API
  21232. 23.2.2.33 Python representation of architectures
  21233. ................................................
  21234. GDB uses architecture specific parameters and artifacts in a number of
  21235. its various computations. An architecture is represented by an instance
  21236. of the 'gdb.Architecture' class.
  21237. A 'gdb.Architecture' class has the following methods:
  21238. -- Function: Architecture.name ()
  21239. Return the name (string value) of the architecture.
  21240. -- Function: Architecture.disassemble (START_PC [, END_PC [, COUNT]])
  21241. Return a list of disassembled instructions starting from the memory
  21242. address START_PC. The optional arguments END_PC and COUNT
  21243. determine the number of instructions in the returned list. If both
  21244. the optional arguments END_PC and COUNT are specified, then a list
  21245. of at most COUNT disassembled instructions whose start address
  21246. falls in the closed memory address interval from START_PC to END_PC
  21247. are returned. If END_PC is not specified, but COUNT is specified,
  21248. then COUNT number of instructions starting from the address
  21249. START_PC are returned. If COUNT is not specified but END_PC is
  21250. specified, then all instructions whose start address falls in the
  21251. closed memory address interval from START_PC to END_PC are
  21252. returned. If neither END_PC nor COUNT are specified, then a single
  21253. instruction at START_PC is returned. For all of these cases, each
  21254. element of the returned list is a Python 'dict' with the following
  21255. string keys:
  21256. 'addr'
  21257. The value corresponding to this key is a Python long integer
  21258. capturing the memory address of the instruction.
  21259. 'asm'
  21260. The value corresponding to this key is a string value which
  21261. represents the instruction with assembly language mnemonics.
  21262. The assembly language flavor used is the same as that
  21263. specified by the current CLI variable 'disassembly-flavor'.
  21264. *Note Machine Code::.
  21265. 'length'
  21266. The value corresponding to this key is the length (integer
  21267. value) of the instruction in bytes.
  21268. 
  21269. File: gdb.info, Node: Python Auto-loading, Next: Python modules, Prev: Python API, Up: Python
  21270. 23.2.3 Python Auto-loading
  21271. --------------------------
  21272. When a new object file is read (for example, due to the 'file' command,
  21273. or because the inferior has loaded a shared library), GDB will look for
  21274. Python support scripts in several ways: 'OBJFILE-gdb.py' and
  21275. '.debug_gdb_scripts' section. *Note Auto-loading extensions::.
  21276. The auto-loading feature is useful for supplying application-specific
  21277. debugging commands and scripts.
  21278. Auto-loading can be enabled or disabled, and the list of auto-loaded
  21279. scripts can be printed.
  21280. 'set auto-load python-scripts [on|off]'
  21281. Enable or disable the auto-loading of Python scripts.
  21282. 'show auto-load python-scripts'
  21283. Show whether auto-loading of Python scripts is enabled or disabled.
  21284. 'info auto-load python-scripts [REGEXP]'
  21285. Print the list of all Python scripts that GDB auto-loaded.
  21286. Also printed is the list of Python scripts that were mentioned in
  21287. the '.debug_gdb_scripts' section and were either not found (*note
  21288. dotdebug_gdb_scripts section::) or were not auto-loaded due to
  21289. 'auto-load safe-path' rejection (*note Auto-loading::). This is
  21290. useful because their names are not printed when GDB tries to load
  21291. them and fails. There may be many of them, and printing an error
  21292. message for each one is problematic.
  21293. If REGEXP is supplied only Python scripts with matching names are
  21294. printed.
  21295. Example:
  21296. (gdb) info auto-load python-scripts
  21297. Loaded Script
  21298. Yes py-section-script.py
  21299. full name: /tmp/py-section-script.py
  21300. No my-foo-pretty-printers.py
  21301. When reading an auto-loaded file or script, GDB sets the "current
  21302. objfile". This is available via the 'gdb.current_objfile' function
  21303. (*note Objfiles In Python::). This can be useful for registering
  21304. objfile-specific pretty-printers and frame-filters.
  21305. 
  21306. File: gdb.info, Node: Python modules, Prev: Python Auto-loading, Up: Python
  21307. 23.2.4 Python modules
  21308. ---------------------
  21309. GDB comes with several modules to assist writing Python code.
  21310. * Menu:
  21311. * gdb.printing:: Building and registering pretty-printers.
  21312. * gdb.types:: Utilities for working with types.
  21313. * gdb.prompt:: Utilities for prompt value substitution.
  21314. 
  21315. File: gdb.info, Node: gdb.printing, Next: gdb.types, Up: Python modules
  21316. 23.2.4.1 gdb.printing
  21317. .....................
  21318. This module provides a collection of utilities for working with
  21319. pretty-printers.
  21320. 'PrettyPrinter (NAME, SUBPRINTERS=None)'
  21321. This class specifies the API that makes 'info pretty-printer',
  21322. 'enable pretty-printer' and 'disable pretty-printer' work.
  21323. Pretty-printers should generally inherit from this class.
  21324. 'SubPrettyPrinter (NAME)'
  21325. For printers that handle multiple types, this class specifies the
  21326. corresponding API for the subprinters.
  21327. 'RegexpCollectionPrettyPrinter (NAME)'
  21328. Utility class for handling multiple printers, all recognized via
  21329. regular expressions. *Note Writing a Pretty-Printer::, for an
  21330. example.
  21331. 'FlagEnumerationPrinter (NAME)'
  21332. A pretty-printer which handles printing of 'enum' values. Unlike
  21333. GDB's built-in 'enum' printing, this printer attempts to work
  21334. properly when there is some overlap between the enumeration
  21335. constants. The argument NAME is the name of the printer and also
  21336. the name of the 'enum' type to look up.
  21337. 'register_pretty_printer (OBJ, PRINTER, REPLACE=False)'
  21338. Register PRINTER with the pretty-printer list of OBJ. If REPLACE
  21339. is 'True' then any existing copy of the printer is replaced.
  21340. Otherwise a 'RuntimeError' exception is raised if a printer with
  21341. the same name already exists.
  21342. 
  21343. File: gdb.info, Node: gdb.types, Next: gdb.prompt, Prev: gdb.printing, Up: Python modules
  21344. 23.2.4.2 gdb.types
  21345. ..................
  21346. This module provides a collection of utilities for working with
  21347. 'gdb.Type' objects.
  21348. 'get_basic_type (TYPE)'
  21349. Return TYPE with const and volatile qualifiers stripped, and with
  21350. typedefs and C++ references converted to the underlying type.
  21351. C++ example:
  21352. typedef const int const_int;
  21353. const_int foo (3);
  21354. const_int& foo_ref (foo);
  21355. int main () { return 0; }
  21356. Then in gdb:
  21357. (gdb) start
  21358. (gdb) python import gdb.types
  21359. (gdb) python foo_ref = gdb.parse_and_eval("foo_ref")
  21360. (gdb) python print gdb.types.get_basic_type(foo_ref.type)
  21361. int
  21362. 'has_field (TYPE, FIELD)'
  21363. Return 'True' if TYPE, assumed to be a type with fields (e.g., a
  21364. structure or union), has field FIELD.
  21365. 'make_enum_dict (ENUM_TYPE)'
  21366. Return a Python 'dictionary' type produced from ENUM_TYPE.
  21367. 'deep_items (TYPE)'
  21368. Returns a Python iterator similar to the standard
  21369. 'gdb.Type.iteritems' method, except that the iterator returned by
  21370. 'deep_items' will recursively traverse anonymous struct or union
  21371. fields. For example:
  21372. struct A
  21373. {
  21374. int a;
  21375. union {
  21376. int b0;
  21377. int b1;
  21378. };
  21379. };
  21380. Then in GDB:
  21381. (gdb) python import gdb.types
  21382. (gdb) python struct_a = gdb.lookup_type("struct A")
  21383. (gdb) python print struct_a.keys ()
  21384. {['a', '']}
  21385. (gdb) python print [k for k,v in gdb.types.deep_items(struct_a)]
  21386. {['a', 'b0', 'b1']}
  21387. 'get_type_recognizers ()'
  21388. Return a list of the enabled type recognizers for the current
  21389. context. This is called by GDB during the type-printing process
  21390. (*note Type Printing API::).
  21391. 'apply_type_recognizers (recognizers, type_obj)'
  21392. Apply the type recognizers, RECOGNIZERS, to the type object
  21393. TYPE_OBJ. If any recognizer returns a string, return that string.
  21394. Otherwise, return 'None'. This is called by GDB during the
  21395. type-printing process (*note Type Printing API::).
  21396. 'register_type_printer (locus, printer)'
  21397. This is a convenience function to register a type printer PRINTER.
  21398. The printer must implement the type printer protocol. The LOCUS
  21399. argument is either a 'gdb.Objfile', in which case the printer is
  21400. registered with that objfile; a 'gdb.Progspace', in which case the
  21401. printer is registered with that progspace; or 'None', in which case
  21402. the printer is registered globally.
  21403. 'TypePrinter'
  21404. This is a base class that implements the type printer protocol.
  21405. Type printers are encouraged, but not required, to derive from this
  21406. class. It defines a constructor:
  21407. -- Method on TypePrinter: __init__ (self, name)
  21408. Initialize the type printer with the given name. The new
  21409. printer starts in the enabled state.
  21410. 
  21411. File: gdb.info, Node: gdb.prompt, Prev: gdb.types, Up: Python modules
  21412. 23.2.4.3 gdb.prompt
  21413. ...................
  21414. This module provides a method for prompt value-substitution.
  21415. 'substitute_prompt (STRING)'
  21416. Return STRING with escape sequences substituted by values. Some
  21417. escape sequences take arguments. You can specify arguments inside
  21418. "{}" immediately following the escape sequence.
  21419. The escape sequences you can pass to this function are:
  21420. '\\'
  21421. Substitute a backslash.
  21422. '\e'
  21423. Substitute an ESC character.
  21424. '\f'
  21425. Substitute the selected frame; an argument names a frame
  21426. parameter.
  21427. '\n'
  21428. Substitute a newline.
  21429. '\p'
  21430. Substitute a parameter's value; the argument names the
  21431. parameter.
  21432. '\r'
  21433. Substitute a carriage return.
  21434. '\t'
  21435. Substitute the selected thread; an argument names a thread
  21436. parameter.
  21437. '\v'
  21438. Substitute the version of GDB.
  21439. '\w'
  21440. Substitute the current working directory.
  21441. '\['
  21442. Begin a sequence of non-printing characters. These sequences
  21443. are typically used with the ESC character, and are not counted
  21444. in the string length. Example: "\[\e[0;34m\](gdb)\[\e[0m\]"
  21445. will return a blue-colored "(gdb)" prompt where the length is
  21446. five.
  21447. '\]'
  21448. End a sequence of non-printing characters.
  21449. For example:
  21450. substitute_prompt (``frame: \f,
  21451. print arguments: \p{print frame-arguments}'')
  21452. will return the string:
  21453. "frame: main, print arguments: scalars"
  21454. 
  21455. File: gdb.info, Node: Guile, Next: Auto-loading extensions, Prev: Python, Up: Extending GDB
  21456. 23.3 Extending GDB using Guile
  21457. ==============================
  21458. You can extend GDB using the Guile implementation of the Scheme
  21459. programming language (http://www.gnu.org/software/guile/). This feature
  21460. is available only if GDB was configured using '--with-guile'.
  21461. * Menu:
  21462. * Guile Introduction:: Introduction to Guile scripting in GDB
  21463. * Guile Commands:: Accessing Guile from GDB
  21464. * Guile API:: Accessing GDB from Guile
  21465. * Guile Auto-loading:: Automatically loading Guile code
  21466. * Guile Modules:: Guile modules provided by GDB
  21467. 
  21468. File: gdb.info, Node: Guile Introduction, Next: Guile Commands, Up: Guile
  21469. 23.3.1 Guile Introduction
  21470. -------------------------
  21471. Guile is an implementation of the Scheme programming language and is the
  21472. GNU project's official extension language.
  21473. Guile support in GDB follows the Python support in GDB reasonably
  21474. closely, so concepts there should carry over. However, some things are
  21475. done differently where it makes sense.
  21476. GDB requires Guile version 2.0 or greater. Older versions are not
  21477. supported.
  21478. Guile scripts used by GDB should be installed in
  21479. 'DATA-DIRECTORY/guile', where DATA-DIRECTORY is the data directory as
  21480. determined at GDB startup (*note Data Files::). This directory, known
  21481. as the "guile directory", is automatically added to the Guile Search
  21482. Path in order to allow the Guile interpreter to locate all scripts
  21483. installed at this location.
  21484. 
  21485. File: gdb.info, Node: Guile Commands, Next: Guile API, Prev: Guile Introduction, Up: Guile
  21486. 23.3.2 Guile Commands
  21487. ---------------------
  21488. GDB provides two commands for accessing the Guile interpreter:
  21489. 'guile-repl'
  21490. 'gr'
  21491. The 'guile-repl' command can be used to start an interactive Guile
  21492. prompt or "repl". To return to GDB, type ',q' or the 'EOF'
  21493. character (e.g., 'Ctrl-D' on an empty prompt). These commands do
  21494. not take any arguments.
  21495. 'guile [SCHEME-EXPRESSION]'
  21496. 'gu [SCHEME-EXPRESSION]'
  21497. The 'guile' command can be used to evaluate a Scheme expression.
  21498. If given an argument, GDB will pass the argument to the Guile
  21499. interpreter for evaluation.
  21500. (gdb) guile (display (+ 20 3)) (newline)
  21501. 23
  21502. The result of the Scheme expression is displayed using normal Guile
  21503. rules.
  21504. (gdb) guile (+ 20 3)
  21505. 23
  21506. If you do not provide an argument to 'guile', it will act as a
  21507. multi-line command, like 'define'. In this case, the Guile script
  21508. is made up of subsequent command lines, given after the 'guile'
  21509. command. This command list is terminated using a line containing
  21510. 'end'. For example:
  21511. (gdb) guile
  21512. >(display 23)
  21513. >(newline)
  21514. >end
  21515. 23
  21516. It is also possible to execute a Guile script from the GDB
  21517. interpreter:
  21518. 'source script-name'
  21519. The script name must end with '.scm' and GDB must be configured to
  21520. recognize the script language based on filename extension using the
  21521. 'script-extension' setting. *Note Extending GDB: Extending GDB.
  21522. 'guile (load "script-name")'
  21523. This method uses the 'load' Guile function. It takes a string
  21524. argument that is the name of the script to load. See the Guile
  21525. documentation for a description of this function. (*note
  21526. (guile)Loading::).
  21527. 
  21528. File: gdb.info, Node: Guile API, Next: Guile Auto-loading, Prev: Guile Commands, Up: Guile
  21529. 23.3.3 Guile API
  21530. ----------------
  21531. You can get quick online help for GDB's Guile API by issuing the command
  21532. 'help guile', or by issuing the command ',help' from an interactive
  21533. Guile session. Furthermore, most Guile procedures provided by GDB have
  21534. doc strings which can be obtained with ',describe PROCEDURE-NAME' or ',d
  21535. PROCEDURE-NAME' from the Guile interactive prompt.
  21536. * Menu:
  21537. * Basic Guile:: Basic Guile Functions
  21538. * Guile Configuration:: Guile configuration variables
  21539. * GDB Scheme Data Types:: Scheme representations of GDB objects
  21540. * Guile Exception Handling:: How Guile exceptions are translated
  21541. * Values From Inferior In Guile:: Guile representation of values
  21542. * Arithmetic In Guile:: Arithmetic in Guile
  21543. * Types In Guile:: Guile representation of types
  21544. * Guile Pretty Printing API:: Pretty-printing values with Guile
  21545. * Selecting Guile Pretty-Printers:: How GDB chooses a pretty-printer
  21546. * Writing a Guile Pretty-Printer:: Writing a pretty-printer
  21547. * Commands In Guile:: Implementing new commands in Guile
  21548. * Parameters In Guile:: Adding new GDB parameters
  21549. * Progspaces In Guile:: Program spaces
  21550. * Objfiles In Guile:: Object files in Guile
  21551. * Frames In Guile:: Accessing inferior stack frames from Guile
  21552. * Blocks In Guile:: Accessing blocks from Guile
  21553. * Symbols In Guile:: Guile representation of symbols
  21554. * Symbol Tables In Guile:: Guile representation of symbol tables
  21555. * Breakpoints In Guile:: Manipulating breakpoints using Guile
  21556. * Lazy Strings In Guile:: Guile representation of lazy strings
  21557. * Architectures In Guile:: Guile representation of architectures
  21558. * Disassembly In Guile:: Disassembling instructions from Guile
  21559. * I/O Ports in Guile:: GDB I/O ports
  21560. * Memory Ports in Guile:: Accessing memory through ports and bytevectors
  21561. * Iterators In Guile:: Basic iterator support
  21562. 
  21563. File: gdb.info, Node: Basic Guile, Next: Guile Configuration, Up: Guile API
  21564. 23.3.3.1 Basic Guile
  21565. ....................
  21566. At startup, GDB overrides Guile's 'current-output-port' and
  21567. 'current-error-port' to print using GDB's output-paging streams. A
  21568. Guile program which outputs to one of these streams may have its output
  21569. interrupted by the user (*note Screen Size::). In this situation, a
  21570. Guile 'signal' exception is thrown with value 'SIGINT'.
  21571. Guile's history mechanism uses the same naming as GDB's, namely the
  21572. user of dollar-variables (e.g., $1, $2, etc.). The results of
  21573. evaluations in Guile and in GDB are counted separately, '$1' in Guile is
  21574. not the same value as '$1' in GDB.
  21575. GDB is not thread-safe. If your Guile program uses multiple threads,
  21576. you must be careful to only call GDB-specific functions in the GDB
  21577. thread.
  21578. Some care must be taken when writing Guile code to run in GDB. Two
  21579. things are worth noting in particular:
  21580. * GDB installs handlers for 'SIGCHLD' and 'SIGINT'. Guile code must
  21581. not override these, or even change the options using 'sigaction'.
  21582. If your program changes the handling of these signals, GDB will
  21583. most likely stop working correctly. Note that it is unfortunately
  21584. common for GUI toolkits to install a 'SIGCHLD' handler.
  21585. * GDB takes care to mark its internal file descriptors as
  21586. close-on-exec. However, this cannot be done in a thread-safe way
  21587. on all platforms. Your Guile programs should be aware of this and
  21588. should both create new file descriptors with the close-on-exec flag
  21589. set and arrange to close unneeded file descriptors before starting
  21590. a child process.
  21591. GDB introduces a new Guile module, named 'gdb'. All methods and
  21592. classes added by GDB are placed in this module. GDB does not
  21593. automatically 'import' the 'gdb' module, scripts must do this
  21594. themselves. There are various options for how to import a module, so
  21595. GDB leaves the choice of how the 'gdb' module is imported to the user.
  21596. To simplify interactive use, it is recommended to add one of the
  21597. following to your ~/.gdbinit.
  21598. guile (use-modules (gdb))
  21599. guile (use-modules ((gdb) #:renamer (symbol-prefix-proc 'gdb:)))
  21600. Which one to choose depends on your preference. The second one adds
  21601. 'gdb:' as a prefix to all module functions and variables.
  21602. The rest of this manual assumes the 'gdb' module has been imported
  21603. without any prefix. See the Guile documentation for 'use-modules' for
  21604. more information (*note (guile)Using Guile Modules::).
  21605. Example:
  21606. (gdb) guile (value-type (make-value 1))
  21607. ERROR: Unbound variable: value-type
  21608. Error while executing Scheme code.
  21609. (gdb) guile (use-modules (gdb))
  21610. (gdb) guile (value-type (make-value 1))
  21611. int
  21612. (gdb)
  21613. The '(gdb)' module provides these basic Guile functions.
  21614. -- Scheme Procedure: execute command [#:from-tty boolean] [#:to-string
  21615. boolean]
  21616. Evaluate COMMAND, a string, as a GDB CLI command. If a GDB
  21617. exception happens while COMMAND runs, it is translated as described
  21618. in *note Guile Exception Handling: Guile Exception Handling.
  21619. FROM-TTY specifies whether GDB ought to consider this command as
  21620. having originated from the user invoking it interactively. It must
  21621. be a boolean value. If omitted, it defaults to '#f'.
  21622. By default, any output produced by COMMAND is sent to GDB's
  21623. standard output (and to the log output if logging is turned on).
  21624. If the TO-STRING parameter is '#t', then output will be collected
  21625. by 'execute' and returned as a string. The default is '#f', in
  21626. which case the return value is unspecified. If TO-STRING is '#t',
  21627. the GDB virtual terminal will be temporarily set to unlimited width
  21628. and height, and its pagination will be disabled; *note Screen
  21629. Size::.
  21630. -- Scheme Procedure: history-ref number
  21631. Return a value from GDB's value history (*note Value History::).
  21632. The NUMBER argument indicates which history element to return. If
  21633. NUMBER is negative, then GDB will take its absolute value and count
  21634. backward from the last element (i.e., the most recent element) to
  21635. find the value to return. If NUMBER is zero, then GDB will return
  21636. the most recent element. If the element specified by NUMBER
  21637. doesn't exist in the value history, a 'gdb:error' exception will be
  21638. raised.
  21639. If no exception is raised, the return value is always an instance
  21640. of '<gdb:value>' (*note Values From Inferior In Guile::).
  21641. _Note:_ GDB's value history is independent of Guile's. '$1' in
  21642. GDB's value history contains the result of evaluating an expression
  21643. from GDB's command line and '$1' from Guile's history contains the
  21644. result of evaluating an expression from Guile's command line.
  21645. -- Scheme Procedure: history-append! value
  21646. Append VALUE, an instance of '<gdb:value>', to GDB's value history.
  21647. Return its index in the history.
  21648. Putting into history values returned by Guile extensions will allow
  21649. the user convenient access to those values via CLI history
  21650. facilities.
  21651. -- Scheme Procedure: parse-and-eval expression
  21652. Parse EXPRESSION as an expression in the current language, evaluate
  21653. it, and return the result as a '<gdb:value>'. The EXPRESSION must
  21654. be a string.
  21655. This function can be useful when implementing a new command (*note
  21656. Commands In Guile::), as it provides a way to parse the command's
  21657. arguments as an expression. It is also is useful when computing
  21658. values. For example, it is the only way to get the value of a
  21659. convenience variable (*note Convenience Vars::) as a '<gdb:value>'.
  21660. 
  21661. File: gdb.info, Node: Guile Configuration, Next: GDB Scheme Data Types, Prev: Basic Guile, Up: Guile API
  21662. 23.3.3.2 Guile Configuration
  21663. ............................
  21664. GDB provides these Scheme functions to access various configuration
  21665. parameters.
  21666. -- Scheme Procedure: data-directory
  21667. Return a string containing GDB's data directory. This directory
  21668. contains GDB's ancillary files.
  21669. -- Scheme Procedure: guile-data-directory
  21670. Return a string containing GDB's Guile data directory. This
  21671. directory contains the Guile modules provided by GDB.
  21672. -- Scheme Procedure: gdb-version
  21673. Return a string containing the GDB version.
  21674. -- Scheme Procedure: host-config
  21675. Return a string containing the host configuration. This is the
  21676. string passed to '--host' when GDB was configured.
  21677. -- Scheme Procedure: target-config
  21678. Return a string containing the target configuration. This is the
  21679. string passed to '--target' when GDB was configured.
  21680. 
  21681. File: gdb.info, Node: GDB Scheme Data Types, Next: Guile Exception Handling, Prev: Guile Configuration, Up: Guile API
  21682. 23.3.3.3 GDB Scheme Data Types
  21683. ..............................
  21684. The values exposed by GDB to Guile are known as "GDB objects". There
  21685. are several kinds of GDB object, and each is disjoint from all other
  21686. types known to Guile.
  21687. -- Scheme Procedure: gdb-object-kind object
  21688. Return the kind of the GDB object, e.g., '<gdb:breakpoint>', as a
  21689. symbol.
  21690. GDB defines the following object types:
  21691. '<gdb:arch>'
  21692. *Note Architectures In Guile::.
  21693. '<gdb:block>'
  21694. *Note Blocks In Guile::.
  21695. '<gdb:block-symbols-iterator>'
  21696. *Note Blocks In Guile::.
  21697. '<gdb:breakpoint>'
  21698. *Note Breakpoints In Guile::.
  21699. '<gdb:command>'
  21700. *Note Commands In Guile::.
  21701. '<gdb:exception>'
  21702. *Note Guile Exception Handling::.
  21703. '<gdb:frame>'
  21704. *Note Frames In Guile::.
  21705. '<gdb:iterator>'
  21706. *Note Iterators In Guile::.
  21707. '<gdb:lazy-string>'
  21708. *Note Lazy Strings In Guile::.
  21709. '<gdb:objfile>'
  21710. *Note Objfiles In Guile::.
  21711. '<gdb:parameter>'
  21712. *Note Parameters In Guile::.
  21713. '<gdb:pretty-printer>'
  21714. *Note Guile Pretty Printing API::.
  21715. '<gdb:pretty-printer-worker>'
  21716. *Note Guile Pretty Printing API::.
  21717. '<gdb:progspace>'
  21718. *Note Progspaces In Guile::.
  21719. '<gdb:symbol>'
  21720. *Note Symbols In Guile::.
  21721. '<gdb:symtab>'
  21722. *Note Symbol Tables In Guile::.
  21723. '<gdb:sal>'
  21724. *Note Symbol Tables In Guile::.
  21725. '<gdb:type>'
  21726. *Note Types In Guile::.
  21727. '<gdb:field>'
  21728. *Note Types In Guile::.
  21729. '<gdb:value>'
  21730. *Note Values From Inferior In Guile::.
  21731. The following GDB objects are managed internally so that the Scheme
  21732. function 'eq?' may be applied to them.
  21733. '<gdb:arch>'
  21734. '<gdb:block>'
  21735. '<gdb:breakpoint>'
  21736. '<gdb:frame>'
  21737. '<gdb:objfile>'
  21738. '<gdb:progspace>'
  21739. '<gdb:symbol>'
  21740. '<gdb:symtab>'
  21741. '<gdb:type>'
  21742. 
  21743. File: gdb.info, Node: Guile Exception Handling, Next: Values From Inferior In Guile, Prev: GDB Scheme Data Types, Up: Guile API
  21744. 23.3.3.4 Guile Exception Handling
  21745. .................................
  21746. When executing the 'guile' command, Guile exceptions uncaught within the
  21747. Guile code are translated to calls to the GDB error-reporting mechanism.
  21748. If the command that called 'guile' does not handle the error, GDB will
  21749. terminate it and report the error according to the setting of the 'guile
  21750. print-stack' parameter.
  21751. The 'guile print-stack' parameter has three settings:
  21752. 'none'
  21753. Nothing is printed.
  21754. 'message'
  21755. An error message is printed containing the Guile exception name,
  21756. the associated value, and the Guile call stack backtrace at the
  21757. point where the exception was raised. Example:
  21758. (gdb) guile (display foo)
  21759. ERROR: In procedure memoize-variable-access!:
  21760. ERROR: Unbound variable: foo
  21761. Error while executing Scheme code.
  21762. 'full'
  21763. In addition to an error message a full backtrace is printed.
  21764. (gdb) set guile print-stack full
  21765. (gdb) guile (display foo)
  21766. Guile Backtrace:
  21767. In ice-9/boot-9.scm:
  21768. 157: 10 [catch #t #<catch-closure 2c76e20> ...]
  21769. In unknown file:
  21770. ?: 9 [apply-smob/1 #<catch-closure 2c76e20>]
  21771. In ice-9/boot-9.scm:
  21772. 157: 8 [catch #t #<catch-closure 2c76d20> ...]
  21773. In unknown file:
  21774. ?: 7 [apply-smob/1 #<catch-closure 2c76d20>]
  21775. ?: 6 [call-with-input-string "(display foo)" ...]
  21776. In ice-9/boot-9.scm:
  21777. 2320: 5 [save-module-excursion #<procedure 2c2dc30 ... ()>]
  21778. In ice-9/eval-string.scm:
  21779. 44: 4 [read-and-eval #<input: string 27cb410> #:lang ...]
  21780. 37: 3 [lp (display foo)]
  21781. In ice-9/eval.scm:
  21782. 387: 2 [eval # ()]
  21783. 393: 1 [eval #<memoized foo> ()]
  21784. In unknown file:
  21785. ?: 0 [memoize-variable-access! #<memoized foo> ...]
  21786. ERROR: In procedure memoize-variable-access!:
  21787. ERROR: Unbound variable: foo
  21788. Error while executing Scheme code.
  21789. GDB errors that happen in GDB commands invoked by Guile code are
  21790. converted to Guile exceptions. The type of the Guile exception depends
  21791. on the error.
  21792. Guile procedures provided by GDB can throw the standard Guile
  21793. exceptions like 'wrong-type-arg' and 'out-of-range'.
  21794. User interrupt (via 'C-c' or by typing 'q' at a pagination prompt) is
  21795. translated to a Guile 'signal' exception with value 'SIGINT'.
  21796. GDB Guile procedures can also throw these exceptions:
  21797. 'gdb:error'
  21798. This exception is a catch-all for errors generated from within GDB.
  21799. 'gdb:invalid-object'
  21800. This exception is thrown when accessing Guile objects that wrap
  21801. underlying GDB objects have become invalid. For example, a
  21802. '<gdb:breakpoint>' object becomes invalid if the user deletes it
  21803. from the command line. The object still exists in Guile, but the
  21804. object it represents is gone. Further operations on this
  21805. breakpoint will throw this exception.
  21806. 'gdb:memory-error'
  21807. This exception is thrown when an operation tried to access invalid
  21808. memory in the inferior.
  21809. 'gdb:pp-type-error'
  21810. This exception is thrown when a Guile pretty-printer passes a bad
  21811. object to GDB.
  21812. The following exception-related procedures are provided by the
  21813. '(gdb)' module.
  21814. -- Scheme Procedure: make-exception key args
  21815. Return a '<gdb:exception>' object given by its KEY and ARGS, which
  21816. are the standard Guile parameters of an exception. See the Guile
  21817. documentation for more information (*note (guile)Exceptions::).
  21818. -- Scheme Procedure: exception? object
  21819. Return '#t' if OBJECT is a '<gdb:exception>' object. Otherwise
  21820. return '#f'.
  21821. -- Scheme Procedure: exception-key exception
  21822. Return the ARGS field of a '<gdb:exception>' object.
  21823. -- Scheme Procedure: exception-args exception
  21824. Return the ARGS field of a '<gdb:exception>' object.
  21825. 
  21826. File: gdb.info, Node: Values From Inferior In Guile, Next: Arithmetic In Guile, Prev: Guile Exception Handling, Up: Guile API
  21827. 23.3.3.5 Values From Inferior In Guile
  21828. ......................................
  21829. GDB provides values it obtains from the inferior program in an object of
  21830. type '<gdb:value>'. GDB uses this object for its internal bookkeeping
  21831. of the inferior's values, and for fetching values when necessary.
  21832. GDB does not memoize '<gdb:value>' objects. 'make-value' always
  21833. returns a fresh object.
  21834. (gdb) guile (eq? (make-value 1) (make-value 1))
  21835. $1 = #f
  21836. (gdb) guile (equal? (make-value 1) (make-value 1))
  21837. $1 = #t
  21838. A '<gdb:value>' that represents a function can be executed via
  21839. inferior function call with 'value-call'. Any arguments provided to the
  21840. call must match the function's prototype, and must be provided in the
  21841. order specified by that prototype.
  21842. For example, 'some-val' is a '<gdb:value>' instance representing a
  21843. function that takes two integers as arguments. To execute this
  21844. function, call it like so:
  21845. (define result (value-call some-val 10 20))
  21846. Any values returned from a function call are '<gdb:value>' objects.
  21847. Note: Unlike Python scripting in GDB, inferior values that are simple
  21848. scalars cannot be used directly in Scheme expressions that are valid for
  21849. the value's data type. For example, '(+ (parse-and-eval "int_variable")
  21850. 2)' does not work. And inferior values that are structures or instances
  21851. of some class cannot be accessed using any special syntax, instead
  21852. 'value-field' must be used.
  21853. The following value-related procedures are provided by the '(gdb)'
  21854. module.
  21855. -- Scheme Procedure: value? object
  21856. Return '#t' if OBJECT is a '<gdb:value>' object. Otherwise return
  21857. '#f'.
  21858. -- Scheme Procedure: make-value value [#:type type]
  21859. Many Scheme values can be converted directly to a '<gdb:value>'
  21860. with this procedure. If TYPE is specified, the result is a value
  21861. of this type, and if VALUE can't be represented with this type an
  21862. exception is thrown. Otherwise the type of the result is
  21863. determined from VALUE as described below.
  21864. *Note Architectures In Guile::, for a list of the builtin types for
  21865. an architecture.
  21866. Here's how Scheme values are converted when TYPE argument to
  21867. 'make-value' is not specified:
  21868. Scheme boolean
  21869. A Scheme boolean is converted the boolean type for the current
  21870. language.
  21871. Scheme integer
  21872. A Scheme integer is converted to the first of a C 'int',
  21873. 'unsigned int', 'long', 'unsigned long', 'long long' or
  21874. 'unsigned long long' type for the current architecture that
  21875. can represent the value.
  21876. If the Scheme integer cannot be represented as a target
  21877. integer an 'out-of-range' exception is thrown.
  21878. Scheme real
  21879. A Scheme real is converted to the C 'double' type for the
  21880. current architecture.
  21881. Scheme string
  21882. A Scheme string is converted to a string in the current target
  21883. language using the current target encoding. Characters that
  21884. cannot be represented in the current target encoding are
  21885. replaced with the corresponding escape sequence. This is
  21886. Guile's 'SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE' conversion
  21887. strategy (*note (guile)Strings::).
  21888. Passing TYPE is not supported in this case, if it is provided
  21889. a 'wrong-type-arg' exception is thrown.
  21890. '<gdb:lazy-string>'
  21891. If VALUE is a '<gdb:lazy-string>' object (*note Lazy Strings
  21892. In Guile::), then the 'lazy-string->value' procedure is
  21893. called, and its result is used.
  21894. Passing TYPE is not supported in this case, if it is provided
  21895. a 'wrong-type-arg' exception is thrown.
  21896. Scheme bytevector
  21897. If VALUE is a Scheme bytevector and TYPE is provided, VALUE
  21898. must be the same size, in bytes, of values of type TYPE, and
  21899. the result is essentially created by using 'memcpy'.
  21900. If VALUE is a Scheme bytevector and TYPE is not provided, the
  21901. result is an array of type 'uint8' of the same length.
  21902. -- Scheme Procedure: value-optimized-out? value
  21903. Return '#t' if the compiler optimized out VALUE, thus it is not
  21904. available for fetching from the inferior. Otherwise return '#f'.
  21905. -- Scheme Procedure: value-address value
  21906. If VALUE is addressable, returns a '<gdb:value>' object
  21907. representing the address. Otherwise, '#f' is returned.
  21908. -- Scheme Procedure: value-type value
  21909. Return the type of VALUE as a '<gdb:type>' object (*note Types In
  21910. Guile::).
  21911. -- Scheme Procedure: value-dynamic-type value
  21912. Return the dynamic type of VALUE. This uses C++ run-time type
  21913. information (RTTI) to determine the dynamic type of the value. If
  21914. the value is of class type, it will return the class in which the
  21915. value is embedded, if any. If the value is of pointer or reference
  21916. to a class type, it will compute the dynamic type of the referenced
  21917. object, and return a pointer or reference to that type,
  21918. respectively. In all other cases, it will return the value's
  21919. static type.
  21920. Note that this feature will only work when debugging a C++ program
  21921. that includes RTTI for the object in question. Otherwise, it will
  21922. just return the static type of the value as in 'ptype foo'. *Note
  21923. ptype: Symbols.
  21924. -- Scheme Procedure: value-cast value type
  21925. Return a new instance of '<gdb:value>' that is the result of
  21926. casting VALUE to the type described by TYPE, which must be a
  21927. '<gdb:type>' object. If the cast cannot be performed for some
  21928. reason, this method throws an exception.
  21929. -- Scheme Procedure: value-dynamic-cast value type
  21930. Like 'value-cast', but works as if the C++ 'dynamic_cast' operator
  21931. were used. Consult a C++ reference for details.
  21932. -- Scheme Procedure: value-reinterpret-cast value type
  21933. Like 'value-cast', but works as if the C++ 'reinterpret_cast'
  21934. operator were used. Consult a C++ reference for details.
  21935. -- Scheme Procedure: value-dereference value
  21936. For pointer data types, this method returns a new '<gdb:value>'
  21937. object whose contents is the object pointed to by VALUE. For
  21938. example, if 'foo' is a C pointer to an 'int', declared in your C
  21939. program as
  21940. int *foo;
  21941. then you can use the corresponding '<gdb:value>' to access what
  21942. 'foo' points to like this:
  21943. (define bar (value-dereference foo))
  21944. The result 'bar' will be a '<gdb:value>' object holding the value
  21945. pointed to by 'foo'.
  21946. A similar function 'value-referenced-value' exists which also
  21947. returns '<gdb:value>' objects corresonding to the values pointed to
  21948. by pointer values (and additionally, values referenced by reference
  21949. values). However, the behavior of 'value-dereference' differs from
  21950. 'value-referenced-value' by the fact that the behavior of
  21951. 'value-dereference' is identical to applying the C unary operator
  21952. '*' on a given value. For example, consider a reference to a
  21953. pointer 'ptrref', declared in your C++ program as
  21954. typedef int *intptr;
  21955. ...
  21956. int val = 10;
  21957. intptr ptr = &val;
  21958. intptr &ptrref = ptr;
  21959. Though 'ptrref' is a reference value, one can apply the method
  21960. 'value-dereference' to the '<gdb:value>' object corresponding to it
  21961. and obtain a '<gdb:value>' which is identical to that corresponding
  21962. to 'val'. However, if you apply the method
  21963. 'value-referenced-value', the result would be a '<gdb:value>'
  21964. object identical to that corresponding to 'ptr'.
  21965. (define scm-ptrref (parse-and-eval "ptrref"))
  21966. (define scm-val (value-dereference scm-ptrref))
  21967. (define scm-ptr (value-referenced-value scm-ptrref))
  21968. The '<gdb:value>' object 'scm-val' is identical to that
  21969. corresponding to 'val', and 'scm-ptr' is identical to that
  21970. corresponding to 'ptr'. In general, 'value-dereference' can be
  21971. applied whenever the C unary operator '*' can be applied to the
  21972. corresponding C value. For those cases where applying both
  21973. 'value-dereference' and 'value-referenced-value' is allowed, the
  21974. results obtained need not be identical (as we have seen in the
  21975. above example). The results are however identical when applied on
  21976. '<gdb:value>' objects corresponding to pointers ('<gdb:value>'
  21977. objects with type code 'TYPE_CODE_PTR') in a C/C++ program.
  21978. -- Scheme Procedure: value-referenced-value value
  21979. For pointer or reference data types, this method returns a new
  21980. '<gdb:value>' object corresponding to the value referenced by the
  21981. pointer/reference value. For pointer data types,
  21982. 'value-dereference' and 'value-referenced-value' produce identical
  21983. results. The difference between these methods is that
  21984. 'value-dereference' cannot get the values referenced by reference
  21985. values. For example, consider a reference to an 'int', declared in
  21986. your C++ program as
  21987. int val = 10;
  21988. int &ref = val;
  21989. then applying 'value-dereference' to the '<gdb:value>' object
  21990. corresponding to 'ref' will result in an error, while applying
  21991. 'value-referenced-value' will result in a '<gdb:value>' object
  21992. identical to that corresponding to 'val'.
  21993. (define scm-ref (parse-and-eval "ref"))
  21994. (define err-ref (value-dereference scm-ref)) ;; error
  21995. (define scm-val (value-referenced-value scm-ref)) ;; ok
  21996. The '<gdb:value>' object 'scm-val' is identical to that
  21997. corresponding to 'val'.
  21998. -- Scheme Procedure: value-field value field-name
  21999. Return field FIELD-NAME from '<gdb:value>' object VALUE.
  22000. -- Scheme Procedure: value-subscript value index
  22001. Return the value of array VALUE at index INDEX. The VALUE argument
  22002. must be a subscriptable '<gdb:value>' object.
  22003. -- Scheme Procedure: value-call value arg-list
  22004. Perform an inferior function call, taking VALUE as a pointer to the
  22005. function to call. Each element of list ARG-LIST must be a
  22006. <gdb:value> object or an object that can be converted to a value.
  22007. The result is the value returned by the function.
  22008. -- Scheme Procedure: value->bool value
  22009. Return the Scheme boolean representing '<gdb:value>' VALUE. The
  22010. value must be "integer like". Pointers are ok.
  22011. -- Scheme Procedure: value->integer
  22012. Return the Scheme integer representing '<gdb:value>' VALUE. The
  22013. value must be "integer like". Pointers are ok.
  22014. -- Scheme Procedure: value->real
  22015. Return the Scheme real number representing '<gdb:value>' VALUE.
  22016. The value must be a number.
  22017. -- Scheme Procedure: value->bytevector
  22018. Return a Scheme bytevector with the raw contents of '<gdb:value>'
  22019. VALUE. No transformation, endian or otherwise, is performed.
  22020. -- Scheme Procedure: value->string value [#:encoding encoding]
  22021. [#:errors errors] [#:length length]
  22022. If VALUE> represents a string, then this method converts the
  22023. contents to a Guile string. Otherwise, this method will throw an
  22024. exception.
  22025. Values are interpreted as strings according to the rules of the
  22026. current language. If the optional length argument is given, the
  22027. string will be converted to that length, and will include any
  22028. embedded zeroes that the string may contain. Otherwise, for
  22029. languages where the string is zero-terminated, the entire string
  22030. will be converted.
  22031. For example, in C-like languages, a value is a string if it is a
  22032. pointer to or an array of characters or ints of type 'wchar_t',
  22033. 'char16_t', or 'char32_t'.
  22034. If the optional ENCODING argument is given, it must be a string
  22035. naming the encoding of the string in the '<gdb:value>', such as
  22036. '"ascii"', '"iso-8859-6"' or '"utf-8"'. It accepts the same
  22037. encodings as the corresponding argument to Guile's
  22038. 'scm_from_stringn' function, and the Guile codec machinery will be
  22039. used to convert the string. If ENCODING is not given, or if
  22040. ENCODING is the empty string, then either the 'target-charset'
  22041. (*note Character Sets::) will be used, or a language-specific
  22042. encoding will be used, if the current language is able to supply
  22043. one.
  22044. The optional ERRORS argument is one of '#f', 'error' or
  22045. 'substitute'. 'error' and 'substitute' must be symbols. If ERRORS
  22046. is not specified, or if its value is '#f', then the default
  22047. conversion strategy is used, which is set with the Scheme function
  22048. 'set-port-conversion-strategy!'. If the value is ''error' then an
  22049. exception is thrown if there is any conversion error. If the value
  22050. is ''substitute' then any conversion error is replaced with
  22051. question marks. *Note (guile)Strings::.
  22052. If the optional LENGTH argument is given, the string will be
  22053. fetched and converted to the given length. The length must be a
  22054. Scheme integer and not a '<gdb:value>' integer.
  22055. -- Scheme Procedure: value->lazy-string value [#:encoding encoding]
  22056. [#:length length]
  22057. If this '<gdb:value>' represents a string, then this method
  22058. converts VALUE to a '<gdb:lazy-string' (*note Lazy Strings In
  22059. Guile::). Otherwise, this method will throw an exception.
  22060. If the optional ENCODING argument is given, it must be a string
  22061. naming the encoding of the '<gdb:lazy-string'. Some examples are:
  22062. '"ascii"', '"iso-8859-6"' or '"utf-8"'. If the ENCODING argument
  22063. is an encoding that GDB does not recognize, GDB will raise an
  22064. error.
  22065. When a lazy string is printed, the GDB encoding machinery is used
  22066. to convert the string during printing. If the optional ENCODING
  22067. argument is not provided, or is an empty string, GDB will
  22068. automatically select the encoding most suitable for the string
  22069. type. For further information on encoding in GDB please see *note
  22070. Character Sets::.
  22071. If the optional LENGTH argument is given, the string will be
  22072. fetched and encoded to the length of characters specified. If the
  22073. LENGTH argument is not provided, the string will be fetched and
  22074. encoded until a null of appropriate width is found. The length
  22075. must be a Scheme integer and not a '<gdb:value>' integer.
  22076. -- Scheme Procedure: value-lazy? value
  22077. Return '#t' if VALUE has not yet been fetched from the inferior.
  22078. Otherwise return '#f'. GDB does not fetch values until necessary,
  22079. for efficiency. For example:
  22080. (define myval (parse-and-eval "somevar"))
  22081. The value of 'somevar' is not fetched at this time. It will be
  22082. fetched when the value is needed, or when the 'fetch-lazy'
  22083. procedure is invoked.
  22084. -- Scheme Procedure: make-lazy-value type address
  22085. Return a '<gdb:value>' that will be lazily fetched from the target.
  22086. The object of type '<gdb:type>' whose value to fetch is specified
  22087. by its TYPE and its target memory ADDRESS, which is a Scheme
  22088. integer.
  22089. -- Scheme Procedure: value-fetch-lazy! value
  22090. If VALUE is a lazy value ('(value-lazy? value)' is '#t'), then the
  22091. value is fetched from the inferior. Any errors that occur in the
  22092. process will produce a Guile exception.
  22093. If VALUE is not a lazy value, this method has no effect.
  22094. The result of this function is unspecified.
  22095. -- Scheme Procedure: value-print value
  22096. Return the string representation (print form) of '<gdb:value>'
  22097. VALUE.
  22098. 
  22099. File: gdb.info, Node: Arithmetic In Guile, Next: Types In Guile, Prev: Values From Inferior In Guile, Up: Guile API
  22100. 23.3.3.6 Arithmetic In Guile
  22101. ............................
  22102. The '(gdb)' module provides several functions for performing arithmetic
  22103. on '<gdb:value>' objects. The arithmetic is performed as if it were
  22104. done by the target, and therefore has target semantics which are not
  22105. necessarily those of Scheme. For example operations work with a fixed
  22106. precision, not the arbitrary precision of Scheme.
  22107. Wherever a function takes an integer or pointer as an operand, GDB
  22108. will convert appropriate Scheme values to perform the operation.
  22109. -- Scheme Procedure: value-add a b
  22110. -- Scheme Procedure: value-sub a b
  22111. -- Scheme Procedure: value-mul a b
  22112. -- Scheme Procedure: value-div a b
  22113. -- Scheme Procedure: value-rem a b
  22114. -- Scheme Procedure: value-mod a b
  22115. -- Scheme Procedure: value-pow a b
  22116. -- Scheme Procedure: value-not a
  22117. -- Scheme Procedure: value-neg a
  22118. -- Scheme Procedure: value-pos a
  22119. -- Scheme Procedure: value-abs a
  22120. -- Scheme Procedure: value-lsh a b
  22121. -- Scheme Procedure: value-rsh a b
  22122. -- Scheme Procedure: value-min a b
  22123. -- Scheme Procedure: value-max a b
  22124. -- Scheme Procedure: value-lognot a
  22125. -- Scheme Procedure: value-logand a b
  22126. -- Scheme Procedure: value-logior a b
  22127. -- Scheme Procedure: value-logxor a b
  22128. -- Scheme Procedure: value=? a b
  22129. -- Scheme Procedure: value<? a b
  22130. -- Scheme Procedure: value<=? a b
  22131. -- Scheme Procedure: value>? a b
  22132. -- Scheme Procedure: value>=? a b
  22133. Scheme does not provide a 'not-equal' function, and thus Guile
  22134. support in GDB does not either.
  22135. 
  22136. File: gdb.info, Node: Types In Guile, Next: Guile Pretty Printing API, Prev: Arithmetic In Guile, Up: Guile API
  22137. 23.3.3.7 Types In Guile
  22138. .......................
  22139. GDB represents types from the inferior in objects of type '<gdb:type>'.
  22140. The following type-related procedures are provided by the '(gdb)'
  22141. module.
  22142. -- Scheme Procedure: type? object
  22143. Return '#t' if OBJECT is an object of type '<gdb:type>'. Otherwise
  22144. return '#f'.
  22145. -- Scheme Procedure: lookup-type name [#:block block]
  22146. This function looks up a type by its NAME, which must be a string.
  22147. If BLOCK is given, it is an object of type '<gdb:block>', and NAME
  22148. is looked up in that scope. Otherwise, it is searched for
  22149. globally.
  22150. Ordinarily, this function will return an instance of '<gdb:type>'.
  22151. If the named type cannot be found, it will throw an exception.
  22152. -- Scheme Procedure: type-code type
  22153. Return the type code of TYPE. The type code will be one of the
  22154. 'TYPE_CODE_' constants defined below.
  22155. -- Scheme Procedure: type-tag type
  22156. Return the tag name of TYPE. The tag name is the name after
  22157. 'struct', 'union', or 'enum' in C and C++; not all languages have
  22158. this concept. If this type has no tag name, then '#f' is returned.
  22159. -- Scheme Procedure: type-name type
  22160. Return the name of TYPE. If this type has no name, then '#f' is
  22161. returned.
  22162. -- Scheme Procedure: type-print-name type
  22163. Return the print name of TYPE. This returns something even for
  22164. anonymous types. For example, for an anonymous C struct '"struct
  22165. {...}"' is returned.
  22166. -- Scheme Procedure: type-sizeof type
  22167. Return the size of this type, in target 'char' units. Usually, a
  22168. target's 'char' type will be an 8-bit byte. However, on some
  22169. unusual platforms, this type may have a different size.
  22170. -- Scheme Procedure: type-strip-typedefs type
  22171. Return a new '<gdb:type>' that represents the real type of TYPE,
  22172. after removing all layers of typedefs.
  22173. -- Scheme Procedure: type-array type n1 [n2]
  22174. Return a new '<gdb:type>' object which represents an array of this
  22175. type. If one argument is given, it is the inclusive upper bound of
  22176. the array; in this case the lower bound is zero. If two arguments
  22177. are given, the first argument is the lower bound of the array, and
  22178. the second argument is the upper bound of the array. An array's
  22179. length must not be negative, but the bounds can be.
  22180. -- Scheme Procedure: type-vector type n1 [n2]
  22181. Return a new '<gdb:type>' object which represents a vector of this
  22182. type. If one argument is given, it is the inclusive upper bound of
  22183. the vector; in this case the lower bound is zero. If two arguments
  22184. are given, the first argument is the lower bound of the vector, and
  22185. the second argument is the upper bound of the vector. A vector's
  22186. length must not be negative, but the bounds can be.
  22187. The difference between an 'array' and a 'vector' is that arrays
  22188. behave like in C: when used in expressions they decay to a pointer
  22189. to the first element whereas vectors are treated as first class
  22190. values.
  22191. -- Scheme Procedure: type-pointer type
  22192. Return a new '<gdb:type>' object which represents a pointer to
  22193. TYPE.
  22194. -- Scheme Procedure: type-range type
  22195. Return a list of two elements: the low bound and high bound of
  22196. TYPE. If TYPE does not have a range, an exception is thrown.
  22197. -- Scheme Procedure: type-reference type
  22198. Return a new '<gdb:type>' object which represents a reference to
  22199. TYPE.
  22200. -- Scheme Procedure: type-target type
  22201. Return a new '<gdb:type>' object which represents the target type
  22202. of TYPE.
  22203. For a pointer type, the target type is the type of the pointed-to
  22204. object. For an array type (meaning C-like arrays), the target type
  22205. is the type of the elements of the array. For a function or method
  22206. type, the target type is the type of the return value. For a
  22207. complex type, the target type is the type of the elements. For a
  22208. typedef, the target type is the aliased type.
  22209. If the type does not have a target, this method will throw an
  22210. exception.
  22211. -- Scheme Procedure: type-const type
  22212. Return a new '<gdb:type>' object which represents a
  22213. 'const'-qualified variant of TYPE.
  22214. -- Scheme Procedure: type-volatile type
  22215. Return a new '<gdb:type>' object which represents a
  22216. 'volatile'-qualified variant of TYPE.
  22217. -- Scheme Procedure: type-unqualified type
  22218. Return a new '<gdb:type>' object which represents an unqualified
  22219. variant of TYPE. That is, the result is neither 'const' nor
  22220. 'volatile'.
  22221. -- Scheme Procedure: type-num-fields
  22222. Return the number of fields of '<gdb:type>' TYPE.
  22223. -- Scheme Procedure: type-fields type
  22224. Return the fields of TYPE as a list. For structure and union
  22225. types, 'fields' has the usual meaning. Range types have two
  22226. fields, the minimum and maximum values. Enum types have one field
  22227. per enum constant. Function and method types have one field per
  22228. parameter. The base types of C++ classes are also represented as
  22229. fields. If the type has no fields, or does not fit into one of
  22230. these categories, an empty list will be returned. *Note Fields of
  22231. a type in Guile::.
  22232. -- Scheme Procedure: make-field-iterator type
  22233. Return the fields of TYPE as a <gdb:iterator> object. *Note
  22234. Iterators In Guile::.
  22235. -- Scheme Procedure: type-field type field-name
  22236. Return field named FIELD-NAME in TYPE. The result is an object of
  22237. type '<gdb:field>'. *Note Fields of a type in Guile::. If the
  22238. type does not have fields, or FIELD-NAME is not a field of TYPE, an
  22239. exception is thrown.
  22240. For example, if 'some-type' is a '<gdb:type>' instance holding a
  22241. structure type, you can access its 'foo' field with:
  22242. (define bar (type-field some-type "foo"))
  22243. 'bar' will be a '<gdb:field>' object.
  22244. -- Scheme Procedure: type-has-field? type name
  22245. Return '#t' if '<gdb:type>' TYPE has field named NAME. Otherwise
  22246. return '#f'.
  22247. Each type has a code, which indicates what category this type falls
  22248. into. The available type categories are represented by constants
  22249. defined in the '(gdb)' module:
  22250. 'TYPE_CODE_PTR'
  22251. The type is a pointer.
  22252. 'TYPE_CODE_ARRAY'
  22253. The type is an array.
  22254. 'TYPE_CODE_STRUCT'
  22255. The type is a structure.
  22256. 'TYPE_CODE_UNION'
  22257. The type is a union.
  22258. 'TYPE_CODE_ENUM'
  22259. The type is an enum.
  22260. 'TYPE_CODE_FLAGS'
  22261. A bit flags type, used for things such as status registers.
  22262. 'TYPE_CODE_FUNC'
  22263. The type is a function.
  22264. 'TYPE_CODE_INT'
  22265. The type is an integer type.
  22266. 'TYPE_CODE_FLT'
  22267. A floating point type.
  22268. 'TYPE_CODE_VOID'
  22269. The special type 'void'.
  22270. 'TYPE_CODE_SET'
  22271. A Pascal set type.
  22272. 'TYPE_CODE_RANGE'
  22273. A range type, that is, an integer type with bounds.
  22274. 'TYPE_CODE_STRING'
  22275. A string type. Note that this is only used for certain languages
  22276. with language-defined string types; C strings are not represented
  22277. this way.
  22278. 'TYPE_CODE_BITSTRING'
  22279. A string of bits. It is deprecated.
  22280. 'TYPE_CODE_ERROR'
  22281. An unknown or erroneous type.
  22282. 'TYPE_CODE_METHOD'
  22283. A method type, as found in C++.
  22284. 'TYPE_CODE_METHODPTR'
  22285. A pointer-to-member-function.
  22286. 'TYPE_CODE_MEMBERPTR'
  22287. A pointer-to-member.
  22288. 'TYPE_CODE_REF'
  22289. A reference type.
  22290. 'TYPE_CODE_CHAR'
  22291. A character type.
  22292. 'TYPE_CODE_BOOL'
  22293. A boolean type.
  22294. 'TYPE_CODE_COMPLEX'
  22295. A complex float type.
  22296. 'TYPE_CODE_TYPEDEF'
  22297. A typedef to some other type.
  22298. 'TYPE_CODE_NAMESPACE'
  22299. A C++ namespace.
  22300. 'TYPE_CODE_DECFLOAT'
  22301. A decimal floating point type.
  22302. 'TYPE_CODE_INTERNAL_FUNCTION'
  22303. A function internal to GDB. This is the type used to represent
  22304. convenience functions (*note Convenience Funs::).
  22305. Further support for types is provided in the '(gdb types)' Guile
  22306. module (*note Guile Types Module::).
  22307. Each field is represented as an object of type '<gdb:field>'.
  22308. The following field-related procedures are provided by the '(gdb)'
  22309. module:
  22310. -- Scheme Procedure: field? object
  22311. Return '#t' if OBJECT is an object of type '<gdb:field>'.
  22312. Otherwise return '#f'.
  22313. -- Scheme Procedure: field-name field
  22314. Return the name of the field, or '#f' for anonymous fields.
  22315. -- Scheme Procedure: field-type field
  22316. Return the type of the field. This is usually an instance of
  22317. '<gdb:type>', but it can be '#f' in some situations.
  22318. -- Scheme Procedure: field-enumval field
  22319. Return the enum value represented by '<gdb:field>' FIELD.
  22320. -- Scheme Procedure: field-bitpos field
  22321. Return the bit position of '<gdb:field>' FIELD. This attribute is
  22322. not available for 'static' fields (as in C++).
  22323. -- Scheme Procedure: field-bitsize field
  22324. If the field is packed, or is a bitfield, return the size of
  22325. '<gdb:field>' FIELD in bits. Otherwise, zero is returned; in which
  22326. case the field's size is given by its type.
  22327. -- Scheme Procedure: field-artificial? field
  22328. Return '#t' if the field is artificial, usually meaning that it was
  22329. provided by the compiler and not the user. Otherwise return '#f'.
  22330. -- Scheme Procedure: field-base-class? field
  22331. Return '#t' if the field represents a base class of a C++
  22332. structure. Otherwise return '#f'.
  22333. 
  22334. File: gdb.info, Node: Guile Pretty Printing API, Next: Selecting Guile Pretty-Printers, Prev: Types In Guile, Up: Guile API
  22335. 23.3.3.8 Guile Pretty Printing API
  22336. ..................................
  22337. An example output is provided (*note Pretty Printing::).
  22338. A pretty-printer is represented by an object of type
  22339. <gdb:pretty-printer>. Pretty-printer objects are created with
  22340. 'make-pretty-printer'.
  22341. The following pretty-printer-related procedures are provided by the
  22342. '(gdb)' module:
  22343. -- Scheme Procedure: make-pretty-printer name lookup-function
  22344. Return a '<gdb:pretty-printer>' object named NAME.
  22345. LOOKUP-FUNCTION is a function of one parameter: the value to be
  22346. printed. If the value is handled by this pretty-printer, then
  22347. LOOKUP-FUNCTION returns an object of type
  22348. <gdb:pretty-printer-worker> to perform the actual pretty-printing.
  22349. Otherwise LOOKUP-FUNCTION returns '#f'.
  22350. -- Scheme Procedure: pretty-printer? object
  22351. Return '#t' if OBJECT is a '<gdb:pretty-printer>' object.
  22352. Otherwise return '#f'.
  22353. -- Scheme Procedure: pretty-printer-enabled? pretty-printer
  22354. Return '#t' if PRETTY-PRINTER is enabled. Otherwise return '#f'.
  22355. -- Scheme Procedure: set-pretty-printer-enabled! pretty-printer flag
  22356. Set the enabled flag of PRETTY-PRINTER to FLAG. The value returned
  22357. is unspecified.
  22358. -- Scheme Procedure: pretty-printers
  22359. Return the list of global pretty-printers.
  22360. -- Scheme Procedure: set-pretty-printers! pretty-printers
  22361. Set the list of global pretty-printers to PRETTY-PRINTERS. The
  22362. value returned is unspecified.
  22363. -- Scheme Procedure: make-pretty-printer-worker display-hint to-string
  22364. children
  22365. Return an object of type '<gdb:pretty-printer-worker>'.
  22366. This function takes three parameters:
  22367. 'display-hint'
  22368. DISPLAY-HINT provides a hint to GDB or GDB front end via MI to
  22369. change the formatting of the value being printed. The value
  22370. must be a string or '#f' (meaning there is no hint). Several
  22371. values for DISPLAY-HINT are predefined by GDB:
  22372. 'array'
  22373. Indicate that the object being printed is "array-like".
  22374. The CLI uses this to respect parameters such as 'set
  22375. print elements' and 'set print array'.
  22376. 'map'
  22377. Indicate that the object being printed is "map-like", and
  22378. that the children of this value can be assumed to
  22379. alternate between keys and values.
  22380. 'string'
  22381. Indicate that the object being printed is "string-like".
  22382. If the printer's 'to-string' function returns a Guile
  22383. string of some kind, then GDB will call its internal
  22384. language-specific string-printing function to format the
  22385. string. For the CLI this means adding quotation marks,
  22386. possibly escaping some characters, respecting 'set print
  22387. elements', and the like.
  22388. 'to-string'
  22389. TO-STRING is either a function of one parameter, the
  22390. '<gdb:pretty-printer-worker>' object, or '#f'.
  22391. When printing from the CLI, if the 'to-string' method exists,
  22392. then GDB will prepend its result to the values returned by
  22393. 'children'. Exactly how this formatting is done is dependent
  22394. on the display hint, and may change as more hints are added.
  22395. Also, depending on the print settings (*note Print
  22396. Settings::), the CLI may print just the result of 'to-string'
  22397. in a stack trace, omitting the result of 'children'.
  22398. If this method returns a string, it is printed verbatim.
  22399. Otherwise, if this method returns an instance of
  22400. '<gdb:value>', then GDB prints this value. This may result in
  22401. a call to another pretty-printer.
  22402. If instead the method returns a Guile value which is
  22403. convertible to a '<gdb:value>', then GDB performs the
  22404. conversion and prints the resulting value. Again, this may
  22405. result in a call to another pretty-printer. Guile scalars
  22406. (integers, floats, and booleans) and strings are convertible
  22407. to '<gdb:value>'; other types are not.
  22408. Finally, if this method returns '#f' then no further
  22409. operations are peformed in this method and nothing is printed.
  22410. If the result is not one of these types, an exception is
  22411. raised.
  22412. TO-STRING may also be '#f' in which case it is left to
  22413. CHILDREN to print the value.
  22414. 'children'
  22415. CHILDREN is either a function of one parameter, the
  22416. '<gdb:pretty-printer-worker>' object, or '#f'.
  22417. GDB will call this function on a pretty-printer to compute the
  22418. children of the pretty-printer's value.
  22419. This function must return a <gdb:iterator> object. Each item
  22420. returned by the iterator must be a tuple holding two elements.
  22421. The first element is the "name" of the child; the second
  22422. element is the child's value. The value can be any Guile
  22423. object which is convertible to a GDB value.
  22424. If CHILDREN is '#f', GDB will act as though the value has no
  22425. children.
  22426. GDB provides a function which can be used to look up the default
  22427. pretty-printer for a '<gdb:value>':
  22428. -- Scheme Procedure: default-visualizer value
  22429. This function takes a '<gdb:value>' object as an argument. If a
  22430. pretty-printer for this value exists, then it is returned. If no
  22431. such printer exists, then this returns '#f'.
  22432. 
  22433. File: gdb.info, Node: Selecting Guile Pretty-Printers, Next: Writing a Guile Pretty-Printer, Prev: Guile Pretty Printing API, Up: Guile API
  22434. 23.3.3.9 Selecting Guile Pretty-Printers
  22435. ........................................
  22436. There are three sets of pretty-printers that GDB searches:
  22437. * Per-objfile list of pretty-printers (*note Objfiles In Guile::).
  22438. * Per-progspace list of pretty-printers (*note Progspaces In
  22439. Guile::).
  22440. * The global list of pretty-printers (*note Guile Pretty Printing
  22441. API::). These printers are available when debugging any inferior.
  22442. Pretty-printer lookup is done by passing the value to be printed to
  22443. the lookup function of each enabled object in turn. Lookup stops when a
  22444. lookup function returns a non-'#f' value or when the list is exhausted.
  22445. Lookup functions must return either a '<gdb:pretty-printer-worker>'
  22446. object or '#f'. Otherwise an exception is thrown.
  22447. GDB first checks the result of 'objfile-pretty-printers' of each
  22448. '<gdb:objfile>' in the current program space and iteratively calls each
  22449. enabled lookup function in the list for that '<gdb:objfile>' until a
  22450. non-'#f' object is returned. If no pretty-printer is found in the
  22451. objfile lists, GDB then searches the result of
  22452. 'progspace-pretty-printers' of the current program space, calling each
  22453. enabled function until a non-'#f' object is returned. After these lists
  22454. have been exhausted, it tries the global pretty-printers list, obtained
  22455. with 'pretty-printers', again calling each enabled function until a
  22456. non-'#f' object is returned.
  22457. The order in which the objfiles are searched is not specified. For a
  22458. given list, functions are always invoked from the head of the list, and
  22459. iterated over sequentially until the end of the list, or a
  22460. '<gdb:pretty-printer-worker>' object is returned.
  22461. For various reasons a pretty-printer may not work. For example, the
  22462. underlying data structure may have changed and the pretty-printer is out
  22463. of date.
  22464. The consequences of a broken pretty-printer are severe enough that
  22465. GDB provides support for enabling and disabling individual printers.
  22466. For example, if 'print frame-arguments' is on, a backtrace can become
  22467. highly illegible if any argument is printed with a broken printer.
  22468. Pretty-printers are enabled and disabled from Scheme by calling
  22469. 'set-pretty-printer-enabled!'. *Note Guile Pretty Printing API::.
  22470. 
  22471. File: gdb.info, Node: Writing a Guile Pretty-Printer, Next: Commands In Guile, Prev: Selecting Guile Pretty-Printers, Up: Guile API
  22472. 23.3.3.10 Writing a Guile Pretty-Printer
  22473. ........................................
  22474. A pretty-printer consists of two basic parts: a lookup function to
  22475. determine if the type is supported, and the printer itself.
  22476. Here is an example showing how a 'std::string' printer might be
  22477. written. *Note Guile Pretty Printing API::, for details.
  22478. (define (make-my-string-printer value)
  22479. "Print a my::string string"
  22480. (make-pretty-printer-worker
  22481. "string"
  22482. (lambda (printer)
  22483. (value-field value "_data"))
  22484. #f))
  22485. And here is an example showing how a lookup function for the printer
  22486. example above might be written.
  22487. (define (str-lookup-function pretty-printer value)
  22488. (let ((tag (type-tag (value-type value))))
  22489. (and tag
  22490. (string-prefix? "std::string<" tag)
  22491. (make-my-string-printer value))))
  22492. Then to register this printer in the global printer list:
  22493. (append-pretty-printer!
  22494. (make-pretty-printer "my-string" str-lookup-function))
  22495. The example lookup function extracts the value's type, and attempts
  22496. to match it to a type that it can pretty-print. If it is a type the
  22497. printer can pretty-print, it will return a <gdb:pretty-printer-worker>
  22498. object. If not, it returns '#f'.
  22499. We recommend that you put your core pretty-printers into a Guile
  22500. package. If your pretty-printers are for use with a library, we further
  22501. recommend embedding a version number into the package name. This
  22502. practice will enable GDB to load multiple versions of your
  22503. pretty-printers at the same time, because they will have different
  22504. names.
  22505. You should write auto-loaded code (*note Guile Auto-loading::) such
  22506. that it can be evaluated multiple times without changing its meaning.
  22507. An ideal auto-load file will consist solely of 'import's of your printer
  22508. modules, followed by a call to a register pretty-printers with the
  22509. current objfile.
  22510. Taken as a whole, this approach will scale nicely to multiple
  22511. inferiors, each potentially using a different library version.
  22512. Embedding a version number in the Guile package name will ensure that
  22513. GDB is able to load both sets of printers simultaneously. Then, because
  22514. the search for pretty-printers is done by objfile, and because your
  22515. auto-loaded code took care to register your library's printers with a
  22516. specific objfile, GDB will find the correct printers for the specific
  22517. version of the library used by each inferior.
  22518. To continue the 'my::string' example, this code might appear in
  22519. '(my-project my-library v1)':
  22520. (use-modules (gdb))
  22521. (define (register-printers objfile)
  22522. (append-objfile-pretty-printer!
  22523. (make-pretty-printer "my-string" str-lookup-function)))
  22524. And then the corresponding contents of the auto-load file would be:
  22525. (use-modules (gdb) (my-project my-library v1))
  22526. (register-printers (current-objfile))
  22527. The previous example illustrates a basic pretty-printer. There are a
  22528. few things that can be improved on. The printer only handles one type,
  22529. whereas a library typically has several types. One could install a
  22530. lookup function for each desired type in the library, but one could also
  22531. have a single lookup function recognize several types. The latter is
  22532. the conventional way this is handled. If a pretty-printer can handle
  22533. multiple data types, then its "subprinters" are the printers for the
  22534. individual data types.
  22535. The '(gdb printing)' module provides a formal way of solving this
  22536. problem (*note Guile Printing Module::). Here is another example that
  22537. handles multiple types.
  22538. These are the types we are going to pretty-print:
  22539. struct foo { int a, b; };
  22540. struct bar { struct foo x, y; };
  22541. Here are the printers:
  22542. (define (make-foo-printer value)
  22543. "Print a foo object"
  22544. (make-pretty-printer-worker
  22545. "foo"
  22546. (lambda (printer)
  22547. (format #f "a=<~a> b=<~a>"
  22548. (value-field value "a") (value-field value "a")))
  22549. #f))
  22550. (define (make-bar-printer value)
  22551. "Print a bar object"
  22552. (make-pretty-printer-worker
  22553. "foo"
  22554. (lambda (printer)
  22555. (format #f "x=<~a> y=<~a>"
  22556. (value-field value "x") (value-field value "y")))
  22557. #f))
  22558. This example doesn't need a lookup function, that is handled by the
  22559. '(gdb printing)' module. Instead a function is provided to build up the
  22560. object that handles the lookup.
  22561. (use-modules (gdb printing))
  22562. (define (build-pretty-printer)
  22563. (let ((pp (make-pretty-printer-collection "my-library")))
  22564. (pp-collection-add-tag-printer "foo" make-foo-printer)
  22565. (pp-collection-add-tag-printer "bar" make-bar-printer)
  22566. pp))
  22567. And here is the autoload support:
  22568. (use-modules (gdb) (my-library))
  22569. (append-objfile-pretty-printer! (current-objfile) (build-pretty-printer))
  22570. Finally, when this printer is loaded into GDB, here is the
  22571. corresponding output of 'info pretty-printer':
  22572. (gdb) info pretty-printer
  22573. my_library.so:
  22574. my-library
  22575. foo
  22576. bar
  22577. 
  22578. File: gdb.info, Node: Commands In Guile, Next: Parameters In Guile, Prev: Writing a Guile Pretty-Printer, Up: Guile API
  22579. 23.3.3.11 Commands In Guile
  22580. ...........................
  22581. You can implement new GDB CLI commands in Guile. A CLI command object
  22582. is created with the 'make-command' Guile function, and added to GDB with
  22583. the 'register-command!' Guile function. This two-step approach is taken
  22584. to separate out the side-effect of adding the command to GDB from
  22585. 'make-command'.
  22586. There is no support for multi-line commands, that is commands that
  22587. consist of multiple lines and are terminated with 'end'.
  22588. -- Scheme Procedure: (make-command name [#:invoke invoke]
  22589. [#:command-class command-class] [#:completer-class completer]
  22590. [#:prefix? prefix] [#:doc doc-string])
  22591. The argument NAME is the name of the command. If NAME consists of
  22592. multiple words, then the initial words are looked for as prefix
  22593. commands. In this case, if one of the prefix commands does not
  22594. exist, an exception is raised.
  22595. The result is the '<gdb:command>' object representing the command.
  22596. The command is not usable until it has been registered with GDB
  22597. with 'register-command!'.
  22598. The rest of the arguments are optional.
  22599. The argument INVOKE is a procedure of three arguments: SELF, ARGS
  22600. and FROM-TTY. The argument SELF is the '<gdb:command>' object
  22601. representing the command. The argument ARGS is a string
  22602. representing the arguments passed to the command, after leading and
  22603. trailing whitespace has been stripped. The argument FROM-TTY is a
  22604. boolean flag and specifies whether the command should consider
  22605. itself to have been originated from the user invoking it
  22606. interactively. If this function throws an exception, it is turned
  22607. into a GDB 'error' call. Otherwise, the return value is ignored.
  22608. The argument COMMAND-CLASS is one of the 'COMMAND_' constants
  22609. defined below. This argument tells GDB how to categorize the new
  22610. command in the help system. The default is 'COMMAND_NONE'.
  22611. The argument COMPLETER is either '#f', one of the 'COMPLETE_'
  22612. constants defined below, or a procedure, also defined below. This
  22613. argument tells GDB how to perform completion for this command. If
  22614. not provided or if the value is '#f', then no completion is
  22615. performed on the command.
  22616. The argument PREFIX is a boolean flag indicating whether the new
  22617. command is a prefix command; sub-commands of this command may be
  22618. registered.
  22619. The argument DOC-STRING is help text for the new command. If no
  22620. documentation string is provided, the default value "This command
  22621. is not documented." is used.
  22622. -- Scheme Procedure: register-command! command
  22623. Add COMMAND, a '<gdb:command>' object, to GDB's list of commands.
  22624. It is an error to register a command more than once. The result is
  22625. unspecified.
  22626. -- Scheme Procedure: command? object
  22627. Return '#t' if OBJECT is a '<gdb:command>' object. Otherwise
  22628. return '#f'.
  22629. -- Scheme Procedure: dont-repeat
  22630. By default, a GDB command is repeated when the user enters a blank
  22631. line at the command prompt. A command can suppress this behavior
  22632. by invoking the 'dont-repeat' function. This is similar to the
  22633. user command 'dont-repeat', see *note dont-repeat: Define.
  22634. -- Scheme Procedure: string->argv string
  22635. Convert a string to a list of strings split up according to GDB's
  22636. argv parsing rules. It is recommended to use this for consistency.
  22637. Arguments are separated by spaces and may be quoted. Example:
  22638. scheme@(guile-user)> (string->argv "1 2\\ \\\"3 '4 \"5' \"6 '7\"")
  22639. $1 = ("1" "2 \"3" "4 \"5" "6 '7")
  22640. -- Scheme Procedure: throw-user-error message . args
  22641. Throw a 'gdb:user-error' exception. The argument MESSAGE is the
  22642. error message as a format string, like the FMT argument to the
  22643. 'format' Scheme function. *Note (guile)Formatted Output::. The
  22644. argument ARGS is a list of the optional arguments of MESSAGE.
  22645. This is used when the command detects a user error of some kind,
  22646. say a bad command argument.
  22647. (gdb) guile (use-modules (gdb))
  22648. (gdb) guile
  22649. (register-command! (make-command "test-user-error"
  22650. #:command-class COMMAND_OBSCURE
  22651. #:invoke (lambda (self arg from-tty)
  22652. (throw-user-error "Bad argument ~a" arg))))
  22653. end
  22654. (gdb) test-user-error ugh
  22655. ERROR: Bad argument ugh
  22656. -- completer: self text word
  22657. If the COMPLETER option to 'make-command' is a procedure, it takes
  22658. three arguments: SELF which is the '<gdb:command>' object, and TEXT
  22659. and WORD which are both strings. The argument TEXT holds the
  22660. complete command line up to the cursor's location. The argument
  22661. WORD holds the last word of the command line; this is computed
  22662. using a word-breaking heuristic.
  22663. All forms of completion are handled by this function, that is, the
  22664. <TAB> and <M-?> key bindings (*note Completion::), and the
  22665. 'complete' command (*note complete: Help.).
  22666. This procedure can return several kinds of values:
  22667. * If the return value is a list, the contents of the list are
  22668. used as the completions. It is up to COMPLETER to ensure that
  22669. the contents actually do complete the word. An empty list is
  22670. allowed, it means that there were no completions available.
  22671. Only string elements of the list are used; other elements in
  22672. the list are ignored.
  22673. * If the return value is a '<gdb:iterator>' object, it is
  22674. iterated over to obtain the completions. It is up to
  22675. 'completer-procedure' to ensure that the results actually do
  22676. complete the word. Only string elements of the result are
  22677. used; other elements in the sequence are ignored.
  22678. * All other results are treated as though there were no
  22679. available completions.
  22680. When a new command is registered, it will have been declared as a
  22681. member of some general class of commands. This is used to classify
  22682. top-level commands in the on-line help system; note that prefix commands
  22683. are not listed under their own category but rather that of their
  22684. top-level command. The available classifications are represented by
  22685. constants defined in the 'gdb' module:
  22686. 'COMMAND_NONE'
  22687. The command does not belong to any particular class. A command in
  22688. this category will not be displayed in any of the help categories.
  22689. This is the default.
  22690. 'COMMAND_RUNNING'
  22691. The command is related to running the inferior. For example,
  22692. 'start', 'step', and 'continue' are in this category. Type 'help
  22693. running' at the GDB prompt to see a list of commands in this
  22694. category.
  22695. 'COMMAND_DATA'
  22696. The command is related to data or variables. For example, 'call',
  22697. 'find', and 'print' are in this category. Type 'help data' at the
  22698. GDB prompt to see a list of commands in this category.
  22699. 'COMMAND_STACK'
  22700. The command has to do with manipulation of the stack. For example,
  22701. 'backtrace', 'frame', and 'return' are in this category. Type
  22702. 'help stack' at the GDB prompt to see a list of commands in this
  22703. category.
  22704. 'COMMAND_FILES'
  22705. This class is used for file-related commands. For example, 'file',
  22706. 'list' and 'section' are in this category. Type 'help files' at
  22707. the GDB prompt to see a list of commands in this category.
  22708. 'COMMAND_SUPPORT'
  22709. This should be used for "support facilities", generally meaning
  22710. things that are useful to the user when interacting with GDB, but
  22711. not related to the state of the inferior. For example, 'help',
  22712. 'make', and 'shell' are in this category. Type 'help support' at
  22713. the GDB prompt to see a list of commands in this category.
  22714. 'COMMAND_STATUS'
  22715. The command is an 'info'-related command, that is, related to the
  22716. state of GDB itself. For example, 'info', 'macro', and 'show' are
  22717. in this category. Type 'help status' at the GDB prompt to see a
  22718. list of commands in this category.
  22719. 'COMMAND_BREAKPOINTS'
  22720. The command has to do with breakpoints. For example, 'break',
  22721. 'clear', and 'delete' are in this category. Type 'help
  22722. breakpoints' at the GDB prompt to see a list of commands in this
  22723. category.
  22724. 'COMMAND_TRACEPOINTS'
  22725. The command has to do with tracepoints. For example, 'trace',
  22726. 'actions', and 'tfind' are in this category. Type 'help
  22727. tracepoints' at the GDB prompt to see a list of commands in this
  22728. category.
  22729. 'COMMAND_USER'
  22730. The command is a general purpose command for the user, and
  22731. typically does not fit in one of the other categories. Type 'help
  22732. user-defined' at the GDB prompt to see a list of commands in this
  22733. category, as well as the list of gdb macros (*note Sequences::).
  22734. 'COMMAND_OBSCURE'
  22735. The command is only used in unusual circumstances, or is not of
  22736. general interest to users. For example, 'checkpoint', 'fork', and
  22737. 'stop' are in this category. Type 'help obscure' at the GDB prompt
  22738. to see a list of commands in this category.
  22739. 'COMMAND_MAINTENANCE'
  22740. The command is only useful to GDB maintainers. The 'maintenance'
  22741. and 'flushregs' commands are in this category. Type 'help
  22742. internals' at the GDB prompt to see a list of commands in this
  22743. category.
  22744. A new command can use a predefined completion function, either by
  22745. specifying it via an argument at initialization, or by returning it from
  22746. the 'completer' procedure. These predefined completion constants are
  22747. all defined in the 'gdb' module:
  22748. 'COMPLETE_NONE'
  22749. This constant means that no completion should be done.
  22750. 'COMPLETE_FILENAME'
  22751. This constant means that filename completion should be performed.
  22752. 'COMPLETE_LOCATION'
  22753. This constant means that location completion should be done. *Note
  22754. Specify Location::.
  22755. 'COMPLETE_COMMAND'
  22756. This constant means that completion should examine GDB command
  22757. names.
  22758. 'COMPLETE_SYMBOL'
  22759. This constant means that completion should be done using symbol
  22760. names as the source.
  22761. 'COMPLETE_EXPRESSION'
  22762. This constant means that completion should be done on expressions.
  22763. Often this means completing on symbol names, but some language
  22764. parsers also have support for completing on field names.
  22765. The following code snippet shows how a trivial CLI command can be
  22766. implemented in Guile:
  22767. (gdb) guile
  22768. (register-command! (make-command "hello-world"
  22769. #:command-class COMMAND_USER
  22770. #:doc "Greet the whole world."
  22771. #:invoke (lambda (self args from-tty) (display "Hello, World!\n"))))
  22772. end
  22773. (gdb) hello-world
  22774. Hello, World!
  22775. 
  22776. File: gdb.info, Node: Parameters In Guile, Next: Progspaces In Guile, Prev: Commands In Guile, Up: Guile API
  22777. 23.3.3.12 Parameters In Guile
  22778. .............................
  22779. You can implement new GDB "parameters" using Guile (1).
  22780. There are many parameters that already exist and can be set in GDB.
  22781. Two examples are: 'set follow-fork' and 'set charset'. Setting these
  22782. parameters influences certain behavior in GDB. Similarly, you can
  22783. define parameters that can be used to influence behavior in custom Guile
  22784. scripts and commands.
  22785. A new parameter is defined with the 'make-parameter' Guile function,
  22786. and added to GDB with the 'register-parameter!' Guile function. This
  22787. two-step approach is taken to separate out the side-effect of adding the
  22788. parameter to GDB from 'make-parameter'.
  22789. Parameters are exposed to the user via the 'set' and 'show' commands.
  22790. *Note Help::.
  22791. -- Scheme Procedure: (make-parameter name [#:command-class
  22792. command-class] [#:parameter-type parameter-type] [#:enum-list
  22793. enum-list] [#:set-func set-func] [#:show-func show-func]
  22794. [#:doc doc] [#:set-doc set-doc] [#:show-doc show-doc]
  22795. [#:initial-value initial-value])
  22796. The argument NAME is the name of the new parameter. If NAME
  22797. consists of multiple words, then the initial words are looked for
  22798. as prefix parameters. An example of this can be illustrated with
  22799. the 'set print' set of parameters. If NAME is 'print foo', then
  22800. 'print' will be searched as the prefix parameter. In this case the
  22801. parameter can subsequently be accessed in GDB as 'set print foo'.
  22802. If NAME consists of multiple words, and no prefix parameter group
  22803. can be found, an exception is raised.
  22804. The result is the '<gdb:parameter>' object representing the
  22805. parameter. The parameter is not usable until it has been
  22806. registered with GDB with 'register-parameter!'.
  22807. The rest of the arguments are optional.
  22808. The argument COMMAND-CLASS should be one of the 'COMMAND_'
  22809. constants (*note Commands In Guile::). This argument tells GDB how
  22810. to categorize the new parameter in the help system. The default is
  22811. 'COMMAND_NONE'.
  22812. The argument PARAMETER-TYPE should be one of the 'PARAM_' constants
  22813. defined below. This argument tells GDB the type of the new
  22814. parameter; this information is used for input validation and
  22815. completion. The default is 'PARAM_BOOLEAN'.
  22816. If PARAMETER-TYPE is 'PARAM_ENUM', then ENUM-LIST must be a list of
  22817. strings. These strings represent the possible values for the
  22818. parameter.
  22819. If PARAMETER-TYPE is not 'PARAM_ENUM', then the presence of
  22820. ENUM-LIST will cause an exception to be thrown.
  22821. The argument SET-FUNC is a function of one argument: SELF which is
  22822. the '<gdb:parameter>' object representing the parameter. GDB will
  22823. call this function when a PARAMETER's value has been changed via
  22824. the 'set' API (for example, 'set foo off'). The value of the
  22825. parameter has already been set to the new value. This function
  22826. must return a string to be displayed to the user. GDB will add a
  22827. trailing newline if the string is non-empty. GDB generally doesn't
  22828. print anything when a parameter is set, thus typically this
  22829. function should return '""'. A non-empty string result should
  22830. typically be used for displaying warnings and errors.
  22831. The argument SHOW-FUNC is a function of two arguments: SELF which
  22832. is the '<gdb:parameter>' object representing the parameter, and
  22833. SVALUE which is the string representation of the current value.
  22834. GDB will call this function when a PARAMETER's 'show' API has been
  22835. invoked (for example, 'show foo'). This function must return a
  22836. string, and will be displayed to the user. GDB will add a trailing
  22837. newline.
  22838. The argument DOC is the help text for the new parameter. If there
  22839. is no documentation string, a default value is used.
  22840. The argument SET-DOC is the help text for this parameter's 'set'
  22841. command.
  22842. The argument SHOW-DOC is the help text for this parameter's 'show'
  22843. command.
  22844. The argument INITIAL-VALUE specifies the initial value of the
  22845. parameter. If it is a function, it takes one parameter, the
  22846. '<gdb:parameter>' object and its result is used as the initial
  22847. value of the parameter. The initial value must be valid for the
  22848. parameter type, otherwise an exception is thrown.
  22849. -- Scheme Procedure: register-parameter! parameter
  22850. Add PARAMETER, a '<gdb:parameter>' object, to GDB's list of
  22851. parameters. It is an error to register a parameter more than once.
  22852. The result is unspecified.
  22853. -- Scheme Procedure: parameter? object
  22854. Return '#t' if OBJECT is a '<gdb:parameter>' object. Otherwise
  22855. return '#f'.
  22856. -- Scheme Procedure: parameter-value parameter
  22857. Return the value of PARAMETER which may either be a
  22858. '<gdb:parameter>' object or a string naming the parameter.
  22859. -- Scheme Procedure: set-parameter-value! parameter new-value
  22860. Assign PARAMETER the value of NEW-VALUE. The argument PARAMETER
  22861. must be an object of type '<gdb:parameter>'. GDB does validation
  22862. when assignments are made.
  22863. When a new parameter is defined, its type must be specified. The
  22864. available types are represented by constants defined in the 'gdb'
  22865. module:
  22866. 'PARAM_BOOLEAN'
  22867. The value is a plain boolean. The Guile boolean values, '#t' and
  22868. '#f' are the only valid values.
  22869. 'PARAM_AUTO_BOOLEAN'
  22870. The value has three possible states: true, false, and 'auto'. In
  22871. Guile, true and false are represented using boolean constants, and
  22872. 'auto' is represented using '#:auto'.
  22873. 'PARAM_UINTEGER'
  22874. The value is an unsigned integer. The value of 0 should be
  22875. interpreted to mean "unlimited".
  22876. 'PARAM_ZINTEGER'
  22877. The value is an integer.
  22878. 'PARAM_ZUINTEGER'
  22879. The value is an unsigned integer.
  22880. 'PARAM_ZUINTEGER_UNLIMITED'
  22881. The value is an integer in the range '[0, INT_MAX]'. A value of
  22882. '-1' means "unlimited", and other negative numbers are not allowed.
  22883. 'PARAM_STRING'
  22884. The value is a string. When the user modifies the string, any
  22885. escape sequences, such as '\t', '\f', and octal escapes, are
  22886. translated into corresponding characters and encoded into the
  22887. current host charset.
  22888. 'PARAM_STRING_NOESCAPE'
  22889. The value is a string. When the user modifies the string, escapes
  22890. are passed through untranslated.
  22891. 'PARAM_OPTIONAL_FILENAME'
  22892. The value is a either a filename (a string), or '#f'.
  22893. 'PARAM_FILENAME'
  22894. The value is a filename. This is just like
  22895. 'PARAM_STRING_NOESCAPE', but uses file names for completion.
  22896. 'PARAM_ENUM'
  22897. The value is a string, which must be one of a collection of string
  22898. constants provided when the parameter is created.
  22899. ---------- Footnotes ----------
  22900. (1) Note that GDB parameters must not be confused with Guile’s
  22901. parameter objects (*note (guile)Parameters::).
  22902. 
  22903. File: gdb.info, Node: Progspaces In Guile, Next: Objfiles In Guile, Prev: Parameters In Guile, Up: Guile API
  22904. 23.3.3.13 Program Spaces In Guile
  22905. .................................
  22906. A program space, or "progspace", represents a symbolic view of an
  22907. address space. It consists of all of the objfiles of the program.
  22908. *Note Objfiles In Guile::. *Note program spaces: Inferiors and
  22909. Programs, for more details about program spaces.
  22910. Each progspace is represented by an instance of the '<gdb:progspace>'
  22911. smob. *Note GDB Scheme Data Types::.
  22912. The following progspace-related functions are available in the
  22913. '(gdb)' module:
  22914. -- Scheme Procedure: progspace? object
  22915. Return '#t' if OBJECT is a '<gdb:progspace>' object. Otherwise
  22916. return '#f'.
  22917. -- Scheme Procedure: progspace-valid? progspace
  22918. Return '#t' if PROGSPACE is valid, '#f' if not. A
  22919. '<gdb:progspace>' object can become invalid if the program it
  22920. refers to is not loaded in GDB any longer.
  22921. -- Scheme Procedure: current-progspace
  22922. This function returns the program space of the currently selected
  22923. inferior. There is always a current progspace, this never returns
  22924. '#f'. *Note Inferiors and Programs::.
  22925. -- Scheme Procedure: progspaces
  22926. Return a list of all the progspaces currently known to GDB.
  22927. -- Scheme Procedure: progspace-filename progspace
  22928. Return the absolute file name of PROGSPACE as a string. This is
  22929. the name of the file passed as the argument to the 'file' or
  22930. 'symbol-file' commands. If the program space does not have an
  22931. associated file name, then '#f' is returned. This occurs, for
  22932. example, when GDB is started without a program to debug.
  22933. A 'gdb:invalid-object-error' exception is thrown if PROGSPACE is
  22934. invalid.
  22935. -- Scheme Procedure: progspace-objfiles progspace
  22936. Return the list of objfiles of PROGSPACE. The order of objfiles in
  22937. the result is arbitrary. Each element is an object of type
  22938. '<gdb:objfile>'. *Note Objfiles In Guile::.
  22939. A 'gdb:invalid-object-error' exception is thrown if PROGSPACE is
  22940. invalid.
  22941. -- Scheme Procedure: progspace-pretty-printers progspace
  22942. Return the list of pretty-printers of PROGSPACE. Each element is
  22943. an object of type '<gdb:pretty-printer>'. *Note Guile Pretty
  22944. Printing API::, for more information.
  22945. -- Scheme Procedure: set-progspace-pretty-printers! progspace
  22946. printer-list
  22947. Set the list of registered '<gdb:pretty-printer>' objects for
  22948. PROGSPACE to PRINTER-LIST. *Note Guile Pretty Printing API::, for
  22949. more information.
  22950. 
  22951. File: gdb.info, Node: Objfiles In Guile, Next: Frames In Guile, Prev: Progspaces In Guile, Up: Guile API
  22952. 23.3.3.14 Objfiles In Guile
  22953. ...........................
  22954. GDB loads symbols for an inferior from various symbol-containing files
  22955. (*note Files::). These include the primary executable file, any shared
  22956. libraries used by the inferior, and any separate debug info files (*note
  22957. Separate Debug Files::). GDB calls these symbol-containing files
  22958. "objfiles".
  22959. Each objfile is represented as an object of type '<gdb:objfile>'.
  22960. The following objfile-related procedures are provided by the '(gdb)'
  22961. module:
  22962. -- Scheme Procedure: objfile? object
  22963. Return '#t' if OBJECT is a '<gdb:objfile>' object. Otherwise
  22964. return '#f'.
  22965. -- Scheme Procedure: objfile-valid? objfile
  22966. Return '#t' if OBJFILE is valid, '#f' if not. A '<gdb:objfile>'
  22967. object can become invalid if the object file it refers to is not
  22968. loaded in GDB any longer. All other '<gdb:objfile>' procedures
  22969. will throw an exception if it is invalid at the time the procedure
  22970. is called.
  22971. -- Scheme Procedure: objfile-filename objfile
  22972. Return the file name of OBJFILE as a string, with symbolic links
  22973. resolved.
  22974. -- Scheme Procedure: objfile-progspace objfile
  22975. Return the '<gdb:progspace>' that this object file lives in. *Note
  22976. Progspaces In Guile::, for more on progspaces.
  22977. -- Scheme Procedure: objfile-pretty-printers objfile
  22978. Return the list of registered '<gdb:pretty-printer>' objects for
  22979. OBJFILE. *Note Guile Pretty Printing API::, for more information.
  22980. -- Scheme Procedure: set-objfile-pretty-printers! objfile printer-list
  22981. Set the list of registered '<gdb:pretty-printer>' objects for
  22982. OBJFILE to PRINTER-LIST. The PRINTER-LIST must be a list of
  22983. '<gdb:pretty-printer>' objects. *Note Guile Pretty Printing API::,
  22984. for more information.
  22985. -- Scheme Procedure: current-objfile
  22986. When auto-loading a Guile script (*note Guile Auto-loading::), GDB
  22987. sets the "current objfile" to the corresponding objfile. This
  22988. function returns the current objfile. If there is no current
  22989. objfile, this function returns '#f'.
  22990. -- Scheme Procedure: objfiles
  22991. Return a list of all the objfiles in the current program space.
  22992. 
  22993. File: gdb.info, Node: Frames In Guile, Next: Blocks In Guile, Prev: Objfiles In Guile, Up: Guile API
  22994. 23.3.3.15 Accessing inferior stack frames from Guile.
  22995. .....................................................
  22996. When the debugged program stops, GDB is able to analyze its call stack
  22997. (*note Stack frames: Frames.). The '<gdb:frame>' class represents a
  22998. frame in the stack. A '<gdb:frame>' object is only valid while its
  22999. corresponding frame exists in the inferior's stack. If you try to use
  23000. an invalid frame object, GDB will throw a 'gdb:invalid-object' exception
  23001. (*note Guile Exception Handling::).
  23002. Two '<gdb:frame>' objects can be compared for equality with the
  23003. 'equal?' function, like:
  23004. (gdb) guile (equal? (newest-frame) (selected-frame))
  23005. #t
  23006. The following frame-related procedures are provided by the '(gdb)'
  23007. module:
  23008. -- Scheme Procedure: frame? object
  23009. Return '#t' if OBJECT is a '<gdb:frame>' object. Otherwise return
  23010. '#f'.
  23011. -- Scheme Procedure: frame-valid? frame
  23012. Returns '#t' if FRAME is valid, '#f' if not. A frame object can
  23013. become invalid if the frame it refers to doesn't exist anymore in
  23014. the inferior. All '<gdb:frame>' procedures will throw an exception
  23015. if the frame is invalid at the time the procedure is called.
  23016. -- Scheme Procedure: frame-name frame
  23017. Return the function name of FRAME, or '#f' if it can't be obtained.
  23018. -- Scheme Procedure: frame-arch frame
  23019. Return the '<gdb:architecture>' object corresponding to FRAME's
  23020. architecture. *Note Architectures In Guile::.
  23021. -- Scheme Procedure: frame-type frame
  23022. Return the type of FRAME. The value can be one of:
  23023. 'NORMAL_FRAME'
  23024. An ordinary stack frame.
  23025. 'DUMMY_FRAME'
  23026. A fake stack frame that was created by GDB when performing an
  23027. inferior function call.
  23028. 'INLINE_FRAME'
  23029. A frame representing an inlined function. The function was
  23030. inlined into a 'NORMAL_FRAME' that is older than this one.
  23031. 'TAILCALL_FRAME'
  23032. A frame representing a tail call. *Note Tail Call Frames::.
  23033. 'SIGTRAMP_FRAME'
  23034. A signal trampoline frame. This is the frame created by the
  23035. OS when it calls into a signal handler.
  23036. 'ARCH_FRAME'
  23037. A fake stack frame representing a cross-architecture call.
  23038. 'SENTINEL_FRAME'
  23039. This is like 'NORMAL_FRAME', but it is only used for the
  23040. newest frame.
  23041. -- Scheme Procedure: frame-unwind-stop-reason frame
  23042. Return an integer representing the reason why it's not possible to
  23043. find more frames toward the outermost frame. Use
  23044. 'unwind-stop-reason-string' to convert the value returned by this
  23045. function to a string. The value can be one of:
  23046. 'FRAME_UNWIND_NO_REASON'
  23047. No particular reason (older frames should be available).
  23048. 'FRAME_UNWIND_NULL_ID'
  23049. The previous frame's analyzer returns an invalid result.
  23050. 'FRAME_UNWIND_OUTERMOST'
  23051. This frame is the outermost.
  23052. 'FRAME_UNWIND_UNAVAILABLE'
  23053. Cannot unwind further, because that would require knowing the
  23054. values of registers or memory that have not been collected.
  23055. 'FRAME_UNWIND_INNER_ID'
  23056. This frame ID looks like it ought to belong to a NEXT frame,
  23057. but we got it for a PREV frame. Normally, this is a sign of
  23058. unwinder failure. It could also indicate stack corruption.
  23059. 'FRAME_UNWIND_SAME_ID'
  23060. This frame has the same ID as the previous one. That means
  23061. that unwinding further would almost certainly give us another
  23062. frame with exactly the same ID, so break the chain. Normally,
  23063. this is a sign of unwinder failure. It could also indicate
  23064. stack corruption.
  23065. 'FRAME_UNWIND_NO_SAVED_PC'
  23066. The frame unwinder did not find any saved PC, but we needed
  23067. one to unwind further.
  23068. 'FRAME_UNWIND_MEMORY_ERROR'
  23069. The frame unwinder caused an error while trying to access
  23070. memory.
  23071. 'FRAME_UNWIND_FIRST_ERROR'
  23072. Any stop reason greater or equal to this value indicates some
  23073. kind of error. This special value facilitates writing code
  23074. that tests for errors in unwinding in a way that will work
  23075. correctly even if the list of the other values is modified in
  23076. future GDB versions. Using it, you could write:
  23077. (define reason (frame-unwind-stop-readon (selected-frame)))
  23078. (define reason-str (unwind-stop-reason-string reason))
  23079. (if (>= reason FRAME_UNWIND_FIRST_ERROR)
  23080. (format #t "An error occured: ~s\n" reason-str))
  23081. -- Scheme Procedure: frame-pc frame
  23082. Return the frame's resume address.
  23083. -- Scheme Procedure: frame-block frame
  23084. Return the frame's code block as a '<gdb:block>' object. *Note
  23085. Blocks In Guile::.
  23086. -- Scheme Procedure: frame-function frame
  23087. Return the symbol for the function corresponding to this frame as a
  23088. '<gdb:symbol>' object, or '#f' if there isn't one. *Note Symbols
  23089. In Guile::.
  23090. -- Scheme Procedure: frame-older frame
  23091. Return the frame that called FRAME.
  23092. -- Scheme Procedure: frame-newer frame
  23093. Return the frame called by FRAME.
  23094. -- Scheme Procedure: frame-sal frame
  23095. Return the frame's '<gdb:sal>' (symtab and line) object. *Note
  23096. Symbol Tables In Guile::.
  23097. -- Scheme Procedure: frame-read-register frame register
  23098. Return the value of REGISTER in FRAME. REGISTER should be a
  23099. string, like 'pc'.
  23100. -- Scheme Procedure: frame-read-var frame variable [#:block block]
  23101. Return the value of VARIABLE in FRAME. If the optional argument
  23102. BLOCK is provided, search for the variable from that block;
  23103. otherwise start at the frame's current block (which is determined
  23104. by the frame's current program counter). The VARIABLE must be
  23105. given as a string or a '<gdb:symbol>' object, and BLOCK must be a
  23106. '<gdb:block>' object.
  23107. -- Scheme Procedure: frame-select frame
  23108. Set FRAME to be the selected frame. *Note Examining the Stack:
  23109. Stack.
  23110. -- Scheme Procedure: selected-frame
  23111. Return the selected frame object. *Note Selecting a Frame:
  23112. Selection.
  23113. -- Scheme Procedure: newest-frame
  23114. Return the newest frame object for the selected thread.
  23115. -- Scheme Procedure: unwind-stop-reason-string reason
  23116. Return a string explaining the reason why GDB stopped unwinding
  23117. frames, as expressed by the given REASON code (an integer, see the
  23118. 'frame-unwind-stop-reason' procedure above in this section).
  23119. 
  23120. File: gdb.info, Node: Blocks In Guile, Next: Symbols In Guile, Prev: Frames In Guile, Up: Guile API
  23121. 23.3.3.16 Accessing blocks from Guile.
  23122. ......................................
  23123. In GDB, symbols are stored in blocks. A block corresponds roughly to a
  23124. scope in the source code. Blocks are organized hierarchically, and are
  23125. represented individually in Guile as an object of type '<gdb:block>'.
  23126. Blocks rely on debugging information being available.
  23127. A frame has a block. Please see *note Frames In Guile::, for a more
  23128. in-depth discussion of frames.
  23129. The outermost block is known as the "global block". The global block
  23130. typically holds public global variables and functions.
  23131. The block nested just inside the global block is the "static block".
  23132. The static block typically holds file-scoped variables and functions.
  23133. GDB provides a method to get a block's superblock, but there is
  23134. currently no way to examine the sub-blocks of a block, or to iterate
  23135. over all the blocks in a symbol table (*note Symbol Tables In Guile::).
  23136. Here is a short example that should help explain blocks:
  23137. /* This is in the global block. */
  23138. int global;
  23139. /* This is in the static block. */
  23140. static int file_scope;
  23141. /* 'function' is in the global block, and 'argument' is
  23142. in a block nested inside of 'function'. */
  23143. int function (int argument)
  23144. {
  23145. /* 'local' is in a block inside 'function'. It may or may
  23146. not be in the same block as 'argument'. */
  23147. int local;
  23148. {
  23149. /* 'inner' is in a block whose superblock is the one holding
  23150. 'local'. */
  23151. int inner;
  23152. /* If this call is expanded by the compiler, you may see
  23153. a nested block here whose function is 'inline_function'
  23154. and whose superblock is the one holding 'inner'. */
  23155. inline_function ();
  23156. }
  23157. }
  23158. The following block-related procedures are provided by the '(gdb)'
  23159. module:
  23160. -- Scheme Procedure: block? object
  23161. Return '#t' if OBJECT is a '<gdb:block>' object. Otherwise return
  23162. '#f'.
  23163. -- Scheme Procedure: block-valid? block
  23164. Returns '#t' if '<gdb:block>' BLOCK is valid, '#f' if not. A block
  23165. object can become invalid if the block it refers to doesn't exist
  23166. anymore in the inferior. All other '<gdb:block>' methods will
  23167. throw an exception if it is invalid at the time the procedure is
  23168. called. The block's validity is also checked during iteration over
  23169. symbols of the block.
  23170. -- Scheme Procedure: block-start block
  23171. Return the start address of '<gdb:block>' BLOCK.
  23172. -- Scheme Procedure: block-end block
  23173. Return the end address of '<gdb:block>' BLOCK.
  23174. -- Scheme Procedure: block-function block
  23175. Return the name of '<gdb:block>' BLOCK represented as a
  23176. '<gdb:symbol>' object. If the block is not named, then '#f' is
  23177. returned.
  23178. For ordinary function blocks, the superblock is the static block.
  23179. However, you should note that it is possible for a function block
  23180. to have a superblock that is not the static block - for instance
  23181. this happens for an inlined function.
  23182. -- Scheme Procedure: block-superblock block
  23183. Return the block containing '<gdb:block>' BLOCK. If the parent
  23184. block does not exist, then '#f' is returned.
  23185. -- Scheme Procedure: block-global-block block
  23186. Return the global block associated with '<gdb:block>' BLOCK.
  23187. -- Scheme Procedure: block-static-block block
  23188. Return the static block associated with '<gdb:block>' BLOCK.
  23189. -- Scheme Procedure: block-global? block
  23190. Return '#t' if '<gdb:block>' BLOCK is a global block. Otherwise
  23191. return '#f'.
  23192. -- Scheme Procedure: block-static? block
  23193. Return '#t' if '<gdb:block>' BLOCK is a static block. Otherwise
  23194. return '#f'.
  23195. -- Scheme Procedure: block-symbols
  23196. Return a list of all symbols (as <gdb:symbol> objects) in
  23197. '<gdb:block>' BLOCK.
  23198. -- Scheme Procedure: make-block-symbols-iterator block
  23199. Return an object of type '<gdb:iterator>' that will iterate over
  23200. all symbols of the block. Guile programs should not assume that a
  23201. specific block object will always contain a given symbol, since
  23202. changes in GDB features and infrastructure may cause symbols move
  23203. across blocks in a symbol table. *Note Iterators In Guile::.
  23204. -- Scheme Procedure: block-symbols-progress?
  23205. Return #t if the object is a <gdb:block-symbols-progress> object.
  23206. This object would be obtained from the 'progress' element of the
  23207. '<gdb:iterator>' object returned by 'make-block-symbols-iterator'.
  23208. -- Scheme Procedure: lookup-block pc
  23209. Return the innermost '<gdb:block>' containing the given PC value.
  23210. If the block cannot be found for the PC value specified, the
  23211. function will return '#f'.
  23212. 
  23213. File: gdb.info, Node: Symbols In Guile, Next: Symbol Tables In Guile, Prev: Blocks In Guile, Up: Guile API
  23214. 23.3.3.17 Guile representation of Symbols.
  23215. ..........................................
  23216. GDB represents every variable, function and type as an entry in a symbol
  23217. table. *Note Examining the Symbol Table: Symbols. Guile represents
  23218. these symbols in GDB with the '<gdb:symbol>' object.
  23219. The following symbol-related procedures are provided by the '(gdb)'
  23220. module:
  23221. -- Scheme Procedure: symbol? object
  23222. Return '#t' if OBJECT is an object of type '<gdb:symbol>'.
  23223. Otherwise return '#f'.
  23224. -- Scheme Procedure: symbol-valid? symbol
  23225. Return '#t' if the '<gdb:symbol>' object is valid, '#f' if not. A
  23226. '<gdb:symbol>' object can become invalid if the symbol it refers to
  23227. does not exist in GDB any longer. All other '<gdb:symbol>'
  23228. procedures will throw an exception if it is invalid at the time the
  23229. procedure is called.
  23230. -- Scheme Procedure: symbol-type symbol
  23231. Return the type of SYMBOL or '#f' if no type is recorded. The
  23232. result is an object of type '<gdb:type>'. *Note Types In Guile::.
  23233. -- Scheme Procedure: symbol-symtab symbol
  23234. Return the symbol table in which SYMBOL appears. The result is an
  23235. object of type '<gdb:symtab>'. *Note Symbol Tables In Guile::.
  23236. -- Scheme Procedure: symbol-line symbol
  23237. Return the line number in the source code at which SYMBOL was
  23238. defined. This is an integer.
  23239. -- Scheme Procedure: symbol-name symbol
  23240. Return the name of SYMBOL as a string.
  23241. -- Scheme Procedure: symbol-linkage-name symbol
  23242. Return the name of SYMBOL, as used by the linker (i.e., may be
  23243. mangled).
  23244. -- Scheme Procedure: symbol-print-name symbol
  23245. Return the name of SYMBOL in a form suitable for output. This is
  23246. either 'name' or 'linkage_name', depending on whether the user
  23247. asked GDB to display demangled or mangled names.
  23248. -- Scheme Procedure: symbol-addr-class symbol
  23249. Return the address class of the symbol. This classifies how to
  23250. find the value of a symbol. Each address class is a constant
  23251. defined in the '(gdb)' module and described later in this chapter.
  23252. -- Scheme Procedure: symbol-needs-frame? symbol
  23253. Return '#t' if evaluating SYMBOL's value requires a frame (*note
  23254. Frames In Guile::) and '#f' otherwise. Typically, local variables
  23255. will require a frame, but other symbols will not.
  23256. -- Scheme Procedure: symbol-argument? symbol
  23257. Return '#t' if SYMBOL is an argument of a function. Otherwise
  23258. return '#f'.
  23259. -- Scheme Procedure: symbol-constant? symbol
  23260. Return '#t' if SYMBOL is a constant. Otherwise return '#f'.
  23261. -- Scheme Procedure: symbol-function? symbol
  23262. Return '#t' if SYMBOL is a function or a method. Otherwise return
  23263. '#f'.
  23264. -- Scheme Procedure: symbol-variable? symbol
  23265. Return '#t' if SYMBOL is a variable. Otherwise return '#f'.
  23266. -- Scheme Procedure: symbol-value symbol [#:frame frame]
  23267. Compute the value of SYMBOL, as a '<gdb:value>'. For functions,
  23268. this computes the address of the function, cast to the appropriate
  23269. type. If the symbol requires a frame in order to compute its
  23270. value, then FRAME must be given. If FRAME is not given, or if
  23271. FRAME is invalid, then an exception is thrown.
  23272. -- Scheme Procedure: lookup-symbol name [#:block block] [#:domain
  23273. domain]
  23274. This function searches for a symbol by name. The search scope can
  23275. be restricted to the parameters defined in the optional domain and
  23276. block arguments.
  23277. NAME is the name of the symbol. It must be a string. The optional
  23278. BLOCK argument restricts the search to symbols visible in that
  23279. BLOCK. The BLOCK argument must be a '<gdb:block>' object. If
  23280. omitted, the block for the current frame is used. The optional
  23281. DOMAIN argument restricts the search to the domain type. The
  23282. DOMAIN argument must be a domain constant defined in the '(gdb)'
  23283. module and described later in this chapter.
  23284. The result is a list of two elements. The first element is a
  23285. '<gdb:symbol>' object or '#f' if the symbol is not found. If the
  23286. symbol is found, the second element is '#t' if the symbol is a
  23287. field of a method's object (e.g., 'this' in C++), otherwise it is
  23288. '#f'. If the symbol is not found, the second element is '#f'.
  23289. -- Scheme Procedure: lookup-global-symbol name [#:domain domain]
  23290. This function searches for a global symbol by name. The search
  23291. scope can be restricted by the domain argument.
  23292. NAME is the name of the symbol. It must be a string. The optional
  23293. DOMAIN argument restricts the search to the domain type. The
  23294. DOMAIN argument must be a domain constant defined in the '(gdb)'
  23295. module and described later in this chapter.
  23296. The result is a '<gdb:symbol>' object or '#f' if the symbol is not
  23297. found.
  23298. The available domain categories in '<gdb:symbol>' are represented as
  23299. constants in the '(gdb)' module:
  23300. 'SYMBOL_UNDEF_DOMAIN'
  23301. This is used when a domain has not been discovered or none of the
  23302. following domains apply. This usually indicates an error either in
  23303. the symbol information or in GDB's handling of symbols.
  23304. 'SYMBOL_VAR_DOMAIN'
  23305. This domain contains variables, function names, typedef names and
  23306. enum type values.
  23307. 'SYMBOL_STRUCT_DOMAIN'
  23308. This domain holds struct, union and enum type names.
  23309. 'SYMBOL_LABEL_DOMAIN'
  23310. This domain contains names of labels (for gotos).
  23311. 'SYMBOL_VARIABLES_DOMAIN'
  23312. This domain holds a subset of the 'SYMBOLS_VAR_DOMAIN'; it contains
  23313. everything minus functions and types.
  23314. 'SYMBOL_FUNCTIONS_DOMAIN'
  23315. This domain contains all functions.
  23316. 'SYMBOL_TYPES_DOMAIN'
  23317. This domain contains all types.
  23318. The available address class categories in '<gdb:symbol>' are
  23319. represented as constants in the 'gdb' module:
  23320. 'SYMBOL_LOC_UNDEF'
  23321. If this is returned by address class, it indicates an error either
  23322. in the symbol information or in GDB's handling of symbols.
  23323. 'SYMBOL_LOC_CONST'
  23324. Value is constant int.
  23325. 'SYMBOL_LOC_STATIC'
  23326. Value is at a fixed address.
  23327. 'SYMBOL_LOC_REGISTER'
  23328. Value is in a register.
  23329. 'SYMBOL_LOC_ARG'
  23330. Value is an argument. This value is at the offset stored within
  23331. the symbol inside the frame's argument list.
  23332. 'SYMBOL_LOC_REF_ARG'
  23333. Value address is stored in the frame's argument list. Just like
  23334. 'LOC_ARG' except that the value's address is stored at the offset,
  23335. not the value itself.
  23336. 'SYMBOL_LOC_REGPARM_ADDR'
  23337. Value is a specified register. Just like 'LOC_REGISTER' except the
  23338. register holds the address of the argument instead of the argument
  23339. itself.
  23340. 'SYMBOL_LOC_LOCAL'
  23341. Value is a local variable.
  23342. 'SYMBOL_LOC_TYPEDEF'
  23343. Value not used. Symbols in the domain 'SYMBOL_STRUCT_DOMAIN' all
  23344. have this class.
  23345. 'SYMBOL_LOC_BLOCK'
  23346. Value is a block.
  23347. 'SYMBOL_LOC_CONST_BYTES'
  23348. Value is a byte-sequence.
  23349. 'SYMBOL_LOC_UNRESOLVED'
  23350. Value is at a fixed address, but the address of the variable has to
  23351. be determined from the minimal symbol table whenever the variable
  23352. is referenced.
  23353. 'SYMBOL_LOC_OPTIMIZED_OUT'
  23354. The value does not actually exist in the program.
  23355. 'SYMBOL_LOC_COMPUTED'
  23356. The value's address is a computed location.
  23357. 
  23358. File: gdb.info, Node: Symbol Tables In Guile, Next: Breakpoints In Guile, Prev: Symbols In Guile, Up: Guile API
  23359. 23.3.3.18 Symbol table representation in Guile.
  23360. ...............................................
  23361. Access to symbol table data maintained by GDB on the inferior is exposed
  23362. to Guile via two objects: '<gdb:sal>' (symtab-and-line) and
  23363. '<gdb:symtab>'. Symbol table and line data for a frame is returned from
  23364. the 'frame-find-sal' '<gdb:frame>' procedure. *Note Frames In Guile::.
  23365. For more information on GDB's symbol table management, see *note
  23366. Examining the Symbol Table: Symbols.
  23367. The following symtab-related procedures are provided by the '(gdb)'
  23368. module:
  23369. -- Scheme Procedure: symtab? object
  23370. Return '#t' if OBJECT is an object of type '<gdb:symtab>'.
  23371. Otherwise return '#f'.
  23372. -- Scheme Procedure: symtab-valid? symtab
  23373. Return '#t' if the '<gdb:symtab>' object is valid, '#f' if not. A
  23374. '<gdb:symtab>' object becomes invalid when the symbol table it
  23375. refers to no longer exists in GDB. All other '<gdb:symtab>'
  23376. procedures will throw an exception if it is invalid at the time the
  23377. procedure is called.
  23378. -- Scheme Procedure: symtab-filename symtab
  23379. Return the symbol table's source filename.
  23380. -- Scheme Procedure: symtab-fullname symtab
  23381. Return the symbol table's source absolute file name.
  23382. -- Scheme Procedure: symtab-objfile symtab
  23383. Return the symbol table's backing object file. *Note Objfiles In
  23384. Guile::.
  23385. -- Scheme Procedure: symtab-global-block symtab
  23386. Return the global block of the underlying symbol table. *Note
  23387. Blocks In Guile::.
  23388. -- Scheme Procedure: symtab-static-block symtab
  23389. Return the static block of the underlying symbol table. *Note
  23390. Blocks In Guile::.
  23391. The following symtab-and-line-related procedures are provided by the
  23392. '(gdb)' module:
  23393. -- Scheme Procedure: sal? object
  23394. Return '#t' if OBJECT is an object of type '<gdb:sal>'. Otherwise
  23395. return '#f'.
  23396. -- Scheme Procedure: sal-valid? sal
  23397. Return '#t' if SAL is valid, '#f' if not. A '<gdb:sal>' object
  23398. becomes invalid when the Symbol table object it refers to no longer
  23399. exists in GDB. All other '<gdb:sal>' procedures will throw an
  23400. exception if it is invalid at the time the procedure is called.
  23401. -- Scheme Procedure: sal-symtab sal
  23402. Return the symbol table object ('<gdb:symtab>') for SAL.
  23403. -- Scheme Procedure: sal-line sal
  23404. Return the line number for SAL.
  23405. -- Scheme Procedure: sal-pc sal
  23406. Return the start of the address range occupied by code for SAL.
  23407. -- Scheme Procedure: sal-last sal
  23408. Return the end of the address range occupied by code for SAL.
  23409. -- Scheme Procedure: find-pc-line pc
  23410. Return the '<gdb:sal>' object corresponding to the PC value. If an
  23411. invalid value of PC is passed as an argument, then the 'symtab' and
  23412. 'line' attributes of the returned '<gdb:sal>' object will be '#f'
  23413. and 0 respectively.
  23414. 
  23415. File: gdb.info, Node: Breakpoints In Guile, Next: Lazy Strings In Guile, Prev: Symbol Tables In Guile, Up: Guile API
  23416. 23.3.3.19 Manipulating breakpoints using Guile
  23417. ..............................................
  23418. Breakpoints in Guile are represented by objects of type
  23419. '<gdb:breakpoint>'. New breakpoints can be created with the
  23420. 'make-breakpoint' Guile function, and then added to GDB with the
  23421. 'register-breakpoint!' Guile function. This two-step approach is taken
  23422. to separate out the side-effect of adding the breakpoint to GDB from
  23423. 'make-breakpoint'.
  23424. Support is also provided to view and manipulate breakpoints created
  23425. outside of Guile.
  23426. The following breakpoint-related procedures are provided by the
  23427. '(gdb)' module:
  23428. -- Scheme Procedure: make-breakpoint location [#:type type] [#:wp-class
  23429. wp-class] [#:internal internal]
  23430. Create a new breakpoint at LOCATION, a string naming the location
  23431. of the breakpoint, or an expression that defines a watchpoint. The
  23432. contents can be any location recognized by the 'break' command, or
  23433. in the case of a watchpoint, by the 'watch' command.
  23434. The breakpoint is initially marked as 'invalid'. The breakpoint is
  23435. not usable until it has been registered with GDB with
  23436. 'register-breakpoint!', at which point it becomes 'valid'. The
  23437. result is the '<gdb:breakpoint>' object representing the
  23438. breakpoint.
  23439. The optional TYPE denotes the breakpoint to create. This argument
  23440. can be either 'BP_BREAKPOINT' or 'BP_WATCHPOINT', and defaults to
  23441. 'BP_BREAKPOINT'.
  23442. The optional WP-CLASS argument defines the class of watchpoint to
  23443. create, if TYPE is 'BP_WATCHPOINT'. If a watchpoint class is not
  23444. provided, it is assumed to be a 'WP_WRITE' class.
  23445. The optional INTERNAL argument allows the breakpoint to become
  23446. invisible to the user. The breakpoint will neither be reported
  23447. when registered, nor will it be listed in the output from 'info
  23448. breakpoints' (but will be listed with the 'maint info breakpoints'
  23449. command). If an internal flag is not provided, the breakpoint is
  23450. visible (non-internal).
  23451. When a watchpoint is created, GDB will try to create a hardware
  23452. assisted watchpoint. If successful, the type of the watchpoint is
  23453. changed from 'BP_WATCHPOINT' to 'BP_HARDWARE_WATCHPOINT' for
  23454. 'WP_WRITE', 'BP_READ_WATCHPOINT' for 'WP_READ', and
  23455. 'BP_ACCESS_WATCHPOINT' for 'WP_ACCESS'. If not successful, the
  23456. type of the watchpoint is left as 'WP_WATCHPOINT'.
  23457. The available types are represented by constants defined in the
  23458. 'gdb' module:
  23459. 'BP_BREAKPOINT'
  23460. Normal code breakpoint.
  23461. 'BP_WATCHPOINT'
  23462. Watchpoint breakpoint.
  23463. 'BP_HARDWARE_WATCHPOINT'
  23464. Hardware assisted watchpoint. This value cannot be specified
  23465. when creating the breakpoint.
  23466. 'BP_READ_WATCHPOINT'
  23467. Hardware assisted read watchpoint. This value cannot be
  23468. specified when creating the breakpoint.
  23469. 'BP_ACCESS_WATCHPOINT'
  23470. Hardware assisted access watchpoint. This value cannot be
  23471. specified when creating the breakpoint.
  23472. The available watchpoint types represented by constants are defined
  23473. in the '(gdb)' module:
  23474. 'WP_READ'
  23475. Read only watchpoint.
  23476. 'WP_WRITE'
  23477. Write only watchpoint.
  23478. 'WP_ACCESS'
  23479. Read/Write watchpoint.
  23480. -- Scheme Procedure: register-breakpoint! breakpoint
  23481. Add BREAKPOINT, a '<gdb:breakpoint>' object, to GDB's list of
  23482. breakpoints. The breakpoint must have been created with
  23483. 'make-breakpoint'. One cannot register breakpoints that have been
  23484. created outside of Guile. Once a breakpoint is registered it
  23485. becomes 'valid'. It is an error to register an already registered
  23486. breakpoint. The result is unspecified.
  23487. -- Scheme Procedure: delete-breakpoint! breakpoint
  23488. Remove BREAKPOINT from GDB's list of breakpoints. This also
  23489. invalidates the Guile BREAKPOINT object. Any further attempt to
  23490. access the object will throw an exception.
  23491. If BREAKPOINT was created from Guile with 'make-breakpoint' it may
  23492. be re-registered with GDB, in which case the breakpoint becomes
  23493. valid again.
  23494. -- Scheme Procedure: breakpoints
  23495. Return a list of all breakpoints. Each element of the list is a
  23496. '<gdb:breakpoint>' object.
  23497. -- Scheme Procedure: breakpoint? object
  23498. Return '#t' if OBJECT is a '<gdb:breakpoint>' object, and '#f'
  23499. otherwise.
  23500. -- Scheme Procedure: breakpoint-valid? breakpoint
  23501. Return '#t' if BREAKPOINT is valid, '#f' otherwise. Breakpoints
  23502. created with 'make-breakpoint' are marked as invalid until they are
  23503. registered with GDB with 'register-breakpoint!'. A
  23504. '<gdb:breakpoint>' object can become invalid if the user deletes
  23505. the breakpoint. In this case, the object still exists, but the
  23506. underlying breakpoint does not. In the cases of watchpoint scope,
  23507. the watchpoint remains valid even if execution of the inferior
  23508. leaves the scope of that watchpoint.
  23509. -- Scheme Procedure: breakpoint-number breakpoint
  23510. Return the breakpoint's number -- the identifier used by the user
  23511. to manipulate the breakpoint.
  23512. -- Scheme Procedure: breakpoint-type breakpoint
  23513. Return the breakpoint's type -- the identifier used to determine
  23514. the actual breakpoint type or use-case.
  23515. -- Scheme Procedure: breakpoint-visible? breakpoint
  23516. Return '#t' if the breakpoint is visible to the user when hit, or
  23517. when the 'info breakpoints' command is run. Otherwise return '#f'.
  23518. -- Scheme Procedure: breakpoint-location breakpoint
  23519. Return the location of the breakpoint, as specified by the user.
  23520. It is a string. If the breakpoint does not have a location (that
  23521. is, it is a watchpoint) return '#f'.
  23522. -- Scheme Procedure: breakpoint-expression breakpoint
  23523. Return the breakpoint expression, as specified by the user. It is
  23524. a string. If the breakpoint does not have an expression (the
  23525. breakpoint is not a watchpoint) return '#f'.
  23526. -- Scheme Procedure: breakpoint-enabled? breakpoint
  23527. Return '#t' if the breakpoint is enabled, and '#f' otherwise.
  23528. -- Scheme Procedure: set-breakpoint-enabled! breakpoint flag
  23529. Set the enabled state of BREAKPOINT to FLAG. If flag is '#f' it is
  23530. disabled, otherwise it is enabled.
  23531. -- Scheme Procedure: breakpoint-silent? breakpoint
  23532. Return '#t' if the breakpoint is silent, and '#f' otherwise.
  23533. Note that a breakpoint can also be silent if it has commands and
  23534. the first command is 'silent'. This is not reported by the
  23535. 'silent' attribute.
  23536. -- Scheme Procedure: set-breakpoint-silent! breakpoint flag
  23537. Set the silent state of BREAKPOINT to FLAG. If flag is '#f' the
  23538. breakpoint is made silent, otherwise it is made non-silent (or
  23539. noisy).
  23540. -- Scheme Procedure: breakpoint-ignore-count breakpoint
  23541. Return the ignore count for BREAKPOINT.
  23542. -- Scheme Procedure: set-breakpoint-ignore-count! breakpoint count
  23543. Set the ignore count for BREAKPOINT to COUNT.
  23544. -- Scheme Procedure: breakpoint-hit-count breakpoint
  23545. Return hit count of BREAKPOINT.
  23546. -- Scheme Procedure: set-breakpoint-hit-count! breakpoint count
  23547. Set the hit count of BREAKPOINT to COUNT. At present, COUNT must
  23548. be zero.
  23549. -- Scheme Procedure: breakpoint-thread breakpoint
  23550. Return the global-thread-id for thread-specific breakpoint
  23551. BREAKPOINT. Return #f if BREAKPOINT is not thread-specific.
  23552. -- Scheme Procedure: set-breakpoint-thread! breakpoint
  23553. global-thread-id|#f
  23554. Set the thread-id for BREAKPOINT to GLOBAL-THREAD-ID If set to
  23555. '#f', the breakpoint is no longer thread-specific.
  23556. -- Scheme Procedure: breakpoint-task breakpoint
  23557. If the breakpoint is Ada task-specific, return the Ada task id. If
  23558. the breakpoint is not task-specific (or the underlying language is
  23559. not Ada), return '#f'.
  23560. -- Scheme Procedure: set-breakpoint-task! breakpoint task
  23561. Set the Ada task of BREAKPOINT to TASK. If set to '#f', the
  23562. breakpoint is no longer task-specific.
  23563. -- Scheme Procedure: breakpoint-condition breakpoint
  23564. Return the condition of BREAKPOINT, as specified by the user. It
  23565. is a string. If there is no condition, return '#f'.
  23566. -- Scheme Procedure: set-breakpoint-condition! breakpoint condition
  23567. Set the condition of BREAKPOINT to CONDITION, which must be a
  23568. string. If set to '#f' then the breakpoint becomes unconditional.
  23569. -- Scheme Procedure: breakpoint-stop breakpoint
  23570. Return the stop predicate of BREAKPOINT. See
  23571. 'set-breakpoint-stop!' below in this section.
  23572. -- Scheme Procedure: set-breakpoint-stop! breakpoint procedure|#f
  23573. Set the stop predicate of BREAKPOINT. The predicate PROCEDURE
  23574. takes one argument: the <gdb:breakpoint> object. If this predicate
  23575. is set to a procedure then it is invoked whenever the inferior
  23576. reaches this breakpoint. If it returns '#t', or any non-'#f'
  23577. value, then the inferior is stopped, otherwise the inferior will
  23578. continue.
  23579. If there are multiple breakpoints at the same location with a
  23580. 'stop' predicate, each one will be called regardless of the return
  23581. status of the previous. This ensures that all 'stop' predicates
  23582. have a chance to execute at that location. In this scenario if one
  23583. of the methods returns '#t' but the others return '#f', the
  23584. inferior will still be stopped.
  23585. You should not alter the execution state of the inferior (i.e.,
  23586. step, next, etc.), alter the current frame context (i.e., change
  23587. the current active frame), or alter, add or delete any breakpoint.
  23588. As a general rule, you should not alter any data within GDB or the
  23589. inferior at this time.
  23590. Example 'stop' implementation:
  23591. (define (my-stop? bkpt)
  23592. (let ((int-val (parse-and-eval "foo")))
  23593. (value=? int-val 3)))
  23594. (define bkpt (make-breakpoint "main.c:42"))
  23595. (register-breakpoint! bkpt)
  23596. (set-breakpoint-stop! bkpt my-stop?)
  23597. -- Scheme Procedure: breakpoint-commands breakpoint
  23598. Return the commands attached to BREAKPOINT as a string, or '#f' if
  23599. there are none.
  23600. 
  23601. File: gdb.info, Node: Lazy Strings In Guile, Next: Architectures In Guile, Prev: Breakpoints In Guile, Up: Guile API
  23602. 23.3.3.20 Guile representation of lazy strings.
  23603. ...............................................
  23604. A "lazy string" is a string whose contents is not retrieved or encoded
  23605. until it is needed.
  23606. A '<gdb:lazy-string>' is represented in GDB as an 'address' that
  23607. points to a region of memory, an 'encoding' that will be used to encode
  23608. that region of memory, and a 'length' to delimit the region of memory
  23609. that represents the string. The difference between a
  23610. '<gdb:lazy-string>' and a string wrapped within a '<gdb:value>' is that
  23611. a '<gdb:lazy-string>' will be treated differently by GDB when printing.
  23612. A '<gdb:lazy-string>' is retrieved and encoded during printing, while a
  23613. '<gdb:value>' wrapping a string is immediately retrieved and encoded on
  23614. creation.
  23615. The following lazy-string-related procedures are provided by the
  23616. '(gdb)' module:
  23617. -- Scheme Procedure: lazy-string? object
  23618. Return '#t' if OBJECT is an object of type '<gdb:lazy-string>'.
  23619. Otherwise return '#f'.
  23620. -- Scheme Procedure: lazy-string-address lazy-sring
  23621. Return the address of LAZY-STRING.
  23622. -- Scheme Procedure: lazy-string-length lazy-string
  23623. Return the length of LAZY-STRING in characters. If the length is
  23624. -1, then the string will be fetched and encoded up to the first
  23625. null of appropriate width.
  23626. -- Scheme Procedure: lazy-string-encoding lazy-string
  23627. Return the encoding that will be applied to LAZY-STRING when the
  23628. string is printed by GDB. If the encoding is not set, or contains
  23629. an empty string, then GDB will select the most appropriate encoding
  23630. when the string is printed.
  23631. -- Scheme Procedure: lazy-string-type lazy-string
  23632. Return the type that is represented by LAZY-STRING's type. For a
  23633. lazy string this is a pointer or array type. To resolve this to
  23634. the lazy string's character type, use 'type-target-type'. *Note
  23635. Types In Guile::.
  23636. -- Scheme Procedure: lazy-string->value lazy-string
  23637. Convert the '<gdb:lazy-string>' to a '<gdb:value>'. This value
  23638. will point to the string in memory, but will lose all the delayed
  23639. retrieval, encoding and handling that GDB applies to a
  23640. '<gdb:lazy-string>'.
  23641. 
  23642. File: gdb.info, Node: Architectures In Guile, Next: Disassembly In Guile, Prev: Lazy Strings In Guile, Up: Guile API
  23643. 23.3.3.21 Guile representation of architectures
  23644. ...............................................
  23645. GDB uses architecture specific parameters and artifacts in a number of
  23646. its various computations. An architecture is represented by an instance
  23647. of the '<gdb:arch>' class.
  23648. The following architecture-related procedures are provided by the
  23649. '(gdb)' module:
  23650. -- Scheme Procedure: arch? object
  23651. Return '#t' if OBJECT is an object of type '<gdb:arch>'. Otherwise
  23652. return '#f'.
  23653. -- Scheme Procedure: current-arch
  23654. Return the current architecture as a '<gdb:arch>' object.
  23655. -- Scheme Procedure: arch-name arch
  23656. Return the name (string value) of '<gdb:arch>' ARCH.
  23657. -- Scheme Procedure: arch-charset arch
  23658. Return name of target character set of '<gdb:arch>' ARCH.
  23659. -- Scheme Procedure: arch-wide-charset
  23660. Return name of target wide character set of '<gdb:arch>' ARCH.
  23661. Each architecture provides a set of predefined types, obtained by the
  23662. following functions.
  23663. -- Scheme Procedure: arch-void-type arch
  23664. Return the '<gdb:type>' object for a 'void' type of architecture
  23665. ARCH.
  23666. -- Scheme Procedure: arch-char-type arch
  23667. Return the '<gdb:type>' object for a 'char' type of architecture
  23668. ARCH.
  23669. -- Scheme Procedure: arch-short-type arch
  23670. Return the '<gdb:type>' object for a 'short' type of architecture
  23671. ARCH.
  23672. -- Scheme Procedure: arch-int-type arch
  23673. Return the '<gdb:type>' object for an 'int' type of architecture
  23674. ARCH.
  23675. -- Scheme Procedure: arch-long-type arch
  23676. Return the '<gdb:type>' object for a 'long' type of architecture
  23677. ARCH.
  23678. -- Scheme Procedure: arch-schar-type arch
  23679. Return the '<gdb:type>' object for a 'signed char' type of
  23680. architecture ARCH.
  23681. -- Scheme Procedure: arch-uchar-type arch
  23682. Return the '<gdb:type>' object for an 'unsigned char' type of
  23683. architecture ARCH.
  23684. -- Scheme Procedure: arch-ushort-type arch
  23685. Return the '<gdb:type>' object for an 'unsigned short' type of
  23686. architecture ARCH.
  23687. -- Scheme Procedure: arch-uint-type arch
  23688. Return the '<gdb:type>' object for an 'unsigned int' type of
  23689. architecture ARCH.
  23690. -- Scheme Procedure: arch-ulong-type arch
  23691. Return the '<gdb:type>' object for an 'unsigned long' type of
  23692. architecture ARCH.
  23693. -- Scheme Procedure: arch-float-type arch
  23694. Return the '<gdb:type>' object for a 'float' type of architecture
  23695. ARCH.
  23696. -- Scheme Procedure: arch-double-type arch
  23697. Return the '<gdb:type>' object for a 'double' type of architecture
  23698. ARCH.
  23699. -- Scheme Procedure: arch-longdouble-type arch
  23700. Return the '<gdb:type>' object for a 'long double' type of
  23701. architecture ARCH.
  23702. -- Scheme Procedure: arch-bool-type arch
  23703. Return the '<gdb:type>' object for a 'bool' type of architecture
  23704. ARCH.
  23705. -- Scheme Procedure: arch-longlong-type arch
  23706. Return the '<gdb:type>' object for a 'long long' type of
  23707. architecture ARCH.
  23708. -- Scheme Procedure: arch-ulonglong-type arch
  23709. Return the '<gdb:type>' object for an 'unsigned long long' type of
  23710. architecture ARCH.
  23711. -- Scheme Procedure: arch-int8-type arch
  23712. Return the '<gdb:type>' object for an 'int8' type of architecture
  23713. ARCH.
  23714. -- Scheme Procedure: arch-uint8-type arch
  23715. Return the '<gdb:type>' object for a 'uint8' type of architecture
  23716. ARCH.
  23717. -- Scheme Procedure: arch-int16-type arch
  23718. Return the '<gdb:type>' object for an 'int16' type of architecture
  23719. ARCH.
  23720. -- Scheme Procedure: arch-uint16-type arch
  23721. Return the '<gdb:type>' object for a 'uint16' type of architecture
  23722. ARCH.
  23723. -- Scheme Procedure: arch-int32-type arch
  23724. Return the '<gdb:type>' object for an 'int32' type of architecture
  23725. ARCH.
  23726. -- Scheme Procedure: arch-uint32-type arch
  23727. Return the '<gdb:type>' object for a 'uint32' type of architecture
  23728. ARCH.
  23729. -- Scheme Procedure: arch-int64-type arch
  23730. Return the '<gdb:type>' object for an 'int64' type of architecture
  23731. ARCH.
  23732. -- Scheme Procedure: arch-uint64-type arch
  23733. Return the '<gdb:type>' object for a 'uint64' type of architecture
  23734. ARCH.
  23735. Example:
  23736. (gdb) guile (type-name (arch-uchar-type (current-arch)))
  23737. "unsigned char"
  23738. 
  23739. File: gdb.info, Node: Disassembly In Guile, Next: I/O Ports in Guile, Prev: Architectures In Guile, Up: Guile API
  23740. 23.3.3.22 Disassembly In Guile
  23741. ..............................
  23742. The disassembler can be invoked from Scheme code. Furthermore, the
  23743. disassembler can take a Guile port as input, allowing one to disassemble
  23744. from any source, and not just target memory.
  23745. -- Scheme Procedure: arch-disassemble arch start-pc [#:port port]
  23746. [#:offset offset] [#:size size] [#:count count]
  23747. Return a list of disassembled instructions starting from the memory
  23748. address START-PC.
  23749. The optional argument PORT specifies the input port to read bytes
  23750. from. If PORT is '#f' then bytes are read from target memory.
  23751. The optional argument OFFSET specifies the address offset of the
  23752. first byte in PORT. This is useful, for example, when PORT
  23753. specifies a 'bytevector' and you want the bytevector to be
  23754. disassembled as if it came from that address. The START-PC passed
  23755. to the reader for PORT is offset by the same amount.
  23756. Example:
  23757. (gdb) guile (use-modules (rnrs io ports))
  23758. (gdb) guile (define pc (value->integer (parse-and-eval "$pc")))
  23759. (gdb) guile (define mem (open-memory #:start pc))
  23760. (gdb) guile (define bv (get-bytevector-n mem 10))
  23761. (gdb) guile (define bv-port (open-bytevector-input-port bv))
  23762. (gdb) guile (define arch (current-arch))
  23763. (gdb) guile (arch-disassemble arch pc #:port bv-port #:offset pc)
  23764. (((address . 4195516) (asm . "mov $0x4005c8,%edi") (length . 5)))
  23765. The optional arguments SIZE and COUNT determine the number of
  23766. instructions in the returned list. If either SIZE or COUNT is
  23767. specified as zero, then no instructions are disassembled and an
  23768. empty list is returned. If both the optional arguments SIZE and
  23769. COUNT are specified, then a list of at most COUNT disassembled
  23770. instructions whose start address falls in the closed memory address
  23771. interval from START-PC to (START-PC + SIZE - 1) are returned. If
  23772. SIZE is not specified, but COUNT is specified, then COUNT number of
  23773. instructions starting from the address START-PC are returned. If
  23774. COUNT is not specified but SIZE is specified, then all instructions
  23775. whose start address falls in the closed memory address interval
  23776. from START-PC to (START-PC + SIZE - 1) are returned. If neither
  23777. SIZE nor COUNT are specified, then a single instruction at START-PC
  23778. is returned.
  23779. Each element of the returned list is an alist (associative list)
  23780. with the following keys:
  23781. 'address'
  23782. The value corresponding to this key is a Guile integer of the
  23783. memory address of the instruction.
  23784. 'asm'
  23785. The value corresponding to this key is a string value which
  23786. represents the instruction with assembly language mnemonics.
  23787. The assembly language flavor used is the same as that
  23788. specified by the current CLI variable 'disassembly-flavor'.
  23789. *Note Machine Code::.
  23790. 'length'
  23791. The value corresponding to this key is the length of the
  23792. instruction in bytes.
  23793. 
  23794. File: gdb.info, Node: I/O Ports in Guile, Next: Memory Ports in Guile, Prev: Disassembly In Guile, Up: Guile API
  23795. 23.3.3.23 I/O Ports in Guile
  23796. ............................
  23797. -- Scheme Procedure: input-port
  23798. Return GDB's input port as a Guile port object.
  23799. -- Scheme Procedure: output-port
  23800. Return GDB's output port as a Guile port object.
  23801. -- Scheme Procedure: error-port
  23802. Return GDB's error port as a Guile port object.
  23803. -- Scheme Procedure: stdio-port? object
  23804. Return '#t' if OBJECT is a GDB stdio port. Otherwise return '#f'.
  23805. 
  23806. File: gdb.info, Node: Memory Ports in Guile, Next: Iterators In Guile, Prev: I/O Ports in Guile, Up: Guile API
  23807. 23.3.3.24 Memory Ports in Guile
  23808. ...............................
  23809. GDB provides a 'port' interface to target memory. This allows Guile
  23810. code to read/write target memory using Guile's port and bytevector
  23811. functionality. The main routine is 'open-memory' which returns a port
  23812. object. One can then read/write memory using that object.
  23813. -- Scheme Procedure: open-memory [#:mode mode] [#:start address]
  23814. [#:size size]
  23815. Return a port object that can be used for reading and writing
  23816. memory. The port will be open according to MODE, which is the
  23817. standard mode argument to Guile port open routines, except that the
  23818. '"a"' and '"l"' modes are not supported. *Note (guile)File
  23819. Ports::. The '"b"' (binary) character may be present, but is
  23820. ignored: memory ports are binary only. If '"0"' is appended then
  23821. the port is marked as unbuffered. The default is '"r"', read-only
  23822. and buffered.
  23823. The chunk of memory that can be accessed can be bounded. If both
  23824. START and SIZE are unspecified, all of memory can be accessed. If
  23825. only START is specified, all of memory from that point on can be
  23826. accessed. If only SIZE if specified, all memory in the range
  23827. [0,SIZE) can be accessed. If both are specified, all memory in the
  23828. rane [START,START+SIZE) can be accessed.
  23829. -- Scheme Procedure: memory-port?
  23830. Return '#t' if OBJECT is an object of type '<gdb:memory-port>'.
  23831. Otherwise return '#f'.
  23832. -- Scheme Procedure: memory-port-range memory-port
  23833. Return the range of '<gdb:memory-port>' MEMORY-PORT as a list of
  23834. two elements: '(start end)'. The range is START to END inclusive.
  23835. -- Scheme Procedure: memory-port-read-buffer-size memory-port
  23836. Return the size of the read buffer of '<gdb:memory-port>'
  23837. MEMORY-PORT.
  23838. -- Scheme Procedure: set-memory-port-read-buffer-size! memory-port size
  23839. Set the size of the read buffer of '<gdb:memory-port>' MEMORY-PORT
  23840. to SIZE. The result is unspecified.
  23841. -- Scheme Procedure: memory-port-write-buffer-size memory-port
  23842. Return the size of the write buffer of '<gdb:memory-port>'
  23843. MEMORY-PORT.
  23844. -- Scheme Procedure: set-memory-port-write-buffer-size! memory-port
  23845. size
  23846. Set the size of the write buffer of '<gdb:memory-port>' MEMORY-PORT
  23847. to SIZE. The result is unspecified.
  23848. A memory port is closed like any other port, with 'close-port'.
  23849. Combined with Guile's 'bytevectors', memory ports provide a lot of
  23850. utility. For example, to fill a buffer of 10 integers in memory, one
  23851. can do something like the following.
  23852. ;; In the program: int buffer[10];
  23853. (use-modules (rnrs bytevectors))
  23854. (use-modules (rnrs io ports))
  23855. (define addr (parse-and-eval "buffer"))
  23856. (define n 10)
  23857. (define byte-size (* n 4))
  23858. (define mem-port (open-memory #:mode "r+" #:start
  23859. (value->integer addr) #:size byte-size))
  23860. (define byte-vec (make-bytevector byte-size))
  23861. (do ((i 0 (+ i 1)))
  23862. ((>= i n))
  23863. (bytevector-s32-native-set! byte-vec (* i 4) (* i 42)))
  23864. (put-bytevector mem-port byte-vec)
  23865. (close-port mem-port)
  23866. 
  23867. File: gdb.info, Node: Iterators In Guile, Prev: Memory Ports in Guile, Up: Guile API
  23868. 23.3.3.25 Iterators In Guile
  23869. ............................
  23870. A simple iterator facility is provided to allow, for example, iterating
  23871. over the set of program symbols without having to first construct a list
  23872. of all of them. A useful contribution would be to add support for SRFI
  23873. 41 and SRFI 45.
  23874. -- Scheme Procedure: make-iterator object progress next!
  23875. A '<gdb:iterator>' object is constructed with the 'make-iterator'
  23876. procedure. It takes three arguments: the object to be iterated
  23877. over, an object to record the progress of the iteration, and a
  23878. procedure to return the next element in the iteration, or an
  23879. implementation chosen value to denote the end of iteration.
  23880. By convention, end of iteration is marked with
  23881. '(end-of-iteration)', and may be tested with the
  23882. 'end-of-iteration?' predicate. The result of '(end-of-iteration)'
  23883. is chosen so that it is not otherwise used by the '(gdb)' module.
  23884. If you are using '<gdb:iterator>' in your own code it is your
  23885. responsibility to maintain this invariant.
  23886. A trivial example for illustration's sake:
  23887. (use-modules (gdb iterator))
  23888. (define my-list (list 1 2 3))
  23889. (define iter
  23890. (make-iterator my-list my-list
  23891. (lambda (iter)
  23892. (let ((l (iterator-progress iter)))
  23893. (if (eq? l '())
  23894. (end-of-iteration)
  23895. (begin
  23896. (set-iterator-progress! iter (cdr l))
  23897. (car l)))))))
  23898. Here is a slightly more realistic example, which computes a list of
  23899. all the functions in 'my-global-block'.
  23900. (use-modules (gdb iterator))
  23901. (define this-sal (find-pc-line (frame-pc (selected-frame))))
  23902. (define this-symtab (sal-symtab this-sal))
  23903. (define this-global-block (symtab-global-block this-symtab))
  23904. (define syms-iter (make-block-symbols-iterator this-global-block))
  23905. (define functions (iterator-filter symbol-function? syms-iter))
  23906. -- Scheme Procedure: iterator? object
  23907. Return '#t' if OBJECT is a '<gdb:iterator>' object. Otherwise
  23908. return '#f'.
  23909. -- Scheme Procedure: iterator-object iterator
  23910. Return the first argument that was passed to 'make-iterator'. This
  23911. is the object being iterated over.
  23912. -- Scheme Procedure: iterator-progress iterator
  23913. Return the object tracking iteration progress.
  23914. -- Scheme Procedure: set-iterator-progress! iterator new-value
  23915. Set the object tracking iteration progress.
  23916. -- Scheme Procedure: iterator-next! iterator
  23917. Invoke the procedure that was the third argument to
  23918. 'make-iterator', passing it one argument, the '<gdb:iterator>'
  23919. object. The result is either the next element in the iteration, or
  23920. an end marker as implemented by the 'next!' procedure. By
  23921. convention the end marker is the result of '(end-of-iteration)'.
  23922. -- Scheme Procedure: end-of-iteration
  23923. Return the Scheme object that denotes end of iteration.
  23924. -- Scheme Procedure: end-of-iteration? object
  23925. Return '#t' if OBJECT is the end of iteration marker. Otherwise
  23926. return '#f'.
  23927. These functions are provided by the '(gdb iterator)' module to assist
  23928. in using iterators.
  23929. -- Scheme Procedure: make-list-iterator list
  23930. Return a '<gdb:iterator>' object that will iterate over LIST.
  23931. -- Scheme Procedure: iterator->list iterator
  23932. Return the elements pointed to by ITERATOR as a list.
  23933. -- Scheme Procedure: iterator-map proc iterator
  23934. Return the list of objects obtained by applying PROC to the object
  23935. pointed to by ITERATOR and to each subsequent object.
  23936. -- Scheme Procedure: iterator-for-each proc iterator
  23937. Apply PROC to each element pointed to by ITERATOR. The result is
  23938. unspecified.
  23939. -- Scheme Procedure: iterator-filter pred iterator
  23940. Return the list of elements pointed to by ITERATOR that satisfy
  23941. PRED.
  23942. -- Scheme Procedure: iterator-until pred iterator
  23943. Run ITERATOR until the result of '(pred element)' is true and
  23944. return that as the result. Otherwise return '#f'.
  23945. 
  23946. File: gdb.info, Node: Guile Auto-loading, Next: Guile Modules, Prev: Guile API, Up: Guile
  23947. 23.3.4 Guile Auto-loading
  23948. -------------------------
  23949. When a new object file is read (for example, due to the 'file' command,
  23950. or because the inferior has loaded a shared library), GDB will look for
  23951. Guile support scripts in two ways: 'OBJFILE-gdb.scm' and the
  23952. '.debug_gdb_scripts' section. *Note Auto-loading extensions::.
  23953. The auto-loading feature is useful for supplying application-specific
  23954. debugging commands and scripts.
  23955. Auto-loading can be enabled or disabled, and the list of auto-loaded
  23956. scripts can be printed.
  23957. 'set auto-load guile-scripts [on|off]'
  23958. Enable or disable the auto-loading of Guile scripts.
  23959. 'show auto-load guile-scripts'
  23960. Show whether auto-loading of Guile scripts is enabled or disabled.
  23961. 'info auto-load guile-scripts [REGEXP]'
  23962. Print the list of all Guile scripts that GDB auto-loaded.
  23963. Also printed is the list of Guile scripts that were mentioned in
  23964. the '.debug_gdb_scripts' section and were not found. This is
  23965. useful because their names are not printed when GDB tries to load
  23966. them and fails. There may be many of them, and printing an error
  23967. message for each one is problematic.
  23968. If REGEXP is supplied only Guile scripts with matching names are
  23969. printed.
  23970. Example:
  23971. (gdb) info auto-load guile-scripts
  23972. Loaded Script
  23973. Yes scm-section-script.scm
  23974. full name: /tmp/scm-section-script.scm
  23975. No my-foo-pretty-printers.scm
  23976. When reading an auto-loaded file, GDB sets the "current objfile".
  23977. This is available via the 'current-objfile' procedure (*note Objfiles In
  23978. Guile::). This can be useful for registering objfile-specific
  23979. pretty-printers.
  23980. 
  23981. File: gdb.info, Node: Guile Modules, Prev: Guile Auto-loading, Up: Guile
  23982. 23.3.5 Guile Modules
  23983. --------------------
  23984. GDB comes with several modules to assist writing Guile code.
  23985. * Menu:
  23986. * Guile Printing Module:: Building and registering pretty-printers
  23987. * Guile Types Module:: Utilities for working with types
  23988. 
  23989. File: gdb.info, Node: Guile Printing Module, Next: Guile Types Module, Up: Guile Modules
  23990. 23.3.5.1 Guile Printing Module
  23991. ..............................
  23992. This module provides a collection of utilities for working with
  23993. pretty-printers.
  23994. Usage:
  23995. (use-modules (gdb printing))
  23996. -- Scheme Procedure: prepend-pretty-printer! object printer
  23997. Add PRINTER to the front of the list of pretty-printers for OBJECT.
  23998. The OBJECT must either be a '<gdb:objfile>' object, or '#f' in
  23999. which case PRINTER is added to the global list of printers.
  24000. -- Scheme Procecure: append-pretty-printer! object printer
  24001. Add PRINTER to the end of the list of pretty-printers for OBJECT.
  24002. The OBJECT must either be a '<gdb:objfile>' object, or '#f' in
  24003. which case PRINTER is added to the global list of printers.
  24004. 
  24005. File: gdb.info, Node: Guile Types Module, Prev: Guile Printing Module, Up: Guile Modules
  24006. 23.3.5.2 Guile Types Module
  24007. ...........................
  24008. This module provides a collection of utilities for working with
  24009. '<gdb:type>' objects.
  24010. Usage:
  24011. (use-modules (gdb types))
  24012. -- Scheme Procedure: get-basic-type type
  24013. Return TYPE with const and volatile qualifiers stripped, and with
  24014. typedefs and C++ references converted to the underlying type.
  24015. C++ example:
  24016. typedef const int const_int;
  24017. const_int foo (3);
  24018. const_int& foo_ref (foo);
  24019. int main () { return 0; }
  24020. Then in gdb:
  24021. (gdb) start
  24022. (gdb) guile (use-modules (gdb) (gdb types))
  24023. (gdb) guile (define foo-ref (parse-and-eval "foo_ref"))
  24024. (gdb) guile (get-basic-type (value-type foo-ref))
  24025. int
  24026. -- Scheme Procedure: type-has-field-deep? type field
  24027. Return '#t' if TYPE, assumed to be a type with fields (e.g., a
  24028. structure or union), has field FIELD. Otherwise return '#f'. This
  24029. searches baseclasses, whereas 'type-has-field?' does not.
  24030. -- Scheme Procedure: make-enum-hashtable enum-type
  24031. Return a Guile hash table produced from ENUM-TYPE. Elements in the
  24032. hash table are referenced with 'hashq-ref'.
  24033. 
  24034. File: gdb.info, Node: Auto-loading extensions, Next: Multiple Extension Languages, Prev: Guile, Up: Extending GDB
  24035. 23.4 Auto-loading extensions
  24036. ============================
  24037. GDB provides two mechanisms for automatically loading extensions when a
  24038. new object file is read (for example, due to the 'file' command, or
  24039. because the inferior has loaded a shared library): 'OBJFILE-gdb.EXT' and
  24040. the '.debug_gdb_scripts' section of modern file formats like ELF.
  24041. * Menu:
  24042. * objfile-gdb.ext file: objfile-gdbdotext file. The 'OBJFILE-gdb.EXT' file
  24043. * .debug_gdb_scripts section: dotdebug_gdb_scripts section. The '.debug_gdb_scripts' section
  24044. * Which flavor to choose?::
  24045. The auto-loading feature is useful for supplying application-specific
  24046. debugging commands and features.
  24047. Auto-loading can be enabled or disabled, and the list of auto-loaded
  24048. scripts can be printed. See the 'auto-loading' section of each
  24049. extension language for more information. For GDB command files see
  24050. *note Auto-loading sequences::. For Python files see *note Python
  24051. Auto-loading::.
  24052. Note that loading of this script file also requires accordingly
  24053. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  24054. 
  24055. File: gdb.info, Node: objfile-gdbdotext file, Next: dotdebug_gdb_scripts section, Up: Auto-loading extensions
  24056. 23.4.1 The 'OBJFILE-gdb.EXT' file
  24057. ---------------------------------
  24058. When a new object file is read, GDB looks for a file named
  24059. 'OBJFILE-gdb.EXT' (we call it SCRIPT-NAME below), where OBJFILE is the
  24060. object file's name and where EXT is the file extension for the extension
  24061. language:
  24062. 'OBJFILE-gdb.gdb'
  24063. GDB's own command language
  24064. 'OBJFILE-gdb.py'
  24065. Python
  24066. 'OBJFILE-gdb.scm'
  24067. Guile
  24068. SCRIPT-NAME is formed by ensuring that the file name of OBJFILE is
  24069. absolute, following all symlinks, and resolving '.' and '..' components,
  24070. and appending the '-gdb.EXT' suffix. If this file exists and is
  24071. readable, GDB will evaluate it as a script in the specified extension
  24072. language.
  24073. If this file does not exist, then GDB will look for SCRIPT-NAME file
  24074. in all of the directories as specified below.
  24075. Note that loading of these files requires an accordingly configured
  24076. 'auto-load safe-path' (*note Auto-loading safe path::).
  24077. For object files using '.exe' suffix GDB tries to load first the
  24078. scripts normally according to its '.exe' filename. But if no scripts
  24079. are found GDB also tries script filenames matching the object file
  24080. without its '.exe' suffix. This '.exe' stripping is case insensitive
  24081. and it is attempted on any platform. This makes the script filenames
  24082. compatible between Unix and MS-Windows hosts.
  24083. 'set auto-load scripts-directory [DIRECTORIES]'
  24084. Control GDB auto-loaded scripts location. Multiple directory
  24085. entries may be delimited by the host platform path separator in use
  24086. (':' on Unix, ';' on MS-Windows and MS-DOS).
  24087. Each entry here needs to be covered also by the security setting
  24088. 'set auto-load safe-path' (*note set auto-load safe-path::).
  24089. This variable defaults to '$debugdir:$datadir/auto-load'. The
  24090. default 'set auto-load safe-path' value can be also overriden by
  24091. GDB configuration option '--with-auto-load-dir'.
  24092. Any reference to '$debugdir' will get replaced by
  24093. DEBUG-FILE-DIRECTORY value (*note Separate Debug Files::) and any
  24094. reference to '$datadir' will get replaced by DATA-DIRECTORY which
  24095. is determined at GDB startup (*note Data Files::). '$debugdir' and
  24096. '$datadir' must be placed as a directory component -- either alone
  24097. or delimited by '/' or '\' directory separators, depending on the
  24098. host platform.
  24099. The list of directories uses path separator (':' on GNU and Unix
  24100. systems, ';' on MS-Windows and MS-DOS) to separate directories,
  24101. similarly to the 'PATH' environment variable.
  24102. 'show auto-load scripts-directory'
  24103. Show GDB auto-loaded scripts location.
  24104. 'add-auto-load-scripts-directory [DIRECTORIES...]'
  24105. Add an entry (or list of entries) to the list of auto-loaded
  24106. scripts locations. Multiple entries may be delimited by the host
  24107. platform path separator in use.
  24108. GDB does not track which files it has already auto-loaded this way.
  24109. GDB will load the associated script every time the corresponding OBJFILE
  24110. is opened. So your '-gdb.EXT' file should be careful to avoid errors if
  24111. it is evaluated more than once.
  24112. 
  24113. File: gdb.info, Node: dotdebug_gdb_scripts section, Next: Which flavor to choose?, Prev: objfile-gdbdotext file, Up: Auto-loading extensions
  24114. 23.4.2 The '.debug_gdb_scripts' section
  24115. ---------------------------------------
  24116. For systems using file formats like ELF and COFF, when GDB loads a new
  24117. object file it will look for a special section named
  24118. '.debug_gdb_scripts'. If this section exists, its contents is a list of
  24119. null-terminated entries specifying scripts to load. Each entry begins
  24120. with a non-null prefix byte that specifies the kind of entry, typically
  24121. the extension language and whether the script is in a file or inlined in
  24122. '.debug_gdb_scripts'.
  24123. The following entries are supported:
  24124. 'SECTION_SCRIPT_ID_PYTHON_FILE = 1'
  24125. 'SECTION_SCRIPT_ID_SCHEME_FILE = 3'
  24126. 'SECTION_SCRIPT_ID_PYTHON_TEXT = 4'
  24127. 'SECTION_SCRIPT_ID_SCHEME_TEXT = 6'
  24128. 23.4.2.1 Script File Entries
  24129. ............................
  24130. If the entry specifies a file, GDB will look for the file first in the
  24131. current directory and then along the source search path (*note
  24132. Specifying Source Directories: Source Path.), except that '$cdir' is not
  24133. searched, since the compilation directory is not relevant to scripts.
  24134. File entries can be placed in section '.debug_gdb_scripts' with, for
  24135. example, this GCC macro for Python scripts.
  24136. /* Note: The "MS" section flags are to remove duplicates. */
  24137. #define DEFINE_GDB_PY_SCRIPT(script_name) \
  24138. asm("\
  24139. .pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n\
  24140. .byte 1 /* Python */\n\
  24141. .asciz \"" script_name "\"\n\
  24142. .popsection \n\
  24143. ");
  24144. For Guile scripts, replace '.byte 1' with '.byte 3'. Then one can
  24145. reference the macro in a header or source file like this:
  24146. DEFINE_GDB_PY_SCRIPT ("my-app-scripts.py")
  24147. The script name may include directories if desired.
  24148. Note that loading of this script file also requires accordingly
  24149. configured 'auto-load safe-path' (*note Auto-loading safe path::).
  24150. If the macro invocation is put in a header, any application or
  24151. library using this header will get a reference to the specified script,
  24152. and with the use of '"MS"' attributes on the section, the linker will
  24153. remove duplicates.
  24154. 23.4.2.2 Script Text Entries
  24155. ............................
  24156. Script text entries allow to put the executable script in the entry
  24157. itself instead of loading it from a file. The first line of the entry,
  24158. everything after the prefix byte and up to the first newline ('0xa')
  24159. character, is the script name, and must not contain any kind of space
  24160. character, e.g., spaces or tabs. The rest of the entry, up to the
  24161. trailing null byte, is the script to execute in the specified language.
  24162. The name needs to be unique among all script names, as GDB executes each
  24163. script only once based on its name.
  24164. Here is an example from file 'py-section-script.c' in the GDB
  24165. testsuite.
  24166. #include "symcat.h"
  24167. #include "gdb/section-scripts.h"
  24168. asm(
  24169. ".pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n"
  24170. ".byte " XSTRING (SECTION_SCRIPT_ID_PYTHON_TEXT) "\n"
  24171. ".ascii \"gdb.inlined-script\\n\"\n"
  24172. ".ascii \"class test_cmd (gdb.Command):\\n\"\n"
  24173. ".ascii \" def __init__ (self):\\n\"\n"
  24174. ".ascii \" super (test_cmd, self).__init__ ("
  24175. "\\\"test-cmd\\\", gdb.COMMAND_OBSCURE)\\n\"\n"
  24176. ".ascii \" def invoke (self, arg, from_tty):\\n\"\n"
  24177. ".ascii \" print (\\\"test-cmd output, arg = %s\\\" % arg)\\n\"\n"
  24178. ".ascii \"test_cmd ()\\n\"\n"
  24179. ".byte 0\n"
  24180. ".popsection\n"
  24181. );
  24182. Loading of inlined scripts requires a properly configured 'auto-load
  24183. safe-path' (*note Auto-loading safe path::). The path to specify in
  24184. 'auto-load safe-path' is the path of the file containing the
  24185. '.debug_gdb_scripts' section.
  24186. 
  24187. File: gdb.info, Node: Which flavor to choose?, Prev: dotdebug_gdb_scripts section, Up: Auto-loading extensions
  24188. 23.4.3 Which flavor to choose?
  24189. ------------------------------
  24190. Given the multiple ways of auto-loading extensions, it might not always
  24191. be clear which one to choose. This section provides some guidance.
  24192. Benefits of the '-gdb.EXT' way:
  24193. * Can be used with file formats that don't support multiple sections.
  24194. * Ease of finding scripts for public libraries.
  24195. Scripts specified in the '.debug_gdb_scripts' section are searched
  24196. for in the source search path. For publicly installed libraries,
  24197. e.g., 'libstdc++', there typically isn't a source directory in
  24198. which to find the script.
  24199. * Doesn't require source code additions.
  24200. Benefits of the '.debug_gdb_scripts' way:
  24201. * Works with static linking.
  24202. Scripts for libraries done the '-gdb.EXT' way require an objfile to
  24203. trigger their loading. When an application is statically linked
  24204. the only objfile available is the executable, and it is cumbersome
  24205. to attach all the scripts from all the input libraries to the
  24206. executable's '-gdb.EXT' script.
  24207. * Works with classes that are entirely inlined.
  24208. Some classes can be entirely inlined, and thus there may not be an
  24209. associated shared library to attach a '-gdb.EXT' script to.
  24210. * Scripts needn't be copied out of the source tree.
  24211. In some circumstances, apps can be built out of large collections
  24212. of internal libraries, and the build infrastructure necessary to
  24213. install the '-gdb.EXT' scripts in a place where GDB can find them
  24214. is cumbersome. It may be easier to specify the scripts in the
  24215. '.debug_gdb_scripts' section as relative paths, and add a path to
  24216. the top of the source tree to the source search path.
  24217. 
  24218. File: gdb.info, Node: Multiple Extension Languages, Next: Aliases, Prev: Auto-loading extensions, Up: Extending GDB
  24219. 23.5 Multiple Extension Languages
  24220. =================================
  24221. The Guile and Python extension languages do not share any state, and
  24222. generally do not interfere with each other. There are some things to be
  24223. aware of, however.
  24224. 23.5.1 Python comes first
  24225. -------------------------
  24226. Python was GDB's first extension language, and to avoid breaking
  24227. existing behaviour Python comes first. This is generally solved by the
  24228. "first one wins" principle. GDB maintains a list of enabled extension
  24229. languages, and when it makes a call to an extension language, (say to
  24230. pretty-print a value), it tries each in turn until an extension language
  24231. indicates it has performed the request (e.g., has returned the
  24232. pretty-printed form of a value). This extends to errors while
  24233. performing such requests: If an error happens while, for example, trying
  24234. to pretty-print an object then the error is reported and any following
  24235. extension languages are not tried.
  24236. 
  24237. File: gdb.info, Node: Aliases, Prev: Multiple Extension Languages, Up: Extending GDB
  24238. 23.6 Creating new spellings of existing commands
  24239. ================================================
  24240. It is often useful to define alternate spellings of existing commands.
  24241. For example, if a new GDB command defined in Python has a long name to
  24242. type, it is handy to have an abbreviated version of it that involves
  24243. less typing.
  24244. GDB itself uses aliases. For example 's' is an alias of the 'step'
  24245. command even though it is otherwise an ambiguous abbreviation of other
  24246. commands like 'set' and 'show'.
  24247. Aliases are also used to provide shortened or more common versions of
  24248. multi-word commands. For example, GDB provides the 'tty' alias of the
  24249. 'set inferior-tty' command.
  24250. You can define a new alias with the 'alias' command.
  24251. 'alias [-a] [--] ALIAS = COMMAND'
  24252. ALIAS specifies the name of the new alias. Each word of ALIAS must
  24253. consist of letters, numbers, dashes and underscores.
  24254. COMMAND specifies the name of an existing command that is being
  24255. aliased.
  24256. The '-a' option specifies that the new alias is an abbreviation of
  24257. the command. Abbreviations are not shown in command lists displayed by
  24258. the 'help' command.
  24259. The '--' option specifies the end of options, and is useful when
  24260. ALIAS begins with a dash.
  24261. Here is a simple example showing how to make an abbreviation of a
  24262. command so that there is less to type. Suppose you were tired of typing
  24263. 'disas', the current shortest unambiguous abbreviation of the
  24264. 'disassemble' command and you wanted an even shorter version named 'di'.
  24265. The following will accomplish this.
  24266. (gdb) alias -a di = disas
  24267. Note that aliases are different from user-defined commands. With a
  24268. user-defined command, you also need to write documentation for it with
  24269. the 'document' command. An alias automatically picks up the
  24270. documentation of the existing command.
  24271. Here is an example where we make 'elms' an abbreviation of 'elements'
  24272. in the 'set print elements' command. This is to show that you can make
  24273. an abbreviation of any part of a command.
  24274. (gdb) alias -a set print elms = set print elements
  24275. (gdb) alias -a show print elms = show print elements
  24276. (gdb) set p elms 20
  24277. (gdb) show p elms
  24278. Limit on string chars or array elements to print is 200.
  24279. Note that if you are defining an alias of a 'set' command, and you
  24280. want to have an alias for the corresponding 'show' command, then you
  24281. need to define the latter separately.
  24282. Unambiguously abbreviated commands are allowed in COMMAND and ALIAS,
  24283. just as they are normally.
  24284. (gdb) alias -a set pr elms = set p ele
  24285. Finally, here is an example showing the creation of a one word alias
  24286. for a more complex command. This creates alias 'spe' of the command
  24287. 'set print elements'.
  24288. (gdb) alias spe = set print elements
  24289. (gdb) spe 20
  24290. 
  24291. File: gdb.info, Node: Interpreters, Next: TUI, Prev: Extending GDB, Up: Top
  24292. 24 Command Interpreters
  24293. ***********************
  24294. GDB supports multiple command interpreters, and some command
  24295. infrastructure to allow users or user interface writers to switch
  24296. between interpreters or run commands in other interpreters.
  24297. GDB currently supports two command interpreters, the console
  24298. interpreter (sometimes called the command-line interpreter or CLI) and
  24299. the machine interface interpreter (or GDB/MI). This manual describes
  24300. both of these interfaces in great detail.
  24301. By default, GDB will start with the console interpreter. However,
  24302. the user may choose to start GDB with another interpreter by specifying
  24303. the '-i' or '--interpreter' startup options. Defined interpreters
  24304. include:
  24305. 'console'
  24306. The traditional console or command-line interpreter. This is the
  24307. most often used interpreter with GDB. With no interpreter
  24308. specified at runtime, GDB will use this interpreter.
  24309. 'mi'
  24310. The newest GDB/MI interface (currently 'mi2'). Used primarily by
  24311. programs wishing to use GDB as a backend for a debugger GUI or an
  24312. IDE. For more information, see *note The GDB/MI Interface: GDB/MI.
  24313. 'mi2'
  24314. The current GDB/MI interface.
  24315. 'mi1'
  24316. The GDB/MI interface included in GDB 5.1, 5.2, and 5.3.
  24317. You may execute commands in any interpreter from the current
  24318. interpreter using the appropriate command. If you are running the
  24319. console interpreter, simply use the 'interpreter-exec' command:
  24320. interpreter-exec mi "-data-list-register-names"
  24321. GDB/MI has a similar command, although it is only available in
  24322. versions of GDB which support GDB/MI version 2 (or greater).
  24323. Note that 'interpreter-exec' only changes the interpreter for the
  24324. duration of the specified command. It does not change the interpreter
  24325. permanently.
  24326. Although you may only choose a single interpreter at startup, it is
  24327. possible to run an independent interpreter on a specified input/output
  24328. device (usually a tty).
  24329. For example, consider a debugger GUI or IDE that wants to provide a
  24330. GDB console view. It may do so by embedding a terminal emulator widget
  24331. in its GUI, starting GDB in the traditional command-line mode with
  24332. stdin/stdout/stderr redirected to that terminal, and then creating an MI
  24333. interpreter running on a specified input/output device. The console
  24334. interpreter created by GDB at startup handles commands the user types in
  24335. the terminal widget, while the GUI controls and synchronizes state with
  24336. GDB using the separate MI interpreter.
  24337. To start a new secondary "user interface" running MI, use the
  24338. 'new-ui' command:
  24339. new-ui INTERPRETER TTY
  24340. The INTERPRETER parameter specifies the interpreter to run. This
  24341. accepts the same values as the 'interpreter-exec' command. For example,
  24342. 'console', 'mi', 'mi2', etc. The TTY parameter specifies the name of
  24343. the bidirectional file the interpreter uses for input/output, usually
  24344. the name of a pseudoterminal slave on Unix systems. For example:
  24345. (gdb) new-ui mi /dev/pts/9
  24346. runs an MI interpreter on '/dev/pts/9'.
  24347. 
  24348. File: gdb.info, Node: TUI, Next: Emacs, Prev: Interpreters, Up: Top
  24349. 25 GDB Text User Interface
  24350. **************************
  24351. * Menu:
  24352. * TUI Overview:: TUI overview
  24353. * TUI Keys:: TUI key bindings
  24354. * TUI Single Key Mode:: TUI single key mode
  24355. * TUI Commands:: TUI-specific commands
  24356. * TUI Configuration:: TUI configuration variables
  24357. The GDB Text User Interface (TUI) is a terminal interface which uses the
  24358. 'curses' library to show the source file, the assembly output, the
  24359. program registers and GDB commands in separate text windows. The TUI
  24360. mode is supported only on platforms where a suitable version of the
  24361. 'curses' library is available.
  24362. The TUI mode is enabled by default when you invoke GDB as 'gdb -tui'.
  24363. You can also switch in and out of TUI mode while GDB runs by using
  24364. various TUI commands and key bindings, such as 'tui enable' or 'C-x
  24365. C-a'. *Note TUI Commands: TUI Commands, and *note TUI Key Bindings: TUI
  24366. Keys.
  24367. 
  24368. File: gdb.info, Node: TUI Overview, Next: TUI Keys, Up: TUI
  24369. 25.1 TUI Overview
  24370. =================
  24371. In TUI mode, GDB can display several text windows:
  24372. _command_
  24373. This window is the GDB command window with the GDB prompt and the
  24374. GDB output. The GDB input is still managed using readline.
  24375. _source_
  24376. The source window shows the source file of the program. The
  24377. current line and active breakpoints are displayed in this window.
  24378. _assembly_
  24379. The assembly window shows the disassembly output of the program.
  24380. _register_
  24381. This window shows the processor registers. Registers are
  24382. highlighted when their values change.
  24383. The source and assembly windows show the current program position by
  24384. highlighting the current line and marking it with a '>' marker.
  24385. Breakpoints are indicated with two markers. The first marker indicates
  24386. the breakpoint type:
  24387. 'B'
  24388. Breakpoint which was hit at least once.
  24389. 'b'
  24390. Breakpoint which was never hit.
  24391. 'H'
  24392. Hardware breakpoint which was hit at least once.
  24393. 'h'
  24394. Hardware breakpoint which was never hit.
  24395. The second marker indicates whether the breakpoint is enabled or not:
  24396. '+'
  24397. Breakpoint is enabled.
  24398. '-'
  24399. Breakpoint is disabled.
  24400. The source, assembly and register windows are updated when the
  24401. current thread changes, when the frame changes, or when the program
  24402. counter changes.
  24403. These windows are not all visible at the same time. The command
  24404. window is always visible. The others can be arranged in several
  24405. layouts:
  24406. * source only,
  24407. * assembly only,
  24408. * source and assembly,
  24409. * source and registers, or
  24410. * assembly and registers.
  24411. A status line above the command window shows the following
  24412. information:
  24413. _target_
  24414. Indicates the current GDB target. (*note Specifying a Debugging
  24415. Target: Targets.).
  24416. _process_
  24417. Gives the current process or thread number. When no process is
  24418. being debugged, this field is set to 'No process'.
  24419. _function_
  24420. Gives the current function name for the selected frame. The name
  24421. is demangled if demangling is turned on (*note Print Settings::).
  24422. When there is no symbol corresponding to the current program
  24423. counter, the string '??' is displayed.
  24424. _line_
  24425. Indicates the current line number for the selected frame. When the
  24426. current line number is not known, the string '??' is displayed.
  24427. _pc_
  24428. Indicates the current program counter address.
  24429. 
  24430. File: gdb.info, Node: TUI Keys, Next: TUI Single Key Mode, Prev: TUI Overview, Up: TUI
  24431. 25.2 TUI Key Bindings
  24432. =====================
  24433. The TUI installs several key bindings in the readline keymaps (*note
  24434. Command Line Editing::). The following key bindings are installed for
  24435. both TUI mode and the GDB standard mode.
  24436. 'C-x C-a'
  24437. 'C-x a'
  24438. 'C-x A'
  24439. Enter or leave the TUI mode. When leaving the TUI mode, the curses
  24440. window management stops and GDB operates using its standard mode,
  24441. writing on the terminal directly. When reentering the TUI mode,
  24442. control is given back to the curses windows. The screen is then
  24443. refreshed.
  24444. 'C-x 1'
  24445. Use a TUI layout with only one window. The layout will either be
  24446. 'source' or 'assembly'. When the TUI mode is not active, it will
  24447. switch to the TUI mode.
  24448. Think of this key binding as the Emacs 'C-x 1' binding.
  24449. 'C-x 2'
  24450. Use a TUI layout with at least two windows. When the current
  24451. layout already has two windows, the next layout with two windows is
  24452. used. When a new layout is chosen, one window will always be
  24453. common to the previous layout and the new one.
  24454. Think of it as the Emacs 'C-x 2' binding.
  24455. 'C-x o'
  24456. Change the active window. The TUI associates several key bindings
  24457. (like scrolling and arrow keys) with the active window. This
  24458. command gives the focus to the next TUI window.
  24459. Think of it as the Emacs 'C-x o' binding.
  24460. 'C-x s'
  24461. Switch in and out of the TUI SingleKey mode that binds single keys
  24462. to GDB commands (*note TUI Single Key Mode::).
  24463. The following key bindings only work in the TUI mode:
  24464. <PgUp>
  24465. Scroll the active window one page up.
  24466. <PgDn>
  24467. Scroll the active window one page down.
  24468. <Up>
  24469. Scroll the active window one line up.
  24470. <Down>
  24471. Scroll the active window one line down.
  24472. <Left>
  24473. Scroll the active window one column left.
  24474. <Right>
  24475. Scroll the active window one column right.
  24476. 'C-L'
  24477. Refresh the screen.
  24478. Because the arrow keys scroll the active window in the TUI mode, they
  24479. are not available for their normal use by readline unless the command
  24480. window has the focus. When another window is active, you must use other
  24481. readline key bindings such as 'C-p', 'C-n', 'C-b' and 'C-f' to control
  24482. the command window.
  24483. 
  24484. File: gdb.info, Node: TUI Single Key Mode, Next: TUI Commands, Prev: TUI Keys, Up: TUI
  24485. 25.3 TUI Single Key Mode
  24486. ========================
  24487. The TUI also provides a "SingleKey" mode, which binds several frequently
  24488. used GDB commands to single keys. Type 'C-x s' to switch into this
  24489. mode, where the following key bindings are used:
  24490. 'c'
  24491. continue
  24492. 'd'
  24493. down
  24494. 'f'
  24495. finish
  24496. 'n'
  24497. next
  24498. 'o'
  24499. nexti. The shortcut letter 'o' stands for "step Over".
  24500. 'q'
  24501. exit the SingleKey mode.
  24502. 'r'
  24503. run
  24504. 's'
  24505. step
  24506. 'i'
  24507. stepi. The shortcut letter 'i' stands for "step Into".
  24508. 'u'
  24509. up
  24510. 'v'
  24511. info locals
  24512. 'w'
  24513. where
  24514. Other keys temporarily switch to the GDB command prompt. The key
  24515. that was pressed is inserted in the editing buffer so that it is
  24516. possible to type most GDB commands without interaction with the TUI
  24517. SingleKey mode. Once the command is entered the TUI SingleKey mode is
  24518. restored. The only way to permanently leave this mode is by typing 'q'
  24519. or 'C-x s'.
  24520. 
  24521. File: gdb.info, Node: TUI Commands, Next: TUI Configuration, Prev: TUI Single Key Mode, Up: TUI
  24522. 25.4 TUI-specific Commands
  24523. ==========================
  24524. The TUI has specific commands to control the text windows. These
  24525. commands are always available, even when GDB is not in the TUI mode.
  24526. When GDB is in the standard mode, most of these commands will
  24527. automatically switch to the TUI mode.
  24528. Note that if GDB's 'stdout' is not connected to a terminal, or GDB
  24529. has been started with the machine interface interpreter (*note The
  24530. GDB/MI Interface: GDB/MI.), most of these commands will fail with an
  24531. error, because it would not be possible or desirable to enable curses
  24532. window management.
  24533. 'tui enable'
  24534. Activate TUI mode. The last active TUI window layout will be used
  24535. if TUI mode has prevsiouly been used in the current debugging
  24536. session, otherwise a default layout is used.
  24537. 'tui disable'
  24538. Disable TUI mode, returning to the console interpreter.
  24539. 'info win'
  24540. List and give the size of all displayed windows.
  24541. 'layout NAME'
  24542. Changes which TUI windows are displayed. In each layout the
  24543. command window is always displayed, the NAME parameter controls
  24544. which additional windows are displayed, and can be any of the
  24545. following:
  24546. 'next'
  24547. Display the next layout.
  24548. 'prev'
  24549. Display the previous layout.
  24550. 'src'
  24551. Display the source and command windows.
  24552. 'asm'
  24553. Display the assembly and command windows.
  24554. 'split'
  24555. Display the source, assembly, and command windows.
  24556. 'regs'
  24557. When in 'src' layout display the register, source, and command
  24558. windows. When in 'asm' or 'split' layout display the
  24559. register, assembler, and command windows.
  24560. 'focus NAME'
  24561. Changes which TUI window is currently active for scrolling. The
  24562. NAME parameter can be any of the following:
  24563. 'next'
  24564. Make the next window active for scrolling.
  24565. 'prev'
  24566. Make the previous window active for scrolling.
  24567. 'src'
  24568. Make the source window active for scrolling.
  24569. 'asm'
  24570. Make the assembly window active for scrolling.
  24571. 'regs'
  24572. Make the register window active for scrolling.
  24573. 'cmd'
  24574. Make the command window active for scrolling.
  24575. 'refresh'
  24576. Refresh the screen. This is similar to typing 'C-L'.
  24577. 'tui reg GROUP'
  24578. Changes the register group displayed in the tui register window to
  24579. GROUP. If the register window is not currently displayed this
  24580. command will cause the register window to be displayed. The list
  24581. of register groups, as well as their order is target specific. The
  24582. following groups are available on most targets:
  24583. 'next'
  24584. Repeatedly selecting this group will cause the display to
  24585. cycle through all of the available register groups.
  24586. 'prev'
  24587. Repeatedly selecting this group will cause the display to
  24588. cycle through all of the available register groups in the
  24589. reverse order to NEXT.
  24590. 'general'
  24591. Display the general registers.
  24592. 'float'
  24593. Display the floating point registers.
  24594. 'system'
  24595. Display the system registers.
  24596. 'vector'
  24597. Display the vector registers.
  24598. 'all'
  24599. Display all registers.
  24600. 'update'
  24601. Update the source window and the current execution point.
  24602. 'winheight NAME +COUNT'
  24603. 'winheight NAME -COUNT'
  24604. Change the height of the window NAME by COUNT lines. Positive
  24605. counts increase the height, while negative counts decrease it. The
  24606. NAME parameter can be one of 'src' (the source window), 'cmd' (the
  24607. command window), 'asm' (the disassembly window), or 'regs' (the
  24608. register display window).
  24609. 
  24610. File: gdb.info, Node: TUI Configuration, Prev: TUI Commands, Up: TUI
  24611. 25.5 TUI Configuration Variables
  24612. ================================
  24613. Several configuration variables control the appearance of TUI windows.
  24614. 'set tui border-kind KIND'
  24615. Select the border appearance for the source, assembly and register
  24616. windows. The possible values are the following:
  24617. 'space'
  24618. Use a space character to draw the border.
  24619. 'ascii'
  24620. Use ASCII characters '+', '-' and '|' to draw the border.
  24621. 'acs'
  24622. Use the Alternate Character Set to draw the border. The
  24623. border is drawn using character line graphics if the terminal
  24624. supports them.
  24625. 'set tui border-mode MODE'
  24626. 'set tui active-border-mode MODE'
  24627. Select the display attributes for the borders of the inactive
  24628. windows or the active window. The MODE can be one of the
  24629. following:
  24630. 'normal'
  24631. Use normal attributes to display the border.
  24632. 'standout'
  24633. Use standout mode.
  24634. 'reverse'
  24635. Use reverse video mode.
  24636. 'half'
  24637. Use half bright mode.
  24638. 'half-standout'
  24639. Use half bright and standout mode.
  24640. 'bold'
  24641. Use extra bright or bold mode.
  24642. 'bold-standout'
  24643. Use extra bright or bold and standout mode.
  24644. 'set tui tab-width NCHARS'
  24645. Set the width of tab stops to be NCHARS characters. This setting
  24646. affects the display of TAB characters in the source and assembly
  24647. windows.
  24648. 
  24649. File: gdb.info, Node: Emacs, Next: GDB/MI, Prev: TUI, Up: Top
  24650. 26 Using GDB under GNU Emacs
  24651. ****************************
  24652. A special interface allows you to use GNU Emacs to view (and edit) the
  24653. source files for the program you are debugging with GDB.
  24654. To use this interface, use the command 'M-x gdb' in Emacs. Give the
  24655. executable file you want to debug as an argument. This command starts
  24656. GDB as a subprocess of Emacs, with input and output through a newly
  24657. created Emacs buffer.
  24658. Running GDB under Emacs can be just like running GDB normally except
  24659. for two things:
  24660. * All "terminal" input and output goes through an Emacs buffer,
  24661. called the GUD buffer.
  24662. This applies both to GDB commands and their output, and to the
  24663. input and output done by the program you are debugging.
  24664. This is useful because it means that you can copy the text of
  24665. previous commands and input them again; you can even use parts of
  24666. the output in this way.
  24667. All the facilities of Emacs' Shell mode are available for
  24668. interacting with your program. In particular, you can send signals
  24669. the usual way--for example, 'C-c C-c' for an interrupt, 'C-c C-z'
  24670. for a stop.
  24671. * GDB displays source code through Emacs.
  24672. Each time GDB displays a stack frame, Emacs automatically finds the
  24673. source file for that frame and puts an arrow ('=>') at the left
  24674. margin of the current line. Emacs uses a separate buffer for
  24675. source display, and splits the screen to show both your GDB session
  24676. and the source.
  24677. Explicit GDB 'list' or search commands still produce output as
  24678. usual, but you probably have no reason to use them from Emacs.
  24679. We call this "text command mode". Emacs 22.1, and later, also uses a
  24680. graphical mode, enabled by default, which provides further buffers that
  24681. can control the execution and describe the state of your program. *Note
  24682. (Emacs)GDB Graphical Interface::.
  24683. If you specify an absolute file name when prompted for the 'M-x gdb'
  24684. argument, then Emacs sets your current working directory to where your
  24685. program resides. If you only specify the file name, then Emacs sets
  24686. your current working directory to the directory associated with the
  24687. previous buffer. In this case, GDB may find your program by searching
  24688. your environment's 'PATH' variable, but on some operating systems it
  24689. might not find the source. So, although the GDB input and output
  24690. session proceeds normally, the auxiliary buffer does not display the
  24691. current source and line of execution.
  24692. The initial working directory of GDB is printed on the top line of
  24693. the GUD buffer and this serves as a default for the commands that
  24694. specify files for GDB to operate on. *Note Commands to Specify Files:
  24695. Files.
  24696. By default, 'M-x gdb' calls the program called 'gdb'. If you need to
  24697. call GDB by a different name (for example, if you keep several
  24698. configurations around, with different names) you can customize the Emacs
  24699. variable 'gud-gdb-command-name' to run the one you want.
  24700. In the GUD buffer, you can use these special Emacs commands in
  24701. addition to the standard Shell mode commands:
  24702. 'C-h m'
  24703. Describe the features of Emacs' GUD Mode.
  24704. 'C-c C-s'
  24705. Execute to another source line, like the GDB 'step' command; also
  24706. update the display window to show the current file and location.
  24707. 'C-c C-n'
  24708. Execute to next source line in this function, skipping all function
  24709. calls, like the GDB 'next' command. Then update the display window
  24710. to show the current file and location.
  24711. 'C-c C-i'
  24712. Execute one instruction, like the GDB 'stepi' command; update
  24713. display window accordingly.
  24714. 'C-c C-f'
  24715. Execute until exit from the selected stack frame, like the GDB
  24716. 'finish' command.
  24717. 'C-c C-r'
  24718. Continue execution of your program, like the GDB 'continue'
  24719. command.
  24720. 'C-c <'
  24721. Go up the number of frames indicated by the numeric argument (*note
  24722. Numeric Arguments: (Emacs)Arguments.), like the GDB 'up' command.
  24723. 'C-c >'
  24724. Go down the number of frames indicated by the numeric argument,
  24725. like the GDB 'down' command.
  24726. In any source file, the Emacs command 'C-x <SPC>' ('gud-break') tells
  24727. GDB to set a breakpoint on the source line point is on.
  24728. In text command mode, if you type 'M-x speedbar', Emacs displays a
  24729. separate frame which shows a backtrace when the GUD buffer is current.
  24730. Move point to any frame in the stack and type <RET> to make it become
  24731. the current frame and display the associated source in the source
  24732. buffer. Alternatively, click 'Mouse-2' to make the selected frame
  24733. become the current one. In graphical mode, the speedbar displays watch
  24734. expressions.
  24735. If you accidentally delete the source-display buffer, an easy way to
  24736. get it back is to type the command 'f' in the GDB buffer, to request a
  24737. frame display; when you run under Emacs, this recreates the source
  24738. buffer if necessary to show you the context of the current frame.
  24739. The source files displayed in Emacs are in ordinary Emacs buffers
  24740. which are visiting the source files in the usual way. You can edit the
  24741. files with these buffers if you wish; but keep in mind that GDB
  24742. communicates with Emacs in terms of line numbers. If you add or delete
  24743. lines from the text, the line numbers that GDB knows cease to correspond
  24744. properly with the code.
  24745. A more detailed description of Emacs' interaction with GDB is given
  24746. in the Emacs manual (*note (Emacs)Debuggers::).
  24747. 
  24748. File: gdb.info, Node: GDB/MI, Next: Annotations, Prev: Emacs, Up: Top
  24749. 27 The GDB/MI Interface
  24750. ***********************
  24751. Function and Purpose
  24752. ====================
  24753. GDB/MI is a line based machine oriented text interface to GDB and is
  24754. activated by specifying using the '--interpreter' command line option
  24755. (*note Mode Options::). It is specifically intended to support the
  24756. development of systems which use the debugger as just one small
  24757. component of a larger system.
  24758. This chapter is a specification of the GDB/MI interface. It is
  24759. written in the form of a reference manual.
  24760. Note that GDB/MI is still under construction, so some of the features
  24761. described below are incomplete and subject to change (*note GDB/MI
  24762. Development and Front Ends: GDB/MI Development and Front Ends.).
  24763. Notation and Terminology
  24764. ========================
  24765. This chapter uses the following notation:
  24766. * '|' separates two alternatives.
  24767. * '[ SOMETHING ]' indicates that SOMETHING is optional: it may or may
  24768. not be given.
  24769. * '( GROUP )*' means that GROUP inside the parentheses may repeat
  24770. zero or more times.
  24771. * '( GROUP )+' means that GROUP inside the parentheses may repeat one
  24772. or more times.
  24773. * '"STRING"' means a literal STRING.
  24774. * Menu:
  24775. * GDB/MI General Design::
  24776. * GDB/MI Command Syntax::
  24777. * GDB/MI Compatibility with CLI::
  24778. * GDB/MI Development and Front Ends::
  24779. * GDB/MI Output Records::
  24780. * GDB/MI Simple Examples::
  24781. * GDB/MI Command Description Format::
  24782. * GDB/MI Breakpoint Commands::
  24783. * GDB/MI Catchpoint Commands::
  24784. * GDB/MI Program Context::
  24785. * GDB/MI Thread Commands::
  24786. * GDB/MI Ada Tasking Commands::
  24787. * GDB/MI Program Execution::
  24788. * GDB/MI Stack Manipulation::
  24789. * GDB/MI Variable Objects::
  24790. * GDB/MI Data Manipulation::
  24791. * GDB/MI Tracepoint Commands::
  24792. * GDB/MI Symbol Query::
  24793. * GDB/MI File Commands::
  24794. * GDB/MI Target Manipulation::
  24795. * GDB/MI File Transfer Commands::
  24796. * GDB/MI Ada Exceptions Commands::
  24797. * GDB/MI Support Commands::
  24798. * GDB/MI Miscellaneous Commands::
  24799. 
  24800. File: gdb.info, Node: GDB/MI General Design, Next: GDB/MI Command Syntax, Up: GDB/MI
  24801. 27.1 GDB/MI General Design
  24802. ==========================
  24803. Interaction of a GDB/MI frontend with GDB involves three parts--commands
  24804. sent to GDB, responses to those commands and notifications. Each
  24805. command results in exactly one response, indicating either successful
  24806. completion of the command, or an error. For the commands that do not
  24807. resume the target, the response contains the requested information. For
  24808. the commands that resume the target, the response only indicates whether
  24809. the target was successfully resumed. Notifications is the mechanism for
  24810. reporting changes in the state of the target, or in GDB state, that
  24811. cannot conveniently be associated with a command and reported as part of
  24812. that command response.
  24813. The important examples of notifications are:
  24814. * Exec notifications. These are used to report changes in target
  24815. state--when a target is resumed, or stopped. It would not be
  24816. feasible to include this information in response of resuming
  24817. commands, because one resume commands can result in multiple events
  24818. in different threads. Also, quite some time may pass before any
  24819. event happens in the target, while a frontend needs to know whether
  24820. the resuming command itself was successfully executed.
  24821. * Console output, and status notifications. Console output
  24822. notifications are used to report output of CLI commands, as well as
  24823. diagnostics for other commands. Status notifications are used to
  24824. report the progress of a long-running operation. Naturally,
  24825. including this information in command response would mean no output
  24826. is produced until the command is finished, which is undesirable.
  24827. * General notifications. Commands may have various side effects on
  24828. the GDB or target state beyond their official purpose. For
  24829. example, a command may change the selected thread. Although such
  24830. changes can be included in command response, using notification
  24831. allows for more orthogonal frontend design.
  24832. There's no guarantee that whenever an MI command reports an error,
  24833. GDB or the target are in any specific state, and especially, the state
  24834. is not reverted to the state before the MI command was processed.
  24835. Therefore, whenever an MI command results in an error, we recommend that
  24836. the frontend refreshes all the information shown in the user interface.
  24837. * Menu:
  24838. * Context management::
  24839. * Asynchronous and non-stop modes::
  24840. * Thread groups::
  24841. 
  24842. File: gdb.info, Node: Context management, Next: Asynchronous and non-stop modes, Up: GDB/MI General Design
  24843. 27.1.1 Context management
  24844. -------------------------
  24845. 27.1.1.1 Threads and Frames
  24846. ...........................
  24847. In most cases when GDB accesses the target, this access is done in
  24848. context of a specific thread and frame (*note Frames::). Often, even
  24849. when accessing global data, the target requires that a thread be
  24850. specified. The CLI interface maintains the selected thread and frame,
  24851. and supplies them to target on each command. This is convenient,
  24852. because a command line user would not want to specify that information
  24853. explicitly on each command, and because user interacts with GDB via a
  24854. single terminal, so no confusion is possible as to what thread and frame
  24855. are the current ones.
  24856. In the case of MI, the concept of selected thread and frame is less
  24857. useful. First, a frontend can easily remember this information itself.
  24858. Second, a graphical frontend can have more than one window, each one
  24859. used for debugging a different thread, and the frontend might want to
  24860. access additional threads for internal purposes. This increases the
  24861. risk that by relying on implicitly selected thread, the frontend may be
  24862. operating on a wrong one. Therefore, each MI command should explicitly
  24863. specify which thread and frame to operate on. To make it possible, each
  24864. MI command accepts the '--thread' and '--frame' options, the value to
  24865. each is GDB global identifier for thread and frame to operate on.
  24866. Usually, each top-level window in a frontend allows the user to
  24867. select a thread and a frame, and remembers the user selection for
  24868. further operations. However, in some cases GDB may suggest that the
  24869. current thread or frame be changed. For example, when stopping on a
  24870. breakpoint it is reasonable to switch to the thread where breakpoint is
  24871. hit. For another example, if the user issues the CLI 'thread' or
  24872. 'frame' commands via the frontend, it is desirable to change the
  24873. frontend's selection to the one specified by user. GDB communicates the
  24874. suggestion to change current thread and frame using the
  24875. '=thread-selected' notification.
  24876. Note that historically, MI shares the selected thread with CLI, so
  24877. frontends used the '-thread-select' to execute commands in the right
  24878. context. However, getting this to work right is cumbersome. The
  24879. simplest way is for frontend to emit '-thread-select' command before
  24880. every command. This doubles the number of commands that need to be
  24881. sent. The alternative approach is to suppress '-thread-select' if the
  24882. selected thread in GDB is supposed to be identical to the thread the
  24883. frontend wants to operate on. However, getting this optimization right
  24884. can be tricky. In particular, if the frontend sends several commands to
  24885. GDB, and one of the commands changes the selected thread, then the
  24886. behaviour of subsequent commands will change. So, a frontend should
  24887. either wait for response from such problematic commands, or explicitly
  24888. add '-thread-select' for all subsequent commands. No frontend is known
  24889. to do this exactly right, so it is suggested to just always pass the
  24890. '--thread' and '--frame' options.
  24891. 27.1.1.2 Language
  24892. .................
  24893. The execution of several commands depends on which language is selected.
  24894. By default, the current language (*note show language::) is used. But
  24895. for commands known to be language-sensitive, it is recommended to use
  24896. the '--language' option. This option takes one argument, which is the
  24897. name of the language to use while executing the command. For instance:
  24898. -data-evaluate-expression --language c "sizeof (void*)"
  24899. ^done,value="4"
  24900. (gdb)
  24901. The valid language names are the same names accepted by the 'set
  24902. language' command (*note Manually::), excluding 'auto', 'local' or
  24903. 'unknown'.
  24904. 
  24905. File: gdb.info, Node: Asynchronous and non-stop modes, Next: Thread groups, Prev: Context management, Up: GDB/MI General Design
  24906. 27.1.2 Asynchronous command execution and non-stop mode
  24907. -------------------------------------------------------
  24908. On some targets, GDB is capable of processing MI commands even while the
  24909. target is running. This is called "asynchronous command execution"
  24910. (*note Background Execution::). The frontend may specify a preferrence
  24911. for asynchronous execution using the '-gdb-set mi-async 1' command,
  24912. which should be emitted before either running the executable or
  24913. attaching to the target. After the frontend has started the executable
  24914. or attached to the target, it can find if asynchronous execution is
  24915. enabled using the '-list-target-features' command.
  24916. '-gdb-set mi-async on'
  24917. '-gdb-set mi-async off'
  24918. Set whether MI is in asynchronous mode.
  24919. When 'off', which is the default, MI execution commands (e.g.,
  24920. '-exec-continue') are foreground commands, and GDB waits for the
  24921. program to stop before processing further commands.
  24922. When 'on', MI execution commands are background execution commands
  24923. (e.g., '-exec-continue' becomes the equivalent of the 'c&' CLI
  24924. command), and so GDB is capable of processing MI commands even
  24925. while the target is running.
  24926. '-gdb-show mi-async'
  24927. Show whether MI asynchronous mode is enabled.
  24928. Note: In GDB version 7.7 and earlier, this option was called
  24929. 'target-async' instead of 'mi-async', and it had the effect of both
  24930. putting MI in asynchronous mode and making CLI background commands
  24931. possible. CLI background commands are now always possible "out of the
  24932. box" if the target supports them. The old spelling is kept as a
  24933. deprecated alias for backwards compatibility.
  24934. Even if GDB can accept a command while target is running, many
  24935. commands that access the target do not work when the target is running.
  24936. Therefore, asynchronous command execution is most useful when combined
  24937. with non-stop mode (*note Non-Stop Mode::). Then, it is possible to
  24938. examine the state of one thread, while other threads are running.
  24939. When a given thread is running, MI commands that try to access the
  24940. target in the context of that thread may not work, or may work only on
  24941. some targets. In particular, commands that try to operate on thread's
  24942. stack will not work, on any target. Commands that read memory, or
  24943. modify breakpoints, may work or not work, depending on the target. Note
  24944. that even commands that operate on global state, such as 'print', 'set',
  24945. and breakpoint commands, still access the target in the context of a
  24946. specific thread, so frontend should try to find a stopped thread and
  24947. perform the operation on that thread (using the '--thread' option).
  24948. Which commands will work in the context of a running thread is highly
  24949. target dependent. However, the two commands '-exec-interrupt', to stop
  24950. a thread, and '-thread-info', to find the state of a thread, will always
  24951. work.
  24952. 
  24953. File: gdb.info, Node: Thread groups, Prev: Asynchronous and non-stop modes, Up: GDB/MI General Design
  24954. 27.1.3 Thread groups
  24955. --------------------
  24956. GDB may be used to debug several processes at the same time. On some
  24957. platfroms, GDB may support debugging of several hardware systems, each
  24958. one having several cores with several different processes running on
  24959. each core. This section describes the MI mechanism to support such
  24960. debugging scenarios.
  24961. The key observation is that regardless of the structure of the
  24962. target, MI can have a global list of threads, because most commands that
  24963. accept the '--thread' option do not need to know what process that
  24964. thread belongs to. Therefore, it is not necessary to introduce neither
  24965. additional '--process' option, nor an notion of the current process in
  24966. the MI interface. The only strictly new feature that is required is the
  24967. ability to find how the threads are grouped into processes.
  24968. To allow the user to discover such grouping, and to support arbitrary
  24969. hierarchy of machines/cores/processes, MI introduces the concept of a
  24970. "thread group". Thread group is a collection of threads and other
  24971. thread groups. A thread group always has a string identifier, a type,
  24972. and may have additional attributes specific to the type. A new command,
  24973. '-list-thread-groups', returns the list of top-level thread groups,
  24974. which correspond to processes that GDB is debugging at the moment. By
  24975. passing an identifier of a thread group to the '-list-thread-groups'
  24976. command, it is possible to obtain the members of specific thread group.
  24977. To allow the user to easily discover processes, and other objects, he
  24978. wishes to debug, a concept of "available thread group" is introduced.
  24979. Available thread group is an thread group that GDB is not debugging, but
  24980. that can be attached to, using the '-target-attach' command. The list
  24981. of available top-level thread groups can be obtained using
  24982. '-list-thread-groups --available'. In general, the content of a thread
  24983. group may be only retrieved only after attaching to that thread group.
  24984. Thread groups are related to inferiors (*note Inferiors and
  24985. Programs::). Each inferior corresponds to a thread group of a special
  24986. type 'process', and some additional operations are permitted on such
  24987. thread groups.
  24988. 
  24989. File: gdb.info, Node: GDB/MI Command Syntax, Next: GDB/MI Compatibility with CLI, Prev: GDB/MI General Design, Up: GDB/MI
  24990. 27.2 GDB/MI Command Syntax
  24991. ==========================
  24992. * Menu:
  24993. * GDB/MI Input Syntax::
  24994. * GDB/MI Output Syntax::
  24995. 
  24996. File: gdb.info, Node: GDB/MI Input Syntax, Next: GDB/MI Output Syntax, Up: GDB/MI Command Syntax
  24997. 27.2.1 GDB/MI Input Syntax
  24998. --------------------------
  24999. 'COMMAND ==>'
  25000. 'CLI-COMMAND | MI-COMMAND'
  25001. 'CLI-COMMAND ==>'
  25002. '[ TOKEN ] CLI-COMMAND NL', where CLI-COMMAND is any existing GDB
  25003. CLI command.
  25004. 'MI-COMMAND ==>'
  25005. '[ TOKEN ] "-" OPERATION ( " " OPTION )* [ " --" ] ( " " PARAMETER
  25006. )* NL'
  25007. 'TOKEN ==>'
  25008. "any sequence of digits"
  25009. 'OPTION ==>'
  25010. '"-" PARAMETER [ " " PARAMETER ]'
  25011. 'PARAMETER ==>'
  25012. 'NON-BLANK-SEQUENCE | C-STRING'
  25013. 'OPERATION ==>'
  25014. _any of the operations described in this chapter_
  25015. 'NON-BLANK-SEQUENCE ==>'
  25016. _anything, provided it doesn't contain special characters such as
  25017. "-", NL, """ and of course " "_
  25018. 'C-STRING ==>'
  25019. '""" SEVEN-BIT-ISO-C-STRING-CONTENT """'
  25020. 'NL ==>'
  25021. 'CR | CR-LF'
  25022. Notes:
  25023. * The CLI commands are still handled by the MI interpreter; their
  25024. output is described below.
  25025. * The 'TOKEN', when present, is passed back when the command
  25026. finishes.
  25027. * Some MI commands accept optional arguments as part of the parameter
  25028. list. Each option is identified by a leading '-' (dash) and may be
  25029. followed by an optional argument parameter. Options occur first in
  25030. the parameter list and can be delimited from normal parameters
  25031. using '--' (this is useful when some parameters begin with a dash).
  25032. Pragmatics:
  25033. * We want easy access to the existing CLI syntax (for debugging).
  25034. * We want it to be easy to spot a MI operation.
  25035. 
  25036. File: gdb.info, Node: GDB/MI Output Syntax, Prev: GDB/MI Input Syntax, Up: GDB/MI Command Syntax
  25037. 27.2.2 GDB/MI Output Syntax
  25038. ---------------------------
  25039. The output from GDB/MI consists of zero or more out-of-band records
  25040. followed, optionally, by a single result record. This result record is
  25041. for the most recent command. The sequence of output records is
  25042. terminated by '(gdb)'.
  25043. If an input command was prefixed with a 'TOKEN' then the
  25044. corresponding output for that command will also be prefixed by that same
  25045. TOKEN.
  25046. 'OUTPUT ==>'
  25047. '( OUT-OF-BAND-RECORD )* [ RESULT-RECORD ] "(gdb)" NL'
  25048. 'RESULT-RECORD ==>'
  25049. ' [ TOKEN ] "^" RESULT-CLASS ( "," RESULT )* NL'
  25050. 'OUT-OF-BAND-RECORD ==>'
  25051. 'ASYNC-RECORD | STREAM-RECORD'
  25052. 'ASYNC-RECORD ==>'
  25053. 'EXEC-ASYNC-OUTPUT | STATUS-ASYNC-OUTPUT | NOTIFY-ASYNC-OUTPUT'
  25054. 'EXEC-ASYNC-OUTPUT ==>'
  25055. '[ TOKEN ] "*" ASYNC-OUTPUT NL'
  25056. 'STATUS-ASYNC-OUTPUT ==>'
  25057. '[ TOKEN ] "+" ASYNC-OUTPUT NL'
  25058. 'NOTIFY-ASYNC-OUTPUT ==>'
  25059. '[ TOKEN ] "=" ASYNC-OUTPUT NL'
  25060. 'ASYNC-OUTPUT ==>'
  25061. 'ASYNC-CLASS ( "," RESULT )*'
  25062. 'RESULT-CLASS ==>'
  25063. '"done" | "running" | "connected" | "error" | "exit"'
  25064. 'ASYNC-CLASS ==>'
  25065. '"stopped" | OTHERS' (where OTHERS will be added depending on the
  25066. needs--this is still in development).
  25067. 'RESULT ==>'
  25068. ' VARIABLE "=" VALUE'
  25069. 'VARIABLE ==>'
  25070. ' STRING '
  25071. 'VALUE ==>'
  25072. ' CONST | TUPLE | LIST '
  25073. 'CONST ==>'
  25074. 'C-STRING'
  25075. 'TUPLE ==>'
  25076. ' "{}" | "{" RESULT ( "," RESULT )* "}" '
  25077. 'LIST ==>'
  25078. ' "[]" | "[" VALUE ( "," VALUE )* "]" | "[" RESULT ( "," RESULT )*
  25079. "]" '
  25080. 'STREAM-RECORD ==>'
  25081. 'CONSOLE-STREAM-OUTPUT | TARGET-STREAM-OUTPUT | LOG-STREAM-OUTPUT'
  25082. 'CONSOLE-STREAM-OUTPUT ==>'
  25083. '"~" C-STRING NL'
  25084. 'TARGET-STREAM-OUTPUT ==>'
  25085. '"@" C-STRING NL'
  25086. 'LOG-STREAM-OUTPUT ==>'
  25087. '"&" C-STRING NL'
  25088. 'NL ==>'
  25089. 'CR | CR-LF'
  25090. 'TOKEN ==>'
  25091. _any sequence of digits_.
  25092. Notes:
  25093. * All output sequences end in a single line containing a period.
  25094. * The 'TOKEN' is from the corresponding request. Note that for all
  25095. async output, while the token is allowed by the grammar and may be
  25096. output by future versions of GDB for select async output messages,
  25097. it is generally omitted. Frontends should treat all async output
  25098. as reporting general changes in the state of the target and there
  25099. should be no need to associate async output to any prior command.
  25100. * STATUS-ASYNC-OUTPUT contains on-going status information about the
  25101. progress of a slow operation. It can be discarded. All status
  25102. output is prefixed by '+'.
  25103. * EXEC-ASYNC-OUTPUT contains asynchronous state change on the target
  25104. (stopped, started, disappeared). All async output is prefixed by
  25105. '*'.
  25106. * NOTIFY-ASYNC-OUTPUT contains supplementary information that the
  25107. client should handle (e.g., a new breakpoint information). All
  25108. notify output is prefixed by '='.
  25109. * CONSOLE-STREAM-OUTPUT is output that should be displayed as is in
  25110. the console. It is the textual response to a CLI command. All the
  25111. console output is prefixed by '~'.
  25112. * TARGET-STREAM-OUTPUT is the output produced by the target program.
  25113. All the target output is prefixed by '@'.
  25114. * LOG-STREAM-OUTPUT is output text coming from GDB's internals, for
  25115. instance messages that should be displayed as part of an error log.
  25116. All the log output is prefixed by '&'.
  25117. * New GDB/MI commands should only output LISTS containing VALUES.
  25118. *Note GDB/MI Stream Records: GDB/MI Stream Records, for more details
  25119. about the various output records.
  25120. 
  25121. File: gdb.info, Node: GDB/MI Compatibility with CLI, Next: GDB/MI Development and Front Ends, Prev: GDB/MI Command Syntax, Up: GDB/MI
  25122. 27.3 GDB/MI Compatibility with CLI
  25123. ==================================
  25124. For the developers convenience CLI commands can be entered directly, but
  25125. there may be some unexpected behaviour. For example, commands that
  25126. query the user will behave as if the user replied yes, breakpoint
  25127. command lists are not executed and some CLI commands, such as 'if',
  25128. 'when' and 'define', prompt for further input with '>', which is not
  25129. valid MI output.
  25130. This feature may be removed at some stage in the future and it is
  25131. recommended that front ends use the '-interpreter-exec' command (*note
  25132. -interpreter-exec::).
  25133. 
  25134. File: gdb.info, Node: GDB/MI Development and Front Ends, Next: GDB/MI Output Records, Prev: GDB/MI Compatibility with CLI, Up: GDB/MI
  25135. 27.4 GDB/MI Development and Front Ends
  25136. ======================================
  25137. The application which takes the MI output and presents the state of the
  25138. program being debugged to the user is called a "front end".
  25139. Since GDB/MI is used by a variety of front ends to GDB, changes to
  25140. the MI interface may break existing usage. This section describes how
  25141. the protocol changes and how to request previous version of the protocol
  25142. when it does.
  25143. Some changes in MI need not break a carefully designed front end, and
  25144. for these the MI version will remain unchanged. The following is a list
  25145. of changes that may occur within one level, so front ends should parse
  25146. MI output in a way that can handle them:
  25147. * New MI commands may be added.
  25148. * New fields may be added to the output of any MI command.
  25149. * The range of values for fields with specified values, e.g.,
  25150. 'in_scope' (*note -var-update::) may be extended.
  25151. If the changes are likely to break front ends, the MI version level
  25152. will be increased by one. The new versions of the MI protocol are not
  25153. compatible with the old versions. Old versions of MI remain available,
  25154. allowing front ends to keep using them until they are modified to use
  25155. the latest MI version.
  25156. Since '--interpreter=mi' always points to the latest MI version, it
  25157. is recommended that front ends request a specific version of MI when
  25158. launching GDB (e.g. '--interpreter=mi2') to make sure they get an
  25159. interpreter with the MI version they expect.
  25160. The following table gives a summary of the the released versions of
  25161. the MI interface: the version number, the version of GDB in which it
  25162. first appeared and the breaking changes compared to the previous
  25163. version.
  25164. MI GDB Breaking changes
  25165. versionversion
  25166. ----------------------------------------------------------------------------
  25167. 1 5.1 None
  25168. 2 6.0
  25169. * The '-environment-pwd', '-environment-directory' and
  25170. '-environment-path' commands now returns values using the
  25171. MI output syntax, rather than CLI output syntax.
  25172. * '-var-list-children''s 'children' result field is now a
  25173. list, rather than a tuple.
  25174. * '-var-update''s 'changelist' result field is now a list,
  25175. rather than a tuple.
  25176. The best way to avoid unexpected changes in MI that might break your
  25177. front end is to make your project known to GDB developers and follow
  25178. development on <gdb@sourceware.org> and <gdb-patches@sourceware.org>.
  25179. 
  25180. File: gdb.info, Node: GDB/MI Output Records, Next: GDB/MI Simple Examples, Prev: GDB/MI Development and Front Ends, Up: GDB/MI
  25181. 27.5 GDB/MI Output Records
  25182. ==========================
  25183. * Menu:
  25184. * GDB/MI Result Records::
  25185. * GDB/MI Stream Records::
  25186. * GDB/MI Async Records::
  25187. * GDB/MI Breakpoint Information::
  25188. * GDB/MI Frame Information::
  25189. * GDB/MI Thread Information::
  25190. * GDB/MI Ada Exception Information::
  25191. 
  25192. File: gdb.info, Node: GDB/MI Result Records, Next: GDB/MI Stream Records, Up: GDB/MI Output Records
  25193. 27.5.1 GDB/MI Result Records
  25194. ----------------------------
  25195. In addition to a number of out-of-band notifications, the response to a
  25196. GDB/MI command includes one of the following result indications:
  25197. '"^done" [ "," RESULTS ]'
  25198. The synchronous operation was successful, 'RESULTS' are the return
  25199. values.
  25200. '"^running"'
  25201. This result record is equivalent to '^done'. Historically, it was
  25202. output instead of '^done' if the command has resumed the target.
  25203. This behaviour is maintained for backward compatibility, but all
  25204. frontends should treat '^done' and '^running' identically and rely
  25205. on the '*running' output record to determine which threads are
  25206. resumed.
  25207. '"^connected"'
  25208. GDB has connected to a remote target.
  25209. '"^error" "," "msg=" C-STRING [ "," "code=" C-STRING ]'
  25210. The operation failed. The 'msg=C-STRING' variable contains the
  25211. corresponding error message.
  25212. If present, the 'code=C-STRING' variable provides an error code on
  25213. which consumers can rely on to detect the corresponding error
  25214. condition. At present, only one error code is defined:
  25215. '"undefined-command"'
  25216. Indicates that the command causing the error does not exist.
  25217. '"^exit"'
  25218. GDB has terminated.
  25219. 
  25220. File: gdb.info, Node: GDB/MI Stream Records, Next: GDB/MI Async Records, Prev: GDB/MI Result Records, Up: GDB/MI Output Records
  25221. 27.5.2 GDB/MI Stream Records
  25222. ----------------------------
  25223. GDB internally maintains a number of output streams: the console, the
  25224. target, and the log. The output intended for each of these streams is
  25225. funneled through the GDB/MI interface using "stream records".
  25226. Each stream record begins with a unique "prefix character" which
  25227. identifies its stream (*note GDB/MI Output Syntax: GDB/MI Output
  25228. Syntax.). In addition to the prefix, each stream record contains a
  25229. 'STRING-OUTPUT'. This is either raw text (with an implicit new line) or
  25230. a quoted C string (which does not contain an implicit newline).
  25231. '"~" STRING-OUTPUT'
  25232. The console output stream contains text that should be displayed in
  25233. the CLI console window. It contains the textual responses to CLI
  25234. commands.
  25235. '"@" STRING-OUTPUT'
  25236. The target output stream contains any textual output from the
  25237. running target. This is only present when GDB's event loop is
  25238. truly asynchronous, which is currently only the case for remote
  25239. targets.
  25240. '"&" STRING-OUTPUT'
  25241. The log stream contains debugging messages being produced by GDB's
  25242. internals.
  25243. 
  25244. File: gdb.info, Node: GDB/MI Async Records, Next: GDB/MI Breakpoint Information, Prev: GDB/MI Stream Records, Up: GDB/MI Output Records
  25245. 27.5.3 GDB/MI Async Records
  25246. ---------------------------
  25247. "Async" records are used to notify the GDB/MI client of additional
  25248. changes that have occurred. Those changes can either be a consequence
  25249. of GDB/MI commands (e.g., a breakpoint modified) or a result of target
  25250. activity (e.g., target stopped).
  25251. The following is the list of possible async records:
  25252. '*running,thread-id="THREAD"'
  25253. The target is now running. The THREAD field can be the global
  25254. thread ID of the the thread that is now running, and it can be
  25255. 'all' if all threads are running. The frontend should assume that
  25256. no interaction with a running thread is possible after this
  25257. notification is produced. The frontend should not assume that this
  25258. notification is output only once for any command. GDB may emit
  25259. this notification several times, either for different threads,
  25260. because it cannot resume all threads together, or even for a single
  25261. thread, if the thread must be stepped though some code before
  25262. letting it run freely.
  25263. '*stopped,reason="REASON",thread-id="ID",stopped-threads="STOPPED",core="CORE"'
  25264. The target has stopped. The REASON field can have one of the
  25265. following values:
  25266. 'breakpoint-hit'
  25267. A breakpoint was reached.
  25268. 'watchpoint-trigger'
  25269. A watchpoint was triggered.
  25270. 'read-watchpoint-trigger'
  25271. A read watchpoint was triggered.
  25272. 'access-watchpoint-trigger'
  25273. An access watchpoint was triggered.
  25274. 'function-finished'
  25275. An -exec-finish or similar CLI command was accomplished.
  25276. 'location-reached'
  25277. An -exec-until or similar CLI command was accomplished.
  25278. 'watchpoint-scope'
  25279. A watchpoint has gone out of scope.
  25280. 'end-stepping-range'
  25281. An -exec-next, -exec-next-instruction, -exec-step,
  25282. -exec-step-instruction or similar CLI command was
  25283. accomplished.
  25284. 'exited-signalled'
  25285. The inferior exited because of a signal.
  25286. 'exited'
  25287. The inferior exited.
  25288. 'exited-normally'
  25289. The inferior exited normally.
  25290. 'signal-received'
  25291. A signal was received by the inferior.
  25292. 'solib-event'
  25293. The inferior has stopped due to a library being loaded or
  25294. unloaded. This can happen when 'stop-on-solib-events' (*note
  25295. Files::) is set or when a 'catch load' or 'catch unload'
  25296. catchpoint is in use (*note Set Catchpoints::).
  25297. 'fork'
  25298. The inferior has forked. This is reported when 'catch fork'
  25299. (*note Set Catchpoints::) has been used.
  25300. 'vfork'
  25301. The inferior has vforked. This is reported in when 'catch
  25302. vfork' (*note Set Catchpoints::) has been used.
  25303. 'syscall-entry'
  25304. The inferior entered a system call. This is reported when
  25305. 'catch syscall' (*note Set Catchpoints::) has been used.
  25306. 'syscall-return'
  25307. The inferior returned from a system call. This is reported
  25308. when 'catch syscall' (*note Set Catchpoints::) has been used.
  25309. 'exec'
  25310. The inferior called 'exec'. This is reported when 'catch
  25311. exec' (*note Set Catchpoints::) has been used.
  25312. The ID field identifies the global thread ID of the thread that
  25313. directly caused the stop - for example by hitting a breakpoint.
  25314. Depending on whether all-stop mode is in effect (*note All-Stop
  25315. Mode::), GDB may either stop all threads, or only the thread that
  25316. directly triggered the stop. If all threads are stopped, the
  25317. STOPPED field will have the value of '"all"'. Otherwise, the value
  25318. of the STOPPED field will be a list of thread identifiers.
  25319. Presently, this list will always include a single thread, but
  25320. frontend should be prepared to see several threads in the list.
  25321. The CORE field reports the processor core on which the stop event
  25322. has happened. This field may be absent if such information is not
  25323. available.
  25324. '=thread-group-added,id="ID"'
  25325. '=thread-group-removed,id="ID"'
  25326. A thread group was either added or removed. The ID field contains
  25327. the GDB identifier of the thread group. When a thread group is
  25328. added, it generally might not be associated with a running process.
  25329. When a thread group is removed, its id becomes invalid and cannot
  25330. be used in any way.
  25331. '=thread-group-started,id="ID",pid="PID"'
  25332. A thread group became associated with a running program, either
  25333. because the program was just started or the thread group was
  25334. attached to a program. The ID field contains the GDB identifier of
  25335. the thread group. The PID field contains process identifier,
  25336. specific to the operating system.
  25337. '=thread-group-exited,id="ID"[,exit-code="CODE"]'
  25338. A thread group is no longer associated with a running program,
  25339. either because the program has exited, or because it was detached
  25340. from. The ID field contains the GDB identifier of the thread
  25341. group. The CODE field is the exit code of the inferior; it exists
  25342. only when the inferior exited with some code.
  25343. '=thread-created,id="ID",group-id="GID"'
  25344. '=thread-exited,id="ID",group-id="GID"'
  25345. A thread either was created, or has exited. The ID field contains
  25346. the global GDB identifier of the thread. The GID field identifies
  25347. the thread group this thread belongs to.
  25348. '=thread-selected,id="ID"[,frame="FRAME"]'
  25349. Informs that the selected thread or frame were changed. This
  25350. notification is not emitted as result of the '-thread-select' or
  25351. '-stack-select-frame' commands, but is emitted whenever an MI
  25352. command that is not documented to change the selected thread and
  25353. frame actually changes them. In particular, invoking, directly or
  25354. indirectly (via user-defined command), the CLI 'thread' or 'frame'
  25355. commands, will generate this notification. Changing the thread or
  25356. frame from another user interface (see *note Interpreters::) will
  25357. also generate this notification.
  25358. The FRAME field is only present if the newly selected thread is
  25359. stopped. See *note GDB/MI Frame Information:: for the format of
  25360. its value.
  25361. We suggest that in response to this notification, front ends
  25362. highlight the selected thread and cause subsequent commands to
  25363. apply to that thread.
  25364. '=library-loaded,...'
  25365. Reports that a new library file was loaded by the program. This
  25366. notification has 5 fields--ID, TARGET-NAME, HOST-NAME,
  25367. SYMBOLS-LOADED and RANGES. The ID field is an opaque identifier of
  25368. the library. For remote debugging case, TARGET-NAME and HOST-NAME
  25369. fields give the name of the library file on the target, and on the
  25370. host respectively. For native debugging, both those fields have
  25371. the same value. The SYMBOLS-LOADED field is emitted only for
  25372. backward compatibility and should not be relied on to convey any
  25373. useful information. The THREAD-GROUP field, if present, specifies
  25374. the id of the thread group in whose context the library was loaded.
  25375. If the field is absent, it means the library was loaded in the
  25376. context of all present thread groups. The RANGES field specifies
  25377. the ranges of addresses belonging to this library.
  25378. '=library-unloaded,...'
  25379. Reports that a library was unloaded by the program. This
  25380. notification has 3 fields--ID, TARGET-NAME and HOST-NAME with the
  25381. same meaning as for the '=library-loaded' notification. The
  25382. THREAD-GROUP field, if present, specifies the id of the thread
  25383. group in whose context the library was unloaded. If the field is
  25384. absent, it means the library was unloaded in the context of all
  25385. present thread groups.
  25386. '=traceframe-changed,num=TFNUM,tracepoint=TPNUM'
  25387. '=traceframe-changed,end'
  25388. Reports that the trace frame was changed and its new number is
  25389. TFNUM. The number of the tracepoint associated with this trace
  25390. frame is TPNUM.
  25391. '=tsv-created,name=NAME,initial=INITIAL'
  25392. Reports that the new trace state variable NAME is created with
  25393. initial value INITIAL.
  25394. '=tsv-deleted,name=NAME'
  25395. '=tsv-deleted'
  25396. Reports that the trace state variable NAME is deleted or all trace
  25397. state variables are deleted.
  25398. '=tsv-modified,name=NAME,initial=INITIAL[,current=CURRENT]'
  25399. Reports that the trace state variable NAME is modified with the
  25400. initial value INITIAL. The current value CURRENT of trace state
  25401. variable is optional and is reported if the current value of trace
  25402. state variable is known.
  25403. '=breakpoint-created,bkpt={...}'
  25404. '=breakpoint-modified,bkpt={...}'
  25405. '=breakpoint-deleted,id=NUMBER'
  25406. Reports that a breakpoint was created, modified, or deleted,
  25407. respectively. Only user-visible breakpoints are reported to the MI
  25408. user.
  25409. The BKPT argument is of the same form as returned by the various
  25410. breakpoint commands; *Note GDB/MI Breakpoint Commands::. The
  25411. NUMBER is the ordinal number of the breakpoint.
  25412. Note that if a breakpoint is emitted in the result record of a
  25413. command, then it will not also be emitted in an async record.
  25414. '=record-started,thread-group="ID",method="METHOD"[,format="FORMAT"]'
  25415. '=record-stopped,thread-group="ID"'
  25416. Execution log recording was either started or stopped on an
  25417. inferior. The ID is the GDB identifier of the thread group
  25418. corresponding to the affected inferior.
  25419. The METHOD field indicates the method used to record execution. If
  25420. the method in use supports multiple recording formats, FORMAT will
  25421. be present and contain the currently used format. *Note Process
  25422. Record and Replay::, for existing method and format values.
  25423. '=cmd-param-changed,param=PARAM,value=VALUE'
  25424. Reports that a parameter of the command 'set PARAM' is changed to
  25425. VALUE. In the multi-word 'set' command, the PARAM is the whole
  25426. parameter list to 'set' command. For example, In command 'set
  25427. check type on', PARAM is 'check type' and VALUE is 'on'.
  25428. '=memory-changed,thread-group=ID,addr=ADDR,len=LEN[,type="code"]'
  25429. Reports that bytes from ADDR to DATA + LEN were written in an
  25430. inferior. The ID is the identifier of the thread group
  25431. corresponding to the affected inferior. The optional 'type="code"'
  25432. part is reported if the memory written to holds executable code.
  25433. 
  25434. File: gdb.info, Node: GDB/MI Breakpoint Information, Next: GDB/MI Frame Information, Prev: GDB/MI Async Records, Up: GDB/MI Output Records
  25435. 27.5.4 GDB/MI Breakpoint Information
  25436. ------------------------------------
  25437. When GDB reports information about a breakpoint, a tracepoint, a
  25438. watchpoint, or a catchpoint, it uses a tuple with the following fields:
  25439. 'number'
  25440. The breakpoint number. For a breakpoint that represents one
  25441. location of a multi-location breakpoint, this will be a dotted
  25442. pair, like '1.2'.
  25443. 'type'
  25444. The type of the breakpoint. For ordinary breakpoints this will be
  25445. 'breakpoint', but many values are possible.
  25446. 'catch-type'
  25447. If the type of the breakpoint is 'catchpoint', then this indicates
  25448. the exact type of catchpoint.
  25449. 'disp'
  25450. This is the breakpoint disposition--either 'del', meaning that the
  25451. breakpoint will be deleted at the next stop, or 'keep', meaning
  25452. that the breakpoint will not be deleted.
  25453. 'enabled'
  25454. This indicates whether the breakpoint is enabled, in which case the
  25455. value is 'y', or disabled, in which case the value is 'n'. Note
  25456. that this is not the same as the field 'enable'.
  25457. 'addr'
  25458. The address of the breakpoint. This may be a hexidecimal number,
  25459. giving the address; or the string '<PENDING>', for a pending
  25460. breakpoint; or the string '<MULTIPLE>', for a breakpoint with
  25461. multiple locations. This field will not be present if no address
  25462. can be determined. For example, a watchpoint does not have an
  25463. address.
  25464. 'func'
  25465. If known, the function in which the breakpoint appears. If not
  25466. known, this field is not present.
  25467. 'filename'
  25468. The name of the source file which contains this function, if known.
  25469. If not known, this field is not present.
  25470. 'fullname'
  25471. The full file name of the source file which contains this function,
  25472. if known. If not known, this field is not present.
  25473. 'line'
  25474. The line number at which this breakpoint appears, if known. If not
  25475. known, this field is not present.
  25476. 'at'
  25477. If the source file is not known, this field may be provided. If
  25478. provided, this holds the address of the breakpoint, possibly
  25479. followed by a symbol name.
  25480. 'pending'
  25481. If this breakpoint is pending, this field is present and holds the
  25482. text used to set the breakpoint, as entered by the user.
  25483. 'evaluated-by'
  25484. Where this breakpoint's condition is evaluated, either 'host' or
  25485. 'target'.
  25486. 'thread'
  25487. If this is a thread-specific breakpoint, then this identifies the
  25488. thread in which the breakpoint can trigger.
  25489. 'task'
  25490. If this breakpoint is restricted to a particular Ada task, then
  25491. this field will hold the task identifier.
  25492. 'cond'
  25493. If the breakpoint is conditional, this is the condition expression.
  25494. 'ignore'
  25495. The ignore count of the breakpoint.
  25496. 'enable'
  25497. The enable count of the breakpoint.
  25498. 'traceframe-usage'
  25499. FIXME.
  25500. 'static-tracepoint-marker-string-id'
  25501. For a static tracepoint, the name of the static tracepoint marker.
  25502. 'mask'
  25503. For a masked watchpoint, this is the mask.
  25504. 'pass'
  25505. A tracepoint's pass count.
  25506. 'original-location'
  25507. The location of the breakpoint as originally specified by the user.
  25508. This field is optional.
  25509. 'times'
  25510. The number of times the breakpoint has been hit.
  25511. 'installed'
  25512. This field is only given for tracepoints. This is either 'y',
  25513. meaning that the tracepoint is installed, or 'n', meaning that it
  25514. is not.
  25515. 'what'
  25516. Some extra data, the exact contents of which are type-dependent.
  25517. For example, here is what the output of '-break-insert' (*note GDB/MI
  25518. Breakpoint Commands::) might be:
  25519. -> -break-insert main
  25520. <- ^done,bkpt={number="1",type="breakpoint",disp="keep",
  25521. enabled="y",addr="0x08048564",func="main",file="myprog.c",
  25522. fullname="/home/nickrob/myprog.c",line="68",thread-groups=["i1"],
  25523. times="0"}
  25524. <- (gdb)
  25525. 
  25526. File: gdb.info, Node: GDB/MI Frame Information, Next: GDB/MI Thread Information, Prev: GDB/MI Breakpoint Information, Up: GDB/MI Output Records
  25527. 27.5.5 GDB/MI Frame Information
  25528. -------------------------------
  25529. Response from many MI commands includes an information about stack
  25530. frame. This information is a tuple that may have the following fields:
  25531. 'level'
  25532. The level of the stack frame. The innermost frame has the level of
  25533. zero. This field is always present.
  25534. 'func'
  25535. The name of the function corresponding to the frame. This field
  25536. may be absent if GDB is unable to determine the function name.
  25537. 'addr'
  25538. The code address for the frame. This field is always present.
  25539. 'file'
  25540. The name of the source files that correspond to the frame's code
  25541. address. This field may be absent.
  25542. 'line'
  25543. The source line corresponding to the frames' code address. This
  25544. field may be absent.
  25545. 'from'
  25546. The name of the binary file (either executable or shared library)
  25547. the corresponds to the frame's code address. This field may be
  25548. absent.
  25549. 
  25550. File: gdb.info, Node: GDB/MI Thread Information, Next: GDB/MI Ada Exception Information, Prev: GDB/MI Frame Information, Up: GDB/MI Output Records
  25551. 27.5.6 GDB/MI Thread Information
  25552. --------------------------------
  25553. Whenever GDB has to report an information about a thread, it uses a
  25554. tuple with the following fields. The fields are always present unless
  25555. stated otherwise.
  25556. 'id'
  25557. The global numeric id assigned to the thread by GDB.
  25558. 'target-id'
  25559. The target-specific string identifying the thread.
  25560. 'details'
  25561. Additional information about the thread provided by the target. It
  25562. is supposed to be human-readable and not interpreted by the
  25563. frontend. This field is optional.
  25564. 'name'
  25565. The name of the thread. If the user specified a name using the
  25566. 'thread name' command, then this name is given. Otherwise, if GDB
  25567. can extract the thread name from the target, then that name is
  25568. given. If GDB cannot find the thread name, then this field is
  25569. omitted.
  25570. 'state'
  25571. The execution state of the thread, either 'stopped' or 'running',
  25572. depending on whether the thread is presently running.
  25573. 'frame'
  25574. The stack frame currently executing in the thread. This field is
  25575. only present if the thread is stopped. Its format is documented in
  25576. *note GDB/MI Frame Information::.
  25577. 'core'
  25578. The value of this field is an integer number of the processor core
  25579. the thread was last seen on. This field is optional.
  25580. 
  25581. File: gdb.info, Node: GDB/MI Ada Exception Information, Prev: GDB/MI Thread Information, Up: GDB/MI Output Records
  25582. 27.5.7 GDB/MI Ada Exception Information
  25583. ---------------------------------------
  25584. Whenever a '*stopped' record is emitted because the program stopped
  25585. after hitting an exception catchpoint (*note Set Catchpoints::), GDB
  25586. provides the name of the exception that was raised via the
  25587. 'exception-name' field. Also, for exceptions that were raised with an
  25588. exception message, GDB provides that message via the 'exception-message'
  25589. field.
  25590. 
  25591. File: gdb.info, Node: GDB/MI Simple Examples, Next: GDB/MI Command Description Format, Prev: GDB/MI Output Records, Up: GDB/MI
  25592. 27.6 Simple Examples of GDB/MI Interaction
  25593. ==========================================
  25594. This subsection presents several simple examples of interaction using
  25595. the GDB/MI interface. In these examples, '->' means that the following
  25596. line is passed to GDB/MI as input, while '<-' means the output received
  25597. from GDB/MI.
  25598. Note the line breaks shown in the examples are here only for
  25599. readability, they don't appear in the real output.
  25600. Setting a Breakpoint
  25601. --------------------
  25602. Setting a breakpoint generates synchronous output which contains
  25603. detailed information of the breakpoint.
  25604. -> -break-insert main
  25605. <- ^done,bkpt={number="1",type="breakpoint",disp="keep",
  25606. enabled="y",addr="0x08048564",func="main",file="myprog.c",
  25607. fullname="/home/nickrob/myprog.c",line="68",thread-groups=["i1"],
  25608. times="0"}
  25609. <- (gdb)
  25610. Program Execution
  25611. -----------------
  25612. Program execution generates asynchronous records and MI gives the reason
  25613. that execution stopped.
  25614. -> -exec-run
  25615. <- ^running
  25616. <- (gdb)
  25617. <- *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
  25618. frame={addr="0x08048564",func="main",
  25619. args=[{name="argc",value="1"},{name="argv",value="0xbfc4d4d4"}],
  25620. file="myprog.c",fullname="/home/nickrob/myprog.c",line="68",
  25621. arch="i386:x86_64"}
  25622. <- (gdb)
  25623. -> -exec-continue
  25624. <- ^running
  25625. <- (gdb)
  25626. <- *stopped,reason="exited-normally"
  25627. <- (gdb)
  25628. Quitting GDB
  25629. ------------
  25630. Quitting GDB just prints the result class '^exit'.
  25631. -> (gdb)
  25632. <- -gdb-exit
  25633. <- ^exit
  25634. Please note that '^exit' is printed immediately, but it might take
  25635. some time for GDB to actually exit. During that time, GDB performs
  25636. necessary cleanups, including killing programs being debugged or
  25637. disconnecting from debug hardware, so the frontend should wait till GDB
  25638. exits and should only forcibly kill GDB if it fails to exit in
  25639. reasonable time.
  25640. A Bad Command
  25641. -------------
  25642. Here's what happens if you pass a non-existent command:
  25643. -> -rubbish
  25644. <- ^error,msg="Undefined MI command: rubbish"
  25645. <- (gdb)
  25646. 
  25647. File: gdb.info, Node: GDB/MI Command Description Format, Next: GDB/MI Breakpoint Commands, Prev: GDB/MI Simple Examples, Up: GDB/MI
  25648. 27.7 GDB/MI Command Description Format
  25649. ======================================
  25650. The remaining sections describe blocks of commands. Each block of
  25651. commands is laid out in a fashion similar to this section.
  25652. Motivation
  25653. ----------
  25654. The motivation for this collection of commands.
  25655. Introduction
  25656. ------------
  25657. A brief introduction to this collection of commands as a whole.
  25658. Commands
  25659. --------
  25660. For each command in the block, the following is described:
  25661. Synopsis
  25662. ........
  25663. -command ARGS...
  25664. Result
  25665. ......
  25666. GDB Command
  25667. ...........
  25668. The corresponding GDB CLI command(s), if any.
  25669. Example
  25670. .......
  25671. Example(s) formatted for readability. Some of the described commands
  25672. have not been implemented yet and these are labeled N.A. (not
  25673. available).
  25674. 
  25675. File: gdb.info, Node: GDB/MI Breakpoint Commands, Next: GDB/MI Catchpoint Commands, Prev: GDB/MI Command Description Format, Up: GDB/MI
  25676. 27.8 GDB/MI Breakpoint Commands
  25677. ===============================
  25678. This section documents GDB/MI commands for manipulating breakpoints.
  25679. The '-break-after' Command
  25680. --------------------------
  25681. Synopsis
  25682. ........
  25683. -break-after NUMBER COUNT
  25684. The breakpoint number NUMBER is not in effect until it has been hit
  25685. COUNT times. To see how this is reflected in the output of the
  25686. '-break-list' command, see the description of the '-break-list' command
  25687. below.
  25688. GDB Command
  25689. ...........
  25690. The corresponding GDB command is 'ignore'.
  25691. Example
  25692. .......
  25693. (gdb)
  25694. -break-insert main
  25695. ^done,bkpt={number="1",type="breakpoint",disp="keep",
  25696. enabled="y",addr="0x000100d0",func="main",file="hello.c",
  25697. fullname="/home/foo/hello.c",line="5",thread-groups=["i1"],
  25698. times="0"}
  25699. (gdb)
  25700. -break-after 1 3
  25701. ~
  25702. ^done
  25703. (gdb)
  25704. -break-list
  25705. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  25706. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  25707. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  25708. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  25709. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  25710. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  25711. {width="40",alignment="2",col_name="what",colhdr="What"}],
  25712. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  25713. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  25714. line="5",thread-groups=["i1"],times="0",ignore="3"}]}
  25715. (gdb)
  25716. The '-break-commands' Command
  25717. -----------------------------
  25718. Synopsis
  25719. ........
  25720. -break-commands NUMBER [ COMMAND1 ... COMMANDN ]
  25721. Specifies the CLI commands that should be executed when breakpoint
  25722. NUMBER is hit. The parameters COMMAND1 to COMMANDN are the commands.
  25723. If no command is specified, any previously-set commands are cleared.
  25724. *Note Break Commands::. Typical use of this functionality is tracing a
  25725. program, that is, printing of values of some variables whenever
  25726. breakpoint is hit and then continuing.
  25727. GDB Command
  25728. ...........
  25729. The corresponding GDB command is 'commands'.
  25730. Example
  25731. .......
  25732. (gdb)
  25733. -break-insert main
  25734. ^done,bkpt={number="1",type="breakpoint",disp="keep",
  25735. enabled="y",addr="0x000100d0",func="main",file="hello.c",
  25736. fullname="/home/foo/hello.c",line="5",thread-groups=["i1"],
  25737. times="0"}
  25738. (gdb)
  25739. -break-commands 1 "print v" "continue"
  25740. ^done
  25741. (gdb)
  25742. The '-break-condition' Command
  25743. ------------------------------
  25744. Synopsis
  25745. ........
  25746. -break-condition NUMBER EXPR
  25747. Breakpoint NUMBER will stop the program only if the condition in EXPR
  25748. is true. The condition becomes part of the '-break-list' output (see
  25749. the description of the '-break-list' command below).
  25750. GDB Command
  25751. ...........
  25752. The corresponding GDB command is 'condition'.
  25753. Example
  25754. .......
  25755. (gdb)
  25756. -break-condition 1 1
  25757. ^done
  25758. (gdb)
  25759. -break-list
  25760. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  25761. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  25762. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  25763. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  25764. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  25765. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  25766. {width="40",alignment="2",col_name="what",colhdr="What"}],
  25767. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  25768. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  25769. line="5",cond="1",thread-groups=["i1"],times="0",ignore="3"}]}
  25770. (gdb)
  25771. The '-break-delete' Command
  25772. ---------------------------
  25773. Synopsis
  25774. ........
  25775. -break-delete ( BREAKPOINT )+
  25776. Delete the breakpoint(s) whose number(s) are specified in the
  25777. argument list. This is obviously reflected in the breakpoint list.
  25778. GDB Command
  25779. ...........
  25780. The corresponding GDB command is 'delete'.
  25781. Example
  25782. .......
  25783. (gdb)
  25784. -break-delete 1
  25785. ^done
  25786. (gdb)
  25787. -break-list
  25788. ^done,BreakpointTable={nr_rows="0",nr_cols="6",
  25789. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  25790. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  25791. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  25792. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  25793. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  25794. {width="40",alignment="2",col_name="what",colhdr="What"}],
  25795. body=[]}
  25796. (gdb)
  25797. The '-break-disable' Command
  25798. ----------------------------
  25799. Synopsis
  25800. ........
  25801. -break-disable ( BREAKPOINT )+
  25802. Disable the named BREAKPOINT(s). The field 'enabled' in the break
  25803. list is now set to 'n' for the named BREAKPOINT(s).
  25804. GDB Command
  25805. ...........
  25806. The corresponding GDB command is 'disable'.
  25807. Example
  25808. .......
  25809. (gdb)
  25810. -break-disable 2
  25811. ^done
  25812. (gdb)
  25813. -break-list
  25814. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  25815. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  25816. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  25817. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  25818. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  25819. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  25820. {width="40",alignment="2",col_name="what",colhdr="What"}],
  25821. body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="n",
  25822. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  25823. line="5",thread-groups=["i1"],times="0"}]}
  25824. (gdb)
  25825. The '-break-enable' Command
  25826. ---------------------------
  25827. Synopsis
  25828. ........
  25829. -break-enable ( BREAKPOINT )+
  25830. Enable (previously disabled) BREAKPOINT(s).
  25831. GDB Command
  25832. ...........
  25833. The corresponding GDB command is 'enable'.
  25834. Example
  25835. .......
  25836. (gdb)
  25837. -break-enable 2
  25838. ^done
  25839. (gdb)
  25840. -break-list
  25841. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  25842. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  25843. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  25844. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  25845. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  25846. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  25847. {width="40",alignment="2",col_name="what",colhdr="What"}],
  25848. body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
  25849. addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
  25850. line="5",thread-groups=["i1"],times="0"}]}
  25851. (gdb)
  25852. The '-break-info' Command
  25853. -------------------------
  25854. Synopsis
  25855. ........
  25856. -break-info BREAKPOINT
  25857. Get information about a single breakpoint.
  25858. The result is a table of breakpoints. *Note GDB/MI Breakpoint
  25859. Information::, for details on the format of each breakpoint in the
  25860. table.
  25861. GDB Command
  25862. ...........
  25863. The corresponding GDB command is 'info break BREAKPOINT'.
  25864. Example
  25865. .......
  25866. N.A.
  25867. The '-break-insert' Command
  25868. ---------------------------
  25869. Synopsis
  25870. ........
  25871. -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -a ]
  25872. [ -c CONDITION ] [ -i IGNORE-COUNT ]
  25873. [ -p THREAD-ID ] [ LOCATION ]
  25874. If specified, LOCATION, can be one of:
  25875. LINESPEC LOCATION
  25876. A linespec location. *Note Linespec Locations::.
  25877. EXPLICIT LOCATION
  25878. An explicit location. GDB/MI explicit locations are analogous to
  25879. the CLI's explicit locations using the option names listed below.
  25880. *Note Explicit Locations::.
  25881. '--source FILENAME'
  25882. The source file name of the location. This option requires
  25883. the use of either '--function' or '--line'.
  25884. '--function FUNCTION'
  25885. The name of a function or method.
  25886. '--label LABEL'
  25887. The name of a label.
  25888. '--line LINEOFFSET'
  25889. An absolute or relative line offset from the start of the
  25890. location.
  25891. ADDRESS LOCATION
  25892. An address location, *ADDRESS. *Note Address Locations::.
  25893. The possible optional parameters of this command are:
  25894. '-t'
  25895. Insert a temporary breakpoint.
  25896. '-h'
  25897. Insert a hardware breakpoint.
  25898. '-f'
  25899. If LOCATION cannot be parsed (for example if it refers to unknown
  25900. files or functions), create a pending breakpoint. Without this
  25901. flag, GDB will report an error, and won't create a breakpoint, if
  25902. LOCATION cannot be parsed.
  25903. '-d'
  25904. Create a disabled breakpoint.
  25905. '-a'
  25906. Create a tracepoint. *Note Tracepoints::. When this parameter is
  25907. used together with '-h', a fast tracepoint is created.
  25908. '-c CONDITION'
  25909. Make the breakpoint conditional on CONDITION.
  25910. '-i IGNORE-COUNT'
  25911. Initialize the IGNORE-COUNT.
  25912. '-p THREAD-ID'
  25913. Restrict the breakpoint to the thread with the specified global
  25914. THREAD-ID.
  25915. Result
  25916. ......
  25917. *Note GDB/MI Breakpoint Information::, for details on the format of the
  25918. resulting breakpoint.
  25919. Note: this format is open to change.
  25920. GDB Command
  25921. ...........
  25922. The corresponding GDB commands are 'break', 'tbreak', 'hbreak', and
  25923. 'thbreak'.
  25924. Example
  25925. .......
  25926. (gdb)
  25927. -break-insert main
  25928. ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",
  25929. fullname="/home/foo/recursive2.c,line="4",thread-groups=["i1"],
  25930. times="0"}
  25931. (gdb)
  25932. -break-insert -t foo
  25933. ^done,bkpt={number="2",addr="0x00010774",file="recursive2.c",
  25934. fullname="/home/foo/recursive2.c,line="11",thread-groups=["i1"],
  25935. times="0"}
  25936. (gdb)
  25937. -break-list
  25938. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  25939. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  25940. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  25941. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  25942. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  25943. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  25944. {width="40",alignment="2",col_name="what",colhdr="What"}],
  25945. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  25946. addr="0x0001072c", func="main",file="recursive2.c",
  25947. fullname="/home/foo/recursive2.c,"line="4",thread-groups=["i1"],
  25948. times="0"},
  25949. bkpt={number="2",type="breakpoint",disp="del",enabled="y",
  25950. addr="0x00010774",func="foo",file="recursive2.c",
  25951. fullname="/home/foo/recursive2.c",line="11",thread-groups=["i1"],
  25952. times="0"}]}
  25953. (gdb)
  25954. The '-dprintf-insert' Command
  25955. -----------------------------
  25956. Synopsis
  25957. ........
  25958. -dprintf-insert [ -t ] [ -f ] [ -d ]
  25959. [ -c CONDITION ] [ -i IGNORE-COUNT ]
  25960. [ -p THREAD-ID ] [ LOCATION ] [ FORMAT ]
  25961. [ ARGUMENT ]
  25962. If supplied, LOCATION may be specified the same way as for the
  25963. '-break-insert' command. *Note -break-insert::.
  25964. The possible optional parameters of this command are:
  25965. '-t'
  25966. Insert a temporary breakpoint.
  25967. '-f'
  25968. If LOCATION cannot be parsed (for example, if it refers to unknown
  25969. files or functions), create a pending breakpoint. Without this
  25970. flag, GDB will report an error, and won't create a breakpoint, if
  25971. LOCATION cannot be parsed.
  25972. '-d'
  25973. Create a disabled breakpoint.
  25974. '-c CONDITION'
  25975. Make the breakpoint conditional on CONDITION.
  25976. '-i IGNORE-COUNT'
  25977. Set the ignore count of the breakpoint (*note ignore count:
  25978. Conditions.) to IGNORE-COUNT.
  25979. '-p THREAD-ID'
  25980. Restrict the breakpoint to the thread with the specified global
  25981. THREAD-ID.
  25982. Result
  25983. ......
  25984. *Note GDB/MI Breakpoint Information::, for details on the format of the
  25985. resulting breakpoint.
  25986. GDB Command
  25987. ...........
  25988. The corresponding GDB command is 'dprintf'.
  25989. Example
  25990. .......
  25991. (gdb)
  25992. 4-dprintf-insert foo "At foo entry\n"
  25993. 4^done,bkpt={number="1",type="dprintf",disp="keep",enabled="y",
  25994. addr="0x000000000040061b",func="foo",file="mi-dprintf.c",
  25995. fullname="mi-dprintf.c",line="25",thread-groups=["i1"],
  25996. times="0",script={"printf \"At foo entry\\n\"","continue"},
  25997. original-location="foo"}
  25998. (gdb)
  25999. 5-dprintf-insert 26 "arg=%d, g=%d\n" arg g
  26000. 5^done,bkpt={number="2",type="dprintf",disp="keep",enabled="y",
  26001. addr="0x000000000040062a",func="foo",file="mi-dprintf.c",
  26002. fullname="mi-dprintf.c",line="26",thread-groups=["i1"],
  26003. times="0",script={"printf \"arg=%d, g=%d\\n\", arg, g","continue"},
  26004. original-location="mi-dprintf.c:26"}
  26005. (gdb)
  26006. The '-break-list' Command
  26007. -------------------------
  26008. Synopsis
  26009. ........
  26010. -break-list
  26011. Displays the list of inserted breakpoints, showing the following
  26012. fields:
  26013. 'Number'
  26014. number of the breakpoint
  26015. 'Type'
  26016. type of the breakpoint: 'breakpoint' or 'watchpoint'
  26017. 'Disposition'
  26018. should the breakpoint be deleted or disabled when it is hit: 'keep'
  26019. or 'nokeep'
  26020. 'Enabled'
  26021. is the breakpoint enabled or no: 'y' or 'n'
  26022. 'Address'
  26023. memory location at which the breakpoint is set
  26024. 'What'
  26025. logical location of the breakpoint, expressed by function name,
  26026. file name, line number
  26027. 'Thread-groups'
  26028. list of thread groups to which this breakpoint applies
  26029. 'Times'
  26030. number of times the breakpoint has been hit
  26031. If there are no breakpoints or watchpoints, the 'BreakpointTable'
  26032. 'body' field is an empty list.
  26033. GDB Command
  26034. ...........
  26035. The corresponding GDB command is 'info break'.
  26036. Example
  26037. .......
  26038. (gdb)
  26039. -break-list
  26040. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  26041. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26042. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26043. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26044. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26045. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26046. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26047. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  26048. addr="0x000100d0",func="main",file="hello.c",line="5",thread-groups=["i1"],
  26049. times="0"},
  26050. bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
  26051. addr="0x00010114",func="foo",file="hello.c",fullname="/home/foo/hello.c",
  26052. line="13",thread-groups=["i1"],times="0"}]}
  26053. (gdb)
  26054. Here's an example of the result when there are no breakpoints:
  26055. (gdb)
  26056. -break-list
  26057. ^done,BreakpointTable={nr_rows="0",nr_cols="6",
  26058. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26059. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26060. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26061. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26062. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26063. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26064. body=[]}
  26065. (gdb)
  26066. The '-break-passcount' Command
  26067. ------------------------------
  26068. Synopsis
  26069. ........
  26070. -break-passcount TRACEPOINT-NUMBER PASSCOUNT
  26071. Set the passcount for tracepoint TRACEPOINT-NUMBER to PASSCOUNT. If
  26072. the breakpoint referred to by TRACEPOINT-NUMBER is not a tracepoint,
  26073. error is emitted. This corresponds to CLI command 'passcount'.
  26074. The '-break-watch' Command
  26075. --------------------------
  26076. Synopsis
  26077. ........
  26078. -break-watch [ -a | -r ]
  26079. Create a watchpoint. With the '-a' option it will create an "access"
  26080. watchpoint, i.e., a watchpoint that triggers either on a read from or on
  26081. a write to the memory location. With the '-r' option, the watchpoint
  26082. created is a "read" watchpoint, i.e., it will trigger only when the
  26083. memory location is accessed for reading. Without either of the options,
  26084. the watchpoint created is a regular watchpoint, i.e., it will trigger
  26085. when the memory location is accessed for writing. *Note Setting
  26086. Watchpoints: Set Watchpoints.
  26087. Note that '-break-list' will report a single list of watchpoints and
  26088. breakpoints inserted.
  26089. GDB Command
  26090. ...........
  26091. The corresponding GDB commands are 'watch', 'awatch', and 'rwatch'.
  26092. Example
  26093. .......
  26094. Setting a watchpoint on a variable in the 'main' function:
  26095. (gdb)
  26096. -break-watch x
  26097. ^done,wpt={number="2",exp="x"}
  26098. (gdb)
  26099. -exec-continue
  26100. ^running
  26101. (gdb)
  26102. *stopped,reason="watchpoint-trigger",wpt={number="2",exp="x"},
  26103. value={old="-268439212",new="55"},
  26104. frame={func="main",args=[],file="recursive2.c",
  26105. fullname="/home/foo/bar/recursive2.c",line="5",arch="i386:x86_64"}
  26106. (gdb)
  26107. Setting a watchpoint on a variable local to a function. GDB will
  26108. stop the program execution twice: first for the variable changing value,
  26109. then for the watchpoint going out of scope.
  26110. (gdb)
  26111. -break-watch C
  26112. ^done,wpt={number="5",exp="C"}
  26113. (gdb)
  26114. -exec-continue
  26115. ^running
  26116. (gdb)
  26117. *stopped,reason="watchpoint-trigger",
  26118. wpt={number="5",exp="C"},value={old="-276895068",new="3"},
  26119. frame={func="callee4",args=[],
  26120. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  26121. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",
  26122. arch="i386:x86_64"}
  26123. (gdb)
  26124. -exec-continue
  26125. ^running
  26126. (gdb)
  26127. *stopped,reason="watchpoint-scope",wpnum="5",
  26128. frame={func="callee3",args=[{name="strarg",
  26129. value="0x11940 \"A string argument.\""}],
  26130. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  26131. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  26132. arch="i386:x86_64"}
  26133. (gdb)
  26134. Listing breakpoints and watchpoints, at different points in the
  26135. program execution. Note that once the watchpoint goes out of scope, it
  26136. is deleted.
  26137. (gdb)
  26138. -break-watch C
  26139. ^done,wpt={number="2",exp="C"}
  26140. (gdb)
  26141. -break-list
  26142. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  26143. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26144. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26145. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26146. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26147. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26148. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26149. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  26150. addr="0x00010734",func="callee4",
  26151. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  26152. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c"line="8",thread-groups=["i1"],
  26153. times="1"},
  26154. bkpt={number="2",type="watchpoint",disp="keep",
  26155. enabled="y",addr="",what="C",thread-groups=["i1"],times="0"}]}
  26156. (gdb)
  26157. -exec-continue
  26158. ^running
  26159. (gdb)
  26160. *stopped,reason="watchpoint-trigger",wpt={number="2",exp="C"},
  26161. value={old="-276895068",new="3"},
  26162. frame={func="callee4",args=[],
  26163. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  26164. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",
  26165. arch="i386:x86_64"}
  26166. (gdb)
  26167. -break-list
  26168. ^done,BreakpointTable={nr_rows="2",nr_cols="6",
  26169. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26170. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26171. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26172. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26173. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26174. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26175. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  26176. addr="0x00010734",func="callee4",
  26177. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  26178. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",thread-groups=["i1"],
  26179. times="1"},
  26180. bkpt={number="2",type="watchpoint",disp="keep",
  26181. enabled="y",addr="",what="C",thread-groups=["i1"],times="-5"}]}
  26182. (gdb)
  26183. -exec-continue
  26184. ^running
  26185. ^done,reason="watchpoint-scope",wpnum="2",
  26186. frame={func="callee3",args=[{name="strarg",
  26187. value="0x11940 \"A string argument.\""}],
  26188. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  26189. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  26190. arch="i386:x86_64"}
  26191. (gdb)
  26192. -break-list
  26193. ^done,BreakpointTable={nr_rows="1",nr_cols="6",
  26194. hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
  26195. {width="14",alignment="-1",col_name="type",colhdr="Type"},
  26196. {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
  26197. {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
  26198. {width="10",alignment="-1",col_name="addr",colhdr="Address"},
  26199. {width="40",alignment="2",col_name="what",colhdr="What"}],
  26200. body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  26201. addr="0x00010734",func="callee4",
  26202. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  26203. fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  26204. thread-groups=["i1"],times="1"}]}
  26205. (gdb)
  26206. 
  26207. File: gdb.info, Node: GDB/MI Catchpoint Commands, Next: GDB/MI Program Context, Prev: GDB/MI Breakpoint Commands, Up: GDB/MI
  26208. 27.9 GDB/MI Catchpoint Commands
  26209. ===============================
  26210. This section documents GDB/MI commands for manipulating catchpoints.
  26211. * Menu:
  26212. * Shared Library GDB/MI Catchpoint Commands::
  26213. * Ada Exception GDB/MI Catchpoint Commands::
  26214. 
  26215. File: gdb.info, Node: Shared Library GDB/MI Catchpoint Commands, Next: Ada Exception GDB/MI Catchpoint Commands, Up: GDB/MI Catchpoint Commands
  26216. 27.9.1 Shared Library GDB/MI Catchpoints
  26217. ----------------------------------------
  26218. The '-catch-load' Command
  26219. -------------------------
  26220. Synopsis
  26221. ........
  26222. -catch-load [ -t ] [ -d ] REGEXP
  26223. Add a catchpoint for library load events. If the '-t' option is
  26224. used, the catchpoint is a temporary one (*note Setting Breakpoints: Set
  26225. Breaks.). If the '-d' option is used, the catchpoint is created in a
  26226. disabled state. The 'regexp' argument is a regular expression used to
  26227. match the name of the loaded library.
  26228. GDB Command
  26229. ...........
  26230. The corresponding GDB command is 'catch load'.
  26231. Example
  26232. .......
  26233. -catch-load -t foo.so
  26234. ^done,bkpt={number="1",type="catchpoint",disp="del",enabled="y",
  26235. what="load of library matching foo.so",catch-type="load",times="0"}
  26236. (gdb)
  26237. The '-catch-unload' Command
  26238. ---------------------------
  26239. Synopsis
  26240. ........
  26241. -catch-unload [ -t ] [ -d ] REGEXP
  26242. Add a catchpoint for library unload events. If the '-t' option is
  26243. used, the catchpoint is a temporary one (*note Setting Breakpoints: Set
  26244. Breaks.). If the '-d' option is used, the catchpoint is created in a
  26245. disabled state. The 'regexp' argument is a regular expression used to
  26246. match the name of the unloaded library.
  26247. GDB Command
  26248. ...........
  26249. The corresponding GDB command is 'catch unload'.
  26250. Example
  26251. .......
  26252. -catch-unload -d bar.so
  26253. ^done,bkpt={number="2",type="catchpoint",disp="keep",enabled="n",
  26254. what="load of library matching bar.so",catch-type="unload",times="0"}
  26255. (gdb)
  26256. 
  26257. File: gdb.info, Node: Ada Exception GDB/MI Catchpoint Commands, Prev: Shared Library GDB/MI Catchpoint Commands, Up: GDB/MI Catchpoint Commands
  26258. 27.9.2 Ada Exception GDB/MI Catchpoints
  26259. ---------------------------------------
  26260. The following GDB/MI commands can be used to create catchpoints that
  26261. stop the execution when Ada exceptions are being raised.
  26262. The '-catch-assert' Command
  26263. ---------------------------
  26264. Synopsis
  26265. ........
  26266. -catch-assert [ -c CONDITION] [ -d ] [ -t ]
  26267. Add a catchpoint for failed Ada assertions.
  26268. The possible optional parameters for this command are:
  26269. '-c CONDITION'
  26270. Make the catchpoint conditional on CONDITION.
  26271. '-d'
  26272. Create a disabled catchpoint.
  26273. '-t'
  26274. Create a temporary catchpoint.
  26275. GDB Command
  26276. ...........
  26277. The corresponding GDB command is 'catch assert'.
  26278. Example
  26279. .......
  26280. -catch-assert
  26281. ^done,bkptno="5",bkpt={number="5",type="breakpoint",disp="keep",
  26282. enabled="y",addr="0x0000000000404888",what="failed Ada assertions",
  26283. thread-groups=["i1"],times="0",
  26284. original-location="__gnat_debug_raise_assert_failure"}
  26285. (gdb)
  26286. The '-catch-exception' Command
  26287. ------------------------------
  26288. Synopsis
  26289. ........
  26290. -catch-exception [ -c CONDITION] [ -d ] [ -e EXCEPTION-NAME ]
  26291. [ -t ] [ -u ]
  26292. Add a catchpoint stopping when Ada exceptions are raised. By
  26293. default, the command stops the program when any Ada exception gets
  26294. raised. But it is also possible, by using some of the optional
  26295. parameters described below, to create more selective catchpoints.
  26296. The possible optional parameters for this command are:
  26297. '-c CONDITION'
  26298. Make the catchpoint conditional on CONDITION.
  26299. '-d'
  26300. Create a disabled catchpoint.
  26301. '-e EXCEPTION-NAME'
  26302. Only stop when EXCEPTION-NAME is raised. This option cannot be
  26303. used combined with '-u'.
  26304. '-t'
  26305. Create a temporary catchpoint.
  26306. '-u'
  26307. Stop only when an unhandled exception gets raised. This option
  26308. cannot be used combined with '-e'.
  26309. GDB Command
  26310. ...........
  26311. The corresponding GDB commands are 'catch exception' and 'catch
  26312. exception unhandled'.
  26313. Example
  26314. .......
  26315. -catch-exception -e Program_Error
  26316. ^done,bkptno="4",bkpt={number="4",type="breakpoint",disp="keep",
  26317. enabled="y",addr="0x0000000000404874",
  26318. what="`Program_Error' Ada exception", thread-groups=["i1"],
  26319. times="0",original-location="__gnat_debug_raise_exception"}
  26320. (gdb)
  26321. The '-catch-handlers' Command
  26322. -----------------------------
  26323. Synopsis
  26324. ........
  26325. -catch-handlers [ -c CONDITION] [ -d ] [ -e EXCEPTION-NAME ]
  26326. [ -t ]
  26327. Add a catchpoint stopping when Ada exceptions are handled. By
  26328. default, the command stops the program when any Ada exception gets
  26329. handled. But it is also possible, by using some of the optional
  26330. parameters described below, to create more selective catchpoints.
  26331. The possible optional parameters for this command are:
  26332. '-c CONDITION'
  26333. Make the catchpoint conditional on CONDITION.
  26334. '-d'
  26335. Create a disabled catchpoint.
  26336. '-e EXCEPTION-NAME'
  26337. Only stop when EXCEPTION-NAME is handled.
  26338. '-t'
  26339. Create a temporary catchpoint.
  26340. GDB Command
  26341. ...........
  26342. The corresponding GDB command is 'catch handlers'.
  26343. Example
  26344. .......
  26345. -catch-handlers -e Constraint_Error
  26346. ^done,bkptno="4",bkpt={number="4",type="breakpoint",disp="keep",
  26347. enabled="y",addr="0x0000000000402f68",
  26348. what="`Constraint_Error' Ada exception handlers",thread-groups=["i1"],
  26349. times="0",original-location="__gnat_begin_handler"}
  26350. (gdb)
  26351. 
  26352. File: gdb.info, Node: GDB/MI Program Context, Next: GDB/MI Thread Commands, Prev: GDB/MI Catchpoint Commands, Up: GDB/MI
  26353. 27.10 GDB/MI Program Context
  26354. ============================
  26355. The '-exec-arguments' Command
  26356. -----------------------------
  26357. Synopsis
  26358. ........
  26359. -exec-arguments ARGS
  26360. Set the inferior program arguments, to be used in the next
  26361. '-exec-run'.
  26362. GDB Command
  26363. ...........
  26364. The corresponding GDB command is 'set args'.
  26365. Example
  26366. .......
  26367. (gdb)
  26368. -exec-arguments -v word
  26369. ^done
  26370. (gdb)
  26371. The '-environment-cd' Command
  26372. -----------------------------
  26373. Synopsis
  26374. ........
  26375. -environment-cd PATHDIR
  26376. Set GDB's working directory.
  26377. GDB Command
  26378. ...........
  26379. The corresponding GDB command is 'cd'.
  26380. Example
  26381. .......
  26382. (gdb)
  26383. -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
  26384. ^done
  26385. (gdb)
  26386. The '-environment-directory' Command
  26387. ------------------------------------
  26388. Synopsis
  26389. ........
  26390. -environment-directory [ -r ] [ PATHDIR ]+
  26391. Add directories PATHDIR to beginning of search path for source files.
  26392. If the '-r' option is used, the search path is reset to the default
  26393. search path. If directories PATHDIR are supplied in addition to the
  26394. '-r' option, the search path is first reset and then addition occurs as
  26395. normal. Multiple directories may be specified, separated by blanks.
  26396. Specifying multiple directories in a single command results in the
  26397. directories added to the beginning of the search path in the same order
  26398. they were presented in the command. If blanks are needed as part of a
  26399. directory name, double-quotes should be used around the name. In the
  26400. command output, the path will show up separated by the system
  26401. directory-separator character. The directory-separator character must
  26402. not be used in any directory name. If no directories are specified, the
  26403. current search path is displayed.
  26404. GDB Command
  26405. ...........
  26406. The corresponding GDB command is 'dir'.
  26407. Example
  26408. .......
  26409. (gdb)
  26410. -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
  26411. ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
  26412. (gdb)
  26413. -environment-directory ""
  26414. ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
  26415. (gdb)
  26416. -environment-directory -r /home/jjohnstn/src/gdb /usr/src
  26417. ^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
  26418. (gdb)
  26419. -environment-directory -r
  26420. ^done,source-path="$cdir:$cwd"
  26421. (gdb)
  26422. The '-environment-path' Command
  26423. -------------------------------
  26424. Synopsis
  26425. ........
  26426. -environment-path [ -r ] [ PATHDIR ]+
  26427. Add directories PATHDIR to beginning of search path for object files.
  26428. If the '-r' option is used, the search path is reset to the original
  26429. search path that existed at gdb start-up. If directories PATHDIR are
  26430. supplied in addition to the '-r' option, the search path is first reset
  26431. and then addition occurs as normal. Multiple directories may be
  26432. specified, separated by blanks. Specifying multiple directories in a
  26433. single command results in the directories added to the beginning of the
  26434. search path in the same order they were presented in the command. If
  26435. blanks are needed as part of a directory name, double-quotes should be
  26436. used around the name. In the command output, the path will show up
  26437. separated by the system directory-separator character. The
  26438. directory-separator character must not be used in any directory name.
  26439. If no directories are specified, the current path is displayed.
  26440. GDB Command
  26441. ...........
  26442. The corresponding GDB command is 'path'.
  26443. Example
  26444. .......
  26445. (gdb)
  26446. -environment-path
  26447. ^done,path="/usr/bin"
  26448. (gdb)
  26449. -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
  26450. ^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
  26451. (gdb)
  26452. -environment-path -r /usr/local/bin
  26453. ^done,path="/usr/local/bin:/usr/bin"
  26454. (gdb)
  26455. The '-environment-pwd' Command
  26456. ------------------------------
  26457. Synopsis
  26458. ........
  26459. -environment-pwd
  26460. Show the current working directory.
  26461. GDB Command
  26462. ...........
  26463. The corresponding GDB command is 'pwd'.
  26464. Example
  26465. .......
  26466. (gdb)
  26467. -environment-pwd
  26468. ^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
  26469. (gdb)
  26470. 
  26471. File: gdb.info, Node: GDB/MI Thread Commands, Next: GDB/MI Ada Tasking Commands, Prev: GDB/MI Program Context, Up: GDB/MI
  26472. 27.11 GDB/MI Thread Commands
  26473. ============================
  26474. The '-thread-info' Command
  26475. --------------------------
  26476. Synopsis
  26477. ........
  26478. -thread-info [ THREAD-ID ]
  26479. Reports information about either a specific thread, if the THREAD-ID
  26480. parameter is present, or about all threads. THREAD-ID is the thread's
  26481. global thread ID. When printing information about all threads, also
  26482. reports the global ID of the current thread.
  26483. GDB Command
  26484. ...........
  26485. The 'info thread' command prints the same information about all threads.
  26486. Result
  26487. ......
  26488. The result contains the following attributes:
  26489. 'threads'
  26490. A list of threads. The format of the elements of the list is
  26491. described in *note GDB/MI Thread Information::.
  26492. 'current-thread-id'
  26493. The global id of the currently selected thread. This field is
  26494. omitted if there is no selected thread (for example, when the
  26495. selected inferior is not running, and therefore has no threads) or
  26496. if a THREAD-ID argument was passed to the command.
  26497. Example
  26498. .......
  26499. -thread-info
  26500. ^done,threads=[
  26501. {id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
  26502. frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",
  26503. args=[]},state="running"},
  26504. {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
  26505. frame={level="0",addr="0x0804891f",func="foo",
  26506. args=[{name="i",value="10"}],
  26507. file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"},
  26508. state="running"}],
  26509. current-thread-id="1"
  26510. (gdb)
  26511. The '-thread-list-ids' Command
  26512. ------------------------------
  26513. Synopsis
  26514. ........
  26515. -thread-list-ids
  26516. Produces a list of the currently known global GDB thread ids. At the
  26517. end of the list it also prints the total number of such threads.
  26518. This command is retained for historical reasons, the '-thread-info'
  26519. command should be used instead.
  26520. GDB Command
  26521. ...........
  26522. Part of 'info threads' supplies the same information.
  26523. Example
  26524. .......
  26525. (gdb)
  26526. -thread-list-ids
  26527. ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},
  26528. current-thread-id="1",number-of-threads="3"
  26529. (gdb)
  26530. The '-thread-select' Command
  26531. ----------------------------
  26532. Synopsis
  26533. ........
  26534. -thread-select THREAD-ID
  26535. Make thread with global thread number THREAD-ID the current thread.
  26536. It prints the number of the new current thread, and the topmost frame
  26537. for that thread.
  26538. This command is deprecated in favor of explicitly using the
  26539. '--thread' option to each command.
  26540. GDB Command
  26541. ...........
  26542. The corresponding GDB command is 'thread'.
  26543. Example
  26544. .......
  26545. (gdb)
  26546. -exec-next
  26547. ^running
  26548. (gdb)
  26549. *stopped,reason="end-stepping-range",thread-id="2",line="187",
  26550. file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
  26551. (gdb)
  26552. -thread-list-ids
  26553. ^done,
  26554. thread-ids={thread-id="3",thread-id="2",thread-id="1"},
  26555. number-of-threads="3"
  26556. (gdb)
  26557. -thread-select 3
  26558. ^done,new-thread-id="3",
  26559. frame={level="0",func="vprintf",
  26560. args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""},
  26561. {name="arg",value="0x2"}],file="vprintf.c",line="31",arch="i386:x86_64"}
  26562. (gdb)
  26563. 
  26564. File: gdb.info, Node: GDB/MI Ada Tasking Commands, Next: GDB/MI Program Execution, Prev: GDB/MI Thread Commands, Up: GDB/MI
  26565. 27.12 GDB/MI Ada Tasking Commands
  26566. =================================
  26567. The '-ada-task-info' Command
  26568. ----------------------------
  26569. Synopsis
  26570. ........
  26571. -ada-task-info [ TASK-ID ]
  26572. Reports information about either a specific Ada task, if the TASK-ID
  26573. parameter is present, or about all Ada tasks.
  26574. GDB Command
  26575. ...........
  26576. The 'info tasks' command prints the same information about all Ada tasks
  26577. (*note Ada Tasks::).
  26578. Result
  26579. ......
  26580. The result is a table of Ada tasks. The following columns are defined
  26581. for each Ada task:
  26582. 'current'
  26583. This field exists only for the current thread. It has the value
  26584. '*'.
  26585. 'id'
  26586. The identifier that GDB uses to refer to the Ada task.
  26587. 'task-id'
  26588. The identifier that the target uses to refer to the Ada task.
  26589. 'thread-id'
  26590. The global thread identifier of the thread corresponding to the Ada
  26591. task.
  26592. This field should always exist, as Ada tasks are always implemented
  26593. on top of a thread. But if GDB cannot find this corresponding
  26594. thread for any reason, the field is omitted.
  26595. 'parent-id'
  26596. This field exists only when the task was created by another task.
  26597. In this case, it provides the ID of the parent task.
  26598. 'priority'
  26599. The base priority of the task.
  26600. 'state'
  26601. The current state of the task. For a detailed description of the
  26602. possible states, see *note Ada Tasks::.
  26603. 'name'
  26604. The name of the task.
  26605. Example
  26606. .......
  26607. -ada-task-info
  26608. ^done,tasks={nr_rows="3",nr_cols="8",
  26609. hdr=[{width="1",alignment="-1",col_name="current",colhdr=""},
  26610. {width="3",alignment="1",col_name="id",colhdr="ID"},
  26611. {width="9",alignment="1",col_name="task-id",colhdr="TID"},
  26612. {width="4",alignment="1",col_name="thread-id",colhdr=""},
  26613. {width="4",alignment="1",col_name="parent-id",colhdr="P-ID"},
  26614. {width="3",alignment="1",col_name="priority",colhdr="Pri"},
  26615. {width="22",alignment="-1",col_name="state",colhdr="State"},
  26616. {width="1",alignment="2",col_name="name",colhdr="Name"}],
  26617. body=[{current="*",id="1",task-id=" 644010",thread-id="1",priority="48",
  26618. state="Child Termination Wait",name="main_task"}]}
  26619. (gdb)
  26620. 
  26621. File: gdb.info, Node: GDB/MI Program Execution, Next: GDB/MI Stack Manipulation, Prev: GDB/MI Ada Tasking Commands, Up: GDB/MI
  26622. 27.13 GDB/MI Program Execution
  26623. ==============================
  26624. These are the asynchronous commands which generate the out-of-band
  26625. record '*stopped'. Currently GDB only really executes asynchronously
  26626. with remote targets and this interaction is mimicked in other cases.
  26627. The '-exec-continue' Command
  26628. ----------------------------
  26629. Synopsis
  26630. ........
  26631. -exec-continue [--reverse] [--all|--thread-group N]
  26632. Resumes the execution of the inferior program, which will continue to
  26633. execute until it reaches a debugger stop event. If the '--reverse'
  26634. option is specified, execution resumes in reverse until it reaches a
  26635. stop event. Stop events may include
  26636. * breakpoints or watchpoints
  26637. * signals or exceptions
  26638. * the end of the process (or its beginning under '--reverse')
  26639. * the end or beginning of a replay log if one is being used.
  26640. In all-stop mode (*note All-Stop Mode::), may resume only one thread,
  26641. or all threads, depending on the value of the 'scheduler-locking'
  26642. variable. If '--all' is specified, all threads (in all inferiors) will
  26643. be resumed. The '--all' option is ignored in all-stop mode. If the
  26644. '--thread-group' options is specified, then all threads in that thread
  26645. group are resumed.
  26646. GDB Command
  26647. ...........
  26648. The corresponding GDB corresponding is 'continue'.
  26649. Example
  26650. .......
  26651. -exec-continue
  26652. ^running
  26653. (gdb)
  26654. @Hello world
  26655. *stopped,reason="breakpoint-hit",disp="keep",bkptno="2",frame={
  26656. func="foo",args=[],file="hello.c",fullname="/home/foo/bar/hello.c",
  26657. line="13",arch="i386:x86_64"}
  26658. (gdb)
  26659. The '-exec-finish' Command
  26660. --------------------------
  26661. Synopsis
  26662. ........
  26663. -exec-finish [--reverse]
  26664. Resumes the execution of the inferior program until the current
  26665. function is exited. Displays the results returned by the function. If
  26666. the '--reverse' option is specified, resumes the reverse execution of
  26667. the inferior program until the point where current function was called.
  26668. GDB Command
  26669. ...........
  26670. The corresponding GDB command is 'finish'.
  26671. Example
  26672. .......
  26673. Function returning 'void'.
  26674. -exec-finish
  26675. ^running
  26676. (gdb)
  26677. @hello from foo
  26678. *stopped,reason="function-finished",frame={func="main",args=[],
  26679. file="hello.c",fullname="/home/foo/bar/hello.c",line="7",arch="i386:x86_64"}
  26680. (gdb)
  26681. Function returning other than 'void'. The name of the internal GDB
  26682. variable storing the result is printed, together with the value itself.
  26683. -exec-finish
  26684. ^running
  26685. (gdb)
  26686. *stopped,reason="function-finished",frame={addr="0x000107b0",func="foo",
  26687. args=[{name="a",value="1"],{name="b",value="9"}},
  26688. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  26689. arch="i386:x86_64"},
  26690. gdb-result-var="$1",return-value="0"
  26691. (gdb)
  26692. The '-exec-interrupt' Command
  26693. -----------------------------
  26694. Synopsis
  26695. ........
  26696. -exec-interrupt [--all|--thread-group N]
  26697. Interrupts the background execution of the target. Note how the
  26698. token associated with the stop message is the one for the execution
  26699. command that has been interrupted. The token for the interrupt itself
  26700. only appears in the '^done' output. If the user is trying to interrupt
  26701. a non-running program, an error message will be printed.
  26702. Note that when asynchronous execution is enabled, this command is
  26703. asynchronous just like other execution commands. That is, first the
  26704. '^done' response will be printed, and the target stop will be reported
  26705. after that using the '*stopped' notification.
  26706. In non-stop mode, only the context thread is interrupted by default.
  26707. All threads (in all inferiors) will be interrupted if the '--all' option
  26708. is specified. If the '--thread-group' option is specified, all threads
  26709. in that group will be interrupted.
  26710. GDB Command
  26711. ...........
  26712. The corresponding GDB command is 'interrupt'.
  26713. Example
  26714. .......
  26715. (gdb)
  26716. 111-exec-continue
  26717. 111^running
  26718. (gdb)
  26719. 222-exec-interrupt
  26720. 222^done
  26721. (gdb)
  26722. 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
  26723. frame={addr="0x00010140",func="foo",args=[],file="try.c",
  26724. fullname="/home/foo/bar/try.c",line="13",arch="i386:x86_64"}
  26725. (gdb)
  26726. (gdb)
  26727. -exec-interrupt
  26728. ^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
  26729. (gdb)
  26730. The '-exec-jump' Command
  26731. ------------------------
  26732. Synopsis
  26733. ........
  26734. -exec-jump LOCATION
  26735. Resumes execution of the inferior program at the location specified
  26736. by parameter. *Note Specify Location::, for a description of the
  26737. different forms of LOCATION.
  26738. GDB Command
  26739. ...........
  26740. The corresponding GDB command is 'jump'.
  26741. Example
  26742. .......
  26743. -exec-jump foo.c:10
  26744. *running,thread-id="all"
  26745. ^running
  26746. The '-exec-next' Command
  26747. ------------------------
  26748. Synopsis
  26749. ........
  26750. -exec-next [--reverse]
  26751. Resumes execution of the inferior program, stopping when the
  26752. beginning of the next source line is reached.
  26753. If the '--reverse' option is specified, resumes reverse execution of
  26754. the inferior program, stopping at the beginning of the previous source
  26755. line. If you issue this command on the first line of a function, it
  26756. will take you back to the caller of that function, to the source line
  26757. where the function was called.
  26758. GDB Command
  26759. ...........
  26760. The corresponding GDB command is 'next'.
  26761. Example
  26762. .......
  26763. -exec-next
  26764. ^running
  26765. (gdb)
  26766. *stopped,reason="end-stepping-range",line="8",file="hello.c"
  26767. (gdb)
  26768. The '-exec-next-instruction' Command
  26769. ------------------------------------
  26770. Synopsis
  26771. ........
  26772. -exec-next-instruction [--reverse]
  26773. Executes one machine instruction. If the instruction is a function
  26774. call, continues until the function returns. If the program stops at an
  26775. instruction in the middle of a source line, the address will be printed
  26776. as well.
  26777. If the '--reverse' option is specified, resumes reverse execution of
  26778. the inferior program, stopping at the previous instruction. If the
  26779. previously executed instruction was a return from another function, it
  26780. will continue to execute in reverse until the call to that function
  26781. (from the current stack frame) is reached.
  26782. GDB Command
  26783. ...........
  26784. The corresponding GDB command is 'nexti'.
  26785. Example
  26786. .......
  26787. (gdb)
  26788. -exec-next-instruction
  26789. ^running
  26790. (gdb)
  26791. *stopped,reason="end-stepping-range",
  26792. addr="0x000100d4",line="5",file="hello.c"
  26793. (gdb)
  26794. The '-exec-return' Command
  26795. --------------------------
  26796. Synopsis
  26797. ........
  26798. -exec-return
  26799. Makes current function return immediately. Doesn't execute the
  26800. inferior. Displays the new current frame.
  26801. GDB Command
  26802. ...........
  26803. The corresponding GDB command is 'return'.
  26804. Example
  26805. .......
  26806. (gdb)
  26807. 200-break-insert callee4
  26808. 200^done,bkpt={number="1",addr="0x00010734",
  26809. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
  26810. (gdb)
  26811. 000-exec-run
  26812. 000^running
  26813. (gdb)
  26814. 000*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
  26815. frame={func="callee4",args=[],
  26816. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  26817. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  26818. arch="i386:x86_64"}
  26819. (gdb)
  26820. 205-break-delete
  26821. 205^done
  26822. (gdb)
  26823. 111-exec-return
  26824. 111^done,frame={level="0",func="callee3",
  26825. args=[{name="strarg",
  26826. value="0x11940 \"A string argument.\""}],
  26827. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  26828. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
  26829. arch="i386:x86_64"}
  26830. (gdb)
  26831. The '-exec-run' Command
  26832. -----------------------
  26833. Synopsis
  26834. ........
  26835. -exec-run [ --all | --thread-group N ] [ --start ]
  26836. Starts execution of the inferior from the beginning. The inferior
  26837. executes until either a breakpoint is encountered or the program exits.
  26838. In the latter case the output will include an exit code, if the program
  26839. has exited exceptionally.
  26840. When neither the '--all' nor the '--thread-group' option is
  26841. specified, the current inferior is started. If the '--thread-group'
  26842. option is specified, it should refer to a thread group of type
  26843. 'process', and that thread group will be started. If the '--all' option
  26844. is specified, then all inferiors will be started.
  26845. Using the '--start' option instructs the debugger to stop the
  26846. execution at the start of the inferior's main subprogram, following the
  26847. same behavior as the 'start' command (*note Starting::).
  26848. GDB Command
  26849. ...........
  26850. The corresponding GDB command is 'run'.
  26851. Examples
  26852. ........
  26853. (gdb)
  26854. -break-insert main
  26855. ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"}
  26856. (gdb)
  26857. -exec-run
  26858. ^running
  26859. (gdb)
  26860. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
  26861. frame={func="main",args=[],file="recursive2.c",
  26862. fullname="/home/foo/bar/recursive2.c",line="4",arch="i386:x86_64"}
  26863. (gdb)
  26864. Program exited normally:
  26865. (gdb)
  26866. -exec-run
  26867. ^running
  26868. (gdb)
  26869. x = 55
  26870. *stopped,reason="exited-normally"
  26871. (gdb)
  26872. Program exited exceptionally:
  26873. (gdb)
  26874. -exec-run
  26875. ^running
  26876. (gdb)
  26877. x = 55
  26878. *stopped,reason="exited",exit-code="01"
  26879. (gdb)
  26880. Another way the program can terminate is if it receives a signal such
  26881. as 'SIGINT'. In this case, GDB/MI displays this:
  26882. (gdb)
  26883. *stopped,reason="exited-signalled",signal-name="SIGINT",
  26884. signal-meaning="Interrupt"
  26885. The '-exec-step' Command
  26886. ------------------------
  26887. Synopsis
  26888. ........
  26889. -exec-step [--reverse]
  26890. Resumes execution of the inferior program, stopping when the
  26891. beginning of the next source line is reached, if the next source line is
  26892. not a function call. If it is, stop at the first instruction of the
  26893. called function. If the '--reverse' option is specified, resumes
  26894. reverse execution of the inferior program, stopping at the beginning of
  26895. the previously executed source line.
  26896. GDB Command
  26897. ...........
  26898. The corresponding GDB command is 'step'.
  26899. Example
  26900. .......
  26901. Stepping into a function:
  26902. -exec-step
  26903. ^running
  26904. (gdb)
  26905. *stopped,reason="end-stepping-range",
  26906. frame={func="foo",args=[{name="a",value="10"},
  26907. {name="b",value="0"}],file="recursive2.c",
  26908. fullname="/home/foo/bar/recursive2.c",line="11",arch="i386:x86_64"}
  26909. (gdb)
  26910. Regular stepping:
  26911. -exec-step
  26912. ^running
  26913. (gdb)
  26914. *stopped,reason="end-stepping-range",line="14",file="recursive2.c"
  26915. (gdb)
  26916. The '-exec-step-instruction' Command
  26917. ------------------------------------
  26918. Synopsis
  26919. ........
  26920. -exec-step-instruction [--reverse]
  26921. Resumes the inferior which executes one machine instruction. If the
  26922. '--reverse' option is specified, resumes reverse execution of the
  26923. inferior program, stopping at the previously executed instruction. The
  26924. output, once GDB has stopped, will vary depending on whether we have
  26925. stopped in the middle of a source line or not. In the former case, the
  26926. address at which the program stopped will be printed as well.
  26927. GDB Command
  26928. ...........
  26929. The corresponding GDB command is 'stepi'.
  26930. Example
  26931. .......
  26932. (gdb)
  26933. -exec-step-instruction
  26934. ^running
  26935. (gdb)
  26936. *stopped,reason="end-stepping-range",
  26937. frame={func="foo",args=[],file="try.c",
  26938. fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"}
  26939. (gdb)
  26940. -exec-step-instruction
  26941. ^running
  26942. (gdb)
  26943. *stopped,reason="end-stepping-range",
  26944. frame={addr="0x000100f4",func="foo",args=[],file="try.c",
  26945. fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"}
  26946. (gdb)
  26947. The '-exec-until' Command
  26948. -------------------------
  26949. Synopsis
  26950. ........
  26951. -exec-until [ LOCATION ]
  26952. Executes the inferior until the LOCATION specified in the argument is
  26953. reached. If there is no argument, the inferior executes until a source
  26954. line greater than the current one is reached. The reason for stopping
  26955. in this case will be 'location-reached'.
  26956. GDB Command
  26957. ...........
  26958. The corresponding GDB command is 'until'.
  26959. Example
  26960. .......
  26961. (gdb)
  26962. -exec-until recursive2.c:6
  26963. ^running
  26964. (gdb)
  26965. x = 55
  26966. *stopped,reason="location-reached",frame={func="main",args=[],
  26967. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6",
  26968. arch="i386:x86_64"}
  26969. (gdb)
  26970. 
  26971. File: gdb.info, Node: GDB/MI Stack Manipulation, Next: GDB/MI Variable Objects, Prev: GDB/MI Program Execution, Up: GDB/MI
  26972. 27.14 GDB/MI Stack Manipulation Commands
  26973. ========================================
  26974. The '-enable-frame-filters' Command
  26975. -----------------------------------
  26976. -enable-frame-filters
  26977. GDB allows Python-based frame filters to affect the output of the MI
  26978. commands relating to stack traces. As there is no way to implement this
  26979. in a fully backward-compatible way, a front end must request that this
  26980. functionality be enabled.
  26981. Once enabled, this feature cannot be disabled.
  26982. Note that if Python support has not been compiled into GDB, this
  26983. command will still succeed (and do nothing).
  26984. The '-stack-info-frame' Command
  26985. -------------------------------
  26986. Synopsis
  26987. ........
  26988. -stack-info-frame
  26989. Get info on the selected frame.
  26990. GDB Command
  26991. ...........
  26992. The corresponding GDB command is 'info frame' or 'frame' (without
  26993. arguments).
  26994. Example
  26995. .......
  26996. (gdb)
  26997. -stack-info-frame
  26998. ^done,frame={level="1",addr="0x0001076c",func="callee3",
  26999. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27000. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",
  27001. arch="i386:x86_64"}
  27002. (gdb)
  27003. The '-stack-info-depth' Command
  27004. -------------------------------
  27005. Synopsis
  27006. ........
  27007. -stack-info-depth [ MAX-DEPTH ]
  27008. Return the depth of the stack. If the integer argument MAX-DEPTH is
  27009. specified, do not count beyond MAX-DEPTH frames.
  27010. GDB Command
  27011. ...........
  27012. There's no equivalent GDB command.
  27013. Example
  27014. .......
  27015. For a stack with frame levels 0 through 11:
  27016. (gdb)
  27017. -stack-info-depth
  27018. ^done,depth="12"
  27019. (gdb)
  27020. -stack-info-depth 4
  27021. ^done,depth="4"
  27022. (gdb)
  27023. -stack-info-depth 12
  27024. ^done,depth="12"
  27025. (gdb)
  27026. -stack-info-depth 11
  27027. ^done,depth="11"
  27028. (gdb)
  27029. -stack-info-depth 13
  27030. ^done,depth="12"
  27031. (gdb)
  27032. The '-stack-list-arguments' Command
  27033. -----------------------------------
  27034. Synopsis
  27035. ........
  27036. -stack-list-arguments [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  27037. [ LOW-FRAME HIGH-FRAME ]
  27038. Display a list of the arguments for the frames between LOW-FRAME and
  27039. HIGH-FRAME (inclusive). If LOW-FRAME and HIGH-FRAME are not provided,
  27040. list the arguments for the whole call stack. If the two arguments are
  27041. equal, show the single frame at the corresponding level. It is an error
  27042. if LOW-FRAME is larger than the actual number of frames. On the other
  27043. hand, HIGH-FRAME may be larger than the actual number of frames, in
  27044. which case only existing frames will be returned.
  27045. If PRINT-VALUES is 0 or '--no-values', print only the names of the
  27046. variables; if it is 1 or '--all-values', print also their values; and if
  27047. it is 2 or '--simple-values', print the name, type and value for simple
  27048. data types, and the name and type for arrays, structures and unions. If
  27049. the option '--no-frame-filters' is supplied, then Python frame filters
  27050. will not be executed.
  27051. If the '--skip-unavailable' option is specified, arguments that are
  27052. not available are not listed. Partially available arguments are still
  27053. displayed, however.
  27054. Use of this command to obtain arguments in a single frame is
  27055. deprecated in favor of the '-stack-list-variables' command.
  27056. GDB Command
  27057. ...........
  27058. GDB does not have an equivalent command. 'gdbtk' has a 'gdb_get_args'
  27059. command which partially overlaps with the functionality of
  27060. '-stack-list-arguments'.
  27061. Example
  27062. .......
  27063. (gdb)
  27064. -stack-list-frames
  27065. ^done,
  27066. stack=[
  27067. frame={level="0",addr="0x00010734",func="callee4",
  27068. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27069. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
  27070. arch="i386:x86_64"},
  27071. frame={level="1",addr="0x0001076c",func="callee3",
  27072. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27073. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",
  27074. arch="i386:x86_64"},
  27075. frame={level="2",addr="0x0001078c",func="callee2",
  27076. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27077. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22",
  27078. arch="i386:x86_64"},
  27079. frame={level="3",addr="0x000107b4",func="callee1",
  27080. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27081. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27",
  27082. arch="i386:x86_64"},
  27083. frame={level="4",addr="0x000107e0",func="main",
  27084. file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  27085. fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32",
  27086. arch="i386:x86_64"}]
  27087. (gdb)
  27088. -stack-list-arguments 0
  27089. ^done,
  27090. stack-args=[
  27091. frame={level="0",args=[]},
  27092. frame={level="1",args=[name="strarg"]},
  27093. frame={level="2",args=[name="intarg",name="strarg"]},
  27094. frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]},
  27095. frame={level="4",args=[]}]
  27096. (gdb)
  27097. -stack-list-arguments 1
  27098. ^done,
  27099. stack-args=[
  27100. frame={level="0",args=[]},
  27101. frame={level="1",
  27102. args=[{name="strarg",value="0x11940 \"A string argument.\""}]},
  27103. frame={level="2",args=[
  27104. {name="intarg",value="2"},
  27105. {name="strarg",value="0x11940 \"A string argument.\""}]},
  27106. {frame={level="3",args=[
  27107. {name="intarg",value="2"},
  27108. {name="strarg",value="0x11940 \"A string argument.\""},
  27109. {name="fltarg",value="3.5"}]},
  27110. frame={level="4",args=[]}]
  27111. (gdb)
  27112. -stack-list-arguments 0 2 2
  27113. ^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}]
  27114. (gdb)
  27115. -stack-list-arguments 1 2 2
  27116. ^done,stack-args=[frame={level="2",
  27117. args=[{name="intarg",value="2"},
  27118. {name="strarg",value="0x11940 \"A string argument.\""}]}]
  27119. (gdb)
  27120. The '-stack-list-frames' Command
  27121. --------------------------------
  27122. Synopsis
  27123. ........
  27124. -stack-list-frames [ --no-frame-filters LOW-FRAME HIGH-FRAME ]
  27125. List the frames currently on the stack. For each frame it displays
  27126. the following info:
  27127. 'LEVEL'
  27128. The frame number, 0 being the topmost frame, i.e., the innermost
  27129. function.
  27130. 'ADDR'
  27131. The '$pc' value for that frame.
  27132. 'FUNC'
  27133. Function name.
  27134. 'FILE'
  27135. File name of the source file where the function lives.
  27136. 'FULLNAME'
  27137. The full file name of the source file where the function lives.
  27138. 'LINE'
  27139. Line number corresponding to the '$pc'.
  27140. 'FROM'
  27141. The shared library where this function is defined. This is only
  27142. given if the frame's function is not known.
  27143. 'ARCH'
  27144. Frame's architecture.
  27145. If invoked without arguments, this command prints a backtrace for the
  27146. whole stack. If given two integer arguments, it shows the frames whose
  27147. levels are between the two arguments (inclusive). If the two arguments
  27148. are equal, it shows the single frame at the corresponding level. It is
  27149. an error if LOW-FRAME is larger than the actual number of frames. On
  27150. the other hand, HIGH-FRAME may be larger than the actual number of
  27151. frames, in which case only existing frames will be returned. If the
  27152. option '--no-frame-filters' is supplied, then Python frame filters will
  27153. not be executed.
  27154. GDB Command
  27155. ...........
  27156. The corresponding GDB commands are 'backtrace' and 'where'.
  27157. Example
  27158. .......
  27159. Full stack backtrace:
  27160. (gdb)
  27161. -stack-list-frames
  27162. ^done,stack=
  27163. [frame={level="0",addr="0x0001076c",func="foo",
  27164. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11",
  27165. arch="i386:x86_64"},
  27166. frame={level="1",addr="0x000107a4",func="foo",
  27167. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27168. arch="i386:x86_64"},
  27169. frame={level="2",addr="0x000107a4",func="foo",
  27170. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27171. arch="i386:x86_64"},
  27172. frame={level="3",addr="0x000107a4",func="foo",
  27173. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27174. arch="i386:x86_64"},
  27175. frame={level="4",addr="0x000107a4",func="foo",
  27176. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27177. arch="i386:x86_64"},
  27178. frame={level="5",addr="0x000107a4",func="foo",
  27179. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27180. arch="i386:x86_64"},
  27181. frame={level="6",addr="0x000107a4",func="foo",
  27182. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27183. arch="i386:x86_64"},
  27184. frame={level="7",addr="0x000107a4",func="foo",
  27185. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27186. arch="i386:x86_64"},
  27187. frame={level="8",addr="0x000107a4",func="foo",
  27188. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27189. arch="i386:x86_64"},
  27190. frame={level="9",addr="0x000107a4",func="foo",
  27191. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27192. arch="i386:x86_64"},
  27193. frame={level="10",addr="0x000107a4",func="foo",
  27194. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27195. arch="i386:x86_64"},
  27196. frame={level="11",addr="0x00010738",func="main",
  27197. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4",
  27198. arch="i386:x86_64"}]
  27199. (gdb)
  27200. Show frames between LOW_FRAME and HIGH_FRAME:
  27201. (gdb)
  27202. -stack-list-frames 3 5
  27203. ^done,stack=
  27204. [frame={level="3",addr="0x000107a4",func="foo",
  27205. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27206. arch="i386:x86_64"},
  27207. frame={level="4",addr="0x000107a4",func="foo",
  27208. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27209. arch="i386:x86_64"},
  27210. frame={level="5",addr="0x000107a4",func="foo",
  27211. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27212. arch="i386:x86_64"}]
  27213. (gdb)
  27214. Show a single frame:
  27215. (gdb)
  27216. -stack-list-frames 3 3
  27217. ^done,stack=
  27218. [frame={level="3",addr="0x000107a4",func="foo",
  27219. file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
  27220. arch="i386:x86_64"}]
  27221. (gdb)
  27222. The '-stack-list-locals' Command
  27223. --------------------------------
  27224. Synopsis
  27225. ........
  27226. -stack-list-locals [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  27227. Display the local variable names for the selected frame. If
  27228. PRINT-VALUES is 0 or '--no-values', print only the names of the
  27229. variables; if it is 1 or '--all-values', print also their values; and if
  27230. it is 2 or '--simple-values', print the name, type and value for simple
  27231. data types, and the name and type for arrays, structures and unions. In
  27232. this last case, a frontend can immediately display the value of simple
  27233. data types and create variable objects for other data types when the
  27234. user wishes to explore their values in more detail. If the option
  27235. '--no-frame-filters' is supplied, then Python frame filters will not be
  27236. executed.
  27237. If the '--skip-unavailable' option is specified, local variables that
  27238. are not available are not listed. Partially available local variables
  27239. are still displayed, however.
  27240. This command is deprecated in favor of the '-stack-list-variables'
  27241. command.
  27242. GDB Command
  27243. ...........
  27244. 'info locals' in GDB, 'gdb_get_locals' in 'gdbtk'.
  27245. Example
  27246. .......
  27247. (gdb)
  27248. -stack-list-locals 0
  27249. ^done,locals=[name="A",name="B",name="C"]
  27250. (gdb)
  27251. -stack-list-locals --all-values
  27252. ^done,locals=[{name="A",value="1"},{name="B",value="2"},
  27253. {name="C",value="{1, 2, 3}"}]
  27254. -stack-list-locals --simple-values
  27255. ^done,locals=[{name="A",type="int",value="1"},
  27256. {name="B",type="int",value="2"},{name="C",type="int [3]"}]
  27257. (gdb)
  27258. The '-stack-list-variables' Command
  27259. -----------------------------------
  27260. Synopsis
  27261. ........
  27262. -stack-list-variables [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
  27263. Display the names of local variables and function arguments for the
  27264. selected frame. If PRINT-VALUES is 0 or '--no-values', print only the
  27265. names of the variables; if it is 1 or '--all-values', print also their
  27266. values; and if it is 2 or '--simple-values', print the name, type and
  27267. value for simple data types, and the name and type for arrays,
  27268. structures and unions. If the option '--no-frame-filters' is supplied,
  27269. then Python frame filters will not be executed.
  27270. If the '--skip-unavailable' option is specified, local variables and
  27271. arguments that are not available are not listed. Partially available
  27272. arguments and local variables are still displayed, however.
  27273. Example
  27274. .......
  27275. (gdb)
  27276. -stack-list-variables --thread 1 --frame 0 --all-values
  27277. ^done,variables=[{name="x",value="11"},{name="s",value="{a = 1, b = 2}"}]
  27278. (gdb)
  27279. The '-stack-select-frame' Command
  27280. ---------------------------------
  27281. Synopsis
  27282. ........
  27283. -stack-select-frame FRAMENUM
  27284. Change the selected frame. Select a different frame FRAMENUM on the
  27285. stack.
  27286. This command in deprecated in favor of passing the '--frame' option
  27287. to every command.
  27288. GDB Command
  27289. ...........
  27290. The corresponding GDB commands are 'frame', 'up', 'down',
  27291. 'select-frame', 'up-silent', and 'down-silent'.
  27292. Example
  27293. .......
  27294. (gdb)
  27295. -stack-select-frame 2
  27296. ^done
  27297. (gdb)
  27298. 
  27299. File: gdb.info, Node: GDB/MI Variable Objects, Next: GDB/MI Data Manipulation, Prev: GDB/MI Stack Manipulation, Up: GDB/MI
  27300. 27.15 GDB/MI Variable Objects
  27301. =============================
  27302. Introduction to Variable Objects
  27303. --------------------------------
  27304. Variable objects are "object-oriented" MI interface for examining and
  27305. changing values of expressions. Unlike some other MI interfaces that
  27306. work with expressions, variable objects are specifically designed for
  27307. simple and efficient presentation in the frontend. A variable object is
  27308. identified by string name. When a variable object is created, the
  27309. frontend specifies the expression for that variable object. The
  27310. expression can be a simple variable, or it can be an arbitrary complex
  27311. expression, and can even involve CPU registers. After creating a
  27312. variable object, the frontend can invoke other variable object
  27313. operations--for example to obtain or change the value of a variable
  27314. object, or to change display format.
  27315. Variable objects have hierarchical tree structure. Any variable
  27316. object that corresponds to a composite type, such as structure in C, has
  27317. a number of child variable objects, for example corresponding to each
  27318. element of a structure. A child variable object can itself have
  27319. children, recursively. Recursion ends when we reach leaf variable
  27320. objects, which always have built-in types. Child variable objects are
  27321. created only by explicit request, so if a frontend is not interested in
  27322. the children of a particular variable object, no child will be created.
  27323. For a leaf variable object it is possible to obtain its value as a
  27324. string, or set the value from a string. String value can be also
  27325. obtained for a non-leaf variable object, but it's generally a string
  27326. that only indicates the type of the object, and does not list its
  27327. contents. Assignment to a non-leaf variable object is not allowed.
  27328. A frontend does not need to read the values of all variable objects
  27329. each time the program stops. Instead, MI provides an update command
  27330. that lists all variable objects whose values has changed since the last
  27331. update operation. This considerably reduces the amount of data that
  27332. must be transferred to the frontend. As noted above, children variable
  27333. objects are created on demand, and only leaf variable objects have a
  27334. real value. As result, gdb will read target memory only for leaf
  27335. variables that frontend has created.
  27336. The automatic update is not always desirable. For example, a
  27337. frontend might want to keep a value of some expression for future
  27338. reference, and never update it. For another example, fetching memory is
  27339. relatively slow for embedded targets, so a frontend might want to
  27340. disable automatic update for the variables that are either not visible
  27341. on the screen, or "closed". This is possible using so called "frozen
  27342. variable objects". Such variable objects are never implicitly updated.
  27343. Variable objects can be either "fixed" or "floating". For the fixed
  27344. variable object, the expression is parsed when the variable object is
  27345. created, including associating identifiers to specific variables. The
  27346. meaning of expression never changes. For a floating variable object the
  27347. values of variables whose names appear in the expressions are
  27348. re-evaluated every time in the context of the current frame. Consider
  27349. this example:
  27350. void do_work(...)
  27351. {
  27352. struct work_state state;
  27353. if (...)
  27354. do_work(...);
  27355. }
  27356. If a fixed variable object for the 'state' variable is created in
  27357. this function, and we enter the recursive call, the variable object will
  27358. report the value of 'state' in the top-level 'do_work' invocation. On
  27359. the other hand, a floating variable object will report the value of
  27360. 'state' in the current frame.
  27361. If an expression specified when creating a fixed variable object
  27362. refers to a local variable, the variable object becomes bound to the
  27363. thread and frame in which the variable object is created. When such
  27364. variable object is updated, GDB makes sure that the thread/frame
  27365. combination the variable object is bound to still exists, and
  27366. re-evaluates the variable object in context of that thread/frame.
  27367. The following is the complete set of GDB/MI operations defined to
  27368. access this functionality:
  27369. *Operation* *Description*
  27370. '-enable-pretty-printing' enable Python-based pretty-printing
  27371. '-var-create' create a variable object
  27372. '-var-delete' delete the variable object and/or its
  27373. children
  27374. '-var-set-format' set the display format of this variable
  27375. '-var-show-format' show the display format of this variable
  27376. '-var-info-num-children' tells how many children this object has
  27377. '-var-list-children' return a list of the object's children
  27378. '-var-info-type' show the type of this variable object
  27379. '-var-info-expression' print parent-relative expression that
  27380. this variable object represents
  27381. '-var-info-path-expression' print full expression that this variable
  27382. object represents
  27383. '-var-show-attributes' is this variable editable? does it exist
  27384. here?
  27385. '-var-evaluate-expression' get the value of this variable
  27386. '-var-assign' set the value of this variable
  27387. '-var-update' update the variable and its children
  27388. '-var-set-frozen' set frozeness attribute
  27389. '-var-set-update-range' set range of children to display on
  27390. update
  27391. In the next subsection we describe each operation in detail and
  27392. suggest how it can be used.
  27393. Description And Use of Operations on Variable Objects
  27394. -----------------------------------------------------
  27395. The '-enable-pretty-printing' Command
  27396. -------------------------------------
  27397. -enable-pretty-printing
  27398. GDB allows Python-based visualizers to affect the output of the MI
  27399. variable object commands. However, because there was no way to
  27400. implement this in a fully backward-compatible way, a front end must
  27401. request that this functionality be enabled.
  27402. Once enabled, this feature cannot be disabled.
  27403. Note that if Python support has not been compiled into GDB, this
  27404. command will still succeed (and do nothing).
  27405. This feature is currently (as of GDB 7.0) experimental, and may work
  27406. differently in future versions of GDB.
  27407. The '-var-create' Command
  27408. -------------------------
  27409. Synopsis
  27410. ........
  27411. -var-create {NAME | "-"}
  27412. {FRAME-ADDR | "*" | "@"} EXPRESSION
  27413. This operation creates a variable object, which allows the monitoring
  27414. of a variable, the result of an expression, a memory cell or a CPU
  27415. register.
  27416. The NAME parameter is the string by which the object can be
  27417. referenced. It must be unique. If '-' is specified, the varobj system
  27418. will generate a string "varNNNNNN" automatically. It will be unique
  27419. provided that one does not specify NAME of that format. The command
  27420. fails if a duplicate name is found.
  27421. The frame under which the expression should be evaluated can be
  27422. specified by FRAME-ADDR. A '*' indicates that the current frame should
  27423. be used. A '@' indicates that a floating variable object must be
  27424. created.
  27425. EXPRESSION is any expression valid on the current language set (must
  27426. not begin with a '*'), or one of the following:
  27427. * '*ADDR', where ADDR is the address of a memory cell
  27428. * '*ADDR-ADDR' -- a memory address range (TBD)
  27429. * '$REGNAME' -- a CPU register name
  27430. A varobj's contents may be provided by a Python-based pretty-printer.
  27431. In this case the varobj is known as a "dynamic varobj". Dynamic varobjs
  27432. have slightly different semantics in some cases. If the
  27433. '-enable-pretty-printing' command is not sent, then GDB will never
  27434. create a dynamic varobj. This ensures backward compatibility for
  27435. existing clients.
  27436. Result
  27437. ......
  27438. This operation returns attributes of the newly-created varobj. These
  27439. are:
  27440. 'name'
  27441. The name of the varobj.
  27442. 'numchild'
  27443. The number of children of the varobj. This number is not
  27444. necessarily reliable for a dynamic varobj. Instead, you must
  27445. examine the 'has_more' attribute.
  27446. 'value'
  27447. The varobj's scalar value. For a varobj whose type is some sort of
  27448. aggregate (e.g., a 'struct'), or for a dynamic varobj, this value
  27449. will not be interesting.
  27450. 'type'
  27451. The varobj's type. This is a string representation of the type, as
  27452. would be printed by the GDB CLI. If 'print object' (*note set print
  27453. object: Print Settings.) is set to 'on', the _actual_ (derived)
  27454. type of the object is shown rather than the _declared_ one.
  27455. 'thread-id'
  27456. If a variable object is bound to a specific thread, then this is
  27457. the thread's global identifier.
  27458. 'has_more'
  27459. For a dynamic varobj, this indicates whether there appear to be any
  27460. children available. For a non-dynamic varobj, this will be 0.
  27461. 'dynamic'
  27462. This attribute will be present and have the value '1' if the varobj
  27463. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  27464. this attribute will not be present.
  27465. 'displayhint'
  27466. A dynamic varobj can supply a display hint to the front end. The
  27467. value comes directly from the Python pretty-printer object's
  27468. 'display_hint' method. *Note Pretty Printing API::.
  27469. Typical output will look like this:
  27470. name="NAME",numchild="N",type="TYPE",thread-id="M",
  27471. has_more="HAS_MORE"
  27472. The '-var-delete' Command
  27473. -------------------------
  27474. Synopsis
  27475. ........
  27476. -var-delete [ -c ] NAME
  27477. Deletes a previously created variable object and all of its children.
  27478. With the '-c' option, just deletes the children.
  27479. Returns an error if the object NAME is not found.
  27480. The '-var-set-format' Command
  27481. -----------------------------
  27482. Synopsis
  27483. ........
  27484. -var-set-format NAME FORMAT-SPEC
  27485. Sets the output format for the value of the object NAME to be
  27486. FORMAT-SPEC.
  27487. The syntax for the FORMAT-SPEC is as follows:
  27488. FORMAT-SPEC ==>
  27489. {binary | decimal | hexadecimal | octal | natural | zero-hexadecimal}
  27490. The natural format is the default format choosen automatically based
  27491. on the variable type (like decimal for an 'int', hex for pointers,
  27492. etc.).
  27493. The zero-hexadecimal format has a representation similar to
  27494. hexadecimal but with padding zeroes to the left of the value. For
  27495. example, a 32-bit hexadecimal value of 0x1234 would be represented as
  27496. 0x00001234 in the zero-hexadecimal format.
  27497. For a variable with children, the format is set only on the variable
  27498. itself, and the children are not affected.
  27499. The '-var-show-format' Command
  27500. ------------------------------
  27501. Synopsis
  27502. ........
  27503. -var-show-format NAME
  27504. Returns the format used to display the value of the object NAME.
  27505. FORMAT ==>
  27506. FORMAT-SPEC
  27507. The '-var-info-num-children' Command
  27508. ------------------------------------
  27509. Synopsis
  27510. ........
  27511. -var-info-num-children NAME
  27512. Returns the number of children of a variable object NAME:
  27513. numchild=N
  27514. Note that this number is not completely reliable for a dynamic
  27515. varobj. It will return the current number of children, but more
  27516. children may be available.
  27517. The '-var-list-children' Command
  27518. --------------------------------
  27519. Synopsis
  27520. ........
  27521. -var-list-children [PRINT-VALUES] NAME [FROM TO]
  27522. Return a list of the children of the specified variable object and
  27523. create variable objects for them, if they do not already exist. With a
  27524. single argument or if PRINT-VALUES has a value of 0 or '--no-values',
  27525. print only the names of the variables; if PRINT-VALUES is 1 or
  27526. '--all-values', also print their values; and if it is 2 or
  27527. '--simple-values' print the name and value for simple data types and
  27528. just the name for arrays, structures and unions.
  27529. FROM and TO, if specified, indicate the range of children to report.
  27530. If FROM or TO is less than zero, the range is reset and all children
  27531. will be reported. Otherwise, children starting at FROM (zero-based) and
  27532. up to and excluding TO will be reported.
  27533. If a child range is requested, it will only affect the current call
  27534. to '-var-list-children', but not future calls to '-var-update'. For
  27535. this, you must instead use '-var-set-update-range'. The intent of this
  27536. approach is to enable a front end to implement any update approach it
  27537. likes; for example, scrolling a view may cause the front end to request
  27538. more children with '-var-list-children', and then the front end could
  27539. call '-var-set-update-range' with a different range to ensure that
  27540. future updates are restricted to just the visible items.
  27541. For each child the following results are returned:
  27542. NAME
  27543. Name of the variable object created for this child.
  27544. EXP
  27545. The expression to be shown to the user by the front end to
  27546. designate this child. For example this may be the name of a
  27547. structure member.
  27548. For a dynamic varobj, this value cannot be used to form an
  27549. expression. There is no way to do this at all with a dynamic
  27550. varobj.
  27551. For C/C++ structures there are several pseudo children returned to
  27552. designate access qualifiers. For these pseudo children EXP is
  27553. 'public', 'private', or 'protected'. In this case the type and
  27554. value are not present.
  27555. A dynamic varobj will not report the access qualifying
  27556. pseudo-children, regardless of the language. This information is
  27557. not available at all with a dynamic varobj.
  27558. NUMCHILD
  27559. Number of children this child has. For a dynamic varobj, this will
  27560. be 0.
  27561. TYPE
  27562. The type of the child. If 'print object' (*note set print object:
  27563. Print Settings.) is set to 'on', the _actual_ (derived) type of the
  27564. object is shown rather than the _declared_ one.
  27565. VALUE
  27566. If values were requested, this is the value.
  27567. THREAD-ID
  27568. If this variable object is associated with a thread, this is the
  27569. thread's global thread id. Otherwise this result is not present.
  27570. FROZEN
  27571. If the variable object is frozen, this variable will be present
  27572. with a value of 1.
  27573. DISPLAYHINT
  27574. A dynamic varobj can supply a display hint to the front end. The
  27575. value comes directly from the Python pretty-printer object's
  27576. 'display_hint' method. *Note Pretty Printing API::.
  27577. DYNAMIC
  27578. This attribute will be present and have the value '1' if the varobj
  27579. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  27580. this attribute will not be present.
  27581. The result may have its own attributes:
  27582. 'displayhint'
  27583. A dynamic varobj can supply a display hint to the front end. The
  27584. value comes directly from the Python pretty-printer object's
  27585. 'display_hint' method. *Note Pretty Printing API::.
  27586. 'has_more'
  27587. This is an integer attribute which is nonzero if there are children
  27588. remaining after the end of the selected range.
  27589. Example
  27590. .......
  27591. (gdb)
  27592. -var-list-children n
  27593. ^done,numchild=N,children=[child={name=NAME,exp=EXP,
  27594. numchild=N,type=TYPE},(repeats N times)]
  27595. (gdb)
  27596. -var-list-children --all-values n
  27597. ^done,numchild=N,children=[child={name=NAME,exp=EXP,
  27598. numchild=N,value=VALUE,type=TYPE},(repeats N times)]
  27599. The '-var-info-type' Command
  27600. ----------------------------
  27601. Synopsis
  27602. ........
  27603. -var-info-type NAME
  27604. Returns the type of the specified variable NAME. The type is
  27605. returned as a string in the same format as it is output by the GDB CLI:
  27606. type=TYPENAME
  27607. The '-var-info-expression' Command
  27608. ----------------------------------
  27609. Synopsis
  27610. ........
  27611. -var-info-expression NAME
  27612. Returns a string that is suitable for presenting this variable object
  27613. in user interface. The string is generally not valid expression in the
  27614. current language, and cannot be evaluated.
  27615. For example, if 'a' is an array, and variable object 'A' was created
  27616. for 'a', then we'll get this output:
  27617. (gdb) -var-info-expression A.1
  27618. ^done,lang="C",exp="1"
  27619. Here, the value of 'lang' is the language name, which can be found in
  27620. *note Supported Languages::.
  27621. Note that the output of the '-var-list-children' command also
  27622. includes those expressions, so the '-var-info-expression' command is of
  27623. limited use.
  27624. The '-var-info-path-expression' Command
  27625. ---------------------------------------
  27626. Synopsis
  27627. ........
  27628. -var-info-path-expression NAME
  27629. Returns an expression that can be evaluated in the current context
  27630. and will yield the same value that a variable object has. Compare this
  27631. with the '-var-info-expression' command, which result can be used only
  27632. for UI presentation. Typical use of the '-var-info-path-expression'
  27633. command is creating a watchpoint from a variable object.
  27634. This command is currently not valid for children of a dynamic varobj,
  27635. and will give an error when invoked on one.
  27636. For example, suppose 'C' is a C++ class, derived from class 'Base',
  27637. and that the 'Base' class has a member called 'm_size'. Assume a
  27638. variable 'c' is has the type of 'C' and a variable object 'C' was
  27639. created for variable 'c'. Then, we'll get this output:
  27640. (gdb) -var-info-path-expression C.Base.public.m_size
  27641. ^done,path_expr=((Base)c).m_size)
  27642. The '-var-show-attributes' Command
  27643. ----------------------------------
  27644. Synopsis
  27645. ........
  27646. -var-show-attributes NAME
  27647. List attributes of the specified variable object NAME:
  27648. status=ATTR [ ( ,ATTR )* ]
  27649. where ATTR is '{ { editable | noneditable } | TBD }'.
  27650. The '-var-evaluate-expression' Command
  27651. --------------------------------------
  27652. Synopsis
  27653. ........
  27654. -var-evaluate-expression [-f FORMAT-SPEC] NAME
  27655. Evaluates the expression that is represented by the specified
  27656. variable object and returns its value as a string. The format of the
  27657. string can be specified with the '-f' option. The possible values of
  27658. this option are the same as for '-var-set-format' (*note
  27659. -var-set-format::). If the '-f' option is not specified, the current
  27660. display format will be used. The current display format can be changed
  27661. using the '-var-set-format' command.
  27662. value=VALUE
  27663. Note that one must invoke '-var-list-children' for a variable before
  27664. the value of a child variable can be evaluated.
  27665. The '-var-assign' Command
  27666. -------------------------
  27667. Synopsis
  27668. ........
  27669. -var-assign NAME EXPRESSION
  27670. Assigns the value of EXPRESSION to the variable object specified by
  27671. NAME. The object must be 'editable'. If the variable's value is
  27672. altered by the assign, the variable will show up in any subsequent
  27673. '-var-update' list.
  27674. Example
  27675. .......
  27676. (gdb)
  27677. -var-assign var1 3
  27678. ^done,value="3"
  27679. (gdb)
  27680. -var-update *
  27681. ^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
  27682. (gdb)
  27683. The '-var-update' Command
  27684. -------------------------
  27685. Synopsis
  27686. ........
  27687. -var-update [PRINT-VALUES] {NAME | "*"}
  27688. Reevaluate the expressions corresponding to the variable object NAME
  27689. and all its direct and indirect children, and return the list of
  27690. variable objects whose values have changed; NAME must be a root variable
  27691. object. Here, "changed" means that the result of
  27692. '-var-evaluate-expression' before and after the '-var-update' is
  27693. different. If '*' is used as the variable object names, all existing
  27694. variable objects are updated, except for frozen ones (*note
  27695. -var-set-frozen::). The option PRINT-VALUES determines whether both
  27696. names and values, or just names are printed. The possible values of
  27697. this option are the same as for '-var-list-children' (*note
  27698. -var-list-children::). It is recommended to use the '--all-values'
  27699. option, to reduce the number of MI commands needed on each program stop.
  27700. With the '*' parameter, if a variable object is bound to a currently
  27701. running thread, it will not be updated, without any diagnostic.
  27702. If '-var-set-update-range' was previously used on a varobj, then only
  27703. the selected range of children will be reported.
  27704. '-var-update' reports all the changed varobjs in a tuple named
  27705. 'changelist'.
  27706. Each item in the change list is itself a tuple holding:
  27707. 'name'
  27708. The name of the varobj.
  27709. 'value'
  27710. If values were requested for this update, then this field will be
  27711. present and will hold the value of the varobj.
  27712. 'in_scope'
  27713. This field is a string which may take one of three values:
  27714. '"true"'
  27715. The variable object's current value is valid.
  27716. '"false"'
  27717. The variable object does not currently hold a valid value but
  27718. it may hold one in the future if its associated expression
  27719. comes back into scope.
  27720. '"invalid"'
  27721. The variable object no longer holds a valid value. This can
  27722. occur when the executable file being debugged has changed,
  27723. either through recompilation or by using the GDB 'file'
  27724. command. The front end should normally choose to delete these
  27725. variable objects.
  27726. In the future new values may be added to this list so the front
  27727. should be prepared for this possibility. *Note GDB/MI Development
  27728. and Front Ends: GDB/MI Development and Front Ends.
  27729. 'type_changed'
  27730. This is only present if the varobj is still valid. If the type
  27731. changed, then this will be the string 'true'; otherwise it will be
  27732. 'false'.
  27733. When a varobj's type changes, its children are also likely to have
  27734. become incorrect. Therefore, the varobj's children are
  27735. automatically deleted when this attribute is 'true'. Also, the
  27736. varobj's update range, when set using the '-var-set-update-range'
  27737. command, is unset.
  27738. 'new_type'
  27739. If the varobj's type changed, then this field will be present and
  27740. will hold the new type.
  27741. 'new_num_children'
  27742. For a dynamic varobj, if the number of children changed, or if the
  27743. type changed, this will be the new number of children.
  27744. The 'numchild' field in other varobj responses is generally not
  27745. valid for a dynamic varobj - it will show the number of children
  27746. that GDB knows about, but because dynamic varobjs lazily
  27747. instantiate their children, this will not reflect the number of
  27748. children which may be available.
  27749. The 'new_num_children' attribute only reports changes to the number
  27750. of children known by GDB. This is the only way to detect whether
  27751. an update has removed children (which necessarily can only happen
  27752. at the end of the update range).
  27753. 'displayhint'
  27754. The display hint, if any.
  27755. 'has_more'
  27756. This is an integer value, which will be 1 if there are more
  27757. children available outside the varobj's update range.
  27758. 'dynamic'
  27759. This attribute will be present and have the value '1' if the varobj
  27760. is a dynamic varobj. If the varobj is not a dynamic varobj, then
  27761. this attribute will not be present.
  27762. 'new_children'
  27763. If new children were added to a dynamic varobj within the selected
  27764. update range (as set by '-var-set-update-range'), then they will be
  27765. listed in this attribute.
  27766. Example
  27767. .......
  27768. (gdb)
  27769. -var-assign var1 3
  27770. ^done,value="3"
  27771. (gdb)
  27772. -var-update --all-values var1
  27773. ^done,changelist=[{name="var1",value="3",in_scope="true",
  27774. type_changed="false"}]
  27775. (gdb)
  27776. The '-var-set-frozen' Command
  27777. -----------------------------
  27778. Synopsis
  27779. ........
  27780. -var-set-frozen NAME FLAG
  27781. Set the frozenness flag on the variable object NAME. The FLAG
  27782. parameter should be either '1' to make the variable frozen or '0' to
  27783. make it unfrozen. If a variable object is frozen, then neither itself,
  27784. nor any of its children, are implicitly updated by '-var-update' of a
  27785. parent variable or by '-var-update *'. Only '-var-update' of the
  27786. variable itself will update its value and values of its children. After
  27787. a variable object is unfrozen, it is implicitly updated by all
  27788. subsequent '-var-update' operations. Unfreezing a variable does not
  27789. update it, only subsequent '-var-update' does.
  27790. Example
  27791. .......
  27792. (gdb)
  27793. -var-set-frozen V 1
  27794. ^done
  27795. (gdb)
  27796. The '-var-set-update-range' command
  27797. -----------------------------------
  27798. Synopsis
  27799. ........
  27800. -var-set-update-range NAME FROM TO
  27801. Set the range of children to be returned by future invocations of
  27802. '-var-update'.
  27803. FROM and TO indicate the range of children to report. If FROM or TO
  27804. is less than zero, the range is reset and all children will be reported.
  27805. Otherwise, children starting at FROM (zero-based) and up to and
  27806. excluding TO will be reported.
  27807. Example
  27808. .......
  27809. (gdb)
  27810. -var-set-update-range V 1 2
  27811. ^done
  27812. The '-var-set-visualizer' command
  27813. ---------------------------------
  27814. Synopsis
  27815. ........
  27816. -var-set-visualizer NAME VISUALIZER
  27817. Set a visualizer for the variable object NAME.
  27818. VISUALIZER is the visualizer to use. The special value 'None' means
  27819. to disable any visualizer in use.
  27820. If not 'None', VISUALIZER must be a Python expression. This
  27821. expression must evaluate to a callable object which accepts a single
  27822. argument. GDB will call this object with the value of the varobj NAME
  27823. as an argument (this is done so that the same Python pretty-printing
  27824. code can be used for both the CLI and MI). When called, this object must
  27825. return an object which conforms to the pretty-printing interface (*note
  27826. Pretty Printing API::).
  27827. The pre-defined function 'gdb.default_visualizer' may be used to
  27828. select a visualizer by following the built-in process (*note Selecting
  27829. Pretty-Printers::). This is done automatically when a varobj is
  27830. created, and so ordinarily is not needed.
  27831. This feature is only available if Python support is enabled. The MI
  27832. command '-list-features' (*note GDB/MI Support Commands::) can be used
  27833. to check this.
  27834. Example
  27835. .......
  27836. Resetting the visualizer:
  27837. (gdb)
  27838. -var-set-visualizer V None
  27839. ^done
  27840. Reselecting the default (type-based) visualizer:
  27841. (gdb)
  27842. -var-set-visualizer V gdb.default_visualizer
  27843. ^done
  27844. Suppose 'SomeClass' is a visualizer class. A lambda expression can
  27845. be used to instantiate this class for a varobj:
  27846. (gdb)
  27847. -var-set-visualizer V "lambda val: SomeClass()"
  27848. ^done
  27849. 
  27850. File: gdb.info, Node: GDB/MI Data Manipulation, Next: GDB/MI Tracepoint Commands, Prev: GDB/MI Variable Objects, Up: GDB/MI
  27851. 27.16 GDB/MI Data Manipulation
  27852. ==============================
  27853. This section describes the GDB/MI commands that manipulate data: examine
  27854. memory and registers, evaluate expressions, etc.
  27855. For details about what an addressable memory unit is, *note
  27856. addressable memory unit::.
  27857. The '-data-disassemble' Command
  27858. -------------------------------
  27859. Synopsis
  27860. ........
  27861. -data-disassemble
  27862. [ -s START-ADDR -e END-ADDR ]
  27863. | [ -a ADDR ]
  27864. | [ -f FILENAME -l LINENUM [ -n LINES ] ]
  27865. -- MODE
  27866. Where:
  27867. 'START-ADDR'
  27868. is the beginning address (or '$pc')
  27869. 'END-ADDR'
  27870. is the end address
  27871. 'ADDR'
  27872. is an address anywhere within (or the name of) the function to
  27873. disassemble. If an address is specified, the whole function
  27874. surrounding that address will be disassembled. If a name is
  27875. specified, the whole function with that name will be disassembled.
  27876. 'FILENAME'
  27877. is the name of the file to disassemble
  27878. 'LINENUM'
  27879. is the line number to disassemble around
  27880. 'LINES'
  27881. is the number of disassembly lines to be produced. If it is -1,
  27882. the whole function will be disassembled, in case no END-ADDR is
  27883. specified. If END-ADDR is specified as a non-zero value, and LINES
  27884. is lower than the number of disassembly lines between START-ADDR
  27885. and END-ADDR, only LINES lines are displayed; if LINES is higher
  27886. than the number of lines between START-ADDR and END-ADDR, only the
  27887. lines up to END-ADDR are displayed.
  27888. 'MODE'
  27889. is one of:
  27890. * 0 disassembly only
  27891. * 1 mixed source and disassembly (deprecated)
  27892. * 2 disassembly with raw opcodes
  27893. * 3 mixed source and disassembly with raw opcodes (deprecated)
  27894. * 4 mixed source and disassembly
  27895. * 5 mixed source and disassembly with raw opcodes
  27896. Modes 1 and 3 are deprecated. The output is "source centric" which
  27897. hasn't proved useful in practice. *Note Machine Code::, for a
  27898. discussion of the difference between '/m' and '/s' output of the
  27899. 'disassemble' command.
  27900. Result
  27901. ......
  27902. The result of the '-data-disassemble' command will be a list named
  27903. 'asm_insns', the contents of this list depend on the MODE used with the
  27904. '-data-disassemble' command.
  27905. For modes 0 and 2 the 'asm_insns' list contains tuples with the
  27906. following fields:
  27907. 'address'
  27908. The address at which this instruction was disassembled.
  27909. 'func-name'
  27910. The name of the function this instruction is within.
  27911. 'offset'
  27912. The decimal offset in bytes from the start of 'func-name'.
  27913. 'inst'
  27914. The text disassembly for this 'address'.
  27915. 'opcodes'
  27916. This field is only present for modes 2, 3 and 5. This contains the
  27917. raw opcode bytes for the 'inst' field.
  27918. For modes 1, 3, 4 and 5 the 'asm_insns' list contains tuples named
  27919. 'src_and_asm_line', each of which has the following fields:
  27920. 'line'
  27921. The line number within 'file'.
  27922. 'file'
  27923. The file name from the compilation unit. This might be an absolute
  27924. file name or a relative file name depending on the compile command
  27925. used.
  27926. 'fullname'
  27927. Absolute file name of 'file'. It is converted to a canonical form
  27928. using the source file search path (*note Specifying Source
  27929. Directories: Source Path.) and after resolving all the symbolic
  27930. links.
  27931. If the source file is not found this field will contain the path as
  27932. present in the debug information.
  27933. 'line_asm_insn'
  27934. This is a list of tuples containing the disassembly for 'line' in
  27935. 'file'. The fields of each tuple are the same as for
  27936. '-data-disassemble' in MODE 0 and 2, so 'address', 'func-name',
  27937. 'offset', 'inst', and optionally 'opcodes'.
  27938. Note that whatever included in the 'inst' field, is not manipulated
  27939. directly by GDB/MI, i.e., it is not possible to adjust its format.
  27940. GDB Command
  27941. ...........
  27942. The corresponding GDB command is 'disassemble'.
  27943. Example
  27944. .......
  27945. Disassemble from the current value of '$pc' to '$pc + 20':
  27946. (gdb)
  27947. -data-disassemble -s $pc -e "$pc + 20" -- 0
  27948. ^done,
  27949. asm_insns=[
  27950. {address="0x000107c0",func-name="main",offset="4",
  27951. inst="mov 2, %o0"},
  27952. {address="0x000107c4",func-name="main",offset="8",
  27953. inst="sethi %hi(0x11800), %o2"},
  27954. {address="0x000107c8",func-name="main",offset="12",
  27955. inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"},
  27956. {address="0x000107cc",func-name="main",offset="16",
  27957. inst="sethi %hi(0x11800), %o2"},
  27958. {address="0x000107d0",func-name="main",offset="20",
  27959. inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}]
  27960. (gdb)
  27961. Disassemble the whole 'main' function. Line 32 is part of 'main'.
  27962. -data-disassemble -f basics.c -l 32 -- 0
  27963. ^done,asm_insns=[
  27964. {address="0x000107bc",func-name="main",offset="0",
  27965. inst="save %sp, -112, %sp"},
  27966. {address="0x000107c0",func-name="main",offset="4",
  27967. inst="mov 2, %o0"},
  27968. {address="0x000107c4",func-name="main",offset="8",
  27969. inst="sethi %hi(0x11800), %o2"},
  27970. [...]
  27971. {address="0x0001081c",func-name="main",offset="96",inst="ret "},
  27972. {address="0x00010820",func-name="main",offset="100",inst="restore "}]
  27973. (gdb)
  27974. Disassemble 3 instructions from the start of 'main':
  27975. (gdb)
  27976. -data-disassemble -f basics.c -l 32 -n 3 -- 0
  27977. ^done,asm_insns=[
  27978. {address="0x000107bc",func-name="main",offset="0",
  27979. inst="save %sp, -112, %sp"},
  27980. {address="0x000107c0",func-name="main",offset="4",
  27981. inst="mov 2, %o0"},
  27982. {address="0x000107c4",func-name="main",offset="8",
  27983. inst="sethi %hi(0x11800), %o2"}]
  27984. (gdb)
  27985. Disassemble 3 instructions from the start of 'main' in mixed mode:
  27986. (gdb)
  27987. -data-disassemble -f basics.c -l 32 -n 3 -- 1
  27988. ^done,asm_insns=[
  27989. src_and_asm_line={line="31",
  27990. file="../../../src/gdb/testsuite/gdb.mi/basics.c",
  27991. fullname="/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c",
  27992. line_asm_insn=[{address="0x000107bc",
  27993. func-name="main",offset="0",inst="save %sp, -112, %sp"}]},
  27994. src_and_asm_line={line="32",
  27995. file="../../../src/gdb/testsuite/gdb.mi/basics.c",
  27996. fullname="/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c",
  27997. line_asm_insn=[{address="0x000107c0",
  27998. func-name="main",offset="4",inst="mov 2, %o0"},
  27999. {address="0x000107c4",func-name="main",offset="8",
  28000. inst="sethi %hi(0x11800), %o2"}]}]
  28001. (gdb)
  28002. The '-data-evaluate-expression' Command
  28003. ---------------------------------------
  28004. Synopsis
  28005. ........
  28006. -data-evaluate-expression EXPR
  28007. Evaluate EXPR as an expression. The expression could contain an
  28008. inferior function call. The function call will execute synchronously.
  28009. If the expression contains spaces, it must be enclosed in double quotes.
  28010. GDB Command
  28011. ...........
  28012. The corresponding GDB commands are 'print', 'output', and 'call'. In
  28013. 'gdbtk' only, there's a corresponding 'gdb_eval' command.
  28014. Example
  28015. .......
  28016. In the following example, the numbers that precede the commands are the
  28017. "tokens" described in *note GDB/MI Command Syntax: GDB/MI Command
  28018. Syntax. Notice how GDB/MI returns the same tokens in its output.
  28019. 211-data-evaluate-expression A
  28020. 211^done,value="1"
  28021. (gdb)
  28022. 311-data-evaluate-expression &A
  28023. 311^done,value="0xefffeb7c"
  28024. (gdb)
  28025. 411-data-evaluate-expression A+3
  28026. 411^done,value="4"
  28027. (gdb)
  28028. 511-data-evaluate-expression "A + 3"
  28029. 511^done,value="4"
  28030. (gdb)
  28031. The '-data-list-changed-registers' Command
  28032. ------------------------------------------
  28033. Synopsis
  28034. ........
  28035. -data-list-changed-registers
  28036. Display a list of the registers that have changed.
  28037. GDB Command
  28038. ...........
  28039. GDB doesn't have a direct analog for this command; 'gdbtk' has the
  28040. corresponding command 'gdb_changed_register_list'.
  28041. Example
  28042. .......
  28043. On a PPC MBX board:
  28044. (gdb)
  28045. -exec-continue
  28046. ^running
  28047. (gdb)
  28048. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={
  28049. func="main",args=[],file="try.c",fullname="/home/foo/bar/try.c",
  28050. line="5",arch="powerpc"}
  28051. (gdb)
  28052. -data-list-changed-registers
  28053. ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
  28054. "10","11","13","14","15","16","17","18","19","20","21","22","23",
  28055. "24","25","26","27","28","30","31","64","65","66","67","69"]
  28056. (gdb)
  28057. The '-data-list-register-names' Command
  28058. ---------------------------------------
  28059. Synopsis
  28060. ........
  28061. -data-list-register-names [ ( REGNO )+ ]
  28062. Show a list of register names for the current target. If no
  28063. arguments are given, it shows a list of the names of all the registers.
  28064. If integer numbers are given as arguments, it will print a list of the
  28065. names of the registers corresponding to the arguments. To ensure
  28066. consistency between a register name and its number, the output list may
  28067. include empty register names.
  28068. GDB Command
  28069. ...........
  28070. GDB does not have a command which corresponds to
  28071. '-data-list-register-names'. In 'gdbtk' there is a corresponding
  28072. command 'gdb_regnames'.
  28073. Example
  28074. .......
  28075. For the PPC MBX board:
  28076. (gdb)
  28077. -data-list-register-names
  28078. ^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
  28079. "r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
  28080. "r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
  28081. "r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
  28082. "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
  28083. "f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
  28084. "", "pc","ps","cr","lr","ctr","xer"]
  28085. (gdb)
  28086. -data-list-register-names 1 2 3
  28087. ^done,register-names=["r1","r2","r3"]
  28088. (gdb)
  28089. The '-data-list-register-values' Command
  28090. ----------------------------------------
  28091. Synopsis
  28092. ........
  28093. -data-list-register-values
  28094. [ --skip-unavailable ] FMT [ ( REGNO )*]
  28095. Display the registers' contents. The format according to which the
  28096. registers' contents are to be returned is given by FMT, followed by an
  28097. optional list of numbers specifying the registers to display. A missing
  28098. list of numbers indicates that the contents of all the registers must be
  28099. returned. The '--skip-unavailable' option indicates that only the
  28100. available registers are to be returned.
  28101. Allowed formats for FMT are:
  28102. 'x'
  28103. Hexadecimal
  28104. 'o'
  28105. Octal
  28106. 't'
  28107. Binary
  28108. 'd'
  28109. Decimal
  28110. 'r'
  28111. Raw
  28112. 'N'
  28113. Natural
  28114. GDB Command
  28115. ...........
  28116. The corresponding GDB commands are 'info reg', 'info all-reg', and (in
  28117. 'gdbtk') 'gdb_fetch_registers'.
  28118. Example
  28119. .......
  28120. For a PPC MBX board (note: line breaks are for readability only, they
  28121. don't appear in the actual output):
  28122. (gdb)
  28123. -data-list-register-values r 64 65
  28124. ^done,register-values=[{number="64",value="0xfe00a300"},
  28125. {number="65",value="0x00029002"}]
  28126. (gdb)
  28127. -data-list-register-values x
  28128. ^done,register-values=[{number="0",value="0xfe0043c8"},
  28129. {number="1",value="0x3fff88"},{number="2",value="0xfffffffe"},
  28130. {number="3",value="0x0"},{number="4",value="0xa"},
  28131. {number="5",value="0x3fff68"},{number="6",value="0x3fff58"},
  28132. {number="7",value="0xfe011e98"},{number="8",value="0x2"},
  28133. {number="9",value="0xfa202820"},{number="10",value="0xfa202808"},
  28134. {number="11",value="0x1"},{number="12",value="0x0"},
  28135. {number="13",value="0x4544"},{number="14",value="0xffdfffff"},
  28136. {number="15",value="0xffffffff"},{number="16",value="0xfffffeff"},
  28137. {number="17",value="0xefffffed"},{number="18",value="0xfffffffe"},
  28138. {number="19",value="0xffffffff"},{number="20",value="0xffffffff"},
  28139. {number="21",value="0xffffffff"},{number="22",value="0xfffffff7"},
  28140. {number="23",value="0xffffffff"},{number="24",value="0xffffffff"},
  28141. {number="25",value="0xffffffff"},{number="26",value="0xfffffffb"},
  28142. {number="27",value="0xffffffff"},{number="28",value="0xf7bfffff"},
  28143. {number="29",value="0x0"},{number="30",value="0xfe010000"},
  28144. {number="31",value="0x0"},{number="32",value="0x0"},
  28145. {number="33",value="0x0"},{number="34",value="0x0"},
  28146. {number="35",value="0x0"},{number="36",value="0x0"},
  28147. {number="37",value="0x0"},{number="38",value="0x0"},
  28148. {number="39",value="0x0"},{number="40",value="0x0"},
  28149. {number="41",value="0x0"},{number="42",value="0x0"},
  28150. {number="43",value="0x0"},{number="44",value="0x0"},
  28151. {number="45",value="0x0"},{number="46",value="0x0"},
  28152. {number="47",value="0x0"},{number="48",value="0x0"},
  28153. {number="49",value="0x0"},{number="50",value="0x0"},
  28154. {number="51",value="0x0"},{number="52",value="0x0"},
  28155. {number="53",value="0x0"},{number="54",value="0x0"},
  28156. {number="55",value="0x0"},{number="56",value="0x0"},
  28157. {number="57",value="0x0"},{number="58",value="0x0"},
  28158. {number="59",value="0x0"},{number="60",value="0x0"},
  28159. {number="61",value="0x0"},{number="62",value="0x0"},
  28160. {number="63",value="0x0"},{number="64",value="0xfe00a300"},
  28161. {number="65",value="0x29002"},{number="66",value="0x202f04b5"},
  28162. {number="67",value="0xfe0043b0"},{number="68",value="0xfe00b3e4"},
  28163. {number="69",value="0x20002b03"}]
  28164. (gdb)
  28165. The '-data-read-memory' Command
  28166. -------------------------------
  28167. This command is deprecated, use '-data-read-memory-bytes' instead.
  28168. Synopsis
  28169. ........
  28170. -data-read-memory [ -o BYTE-OFFSET ]
  28171. ADDRESS WORD-FORMAT WORD-SIZE
  28172. NR-ROWS NR-COLS [ ASCHAR ]
  28173. where:
  28174. 'ADDRESS'
  28175. An expression specifying the address of the first memory word to be
  28176. read. Complex expressions containing embedded white space should
  28177. be quoted using the C convention.
  28178. 'WORD-FORMAT'
  28179. The format to be used to print the memory words. The notation is
  28180. the same as for GDB's 'print' command (*note Output Formats: Output
  28181. Formats.).
  28182. 'WORD-SIZE'
  28183. The size of each memory word in bytes.
  28184. 'NR-ROWS'
  28185. The number of rows in the output table.
  28186. 'NR-COLS'
  28187. The number of columns in the output table.
  28188. 'ASCHAR'
  28189. If present, indicates that each row should include an ASCII dump.
  28190. The value of ASCHAR is used as a padding character when a byte is
  28191. not a member of the printable ASCII character set (printable ASCII
  28192. characters are those whose code is between 32 and 126,
  28193. inclusively).
  28194. 'BYTE-OFFSET'
  28195. An offset to add to the ADDRESS before fetching memory.
  28196. This command displays memory contents as a table of NR-ROWS by
  28197. NR-COLS words, each word being WORD-SIZE bytes. In total, 'NR-ROWS *
  28198. NR-COLS * WORD-SIZE' bytes are read (returned as 'total-bytes'). Should
  28199. less than the requested number of bytes be returned by the target, the
  28200. missing words are identified using 'N/A'. The number of bytes read from
  28201. the target is returned in 'nr-bytes' and the starting address used to
  28202. read memory in 'addr'.
  28203. The address of the next/previous row or page is available in
  28204. 'next-row' and 'prev-row', 'next-page' and 'prev-page'.
  28205. GDB Command
  28206. ...........
  28207. The corresponding GDB command is 'x'. 'gdbtk' has 'gdb_get_mem' memory
  28208. read command.
  28209. Example
  28210. .......
  28211. Read six bytes of memory starting at 'bytes+6' but then offset by '-6'
  28212. bytes. Format as three rows of two columns. One byte per word.
  28213. Display each word in hex.
  28214. (gdb)
  28215. 9-data-read-memory -o -6 -- bytes+6 x 1 3 2
  28216. 9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
  28217. next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
  28218. prev-page="0x0000138a",memory=[
  28219. {addr="0x00001390",data=["0x00","0x01"]},
  28220. {addr="0x00001392",data=["0x02","0x03"]},
  28221. {addr="0x00001394",data=["0x04","0x05"]}]
  28222. (gdb)
  28223. Read two bytes of memory starting at address 'shorts + 64' and
  28224. display as a single word formatted in decimal.
  28225. (gdb)
  28226. 5-data-read-memory shorts+64 d 2 1 1
  28227. 5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
  28228. next-row="0x00001512",prev-row="0x0000150e",
  28229. next-page="0x00001512",prev-page="0x0000150e",memory=[
  28230. {addr="0x00001510",data=["128"]}]
  28231. (gdb)
  28232. Read thirty two bytes of memory starting at 'bytes+16' and format as
  28233. eight rows of four columns. Include a string encoding with 'x' used as
  28234. the non-printable character.
  28235. (gdb)
  28236. 4-data-read-memory bytes+16 x 1 8 4 x
  28237. 4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
  28238. next-row="0x000013c0",prev-row="0x0000139c",
  28239. next-page="0x000013c0",prev-page="0x00001380",memory=[
  28240. {addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"},
  28241. {addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"},
  28242. {addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"},
  28243. {addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"},
  28244. {addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"},
  28245. {addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"},
  28246. {addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"},
  28247. {addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"}]
  28248. (gdb)
  28249. The '-data-read-memory-bytes' Command
  28250. -------------------------------------
  28251. Synopsis
  28252. ........
  28253. -data-read-memory-bytes [ -o OFFSET ]
  28254. ADDRESS COUNT
  28255. where:
  28256. 'ADDRESS'
  28257. An expression specifying the address of the first addressable
  28258. memory unit to be read. Complex expressions containing embedded
  28259. white space should be quoted using the C convention.
  28260. 'COUNT'
  28261. The number of addressable memory units to read. This should be an
  28262. integer literal.
  28263. 'OFFSET'
  28264. The offset relative to ADDRESS at which to start reading. This
  28265. should be an integer literal. This option is provided so that a
  28266. frontend is not required to first evaluate address and then perform
  28267. address arithmetics itself.
  28268. This command attempts to read all accessible memory regions in the
  28269. specified range. First, all regions marked as unreadable in the memory
  28270. map (if one is defined) will be skipped. *Note Memory Region
  28271. Attributes::. Second, GDB will attempt to read the remaining regions.
  28272. For each one, if reading full region results in an errors, GDB will try
  28273. to read a subset of the region.
  28274. In general, every single memory unit in the region may be readable or
  28275. not, and the only way to read every readable unit is to try a read at
  28276. every address, which is not practical. Therefore, GDB will attempt to
  28277. read all accessible memory units at either beginning or the end of the
  28278. region, using a binary division scheme. This heuristic works well for
  28279. reading accross a memory map boundary. Note that if a region has a
  28280. readable range that is neither at the beginning or the end, GDB will not
  28281. read it.
  28282. The result record (*note GDB/MI Result Records::) that is output of
  28283. the command includes a field named 'memory' whose content is a list of
  28284. tuples. Each tuple represent a successfully read memory block and has
  28285. the following fields:
  28286. 'begin'
  28287. The start address of the memory block, as hexadecimal literal.
  28288. 'end'
  28289. The end address of the memory block, as hexadecimal literal.
  28290. 'offset'
  28291. The offset of the memory block, as hexadecimal literal, relative to
  28292. the start address passed to '-data-read-memory-bytes'.
  28293. 'contents'
  28294. The contents of the memory block, in hex.
  28295. GDB Command
  28296. ...........
  28297. The corresponding GDB command is 'x'.
  28298. Example
  28299. .......
  28300. (gdb)
  28301. -data-read-memory-bytes &a 10
  28302. ^done,memory=[{begin="0xbffff154",offset="0x00000000",
  28303. end="0xbffff15e",
  28304. contents="01000000020000000300"}]
  28305. (gdb)
  28306. The '-data-write-memory-bytes' Command
  28307. --------------------------------------
  28308. Synopsis
  28309. ........
  28310. -data-write-memory-bytes ADDRESS CONTENTS
  28311. -data-write-memory-bytes ADDRESS CONTENTS [COUNT]
  28312. where:
  28313. 'ADDRESS'
  28314. An expression specifying the address of the first addressable
  28315. memory unit to be written. Complex expressions containing embedded
  28316. white space should be quoted using the C convention.
  28317. 'CONTENTS'
  28318. The hex-encoded data to write. It is an error if CONTENTS does not
  28319. represent an integral number of addressable memory units.
  28320. 'COUNT'
  28321. Optional argument indicating the number of addressable memory units
  28322. to be written. If COUNT is greater than CONTENTS' length, GDB will
  28323. repeatedly write CONTENTS until it fills COUNT memory units.
  28324. GDB Command
  28325. ...........
  28326. There's no corresponding GDB command.
  28327. Example
  28328. .......
  28329. (gdb)
  28330. -data-write-memory-bytes &a "aabbccdd"
  28331. ^done
  28332. (gdb)
  28333. (gdb)
  28334. -data-write-memory-bytes &a "aabbccdd" 16e
  28335. ^done
  28336. (gdb)
  28337. 
  28338. File: gdb.info, Node: GDB/MI Tracepoint Commands, Next: GDB/MI Symbol Query, Prev: GDB/MI Data Manipulation, Up: GDB/MI
  28339. 27.17 GDB/MI Tracepoint Commands
  28340. ================================
  28341. The commands defined in this section implement MI support for
  28342. tracepoints. For detailed introduction, see *note Tracepoints::.
  28343. The '-trace-find' Command
  28344. -------------------------
  28345. Synopsis
  28346. ........
  28347. -trace-find MODE [PARAMETERS...]
  28348. Find a trace frame using criteria defined by MODE and PARAMETERS.
  28349. The following table lists permissible modes and their parameters. For
  28350. details of operation, see *note tfind::.
  28351. 'none'
  28352. No parameters are required. Stops examining trace frames.
  28353. 'frame-number'
  28354. An integer is required as parameter. Selects tracepoint frame with
  28355. that index.
  28356. 'tracepoint-number'
  28357. An integer is required as parameter. Finds next trace frame that
  28358. corresponds to tracepoint with the specified number.
  28359. 'pc'
  28360. An address is required as parameter. Finds next trace frame that
  28361. corresponds to any tracepoint at the specified address.
  28362. 'pc-inside-range'
  28363. Two addresses are required as parameters. Finds next trace frame
  28364. that corresponds to a tracepoint at an address inside the specified
  28365. range. Both bounds are considered to be inside the range.
  28366. 'pc-outside-range'
  28367. Two addresses are required as parameters. Finds next trace frame
  28368. that corresponds to a tracepoint at an address outside the
  28369. specified range. Both bounds are considered to be inside the
  28370. range.
  28371. 'line'
  28372. Line specification is required as parameter. *Note Specify
  28373. Location::. Finds next trace frame that corresponds to a
  28374. tracepoint at the specified location.
  28375. If 'none' was passed as MODE, the response does not have fields.
  28376. Otherwise, the response may have the following fields:
  28377. 'found'
  28378. This field has either '0' or '1' as the value, depending on whether
  28379. a matching tracepoint was found.
  28380. 'traceframe'
  28381. The index of the found traceframe. This field is present iff the
  28382. 'found' field has value of '1'.
  28383. 'tracepoint'
  28384. The index of the found tracepoint. This field is present iff the
  28385. 'found' field has value of '1'.
  28386. 'frame'
  28387. The information about the frame corresponding to the found trace
  28388. frame. This field is present only if a trace frame was found.
  28389. *Note GDB/MI Frame Information::, for description of this field.
  28390. GDB Command
  28391. ...........
  28392. The corresponding GDB command is 'tfind'.
  28393. -trace-define-variable
  28394. ----------------------
  28395. Synopsis
  28396. ........
  28397. -trace-define-variable NAME [ VALUE ]
  28398. Create trace variable NAME if it does not exist. If VALUE is
  28399. specified, sets the initial value of the specified trace variable to
  28400. that value. Note that the NAME should start with the '$' character.
  28401. GDB Command
  28402. ...........
  28403. The corresponding GDB command is 'tvariable'.
  28404. The '-trace-frame-collected' Command
  28405. ------------------------------------
  28406. Synopsis
  28407. ........
  28408. -trace-frame-collected
  28409. [--var-print-values VAR_PVAL]
  28410. [--comp-print-values COMP_PVAL]
  28411. [--registers-format REGFORMAT]
  28412. [--memory-contents]
  28413. This command returns the set of collected objects, register names,
  28414. trace state variable names, memory ranges and computed expressions that
  28415. have been collected at a particular trace frame. The optional
  28416. parameters to the command affect the output format in different ways.
  28417. See the output description table below for more details.
  28418. The reported names can be used in the normal manner to create varobjs
  28419. and inspect the objects themselves. The items returned by this command
  28420. are categorized so that it is clear which is a variable, which is a
  28421. register, which is a trace state variable, which is a memory range and
  28422. which is a computed expression.
  28423. For instance, if the actions were
  28424. collect myVar, myArray[myIndex], myObj.field, myPtr->field, myCount + 2
  28425. collect *(int*)0xaf02bef0@40
  28426. the object collected in its entirety would be 'myVar'. The object
  28427. 'myArray' would be partially collected, because only the element at
  28428. index 'myIndex' would be collected. The remaining objects would be
  28429. computed expressions.
  28430. An example output would be:
  28431. (gdb)
  28432. -trace-frame-collected
  28433. ^done,
  28434. explicit-variables=[{name="myVar",value="1"}],
  28435. computed-expressions=[{name="myArray[myIndex]",value="0"},
  28436. {name="myObj.field",value="0"},
  28437. {name="myPtr->field",value="1"},
  28438. {name="myCount + 2",value="3"},
  28439. {name="$tvar1 + 1",value="43970027"}],
  28440. registers=[{number="0",value="0x7fe2c6e79ec8"},
  28441. {number="1",value="0x0"},
  28442. {number="2",value="0x4"},
  28443. ...
  28444. {number="125",value="0x0"}],
  28445. tvars=[{name="$tvar1",current="43970026"}],
  28446. memory=[{address="0x0000000000602264",length="4"},
  28447. {address="0x0000000000615bc0",length="4"}]
  28448. (gdb)
  28449. Where:
  28450. 'explicit-variables'
  28451. The set of objects that have been collected in their entirety (as
  28452. opposed to collecting just a few elements of an array or a few
  28453. struct members). For each object, its name and value are printed.
  28454. The '--var-print-values' option affects how or whether the value
  28455. field is output. If VAR_PVAL is 0, then print only the names; if
  28456. it is 1, print also their values; and if it is 2, print the name,
  28457. type and value for simple data types, and the name and type for
  28458. arrays, structures and unions.
  28459. 'computed-expressions'
  28460. The set of computed expressions that have been collected at the
  28461. current trace frame. The '--comp-print-values' option affects this
  28462. set like the '--var-print-values' option affects the
  28463. 'explicit-variables' set. See above.
  28464. 'registers'
  28465. The registers that have been collected at the current trace frame.
  28466. For each register collected, the name and current value are
  28467. returned. The value is formatted according to the
  28468. '--registers-format' option. See the '-data-list-register-values'
  28469. command for a list of the allowed formats. The default is 'x'.
  28470. 'tvars'
  28471. The trace state variables that have been collected at the current
  28472. trace frame. For each trace state variable collected, the name and
  28473. current value are returned.
  28474. 'memory'
  28475. The set of memory ranges that have been collected at the current
  28476. trace frame. Its content is a list of tuples. Each tuple
  28477. represents a collected memory range and has the following fields:
  28478. 'address'
  28479. The start address of the memory range, as hexadecimal literal.
  28480. 'length'
  28481. The length of the memory range, as decimal literal.
  28482. 'contents'
  28483. The contents of the memory block, in hex. This field is only
  28484. present if the '--memory-contents' option is specified.
  28485. GDB Command
  28486. ...........
  28487. There is no corresponding GDB command.
  28488. Example
  28489. .......
  28490. -trace-list-variables
  28491. ---------------------
  28492. Synopsis
  28493. ........
  28494. -trace-list-variables
  28495. Return a table of all defined trace variables. Each element of the
  28496. table has the following fields:
  28497. 'name'
  28498. The name of the trace variable. This field is always present.
  28499. 'initial'
  28500. The initial value. This is a 64-bit signed integer. This field is
  28501. always present.
  28502. 'current'
  28503. The value the trace variable has at the moment. This is a 64-bit
  28504. signed integer. This field is absent iff current value is not
  28505. defined, for example if the trace was never run, or is presently
  28506. running.
  28507. GDB Command
  28508. ...........
  28509. The corresponding GDB command is 'tvariables'.
  28510. Example
  28511. .......
  28512. (gdb)
  28513. -trace-list-variables
  28514. ^done,trace-variables={nr_rows="1",nr_cols="3",
  28515. hdr=[{width="15",alignment="-1",col_name="name",colhdr="Name"},
  28516. {width="11",alignment="-1",col_name="initial",colhdr="Initial"},
  28517. {width="11",alignment="-1",col_name="current",colhdr="Current"}],
  28518. body=[variable={name="$trace_timestamp",initial="0"}
  28519. variable={name="$foo",initial="10",current="15"}]}
  28520. (gdb)
  28521. -trace-save
  28522. -----------
  28523. Synopsis
  28524. ........
  28525. -trace-save [ -r ] [ -ctf ] FILENAME
  28526. Saves the collected trace data to FILENAME. Without the '-r' option,
  28527. the data is downloaded from the target and saved in a local file. With
  28528. the '-r' option the target is asked to perform the save.
  28529. By default, this command will save the trace in the tfile format.
  28530. You can supply the optional '-ctf' argument to save it the CTF format.
  28531. See *note Trace Files:: for more information about CTF.
  28532. GDB Command
  28533. ...........
  28534. The corresponding GDB command is 'tsave'.
  28535. -trace-start
  28536. ------------
  28537. Synopsis
  28538. ........
  28539. -trace-start
  28540. Starts a tracing experiment. The result of this command does not
  28541. have any fields.
  28542. GDB Command
  28543. ...........
  28544. The corresponding GDB command is 'tstart'.
  28545. -trace-status
  28546. -------------
  28547. Synopsis
  28548. ........
  28549. -trace-status
  28550. Obtains the status of a tracing experiment. The result may include
  28551. the following fields:
  28552. 'supported'
  28553. May have a value of either '0', when no tracing operations are
  28554. supported, '1', when all tracing operations are supported, or
  28555. 'file' when examining trace file. In the latter case, examining of
  28556. trace frame is possible but new tracing experiement cannot be
  28557. started. This field is always present.
  28558. 'running'
  28559. May have a value of either '0' or '1' depending on whether tracing
  28560. experiement is in progress on target. This field is present if
  28561. 'supported' field is not '0'.
  28562. 'stop-reason'
  28563. Report the reason why the tracing was stopped last time. This
  28564. field may be absent iff tracing was never stopped on target yet.
  28565. The value of 'request' means the tracing was stopped as result of
  28566. the '-trace-stop' command. The value of 'overflow' means the
  28567. tracing buffer is full. The value of 'disconnection' means tracing
  28568. was automatically stopped when GDB has disconnected. The value of
  28569. 'passcount' means tracing was stopped when a tracepoint was passed
  28570. a maximal number of times for that tracepoint. This field is
  28571. present if 'supported' field is not '0'.
  28572. 'stopping-tracepoint'
  28573. The number of tracepoint whose passcount as exceeded. This field
  28574. is present iff the 'stop-reason' field has the value of
  28575. 'passcount'.
  28576. 'frames'
  28577. 'frames-created'
  28578. The 'frames' field is a count of the total number of trace frames
  28579. in the trace buffer, while 'frames-created' is the total created
  28580. during the run, including ones that were discarded, such as when a
  28581. circular trace buffer filled up. Both fields are optional.
  28582. 'buffer-size'
  28583. 'buffer-free'
  28584. These fields tell the current size of the tracing buffer and the
  28585. remaining space. These fields are optional.
  28586. 'circular'
  28587. The value of the circular trace buffer flag. '1' means that the
  28588. trace buffer is circular and old trace frames will be discarded if
  28589. necessary to make room, '0' means that the trace buffer is linear
  28590. and may fill up.
  28591. 'disconnected'
  28592. The value of the disconnected tracing flag. '1' means that tracing
  28593. will continue after GDB disconnects, '0' means that the trace run
  28594. will stop.
  28595. 'trace-file'
  28596. The filename of the trace file being examined. This field is
  28597. optional, and only present when examining a trace file.
  28598. GDB Command
  28599. ...........
  28600. The corresponding GDB command is 'tstatus'.
  28601. -trace-stop
  28602. -----------
  28603. Synopsis
  28604. ........
  28605. -trace-stop
  28606. Stops a tracing experiment. The result of this command has the same
  28607. fields as '-trace-status', except that the 'supported' and 'running'
  28608. fields are not output.
  28609. GDB Command
  28610. ...........
  28611. The corresponding GDB command is 'tstop'.
  28612. 
  28613. File: gdb.info, Node: GDB/MI Symbol Query, Next: GDB/MI File Commands, Prev: GDB/MI Tracepoint Commands, Up: GDB/MI
  28614. 27.18 GDB/MI Symbol Query Commands
  28615. ==================================
  28616. The '-symbol-list-lines' Command
  28617. --------------------------------
  28618. Synopsis
  28619. ........
  28620. -symbol-list-lines FILENAME
  28621. Print the list of lines that contain code and their associated
  28622. program addresses for the given source filename. The entries are sorted
  28623. in ascending PC order.
  28624. GDB Command
  28625. ...........
  28626. There is no corresponding GDB command.
  28627. Example
  28628. .......
  28629. (gdb)
  28630. -symbol-list-lines basics.c
  28631. ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
  28632. (gdb)
  28633. 
  28634. File: gdb.info, Node: GDB/MI File Commands, Next: GDB/MI Target Manipulation, Prev: GDB/MI Symbol Query, Up: GDB/MI
  28635. 27.19 GDB/MI File Commands
  28636. ==========================
  28637. This section describes the GDB/MI commands to specify executable file
  28638. names and to read in and obtain symbol table information.
  28639. The '-file-exec-and-symbols' Command
  28640. ------------------------------------
  28641. Synopsis
  28642. ........
  28643. -file-exec-and-symbols FILE
  28644. Specify the executable file to be debugged. This file is the one
  28645. from which the symbol table is also read. If no file is specified, the
  28646. command clears the executable and symbol information. If breakpoints
  28647. are set when using this command with no arguments, GDB will produce
  28648. error messages. Otherwise, no output is produced, except a completion
  28649. notification.
  28650. GDB Command
  28651. ...........
  28652. The corresponding GDB command is 'file'.
  28653. Example
  28654. .......
  28655. (gdb)
  28656. -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  28657. ^done
  28658. (gdb)
  28659. The '-file-exec-file' Command
  28660. -----------------------------
  28661. Synopsis
  28662. ........
  28663. -file-exec-file FILE
  28664. Specify the executable file to be debugged. Unlike
  28665. '-file-exec-and-symbols', the symbol table is _not_ read from this file.
  28666. If used without argument, GDB clears the information about the
  28667. executable file. No output is produced, except a completion
  28668. notification.
  28669. GDB Command
  28670. ...........
  28671. The corresponding GDB command is 'exec-file'.
  28672. Example
  28673. .......
  28674. (gdb)
  28675. -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  28676. ^done
  28677. (gdb)
  28678. The '-file-list-exec-source-file' Command
  28679. -----------------------------------------
  28680. Synopsis
  28681. ........
  28682. -file-list-exec-source-file
  28683. List the line number, the current source file, and the absolute path
  28684. to the current source file for the current executable. The macro
  28685. information field has a value of '1' or '0' depending on whether or not
  28686. the file includes preprocessor macro information.
  28687. GDB Command
  28688. ...........
  28689. The GDB equivalent is 'info source'
  28690. Example
  28691. .......
  28692. (gdb)
  28693. 123-file-list-exec-source-file
  28694. 123^done,line="1",file="foo.c",fullname="/home/bar/foo.c,macro-info="1"
  28695. (gdb)
  28696. The '-file-list-exec-source-files' Command
  28697. ------------------------------------------
  28698. Synopsis
  28699. ........
  28700. -file-list-exec-source-files
  28701. List the source files for the current executable.
  28702. It will always output both the filename and fullname (absolute file
  28703. name) of a source file.
  28704. GDB Command
  28705. ...........
  28706. The GDB equivalent is 'info sources'. 'gdbtk' has an analogous command
  28707. 'gdb_listfiles'.
  28708. Example
  28709. .......
  28710. (gdb)
  28711. -file-list-exec-source-files
  28712. ^done,files=[
  28713. {file=foo.c,fullname=/home/foo.c},
  28714. {file=/home/bar.c,fullname=/home/bar.c},
  28715. {file=gdb_could_not_find_fullpath.c}]
  28716. (gdb)
  28717. The '-file-list-shared-libraries' Command
  28718. -----------------------------------------
  28719. Synopsis
  28720. ........
  28721. -file-list-shared-libraries [ REGEXP ]
  28722. List the shared libraries in the program. With a regular expression
  28723. REGEXP, only those libraries whose names match REGEXP are listed.
  28724. GDB Command
  28725. ...........
  28726. The corresponding GDB command is 'info shared'. The fields have a
  28727. similar meaning to the '=library-loaded' notification. The 'ranges'
  28728. field specifies the multiple segments belonging to this library. Each
  28729. range has the following fields:
  28730. 'from'
  28731. The address defining the inclusive lower bound of the segment.
  28732. 'to'
  28733. The address defining the exclusive upper bound of the segment.
  28734. Example
  28735. .......
  28736. (gdb)
  28737. -file-list-exec-source-files
  28738. ^done,shared-libraries=[
  28739. {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"}]},
  28740. {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"}]}]
  28741. (gdb)
  28742. The '-file-symbol-file' Command
  28743. -------------------------------
  28744. Synopsis
  28745. ........
  28746. -file-symbol-file FILE
  28747. Read symbol table info from the specified FILE argument. When used
  28748. without arguments, clears GDB's symbol table info. No output is
  28749. produced, except for a completion notification.
  28750. GDB Command
  28751. ...........
  28752. The corresponding GDB command is 'symbol-file'.
  28753. Example
  28754. .......
  28755. (gdb)
  28756. -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  28757. ^done
  28758. (gdb)
  28759. 
  28760. File: gdb.info, Node: GDB/MI Target Manipulation, Next: GDB/MI File Transfer Commands, Prev: GDB/MI File Commands, Up: GDB/MI
  28761. 27.20 GDB/MI Target Manipulation Commands
  28762. =========================================
  28763. The '-target-attach' Command
  28764. ----------------------------
  28765. Synopsis
  28766. ........
  28767. -target-attach PID | GID | FILE
  28768. Attach to a process PID or a file FILE outside of GDB, or a thread
  28769. group GID. If attaching to a thread group, the id previously returned
  28770. by '-list-thread-groups --available' must be used.
  28771. GDB Command
  28772. ...........
  28773. The corresponding GDB command is 'attach'.
  28774. Example
  28775. .......
  28776. (gdb)
  28777. -target-attach 34
  28778. =thread-created,id="1"
  28779. *stopped,thread-id="1",frame={addr="0xb7f7e410",func="bar",args=[]}
  28780. ^done
  28781. (gdb)
  28782. The '-target-detach' Command
  28783. ----------------------------
  28784. Synopsis
  28785. ........
  28786. -target-detach [ PID | GID ]
  28787. Detach from the remote target which normally resumes its execution.
  28788. If either PID or GID is specified, detaches from either the specified
  28789. process, or specified thread group. There's no output.
  28790. GDB Command
  28791. ...........
  28792. The corresponding GDB command is 'detach'.
  28793. Example
  28794. .......
  28795. (gdb)
  28796. -target-detach
  28797. ^done
  28798. (gdb)
  28799. The '-target-disconnect' Command
  28800. --------------------------------
  28801. Synopsis
  28802. ........
  28803. -target-disconnect
  28804. Disconnect from the remote target. There's no output and the target
  28805. is generally not resumed.
  28806. GDB Command
  28807. ...........
  28808. The corresponding GDB command is 'disconnect'.
  28809. Example
  28810. .......
  28811. (gdb)
  28812. -target-disconnect
  28813. ^done
  28814. (gdb)
  28815. The '-target-download' Command
  28816. ------------------------------
  28817. Synopsis
  28818. ........
  28819. -target-download
  28820. Loads the executable onto the remote target. It prints out an update
  28821. message every half second, which includes the fields:
  28822. 'section'
  28823. The name of the section.
  28824. 'section-sent'
  28825. The size of what has been sent so far for that section.
  28826. 'section-size'
  28827. The size of the section.
  28828. 'total-sent'
  28829. The total size of what was sent so far (the current and the
  28830. previous sections).
  28831. 'total-size'
  28832. The size of the overall executable to download.
  28833. Each message is sent as status record (*note GDB/MI Output Syntax:
  28834. GDB/MI Output Syntax.).
  28835. In addition, it prints the name and size of the sections, as they are
  28836. downloaded. These messages include the following fields:
  28837. 'section'
  28838. The name of the section.
  28839. 'section-size'
  28840. The size of the section.
  28841. 'total-size'
  28842. The size of the overall executable to download.
  28843. At the end, a summary is printed.
  28844. GDB Command
  28845. ...........
  28846. The corresponding GDB command is 'load'.
  28847. Example
  28848. .......
  28849. Note: each status message appears on a single line. Here the messages
  28850. have been broken down so that they can fit onto a page.
  28851. (gdb)
  28852. -target-download
  28853. +download,{section=".text",section-size="6668",total-size="9880"}
  28854. +download,{section=".text",section-sent="512",section-size="6668",
  28855. total-sent="512",total-size="9880"}
  28856. +download,{section=".text",section-sent="1024",section-size="6668",
  28857. total-sent="1024",total-size="9880"}
  28858. +download,{section=".text",section-sent="1536",section-size="6668",
  28859. total-sent="1536",total-size="9880"}
  28860. +download,{section=".text",section-sent="2048",section-size="6668",
  28861. total-sent="2048",total-size="9880"}
  28862. +download,{section=".text",section-sent="2560",section-size="6668",
  28863. total-sent="2560",total-size="9880"}
  28864. +download,{section=".text",section-sent="3072",section-size="6668",
  28865. total-sent="3072",total-size="9880"}
  28866. +download,{section=".text",section-sent="3584",section-size="6668",
  28867. total-sent="3584",total-size="9880"}
  28868. +download,{section=".text",section-sent="4096",section-size="6668",
  28869. total-sent="4096",total-size="9880"}
  28870. +download,{section=".text",section-sent="4608",section-size="6668",
  28871. total-sent="4608",total-size="9880"}
  28872. +download,{section=".text",section-sent="5120",section-size="6668",
  28873. total-sent="5120",total-size="9880"}
  28874. +download,{section=".text",section-sent="5632",section-size="6668",
  28875. total-sent="5632",total-size="9880"}
  28876. +download,{section=".text",section-sent="6144",section-size="6668",
  28877. total-sent="6144",total-size="9880"}
  28878. +download,{section=".text",section-sent="6656",section-size="6668",
  28879. total-sent="6656",total-size="9880"}
  28880. +download,{section=".init",section-size="28",total-size="9880"}
  28881. +download,{section=".fini",section-size="28",total-size="9880"}
  28882. +download,{section=".data",section-size="3156",total-size="9880"}
  28883. +download,{section=".data",section-sent="512",section-size="3156",
  28884. total-sent="7236",total-size="9880"}
  28885. +download,{section=".data",section-sent="1024",section-size="3156",
  28886. total-sent="7748",total-size="9880"}
  28887. +download,{section=".data",section-sent="1536",section-size="3156",
  28888. total-sent="8260",total-size="9880"}
  28889. +download,{section=".data",section-sent="2048",section-size="3156",
  28890. total-sent="8772",total-size="9880"}
  28891. +download,{section=".data",section-sent="2560",section-size="3156",
  28892. total-sent="9284",total-size="9880"}
  28893. +download,{section=".data",section-sent="3072",section-size="3156",
  28894. total-sent="9796",total-size="9880"}
  28895. ^done,address="0x10004",load-size="9880",transfer-rate="6586",
  28896. write-rate="429"
  28897. (gdb)
  28898. GDB Command
  28899. ...........
  28900. No equivalent.
  28901. Example
  28902. .......
  28903. N.A.
  28904. The '-target-flash-erase' Command
  28905. ---------------------------------
  28906. Synopsis
  28907. ........
  28908. -target-flash-erase
  28909. Erases all known flash memory regions on the target.
  28910. The corresponding GDB command is 'flash-erase'.
  28911. The output is a list of flash regions that have been erased, with
  28912. starting addresses and memory region sizes.
  28913. (gdb)
  28914. -target-flash-erase
  28915. ^done,erased-regions={address="0x0",size="0x40000"}
  28916. (gdb)
  28917. The '-target-select' Command
  28918. ----------------------------
  28919. Synopsis
  28920. ........
  28921. -target-select TYPE PARAMETERS ...
  28922. Connect GDB to the remote target. This command takes two args:
  28923. 'TYPE'
  28924. The type of target, for instance 'remote', etc.
  28925. 'PARAMETERS'
  28926. Device names, host names and the like. *Note Commands for Managing
  28927. Targets: Target Commands, for more details.
  28928. The output is a connection notification, followed by the address at
  28929. which the target program is, in the following form:
  28930. ^connected,addr="ADDRESS",func="FUNCTION NAME",
  28931. args=[ARG LIST]
  28932. GDB Command
  28933. ...........
  28934. The corresponding GDB command is 'target'.
  28935. Example
  28936. .......
  28937. (gdb)
  28938. -target-select remote /dev/ttya
  28939. ^connected,addr="0xfe00a300",func="??",args=[]
  28940. (gdb)
  28941. 
  28942. File: gdb.info, Node: GDB/MI File Transfer Commands, Next: GDB/MI Ada Exceptions Commands, Prev: GDB/MI Target Manipulation, Up: GDB/MI
  28943. 27.21 GDB/MI File Transfer Commands
  28944. ===================================
  28945. The '-target-file-put' Command
  28946. ------------------------------
  28947. Synopsis
  28948. ........
  28949. -target-file-put HOSTFILE TARGETFILE
  28950. Copy file HOSTFILE from the host system (the machine running GDB) to
  28951. TARGETFILE on the target system.
  28952. GDB Command
  28953. ...........
  28954. The corresponding GDB command is 'remote put'.
  28955. Example
  28956. .......
  28957. (gdb)
  28958. -target-file-put localfile remotefile
  28959. ^done
  28960. (gdb)
  28961. The '-target-file-get' Command
  28962. ------------------------------
  28963. Synopsis
  28964. ........
  28965. -target-file-get TARGETFILE HOSTFILE
  28966. Copy file TARGETFILE from the target system to HOSTFILE on the host
  28967. system.
  28968. GDB Command
  28969. ...........
  28970. The corresponding GDB command is 'remote get'.
  28971. Example
  28972. .......
  28973. (gdb)
  28974. -target-file-get remotefile localfile
  28975. ^done
  28976. (gdb)
  28977. The '-target-file-delete' Command
  28978. ---------------------------------
  28979. Synopsis
  28980. ........
  28981. -target-file-delete TARGETFILE
  28982. Delete TARGETFILE from the target system.
  28983. GDB Command
  28984. ...........
  28985. The corresponding GDB command is 'remote delete'.
  28986. Example
  28987. .......
  28988. (gdb)
  28989. -target-file-delete remotefile
  28990. ^done
  28991. (gdb)
  28992. 
  28993. File: gdb.info, Node: GDB/MI Ada Exceptions Commands, Next: GDB/MI Support Commands, Prev: GDB/MI File Transfer Commands, Up: GDB/MI
  28994. 27.22 Ada Exceptions GDB/MI Commands
  28995. ====================================
  28996. The '-info-ada-exceptions' Command
  28997. ----------------------------------
  28998. Synopsis
  28999. ........
  29000. -info-ada-exceptions [ REGEXP]
  29001. List all Ada exceptions defined within the program being debugged.
  29002. With a regular expression REGEXP, only those exceptions whose names
  29003. match REGEXP are listed.
  29004. GDB Command
  29005. ...........
  29006. The corresponding GDB command is 'info exceptions'.
  29007. Result
  29008. ......
  29009. The result is a table of Ada exceptions. The following columns are
  29010. defined for each exception:
  29011. 'name'
  29012. The name of the exception.
  29013. 'address'
  29014. The address of the exception.
  29015. Example
  29016. .......
  29017. -info-ada-exceptions aint
  29018. ^done,ada-exceptions={nr_rows="2",nr_cols="2",
  29019. hdr=[{width="1",alignment="-1",col_name="name",colhdr="Name"},
  29020. {width="1",alignment="-1",col_name="address",colhdr="Address"}],
  29021. body=[{name="constraint_error",address="0x0000000000613da0"},
  29022. {name="const.aint_global_e",address="0x0000000000613b00"}]}
  29023. Catching Ada Exceptions
  29024. -----------------------
  29025. The commands describing how to ask GDB to stop when a program raises an
  29026. exception are described at *note Ada Exception GDB/MI Catchpoint
  29027. Commands::.
  29028. 
  29029. File: gdb.info, Node: GDB/MI Support Commands, Next: GDB/MI Miscellaneous Commands, Prev: GDB/MI Ada Exceptions Commands, Up: GDB/MI
  29030. 27.23 GDB/MI Support Commands
  29031. =============================
  29032. Since new commands and features get regularly added to GDB/MI, some
  29033. commands are available to help front-ends query the debugger about
  29034. support for these capabilities. Similarly, it is also possible to query
  29035. GDB about target support of certain features.
  29036. The '-info-gdb-mi-command' Command
  29037. ----------------------------------
  29038. Synopsis
  29039. ........
  29040. -info-gdb-mi-command CMD_NAME
  29041. Query support for the GDB/MI command named CMD_NAME.
  29042. Note that the dash ('-') starting all GDB/MI commands is technically
  29043. not part of the command name (*note GDB/MI Input Syntax::), and thus
  29044. should be omitted in CMD_NAME. However, for ease of use, this command
  29045. also accepts the form with the leading dash.
  29046. GDB Command
  29047. ...........
  29048. There is no corresponding GDB command.
  29049. Result
  29050. ......
  29051. The result is a tuple. There is currently only one field:
  29052. 'exists'
  29053. This field is equal to '"true"' if the GDB/MI command exists,
  29054. '"false"' otherwise.
  29055. Example
  29056. .......
  29057. Here is an example where the GDB/MI command does not exist:
  29058. -info-gdb-mi-command unsupported-command
  29059. ^done,command={exists="false"}
  29060. And here is an example where the GDB/MI command is known to the
  29061. debugger:
  29062. -info-gdb-mi-command symbol-list-lines
  29063. ^done,command={exists="true"}
  29064. The '-list-features' Command
  29065. ----------------------------
  29066. Returns a list of particular features of the MI protocol that this
  29067. version of gdb implements. A feature can be a command, or a new field
  29068. in an output of some command, or even an important bugfix. While a
  29069. frontend can sometimes detect presence of a feature at runtime, it is
  29070. easier to perform detection at debugger startup.
  29071. The command returns a list of strings, with each string naming an
  29072. available feature. Each returned string is just a name, it does not
  29073. have any internal structure. The list of possible feature names is
  29074. given below.
  29075. Example output:
  29076. (gdb) -list-features
  29077. ^done,result=["feature1","feature2"]
  29078. The current list of features is:
  29079. 'frozen-varobjs'
  29080. Indicates support for the '-var-set-frozen' command, as well as
  29081. possible presense of the 'frozen' field in the output of
  29082. '-varobj-create'.
  29083. 'pending-breakpoints'
  29084. Indicates support for the '-f' option to the '-break-insert'
  29085. command.
  29086. 'python'
  29087. Indicates Python scripting support, Python-based pretty-printing
  29088. commands, and possible presence of the 'display_hint' field in the
  29089. output of '-var-list-children'
  29090. 'thread-info'
  29091. Indicates support for the '-thread-info' command.
  29092. 'data-read-memory-bytes'
  29093. Indicates support for the '-data-read-memory-bytes' and the
  29094. '-data-write-memory-bytes' commands.
  29095. 'breakpoint-notifications'
  29096. Indicates that changes to breakpoints and breakpoints created via
  29097. the CLI will be announced via async records.
  29098. 'ada-task-info'
  29099. Indicates support for the '-ada-task-info' command.
  29100. 'language-option'
  29101. Indicates that all GDB/MI commands accept the '--language' option
  29102. (*note Context management::).
  29103. 'info-gdb-mi-command'
  29104. Indicates support for the '-info-gdb-mi-command' command.
  29105. 'undefined-command-error-code'
  29106. Indicates support for the "undefined-command" error code in error
  29107. result records, produced when trying to execute an undefined GDB/MI
  29108. command (*note GDB/MI Result Records::).
  29109. 'exec-run-start-option'
  29110. Indicates that the '-exec-run' command supports the '--start'
  29111. option (*note GDB/MI Program Execution::).
  29112. 'data-disassemble-a-option'
  29113. Indicates that the '-data-disassemble' command supports the '-a'
  29114. option (*note GDB/MI Data Manipulation::).
  29115. The '-list-target-features' Command
  29116. -----------------------------------
  29117. Returns a list of particular features that are supported by the target.
  29118. Those features affect the permitted MI commands, but unlike the features
  29119. reported by the '-list-features' command, the features depend on which
  29120. target GDB is using at the moment. Whenever a target can change, due to
  29121. commands such as '-target-select', '-target-attach' or '-exec-run', the
  29122. list of target features may change, and the frontend should obtain it
  29123. again. Example output:
  29124. (gdb) -list-target-features
  29125. ^done,result=["async"]
  29126. The current list of features is:
  29127. 'async'
  29128. Indicates that the target is capable of asynchronous command
  29129. execution, which means that GDB will accept further commands while
  29130. the target is running.
  29131. 'reverse'
  29132. Indicates that the target is capable of reverse execution. *Note
  29133. Reverse Execution::, for more information.
  29134. 
  29135. File: gdb.info, Node: GDB/MI Miscellaneous Commands, Prev: GDB/MI Support Commands, Up: GDB/MI
  29136. 27.24 Miscellaneous GDB/MI Commands
  29137. ===================================
  29138. The '-gdb-exit' Command
  29139. -----------------------
  29140. Synopsis
  29141. ........
  29142. -gdb-exit
  29143. Exit GDB immediately.
  29144. GDB Command
  29145. ...........
  29146. Approximately corresponds to 'quit'.
  29147. Example
  29148. .......
  29149. (gdb)
  29150. -gdb-exit
  29151. ^exit
  29152. The '-gdb-set' Command
  29153. ----------------------
  29154. Synopsis
  29155. ........
  29156. -gdb-set
  29157. Set an internal GDB variable.
  29158. GDB Command
  29159. ...........
  29160. The corresponding GDB command is 'set'.
  29161. Example
  29162. .......
  29163. (gdb)
  29164. -gdb-set $foo=3
  29165. ^done
  29166. (gdb)
  29167. The '-gdb-show' Command
  29168. -----------------------
  29169. Synopsis
  29170. ........
  29171. -gdb-show
  29172. Show the current value of a GDB variable.
  29173. GDB Command
  29174. ...........
  29175. The corresponding GDB command is 'show'.
  29176. Example
  29177. .......
  29178. (gdb)
  29179. -gdb-show annotate
  29180. ^done,value="0"
  29181. (gdb)
  29182. The '-gdb-version' Command
  29183. --------------------------
  29184. Synopsis
  29185. ........
  29186. -gdb-version
  29187. Show version information for GDB. Used mostly in testing.
  29188. GDB Command
  29189. ...........
  29190. The GDB equivalent is 'show version'. GDB by default shows this
  29191. information when you start an interactive session.
  29192. Example
  29193. .......
  29194. (gdb)
  29195. -gdb-version
  29196. ~GNU gdb 5.2.1
  29197. ~Copyright 2000 Free Software Foundation, Inc.
  29198. ~GDB is free software, covered by the GNU General Public License, and
  29199. ~you are welcome to change it and/or distribute copies of it under
  29200. ~ certain conditions.
  29201. ~Type "show copying" to see the conditions.
  29202. ~There is absolutely no warranty for GDB. Type "show warranty" for
  29203. ~ details.
  29204. ~This GDB was configured as
  29205. "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
  29206. ^done
  29207. (gdb)
  29208. The '-list-thread-groups' Command
  29209. ---------------------------------
  29210. Synopsis
  29211. --------
  29212. -list-thread-groups [ --available ] [ --recurse 1 ] [ GROUP ... ]
  29213. Lists thread groups (*note Thread groups::). When a single thread
  29214. group is passed as the argument, lists the children of that group. When
  29215. several thread group are passed, lists information about those thread
  29216. groups. Without any parameters, lists information about all top-level
  29217. thread groups.
  29218. Normally, thread groups that are being debugged are reported. With
  29219. the '--available' option, GDB reports thread groups available on the
  29220. target.
  29221. The output of this command may have either a 'threads' result or a
  29222. 'groups' result. The 'thread' result has a list of tuples as value,
  29223. with each tuple describing a thread (*note GDB/MI Thread Information::).
  29224. The 'groups' result has a list of tuples as value, each tuple describing
  29225. a thread group. If top-level groups are requested (that is, no
  29226. parameter is passed), or when several groups are passed, the output
  29227. always has a 'groups' result. The format of the 'group' result is
  29228. described below.
  29229. To reduce the number of roundtrips it's possible to list thread
  29230. groups together with their children, by passing the '--recurse' option
  29231. and the recursion depth. Presently, only recursion depth of 1 is
  29232. permitted. If this option is present, then every reported thread group
  29233. will also include its children, either as 'group' or 'threads' field.
  29234. In general, any combination of option and parameters is permitted,
  29235. with the following caveats:
  29236. * When a single thread group is passed, the output will typically be
  29237. the 'threads' result. Because threads may not contain anything,
  29238. the 'recurse' option will be ignored.
  29239. * When the '--available' option is passed, limited information may be
  29240. available. In particular, the list of threads of a process might
  29241. be inaccessible. Further, specifying specific thread groups might
  29242. not give any performance advantage over listing all thread groups.
  29243. The frontend should assume that '-list-thread-groups --available'
  29244. is always an expensive operation and cache the results.
  29245. The 'groups' result is a list of tuples, where each tuple may have
  29246. the following fields:
  29247. 'id'
  29248. Identifier of the thread group. This field is always present. The
  29249. identifier is an opaque string; frontends should not try to convert
  29250. it to an integer, even though it might look like one.
  29251. 'type'
  29252. The type of the thread group. At present, only 'process' is a
  29253. valid type.
  29254. 'pid'
  29255. The target-specific process identifier. This field is only present
  29256. for thread groups of type 'process' and only if the process exists.
  29257. 'exit-code'
  29258. The exit code of this group's last exited thread, formatted in
  29259. octal. This field is only present for thread groups of type
  29260. 'process' and only if the process is not running.
  29261. 'num_children'
  29262. The number of children this thread group has. This field may be
  29263. absent for an available thread group.
  29264. 'threads'
  29265. This field has a list of tuples as value, each tuple describing a
  29266. thread. It may be present if the '--recurse' option is specified,
  29267. and it's actually possible to obtain the threads.
  29268. 'cores'
  29269. This field is a list of integers, each identifying a core that one
  29270. thread of the group is running on. This field may be absent if
  29271. such information is not available.
  29272. 'executable'
  29273. The name of the executable file that corresponds to this thread
  29274. group. The field is only present for thread groups of type
  29275. 'process', and only if there is a corresponding executable file.
  29276. Example
  29277. -------
  29278. gdb
  29279. -list-thread-groups
  29280. ^done,groups=[{id="17",type="process",pid="yyy",num_children="2"}]
  29281. -list-thread-groups 17
  29282. ^done,threads=[{id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
  29283. frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",args=[]},state="running"},
  29284. {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
  29285. frame={level="0",addr="0x0804891f",func="foo",args=[{name="i",value="10"}],
  29286. file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"},state="running"}]]
  29287. -list-thread-groups --available
  29288. ^done,groups=[{id="17",type="process",pid="yyy",num_children="2",cores=[1,2]}]
  29289. -list-thread-groups --available --recurse 1
  29290. ^done,groups=[{id="17", types="process",pid="yyy",num_children="2",cores=[1,2],
  29291. threads=[{id="1",target-id="Thread 0xb7e14b90",cores=[1]},
  29292. {id="2",target-id="Thread 0xb7e14b90",cores=[2]}]},..]
  29293. -list-thread-groups --available --recurse 1 17 18
  29294. ^done,groups=[{id="17", types="process",pid="yyy",num_children="2",cores=[1,2],
  29295. threads=[{id="1",target-id="Thread 0xb7e14b90",cores=[1]},
  29296. {id="2",target-id="Thread 0xb7e14b90",cores=[2]}]},...]
  29297. The '-info-os' Command
  29298. ----------------------
  29299. Synopsis
  29300. ........
  29301. -info-os [ TYPE ]
  29302. If no argument is supplied, the command returns a table of available
  29303. operating-system-specific information types. If one of these types is
  29304. supplied as an argument TYPE, then the command returns a table of data
  29305. of that type.
  29306. The types of information available depend on the target operating
  29307. system.
  29308. GDB Command
  29309. ...........
  29310. The corresponding GDB command is 'info os'.
  29311. Example
  29312. .......
  29313. When run on a GNU/Linux system, the output will look something like
  29314. this:
  29315. gdb
  29316. -info-os
  29317. ^done,OSDataTable={nr_rows="10",nr_cols="3",
  29318. hdr=[{width="10",alignment="-1",col_name="col0",colhdr="Type"},
  29319. {width="10",alignment="-1",col_name="col1",colhdr="Description"},
  29320. {width="10",alignment="-1",col_name="col2",colhdr="Title"}],
  29321. body=[item={col0="cpus",col1="Listing of all cpus/cores on the system",
  29322. col2="CPUs"},
  29323. item={col0="files",col1="Listing of all file descriptors",
  29324. col2="File descriptors"},
  29325. item={col0="modules",col1="Listing of all loaded kernel modules",
  29326. col2="Kernel modules"},
  29327. item={col0="msg",col1="Listing of all message queues",
  29328. col2="Message queues"},
  29329. item={col0="processes",col1="Listing of all processes",
  29330. col2="Processes"},
  29331. item={col0="procgroups",col1="Listing of all process groups",
  29332. col2="Process groups"},
  29333. item={col0="semaphores",col1="Listing of all semaphores",
  29334. col2="Semaphores"},
  29335. item={col0="shm",col1="Listing of all shared-memory regions",
  29336. col2="Shared-memory regions"},
  29337. item={col0="sockets",col1="Listing of all internet-domain sockets",
  29338. col2="Sockets"},
  29339. item={col0="threads",col1="Listing of all threads",
  29340. col2="Threads"}]
  29341. gdb
  29342. -info-os processes
  29343. ^done,OSDataTable={nr_rows="190",nr_cols="4",
  29344. hdr=[{width="10",alignment="-1",col_name="col0",colhdr="pid"},
  29345. {width="10",alignment="-1",col_name="col1",colhdr="user"},
  29346. {width="10",alignment="-1",col_name="col2",colhdr="command"},
  29347. {width="10",alignment="-1",col_name="col3",colhdr="cores"}],
  29348. body=[item={col0="1",col1="root",col2="/sbin/init",col3="0"},
  29349. item={col0="2",col1="root",col2="[kthreadd]",col3="1"},
  29350. item={col0="3",col1="root",col2="[ksoftirqd/0]",col3="0"},
  29351. ...
  29352. item={col0="26446",col1="stan",col2="bash",col3="0"},
  29353. item={col0="28152",col1="stan",col2="bash",col3="1"}]}
  29354. (gdb)
  29355. (Note that the MI output here includes a '"Title"' column that does
  29356. not appear in command-line 'info os'; this column is useful for MI
  29357. clients that want to enumerate the types of data, such as in a popup
  29358. menu, but is needless clutter on the command line, and 'info os' omits
  29359. it.)
  29360. The '-add-inferior' Command
  29361. ---------------------------
  29362. Synopsis
  29363. --------
  29364. -add-inferior
  29365. Creates a new inferior (*note Inferiors and Programs::). The created
  29366. inferior is not associated with any executable. Such association may be
  29367. established with the '-file-exec-and-symbols' command (*note GDB/MI File
  29368. Commands::). The command response has a single field, 'inferior', whose
  29369. value is the identifier of the thread group corresponding to the new
  29370. inferior.
  29371. Example
  29372. -------
  29373. gdb
  29374. -add-inferior
  29375. ^done,inferior="i3"
  29376. The '-interpreter-exec' Command
  29377. -------------------------------
  29378. Synopsis
  29379. --------
  29380. -interpreter-exec INTERPRETER COMMAND
  29381. Execute the specified COMMAND in the given INTERPRETER.
  29382. GDB Command
  29383. -----------
  29384. The corresponding GDB command is 'interpreter-exec'.
  29385. Example
  29386. -------
  29387. (gdb)
  29388. -interpreter-exec console "break main"
  29389. &"During symbol reading, couldn't parse type; debugger out of date?.\n"
  29390. &"During symbol reading, bad structure-type format.\n"
  29391. ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
  29392. ^done
  29393. (gdb)
  29394. The '-inferior-tty-set' Command
  29395. -------------------------------
  29396. Synopsis
  29397. --------
  29398. -inferior-tty-set /dev/pts/1
  29399. Set terminal for future runs of the program being debugged.
  29400. GDB Command
  29401. -----------
  29402. The corresponding GDB command is 'set inferior-tty' /dev/pts/1.
  29403. Example
  29404. -------
  29405. (gdb)
  29406. -inferior-tty-set /dev/pts/1
  29407. ^done
  29408. (gdb)
  29409. The '-inferior-tty-show' Command
  29410. --------------------------------
  29411. Synopsis
  29412. --------
  29413. -inferior-tty-show
  29414. Show terminal for future runs of program being debugged.
  29415. GDB Command
  29416. -----------
  29417. The corresponding GDB command is 'show inferior-tty'.
  29418. Example
  29419. -------
  29420. (gdb)
  29421. -inferior-tty-set /dev/pts/1
  29422. ^done
  29423. (gdb)
  29424. -inferior-tty-show
  29425. ^done,inferior_tty_terminal="/dev/pts/1"
  29426. (gdb)
  29427. The '-enable-timings' Command
  29428. -----------------------------
  29429. Synopsis
  29430. --------
  29431. -enable-timings [yes | no]
  29432. Toggle the printing of the wallclock, user and system times for an MI
  29433. command as a field in its output. This command is to help frontend
  29434. developers optimize the performance of their code. No argument is
  29435. equivalent to 'yes'.
  29436. GDB Command
  29437. -----------
  29438. No equivalent.
  29439. Example
  29440. -------
  29441. (gdb)
  29442. -enable-timings
  29443. ^done
  29444. (gdb)
  29445. -break-insert main
  29446. ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
  29447. addr="0x080484ed",func="main",file="myprog.c",
  29448. fullname="/home/nickrob/myprog.c",line="73",thread-groups=["i1"],
  29449. times="0"},
  29450. time={wallclock="0.05185",user="0.00800",system="0.00000"}
  29451. (gdb)
  29452. -enable-timings no
  29453. ^done
  29454. (gdb)
  29455. -exec-run
  29456. ^running
  29457. (gdb)
  29458. *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
  29459. frame={addr="0x080484ed",func="main",args=[{name="argc",value="1"},
  29460. {name="argv",value="0xbfb60364"}],file="myprog.c",
  29461. fullname="/home/nickrob/myprog.c",line="73",arch="i386:x86_64"}
  29462. (gdb)
  29463. 
  29464. File: gdb.info, Node: Annotations, Next: JIT Interface, Prev: GDB/MI, Up: Top
  29465. 28 GDB Annotations
  29466. ******************
  29467. This chapter describes annotations in GDB. Annotations were designed to
  29468. interface GDB to graphical user interfaces or other similar programs
  29469. which want to interact with GDB at a relatively high level.
  29470. The annotation mechanism has largely been superseded by GDB/MI (*note
  29471. GDB/MI::).
  29472. * Menu:
  29473. * Annotations Overview:: What annotations are; the general syntax.
  29474. * Server Prefix:: Issuing a command without affecting user state.
  29475. * Prompting:: Annotations marking GDB's need for input.
  29476. * Errors:: Annotations for error messages.
  29477. * Invalidation:: Some annotations describe things now invalid.
  29478. * Annotations for Running::
  29479. Whether the program is running, how it stopped, etc.
  29480. * Source Annotations:: Annotations describing source code.
  29481. 
  29482. File: gdb.info, Node: Annotations Overview, Next: Server Prefix, Up: Annotations
  29483. 28.1 What is an Annotation?
  29484. ===========================
  29485. Annotations start with a newline character, two 'control-z' characters,
  29486. and the name of the annotation. If there is no additional information
  29487. associated with this annotation, the name of the annotation is followed
  29488. immediately by a newline. If there is additional information, the name
  29489. of the annotation is followed by a space, the additional information,
  29490. and a newline. The additional information cannot contain newline
  29491. characters.
  29492. Any output not beginning with a newline and two 'control-z'
  29493. characters denotes literal output from GDB. Currently there is no need
  29494. for GDB to output a newline followed by two 'control-z' characters, but
  29495. if there was such a need, the annotations could be extended with an
  29496. 'escape' annotation which means those three characters as output.
  29497. The annotation LEVEL, which is specified using the '--annotate'
  29498. command line option (*note Mode Options::), controls how much
  29499. information GDB prints together with its prompt, values of expressions,
  29500. source lines, and other types of output. Level 0 is for no annotations,
  29501. level 1 is for use when GDB is run as a subprocess of GNU Emacs, level 3
  29502. is the maximum annotation suitable for programs that control GDB, and
  29503. level 2 annotations have been made obsolete (*note Limitations of the
  29504. Annotation Interface: (annotate)Limitations.).
  29505. 'set annotate LEVEL'
  29506. The GDB command 'set annotate' sets the level of annotations to the
  29507. specified LEVEL.
  29508. 'show annotate'
  29509. Show the current annotation level.
  29510. This chapter describes level 3 annotations.
  29511. A simple example of starting up GDB with annotations is:
  29512. $ gdb --annotate=3
  29513. GNU gdb 6.0
  29514. Copyright 2003 Free Software Foundation, Inc.
  29515. GDB is free software, covered by the GNU General Public License,
  29516. and you are welcome to change it and/or distribute copies of it
  29517. under certain conditions.
  29518. Type "show copying" to see the conditions.
  29519. There is absolutely no warranty for GDB. Type "show warranty"
  29520. for details.
  29521. This GDB was configured as "i386-pc-linux-gnu"
  29522. ^Z^Zpre-prompt
  29523. (gdb)
  29524. ^Z^Zprompt
  29525. quit
  29526. ^Z^Zpost-prompt
  29527. $
  29528. Here 'quit' is input to GDB; the rest is output from GDB. The three
  29529. lines beginning '^Z^Z' (where '^Z' denotes a 'control-z' character) are
  29530. annotations; the rest is output from GDB.
  29531. 
  29532. File: gdb.info, Node: Server Prefix, Next: Prompting, Prev: Annotations Overview, Up: Annotations
  29533. 28.2 The Server Prefix
  29534. ======================
  29535. If you prefix a command with 'server ' then it will not affect the
  29536. command history, nor will it affect GDB's notion of which command to
  29537. repeat if <RET> is pressed on a line by itself. This means that
  29538. commands can be run behind a user's back by a front-end in a transparent
  29539. manner.
  29540. The 'server ' prefix does not affect the recording of values into the
  29541. value history; to print a value without recording it into the value
  29542. history, use the 'output' command instead of the 'print' command.
  29543. Using this prefix also disables confirmation requests (*note
  29544. confirmation requests::).
  29545. 
  29546. File: gdb.info, Node: Prompting, Next: Errors, Prev: Server Prefix, Up: Annotations
  29547. 28.3 Annotation for GDB Input
  29548. =============================
  29549. When GDB prompts for input, it annotates this fact so it is possible to
  29550. know when to send output, when the output from a given command is over,
  29551. etc.
  29552. Different kinds of input each have a different "input type". Each
  29553. input type has three annotations: a 'pre-' annotation, which denotes the
  29554. beginning of any prompt which is being output, a plain annotation, which
  29555. denotes the end of the prompt, and then a 'post-' annotation which
  29556. denotes the end of any echo which may (or may not) be associated with
  29557. the input. For example, the 'prompt' input type features the following
  29558. annotations:
  29559. ^Z^Zpre-prompt
  29560. ^Z^Zprompt
  29561. ^Z^Zpost-prompt
  29562. The input types are
  29563. 'prompt'
  29564. When GDB is prompting for a command (the main GDB prompt).
  29565. 'commands'
  29566. When GDB prompts for a set of commands, like in the 'commands'
  29567. command. The annotations are repeated for each command which is
  29568. input.
  29569. 'overload-choice'
  29570. When GDB wants the user to select between various overloaded
  29571. functions.
  29572. 'query'
  29573. When GDB wants the user to confirm a potentially dangerous
  29574. operation.
  29575. 'prompt-for-continue'
  29576. When GDB is asking the user to press return to continue. Note:
  29577. Don't expect this to work well; instead use 'set height 0' to
  29578. disable prompting. This is because the counting of lines is buggy
  29579. in the presence of annotations.
  29580. 
  29581. File: gdb.info, Node: Errors, Next: Invalidation, Prev: Prompting, Up: Annotations
  29582. 28.4 Errors
  29583. ===========
  29584. ^Z^Zquit
  29585. This annotation occurs right before GDB responds to an interrupt.
  29586. ^Z^Zerror
  29587. This annotation occurs right before GDB responds to an error.
  29588. Quit and error annotations indicate that any annotations which GDB
  29589. was in the middle of may end abruptly. For example, if a
  29590. 'value-history-begin' annotation is followed by a 'error', one cannot
  29591. expect to receive the matching 'value-history-end'. One cannot expect
  29592. not to receive it either, however; an error annotation does not
  29593. necessarily mean that GDB is immediately returning all the way to the
  29594. top level.
  29595. A quit or error annotation may be preceded by
  29596. ^Z^Zerror-begin
  29597. Any output between that and the quit or error annotation is the error
  29598. message.
  29599. Warning messages are not yet annotated.
  29600. 
  29601. File: gdb.info, Node: Invalidation, Next: Annotations for Running, Prev: Errors, Up: Annotations
  29602. 28.5 Invalidation Notices
  29603. =========================
  29604. The following annotations say that certain pieces of state may have
  29605. changed.
  29606. '^Z^Zframes-invalid'
  29607. The frames (for example, output from the 'backtrace' command) may
  29608. have changed.
  29609. '^Z^Zbreakpoints-invalid'
  29610. The breakpoints may have changed. For example, the user just added
  29611. or deleted a breakpoint.
  29612. 
  29613. File: gdb.info, Node: Annotations for Running, Next: Source Annotations, Prev: Invalidation, Up: Annotations
  29614. 28.6 Running the Program
  29615. ========================
  29616. When the program starts executing due to a GDB command such as 'step' or
  29617. 'continue',
  29618. ^Z^Zstarting
  29619. is output. When the program stops,
  29620. ^Z^Zstopped
  29621. is output. Before the 'stopped' annotation, a variety of annotations
  29622. describe how the program stopped.
  29623. '^Z^Zexited EXIT-STATUS'
  29624. The program exited, and EXIT-STATUS is the exit status (zero for
  29625. successful exit, otherwise nonzero).
  29626. '^Z^Zsignalled'
  29627. The program exited with a signal. After the '^Z^Zsignalled', the
  29628. annotation continues:
  29629. INTRO-TEXT
  29630. ^Z^Zsignal-name
  29631. NAME
  29632. ^Z^Zsignal-name-end
  29633. MIDDLE-TEXT
  29634. ^Z^Zsignal-string
  29635. STRING
  29636. ^Z^Zsignal-string-end
  29637. END-TEXT
  29638. where NAME is the name of the signal, such as 'SIGILL' or
  29639. 'SIGSEGV', and STRING is the explanation of the signal, such as
  29640. 'Illegal Instruction' or 'Segmentation fault'. The arguments
  29641. INTRO-TEXT, MIDDLE-TEXT, and END-TEXT are for the user's benefit
  29642. and have no particular format.
  29643. '^Z^Zsignal'
  29644. The syntax of this annotation is just like 'signalled', but GDB is
  29645. just saying that the program received the signal, not that it was
  29646. terminated with it.
  29647. '^Z^Zbreakpoint NUMBER'
  29648. The program hit breakpoint number NUMBER.
  29649. '^Z^Zwatchpoint NUMBER'
  29650. The program hit watchpoint number NUMBER.
  29651. 
  29652. File: gdb.info, Node: Source Annotations, Prev: Annotations for Running, Up: Annotations
  29653. 28.7 Displaying Source
  29654. ======================
  29655. The following annotation is used instead of displaying source code:
  29656. ^Z^Zsource FILENAME:LINE:CHARACTER:MIDDLE:ADDR
  29657. where FILENAME is an absolute file name indicating which source file,
  29658. LINE is the line number within that file (where 1 is the first line in
  29659. the file), CHARACTER is the character position within the file (where 0
  29660. is the first character in the file) (for most debug formats this will
  29661. necessarily point to the beginning of a line), MIDDLE is 'middle' if
  29662. ADDR is in the middle of the line, or 'beg' if ADDR is at the beginning
  29663. of the line, and ADDR is the address in the target program associated
  29664. with the source which is being displayed. The ADDR is in the form '0x'
  29665. followed by one or more lowercase hex digits (note that this does not
  29666. depend on the language).
  29667. 
  29668. File: gdb.info, Node: JIT Interface, Next: In-Process Agent, Prev: Annotations, Up: Top
  29669. 29 JIT Compilation Interface
  29670. ****************************
  29671. This chapter documents GDB's "just-in-time" (JIT) compilation interface.
  29672. A JIT compiler is a program or library that generates native executable
  29673. code at runtime and executes it, usually in order to achieve good
  29674. performance while maintaining platform independence.
  29675. Programs that use JIT compilation are normally difficult to debug
  29676. because portions of their code are generated at runtime, instead of
  29677. being loaded from object files, which is where GDB normally finds the
  29678. program's symbols and debug information. In order to debug programs
  29679. that use JIT compilation, GDB has an interface that allows the program
  29680. to register in-memory symbol files with GDB at runtime.
  29681. If you are using GDB to debug a program that uses this interface,
  29682. then it should work transparently so long as you have not stripped the
  29683. binary. If you are developing a JIT compiler, then the interface is
  29684. documented in the rest of this chapter. At this time, the only known
  29685. client of this interface is the LLVM JIT.
  29686. Broadly speaking, the JIT interface mirrors the dynamic loader
  29687. interface. The JIT compiler communicates with GDB by writing data into
  29688. a global variable and calling a fuction at a well-known symbol. When
  29689. GDB attaches, it reads a linked list of symbol files from the global
  29690. variable to find existing code, and puts a breakpoint in the function so
  29691. that it can find out about additional code.
  29692. * Menu:
  29693. * Declarations:: Relevant C struct declarations
  29694. * Registering Code:: Steps to register code
  29695. * Unregistering Code:: Steps to unregister code
  29696. * Custom Debug Info:: Emit debug information in a custom format
  29697. 
  29698. File: gdb.info, Node: Declarations, Next: Registering Code, Up: JIT Interface
  29699. 29.1 JIT Declarations
  29700. =====================
  29701. These are the relevant struct declarations that a C program should
  29702. include to implement the interface:
  29703. typedef enum
  29704. {
  29705. JIT_NOACTION = 0,
  29706. JIT_REGISTER_FN,
  29707. JIT_UNREGISTER_FN
  29708. } jit_actions_t;
  29709. struct jit_code_entry
  29710. {
  29711. struct jit_code_entry *next_entry;
  29712. struct jit_code_entry *prev_entry;
  29713. const char *symfile_addr;
  29714. uint64_t symfile_size;
  29715. };
  29716. struct jit_descriptor
  29717. {
  29718. uint32_t version;
  29719. /* This type should be jit_actions_t, but we use uint32_t
  29720. to be explicit about the bitwidth. */
  29721. uint32_t action_flag;
  29722. struct jit_code_entry *relevant_entry;
  29723. struct jit_code_entry *first_entry;
  29724. };
  29725. /* GDB puts a breakpoint in this function. */
  29726. void __attribute__((noinline)) __jit_debug_register_code() { };
  29727. /* Make sure to specify the version statically, because the
  29728. debugger may check the version before we can set it. */
  29729. struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
  29730. If the JIT is multi-threaded, then it is important that the JIT
  29731. synchronize any modifications to this global data properly, which can
  29732. easily be done by putting a global mutex around modifications to these
  29733. structures.
  29734. 
  29735. File: gdb.info, Node: Registering Code, Next: Unregistering Code, Prev: Declarations, Up: JIT Interface
  29736. 29.2 Registering Code
  29737. =====================
  29738. To register code with GDB, the JIT should follow this protocol:
  29739. * Generate an object file in memory with symbols and other desired
  29740. debug information. The file must include the virtual addresses of
  29741. the sections.
  29742. * Create a code entry for the file, which gives the start and size of
  29743. the symbol file.
  29744. * Add it to the linked list in the JIT descriptor.
  29745. * Point the relevant_entry field of the descriptor at the entry.
  29746. * Set 'action_flag' to 'JIT_REGISTER' and call
  29747. '__jit_debug_register_code'.
  29748. When GDB is attached and the breakpoint fires, GDB uses the
  29749. 'relevant_entry' pointer so it doesn't have to walk the list looking for
  29750. new code. However, the linked list must still be maintained in order to
  29751. allow GDB to attach to a running process and still find the symbol
  29752. files.
  29753. 
  29754. File: gdb.info, Node: Unregistering Code, Next: Custom Debug Info, Prev: Registering Code, Up: JIT Interface
  29755. 29.3 Unregistering Code
  29756. =======================
  29757. If code is freed, then the JIT should use the following protocol:
  29758. * Remove the code entry corresponding to the code from the linked
  29759. list.
  29760. * Point the 'relevant_entry' field of the descriptor at the code
  29761. entry.
  29762. * Set 'action_flag' to 'JIT_UNREGISTER' and call
  29763. '__jit_debug_register_code'.
  29764. If the JIT frees or recompiles code without unregistering it, then
  29765. GDB and the JIT will leak the memory used for the associated symbol
  29766. files.
  29767. 
  29768. File: gdb.info, Node: Custom Debug Info, Prev: Unregistering Code, Up: JIT Interface
  29769. 29.4 Custom Debug Info
  29770. ======================
  29771. Generating debug information in platform-native file formats (like ELF
  29772. or COFF) may be an overkill for JIT compilers; especially if all the
  29773. debug info is used for is displaying a meaningful backtrace. The issue
  29774. can be resolved by having the JIT writers decide on a debug info format
  29775. and also provide a reader that parses the debug info generated by the
  29776. JIT compiler. This section gives a brief overview on writing such a
  29777. parser. More specific details can be found in the source file
  29778. 'gdb/jit-reader.in', which is also installed as a header at
  29779. 'INCLUDEDIR/gdb/jit-reader.h' for easy inclusion.
  29780. The reader is implemented as a shared object (so this functionality
  29781. is not available on platforms which don't allow loading shared objects
  29782. at runtime). Two GDB commands, 'jit-reader-load' and
  29783. 'jit-reader-unload' are provided, to be used to load and unload the
  29784. readers from a preconfigured directory. Once loaded, the shared object
  29785. is used the parse the debug information emitted by the JIT compiler.
  29786. * Menu:
  29787. * Using JIT Debug Info Readers:: How to use supplied readers correctly
  29788. * Writing JIT Debug Info Readers:: Creating a debug-info reader
  29789. 
  29790. File: gdb.info, Node: Using JIT Debug Info Readers, Next: Writing JIT Debug Info Readers, Up: Custom Debug Info
  29791. 29.4.1 Using JIT Debug Info Readers
  29792. -----------------------------------
  29793. Readers can be loaded and unloaded using the 'jit-reader-load' and
  29794. 'jit-reader-unload' commands.
  29795. 'jit-reader-load READER'
  29796. Load the JIT reader named READER, which is a shared object
  29797. specified as either an absolute or a relative file name. In the
  29798. latter case, GDB will try to load the reader from a pre-configured
  29799. directory, usually 'LIBDIR/gdb/' on a UNIX system (here LIBDIR is
  29800. the system library directory, often '/usr/local/lib').
  29801. Only one reader can be active at a time; trying to load a second
  29802. reader when one is already loaded will result in GDB reporting an
  29803. error. A new JIT reader can be loaded by first unloading the
  29804. current one using 'jit-reader-unload' and then invoking
  29805. 'jit-reader-load'.
  29806. 'jit-reader-unload'
  29807. Unload the currently loaded JIT reader.
  29808. 
  29809. File: gdb.info, Node: Writing JIT Debug Info Readers, Prev: Using JIT Debug Info Readers, Up: Custom Debug Info
  29810. 29.4.2 Writing JIT Debug Info Readers
  29811. -------------------------------------
  29812. As mentioned, a reader is essentially a shared object conforming to a
  29813. certain ABI. This ABI is described in 'jit-reader.h'.
  29814. 'jit-reader.h' defines the structures, macros and functions required
  29815. to write a reader. It is installed (along with GDB), in
  29816. 'INCLUDEDIR/gdb' where INCLUDEDIR is the system include directory.
  29817. Readers need to be released under a GPL compatible license. A reader
  29818. can be declared as released under such a license by placing the macro
  29819. 'GDB_DECLARE_GPL_COMPATIBLE_READER' in a source file.
  29820. The entry point for readers is the symbol 'gdb_init_reader', which is
  29821. expected to be a function with the prototype
  29822. extern struct gdb_reader_funcs *gdb_init_reader (void);
  29823. 'struct gdb_reader_funcs' contains a set of pointers to callback
  29824. functions. These functions are executed to read the debug info
  29825. generated by the JIT compiler ('read'), to unwind stack frames
  29826. ('unwind') and to create canonical frame IDs ('get_Frame_id'). It also
  29827. has a callback that is called when the reader is being unloaded
  29828. ('destroy'). The struct looks like this
  29829. struct gdb_reader_funcs
  29830. {
  29831. /* Must be set to GDB_READER_INTERFACE_VERSION. */
  29832. int reader_version;
  29833. /* For use by the reader. */
  29834. void *priv_data;
  29835. gdb_read_debug_info *read;
  29836. gdb_unwind_frame *unwind;
  29837. gdb_get_frame_id *get_frame_id;
  29838. gdb_destroy_reader *destroy;
  29839. };
  29840. The callbacks are provided with another set of callbacks by GDB to do
  29841. their job. For 'read', these callbacks are passed in a 'struct
  29842. gdb_symbol_callbacks' and for 'unwind' and 'get_frame_id', in a 'struct
  29843. gdb_unwind_callbacks'. 'struct gdb_symbol_callbacks' has callbacks to
  29844. create new object files and new symbol tables inside those object files.
  29845. 'struct gdb_unwind_callbacks' has callbacks to read registers off the
  29846. current frame and to write out the values of the registers in the
  29847. previous frame. Both have a callback ('target_read') to read bytes off
  29848. the target's address space.
  29849. 
  29850. File: gdb.info, Node: In-Process Agent, Next: GDB Bugs, Prev: JIT Interface, Up: Top
  29851. 30 In-Process Agent
  29852. *******************
  29853. The traditional debugging model is conceptually low-speed, but works
  29854. fine, because most bugs can be reproduced in debugging-mode execution.
  29855. However, as multi-core or many-core processors are becoming mainstream,
  29856. and multi-threaded programs become more and more popular, there should
  29857. be more and more bugs that only manifest themselves at normal-mode
  29858. execution, for example, thread races, because debugger's interference
  29859. with the program's timing may conceal the bugs. On the other hand, in
  29860. some applications, it is not feasible for the debugger to interrupt the
  29861. program's execution long enough for the developer to learn anything
  29862. helpful about its behavior. If the program's correctness depends on its
  29863. real-time behavior, delays introduced by a debugger might cause the
  29864. program to fail, even when the code itself is correct. It is useful to
  29865. be able to observe the program's behavior without interrupting it.
  29866. Therefore, traditional debugging model is too intrusive to reproduce
  29867. some bugs. In order to reduce the interference with the program, we can
  29868. reduce the number of operations performed by debugger. The "In-Process
  29869. Agent", a shared library, is running within the same process with
  29870. inferior, and is able to perform some debugging operations itself. As a
  29871. result, debugger is only involved when necessary, and performance of
  29872. debugging can be improved accordingly. Note that interference with
  29873. program can be reduced but can't be removed completely, because the
  29874. in-process agent will still stop or slow down the program.
  29875. The in-process agent can interpret and execute Agent Expressions
  29876. (*note Agent Expressions::) during performing debugging operations. The
  29877. agent expressions can be used for different purposes, such as collecting
  29878. data in tracepoints, and condition evaluation in breakpoints.
  29879. You can control whether the in-process agent is used as an aid for
  29880. debugging with the following commands:
  29881. 'set agent on'
  29882. Causes the in-process agent to perform some operations on behalf of
  29883. the debugger. Just which operations requested by the user will be
  29884. done by the in-process agent depends on the its capabilities. For
  29885. example, if you request to evaluate breakpoint conditions in the
  29886. in-process agent, and the in-process agent has such capability as
  29887. well, then breakpoint conditions will be evaluated in the
  29888. in-process agent.
  29889. 'set agent off'
  29890. Disables execution of debugging operations by the in-process agent.
  29891. All of the operations will be performed by GDB.
  29892. 'show agent'
  29893. Display the current setting of execution of debugging operations by
  29894. the in-process agent.
  29895. * Menu:
  29896. * In-Process Agent Protocol::
  29897. 
  29898. File: gdb.info, Node: In-Process Agent Protocol, Up: In-Process Agent
  29899. 30.1 In-Process Agent Protocol
  29900. ==============================
  29901. The in-process agent is able to communicate with both GDB and GDBserver
  29902. (*note In-Process Agent::). This section documents the protocol used
  29903. for communications between GDB or GDBserver and the IPA. In general, GDB
  29904. or GDBserver sends commands (*note IPA Protocol Commands::) and data to
  29905. in-process agent, and then in-process agent replies back with the return
  29906. result of the command, or some other information. The data sent to
  29907. in-process agent is composed of primitive data types, such as 4-byte or
  29908. 8-byte type, and composite types, which are called objects (*note IPA
  29909. Protocol Objects::).
  29910. * Menu:
  29911. * IPA Protocol Objects::
  29912. * IPA Protocol Commands::
  29913. 
  29914. File: gdb.info, Node: IPA Protocol Objects, Next: IPA Protocol Commands, Up: In-Process Agent Protocol
  29915. 30.1.1 IPA Protocol Objects
  29916. ---------------------------
  29917. The commands sent to and results received from agent may contain some
  29918. complex data types called "objects".
  29919. The in-process agent is running on the same machine with GDB or
  29920. GDBserver, so it doesn't have to handle as much differences between two
  29921. ends as remote protocol (*note Remote Protocol::) tries to handle.
  29922. However, there are still some differences of two ends in two processes:
  29923. 1. word size. On some 64-bit machines, GDB or GDBserver can be
  29924. compiled as a 64-bit executable, while in-process agent is a 32-bit
  29925. one.
  29926. 2. ABI. Some machines may have multiple types of ABI, GDB or GDBserver
  29927. is compiled with one, and in-process agent is compiled with the
  29928. other one.
  29929. Here are the IPA Protocol Objects:
  29930. 1. agent expression object. It represents an agent expression (*note
  29931. Agent Expressions::).
  29932. 2. tracepoint action object. It represents a tracepoint action (*note
  29933. Tracepoint Action Lists: Tracepoint Actions.) to collect registers,
  29934. memory, static trace data and to evaluate expression.
  29935. 3. tracepoint object. It represents a tracepoint (*note
  29936. Tracepoints::).
  29937. The following table describes important attributes of each IPA
  29938. protocol object:
  29939. Name Size Description
  29940. ---------------------------------------------------------------------------
  29941. _agent expression
  29942. object_
  29943. length 4 length of bytes code
  29944. byte code LENGTH contents of byte code
  29945. _tracepoint action
  29946. for collecting
  29947. memory_
  29948. 'M' 1 type of tracepoint action
  29949. addr 8 if BASEREG is '-1', ADDR is the
  29950. address of the lowest byte to
  29951. collect, otherwise ADDR is the
  29952. offset of BASEREG for memory
  29953. collecting.
  29954. len 8 length of memory for collecting
  29955. basereg 4 the register number containing the
  29956. starting memory address for
  29957. collecting.
  29958. _tracepoint action
  29959. for collecting
  29960. registers_
  29961. 'R' 1 type of tracepoint action
  29962. _tracepoint action
  29963. for collecting
  29964. static trace data_
  29965. 'L' 1 type of tracepoint action
  29966. _tracepoint action
  29967. for expression
  29968. evaluation_
  29969. 'X' 1 type of tracepoint action
  29970. agent expression length of *note agent expression object::
  29971. _tracepoint object_
  29972. number 4 number of tracepoint
  29973. address 8 address of tracepoint inserted on
  29974. type 4 type of tracepoint
  29975. enabled 1 enable or disable of tracepoint
  29976. step_count 8 step
  29977. pass_count 8 pass
  29978. numactions 4 number of tracepoint actions
  29979. hit count 8 hit count
  29980. trace frame usage 8 trace frame usage
  29981. compiled_cond 8 compiled condition
  29982. orig_size 8 orig size
  29983. condition 4 if zero if condition is NULL,
  29984. condition is otherwise is *note agent
  29985. NULL expression object::
  29986. otherwise
  29987. length of
  29988. *note agent
  29989. expression
  29990. object::
  29991. actions variable numactions number of *note
  29992. tracepoint action object::
  29993. 
  29994. File: gdb.info, Node: IPA Protocol Commands, Prev: IPA Protocol Objects, Up: In-Process Agent Protocol
  29995. 30.1.2 IPA Protocol Commands
  29996. ----------------------------
  29997. The spaces in each command are delimiters to ease reading this commands
  29998. specification. They don't exist in real commands.
  29999. 'FastTrace:TRACEPOINT_OBJECT GDB_JUMP_PAD_HEAD'
  30000. Installs a new fast tracepoint described by TRACEPOINT_OBJECT
  30001. (*note tracepoint object::). The GDB_JUMP_PAD_HEAD, 8-byte long,
  30002. is the head of "jumppad", which is used to jump to data collection
  30003. routine in IPA finally.
  30004. Replies:
  30005. 'OK TARGET_ADDRESS GDB_JUMP_PAD_HEAD FJUMP_SIZE FJUMP'
  30006. TARGET_ADDRESS is address of tracepoint in the inferior. The
  30007. GDB_JUMP_PAD_HEAD is updated head of jumppad. Both of
  30008. TARGET_ADDRESS and GDB_JUMP_PAD_HEAD are 8-byte long. The
  30009. FJUMP contains a sequence of instructions jump to jumppad
  30010. entry. The FJUMP_SIZE, 4-byte long, is the size of FJUMP.
  30011. 'E NN'
  30012. for an error
  30013. 'close'
  30014. Closes the in-process agent. This command is sent when GDB or
  30015. GDBserver is about to kill inferiors.
  30016. 'qTfSTM'
  30017. *Note qTfSTM::.
  30018. 'qTsSTM'
  30019. *Note qTsSTM::.
  30020. 'qTSTMat'
  30021. *Note qTSTMat::.
  30022. 'probe_marker_at:ADDRESS'
  30023. Asks in-process agent to probe the marker at ADDRESS.
  30024. Replies:
  30025. 'E NN'
  30026. for an error
  30027. 'unprobe_marker_at:ADDRESS'
  30028. Asks in-process agent to unprobe the marker at ADDRESS.
  30029. 
  30030. File: gdb.info, Node: GDB Bugs, Next: Command Line Editing, Prev: In-Process Agent, Up: Top
  30031. 31 Reporting Bugs in GDB
  30032. ************************
  30033. Your bug reports play an essential role in making GDB reliable.
  30034. Reporting a bug may help you by bringing a solution to your problem,
  30035. or it may not. But in any case the principal function of a bug report
  30036. is to help the entire community by making the next version of GDB work
  30037. better. Bug reports are your contribution to the maintenance of GDB.
  30038. In order for a bug report to serve its purpose, you must include the
  30039. information that enables us to fix the bug.
  30040. * Menu:
  30041. * Bug Criteria:: Have you found a bug?
  30042. * Bug Reporting:: How to report bugs
  30043. 
  30044. File: gdb.info, Node: Bug Criteria, Next: Bug Reporting, Up: GDB Bugs
  30045. 31.1 Have You Found a Bug?
  30046. ==========================
  30047. If you are not sure whether you have found a bug, here are some
  30048. guidelines:
  30049. * If the debugger gets a fatal signal, for any input whatever, that
  30050. is a GDB bug. Reliable debuggers never crash.
  30051. * If GDB produces an error message for valid input, that is a bug.
  30052. (Note that if you're cross debugging, the problem may also be
  30053. somewhere in the connection to the target.)
  30054. * If GDB does not produce an error message for invalid input, that is
  30055. a bug. However, you should note that your idea of "invalid input"
  30056. might be our idea of "an extension" or "support for traditional
  30057. practice".
  30058. * If you are an experienced user of debugging tools, your suggestions
  30059. for improvement of GDB are welcome in any case.
  30060. 
  30061. File: gdb.info, Node: Bug Reporting, Prev: Bug Criteria, Up: GDB Bugs
  30062. 31.2 How to Report Bugs
  30063. =======================
  30064. A number of companies and individuals offer support for GNU products.
  30065. If you obtained GDB from a support organization, we recommend you
  30066. contact that organization first.
  30067. You can find contact information for many support companies and
  30068. individuals in the file 'etc/SERVICE' in the GNU Emacs distribution.
  30069. In any event, we also recommend that you submit bug reports for GDB.
  30070. The preferred method is to submit them directly using GDB's Bugs web
  30071. page (http://www.gnu.org/software/gdb/bugs/). Alternatively, the e-mail
  30072. gateway <bug-gdb@gnu.org> can be used.
  30073. *Do not send bug reports to 'info-gdb', or to 'help-gdb', or to any
  30074. newsgroups.* Most users of GDB do not want to receive bug reports.
  30075. Those that do have arranged to receive 'bug-gdb'.
  30076. The mailing list 'bug-gdb' has a newsgroup 'gnu.gdb.bug' which serves
  30077. as a repeater. The mailing list and the newsgroup carry exactly the
  30078. same messages. Often people think of posting bug reports to the
  30079. newsgroup instead of mailing them. This appears to work, but it has one
  30080. problem which can be crucial: a newsgroup posting often lacks a mail
  30081. path back to the sender. Thus, if we need to ask for more information,
  30082. we may be unable to reach you. For this reason, it is better to send
  30083. bug reports to the mailing list.
  30084. The fundamental principle of reporting bugs usefully is this: *report
  30085. all the facts*. If you are not sure whether to state a fact or leave it
  30086. out, state it!
  30087. Often people omit facts because they think they know what causes the
  30088. problem and assume that some details do not matter. Thus, you might
  30089. assume that the name of the variable you use in an example does not
  30090. matter. Well, probably it does not, but one cannot be sure. Perhaps
  30091. the bug is a stray memory reference which happens to fetch from the
  30092. location where that name is stored in memory; perhaps, if the name were
  30093. different, the contents of that location would fool the debugger into
  30094. doing the right thing despite the bug. Play it safe and give a
  30095. specific, complete example. That is the easiest thing for you to do,
  30096. and the most helpful.
  30097. Keep in mind that the purpose of a bug report is to enable us to fix
  30098. the bug. It may be that the bug has been reported previously, but
  30099. neither you nor we can know that unless your bug report is complete and
  30100. self-contained.
  30101. Sometimes people give a few sketchy facts and ask, "Does this ring a
  30102. bell?" Those bug reports are useless, and we urge everyone to _refuse
  30103. to respond to them_ except to chide the sender to report bugs properly.
  30104. To enable us to fix the bug, you should include all these things:
  30105. * The version of GDB. GDB announces it if you start with no
  30106. arguments; you can also print it at any time using 'show version'.
  30107. Without this, we will not know whether there is any point in
  30108. looking for the bug in the current version of GDB.
  30109. * The type of machine you are using, and the operating system name
  30110. and version number.
  30111. * The details of the GDB build-time configuration. GDB shows these
  30112. details if you invoke it with the '--configuration' command-line
  30113. option, or if you type 'show configuration' at GDB's prompt.
  30114. * What compiler (and its version) was used to compile GDB--e.g.
  30115. "gcc-2.8.1".
  30116. * What compiler (and its version) was used to compile the program you
  30117. are debugging--e.g. "gcc-2.8.1", or "HP92453-01 A.10.32.03 HP C
  30118. Compiler". For GCC, you can say 'gcc --version' to get this
  30119. information; for other compilers, see the documentation for those
  30120. compilers.
  30121. * The command arguments you gave the compiler to compile your example
  30122. and observe the bug. For example, did you use '-O'? To guarantee
  30123. you will not omit something important, list them all. A copy of
  30124. the Makefile (or the output from make) is sufficient.
  30125. If we were to try to guess the arguments, we would probably guess
  30126. wrong and then we might not encounter the bug.
  30127. * A complete input script, and all necessary source files, that will
  30128. reproduce the bug.
  30129. * A description of what behavior you observe that you believe is
  30130. incorrect. For example, "It gets a fatal signal."
  30131. Of course, if the bug is that GDB gets a fatal signal, then we will
  30132. certainly notice it. But if the bug is incorrect output, we might
  30133. not notice unless it is glaringly wrong. You might as well not
  30134. give us a chance to make a mistake.
  30135. Even if the problem you experience is a fatal signal, you should
  30136. still say so explicitly. Suppose something strange is going on,
  30137. such as, your copy of GDB is out of synch, or you have encountered
  30138. a bug in the C library on your system. (This has happened!) Your
  30139. copy might crash and ours would not. If you told us to expect a
  30140. crash, then when ours fails to crash, we would know that the bug
  30141. was not happening for us. If you had not told us to expect a
  30142. crash, then we would not be able to draw any conclusion from our
  30143. observations.
  30144. To collect all this information, you can use a session recording
  30145. program such as 'script', which is available on many Unix systems.
  30146. Just run your GDB session inside 'script' and then include the
  30147. 'typescript' file with your bug report.
  30148. Another way to record a GDB session is to run GDB inside Emacs and
  30149. then save the entire buffer to a file.
  30150. * If you wish to suggest changes to the GDB source, send us context
  30151. diffs. If you even discuss something in the GDB source, refer to
  30152. it by context, not by line number.
  30153. The line numbers in our development sources will not match those in
  30154. your sources. Your line numbers would convey no useful information
  30155. to us.
  30156. Here are some things that are not necessary:
  30157. * A description of the envelope of the bug.
  30158. Often people who encounter a bug spend a lot of time investigating
  30159. which changes to the input file will make the bug go away and which
  30160. changes will not affect it.
  30161. This is often time consuming and not very useful, because the way
  30162. we will find the bug is by running a single example under the
  30163. debugger with breakpoints, not by pure deduction from a series of
  30164. examples. We recommend that you save your time for something else.
  30165. Of course, if you can find a simpler example to report _instead_ of
  30166. the original one, that is a convenience for us. Errors in the
  30167. output will be easier to spot, running under the debugger will take
  30168. less time, and so on.
  30169. However, simplification is not vital; if you do not want to do
  30170. this, report the bug anyway and send us the entire test case you
  30171. used.
  30172. * A patch for the bug.
  30173. A patch for the bug does help us if it is a good one. But do not
  30174. omit the necessary information, such as the test case, on the
  30175. assumption that a patch is all we need. We might see problems with
  30176. your patch and decide to fix the problem another way, or we might
  30177. not understand it at all.
  30178. Sometimes with a program as complicated as GDB it is very hard to
  30179. construct an example that will make the program follow a certain
  30180. path through the code. If you do not send us the example, we will
  30181. not be able to construct one, so we will not be able to verify that
  30182. the bug is fixed.
  30183. And if we cannot understand what bug you are trying to fix, or why
  30184. your patch should be an improvement, we will not install it. A
  30185. test case will help us to understand.
  30186. * A guess about what the bug is or what it depends on.
  30187. Such guesses are usually wrong. Even we cannot guess right about
  30188. such things without first using the debugger to find the facts.
  30189. 
  30190. File: gdb.info, Node: Command Line Editing, Next: Using History Interactively, Prev: GDB Bugs, Up: Top
  30191. 32 Command Line Editing
  30192. ***********************
  30193. This chapter describes the basic features of the GNU command line
  30194. editing interface.
  30195. * Menu:
  30196. * Introduction and Notation:: Notation used in this text.
  30197. * Readline Interaction:: The minimum set of commands for editing a line.
  30198. * Readline Init File:: Customizing Readline from a user's view.
  30199. * Bindable Readline Commands:: A description of most of the Readline commands
  30200. available for binding
  30201. * Readline vi Mode:: A short description of how to make Readline
  30202. behave like the vi editor.
  30203. 
  30204. File: gdb.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
  30205. 32.1 Introduction to Line Editing
  30206. =================================
  30207. The following paragraphs describe the notation used to represent
  30208. keystrokes.
  30209. The text 'C-k' is read as 'Control-K' and describes the character
  30210. produced when the <k> key is pressed while the Control key is depressed.
  30211. The text 'M-k' is read as 'Meta-K' and describes the character
  30212. produced when the Meta key (if you have one) is depressed, and the <k>
  30213. key is pressed. The Meta key is labeled <ALT> on many keyboards. On
  30214. keyboards with two keys labeled <ALT> (usually to either side of the
  30215. space bar), the <ALT> on the left side is generally set to work as a
  30216. Meta key. The <ALT> key on the right may also be configured to work as
  30217. a Meta key or may be configured as some other modifier, such as a
  30218. Compose key for typing accented characters.
  30219. If you do not have a Meta or <ALT> key, or another key working as a
  30220. Meta key, the identical keystroke can be generated by typing <ESC>
  30221. _first_, and then typing <k>. Either process is known as "metafying"
  30222. the <k> key.
  30223. The text 'M-C-k' is read as 'Meta-Control-k' and describes the
  30224. character produced by "metafying" 'C-k'.
  30225. In addition, several keys have their own names. Specifically, <DEL>,
  30226. <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves when seen
  30227. in this text, or in an init file (*note Readline Init File::). If your
  30228. keyboard lacks a <LFD> key, typing <C-j> will produce the desired
  30229. character. The <RET> key may be labeled <Return> or <Enter> on some
  30230. keyboards.
  30231. 
  30232. File: gdb.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
  30233. 32.2 Readline Interaction
  30234. =========================
  30235. Often during an interactive session you type in a long line of text,
  30236. only to notice that the first word on the line is misspelled. The
  30237. Readline library gives you a set of commands for manipulating the text
  30238. as you type it in, allowing you to just fix your typo, and not forcing
  30239. you to retype the majority of the line. Using these editing commands,
  30240. you move the cursor to the place that needs correction, and delete or
  30241. insert the text of the corrections. Then, when you are satisfied with
  30242. the line, you simply press <RET>. You do not have to be at the end of
  30243. the line to press <RET>; the entire line is accepted regardless of the
  30244. location of the cursor within the line.
  30245. * Menu:
  30246. * Readline Bare Essentials:: The least you need to know about Readline.
  30247. * Readline Movement Commands:: Moving about the input line.
  30248. * Readline Killing Commands:: How to delete text, and how to get it back!
  30249. * Readline Arguments:: Giving numeric arguments to commands.
  30250. * Searching:: Searching through previous lines.
  30251. 
  30252. File: gdb.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
  30253. 32.2.1 Readline Bare Essentials
  30254. -------------------------------
  30255. In order to enter characters into the line, simply type them. The typed
  30256. character appears where the cursor was, and then the cursor moves one
  30257. space to the right. If you mistype a character, you can use your erase
  30258. character to back up and delete the mistyped character.
  30259. Sometimes you may mistype a character, and not notice the error until
  30260. you have typed several other characters. In that case, you can type
  30261. 'C-b' to move the cursor to the left, and then correct your mistake.
  30262. Afterwards, you can move the cursor to the right with 'C-f'.
  30263. When you add text in the middle of a line, you will notice that
  30264. characters to the right of the cursor are 'pushed over' to make room for
  30265. the text that you have inserted. Likewise, when you delete text behind
  30266. the cursor, characters to the right of the cursor are 'pulled back' to
  30267. fill in the blank space created by the removal of the text. A list of
  30268. the bare essentials for editing the text of an input line follows.
  30269. 'C-b'
  30270. Move back one character.
  30271. 'C-f'
  30272. Move forward one character.
  30273. <DEL> or <Backspace>
  30274. Delete the character to the left of the cursor.
  30275. 'C-d'
  30276. Delete the character underneath the cursor.
  30277. Printing characters
  30278. Insert the character into the line at the cursor.
  30279. 'C-_' or 'C-x C-u'
  30280. Undo the last editing command. You can undo all the way back to an
  30281. empty line.
  30282. (Depending on your configuration, the <Backspace> key be set to delete
  30283. the character to the left of the cursor and the <DEL> key set to delete
  30284. the character underneath the cursor, like 'C-d', rather than the
  30285. character to the left of the cursor.)
  30286. 
  30287. File: gdb.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
  30288. 32.2.2 Readline Movement Commands
  30289. ---------------------------------
  30290. The above table describes the most basic keystrokes that you need in
  30291. order to do editing of the input line. For your convenience, many other
  30292. commands have been added in addition to 'C-b', 'C-f', 'C-d', and <DEL>.
  30293. Here are some commands for moving more rapidly about the line.
  30294. 'C-a'
  30295. Move to the start of the line.
  30296. 'C-e'
  30297. Move to the end of the line.
  30298. 'M-f'
  30299. Move forward a word, where a word is composed of letters and
  30300. digits.
  30301. 'M-b'
  30302. Move backward a word.
  30303. 'C-l'
  30304. Clear the screen, reprinting the current line at the top.
  30305. Notice how 'C-f' moves forward a character, while 'M-f' moves forward
  30306. a word. It is a loose convention that control keystrokes operate on
  30307. characters while meta keystrokes operate on words.
  30308. 
  30309. File: gdb.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
  30310. 32.2.3 Readline Killing Commands
  30311. --------------------------------
  30312. "Killing" text means to delete the text from the line, but to save it
  30313. away for later use, usually by "yanking" (re-inserting) it back into the
  30314. line. ('Cut' and 'paste' are more recent jargon for 'kill' and 'yank'.)
  30315. If the description for a command says that it 'kills' text, then you
  30316. can be sure that you can get the text back in a different (or the same)
  30317. place later.
  30318. When you use a kill command, the text is saved in a "kill-ring". Any
  30319. number of consecutive kills save all of the killed text together, so
  30320. that when you yank it back, you get it all. The kill ring is not line
  30321. specific; the text that you killed on a previously typed line is
  30322. available to be yanked back later, when you are typing another line.
  30323. Here is the list of commands for killing text.
  30324. 'C-k'
  30325. Kill the text from the current cursor position to the end of the
  30326. line.
  30327. 'M-d'
  30328. Kill from the cursor to the end of the current word, or, if between
  30329. words, to the end of the next word. Word boundaries are the same
  30330. as those used by 'M-f'.
  30331. 'M-<DEL>'
  30332. Kill from the cursor the start of the current word, or, if between
  30333. words, to the start of the previous word. Word boundaries are the
  30334. same as those used by 'M-b'.
  30335. 'C-w'
  30336. Kill from the cursor to the previous whitespace. This is different
  30337. than 'M-<DEL>' because the word boundaries differ.
  30338. Here is how to "yank" the text back into the line. Yanking means to
  30339. copy the most-recently-killed text from the kill buffer.
  30340. 'C-y'
  30341. Yank the most recently killed text back into the buffer at the
  30342. cursor.
  30343. 'M-y'
  30344. Rotate the kill-ring, and yank the new top. You can only do this
  30345. if the prior command is 'C-y' or 'M-y'.
  30346. 
  30347. File: gdb.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction
  30348. 32.2.4 Readline Arguments
  30349. -------------------------
  30350. You can pass numeric arguments to Readline commands. Sometimes the
  30351. argument acts as a repeat count, other times it is the sign of the
  30352. argument that is significant. If you pass a negative argument to a
  30353. command which normally acts in a forward direction, that command will
  30354. act in a backward direction. For example, to kill text back to the
  30355. start of the line, you might type 'M-- C-k'.
  30356. The general way to pass numeric arguments to a command is to type
  30357. meta digits before the command. If the first 'digit' typed is a minus
  30358. sign ('-'), then the sign of the argument will be negative. Once you
  30359. have typed one meta digit to get the argument started, you can type the
  30360. remainder of the digits, and then the command. For example, to give the
  30361. 'C-d' command an argument of 10, you could type 'M-1 0 C-d', which will
  30362. delete the next ten characters on the input line.
  30363. 
  30364. File: gdb.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction
  30365. 32.2.5 Searching for Commands in the History
  30366. --------------------------------------------
  30367. Readline provides commands for searching through the command history for
  30368. lines containing a specified string. There are two search modes:
  30369. "incremental" and "non-incremental".
  30370. Incremental searches begin before the user has finished typing the
  30371. search string. As each character of the search string is typed,
  30372. Readline displays the next entry from the history matching the string
  30373. typed so far. An incremental search requires only as many characters as
  30374. needed to find the desired history entry. To search backward in the
  30375. history for a particular string, type 'C-r'. Typing 'C-s' searches
  30376. forward through the history. The characters present in the value of the
  30377. 'isearch-terminators' variable are used to terminate an incremental
  30378. search. If that variable has not been assigned a value, the <ESC> and
  30379. 'C-J' characters will terminate an incremental search. 'C-g' will abort
  30380. an incremental search and restore the original line. When the search is
  30381. terminated, the history entry containing the search string becomes the
  30382. current line.
  30383. To find other matching entries in the history list, type 'C-r' or
  30384. 'C-s' as appropriate. This will search backward or forward in the
  30385. history for the next entry matching the search string typed so far. Any
  30386. other key sequence bound to a Readline command will terminate the search
  30387. and execute that command. For instance, a <RET> will terminate the
  30388. search and accept the line, thereby executing the command from the
  30389. history list. A movement command will terminate the search, make the
  30390. last line found the current line, and begin editing.
  30391. Readline remembers the last incremental search string. If two 'C-r's
  30392. are typed without any intervening characters defining a new search
  30393. string, any remembered search string is used.
  30394. Non-incremental searches read the entire search string before
  30395. starting to search for matching history lines. The search string may be
  30396. typed by the user or be part of the contents of the current line.
  30397. 
  30398. File: gdb.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
  30399. 32.3 Readline Init File
  30400. =======================
  30401. Although the Readline library comes with a set of Emacs-like keybindings
  30402. installed by default, it is possible to use a different set of
  30403. keybindings. Any user can customize programs that use Readline by
  30404. putting commands in an "inputrc" file, conventionally in his home
  30405. directory. The name of this file is taken from the value of the
  30406. environment variable 'INPUTRC'. If that variable is unset, the default
  30407. is '~/.inputrc'. If that file does not exist or cannot be read, the
  30408. ultimate default is '/etc/inputrc'.
  30409. When a program which uses the Readline library starts up, the init
  30410. file is read, and the key bindings are set.
  30411. In addition, the 'C-x C-r' command re-reads this init file, thus
  30412. incorporating any changes that you might have made to it.
  30413. * Menu:
  30414. * Readline Init File Syntax:: Syntax for the commands in the inputrc file.
  30415. * Conditional Init Constructs:: Conditional key bindings in the inputrc file.
  30416. * Sample Init File:: An example inputrc file.
  30417. 
  30418. File: gdb.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File
  30419. 32.3.1 Readline Init File Syntax
  30420. --------------------------------
  30421. There are only a few basic constructs allowed in the Readline init file.
  30422. Blank lines are ignored. Lines beginning with a '#' are comments.
  30423. Lines beginning with a '$' indicate conditional constructs (*note
  30424. Conditional Init Constructs::). Other lines denote variable settings
  30425. and key bindings.
  30426. Variable Settings
  30427. You can modify the run-time behavior of Readline by altering the
  30428. values of variables in Readline using the 'set' command within the
  30429. init file. The syntax is simple:
  30430. set VARIABLE VALUE
  30431. Here, for example, is how to change from the default Emacs-like key
  30432. binding to use 'vi' line editing commands:
  30433. set editing-mode vi
  30434. Variable names and values, where appropriate, are recognized
  30435. without regard to case. Unrecognized variable names are ignored.
  30436. Boolean variables (those that can be set to on or off) are set to
  30437. on if the value is null or empty, ON (case-insensitive), or 1. Any
  30438. other value results in the variable being set to off.
  30439. A great deal of run-time behavior is changeable with the following
  30440. variables.
  30441. 'bell-style'
  30442. Controls what happens when Readline wants to ring the terminal
  30443. bell. If set to 'none', Readline never rings the bell. If
  30444. set to 'visible', Readline uses a visible bell if one is
  30445. available. If set to 'audible' (the default), Readline
  30446. attempts to ring the terminal's bell.
  30447. 'bind-tty-special-chars'
  30448. If set to 'on', Readline attempts to bind the control
  30449. characters treated specially by the kernel's terminal driver
  30450. to their Readline equivalents.
  30451. 'comment-begin'
  30452. The string to insert at the beginning of the line when the
  30453. 'insert-comment' command is executed. The default value is
  30454. '"#"'.
  30455. 'completion-display-width'
  30456. The number of screen columns used to display possible matches
  30457. when performing completion. The value is ignored if it is
  30458. less than 0 or greater than the terminal screen width. A
  30459. value of 0 will cause matches to be displayed one per line.
  30460. The default value is -1.
  30461. 'completion-ignore-case'
  30462. If set to 'on', Readline performs filename matching and
  30463. completion in a case-insensitive fashion. The default value
  30464. is 'off'.
  30465. 'completion-map-case'
  30466. If set to 'on', and COMPLETION-IGNORE-CASE is enabled,
  30467. Readline treats hyphens ('-') and underscores ('_') as
  30468. equivalent when performing case-insensitive filename matching
  30469. and completion.
  30470. 'completion-prefix-display-length'
  30471. The length in characters of the common prefix of a list of
  30472. possible completions that is displayed without modification.
  30473. When set to a value greater than zero, common prefixes longer
  30474. than this value are replaced with an ellipsis when displaying
  30475. possible completions.
  30476. 'completion-query-items'
  30477. The number of possible completions that determines when the
  30478. user is asked whether the list of possibilities should be
  30479. displayed. If the number of possible completions is greater
  30480. than this value, Readline will ask the user whether or not he
  30481. wishes to view them; otherwise, they are simply listed. This
  30482. variable must be set to an integer value greater than or equal
  30483. to 0. A negative value means Readline should never ask. The
  30484. default limit is '100'.
  30485. 'convert-meta'
  30486. If set to 'on', Readline will convert characters with the
  30487. eighth bit set to an ASCII key sequence by stripping the
  30488. eighth bit and prefixing an <ESC> character, converting them
  30489. to a meta-prefixed key sequence. The default value is 'on'.
  30490. 'disable-completion'
  30491. If set to 'On', Readline will inhibit word completion.
  30492. Completion characters will be inserted into the line as if
  30493. they had been mapped to 'self-insert'. The default is 'off'.
  30494. 'editing-mode'
  30495. The 'editing-mode' variable controls which default set of key
  30496. bindings is used. By default, Readline starts up in Emacs
  30497. editing mode, where the keystrokes are most similar to Emacs.
  30498. This variable can be set to either 'emacs' or 'vi'.
  30499. 'echo-control-characters'
  30500. When set to 'on', on operating systems that indicate they
  30501. support it, readline echoes a character corresponding to a
  30502. signal generated from the keyboard. The default is 'on'.
  30503. 'enable-keypad'
  30504. When set to 'on', Readline will try to enable the application
  30505. keypad when it is called. Some systems need this to enable
  30506. the arrow keys. The default is 'off'.
  30507. 'enable-meta-key'
  30508. When set to 'on', Readline will try to enable any meta
  30509. modifier key the terminal claims to support when it is called.
  30510. On many terminals, the meta key is used to send eight-bit
  30511. characters. The default is 'on'.
  30512. 'expand-tilde'
  30513. If set to 'on', tilde expansion is performed when Readline
  30514. attempts word completion. The default is 'off'.
  30515. 'history-preserve-point'
  30516. If set to 'on', the history code attempts to place the point
  30517. (the current cursor position) at the same location on each
  30518. history line retrieved with 'previous-history' or
  30519. 'next-history'. The default is 'off'.
  30520. 'history-size'
  30521. Set the maximum number of history entries saved in the history
  30522. list. If set to zero, the number of entries in the history
  30523. list is not limited.
  30524. 'horizontal-scroll-mode'
  30525. This variable can be set to either 'on' or 'off'. Setting it
  30526. to 'on' means that the text of the lines being edited will
  30527. scroll horizontally on a single screen line when they are
  30528. longer than the width of the screen, instead of wrapping onto
  30529. a new screen line. By default, this variable is set to 'off'.
  30530. 'input-meta'
  30531. If set to 'on', Readline will enable eight-bit input (it will
  30532. not clear the eighth bit in the characters it reads),
  30533. regardless of what the terminal claims it can support. The
  30534. default value is 'off'. The name 'meta-flag' is a synonym for
  30535. this variable.
  30536. 'isearch-terminators'
  30537. The string of characters that should terminate an incremental
  30538. search without subsequently executing the character as a
  30539. command (*note Searching::). If this variable has not been
  30540. given a value, the characters <ESC> and 'C-J' will terminate
  30541. an incremental search.
  30542. 'keymap'
  30543. Sets Readline's idea of the current keymap for key binding
  30544. commands. Acceptable 'keymap' names are 'emacs',
  30545. 'emacs-standard', 'emacs-meta', 'emacs-ctlx', 'vi', 'vi-move',
  30546. 'vi-command', and 'vi-insert'. 'vi' is equivalent to
  30547. 'vi-command'; 'emacs' is equivalent to 'emacs-standard'. The
  30548. default value is 'emacs'. The value of the 'editing-mode'
  30549. variable also affects the default keymap.
  30550. 'mark-directories'
  30551. If set to 'on', completed directory names have a slash
  30552. appended. The default is 'on'.
  30553. 'mark-modified-lines'
  30554. This variable, when set to 'on', causes Readline to display an
  30555. asterisk ('*') at the start of history lines which have been
  30556. modified. This variable is 'off' by default.
  30557. 'mark-symlinked-directories'
  30558. If set to 'on', completed names which are symbolic links to
  30559. directories have a slash appended (subject to the value of
  30560. 'mark-directories'). The default is 'off'.
  30561. 'match-hidden-files'
  30562. This variable, when set to 'on', causes Readline to match
  30563. files whose names begin with a '.' (hidden files) when
  30564. performing filename completion. If set to 'off', the leading
  30565. '.' must be supplied by the user in the filename to be
  30566. completed. This variable is 'on' by default.
  30567. 'menu-complete-display-prefix'
  30568. If set to 'on', menu completion displays the common prefix of
  30569. the list of possible completions (which may be empty) before
  30570. cycling through the list. The default is 'off'.
  30571. 'output-meta'
  30572. If set to 'on', Readline will display characters with the
  30573. eighth bit set directly rather than as a meta-prefixed escape
  30574. sequence. The default is 'off'.
  30575. 'page-completions'
  30576. If set to 'on', Readline uses an internal 'more'-like pager to
  30577. display a screenful of possible completions at a time. This
  30578. variable is 'on' by default.
  30579. 'print-completions-horizontally'
  30580. If set to 'on', Readline will display completions with matches
  30581. sorted horizontally in alphabetical order, rather than down
  30582. the screen. The default is 'off'.
  30583. 'revert-all-at-newline'
  30584. If set to 'on', Readline will undo all changes to history
  30585. lines before returning when 'accept-line' is executed. By
  30586. default, history lines may be modified and retain individual
  30587. undo lists across calls to 'readline'. The default is 'off'.
  30588. 'show-all-if-ambiguous'
  30589. This alters the default behavior of the completion functions.
  30590. If set to 'on', words which have more than one possible
  30591. completion cause the matches to be listed immediately instead
  30592. of ringing the bell. The default value is 'off'.
  30593. 'show-all-if-unmodified'
  30594. This alters the default behavior of the completion functions
  30595. in a fashion similar to SHOW-ALL-IF-AMBIGUOUS. If set to
  30596. 'on', words which have more than one possible completion
  30597. without any possible partial completion (the possible
  30598. completions don't share a common prefix) cause the matches to
  30599. be listed immediately instead of ringing the bell. The
  30600. default value is 'off'.
  30601. 'skip-completed-text'
  30602. If set to 'on', this alters the default completion behavior
  30603. when inserting a single match into the line. It's only active
  30604. when performing completion in the middle of a word. If
  30605. enabled, readline does not insert characters from the
  30606. completion that match characters after point in the word being
  30607. completed, so portions of the word following the cursor are
  30608. not duplicated. For instance, if this is enabled, attempting
  30609. completion when the cursor is after the 'e' in 'Makefile' will
  30610. result in 'Makefile' rather than 'Makefilefile', assuming
  30611. there is a single possible completion. The default value is
  30612. 'off'.
  30613. 'visible-stats'
  30614. If set to 'on', a character denoting a file's type is appended
  30615. to the filename when listing possible completions. The
  30616. default is 'off'.
  30617. Key Bindings
  30618. The syntax for controlling key bindings in the init file is simple.
  30619. First you need to find the name of the command that you want to
  30620. change. The following sections contain tables of the command name,
  30621. the default keybinding, if any, and a short description of what the
  30622. command does.
  30623. Once you know the name of the command, simply place on a line in
  30624. the init file the name of the key you wish to bind the command to,
  30625. a colon, and then the name of the command. There can be no space
  30626. between the key name and the colon - that will be interpreted as
  30627. part of the key name. The name of the key can be expressed in
  30628. different ways, depending on what you find most comfortable.
  30629. In addition to command names, readline allows keys to be bound to a
  30630. string that is inserted when the key is pressed (a MACRO).
  30631. KEYNAME: FUNCTION-NAME or MACRO
  30632. KEYNAME is the name of a key spelled out in English. For
  30633. example:
  30634. Control-u: universal-argument
  30635. Meta-Rubout: backward-kill-word
  30636. Control-o: "> output"
  30637. In the above example, 'C-u' is bound to the function
  30638. 'universal-argument', 'M-DEL' is bound to the function
  30639. 'backward-kill-word', and 'C-o' is bound to run the macro
  30640. expressed on the right hand side (that is, to insert the text
  30641. '> output' into the line).
  30642. A number of symbolic character names are recognized while
  30643. processing this key binding syntax: DEL, ESC, ESCAPE, LFD,
  30644. NEWLINE, RET, RETURN, RUBOUT, SPACE, SPC, and TAB.
  30645. "KEYSEQ": FUNCTION-NAME or MACRO
  30646. KEYSEQ differs from KEYNAME above in that strings denoting an
  30647. entire key sequence can be specified, by placing the key
  30648. sequence in double quotes. Some GNU Emacs style key escapes
  30649. can be used, as in the following example, but the special
  30650. character names are not recognized.
  30651. "\C-u": universal-argument
  30652. "\C-x\C-r": re-read-init-file
  30653. "\e[11~": "Function Key 1"
  30654. In the above example, 'C-u' is again bound to the function
  30655. 'universal-argument' (just as it was in the first example),
  30656. ''C-x' 'C-r'' is bound to the function 're-read-init-file',
  30657. and '<ESC> <[> <1> <1> <~>' is bound to insert the text
  30658. 'Function Key 1'.
  30659. The following GNU Emacs style escape sequences are available when
  30660. specifying key sequences:
  30661. '\C-'
  30662. control prefix
  30663. '\M-'
  30664. meta prefix
  30665. '\e'
  30666. an escape character
  30667. '\\'
  30668. backslash
  30669. '\"'
  30670. <">, a double quotation mark
  30671. '\''
  30672. <'>, a single quote or apostrophe
  30673. In addition to the GNU Emacs style escape sequences, a second set
  30674. of backslash escapes is available:
  30675. '\a'
  30676. alert (bell)
  30677. '\b'
  30678. backspace
  30679. '\d'
  30680. delete
  30681. '\f'
  30682. form feed
  30683. '\n'
  30684. newline
  30685. '\r'
  30686. carriage return
  30687. '\t'
  30688. horizontal tab
  30689. '\v'
  30690. vertical tab
  30691. '\NNN'
  30692. the eight-bit character whose value is the octal value NNN
  30693. (one to three digits)
  30694. '\xHH'
  30695. the eight-bit character whose value is the hexadecimal value
  30696. HH (one or two hex digits)
  30697. When entering the text of a macro, single or double quotes must be
  30698. used to indicate a macro definition. Unquoted text is assumed to
  30699. be a function name. In the macro body, the backslash escapes
  30700. described above are expanded. Backslash will quote any other
  30701. character in the macro text, including '"' and '''. For example,
  30702. the following binding will make ''C-x' \' insert a single '\' into
  30703. the line:
  30704. "\C-x\\": "\\"
  30705. 
  30706. File: gdb.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File
  30707. 32.3.2 Conditional Init Constructs
  30708. ----------------------------------
  30709. Readline implements a facility similar in spirit to the conditional
  30710. compilation features of the C preprocessor which allows key bindings and
  30711. variable settings to be performed as the result of tests. There are
  30712. four parser directives used.
  30713. '$if'
  30714. The '$if' construct allows bindings to be made based on the editing
  30715. mode, the terminal being used, or the application using Readline.
  30716. The text of the test extends to the end of the line; no characters
  30717. are required to isolate it.
  30718. 'mode'
  30719. The 'mode=' form of the '$if' directive is used to test
  30720. whether Readline is in 'emacs' or 'vi' mode. This may be used
  30721. in conjunction with the 'set keymap' command, for instance, to
  30722. set bindings in the 'emacs-standard' and 'emacs-ctlx' keymaps
  30723. only if Readline is starting out in 'emacs' mode.
  30724. 'term'
  30725. The 'term=' form may be used to include terminal-specific key
  30726. bindings, perhaps to bind the key sequences output by the
  30727. terminal's function keys. The word on the right side of the
  30728. '=' is tested against both the full name of the terminal and
  30729. the portion of the terminal name before the first '-'. This
  30730. allows 'sun' to match both 'sun' and 'sun-cmd', for instance.
  30731. 'application'
  30732. The APPLICATION construct is used to include
  30733. application-specific settings. Each program using the
  30734. Readline library sets the APPLICATION NAME, and you can test
  30735. for a particular value. This could be used to bind key
  30736. sequences to functions useful for a specific program. For
  30737. instance, the following command adds a key sequence that
  30738. quotes the current or previous word in Bash:
  30739. $if Bash
  30740. # Quote the current or previous word
  30741. "\C-xq": "\eb\"\ef\""
  30742. $endif
  30743. '$endif'
  30744. This command, as seen in the previous example, terminates an '$if'
  30745. command.
  30746. '$else'
  30747. Commands in this branch of the '$if' directive are executed if the
  30748. test fails.
  30749. '$include'
  30750. This directive takes a single filename as an argument and reads
  30751. commands and bindings from that file. For example, the following
  30752. directive reads from '/etc/inputrc':
  30753. $include /etc/inputrc
  30754. 
  30755. File: gdb.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File
  30756. 32.3.3 Sample Init File
  30757. -----------------------
  30758. Here is an example of an INPUTRC file. This illustrates key binding,
  30759. variable assignment, and conditional syntax.
  30760. # This file controls the behaviour of line input editing for
  30761. # programs that use the GNU Readline library. Existing
  30762. # programs include FTP, Bash, and GDB.
  30763. #
  30764. # You can re-read the inputrc file with C-x C-r.
  30765. # Lines beginning with '#' are comments.
  30766. #
  30767. # First, include any systemwide bindings and variable
  30768. # assignments from /etc/Inputrc
  30769. $include /etc/Inputrc
  30770. #
  30771. # Set various bindings for emacs mode.
  30772. set editing-mode emacs
  30773. $if mode=emacs
  30774. Meta-Control-h: backward-kill-word Text after the function name is ignored
  30775. #
  30776. # Arrow keys in keypad mode
  30777. #
  30778. #"\M-OD": backward-char
  30779. #"\M-OC": forward-char
  30780. #"\M-OA": previous-history
  30781. #"\M-OB": next-history
  30782. #
  30783. # Arrow keys in ANSI mode
  30784. #
  30785. "\M-[D": backward-char
  30786. "\M-[C": forward-char
  30787. "\M-[A": previous-history
  30788. "\M-[B": next-history
  30789. #
  30790. # Arrow keys in 8 bit keypad mode
  30791. #
  30792. #"\M-\C-OD": backward-char
  30793. #"\M-\C-OC": forward-char
  30794. #"\M-\C-OA": previous-history
  30795. #"\M-\C-OB": next-history
  30796. #
  30797. # Arrow keys in 8 bit ANSI mode
  30798. #
  30799. #"\M-\C-[D": backward-char
  30800. #"\M-\C-[C": forward-char
  30801. #"\M-\C-[A": previous-history
  30802. #"\M-\C-[B": next-history
  30803. C-q: quoted-insert
  30804. $endif
  30805. # An old-style binding. This happens to be the default.
  30806. TAB: complete
  30807. # Macros that are convenient for shell interaction
  30808. $if Bash
  30809. # edit the path
  30810. "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
  30811. # prepare to type a quoted word --
  30812. # insert open and close double quotes
  30813. # and move to just after the open quote
  30814. "\C-x\"": "\"\"\C-b"
  30815. # insert a backslash (testing backslash escapes
  30816. # in sequences and macros)
  30817. "\C-x\\": "\\"
  30818. # Quote the current or previous word
  30819. "\C-xq": "\eb\"\ef\""
  30820. # Add a binding to refresh the line, which is unbound
  30821. "\C-xr": redraw-current-line
  30822. # Edit variable on current line.
  30823. "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
  30824. $endif
  30825. # use a visible bell if one is available
  30826. set bell-style visible
  30827. # don't strip characters to 7 bits when reading
  30828. set input-meta on
  30829. # allow iso-latin1 characters to be inserted rather
  30830. # than converted to prefix-meta sequences
  30831. set convert-meta off
  30832. # display characters with the eighth bit set directly
  30833. # rather than as meta-prefixed characters
  30834. set output-meta on
  30835. # if there are more than 150 possible completions for
  30836. # a word, ask the user if he wants to see all of them
  30837. set completion-query-items 150
  30838. # For FTP
  30839. $if Ftp
  30840. "\C-xg": "get \M-?"
  30841. "\C-xt": "put \M-?"
  30842. "\M-.": yank-last-arg
  30843. $endif
  30844. 
  30845. File: gdb.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing
  30846. 32.4 Bindable Readline Commands
  30847. ===============================
  30848. * Menu:
  30849. * Commands For Moving:: Moving about the line.
  30850. * Commands For History:: Getting at previous lines.
  30851. * Commands For Text:: Commands for changing text.
  30852. * Commands For Killing:: Commands for killing and yanking.
  30853. * Numeric Arguments:: Specifying numeric arguments, repeat counts.
  30854. * Commands For Completion:: Getting Readline to do the typing for you.
  30855. * Keyboard Macros:: Saving and re-executing typed characters
  30856. * Miscellaneous Commands:: Other miscellaneous commands.
  30857. This section describes Readline commands that may be bound to key
  30858. sequences. Command names without an accompanying key sequence are
  30859. unbound by default.
  30860. In the following descriptions, "point" refers to the current cursor
  30861. position, and "mark" refers to a cursor position saved by the 'set-mark'
  30862. command. The text between the point and mark is referred to as the
  30863. "region".
  30864. 
  30865. File: gdb.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
  30866. 32.4.1 Commands For Moving
  30867. --------------------------
  30868. 'beginning-of-line (C-a)'
  30869. Move to the start of the current line.
  30870. 'end-of-line (C-e)'
  30871. Move to the end of the line.
  30872. 'forward-char (C-f)'
  30873. Move forward a character.
  30874. 'backward-char (C-b)'
  30875. Move back a character.
  30876. 'forward-word (M-f)'
  30877. Move forward to the end of the next word. Words are composed of
  30878. letters and digits.
  30879. 'backward-word (M-b)'
  30880. Move back to the start of the current or previous word. Words are
  30881. composed of letters and digits.
  30882. 'clear-screen (C-l)'
  30883. Clear the screen and redraw the current line, leaving the current
  30884. line at the top of the screen.
  30885. 'redraw-current-line ()'
  30886. Refresh the current line. By default, this is unbound.
  30887. 
  30888. File: gdb.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands
  30889. 32.4.2 Commands For Manipulating The History
  30890. --------------------------------------------
  30891. 'accept-line (Newline or Return)'
  30892. Accept the line regardless of where the cursor is. If this line is
  30893. non-empty, it may be added to the history list for future recall
  30894. with 'add_history()'. If this line is a modified history line, the
  30895. history line is restored to its original state.
  30896. 'previous-history (C-p)'
  30897. Move 'back' through the history list, fetching the previous
  30898. command.
  30899. 'next-history (C-n)'
  30900. Move 'forward' through the history list, fetching the next command.
  30901. 'beginning-of-history (M-<)'
  30902. Move to the first line in the history.
  30903. 'end-of-history (M->)'
  30904. Move to the end of the input history, i.e., the line currently
  30905. being entered.
  30906. 'reverse-search-history (C-r)'
  30907. Search backward starting at the current line and moving 'up'
  30908. through the history as necessary. This is an incremental search.
  30909. 'forward-search-history (C-s)'
  30910. Search forward starting at the current line and moving 'down'
  30911. through the the history as necessary. This is an incremental
  30912. search.
  30913. 'non-incremental-reverse-search-history (M-p)'
  30914. Search backward starting at the current line and moving 'up'
  30915. through the history as necessary using a non-incremental search for
  30916. a string supplied by the user.
  30917. 'non-incremental-forward-search-history (M-n)'
  30918. Search forward starting at the current line and moving 'down'
  30919. through the the history as necessary using a non-incremental search
  30920. for a string supplied by the user.
  30921. 'history-search-forward ()'
  30922. Search forward through the history for the string of characters
  30923. between the start of the current line and the point. This is a
  30924. non-incremental search. By default, this command is unbound.
  30925. 'history-search-backward ()'
  30926. Search backward through the history for the string of characters
  30927. between the start of the current line and the point. This is a
  30928. non-incremental search. By default, this command is unbound.
  30929. 'yank-nth-arg (M-C-y)'
  30930. Insert the first argument to the previous command (usually the
  30931. second word on the previous line) at point. With an argument N,
  30932. insert the Nth word from the previous command (the words in the
  30933. previous command begin with word 0). A negative argument inserts
  30934. the Nth word from the end of the previous command. Once the
  30935. argument N is computed, the argument is extracted as if the '!N'
  30936. history expansion had been specified.
  30937. 'yank-last-arg (M-. or M-_)'
  30938. Insert last argument to the previous command (the last word of the
  30939. previous history entry). With a numeric argument, behave exactly
  30940. like 'yank-nth-arg'. Successive calls to 'yank-last-arg' move back
  30941. through the history list, inserting the last word (or the word
  30942. specified by the argument to the first call) of each line in turn.
  30943. Any numeric argument supplied to these successive calls determines
  30944. the direction to move through the history. A negative argument
  30945. switches the direction through the history (back or forward). The
  30946. history expansion facilities are used to extract the last argument,
  30947. as if the '!$' history expansion had been specified.
  30948. 
  30949. File: gdb.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands
  30950. 32.4.3 Commands For Changing Text
  30951. ---------------------------------
  30952. 'delete-char (C-d)'
  30953. Delete the character at point. If point is at the beginning of the
  30954. line, there are no characters in the line, and the last character
  30955. typed was not bound to 'delete-char', then return EOF.
  30956. 'backward-delete-char (Rubout)'
  30957. Delete the character behind the cursor. A numeric argument means
  30958. to kill the characters instead of deleting them.
  30959. 'forward-backward-delete-char ()'
  30960. Delete the character under the cursor, unless the cursor is at the
  30961. end of the line, in which case the character behind the cursor is
  30962. deleted. By default, this is not bound to a key.
  30963. 'quoted-insert (C-q or C-v)'
  30964. Add the next character typed to the line verbatim. This is how to
  30965. insert key sequences like 'C-q', for example.
  30966. 'tab-insert (M-<TAB>)'
  30967. Insert a tab character.
  30968. 'self-insert (a, b, A, 1, !, ...)'
  30969. Insert yourself.
  30970. 'transpose-chars (C-t)'
  30971. Drag the character before the cursor forward over the character at
  30972. the cursor, moving the cursor forward as well. If the insertion
  30973. point is at the end of the line, then this transposes the last two
  30974. characters of the line. Negative arguments have no effect.
  30975. 'transpose-words (M-t)'
  30976. Drag the word before point past the word after point, moving point
  30977. past that word as well. If the insertion point is at the end of
  30978. the line, this transposes the last two words on the line.
  30979. 'upcase-word (M-u)'
  30980. Uppercase the current (or following) word. With a negative
  30981. argument, uppercase the previous word, but do not move the cursor.
  30982. 'downcase-word (M-l)'
  30983. Lowercase the current (or following) word. With a negative
  30984. argument, lowercase the previous word, but do not move the cursor.
  30985. 'capitalize-word (M-c)'
  30986. Capitalize the current (or following) word. With a negative
  30987. argument, capitalize the previous word, but do not move the cursor.
  30988. 'overwrite-mode ()'
  30989. Toggle overwrite mode. With an explicit positive numeric argument,
  30990. switches to overwrite mode. With an explicit non-positive numeric
  30991. argument, switches to insert mode. This command affects only
  30992. 'emacs' mode; 'vi' mode does overwrite differently. Each call to
  30993. 'readline()' starts in insert mode.
  30994. In overwrite mode, characters bound to 'self-insert' replace the
  30995. text at point rather than pushing the text to the right.
  30996. Characters bound to 'backward-delete-char' replace the character
  30997. before point with a space.
  30998. By default, this command is unbound.
  30999. 
  31000. File: gdb.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
  31001. 32.4.4 Killing And Yanking
  31002. --------------------------
  31003. 'kill-line (C-k)'
  31004. Kill the text from point to the end of the line.
  31005. 'backward-kill-line (C-x Rubout)'
  31006. Kill backward to the beginning of the line.
  31007. 'unix-line-discard (C-u)'
  31008. Kill backward from the cursor to the beginning of the current line.
  31009. 'kill-whole-line ()'
  31010. Kill all characters on the current line, no matter where point is.
  31011. By default, this is unbound.
  31012. 'kill-word (M-d)'
  31013. Kill from point to the end of the current word, or if between
  31014. words, to the end of the next word. Word boundaries are the same
  31015. as 'forward-word'.
  31016. 'backward-kill-word (M-<DEL>)'
  31017. Kill the word behind point. Word boundaries are the same as
  31018. 'backward-word'.
  31019. 'unix-word-rubout (C-w)'
  31020. Kill the word behind point, using white space as a word boundary.
  31021. The killed text is saved on the kill-ring.
  31022. 'unix-filename-rubout ()'
  31023. Kill the word behind point, using white space and the slash
  31024. character as the word boundaries. The killed text is saved on the
  31025. kill-ring.
  31026. 'delete-horizontal-space ()'
  31027. Delete all spaces and tabs around point. By default, this is
  31028. unbound.
  31029. 'kill-region ()'
  31030. Kill the text in the current region. By default, this command is
  31031. unbound.
  31032. 'copy-region-as-kill ()'
  31033. Copy the text in the region to the kill buffer, so it can be yanked
  31034. right away. By default, this command is unbound.
  31035. 'copy-backward-word ()'
  31036. Copy the word before point to the kill buffer. The word boundaries
  31037. are the same as 'backward-word'. By default, this command is
  31038. unbound.
  31039. 'copy-forward-word ()'
  31040. Copy the word following point to the kill buffer. The word
  31041. boundaries are the same as 'forward-word'. By default, this
  31042. command is unbound.
  31043. 'yank (C-y)'
  31044. Yank the top of the kill ring into the buffer at point.
  31045. 'yank-pop (M-y)'
  31046. Rotate the kill-ring, and yank the new top. You can only do this
  31047. if the prior command is 'yank' or 'yank-pop'.
  31048. 
  31049. File: gdb.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands
  31050. 32.4.5 Specifying Numeric Arguments
  31051. -----------------------------------
  31052. 'digit-argument (M-0, M-1, ... M--)'
  31053. Add this digit to the argument already accumulating, or start a new
  31054. argument. 'M--' starts a negative argument.
  31055. 'universal-argument ()'
  31056. This is another way to specify an argument. If this command is
  31057. followed by one or more digits, optionally with a leading minus
  31058. sign, those digits define the argument. If the command is followed
  31059. by digits, executing 'universal-argument' again ends the numeric
  31060. argument, but is otherwise ignored. As a special case, if this
  31061. command is immediately followed by a character that is neither a
  31062. digit or minus sign, the argument count for the next command is
  31063. multiplied by four. The argument count is initially one, so
  31064. executing this function the first time makes the argument count
  31065. four, a second time makes the argument count sixteen, and so on.
  31066. By default, this is not bound to a key.
  31067. 
  31068. File: gdb.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands
  31069. 32.4.6 Letting Readline Type For You
  31070. ------------------------------------
  31071. 'complete (<TAB>)'
  31072. Attempt to perform completion on the text before point. The actual
  31073. completion performed is application-specific. The default is
  31074. filename completion.
  31075. 'possible-completions (M-?)'
  31076. List the possible completions of the text before point. When
  31077. displaying completions, Readline sets the number of columns used
  31078. for display to the value of 'completion-display-width', the value
  31079. of the environment variable 'COLUMNS', or the screen width, in that
  31080. order.
  31081. 'insert-completions (M-*)'
  31082. Insert all completions of the text before point that would have
  31083. been generated by 'possible-completions'.
  31084. 'menu-complete ()'
  31085. Similar to 'complete', but replaces the word to be completed with a
  31086. single match from the list of possible completions. Repeated
  31087. execution of 'menu-complete' steps through the list of possible
  31088. completions, inserting each match in turn. At the end of the list
  31089. of completions, the bell is rung (subject to the setting of
  31090. 'bell-style') and the original text is restored. An argument of N
  31091. moves N positions forward in the list of matches; a negative
  31092. argument may be used to move backward through the list. This
  31093. command is intended to be bound to <TAB>, but is unbound by
  31094. default.
  31095. 'menu-complete-backward ()'
  31096. Identical to 'menu-complete', but moves backward through the list
  31097. of possible completions, as if 'menu-complete' had been given a
  31098. negative argument.
  31099. 'delete-char-or-list ()'
  31100. Deletes the character under the cursor if not at the beginning or
  31101. end of the line (like 'delete-char'). If at the end of the line,
  31102. behaves identically to 'possible-completions'. This command is
  31103. unbound by default.
  31104. 
  31105. File: gdb.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands
  31106. 32.4.7 Keyboard Macros
  31107. ----------------------
  31108. 'start-kbd-macro (C-x ()'
  31109. Begin saving the characters typed into the current keyboard macro.
  31110. 'end-kbd-macro (C-x ))'
  31111. Stop saving the characters typed into the current keyboard macro
  31112. and save the definition.
  31113. 'call-last-kbd-macro (C-x e)'
  31114. Re-execute the last keyboard macro defined, by making the
  31115. characters in the macro appear as if typed at the keyboard.
  31116. 
  31117. File: gdb.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands
  31118. 32.4.8 Some Miscellaneous Commands
  31119. ----------------------------------
  31120. 're-read-init-file (C-x C-r)'
  31121. Read in the contents of the INPUTRC file, and incorporate any
  31122. bindings or variable assignments found there.
  31123. 'abort (C-g)'
  31124. Abort the current editing command and ring the terminal's bell
  31125. (subject to the setting of 'bell-style').
  31126. 'do-uppercase-version (M-a, M-b, M-X, ...)'
  31127. If the metafied character X is lowercase, run the command that is
  31128. bound to the corresponding uppercase character.
  31129. 'prefix-meta (<ESC>)'
  31130. Metafy the next character typed. This is for keyboards without a
  31131. meta key. Typing '<ESC> f' is equivalent to typing 'M-f'.
  31132. 'undo (C-_ or C-x C-u)'
  31133. Incremental undo, separately remembered for each line.
  31134. 'revert-line (M-r)'
  31135. Undo all changes made to this line. This is like executing the
  31136. 'undo' command enough times to get back to the beginning.
  31137. 'tilde-expand (M-~)'
  31138. Perform tilde expansion on the current word.
  31139. 'set-mark (C-@)'
  31140. Set the mark to the point. If a numeric argument is supplied, the
  31141. mark is set to that position.
  31142. 'exchange-point-and-mark (C-x C-x)'
  31143. Swap the point with the mark. The current cursor position is set
  31144. to the saved position, and the old cursor position is saved as the
  31145. mark.
  31146. 'character-search (C-])'
  31147. A character is read and point is moved to the next occurrence of
  31148. that character. A negative count searches for previous
  31149. occurrences.
  31150. 'character-search-backward (M-C-])'
  31151. A character is read and point is moved to the previous occurrence
  31152. of that character. A negative count searches for subsequent
  31153. occurrences.
  31154. 'skip-csi-sequence ()'
  31155. Read enough characters to consume a multi-key sequence such as
  31156. those defined for keys like Home and End. Such sequences begin
  31157. with a Control Sequence Indicator (CSI), usually ESC-[. If this
  31158. sequence is bound to "\e[", keys producing such sequences will have
  31159. no effect unless explicitly bound to a readline command, instead of
  31160. inserting stray characters into the editing buffer. This is
  31161. unbound by default, but usually bound to ESC-[.
  31162. 'insert-comment (M-#)'
  31163. Without a numeric argument, the value of the 'comment-begin'
  31164. variable is inserted at the beginning of the current line. If a
  31165. numeric argument is supplied, this command acts as a toggle: if the
  31166. characters at the beginning of the line do not match the value of
  31167. 'comment-begin', the value is inserted, otherwise the characters in
  31168. 'comment-begin' are deleted from the beginning of the line. In
  31169. either case, the line is accepted as if a newline had been typed.
  31170. 'dump-functions ()'
  31171. Print all of the functions and their key bindings to the Readline
  31172. output stream. If a numeric argument is supplied, the output is
  31173. formatted in such a way that it can be made part of an INPUTRC
  31174. file. This command is unbound by default.
  31175. 'dump-variables ()'
  31176. Print all of the settable variables and their values to the
  31177. Readline output stream. If a numeric argument is supplied, the
  31178. output is formatted in such a way that it can be made part of an
  31179. INPUTRC file. This command is unbound by default.
  31180. 'dump-macros ()'
  31181. Print all of the Readline key sequences bound to macros and the
  31182. strings they output. If a numeric argument is supplied, the output
  31183. is formatted in such a way that it can be made part of an INPUTRC
  31184. file. This command is unbound by default.
  31185. 'emacs-editing-mode (C-e)'
  31186. When in 'vi' command mode, this causes a switch to 'emacs' editing
  31187. mode.
  31188. 'vi-editing-mode (M-C-j)'
  31189. When in 'emacs' editing mode, this causes a switch to 'vi' editing
  31190. mode.
  31191. 
  31192. File: gdb.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing
  31193. 32.5 Readline vi Mode
  31194. =====================
  31195. While the Readline library does not have a full set of 'vi' editing
  31196. functions, it does contain enough to allow simple editing of the line.
  31197. The Readline 'vi' mode behaves as specified in the POSIX standard.
  31198. In order to switch interactively between 'emacs' and 'vi' editing
  31199. modes, use the command 'M-C-j' (bound to emacs-editing-mode when in 'vi'
  31200. mode and to vi-editing-mode in 'emacs' mode). The Readline default is
  31201. 'emacs' mode.
  31202. When you enter a line in 'vi' mode, you are already placed in
  31203. 'insertion' mode, as if you had typed an 'i'. Pressing <ESC> switches
  31204. you into 'command' mode, where you can edit the text of the line with
  31205. the standard 'vi' movement keys, move to previous history lines with 'k'
  31206. and subsequent lines with 'j', and so forth.
  31207. 
  31208. File: gdb.info, Node: Using History Interactively, Next: In Memoriam, Prev: Command Line Editing, Up: Top
  31209. 33 Using History Interactively
  31210. ******************************
  31211. This chapter describes how to use the GNU History Library interactively,
  31212. from a user's standpoint. It should be considered a user's guide. For
  31213. information on using the GNU History Library in your own programs, *note
  31214. (history)Programming with GNU History::.
  31215. * Menu:
  31216. * History Interaction:: What it feels like using History as a user.
  31217. 
  31218. File: gdb.info, Node: History Interaction, Up: Using History Interactively
  31219. 33.1 History Expansion
  31220. ======================
  31221. The History library provides a history expansion feature that is similar
  31222. to the history expansion provided by 'csh'. This section describes the
  31223. syntax used to manipulate the history information.
  31224. History expansions introduce words from the history list into the
  31225. input stream, making it easy to repeat commands, insert the arguments to
  31226. a previous command into the current input line, or fix errors in
  31227. previous commands quickly.
  31228. History expansion takes place in two parts. The first is to
  31229. determine which line from the history list should be used during
  31230. substitution. The second is to select portions of that line for
  31231. inclusion into the current one. The line selected from the history is
  31232. called the "event", and the portions of that line that are acted upon
  31233. are called "words". Various "modifiers" are available to manipulate the
  31234. selected words. The line is broken into words in the same fashion that
  31235. Bash does, so that several words surrounded by quotes are considered one
  31236. word. History expansions are introduced by the appearance of the
  31237. history expansion character, which is '!' by default.
  31238. * Menu:
  31239. * Event Designators:: How to specify which history line to use.
  31240. * Word Designators:: Specifying which words are of interest.
  31241. * Modifiers:: Modifying the results of substitution.
  31242. 
  31243. File: gdb.info, Node: Event Designators, Next: Word Designators, Up: History Interaction
  31244. 33.1.1 Event Designators
  31245. ------------------------
  31246. An event designator is a reference to a command line entry in the
  31247. history list. Unless the reference is absolute, events are relative to
  31248. the current position in the history list.
  31249. '!'
  31250. Start a history substitution, except when followed by a space, tab,
  31251. the end of the line, or '='.
  31252. '!N'
  31253. Refer to command line N.
  31254. '!-N'
  31255. Refer to the command N lines back.
  31256. '!!'
  31257. Refer to the previous command. This is a synonym for '!-1'.
  31258. '!STRING'
  31259. Refer to the most recent command preceding the current position in
  31260. the history list starting with STRING.
  31261. '!?STRING[?]'
  31262. Refer to the most recent command preceding the current position in
  31263. the history list containing STRING. The trailing '?' may be
  31264. omitted if the STRING is followed immediately by a newline.
  31265. '^STRING1^STRING2^'
  31266. Quick Substitution. Repeat the last command, replacing STRING1
  31267. with STRING2. Equivalent to '!!:s/STRING1/STRING2/'.
  31268. '!#'
  31269. The entire command line typed so far.
  31270. 
  31271. File: gdb.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction
  31272. 33.1.2 Word Designators
  31273. -----------------------
  31274. Word designators are used to select desired words from the event. A ':'
  31275. separates the event specification from the word designator. It may be
  31276. omitted if the word designator begins with a '^', '$', '*', '-', or '%'.
  31277. Words are numbered from the beginning of the line, with the first word
  31278. being denoted by 0 (zero). Words are inserted into the current line
  31279. separated by single spaces.
  31280. For example,
  31281. '!!'
  31282. designates the preceding command. When you type this, the
  31283. preceding command is repeated in toto.
  31284. '!!:$'
  31285. designates the last argument of the preceding command. This may be
  31286. shortened to '!$'.
  31287. '!fi:2'
  31288. designates the second argument of the most recent command starting
  31289. with the letters 'fi'.
  31290. Here are the word designators:
  31291. '0 (zero)'
  31292. The '0'th word. For many applications, this is the command word.
  31293. 'N'
  31294. The Nth word.
  31295. '^'
  31296. The first argument; that is, word 1.
  31297. '$'
  31298. The last argument.
  31299. '%'
  31300. The word matched by the most recent '?STRING?' search.
  31301. 'X-Y'
  31302. A range of words; '-Y' abbreviates '0-Y'.
  31303. '*'
  31304. All of the words, except the '0'th. This is a synonym for '1-$'.
  31305. It is not an error to use '*' if there is just one word in the
  31306. event; the empty string is returned in that case.
  31307. 'X*'
  31308. Abbreviates 'X-$'
  31309. 'X-'
  31310. Abbreviates 'X-$' like 'X*', but omits the last word.
  31311. If a word designator is supplied without an event specification, the
  31312. previous command is used as the event.
  31313. 
  31314. File: gdb.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
  31315. 33.1.3 Modifiers
  31316. ----------------
  31317. After the optional word designator, you can add a sequence of one or
  31318. more of the following modifiers, each preceded by a ':'.
  31319. 'h'
  31320. Remove a trailing pathname component, leaving only the head.
  31321. 't'
  31322. Remove all leading pathname components, leaving the tail.
  31323. 'r'
  31324. Remove a trailing suffix of the form '.SUFFIX', leaving the
  31325. basename.
  31326. 'e'
  31327. Remove all but the trailing suffix.
  31328. 'p'
  31329. Print the new command but do not execute it.
  31330. 's/OLD/NEW/'
  31331. Substitute NEW for the first occurrence of OLD in the event line.
  31332. Any delimiter may be used in place of '/'. The delimiter may be
  31333. quoted in OLD and NEW with a single backslash. If '&' appears in
  31334. NEW, it is replaced by OLD. A single backslash will quote the '&'.
  31335. The final delimiter is optional if it is the last character on the
  31336. input line.
  31337. '&'
  31338. Repeat the previous substitution.
  31339. 'g'
  31340. 'a'
  31341. Cause changes to be applied over the entire event line. Used in
  31342. conjunction with 's', as in 'gs/OLD/NEW/', or with '&'.
  31343. 'G'
  31344. Apply the following 's' modifier once to each word in the event.
  31345. 
  31346. File: gdb.info, Node: In Memoriam, Next: Formatting Documentation, Prev: Using History Interactively, Up: Top
  31347. Appendix A In Memoriam
  31348. **********************
  31349. The GDB project mourns the loss of the following long-time contributors:
  31350. 'Fred Fish'
  31351. Fred was a long-standing contributor to GDB (1991-2006), and to
  31352. Free Software in general. Outside of GDB, he was known in the
  31353. Amiga world for his series of Fish Disks, and the GeekGadget
  31354. project.
  31355. 'Michael Snyder'
  31356. Michael was one of the Global Maintainers of the GDB project, with
  31357. contributions recorded as early as 1996, until 2011. In addition
  31358. to his day to day participation, he was a large driving force
  31359. behind adding Reverse Debugging to GDB.
  31360. Beyond their technical contributions to the project, they were also
  31361. enjoyable members of the Free Software Community. We will miss them.
  31362. 
  31363. File: gdb.info, Node: Formatting Documentation, Next: Installing GDB, Prev: In Memoriam, Up: Top
  31364. Appendix B Formatting Documentation
  31365. ***********************************
  31366. The GDB 4 release includes an already-formatted reference card, ready
  31367. for printing with PostScript or Ghostscript, in the 'gdb' subdirectory
  31368. of the main source directory(1). If you can use PostScript or
  31369. Ghostscript with your printer, you can print the reference card
  31370. immediately with 'refcard.ps'.
  31371. The release also includes the source for the reference card. You can
  31372. format it, using TeX, by typing:
  31373. make refcard.dvi
  31374. The GDB reference card is designed to print in "landscape" mode on US
  31375. "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
  31376. high. You will need to specify this form of printing as an option to
  31377. your DVI output program.
  31378. All the documentation for GDB comes as part of the machine-readable
  31379. distribution. The documentation is written in Texinfo format, which is
  31380. a documentation system that uses a single source file to produce both
  31381. on-line information and a printed manual. You can use one of the Info
  31382. formatting commands to create the on-line version of the documentation
  31383. and TeX (or 'texi2roff') to typeset the printed version.
  31384. GDB includes an already formatted copy of the on-line Info version of
  31385. this manual in the 'gdb' subdirectory. The main Info file is
  31386. 'gdb-8.3.1.20191204-git/gdb/gdb.info', and it refers to subordinate
  31387. files matching 'gdb.info*' in the same directory. If necessary, you can
  31388. print out these files, or read them with any editor; but they are easier
  31389. to read using the 'info' subsystem in GNU Emacs or the standalone 'info'
  31390. program, available as part of the GNU Texinfo distribution.
  31391. If you want to format these Info files yourself, you need one of the
  31392. Info formatting programs, such as 'texinfo-format-buffer' or 'makeinfo'.
  31393. If you have 'makeinfo' installed, and are in the top level GDB source
  31394. directory ('gdb-8.3.1.20191204-git', in the case of version
  31395. 8.3.1.20191204-git), you can make the Info file by typing:
  31396. cd gdb
  31397. make gdb.info
  31398. If you want to typeset and print copies of this manual, you need TeX,
  31399. a program to print its DVI output files, and 'texinfo.tex', the Texinfo
  31400. definitions file.
  31401. TeX is a typesetting program; it does not print files directly, but
  31402. produces output files called DVI files. To print a typeset document,
  31403. you need a program to print DVI files. If your system has TeX
  31404. installed, chances are it has such a program. The precise command to
  31405. use depends on your system; 'lpr -d' is common; another (for PostScript
  31406. devices) is 'dvips'. The DVI print command may require a file name
  31407. without any extension or a '.dvi' extension.
  31408. TeX also requires a macro definitions file called 'texinfo.tex'.
  31409. This file tells TeX how to typeset a document written in Texinfo format.
  31410. On its own, TeX cannot either read or typeset a Texinfo file.
  31411. 'texinfo.tex' is distributed with GDB and is located in the
  31412. 'gdb-VERSION-NUMBER/texinfo' directory.
  31413. If you have TeX and a DVI printer program installed, you can typeset
  31414. and print this manual. First switch to the 'gdb' subdirectory of the
  31415. main source directory (for example, to 'gdb-8.3.1.20191204-git/gdb') and
  31416. type:
  31417. make gdb.dvi
  31418. Then give 'gdb.dvi' to your DVI printing program.
  31419. ---------- Footnotes ----------
  31420. (1) In 'gdb-8.3.1.20191204-git/gdb/refcard.ps' of the version
  31421. 8.3.1.20191204-git release.
  31422. 
  31423. File: gdb.info, Node: Installing GDB, Next: Maintenance Commands, Prev: Formatting Documentation, Up: Top
  31424. Appendix C Installing GDB
  31425. *************************
  31426. * Menu:
  31427. * Requirements:: Requirements for building GDB
  31428. * Running Configure:: Invoking the GDB 'configure' script
  31429. * Separate Objdir:: Compiling GDB in another directory
  31430. * Config Names:: Specifying names for hosts and targets
  31431. * Configure Options:: Summary of options for configure
  31432. * System-wide configuration:: Having a system-wide init file
  31433. 
  31434. File: gdb.info, Node: Requirements, Next: Running Configure, Up: Installing GDB
  31435. C.1 Requirements for Building GDB
  31436. =================================
  31437. Building GDB requires various tools and packages to be available. Other
  31438. packages will be used only if they are found.
  31439. Tools/Packages Necessary for Building GDB
  31440. =========================================
  31441. C++11 compiler
  31442. GDB is written in C++11. It should be buildable with any recent
  31443. C++11 compiler, e.g. GCC.
  31444. GNU make
  31445. GDB's build system relies on features only found in the GNU make
  31446. program. Other variants of 'make' will not work.
  31447. Tools/Packages Optional for Building GDB
  31448. ========================================
  31449. Expat
  31450. GDB can use the Expat XML parsing library. This library may be
  31451. included with your operating system distribution; if it is not, you
  31452. can get the latest version from <http://expat.sourceforge.net>.
  31453. The 'configure' script will search for this library in several
  31454. standard locations; if it is installed in an unusual path, you can
  31455. use the '--with-libexpat-prefix' option to specify its location.
  31456. Expat is used for:
  31457. * Remote protocol memory maps (*note Memory Map Format::)
  31458. * Target descriptions (*note Target Descriptions::)
  31459. * Remote shared library lists (*Note Library List Format::, or
  31460. alternatively *note Library List Format for SVR4 Targets::)
  31461. * MS-Windows shared libraries (*note Shared Libraries::)
  31462. * Traceframe info (*note Traceframe Info Format::)
  31463. * Branch trace (*note Branch Trace Format::, *note Branch Trace
  31464. Configuration Format::)
  31465. Guile
  31466. GDB can be scripted using GNU Guile. *Note Guile::. By default,
  31467. GDB will be compiled if the Guile libraries are installed and are
  31468. found by 'configure'. You can use the '--with-guile' option to
  31469. request Guile, and pass either the Guile version number or the file
  31470. name of the relevant 'pkg-config' program to choose a particular
  31471. version of Guile.
  31472. iconv
  31473. GDB's features related to character sets (*note Character Sets::)
  31474. require a functioning 'iconv' implementation. If you are on a GNU
  31475. system, then this is provided by the GNU C Library. Some other
  31476. systems also provide a working 'iconv'.
  31477. If GDB is using the 'iconv' program which is installed in a
  31478. non-standard place, you will need to tell GDB where to find it.
  31479. This is done with '--with-iconv-bin' which specifies the directory
  31480. that contains the 'iconv' program. This program is run in order to
  31481. make a list of the available character sets.
  31482. On systems without 'iconv', you can install GNU Libiconv. If
  31483. Libiconv is installed in a standard place, GDB will automatically
  31484. use it if it is needed. If you have previously installed Libiconv
  31485. in a non-standard place, you can use the '--with-libiconv-prefix'
  31486. option to 'configure'.
  31487. GDB's top-level 'configure' and 'Makefile' will arrange to build
  31488. Libiconv if a directory named 'libiconv' appears in the top-most
  31489. source directory. If Libiconv is built this way, and if the
  31490. operating system does not provide a suitable 'iconv'
  31491. implementation, then the just-built library will automatically be
  31492. used by GDB. One easy way to set this up is to download GNU
  31493. Libiconv, unpack it inside the top-level directory of the GDB
  31494. source tree, and then rename the directory holding the Libiconv
  31495. source code to 'libiconv'.
  31496. lzma
  31497. GDB can support debugging sections that are compressed with the
  31498. LZMA library. *Note MiniDebugInfo::. If this library is not
  31499. included with your operating system, you can find it in the xz
  31500. package at <http://tukaani.org/xz/>. If the LZMA library is
  31501. available in the usual place, then the 'configure' script will use
  31502. it automatically. If it is installed in an unusual path, you can
  31503. use the '--with-lzma-prefix' option to specify its location.
  31504. MPFR
  31505. GDB can use the GNU MPFR multiple-precision floating-point library.
  31506. This library may be included with your operating system
  31507. distribution; if it is not, you can get the latest version from
  31508. <http://www.mpfr.org>. The 'configure' script will search for this
  31509. library in several standard locations; if it is installed in an
  31510. unusual path, you can use the '--with-libmpfr-prefix' option to
  31511. specify its location.
  31512. GNU MPFR is used to emulate target floating-point arithmetic during
  31513. expression evaluation when the target uses different floating-point
  31514. formats than the host. If GNU MPFR it is not available, GDB will
  31515. fall back to using host floating-point arithmetic.
  31516. Python
  31517. GDB can be scripted using Python language. *Note Python::. By
  31518. default, GDB will be compiled if the Python libraries are installed
  31519. and are found by 'configure'. You can use the '--with-python'
  31520. option to request Python, and pass either the file name of the
  31521. relevant 'python' executable, or the name of the directory in which
  31522. Python is installed, to choose a particular installation of Python.
  31523. zlib
  31524. GDB will use the 'zlib' library, if available, to read compressed
  31525. debug sections. Some linkers, such as GNU gold, are capable of
  31526. producing binaries with compressed debug sections. If GDB is
  31527. compiled with 'zlib', it will be able to read the debug information
  31528. in such binaries.
  31529. The 'zlib' library is likely included with your operating system
  31530. distribution; if it is not, you can get the latest version from
  31531. <http://zlib.net>.
  31532. 
  31533. File: gdb.info, Node: Running Configure, Next: Separate Objdir, Prev: Requirements, Up: Installing GDB
  31534. C.2 Invoking the GDB 'configure' Script
  31535. =======================================
  31536. GDB comes with a 'configure' script that automates the process of
  31537. preparing GDB for installation; you can then use 'make' to build the
  31538. 'gdb' program.
  31539. The GDB distribution includes all the source code you need for GDB in
  31540. a single directory, whose name is usually composed by appending the
  31541. version number to 'gdb'.
  31542. For example, the GDB version 8.3.1.20191204-git distribution is in
  31543. the 'gdb-8.3.1.20191204-git' directory. That directory contains:
  31544. 'gdb-8.3.1.20191204-git/configure (and supporting files)'
  31545. script for configuring GDB and all its supporting libraries
  31546. 'gdb-8.3.1.20191204-git/gdb'
  31547. the source specific to GDB itself
  31548. 'gdb-8.3.1.20191204-git/bfd'
  31549. source for the Binary File Descriptor library
  31550. 'gdb-8.3.1.20191204-git/include'
  31551. GNU include files
  31552. 'gdb-8.3.1.20191204-git/libiberty'
  31553. source for the '-liberty' free software library
  31554. 'gdb-8.3.1.20191204-git/opcodes'
  31555. source for the library of opcode tables and disassemblers
  31556. 'gdb-8.3.1.20191204-git/readline'
  31557. source for the GNU command-line interface
  31558. There may be other subdirectories as well.
  31559. The simplest way to configure and build GDB is to run 'configure'
  31560. from the 'gdb-VERSION-NUMBER' source directory, which in this example is
  31561. the 'gdb-8.3.1.20191204-git' directory.
  31562. First switch to the 'gdb-VERSION-NUMBER' source directory if you are
  31563. not already in it; then run 'configure'. Pass the identifier for the
  31564. platform on which GDB will run as an argument.
  31565. For example:
  31566. cd gdb-8.3.1.20191204-git
  31567. ./configure
  31568. make
  31569. Running 'configure' and then running 'make' builds the included
  31570. supporting libraries, then 'gdb' itself. The configured source files,
  31571. and the binaries, are left in the corresponding source directories.
  31572. 'configure' is a Bourne-shell ('/bin/sh') script; if your system does
  31573. not recognize this automatically when you run a different shell, you may
  31574. need to run 'sh' on it explicitly:
  31575. sh configure
  31576. You should run the 'configure' script from the top directory in the
  31577. source tree, the 'gdb-VERSION-NUMBER' directory. If you run 'configure'
  31578. from one of the subdirectories, you will configure only that
  31579. subdirectory. That is usually not what you want. In particular, if you
  31580. run the first 'configure' from the 'gdb' subdirectory of the
  31581. 'gdb-VERSION-NUMBER' directory, you will omit the configuration of
  31582. 'bfd', 'readline', and other sibling directories of the 'gdb'
  31583. subdirectory. This leads to build errors about missing include files
  31584. such as 'bfd/bfd.h'.
  31585. You can install 'GDB' anywhere. The best way to do this is to pass
  31586. the '--prefix' option to 'configure', and then install it with 'make
  31587. install'.
  31588. 
  31589. File: gdb.info, Node: Separate Objdir, Next: Config Names, Prev: Running Configure, Up: Installing GDB
  31590. C.3 Compiling GDB in Another Directory
  31591. ======================================
  31592. If you want to run GDB versions for several host or target machines, you
  31593. need a different 'gdb' compiled for each combination of host and target.
  31594. 'configure' is designed to make this easy by allowing you to generate
  31595. each configuration in a separate subdirectory, rather than in the source
  31596. directory. If your 'make' program handles the 'VPATH' feature (GNU
  31597. 'make' does), running 'make' in each of these directories builds the
  31598. 'gdb' program specified there.
  31599. To build 'gdb' in a separate directory, run 'configure' with the
  31600. '--srcdir' option to specify where to find the source. (You also need
  31601. to specify a path to find 'configure' itself from your working
  31602. directory. If the path to 'configure' would be the same as the argument
  31603. to '--srcdir', you can leave out the '--srcdir' option; it is assumed.)
  31604. For example, with version 8.3.1.20191204-git, you can build GDB in a
  31605. separate directory for a Sun 4 like this:
  31606. cd gdb-8.3.1.20191204-git
  31607. mkdir ../gdb-sun4
  31608. cd ../gdb-sun4
  31609. ../gdb-8.3.1.20191204-git/configure
  31610. make
  31611. When 'configure' builds a configuration using a remote source
  31612. directory, it creates a tree for the binaries with the same structure
  31613. (and using the same names) as the tree under the source directory. In
  31614. the example, you'd find the Sun 4 library 'libiberty.a' in the directory
  31615. 'gdb-sun4/libiberty', and GDB itself in 'gdb-sun4/gdb'.
  31616. Make sure that your path to the 'configure' script has just one
  31617. instance of 'gdb' in it. If your path to 'configure' looks like
  31618. '../gdb-8.3.1.20191204-git/gdb/configure', you are configuring only one
  31619. subdirectory of GDB, not the whole package. This leads to build errors
  31620. about missing include files such as 'bfd/bfd.h'.
  31621. One popular reason to build several GDB configurations in separate
  31622. directories is to configure GDB for cross-compiling (where GDB runs on
  31623. one machine--the "host"--while debugging programs that run on another
  31624. machine--the "target"). You specify a cross-debugging target by giving
  31625. the '--target=TARGET' option to 'configure'.
  31626. When you run 'make' to build a program or library, you must run it in
  31627. a configured directory--whatever directory you were in when you called
  31628. 'configure' (or one of its subdirectories).
  31629. The 'Makefile' that 'configure' generates in each source directory
  31630. also runs recursively. If you type 'make' in a source directory such as
  31631. 'gdb-8.3.1.20191204-git' (or in a separate configured directory
  31632. configured with '--srcdir=DIRNAME/gdb-8.3.1.20191204-git'), you will
  31633. build all the required libraries, and then build GDB.
  31634. When you have multiple hosts or targets configured in separate
  31635. directories, you can run 'make' on them in parallel (for example, if
  31636. they are NFS-mounted on each of the hosts); they will not interfere with
  31637. each other.
  31638. 
  31639. File: gdb.info, Node: Config Names, Next: Configure Options, Prev: Separate Objdir, Up: Installing GDB
  31640. C.4 Specifying Names for Hosts and Targets
  31641. ==========================================
  31642. The specifications used for hosts and targets in the 'configure' script
  31643. are based on a three-part naming scheme, but some short predefined
  31644. aliases are also supported. The full naming scheme encodes three pieces
  31645. of information in the following pattern:
  31646. ARCHITECTURE-VENDOR-OS
  31647. For example, you can use the alias 'sun4' as a HOST argument, or as
  31648. the value for TARGET in a '--target=TARGET' option. The equivalent full
  31649. name is 'sparc-sun-sunos4'.
  31650. The 'configure' script accompanying GDB does not provide any query
  31651. facility to list all supported host and target names or aliases.
  31652. 'configure' calls the Bourne shell script 'config.sub' to map
  31653. abbreviations to full names; you can read the script, if you wish, or
  31654. you can use it to test your guesses on abbreviations--for example:
  31655. % sh config.sub i386-linux
  31656. i386-pc-linux-gnu
  31657. % sh config.sub alpha-linux
  31658. alpha-unknown-linux-gnu
  31659. % sh config.sub hp9k700
  31660. hppa1.1-hp-hpux
  31661. % sh config.sub sun4
  31662. sparc-sun-sunos4.1.1
  31663. % sh config.sub sun3
  31664. m68k-sun-sunos4.1.1
  31665. % sh config.sub i986v
  31666. Invalid configuration `i986v': machine `i986v' not recognized
  31667. 'config.sub' is also distributed in the GDB source directory
  31668. ('gdb-8.3.1.20191204-git', for version 8.3.1.20191204-git).
  31669. 
  31670. File: gdb.info, Node: Configure Options, Next: System-wide configuration, Prev: Config Names, Up: Installing GDB
  31671. C.5 'configure' Options
  31672. =======================
  31673. Here is a summary of the 'configure' options and arguments that are most
  31674. often useful for building GDB. 'configure' also has several other
  31675. options not listed here. *note (autoconf.info)Running configure
  31676. scripts::, for a full explanation of 'configure'.
  31677. configure [--help]
  31678. [--prefix=DIR]
  31679. [--exec-prefix=DIR]
  31680. [--srcdir=DIRNAME]
  31681. [--target=TARGET]
  31682. You may introduce options with a single '-' rather than '--' if you
  31683. prefer; but you may abbreviate option names if you use '--'.
  31684. '--help'
  31685. Display a quick summary of how to invoke 'configure'.
  31686. '--prefix=DIR'
  31687. Configure the source to install programs and files under directory
  31688. 'DIR'.
  31689. '--exec-prefix=DIR'
  31690. Configure the source to install programs under directory 'DIR'.
  31691. '--srcdir=DIRNAME'
  31692. Use this option to make configurations in directories separate from
  31693. the GDB source directories. Among other things, you can use this
  31694. to build (or maintain) several configurations simultaneously, in
  31695. separate directories. 'configure' writes configuration-specific
  31696. files in the current directory, but arranges for them to use the
  31697. source in the directory DIRNAME. 'configure' creates directories
  31698. under the working directory in parallel to the source directories
  31699. below DIRNAME.
  31700. '--target=TARGET'
  31701. Configure GDB for cross-debugging programs running on the specified
  31702. TARGET. Without this option, GDB is configured to debug programs
  31703. that run on the same machine (HOST) as GDB itself.
  31704. There is no convenient way to generate a list of all available
  31705. targets. Also see the '--enable-targets' option, below.
  31706. There are many other options that are specific to GDB. This lists
  31707. just the most common ones; there are some very specialized options not
  31708. described here.
  31709. '--enable-targets=[TARGET]...'
  31710. '--enable-targets=all'
  31711. Configure GDB for cross-debugging programs running on the specified
  31712. list of targets. The special value 'all' configures GDB for
  31713. debugging programs running on any target it supports.
  31714. '--with-gdb-datadir=PATH'
  31715. Set the GDB-specific data directory. GDB will look here for
  31716. certain supporting files or scripts. This defaults to the 'gdb'
  31717. subdirectory of 'datadi' (which can be set using '--datadir').
  31718. '--with-relocated-sources=DIR'
  31719. Sets up the default source path substitution rule so that directory
  31720. names recorded in debug information will be automatically adjusted
  31721. for any directory under DIR. DIR should be a subdirectory of GDB's
  31722. configured prefix, the one mentioned in the '--prefix' or
  31723. '--exec-prefix' options to configure. This option is useful if GDB
  31724. is supposed to be moved to a different place after it is built.
  31725. '--enable-64-bit-bfd'
  31726. Enable 64-bit support in BFD on 32-bit hosts.
  31727. '--disable-gdbmi'
  31728. Build GDB without the GDB/MI machine interface (*note GDB/MI::).
  31729. '--enable-tui'
  31730. Build GDB with the text-mode full-screen user interface (TUI).
  31731. Requires a curses library (ncurses and cursesX are also supported).
  31732. '--with-curses'
  31733. Use the curses library instead of the termcap library, for
  31734. text-mode terminal operations.
  31735. '--with-libunwind-ia64'
  31736. Use the libunwind library for unwinding function call stack on ia64
  31737. target platforms. See http://www.nongnu.org/libunwind/index.html
  31738. for details.
  31739. '--with-system-readline'
  31740. Use the readline library installed on the host, rather than the
  31741. library supplied as part of GDB.
  31742. '--with-system-zlib'
  31743. Use the zlib library installed on the host, rather than the library
  31744. supplied as part of GDB.
  31745. '--with-expat'
  31746. Build GDB with Expat, a library for XML parsing. (Done by default
  31747. if libexpat is installed and found at configure time.) This
  31748. library is used to read XML files supplied with GDB. If it is
  31749. unavailable, some features, such as remote protocol memory maps,
  31750. target descriptions, and shared library lists, that are based on
  31751. XML files, will not be available in GDB. If your host does not
  31752. have libexpat installed, you can get the latest version from
  31753. 'http://expat.sourceforge.net'.
  31754. '--with-libiconv-prefix[=DIR]'
  31755. Build GDB with GNU libiconv, a character set encoding conversion
  31756. library. This is not done by default, as on GNU systems the
  31757. 'iconv' that is built in to the C library is sufficient. If your
  31758. host does not have a working 'iconv', you can get the latest
  31759. version of GNU iconv from 'https://www.gnu.org/software/libiconv/'.
  31760. GDB's build system also supports building GNU libiconv as part of
  31761. the overall build. *Note Requirements::.
  31762. '--with-lzma'
  31763. Build GDB with LZMA, a compression library. (Done by default if
  31764. liblzma is installed and found at configure time.) LZMA is used by
  31765. GDB's "mini debuginfo" feature, which is only useful on platforms
  31766. using the ELF object file format. If your host does not have
  31767. liblzma installed, you can get the latest version from
  31768. 'https://tukaani.org/xz/'.
  31769. '--with-mpfr'
  31770. Build GDB with GNU MPFR, a library for multiple-precision
  31771. floating-point computation with correct rounding. (Done by default
  31772. if GNU MPFR is installed and found at configure time.) This
  31773. library is used to emulate target floating-point arithmetic during
  31774. expression evaluation when the target uses different floating-point
  31775. formats than the host. If GNU MPFR is not available, GDB will fall
  31776. back to using host floating-point arithmetic. If your host does
  31777. not have GNU MPFR installed, you can get the latest version from
  31778. 'http://www.mpfr.org'.
  31779. '--with-python[=PYTHON]'
  31780. Build GDB with Python scripting support. (Done by default if
  31781. libpython is present and found at configure time.) Python makes
  31782. GDB scripting much more powerful than the restricted CLI scripting
  31783. language. If your host does not have Python installed, you can
  31784. find it on 'http://www.python.org/download/'. The oldest version
  31785. of Python supported by GDB is 2.6. The optional argument PYTHON is
  31786. used to find the Python headers and libraries. It can be either
  31787. the name of a Python executable, or the name of the directory in
  31788. which Python is installed.
  31789. '--with-guile[=GUILE]''
  31790. Build GDB with GNU Guile scripting support. (Done by default if
  31791. libguile is present and found at configure time.) If your host
  31792. does not have Guile installed, you can find it at
  31793. 'https://www.gnu.org/software/guile/'. The optional argument GUILE
  31794. can be a version number, which will cause 'configure' to try to use
  31795. that version of Guile; or the file name of a 'pkg-config'
  31796. executable, which will be queried to find the information needed to
  31797. compile and link against Guile.
  31798. '--without-included-regex'
  31799. Don't use the regex library included with GDB (as part of the
  31800. libiberty library). This is the default on hosts with version 2 of
  31801. the GNU C library.
  31802. '--with-sysroot=DIR'
  31803. Use DIR as the default system root directory for libraries whose
  31804. file names begin with '/lib'' or '/usr/lib''. (The value of DIR
  31805. can be modified at run time by using the 'set sysroot' command.)
  31806. If DIR is under the GDB configured prefix (set with '--prefix' or
  31807. '--exec-prefix options', the default system root will be
  31808. automatically adjusted if and when GDB is moved to a different
  31809. location.
  31810. '--with-system-gdbinit=FILE'
  31811. Configure GDB to automatically load a system-wide init file. FILE
  31812. should be an absolute file name. If FILE is in a directory under
  31813. the configured prefix, and GDB is moved to another location after
  31814. being built, the location of the system-wide init file will be
  31815. adjusted accordingly.
  31816. '--enable-build-warnings'
  31817. When building the GDB sources, ask the compiler to warn about any
  31818. code which looks even vaguely suspicious. It passes many different
  31819. warning flags, depending on the exact version of the compiler you
  31820. are using.
  31821. '--enable-werror'
  31822. Treat compiler warnings as werrors. It adds the '-Werror' flag to
  31823. the compiler, which will fail the compilation if the compiler
  31824. outputs any warning messages.
  31825. '--enable-ubsan'
  31826. Enable the GCC undefined behavior sanitizer. This is disabled by
  31827. default, but passing '--enable-ubsan=yes' or '--enable-ubsan=auto'
  31828. to 'configure' will enable it. The undefined behavior sanitizer
  31829. checks for C++ undefined behavior. It has a performance cost, so
  31830. if you are looking at GDB's performance, you should disable it.
  31831. The undefined behavior sanitizer was first introduced in GCC 4.9.
  31832. 
  31833. File: gdb.info, Node: System-wide configuration, Prev: Configure Options, Up: Installing GDB
  31834. C.6 System-wide configuration and settings
  31835. ==========================================
  31836. GDB can be configured to have a system-wide init file; this file will be
  31837. read and executed at startup (*note What GDB does during startup:
  31838. Startup.).
  31839. Here is the corresponding configure option:
  31840. '--with-system-gdbinit=FILE'
  31841. Specify that the default location of the system-wide init file is
  31842. FILE.
  31843. If GDB has been configured with the option '--prefix=$prefix', it may
  31844. be subject to relocation. Two possible cases:
  31845. * If the default location of this init file contains '$prefix', it
  31846. will be subject to relocation. Suppose that the configure options
  31847. are '--prefix=$prefix --with-system-gdbinit=$prefix/etc/gdbinit';
  31848. if GDB is moved from '$prefix' to '$install', the system init file
  31849. is looked for as '$install/etc/gdbinit' instead of
  31850. '$prefix/etc/gdbinit'.
  31851. * By contrast, if the default location does not contain the prefix,
  31852. it will not be relocated. E.g. if GDB has been configured with
  31853. '--prefix=/usr/local --with-system-gdbinit=/usr/share/gdb/gdbinit',
  31854. then GDB will always look for '/usr/share/gdb/gdbinit', wherever
  31855. GDB is installed.
  31856. If the configured location of the system-wide init file (as given by
  31857. the '--with-system-gdbinit' option at configure time) is in the
  31858. data-directory (as specified by '--with-gdb-datadir' at configure time)
  31859. or in one of its subdirectories, then GDB will look for the system-wide
  31860. init file in the directory specified by the '--data-directory'
  31861. command-line option. Note that the system-wide init file is only read
  31862. once, during GDB initialization. If the data-directory is changed after
  31863. GDB has started with the 'set data-directory' command, the file will not
  31864. be reread.
  31865. * Menu:
  31866. * System-wide Configuration Scripts:: Installed System-wide Configuration Scripts
  31867. 
  31868. File: gdb.info, Node: System-wide Configuration Scripts, Up: System-wide configuration
  31869. C.6.1 Installed System-wide Configuration Scripts
  31870. -------------------------------------------------
  31871. The 'system-gdbinit' directory, located inside the data-directory (as
  31872. specified by '--with-gdb-datadir' at configure time) contains a number
  31873. of scripts which can be used as system-wide init files. To
  31874. automatically source those scripts at startup, GDB should be configured
  31875. with '--with-system-gdbinit'. Otherwise, any user should be able to
  31876. source them by hand as needed.
  31877. The following scripts are currently available:
  31878. * 'elinos.py' This script is useful when debugging a program on an
  31879. ELinOS target. It takes advantage of the environment variables
  31880. defined in a standard ELinOS environment in order to determine the
  31881. location of the system shared libraries, and then sets the
  31882. 'solib-absolute-prefix' and 'solib-search-path' variables
  31883. appropriately.
  31884. * 'wrs-linux.py' This script is useful when debugging a program on a
  31885. target running Wind River Linux. It expects the 'ENV_PREFIX' to be
  31886. set to the host-side sysroot used by the target system.
  31887. 
  31888. File: gdb.info, Node: Maintenance Commands, Next: Remote Protocol, Prev: Installing GDB, Up: Top
  31889. Appendix D Maintenance Commands
  31890. *******************************
  31891. In addition to commands intended for GDB users, GDB includes a number of
  31892. commands intended for GDB developers, that are not documented elsewhere
  31893. in this manual. These commands are provided here for reference. (For
  31894. commands that turn on debugging messages, see *note Debugging Output::.)
  31895. 'maint agent [-at LOCATION,] EXPRESSION'
  31896. 'maint agent-eval [-at LOCATION,] EXPRESSION'
  31897. Translate the given EXPRESSION into remote agent bytecodes. This
  31898. command is useful for debugging the Agent Expression mechanism
  31899. (*note Agent Expressions::). The 'agent' version produces an
  31900. expression useful for data collection, such as by tracepoints,
  31901. while 'maint agent-eval' produces an expression that evaluates
  31902. directly to a result. For instance, a collection expression for
  31903. 'globa + globb' will include bytecodes to record four bytes of
  31904. memory at each of the addresses of 'globa' and 'globb', while
  31905. discarding the result of the addition, while an evaluation
  31906. expression will do the addition and return the sum. If '-at' is
  31907. given, generate remote agent bytecode for LOCATION. If not,
  31908. generate remote agent bytecode for current frame PC address.
  31909. 'maint agent-printf FORMAT,EXPR,...'
  31910. Translate the given format string and list of argument expressions
  31911. into remote agent bytecodes and display them as a disassembled
  31912. list. This command is useful for debugging the agent version of
  31913. dynamic printf (*note Dynamic Printf::).
  31914. 'maint info breakpoints'
  31915. Using the same format as 'info breakpoints', display both the
  31916. breakpoints you've set explicitly, and those GDB is using for
  31917. internal purposes. Internal breakpoints are shown with negative
  31918. breakpoint numbers. The type column identifies what kind of
  31919. breakpoint is shown:
  31920. 'breakpoint'
  31921. Normal, explicitly set breakpoint.
  31922. 'watchpoint'
  31923. Normal, explicitly set watchpoint.
  31924. 'longjmp'
  31925. Internal breakpoint, used to handle correctly stepping through
  31926. 'longjmp' calls.
  31927. 'longjmp resume'
  31928. Internal breakpoint at the target of a 'longjmp'.
  31929. 'until'
  31930. Temporary internal breakpoint used by the GDB 'until' command.
  31931. 'finish'
  31932. Temporary internal breakpoint used by the GDB 'finish'
  31933. command.
  31934. 'shlib events'
  31935. Shared library events.
  31936. 'maint info btrace'
  31937. Pint information about raw branch tracing data.
  31938. 'maint btrace packet-history'
  31939. Print the raw branch trace packets that are used to compute the
  31940. execution history for the 'record btrace' command. Both the
  31941. information and the format in which it is printed depend on the
  31942. btrace recording format.
  31943. 'bts'
  31944. For the BTS recording format, print a list of blocks of
  31945. sequential code. For each block, the following information is
  31946. printed:
  31947. Block number
  31948. Newer blocks have higher numbers. The oldest block has
  31949. number zero.
  31950. Lowest 'PC'
  31951. Highest 'PC'
  31952. 'pt'
  31953. For the Intel Processor Trace recording format, print a list
  31954. of Intel Processor Trace packets. For each packet, the
  31955. following information is printed:
  31956. Packet number
  31957. Newer packets have higher numbers. The oldest packet has
  31958. number zero.
  31959. Trace offset
  31960. The packet's offset in the trace stream.
  31961. Packet opcode and payload
  31962. 'maint btrace clear-packet-history'
  31963. Discards the cached packet history printed by the 'maint btrace
  31964. packet-history' command. The history will be computed again when
  31965. needed.
  31966. 'maint btrace clear'
  31967. Discard the branch trace data. The data will be fetched anew and
  31968. the branch trace will be recomputed when needed.
  31969. This implicitly truncates the branch trace to a single branch trace
  31970. buffer. When updating branch trace incrementally, the branch trace
  31971. available to GDB may be bigger than a single branch trace buffer.
  31972. 'maint set btrace pt skip-pad'
  31973. 'maint show btrace pt skip-pad'
  31974. Control whether GDB will skip PAD packets when computing the packet
  31975. history.
  31976. 'set displaced-stepping'
  31977. 'show displaced-stepping'
  31978. Control whether or not GDB will do "displaced stepping" if the
  31979. target supports it. Displaced stepping is a way to single-step
  31980. over breakpoints without removing them from the inferior, by
  31981. executing an out-of-line copy of the instruction that was
  31982. originally at the breakpoint location. It is also known as
  31983. out-of-line single-stepping.
  31984. 'set displaced-stepping on'
  31985. If the target architecture supports it, GDB will use displaced
  31986. stepping to step over breakpoints.
  31987. 'set displaced-stepping off'
  31988. GDB will not use displaced stepping to step over breakpoints,
  31989. even if such is supported by the target architecture.
  31990. 'set displaced-stepping auto'
  31991. This is the default mode. GDB will use displaced stepping
  31992. only if non-stop mode is active (*note Non-Stop Mode::) and
  31993. the target architecture supports displaced stepping.
  31994. 'maint check-psymtabs'
  31995. Check the consistency of currently expanded psymtabs versus
  31996. symtabs. Use this to check, for example, whether a symbol is in
  31997. one but not the other.
  31998. 'maint check-symtabs'
  31999. Check the consistency of currently expanded symtabs.
  32000. 'maint expand-symtabs [REGEXP]'
  32001. Expand symbol tables. If REGEXP is specified, only expand symbol
  32002. tables for file names matching REGEXP.
  32003. 'maint set catch-demangler-crashes [on|off]'
  32004. 'maint show catch-demangler-crashes'
  32005. Control whether GDB should attempt to catch crashes in the symbol
  32006. name demangler. The default is to attempt to catch crashes. If
  32007. enabled, the first time a crash is caught, a core file is created,
  32008. the offending symbol is displayed and the user is presented with
  32009. the option to terminate the current session.
  32010. 'maint cplus first_component NAME'
  32011. Print the first C++ class/namespace component of NAME.
  32012. 'maint cplus namespace'
  32013. Print the list of possible C++ namespaces.
  32014. 'maint deprecate COMMAND [REPLACEMENT]'
  32015. 'maint undeprecate COMMAND'
  32016. Deprecate or undeprecate the named COMMAND. Deprecated commands
  32017. cause GDB to issue a warning when you use them. The optional
  32018. argument REPLACEMENT says which newer command should be used in
  32019. favor of the deprecated one; if it is given, GDB will mention the
  32020. replacement as part of the warning.
  32021. 'maint dump-me'
  32022. Cause a fatal signal in the debugger and force it to dump its core.
  32023. This is supported only on systems which support aborting a program
  32024. with the 'SIGQUIT' signal.
  32025. 'maint internal-error [MESSAGE-TEXT]'
  32026. 'maint internal-warning [MESSAGE-TEXT]'
  32027. 'maint demangler-warning [MESSAGE-TEXT]'
  32028. Cause GDB to call the internal function 'internal_error',
  32029. 'internal_warning' or 'demangler_warning' and hence behave as
  32030. though an internal problem has been detected. In addition to
  32031. reporting the internal problem, these functions give the user the
  32032. opportunity to either quit GDB or (for 'internal_error' and
  32033. 'internal_warning') create a core file of the current GDB session.
  32034. These commands take an optional parameter MESSAGE-TEXT that is used
  32035. as the text of the error or warning message.
  32036. Here's an example of using 'internal-error':
  32037. (gdb) maint internal-error testing, 1, 2
  32038. .../maint.c:121: internal-error: testing, 1, 2
  32039. A problem internal to GDB has been detected. Further
  32040. debugging may prove unreliable.
  32041. Quit this debugging session? (y or n) n
  32042. Create a core file? (y or n) n
  32043. (gdb)
  32044. 'maint set internal-error ACTION [ask|yes|no]'
  32045. 'maint show internal-error ACTION'
  32046. 'maint set internal-warning ACTION [ask|yes|no]'
  32047. 'maint show internal-warning ACTION'
  32048. 'maint set demangler-warning ACTION [ask|yes|no]'
  32049. 'maint show demangler-warning ACTION'
  32050. When GDB reports an internal problem (error or warning) it gives
  32051. the user the opportunity to both quit GDB and create a core file of
  32052. the current GDB session. These commands let you override the
  32053. default behaviour for each particular ACTION, described in the
  32054. table below.
  32055. 'quit'
  32056. You can specify that GDB should always (yes) or never (no)
  32057. quit. The default is to ask the user what to do.
  32058. 'corefile'
  32059. You can specify that GDB should always (yes) or never (no)
  32060. create a core file. The default is to ask the user what to
  32061. do. Note that there is no 'corefile' option for
  32062. 'demangler-warning': demangler warnings always create a core
  32063. file and this cannot be disabled.
  32064. 'maint packet TEXT'
  32065. If GDB is talking to an inferior via the serial protocol, then this
  32066. command sends the string TEXT to the inferior, and displays the
  32067. response packet. GDB supplies the initial '$' character, the
  32068. terminating '#' character, and the checksum.
  32069. 'maint print architecture [FILE]'
  32070. Print the entire architecture configuration. The optional argument
  32071. FILE names the file where the output goes.
  32072. 'maint print c-tdesc'
  32073. Print the target description (*note Target Descriptions::) as a C
  32074. source file. By default, the target description is for the current
  32075. target, but if the optional argument FILE is provided, that file is
  32076. used to produce the description. The FILE should be an XML
  32077. document, of the form described in *note Target Description
  32078. Format::. The created source file is built into GDB when GDB is
  32079. built again. This command is used by developers after they add or
  32080. modify XML target descriptions.
  32081. 'maint check xml-descriptions DIR'
  32082. Check that the target descriptions dynamically created by GDB equal
  32083. the descriptions created from XML files found in DIR.
  32084. 'maint check libthread-db'
  32085. Run integrity checks on the current inferior's thread debugging
  32086. library. This exercises all 'libthread_db' functionality used by
  32087. GDB on GNU/Linux systems, and by extension also exercises the
  32088. 'proc_service' functions provided by GDB that 'libthread_db' uses.
  32089. Note that parts of the test may be skipped on some platforms when
  32090. debugging core files.
  32091. 'maint print dummy-frames'
  32092. Prints the contents of GDB's internal dummy-frame stack.
  32093. (gdb) b add
  32094. ...
  32095. (gdb) print add(2,3)
  32096. Breakpoint 2, add (a=2, b=3) at ...
  32097. 58 return (a + b);
  32098. The program being debugged stopped while in a function called from GDB.
  32099. ...
  32100. (gdb) maint print dummy-frames
  32101. 0xa8206d8: id={stack=0xbfffe734,code=0xbfffe73f,!special}, ptid=process 9353
  32102. (gdb)
  32103. Takes an optional file parameter.
  32104. 'maint print registers [FILE]'
  32105. 'maint print raw-registers [FILE]'
  32106. 'maint print cooked-registers [FILE]'
  32107. 'maint print register-groups [FILE]'
  32108. 'maint print remote-registers [FILE]'
  32109. Print GDB's internal register data structures.
  32110. The command 'maint print raw-registers' includes the contents of
  32111. the raw register cache; the command 'maint print cooked-registers'
  32112. includes the (cooked) value of all registers, including registers
  32113. which aren't available on the target nor visible to user; the
  32114. command 'maint print register-groups' includes the groups that each
  32115. register is a member of; and the command 'maint print
  32116. remote-registers' includes the remote target's register numbers and
  32117. offsets in the 'G' packets.
  32118. These commands take an optional parameter, a file name to which to
  32119. write the information.
  32120. 'maint print reggroups [FILE]'
  32121. Print GDB's internal register group data structures. The optional
  32122. argument FILE tells to what file to write the information.
  32123. The register groups info looks like this:
  32124. (gdb) maint print reggroups
  32125. Group Type
  32126. general user
  32127. float user
  32128. all user
  32129. vector user
  32130. system user
  32131. save internal
  32132. restore internal
  32133. 'flushregs'
  32134. This command forces GDB to flush its internal register cache.
  32135. 'maint print objfiles [REGEXP]'
  32136. Print a dump of all known object files. If REGEXP is specified,
  32137. only print object files whose names match REGEXP. For each object
  32138. file, this command prints its name, address in memory, and all of
  32139. its psymtabs and symtabs.
  32140. 'maint print user-registers'
  32141. List all currently available "user registers". User registers
  32142. typically provide alternate names for actual hardware registers.
  32143. They include the four "standard" registers '$fp', '$pc', '$sp', and
  32144. '$ps'. *Note standard registers::. User registers can be used in
  32145. expressions in the same way as the canonical register names, but
  32146. only the latter are listed by the 'info registers' and 'maint print
  32147. registers' commands.
  32148. 'maint print section-scripts [REGEXP]'
  32149. Print a dump of scripts specified in the '.debug_gdb_section'
  32150. section. If REGEXP is specified, only print scripts loaded by
  32151. object files matching REGEXP. For each script, this command prints
  32152. its name as specified in the objfile, and the full path if known.
  32153. *Note dotdebug_gdb_scripts section::.
  32154. 'maint print statistics'
  32155. This command prints, for each object file in the program, various
  32156. data about that object file followed by the byte cache ("bcache")
  32157. statistics for the object file. The objfile data includes the
  32158. number of minimal, partial, full, and stabs symbols, the number of
  32159. types defined by the objfile, the number of as yet unexpanded psym
  32160. tables, the number of line tables and string tables, and the amount
  32161. of memory used by the various tables. The bcache statistics
  32162. include the counts, sizes, and counts of duplicates of all and
  32163. unique objects, max, average, and median entry size, total memory
  32164. used and its overhead and savings, and various measures of the hash
  32165. table size and chain lengths.
  32166. 'maint print target-stack'
  32167. A "target" is an interface between the debugger and a particular
  32168. kind of file or process. Targets can be stacked in "strata", so
  32169. that more than one target can potentially respond to a request. In
  32170. particular, memory accesses will walk down the stack of targets
  32171. until they find a target that is interested in handling that
  32172. particular address.
  32173. This command prints a short description of each layer that was
  32174. pushed on the "target stack", starting from the top layer down to
  32175. the bottom one.
  32176. 'maint print type EXPR'
  32177. Print the type chain for a type specified by EXPR. The argument
  32178. can be either a type name or a symbol. If it is a symbol, the type
  32179. of that symbol is described. The type chain produced by this
  32180. command is a recursive definition of the data type as stored in
  32181. GDB's data structures, including its flags and contained types.
  32182. 'maint selftest [FILTER]'
  32183. Run any self tests that were compiled in to GDB. This will print a
  32184. message showing how many tests were run, and how many failed. If a
  32185. FILTER is passed, only the tests with FILTER in their name will by
  32186. ran.
  32187. 'maint info selftests'
  32188. List the selftests compiled in to GDB.
  32189. 'maint set dwarf always-disassemble'
  32190. 'maint show dwarf always-disassemble'
  32191. Control the behavior of 'info address' when using DWARF debugging
  32192. information.
  32193. The default is 'off', which means that GDB should try to describe a
  32194. variable's location in an easily readable format. When 'on', GDB
  32195. will instead display the DWARF location expression in an
  32196. assembly-like format. Note that some locations are too complex for
  32197. GDB to describe simply; in this case you will always see the
  32198. disassembly form.
  32199. Here is an example of the resulting disassembly:
  32200. (gdb) info addr argc
  32201. Symbol "argc" is a complex DWARF expression:
  32202. 1: DW_OP_fbreg 0
  32203. For more information on these expressions, see the DWARF standard
  32204. (http://www.dwarfstd.org/).
  32205. 'maint set dwarf max-cache-age'
  32206. 'maint show dwarf max-cache-age'
  32207. Control the DWARF compilation unit cache.
  32208. In object files with inter-compilation-unit references, such as
  32209. those produced by the GCC option '-feliminate-dwarf2-dups', the
  32210. DWARF reader needs to frequently refer to previously read
  32211. compilation units. This setting controls how long a compilation
  32212. unit will remain in the cache if it is not referenced. A higher
  32213. limit means that cached compilation units will be stored in memory
  32214. longer, and more total memory will be used. Setting it to zero
  32215. disables caching, which will slow down GDB startup, but reduce
  32216. memory consumption.
  32217. 'maint set dwarf unwinders'
  32218. 'maint show dwarf unwinders'
  32219. Control use of the DWARF frame unwinders.
  32220. Many targets that support DWARF debugging use GDB's DWARF frame
  32221. unwinders to build the backtrace. Many of these targets will also
  32222. have a second mechanism for building the backtrace for use in cases
  32223. where DWARF information is not available, this second mechanism is
  32224. often an analysis of a function's prologue.
  32225. In order to extend testing coverage of the second level stack
  32226. unwinding mechanisms it is helpful to be able to disable the DWARF
  32227. stack unwinders, this can be done with this switch.
  32228. In normal use of GDB disabling the DWARF unwinders is not
  32229. advisable, there are cases that are better handled through DWARF
  32230. than prologue analysis, and the debug experience is likely to be
  32231. better with the DWARF frame unwinders enabled.
  32232. If DWARF frame unwinders are not supported for a particular target
  32233. architecture, then enabling this flag does not cause them to be
  32234. used.
  32235. 'maint set profile'
  32236. 'maint show profile'
  32237. Control profiling of GDB.
  32238. Profiling will be disabled until you use the 'maint set profile'
  32239. command to enable it. When you enable profiling, the system will
  32240. begin collecting timing and execution count data; when you disable
  32241. profiling or exit GDB, the results will be written to a log file.
  32242. Remember that if you use profiling, GDB will overwrite the
  32243. profiling log file (often called 'gmon.out'). If you have a record
  32244. of important profiling data in a 'gmon.out' file, be sure to move
  32245. it to a safe location.
  32246. Configuring with '--enable-profiling' arranges for GDB to be
  32247. compiled with the '-pg' compiler option.
  32248. 'maint set show-debug-regs'
  32249. 'maint show show-debug-regs'
  32250. Control whether to show variables that mirror the hardware debug
  32251. registers. Use 'on' to enable, 'off' to disable. If enabled, the
  32252. debug registers values are shown when GDB inserts or removes a
  32253. hardware breakpoint or watchpoint, and when the inferior triggers a
  32254. hardware-assisted breakpoint or watchpoint.
  32255. 'maint set show-all-tib'
  32256. 'maint show show-all-tib'
  32257. Control whether to show all non zero areas within a 1k block
  32258. starting at thread local base, when using the 'info w32
  32259. thread-information-block' command.
  32260. 'maint set target-async'
  32261. 'maint show target-async'
  32262. This controls whether GDB targets operate in synchronous or
  32263. asynchronous mode (*note Background Execution::). Normally the
  32264. default is asynchronous, if it is available; but this can be
  32265. changed to more easily debug problems occurring only in synchronous
  32266. mode.
  32267. 'maint set target-non-stop'
  32268. 'maint show target-non-stop'
  32269. This controls whether GDB targets always operate in non-stop mode
  32270. even if 'set non-stop' is 'off' (*note Non-Stop Mode::). The
  32271. default is 'auto', meaning non-stop mode is enabled if supported by
  32272. the target.
  32273. 'maint set target-non-stop auto'
  32274. This is the default mode. GDB controls the target in non-stop
  32275. mode if the target supports it.
  32276. 'maint set target-non-stop on'
  32277. GDB controls the target in non-stop mode even if the target
  32278. does not indicate support.
  32279. 'maint set target-non-stop off'
  32280. GDB does not control the target in non-stop mode even if the
  32281. target supports it.
  32282. 'maint set per-command'
  32283. 'maint show per-command'
  32284. GDB can display the resources used by each command. This is useful
  32285. in debugging performance problems.
  32286. 'maint set per-command space [on|off]'
  32287. 'maint show per-command space'
  32288. Enable or disable the printing of the memory used by GDB for
  32289. each command. If enabled, GDB will display how much memory
  32290. each command took, following the command's own output. This
  32291. can also be requested by invoking GDB with the '--statistics'
  32292. command-line switch (*note Mode Options::).
  32293. 'maint set per-command time [on|off]'
  32294. 'maint show per-command time'
  32295. Enable or disable the printing of the execution time of GDB
  32296. for each command. If enabled, GDB will display how much time
  32297. it took to execute each command, following the command's own
  32298. output. Both CPU time and wallclock time are printed.
  32299. Printing both is useful when trying to determine whether the
  32300. cost is CPU or, e.g., disk/network latency. Note that the CPU
  32301. time printed is for GDB only, it does not include the
  32302. execution time of the inferior because there's no mechanism
  32303. currently to compute how much time was spent by GDB and how
  32304. much time was spent by the program been debugged. This can
  32305. also be requested by invoking GDB with the '--statistics'
  32306. command-line switch (*note Mode Options::).
  32307. 'maint set per-command symtab [on|off]'
  32308. 'maint show per-command symtab'
  32309. Enable or disable the printing of basic symbol table
  32310. statistics for each command. If enabled, GDB will display the
  32311. following information:
  32312. a. number of symbol tables
  32313. b. number of primary symbol tables
  32314. c. number of blocks in the blockvector
  32315. 'maint set check-libthread-db [on|off]'
  32316. 'maint show check-libthread-db'
  32317. Control whether GDB should run integrity checks on inferior
  32318. specific thread debugging libraries as they are loaded. The
  32319. default is not to perform such checks. If any check fails GDB will
  32320. unload the library and continue searching for a suitable candidate
  32321. as described in *note set libthread-db-search-path::. For more
  32322. information about the tests, see *note maint check libthread-db::.
  32323. 'maint space VALUE'
  32324. An alias for 'maint set per-command space'. A non-zero value
  32325. enables it, zero disables it.
  32326. 'maint time VALUE'
  32327. An alias for 'maint set per-command time'. A non-zero value
  32328. enables it, zero disables it.
  32329. 'maint translate-address [SECTION] ADDR'
  32330. Find the symbol stored at the location specified by the address
  32331. ADDR and an optional section name SECTION. If found, GDB prints
  32332. the name of the closest symbol and an offset from the symbol's
  32333. location to the specified address. This is similar to the 'info
  32334. address' command (*note Symbols::), except that this command also
  32335. allows to find symbols in other sections.
  32336. If section was not specified, the section in which the symbol was
  32337. found is also printed. For dynamically linked executables, the
  32338. name of executable or shared library containing the symbol is
  32339. printed as well.
  32340. The following command is useful for non-interactive invocations of
  32341. GDB, such as in the test suite.
  32342. 'set watchdog NSEC'
  32343. Set the maximum number of seconds GDB will wait for the target
  32344. operation to finish. If this time expires, GDB reports and error
  32345. and the command is aborted.
  32346. 'show watchdog'
  32347. Show the current setting of the target wait timeout.
  32348. 
  32349. File: gdb.info, Node: Remote Protocol, Next: Agent Expressions, Prev: Maintenance Commands, Up: Top
  32350. Appendix E GDB Remote Serial Protocol
  32351. *************************************
  32352. * Menu:
  32353. * Overview::
  32354. * Packets::
  32355. * Stop Reply Packets::
  32356. * General Query Packets::
  32357. * Architecture-Specific Protocol Details::
  32358. * Tracepoint Packets::
  32359. * Host I/O Packets::
  32360. * Interrupts::
  32361. * Notification Packets::
  32362. * Remote Non-Stop::
  32363. * Packet Acknowledgment::
  32364. * Examples::
  32365. * File-I/O Remote Protocol Extension::
  32366. * Library List Format::
  32367. * Library List Format for SVR4 Targets::
  32368. * Memory Map Format::
  32369. * Thread List Format::
  32370. * Traceframe Info Format::
  32371. * Branch Trace Format::
  32372. * Branch Trace Configuration Format::
  32373. 
  32374. File: gdb.info, Node: Overview, Next: Packets, Up: Remote Protocol
  32375. E.1 Overview
  32376. ============
  32377. There may be occasions when you need to know something about the
  32378. protocol--for example, if there is only one serial port to your target
  32379. machine, you might want your program to do something special if it
  32380. recognizes a packet meant for GDB.
  32381. In the examples below, '->' and '<-' are used to indicate transmitted
  32382. and received data, respectively.
  32383. All GDB commands and responses (other than acknowledgments and
  32384. notifications, see *note Notification Packets::) are sent as a PACKET.
  32385. A PACKET is introduced with the character '$', the actual PACKET-DATA,
  32386. and the terminating character '#' followed by a two-digit CHECKSUM:
  32387. $PACKET-DATA#CHECKSUM
  32388. The two-digit CHECKSUM is computed as the modulo 256 sum of all
  32389. characters between the leading '$' and the trailing '#' (an eight bit
  32390. unsigned checksum).
  32391. Implementors should note that prior to GDB 5.0 the protocol
  32392. specification also included an optional two-digit SEQUENCE-ID:
  32393. $SEQUENCE-ID:PACKET-DATA#CHECKSUM
  32394. That SEQUENCE-ID was appended to the acknowledgment. GDB has never
  32395. output SEQUENCE-IDs. Stubs that handle packets added since GDB 5.0 must
  32396. not accept SEQUENCE-ID.
  32397. When either the host or the target machine receives a packet, the
  32398. first response expected is an acknowledgment: either '+' (to indicate
  32399. the package was received correctly) or '-' (to request retransmission):
  32400. -> $PACKET-DATA#CHECKSUM
  32401. <- +
  32402. The '+'/'-' acknowledgments can be disabled once a connection is
  32403. established. *Note Packet Acknowledgment::, for details.
  32404. The host (GDB) sends COMMANDs, and the target (the debugging stub
  32405. incorporated in your program) sends a RESPONSE. In the case of step and
  32406. continue COMMANDs, the response is only sent when the operation has
  32407. completed, and the target has again stopped all threads in all attached
  32408. processes. This is the default all-stop mode behavior, but the remote
  32409. protocol also supports GDB's non-stop execution mode; see *note Remote
  32410. Non-Stop::, for details.
  32411. PACKET-DATA consists of a sequence of characters with the exception
  32412. of '#' and '$' (see 'X' packet for additional exceptions).
  32413. Fields within the packet should be separated using ',' ';' or ':'.
  32414. Except where otherwise noted all numbers are represented in HEX with
  32415. leading zeros suppressed.
  32416. Implementors should note that prior to GDB 5.0, the character ':'
  32417. could not appear as the third character in a packet (as it would
  32418. potentially conflict with the SEQUENCE-ID).
  32419. Binary data in most packets is encoded either as two hexadecimal
  32420. digits per byte of binary data. This allowed the traditional remote
  32421. protocol to work over connections which were only seven-bit clean. Some
  32422. packets designed more recently assume an eight-bit clean connection, and
  32423. use a more efficient encoding to send and receive binary data.
  32424. The binary data representation uses '7d' (ASCII '}') as an escape
  32425. character. Any escaped byte is transmitted as the escape character
  32426. followed by the original character XORed with '0x20'. For example, the
  32427. byte '0x7d' would be transmitted as the two bytes '0x7d 0x5d'. The
  32428. bytes '0x23' (ASCII '#'), '0x24' (ASCII '$'), and '0x7d' (ASCII '}')
  32429. must always be escaped. Responses sent by the stub must also escape
  32430. '0x2a' (ASCII '*'), so that it is not interpreted as the start of a
  32431. run-length encoded sequence (described next).
  32432. Response DATA can be run-length encoded to save space. Run-length
  32433. encoding replaces runs of identical characters with one instance of the
  32434. repeated character, followed by a '*' and a repeat count. The repeat
  32435. count is itself sent encoded, to avoid binary characters in DATA: a
  32436. value of N is sent as 'N+29'. For a repeat count greater or equal to 3,
  32437. this produces a printable ASCII character, e.g. a space (ASCII code 32)
  32438. for a repeat count of 3. (This is because run-length encoding starts to
  32439. win for counts 3 or more.) Thus, for example, '0* ' is a run-length
  32440. encoding of "0000": the space character after '*' means repeat the
  32441. leading '0' '32 - 29 = 3' more times.
  32442. The printable characters '#' and '$' or with a numeric value greater
  32443. than 126 must not be used. Runs of six repeats ('#') or seven repeats
  32444. ('$') can be expanded using a repeat count of only five ('"'). For
  32445. example, '00000000' can be encoded as '0*"00'.
  32446. The error response returned for some packets includes a two character
  32447. error number. That number is not well defined.
  32448. For any COMMAND not supported by the stub, an empty response ('$#00')
  32449. should be returned. That way it is possible to extend the protocol. A
  32450. newer GDB can tell if a packet is supported based on that response.
  32451. At a minimum, a stub is required to support the 'g' and 'G' commands
  32452. for register access, and the 'm' and 'M' commands for memory access.
  32453. Stubs that only control single-threaded targets can implement run
  32454. control with the 'c' (continue), and 's' (step) commands. Stubs that
  32455. support multi-threading targets should support the 'vCont' command. All
  32456. other commands are optional.
  32457. 
  32458. File: gdb.info, Node: Packets, Next: Stop Reply Packets, Prev: Overview, Up: Remote Protocol
  32459. E.2 Packets
  32460. ===========
  32461. The following table provides a complete list of all currently defined
  32462. COMMANDs and their corresponding response DATA. *Note File-I/O Remote
  32463. Protocol Extension::, for details about the File I/O extension of the
  32464. remote protocol.
  32465. Each packet's description has a template showing the packet's overall
  32466. syntax, followed by an explanation of the packet's meaning. We include
  32467. spaces in some of the templates for clarity; these are not part of the
  32468. packet's syntax. No GDB packet uses spaces to separate its components.
  32469. For example, a template like 'foo BAR BAZ' describes a packet beginning
  32470. with the three ASCII bytes 'foo', followed by a BAR, followed directly
  32471. by a BAZ. GDB does not transmit a space character between the 'foo' and
  32472. the BAR, or between the BAR and the BAZ.
  32473. Several packets and replies include a THREAD-ID field to identify a
  32474. thread. Normally these are positive numbers with a target-specific
  32475. interpretation, formatted as big-endian hex strings. A THREAD-ID can
  32476. also be a literal '-1' to indicate all threads, or '0' to pick any
  32477. thread.
  32478. In addition, the remote protocol supports a multiprocess feature in
  32479. which the THREAD-ID syntax is extended to optionally include both
  32480. process and thread ID fields, as 'pPID.TID'. The PID (process) and TID
  32481. (thread) components each have the format described above: a positive
  32482. number with target-specific interpretation formatted as a big-endian hex
  32483. string, literal '-1' to indicate all processes or threads
  32484. (respectively), or '0' to indicate an arbitrary process or thread.
  32485. Specifying just a process, as 'pPID', is equivalent to 'pPID.-1'. It is
  32486. an error to specify all processes but a specific thread, such as
  32487. 'p-1.TID'. Note that the 'p' prefix is _not_ used for those packets and
  32488. replies explicitly documented to include a process ID, rather than a
  32489. THREAD-ID.
  32490. The multiprocess THREAD-ID syntax extensions are only used if both
  32491. GDB and the stub report support for the 'multiprocess' feature using
  32492. 'qSupported'. *Note multiprocess extensions::, for more information.
  32493. Note that all packet forms beginning with an upper- or lower-case
  32494. letter, other than those described here, are reserved for future use.
  32495. Here are the packet descriptions.
  32496. '!'
  32497. Enable extended mode. In extended mode, the remote server is made
  32498. persistent. The 'R' packet is used to restart the program being
  32499. debugged.
  32500. Reply:
  32501. 'OK'
  32502. The remote target both supports and has enabled extended mode.
  32503. '?'
  32504. Indicate the reason the target halted. The reply is the same as
  32505. for step and continue. This packet has a special interpretation
  32506. when the target is in non-stop mode; see *note Remote Non-Stop::.
  32507. Reply: *Note Stop Reply Packets::, for the reply specifications.
  32508. 'A ARGLEN,ARGNUM,ARG,...'
  32509. Initialized 'argv[]' array passed into program. ARGLEN specifies
  32510. the number of bytes in the hex encoded byte stream ARG. See
  32511. 'gdbserver' for more details.
  32512. Reply:
  32513. 'OK'
  32514. The arguments were set.
  32515. 'E NN'
  32516. An error occurred.
  32517. 'b BAUD'
  32518. (Don't use this packet; its behavior is not well-defined.) Change
  32519. the serial line speed to BAUD.
  32520. JTC: _When does the transport layer state change? When it's
  32521. received, or after the ACK is transmitted. In either case, there
  32522. are problems if the command or the acknowledgment packet is
  32523. dropped._
  32524. Stan: _If people really wanted to add something like this, and get
  32525. it working for the first time, they ought to modify ser-unix.c to
  32526. send some kind of out-of-band message to a specially-setup stub and
  32527. have the switch happen "in between" packets, so that from remote
  32528. protocol's point of view, nothing actually happened._
  32529. 'B ADDR,MODE'
  32530. Set (MODE is 'S') or clear (MODE is 'C') a breakpoint at ADDR.
  32531. Don't use this packet. Use the 'Z' and 'z' packets instead (*note
  32532. insert breakpoint or watchpoint packet::).
  32533. 'bc'
  32534. Backward continue. Execute the target system in reverse. No
  32535. parameter. *Note Reverse Execution::, for more information.
  32536. Reply: *Note Stop Reply Packets::, for the reply specifications.
  32537. 'bs'
  32538. Backward single step. Execute one instruction in reverse. No
  32539. parameter. *Note Reverse Execution::, for more information.
  32540. Reply: *Note Stop Reply Packets::, for the reply specifications.
  32541. 'c [ADDR]'
  32542. Continue at ADDR, which is the address to resume. If ADDR is
  32543. omitted, resume at current address.
  32544. This packet is deprecated for multi-threading support. *Note vCont
  32545. packet::.
  32546. Reply: *Note Stop Reply Packets::, for the reply specifications.
  32547. 'C SIG[;ADDR]'
  32548. Continue with signal SIG (hex signal number). If ';ADDR' is
  32549. omitted, resume at same address.
  32550. This packet is deprecated for multi-threading support. *Note vCont
  32551. packet::.
  32552. Reply: *Note Stop Reply Packets::, for the reply specifications.
  32553. 'd'
  32554. Toggle debug flag.
  32555. Don't use this packet; instead, define a general set packet (*note
  32556. General Query Packets::).
  32557. 'D'
  32558. 'D;PID'
  32559. The first form of the packet is used to detach GDB from the remote
  32560. system. It is sent to the remote target before GDB disconnects via
  32561. the 'detach' command.
  32562. The second form, including a process ID, is used when multiprocess
  32563. protocol extensions are enabled (*note multiprocess extensions::),
  32564. to detach only a specific process. The PID is specified as a
  32565. big-endian hex string.
  32566. Reply:
  32567. 'OK'
  32568. for success
  32569. 'E NN'
  32570. for an error
  32571. 'F RC,EE,CF;XX'
  32572. A reply from GDB to an 'F' packet sent by the target. This is part
  32573. of the File-I/O protocol extension. *Note File-I/O Remote Protocol
  32574. Extension::, for the specification.
  32575. 'g'
  32576. Read general registers.
  32577. Reply:
  32578. 'XX...'
  32579. Each byte of register data is described by two hex digits.
  32580. The bytes with the register are transmitted in target byte
  32581. order. The size of each register and their position within
  32582. the 'g' packet are determined by the GDB internal gdbarch
  32583. functions 'DEPRECATED_REGISTER_RAW_SIZE' and
  32584. 'gdbarch_register_name'.
  32585. When reading registers from a trace frame (*note Using the
  32586. Collected Data: Analyze Collected Data.), the stub may also
  32587. return a string of literal 'x''s in place of the register data
  32588. digits, to indicate that the corresponding register has not
  32589. been collected, thus its value is unavailable. For example,
  32590. for an architecture with 4 registers of 4 bytes each, the
  32591. following reply indicates to GDB that registers 0 and 2 have
  32592. not been collected, while registers 1 and 3 have been
  32593. collected, and both have zero value:
  32594. -> g
  32595. <- xxxxxxxx00000000xxxxxxxx00000000
  32596. 'E NN'
  32597. for an error.
  32598. 'G XX...'
  32599. Write general registers. *Note read registers packet::, for a
  32600. description of the XX... data.
  32601. Reply:
  32602. 'OK'
  32603. for success
  32604. 'E NN'
  32605. for an error
  32606. 'H OP THREAD-ID'
  32607. Set thread for subsequent operations ('m', 'M', 'g', 'G', et.al.).
  32608. Depending on the operation to be performed, OP should be 'c' for
  32609. step and continue operations (note that this is deprecated,
  32610. supporting the 'vCont' command is a better option), and 'g' for
  32611. other operations. The thread designator THREAD-ID has the format
  32612. and interpretation described in *note thread-id syntax::.
  32613. Reply:
  32614. 'OK'
  32615. for success
  32616. 'E NN'
  32617. for an error
  32618. 'i [ADDR[,NNN]]'
  32619. Step the remote target by a single clock cycle. If ',NNN' is
  32620. present, cycle step NNN cycles. If ADDR is present, cycle step
  32621. starting at that address.
  32622. 'I'
  32623. Signal, then cycle step. *Note step with signal packet::. *Note
  32624. cycle step packet::.
  32625. 'k'
  32626. Kill request.
  32627. The exact effect of this packet is not specified.
  32628. For a bare-metal target, it may power cycle or reset the target
  32629. system. For that reason, the 'k' packet has no reply.
  32630. For a single-process target, it may kill that process if possible.
  32631. A multiple-process target may choose to kill just one process, or
  32632. all that are under GDB's control. For more precise control, use
  32633. the vKill packet (*note vKill packet::).
  32634. If the target system immediately closes the connection in response
  32635. to 'k', GDB does not consider the lack of packet acknowledgment to
  32636. be an error, and assumes the kill was successful.
  32637. If connected using 'target extended-remote', and the target does
  32638. not close the connection in response to a kill request, GDB probes
  32639. the target state as if a new connection was opened (*note ?
  32640. packet::).
  32641. 'm ADDR,LENGTH'
  32642. Read LENGTH addressable memory units starting at address ADDR
  32643. (*note addressable memory unit::). Note that ADDR may not be
  32644. aligned to any particular boundary.
  32645. The stub need not use any particular size or alignment when
  32646. gathering data from memory for the response; even if ADDR is
  32647. word-aligned and LENGTH is a multiple of the word size, the stub is
  32648. free to use byte accesses, or not. For this reason, this packet
  32649. may not be suitable for accessing memory-mapped I/O devices.
  32650. Reply:
  32651. 'XX...'
  32652. Memory contents; each byte is transmitted as a two-digit
  32653. hexadecimal number. The reply may contain fewer addressable
  32654. memory units than requested if the server was able to read
  32655. only part of the region of memory.
  32656. 'E NN'
  32657. NN is errno
  32658. 'M ADDR,LENGTH:XX...'
  32659. Write LENGTH addressable memory units starting at address ADDR
  32660. (*note addressable memory unit::). The data is given by XX...;
  32661. each byte is transmitted as a two-digit hexadecimal number.
  32662. Reply:
  32663. 'OK'
  32664. for success
  32665. 'E NN'
  32666. for an error (this includes the case where only part of the
  32667. data was written).
  32668. 'p N'
  32669. Read the value of register N; N is in hex. *Note read registers
  32670. packet::, for a description of how the returned register value is
  32671. encoded.
  32672. Reply:
  32673. 'XX...'
  32674. the register's value
  32675. 'E NN'
  32676. for an error
  32677. ''
  32678. Indicating an unrecognized QUERY.
  32679. 'P N...=R...'
  32680. Write register N... with value R.... The register number N is in
  32681. hexadecimal, and R... contains two hex digits for each byte in the
  32682. register (target byte order).
  32683. Reply:
  32684. 'OK'
  32685. for success
  32686. 'E NN'
  32687. for an error
  32688. 'q NAME PARAMS...'
  32689. 'Q NAME PARAMS...'
  32690. General query ('q') and set ('Q'). These packets are described
  32691. fully in *note General Query Packets::.
  32692. 'r'
  32693. Reset the entire system.
  32694. Don't use this packet; use the 'R' packet instead.
  32695. 'R XX'
  32696. Restart the program being debugged. The XX, while needed, is
  32697. ignored. This packet is only available in extended mode (*note
  32698. extended mode::).
  32699. The 'R' packet has no reply.
  32700. 's [ADDR]'
  32701. Single step, resuming at ADDR. If ADDR is omitted, resume at same
  32702. address.
  32703. This packet is deprecated for multi-threading support. *Note vCont
  32704. packet::.
  32705. Reply: *Note Stop Reply Packets::, for the reply specifications.
  32706. 'S SIG[;ADDR]'
  32707. Step with signal. This is analogous to the 'C' packet, but
  32708. requests a single-step, rather than a normal resumption of
  32709. execution.
  32710. This packet is deprecated for multi-threading support. *Note vCont
  32711. packet::.
  32712. Reply: *Note Stop Reply Packets::, for the reply specifications.
  32713. 't ADDR:PP,MM'
  32714. Search backwards starting at address ADDR for a match with pattern
  32715. PP and mask MM, both of which are are 4 byte long. There must be
  32716. at least 3 digits in ADDR.
  32717. 'T THREAD-ID'
  32718. Find out if the thread THREAD-ID is alive. *Note thread-id
  32719. syntax::.
  32720. Reply:
  32721. 'OK'
  32722. thread is still alive
  32723. 'E NN'
  32724. thread is dead
  32725. 'v'
  32726. Packets starting with 'v' are identified by a multi-letter name, up
  32727. to the first ';' or '?' (or the end of the packet).
  32728. 'vAttach;PID'
  32729. Attach to a new process with the specified process ID PID. The
  32730. process ID is a hexadecimal integer identifying the process. In
  32731. all-stop mode, all threads in the attached process are stopped; in
  32732. non-stop mode, it may be attached without being stopped if that is
  32733. supported by the target.
  32734. This packet is only available in extended mode (*note extended
  32735. mode::).
  32736. Reply:
  32737. 'E NN'
  32738. for an error
  32739. 'Any stop packet'
  32740. for success in all-stop mode (*note Stop Reply Packets::)
  32741. 'OK'
  32742. for success in non-stop mode (*note Remote Non-Stop::)
  32743. 'vCont[;ACTION[:THREAD-ID]]...'
  32744. Resume the inferior, specifying different actions for each thread.
  32745. For each inferior thread, the leftmost action with a matching
  32746. THREAD-ID is applied. Threads that don't match any action remain
  32747. in their current state. Thread IDs are specified using the syntax
  32748. described in *note thread-id syntax::. If multiprocess extensions
  32749. (*note multiprocess extensions::) are supported, actions can be
  32750. specified to match all threads in a process by using the 'pPID.-1'
  32751. form of the THREAD-ID. An action with no THREAD-ID matches all
  32752. threads. Specifying no actions is an error.
  32753. Currently supported actions are:
  32754. 'c'
  32755. Continue.
  32756. 'C SIG'
  32757. Continue with signal SIG. The signal SIG should be two hex
  32758. digits.
  32759. 's'
  32760. Step.
  32761. 'S SIG'
  32762. Step with signal SIG. The signal SIG should be two hex
  32763. digits.
  32764. 't'
  32765. Stop.
  32766. 'r START,END'
  32767. Step once, and then keep stepping as long as the thread stops
  32768. at addresses between START (inclusive) and END (exclusive).
  32769. The remote stub reports a stop reply when either the thread
  32770. goes out of the range or is stopped due to an unrelated
  32771. reason, such as hitting a breakpoint. *Note range stepping::.
  32772. If the range is empty (START == END), then the action becomes
  32773. equivalent to the 's' action. In other words, single-step
  32774. once, and report the stop (even if the stepped instruction
  32775. jumps to START).
  32776. (A stop reply may be sent at any point even if the PC is still
  32777. within the stepping range; for example, it is valid to
  32778. implement this packet in a degenerate way as a single
  32779. instruction step operation.)
  32780. The optional argument ADDR normally associated with the 'c', 'C',
  32781. 's', and 'S' packets is not supported in 'vCont'.
  32782. The 't' action is only relevant in non-stop mode (*note Remote
  32783. Non-Stop::) and may be ignored by the stub otherwise. A stop reply
  32784. should be generated for any affected thread not already stopped.
  32785. When a thread is stopped by means of a 't' action, the
  32786. corresponding stop reply should indicate that the thread has
  32787. stopped with signal '0', regardless of whether the target uses some
  32788. other signal as an implementation detail.
  32789. The server must ignore 'c', 'C', 's', 'S', and 'r' actions for
  32790. threads that are already running. Conversely, the server must
  32791. ignore 't' actions for threads that are already stopped.
  32792. _Note:_ In non-stop mode, a thread is considered running until GDB
  32793. acknowleges an asynchronous stop notification for it with the
  32794. 'vStopped' packet (*note Remote Non-Stop::).
  32795. The stub must support 'vCont' if it reports support for
  32796. multiprocess extensions (*note multiprocess extensions::).
  32797. Reply: *Note Stop Reply Packets::, for the reply specifications.
  32798. 'vCont?'
  32799. Request a list of actions supported by the 'vCont' packet.
  32800. Reply:
  32801. 'vCont[;ACTION...]'
  32802. The 'vCont' packet is supported. Each ACTION is a supported
  32803. command in the 'vCont' packet.
  32804. ''
  32805. The 'vCont' packet is not supported.
  32806. 'vCtrlC'
  32807. Interrupt remote target as if a control-C was pressed on the remote
  32808. terminal. This is the equivalent to reacting to the '^C' ('\003',
  32809. the control-C character) character in all-stop mode while the
  32810. target is running, except this works in non-stop mode. *Note
  32811. interrupting remote targets::, for more info on the all-stop
  32812. variant.
  32813. Reply:
  32814. 'E NN'
  32815. for an error
  32816. 'OK'
  32817. for success
  32818. 'vFile:OPERATION:PARAMETER...'
  32819. Perform a file operation on the target system. For details, see
  32820. *note Host I/O Packets::.
  32821. 'vFlashErase:ADDR,LENGTH'
  32822. Direct the stub to erase LENGTH bytes of flash starting at ADDR.
  32823. The region may enclose any number of flash blocks, but its start
  32824. and end must fall on block boundaries, as indicated by the flash
  32825. block size appearing in the memory map (*note Memory Map Format::).
  32826. GDB groups flash memory programming operations together, and sends
  32827. a 'vFlashDone' request after each group; the stub is allowed to
  32828. delay erase operation until the 'vFlashDone' packet is received.
  32829. Reply:
  32830. 'OK'
  32831. for success
  32832. 'E NN'
  32833. for an error
  32834. 'vFlashWrite:ADDR:XX...'
  32835. Direct the stub to write data to flash address ADDR. The data is
  32836. passed in binary form using the same encoding as for the 'X' packet
  32837. (*note Binary Data::). The memory ranges specified by
  32838. 'vFlashWrite' packets preceding a 'vFlashDone' packet must not
  32839. overlap, and must appear in order of increasing addresses (although
  32840. 'vFlashErase' packets for higher addresses may already have been
  32841. received; the ordering is guaranteed only between 'vFlashWrite'
  32842. packets). If a packet writes to an address that was neither erased
  32843. by a preceding 'vFlashErase' packet nor by some other
  32844. target-specific method, the results are unpredictable.
  32845. Reply:
  32846. 'OK'
  32847. for success
  32848. 'E.memtype'
  32849. for vFlashWrite addressing non-flash memory
  32850. 'E NN'
  32851. for an error
  32852. 'vFlashDone'
  32853. Indicate to the stub that flash programming operation is finished.
  32854. The stub is permitted to delay or batch the effects of a group of
  32855. 'vFlashErase' and 'vFlashWrite' packets until a 'vFlashDone' packet
  32856. is received. The contents of the affected regions of flash memory
  32857. are unpredictable until the 'vFlashDone' request is completed.
  32858. 'vKill;PID'
  32859. Kill the process with the specified process ID PID, which is a
  32860. hexadecimal integer identifying the process. This packet is used
  32861. in preference to 'k' when multiprocess protocol extensions are
  32862. supported; see *note multiprocess extensions::.
  32863. Reply:
  32864. 'E NN'
  32865. for an error
  32866. 'OK'
  32867. for success
  32868. 'vMustReplyEmpty'
  32869. The correct reply to an unknown 'v' packet is to return the empty
  32870. string, however, some older versions of 'gdbserver' would
  32871. incorrectly return 'OK' for unknown 'v' packets.
  32872. The 'vMustReplyEmpty' is used as a feature test to check how
  32873. 'gdbserver' handles unknown packets, it is important that this
  32874. packet be handled in the same way as other unknown 'v' packets. If
  32875. this packet is handled differently to other unknown 'v' packets
  32876. then it is possile that GDB may run into problems in other areas,
  32877. specifically around use of 'vFile:setfs:'.
  32878. 'vRun;FILENAME[;ARGUMENT]...'
  32879. Run the program FILENAME, passing it each ARGUMENT on its command
  32880. line. The file and arguments are hex-encoded strings. If FILENAME
  32881. is an empty string, the stub may use a default program (e.g. the
  32882. last program run). The program is created in the stopped state.
  32883. This packet is only available in extended mode (*note extended
  32884. mode::).
  32885. Reply:
  32886. 'E NN'
  32887. for an error
  32888. 'Any stop packet'
  32889. for success (*note Stop Reply Packets::)
  32890. 'vStopped'
  32891. *Note Notification Packets::.
  32892. 'X ADDR,LENGTH:XX...'
  32893. Write data to memory, where the data is transmitted in binary.
  32894. Memory is specified by its address ADDR and number of addressable
  32895. memory units LENGTH (*note addressable memory unit::); 'XX...' is
  32896. binary data (*note Binary Data::).
  32897. Reply:
  32898. 'OK'
  32899. for success
  32900. 'E NN'
  32901. for an error
  32902. 'z TYPE,ADDR,KIND'
  32903. 'Z TYPE,ADDR,KIND'
  32904. Insert ('Z') or remove ('z') a TYPE breakpoint or watchpoint
  32905. starting at address ADDRESS of kind KIND.
  32906. Each breakpoint and watchpoint packet TYPE is documented
  32907. separately.
  32908. _Implementation notes: A remote target shall return an empty string
  32909. for an unrecognized breakpoint or watchpoint packet TYPE. A remote
  32910. target shall support either both or neither of a given 'ZTYPE...'
  32911. and 'zTYPE...' packet pair. To avoid potential problems with
  32912. duplicate packets, the operations should be implemented in an
  32913. idempotent way._
  32914. 'z0,ADDR,KIND'
  32915. 'Z0,ADDR,KIND[;COND_LIST...][;cmds:PERSIST,CMD_LIST...]'
  32916. Insert ('Z0') or remove ('z0') a software breakpoint at address
  32917. ADDR of type KIND.
  32918. A software breakpoint is implemented by replacing the instruction
  32919. at ADDR with a software breakpoint or trap instruction. The KIND
  32920. is target-specific and typically indicates the size of the
  32921. breakpoint in bytes that should be inserted. E.g., the ARM and
  32922. MIPS can insert either a 2 or 4 byte breakpoint. Some
  32923. architectures have additional meanings for KIND (*note
  32924. Architecture-Specific Protocol Details::); if no
  32925. architecture-specific value is being used, it should be '0'. KIND
  32926. is hex-encoded. COND_LIST is an optional list of conditional
  32927. expressions in bytecode form that should be evaluated on the
  32928. target's side. These are the conditions that should be taken into
  32929. consideration when deciding if the breakpoint trigger should be
  32930. reported back to GDB.
  32931. See also the 'swbreak' stop reason (*note swbreak stop reason::)
  32932. for how to best report a software breakpoint event to GDB.
  32933. The COND_LIST parameter is comprised of a series of expressions,
  32934. concatenated without separators. Each expression has the following
  32935. form:
  32936. 'X LEN,EXPR'
  32937. LEN is the length of the bytecode expression and EXPR is the
  32938. actual conditional expression in bytecode form.
  32939. The optional CMD_LIST parameter introduces commands that may be run
  32940. on the target, rather than being reported back to GDB. The
  32941. parameter starts with a numeric flag PERSIST; if the flag is
  32942. nonzero, then the breakpoint may remain active and the commands
  32943. continue to be run even when GDB disconnects from the target.
  32944. Following this flag is a series of expressions concatenated with no
  32945. separators. Each expression has the following form:
  32946. 'X LEN,EXPR'
  32947. LEN is the length of the bytecode expression and EXPR is the
  32948. actual commands expression in bytecode form.
  32949. _Implementation note: It is possible for a target to copy or move
  32950. code that contains software breakpoints (e.g., when implementing
  32951. overlays). The behavior of this packet, in the presence of such a
  32952. target, is not defined._
  32953. Reply:
  32954. 'OK'
  32955. success
  32956. ''
  32957. not supported
  32958. 'E NN'
  32959. for an error
  32960. 'z1,ADDR,KIND'
  32961. 'Z1,ADDR,KIND[;COND_LIST...][;cmds:PERSIST,CMD_LIST...]'
  32962. Insert ('Z1') or remove ('z1') a hardware breakpoint at address
  32963. ADDR.
  32964. A hardware breakpoint is implemented using a mechanism that is not
  32965. dependent on being able to modify the target's memory. The KIND,
  32966. COND_LIST, and CMD_LIST arguments have the same meaning as in 'Z0'
  32967. packets.
  32968. _Implementation note: A hardware breakpoint is not affected by code
  32969. movement._
  32970. Reply:
  32971. 'OK'
  32972. success
  32973. ''
  32974. not supported
  32975. 'E NN'
  32976. for an error
  32977. 'z2,ADDR,KIND'
  32978. 'Z2,ADDR,KIND'
  32979. Insert ('Z2') or remove ('z2') a write watchpoint at ADDR. The
  32980. number of bytes to watch is specified by KIND.
  32981. Reply:
  32982. 'OK'
  32983. success
  32984. ''
  32985. not supported
  32986. 'E NN'
  32987. for an error
  32988. 'z3,ADDR,KIND'
  32989. 'Z3,ADDR,KIND'
  32990. Insert ('Z3') or remove ('z3') a read watchpoint at ADDR. The
  32991. number of bytes to watch is specified by KIND.
  32992. Reply:
  32993. 'OK'
  32994. success
  32995. ''
  32996. not supported
  32997. 'E NN'
  32998. for an error
  32999. 'z4,ADDR,KIND'
  33000. 'Z4,ADDR,KIND'
  33001. Insert ('Z4') or remove ('z4') an access watchpoint at ADDR. The
  33002. number of bytes to watch is specified by KIND.
  33003. Reply:
  33004. 'OK'
  33005. success
  33006. ''
  33007. not supported
  33008. 'E NN'
  33009. for an error
  33010. 
  33011. File: gdb.info, Node: Stop Reply Packets, Next: General Query Packets, Prev: Packets, Up: Remote Protocol
  33012. E.3 Stop Reply Packets
  33013. ======================
  33014. The 'C', 'c', 'S', 's', 'vCont', 'vAttach', 'vRun', 'vStopped', and '?'
  33015. packets can receive any of the below as a reply. Except for '?' and
  33016. 'vStopped', that reply is only returned when the target halts. In the
  33017. below the exact meaning of "signal number" is defined by the header
  33018. 'include/gdb/signals.h' in the GDB source code.
  33019. In non-stop mode, the server will simply reply 'OK' to commands such
  33020. as 'vCont'; any stop will be the subject of a future notification.
  33021. *Note Remote Non-Stop::.
  33022. As in the description of request packets, we include spaces in the
  33023. reply templates for clarity; these are not part of the reply packet's
  33024. syntax. No GDB stop reply packet uses spaces to separate its
  33025. components.
  33026. 'S AA'
  33027. The program received signal number AA (a two-digit hexadecimal
  33028. number). This is equivalent to a 'T' response with no N:R pairs.
  33029. 'T AA N1:R1;N2:R2;...'
  33030. The program received signal number AA (a two-digit hexadecimal
  33031. number). This is equivalent to an 'S' response, except that the
  33032. 'N:R' pairs can carry values of important registers and other
  33033. information directly in the stop reply packet, reducing round-trip
  33034. latency. Single-step and breakpoint traps are reported this way.
  33035. Each 'N:R' pair is interpreted as follows:
  33036. * If N is a hexadecimal number, it is a register number, and the
  33037. corresponding R gives that register's value. The data R is a
  33038. series of bytes in target byte order, with each byte given by
  33039. a two-digit hex number.
  33040. * If N is 'thread', then R is the THREAD-ID of the stopped
  33041. thread, as specified in *note thread-id syntax::.
  33042. * If N is 'core', then R is the hexadecimal number of the core
  33043. on which the stop event was detected.
  33044. * If N is a recognized "stop reason", it describes a more
  33045. specific event that stopped the target. The currently defined
  33046. stop reasons are listed below. The AA should be '05', the
  33047. trap signal. At most one stop reason should be present.
  33048. * Otherwise, GDB should ignore this 'N:R' pair and go on to the
  33049. next; this allows us to extend the protocol in the future.
  33050. The currently defined stop reasons are:
  33051. 'watch'
  33052. 'rwatch'
  33053. 'awatch'
  33054. The packet indicates a watchpoint hit, and R is the data
  33055. address, in hex.
  33056. 'syscall_entry'
  33057. 'syscall_return'
  33058. The packet indicates a syscall entry or return, and R is the
  33059. syscall number, in hex.
  33060. 'library'
  33061. The packet indicates that the loaded libraries have changed.
  33062. GDB should use 'qXfer:libraries:read' to fetch a new list of
  33063. loaded libraries. The R part is ignored.
  33064. 'replaylog'
  33065. The packet indicates that the target cannot continue replaying
  33066. logged execution events, because it has reached the end (or
  33067. the beginning when executing backward) of the log. The value
  33068. of R will be either 'begin' or 'end'. *Note Reverse
  33069. Execution::, for more information.
  33070. 'swbreak'
  33071. The packet indicates a software breakpoint instruction was
  33072. executed, irrespective of whether it was GDB that planted the
  33073. breakpoint or the breakpoint is hardcoded in the program. The
  33074. R part must be left empty.
  33075. On some architectures, such as x86, at the architecture level,
  33076. when a breakpoint instruction executes the program counter
  33077. points at the breakpoint address plus an offset. On such
  33078. targets, the stub is responsible for adjusting the PC to point
  33079. back at the breakpoint address.
  33080. This packet should not be sent by default; older GDB versions
  33081. did not support it. GDB requests it, by supplying an
  33082. appropriate 'qSupported' feature (*note qSupported::). The
  33083. remote stub must also supply the appropriate 'qSupported'
  33084. feature indicating support.
  33085. This packet is required for correct non-stop mode operation.
  33086. 'hwbreak'
  33087. The packet indicates the target stopped for a hardware
  33088. breakpoint. The R part must be left empty.
  33089. The same remarks about 'qSupported' and non-stop mode above
  33090. apply.
  33091. 'fork'
  33092. The packet indicates that 'fork' was called, and R is the
  33093. thread ID of the new child process. Refer to *note thread-id
  33094. syntax:: for the format of the THREAD-ID field. This packet
  33095. is only applicable to targets that support fork events.
  33096. This packet should not be sent by default; older GDB versions
  33097. did not support it. GDB requests it, by supplying an
  33098. appropriate 'qSupported' feature (*note qSupported::). The
  33099. remote stub must also supply the appropriate 'qSupported'
  33100. feature indicating support.
  33101. 'vfork'
  33102. The packet indicates that 'vfork' was called, and R is the
  33103. thread ID of the new child process. Refer to *note thread-id
  33104. syntax:: for the format of the THREAD-ID field. This packet
  33105. is only applicable to targets that support vfork events.
  33106. This packet should not be sent by default; older GDB versions
  33107. did not support it. GDB requests it, by supplying an
  33108. appropriate 'qSupported' feature (*note qSupported::). The
  33109. remote stub must also supply the appropriate 'qSupported'
  33110. feature indicating support.
  33111. 'vforkdone'
  33112. The packet indicates that a child process created by a vfork
  33113. has either called 'exec' or terminated, so that the address
  33114. spaces of the parent and child process are no longer shared.
  33115. The R part is ignored. This packet is only applicable to
  33116. targets that support vforkdone events.
  33117. This packet should not be sent by default; older GDB versions
  33118. did not support it. GDB requests it, by supplying an
  33119. appropriate 'qSupported' feature (*note qSupported::). The
  33120. remote stub must also supply the appropriate 'qSupported'
  33121. feature indicating support.
  33122. 'exec'
  33123. The packet indicates that 'execve' was called, and R is the
  33124. absolute pathname of the file that was executed, in hex. This
  33125. packet is only applicable to targets that support exec events.
  33126. This packet should not be sent by default; older GDB versions
  33127. did not support it. GDB requests it, by supplying an
  33128. appropriate 'qSupported' feature (*note qSupported::). The
  33129. remote stub must also supply the appropriate 'qSupported'
  33130. feature indicating support.
  33131. 'create'
  33132. The packet indicates that the thread was just created. The
  33133. new thread is stopped until GDB sets it running with a
  33134. resumption packet (*note vCont packet::). This packet should
  33135. not be sent by default; GDB requests it with the *note
  33136. QThreadEvents:: packet. See also the 'w' (*note thread exit
  33137. event::) remote reply below. The R part is ignored.
  33138. 'W AA'
  33139. 'W AA ; process:PID'
  33140. The process exited, and AA is the exit status. This is only
  33141. applicable to certain targets.
  33142. The second form of the response, including the process ID of the
  33143. exited process, can be used only when GDB has reported support for
  33144. multiprocess protocol extensions; see *note multiprocess
  33145. extensions::. Both AA and PID are formatted as big-endian hex
  33146. strings.
  33147. 'X AA'
  33148. 'X AA ; process:PID'
  33149. The process terminated with signal AA.
  33150. The second form of the response, including the process ID of the
  33151. terminated process, can be used only when GDB has reported support
  33152. for multiprocess protocol extensions; see *note multiprocess
  33153. extensions::. Both AA and PID are formatted as big-endian hex
  33154. strings.
  33155. 'w AA ; TID'
  33156. The thread exited, and AA is the exit status. This response should
  33157. not be sent by default; GDB requests it with the *note
  33158. QThreadEvents:: packet. See also *note thread create event::
  33159. above. AA is formatted as a big-endian hex string.
  33160. 'N'
  33161. There are no resumed threads left in the target. In other words,
  33162. even though the process is alive, the last resumed thread has
  33163. exited. For example, say the target process has two threads:
  33164. thread 1 and thread 2. The client leaves thread 1 stopped, and
  33165. resumes thread 2, which subsequently exits. At this point, even
  33166. though the process is still alive, and thus no 'W' stop reply is
  33167. sent, no thread is actually executing either. The 'N' stop reply
  33168. thus informs the client that it can stop waiting for stop replies.
  33169. This packet should not be sent by default; older GDB versions did
  33170. not support it. GDB requests it, by supplying an appropriate
  33171. 'qSupported' feature (*note qSupported::). The remote stub must
  33172. also supply the appropriate 'qSupported' feature indicating
  33173. support.
  33174. 'O XX...'
  33175. 'XX...' is hex encoding of ASCII data, to be written as the
  33176. program's console output. This can happen at any time while the
  33177. program is running and the debugger should continue to wait for
  33178. 'W', 'T', etc. This reply is not permitted in non-stop mode.
  33179. 'F CALL-ID,PARAMETER...'
  33180. CALL-ID is the identifier which says which host system call should
  33181. be called. This is just the name of the function. Translation
  33182. into the correct system call is only applicable as it's defined in
  33183. GDB. *Note File-I/O Remote Protocol Extension::, for a list of
  33184. implemented system calls.
  33185. 'PARAMETER...' is a list of parameters as defined for this very
  33186. system call.
  33187. The target replies with this packet when it expects GDB to call a
  33188. host system call on behalf of the target. GDB replies with an
  33189. appropriate 'F' packet and keeps up waiting for the next reply
  33190. packet from the target. The latest 'C', 'c', 'S' or 's' action is
  33191. expected to be continued. *Note File-I/O Remote Protocol
  33192. Extension::, for more details.
  33193. 
  33194. File: gdb.info, Node: General Query Packets, Next: Architecture-Specific Protocol Details, Prev: Stop Reply Packets, Up: Remote Protocol
  33195. E.4 General Query Packets
  33196. =========================
  33197. Packets starting with 'q' are "general query packets"; packets starting
  33198. with 'Q' are "general set packets". General query and set packets are a
  33199. semi-unified form for retrieving and sending information to and from the
  33200. stub.
  33201. The initial letter of a query or set packet is followed by a name
  33202. indicating what sort of thing the packet applies to. For example, GDB
  33203. may use a 'qSymbol' packet to exchange symbol definitions with the stub.
  33204. These packet names follow some conventions:
  33205. * The name must not contain commas, colons or semicolons.
  33206. * Most GDB query and set packets have a leading upper case letter.
  33207. * The names of custom vendor packets should use a company prefix, in
  33208. lower case, followed by a period. For example, packets designed at
  33209. the Acme Corporation might begin with 'qacme.foo' (for querying
  33210. foos) or 'Qacme.bar' (for setting bars).
  33211. The name of a query or set packet should be separated from any
  33212. parameters by a ':'; the parameters themselves should be separated by
  33213. ',' or ';'. Stubs must be careful to match the full packet name, and
  33214. check for a separator or the end of the packet, in case two packet names
  33215. share a common prefix. New packets should not begin with 'qC', 'qP', or
  33216. 'qL'(1).
  33217. Like the descriptions of the other packets, each description here has
  33218. a template showing the packet's overall syntax, followed by an
  33219. explanation of the packet's meaning. We include spaces in some of the
  33220. templates for clarity; these are not part of the packet's syntax. No
  33221. GDB packet uses spaces to separate its components.
  33222. Here are the currently defined query and set packets:
  33223. 'QAgent:1'
  33224. 'QAgent:0'
  33225. Turn on or off the agent as a helper to perform some debugging
  33226. operations delegated from GDB (*note Control Agent::).
  33227. 'QAllow:OP:VAL...'
  33228. Specify which operations GDB expects to request of the target, as a
  33229. semicolon-separated list of operation name and value pairs.
  33230. Possible values for OP include 'WriteReg', 'WriteMem',
  33231. 'InsertBreak', 'InsertTrace', 'InsertFastTrace', and 'Stop'. VAL
  33232. is either 0, indicating that GDB will not request the operation, or
  33233. 1, indicating that it may. (The target can then use this to set up
  33234. its own internals optimally, for instance if the debugger never
  33235. expects to insert breakpoints, it may not need to install its own
  33236. trap handler.)
  33237. 'qC'
  33238. Return the current thread ID.
  33239. Reply:
  33240. 'QC THREAD-ID'
  33241. Where THREAD-ID is a thread ID as documented in *note
  33242. thread-id syntax::.
  33243. '(anything else)'
  33244. Any other reply implies the old thread ID.
  33245. 'qCRC:ADDR,LENGTH'
  33246. Compute the CRC checksum of a block of memory using CRC-32 defined
  33247. in IEEE 802.3. The CRC is computed byte at a time, taking the most
  33248. significant bit of each byte first. The initial pattern code
  33249. '0xffffffff' is used to ensure leading zeros affect the CRC.
  33250. _Note:_ This is the same CRC used in validating separate debug
  33251. files (*note Debugging Information in Separate Files: Separate
  33252. Debug Files.). However the algorithm is slightly different. When
  33253. validating separate debug files, the CRC is computed taking the
  33254. _least_ significant bit of each byte first, and the final result is
  33255. inverted to detect trailing zeros.
  33256. Reply:
  33257. 'E NN'
  33258. An error (such as memory fault)
  33259. 'C CRC32'
  33260. The specified memory region's checksum is CRC32.
  33261. 'QDisableRandomization:VALUE'
  33262. Some target operating systems will randomize the virtual address
  33263. space of the inferior process as a security feature, but provide a
  33264. feature to disable such randomization, e.g. to allow for a more
  33265. deterministic debugging experience. On such systems, this packet
  33266. with a VALUE of 1 directs the target to disable address space
  33267. randomization for processes subsequently started via 'vRun'
  33268. packets, while a packet with a VALUE of 0 tells the target to
  33269. enable address space randomization.
  33270. This packet is only available in extended mode (*note extended
  33271. mode::).
  33272. Reply:
  33273. 'OK'
  33274. The request succeeded.
  33275. 'E NN'
  33276. An error occurred. The error number NN is given as hex
  33277. digits.
  33278. ''
  33279. An empty reply indicates that 'QDisableRandomization' is not
  33280. supported by the stub.
  33281. This packet is not probed by default; the remote stub must request
  33282. it, by supplying an appropriate 'qSupported' response (*note
  33283. qSupported::). This should only be done on targets that actually
  33284. support disabling address space randomization.
  33285. 'QStartupWithShell:VALUE'
  33286. On UNIX-like targets, it is possible to start the inferior using a
  33287. shell program. This is the default behavior on both GDB and
  33288. 'gdbserver' (*note set startup-with-shell::). This packet is used
  33289. to inform 'gdbserver' whether it should start the inferior using a
  33290. shell or not.
  33291. If VALUE is '0', 'gdbserver' will not use a shell to start the
  33292. inferior. If VALUE is '1', 'gdbserver' will use a shell to start
  33293. the inferior. All other values are considered an error.
  33294. This packet is only available in extended mode (*note extended
  33295. mode::).
  33296. Reply:
  33297. 'OK'
  33298. The request succeeded.
  33299. 'E NN'
  33300. An error occurred. The error number NN is given as hex
  33301. digits.
  33302. This packet is not probed by default; the remote stub must request
  33303. it, by supplying an appropriate 'qSupported' response (*note
  33304. qSupported::). This should only be done on targets that actually
  33305. support starting the inferior using a shell.
  33306. Use of this packet is controlled by the 'set startup-with-shell'
  33307. command; *note set startup-with-shell::.
  33308. 'QEnvironmentHexEncoded:HEX-VALUE'
  33309. On UNIX-like targets, it is possible to set environment variables
  33310. that will be passed to the inferior during the startup process.
  33311. This packet is used to inform 'gdbserver' of an environment
  33312. variable that has been defined by the user on GDB (*note set
  33313. environment::).
  33314. The packet is composed by HEX-VALUE, an hex encoded representation
  33315. of the NAME=VALUE format representing an environment variable. The
  33316. name of the environment variable is represented by NAME, and the
  33317. value to be assigned to the environment variable is represented by
  33318. VALUE. If the variable has no value (i.e., the value is 'null'),
  33319. then VALUE will not be present.
  33320. This packet is only available in extended mode (*note extended
  33321. mode::).
  33322. Reply:
  33323. 'OK'
  33324. The request succeeded.
  33325. This packet is not probed by default; the remote stub must request
  33326. it, by supplying an appropriate 'qSupported' response (*note
  33327. qSupported::). This should only be done on targets that actually
  33328. support passing environment variables to the starting inferior.
  33329. This packet is related to the 'set environment' command; *note set
  33330. environment::.
  33331. 'QEnvironmentUnset:HEX-VALUE'
  33332. On UNIX-like targets, it is possible to unset environment variables
  33333. before starting the inferior in the remote target. This packet is
  33334. used to inform 'gdbserver' of an environment variable that has been
  33335. unset by the user on GDB (*note unset environment::).
  33336. The packet is composed by HEX-VALUE, an hex encoded representation
  33337. of the name of the environment variable to be unset.
  33338. This packet is only available in extended mode (*note extended
  33339. mode::).
  33340. Reply:
  33341. 'OK'
  33342. The request succeeded.
  33343. This packet is not probed by default; the remote stub must request
  33344. it, by supplying an appropriate 'qSupported' response (*note
  33345. qSupported::). This should only be done on targets that actually
  33346. support passing environment variables to the starting inferior.
  33347. This packet is related to the 'unset environment' command; *note
  33348. unset environment::.
  33349. 'QEnvironmentReset'
  33350. On UNIX-like targets, this packet is used to reset the state of
  33351. environment variables in the remote target before starting the
  33352. inferior. In this context, reset means unsetting all environment
  33353. variables that were previously set by the user (i.e., were not
  33354. initially present in the environment). It is sent to 'gdbserver'
  33355. before the 'QEnvironmentHexEncoded' (*note
  33356. QEnvironmentHexEncoded::) and the 'QEnvironmentUnset' (*note
  33357. QEnvironmentUnset::) packets.
  33358. This packet is only available in extended mode (*note extended
  33359. mode::).
  33360. Reply:
  33361. 'OK'
  33362. The request succeeded.
  33363. This packet is not probed by default; the remote stub must request
  33364. it, by supplying an appropriate 'qSupported' response (*note
  33365. qSupported::). This should only be done on targets that actually
  33366. support passing environment variables to the starting inferior.
  33367. 'QSetWorkingDir:[DIRECTORY]'
  33368. This packet is used to inform the remote server of the intended
  33369. current working directory for programs that are going to be
  33370. executed.
  33371. The packet is composed by DIRECTORY, an hex encoded representation
  33372. of the directory that the remote inferior will use as its current
  33373. working directory. If DIRECTORY is an empty string, the remote
  33374. server should reset the inferior's current working directory to its
  33375. original, empty value.
  33376. This packet is only available in extended mode (*note extended
  33377. mode::).
  33378. Reply:
  33379. 'OK'
  33380. The request succeeded.
  33381. 'qfThreadInfo'
  33382. 'qsThreadInfo'
  33383. Obtain a list of all active thread IDs from the target (OS). Since
  33384. there may be too many active threads to fit into one reply packet,
  33385. this query works iteratively: it may require more than one
  33386. query/reply sequence to obtain the entire list of threads. The
  33387. first query of the sequence will be the 'qfThreadInfo' query;
  33388. subsequent queries in the sequence will be the 'qsThreadInfo'
  33389. query.
  33390. NOTE: This packet replaces the 'qL' query (see below).
  33391. Reply:
  33392. 'm THREAD-ID'
  33393. A single thread ID
  33394. 'm THREAD-ID,THREAD-ID...'
  33395. a comma-separated list of thread IDs
  33396. 'l'
  33397. (lower case letter 'L') denotes end of list.
  33398. In response to each query, the target will reply with a list of one
  33399. or more thread IDs, separated by commas. GDB will respond to each
  33400. reply with a request for more thread ids (using the 'qs' form of
  33401. the query), until the target responds with 'l' (lower-case ell, for
  33402. "last"). Refer to *note thread-id syntax::, for the format of the
  33403. THREAD-ID fields.
  33404. _Note: GDB will send the 'qfThreadInfo' query during the initial
  33405. connection with the remote target, and the very first thread ID
  33406. mentioned in the reply will be stopped by GDB in a subsequent
  33407. message. Therefore, the stub should ensure that the first thread
  33408. ID in the 'qfThreadInfo' reply is suitable for being stopped by
  33409. GDB._
  33410. 'qGetTLSAddr:THREAD-ID,OFFSET,LM'
  33411. Fetch the address associated with thread local storage specified by
  33412. THREAD-ID, OFFSET, and LM.
  33413. THREAD-ID is the thread ID associated with the thread for which to
  33414. fetch the TLS address. *Note thread-id syntax::.
  33415. OFFSET is the (big endian, hex encoded) offset associated with the
  33416. thread local variable. (This offset is obtained from the debug
  33417. information associated with the variable.)
  33418. LM is the (big endian, hex encoded) OS/ABI-specific encoding of the
  33419. load module associated with the thread local storage. For example,
  33420. a GNU/Linux system will pass the link map address of the shared
  33421. object associated with the thread local storage under
  33422. consideration. Other operating environments may choose to
  33423. represent the load module differently, so the precise meaning of
  33424. this parameter will vary.
  33425. Reply:
  33426. 'XX...'
  33427. Hex encoded (big endian) bytes representing the address of the
  33428. thread local storage requested.
  33429. 'E NN'
  33430. An error occurred. The error number NN is given as hex
  33431. digits.
  33432. ''
  33433. An empty reply indicates that 'qGetTLSAddr' is not supported
  33434. by the stub.
  33435. 'qGetTIBAddr:THREAD-ID'
  33436. Fetch address of the Windows OS specific Thread Information Block.
  33437. THREAD-ID is the thread ID associated with the thread.
  33438. Reply:
  33439. 'XX...'
  33440. Hex encoded (big endian) bytes representing the linear address
  33441. of the thread information block.
  33442. 'E NN'
  33443. An error occured. This means that either the thread was not
  33444. found, or the address could not be retrieved.
  33445. ''
  33446. An empty reply indicates that 'qGetTIBAddr' is not supported
  33447. by the stub.
  33448. 'qL STARTFLAG THREADCOUNT NEXTTHREAD'
  33449. Obtain thread information from RTOS. Where: STARTFLAG (one hex
  33450. digit) is one to indicate the first query and zero to indicate a
  33451. subsequent query; THREADCOUNT (two hex digits) is the maximum
  33452. number of threads the response packet can contain; and NEXTTHREAD
  33453. (eight hex digits), for subsequent queries (STARTFLAG is zero), is
  33454. returned in the response as ARGTHREAD.
  33455. Don't use this packet; use the 'qfThreadInfo' query instead (see
  33456. above).
  33457. Reply:
  33458. 'qM COUNT DONE ARGTHREAD THREAD...'
  33459. Where: COUNT (two hex digits) is the number of threads being
  33460. returned; DONE (one hex digit) is zero to indicate more
  33461. threads and one indicates no further threads; ARGTHREADID
  33462. (eight hex digits) is NEXTTHREAD from the request packet;
  33463. THREAD... is a sequence of thread IDs, THREADID (eight hex
  33464. digits), from the target. See
  33465. 'remote.c:parse_threadlist_response()'.
  33466. 'qOffsets'
  33467. Get section offsets that the target used when relocating the
  33468. downloaded image.
  33469. Reply:
  33470. 'Text=XXX;Data=YYY[;Bss=ZZZ]'
  33471. Relocate the 'Text' section by XXX from its original address.
  33472. Relocate the 'Data' section by YYY from its original address.
  33473. If the object file format provides segment information (e.g.
  33474. ELF 'PT_LOAD' program headers), GDB will relocate entire
  33475. segments by the supplied offsets.
  33476. _Note: while a 'Bss' offset may be included in the response,
  33477. GDB ignores this and instead applies the 'Data' offset to the
  33478. 'Bss' section._
  33479. 'TextSeg=XXX[;DataSeg=YYY]'
  33480. Relocate the first segment of the object file, which
  33481. conventionally contains program code, to a starting address of
  33482. XXX. If 'DataSeg' is specified, relocate the second segment,
  33483. which conventionally contains modifiable data, to a starting
  33484. address of YYY. GDB will report an error if the object file
  33485. does not contain segment information, or does not contain at
  33486. least as many segments as mentioned in the reply. Extra
  33487. segments are kept at fixed offsets relative to the last
  33488. relocated segment.
  33489. 'qP MODE THREAD-ID'
  33490. Returns information on THREAD-ID. Where: MODE is a hex encoded 32
  33491. bit mode; THREAD-ID is a thread ID (*note thread-id syntax::).
  33492. Don't use this packet; use the 'qThreadExtraInfo' query instead
  33493. (see below).
  33494. Reply: see 'remote.c:remote_unpack_thread_info_response()'.
  33495. 'QNonStop:1'
  33496. 'QNonStop:0'
  33497. Enter non-stop ('QNonStop:1') or all-stop ('QNonStop:0') mode.
  33498. *Note Remote Non-Stop::, for more information.
  33499. Reply:
  33500. 'OK'
  33501. The request succeeded.
  33502. 'E NN'
  33503. An error occurred. The error number NN is given as hex
  33504. digits.
  33505. ''
  33506. An empty reply indicates that 'QNonStop' is not supported by
  33507. the stub.
  33508. This packet is not probed by default; the remote stub must request
  33509. it, by supplying an appropriate 'qSupported' response (*note
  33510. qSupported::). Use of this packet is controlled by the 'set
  33511. non-stop' command; *note Non-Stop Mode::.
  33512. 'QCatchSyscalls:1 [;SYSNO]...'
  33513. 'QCatchSyscalls:0'
  33514. Enable ('QCatchSyscalls:1') or disable ('QCatchSyscalls:0')
  33515. catching syscalls from the inferior process.
  33516. For 'QCatchSyscalls:1', each listed syscall SYSNO (encoded in hex)
  33517. should be reported to GDB. If no syscall SYSNO is listed, every
  33518. system call should be reported.
  33519. Note that if a syscall not in the list is reported, GDB will still
  33520. filter the event according to its own list from all corresponding
  33521. 'catch syscall' commands. However, it is more efficient to only
  33522. report the requested syscalls.
  33523. Multiple 'QCatchSyscalls:1' packets do not combine; any earlier
  33524. 'QCatchSyscalls:1' list is completely replaced by the new list.
  33525. If the inferior process execs, the state of 'QCatchSyscalls' is
  33526. kept for the new process too. On targets where exec may affect
  33527. syscall numbers, for example with exec between 32 and 64-bit
  33528. processes, the client should send a new packet with the new syscall
  33529. list.
  33530. Reply:
  33531. 'OK'
  33532. The request succeeded.
  33533. 'E NN'
  33534. An error occurred. NN are hex digits.
  33535. ''
  33536. An empty reply indicates that 'QCatchSyscalls' is not
  33537. supported by the stub.
  33538. Use of this packet is controlled by the 'set remote catch-syscalls'
  33539. command (*note set remote catch-syscalls: Remote Configuration.).
  33540. This packet is not probed by default; the remote stub must request
  33541. it, by supplying an appropriate 'qSupported' response (*note
  33542. qSupported::).
  33543. 'QPassSignals: SIGNAL [;SIGNAL]...'
  33544. Each listed SIGNAL should be passed directly to the inferior
  33545. process. Signals are numbered identically to continue packets and
  33546. stop replies (*note Stop Reply Packets::). Each SIGNAL list item
  33547. should be strictly greater than the previous item. These signals
  33548. do not need to stop the inferior, or be reported to GDB. All other
  33549. signals should be reported to GDB. Multiple 'QPassSignals' packets
  33550. do not combine; any earlier 'QPassSignals' list is completely
  33551. replaced by the new list. This packet improves performance when
  33552. using 'handle SIGNAL nostop noprint pass'.
  33553. Reply:
  33554. 'OK'
  33555. The request succeeded.
  33556. 'E NN'
  33557. An error occurred. The error number NN is given as hex
  33558. digits.
  33559. ''
  33560. An empty reply indicates that 'QPassSignals' is not supported
  33561. by the stub.
  33562. Use of this packet is controlled by the 'set remote pass-signals'
  33563. command (*note set remote pass-signals: Remote Configuration.).
  33564. This packet is not probed by default; the remote stub must request
  33565. it, by supplying an appropriate 'qSupported' response (*note
  33566. qSupported::).
  33567. 'QProgramSignals: SIGNAL [;SIGNAL]...'
  33568. Each listed SIGNAL may be delivered to the inferior process.
  33569. Others should be silently discarded.
  33570. In some cases, the remote stub may need to decide whether to
  33571. deliver a signal to the program or not without GDB involvement.
  33572. One example of that is while detaching -- the program's threads may
  33573. have stopped for signals that haven't yet had a chance of being
  33574. reported to GDB, and so the remote stub can use the signal list
  33575. specified by this packet to know whether to deliver or ignore those
  33576. pending signals.
  33577. This does not influence whether to deliver a signal as requested by
  33578. a resumption packet (*note vCont packet::).
  33579. Signals are numbered identically to continue packets and stop
  33580. replies (*note Stop Reply Packets::). Each SIGNAL list item should
  33581. be strictly greater than the previous item. Multiple
  33582. 'QProgramSignals' packets do not combine; any earlier
  33583. 'QProgramSignals' list is completely replaced by the new list.
  33584. Reply:
  33585. 'OK'
  33586. The request succeeded.
  33587. 'E NN'
  33588. An error occurred. The error number NN is given as hex
  33589. digits.
  33590. ''
  33591. An empty reply indicates that 'QProgramSignals' is not
  33592. supported by the stub.
  33593. Use of this packet is controlled by the 'set remote
  33594. program-signals' command (*note set remote program-signals: Remote
  33595. Configuration.). This packet is not probed by default; the remote
  33596. stub must request it, by supplying an appropriate 'qSupported'
  33597. response (*note qSupported::).
  33598. 'QThreadEvents:1'
  33599. 'QThreadEvents:0'
  33600. Enable ('QThreadEvents:1') or disable ('QThreadEvents:0') reporting
  33601. of thread create and exit events. *Note thread create event::, for
  33602. the reply specifications. For example, this is used in non-stop
  33603. mode when GDB stops a set of threads and synchronously waits for
  33604. the their corresponding stop replies. Without exit events, if one
  33605. of the threads exits, GDB would hang forever not knowing that it
  33606. should no longer expect a stop for that same thread. GDB does not
  33607. enable this feature unless the stub reports that it supports it by
  33608. including 'QThreadEvents+' in its 'qSupported' reply.
  33609. Reply:
  33610. 'OK'
  33611. The request succeeded.
  33612. 'E NN'
  33613. An error occurred. The error number NN is given as hex
  33614. digits.
  33615. ''
  33616. An empty reply indicates that 'QThreadEvents' is not supported
  33617. by the stub.
  33618. Use of this packet is controlled by the 'set remote thread-events'
  33619. command (*note set remote thread-events: Remote Configuration.).
  33620. 'qRcmd,COMMAND'
  33621. COMMAND (hex encoded) is passed to the local interpreter for
  33622. execution. Invalid commands should be reported using the output
  33623. string. Before the final result packet, the target may also
  33624. respond with a number of intermediate 'OOUTPUT' console output
  33625. packets. _Implementors should note that providing access to a
  33626. stubs's interpreter may have security implications_.
  33627. Reply:
  33628. 'OK'
  33629. A command response with no output.
  33630. 'OUTPUT'
  33631. A command response with the hex encoded output string OUTPUT.
  33632. 'E NN'
  33633. Indicate a badly formed request.
  33634. ''
  33635. An empty reply indicates that 'qRcmd' is not recognized.
  33636. (Note that the 'qRcmd' packet's name is separated from the command
  33637. by a ',', not a ':', contrary to the naming conventions above.
  33638. Please don't use this packet as a model for new packets.)
  33639. 'qSearch:memory:ADDRESS;LENGTH;SEARCH-PATTERN'
  33640. Search LENGTH bytes at ADDRESS for SEARCH-PATTERN. Both ADDRESS
  33641. and LENGTH are encoded in hex; SEARCH-PATTERN is a sequence of
  33642. bytes, also hex encoded.
  33643. Reply:
  33644. '0'
  33645. The pattern was not found.
  33646. '1,address'
  33647. The pattern was found at ADDRESS.
  33648. 'E NN'
  33649. A badly formed request or an error was encountered while
  33650. searching memory.
  33651. ''
  33652. An empty reply indicates that 'qSearch:memory' is not
  33653. recognized.
  33654. 'QStartNoAckMode'
  33655. Request that the remote stub disable the normal '+'/'-' protocol
  33656. acknowledgments (*note Packet Acknowledgment::).
  33657. Reply:
  33658. 'OK'
  33659. The stub has switched to no-acknowledgment mode. GDB
  33660. acknowledges this reponse, but neither the stub nor GDB shall
  33661. send or expect further '+'/'-' acknowledgments in the current
  33662. connection.
  33663. ''
  33664. An empty reply indicates that the stub does not support
  33665. no-acknowledgment mode.
  33666. 'qSupported [:GDBFEATURE [;GDBFEATURE]... ]'
  33667. Tell the remote stub about features supported by GDB, and query the
  33668. stub for features it supports. This packet allows GDB and the
  33669. remote stub to take advantage of each others' features.
  33670. 'qSupported' also consolidates multiple feature probes at startup,
  33671. to improve GDB performance--a single larger packet performs better
  33672. than multiple smaller probe packets on high-latency links. Some
  33673. features may enable behavior which must not be on by default, e.g.
  33674. because it would confuse older clients or stubs. Other features
  33675. may describe packets which could be automatically probed for, but
  33676. are not. These features must be reported before GDB will use them.
  33677. This "default unsupported" behavior is not appropriate for all
  33678. packets, but it helps to keep the initial connection time under
  33679. control with new versions of GDB which support increasing numbers
  33680. of packets.
  33681. Reply:
  33682. 'STUBFEATURE [;STUBFEATURE]...'
  33683. The stub supports or does not support each returned
  33684. STUBFEATURE, depending on the form of each STUBFEATURE (see
  33685. below for the possible forms).
  33686. ''
  33687. An empty reply indicates that 'qSupported' is not recognized,
  33688. or that no features needed to be reported to GDB.
  33689. The allowed forms for each feature (either a GDBFEATURE in the
  33690. 'qSupported' packet, or a STUBFEATURE in the response) are:
  33691. 'NAME=VALUE'
  33692. The remote protocol feature NAME is supported, and associated
  33693. with the specified VALUE. The format of VALUE depends on the
  33694. feature, but it must not include a semicolon.
  33695. 'NAME+'
  33696. The remote protocol feature NAME is supported, and does not
  33697. need an associated value.
  33698. 'NAME-'
  33699. The remote protocol feature NAME is not supported.
  33700. 'NAME?'
  33701. The remote protocol feature NAME may be supported, and GDB
  33702. should auto-detect support in some other way when it is
  33703. needed. This form will not be used for GDBFEATURE
  33704. notifications, but may be used for STUBFEATURE responses.
  33705. Whenever the stub receives a 'qSupported' request, the supplied set
  33706. of GDB features should override any previous request. This allows
  33707. GDB to put the stub in a known state, even if the stub had
  33708. previously been communicating with a different version of GDB.
  33709. The following values of GDBFEATURE (for the packet sent by GDB) are
  33710. defined:
  33711. 'multiprocess'
  33712. This feature indicates whether GDB supports multiprocess
  33713. extensions to the remote protocol. GDB does not use such
  33714. extensions unless the stub also reports that it supports them
  33715. by including 'multiprocess+' in its 'qSupported' reply. *Note
  33716. multiprocess extensions::, for details.
  33717. 'xmlRegisters'
  33718. This feature indicates that GDB supports the XML target
  33719. description. If the stub sees 'xmlRegisters=' with target
  33720. specific strings separated by a comma, it will report register
  33721. description.
  33722. 'qRelocInsn'
  33723. This feature indicates whether GDB supports the 'qRelocInsn'
  33724. packet (*note Relocate instruction reply packet: Tracepoint
  33725. Packets.).
  33726. 'swbreak'
  33727. This feature indicates whether GDB supports the swbreak stop
  33728. reason in stop replies. *Note swbreak stop reason::, for
  33729. details.
  33730. 'hwbreak'
  33731. This feature indicates whether GDB supports the hwbreak stop
  33732. reason in stop replies. *Note swbreak stop reason::, for
  33733. details.
  33734. 'fork-events'
  33735. This feature indicates whether GDB supports fork event
  33736. extensions to the remote protocol. GDB does not use such
  33737. extensions unless the stub also reports that it supports them
  33738. by including 'fork-events+' in its 'qSupported' reply.
  33739. 'vfork-events'
  33740. This feature indicates whether GDB supports vfork event
  33741. extensions to the remote protocol. GDB does not use such
  33742. extensions unless the stub also reports that it supports them
  33743. by including 'vfork-events+' in its 'qSupported' reply.
  33744. 'exec-events'
  33745. This feature indicates whether GDB supports exec event
  33746. extensions to the remote protocol. GDB does not use such
  33747. extensions unless the stub also reports that it supports them
  33748. by including 'exec-events+' in its 'qSupported' reply.
  33749. 'vContSupported'
  33750. This feature indicates whether GDB wants to know the supported
  33751. actions in the reply to 'vCont?' packet.
  33752. Stubs should ignore any unknown values for GDBFEATURE. Any GDB
  33753. which sends a 'qSupported' packet supports receiving packets of
  33754. unlimited length (earlier versions of GDB may reject overly long
  33755. responses). Additional values for GDBFEATURE may be defined in the
  33756. future to let the stub take advantage of new features in GDB, e.g.
  33757. incompatible improvements in the remote protocol--the
  33758. 'multiprocess' feature is an example of such a feature. The stub's
  33759. reply should be independent of the GDBFEATURE entries sent by GDB;
  33760. first GDB describes all the features it supports, and then the stub
  33761. replies with all the features it supports.
  33762. Similarly, GDB will silently ignore unrecognized stub feature
  33763. responses, as long as each response uses one of the standard forms.
  33764. Some features are flags. A stub which supports a flag feature
  33765. should respond with a '+' form response. Other features require
  33766. values, and the stub should respond with an '=' form response.
  33767. Each feature has a default value, which GDB will use if
  33768. 'qSupported' is not available or if the feature is not mentioned in
  33769. the 'qSupported' response. The default values are fixed; a stub is
  33770. free to omit any feature responses that match the defaults.
  33771. Not all features can be probed, but for those which can, the
  33772. probing mechanism is useful: in some cases, a stub's internal
  33773. architecture may not allow the protocol layer to know some
  33774. information about the underlying target in advance. This is
  33775. especially common in stubs which may be configured for multiple
  33776. targets.
  33777. These are the currently defined stub features and their properties:
  33778. Feature Name Value Default Probe
  33779. Required Allowed
  33780. 'PacketSize' Yes '-' No
  33781. 'qXfer:auxv:read' No '-' Yes
  33782. 'qXfer:btrace:read' No '-' Yes
  33783. 'qXfer:btrace-conf:read' No '-' Yes
  33784. 'qXfer:exec-file:read' No '-' Yes
  33785. 'qXfer:features:read' No '-' Yes
  33786. 'qXfer:libraries:read' No '-' Yes
  33787. 'qXfer:libraries-svr4:read'No '-' Yes
  33788. 'augmented-libraries-svr4-read'No '-' No
  33789. 'qXfer:memory-map:read' No '-' Yes
  33790. 'qXfer:sdata:read' No '-' Yes
  33791. 'qXfer:spu:read' No '-' Yes
  33792. 'qXfer:spu:write' No '-' Yes
  33793. 'qXfer:siginfo:read' No '-' Yes
  33794. 'qXfer:siginfo:write' No '-' Yes
  33795. 'qXfer:threads:read' No '-' Yes
  33796. 'qXfer:traceframe-info:read'No '-' Yes
  33797. 'qXfer:uib:read' No '-' Yes
  33798. 'qXfer:fdpic:read' No '-' Yes
  33799. 'Qbtrace:off' Yes '-' Yes
  33800. 'Qbtrace:bts' Yes '-' Yes
  33801. 'Qbtrace:pt' Yes '-' Yes
  33802. 'Qbtrace-conf:bts:size' Yes '-' Yes
  33803. 'Qbtrace-conf:pt:size' Yes '-' Yes
  33804. 'QNonStop' No '-' Yes
  33805. 'QCatchSyscalls' No '-' Yes
  33806. 'QPassSignals' No '-' Yes
  33807. 'QStartNoAckMode' No '-' Yes
  33808. 'multiprocess' No '-' No
  33809. 'ConditionalBreakpoints' No '-' No
  33810. 'ConditionalTracepoints' No '-' No
  33811. 'ReverseContinue' No '-' No
  33812. 'ReverseStep' No '-' No
  33813. 'TracepointSource' No '-' No
  33814. 'QAgent' No '-' No
  33815. 'QAllow' No '-' No
  33816. 'QDisableRandomization' No '-' No
  33817. 'EnableDisableTracepoints'No '-' No
  33818. 'QTBuffer:size' No '-' No
  33819. 'tracenz' No '-' No
  33820. 'BreakpointCommands' No '-' No
  33821. 'swbreak' No '-' No
  33822. 'hwbreak' No '-' No
  33823. 'fork-events' No '-' No
  33824. 'vfork-events' No '-' No
  33825. 'exec-events' No '-' No
  33826. 'QThreadEvents' No '-' No
  33827. 'no-resumed' No '-' No
  33828. These are the currently defined stub features, in more detail:
  33829. 'PacketSize=BYTES'
  33830. The remote stub can accept packets up to at least BYTES in
  33831. length. GDB will send packets up to this size for bulk
  33832. transfers, and will never send larger packets. This is a
  33833. limit on the data characters in the packet, including the
  33834. frame and checksum. There is no trailing NUL byte in a remote
  33835. protocol packet; if the stub stores packets in a
  33836. NUL-terminated format, it should allow an extra byte in its
  33837. buffer for the NUL. If this stub feature is not supported, GDB
  33838. guesses based on the size of the 'g' packet response.
  33839. 'qXfer:auxv:read'
  33840. The remote stub understands the 'qXfer:auxv:read' packet
  33841. (*note qXfer auxiliary vector read::).
  33842. 'qXfer:btrace:read'
  33843. The remote stub understands the 'qXfer:btrace:read' packet
  33844. (*note qXfer btrace read::).
  33845. 'qXfer:btrace-conf:read'
  33846. The remote stub understands the 'qXfer:btrace-conf:read'
  33847. packet (*note qXfer btrace-conf read::).
  33848. 'qXfer:exec-file:read'
  33849. The remote stub understands the 'qXfer:exec-file:read' packet
  33850. (*note qXfer executable filename read::).
  33851. 'qXfer:features:read'
  33852. The remote stub understands the 'qXfer:features:read' packet
  33853. (*note qXfer target description read::).
  33854. 'qXfer:libraries:read'
  33855. The remote stub understands the 'qXfer:libraries:read' packet
  33856. (*note qXfer library list read::).
  33857. 'qXfer:libraries-svr4:read'
  33858. The remote stub understands the 'qXfer:libraries-svr4:read'
  33859. packet (*note qXfer svr4 library list read::).
  33860. 'augmented-libraries-svr4-read'
  33861. The remote stub understands the augmented form of the
  33862. 'qXfer:libraries-svr4:read' packet (*note qXfer svr4 library
  33863. list read::).
  33864. 'qXfer:memory-map:read'
  33865. The remote stub understands the 'qXfer:memory-map:read' packet
  33866. (*note qXfer memory map read::).
  33867. 'qXfer:sdata:read'
  33868. The remote stub understands the 'qXfer:sdata:read' packet
  33869. (*note qXfer sdata read::).
  33870. 'qXfer:spu:read'
  33871. The remote stub understands the 'qXfer:spu:read' packet (*note
  33872. qXfer spu read::).
  33873. 'qXfer:spu:write'
  33874. The remote stub understands the 'qXfer:spu:write' packet
  33875. (*note qXfer spu write::).
  33876. 'qXfer:siginfo:read'
  33877. The remote stub understands the 'qXfer:siginfo:read' packet
  33878. (*note qXfer siginfo read::).
  33879. 'qXfer:siginfo:write'
  33880. The remote stub understands the 'qXfer:siginfo:write' packet
  33881. (*note qXfer siginfo write::).
  33882. 'qXfer:threads:read'
  33883. The remote stub understands the 'qXfer:threads:read' packet
  33884. (*note qXfer threads read::).
  33885. 'qXfer:traceframe-info:read'
  33886. The remote stub understands the 'qXfer:traceframe-info:read'
  33887. packet (*note qXfer traceframe info read::).
  33888. 'qXfer:uib:read'
  33889. The remote stub understands the 'qXfer:uib:read' packet (*note
  33890. qXfer unwind info block::).
  33891. 'qXfer:fdpic:read'
  33892. The remote stub understands the 'qXfer:fdpic:read' packet
  33893. (*note qXfer fdpic loadmap read::).
  33894. 'QNonStop'
  33895. The remote stub understands the 'QNonStop' packet (*note
  33896. QNonStop::).
  33897. 'QCatchSyscalls'
  33898. The remote stub understands the 'QCatchSyscalls' packet (*note
  33899. QCatchSyscalls::).
  33900. 'QPassSignals'
  33901. The remote stub understands the 'QPassSignals' packet (*note
  33902. QPassSignals::).
  33903. 'QStartNoAckMode'
  33904. The remote stub understands the 'QStartNoAckMode' packet and
  33905. prefers to operate in no-acknowledgment mode. *Note Packet
  33906. Acknowledgment::.
  33907. 'multiprocess'
  33908. The remote stub understands the multiprocess extensions to the
  33909. remote protocol syntax. The multiprocess extensions affect
  33910. the syntax of thread IDs in both packets and replies (*note
  33911. thread-id syntax::), and add process IDs to the 'D' packet and
  33912. 'W' and 'X' replies. Note that reporting this feature
  33913. indicates support for the syntactic extensions only, not that
  33914. the stub necessarily supports debugging of more than one
  33915. process at a time. The stub must not use multiprocess
  33916. extensions in packet replies unless GDB has also indicated it
  33917. supports them in its 'qSupported' request.
  33918. 'qXfer:osdata:read'
  33919. The remote stub understands the 'qXfer:osdata:read' packet
  33920. ((*note qXfer osdata read::).
  33921. 'ConditionalBreakpoints'
  33922. The target accepts and implements evaluation of conditional
  33923. expressions defined for breakpoints. The target will only
  33924. report breakpoint triggers when such conditions are true
  33925. (*note Break Conditions: Conditions.).
  33926. 'ConditionalTracepoints'
  33927. The remote stub accepts and implements conditional expressions
  33928. defined for tracepoints (*note Tracepoint Conditions::).
  33929. 'ReverseContinue'
  33930. The remote stub accepts and implements the reverse continue
  33931. packet (*note bc::).
  33932. 'ReverseStep'
  33933. The remote stub accepts and implements the reverse step packet
  33934. (*note bs::).
  33935. 'TracepointSource'
  33936. The remote stub understands the 'QTDPsrc' packet that supplies
  33937. the source form of tracepoint definitions.
  33938. 'QAgent'
  33939. The remote stub understands the 'QAgent' packet.
  33940. 'QAllow'
  33941. The remote stub understands the 'QAllow' packet.
  33942. 'QDisableRandomization'
  33943. The remote stub understands the 'QDisableRandomization'
  33944. packet.
  33945. 'StaticTracepoint'
  33946. The remote stub supports static tracepoints.
  33947. 'InstallInTrace'
  33948. The remote stub supports installing tracepoint in tracing.
  33949. 'EnableDisableTracepoints'
  33950. The remote stub supports the 'QTEnable' (*note QTEnable::) and
  33951. 'QTDisable' (*note QTDisable::) packets that allow tracepoints
  33952. to be enabled and disabled while a trace experiment is
  33953. running.
  33954. 'QTBuffer:size'
  33955. The remote stub supports the 'QTBuffer:size' (*note
  33956. QTBuffer-size::) packet that allows to change the size of the
  33957. trace buffer.
  33958. 'tracenz'
  33959. The remote stub supports the 'tracenz' bytecode for collecting
  33960. strings. See *note Bytecode Descriptions:: for details about
  33961. the bytecode.
  33962. 'BreakpointCommands'
  33963. The remote stub supports running a breakpoint's command list
  33964. itself, rather than reporting the hit to GDB.
  33965. 'Qbtrace:off'
  33966. The remote stub understands the 'Qbtrace:off' packet.
  33967. 'Qbtrace:bts'
  33968. The remote stub understands the 'Qbtrace:bts' packet.
  33969. 'Qbtrace:pt'
  33970. The remote stub understands the 'Qbtrace:pt' packet.
  33971. 'Qbtrace-conf:bts:size'
  33972. The remote stub understands the 'Qbtrace-conf:bts:size'
  33973. packet.
  33974. 'Qbtrace-conf:pt:size'
  33975. The remote stub understands the 'Qbtrace-conf:pt:size' packet.
  33976. 'swbreak'
  33977. The remote stub reports the 'swbreak' stop reason for memory
  33978. breakpoints.
  33979. 'hwbreak'
  33980. The remote stub reports the 'hwbreak' stop reason for hardware
  33981. breakpoints.
  33982. 'fork-events'
  33983. The remote stub reports the 'fork' stop reason for fork
  33984. events.
  33985. 'vfork-events'
  33986. The remote stub reports the 'vfork' stop reason for vfork
  33987. events and vforkdone events.
  33988. 'exec-events'
  33989. The remote stub reports the 'exec' stop reason for exec
  33990. events.
  33991. 'vContSupported'
  33992. The remote stub reports the supported actions in the reply to
  33993. 'vCont?' packet.
  33994. 'QThreadEvents'
  33995. The remote stub understands the 'QThreadEvents' packet.
  33996. 'no-resumed'
  33997. The remote stub reports the 'N' stop reply.
  33998. 'qSymbol::'
  33999. Notify the target that GDB is prepared to serve symbol lookup
  34000. requests. Accept requests from the target for the values of
  34001. symbols.
  34002. Reply:
  34003. 'OK'
  34004. The target does not need to look up any (more) symbols.
  34005. 'qSymbol:SYM_NAME'
  34006. The target requests the value of symbol SYM_NAME (hex
  34007. encoded). GDB may provide the value by using the
  34008. 'qSymbol:SYM_VALUE:SYM_NAME' message, described below.
  34009. 'qSymbol:SYM_VALUE:SYM_NAME'
  34010. Set the value of SYM_NAME to SYM_VALUE.
  34011. SYM_NAME (hex encoded) is the name of a symbol whose value the
  34012. target has previously requested.
  34013. SYM_VALUE (hex) is the value for symbol SYM_NAME. If GDB cannot
  34014. supply a value for SYM_NAME, then this field will be empty.
  34015. Reply:
  34016. 'OK'
  34017. The target does not need to look up any (more) symbols.
  34018. 'qSymbol:SYM_NAME'
  34019. The target requests the value of a new symbol SYM_NAME (hex
  34020. encoded). GDB will continue to supply the values of symbols
  34021. (if available), until the target ceases to request them.
  34022. 'qTBuffer'
  34023. 'QTBuffer'
  34024. 'QTDisconnected'
  34025. 'QTDP'
  34026. 'QTDPsrc'
  34027. 'QTDV'
  34028. 'qTfP'
  34029. 'qTfV'
  34030. 'QTFrame'
  34031. 'qTMinFTPILen'
  34032. *Note Tracepoint Packets::.
  34033. 'qThreadExtraInfo,THREAD-ID'
  34034. Obtain from the target OS a printable string description of thread
  34035. attributes for the thread THREAD-ID; see *note thread-id syntax::,
  34036. for the forms of THREAD-ID. This string may contain anything that
  34037. the target OS thinks is interesting for GDB to tell the user about
  34038. the thread. The string is displayed in GDB's 'info threads'
  34039. display. Some examples of possible thread extra info strings are
  34040. 'Runnable', or 'Blocked on Mutex'.
  34041. Reply:
  34042. 'XX...'
  34043. Where 'XX...' is a hex encoding of ASCII data, comprising the
  34044. printable string containing the extra information about the
  34045. thread's attributes.
  34046. (Note that the 'qThreadExtraInfo' packet's name is separated from
  34047. the command by a ',', not a ':', contrary to the naming conventions
  34048. above. Please don't use this packet as a model for new packets.)
  34049. 'QTNotes'
  34050. 'qTP'
  34051. 'QTSave'
  34052. 'qTsP'
  34053. 'qTsV'
  34054. 'QTStart'
  34055. 'QTStop'
  34056. 'QTEnable'
  34057. 'QTDisable'
  34058. 'QTinit'
  34059. 'QTro'
  34060. 'qTStatus'
  34061. 'qTV'
  34062. 'qTfSTM'
  34063. 'qTsSTM'
  34064. 'qTSTMat'
  34065. *Note Tracepoint Packets::.
  34066. 'qXfer:OBJECT:read:ANNEX:OFFSET,LENGTH'
  34067. Read uninterpreted bytes from the target's special data area
  34068. identified by the keyword OBJECT. Request LENGTH bytes starting at
  34069. OFFSET bytes into the data. The content and encoding of ANNEX is
  34070. specific to OBJECT; it can supply additional details about what
  34071. data to access.
  34072. Reply:
  34073. 'm DATA'
  34074. Data DATA (*note Binary Data::) has been read from the target.
  34075. There may be more data at a higher address (although it is
  34076. permitted to return 'm' even for the last valid block of data,
  34077. as long as at least one byte of data was read). It is
  34078. possible for DATA to have fewer bytes than the LENGTH in the
  34079. request.
  34080. 'l DATA'
  34081. Data DATA (*note Binary Data::) has been read from the target.
  34082. There is no more data to be read. It is possible for DATA to
  34083. have fewer bytes than the LENGTH in the request.
  34084. 'l'
  34085. The OFFSET in the request is at the end of the data. There is
  34086. no more data to be read.
  34087. 'E00'
  34088. The request was malformed, or ANNEX was invalid.
  34089. 'E NN'
  34090. The offset was invalid, or there was an error encountered
  34091. reading the data. The NN part is a hex-encoded 'errno' value.
  34092. ''
  34093. An empty reply indicates the OBJECT string was not recognized
  34094. by the stub, or that the object does not support reading.
  34095. Here are the specific requests of this form defined so far. All
  34096. the 'qXfer:OBJECT:read:...' requests use the same reply formats,
  34097. listed above.
  34098. 'qXfer:auxv:read::OFFSET,LENGTH'
  34099. Access the target's "auxiliary vector". *Note auxiliary
  34100. vector: OS Information. Note ANNEX must be empty.
  34101. This packet is not probed by default; the remote stub must
  34102. request it, by supplying an appropriate 'qSupported' response
  34103. (*note qSupported::).
  34104. 'qXfer:btrace:read:ANNEX:OFFSET,LENGTH'
  34105. Return a description of the current branch trace. *Note
  34106. Branch Trace Format::. The annex part of the generic 'qXfer'
  34107. packet may have one of the following values:
  34108. 'all'
  34109. Returns all available branch trace.
  34110. 'new'
  34111. Returns all available branch trace if the branch trace
  34112. changed since the last read request.
  34113. 'delta'
  34114. Returns the new branch trace since the last read request.
  34115. Adds a new block to the end of the trace that begins at
  34116. zero and ends at the source location of the first branch
  34117. in the trace buffer. This extra block is used to stitch
  34118. traces together.
  34119. If the trace buffer overflowed, returns an error
  34120. indicating the overflow.
  34121. This packet is not probed by default; the remote stub must
  34122. request it by supplying an appropriate 'qSupported' response
  34123. (*note qSupported::).
  34124. 'qXfer:btrace-conf:read::OFFSET,LENGTH'
  34125. Return a description of the current branch trace
  34126. configuration. *Note Branch Trace Configuration Format::.
  34127. This packet is not probed by default; the remote stub must
  34128. request it by supplying an appropriate 'qSupported' response
  34129. (*note qSupported::).
  34130. 'qXfer:exec-file:read:ANNEX:OFFSET,LENGTH'
  34131. Return the full absolute name of the file that was executed to
  34132. create a process running on the remote system. The annex
  34133. specifies the numeric process ID of the process to query,
  34134. encoded as a hexadecimal number. If the annex part is empty
  34135. the remote stub should return the filename corresponding to
  34136. the currently executing process.
  34137. This packet is not probed by default; the remote stub must
  34138. request it, by supplying an appropriate 'qSupported' response
  34139. (*note qSupported::).
  34140. 'qXfer:features:read:ANNEX:OFFSET,LENGTH'
  34141. Access the "target description". *Note Target Descriptions::.
  34142. The annex specifies which XML document to access. The main
  34143. description is always loaded from the 'target.xml' annex.
  34144. This packet is not probed by default; the remote stub must
  34145. request it, by supplying an appropriate 'qSupported' response
  34146. (*note qSupported::).
  34147. 'qXfer:libraries:read:ANNEX:OFFSET,LENGTH'
  34148. Access the target's list of loaded libraries. *Note Library
  34149. List Format::. The annex part of the generic 'qXfer' packet
  34150. must be empty (*note qXfer read::).
  34151. Targets which maintain a list of libraries in the program's
  34152. memory do not need to implement this packet; it is designed
  34153. for platforms where the operating system manages the list of
  34154. loaded libraries.
  34155. This packet is not probed by default; the remote stub must
  34156. request it, by supplying an appropriate 'qSupported' response
  34157. (*note qSupported::).
  34158. 'qXfer:libraries-svr4:read:ANNEX:OFFSET,LENGTH'
  34159. Access the target's list of loaded libraries when the target
  34160. is an SVR4 platform. *Note Library List Format for SVR4
  34161. Targets::. The annex part of the generic 'qXfer' packet must
  34162. be empty unless the remote stub indicated it supports the
  34163. augmented form of this packet by supplying an appropriate
  34164. 'qSupported' response (*note qXfer read::, *note
  34165. qSupported::).
  34166. This packet is optional for better performance on SVR4
  34167. targets. GDB uses memory read packets to read the SVR4
  34168. library list otherwise.
  34169. This packet is not probed by default; the remote stub must
  34170. request it, by supplying an appropriate 'qSupported' response
  34171. (*note qSupported::).
  34172. If the remote stub indicates it supports the augmented form of
  34173. this packet then the annex part of the generic 'qXfer' packet
  34174. may contain a semicolon-separated list of 'NAME=VALUE'
  34175. arguments. The currently supported arguments are:
  34176. 'start=ADDRESS'
  34177. A hexadecimal number specifying the address of the
  34178. 'struct link_map' to start reading the library list from.
  34179. If unset or zero then the first 'struct link_map' in the
  34180. library list will be chosen as the starting point.
  34181. 'prev=ADDRESS'
  34182. A hexadecimal number specifying the address of the
  34183. 'struct link_map' immediately preceding the 'struct
  34184. link_map' specified by the 'start' argument. If unset or
  34185. zero then the remote stub will expect that no 'struct
  34186. link_map' exists prior to the starting point.
  34187. Arguments that are not understood by the remote stub will be
  34188. silently ignored.
  34189. 'qXfer:memory-map:read::OFFSET,LENGTH'
  34190. Access the target's "memory-map". *Note Memory Map Format::.
  34191. The annex part of the generic 'qXfer' packet must be empty
  34192. (*note qXfer read::).
  34193. This packet is not probed by default; the remote stub must
  34194. request it, by supplying an appropriate 'qSupported' response
  34195. (*note qSupported::).
  34196. 'qXfer:sdata:read::OFFSET,LENGTH'
  34197. Read contents of the extra collected static tracepoint marker
  34198. information. The annex part of the generic 'qXfer' packet
  34199. must be empty (*note qXfer read::). *Note Tracepoint Action
  34200. Lists: Tracepoint Actions.
  34201. This packet is not probed by default; the remote stub must
  34202. request it, by supplying an appropriate 'qSupported' response
  34203. (*note qSupported::).
  34204. 'qXfer:siginfo:read::OFFSET,LENGTH'
  34205. Read contents of the extra signal information on the target
  34206. system. The annex part of the generic 'qXfer' packet must be
  34207. empty (*note qXfer read::).
  34208. This packet is not probed by default; the remote stub must
  34209. request it, by supplying an appropriate 'qSupported' response
  34210. (*note qSupported::).
  34211. 'qXfer:spu:read:ANNEX:OFFSET,LENGTH'
  34212. Read contents of an 'spufs' file on the target system. The
  34213. annex specifies which file to read; it must be of the form
  34214. 'ID/NAME', where ID specifies an SPU context ID in the target
  34215. process, and NAME identifes the 'spufs' file in that context
  34216. to be accessed.
  34217. This packet is not probed by default; the remote stub must
  34218. request it, by supplying an appropriate 'qSupported' response
  34219. (*note qSupported::).
  34220. 'qXfer:threads:read::OFFSET,LENGTH'
  34221. Access the list of threads on target. *Note Thread List
  34222. Format::. The annex part of the generic 'qXfer' packet must
  34223. be empty (*note qXfer read::).
  34224. This packet is not probed by default; the remote stub must
  34225. request it, by supplying an appropriate 'qSupported' response
  34226. (*note qSupported::).
  34227. 'qXfer:traceframe-info:read::OFFSET,LENGTH'
  34228. Return a description of the current traceframe's contents.
  34229. *Note Traceframe Info Format::. The annex part of the generic
  34230. 'qXfer' packet must be empty (*note qXfer read::).
  34231. This packet is not probed by default; the remote stub must
  34232. request it, by supplying an appropriate 'qSupported' response
  34233. (*note qSupported::).
  34234. 'qXfer:uib:read:PC:OFFSET,LENGTH'
  34235. Return the unwind information block for PC. This packet is
  34236. used on OpenVMS/ia64 to ask the kernel unwind information.
  34237. This packet is not probed by default.
  34238. 'qXfer:fdpic:read:ANNEX:OFFSET,LENGTH'
  34239. Read contents of 'loadmap's on the target system. The annex,
  34240. either 'exec' or 'interp', specifies which 'loadmap',
  34241. executable 'loadmap' or interpreter 'loadmap' to read.
  34242. This packet is not probed by default; the remote stub must
  34243. request it, by supplying an appropriate 'qSupported' response
  34244. (*note qSupported::).
  34245. 'qXfer:osdata:read::OFFSET,LENGTH'
  34246. Access the target's "operating system information". *Note
  34247. Operating System Information::.
  34248. 'qXfer:OBJECT:write:ANNEX:OFFSET:DATA...'
  34249. Write uninterpreted bytes into the target's special data area
  34250. identified by the keyword OBJECT, starting at OFFSET bytes into the
  34251. data. The binary-encoded data (*note Binary Data::) to be written
  34252. is given by DATA.... The content and encoding of ANNEX is specific
  34253. to OBJECT; it can supply additional details about what data to
  34254. access.
  34255. Reply:
  34256. 'NN'
  34257. NN (hex encoded) is the number of bytes written. This may be
  34258. fewer bytes than supplied in the request.
  34259. 'E00'
  34260. The request was malformed, or ANNEX was invalid.
  34261. 'E NN'
  34262. The offset was invalid, or there was an error encountered
  34263. writing the data. The NN part is a hex-encoded 'errno' value.
  34264. ''
  34265. An empty reply indicates the OBJECT string was not recognized
  34266. by the stub, or that the object does not support writing.
  34267. Here are the specific requests of this form defined so far. All
  34268. the 'qXfer:OBJECT:write:...' requests use the same reply formats,
  34269. listed above.
  34270. 'qXfer:siginfo:write::OFFSET:DATA...'
  34271. Write DATA to the extra signal information on the target
  34272. system. The annex part of the generic 'qXfer' packet must be
  34273. empty (*note qXfer write::).
  34274. This packet is not probed by default; the remote stub must
  34275. request it, by supplying an appropriate 'qSupported' response
  34276. (*note qSupported::).
  34277. 'qXfer:spu:write:ANNEX:OFFSET:DATA...'
  34278. Write DATA to an 'spufs' file on the target system. The annex
  34279. specifies which file to write; it must be of the form
  34280. 'ID/NAME', where ID specifies an SPU context ID in the target
  34281. process, and NAME identifes the 'spufs' file in that context
  34282. to be accessed.
  34283. This packet is not probed by default; the remote stub must
  34284. request it, by supplying an appropriate 'qSupported' response
  34285. (*note qSupported::).
  34286. 'qXfer:OBJECT:OPERATION:...'
  34287. Requests of this form may be added in the future. When a stub does
  34288. not recognize the OBJECT keyword, or its support for OBJECT does
  34289. not recognize the OPERATION keyword, the stub must respond with an
  34290. empty packet.
  34291. 'qAttached:PID'
  34292. Return an indication of whether the remote server attached to an
  34293. existing process or created a new process. When the multiprocess
  34294. protocol extensions are supported (*note multiprocess
  34295. extensions::), PID is an integer in hexadecimal format identifying
  34296. the target process. Otherwise, GDB will omit the PID field and the
  34297. query packet will be simplified as 'qAttached'.
  34298. This query is used, for example, to know whether the remote process
  34299. should be detached or killed when a GDB session is ended with the
  34300. 'quit' command.
  34301. Reply:
  34302. '1'
  34303. The remote server attached to an existing process.
  34304. '0'
  34305. The remote server created a new process.
  34306. 'E NN'
  34307. A badly formed request or an error was encountered.
  34308. 'Qbtrace:bts'
  34309. Enable branch tracing for the current thread using Branch Trace
  34310. Store.
  34311. Reply:
  34312. 'OK'
  34313. Branch tracing has been enabled.
  34314. 'E.errtext'
  34315. A badly formed request or an error was encountered.
  34316. 'Qbtrace:pt'
  34317. Enable branch tracing for the current thread using Intel Processor
  34318. Trace.
  34319. Reply:
  34320. 'OK'
  34321. Branch tracing has been enabled.
  34322. 'E.errtext'
  34323. A badly formed request or an error was encountered.
  34324. 'Qbtrace:off'
  34325. Disable branch tracing for the current thread.
  34326. Reply:
  34327. 'OK'
  34328. Branch tracing has been disabled.
  34329. 'E.errtext'
  34330. A badly formed request or an error was encountered.
  34331. 'Qbtrace-conf:bts:size=VALUE'
  34332. Set the requested ring buffer size for new threads that use the
  34333. btrace recording method in bts format.
  34334. Reply:
  34335. 'OK'
  34336. The ring buffer size has been set.
  34337. 'E.errtext'
  34338. A badly formed request or an error was encountered.
  34339. 'Qbtrace-conf:pt:size=VALUE'
  34340. Set the requested ring buffer size for new threads that use the
  34341. btrace recording method in pt format.
  34342. Reply:
  34343. 'OK'
  34344. The ring buffer size has been set.
  34345. 'E.errtext'
  34346. A badly formed request or an error was encountered.
  34347. ---------- Footnotes ----------
  34348. (1) The 'qP' and 'qL' packets predate these conventions, and have
  34349. arguments without any terminator for the packet name; we suspect they
  34350. are in widespread use in places that are difficult to upgrade. The 'qC'
  34351. packet has no arguments, but some existing stubs (e.g. RedBoot) are
  34352. known to not check for the end of the packet.
  34353. 
  34354. File: gdb.info, Node: Architecture-Specific Protocol Details, Next: Tracepoint Packets, Prev: General Query Packets, Up: Remote Protocol
  34355. E.5 Architecture-Specific Protocol Details
  34356. ==========================================
  34357. This section describes how the remote protocol is applied to specific
  34358. target architectures. Also see *note Standard Target Features::, for
  34359. details of XML target descriptions for each architecture.
  34360. * Menu:
  34361. * ARM-Specific Protocol Details::
  34362. * MIPS-Specific Protocol Details::
  34363. 
  34364. File: gdb.info, Node: ARM-Specific Protocol Details, Next: MIPS-Specific Protocol Details, Up: Architecture-Specific Protocol Details
  34365. E.5.1 ARM-specific Protocol Details
  34366. -----------------------------------
  34367. * Menu:
  34368. * ARM Breakpoint Kinds::
  34369. 
  34370. File: gdb.info, Node: ARM Breakpoint Kinds, Up: ARM-Specific Protocol Details
  34371. E.5.1.1 ARM Breakpoint Kinds
  34372. ............................
  34373. These breakpoint kinds are defined for the 'Z0' and 'Z1' packets.
  34374. 2
  34375. 16-bit Thumb mode breakpoint.
  34376. 3
  34377. 32-bit Thumb mode (Thumb-2) breakpoint.
  34378. 4
  34379. 32-bit ARM mode breakpoint.
  34380. 
  34381. File: gdb.info, Node: MIPS-Specific Protocol Details, Prev: ARM-Specific Protocol Details, Up: Architecture-Specific Protocol Details
  34382. E.5.2 MIPS-specific Protocol Details
  34383. ------------------------------------
  34384. * Menu:
  34385. * MIPS Register packet Format::
  34386. * MIPS Breakpoint Kinds::
  34387. 
  34388. File: gdb.info, Node: MIPS Register packet Format, Next: MIPS Breakpoint Kinds, Up: MIPS-Specific Protocol Details
  34389. E.5.2.1 MIPS Register Packet Format
  34390. ...................................
  34391. The following 'g'/'G' packets have previously been defined. In the
  34392. below, some thirty-two bit registers are transferred as sixty-four bits.
  34393. Those registers should be zero/sign extended (which?) to fill the space
  34394. allocated. Register bytes are transferred in target byte order. The
  34395. two nibbles within a register byte are transferred most-significant -
  34396. least-significant.
  34397. MIPS32
  34398. All registers are transferred as thirty-two bit quantities in the
  34399. order: 32 general-purpose; sr; lo; hi; bad; cause; pc; 32
  34400. floating-point registers; fsr; fir; fp.
  34401. MIPS64
  34402. All registers are transferred as sixty-four bit quantities
  34403. (including thirty-two bit registers such as 'sr'). The ordering is
  34404. the same as 'MIPS32'.
  34405. 
  34406. File: gdb.info, Node: MIPS Breakpoint Kinds, Prev: MIPS Register packet Format, Up: MIPS-Specific Protocol Details
  34407. E.5.2.2 MIPS Breakpoint Kinds
  34408. .............................
  34409. These breakpoint kinds are defined for the 'Z0' and 'Z1' packets.
  34410. 2
  34411. 16-bit MIPS16 mode breakpoint.
  34412. 3
  34413. 16-bit microMIPS mode breakpoint.
  34414. 4
  34415. 32-bit standard MIPS mode breakpoint.
  34416. 5
  34417. 32-bit microMIPS mode breakpoint.
  34418. 
  34419. File: gdb.info, Node: Tracepoint Packets, Next: Host I/O Packets, Prev: Architecture-Specific Protocol Details, Up: Remote Protocol
  34420. E.6 Tracepoint Packets
  34421. ======================
  34422. Here we describe the packets GDB uses to implement tracepoints (*note
  34423. Tracepoints::).
  34424. 'QTDP:N:ADDR:ENA:STEP:PASS[:FFLEN][:XLEN,BYTES][-]'
  34425. Create a new tracepoint, number N, at ADDR. If ENA is 'E', then
  34426. the tracepoint is enabled; if it is 'D', then the tracepoint is
  34427. disabled. The STEP gives the tracepoint's step count, and PASS
  34428. gives its pass count. If an 'F' is present, then the tracepoint is
  34429. to be a fast tracepoint, and the FLEN is the number of bytes that
  34430. the target should copy elsewhere to make room for the tracepoint.
  34431. If an 'X' is present, it introduces a tracepoint condition, which
  34432. consists of a hexadecimal length, followed by a comma and
  34433. hex-encoded bytes, in a manner similar to action encodings as
  34434. described below. If the trailing '-' is present, further 'QTDP'
  34435. packets will follow to specify this tracepoint's actions.
  34436. Replies:
  34437. 'OK'
  34438. The packet was understood and carried out.
  34439. 'qRelocInsn'
  34440. *Note Relocate instruction reply packet: Tracepoint Packets.
  34441. ''
  34442. The packet was not recognized.
  34443. 'QTDP:-N:ADDR:[S]ACTION...[-]'
  34444. Define actions to be taken when a tracepoint is hit. The N and
  34445. ADDR must be the same as in the initial 'QTDP' packet for this
  34446. tracepoint. This packet may only be sent immediately after another
  34447. 'QTDP' packet that ended with a '-'. If the trailing '-' is
  34448. present, further 'QTDP' packets will follow, specifying more
  34449. actions for this tracepoint.
  34450. In the series of action packets for a given tracepoint, at most one
  34451. can have an 'S' before its first ACTION. If such a packet is sent,
  34452. it and the following packets define "while-stepping" actions. Any
  34453. prior packets define ordinary actions -- that is, those taken when
  34454. the tracepoint is first hit. If no action packet has an 'S', then
  34455. all the packets in the series specify ordinary tracepoint actions.
  34456. The 'ACTION...' portion of the packet is a series of actions,
  34457. concatenated without separators. Each action has one of the
  34458. following forms:
  34459. 'R MASK'
  34460. Collect the registers whose bits are set in MASK, a
  34461. hexadecimal number whose I'th bit is set if register number I
  34462. should be collected. (The least significant bit is numbered
  34463. zero.) Note that MASK may be any number of digits long; it
  34464. may not fit in a 32-bit word.
  34465. 'M BASEREG,OFFSET,LEN'
  34466. Collect LEN bytes of memory starting at the address in
  34467. register number BASEREG, plus OFFSET. If BASEREG is '-1',
  34468. then the range has a fixed address: OFFSET is the address of
  34469. the lowest byte to collect. The BASEREG, OFFSET, and LEN
  34470. parameters are all unsigned hexadecimal values (the '-1' value
  34471. for BASEREG is a special case).
  34472. 'X LEN,EXPR'
  34473. Evaluate EXPR, whose length is LEN, and collect memory as it
  34474. directs. The agent expression EXPR is as described in *note
  34475. Agent Expressions::. Each byte of the expression is encoded
  34476. as a two-digit hex number in the packet; LEN is the number of
  34477. bytes in the expression (and thus one-half the number of hex
  34478. digits in the packet).
  34479. Any number of actions may be packed together in a single 'QTDP'
  34480. packet, as long as the packet does not exceed the maximum packet
  34481. length (400 bytes, for many stubs). There may be only one 'R'
  34482. action per tracepoint, and it must precede any 'M' or 'X' actions.
  34483. Any registers referred to by 'M' and 'X' actions must be collected
  34484. by a preceding 'R' action. (The "while-stepping" actions are
  34485. treated as if they were attached to a separate tracepoint, as far
  34486. as these restrictions are concerned.)
  34487. Replies:
  34488. 'OK'
  34489. The packet was understood and carried out.
  34490. 'qRelocInsn'
  34491. *Note Relocate instruction reply packet: Tracepoint Packets.
  34492. ''
  34493. The packet was not recognized.
  34494. 'QTDPsrc:N:ADDR:TYPE:START:SLEN:BYTES'
  34495. Specify a source string of tracepoint N at address ADDR. This is
  34496. useful to get accurate reproduction of the tracepoints originally
  34497. downloaded at the beginning of the trace run. The TYPE is the name
  34498. of the tracepoint part, such as 'cond' for the tracepoint's
  34499. conditional expression (see below for a list of types), while BYTES
  34500. is the string, encoded in hexadecimal.
  34501. START is the offset of the BYTES within the overall source string,
  34502. while SLEN is the total length of the source string. This is
  34503. intended for handling source strings that are longer than will fit
  34504. in a single packet.
  34505. The available string types are 'at' for the location, 'cond' for
  34506. the conditional, and 'cmd' for an action command. GDB sends a
  34507. separate packet for each command in the action list, in the same
  34508. order in which the commands are stored in the list.
  34509. The target does not need to do anything with source strings except
  34510. report them back as part of the replies to the 'qTfP'/'qTsP' query
  34511. packets.
  34512. Although this packet is optional, and GDB will only send it if the
  34513. target replies with 'TracepointSource' *Note General Query
  34514. Packets::, it makes both disconnected tracing and trace files much
  34515. easier to use. Otherwise the user must be careful that the
  34516. tracepoints in effect while looking at trace frames are identical
  34517. to the ones in effect during the trace run; even a small
  34518. discrepancy could cause 'tdump' not to work, or a particular trace
  34519. frame not be found.
  34520. 'QTDV:N:VALUE:BUILTIN:NAME'
  34521. Create a new trace state variable, number N, with an initial value
  34522. of VALUE, which is a 64-bit signed integer. Both N and VALUE are
  34523. encoded as hexadecimal values. GDB has the option of not using
  34524. this packet for initial values of zero; the target should simply
  34525. create the trace state variables as they are mentioned in
  34526. expressions. The value BUILTIN should be 1 (one) if the trace
  34527. state variable is builtin and 0 (zero) if it is not builtin. GDB
  34528. only sets BUILTIN to 1 if a previous 'qTfV' or 'qTsV' packet had it
  34529. set. The contents of NAME is the hex-encoded name (without the
  34530. leading '$') of the trace state variable.
  34531. 'QTFrame:N'
  34532. Select the N'th tracepoint frame from the buffer, and use the
  34533. register and memory contents recorded there to answer subsequent
  34534. request packets from GDB.
  34535. A successful reply from the stub indicates that the stub has found
  34536. the requested frame. The response is a series of parts,
  34537. concatenated without separators, describing the frame we selected.
  34538. Each part has one of the following forms:
  34539. 'F F'
  34540. The selected frame is number N in the trace frame buffer; F is
  34541. a hexadecimal number. If F is '-1', then there was no frame
  34542. matching the criteria in the request packet.
  34543. 'T T'
  34544. The selected trace frame records a hit of tracepoint number T;
  34545. T is a hexadecimal number.
  34546. 'QTFrame:pc:ADDR'
  34547. Like 'QTFrame:N', but select the first tracepoint frame after the
  34548. currently selected frame whose PC is ADDR; ADDR is a hexadecimal
  34549. number.
  34550. 'QTFrame:tdp:T'
  34551. Like 'QTFrame:N', but select the first tracepoint frame after the
  34552. currently selected frame that is a hit of tracepoint T; T is a
  34553. hexadecimal number.
  34554. 'QTFrame:range:START:END'
  34555. Like 'QTFrame:N', but select the first tracepoint frame after the
  34556. currently selected frame whose PC is between START (inclusive) and
  34557. END (inclusive); START and END are hexadecimal numbers.
  34558. 'QTFrame:outside:START:END'
  34559. Like 'QTFrame:range:START:END', but select the first frame
  34560. _outside_ the given range of addresses (exclusive).
  34561. 'qTMinFTPILen'
  34562. This packet requests the minimum length of instruction at which a
  34563. fast tracepoint (*note Set Tracepoints::) may be placed. For
  34564. instance, on the 32-bit x86 architecture, it is possible to use a
  34565. 4-byte jump, but it depends on the target system being able to
  34566. create trampolines in the first 64K of memory, which might or might
  34567. not be possible for that system. So the reply to this packet will
  34568. be 4 if it is able to arrange for that.
  34569. Replies:
  34570. '0'
  34571. The minimum instruction length is currently unknown.
  34572. 'LENGTH'
  34573. The minimum instruction length is LENGTH, where LENGTH is a
  34574. hexadecimal number greater or equal to 1. A reply of 1 means
  34575. that a fast tracepoint may be placed on any instruction
  34576. regardless of size.
  34577. 'E'
  34578. An error has occurred.
  34579. ''
  34580. An empty reply indicates that the request is not supported by
  34581. the stub.
  34582. 'QTStart'
  34583. Begin the tracepoint experiment. Begin collecting data from
  34584. tracepoint hits in the trace frame buffer. This packet supports
  34585. the 'qRelocInsn' reply (*note Relocate instruction reply packet:
  34586. Tracepoint Packets.).
  34587. 'QTStop'
  34588. End the tracepoint experiment. Stop collecting trace frames.
  34589. 'QTEnable:N:ADDR'
  34590. Enable tracepoint N at address ADDR in a started tracepoint
  34591. experiment. If the tracepoint was previously disabled, then
  34592. collection of data from it will resume.
  34593. 'QTDisable:N:ADDR'
  34594. Disable tracepoint N at address ADDR in a started tracepoint
  34595. experiment. No more data will be collected from the tracepoint
  34596. unless 'QTEnable:N:ADDR' is subsequently issued.
  34597. 'QTinit'
  34598. Clear the table of tracepoints, and empty the trace frame buffer.
  34599. 'QTro:START1,END1:START2,END2:...'
  34600. Establish the given ranges of memory as "transparent". The stub
  34601. will answer requests for these ranges from memory's current
  34602. contents, if they were not collected as part of the tracepoint hit.
  34603. GDB uses this to mark read-only regions of memory, like those
  34604. containing program code. Since these areas never change, they
  34605. should still have the same contents they did when the tracepoint
  34606. was hit, so there's no reason for the stub to refuse to provide
  34607. their contents.
  34608. 'QTDisconnected:VALUE'
  34609. Set the choice to what to do with the tracing run when GDB
  34610. disconnects from the target. A VALUE of 1 directs the target to
  34611. continue the tracing run, while 0 tells the target to stop tracing
  34612. if GDB is no longer in the picture.
  34613. 'qTStatus'
  34614. Ask the stub if there is a trace experiment running right now.
  34615. The reply has the form:
  34616. 'TRUNNING[;FIELD]...'
  34617. RUNNING is a single digit '1' if the trace is presently
  34618. running, or '0' if not. It is followed by semicolon-separated
  34619. optional fields that an agent may use to report additional
  34620. status.
  34621. If the trace is not running, the agent may report any of several
  34622. explanations as one of the optional fields:
  34623. 'tnotrun:0'
  34624. No trace has been run yet.
  34625. 'tstop[:TEXT]:0'
  34626. The trace was stopped by a user-originated stop command. The
  34627. optional TEXT field is a user-supplied string supplied as part
  34628. of the stop command (for instance, an explanation of why the
  34629. trace was stopped manually). It is hex-encoded.
  34630. 'tfull:0'
  34631. The trace stopped because the trace buffer filled up.
  34632. 'tdisconnected:0'
  34633. The trace stopped because GDB disconnected from the target.
  34634. 'tpasscount:TPNUM'
  34635. The trace stopped because tracepoint TPNUM exceeded its pass
  34636. count.
  34637. 'terror:TEXT:TPNUM'
  34638. The trace stopped because tracepoint TPNUM had an error. The
  34639. string TEXT is available to describe the nature of the error
  34640. (for instance, a divide by zero in the condition expression);
  34641. it is hex encoded.
  34642. 'tunknown:0'
  34643. The trace stopped for some other reason.
  34644. Additional optional fields supply statistical and other
  34645. information. Although not required, they are extremely useful for
  34646. users monitoring the progress of a trace run. If a trace has
  34647. stopped, and these numbers are reported, they must reflect the
  34648. state of the just-stopped trace.
  34649. 'tframes:N'
  34650. The number of trace frames in the buffer.
  34651. 'tcreated:N'
  34652. The total number of trace frames created during the run. This
  34653. may be larger than the trace frame count, if the buffer is
  34654. circular.
  34655. 'tsize:N'
  34656. The total size of the trace buffer, in bytes.
  34657. 'tfree:N'
  34658. The number of bytes still unused in the buffer.
  34659. 'circular:N'
  34660. The value of the circular trace buffer flag. '1' means that
  34661. the trace buffer is circular and old trace frames will be
  34662. discarded if necessary to make room, '0' means that the trace
  34663. buffer is linear and may fill up.
  34664. 'disconn:N'
  34665. The value of the disconnected tracing flag. '1' means that
  34666. tracing will continue after GDB disconnects, '0' means that
  34667. the trace run will stop.
  34668. 'qTP:TP:ADDR'
  34669. Ask the stub for the current state of tracepoint number TP at
  34670. address ADDR.
  34671. Replies:
  34672. 'VHITS:USAGE'
  34673. The tracepoint has been hit HITS times so far during the trace
  34674. run, and accounts for USAGE in the trace buffer. Note that
  34675. 'while-stepping' steps are not counted as separate hits, but
  34676. the steps' space consumption is added into the usage number.
  34677. 'qTV:VAR'
  34678. Ask the stub for the value of the trace state variable number VAR.
  34679. Replies:
  34680. 'VVALUE'
  34681. The value of the variable is VALUE. This will be the current
  34682. value of the variable if the user is examining a running
  34683. target, or a saved value if the variable was collected in the
  34684. trace frame that the user is looking at. Note that multiple
  34685. requests may result in different reply values, such as when
  34686. requesting values while the program is running.
  34687. 'U'
  34688. The value of the variable is unknown. This would occur, for
  34689. example, if the user is examining a trace frame in which the
  34690. requested variable was not collected.
  34691. 'qTfP'
  34692. 'qTsP'
  34693. These packets request data about tracepoints that are being used by
  34694. the target. GDB sends 'qTfP' to get the first piece of data, and
  34695. multiple 'qTsP' to get additional pieces. Replies to these packets
  34696. generally take the form of the 'QTDP' packets that define
  34697. tracepoints. (FIXME add detailed syntax)
  34698. 'qTfV'
  34699. 'qTsV'
  34700. These packets request data about trace state variables that are on
  34701. the target. GDB sends 'qTfV' to get the first vari of data, and
  34702. multiple 'qTsV' to get additional variables. Replies to these
  34703. packets follow the syntax of the 'QTDV' packets that define trace
  34704. state variables.
  34705. 'qTfSTM'
  34706. 'qTsSTM'
  34707. These packets request data about static tracepoint markers that
  34708. exist in the target program. GDB sends 'qTfSTM' to get the first
  34709. piece of data, and multiple 'qTsSTM' to get additional pieces.
  34710. Replies to these packets take the following form:
  34711. Reply:
  34712. 'm ADDRESS:ID:EXTRA'
  34713. A single marker
  34714. 'm ADDRESS:ID:EXTRA,ADDRESS:ID:EXTRA...'
  34715. a comma-separated list of markers
  34716. 'l'
  34717. (lower case letter 'L') denotes end of list.
  34718. 'E NN'
  34719. An error occurred. The error number NN is given as hex
  34720. digits.
  34721. ''
  34722. An empty reply indicates that the request is not supported by
  34723. the stub.
  34724. The ADDRESS is encoded in hex; ID and EXTRA are strings encoded in
  34725. hex.
  34726. In response to each query, the target will reply with a list of one
  34727. or more markers, separated by commas. GDB will respond to each
  34728. reply with a request for more markers (using the 'qs' form of the
  34729. query), until the target responds with 'l' (lower-case ell, for
  34730. "last").
  34731. 'qTSTMat:ADDRESS'
  34732. This packets requests data about static tracepoint markers in the
  34733. target program at ADDRESS. Replies to this packet follow the
  34734. syntax of the 'qTfSTM' and 'qTsSTM' packets that list static
  34735. tracepoint markers.
  34736. 'QTSave:FILENAME'
  34737. This packet directs the target to save trace data to the file name
  34738. FILENAME in the target's filesystem. The FILENAME is encoded as a
  34739. hex string; the interpretation of the file name (relative vs
  34740. absolute, wild cards, etc) is up to the target.
  34741. 'qTBuffer:OFFSET,LEN'
  34742. Return up to LEN bytes of the current contents of trace buffer,
  34743. starting at OFFSET. The trace buffer is treated as if it were a
  34744. contiguous collection of traceframes, as per the trace file format.
  34745. The reply consists as many hex-encoded bytes as the target can
  34746. deliver in a packet; it is not an error to return fewer than were
  34747. asked for. A reply consisting of just 'l' indicates that no bytes
  34748. are available.
  34749. 'QTBuffer:circular:VALUE'
  34750. This packet directs the target to use a circular trace buffer if
  34751. VALUE is 1, or a linear buffer if the value is 0.
  34752. 'QTBuffer:size:SIZE'
  34753. This packet directs the target to make the trace buffer be of size
  34754. SIZE if possible. A value of '-1' tells the target to use whatever
  34755. size it prefers.
  34756. 'QTNotes:[TYPE:TEXT][;TYPE:TEXT]...'
  34757. This packet adds optional textual notes to the trace run.
  34758. Allowable types include 'user', 'notes', and 'tstop', the TEXT
  34759. fields are arbitrary strings, hex-encoded.
  34760. E.6.1 Relocate instruction reply packet
  34761. ---------------------------------------
  34762. When installing fast tracepoints in memory, the target may need to
  34763. relocate the instruction currently at the tracepoint address to a
  34764. different address in memory. For most instructions, a simple copy is
  34765. enough, but, for example, call instructions that implicitly push the
  34766. return address on the stack, and relative branches or other PC-relative
  34767. instructions require offset adjustment, so that the effect of executing
  34768. the instruction at a different address is the same as if it had executed
  34769. in the original location.
  34770. In response to several of the tracepoint packets, the target may also
  34771. respond with a number of intermediate 'qRelocInsn' request packets
  34772. before the final result packet, to have GDB handle this relocation
  34773. operation. If a packet supports this mechanism, its documentation will
  34774. explicitly say so. See for example the above descriptions for the
  34775. 'QTStart' and 'QTDP' packets. The format of the request is:
  34776. 'qRelocInsn:FROM;TO'
  34777. This requests GDB to copy instruction at address FROM to address
  34778. TO, possibly adjusted so that executing the instruction at TO has
  34779. the same effect as executing it at FROM. GDB writes the adjusted
  34780. instruction to target memory starting at TO.
  34781. Replies:
  34782. 'qRelocInsn:ADJUSTED_SIZE'
  34783. Informs the stub the relocation is complete. The ADJUSTED_SIZE is
  34784. the length in bytes of resulting relocated instruction sequence.
  34785. 'E NN'
  34786. A badly formed request was detected, or an error was encountered
  34787. while relocating the instruction.
  34788. 
  34789. File: gdb.info, Node: Host I/O Packets, Next: Interrupts, Prev: Tracepoint Packets, Up: Remote Protocol
  34790. E.7 Host I/O Packets
  34791. ====================
  34792. The "Host I/O" packets allow GDB to perform I/O operations on the far
  34793. side of a remote link. For example, Host I/O is used to upload and
  34794. download files to a remote target with its own filesystem. Host I/O
  34795. uses the same constant values and data structure layout as the
  34796. target-initiated File-I/O protocol. However, the Host I/O packets are
  34797. structured differently. The target-initiated protocol relies on target
  34798. memory to store parameters and buffers. Host I/O requests are initiated
  34799. by GDB, and the target's memory is not involved. *Note File-I/O Remote
  34800. Protocol Extension::, for more details on the target-initiated protocol.
  34801. The Host I/O request packets all encode a single operation along with
  34802. its arguments. They have this format:
  34803. 'vFile:OPERATION: PARAMETER...'
  34804. OPERATION is the name of the particular request; the target should
  34805. compare the entire packet name up to the second colon when checking
  34806. for a supported operation. The format of PARAMETER depends on the
  34807. operation. Numbers are always passed in hexadecimal. Negative
  34808. numbers have an explicit minus sign (i.e. two's complement is not
  34809. used). Strings (e.g. filenames) are encoded as a series of
  34810. hexadecimal bytes. The last argument to a system call may be a
  34811. buffer of escaped binary data (*note Binary Data::).
  34812. The valid responses to Host I/O packets are:
  34813. 'F RESULT [, ERRNO] [; ATTACHMENT]'
  34814. RESULT is the integer value returned by this operation, usually
  34815. non-negative for success and -1 for errors. If an error has
  34816. occured, ERRNO will be included in the result specifying a value
  34817. defined by the File-I/O protocol (*note Errno Values::). For
  34818. operations which return data, ATTACHMENT supplies the data as a
  34819. binary buffer. Binary buffers in response packets are escaped in
  34820. the normal way (*note Binary Data::). See the individual packet
  34821. documentation for the interpretation of RESULT and ATTACHMENT.
  34822. ''
  34823. An empty response indicates that this operation is not recognized.
  34824. These are the supported Host I/O operations:
  34825. 'vFile:open: FILENAME, FLAGS, MODE'
  34826. Open a file at FILENAME and return a file descriptor for it, or
  34827. return -1 if an error occurs. The FILENAME is a string, FLAGS is
  34828. an integer indicating a mask of open flags (*note Open Flags::),
  34829. and MODE is an integer indicating a mask of mode bits to use if the
  34830. file is created (*note mode_t Values::). *Note open::, for details
  34831. of the open flags and mode values.
  34832. 'vFile:close: FD'
  34833. Close the open file corresponding to FD and return 0, or -1 if an
  34834. error occurs.
  34835. 'vFile:pread: FD, COUNT, OFFSET'
  34836. Read data from the open file corresponding to FD. Up to COUNT
  34837. bytes will be read from the file, starting at OFFSET relative to
  34838. the start of the file. The target may read fewer bytes; common
  34839. reasons include packet size limits and an end-of-file condition.
  34840. The number of bytes read is returned. Zero should only be returned
  34841. for a successful read at the end of the file, or if COUNT was zero.
  34842. The data read should be returned as a binary attachment on success.
  34843. If zero bytes were read, the response should include an empty
  34844. binary attachment (i.e. a trailing semicolon). The return value is
  34845. the number of target bytes read; the binary attachment may be
  34846. longer if some characters were escaped.
  34847. 'vFile:pwrite: FD, OFFSET, DATA'
  34848. Write DATA (a binary buffer) to the open file corresponding to FD.
  34849. Start the write at OFFSET from the start of the file. Unlike many
  34850. 'write' system calls, there is no separate COUNT argument; the
  34851. length of DATA in the packet is used. 'vFile:write' returns the
  34852. number of bytes written, which may be shorter than the length of
  34853. DATA, or -1 if an error occurred.
  34854. 'vFile:fstat: FD'
  34855. Get information about the open file corresponding to FD. On
  34856. success the information is returned as a binary attachment and the
  34857. return value is the size of this attachment in bytes. If an error
  34858. occurs the return value is -1. The format of the returned binary
  34859. attachment is as described in *note struct stat::.
  34860. 'vFile:unlink: FILENAME'
  34861. Delete the file at FILENAME on the target. Return 0, or -1 if an
  34862. error occurs. The FILENAME is a string.
  34863. 'vFile:readlink: FILENAME'
  34864. Read value of symbolic link FILENAME on the target. Return the
  34865. number of bytes read, or -1 if an error occurs.
  34866. The data read should be returned as a binary attachment on success.
  34867. If zero bytes were read, the response should include an empty
  34868. binary attachment (i.e. a trailing semicolon). The return value is
  34869. the number of target bytes read; the binary attachment may be
  34870. longer if some characters were escaped.
  34871. 'vFile:setfs: PID'
  34872. Select the filesystem on which 'vFile' operations with FILENAME
  34873. arguments will operate. This is required for GDB to be able to
  34874. access files on remote targets where the remote stub does not share
  34875. a common filesystem with the inferior(s).
  34876. If PID is nonzero, select the filesystem as seen by process PID.
  34877. If PID is zero, select the filesystem as seen by the remote stub.
  34878. Return 0 on success, or -1 if an error occurs. If 'vFile:setfs:'
  34879. indicates success, the selected filesystem remains selected until
  34880. the next successful 'vFile:setfs:' operation.
  34881. 
  34882. File: gdb.info, Node: Interrupts, Next: Notification Packets, Prev: Host I/O Packets, Up: Remote Protocol
  34883. E.8 Interrupts
  34884. ==============
  34885. In all-stop mode, when a program on the remote target is running, GDB
  34886. may attempt to interrupt it by sending a 'Ctrl-C', 'BREAK' or a 'BREAK'
  34887. followed by 'g', control of which is specified via GDB's
  34888. 'interrupt-sequence'.
  34889. The precise meaning of 'BREAK' is defined by the transport mechanism
  34890. and may, in fact, be undefined. GDB does not currently define a 'BREAK'
  34891. mechanism for any of the network interfaces except for TCP, in which
  34892. case GDB sends the 'telnet' BREAK sequence.
  34893. 'Ctrl-C', on the other hand, is defined and implemented for all
  34894. transport mechanisms. It is represented by sending the single byte
  34895. '0x03' without any of the usual packet overhead described in the
  34896. Overview section (*note Overview::). When a '0x03' byte is transmitted
  34897. as part of a packet, it is considered to be packet data and does _not_
  34898. represent an interrupt. E.g., an 'X' packet (*note X packet::), used
  34899. for binary downloads, may include an unescaped '0x03' as part of its
  34900. packet.
  34901. 'BREAK' followed by 'g' is also known as Magic SysRq g. When Linux
  34902. kernel receives this sequence from serial port, it stops execution and
  34903. connects to gdb.
  34904. In non-stop mode, because packet resumptions are asynchronous (*note
  34905. vCont packet::), GDB is always free to send a remote command to the
  34906. remote stub, even when the target is running. For that reason, GDB
  34907. instead sends a regular packet (*note vCtrlC packet::) with the usual
  34908. packet framing instead of the single byte '0x03'.
  34909. Stubs are not required to recognize these interrupt mechanisms and
  34910. the precise meaning associated with receipt of the interrupt is
  34911. implementation defined. If the target supports debugging of multiple
  34912. threads and/or processes, it should attempt to interrupt all
  34913. currently-executing threads and processes. If the stub is successful at
  34914. interrupting the running program, it should send one of the stop reply
  34915. packets (*note Stop Reply Packets::) to GDB as a result of successfully
  34916. stopping the program in all-stop mode, and a stop reply for each stopped
  34917. thread in non-stop mode. Interrupts received while the program is
  34918. stopped are queued and the program will be interrupted when it is
  34919. resumed next time.
  34920. 
  34921. File: gdb.info, Node: Notification Packets, Next: Remote Non-Stop, Prev: Interrupts, Up: Remote Protocol
  34922. E.9 Notification Packets
  34923. ========================
  34924. The GDB remote serial protocol includes "notifications", packets that
  34925. require no acknowledgment. Both the GDB and the stub may send
  34926. notifications (although the only notifications defined at present are
  34927. sent by the stub). Notifications carry information without incurring
  34928. the round-trip latency of an acknowledgment, and so are useful for
  34929. low-impact communications where occasional packet loss is not a problem.
  34930. A notification packet has the form '% DATA # CHECKSUM', where DATA is
  34931. the content of the notification, and CHECKSUM is a checksum of DATA,
  34932. computed and formatted as for ordinary GDB packets. A notification's
  34933. DATA never contains '$', '%' or '#' characters. Upon receiving a
  34934. notification, the recipient sends no '+' or '-' to acknowledge the
  34935. notification's receipt or to report its corruption.
  34936. Every notification's DATA begins with a name, which contains no colon
  34937. characters, followed by a colon character.
  34938. Recipients should silently ignore corrupted notifications and
  34939. notifications they do not understand. Recipients should restart timeout
  34940. periods on receipt of a well-formed notification, whether or not they
  34941. understand it.
  34942. Senders should only send the notifications described here when this
  34943. protocol description specifies that they are permitted. In the future,
  34944. we may extend the protocol to permit existing notifications in new
  34945. contexts; this rule helps older senders avoid confusing newer
  34946. recipients.
  34947. (Older versions of GDB ignore bytes received until they see the '$'
  34948. byte that begins an ordinary packet, so new stubs may transmit
  34949. notifications without fear of confusing older clients. There are no
  34950. notifications defined for GDB to send at the moment, but we assume that
  34951. most older stubs would ignore them, as well.)
  34952. Each notification is comprised of three parts:
  34953. 'NAME:EVENT'
  34954. The notification packet is sent by the side that initiates the
  34955. exchange (currently, only the stub does that), with EVENT carrying
  34956. the specific information about the notification, and NAME
  34957. specifying the name of the notification.
  34958. 'ACK'
  34959. The acknowledge sent by the other side, usually GDB, to acknowledge
  34960. the exchange and request the event.
  34961. The purpose of an asynchronous notification mechanism is to report to
  34962. GDB that something interesting happened in the remote stub.
  34963. The remote stub may send notification NAME:EVENT at any time, but GDB
  34964. acknowledges the notification when appropriate. The notification event
  34965. is pending before GDB acknowledges. Only one notification at a time may
  34966. be pending; if additional events occur before GDB has acknowledged the
  34967. previous notification, they must be queued by the stub for later
  34968. synchronous transmission in response to ACK packets from GDB. Because
  34969. the notification mechanism is unreliable, the stub is permitted to
  34970. resend a notification if it believes GDB may not have received it.
  34971. Specifically, notifications may appear when GDB is not otherwise
  34972. reading input from the stub, or when GDB is expecting to read a normal
  34973. synchronous response or a '+'/'-' acknowledgment to a packet it has
  34974. sent. Notification packets are distinct from any other communication
  34975. from the stub so there is no ambiguity.
  34976. After receiving a notification, GDB shall acknowledge it by sending a
  34977. ACK packet as a regular, synchronous request to the stub. Such
  34978. acknowledgment is not required to happen immediately, as GDB is
  34979. permitted to send other, unrelated packets to the stub first, which the
  34980. stub should process normally.
  34981. Upon receiving a ACK packet, if the stub has other queued events to
  34982. report to GDB, it shall respond by sending a normal EVENT. GDB shall
  34983. then send another ACK packet to solicit further responses; again, it is
  34984. permitted to send other, unrelated packets as well which the stub should
  34985. process normally.
  34986. If the stub receives a ACK packet and there are no additional EVENT
  34987. to report, the stub shall return an 'OK' response. At this point, GDB
  34988. has finished processing a notification and the stub has completed
  34989. sending any queued events. GDB won't accept any new notifications until
  34990. the final 'OK' is received . If further notification events occur, the
  34991. stub shall send a new notification, GDB shall accept the notification,
  34992. and the process shall be repeated.
  34993. The process of asynchronous notification can be illustrated by the
  34994. following example:
  34995. <- %Stop:T0505:98e7ffbf;04:4ce6ffbf;08:b1b6e54c;thread:p7526.7526;core:0;
  34996. ...
  34997. -> vStopped
  34998. <- T0505:68f37db7;04:40f37db7;08:63850408;thread:p7526.7528;core:0;
  34999. -> vStopped
  35000. <- T0505:68e3fdb6;04:40e3fdb6;08:63850408;thread:p7526.7529;core:0;
  35001. -> vStopped
  35002. <- OK
  35003. The following notifications are defined:
  35004. NotificationAck Event Description
  35005. Stop vStopped REPLY. The REPLY has the Report an asynchronous
  35006. form of a stop reply, as stop event in non-stop
  35007. described in *note Stop mode.
  35008. Reply Packets::. Refer
  35009. to *note Remote
  35010. Non-Stop::, for
  35011. information on how these
  35012. notifications are
  35013. acknowledged by GDB.
  35014. 
  35015. File: gdb.info, Node: Remote Non-Stop, Next: Packet Acknowledgment, Prev: Notification Packets, Up: Remote Protocol
  35016. E.10 Remote Protocol Support for Non-Stop Mode
  35017. ==============================================
  35018. GDB's remote protocol supports non-stop debugging of multi-threaded
  35019. programs, as described in *note Non-Stop Mode::. If the stub supports
  35020. non-stop mode, it should report that to GDB by including 'QNonStop+' in
  35021. its 'qSupported' response (*note qSupported::).
  35022. GDB typically sends a 'QNonStop' packet only when establishing a new
  35023. connection with the stub. Entering non-stop mode does not alter the
  35024. state of any currently-running threads, but targets must stop all
  35025. threads in any already-attached processes when entering all-stop mode.
  35026. GDB uses the '?' packet as necessary to probe the target state after a
  35027. mode change.
  35028. In non-stop mode, when an attached process encounters an event that
  35029. would otherwise be reported with a stop reply, it uses the asynchronous
  35030. notification mechanism (*note Notification Packets::) to inform GDB. In
  35031. contrast to all-stop mode, where all threads in all processes are
  35032. stopped when a stop reply is sent, in non-stop mode only the thread
  35033. reporting the stop event is stopped. That is, when reporting a 'S' or
  35034. 'T' response to indicate completion of a step operation, hitting a
  35035. breakpoint, or a fault, only the affected thread is stopped; any other
  35036. still-running threads continue to run. When reporting a 'W' or 'X'
  35037. response, all running threads belonging to other attached processes
  35038. continue to run.
  35039. In non-stop mode, the target shall respond to the '?' packet as
  35040. follows. First, any incomplete stop reply notification/'vStopped'
  35041. sequence in progress is abandoned. The target must begin a new sequence
  35042. reporting stop events for all stopped threads, whether or not it has
  35043. previously reported those events to GDB. The first stop reply is sent
  35044. as a synchronous reply to the '?' packet, and subsequent stop replies
  35045. are sent as responses to 'vStopped' packets using the mechanism
  35046. described above. The target must not send asynchronous stop reply
  35047. notifications until the sequence is complete. If all threads are
  35048. running when the target receives the '?' packet, or if the target is not
  35049. attached to any process, it shall respond 'OK'.
  35050. If the stub supports non-stop mode, it should also support the
  35051. 'swbreak' stop reason if software breakpoints are supported, and the
  35052. 'hwbreak' stop reason if hardware breakpoints are supported (*note
  35053. swbreak stop reason::). This is because given the asynchronous nature
  35054. of non-stop mode, between the time a thread hits a breakpoint and the
  35055. time the event is finally processed by GDB, the breakpoint may have
  35056. already been removed from the target. Due to this, GDB needs to be able
  35057. to tell whether a trap stop was caused by a delayed breakpoint event,
  35058. which should be ignored, as opposed to a random trap signal, which
  35059. should be reported to the user. Note the 'swbreak' feature implies that
  35060. the target is responsible for adjusting the PC when a software
  35061. breakpoint triggers, if necessary, such as on the x86 architecture.
  35062. 
  35063. File: gdb.info, Node: Packet Acknowledgment, Next: Examples, Prev: Remote Non-Stop, Up: Remote Protocol
  35064. E.11 Packet Acknowledgment
  35065. ==========================
  35066. By default, when either the host or the target machine receives a
  35067. packet, the first response expected is an acknowledgment: either '+' (to
  35068. indicate the package was received correctly) or '-' (to request
  35069. retransmission). This mechanism allows the GDB remote protocol to
  35070. operate over unreliable transport mechanisms, such as a serial line.
  35071. In cases where the transport mechanism is itself reliable (such as a
  35072. pipe or TCP connection), the '+'/'-' acknowledgments are redundant. It
  35073. may be desirable to disable them in that case to reduce communication
  35074. overhead, or for other reasons. This can be accomplished by means of
  35075. the 'QStartNoAckMode' packet; *note QStartNoAckMode::.
  35076. When in no-acknowledgment mode, neither the stub nor GDB shall send
  35077. or expect '+'/'-' protocol acknowledgments. The packet and response
  35078. format still includes the normal checksum, as described in *note
  35079. Overview::, but the checksum may be ignored by the receiver.
  35080. If the stub supports 'QStartNoAckMode' and prefers to operate in
  35081. no-acknowledgment mode, it should report that to GDB by including
  35082. 'QStartNoAckMode+' in its response to 'qSupported'; *note qSupported::.
  35083. If GDB also supports 'QStartNoAckMode' and it has not been disabled via
  35084. the 'set remote noack-packet off' command (*note Remote
  35085. Configuration::), GDB may then send a 'QStartNoAckMode' packet to the
  35086. stub. Only then may the stub actually turn off packet acknowledgments.
  35087. GDB sends a final '+' acknowledgment of the stub's 'OK' response, which
  35088. can be safely ignored by the stub.
  35089. Note that 'set remote noack-packet' command only affects negotiation
  35090. between GDB and the stub when subsequent connections are made; it does
  35091. not affect the protocol acknowledgment state for any current connection.
  35092. Since '+'/'-' acknowledgments are enabled by default when a new
  35093. connection is established, there is also no protocol request to
  35094. re-enable the acknowledgments for the current connection, once disabled.
  35095. 
  35096. File: gdb.info, Node: Examples, Next: File-I/O Remote Protocol Extension, Prev: Packet Acknowledgment, Up: Remote Protocol
  35097. E.12 Examples
  35098. =============
  35099. Example sequence of a target being re-started. Notice how the restart
  35100. does not get any direct output:
  35101. -> R00
  35102. <- +
  35103. _target restarts_
  35104. -> ?
  35105. <- +
  35106. <- T001:1234123412341234
  35107. -> +
  35108. Example sequence of a target being stepped by a single instruction:
  35109. -> G1445...
  35110. <- +
  35111. -> s
  35112. <- +
  35113. _time passes_
  35114. <- T001:1234123412341234
  35115. -> +
  35116. -> g
  35117. <- +
  35118. <- 1455...
  35119. -> +
  35120. 
  35121. File: gdb.info, Node: File-I/O Remote Protocol Extension, Next: Library List Format, Prev: Examples, Up: Remote Protocol
  35122. E.13 File-I/O Remote Protocol Extension
  35123. =======================================
  35124. * Menu:
  35125. * File-I/O Overview::
  35126. * Protocol Basics::
  35127. * The F Request Packet::
  35128. * The F Reply Packet::
  35129. * The Ctrl-C Message::
  35130. * Console I/O::
  35131. * List of Supported Calls::
  35132. * Protocol-specific Representation of Datatypes::
  35133. * Constants::
  35134. * File-I/O Examples::
  35135. 
  35136. File: gdb.info, Node: File-I/O Overview, Next: Protocol Basics, Up: File-I/O Remote Protocol Extension
  35137. E.13.1 File-I/O Overview
  35138. ------------------------
  35139. The "File I/O remote protocol extension" (short: File-I/O) allows the
  35140. target to use the host's file system and console I/O to perform various
  35141. system calls. System calls on the target system are translated into a
  35142. remote protocol packet to the host system, which then performs the
  35143. needed actions and returns a response packet to the target system. This
  35144. simulates file system operations even on targets that lack file systems.
  35145. The protocol is defined to be independent of both the host and target
  35146. systems. It uses its own internal representation of datatypes and
  35147. values. Both GDB and the target's GDB stub are responsible for
  35148. translating the system-dependent value representations into the internal
  35149. protocol representations when data is transmitted.
  35150. The communication is synchronous. A system call is possible only
  35151. when GDB is waiting for a response from the 'C', 'c', 'S' or 's'
  35152. packets. While GDB handles the request for a system call, the target is
  35153. stopped to allow deterministic access to the target's memory. Therefore
  35154. File-I/O is not interruptible by target signals. On the other hand, it
  35155. is possible to interrupt File-I/O by a user interrupt ('Ctrl-C') within
  35156. GDB.
  35157. The target's request to perform a host system call does not finish
  35158. the latest 'C', 'c', 'S' or 's' action. That means, after finishing the
  35159. system call, the target returns to continuing the previous activity
  35160. (continue, step). No additional continue or step request from GDB is
  35161. required.
  35162. (gdb) continue
  35163. <- target requests 'system call X'
  35164. target is stopped, GDB executes system call
  35165. -> GDB returns result
  35166. ... target continues, GDB returns to wait for the target
  35167. <- target hits breakpoint and sends a Txx packet
  35168. The protocol only supports I/O on the console and to regular files on
  35169. the host file system. Character or block special devices, pipes, named
  35170. pipes, sockets or any other communication method on the host system are
  35171. not supported by this protocol.
  35172. File I/O is not supported in non-stop mode.
  35173. 
  35174. File: gdb.info, Node: Protocol Basics, Next: The F Request Packet, Prev: File-I/O Overview, Up: File-I/O Remote Protocol Extension
  35175. E.13.2 Protocol Basics
  35176. ----------------------
  35177. The File-I/O protocol uses the 'F' packet as the request as well as
  35178. reply packet. Since a File-I/O system call can only occur when GDB is
  35179. waiting for a response from the continuing or stepping target, the
  35180. File-I/O request is a reply that GDB has to expect as a result of a
  35181. previous 'C', 'c', 'S' or 's' packet. This 'F' packet contains all
  35182. information needed to allow GDB to call the appropriate host system
  35183. call:
  35184. * A unique identifier for the requested system call.
  35185. * All parameters to the system call. Pointers are given as addresses
  35186. in the target memory address space. Pointers to strings are given
  35187. as pointer/length pair. Numerical values are given as they are.
  35188. Numerical control flags are given in a protocol-specific
  35189. representation.
  35190. At this point, GDB has to perform the following actions.
  35191. * If the parameters include pointer values to data needed as input to
  35192. a system call, GDB requests this data from the target with a
  35193. standard 'm' packet request. This additional communication has to
  35194. be expected by the target implementation and is handled as any
  35195. other 'm' packet.
  35196. * GDB translates all value from protocol representation to host
  35197. representation as needed. Datatypes are coerced into the host
  35198. types.
  35199. * GDB calls the system call.
  35200. * It then coerces datatypes back to protocol representation.
  35201. * If the system call is expected to return data in buffer space
  35202. specified by pointer parameters to the call, the data is
  35203. transmitted to the target using a 'M' or 'X' packet. This packet
  35204. has to be expected by the target implementation and is handled as
  35205. any other 'M' or 'X' packet.
  35206. Eventually GDB replies with another 'F' packet which contains all
  35207. necessary information for the target to continue. This at least
  35208. contains
  35209. * Return value.
  35210. * 'errno', if has been changed by the system call.
  35211. * "Ctrl-C" flag.
  35212. After having done the needed type and value coercion, the target
  35213. continues the latest continue or step action.
  35214. 
  35215. File: gdb.info, Node: The F Request Packet, Next: The F Reply Packet, Prev: Protocol Basics, Up: File-I/O Remote Protocol Extension
  35216. E.13.3 The 'F' Request Packet
  35217. -----------------------------
  35218. The 'F' request packet has the following format:
  35219. 'FCALL-ID,PARAMETER...'
  35220. CALL-ID is the identifier to indicate the host system call to be
  35221. called. This is just the name of the function.
  35222. PARAMETER... are the parameters to the system call. Parameters are
  35223. hexadecimal integer values, either the actual values in case of
  35224. scalar datatypes, pointers to target buffer space in case of
  35225. compound datatypes and unspecified memory areas, or pointer/length
  35226. pairs in case of string parameters. These are appended to the
  35227. CALL-ID as a comma-delimited list. All values are transmitted in
  35228. ASCII string representation, pointer/length pairs separated by a
  35229. slash.
  35230. 
  35231. 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
  35232. E.13.4 The 'F' Reply Packet
  35233. ---------------------------
  35234. The 'F' reply packet has the following format:
  35235. 'FRETCODE,ERRNO,CTRL-C FLAG;CALL-SPECIFIC ATTACHMENT'
  35236. RETCODE is the return code of the system call as hexadecimal value.
  35237. ERRNO is the 'errno' set by the call, in protocol-specific
  35238. representation. This parameter can be omitted if the call was
  35239. successful.
  35240. CTRL-C FLAG is only sent if the user requested a break. In this
  35241. case, ERRNO must be sent as well, even if the call was successful.
  35242. The CTRL-C FLAG itself consists of the character 'C':
  35243. F0,0,C
  35244. or, if the call was interrupted before the host call has been
  35245. performed:
  35246. F-1,4,C
  35247. assuming 4 is the protocol-specific representation of 'EINTR'.
  35248. 
  35249. File: gdb.info, Node: The Ctrl-C Message, Next: Console I/O, Prev: The F Reply Packet, Up: File-I/O Remote Protocol Extension
  35250. E.13.5 The 'Ctrl-C' Message
  35251. ---------------------------
  35252. If the 'Ctrl-C' flag is set in the GDB reply packet (*note The F Reply
  35253. Packet::), the target should behave as if it had gotten a break message.
  35254. The meaning for the target is "system call interrupted by 'SIGINT'".
  35255. Consequentially, the target should actually stop (as with a break
  35256. message) and return to GDB with a 'T02' packet.
  35257. It's important for the target to know in which state the system call
  35258. was interrupted. There are two possible cases:
  35259. * The system call hasn't been performed on the host yet.
  35260. * The system call on the host has been finished.
  35261. These two states can be distinguished by the target by the value of
  35262. the returned 'errno'. If it's the protocol representation of 'EINTR',
  35263. the system call hasn't been performed. This is equivalent to the
  35264. 'EINTR' handling on POSIX systems. In any other case, the target may
  35265. presume that the system call has been finished -- successfully or not --
  35266. and should behave as if the break message arrived right after the system
  35267. call.
  35268. GDB must behave reliably. If the system call has not been called
  35269. yet, GDB may send the 'F' reply immediately, setting 'EINTR' as 'errno'
  35270. in the packet. If the system call on the host has been finished before
  35271. the user requests a break, the full action must be finished by GDB.
  35272. This requires sending 'M' or 'X' packets as necessary. The 'F' packet
  35273. may only be sent when either nothing has happened or the full action has
  35274. been completed.
  35275. 
  35276. File: gdb.info, Node: Console I/O, Next: List of Supported Calls, Prev: The Ctrl-C Message, Up: File-I/O Remote Protocol Extension
  35277. E.13.6 Console I/O
  35278. ------------------
  35279. By default and if not explicitly closed by the target system, the file
  35280. descriptors 0, 1 and 2 are connected to the GDB console. Output on the
  35281. GDB console is handled as any other file output operation ('write(1,
  35282. ...)' or 'write(2, ...)'). Console input is handled by GDB so that
  35283. after the target read request from file descriptor 0 all following
  35284. typing is buffered until either one of the following conditions is met:
  35285. * The user types 'Ctrl-c'. The behaviour is as explained above, and
  35286. the 'read' system call is treated as finished.
  35287. * The user presses <RET>. This is treated as end of input with a
  35288. trailing newline.
  35289. * The user types 'Ctrl-d'. This is treated as end of input. No
  35290. trailing character (neither newline nor 'Ctrl-D') is appended to
  35291. the input.
  35292. If the user has typed more characters than fit in the buffer given to
  35293. the 'read' call, the trailing characters are buffered in GDB until
  35294. either another 'read(0, ...)' is requested by the target, or debugging
  35295. is stopped at the user's request.
  35296. 
  35297. 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
  35298. E.13.7 List of Supported Calls
  35299. ------------------------------
  35300. * Menu:
  35301. * open::
  35302. * close::
  35303. * read::
  35304. * write::
  35305. * lseek::
  35306. * rename::
  35307. * unlink::
  35308. * stat/fstat::
  35309. * gettimeofday::
  35310. * isatty::
  35311. * system::
  35312. 
  35313. File: gdb.info, Node: open, Next: close, Up: List of Supported Calls
  35314. open
  35315. ....
  35316. Synopsis:
  35317. int open(const char *pathname, int flags);
  35318. int open(const char *pathname, int flags, mode_t mode);
  35319. Request:
  35320. 'Fopen,PATHPTR/LEN,FLAGS,MODE'
  35321. FLAGS is the bitwise 'OR' of the following values:
  35322. 'O_CREAT'
  35323. If the file does not exist it will be created. The host rules
  35324. apply as far as file ownership and time stamps are concerned.
  35325. 'O_EXCL'
  35326. When used with 'O_CREAT', if the file already exists it is an
  35327. error and open() fails.
  35328. 'O_TRUNC'
  35329. If the file already exists and the open mode allows writing
  35330. ('O_RDWR' or 'O_WRONLY' is given) it will be truncated to zero
  35331. length.
  35332. 'O_APPEND'
  35333. The file is opened in append mode.
  35334. 'O_RDONLY'
  35335. The file is opened for reading only.
  35336. 'O_WRONLY'
  35337. The file is opened for writing only.
  35338. 'O_RDWR'
  35339. The file is opened for reading and writing.
  35340. Other bits are silently ignored.
  35341. MODE is the bitwise 'OR' of the following values:
  35342. 'S_IRUSR'
  35343. User has read permission.
  35344. 'S_IWUSR'
  35345. User has write permission.
  35346. 'S_IRGRP'
  35347. Group has read permission.
  35348. 'S_IWGRP'
  35349. Group has write permission.
  35350. 'S_IROTH'
  35351. Others have read permission.
  35352. 'S_IWOTH'
  35353. Others have write permission.
  35354. Other bits are silently ignored.
  35355. Return value:
  35356. 'open' returns the new file descriptor or -1 if an error occurred.
  35357. Errors:
  35358. 'EEXIST'
  35359. PATHNAME already exists and 'O_CREAT' and 'O_EXCL' were used.
  35360. 'EISDIR'
  35361. PATHNAME refers to a directory.
  35362. 'EACCES'
  35363. The requested access is not allowed.
  35364. 'ENAMETOOLONG'
  35365. PATHNAME was too long.
  35366. 'ENOENT'
  35367. A directory component in PATHNAME does not exist.
  35368. 'ENODEV'
  35369. PATHNAME refers to a device, pipe, named pipe or socket.
  35370. 'EROFS'
  35371. PATHNAME refers to a file on a read-only filesystem and write
  35372. access was requested.
  35373. 'EFAULT'
  35374. PATHNAME is an invalid pointer value.
  35375. 'ENOSPC'
  35376. No space on device to create the file.
  35377. 'EMFILE'
  35378. The process already has the maximum number of files open.
  35379. 'ENFILE'
  35380. The limit on the total number of files open on the system has
  35381. been reached.
  35382. 'EINTR'
  35383. The call was interrupted by the user.
  35384. 
  35385. File: gdb.info, Node: close, Next: read, Prev: open, Up: List of Supported Calls
  35386. close
  35387. .....
  35388. Synopsis:
  35389. int close(int fd);
  35390. Request:
  35391. 'Fclose,FD'
  35392. Return value:
  35393. 'close' returns zero on success, or -1 if an error occurred.
  35394. Errors:
  35395. 'EBADF'
  35396. FD isn't a valid open file descriptor.
  35397. 'EINTR'
  35398. The call was interrupted by the user.
  35399. 
  35400. File: gdb.info, Node: read, Next: write, Prev: close, Up: List of Supported Calls
  35401. read
  35402. ....
  35403. Synopsis:
  35404. int read(int fd, void *buf, unsigned int count);
  35405. Request:
  35406. 'Fread,FD,BUFPTR,COUNT'
  35407. Return value:
  35408. On success, the number of bytes read is returned. Zero indicates
  35409. end of file. If count is zero, read returns zero as well. On
  35410. error, -1 is returned.
  35411. Errors:
  35412. 'EBADF'
  35413. FD is not a valid file descriptor or is not open for reading.
  35414. 'EFAULT'
  35415. BUFPTR is an invalid pointer value.
  35416. 'EINTR'
  35417. The call was interrupted by the user.
  35418. 
  35419. File: gdb.info, Node: write, Next: lseek, Prev: read, Up: List of Supported Calls
  35420. write
  35421. .....
  35422. Synopsis:
  35423. int write(int fd, const void *buf, unsigned int count);
  35424. Request:
  35425. 'Fwrite,FD,BUFPTR,COUNT'
  35426. Return value:
  35427. On success, the number of bytes written are returned. Zero
  35428. indicates nothing was written. On error, -1 is returned.
  35429. Errors:
  35430. 'EBADF'
  35431. FD is not a valid file descriptor or is not open for writing.
  35432. 'EFAULT'
  35433. BUFPTR is an invalid pointer value.
  35434. 'EFBIG'
  35435. An attempt was made to write a file that exceeds the
  35436. host-specific maximum file size allowed.
  35437. 'ENOSPC'
  35438. No space on device to write the data.
  35439. 'EINTR'
  35440. The call was interrupted by the user.
  35441. 
  35442. File: gdb.info, Node: lseek, Next: rename, Prev: write, Up: List of Supported Calls
  35443. lseek
  35444. .....
  35445. Synopsis:
  35446. long lseek (int fd, long offset, int flag);
  35447. Request:
  35448. 'Flseek,FD,OFFSET,FLAG'
  35449. FLAG is one of:
  35450. 'SEEK_SET'
  35451. The offset is set to OFFSET bytes.
  35452. 'SEEK_CUR'
  35453. The offset is set to its current location plus OFFSET bytes.
  35454. 'SEEK_END'
  35455. The offset is set to the size of the file plus OFFSET bytes.
  35456. Return value:
  35457. On success, the resulting unsigned offset in bytes from the
  35458. beginning of the file is returned. Otherwise, a value of -1 is
  35459. returned.
  35460. Errors:
  35461. 'EBADF'
  35462. FD is not a valid open file descriptor.
  35463. 'ESPIPE'
  35464. FD is associated with the GDB console.
  35465. 'EINVAL'
  35466. FLAG is not a proper value.
  35467. 'EINTR'
  35468. The call was interrupted by the user.
  35469. 
  35470. File: gdb.info, Node: rename, Next: unlink, Prev: lseek, Up: List of Supported Calls
  35471. rename
  35472. ......
  35473. Synopsis:
  35474. int rename(const char *oldpath, const char *newpath);
  35475. Request:
  35476. 'Frename,OLDPATHPTR/LEN,NEWPATHPTR/LEN'
  35477. Return value:
  35478. On success, zero is returned. On error, -1 is returned.
  35479. Errors:
  35480. 'EISDIR'
  35481. NEWPATH is an existing directory, but OLDPATH is not a
  35482. directory.
  35483. 'EEXIST'
  35484. NEWPATH is a non-empty directory.
  35485. 'EBUSY'
  35486. OLDPATH or NEWPATH is a directory that is in use by some
  35487. process.
  35488. 'EINVAL'
  35489. An attempt was made to make a directory a subdirectory of
  35490. itself.
  35491. 'ENOTDIR'
  35492. A component used as a directory in OLDPATH or new path is not
  35493. a directory. Or OLDPATH is a directory and NEWPATH exists but
  35494. is not a directory.
  35495. 'EFAULT'
  35496. OLDPATHPTR or NEWPATHPTR are invalid pointer values.
  35497. 'EACCES'
  35498. No access to the file or the path of the file.
  35499. 'ENAMETOOLONG'
  35500. OLDPATH or NEWPATH was too long.
  35501. 'ENOENT'
  35502. A directory component in OLDPATH or NEWPATH does not exist.
  35503. 'EROFS'
  35504. The file is on a read-only filesystem.
  35505. 'ENOSPC'
  35506. The device containing the file has no room for the new
  35507. directory entry.
  35508. 'EINTR'
  35509. The call was interrupted by the user.
  35510. 
  35511. File: gdb.info, Node: unlink, Next: stat/fstat, Prev: rename, Up: List of Supported Calls
  35512. unlink
  35513. ......
  35514. Synopsis:
  35515. int unlink(const char *pathname);
  35516. Request:
  35517. 'Funlink,PATHNAMEPTR/LEN'
  35518. Return value:
  35519. On success, zero is returned. On error, -1 is returned.
  35520. Errors:
  35521. 'EACCES'
  35522. No access to the file or the path of the file.
  35523. 'EPERM'
  35524. The system does not allow unlinking of directories.
  35525. 'EBUSY'
  35526. The file PATHNAME cannot be unlinked because it's being used
  35527. by another process.
  35528. 'EFAULT'
  35529. PATHNAMEPTR is an invalid pointer value.
  35530. 'ENAMETOOLONG'
  35531. PATHNAME was too long.
  35532. 'ENOENT'
  35533. A directory component in PATHNAME does not exist.
  35534. 'ENOTDIR'
  35535. A component of the path is not a directory.
  35536. 'EROFS'
  35537. The file is on a read-only filesystem.
  35538. 'EINTR'
  35539. The call was interrupted by the user.
  35540. 
  35541. File: gdb.info, Node: stat/fstat, Next: gettimeofday, Prev: unlink, Up: List of Supported Calls
  35542. stat/fstat
  35543. ..........
  35544. Synopsis:
  35545. int stat(const char *pathname, struct stat *buf);
  35546. int fstat(int fd, struct stat *buf);
  35547. Request:
  35548. 'Fstat,PATHNAMEPTR/LEN,BUFPTR'
  35549. 'Ffstat,FD,BUFPTR'
  35550. Return value:
  35551. On success, zero is returned. On error, -1 is returned.
  35552. Errors:
  35553. 'EBADF'
  35554. FD is not a valid open file.
  35555. 'ENOENT'
  35556. A directory component in PATHNAME does not exist or the path
  35557. is an empty string.
  35558. 'ENOTDIR'
  35559. A component of the path is not a directory.
  35560. 'EFAULT'
  35561. PATHNAMEPTR is an invalid pointer value.
  35562. 'EACCES'
  35563. No access to the file or the path of the file.
  35564. 'ENAMETOOLONG'
  35565. PATHNAME was too long.
  35566. 'EINTR'
  35567. The call was interrupted by the user.
  35568. 
  35569. File: gdb.info, Node: gettimeofday, Next: isatty, Prev: stat/fstat, Up: List of Supported Calls
  35570. gettimeofday
  35571. ............
  35572. Synopsis:
  35573. int gettimeofday(struct timeval *tv, void *tz);
  35574. Request:
  35575. 'Fgettimeofday,TVPTR,TZPTR'
  35576. Return value:
  35577. On success, 0 is returned, -1 otherwise.
  35578. Errors:
  35579. 'EINVAL'
  35580. TZ is a non-NULL pointer.
  35581. 'EFAULT'
  35582. TVPTR and/or TZPTR is an invalid pointer value.
  35583. 
  35584. File: gdb.info, Node: isatty, Next: system, Prev: gettimeofday, Up: List of Supported Calls
  35585. isatty
  35586. ......
  35587. Synopsis:
  35588. int isatty(int fd);
  35589. Request:
  35590. 'Fisatty,FD'
  35591. Return value:
  35592. Returns 1 if FD refers to the GDB console, 0 otherwise.
  35593. Errors:
  35594. 'EINTR'
  35595. The call was interrupted by the user.
  35596. Note that the 'isatty' call is treated as a special case: it returns
  35597. 1 to the target if the file descriptor is attached to the GDB console, 0
  35598. otherwise. Implementing through system calls would require implementing
  35599. 'ioctl' and would be more complex than needed.
  35600. 
  35601. File: gdb.info, Node: system, Prev: isatty, Up: List of Supported Calls
  35602. system
  35603. ......
  35604. Synopsis:
  35605. int system(const char *command);
  35606. Request:
  35607. 'Fsystem,COMMANDPTR/LEN'
  35608. Return value:
  35609. If LEN is zero, the return value indicates whether a shell is
  35610. available. A zero return value indicates a shell is not available.
  35611. For non-zero LEN, the value returned is -1 on error and the return
  35612. status of the command otherwise. Only the exit status of the
  35613. command is returned, which is extracted from the host's 'system'
  35614. return value by calling 'WEXITSTATUS(retval)'. In case '/bin/sh'
  35615. could not be executed, 127 is returned.
  35616. Errors:
  35617. 'EINTR'
  35618. The call was interrupted by the user.
  35619. GDB takes over the full task of calling the necessary host calls to
  35620. perform the 'system' call. The return value of 'system' on the host is
  35621. simplified before it's returned to the target. Any termination signal
  35622. information from the child process is discarded, and the return value
  35623. consists entirely of the exit status of the called command.
  35624. Due to security concerns, the 'system' call is by default refused by
  35625. GDB. The user has to allow this call explicitly with the 'set remote
  35626. system-call-allowed 1' command.
  35627. 'set remote system-call-allowed'
  35628. Control whether to allow the 'system' calls in the File I/O
  35629. protocol for the remote target. The default is zero (disabled).
  35630. 'show remote system-call-allowed'
  35631. Show whether the 'system' calls are allowed in the File I/O
  35632. protocol.
  35633. 
  35634. File: gdb.info, Node: Protocol-specific Representation of Datatypes, Next: Constants, Prev: List of Supported Calls, Up: File-I/O Remote Protocol Extension
  35635. E.13.8 Protocol-specific Representation of Datatypes
  35636. ----------------------------------------------------
  35637. * Menu:
  35638. * Integral Datatypes::
  35639. * Pointer Values::
  35640. * Memory Transfer::
  35641. * struct stat::
  35642. * struct timeval::
  35643. 
  35644. File: gdb.info, Node: Integral Datatypes, Next: Pointer Values, Up: Protocol-specific Representation of Datatypes
  35645. Integral Datatypes
  35646. ..................
  35647. The integral datatypes used in the system calls are 'int', 'unsigned
  35648. int', 'long', 'unsigned long', 'mode_t', and 'time_t'.
  35649. 'int', 'unsigned int', 'mode_t' and 'time_t' are implemented as 32
  35650. bit values in this protocol.
  35651. 'long' and 'unsigned long' are implemented as 64 bit types.
  35652. *Note Limits::, for corresponding MIN and MAX values (similar to
  35653. those in 'limits.h') to allow range checking on host and target.
  35654. 'time_t' datatypes are defined as seconds since the Epoch.
  35655. All integral datatypes transferred as part of a memory read or write
  35656. of a structured datatype e.g. a 'struct stat' have to be given in big
  35657. endian byte order.
  35658. 
  35659. File: gdb.info, Node: Pointer Values, Next: Memory Transfer, Prev: Integral Datatypes, Up: Protocol-specific Representation of Datatypes
  35660. Pointer Values
  35661. ..............
  35662. Pointers to target data are transmitted as they are. An exception is
  35663. made for pointers to buffers for which the length isn't transmitted as
  35664. part of the function call, namely strings. Strings are transmitted as a
  35665. pointer/length pair, both as hex values, e.g.
  35666. 1aaf/12
  35667. which is a pointer to data of length 18 bytes at position 0x1aaf. The
  35668. length is defined as the full string length in bytes, including the
  35669. trailing null byte. For example, the string '"hello world"' at address
  35670. 0x123456 is transmitted as
  35671. 123456/d
  35672. 
  35673. File: gdb.info, Node: Memory Transfer, Next: struct stat, Prev: Pointer Values, Up: Protocol-specific Representation of Datatypes
  35674. Memory Transfer
  35675. ...............
  35676. Structured data which is transferred using a memory read or write (for
  35677. example, a 'struct stat') is expected to be in a protocol-specific
  35678. format with all scalar multibyte datatypes being big endian.
  35679. Translation to this representation needs to be done both by the target
  35680. before the 'F' packet is sent, and by GDB before it transfers memory to
  35681. the target. Transferred pointers to structured data should point to the
  35682. already-coerced data at any time.
  35683. 
  35684. File: gdb.info, Node: struct stat, Next: struct timeval, Prev: Memory Transfer, Up: Protocol-specific Representation of Datatypes
  35685. struct stat
  35686. ...........
  35687. The buffer of type 'struct stat' used by the target and GDB is defined
  35688. as follows:
  35689. struct stat {
  35690. unsigned int st_dev; /* device */
  35691. unsigned int st_ino; /* inode */
  35692. mode_t st_mode; /* protection */
  35693. unsigned int st_nlink; /* number of hard links */
  35694. unsigned int st_uid; /* user ID of owner */
  35695. unsigned int st_gid; /* group ID of owner */
  35696. unsigned int st_rdev; /* device type (if inode device) */
  35697. unsigned long st_size; /* total size, in bytes */
  35698. unsigned long st_blksize; /* blocksize for filesystem I/O */
  35699. unsigned long st_blocks; /* number of blocks allocated */
  35700. time_t st_atime; /* time of last access */
  35701. time_t st_mtime; /* time of last modification */
  35702. time_t st_ctime; /* time of last change */
  35703. };
  35704. The integral datatypes conform to the definitions given in the
  35705. appropriate section (see *note Integral Datatypes::, for details) so
  35706. this structure is of size 64 bytes.
  35707. The values of several fields have a restricted meaning and/or range
  35708. of values.
  35709. 'st_dev'
  35710. A value of 0 represents a file, 1 the console.
  35711. 'st_ino'
  35712. No valid meaning for the target. Transmitted unchanged.
  35713. 'st_mode'
  35714. Valid mode bits are described in *note Constants::. Any other bits
  35715. have currently no meaning for the target.
  35716. 'st_uid'
  35717. 'st_gid'
  35718. 'st_rdev'
  35719. No valid meaning for the target. Transmitted unchanged.
  35720. 'st_atime'
  35721. 'st_mtime'
  35722. 'st_ctime'
  35723. These values have a host and file system dependent accuracy.
  35724. Especially on Windows hosts, the file system may not support exact
  35725. timing values.
  35726. The target gets a 'struct stat' of the above representation and is
  35727. responsible for coercing it to the target representation before
  35728. continuing.
  35729. Note that due to size differences between the host, target, and
  35730. protocol representations of 'struct stat' members, these members could
  35731. eventually get truncated on the target.
  35732. 
  35733. File: gdb.info, Node: struct timeval, Prev: struct stat, Up: Protocol-specific Representation of Datatypes
  35734. struct timeval
  35735. ..............
  35736. The buffer of type 'struct timeval' used by the File-I/O protocol is
  35737. defined as follows:
  35738. struct timeval {
  35739. time_t tv_sec; /* second */
  35740. long tv_usec; /* microsecond */
  35741. };
  35742. The integral datatypes conform to the definitions given in the
  35743. appropriate section (see *note Integral Datatypes::, for details) so
  35744. this structure is of size 8 bytes.
  35745. 
  35746. File: gdb.info, Node: Constants, Next: File-I/O Examples, Prev: Protocol-specific Representation of Datatypes, Up: File-I/O Remote Protocol Extension
  35747. E.13.9 Constants
  35748. ----------------
  35749. The following values are used for the constants inside of the protocol.
  35750. GDB and target are responsible for translating these values before and
  35751. after the call as needed.
  35752. * Menu:
  35753. * Open Flags::
  35754. * mode_t Values::
  35755. * Errno Values::
  35756. * Lseek Flags::
  35757. * Limits::
  35758. 
  35759. File: gdb.info, Node: Open Flags, Next: mode_t Values, Up: Constants
  35760. Open Flags
  35761. ..........
  35762. All values are given in hexadecimal representation.
  35763. O_RDONLY 0x0
  35764. O_WRONLY 0x1
  35765. O_RDWR 0x2
  35766. O_APPEND 0x8
  35767. O_CREAT 0x200
  35768. O_TRUNC 0x400
  35769. O_EXCL 0x800
  35770. 
  35771. File: gdb.info, Node: mode_t Values, Next: Errno Values, Prev: Open Flags, Up: Constants
  35772. mode_t Values
  35773. .............
  35774. All values are given in octal representation.
  35775. S_IFREG 0100000
  35776. S_IFDIR 040000
  35777. S_IRUSR 0400
  35778. S_IWUSR 0200
  35779. S_IXUSR 0100
  35780. S_IRGRP 040
  35781. S_IWGRP 020
  35782. S_IXGRP 010
  35783. S_IROTH 04
  35784. S_IWOTH 02
  35785. S_IXOTH 01
  35786. 
  35787. File: gdb.info, Node: Errno Values, Next: Lseek Flags, Prev: mode_t Values, Up: Constants
  35788. Errno Values
  35789. ............
  35790. All values are given in decimal representation.
  35791. EPERM 1
  35792. ENOENT 2
  35793. EINTR 4
  35794. EBADF 9
  35795. EACCES 13
  35796. EFAULT 14
  35797. EBUSY 16
  35798. EEXIST 17
  35799. ENODEV 19
  35800. ENOTDIR 20
  35801. EISDIR 21
  35802. EINVAL 22
  35803. ENFILE 23
  35804. EMFILE 24
  35805. EFBIG 27
  35806. ENOSPC 28
  35807. ESPIPE 29
  35808. EROFS 30
  35809. ENAMETOOLONG 91
  35810. EUNKNOWN 9999
  35811. 'EUNKNOWN' is used as a fallback error value if a host system returns
  35812. any error value not in the list of supported error numbers.
  35813. 
  35814. File: gdb.info, Node: Lseek Flags, Next: Limits, Prev: Errno Values, Up: Constants
  35815. Lseek Flags
  35816. ...........
  35817. SEEK_SET 0
  35818. SEEK_CUR 1
  35819. SEEK_END 2
  35820. 
  35821. File: gdb.info, Node: Limits, Prev: Lseek Flags, Up: Constants
  35822. Limits
  35823. ......
  35824. All values are given in decimal representation.
  35825. INT_MIN -2147483648
  35826. INT_MAX 2147483647
  35827. UINT_MAX 4294967295
  35828. LONG_MIN -9223372036854775808
  35829. LONG_MAX 9223372036854775807
  35830. ULONG_MAX 18446744073709551615
  35831. 
  35832. File: gdb.info, Node: File-I/O Examples, Prev: Constants, Up: File-I/O Remote Protocol Extension
  35833. E.13.10 File-I/O Examples
  35834. -------------------------
  35835. Example sequence of a write call, file descriptor 3, buffer is at target
  35836. address 0x1234, 6 bytes should be written:
  35837. <- Fwrite,3,1234,6
  35838. _request memory read from target_
  35839. -> m1234,6
  35840. <- XXXXXX
  35841. _return "6 bytes written"_
  35842. -> F6
  35843. Example sequence of a read call, file descriptor 3, buffer is at
  35844. target address 0x1234, 6 bytes should be read:
  35845. <- Fread,3,1234,6
  35846. _request memory write to target_
  35847. -> X1234,6:XXXXXX
  35848. _return "6 bytes read"_
  35849. -> F6
  35850. Example sequence of a read call, call fails on the host due to
  35851. invalid file descriptor ('EBADF'):
  35852. <- Fread,3,1234,6
  35853. -> F-1,9
  35854. Example sequence of a read call, user presses 'Ctrl-c' before syscall
  35855. on host is called:
  35856. <- Fread,3,1234,6
  35857. -> F-1,4,C
  35858. <- T02
  35859. Example sequence of a read call, user presses 'Ctrl-c' after syscall
  35860. on host is called:
  35861. <- Fread,3,1234,6
  35862. -> X1234,6:XXXXXX
  35863. <- T02
  35864. 
  35865. File: gdb.info, Node: Library List Format, Next: Library List Format for SVR4 Targets, Prev: File-I/O Remote Protocol Extension, Up: Remote Protocol
  35866. E.14 Library List Format
  35867. ========================
  35868. On some platforms, a dynamic loader (e.g. 'ld.so') runs in the same
  35869. process as your application to manage libraries. In this case, GDB can
  35870. use the loader's symbol table and normal memory operations to maintain a
  35871. list of shared libraries. On other platforms, the operating system
  35872. manages loaded libraries. GDB can not retrieve the list of currently
  35873. loaded libraries through memory operations, so it uses the
  35874. 'qXfer:libraries:read' packet (*note qXfer library list read::) instead.
  35875. The remote stub queries the target's operating system and reports which
  35876. libraries are loaded.
  35877. The 'qXfer:libraries:read' packet returns an XML document which lists
  35878. loaded libraries and their offsets. Each library has an associated name
  35879. and one or more segment or section base addresses, which report where
  35880. the library was loaded in memory.
  35881. For the common case of libraries that are fully linked binaries, the
  35882. library should have a list of segments. If the target supports dynamic
  35883. linking of a relocatable object file, its library XML element should
  35884. instead include a list of allocated sections. The segment or section
  35885. bases are start addresses, not relocation offsets; they do not depend on
  35886. the library's link-time base addresses.
  35887. GDB must be linked with the Expat library to support XML library
  35888. lists. *Note Expat::.
  35889. A simple memory map, with one loaded library relocated by a single
  35890. offset, looks like this:
  35891. <library-list>
  35892. <library name="/lib/libc.so.6">
  35893. <segment address="0x10000000"/>
  35894. </library>
  35895. </library-list>
  35896. Another simple memory map, with one loaded library with three
  35897. allocated sections (.text, .data, .bss), looks like this:
  35898. <library-list>
  35899. <library name="sharedlib.o">
  35900. <section address="0x10000000"/>
  35901. <section address="0x20000000"/>
  35902. <section address="0x30000000"/>
  35903. </library>
  35904. </library-list>
  35905. The format of a library list is described by this DTD:
  35906. <!-- library-list: Root element with versioning -->
  35907. <!ELEMENT library-list (library)*>
  35908. <!ATTLIST library-list version CDATA #FIXED "1.0">
  35909. <!ELEMENT library (segment*, section*)>
  35910. <!ATTLIST library name CDATA #REQUIRED>
  35911. <!ELEMENT segment EMPTY>
  35912. <!ATTLIST segment address CDATA #REQUIRED>
  35913. <!ELEMENT section EMPTY>
  35914. <!ATTLIST section address CDATA #REQUIRED>
  35915. In addition, segments and section descriptors cannot be mixed within
  35916. a single library element, and you must supply at least one segment or
  35917. section for each library.
  35918. 
  35919. File: gdb.info, Node: Library List Format for SVR4 Targets, Next: Memory Map Format, Prev: Library List Format, Up: Remote Protocol
  35920. E.15 Library List Format for SVR4 Targets
  35921. =========================================
  35922. On SVR4 platforms GDB can use the symbol table of a dynamic loader (e.g.
  35923. 'ld.so') and normal memory operations to maintain a list of shared
  35924. libraries. Still a special library list provided by this packet is more
  35925. efficient for the GDB remote protocol.
  35926. The 'qXfer:libraries-svr4:read' packet returns an XML document which
  35927. lists loaded libraries and their SVR4 linker parameters. For each
  35928. library on SVR4 target, the following parameters are reported:
  35929. - 'name', the absolute file name from the 'l_name' field of 'struct
  35930. link_map'.
  35931. - 'lm' with address of 'struct link_map' used for TLS (Thread Local
  35932. Storage) access.
  35933. - 'l_addr', the displacement as read from the field 'l_addr' of
  35934. 'struct link_map'. For prelinked libraries this is not an absolute
  35935. memory address. It is a displacement of absolute memory address
  35936. against address the file was prelinked to during the library load.
  35937. - 'l_ld', which is memory address of the 'PT_DYNAMIC' segment
  35938. Additionally the single 'main-lm' attribute specifies address of
  35939. 'struct link_map' used for the main executable. This parameter is used
  35940. for TLS access and its presence is optional.
  35941. GDB must be linked with the Expat library to support XML SVR4 library
  35942. lists. *Note Expat::.
  35943. A simple memory map, with two loaded libraries (which do not use
  35944. prelink), looks like this:
  35945. <library-list-svr4 version="1.0" main-lm="0xe4f8f8">
  35946. <library name="/lib/ld-linux.so.2" lm="0xe4f51c" l_addr="0xe2d000"
  35947. l_ld="0xe4eefc"/>
  35948. <library name="/lib/libc.so.6" lm="0xe4fbe8" l_addr="0x154000"
  35949. l_ld="0x152350"/>
  35950. </library-list-svr>
  35951. The format of an SVR4 library list is described by this DTD:
  35952. <!-- library-list-svr4: Root element with versioning -->
  35953. <!ELEMENT library-list-svr4 (library)*>
  35954. <!ATTLIST library-list-svr4 version CDATA #FIXED "1.0">
  35955. <!ATTLIST library-list-svr4 main-lm CDATA #IMPLIED>
  35956. <!ELEMENT library EMPTY>
  35957. <!ATTLIST library name CDATA #REQUIRED>
  35958. <!ATTLIST library lm CDATA #REQUIRED>
  35959. <!ATTLIST library l_addr CDATA #REQUIRED>
  35960. <!ATTLIST library l_ld CDATA #REQUIRED>
  35961. 
  35962. File: gdb.info, Node: Memory Map Format, Next: Thread List Format, Prev: Library List Format for SVR4 Targets, Up: Remote Protocol
  35963. E.16 Memory Map Format
  35964. ======================
  35965. To be able to write into flash memory, GDB needs to obtain a memory map
  35966. from the target. This section describes the format of the memory map.
  35967. The memory map is obtained using the 'qXfer:memory-map:read' (*note
  35968. qXfer memory map read::) packet and is an XML document that lists memory
  35969. regions.
  35970. GDB must be linked with the Expat library to support XML memory maps.
  35971. *Note Expat::.
  35972. The top-level structure of the document is shown below:
  35973. <?xml version="1.0"?>
  35974. <!DOCTYPE memory-map
  35975. PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
  35976. "http://sourceware.org/gdb/gdb-memory-map.dtd">
  35977. <memory-map>
  35978. region...
  35979. </memory-map>
  35980. Each region can be either:
  35981. * A region of RAM starting at ADDR and extending for LENGTH bytes
  35982. from there:
  35983. <memory type="ram" start="ADDR" length="LENGTH"/>
  35984. * A region of read-only memory:
  35985. <memory type="rom" start="ADDR" length="LENGTH"/>
  35986. * A region of flash memory, with erasure blocks BLOCKSIZE bytes in
  35987. length:
  35988. <memory type="flash" start="ADDR" length="LENGTH">
  35989. <property name="blocksize">BLOCKSIZE</property>
  35990. </memory>
  35991. Regions must not overlap. GDB assumes that areas of memory not
  35992. covered by the memory map are RAM, and uses the ordinary 'M' and 'X'
  35993. packets to write to addresses in such ranges.
  35994. The formal DTD for memory map format is given below:
  35995. <!-- ................................................... -->
  35996. <!-- Memory Map XML DTD ................................ -->
  35997. <!-- File: memory-map.dtd .............................. -->
  35998. <!-- .................................... .............. -->
  35999. <!-- memory-map.dtd -->
  36000. <!-- memory-map: Root element with versioning -->
  36001. <!ELEMENT memory-map (memory)*>
  36002. <!ATTLIST memory-map version CDATA #FIXED "1.0.0">
  36003. <!ELEMENT memory (property)*>
  36004. <!-- memory: Specifies a memory region,
  36005. and its type, or device. -->
  36006. <!ATTLIST memory type (ram|rom|flash) #REQUIRED
  36007. start CDATA #REQUIRED
  36008. length CDATA #REQUIRED>
  36009. <!-- property: Generic attribute tag -->
  36010. <!ELEMENT property (#PCDATA | property)*>
  36011. <!ATTLIST property name (blocksize) #REQUIRED>
  36012. 
  36013. File: gdb.info, Node: Thread List Format, Next: Traceframe Info Format, Prev: Memory Map Format, Up: Remote Protocol
  36014. E.17 Thread List Format
  36015. =======================
  36016. To efficiently update the list of threads and their attributes, GDB
  36017. issues the 'qXfer:threads:read' packet (*note qXfer threads read::) and
  36018. obtains the XML document with the following structure:
  36019. <?xml version="1.0"?>
  36020. <threads>
  36021. <thread id="id" core="0" name="name">
  36022. ... description ...
  36023. </thread>
  36024. </threads>
  36025. Each 'thread' element must have the 'id' attribute that identifies
  36026. the thread (*note thread-id syntax::). The 'core' attribute, if
  36027. present, specifies which processor core the thread was last executing
  36028. on. The 'name' attribute, if present, specifies the human-readable name
  36029. of the thread. The content of the of 'thread' element is interpreted as
  36030. human-readable auxiliary information. The 'handle' attribute, if
  36031. present, is a hex encoded representation of the thread handle.
  36032. 
  36033. File: gdb.info, Node: Traceframe Info Format, Next: Branch Trace Format, Prev: Thread List Format, Up: Remote Protocol
  36034. E.18 Traceframe Info Format
  36035. ===========================
  36036. To be able to know which objects in the inferior can be examined when
  36037. inspecting a tracepoint hit, GDB needs to obtain the list of memory
  36038. ranges, registers and trace state variables that have been collected in
  36039. a traceframe.
  36040. This list is obtained using the 'qXfer:traceframe-info:read' (*note
  36041. qXfer traceframe info read::) packet and is an XML document.
  36042. GDB must be linked with the Expat library to support XML traceframe
  36043. info discovery. *Note Expat::.
  36044. The top-level structure of the document is shown below:
  36045. <?xml version="1.0"?>
  36046. <!DOCTYPE traceframe-info
  36047. PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
  36048. "http://sourceware.org/gdb/gdb-traceframe-info.dtd">
  36049. <traceframe-info>
  36050. block...
  36051. </traceframe-info>
  36052. Each traceframe block can be either:
  36053. * A region of collected memory starting at ADDR and extending for
  36054. LENGTH bytes from there:
  36055. <memory start="ADDR" length="LENGTH"/>
  36056. * A block indicating trace state variable numbered NUMBER has been
  36057. collected:
  36058. <tvar id="NUMBER"/>
  36059. The formal DTD for the traceframe info format is given below:
  36060. <!ELEMENT traceframe-info (memory | tvar)* >
  36061. <!ATTLIST traceframe-info version CDATA #FIXED "1.0">
  36062. <!ELEMENT memory EMPTY>
  36063. <!ATTLIST memory start CDATA #REQUIRED
  36064. length CDATA #REQUIRED>
  36065. <!ELEMENT tvar>
  36066. <!ATTLIST tvar id CDATA #REQUIRED>
  36067. 
  36068. File: gdb.info, Node: Branch Trace Format, Next: Branch Trace Configuration Format, Prev: Traceframe Info Format, Up: Remote Protocol
  36069. E.19 Branch Trace Format
  36070. ========================
  36071. In order to display the branch trace of an inferior thread, GDB needs to
  36072. obtain the list of branches. This list is represented as list of
  36073. sequential code blocks that are connected via branches. The code in
  36074. each block has been executed sequentially.
  36075. This list is obtained using the 'qXfer:btrace:read' (*note qXfer
  36076. btrace read::) packet and is an XML document.
  36077. GDB must be linked with the Expat library to support XML traceframe
  36078. info discovery. *Note Expat::.
  36079. The top-level structure of the document is shown below:
  36080. <?xml version="1.0"?>
  36081. <!DOCTYPE btrace
  36082. PUBLIC "+//IDN gnu.org//DTD GDB Branch Trace V1.0//EN"
  36083. "http://sourceware.org/gdb/gdb-btrace.dtd">
  36084. <btrace>
  36085. block...
  36086. </btrace>
  36087. * A block of sequentially executed instructions starting at BEGIN and
  36088. ending at END:
  36089. <block begin="BEGIN" end="END"/>
  36090. The formal DTD for the branch trace format is given below:
  36091. <!ELEMENT btrace (block* | pt) >
  36092. <!ATTLIST btrace version CDATA #FIXED "1.0">
  36093. <!ELEMENT block EMPTY>
  36094. <!ATTLIST block begin CDATA #REQUIRED
  36095. end CDATA #REQUIRED>
  36096. <!ELEMENT pt (pt-config?, raw?)>
  36097. <!ELEMENT pt-config (cpu?)>
  36098. <!ELEMENT cpu EMPTY>
  36099. <!ATTLIST cpu vendor CDATA #REQUIRED
  36100. family CDATA #REQUIRED
  36101. model CDATA #REQUIRED
  36102. stepping CDATA #REQUIRED>
  36103. <!ELEMENT raw (#PCDATA)>
  36104. 
  36105. File: gdb.info, Node: Branch Trace Configuration Format, Prev: Branch Trace Format, Up: Remote Protocol
  36106. E.20 Branch Trace Configuration Format
  36107. ======================================
  36108. For each inferior thread, GDB can obtain the branch trace configuration
  36109. using the 'qXfer:btrace-conf:read' (*note qXfer btrace-conf read::)
  36110. packet.
  36111. The configuration describes the branch trace format and configuration
  36112. settings for that format. The following information is described:
  36113. 'bts'
  36114. This thread uses the "Branch Trace Store" (BTS) format.
  36115. 'size'
  36116. The size of the BTS ring buffer in bytes.
  36117. 'pt'
  36118. This thread uses the "Intel Processor Trace" (Intel PT) format.
  36119. 'size'
  36120. The size of the Intel PT ring buffer in bytes.
  36121. GDB must be linked with the Expat library to support XML branch trace
  36122. configuration discovery. *Note Expat::.
  36123. The formal DTD for the branch trace configuration format is given
  36124. below:
  36125. <!ELEMENT btrace-conf (bts?, pt?)>
  36126. <!ATTLIST btrace-conf version CDATA #FIXED "1.0">
  36127. <!ELEMENT bts EMPTY>
  36128. <!ATTLIST bts size CDATA #IMPLIED>
  36129. <!ELEMENT pt EMPTY>
  36130. <!ATTLIST pt size CDATA #IMPLIED>
  36131. 
  36132. File: gdb.info, Node: Agent Expressions, Next: Target Descriptions, Prev: Remote Protocol, Up: Top
  36133. Appendix F The GDB Agent Expression Mechanism
  36134. *********************************************
  36135. In some applications, it is not feasible for the debugger to interrupt
  36136. the program's execution long enough for the developer to learn anything
  36137. helpful about its behavior. If the program's correctness depends on its
  36138. real-time behavior, delays introduced by a debugger might cause the
  36139. program to fail, even when the code itself is correct. It is useful to
  36140. be able to observe the program's behavior without interrupting it.
  36141. Using GDB's 'trace' and 'collect' commands, the user can specify
  36142. locations in the program, and arbitrary expressions to evaluate when
  36143. those locations are reached. Later, using the 'tfind' command, she can
  36144. examine the values those expressions had when the program hit the trace
  36145. points. The expressions may also denote objects in memory -- structures
  36146. or arrays, for example -- whose values GDB should record; while visiting
  36147. a particular tracepoint, the user may inspect those objects as if they
  36148. were in memory at that moment. However, because GDB records these
  36149. values without interacting with the user, it can do so quickly and
  36150. unobtrusively, hopefully not disturbing the program's behavior.
  36151. When GDB is debugging a remote target, the GDB "agent" code running
  36152. on the target computes the values of the expressions itself. To avoid
  36153. having a full symbolic expression evaluator on the agent, GDB translates
  36154. expressions in the source language into a simpler bytecode language, and
  36155. then sends the bytecode to the agent; the agent then executes the
  36156. bytecode, and records the values for GDB to retrieve later.
  36157. The bytecode language is simple; there are forty-odd opcodes, the
  36158. bulk of which are the usual vocabulary of C operands (addition,
  36159. subtraction, shifts, and so on) and various sizes of literals and memory
  36160. reference operations. The bytecode interpreter operates strictly on
  36161. machine-level values -- various sizes of integers and floating point
  36162. numbers -- and requires no information about types or symbols; thus, the
  36163. interpreter's internal data structures are simple, and each bytecode
  36164. requires only a few native machine instructions to implement it. The
  36165. interpreter is small, and strict limits on the memory and time required
  36166. to evaluate an expression are easy to determine, making it suitable for
  36167. use by the debugging agent in real-time applications.
  36168. * Menu:
  36169. * General Bytecode Design:: Overview of the interpreter.
  36170. * Bytecode Descriptions:: What each one does.
  36171. * Using Agent Expressions:: How agent expressions fit into the big picture.
  36172. * Varying Target Capabilities:: How to discover what the target can do.
  36173. * Rationale:: Why we did it this way.
  36174. 
  36175. File: gdb.info, Node: General Bytecode Design, Next: Bytecode Descriptions, Up: Agent Expressions
  36176. F.1 General Bytecode Design
  36177. ===========================
  36178. The agent represents bytecode expressions as an array of bytes. Each
  36179. instruction is one byte long (thus the term "bytecode"). Some
  36180. instructions are followed by operand bytes; for example, the 'goto'
  36181. instruction is followed by a destination for the jump.
  36182. The bytecode interpreter is a stack-based machine; most instructions
  36183. pop their operands off the stack, perform some operation, and push the
  36184. result back on the stack for the next instruction to consume. Each
  36185. element of the stack may contain either a integer or a floating point
  36186. value; these values are as many bits wide as the largest integer that
  36187. can be directly manipulated in the source language. Stack elements
  36188. carry no record of their type; bytecode could push a value as an
  36189. integer, then pop it as a floating point value. However, GDB will not
  36190. generate code which does this. In C, one might define the type of a
  36191. stack element as follows:
  36192. union agent_val {
  36193. LONGEST l;
  36194. DOUBLEST d;
  36195. };
  36196. where 'LONGEST' and 'DOUBLEST' are 'typedef' names for the largest
  36197. integer and floating point types on the machine.
  36198. By the time the bytecode interpreter reaches the end of the
  36199. expression, the value of the expression should be the only value left on
  36200. the stack. For tracing applications, 'trace' bytecodes in the
  36201. expression will have recorded the necessary data, and the value on the
  36202. stack may be discarded. For other applications, like conditional
  36203. breakpoints, the value may be useful.
  36204. Separate from the stack, the interpreter has two registers:
  36205. 'pc'
  36206. The address of the next bytecode to execute.
  36207. 'start'
  36208. The address of the start of the bytecode expression, necessary for
  36209. interpreting the 'goto' and 'if_goto' instructions.
  36210. Neither of these registers is directly visible to the bytecode language
  36211. itself, but they are useful for defining the meanings of the bytecode
  36212. operations.
  36213. There are no instructions to perform side effects on the running
  36214. program, or call the program's functions; we assume that these
  36215. expressions are only used for unobtrusive debugging, not for patching
  36216. the running code.
  36217. Most bytecode instructions do not distinguish between the various
  36218. sizes of values, and operate on full-width values; the upper bits of the
  36219. values are simply ignored, since they do not usually make a difference
  36220. to the value computed. The exceptions to this rule are:
  36221. memory reference instructions ('ref'N)
  36222. There are distinct instructions to fetch different word sizes from
  36223. memory. Once on the stack, however, the values are treated as
  36224. full-size integers. They may need to be sign-extended; the 'ext'
  36225. instruction exists for this purpose.
  36226. the sign-extension instruction ('ext' N)
  36227. These clearly need to know which portion of their operand is to be
  36228. extended to occupy the full length of the word.
  36229. If the interpreter is unable to evaluate an expression completely for
  36230. some reason (a memory location is inaccessible, or a divisor is zero,
  36231. for example), we say that interpretation "terminates with an error".
  36232. This means that the problem is reported back to the interpreter's caller
  36233. in some helpful way. In general, code using agent expressions should
  36234. assume that they may attempt to divide by zero, fetch arbitrary memory
  36235. locations, and misbehave in other ways.
  36236. Even complicated C expressions compile to a few bytecode
  36237. instructions; for example, the expression 'x + y * z' would typically
  36238. produce code like the following, assuming that 'x' and 'y' live in
  36239. registers, and 'z' is a global variable holding a 32-bit 'int':
  36240. reg 1
  36241. reg 2
  36242. const32 address of z
  36243. ref32
  36244. ext 32
  36245. mul
  36246. add
  36247. end
  36248. In detail, these mean:
  36249. 'reg 1'
  36250. Push the value of register 1 (presumably holding 'x') onto the
  36251. stack.
  36252. 'reg 2'
  36253. Push the value of register 2 (holding 'y').
  36254. 'const32 address of z'
  36255. Push the address of 'z' onto the stack.
  36256. 'ref32'
  36257. Fetch a 32-bit word from the address at the top of the stack;
  36258. replace the address on the stack with the value. Thus, we replace
  36259. the address of 'z' with 'z''s value.
  36260. 'ext 32'
  36261. Sign-extend the value on the top of the stack from 32 bits to full
  36262. length. This is necessary because 'z' is a signed integer.
  36263. 'mul'
  36264. Pop the top two numbers on the stack, multiply them, and push their
  36265. product. Now the top of the stack contains the value of the
  36266. expression 'y * z'.
  36267. 'add'
  36268. Pop the top two numbers, add them, and push the sum. Now the top
  36269. of the stack contains the value of 'x + y * z'.
  36270. 'end'
  36271. Stop executing; the value left on the stack top is the value to be
  36272. recorded.
  36273. 
  36274. File: gdb.info, Node: Bytecode Descriptions, Next: Using Agent Expressions, Prev: General Bytecode Design, Up: Agent Expressions
  36275. F.2 Bytecode Descriptions
  36276. =========================
  36277. Each bytecode description has the following form:
  36278. 'add' (0x02): A B => A+B
  36279. Pop the top two stack items, A and B, as integers; push their sum,
  36280. as an integer.
  36281. In this example, 'add' is the name of the bytecode, and '(0x02)' is
  36282. the one-byte value used to encode the bytecode, in hexadecimal. The
  36283. phrase "A B => A+B" shows the stack before and after the bytecode
  36284. executes. Beforehand, the stack must contain at least two values, A and
  36285. B; since the top of the stack is to the right, B is on the top of the
  36286. stack, and A is underneath it. After execution, the bytecode will have
  36287. popped A and B from the stack, and replaced them with a single value,
  36288. A+B. There may be other values on the stack below those shown, but the
  36289. bytecode affects only those shown.
  36290. Here is another example:
  36291. 'const8' (0x22) N: => N
  36292. Push the 8-bit integer constant N on the stack, without sign
  36293. extension.
  36294. In this example, the bytecode 'const8' takes an operand N directly
  36295. from the bytecode stream; the operand follows the 'const8' bytecode
  36296. itself. We write any such operands immediately after the name of the
  36297. bytecode, before the colon, and describe the exact encoding of the
  36298. operand in the bytecode stream in the body of the bytecode description.
  36299. For the 'const8' bytecode, there are no stack items given before the
  36300. =>; this simply means that the bytecode consumes no values from the
  36301. stack. If a bytecode consumes no values, or produces no values, the
  36302. list on either side of the => may be empty.
  36303. If a value is written as A, B, or N, then the bytecode treats it as
  36304. an integer. If a value is written is ADDR, then the bytecode treats it
  36305. as an address.
  36306. We do not fully describe the floating point operations here; although
  36307. this design can be extended in a clean way to handle floating point
  36308. values, they are not of immediate interest to the customer, so we avoid
  36309. describing them, to save time.
  36310. 'float' (0x01): =>
  36311. Prefix for floating-point bytecodes. Not implemented yet.
  36312. 'add' (0x02): A B => A+B
  36313. Pop two integers from the stack, and push their sum, as an integer.
  36314. 'sub' (0x03): A B => A-B
  36315. Pop two integers from the stack, subtract the top value from the
  36316. next-to-top value, and push the difference.
  36317. 'mul' (0x04): A B => A*B
  36318. Pop two integers from the stack, multiply them, and push the
  36319. product on the stack. Note that, when one multiplies two N-bit
  36320. numbers yielding another N-bit number, it is irrelevant whether the
  36321. numbers are signed or not; the results are the same.
  36322. 'div_signed' (0x05): A B => A/B
  36323. Pop two signed integers from the stack; divide the next-to-top
  36324. value by the top value, and push the quotient. If the divisor is
  36325. zero, terminate with an error.
  36326. 'div_unsigned' (0x06): A B => A/B
  36327. Pop two unsigned integers from the stack; divide the next-to-top
  36328. value by the top value, and push the quotient. If the divisor is
  36329. zero, terminate with an error.
  36330. 'rem_signed' (0x07): A B => A MODULO B
  36331. Pop two signed integers from the stack; divide the next-to-top
  36332. value by the top value, and push the remainder. If the divisor is
  36333. zero, terminate with an error.
  36334. 'rem_unsigned' (0x08): A B => A MODULO B
  36335. Pop two unsigned integers from the stack; divide the next-to-top
  36336. value by the top value, and push the remainder. If the divisor is
  36337. zero, terminate with an error.
  36338. 'lsh' (0x09): A B => A<<B
  36339. Pop two integers from the stack; let A be the next-to-top value,
  36340. and B be the top value. Shift A left by B bits, and push the
  36341. result.
  36342. 'rsh_signed' (0x0a): A B => '(signed)'A>>B
  36343. Pop two integers from the stack; let A be the next-to-top value,
  36344. and B be the top value. Shift A right by B bits, inserting copies
  36345. of the top bit at the high end, and push the result.
  36346. 'rsh_unsigned' (0x0b): A B => A>>B
  36347. Pop two integers from the stack; let A be the next-to-top value,
  36348. and B be the top value. Shift A right by B bits, inserting zero
  36349. bits at the high end, and push the result.
  36350. 'log_not' (0x0e): A => !A
  36351. Pop an integer from the stack; if it is zero, push the value one;
  36352. otherwise, push the value zero.
  36353. 'bit_and' (0x0f): A B => A&B
  36354. Pop two integers from the stack, and push their bitwise 'and'.
  36355. 'bit_or' (0x10): A B => A|B
  36356. Pop two integers from the stack, and push their bitwise 'or'.
  36357. 'bit_xor' (0x11): A B => A^B
  36358. Pop two integers from the stack, and push their bitwise
  36359. exclusive-'or'.
  36360. 'bit_not' (0x12): A => ~A
  36361. Pop an integer from the stack, and push its bitwise complement.
  36362. 'equal' (0x13): A B => A=B
  36363. Pop two integers from the stack; if they are equal, push the value
  36364. one; otherwise, push the value zero.
  36365. 'less_signed' (0x14): A B => A<B
  36366. Pop two signed integers from the stack; if the next-to-top value is
  36367. less than the top value, push the value one; otherwise, push the
  36368. value zero.
  36369. 'less_unsigned' (0x15): A B => A<B
  36370. Pop two unsigned integers from the stack; if the next-to-top value
  36371. is less than the top value, push the value one; otherwise, push the
  36372. value zero.
  36373. 'ext' (0x16) N: A => A, sign-extended from N bits
  36374. Pop an unsigned value from the stack; treating it as an N-bit
  36375. twos-complement value, extend it to full length. This means that
  36376. all bits to the left of bit N-1 (where the least significant bit is
  36377. bit 0) are set to the value of bit N-1. Note that N may be larger
  36378. than or equal to the width of the stack elements of the bytecode
  36379. engine; in this case, the bytecode should have no effect.
  36380. The number of source bits to preserve, N, is encoded as a single
  36381. byte unsigned integer following the 'ext' bytecode.
  36382. 'zero_ext' (0x2a) N: A => A, zero-extended from N bits
  36383. Pop an unsigned value from the stack; zero all but the bottom N
  36384. bits.
  36385. The number of source bits to preserve, N, is encoded as a single
  36386. byte unsigned integer following the 'zero_ext' bytecode.
  36387. 'ref8' (0x17): ADDR => A
  36388. 'ref16' (0x18): ADDR => A
  36389. 'ref32' (0x19): ADDR => A
  36390. 'ref64' (0x1a): ADDR => A
  36391. Pop an address ADDR from the stack. For bytecode 'ref'N, fetch an
  36392. N-bit value from ADDR, using the natural target endianness. Push
  36393. the fetched value as an unsigned integer.
  36394. Note that ADDR may not be aligned in any particular way; the 'refN'
  36395. bytecodes should operate correctly for any address.
  36396. If attempting to access memory at ADDR would cause a processor
  36397. exception of some sort, terminate with an error.
  36398. 'ref_float' (0x1b): ADDR => D
  36399. 'ref_double' (0x1c): ADDR => D
  36400. 'ref_long_double' (0x1d): ADDR => D
  36401. 'l_to_d' (0x1e): A => D
  36402. 'd_to_l' (0x1f): D => A
  36403. Not implemented yet.
  36404. 'dup' (0x28): A => A A
  36405. Push another copy of the stack's top element.
  36406. 'swap' (0x2b): A B => B A
  36407. Exchange the top two items on the stack.
  36408. 'pop' (0x29): A =>
  36409. Discard the top value on the stack.
  36410. 'pick' (0x32) N: A ... B => A ... B A
  36411. Duplicate an item from the stack and push it on the top of the
  36412. stack. N, a single byte, indicates the stack item to copy. If N
  36413. is zero, this is the same as 'dup'; if N is one, it copies the item
  36414. under the top item, etc. If N exceeds the number of items on the
  36415. stack, terminate with an error.
  36416. 'rot' (0x33): A B C => C A B
  36417. Rotate the top three items on the stack. The top item (c) becomes
  36418. the third item, the next-to-top item (b) becomes the top item and
  36419. the third item (a) from the top becomes the next-to-top item.
  36420. 'if_goto' (0x20) OFFSET: A =>
  36421. Pop an integer off the stack; if it is non-zero, branch to the
  36422. given offset in the bytecode string. Otherwise, continue to the
  36423. next instruction in the bytecode stream. In other words, if A is
  36424. non-zero, set the 'pc' register to 'start' + OFFSET. Thus, an
  36425. offset of zero denotes the beginning of the expression.
  36426. The OFFSET is stored as a sixteen-bit unsigned value, stored
  36427. immediately following the 'if_goto' bytecode. It is always stored
  36428. most significant byte first, regardless of the target's normal
  36429. endianness. The offset is not guaranteed to fall at any particular
  36430. alignment within the bytecode stream; thus, on machines where
  36431. fetching a 16-bit on an unaligned address raises an exception, you
  36432. should fetch the offset one byte at a time.
  36433. 'goto' (0x21) OFFSET: =>
  36434. Branch unconditionally to OFFSET; in other words, set the 'pc'
  36435. register to 'start' + OFFSET.
  36436. The offset is stored in the same way as for the 'if_goto' bytecode.
  36437. 'const8' (0x22) N: => N
  36438. 'const16' (0x23) N: => N
  36439. 'const32' (0x24) N: => N
  36440. 'const64' (0x25) N: => N
  36441. Push the integer constant N on the stack, without sign extension.
  36442. To produce a small negative value, push a small twos-complement
  36443. value, and then sign-extend it using the 'ext' bytecode.
  36444. The constant N is stored in the appropriate number of bytes
  36445. following the 'const'B bytecode. The constant N is always stored
  36446. most significant byte first, regardless of the target's normal
  36447. endianness. The constant is not guaranteed to fall at any
  36448. particular alignment within the bytecode stream; thus, on machines
  36449. where fetching a 16-bit on an unaligned address raises an
  36450. exception, you should fetch N one byte at a time.
  36451. 'reg' (0x26) N: => A
  36452. Push the value of register number N, without sign extension. The
  36453. registers are numbered following GDB's conventions.
  36454. The register number N is encoded as a 16-bit unsigned integer
  36455. immediately following the 'reg' bytecode. It is always stored most
  36456. significant byte first, regardless of the target's normal
  36457. endianness. The register number is not guaranteed to fall at any
  36458. particular alignment within the bytecode stream; thus, on machines
  36459. where fetching a 16-bit on an unaligned address raises an
  36460. exception, you should fetch the register number one byte at a time.
  36461. 'getv' (0x2c) N: => V
  36462. Push the value of trace state variable number N, without sign
  36463. extension.
  36464. The variable number N is encoded as a 16-bit unsigned integer
  36465. immediately following the 'getv' bytecode. It is always stored
  36466. most significant byte first, regardless of the target's normal
  36467. endianness. The variable number is not guaranteed to fall at any
  36468. particular alignment within the bytecode stream; thus, on machines
  36469. where fetching a 16-bit on an unaligned address raises an
  36470. exception, you should fetch the register number one byte at a time.
  36471. 'setv' (0x2d) N: V => V
  36472. Set trace state variable number N to the value found on the top of
  36473. the stack. The stack is unchanged, so that the value is readily
  36474. available if the assignment is part of a larger expression. The
  36475. handling of N is as described for 'getv'.
  36476. 'trace' (0x0c): ADDR SIZE =>
  36477. Record the contents of the SIZE bytes at ADDR in a trace buffer,
  36478. for later retrieval by GDB.
  36479. 'trace_quick' (0x0d) SIZE: ADDR => ADDR
  36480. Record the contents of the SIZE bytes at ADDR in a trace buffer,
  36481. for later retrieval by GDB. SIZE is a single byte unsigned integer
  36482. following the 'trace' opcode.
  36483. This bytecode is equivalent to the sequence 'dup const8 SIZE
  36484. trace', but we provide it anyway to save space in bytecode strings.
  36485. 'trace16' (0x30) SIZE: ADDR => ADDR
  36486. Identical to trace_quick, except that SIZE is a 16-bit big-endian
  36487. unsigned integer, not a single byte. This should probably have
  36488. been named 'trace_quick16', for consistency.
  36489. 'tracev' (0x2e) N: => A
  36490. Record the value of trace state variable number N in the trace
  36491. buffer. The handling of N is as described for 'getv'.
  36492. 'tracenz' (0x2f) ADDR SIZE =>
  36493. Record the bytes at ADDR in a trace buffer, for later retrieval by
  36494. GDB. Stop at either the first zero byte, or when SIZE bytes have
  36495. been recorded, whichever occurs first.
  36496. 'printf' (0x34) NUMARGS STRING =>
  36497. Do a formatted print, in the style of the C function 'printf').
  36498. The value of NUMARGS is the number of arguments to expect on the
  36499. stack, while STRING is the format string, prefixed with a two-byte
  36500. length. The last byte of the string must be zero, and is included
  36501. in the length. The format string includes escaped sequences just
  36502. as it appears in C source, so for instance the format string
  36503. '"\t%d\n"' is six characters long, and the output will consist of a
  36504. tab character, a decimal number, and a newline. At the top of the
  36505. stack, above the values to be printed, this bytecode will pop a
  36506. "function" and "channel". If the function is nonzero, then the
  36507. target may treat it as a function and call it, passing the channel
  36508. as a first argument, as with the C function 'fprintf'. If the
  36509. function is zero, then the target may simply call a standard
  36510. formatted print function of its choice. In all, this bytecode pops
  36511. 2 + NUMARGS stack elements, and pushes nothing.
  36512. 'end' (0x27): =>
  36513. Stop executing bytecode; the result should be the top element of
  36514. the stack. If the purpose of the expression was to compute an
  36515. lvalue or a range of memory, then the next-to-top of the stack is
  36516. the lvalue's address, and the top of the stack is the lvalue's
  36517. size, in bytes.
  36518. 
  36519. File: gdb.info, Node: Using Agent Expressions, Next: Varying Target Capabilities, Prev: Bytecode Descriptions, Up: Agent Expressions
  36520. F.3 Using Agent Expressions
  36521. ===========================
  36522. Agent expressions can be used in several different ways by GDB, and the
  36523. debugger can generate different bytecode sequences as appropriate.
  36524. One possibility is to do expression evaluation on the target rather
  36525. than the host, such as for the conditional of a conditional tracepoint.
  36526. In such a case, GDB compiles the source expression into a bytecode
  36527. sequence that simply gets values from registers or memory, does
  36528. arithmetic, and returns a result.
  36529. Another way to use agent expressions is for tracepoint data
  36530. collection. GDB generates a different bytecode sequence for collection;
  36531. in addition to bytecodes that do the calculation, GDB adds 'trace'
  36532. bytecodes to save the pieces of memory that were used.
  36533. * The user selects trace points in the program's code at which GDB
  36534. should collect data.
  36535. * The user specifies expressions to evaluate at each trace point.
  36536. These expressions may denote objects in memory, in which case those
  36537. objects' contents are recorded as the program runs, or computed
  36538. values, in which case the values themselves are recorded.
  36539. * GDB transmits the tracepoints and their associated expressions to
  36540. the GDB agent, running on the debugging target.
  36541. * The agent arranges to be notified when a trace point is hit.
  36542. * When execution on the target reaches a trace point, the agent
  36543. evaluates the expressions associated with that trace point, and
  36544. records the resulting values and memory ranges.
  36545. * Later, when the user selects a given trace event and inspects the
  36546. objects and expression values recorded, GDB talks to the agent to
  36547. retrieve recorded data as necessary to meet the user's requests.
  36548. If the user asks to see an object whose contents have not been
  36549. recorded, GDB reports an error.
  36550. 
  36551. File: gdb.info, Node: Varying Target Capabilities, Next: Rationale, Prev: Using Agent Expressions, Up: Agent Expressions
  36552. F.4 Varying Target Capabilities
  36553. ===============================
  36554. Some targets don't support floating-point, and some would rather not
  36555. have to deal with 'long long' operations. Also, different targets will
  36556. have different stack sizes, and different bytecode buffer lengths.
  36557. Thus, GDB needs a way to ask the target about itself. We haven't
  36558. worked out the details yet, but in general, GDB should be able to send
  36559. the target a packet asking it to describe itself. The reply should be a
  36560. packet whose length is explicit, so we can add new information to the
  36561. packet in future revisions of the agent, without confusing old versions
  36562. of GDB, and it should contain a version number. It should contain at
  36563. least the following information:
  36564. * whether floating point is supported
  36565. * whether 'long long' is supported
  36566. * maximum acceptable size of bytecode stack
  36567. * maximum acceptable length of bytecode expressions
  36568. * which registers are actually available for collection
  36569. * whether the target supports disabled tracepoints
  36570. 
  36571. File: gdb.info, Node: Rationale, Prev: Varying Target Capabilities, Up: Agent Expressions
  36572. F.5 Rationale
  36573. =============
  36574. Some of the design decisions apparent above are arguable.
  36575. What about stack overflow/underflow?
  36576. GDB should be able to query the target to discover its stack size.
  36577. Given that information, GDB can determine at translation time
  36578. whether a given expression will overflow the stack. But this spec
  36579. isn't about what kinds of error-checking GDB ought to do.
  36580. Why are you doing everything in LONGEST?
  36581. Speed isn't important, but agent code size is; using LONGEST brings
  36582. in a bunch of support code to do things like division, etc. So
  36583. this is a serious concern.
  36584. First, note that you don't need different bytecodes for different
  36585. operand sizes. You can generate code without _knowing_ how big the
  36586. stack elements actually are on the target. If the target only
  36587. supports 32-bit ints, and you don't send any 64-bit bytecodes,
  36588. everything just works. The observation here is that the MIPS and
  36589. the Alpha have only fixed-size registers, and you can still get C's
  36590. semantics even though most instructions only operate on full-sized
  36591. words. You just need to make sure everything is properly
  36592. sign-extended at the right times. So there is no need for 32- and
  36593. 64-bit variants of the bytecodes. Just implement everything using
  36594. the largest size you support.
  36595. GDB should certainly check to see what sizes the target supports,
  36596. so the user can get an error earlier, rather than later. But this
  36597. information is not necessary for correctness.
  36598. Why don't you have '>' or '<=' operators?
  36599. I want to keep the interpreter small, and we don't need them. We
  36600. can combine the 'less_' opcodes with 'log_not', and swap the order
  36601. of the operands, yielding all four asymmetrical comparison
  36602. operators. For example, '(x <= y)' is '! (x > y)', which is '! (y
  36603. < x)'.
  36604. Why do you have 'log_not'?
  36605. Why do you have 'ext'?
  36606. Why do you have 'zero_ext'?
  36607. These are all easily synthesized from other instructions, but I
  36608. expect them to be used frequently, and they're simple, so I include
  36609. them to keep bytecode strings short.
  36610. 'log_not' is equivalent to 'const8 0 equal'; it's used in half the
  36611. relational operators.
  36612. 'ext N' is equivalent to 'const8 S-N lsh const8 S-N rsh_signed',
  36613. where S is the size of the stack elements; it follows 'refM' and
  36614. REG bytecodes when the value should be signed. See the next
  36615. bulleted item.
  36616. 'zero_ext N' is equivalent to 'constM MASK log_and'; it's used
  36617. whenever we push the value of a register, because we can't assume
  36618. the upper bits of the register aren't garbage.
  36619. Why not have sign-extending variants of the 'ref' operators?
  36620. Because that would double the number of 'ref' operators, and we
  36621. need the 'ext' bytecode anyway for accessing bitfields.
  36622. Why not have constant-address variants of the 'ref' operators?
  36623. Because that would double the number of 'ref' operators again, and
  36624. 'const32 ADDRESS ref32' is only one byte longer.
  36625. Why do the 'refN' operators have to support unaligned fetches?
  36626. GDB will generate bytecode that fetches multi-byte values at
  36627. unaligned addresses whenever the executable's debugging information
  36628. tells it to. Furthermore, GDB does not know the value the pointer
  36629. will have when GDB generates the bytecode, so it cannot determine
  36630. whether a particular fetch will be aligned or not.
  36631. In particular, structure bitfields may be several bytes long, but
  36632. follow no alignment rules; members of packed structures are not
  36633. necessarily aligned either.
  36634. In general, there are many cases where unaligned references occur
  36635. in correct C code, either at the programmer's explicit request, or
  36636. at the compiler's discretion. Thus, it is simpler to make the GDB
  36637. agent bytecodes work correctly in all circumstances than to make
  36638. GDB guess in each case whether the compiler did the usual thing.
  36639. Why are there no side-effecting operators?
  36640. Because our current client doesn't want them? That's a cheap
  36641. answer. I think the real answer is that I'm afraid of implementing
  36642. function calls. We should re-visit this issue after the present
  36643. contract is delivered.
  36644. Why aren't the 'goto' ops PC-relative?
  36645. The interpreter has the base address around anyway for PC bounds
  36646. checking, and it seemed simpler.
  36647. Why is there only one offset size for the 'goto' ops?
  36648. Offsets are currently sixteen bits. I'm not happy with this
  36649. situation either:
  36650. Suppose we have multiple branch ops with different offset sizes.
  36651. As I generate code left-to-right, all my jumps are forward jumps
  36652. (there are no loops in expressions), so I never know the target
  36653. when I emit the jump opcode. Thus, I have to either always assume
  36654. the largest offset size, or do jump relaxation on the code after I
  36655. generate it, which seems like a big waste of time.
  36656. I can imagine a reasonable expression being longer than 256 bytes.
  36657. I can't imagine one being longer than 64k. Thus, we need 16-bit
  36658. offsets. This kind of reasoning is so bogus, but relaxation is
  36659. pathetic.
  36660. The other approach would be to generate code right-to-left. Then
  36661. I'd always know my offset size. That might be fun.
  36662. Where is the function call bytecode?
  36663. When we add side-effects, we should add this.
  36664. Why does the 'reg' bytecode take a 16-bit register number?
  36665. Intel's IA-64 architecture has 128 general-purpose registers, and
  36666. 128 floating-point registers, and I'm sure it has some random
  36667. control registers.
  36668. Why do we need 'trace' and 'trace_quick'?
  36669. Because GDB needs to record all the memory contents and registers
  36670. an expression touches. If the user wants to evaluate an expression
  36671. 'x->y->z', the agent must record the values of 'x' and 'x->y' as
  36672. well as the value of 'x->y->z'.
  36673. Don't the 'trace' bytecodes make the interpreter less general?
  36674. They do mean that the interpreter contains special-purpose code,
  36675. but that doesn't mean the interpreter can only be used for that
  36676. purpose. If an expression doesn't use the 'trace' bytecodes, they
  36677. don't get in its way.
  36678. Why doesn't 'trace_quick' consume its arguments the way everything else does?
  36679. In general, you do want your operators to consume their arguments;
  36680. it's consistent, and generally reduces the amount of stack
  36681. rearrangement necessary. However, 'trace_quick' is a kludge to
  36682. save space; it only exists so we needn't write 'dup const8 SIZE
  36683. trace' before every memory reference. Therefore, it's okay for it
  36684. not to consume its arguments; it's meant for a specific context in
  36685. which we know exactly what it should do with the stack. If we're
  36686. going to have a kludge, it should be an effective kludge.
  36687. Why does 'trace16' exist?
  36688. That opcode was added by the customer that contracted Cygnus for
  36689. the data tracing work. I personally think it is unnecessary;
  36690. objects that large will be quite rare, so it is okay to use 'dup
  36691. const16 SIZE trace' in those cases.
  36692. Whatever we decide to do with 'trace16', we should at least leave
  36693. opcode 0x30 reserved, to remain compatible with the customer who
  36694. added it.
  36695. 
  36696. File: gdb.info, Node: Target Descriptions, Next: Operating System Information, Prev: Agent Expressions, Up: Top
  36697. Appendix G Target Descriptions
  36698. ******************************
  36699. One of the challenges of using GDB to debug embedded systems is that
  36700. there are so many minor variants of each processor architecture in use.
  36701. It is common practice for vendors to start with a standard processor
  36702. core -- ARM, PowerPC, or MIPS, for example -- and then make changes to
  36703. adapt it to a particular market niche. Some architectures have hundreds
  36704. of variants, available from dozens of vendors. This leads to a number
  36705. of problems:
  36706. * With so many different customized processors, it is difficult for
  36707. the GDB maintainers to keep up with the changes.
  36708. * Since individual variants may have short lifetimes or limited
  36709. audiences, it may not be worthwhile to carry information about
  36710. every variant in the GDB source tree.
  36711. * When GDB does support the architecture of the embedded system at
  36712. hand, the task of finding the correct architecture name to give the
  36713. 'set architecture' command can be error-prone.
  36714. To address these problems, the GDB remote protocol allows a target
  36715. system to not only identify itself to GDB, but to actually describe its
  36716. own features. This lets GDB support processor variants it has never
  36717. seen before -- to the extent that the descriptions are accurate, and
  36718. that GDB understands them.
  36719. GDB must be linked with the Expat library to support XML target
  36720. descriptions. *Note Expat::.
  36721. * Menu:
  36722. * Retrieving Descriptions:: How descriptions are fetched from a target.
  36723. * Target Description Format:: The contents of a target description.
  36724. * Predefined Target Types:: Standard types available for target
  36725. descriptions.
  36726. * Enum Target Types:: How to define enum target types.
  36727. * Standard Target Features:: Features GDB knows about.
  36728. 
  36729. File: gdb.info, Node: Retrieving Descriptions, Next: Target Description Format, Up: Target Descriptions
  36730. G.1 Retrieving Descriptions
  36731. ===========================
  36732. Target descriptions can be read from the target automatically, or
  36733. specified by the user manually. The default behavior is to read the
  36734. description from the target. GDB retrieves it via the remote protocol
  36735. using 'qXfer' requests (*note qXfer: General Query Packets.). The ANNEX
  36736. in the 'qXfer' packet will be 'target.xml'. The contents of the
  36737. 'target.xml' annex are an XML document, of the form described in *note
  36738. Target Description Format::.
  36739. Alternatively, you can specify a file to read for the target
  36740. description. If a file is set, the target will not be queried. The
  36741. commands to specify a file are:
  36742. 'set tdesc filename PATH'
  36743. Read the target description from PATH.
  36744. 'unset tdesc filename'
  36745. Do not read the XML target description from a file. GDB will use
  36746. the description supplied by the current target.
  36747. 'show tdesc filename'
  36748. Show the filename to read for a target description, if any.
  36749. 
  36750. File: gdb.info, Node: Target Description Format, Next: Predefined Target Types, Prev: Retrieving Descriptions, Up: Target Descriptions
  36751. G.2 Target Description Format
  36752. =============================
  36753. A target description annex is an XML (http://www.w3.org/XML/) document
  36754. which complies with the Document Type Definition provided in the GDB
  36755. sources in 'gdb/features/gdb-target.dtd'. This means you can use
  36756. generally available tools like 'xmllint' to check that your feature
  36757. descriptions are well-formed and valid. However, to help people
  36758. unfamiliar with XML write descriptions for their targets, we also
  36759. describe the grammar here.
  36760. Target descriptions can identify the architecture of the remote
  36761. target and (for some architectures) provide information about custom
  36762. register sets. They can also identify the OS ABI of the remote target.
  36763. GDB can use this information to autoconfigure for your target, or to
  36764. warn you if you connect to an unsupported target.
  36765. Here is a simple target description:
  36766. <target version="1.0">
  36767. <architecture>i386:x86-64</architecture>
  36768. </target>
  36769. This minimal description only says that the target uses the x86-64
  36770. architecture.
  36771. A target description has the following overall form, with [ ] marking
  36772. optional elements and ... marking repeatable elements. The elements are
  36773. explained further below.
  36774. <?xml version="1.0"?>
  36775. <!DOCTYPE target SYSTEM "gdb-target.dtd">
  36776. <target version="1.0">
  36777. [ARCHITECTURE]
  36778. [OSABI]
  36779. [COMPATIBLE]
  36780. [FEATURE...]
  36781. </target>
  36782. The description is generally insensitive to whitespace and line breaks,
  36783. under the usual common-sense rules. The XML version declaration and
  36784. document type declaration can generally be omitted (GDB does not require
  36785. them), but specifying them may be useful for XML validation tools. The
  36786. 'version' attribute for '<target>' may also be omitted, but we recommend
  36787. including it; if future versions of GDB use an incompatible revision of
  36788. 'gdb-target.dtd', they will detect and report the version mismatch.
  36789. G.2.1 Inclusion
  36790. ---------------
  36791. It can sometimes be valuable to split a target description up into
  36792. several different annexes, either for organizational purposes, or to
  36793. share files between different possible target descriptions. You can
  36794. divide a description into multiple files by replacing any element of the
  36795. target description with an inclusion directive of the form:
  36796. <xi:include href="DOCUMENT"/>
  36797. When GDB encounters an element of this form, it will retrieve the named
  36798. XML DOCUMENT, and replace the inclusion directive with the contents of
  36799. that document. If the current description was read using 'qXfer', then
  36800. so will be the included document; DOCUMENT will be interpreted as the
  36801. name of an annex. If the current description was read from a file, GDB
  36802. will look for DOCUMENT as a file in the same directory where it found
  36803. the original description.
  36804. G.2.2 Architecture
  36805. ------------------
  36806. An '<architecture>' element has this form:
  36807. <architecture>ARCH</architecture>
  36808. ARCH is one of the architectures from the set accepted by 'set
  36809. architecture' (*note Specifying a Debugging Target: Targets.).
  36810. G.2.3 OS ABI
  36811. ------------
  36812. This optional field was introduced in GDB version 7.0. Previous
  36813. versions of GDB ignore it.
  36814. An '<osabi>' element has this form:
  36815. <osabi>ABI-NAME</osabi>
  36816. ABI-NAME is an OS ABI name from the same selection accepted by 'set osabi'
  36817. (*note Configuring the Current ABI: ABI.).
  36818. G.2.4 Compatible Architecture
  36819. -----------------------------
  36820. This optional field was introduced in GDB version 7.0. Previous
  36821. versions of GDB ignore it.
  36822. A '<compatible>' element has this form:
  36823. <compatible>ARCH</compatible>
  36824. ARCH is one of the architectures from the set accepted by 'set
  36825. architecture' (*note Specifying a Debugging Target: Targets.).
  36826. A '<compatible>' element is used to specify that the target is able
  36827. to run binaries in some other than the main target architecture given by
  36828. the '<architecture>' element. For example, on the Cell Broadband
  36829. Engine, the main architecture is 'powerpc:common' or 'powerpc:common64',
  36830. but the system is able to run binaries in the 'spu' architecture as
  36831. well. The way to describe this capability with '<compatible>' is as
  36832. follows:
  36833. <architecture>powerpc:common</architecture>
  36834. <compatible>spu</compatible>
  36835. G.2.5 Features
  36836. --------------
  36837. Each '<feature>' describes some logical portion of the target system.
  36838. Features are currently used to describe available CPU registers and the
  36839. types of their contents. A '<feature>' element has this form:
  36840. <feature name="NAME">
  36841. [TYPE...]
  36842. REG...
  36843. </feature>
  36844. Each feature's name should be unique within the description. The name
  36845. of a feature does not matter unless GDB has some special knowledge of
  36846. the contents of that feature; if it does, the feature should have its
  36847. standard name. *Note Standard Target Features::.
  36848. G.2.6 Types
  36849. -----------
  36850. Any register's value is a collection of bits which GDB must interpret.
  36851. The default interpretation is a two's complement integer, but other
  36852. types can be requested by name in the register description. Some
  36853. predefined types are provided by GDB (*note Predefined Target Types::),
  36854. and the description can define additional composite and enum types.
  36855. Each type element must have an 'id' attribute, which gives a unique
  36856. (within the containing '<feature>') name to the type. Types must be
  36857. defined before they are used.
  36858. Some targets offer vector registers, which can be treated as arrays
  36859. of scalar elements. These types are written as '<vector>' elements,
  36860. specifying the array element type, TYPE, and the number of elements,
  36861. COUNT:
  36862. <vector id="ID" type="TYPE" count="COUNT"/>
  36863. If a register's value is usefully viewed in multiple ways, define it
  36864. with a union type containing the useful representations. The '<union>'
  36865. element contains one or more '<field>' elements, each of which has a
  36866. NAME and a TYPE:
  36867. <union id="ID">
  36868. <field name="NAME" type="TYPE"/>
  36869. ...
  36870. </union>
  36871. If a register's value is composed from several separate values,
  36872. define it with either a structure type or a flags type. A flags type
  36873. may only contain bitfields. A structure type may either contain only
  36874. bitfields or contain no bitfields. If the value contains only
  36875. bitfields, its total size in bytes must be specified.
  36876. Non-bitfield values have a NAME and TYPE.
  36877. <struct id="ID">
  36878. <field name="NAME" type="TYPE"/>
  36879. ...
  36880. </struct>
  36881. Both NAME and TYPE values are required. No implicit padding is
  36882. added.
  36883. Bitfield values have a NAME, START, END and TYPE.
  36884. <struct id="ID" size="SIZE">
  36885. <field name="NAME" start="START" end="END" type="TYPE"/>
  36886. ...
  36887. </struct>
  36888. <flags id="ID" size="SIZE">
  36889. <field name="NAME" start="START" end="END" type="TYPE"/>
  36890. ...
  36891. </flags>
  36892. The NAME value is required. Bitfield values may be named with the
  36893. empty string, '""', in which case the field is "filler" and its value is
  36894. not printed. Not all bits need to be specified, so "filler" fields are
  36895. optional.
  36896. The START and END values are required, and TYPE is optional. The
  36897. field's START must be less than or equal to its END, and zero represents
  36898. the least significant bit.
  36899. The default value of TYPE is 'bool' for single bit fields, and an
  36900. unsigned integer otherwise.
  36901. Which to choose? Structures or flags?
  36902. Registers defined with 'flags' have these advantages over defining
  36903. them with 'struct':
  36904. * Arithmetic may be performed on them as if they were integers.
  36905. * They are printed in a more readable fashion.
  36906. Registers defined with 'struct' have one advantage over defining them
  36907. with 'flags':
  36908. * One can fetch individual fields like in 'C'.
  36909. (gdb) print $my_struct_reg.field3
  36910. $1 = 42
  36911. G.2.7 Registers
  36912. ---------------
  36913. Each register is represented as an element with this form:
  36914. <reg name="NAME"
  36915. bitsize="SIZE"
  36916. [regnum="NUM"]
  36917. [save-restore="SAVE-RESTORE"]
  36918. [type="TYPE"]
  36919. [group="GROUP"]/>
  36920. The components are as follows:
  36921. NAME
  36922. The register's name; it must be unique within the target
  36923. description.
  36924. BITSIZE
  36925. The register's size, in bits.
  36926. REGNUM
  36927. The register's number. If omitted, a register's number is one
  36928. greater than that of the previous register (either in the current
  36929. feature or in a preceding feature); the first register in the
  36930. target description defaults to zero. This register number is used
  36931. to read or write the register; e.g. it is used in the remote 'p'
  36932. and 'P' packets, and registers appear in the 'g' and 'G' packets in
  36933. order of increasing register number.
  36934. SAVE-RESTORE
  36935. Whether the register should be preserved across inferior function
  36936. calls; this must be either 'yes' or 'no'. The default is 'yes',
  36937. which is appropriate for most registers except for some system
  36938. control registers; this is not related to the target's ABI.
  36939. TYPE
  36940. The type of the register. It may be a predefined type, a type
  36941. defined in the current feature, or one of the special types 'int'
  36942. and 'float'. 'int' is an integer type of the correct size for
  36943. BITSIZE, and 'float' is a floating point type (in the
  36944. architecture's normal floating point format) of the correct size
  36945. for BITSIZE. The default is 'int'.
  36946. GROUP
  36947. The register group to which this register belongs. It can be one
  36948. of the standard register groups 'general', 'float', 'vector' or an
  36949. arbitrary string. Group names should be limited to alphanumeric
  36950. characters. If a group name is made up of multiple words the words
  36951. may be separated by hyphens; e.g. 'special-group' or
  36952. 'ultra-special-group'. If no GROUP is specified, GDB will not
  36953. display the register in 'info registers'.
  36954. 
  36955. File: gdb.info, Node: Predefined Target Types, Next: Enum Target Types, Prev: Target Description Format, Up: Target Descriptions
  36956. G.3 Predefined Target Types
  36957. ===========================
  36958. Type definitions in the self-description can build up composite types
  36959. from basic building blocks, but can not define fundamental types.
  36960. Instead, standard identifiers are provided by GDB for the fundamental
  36961. types. The currently supported types are:
  36962. 'bool'
  36963. Boolean type, occupying a single bit.
  36964. 'int8'
  36965. 'int16'
  36966. 'int24'
  36967. 'int32'
  36968. 'int64'
  36969. 'int128'
  36970. Signed integer types holding the specified number of bits.
  36971. 'uint8'
  36972. 'uint16'
  36973. 'uint24'
  36974. 'uint32'
  36975. 'uint64'
  36976. 'uint128'
  36977. Unsigned integer types holding the specified number of bits.
  36978. 'code_ptr'
  36979. 'data_ptr'
  36980. Pointers to unspecified code and data. The program counter and any
  36981. dedicated return address register may be marked as code pointers;
  36982. printing a code pointer converts it into a symbolic address. The
  36983. stack pointer and any dedicated address registers may be marked as
  36984. data pointers.
  36985. 'ieee_single'
  36986. Single precision IEEE floating point.
  36987. 'ieee_double'
  36988. Double precision IEEE floating point.
  36989. 'arm_fpa_ext'
  36990. The 12-byte extended precision format used by ARM FPA registers.
  36991. 'i387_ext'
  36992. The 10-byte extended precision format used by x87 registers.
  36993. 'i386_eflags'
  36994. 32bit EFLAGS register used by x86.
  36995. 'i386_mxcsr'
  36996. 32bit MXCSR register used by x86.
  36997. 
  36998. File: gdb.info, Node: Enum Target Types, Next: Standard Target Features, Prev: Predefined Target Types, Up: Target Descriptions
  36999. G.4 Enum Target Types
  37000. =====================
  37001. Enum target types are useful in 'struct' and 'flags' register
  37002. descriptions. *Note Target Description Format::.
  37003. Enum types have a name, size and a list of name/value pairs.
  37004. <enum id="ID" size="SIZE">
  37005. <evalue name="NAME" value="VALUE"/>
  37006. ...
  37007. </enum>
  37008. Enums must be defined before they are used.
  37009. <enum id="levels_type" size="4">
  37010. <evalue name="low" value="0"/>
  37011. <evalue name="high" value="1"/>
  37012. </enum>
  37013. <flags id="flags_type" size="4">
  37014. <field name="X" start="0"/>
  37015. <field name="LEVEL" start="1" end="1" type="levels_type"/>
  37016. </flags>
  37017. <reg name="flags" bitsize="32" type="flags_type"/>
  37018. Given that description, a value of 3 for the 'flags' register would
  37019. be printed as:
  37020. (gdb) info register flags
  37021. flags 0x3 [ X LEVEL=high ]
  37022. 
  37023. File: gdb.info, Node: Standard Target Features, Prev: Enum Target Types, Up: Target Descriptions
  37024. G.5 Standard Target Features
  37025. ============================
  37026. A target description must contain either no registers or all the
  37027. target's registers. If the description contains no registers, then GDB
  37028. will assume a default register layout, selected based on the
  37029. architecture. If the description contains any registers, the default
  37030. layout will not be used; the standard registers must be described in the
  37031. target description, in such a way that GDB can recognize them.
  37032. This is accomplished by giving specific names to feature elements
  37033. which contain standard registers. GDB will look for features with those
  37034. names and verify that they contain the expected registers; if any known
  37035. feature is missing required registers, or if any required feature is
  37036. missing, GDB will reject the target description. You can add additional
  37037. registers to any of the standard features -- GDB will display them just
  37038. as if they were added to an unrecognized feature.
  37039. This section lists the known features and their expected contents.
  37040. Sample XML documents for these features are included in the GDB source
  37041. tree, in the directory 'gdb/features'.
  37042. Names recognized by GDB should include the name of the company or
  37043. organization which selected the name, and the overall architecture to
  37044. which the feature applies; so e.g. the feature containing ARM core
  37045. registers is named 'org.gnu.gdb.arm.core'.
  37046. The names of registers are not case sensitive for the purpose of
  37047. recognizing standard features, but GDB will only display registers using
  37048. the capitalization used in the description.
  37049. * Menu:
  37050. * AArch64 Features::
  37051. * ARC Features::
  37052. * ARM Features::
  37053. * i386 Features::
  37054. * MicroBlaze Features::
  37055. * MIPS Features::
  37056. * M68K Features::
  37057. * NDS32 Features::
  37058. * Nios II Features::
  37059. * OpenRISC 1000 Features::
  37060. * PowerPC Features::
  37061. * RISC-V Features::
  37062. * S/390 and System z Features::
  37063. * Sparc Features::
  37064. * TIC6x Features::
  37065. 
  37066. File: gdb.info, Node: AArch64 Features, Next: ARC Features, Up: Standard Target Features
  37067. G.5.1 AArch64 Features
  37068. ----------------------
  37069. The 'org.gnu.gdb.aarch64.core' feature is required for AArch64 targets.
  37070. It should contain registers 'x0' through 'x30', 'sp', 'pc', and 'cpsr'.
  37071. The 'org.gnu.gdb.aarch64.fpu' feature is optional. If present, it
  37072. should contain registers 'v0' through 'v31', 'fpsr', and 'fpcr'.
  37073. The 'org.gnu.gdb.aarch64.sve' feature is optional. If present, it
  37074. should contain registers 'z0' through 'z31', 'p0' through 'p15', 'ffr'
  37075. and 'vg'.
  37076. 
  37077. File: gdb.info, Node: ARC Features, Next: ARM Features, Prev: AArch64 Features, Up: Standard Target Features
  37078. G.5.2 ARC Features
  37079. ------------------
  37080. ARC processors are highly configurable, so even core registers and their
  37081. number are not completely predetermined. In addition flags and PC
  37082. registers which are important to GDB are not "core" registers in ARC. It
  37083. is required that one of the core registers features is present.
  37084. 'org.gnu.gdb.arc.aux-minimal' feature is mandatory.
  37085. The 'org.gnu.gdb.arc.core.v2' feature is required for ARC EM and ARC
  37086. HS targets with a normal register file. It should contain registers
  37087. 'r0' through 'r25', 'gp', 'fp', 'sp', 'r30', 'blink', 'lp_count' and
  37088. 'pcl'. This feature may contain register 'ilink' and any of extension
  37089. core registers 'r32' through 'r59/acch'. 'ilink' and extension core
  37090. registers are not available to read/write, when debugging GNU/Linux
  37091. applications, thus 'ilink' is made optional.
  37092. The 'org.gnu.gdb.arc.core-reduced.v2' feature is required for ARC EM
  37093. and ARC HS targets with a reduced register file. It should contain
  37094. registers 'r0' through 'r3', 'r10' through 'r15', 'gp', 'fp', 'sp',
  37095. 'r30', 'blink', 'lp_count' and 'pcl'. This feature may contain register
  37096. 'ilink' and any of extension core registers 'r32' through 'r59/acch'.
  37097. The 'org.gnu.gdb.arc.core.arcompact' feature is required for
  37098. ARCompact targets with a normal register file. It should contain
  37099. registers 'r0' through 'r25', 'gp', 'fp', 'sp', 'r30', 'blink',
  37100. 'lp_count' and 'pcl'. This feature may contain registers 'ilink1',
  37101. 'ilink2' and any of extension core registers 'r32' through 'r59/acch'.
  37102. 'ilink1' and 'ilink2' and extension core registers are not available
  37103. when debugging GNU/Linux applications. The only difference with
  37104. 'org.gnu.gdb.arc.core.v2' feature is in the names of 'ilink1' and
  37105. 'ilink2' registers and that 'r30' is mandatory in ARC v2, but 'ilink2'
  37106. is optional on ARCompact.
  37107. The 'org.gnu.gdb.arc.aux-minimal' feature is required for all ARC
  37108. targets. It should contain registers 'pc' and 'status32'.
  37109. 
  37110. File: gdb.info, Node: ARM Features, Next: i386 Features, Prev: ARC Features, Up: Standard Target Features
  37111. G.5.3 ARM Features
  37112. ------------------
  37113. The 'org.gnu.gdb.arm.core' feature is required for non-M-profile ARM
  37114. targets. It should contain registers 'r0' through 'r13', 'sp', 'lr',
  37115. 'pc', and 'cpsr'.
  37116. For M-profile targets (e.g. Cortex-M3), the 'org.gnu.gdb.arm.core'
  37117. feature is replaced by 'org.gnu.gdb.arm.m-profile'. It should contain
  37118. registers 'r0' through 'r13', 'sp', 'lr', 'pc', and 'xpsr'.
  37119. The 'org.gnu.gdb.arm.fpa' feature is optional. If present, it should
  37120. contain registers 'f0' through 'f7' and 'fps'.
  37121. The 'org.gnu.gdb.xscale.iwmmxt' feature is optional. If present, it
  37122. should contain at least registers 'wR0' through 'wR15' and 'wCGR0'
  37123. through 'wCGR3'. The 'wCID', 'wCon', 'wCSSF', and 'wCASF' registers are
  37124. optional.
  37125. The 'org.gnu.gdb.arm.vfp' feature is optional. If present, it should
  37126. contain at least registers 'd0' through 'd15'. If they are present,
  37127. 'd16' through 'd31' should also be included. GDB will synthesize the
  37128. single-precision registers from halves of the double-precision
  37129. registers.
  37130. The 'org.gnu.gdb.arm.neon' feature is optional. It does not need to
  37131. contain registers; it instructs GDB to display the VFP double-precision
  37132. registers as vectors and to synthesize the quad-precision registers from
  37133. pairs of double-precision registers. If this feature is present,
  37134. 'org.gnu.gdb.arm.vfp' must also be present and include 32
  37135. double-precision registers.
  37136. 
  37137. File: gdb.info, Node: i386 Features, Next: MicroBlaze Features, Prev: ARM Features, Up: Standard Target Features
  37138. G.5.4 i386 Features
  37139. -------------------
  37140. The 'org.gnu.gdb.i386.core' feature is required for i386/amd64 targets.
  37141. It should describe the following registers:
  37142. - 'eax' through 'edi' plus 'eip' for i386
  37143. - 'rax' through 'r15' plus 'rip' for amd64
  37144. - 'eflags', 'cs', 'ss', 'ds', 'es', 'fs', 'gs'
  37145. - 'st0' through 'st7'
  37146. - 'fctrl', 'fstat', 'ftag', 'fiseg', 'fioff', 'foseg', 'fooff' and
  37147. 'fop'
  37148. The register sets may be different, depending on the target.
  37149. The 'org.gnu.gdb.i386.sse' feature is optional. It should describe
  37150. registers:
  37151. - 'xmm0' through 'xmm7' for i386
  37152. - 'xmm0' through 'xmm15' for amd64
  37153. - 'mxcsr'
  37154. The 'org.gnu.gdb.i386.avx' feature is optional and requires the
  37155. 'org.gnu.gdb.i386.sse' feature. It should describe the upper 128 bits
  37156. of YMM registers:
  37157. - 'ymm0h' through 'ymm7h' for i386
  37158. - 'ymm0h' through 'ymm15h' for amd64
  37159. The 'org.gnu.gdb.i386.mpx' is an optional feature representing Intel
  37160. Memory Protection Extension (MPX). It should describe the following
  37161. registers:
  37162. - 'bnd0raw' through 'bnd3raw' for i386 and amd64.
  37163. - 'bndcfgu' and 'bndstatus' for i386 and amd64.
  37164. The 'org.gnu.gdb.i386.linux' feature is optional. It should describe
  37165. a single register, 'orig_eax'.
  37166. The 'org.gnu.gdb.i386.segments' feature is optional. It should
  37167. describe two system registers: 'fs_base' and 'gs_base'.
  37168. The 'org.gnu.gdb.i386.avx512' feature is optional and requires the
  37169. 'org.gnu.gdb.i386.avx' feature. It should describe additional XMM
  37170. registers:
  37171. - 'xmm16h' through 'xmm31h', only valid for amd64.
  37172. It should describe the upper 128 bits of additional YMM registers:
  37173. - 'ymm16h' through 'ymm31h', only valid for amd64.
  37174. It should describe the upper 256 bits of ZMM registers:
  37175. - 'zmm0h' through 'zmm7h' for i386.
  37176. - 'zmm0h' through 'zmm15h' for amd64.
  37177. It should describe the additional ZMM registers:
  37178. - 'zmm16h' through 'zmm31h', only valid for amd64.
  37179. The 'org.gnu.gdb.i386.pkeys' feature is optional. It should describe
  37180. a single register, 'pkru'. It is a 32-bit register valid for i386 and
  37181. amd64.
  37182. 
  37183. File: gdb.info, Node: MicroBlaze Features, Next: MIPS Features, Prev: i386 Features, Up: Standard Target Features
  37184. G.5.5 MicroBlaze Features
  37185. -------------------------
  37186. The 'org.gnu.gdb.microblaze.core' feature is required for MicroBlaze
  37187. targets. It should contain registers 'r0' through 'r31', 'rpc', 'rmsr',
  37188. 'rear', 'resr', 'rfsr', 'rbtr', 'rpvr', 'rpvr1' through 'rpvr11',
  37189. 'redr', 'rpid', 'rzpr', 'rtlbx', 'rtlbsx', 'rtlblo', and 'rtlbhi'.
  37190. The 'org.gnu.gdb.microblaze.stack-protect' feature is optional. If
  37191. present, it should contain registers 'rshr' and 'rslr'
  37192. 
  37193. File: gdb.info, Node: MIPS Features, Next: M68K Features, Prev: MicroBlaze Features, Up: Standard Target Features
  37194. G.5.6 MIPS Features
  37195. -------------------
  37196. The 'org.gnu.gdb.mips.cpu' feature is required for MIPS targets. It
  37197. should contain registers 'r0' through 'r31', 'lo', 'hi', and 'pc'. They
  37198. may be 32-bit or 64-bit depending on the target.
  37199. The 'org.gnu.gdb.mips.cp0' feature is also required. It should
  37200. contain at least the 'status', 'badvaddr', and 'cause' registers. They
  37201. may be 32-bit or 64-bit depending on the target.
  37202. The 'org.gnu.gdb.mips.fpu' feature is currently required, though it
  37203. may be optional in a future version of GDB. It should contain registers
  37204. 'f0' through 'f31', 'fcsr', and 'fir'. They may be 32-bit or 64-bit
  37205. depending on the target.
  37206. The 'org.gnu.gdb.mips.dsp' feature is optional. It should contain
  37207. registers 'hi1' through 'hi3', 'lo1' through 'lo3', and 'dspctl'. The
  37208. 'dspctl' register should be 32-bit and the rest may be 32-bit or 64-bit
  37209. depending on the target.
  37210. The 'org.gnu.gdb.mips.linux' feature is optional. It should contain
  37211. a single register, 'restart', which is used by the Linux kernel to
  37212. control restartable syscalls.
  37213. 
  37214. File: gdb.info, Node: M68K Features, Next: NDS32 Features, Prev: MIPS Features, Up: Standard Target Features
  37215. G.5.7 M68K Features
  37216. -------------------
  37217. ''org.gnu.gdb.m68k.core''
  37218. ''org.gnu.gdb.coldfire.core''
  37219. ''org.gnu.gdb.fido.core''
  37220. One of those features must be always present. The feature that is
  37221. present determines which flavor of m68k is used. The feature that
  37222. is present should contain registers 'd0' through 'd7', 'a0' through
  37223. 'a5', 'fp', 'sp', 'ps' and 'pc'.
  37224. ''org.gnu.gdb.coldfire.fp''
  37225. This feature is optional. If present, it should contain registers
  37226. 'fp0' through 'fp7', 'fpcontrol', 'fpstatus' and 'fpiaddr'.
  37227. 
  37228. File: gdb.info, Node: NDS32 Features, Next: Nios II Features, Prev: M68K Features, Up: Standard Target Features
  37229. G.5.8 NDS32 Features
  37230. --------------------
  37231. The 'org.gnu.gdb.nds32.core' feature is required for NDS32 targets. It
  37232. should contain at least registers 'r0' through 'r10', 'r15', 'fp', 'gp',
  37233. 'lp', 'sp', and 'pc'.
  37234. The 'org.gnu.gdb.nds32.fpu' feature is optional. If present, it
  37235. should contain 64-bit double-precision floating-point registers 'fd0'
  37236. through _fdN_, which should be 'fd3', 'fd7', 'fd15', or 'fd31' based on
  37237. the FPU configuration implemented.
  37238. _Note:_ The first sixteen 64-bit double-precision floating-point
  37239. registers are overlapped with the thirty-two 32-bit single-precision
  37240. floating-point registers. The 32-bit single-precision registers, if not
  37241. being listed explicitly, will be synthesized from halves of the
  37242. overlapping 64-bit double-precision registers. Listing 32-bit
  37243. single-precision registers explicitly is deprecated, and the support to
  37244. it could be totally removed some day.
  37245. 
  37246. File: gdb.info, Node: Nios II Features, Next: OpenRISC 1000 Features, Prev: NDS32 Features, Up: Standard Target Features
  37247. G.5.9 Nios II Features
  37248. ----------------------
  37249. The 'org.gnu.gdb.nios2.cpu' feature is required for Nios II targets. It
  37250. should contain the 32 core registers ('zero', 'at', 'r2' through 'r23',
  37251. 'et' through 'ra'), 'pc', and the 16 control registers ('status' through
  37252. 'mpuacc').
  37253. 
  37254. File: gdb.info, Node: OpenRISC 1000 Features, Next: PowerPC Features, Prev: Nios II Features, Up: Standard Target Features
  37255. G.5.10 Openrisc 1000 Features
  37256. -----------------------------
  37257. The 'org.gnu.gdb.or1k.group0' feature is required for OpenRISC 1000
  37258. targets. It should contain the 32 general purpose registers ('r0'
  37259. through 'r31'), 'ppc', 'npc' and 'sr'.
  37260. 
  37261. File: gdb.info, Node: PowerPC Features, Next: RISC-V Features, Prev: OpenRISC 1000 Features, Up: Standard Target Features
  37262. G.5.11 PowerPC Features
  37263. -----------------------
  37264. The 'org.gnu.gdb.power.core' feature is required for PowerPC targets.
  37265. It should contain registers 'r0' through 'r31', 'pc', 'msr', 'cr', 'lr',
  37266. 'ctr', and 'xer'. They may be 32-bit or 64-bit depending on the target.
  37267. The 'org.gnu.gdb.power.fpu' feature is optional. It should contain
  37268. registers 'f0' through 'f31' and 'fpscr'.
  37269. The 'org.gnu.gdb.power.altivec' feature is optional. It should
  37270. contain registers 'vr0' through 'vr31', 'vscr', and 'vrsave'. GDB will
  37271. define pseudo-registers 'v0' through 'v31' as aliases for the
  37272. corresponding 'vrX' registers.
  37273. The 'org.gnu.gdb.power.vsx' feature is optional. It should contain
  37274. registers 'vs0h' through 'vs31h'. GDB will combine these registers with
  37275. the floating point registers ('f0' through 'f31') and the altivec
  37276. registers ('vr0' through 'vr31') to present the 128-bit wide registers
  37277. 'vs0' through 'vs63', the set of vector-scalar registers for POWER7.
  37278. Therefore, this feature requires both 'org.gnu.gdb.power.fpu' and
  37279. 'org.gnu.gdb.power.altivec'.
  37280. The 'org.gnu.gdb.power.spe' feature is optional. It should contain
  37281. registers 'ev0h' through 'ev31h', 'acc', and 'spefscr'. SPE targets
  37282. should provide 32-bit registers in 'org.gnu.gdb.power.core' and provide
  37283. the upper halves in 'ev0h' through 'ev31h'. GDB will combine these to
  37284. present registers 'ev0' through 'ev31' to the user.
  37285. The 'org.gnu.gdb.power.ppr' feature is optional. It should contain
  37286. the 64-bit register 'ppr'.
  37287. The 'org.gnu.gdb.power.dscr' feature is optional. It should contain
  37288. the 64-bit register 'dscr'.
  37289. The 'org.gnu.gdb.power.tar' feature is optional. It should contain
  37290. the 64-bit register 'tar'.
  37291. The 'org.gnu.gdb.power.ebb' feature is optional. It should contain
  37292. registers 'bescr', 'ebbhr' and 'ebbrr', all 64-bit wide.
  37293. The 'org.gnu.gdb.power.linux.pmu' feature is optional. It should
  37294. contain registers 'mmcr0', 'mmcr2', 'siar', 'sdar' and 'sier', all
  37295. 64-bit wide. This is the subset of the isa 2.07 server PMU registers
  37296. provided by GNU/Linux.
  37297. The 'org.gnu.gdb.power.htm.spr' feature is optional. It should
  37298. contain registers 'tfhar', 'texasr' and 'tfiar', all 64-bit wide.
  37299. The 'org.gnu.gdb.power.htm.core' feature is optional. It should
  37300. contain the checkpointed general-purpose registers 'cr0' through 'cr31',
  37301. as well as the checkpointed registers 'clr' and 'cctr'. These registers
  37302. may all be either 32-bit or 64-bit depending on the target. It should
  37303. also contain the checkpointed registers 'ccr' and 'cxer', which should
  37304. both be 32-bit wide.
  37305. The 'org.gnu.gdb.power.htm.fpu' feature is optional. It should
  37306. contain the checkpointed 64-bit floating-point registers 'cf0' through
  37307. 'cf31', as well as the checkpointed 64-bit register 'cfpscr'.
  37308. The 'org.gnu.gdb.power.htm.altivec' feature is optional. It should
  37309. contain the checkpointed altivec registers 'cvr0' through 'cvr31', all
  37310. 128-bit wide. It should also contain the checkpointed registers 'cvscr'
  37311. and 'cvrsave', both 32-bit wide.
  37312. The 'org.gnu.gdb.power.htm.vsx' feature is optional. It should
  37313. contain registers 'cvs0h' through 'cvs31h'. GDB will combine these
  37314. registers with the checkpointed floating point registers ('cf0' through
  37315. 'cf31') and the checkpointed altivec registers ('cvr0' through 'cvr31')
  37316. to present the 128-bit wide checkpointed vector-scalar registers 'cvs0'
  37317. through 'cvs63'. Therefore, this feature requires both
  37318. 'org.gnu.gdb.power.htm.altivec' and 'org.gnu.gdb.power.htm.fpu'.
  37319. The 'org.gnu.gdb.power.htm.ppr' feature is optional. It should
  37320. contain the 64-bit checkpointed register 'cppr'.
  37321. The 'org.gnu.gdb.power.htm.dscr' feature is optional. It should
  37322. contain the 64-bit checkpointed register 'cdscr'.
  37323. The 'org.gnu.gdb.power.htm.tar' feature is optional. It should
  37324. contain the 64-bit checkpointed register 'ctar'.
  37325. 
  37326. File: gdb.info, Node: RISC-V Features, Next: S/390 and System z Features, Prev: PowerPC Features, Up: Standard Target Features
  37327. G.5.12 RISC-V Features
  37328. ----------------------
  37329. The 'org.gnu.gdb.riscv.cpu' feature is required for RISC-V targets. It
  37330. should contain the registers 'x0' through 'x31', and 'pc'. Either the
  37331. architectural names ('x0', 'x1', etc) can be used, or the ABI names
  37332. ('zero', 'ra', etc).
  37333. The 'org.gnu.gdb.riscv.fpu' feature is optional. If present, it
  37334. should contain registers 'f0' through 'f31', 'fflags', 'frm', and
  37335. 'fcsr'. As with the cpu feature, either the architectural register
  37336. names, or the ABI names can be used.
  37337. The 'org.gnu.gdb.riscv.virtual' feature is optional. If present, it
  37338. should contain registers that are not backed by real registers on the
  37339. target, but are instead virtual, where the register value is derived
  37340. from other target state. In many ways these are like GDBs
  37341. pseudo-registers, except implemented by the target. Currently the only
  37342. register expected in this set is the one byte 'priv' register that
  37343. contains the target's privilege level in the least significant two bits.
  37344. The 'org.gnu.gdb.riscv.csr' feature is optional. If present, it
  37345. should contain all of the target's standard CSRs. Standard CSRs are
  37346. those defined in the RISC-V specification documents. There is some
  37347. overlap between this feature and the fpu feature; the 'fflags', 'frm',
  37348. and 'fcsr' registers could be in either feature. The expectation is
  37349. that these registers will be in the fpu feature if the target has
  37350. floating point hardware, but can be moved into the csr feature if the
  37351. target has the floating point control registers, but no other floating
  37352. point hardware.
  37353. 
  37354. File: gdb.info, Node: S/390 and System z Features, Next: Sparc Features, Prev: RISC-V Features, Up: Standard Target Features
  37355. G.5.13 S/390 and System z Features
  37356. ----------------------------------
  37357. The 'org.gnu.gdb.s390.core' feature is required for S/390 and System z
  37358. targets. It should contain the PSW and the 16 general registers. In
  37359. particular, System z targets should provide the 64-bit registers 'pswm',
  37360. 'pswa', and 'r0' through 'r15'. S/390 targets should provide the 32-bit
  37361. versions of these registers. A System z target that runs in 31-bit
  37362. addressing mode should provide 32-bit versions of 'pswm' and 'pswa', as
  37363. well as the general register's upper halves 'r0h' through 'r15h', and
  37364. their lower halves 'r0l' through 'r15l'.
  37365. The 'org.gnu.gdb.s390.fpr' feature is required. It should contain
  37366. the 64-bit registers 'f0' through 'f15', and 'fpc'.
  37367. The 'org.gnu.gdb.s390.acr' feature is required. It should contain
  37368. the 32-bit registers 'acr0' through 'acr15'.
  37369. The 'org.gnu.gdb.s390.linux' feature is optional. It should contain
  37370. the register 'orig_r2', which is 64-bit wide on System z targets and
  37371. 32-bit otherwise. In addition, the feature may contain the 'last_break'
  37372. register, whose width depends on the addressing mode, as well as the
  37373. 'system_call' register, which is always 32-bit wide.
  37374. The 'org.gnu.gdb.s390.tdb' feature is optional. It should contain
  37375. the 64-bit registers 'tdb0', 'tac', 'tct', 'atia', and 'tr0' through
  37376. 'tr15'.
  37377. The 'org.gnu.gdb.s390.vx' feature is optional. It should contain
  37378. 64-bit wide registers 'v0l' through 'v15l', which will be combined by
  37379. GDB with the floating point registers 'f0' through 'f15' to present the
  37380. 128-bit wide vector registers 'v0' through 'v15'. In addition, this
  37381. feature should contain the 128-bit wide vector registers 'v16' through
  37382. 'v31'.
  37383. The 'org.gnu.gdb.s390.gs' feature is optional. It should contain the
  37384. 64-bit wide guarded-storage-control registers 'gsd', 'gssm', and
  37385. 'gsepla'.
  37386. The 'org.gnu.gdb.s390.gsbc' feature is optional. It should contain
  37387. the 64-bit wide guarded-storage broadcast control registers 'bc_gsd',
  37388. 'bc_gssm', and 'bc_gsepla'.
  37389. 
  37390. File: gdb.info, Node: Sparc Features, Next: TIC6x Features, Prev: S/390 and System z Features, Up: Standard Target Features
  37391. G.5.14 Sparc Features
  37392. ---------------------
  37393. The 'org.gnu.gdb.sparc.cpu' feature is required for sparc32/sparc64
  37394. targets. It should describe the following registers:
  37395. - 'g0' through 'g7'
  37396. - 'o0' through 'o7'
  37397. - 'l0' through 'l7'
  37398. - 'i0' through 'i7'
  37399. They may be 32-bit or 64-bit depending on the target.
  37400. Also the 'org.gnu.gdb.sparc.fpu' feature is required for
  37401. sparc32/sparc64 targets. It should describe the following registers:
  37402. - 'f0' through 'f31'
  37403. - 'f32' through 'f62' for sparc64
  37404. The 'org.gnu.gdb.sparc.cp0' feature is required for sparc32/sparc64
  37405. targets. It should describe the following registers:
  37406. - 'y', 'psr', 'wim', 'tbr', 'pc', 'npc', 'fsr', and 'csr' for sparc32
  37407. - 'pc', 'npc', 'state', 'fsr', 'fprs', and 'y' for sparc64
  37408. 
  37409. File: gdb.info, Node: TIC6x Features, Prev: Sparc Features, Up: Standard Target Features
  37410. G.5.15 TMS320C6x Features
  37411. -------------------------
  37412. The 'org.gnu.gdb.tic6x.core' feature is required for TMS320C6x targets.
  37413. It should contain registers 'A0' through 'A15', registers 'B0' through
  37414. 'B15', 'CSR' and 'PC'.
  37415. The 'org.gnu.gdb.tic6x.gp' feature is optional. It should contain
  37416. registers 'A16' through 'A31' and 'B16' through 'B31'.
  37417. The 'org.gnu.gdb.tic6x.c6xp' feature is optional. It should contain
  37418. registers 'TSR', 'ILC' and 'RILC'.
  37419. 
  37420. File: gdb.info, Node: Operating System Information, Next: Trace File Format, Prev: Target Descriptions, Up: Top
  37421. Appendix H Operating System Information
  37422. ***************************************
  37423. * Menu:
  37424. * Process list::
  37425. Users of GDB often wish to obtain information about the state of the
  37426. operating system running on the target--for example the list of
  37427. processes, or the list of open files. This section describes the
  37428. mechanism that makes it possible. This mechanism is similar to the
  37429. target features mechanism (*note Target Descriptions::), but focuses on
  37430. a different aspect of target.
  37431. Operating system information is retrived from the target via the
  37432. remote protocol, using 'qXfer' requests (*note qXfer osdata read::).
  37433. The object name in the request should be 'osdata', and the ANNEX
  37434. identifies the data to be fetched.
  37435. 
  37436. File: gdb.info, Node: Process list, Up: Operating System Information
  37437. H.1 Process list
  37438. ================
  37439. When requesting the process list, the ANNEX field in the 'qXfer' request
  37440. should be 'processes'. The returned data is an XML document. The
  37441. formal syntax of this document is defined in 'gdb/features/osdata.dtd'.
  37442. An example document is:
  37443. <?xml version="1.0"?>
  37444. <!DOCTYPE target SYSTEM "osdata.dtd">
  37445. <osdata type="processes">
  37446. <item>
  37447. <column name="pid">1</column>
  37448. <column name="user">root</column>
  37449. <column name="command">/sbin/init</column>
  37450. <column name="cores">1,2,3</column>
  37451. </item>
  37452. </osdata>
  37453. Each item should include a column whose name is 'pid'. The value of
  37454. that column should identify the process on the target. The 'user' and
  37455. 'command' columns are optional, and will be displayed by GDB. The
  37456. 'cores' column, if present, should contain a comma-separated list of
  37457. cores that this process is running on. Target may provide additional
  37458. columns, which GDB currently ignores.
  37459. 
  37460. File: gdb.info, Node: Trace File Format, Next: Index Section Format, Prev: Operating System Information, Up: Top
  37461. Appendix I Trace File Format
  37462. ****************************
  37463. The trace file comes in three parts: a header, a textual description
  37464. section, and a trace frame section with binary data.
  37465. The header has the form '\x7fTRACE0\n'. The first byte is '0x7f' so
  37466. as to indicate that the file contains binary data, while the '0' is a
  37467. version number that may have different values in the future.
  37468. The description section consists of multiple lines of ASCII text
  37469. separated by newline characters ('0xa'). The lines may include a
  37470. variety of optional descriptive or context-setting information, such as
  37471. tracepoint definitions or register set size. GDB will ignore any line
  37472. that it does not recognize. An empty line marks the end of this
  37473. section.
  37474. 'R SIZE'
  37475. Specifies the size of a register block in bytes. This is equal to
  37476. the size of a 'g' packet payload in the remote protocol. SIZE is
  37477. an ascii decimal number. There should be only one such line in a
  37478. single trace file.
  37479. 'status STATUS'
  37480. Trace status. STATUS has the same format as a 'qTStatus' remote
  37481. packet reply. There should be only one such line in a single trace
  37482. file.
  37483. 'tp PAYLOAD'
  37484. Tracepoint definition. The PAYLOAD has the same format as
  37485. 'qTfP'/'qTsP' remote packet reply payload. A single tracepoint may
  37486. take multiple lines of definition, corresponding to the multiple
  37487. reply packets.
  37488. 'tsv PAYLOAD'
  37489. Trace state variable definition. The PAYLOAD has the same format
  37490. as 'qTfV'/'qTsV' remote packet reply payload. A single variable
  37491. may take multiple lines of definition, corresponding to the
  37492. multiple reply packets.
  37493. 'tdesc PAYLOAD'
  37494. Target description in XML format. The PAYLOAD is a single line of
  37495. the XML file. All such lines should be concatenated together to
  37496. get the original XML file. This file is in the same format as
  37497. 'qXfer' 'features' payload, and corresponds to the main
  37498. 'target.xml' file. Includes are not allowed.
  37499. The trace frame section consists of a number of consecutive frames.
  37500. Each frame begins with a two-byte tracepoint number, followed by a
  37501. four-byte size giving the amount of data in the frame. The data in the
  37502. frame consists of a number of blocks, each introduced by a character
  37503. indicating its type (at least register, memory, and trace state
  37504. variable). The data in this section is raw binary, not a hexadecimal or
  37505. other encoding; its endianness matches the target's endianness.
  37506. 'R BYTES'
  37507. Register block. The number and ordering of bytes matches that of a
  37508. 'g' packet in the remote protocol. Note that these are the actual
  37509. bytes, in target order, not a hexadecimal encoding.
  37510. 'M ADDRESS LENGTH BYTES...'
  37511. Memory block. This is a contiguous block of memory, at the 8-byte
  37512. address ADDRESS, with a 2-byte length LENGTH, followed by LENGTH
  37513. bytes.
  37514. 'V NUMBER VALUE'
  37515. Trace state variable block. This records the 8-byte signed value
  37516. VALUE of trace state variable numbered NUMBER.
  37517. Future enhancements of the trace file format may include additional
  37518. types of blocks.
  37519. 
  37520. File: gdb.info, Node: Index Section Format, Next: Man Pages, Prev: Trace File Format, Up: Top
  37521. Appendix J '.gdb_index' section format
  37522. **************************************
  37523. This section documents the index section that is created by 'save
  37524. gdb-index' (*note Index Files::). The index section is DWARF-specific;
  37525. some knowledge of DWARF is assumed in this description.
  37526. The mapped index file format is designed to be directly 'mmap'able on
  37527. any architecture. In most cases, a datum is represented using a
  37528. little-endian 32-bit integer value, called an 'offset_type'. Big endian
  37529. machines must byte-swap the values before using them. Exceptions to
  37530. this rule are noted. The data is laid out such that alignment is always
  37531. respected.
  37532. A mapped index consists of several areas, laid out in order.
  37533. 1. The file header. This is a sequence of values, of 'offset_type'
  37534. unless otherwise noted:
  37535. 1. The version number, currently 8. Versions 1, 2 and 3 are
  37536. obsolete. Version 4 uses a different hashing function from
  37537. versions 5 and 6. Version 6 includes symbols for inlined
  37538. functions, whereas versions 4 and 5 do not. Version 7 adds
  37539. attributes to the CU indices in the symbol table. Version 8
  37540. specifies that symbols from DWARF type units
  37541. ('DW_TAG_type_unit') refer to the type unit's symbol table and
  37542. not the compilation unit ('DW_TAG_comp_unit') using the type.
  37543. GDB will only read version 4, 5, or 6 indices by specifying
  37544. 'set use-deprecated-index-sections on'. GDB has a workaround
  37545. for potentially broken version 7 indices so it is currently
  37546. not flagged as deprecated.
  37547. 2. The offset, from the start of the file, of the CU list.
  37548. 3. The offset, from the start of the file, of the types CU list.
  37549. Note that this area can be empty, in which case this offset
  37550. will be equal to the next offset.
  37551. 4. The offset, from the start of the file, of the address area.
  37552. 5. The offset, from the start of the file, of the symbol table.
  37553. 6. The offset, from the start of the file, of the constant pool.
  37554. 2. The CU list. This is a sequence of pairs of 64-bit little-endian
  37555. values, sorted by the CU offset. The first element in each pair is
  37556. the offset of a CU in the '.debug_info' section. The second
  37557. element in each pair is the length of that CU. References to a CU
  37558. elsewhere in the map are done using a CU index, which is just the
  37559. 0-based index into this table. Note that if there are type CUs,
  37560. then conceptually CUs and type CUs form a single list for the
  37561. purposes of CU indices.
  37562. 3. The types CU list. This is a sequence of triplets of 64-bit
  37563. little-endian values. In a triplet, the first value is the CU
  37564. offset, the second value is the type offset in the CU, and the
  37565. third value is the type signature. The types CU list is not
  37566. sorted.
  37567. 4. The address area. The address area consists of a sequence of
  37568. address entries. Each address entry has three elements:
  37569. 1. The low address. This is a 64-bit little-endian value.
  37570. 2. The high address. This is a 64-bit little-endian value. Like
  37571. 'DW_AT_high_pc', the value is one byte beyond the end.
  37572. 3. The CU index. This is an 'offset_type' value.
  37573. 5. The symbol table. This is an open-addressed hash table. The size
  37574. of the hash table is always a power of 2.
  37575. Each slot in the hash table consists of a pair of 'offset_type'
  37576. values. The first value is the offset of the symbol's name in the
  37577. constant pool. The second value is the offset of the CU vector in
  37578. the constant pool.
  37579. If both values are 0, then this slot in the hash table is empty.
  37580. This is ok because while 0 is a valid constant pool index, it
  37581. cannot be a valid index for both a string and a CU vector.
  37582. The hash value for a table entry is computed by applying an
  37583. iterative hash function to the symbol's name. Starting with an
  37584. initial value of 'r = 0', each (unsigned) character 'c' in the
  37585. string is incorporated into the hash using the formula depending on
  37586. the index version:
  37587. Version 4
  37588. The formula is 'r = r * 67 + c - 113'.
  37589. Versions 5 to 7
  37590. The formula is 'r = r * 67 + tolower (c) - 113'.
  37591. The terminating '\0' is not incorporated into the hash.
  37592. The step size used in the hash table is computed via '((hash * 17)
  37593. & (size - 1)) | 1', where 'hash' is the hash value, and 'size' is
  37594. the size of the hash table. The step size is used to find the next
  37595. candidate slot when handling a hash collision.
  37596. The names of C++ symbols in the hash table are canonicalized. We
  37597. don't currently have a simple description of the canonicalization
  37598. algorithm; if you intend to create new index sections, you must
  37599. read the code.
  37600. 6. The constant pool. This is simply a bunch of bytes. It is
  37601. organized so that alignment is correct: CU vectors are stored
  37602. first, followed by strings.
  37603. A CU vector in the constant pool is a sequence of 'offset_type'
  37604. values. The first value is the number of CU indices in the vector.
  37605. Each subsequent value is the index and symbol attributes of a CU in
  37606. the CU list. This element in the hash table is used to indicate
  37607. which CUs define the symbol and how the symbol is used. See below
  37608. for the format of each CU index+attributes entry.
  37609. A string in the constant pool is zero-terminated.
  37610. Attributes were added to CU index values in '.gdb_index' version 7.
  37611. If a symbol has multiple uses within a CU then there is one CU
  37612. index+attributes value for each use.
  37613. The format of each CU index+attributes entry is as follows (bit 0 =
  37614. LSB):
  37615. Bits 0-23
  37616. This is the index of the CU in the CU list.
  37617. Bits 24-27
  37618. These bits are reserved for future purposes and must be zero.
  37619. Bits 28-30
  37620. The kind of the symbol in the CU.
  37621. 0
  37622. This value is reserved and should not be used. By reserving
  37623. zero the full 'offset_type' value is backwards compatible with
  37624. previous versions of the index.
  37625. 1
  37626. The symbol is a type.
  37627. 2
  37628. The symbol is a variable or an enum value.
  37629. 3
  37630. The symbol is a function.
  37631. 4
  37632. Any other kind of symbol.
  37633. 5,6,7
  37634. These values are reserved.
  37635. Bit 31
  37636. This bit is zero if the value is global and one if it is static.
  37637. The determination of whether a symbol is global or static is
  37638. complicated. The authorative reference is the file 'dwarf2read.c'
  37639. in GDB sources.
  37640. This pseudo-code describes the computation of a symbol's kind and
  37641. global/static attributes in the index.
  37642. is_external = get_attribute (die, DW_AT_external);
  37643. language = get_attribute (cu_die, DW_AT_language);
  37644. switch (die->tag)
  37645. {
  37646. case DW_TAG_typedef:
  37647. case DW_TAG_base_type:
  37648. case DW_TAG_subrange_type:
  37649. kind = TYPE;
  37650. is_static = 1;
  37651. break;
  37652. case DW_TAG_enumerator:
  37653. kind = VARIABLE;
  37654. is_static = language != CPLUS;
  37655. break;
  37656. case DW_TAG_subprogram:
  37657. kind = FUNCTION;
  37658. is_static = ! (is_external || language == ADA);
  37659. break;
  37660. case DW_TAG_constant:
  37661. kind = VARIABLE;
  37662. is_static = ! is_external;
  37663. break;
  37664. case DW_TAG_variable:
  37665. kind = VARIABLE;
  37666. is_static = ! is_external;
  37667. break;
  37668. case DW_TAG_namespace:
  37669. kind = TYPE;
  37670. is_static = 0;
  37671. break;
  37672. case DW_TAG_class_type:
  37673. case DW_TAG_interface_type:
  37674. case DW_TAG_structure_type:
  37675. case DW_TAG_union_type:
  37676. case DW_TAG_enumeration_type:
  37677. kind = TYPE;
  37678. is_static = language != CPLUS;
  37679. break;
  37680. default:
  37681. assert (0);
  37682. }
  37683. 
  37684. File: gdb.info, Node: Man Pages, Next: Copying, Prev: Index Section Format, Up: Top
  37685. Appendix K Manual pages
  37686. ***********************
  37687. * Menu:
  37688. * gdb man:: The GNU Debugger man page
  37689. * gdbserver man:: Remote Server for the GNU Debugger man page
  37690. * gcore man:: Generate a core file of a running program
  37691. * gdbinit man:: gdbinit scripts
  37692. * gdb-add-index man:: Add index files to speed up GDB
  37693. 
  37694. File: gdb.info, Node: gdb man, Next: gdbserver man, Up: Man Pages
  37695. gdb man
  37696. =======
  37697. gdb ['-help'] ['-nh'] ['-nx'] ['-q'] ['-batch'] ['-cd='DIR] ['-f']
  37698. ['-b' BPS] ['-tty='DEV] ['-s' SYMFILE] ['-e' PROG] ['-se' PROG]
  37699. ['-c' CORE] ['-p' PROCID] ['-x' CMDS] ['-d' DIR] [PROG|PROG PROCID|PROG
  37700. CORE]
  37701. The purpose of a debugger such as GDB is to allow you to see what is
  37702. going on "inside" another program while it executes - or what another
  37703. program was doing at the moment it crashed.
  37704. GDB can do four main kinds of things (plus other things in support of
  37705. these) to help you catch bugs in the act:
  37706. * Start your program, specifying anything that might affect its
  37707. behavior.
  37708. * Make your program stop on specified conditions.
  37709. * Examine what has happened, when your program has stopped.
  37710. * Change things in your program, so you can experiment with
  37711. correcting the effects of one bug and go on to learn about another.
  37712. You can use GDB to debug programs written in C, C++, Fortran and
  37713. Modula-2.
  37714. GDB is invoked with the shell command 'gdb'. Once started, it reads
  37715. commands from the terminal until you tell it to exit with the GDB
  37716. command 'quit'. You can get online help from GDB itself by using the
  37717. command 'help'.
  37718. You can run 'gdb' with no arguments or options; but the most usual
  37719. way to start GDB is with one argument or two, specifying an executable
  37720. program as the argument:
  37721. gdb program
  37722. You can also start with both an executable program and a core file
  37723. specified:
  37724. gdb program core
  37725. You can, instead, specify a process ID as a second argument, if you
  37726. want to debug a running process:
  37727. gdb program 1234
  37728. gdb -p 1234
  37729. would attach GDB to process '1234' (unless you also have a file named
  37730. '1234'; GDB does check for a core file first). With option '-p' you can
  37731. omit the PROGRAM filename.
  37732. Here are some of the most frequently needed GDB commands:
  37733. 'break [FILE:]FUNCTION'
  37734. Set a breakpoint at FUNCTION (in FILE).
  37735. 'run [ARGLIST]'
  37736. Start your program (with ARGLIST, if specified).
  37737. 'bt'
  37738. Backtrace: display the program stack.
  37739. 'print EXPR'
  37740. Display the value of an expression.
  37741. 'c'
  37742. Continue running your program (after stopping, e.g. at a
  37743. breakpoint).
  37744. 'next'
  37745. Execute next program line (after stopping); step _over_ any
  37746. function calls in the line.
  37747. 'edit [FILE:]FUNCTION'
  37748. look at the program line where it is presently stopped.
  37749. 'list [FILE:]FUNCTION'
  37750. type the text of the program in the vicinity of where it is
  37751. presently stopped.
  37752. 'step'
  37753. Execute next program line (after stopping); step _into_ any
  37754. function calls in the line.
  37755. 'help [NAME]'
  37756. Show information about GDB command NAME, or general information
  37757. about using GDB.
  37758. 'quit'
  37759. Exit from GDB.
  37760. Any arguments other than options specify an executable file and core
  37761. file (or process ID); that is, the first argument encountered with no
  37762. associated option flag is equivalent to a '-se' option, and the second,
  37763. if any, is equivalent to a '-c' option if it's the name of a file. Many
  37764. options have both long and short forms; both are shown here. The long
  37765. forms are also recognized if you truncate them, so long as enough of the
  37766. option is present to be unambiguous. (If you prefer, you can flag
  37767. option arguments with '+' rather than '-', though we illustrate the more
  37768. usual convention.)
  37769. All the options and command line arguments you give are processed in
  37770. sequential order. The order makes a difference when the '-x' option is
  37771. used.
  37772. '-help'
  37773. '-h'
  37774. List all options, with brief explanations.
  37775. '-symbols=FILE'
  37776. '-s FILE'
  37777. Read symbol table from file FILE.
  37778. '-write'
  37779. Enable writing into executable and core files.
  37780. '-exec=FILE'
  37781. '-e FILE'
  37782. Use file FILE as the executable file to execute when appropriate,
  37783. and for examining pure data in conjunction with a core dump.
  37784. '-se=FILE'
  37785. Read symbol table from file FILE and use it as the executable file.
  37786. '-core=FILE'
  37787. '-c FILE'
  37788. Use file FILE as a core dump to examine.
  37789. '-command=FILE'
  37790. '-x FILE'
  37791. Execute GDB commands from file FILE.
  37792. '-ex COMMAND'
  37793. Execute given GDB COMMAND.
  37794. '-directory=DIRECTORY'
  37795. '-d DIRECTORY'
  37796. Add DIRECTORY to the path to search for source files.
  37797. '-nh'
  37798. Do not execute commands from '~/.gdbinit'.
  37799. '-nx'
  37800. '-n'
  37801. Do not execute commands from any '.gdbinit' initialization files.
  37802. '-quiet'
  37803. '-q'
  37804. "Quiet". Do not print the introductory and copyright messages.
  37805. These messages are also suppressed in batch mode.
  37806. '-batch'
  37807. Run in batch mode. Exit with status '0' after processing all the
  37808. command files specified with '-x' (and '.gdbinit', if not
  37809. inhibited). Exit with nonzero status if an error occurs in
  37810. executing the GDB commands in the command files.
  37811. Batch mode may be useful for running GDB as a filter, for example
  37812. to download and run a program on another computer; in order to make
  37813. this more useful, the message
  37814. Program exited normally.
  37815. (which is ordinarily issued whenever a program running under GDB
  37816. control terminates) is not issued when running in batch mode.
  37817. '-cd=DIRECTORY'
  37818. Run GDB using DIRECTORY as its working directory, instead of the
  37819. current directory.
  37820. '-fullname'
  37821. '-f'
  37822. Emacs sets this option when it runs GDB as a subprocess. It tells
  37823. GDB to output the full file name and line number in a standard,
  37824. recognizable fashion each time a stack frame is displayed (which
  37825. includes each time the program stops). This recognizable format
  37826. looks like two '\032' characters, followed by the file name, line
  37827. number and character position separated by colons, and a newline.
  37828. The Emacs-to-GDB interface program uses the two '\032' characters
  37829. as a signal to display the source code for the frame.
  37830. '-b BPS'
  37831. Set the line speed (baud rate or bits per second) of any serial
  37832. interface used by GDB for remote debugging.
  37833. '-tty=DEVICE'
  37834. Run using DEVICE for your program's standard input and output.
  37835. 
  37836. File: gdb.info, Node: gdbserver man, Next: gcore man, Prev: gdb man, Up: Man Pages
  37837. gdbserver man
  37838. =============
  37839. gdbserver COMM PROG [ARGS...]
  37840. gdbserver -attach COMM PID
  37841. gdbserver -multi COMM
  37842. 'gdbserver' is a program that allows you to run GDB on a different
  37843. machine than the one which is running the program being debugged.
  37844. Usage (server (target) side)
  37845. ----------------------------
  37846. First, you need to have a copy of the program you want to debug put onto
  37847. the target system. The program can be stripped to save space if needed,
  37848. as 'gdbserver' doesn't care about symbols. All symbol handling is taken
  37849. care of by the GDB running on the host system.
  37850. To use the server, you log on to the target system, and run the
  37851. 'gdbserver' program. You must tell it (a) how to communicate with GDB,
  37852. (b) the name of your program, and (c) its arguments. The general syntax
  37853. is:
  37854. target> gdbserver COMM PROGRAM [ARGS ...]
  37855. For example, using a serial port, you might say:
  37856. target> gdbserver /dev/com1 emacs foo.txt
  37857. This tells 'gdbserver' to debug emacs with an argument of foo.txt,
  37858. and to communicate with GDB via '/dev/com1'. 'gdbserver' now waits
  37859. patiently for the host GDB to communicate with it.
  37860. To use a TCP connection, you could say:
  37861. target> gdbserver host:2345 emacs foo.txt
  37862. This says pretty much the same thing as the last example, except that
  37863. we are going to communicate with the 'host' GDB via TCP. The 'host:2345'
  37864. argument means that we are expecting to see a TCP connection from 'host'
  37865. to local TCP port 2345. (Currently, the 'host' part is ignored.) You
  37866. can choose any number you want for the port number as long as it does
  37867. not conflict with any existing TCP ports on the target system. This
  37868. same port number must be used in the host GDBs 'target remote' command,
  37869. which will be described shortly. Note that if you chose a port number
  37870. that conflicts with another service, 'gdbserver' will print an error
  37871. message and exit.
  37872. 'gdbserver' can also attach to running programs. This is
  37873. accomplished via the '--attach' argument. The syntax is:
  37874. target> gdbserver --attach COMM PID
  37875. PID is the process ID of a currently running process. It isn't
  37876. necessary to point 'gdbserver' at a binary for the running process.
  37877. To start 'gdbserver' without supplying an initial command to run or
  37878. process ID to attach, use the '--multi' command line option. In such
  37879. case you should connect using 'target extended-remote' to start the
  37880. program you want to debug.
  37881. target> gdbserver --multi COMM
  37882. Usage (host side)
  37883. -----------------
  37884. You need an unstripped copy of the target program on your host system,
  37885. since GDB needs to examine its symbol tables and such. Start up GDB as
  37886. you normally would, with the target program as the first argument. (You
  37887. may need to use the '--baud' option if the serial line is running at
  37888. anything except 9600 baud.) That is 'gdb TARGET-PROG', or 'gdb --baud
  37889. BAUD TARGET-PROG'. After that, the only new command you need to know
  37890. about is 'target remote' (or 'target extended-remote'). Its argument is
  37891. either a device name (usually a serial device, like '/dev/ttyb'), or a
  37892. 'HOST:PORT' descriptor. For example:
  37893. (gdb) target remote /dev/ttyb
  37894. communicates with the server via serial line '/dev/ttyb', and:
  37895. (gdb) target remote the-target:2345
  37896. communicates via a TCP connection to port 2345 on host 'the-target',
  37897. where you previously started up 'gdbserver' with the same port number.
  37898. Note that for TCP connections, you must start up 'gdbserver' prior to
  37899. using the 'target remote' command, otherwise you may get an error that
  37900. looks something like 'Connection refused'.
  37901. 'gdbserver' can also debug multiple inferiors at once, described in
  37902. *note Inferiors and Programs::. In such case use the 'extended-remote'
  37903. GDB command variant:
  37904. (gdb) target extended-remote the-target:2345
  37905. The 'gdbserver' option '--multi' may or may not be used in such case.
  37906. There are three different modes for invoking 'gdbserver':
  37907. * Debug a specific program specified by its program name:
  37908. gdbserver COMM PROG [ARGS...]
  37909. The COMM parameter specifies how should the server communicate with
  37910. GDB; it is either a device name (to use a serial line), a TCP port
  37911. number (':1234'), or '-' or 'stdio' to use stdin/stdout of
  37912. 'gdbserver'. Specify the name of the program to debug in PROG.
  37913. Any remaining arguments will be passed to the program verbatim.
  37914. When the program exits, GDB will close the connection, and
  37915. 'gdbserver' will exit.
  37916. * Debug a specific program by specifying the process ID of a running
  37917. program:
  37918. gdbserver --attach COMM PID
  37919. The COMM parameter is as described above. Supply the process ID of
  37920. a running program in PID; GDB will do everything else. Like with
  37921. the previous mode, when the process PID exits, GDB will close the
  37922. connection, and 'gdbserver' will exit.
  37923. * Multi-process mode - debug more than one program/process:
  37924. gdbserver --multi COMM
  37925. In this mode, GDB can instruct 'gdbserver' which command(s) to run.
  37926. Unlike the other 2 modes, GDB will not close the connection when a
  37927. process being debugged exits, so you can debug several processes in
  37928. the same session.
  37929. In each of the modes you may specify these options:
  37930. '--help'
  37931. List all options, with brief explanations.
  37932. '--version'
  37933. This option causes 'gdbserver' to print its version number and
  37934. exit.
  37935. '--attach'
  37936. 'gdbserver' will attach to a running program. The syntax is:
  37937. target> gdbserver --attach COMM PID
  37938. PID is the process ID of a currently running process. It isn't
  37939. necessary to point 'gdbserver' at a binary for the running process.
  37940. '--multi'
  37941. To start 'gdbserver' without supplying an initial command to run or
  37942. process ID to attach, use this command line option. Then you can
  37943. connect using 'target extended-remote' and start the program you
  37944. want to debug. The syntax is:
  37945. target> gdbserver --multi COMM
  37946. '--debug'
  37947. Instruct 'gdbserver' to display extra status information about the
  37948. debugging process. This option is intended for 'gdbserver'
  37949. development and for bug reports to the developers.
  37950. '--remote-debug'
  37951. Instruct 'gdbserver' to display remote protocol debug output. This
  37952. option is intended for 'gdbserver' development and for bug reports
  37953. to the developers.
  37954. '--debug-format=option1[,option2,...]'
  37955. Instruct 'gdbserver' to include extra information in each line of
  37956. debugging output. *Note Other Command-Line Arguments for
  37957. gdbserver::.
  37958. '--wrapper'
  37959. Specify a wrapper to launch programs for debugging. The option
  37960. should be followed by the name of the wrapper, then any
  37961. command-line arguments to pass to the wrapper, then '--' indicating
  37962. the end of the wrapper arguments.
  37963. '--once'
  37964. By default, 'gdbserver' keeps the listening TCP port open, so that
  37965. additional connections are possible. However, if you start
  37966. 'gdbserver' with the '--once' option, it will stop listening for
  37967. any further connection attempts after connecting to the first GDB
  37968. session.
  37969. 
  37970. File: gdb.info, Node: gcore man, Next: gdbinit man, Prev: gdbserver man, Up: Man Pages
  37971. gcore
  37972. =====
  37973. gcore [-a] [-o PREFIX] PID1 [PID2...PIDN]
  37974. Generate core dumps of one or more running programs with process IDs
  37975. PID1, PID2, etc. A core file produced by 'gcore' is equivalent to one
  37976. produced by the kernel when the process crashes (and when 'ulimit -c'
  37977. was used to set up an appropriate core dump limit). However, unlike
  37978. after a crash, after 'gcore' finishes its job the program remains
  37979. running without any change.
  37980. '-a'
  37981. Dump all memory mappings. The actual effect of this option depends
  37982. on the Operating System. On GNU/Linux, it will disable
  37983. 'use-coredump-filter' (*note set use-coredump-filter::) and enable
  37984. 'dump-excluded-mappings' (*note set dump-excluded-mappings::).
  37985. '-o PREFIX'
  37986. The optional argument PREFIX specifies the prefix to be used when
  37987. composing the file names of the core dumps. The file name is
  37988. composed as 'PREFIX.PID', where PID is the process ID of the
  37989. running program being analyzed by 'gcore'. If not specified,
  37990. PREFIX defaults to GCORE.
  37991. 
  37992. File: gdb.info, Node: gdbinit man, Next: gdb-add-index man, Prev: gcore man, Up: Man Pages
  37993. gdbinit
  37994. =======
  37995. ~/.gdbinit
  37996. ./.gdbinit
  37997. These files contain GDB commands to automatically execute during GDB
  37998. startup. The lines of contents are canned sequences of commands,
  37999. described in *note Sequences::.
  38000. Please read more in *note Startup::.
  38001. '(not enabled with --with-system-gdbinit during compilation)'
  38002. System-wide initialization file. It is executed unless user
  38003. specified GDB option '-nx' or '-n'. See more in *note System-wide
  38004. configuration::.
  38005. '~/.gdbinit'
  38006. User initialization file. It is executed unless user specified GDB
  38007. options '-nx', '-n' or '-nh'.
  38008. './.gdbinit'
  38009. Initialization file for current directory. It may need to be
  38010. enabled with GDB security command 'set auto-load local-gdbinit'.
  38011. See more in *note Init File in the Current Directory::.
  38012. 
  38013. File: gdb.info, Node: gdb-add-index man, Prev: gdbinit man, Up: Man Pages
  38014. gdb-add-index
  38015. =============
  38016. gdb-add-index FILENAME
  38017. When GDB finds a symbol file, it scans the symbols in the file in
  38018. order to construct an internal symbol table. This lets most GDB
  38019. operations work quickly-at the cost of a delay early on. For large
  38020. programs, this delay can be quite lengthy, so GDB provides a way to
  38021. build an index, which speeds up startup.
  38022. To determine whether a file contains such an index, use the command
  38023. 'readelf -S filename': the index is stored in a section named
  38024. '.gdb_index'. The index file can only be produced on systems which use
  38025. ELF binaries and DWARF debug information (i.e., sections named
  38026. '.debug_*').
  38027. 'gdb-add-index' uses GDB and 'objdump' found in the 'PATH'
  38028. environment variable. If you want to use different versions of these
  38029. programs, you can specify them through the 'GDB' and 'OBJDUMP'
  38030. environment variables.
  38031. See more in *note Index Files::.
  38032. 
  38033. File: gdb.info, Node: Copying, Next: GNU Free Documentation License, Prev: Man Pages, Up: Top
  38034. Appendix L GNU GENERAL PUBLIC LICENSE
  38035. *************************************
  38036. Version 3, 29 June 2007
  38037. Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
  38038. Everyone is permitted to copy and distribute verbatim copies of this
  38039. license document, but changing it is not allowed.
  38040. Preamble
  38041. ========
  38042. The GNU General Public License is a free, copyleft license for software
  38043. and other kinds of works.
  38044. The licenses for most software and other practical works are designed
  38045. to take away your freedom to share and change the works. By contrast,
  38046. the GNU General Public License is intended to guarantee your freedom to
  38047. share and change all versions of a program--to make sure it remains free
  38048. software for all its users. We, the Free Software Foundation, use the
  38049. GNU General Public License for most of our software; it applies also to
  38050. any other work released this way by its authors. You can apply it to
  38051. your programs, too.
  38052. When we speak of free software, we are referring to freedom, not
  38053. price. Our General Public Licenses are designed to make sure that you
  38054. have the freedom to distribute copies of free software (and charge for
  38055. them if you wish), that you receive source code or can get it if you
  38056. want it, that you can change the software or use pieces of it in new
  38057. free programs, and that you know you can do these things.
  38058. To protect your rights, we need to prevent others from denying you
  38059. these rights or asking you to surrender the rights. Therefore, you have
  38060. certain responsibilities if you distribute copies of the software, or if
  38061. you modify it: responsibilities to respect the freedom of others.
  38062. For example, if you distribute copies of such a program, whether
  38063. gratis or for a fee, you must pass on to the recipients the same
  38064. freedoms that you received. You must make sure that they, too, receive
  38065. or can get the source code. And you must show them these terms so they
  38066. know their rights.
  38067. Developers that use the GNU GPL protect your rights with two steps:
  38068. (1) assert copyright on the software, and (2) offer you this License
  38069. giving you legal permission to copy, distribute and/or modify it.
  38070. For the developers' and authors' protection, the GPL clearly explains
  38071. that there is no warranty for this free software. For both users' and
  38072. authors' sake, the GPL requires that modified versions be marked as
  38073. changed, so that their problems will not be attributed erroneously to
  38074. authors of previous versions.
  38075. Some devices are designed to deny users access to install or run
  38076. modified versions of the software inside them, although the manufacturer
  38077. can do so. This is fundamentally incompatible with the aim of
  38078. protecting users' freedom to change the software. The systematic
  38079. pattern of such abuse occurs in the area of products for individuals to
  38080. use, which is precisely where it is most unacceptable. Therefore, we
  38081. have designed this version of the GPL to prohibit the practice for those
  38082. products. If such problems arise substantially in other domains, we
  38083. stand ready to extend this provision to those domains in future versions
  38084. of the GPL, as needed to protect the freedom of users.
  38085. Finally, every program is threatened constantly by software patents.
  38086. States should not allow patents to restrict development and use of
  38087. software on general-purpose computers, but in those that do, we wish to
  38088. avoid the special danger that patents applied to a free program could
  38089. make it effectively proprietary. To prevent this, the GPL assures that
  38090. patents cannot be used to render the program non-free.
  38091. The precise terms and conditions for copying, distribution and
  38092. modification follow.
  38093. TERMS AND CONDITIONS
  38094. ====================
  38095. 0. Definitions.
  38096. "This License" refers to version 3 of the GNU General Public
  38097. License.
  38098. "Copyright" also means copyright-like laws that apply to other
  38099. kinds of works, such as semiconductor masks.
  38100. "The Program" refers to any copyrightable work licensed under this
  38101. License. Each licensee is addressed as "you". "Licensees" and
  38102. "recipients" may be individuals or organizations.
  38103. To "modify" a work means to copy from or adapt all or part of the
  38104. work in a fashion requiring copyright permission, other than the
  38105. making of an exact copy. The resulting work is called a "modified
  38106. version" of the earlier work or a work "based on" the earlier work.
  38107. A "covered work" means either the unmodified Program or a work
  38108. based on the Program.
  38109. To "propagate" a work means to do anything with it that, without
  38110. permission, would make you directly or secondarily liable for
  38111. infringement under applicable copyright law, except executing it on
  38112. a computer or modifying a private copy. Propagation includes
  38113. copying, distribution (with or without modification), making
  38114. available to the public, and in some countries other activities as
  38115. well.
  38116. To "convey" a work means any kind of propagation that enables other
  38117. parties to make or receive copies. Mere interaction with a user
  38118. through a computer network, with no transfer of a copy, is not
  38119. conveying.
  38120. An interactive user interface displays "Appropriate Legal Notices"
  38121. to the extent that it includes a convenient and prominently visible
  38122. feature that (1) displays an appropriate copyright notice, and (2)
  38123. tells the user that there is no warranty for the work (except to
  38124. the extent that warranties are provided), that licensees may convey
  38125. the work under this License, and how to view a copy of this
  38126. License. If the interface presents a list of user commands or
  38127. options, such as a menu, a prominent item in the list meets this
  38128. criterion.
  38129. 1. Source Code.
  38130. The "source code" for a work means the preferred form of the work
  38131. for making modifications to it. "Object code" means any non-source
  38132. form of a work.
  38133. A "Standard Interface" means an interface that either is an
  38134. official standard defined by a recognized standards body, or, in
  38135. the case of interfaces specified for a particular programming
  38136. language, one that is widely used among developers working in that
  38137. language.
  38138. The "System Libraries" of an executable work include anything,
  38139. other than the work as a whole, that (a) is included in the normal
  38140. form of packaging a Major Component, but which is not part of that
  38141. Major Component, and (b) serves only to enable use of the work with
  38142. that Major Component, or to implement a Standard Interface for
  38143. which an implementation is available to the public in source code
  38144. form. A "Major Component", in this context, means a major
  38145. essential component (kernel, window system, and so on) of the
  38146. specific operating system (if any) on which the executable work
  38147. runs, or a compiler used to produce the work, or an object code
  38148. interpreter used to run it.
  38149. The "Corresponding Source" for a work in object code form means all
  38150. the source code needed to generate, install, and (for an executable
  38151. work) run the object code and to modify the work, including scripts
  38152. to control those activities. However, it does not include the
  38153. work's System Libraries, or general-purpose tools or generally
  38154. available free programs which are used unmodified in performing
  38155. those activities but which are not part of the work. For example,
  38156. Corresponding Source includes interface definition files associated
  38157. with source files for the work, and the source code for shared
  38158. libraries and dynamically linked subprograms that the work is
  38159. specifically designed to require, such as by intimate data
  38160. communication or control flow between those subprograms and other
  38161. parts of the work.
  38162. The Corresponding Source need not include anything that users can
  38163. regenerate automatically from other parts of the Corresponding
  38164. Source.
  38165. The Corresponding Source for a work in source code form is that
  38166. same work.
  38167. 2. Basic Permissions.
  38168. All rights granted under this License are granted for the term of
  38169. copyright on the Program, and are irrevocable provided the stated
  38170. conditions are met. This License explicitly affirms your unlimited
  38171. permission to run the unmodified Program. The output from running
  38172. a covered work is covered by this License only if the output, given
  38173. its content, constitutes a covered work. This License acknowledges
  38174. your rights of fair use or other equivalent, as provided by
  38175. copyright law.
  38176. You may make, run and propagate covered works that you do not
  38177. convey, without conditions so long as your license otherwise
  38178. remains in force. You may convey covered works to others for the
  38179. sole purpose of having them make modifications exclusively for you,
  38180. or provide you with facilities for running those works, provided
  38181. that you comply with the terms of this License in conveying all
  38182. material for which you do not control copyright. Those thus making
  38183. or running the covered works for you must do so exclusively on your
  38184. behalf, under your direction and control, on terms that prohibit
  38185. them from making any copies of your copyrighted material outside
  38186. their relationship with you.
  38187. Conveying under any other circumstances is permitted solely under
  38188. the conditions stated below. Sublicensing is not allowed; section
  38189. 10 makes it unnecessary.
  38190. 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
  38191. No covered work shall be deemed part of an effective technological
  38192. measure under any applicable law fulfilling obligations under
  38193. article 11 of the WIPO copyright treaty adopted on 20 December
  38194. 1996, or similar laws prohibiting or restricting circumvention of
  38195. such measures.
  38196. When you convey a covered work, you waive any legal power to forbid
  38197. circumvention of technological measures to the extent such
  38198. circumvention is effected by exercising rights under this License
  38199. with respect to the covered work, and you disclaim any intention to
  38200. limit operation or modification of the work as a means of
  38201. enforcing, against the work's users, your or third parties' legal
  38202. rights to forbid circumvention of technological measures.
  38203. 4. Conveying Verbatim Copies.
  38204. You may convey verbatim copies of the Program's source code as you
  38205. receive it, in any medium, provided that you conspicuously and
  38206. appropriately publish on each copy an appropriate copyright notice;
  38207. keep intact all notices stating that this License and any
  38208. non-permissive terms added in accord with section 7 apply to the
  38209. code; keep intact all notices of the absence of any warranty; and
  38210. give all recipients a copy of this License along with the Program.
  38211. You may charge any price or no price for each copy that you convey,
  38212. and you may offer support or warranty protection for a fee.
  38213. 5. Conveying Modified Source Versions.
  38214. You may convey a work based on the Program, or the modifications to
  38215. produce it from the Program, in the form of source code under the
  38216. terms of section 4, provided that you also meet all of these
  38217. conditions:
  38218. a. The work must carry prominent notices stating that you
  38219. modified it, and giving a relevant date.
  38220. b. The work must carry prominent notices stating that it is
  38221. released under this License and any conditions added under
  38222. section 7. This requirement modifies the requirement in
  38223. section 4 to "keep intact all notices".
  38224. c. You must license the entire work, as a whole, under this
  38225. License to anyone who comes into possession of a copy. This
  38226. License will therefore apply, along with any applicable
  38227. section 7 additional terms, to the whole of the work, and all
  38228. its parts, regardless of how they are packaged. This License
  38229. gives no permission to license the work in any other way, but
  38230. it does not invalidate such permission if you have separately
  38231. received it.
  38232. d. If the work has interactive user interfaces, each must display
  38233. Appropriate Legal Notices; however, if the Program has
  38234. interactive interfaces that do not display Appropriate Legal
  38235. Notices, your work need not make them do so.
  38236. A compilation of a covered work with other separate and independent
  38237. works, which are not by their nature extensions of the covered
  38238. work, and which are not combined with it such as to form a larger
  38239. program, in or on a volume of a storage or distribution medium, is
  38240. called an "aggregate" if the compilation and its resulting
  38241. copyright are not used to limit the access or legal rights of the
  38242. compilation's users beyond what the individual works permit.
  38243. Inclusion of a covered work in an aggregate does not cause this
  38244. License to apply to the other parts of the aggregate.
  38245. 6. Conveying Non-Source Forms.
  38246. You may convey a covered work in object code form under the terms
  38247. of sections 4 and 5, provided that you also convey the
  38248. machine-readable Corresponding Source under the terms of this
  38249. License, in one of these ways:
  38250. a. Convey the object code in, or embodied in, a physical product
  38251. (including a physical distribution medium), accompanied by the
  38252. Corresponding Source fixed on a durable physical medium
  38253. customarily used for software interchange.
  38254. b. Convey the object code in, or embodied in, a physical product
  38255. (including a physical distribution medium), accompanied by a
  38256. written offer, valid for at least three years and valid for as
  38257. long as you offer spare parts or customer support for that
  38258. product model, to give anyone who possesses the object code
  38259. either (1) a copy of the Corresponding Source for all the
  38260. software in the product that is covered by this License, on a
  38261. durable physical medium customarily used for software
  38262. interchange, for a price no more than your reasonable cost of
  38263. physically performing this conveying of source, or (2) access
  38264. to copy the Corresponding Source from a network server at no
  38265. charge.
  38266. c. Convey individual copies of the object code with a copy of the
  38267. written offer to provide the Corresponding Source. This
  38268. alternative is allowed only occasionally and noncommercially,
  38269. and only if you received the object code with such an offer,
  38270. in accord with subsection 6b.
  38271. d. Convey the object code by offering access from a designated
  38272. place (gratis or for a charge), and offer equivalent access to
  38273. the Corresponding Source in the same way through the same
  38274. place at no further charge. You need not require recipients
  38275. to copy the Corresponding Source along with the object code.
  38276. If the place to copy the object code is a network server, the
  38277. Corresponding Source may be on a different server (operated by
  38278. you or a third party) that supports equivalent copying
  38279. facilities, provided you maintain clear directions next to the
  38280. object code saying where to find the Corresponding Source.
  38281. Regardless of what server hosts the Corresponding Source, you
  38282. remain obligated to ensure that it is available for as long as
  38283. needed to satisfy these requirements.
  38284. e. Convey the object code using peer-to-peer transmission,
  38285. provided you inform other peers where the object code and
  38286. Corresponding Source of the work are being offered to the
  38287. general public at no charge under subsection 6d.
  38288. A separable portion of the object code, whose source code is
  38289. excluded from the Corresponding Source as a System Library, need
  38290. not be included in conveying the object code work.
  38291. A "User Product" is either (1) a "consumer product", which means
  38292. any tangible personal property which is normally used for personal,
  38293. family, or household purposes, or (2) anything designed or sold for
  38294. incorporation into a dwelling. In determining whether a product is
  38295. a consumer product, doubtful cases shall be resolved in favor of
  38296. coverage. For a particular product received by a particular user,
  38297. "normally used" refers to a typical or common use of that class of
  38298. product, regardless of the status of the particular user or of the
  38299. way in which the particular user actually uses, or expects or is
  38300. expected to use, the product. A product is a consumer product
  38301. regardless of whether the product has substantial commercial,
  38302. industrial or non-consumer uses, unless such uses represent the
  38303. only significant mode of use of the product.
  38304. "Installation Information" for a User Product means any methods,
  38305. procedures, authorization keys, or other information required to
  38306. install and execute modified versions of a covered work in that
  38307. User Product from a modified version of its Corresponding Source.
  38308. The information must suffice to ensure that the continued
  38309. functioning of the modified object code is in no case prevented or
  38310. interfered with solely because modification has been made.
  38311. If you convey an object code work under this section in, or with,
  38312. or specifically for use in, a User Product, and the conveying
  38313. occurs as part of a transaction in which the right of possession
  38314. and use of the User Product is transferred to the recipient in
  38315. perpetuity or for a fixed term (regardless of how the transaction
  38316. is characterized), the Corresponding Source conveyed under this
  38317. section must be accompanied by the Installation Information. But
  38318. this requirement does not apply if neither you nor any third party
  38319. retains the ability to install modified object code on the User
  38320. Product (for example, the work has been installed in ROM).
  38321. The requirement to provide Installation Information does not
  38322. include a requirement to continue to provide support service,
  38323. warranty, or updates for a work that has been modified or installed
  38324. by the recipient, or for the User Product in which it has been
  38325. modified or installed. Access to a network may be denied when the
  38326. modification itself materially and adversely affects the operation
  38327. of the network or violates the rules and protocols for
  38328. communication across the network.
  38329. Corresponding Source conveyed, and Installation Information
  38330. provided, in accord with this section must be in a format that is
  38331. publicly documented (and with an implementation available to the
  38332. public in source code form), and must require no special password
  38333. or key for unpacking, reading or copying.
  38334. 7. Additional Terms.
  38335. "Additional permissions" are terms that supplement the terms of
  38336. this License by making exceptions from one or more of its
  38337. conditions. Additional permissions that are applicable to the
  38338. entire Program shall be treated as though they were included in
  38339. this License, to the extent that they are valid under applicable
  38340. law. If additional permissions apply only to part of the Program,
  38341. that part may be used separately under those permissions, but the
  38342. entire Program remains governed by this License without regard to
  38343. the additional permissions.
  38344. When you convey a copy of a covered work, you may at your option
  38345. remove any additional permissions from that copy, or from any part
  38346. of it. (Additional permissions may be written to require their own
  38347. removal in certain cases when you modify the work.) You may place
  38348. additional permissions on material, added by you to a covered work,
  38349. for which you have or can give appropriate copyright permission.
  38350. Notwithstanding any other provision of this License, for material
  38351. you add to a covered work, you may (if authorized by the copyright
  38352. holders of that material) supplement the terms of this License with
  38353. terms:
  38354. a. Disclaiming warranty or limiting liability differently from
  38355. the terms of sections 15 and 16 of this License; or
  38356. b. Requiring preservation of specified reasonable legal notices
  38357. or author attributions in that material or in the Appropriate
  38358. Legal Notices displayed by works containing it; or
  38359. c. Prohibiting misrepresentation of the origin of that material,
  38360. or requiring that modified versions of such material be marked
  38361. in reasonable ways as different from the original version; or
  38362. d. Limiting the use for publicity purposes of names of licensors
  38363. or authors of the material; or
  38364. e. Declining to grant rights under trademark law for use of some
  38365. trade names, trademarks, or service marks; or
  38366. f. Requiring indemnification of licensors and authors of that
  38367. material by anyone who conveys the material (or modified
  38368. versions of it) with contractual assumptions of liability to
  38369. the recipient, for any liability that these contractual
  38370. assumptions directly impose on those licensors and authors.
  38371. All other non-permissive additional terms are considered "further
  38372. restrictions" within the meaning of section 10. If the Program as
  38373. you received it, or any part of it, contains a notice stating that
  38374. it is governed by this License along with a term that is a further
  38375. restriction, you may remove that term. If a license document
  38376. contains a further restriction but permits relicensing or conveying
  38377. under this License, you may add to a covered work material governed
  38378. by the terms of that license document, provided that the further
  38379. restriction does not survive such relicensing or conveying.
  38380. If you add terms to a covered work in accord with this section, you
  38381. must place, in the relevant source files, a statement of the
  38382. additional terms that apply to those files, or a notice indicating
  38383. where to find the applicable terms.
  38384. Additional terms, permissive or non-permissive, may be stated in
  38385. the form of a separately written license, or stated as exceptions;
  38386. the above requirements apply either way.
  38387. 8. Termination.
  38388. You may not propagate or modify a covered work except as expressly
  38389. provided under this License. Any attempt otherwise to propagate or
  38390. modify it is void, and will automatically terminate your rights
  38391. under this License (including any patent licenses granted under the
  38392. third paragraph of section 11).
  38393. However, if you cease all violation of this License, then your
  38394. license from a particular copyright holder is reinstated (a)
  38395. provisionally, unless and until the copyright holder explicitly and
  38396. finally terminates your license, and (b) permanently, if the
  38397. copyright holder fails to notify you of the violation by some
  38398. reasonable means prior to 60 days after the cessation.
  38399. Moreover, your license from a particular copyright holder is
  38400. reinstated permanently if the copyright holder notifies you of the
  38401. violation by some reasonable means, this is the first time you have
  38402. received notice of violation of this License (for any work) from
  38403. that copyright holder, and you cure the violation prior to 30 days
  38404. after your receipt of the notice.
  38405. Termination of your rights under this section does not terminate
  38406. the licenses of parties who have received copies or rights from you
  38407. under this License. If your rights have been terminated and not
  38408. permanently reinstated, you do not qualify to receive new licenses
  38409. for the same material under section 10.
  38410. 9. Acceptance Not Required for Having Copies.
  38411. You are not required to accept this License in order to receive or
  38412. run a copy of the Program. Ancillary propagation of a covered work
  38413. occurring solely as a consequence of using peer-to-peer
  38414. transmission to receive a copy likewise does not require
  38415. acceptance. However, nothing other than this License grants you
  38416. permission to propagate or modify any covered work. These actions
  38417. infringe copyright if you do not accept this License. Therefore,
  38418. by modifying or propagating a covered work, you indicate your
  38419. acceptance of this License to do so.
  38420. 10. Automatic Licensing of Downstream Recipients.
  38421. Each time you convey a covered work, the recipient automatically
  38422. receives a license from the original licensors, to run, modify and
  38423. propagate that work, subject to this License. You are not
  38424. responsible for enforcing compliance by third parties with this
  38425. License.
  38426. An "entity transaction" is a transaction transferring control of an
  38427. organization, or substantially all assets of one, or subdividing an
  38428. organization, or merging organizations. If propagation of a
  38429. covered work results from an entity transaction, each party to that
  38430. transaction who receives a copy of the work also receives whatever
  38431. licenses to the work the party's predecessor in interest had or
  38432. could give under the previous paragraph, plus a right to possession
  38433. of the Corresponding Source of the work from the predecessor in
  38434. interest, if the predecessor has it or can get it with reasonable
  38435. efforts.
  38436. You may not impose any further restrictions on the exercise of the
  38437. rights granted or affirmed under this License. For example, you
  38438. may not impose a license fee, royalty, or other charge for exercise
  38439. of rights granted under this License, and you may not initiate
  38440. litigation (including a cross-claim or counterclaim in a lawsuit)
  38441. alleging that any patent claim is infringed by making, using,
  38442. selling, offering for sale, or importing the Program or any portion
  38443. of it.
  38444. 11. Patents.
  38445. A "contributor" is a copyright holder who authorizes use under this
  38446. License of the Program or a work on which the Program is based.
  38447. The work thus licensed is called the contributor's "contributor
  38448. version".
  38449. A contributor's "essential patent claims" are all patent claims
  38450. owned or controlled by the contributor, whether already acquired or
  38451. hereafter acquired, that would be infringed by some manner,
  38452. permitted by this License, of making, using, or selling its
  38453. contributor version, but do not include claims that would be
  38454. infringed only as a consequence of further modification of the
  38455. contributor version. For purposes of this definition, "control"
  38456. includes the right to grant patent sublicenses in a manner
  38457. consistent with the requirements of this License.
  38458. Each contributor grants you a non-exclusive, worldwide,
  38459. royalty-free patent license under the contributor's essential
  38460. patent claims, to make, use, sell, offer for sale, import and
  38461. otherwise run, modify and propagate the contents of its contributor
  38462. version.
  38463. In the following three paragraphs, a "patent license" is any
  38464. express agreement or commitment, however denominated, not to
  38465. enforce a patent (such as an express permission to practice a
  38466. patent or covenant not to sue for patent infringement). To "grant"
  38467. such a patent license to a party means to make such an agreement or
  38468. commitment not to enforce a patent against the party.
  38469. If you convey a covered work, knowingly relying on a patent
  38470. license, and the Corresponding Source of the work is not available
  38471. for anyone to copy, free of charge and under the terms of this
  38472. License, through a publicly available network server or other
  38473. readily accessible means, then you must either (1) cause the
  38474. Corresponding Source to be so available, or (2) arrange to deprive
  38475. yourself of the benefit of the patent license for this particular
  38476. work, or (3) arrange, in a manner consistent with the requirements
  38477. of this License, to extend the patent license to downstream
  38478. recipients. "Knowingly relying" means you have actual knowledge
  38479. that, but for the patent license, your conveying the covered work
  38480. in a country, or your recipient's use of the covered work in a
  38481. country, would infringe one or more identifiable patents in that
  38482. country that you have reason to believe are valid.
  38483. If, pursuant to or in connection with a single transaction or
  38484. arrangement, you convey, or propagate by procuring conveyance of, a
  38485. covered work, and grant a patent license to some of the parties
  38486. receiving the covered work authorizing them to use, propagate,
  38487. modify or convey a specific copy of the covered work, then the
  38488. patent license you grant is automatically extended to all
  38489. recipients of the covered work and works based on it.
  38490. A patent license is "discriminatory" if it does not include within
  38491. the scope of its coverage, prohibits the exercise of, or is
  38492. conditioned on the non-exercise of one or more of the rights that
  38493. are specifically granted under this License. You may not convey a
  38494. covered work if you are a party to an arrangement with a third
  38495. party that is in the business of distributing software, under which
  38496. you make payment to the third party based on the extent of your
  38497. activity of conveying the work, and under which the third party
  38498. grants, to any of the parties who would receive the covered work
  38499. from you, a discriminatory patent license (a) in connection with
  38500. copies of the covered work conveyed by you (or copies made from
  38501. those copies), or (b) primarily for and in connection with specific
  38502. products or compilations that contain the covered work, unless you
  38503. entered into that arrangement, or that patent license was granted,
  38504. prior to 28 March 2007.
  38505. Nothing in this License shall be construed as excluding or limiting
  38506. any implied license or other defenses to infringement that may
  38507. otherwise be available to you under applicable patent law.
  38508. 12. No Surrender of Others' Freedom.
  38509. If conditions are imposed on you (whether by court order, agreement
  38510. or otherwise) that contradict the conditions of this License, they
  38511. do not excuse you from the conditions of this License. If you
  38512. cannot convey a covered work so as to satisfy simultaneously your
  38513. obligations under this License and any other pertinent obligations,
  38514. then as a consequence you may not convey it at all. For example,
  38515. if you agree to terms that obligate you to collect a royalty for
  38516. further conveying from those to whom you convey the Program, the
  38517. only way you could satisfy both those terms and this License would
  38518. be to refrain entirely from conveying the Program.
  38519. 13. Use with the GNU Affero General Public License.
  38520. Notwithstanding any other provision of this License, you have
  38521. permission to link or combine any covered work with a work licensed
  38522. under version 3 of the GNU Affero General Public License into a
  38523. single combined work, and to convey the resulting work. The terms
  38524. of this License will continue to apply to the part which is the
  38525. covered work, but the special requirements of the GNU Affero
  38526. General Public License, section 13, concerning interaction through
  38527. a network will apply to the combination as such.
  38528. 14. Revised Versions of this License.
  38529. The Free Software Foundation may publish revised and/or new
  38530. versions of the GNU General Public License from time to time. Such
  38531. new versions will be similar in spirit to the present version, but
  38532. may differ in detail to address new problems or concerns.
  38533. Each version is given a distinguishing version number. If the
  38534. Program specifies that a certain numbered version of the GNU
  38535. General Public License "or any later version" applies to it, you
  38536. have the option of following the terms and conditions either of
  38537. that numbered version or of any later version published by the Free
  38538. Software Foundation. If the Program does not specify a version
  38539. number of the GNU General Public License, you may choose any
  38540. version ever published by the Free Software Foundation.
  38541. If the Program specifies that a proxy can decide which future
  38542. versions of the GNU General Public License can be used, that
  38543. proxy's public statement of acceptance of a version permanently
  38544. authorizes you to choose that version for the Program.
  38545. Later license versions may give you additional or different
  38546. permissions. However, no additional obligations are imposed on any
  38547. author or copyright holder as a result of your choosing to follow a
  38548. later version.
  38549. 15. Disclaimer of Warranty.
  38550. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
  38551. APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
  38552. COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
  38553. WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
  38554. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  38555. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
  38556. RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
  38557. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
  38558. NECESSARY SERVICING, REPAIR OR CORRECTION.
  38559. 16. Limitation of Liability.
  38560. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  38561. WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
  38562. AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
  38563. DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
  38564. CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
  38565. THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
  38566. BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
  38567. PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  38568. PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
  38569. THE POSSIBILITY OF SUCH DAMAGES.
  38570. 17. Interpretation of Sections 15 and 16.
  38571. If the disclaimer of warranty and limitation of liability provided
  38572. above cannot be given local legal effect according to their terms,
  38573. reviewing courts shall apply local law that most closely
  38574. approximates an absolute waiver of all civil liability in
  38575. connection with the Program, unless a warranty or assumption of
  38576. liability accompanies a copy of the Program in return for a fee.
  38577. END OF TERMS AND CONDITIONS
  38578. ===========================
  38579. How to Apply These Terms to Your New Programs
  38580. =============================================
  38581. If you develop a new program, and you want it to be of the greatest
  38582. possible use to the public, the best way to achieve this is to make it
  38583. free software which everyone can redistribute and change under these
  38584. terms.
  38585. To do so, attach the following notices to the program. It is safest
  38586. to attach them to the start of each source file to most effectively
  38587. state the exclusion of warranty; and each file should have at least the
  38588. "copyright" line and a pointer to where the full notice is found.
  38589. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
  38590. Copyright (C) YEAR NAME OF AUTHOR
  38591. This program is free software: you can redistribute it and/or modify
  38592. it under the terms of the GNU General Public License as published by
  38593. the Free Software Foundation, either version 3 of the License, or (at
  38594. your option) any later version.
  38595. This program is distributed in the hope that it will be useful, but
  38596. WITHOUT ANY WARRANTY; without even the implied warranty of
  38597. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  38598. General Public License for more details.
  38599. You should have received a copy of the GNU General Public License
  38600. along with this program. If not, see <http://www.gnu.org/licenses/>.
  38601. Also add information on how to contact you by electronic and paper
  38602. mail.
  38603. If the program does terminal interaction, make it output a short
  38604. notice like this when it starts in an interactive mode:
  38605. PROGRAM Copyright (C) YEAR NAME OF AUTHOR
  38606. This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
  38607. This is free software, and you are welcome to redistribute it
  38608. under certain conditions; type 'show c' for details.
  38609. The hypothetical commands 'show w' and 'show c' should show the
  38610. appropriate parts of the General Public License. Of course, your
  38611. program's commands might be different; for a GUI interface, you would
  38612. use an "about box".
  38613. You should also get your employer (if you work as a programmer) or
  38614. school, if any, to sign a "copyright disclaimer" for the program, if
  38615. necessary. For more information on this, and how to apply and follow
  38616. the GNU GPL, see <http://www.gnu.org/licenses/>.
  38617. The GNU General Public License does not permit incorporating your
  38618. program into proprietary programs. If your program is a subroutine
  38619. library, you may consider it more useful to permit linking proprietary
  38620. applications with the library. If this is what you want to do, use the
  38621. GNU Lesser General Public License instead of this License. But first,
  38622. please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
  38623. 
  38624. File: gdb.info, Node: GNU Free Documentation License, Next: Concept Index, Prev: Copying, Up: Top
  38625. Appendix M GNU Free Documentation License
  38626. *****************************************
  38627. Version 1.3, 3 November 2008
  38628. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  38629. <http://fsf.org/>
  38630. Everyone is permitted to copy and distribute verbatim copies
  38631. of this license document, but changing it is not allowed.
  38632. 0. PREAMBLE
  38633. The purpose of this License is to make a manual, textbook, or other
  38634. functional and useful document "free" in the sense of freedom: to
  38635. assure everyone the effective freedom to copy and redistribute it,
  38636. with or without modifying it, either commercially or
  38637. noncommercially. Secondarily, this License preserves for the
  38638. author and publisher a way to get credit for their work, while not
  38639. being considered responsible for modifications made by others.
  38640. This License is a kind of "copyleft", which means that derivative
  38641. works of the document must themselves be free in the same sense.
  38642. It complements the GNU General Public License, which is a copyleft
  38643. license designed for free software.
  38644. We have designed this License in order to use it for manuals for
  38645. free software, because free software needs free documentation: a
  38646. free program should come with manuals providing the same freedoms
  38647. that the software does. But this License is not limited to
  38648. software manuals; it can be used for any textual work, regardless
  38649. of subject matter or whether it is published as a printed book. We
  38650. recommend this License principally for works whose purpose is
  38651. instruction or reference.
  38652. 1. APPLICABILITY AND DEFINITIONS
  38653. This License applies to any manual or other work, in any medium,
  38654. that contains a notice placed by the copyright holder saying it can
  38655. be distributed under the terms of this License. Such a notice
  38656. grants a world-wide, royalty-free license, unlimited in duration,
  38657. to use that work under the conditions stated herein. The
  38658. "Document", below, refers to any such manual or work. Any member
  38659. of the public is a licensee, and is addressed as "you". You accept
  38660. the license if you copy, modify or distribute the work in a way
  38661. requiring permission under copyright law.
  38662. A "Modified Version" of the Document means any work containing the
  38663. Document or a portion of it, either copied verbatim, or with
  38664. modifications and/or translated into another language.
  38665. A "Secondary Section" is a named appendix or a front-matter section
  38666. of the Document that deals exclusively with the relationship of the
  38667. publishers or authors of the Document to the Document's overall
  38668. subject (or to related matters) and contains nothing that could
  38669. fall directly within that overall subject. (Thus, if the Document
  38670. is in part a textbook of mathematics, a Secondary Section may not
  38671. explain any mathematics.) The relationship could be a matter of
  38672. historical connection with the subject or with related matters, or
  38673. of legal, commercial, philosophical, ethical or political position
  38674. regarding them.
  38675. The "Invariant Sections" are certain Secondary Sections whose
  38676. titles are designated, as being those of Invariant Sections, in the
  38677. notice that says that the Document is released under this License.
  38678. If a section does not fit the above definition of Secondary then it
  38679. is not allowed to be designated as Invariant. The Document may
  38680. contain zero Invariant Sections. If the Document does not identify
  38681. any Invariant Sections then there are none.
  38682. The "Cover Texts" are certain short passages of text that are
  38683. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  38684. that says that the Document is released under this License. A
  38685. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  38686. be at most 25 words.
  38687. A "Transparent" copy of the Document means a machine-readable copy,
  38688. represented in a format whose specification is available to the
  38689. general public, that is suitable for revising the document
  38690. straightforwardly with generic text editors or (for images composed
  38691. of pixels) generic paint programs or (for drawings) some widely
  38692. available drawing editor, and that is suitable for input to text
  38693. formatters or for automatic translation to a variety of formats
  38694. suitable for input to text formatters. A copy made in an otherwise
  38695. Transparent file format whose markup, or absence of markup, has
  38696. been arranged to thwart or discourage subsequent modification by
  38697. readers is not Transparent. An image format is not Transparent if
  38698. used for any substantial amount of text. A copy that is not
  38699. "Transparent" is called "Opaque".
  38700. Examples of suitable formats for Transparent copies include plain
  38701. ASCII without markup, Texinfo input format, LaTeX input format,
  38702. SGML or XML using a publicly available DTD, and standard-conforming
  38703. simple HTML, PostScript or PDF designed for human modification.
  38704. Examples of transparent image formats include PNG, XCF and JPG.
  38705. Opaque formats include proprietary formats that can be read and
  38706. edited only by proprietary word processors, SGML or XML for which
  38707. the DTD and/or processing tools are not generally available, and
  38708. the machine-generated HTML, PostScript or PDF produced by some word
  38709. processors for output purposes only.
  38710. The "Title Page" means, for a printed book, the title page itself,
  38711. plus such following pages as are needed to hold, legibly, the
  38712. material this License requires to appear in the title page. For
  38713. works in formats which do not have any title page as such, "Title
  38714. Page" means the text near the most prominent appearance of the
  38715. work's title, preceding the beginning of the body of the text.
  38716. The "publisher" means any person or entity that distributes copies
  38717. of the Document to the public.
  38718. A section "Entitled XYZ" means a named subunit of the Document
  38719. whose title either is precisely XYZ or contains XYZ in parentheses
  38720. following text that translates XYZ in another language. (Here XYZ
  38721. stands for a specific section name mentioned below, such as
  38722. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  38723. To "Preserve the Title" of such a section when you modify the
  38724. Document means that it remains a section "Entitled XYZ" according
  38725. to this definition.
  38726. The Document may include Warranty Disclaimers next to the notice
  38727. which states that this License applies to the Document. These
  38728. Warranty Disclaimers are considered to be included by reference in
  38729. this License, but only as regards disclaiming warranties: any other
  38730. implication that these Warranty Disclaimers may have is void and
  38731. has no effect on the meaning of this License.
  38732. 2. VERBATIM COPYING
  38733. You may copy and distribute the Document in any medium, either
  38734. commercially or noncommercially, provided that this License, the
  38735. copyright notices, and the license notice saying this License
  38736. applies to the Document are reproduced in all copies, and that you
  38737. add no other conditions whatsoever to those of this License. You
  38738. may not use technical measures to obstruct or control the reading
  38739. or further copying of the copies you make or distribute. However,
  38740. you may accept compensation in exchange for copies. If you
  38741. distribute a large enough number of copies you must also follow the
  38742. conditions in section 3.
  38743. You may also lend copies, under the same conditions stated above,
  38744. and you may publicly display copies.
  38745. 3. COPYING IN QUANTITY
  38746. If you publish printed copies (or copies in media that commonly
  38747. have printed covers) of the Document, numbering more than 100, and
  38748. the Document's license notice requires Cover Texts, you must
  38749. enclose the copies in covers that carry, clearly and legibly, all
  38750. these Cover Texts: Front-Cover Texts on the front cover, and
  38751. Back-Cover Texts on the back cover. Both covers must also clearly
  38752. and legibly identify you as the publisher of these copies. The
  38753. front cover must present the full title with all words of the title
  38754. equally prominent and visible. You may add other material on the
  38755. covers in addition. Copying with changes limited to the covers, as
  38756. long as they preserve the title of the Document and satisfy these
  38757. conditions, can be treated as verbatim copying in other respects.
  38758. If the required texts for either cover are too voluminous to fit
  38759. legibly, you should put the first ones listed (as many as fit
  38760. reasonably) on the actual cover, and continue the rest onto
  38761. adjacent pages.
  38762. If you publish or distribute Opaque copies of the Document
  38763. numbering more than 100, you must either include a machine-readable
  38764. Transparent copy along with each Opaque copy, or state in or with
  38765. each Opaque copy a computer-network location from which the general
  38766. network-using public has access to download using public-standard
  38767. network protocols a complete Transparent copy of the Document, free
  38768. of added material. If you use the latter option, you must take
  38769. reasonably prudent steps, when you begin distribution of Opaque
  38770. copies in quantity, to ensure that this Transparent copy will
  38771. remain thus accessible at the stated location until at least one
  38772. year after the last time you distribute an Opaque copy (directly or
  38773. through your agents or retailers) of that edition to the public.
  38774. It is requested, but not required, that you contact the authors of
  38775. the Document well before redistributing any large number of copies,
  38776. to give them a chance to provide you with an updated version of the
  38777. Document.
  38778. 4. MODIFICATIONS
  38779. You may copy and distribute a Modified Version of the Document
  38780. under the conditions of sections 2 and 3 above, provided that you
  38781. release the Modified Version under precisely this License, with the
  38782. Modified Version filling the role of the Document, thus licensing
  38783. distribution and modification of the Modified Version to whoever
  38784. possesses a copy of it. In addition, you must do these things in
  38785. the Modified Version:
  38786. A. Use in the Title Page (and on the covers, if any) a title
  38787. distinct from that of the Document, and from those of previous
  38788. versions (which should, if there were any, be listed in the
  38789. History section of the Document). You may use the same title
  38790. as a previous version if the original publisher of that
  38791. version gives permission.
  38792. B. List on the Title Page, as authors, one or more persons or
  38793. entities responsible for authorship of the modifications in
  38794. the Modified Version, together with at least five of the
  38795. principal authors of the Document (all of its principal
  38796. authors, if it has fewer than five), unless they release you
  38797. from this requirement.
  38798. C. State on the Title page the name of the publisher of the
  38799. Modified Version, as the publisher.
  38800. D. Preserve all the copyright notices of the Document.
  38801. E. Add an appropriate copyright notice for your modifications
  38802. adjacent to the other copyright notices.
  38803. F. Include, immediately after the copyright notices, a license
  38804. notice giving the public permission to use the Modified
  38805. Version under the terms of this License, in the form shown in
  38806. the Addendum below.
  38807. G. Preserve in that license notice the full lists of Invariant
  38808. Sections and required Cover Texts given in the Document's
  38809. license notice.
  38810. H. Include an unaltered copy of this License.
  38811. I. Preserve the section Entitled "History", Preserve its Title,
  38812. and add to it an item stating at least the title, year, new
  38813. authors, and publisher of the Modified Version as given on the
  38814. Title Page. If there is no section Entitled "History" in the
  38815. Document, create one stating the title, year, authors, and
  38816. publisher of the Document as given on its Title Page, then add
  38817. an item describing the Modified Version as stated in the
  38818. previous sentence.
  38819. J. Preserve the network location, if any, given in the Document
  38820. for public access to a Transparent copy of the Document, and
  38821. likewise the network locations given in the Document for
  38822. previous versions it was based on. These may be placed in the
  38823. "History" section. You may omit a network location for a work
  38824. that was published at least four years before the Document
  38825. itself, or if the original publisher of the version it refers
  38826. to gives permission.
  38827. K. For any section Entitled "Acknowledgements" or "Dedications",
  38828. Preserve the Title of the section, and preserve in the section
  38829. all the substance and tone of each of the contributor
  38830. acknowledgements and/or dedications given therein.
  38831. L. Preserve all the Invariant Sections of the Document, unaltered
  38832. in their text and in their titles. Section numbers or the
  38833. equivalent are not considered part of the section titles.
  38834. M. Delete any section Entitled "Endorsements". Such a section
  38835. may not be included in the Modified Version.
  38836. N. Do not retitle any existing section to be Entitled
  38837. "Endorsements" or to conflict in title with any Invariant
  38838. Section.
  38839. O. Preserve any Warranty Disclaimers.
  38840. If the Modified Version includes new front-matter sections or
  38841. appendices that qualify as Secondary Sections and contain no
  38842. material copied from the Document, you may at your option designate
  38843. some or all of these sections as invariant. To do this, add their
  38844. titles to the list of Invariant Sections in the Modified Version's
  38845. license notice. These titles must be distinct from any other
  38846. section titles.
  38847. You may add a section Entitled "Endorsements", provided it contains
  38848. nothing but endorsements of your Modified Version by various
  38849. parties--for example, statements of peer review or that the text
  38850. has been approved by an organization as the authoritative
  38851. definition of a standard.
  38852. You may add a passage of up to five words as a Front-Cover Text,
  38853. and a passage of up to 25 words as a Back-Cover Text, to the end of
  38854. the list of Cover Texts in the Modified Version. Only one passage
  38855. of Front-Cover Text and one of Back-Cover Text may be added by (or
  38856. through arrangements made by) any one entity. If the Document
  38857. already includes a cover text for the same cover, previously added
  38858. by you or by arrangement made by the same entity you are acting on
  38859. behalf of, you may not add another; but you may replace the old
  38860. one, on explicit permission from the previous publisher that added
  38861. the old one.
  38862. The author(s) and publisher(s) of the Document do not by this
  38863. License give permission to use their names for publicity for or to
  38864. assert or imply endorsement of any Modified Version.
  38865. 5. COMBINING DOCUMENTS
  38866. You may combine the Document with other documents released under
  38867. this License, under the terms defined in section 4 above for
  38868. modified versions, provided that you include in the combination all
  38869. of the Invariant Sections of all of the original documents,
  38870. unmodified, and list them all as Invariant Sections of your
  38871. combined work in its license notice, and that you preserve all
  38872. their Warranty Disclaimers.
  38873. The combined work need only contain one copy of this License, and
  38874. multiple identical Invariant Sections may be replaced with a single
  38875. copy. If there are multiple Invariant Sections with the same name
  38876. but different contents, make the title of each such section unique
  38877. by adding at the end of it, in parentheses, the name of the
  38878. original author or publisher of that section if known, or else a
  38879. unique number. Make the same adjustment to the section titles in
  38880. the list of Invariant Sections in the license notice of the
  38881. combined work.
  38882. In the combination, you must combine any sections Entitled
  38883. "History" in the various original documents, forming one section
  38884. Entitled "History"; likewise combine any sections Entitled
  38885. "Acknowledgements", and any sections Entitled "Dedications". You
  38886. must delete all sections Entitled "Endorsements."
  38887. 6. COLLECTIONS OF DOCUMENTS
  38888. You may make a collection consisting of the Document and other
  38889. documents released under this License, and replace the individual
  38890. copies of this License in the various documents with a single copy
  38891. that is included in the collection, provided that you follow the
  38892. rules of this License for verbatim copying of each of the documents
  38893. in all other respects.
  38894. You may extract a single document from such a collection, and
  38895. distribute it individually under this License, provided you insert
  38896. a copy of this License into the extracted document, and follow this
  38897. License in all other respects regarding verbatim copying of that
  38898. document.
  38899. 7. AGGREGATION WITH INDEPENDENT WORKS
  38900. A compilation of the Document or its derivatives with other
  38901. separate and independent documents or works, in or on a volume of a
  38902. storage or distribution medium, is called an "aggregate" if the
  38903. copyright resulting from the compilation is not used to limit the
  38904. legal rights of the compilation's users beyond what the individual
  38905. works permit. When the Document is included in an aggregate, this
  38906. License does not apply to the other works in the aggregate which
  38907. are not themselves derivative works of the Document.
  38908. If the Cover Text requirement of section 3 is applicable to these
  38909. copies of the Document, then if the Document is less than one half
  38910. of the entire aggregate, the Document's Cover Texts may be placed
  38911. on covers that bracket the Document within the aggregate, or the
  38912. electronic equivalent of covers if the Document is in electronic
  38913. form. Otherwise they must appear on printed covers that bracket
  38914. the whole aggregate.
  38915. 8. TRANSLATION
  38916. Translation is considered a kind of modification, so you may
  38917. distribute translations of the Document under the terms of section
  38918. 4. Replacing Invariant Sections with translations requires special
  38919. permission from their copyright holders, but you may include
  38920. translations of some or all Invariant Sections in addition to the
  38921. original versions of these Invariant Sections. You may include a
  38922. translation of this License, and all the license notices in the
  38923. Document, and any Warranty Disclaimers, provided that you also
  38924. include the original English version of this License and the
  38925. original versions of those notices and disclaimers. In case of a
  38926. disagreement between the translation and the original version of
  38927. this License or a notice or disclaimer, the original version will
  38928. prevail.
  38929. If a section in the Document is Entitled "Acknowledgements",
  38930. "Dedications", or "History", the requirement (section 4) to
  38931. Preserve its Title (section 1) will typically require changing the
  38932. actual title.
  38933. 9. TERMINATION
  38934. You may not copy, modify, sublicense, or distribute the Document
  38935. except as expressly provided under this License. Any attempt
  38936. otherwise to copy, modify, sublicense, or distribute it is void,
  38937. and will automatically terminate your rights under this License.
  38938. However, if you cease all violation of this License, then your
  38939. license from a particular copyright holder is reinstated (a)
  38940. provisionally, unless and until the copyright holder explicitly and
  38941. finally terminates your license, and (b) permanently, if the
  38942. copyright holder fails to notify you of the violation by some
  38943. reasonable means prior to 60 days after the cessation.
  38944. Moreover, your license from a particular copyright holder is
  38945. reinstated permanently if the copyright holder notifies you of the
  38946. violation by some reasonable means, this is the first time you have
  38947. received notice of violation of this License (for any work) from
  38948. that copyright holder, and you cure the violation prior to 30 days
  38949. after your receipt of the notice.
  38950. Termination of your rights under this section does not terminate
  38951. the licenses of parties who have received copies or rights from you
  38952. under this License. If your rights have been terminated and not
  38953. permanently reinstated, receipt of a copy of some or all of the
  38954. same material does not give you any rights to use it.
  38955. 10. FUTURE REVISIONS OF THIS LICENSE
  38956. The Free Software Foundation may publish new, revised versions of
  38957. the GNU Free Documentation License from time to time. Such new
  38958. versions will be similar in spirit to the present version, but may
  38959. differ in detail to address new problems or concerns. See
  38960. <http://www.gnu.org/copyleft/>.
  38961. Each version of the License is given a distinguishing version
  38962. number. If the Document specifies that a particular numbered
  38963. version of this License "or any later version" applies to it, you
  38964. have the option of following the terms and conditions either of
  38965. that specified version or of any later version that has been
  38966. published (not as a draft) by the Free Software Foundation. If the
  38967. Document does not specify a version number of this License, you may
  38968. choose any version ever published (not as a draft) by the Free
  38969. Software Foundation. If the Document specifies that a proxy can
  38970. decide which future versions of this License can be used, that
  38971. proxy's public statement of acceptance of a version permanently
  38972. authorizes you to choose that version for the Document.
  38973. 11. RELICENSING
  38974. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  38975. World Wide Web server that publishes copyrightable works and also
  38976. provides prominent facilities for anybody to edit those works. A
  38977. public wiki that anybody can edit is an example of such a server.
  38978. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  38979. site means any set of copyrightable works thus published on the MMC
  38980. site.
  38981. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  38982. license published by Creative Commons Corporation, a not-for-profit
  38983. corporation with a principal place of business in San Francisco,
  38984. California, as well as future copyleft versions of that license
  38985. published by that same organization.
  38986. "Incorporate" means to publish or republish a Document, in whole or
  38987. in part, as part of another Document.
  38988. An MMC is "eligible for relicensing" if it is licensed under this
  38989. License, and if all works that were first published under this
  38990. License somewhere other than this MMC, and subsequently
  38991. incorporated in whole or in part into the MMC, (1) had no cover
  38992. texts or invariant sections, and (2) were thus incorporated prior
  38993. to November 1, 2008.
  38994. The operator of an MMC Site may republish an MMC contained in the
  38995. site under CC-BY-SA on the same site at any time before August 1,
  38996. 2009, provided the MMC is eligible for relicensing.
  38997. ADDENDUM: How to use this License for your documents
  38998. ====================================================
  38999. To use this License in a document you have written, include a copy of
  39000. the License in the document and put the following copyright and license
  39001. notices just after the title page:
  39002. Copyright (C) YEAR YOUR NAME.
  39003. Permission is granted to copy, distribute and/or modify this document
  39004. under the terms of the GNU Free Documentation License, Version 1.3
  39005. or any later version published by the Free Software Foundation;
  39006. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  39007. Texts. A copy of the license is included in the section entitled ``GNU
  39008. Free Documentation License''.
  39009. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  39010. Texts, replace the "with...Texts." line with this:
  39011. with the Invariant Sections being LIST THEIR TITLES, with
  39012. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  39013. being LIST.
  39014. If you have Invariant Sections without Cover Texts, or some other
  39015. combination of the three, merge those two alternatives to suit the
  39016. situation.
  39017. If your document contains nontrivial examples of program code, we
  39018. recommend releasing these examples in parallel under your choice of free
  39019. software license, such as the GNU General Public License, to permit
  39020. their use in free software.
  39021. 
  39022. File: gdb.info, Node: Concept Index, Next: Command and Variable Index, Prev: GNU Free Documentation License, Up: Top
  39023. Concept Index
  39024. *************
  39025. �[index�]
  39026. * Menu:
  39027. * '!' packet: Packets. (line 49)
  39028. * "No symbol "foo" in current context": Variables. (line 122)
  39029. * '#' in Modula-2: GDB/M2. (line 18)
  39030. * '$': Value History. (line 13)
  39031. * '$$': Value History. (line 13)
  39032. * '$_' and 'info breakpoints': Set Breaks. (line 133)
  39033. * '$_' and 'info line': Machine Code. (line 34)
  39034. * '$_', '$__', and value history: Memory. (line 119)
  39035. * '&', background execution of commands: Background Execution.
  39036. (line 16)
  39037. * '--annotate': Mode Options. (line 121)
  39038. * '--args': Mode Options. (line 134)
  39039. * '--attach', 'gdbserver' option: Server. (line 86)
  39040. * '--batch': Mode Options. (line 44)
  39041. * '--batch-silent': Mode Options. (line 62)
  39042. * '--baud': Mode Options. (line 140)
  39043. * '--cd': Mode Options. (line 101)
  39044. * '--command': File Options. (line 51)
  39045. * '--configuration': Mode Options. (line 184)
  39046. * '--core': File Options. (line 43)
  39047. * '--data-directory': Mode Options. (line 106)
  39048. * '--debug', 'gdbserver' option: Server. (line 146)
  39049. * '--debug-format', 'gdbserver' option: Server. (line 152)
  39050. * '--directory': File Options. (line 77)
  39051. * '--eval-command': File Options. (line 57)
  39052. * '--exec': File Options. (line 35)
  39053. * '--fullname': Mode Options. (line 111)
  39054. * '--init-command': File Options. (line 67)
  39055. * '--init-eval-command': File Options. (line 72)
  39056. * '--interpreter': Mode Options. (line 159)
  39057. * '--multi', 'gdbserver' option: Connecting. (line 45)
  39058. * '--nh': Mode Options. (line 34)
  39059. * '--nowindows': Mode Options. (line 91)
  39060. * '--nx': Mode Options. (line 11)
  39061. * '--once', 'gdbserver' option: Server. (line 126)
  39062. * '--pid': File Options. (line 47)
  39063. * '--quiet': Mode Options. (line 40)
  39064. * '--readnever', command-line option: File Options. (line 87)
  39065. * '--readnow': File Options. (line 81)
  39066. * '--remote-debug', 'gdbserver' option: Server. (line 147)
  39067. * '--return-child-result': Mode Options. (line 74)
  39068. * '--se': File Options. (line 39)
  39069. * '--selftest': Server. (line 186)
  39070. * '--silent': Mode Options. (line 40)
  39071. * '--statistics': Mode Options. (line 176)
  39072. * '--symbols': File Options. (line 31)
  39073. * '--tty': Mode Options. (line 149)
  39074. * '--tui': Mode Options. (line 152)
  39075. * '--version': Mode Options. (line 180)
  39076. * '--windows': Mode Options. (line 97)
  39077. * '--with-gdb-datadir': Data Files. (line 19)
  39078. * '--with-relocated-sources': Source Path. (line 88)
  39079. * '--with-sysroot': Files. (line 453)
  39080. * '--wrapper', 'gdbserver' option: Server. (line 165)
  39081. * '--write': Mode Options. (line 171)
  39082. * '-b': Mode Options. (line 140)
  39083. * '-c': File Options. (line 43)
  39084. * '-d': File Options. (line 77)
  39085. * '-D': Mode Options. (line 106)
  39086. * '-e': File Options. (line 35)
  39087. * '-ex': File Options. (line 57)
  39088. * '-f': Mode Options. (line 111)
  39089. * '-iex': File Options. (line 72)
  39090. * '-info-gdb-mi-command': GDB/MI Support Commands.
  39091. (line 14)
  39092. * '-ix': File Options. (line 67)
  39093. * '-l': Mode Options. (line 144)
  39094. * '-n': Mode Options. (line 11)
  39095. * '-nw': Mode Options. (line 91)
  39096. * '-p': File Options. (line 47)
  39097. * '-q': Mode Options. (line 40)
  39098. * '-r': File Options. (line 81)
  39099. * '-readnever', option for symbol-file command: Files. (line 101)
  39100. * '-s': File Options. (line 31)
  39101. * '-t': Mode Options. (line 149)
  39102. * '-w': Mode Options. (line 97)
  39103. * '-x': File Options. (line 51)
  39104. * '.', Modula-2 scope operator: M2 Scope. (line 6)
  39105. * '.build-id' directory: Separate Debug Files.
  39106. (line 6)
  39107. * '.debug' subdirectories: Separate Debug Files.
  39108. (line 6)
  39109. * '.debug_gdb_scripts' section: dotdebug_gdb_scripts section.
  39110. (line 6)
  39111. * '.gdbinit': Startup. (line 65)
  39112. * '.gdb_index' section: Index Files. (line 6)
  39113. * .gdb_index section format: Index Section Format.
  39114. (line 6)
  39115. * '.gnu_debugdata' section: MiniDebugInfo. (line 6)
  39116. * '.gnu_debuglink' sections: Separate Debug Files.
  39117. (line 79)
  39118. * '.note.gnu.build-id' sections: Separate Debug Files.
  39119. (line 95)
  39120. * '.o' files, reading symbols from: Files. (line 146)
  39121. * /proc: Process Information.
  39122. (line 6)
  39123. * <architecture>: Target Description Format.
  39124. (line 72)
  39125. * '<compatible>': Target Description Format.
  39126. (line 95)
  39127. * <feature>: Target Description Format.
  39128. (line 119)
  39129. * <flags>: Target Description Format.
  39130. (line 163)
  39131. * <not saved> values: Registers. (line 106)
  39132. * '<osabi>': Target Description Format.
  39133. (line 82)
  39134. * <reg>: Target Description Format.
  39135. (line 222)
  39136. * <struct>: Target Description Format.
  39137. (line 163)
  39138. * <union>: Target Description Format.
  39139. (line 153)
  39140. * <vector>: Target Description Format.
  39141. (line 146)
  39142. * '?' packet: Packets. (line 58)
  39143. * '_NSPrintForDebugger', and printing Objective-C objects: The Print Command with Objective-C.
  39144. (line 11)
  39145. * {TYPE}: Expressions. (line 41)
  39146. * 'A' packet: Packets. (line 65)
  39147. * AArch64 support: AArch64. (line 6)
  39148. * AArch64 SVE.: AArch64. (line 19)
  39149. * abbreviation: Command Syntax. (line 13)
  39150. * acknowledgment, for GDB remote: Packet Acknowledgment.
  39151. (line 6)
  39152. * active targets: Active Targets. (line 6)
  39153. * Ada: Ada. (line 6)
  39154. * Ada exception catching: Set Catchpoints. (line 66)
  39155. * Ada exception handlers catching: Set Catchpoints. (line 83)
  39156. * Ada mode, general: Ada Mode Intro. (line 6)
  39157. * Ada settings: Ada Settings. (line 6)
  39158. * Ada task switching: Ada Tasks. (line 115)
  39159. * Ada tasking and core file debugging: Ada Tasks and Core Files.
  39160. (line 6)
  39161. * Ada, deviations from: Additions to Ada. (line 6)
  39162. * Ada, omissions from: Omissions from Ada. (line 6)
  39163. * Ada, problems: Ada Glitches. (line 6)
  39164. * Ada, tasking: Ada Tasks. (line 6)
  39165. * add new commands for external monitor: Connecting. (line 272)
  39166. * address locations: Address Locations. (line 6)
  39167. * address of a symbol: Symbols. (line 85)
  39168. * address size for remote targets: Remote Configuration.
  39169. (line 12)
  39170. * addressable memory unit: Memory. (line 133)
  39171. * aggregates (Ada): Omissions from Ada. (line 44)
  39172. * AIX shared library debugging: Debugging Output. (line 30)
  39173. * AIX threads: Debugging Output. (line 36)
  39174. * aliases for commands: Aliases. (line 6)
  39175. * alignment of remote memory accesses: Packets. (line 247)
  39176. * all-stop mode: All-Stop Mode. (line 6)
  39177. * Alpha stack: MIPS. (line 6)
  39178. * ambiguous expressions: Ambiguous Expressions.
  39179. (line 6)
  39180. * annotations: Annotations Overview.
  39181. (line 6)
  39182. * annotations for errors, warnings and interrupts: Errors. (line 6)
  39183. * annotations for invalidation messages: Invalidation. (line 6)
  39184. * annotations for prompts: Prompting. (line 6)
  39185. * annotations for running programs: Annotations for Running.
  39186. (line 6)
  39187. * annotations for source display: Source Annotations. (line 6)
  39188. * append data to a file: Dump/Restore Files. (line 6)
  39189. * Application Data Integrity: Sparc64. (line 5)
  39190. * apply a command to all frames (ignoring errors and empty output): Frame Apply.
  39191. (line 89)
  39192. * apply a command to all frames of all threads (ignoring errors and empty output): Threads.
  39193. (line 226)
  39194. * apply command to all threads (ignoring errors and empty output): Threads.
  39195. (line 222)
  39196. * apply command to several frames: Frame Apply. (line 6)
  39197. * apply command to several threads: Threads. (line 187)
  39198. * ARC EM: ARC. (line 6)
  39199. * ARC HS: ARC. (line 6)
  39200. * ARC specific commands: ARC. (line 6)
  39201. * ARC600: ARC. (line 6)
  39202. * ARC700: ARC. (line 6)
  39203. * architecture debugging info: Debugging Output. (line 23)
  39204. * argument count in user-defined commands: Define. (line 25)
  39205. * arguments (to your program): Arguments. (line 6)
  39206. * arguments, to 'gdbserver': Server. (line 34)
  39207. * arguments, to user-defined commands: Define. (line 6)
  39208. * ARM 32-bit mode: ARM. (line 16)
  39209. * ARM AArch64: Debugging Output. (line 17)
  39210. * array aggregates (Ada): Omissions from Ada. (line 44)
  39211. * arrays: Arrays. (line 6)
  39212. * arrays in expressions: Expressions. (line 13)
  39213. * artificial array: Arrays. (line 6)
  39214. * assembly instructions: Machine Code. (line 43)
  39215. * assignment: Assignment. (line 6)
  39216. * async output in GDB/MI: GDB/MI Output Syntax.
  39217. (line 98)
  39218. * async records in GDB/MI: GDB/MI Async Records.
  39219. (line 6)
  39220. * asynchronous execution: Background Execution.
  39221. (line 6)
  39222. * asynchronous execution, and process record and replay: Process Record and Replay.
  39223. (line 95)
  39224. * AT&T disassembly flavor: Machine Code. (line 237)
  39225. * attach: Attach. (line 6)
  39226. * attach to a program, 'gdbserver': Server. (line 86)
  39227. * auto-loading: Auto-loading. (line 6)
  39228. * auto-loading extensions: Auto-loading extensions.
  39229. (line 6)
  39230. * auto-loading init file in the current directory: Init File in the Current Directory.
  39231. (line 6)
  39232. * auto-loading libthread_db.so.1: libthread_db.so.1 file.
  39233. (line 6)
  39234. * auto-loading safe-path: Auto-loading safe path.
  39235. (line 6)
  39236. * auto-loading verbose mode: Auto-loading verbose mode.
  39237. (line 6)
  39238. * auto-retry, for remote TCP target: Remote Configuration.
  39239. (line 131)
  39240. * automatic display: Auto Display. (line 6)
  39241. * automatic hardware breakpoints: Set Breaks. (line 296)
  39242. * automatic overlay debugging: Automatic Overlay Debugging.
  39243. (line 6)
  39244. * automatic thread selection: All-Stop Mode. (line 28)
  39245. * auxiliary vector: OS Information. (line 9)
  39246. * AVR: AVR. (line 6)
  39247. * 'b' packet: Packets. (line 76)
  39248. * 'B' packet: Packets. (line 91)
  39249. * background execution: Background Execution.
  39250. (line 6)
  39251. * backtrace beyond 'main' function: Backtrace. (line 109)
  39252. * backtrace limit: Backtrace. (line 146)
  39253. * base name differences: Files. (line 520)
  39254. * baud rate for remote targets: Remote Configuration.
  39255. (line 21)
  39256. * 'bc' packet: Packets. (line 96)
  39257. * bcache statistics: Maintenance Commands.
  39258. (line 328)
  39259. * bits in remote address: Remote Configuration.
  39260. (line 12)
  39261. * blocks in guile: Blocks In Guile. (line 6)
  39262. * blocks in python: Blocks In Python. (line 6)
  39263. * bookmark: Checkpoint/Restart. (line 6)
  39264. * boundary violations, Intel MPX: Signals. (line 197)
  39265. * branch trace configuration format: Branch Trace Configuration Format.
  39266. (line 6)
  39267. * branch trace format: Branch Trace Format.
  39268. (line 6)
  39269. * branch trace store: Process Record and Replay.
  39270. (line 64)
  39271. * break in overloaded functions: Debugging C Plus Plus.
  39272. (line 9)
  39273. * break on a system call.: Set Catchpoints. (line 111)
  39274. * break on fork/exec: Set Catchpoints. (line 107)
  39275. * BREAK signal instead of Ctrl-C: Remote Configuration.
  39276. (line 36)
  39277. * breakpoint address adjusted: Breakpoint-related Warnings.
  39278. (line 6)
  39279. * breakpoint at static probe point: Linespec Locations. (line 65)
  39280. * breakpoint commands: Break Commands. (line 6)
  39281. * breakpoint commands for GDB/MI: GDB/MI Breakpoint Commands.
  39282. (line 6)
  39283. * breakpoint commands, in remote protocol: General Query Packets.
  39284. (line 995)
  39285. * breakpoint conditions: Conditions. (line 6)
  39286. * breakpoint kinds, ARM: ARM Breakpoint Kinds.
  39287. (line 6)
  39288. * breakpoint kinds, MIPS: MIPS Breakpoint Kinds.
  39289. (line 6)
  39290. * breakpoint lists: Breakpoints. (line 45)
  39291. * breakpoint numbers: Breakpoints. (line 38)
  39292. * breakpoint on events: Breakpoints. (line 30)
  39293. * breakpoint on memory address: Breakpoints. (line 17)
  39294. * breakpoint on variable modification: Breakpoints. (line 17)
  39295. * breakpoint ranges: Breakpoints. (line 45)
  39296. * 'breakpoint' subroutine, remote: Stub Contents. (line 31)
  39297. * breakpointing Ada elaboration code: Stopping Before Main Program.
  39298. (line 6)
  39299. * breakpoints: Breakpoints. (line 6)
  39300. * breakpoints and tasks, in Ada: Ada Tasks. (line 135)
  39301. * breakpoints and threads: Thread-Specific Breakpoints.
  39302. (line 10)
  39303. * breakpoints at functions matching a regexp: Set Breaks. (line 90)
  39304. * breakpoints in guile: Breakpoints In Guile.
  39305. (line 6)
  39306. * breakpoints in overlays: Overlay Commands. (line 91)
  39307. * breakpoints in python: Breakpoints In Python.
  39308. (line 6)
  39309. * breakpoints, multiple locations: Set Breaks. (line 200)
  39310. * 'bs' packet: Packets. (line 102)
  39311. * bug criteria: Bug Criteria. (line 6)
  39312. * bug reports: Bug Reporting. (line 6)
  39313. * bugs in GDB: GDB Bugs. (line 6)
  39314. * build ID sections: Separate Debug Files.
  39315. (line 95)
  39316. * build ID, and separate debugging files: Separate Debug Files.
  39317. (line 6)
  39318. * building GDB, requirements for: Requirements. (line 6)
  39319. * built-in simulator target: Target Commands. (line 73)
  39320. * builtin Go functions: Go. (line 31)
  39321. * builtin Go types: Go. (line 28)
  39322. * C and C++: C. (line 6)
  39323. * C and C++ checks: C Checks. (line 6)
  39324. * C and C++ constants: C Constants. (line 6)
  39325. * C and C++ defaults: C Defaults. (line 6)
  39326. * C and C++ operators: C Operators. (line 6)
  39327. * 'c' packet: Packets. (line 109)
  39328. * 'C' packet: Packets. (line 118)
  39329. * C++: C. (line 10)
  39330. * C++ compilers: C Plus Plus Expressions.
  39331. (line 8)
  39332. * C++ demangling: Debugging C Plus Plus.
  39333. (line 36)
  39334. * C++ exception handling: Debugging C Plus Plus.
  39335. (line 20)
  39336. * C++ overload debugging info: Debugging Output. (line 147)
  39337. * C++ scope resolution: Variables. (line 90)
  39338. * C++ symbol decoding style: Print Settings. (line 427)
  39339. * C++ symbol display: Debugging C Plus Plus.
  39340. (line 40)
  39341. * caching data of targets: Caching Target Data.
  39342. (line 6)
  39343. * caching of bfd objects: File Caching. (line 6)
  39344. * caching of opened files: File Caching. (line 6)
  39345. * call dummy stack unwinding: Calling. (line 36)
  39346. * call dummy stack unwinding on unhandled exception.: Calling.
  39347. (line 47)
  39348. * call overloaded functions: C Plus Plus Expressions.
  39349. (line 26)
  39350. * call stack: Stack. (line 9)
  39351. * call stack traces: Backtrace. (line 6)
  39352. * call-clobbered registers: Registers. (line 106)
  39353. * caller-saved registers: Registers. (line 106)
  39354. * calling functions: Calling. (line 6)
  39355. * calling make: Shell Commands. (line 21)
  39356. * case sensitivity in symbol names: Symbols. (line 27)
  39357. * case-insensitive symbol names: Symbols. (line 27)
  39358. * casts, in expressions: Expressions. (line 26)
  39359. * casts, to view memory: Expressions. (line 41)
  39360. * catch Ada exceptions: Set Catchpoints. (line 66)
  39361. * catch Ada exceptions when handled: Set Catchpoints. (line 83)
  39362. * catch syscalls from inferior, remote request: General Query Packets.
  39363. (line 401)
  39364. * catchpoints: Breakpoints. (line 30)
  39365. * catchpoints, setting: Set Catchpoints. (line 6)
  39366. * Cell Broadband Engine: SPU. (line 6)
  39367. * change GDB's working directory: Working Directory. (line 32)
  39368. * change inferior's working directory: Working Directory. (line 13)
  39369. * character sets: Character Sets. (line 6)
  39370. * charset: Character Sets. (line 6)
  39371. * checkpoint: Checkpoint/Restart. (line 6)
  39372. * checkpoints and process id: Checkpoint/Restart. (line 76)
  39373. * checks, range: Type Checking. (line 44)
  39374. * checks, type: Checks. (line 23)
  39375. * checksum, for GDB remote: Overview. (line 21)
  39376. * choosing target byte order: Byte Order. (line 6)
  39377. * circular trace buffer: Starting and Stopping Trace Experiments.
  39378. (line 80)
  39379. * clearing breakpoints, watchpoints, catchpoints: Delete Breaks.
  39380. (line 6)
  39381. * close, file-i/o system call: close. (line 6)
  39382. * closest symbol and offset for an address: Symbols. (line 95)
  39383. * code address and its source line: Machine Code. (line 28)
  39384. * code compression, MIPS: MIPS. (line 49)
  39385. * COFF/PE exported symbols: Debugging Output. (line 50)
  39386. * collected data discarded: Starting and Stopping Trace Experiments.
  39387. (line 6)
  39388. * colon, doubled as scope operator: M2 Scope. (line 6)
  39389. * colon-colon, context for variables/functions: Variables. (line 44)
  39390. * colors: Output Styling. (line 6)
  39391. * command editing: Readline Bare Essentials.
  39392. (line 6)
  39393. * command files: Command Files. (line 6)
  39394. * command history: Command History. (line 6)
  39395. * command hooks: Hooks. (line 6)
  39396. * command interpreters: Interpreters. (line 6)
  39397. * command line editing: Editing. (line 6)
  39398. * command scripts, debugging: Messages/Warnings. (line 65)
  39399. * command tracing: Messages/Warnings. (line 60)
  39400. * commands for C++: Debugging C Plus Plus.
  39401. (line 6)
  39402. * commands in guile: Commands In Guile. (line 6)
  39403. * commands in python: Commands In Python. (line 6)
  39404. * commands to access guile: Guile Commands. (line 6)
  39405. * commands to access python: Python Commands. (line 6)
  39406. * comment: Command Syntax. (line 37)
  39407. * 'COMMON' blocks, Fortran: Special Fortran Commands.
  39408. (line 9)
  39409. * common targets: Target Commands. (line 46)
  39410. * compatibility, GDB/MI and CLI: GDB/MI Compatibility with CLI.
  39411. (line 6)
  39412. * compilation directory: Source Path. (line 106)
  39413. * compile C++ type conversion: Compiling and Injecting Code.
  39414. (line 89)
  39415. * compile command debugging info: Compiling and Injecting Code.
  39416. (line 81)
  39417. * compile command driver filename override: Compiling and Injecting Code.
  39418. (line 299)
  39419. * compile command options override: Compiling and Injecting Code.
  39420. (line 124)
  39421. * compiling code: Compiling and Injecting Code.
  39422. (line 6)
  39423. * completion: Completion. (line 6)
  39424. * completion of Guile commands: Commands In Guile. (line 100)
  39425. * completion of Python commands: Commands In Python. (line 70)
  39426. * completion of quoted strings: Completion. (line 82)
  39427. * completion of structure field names: Completion. (line 134)
  39428. * completion of union field names: Completion. (line 134)
  39429. * compressed debug sections: Requirements. (line 110)
  39430. * conditional breakpoints: Conditions. (line 6)
  39431. * conditional tracepoints: Tracepoint Conditions.
  39432. (line 6)
  39433. * configuring GDB: Running Configure. (line 6)
  39434. * confirmation: Messages/Warnings. (line 49)
  39435. * connection timeout, for remote TCP target: Remote Configuration.
  39436. (line 147)
  39437. * console i/o as part of file-i/o: Console I/O. (line 6)
  39438. * console interpreter: Interpreters. (line 21)
  39439. * console output in GDB/MI: GDB/MI Output Syntax.
  39440. (line 106)
  39441. * constants, in file-i/o protocol: Constants. (line 6)
  39442. * continuing: Continuing and Stepping.
  39443. (line 6)
  39444. * continuing threads: Thread Stops. (line 6)
  39445. * control C, and remote debugging: Bootstrapping. (line 25)
  39446. * controlling terminal: Input/Output. (line 23)
  39447. * convenience functions: Convenience Funs. (line 6)
  39448. * convenience functions in python: Functions In Python.
  39449. (line 6)
  39450. * convenience variables: Convenience Vars. (line 6)
  39451. * convenience variables for tracepoints: Tracepoint Variables.
  39452. (line 6)
  39453. * convenience variables, and trace state variables: Trace State Variables.
  39454. (line 17)
  39455. * convenience variables, initializing: Convenience Vars. (line 42)
  39456. * core dump file: Files. (line 6)
  39457. * core dump file target: Target Commands. (line 54)
  39458. * crash of debugger: Bug Criteria. (line 9)
  39459. * CRC algorithm definition: Separate Debug Files.
  39460. (line 139)
  39461. * CRC of memory block, remote request: General Query Packets.
  39462. (line 65)
  39463. * CRIS: CRIS. (line 6)
  39464. * CRIS mode: CRIS. (line 26)
  39465. * CRIS version: CRIS. (line 10)
  39466. * Ctrl-BREAK, MS-Windows: Cygwin Native. (line 9)
  39467. * ctrl-c message, in file-i/o protocol: The Ctrl-C Message. (line 6)
  39468. * current Ada task ID: Ada Tasks. (line 105)
  39469. * current directory: Source Path. (line 106)
  39470. * current Go package: Go. (line 11)
  39471. * current thread: Threads. (line 29)
  39472. * current thread, remote request: General Query Packets.
  39473. (line 55)
  39474. * custom JIT debug info: Custom Debug Info. (line 6)
  39475. * Cygwin DLL, debugging: Cygwin Native. (line 60)
  39476. * Cygwin-specific commands: Cygwin Native. (line 6)
  39477. * D: D. (line 6)
  39478. * 'd' packet: Packets. (line 127)
  39479. * 'D' packet: Packets. (line 134)
  39480. * Darwin: Darwin. (line 6)
  39481. * data breakpoints: Breakpoints. (line 17)
  39482. * data manipulation, in GDB/MI: GDB/MI Data Manipulation.
  39483. (line 6)
  39484. * dcache line-size: Caching Target Data.
  39485. (line 60)
  39486. * dcache size: Caching Target Data.
  39487. (line 57)
  39488. * dead names, GNU Hurd: Hurd Native. (line 84)
  39489. * debug expression parser: Debugging Output. (line 152)
  39490. * debug formats and C++: C Plus Plus Expressions.
  39491. (line 8)
  39492. * debug link sections: Separate Debug Files.
  39493. (line 79)
  39494. * debug remote protocol: Debugging Output. (line 159)
  39495. * debugger crash: Bug Criteria. (line 9)
  39496. * debugging agent: In-Process Agent. (line 6)
  39497. * debugging C++ programs: C Plus Plus Expressions.
  39498. (line 8)
  39499. * debugging information directory, global: Separate Debug Files.
  39500. (line 6)
  39501. * debugging information in separate files: Separate Debug Files.
  39502. (line 6)
  39503. * debugging 'libthread_db': Threads. (line 325)
  39504. * debugging multiple processes: Forks. (line 55)
  39505. * debugging optimized code: Optimized Code. (line 6)
  39506. * debugging stub, example: Remote Stub. (line 6)
  39507. * debugging target: Targets. (line 6)
  39508. * debugging the Cygwin DLL: Cygwin Native. (line 60)
  39509. * decimal floating point format: Decimal Floating Point.
  39510. (line 6)
  39511. * default collection action: Tracepoint Actions. (line 142)
  39512. * default data directory: Data Files. (line 19)
  39513. * default source path substitution: Source Path. (line 88)
  39514. * default system root: Files. (line 453)
  39515. * define trace state variable, remote request: Tracepoint Packets.
  39516. (line 121)
  39517. * defining macros interactively: Macros. (line 59)
  39518. * definition of a macro, showing: Macros. (line 47)
  39519. * delete breakpoints: Delete Breaks. (line 41)
  39520. * deleting breakpoints, watchpoints, catchpoints: Delete Breaks.
  39521. (line 6)
  39522. * deliver a signal to a program: Signaling. (line 6)
  39523. * demangle: Symbols. (line 114)
  39524. * demangler crashes: Maintenance Commands.
  39525. (line 146)
  39526. * demangler crashes <1>: Maintenance Commands.
  39527. (line 173)
  39528. * demangler crashes <2>: Maintenance Commands.
  39529. (line 197)
  39530. * demangling C++ names: Print Settings. (line 408)
  39531. * deprecated commands: Maintenance Commands.
  39532. (line 160)
  39533. * derived type of an object, printing: Print Settings. (line 439)
  39534. * descriptor tables display: DJGPP Native. (line 24)
  39535. * detach from task, GNU Hurd: Hurd Native. (line 59)
  39536. * detach from thread, GNU Hurd: Hurd Native. (line 109)
  39537. * direct memory access (DMA) on MS-DOS: DJGPP Native. (line 74)
  39538. * directories for source files: Source Path. (line 6)
  39539. * directory, compilation: Source Path. (line 106)
  39540. * directory, current: Source Path. (line 106)
  39541. * disable address space randomization, remote request: General Query Packets.
  39542. (line 84)
  39543. * disassembler options: Machine Code. (line 222)
  39544. * disconnected tracing: Starting and Stopping Trace Experiments.
  39545. (line 45)
  39546. * displaced stepping debugging info: Debugging Output. (line 75)
  39547. * displaced stepping support: Maintenance Commands.
  39548. (line 112)
  39549. * displaced stepping, and process record and replay: Process Record and Replay.
  39550. (line 90)
  39551. * display command history: Command History. (line 95)
  39552. * display derived types: Print Settings. (line 439)
  39553. * display disabled out of scope: Auto Display. (line 86)
  39554. * display GDB copyright: Help. (line 138)
  39555. * display of expressions: Auto Display. (line 6)
  39556. * display remote monitor communications: Target Commands. (line 107)
  39557. * display remote packets: Debugging Output. (line 159)
  39558. * DJGPP debugging: DJGPP Native. (line 6)
  39559. * DLLs with no debugging symbols: Non-debug DLL Symbols.
  39560. (line 6)
  39561. * do not print frame argument values: Print Settings. (line 154)
  39562. * documentation: Formatting Documentation.
  39563. (line 22)
  39564. * don't repeat command: Define. (line 74)
  39565. * don't repeat Guile command: Commands In Guile. (line 67)
  39566. * don't repeat Python command: Commands In Python. (line 42)
  39567. * DOS file-name semantics of file names.: Files. (line 476)
  39568. * DOS serial data link, remote debugging: DJGPP Native. (line 118)
  39569. * DOS serial port status: DJGPP Native. (line 139)
  39570. * DPMI: DJGPP Native. (line 6)
  39571. * dprintf: Dynamic Printf. (line 6)
  39572. * dump all data collected at tracepoint: tdump. (line 6)
  39573. * dump core from inferior: Core File Generation.
  39574. (line 6)
  39575. * dump data to a file: Dump/Restore Files. (line 6)
  39576. * dump/restore files: Dump/Restore Files. (line 6)
  39577. * DVC register: PowerPC Embedded. (line 6)
  39578. * DWARF compilation units cache: Maintenance Commands.
  39579. (line 394)
  39580. * DWARF DIEs: Debugging Output. (line 56)
  39581. * DWARF frame unwinders: Maintenance Commands.
  39582. (line 408)
  39583. * DWARF Line Tables: Debugging Output. (line 61)
  39584. * DWARF Reading: Debugging Output. (line 68)
  39585. * DWARF-2 CFI and CRIS: CRIS. (line 18)
  39586. * dynamic linking: Files. (line 123)
  39587. * dynamic printf: Dynamic Printf. (line 6)
  39588. * dynamic varobj: GDB/MI Variable Objects.
  39589. (line 166)
  39590. * editing: Editing. (line 15)
  39591. * editing command lines: Readline Bare Essentials.
  39592. (line 6)
  39593. * editing source files: Edit. (line 6)
  39594. * eight-bit characters in strings: Print Settings. (line 353)
  39595. * elaboration phase: Starting. (line 92)
  39596. * ELinOS system-wide configuration script: System-wide Configuration Scripts.
  39597. (line 15)
  39598. * Emacs: Emacs. (line 6)
  39599. * empty response, for unsupported packets: Overview. (line 97)
  39600. * enable/disable a breakpoint: Disabling. (line 6)
  39601. * enabling and disabling probes: Static Probe Points.
  39602. (line 52)
  39603. * entering numbers: Numbers. (line 6)
  39604. * environment (of your program): Environment. (line 6)
  39605. * errno values, in file-i/o protocol: Errno Values. (line 6)
  39606. * error on valid input: Bug Criteria. (line 12)
  39607. * event debugging info: Debugging Output. (line 81)
  39608. * event designators: Event Designators. (line 6)
  39609. * event handling: Set Catchpoints. (line 6)
  39610. * examine process image: Process Information.
  39611. (line 6)
  39612. * examining data: Data. (line 6)
  39613. * examining memory: Memory. (line 9)
  39614. * exception handlers: Set Catchpoints. (line 6)
  39615. * exceptions, guile: Guile Exception Handling.
  39616. (line 6)
  39617. * exceptions, python: Exception Handling. (line 6)
  39618. * exec events, remote reply: Stop Reply Packets. (line 141)
  39619. * executable file: Files. (line 16)
  39620. * executable file target: Target Commands. (line 50)
  39621. * executable file, for remote target: Remote Configuration.
  39622. (line 102)
  39623. * execute commands from a file: Command Files. (line 17)
  39624. * execute forward or backward in time: Reverse Execution. (line 86)
  39625. * execute remote command, remote request: General Query Packets.
  39626. (line 536)
  39627. * execution, foreground, background and asynchronous: Background Execution.
  39628. (line 6)
  39629. * exiting GDB: Quitting GDB. (line 6)
  39630. * expand macro once: Macros. (line 38)
  39631. * expanding preprocessor macros: Macros. (line 29)
  39632. * explicit locations: Explicit Locations. (line 6)
  39633. * explore type: Data. (line 145)
  39634. * explore value: Data. (line 138)
  39635. * exploring hierarchical data structures: Data. (line 36)
  39636. * expression debugging info: Debugging Output. (line 86)
  39637. * expression parser, debugging info: Debugging Output. (line 152)
  39638. * expressions: Expressions. (line 6)
  39639. * expressions in Ada: Ada. (line 11)
  39640. * expressions in C or C++: C. (line 6)
  39641. * expressions in C++: C Plus Plus Expressions.
  39642. (line 6)
  39643. * expressions in Modula-2: Modula-2. (line 12)
  39644. * extend GDB for remote targets: Connecting. (line 272)
  39645. * extending GDB: Extending GDB. (line 6)
  39646. * extra signal information: Signals. (line 156)
  39647. * 'F' packet: Packets. (line 150)
  39648. * 'F' reply packet: The F Reply Packet. (line 6)
  39649. * 'F' request packet: The F Request Packet.
  39650. (line 6)
  39651. * fast tracepoints: Set Tracepoints. (line 24)
  39652. * fast tracepoints, setting: Create and Delete Tracepoints.
  39653. (line 50)
  39654. * fatal signal: Bug Criteria. (line 9)
  39655. * fatal signals: Signals. (line 15)
  39656. * features of the remote protocol: General Query Packets.
  39657. (line 589)
  39658. * file name canonicalization: Files. (line 520)
  39659. * file transfer: File Transfer. (line 6)
  39660. * file transfer, remote protocol: Host I/O Packets. (line 6)
  39661. * file-i/o examples: File-I/O Examples. (line 6)
  39662. * file-i/o overview: File-I/O Overview. (line 6)
  39663. * File-I/O remote protocol extension: File-I/O Remote Protocol Extension.
  39664. (line 6)
  39665. * file-i/o reply packet: The F Reply Packet. (line 6)
  39666. * file-i/o request packet: The F Request Packet.
  39667. (line 6)
  39668. * filename-display: Backtrace. (line 156)
  39669. * find trace snapshot: tfind. (line 6)
  39670. * flinching: Messages/Warnings. (line 49)
  39671. * float promotion: ABI. (line 34)
  39672. * floating point: Floating Point Hardware.
  39673. (line 6)
  39674. * floating point registers: Registers. (line 15)
  39675. * floating point, MIPS remote: MIPS Embedded. (line 13)
  39676. * focus of debugging: Threads. (line 29)
  39677. * foo: Symbol Errors. (line 54)
  39678. * foreground execution: Background Execution.
  39679. (line 6)
  39680. * fork events, remote reply: Stop Reply Packets. (line 104)
  39681. * fork, debugging programs which call: Forks. (line 6)
  39682. * format options: Print Settings. (line 6)
  39683. * formatted output: Output Formats. (line 6)
  39684. * Fortran: Summary. (line 40)
  39685. * Fortran Defaults: Fortran Defaults. (line 6)
  39686. * Fortran operators and expressions: Fortran Operators. (line 6)
  39687. * Fortran-specific support in GDB: Fortran. (line 6)
  39688. * FR-V shared-library debugging: Debugging Output. (line 179)
  39689. * frame debugging info: Debugging Output. (line 101)
  39690. * frame decorator api: Frame Decorator API.
  39691. (line 6)
  39692. * frame filters api: Frame Filter API. (line 6)
  39693. * frame level: Frames. (line 28)
  39694. * frame number: Frames. (line 28)
  39695. * frame pointer: Frames. (line 21)
  39696. * frame pointer register: Registers. (line 31)
  39697. * frame, definition: Frames. (line 6)
  39698. * frameless execution: Frames. (line 34)
  39699. * frames in guile: Frames In Guile. (line 6)
  39700. * frames in python: Frames In Python. (line 6)
  39701. * free memory information (MS-DOS): DJGPP Native. (line 19)
  39702. * FreeBSD: FreeBSD. (line 6)
  39703. * FreeBSD LWP debug messages: Debugging Output. (line 92)
  39704. * FreeBSD native target debug messages: Debugging Output. (line 97)
  39705. * fstat, file-i/o system call: stat/fstat. (line 6)
  39706. * Fujitsu: Remote Stub. (line 68)
  39707. * full symbol tables, listing GDB's internal: Symbols. (line 601)
  39708. * function call arguments, optimized out: Backtrace. (line 87)
  39709. * function entry/exit, wrong values of variables: Variables. (line 106)
  39710. * functions without line info, and stepping: Continuing and Stepping.
  39711. (line 92)
  39712. * 'g' packet: Packets. (line 155)
  39713. * 'G' packet: Packets. (line 183)
  39714. * 'g++', GNU C++ compiler: C. (line 10)
  39715. * garbled pointers: DJGPP Native. (line 42)
  39716. * GCC and C++: C Plus Plus Expressions.
  39717. (line 8)
  39718. * GDB bugs, reporting: Bug Reporting. (line 6)
  39719. * GDB internal error: Maintenance Commands.
  39720. (line 197)
  39721. * gdb module: Basic Python. (line 28)
  39722. * gdb objects: GDB Scheme Data Types.
  39723. (line 6)
  39724. * GDB reference card: Formatting Documentation.
  39725. (line 6)
  39726. * GDB startup: Startup. (line 6)
  39727. * GDB version number: Help. (line 128)
  39728. * 'gdb.ini': Startup. (line 65)
  39729. * gdb.printing: gdb.printing. (line 6)
  39730. * gdb.prompt: gdb.prompt. (line 6)
  39731. * gdb.types: gdb.types. (line 6)
  39732. * 'gdb.Value': Values From Inferior.
  39733. (line 6)
  39734. * GDB/MI development: GDB/MI Development and Front Ends.
  39735. (line 6)
  39736. * GDB/MI General Design: GDB/MI General Design.
  39737. (line 6)
  39738. * GDB/MI, async records: GDB/MI Async Records.
  39739. (line 6)
  39740. * GDB/MI, breakpoint commands: GDB/MI Breakpoint Commands.
  39741. (line 6)
  39742. * GDB/MI, compatibility with CLI: GDB/MI Compatibility with CLI.
  39743. (line 6)
  39744. * GDB/MI, data manipulation: GDB/MI Data Manipulation.
  39745. (line 6)
  39746. * GDB/MI, input syntax: GDB/MI Input Syntax.
  39747. (line 6)
  39748. * GDB/MI, its purpose: GDB/MI. (line 9)
  39749. * GDB/MI, output syntax: GDB/MI Output Syntax.
  39750. (line 6)
  39751. * GDB/MI, result records: GDB/MI Result Records.
  39752. (line 6)
  39753. * GDB/MI, simple examples: GDB/MI Simple Examples.
  39754. (line 6)
  39755. * GDB/MI, stream records: GDB/MI Stream Records.
  39756. (line 6)
  39757. * gdbarch debugging info: Debugging Output. (line 23)
  39758. * 'GDBHISTFILE', environment variable: Command History. (line 26)
  39759. * 'GDBHISTSIZE', environment variable: Command History. (line 45)
  39760. * 'gdbserver', command-line arguments: Server. (line 34)
  39761. * 'gdbserver', connecting: Connecting. (line 6)
  39762. * gdbserver, search path for 'libthread_db': Server. (line 249)
  39763. * 'gdbserver', 'target extended-remote' mode: Connecting. (line 6)
  39764. * 'gdbserver', 'target remote' mode: Connecting. (line 6)
  39765. * 'gdbserver', types of connections: Connecting. (line 6)
  39766. * GDT: DJGPP Native. (line 24)
  39767. * get thread information block address: General Query Packets.
  39768. (line 303)
  39769. * get thread-local storage address, remote request: General Query Packets.
  39770. (line 271)
  39771. * gettimeofday, file-i/o system call: gettimeofday. (line 6)
  39772. * getting structure elements using gdb.Field objects as subscripts: Values From Inferior.
  39773. (line 40)
  39774. * global debugging information directories: Separate Debug Files.
  39775. (line 6)
  39776. * global thread identifier (GDB): Threads. (line 88)
  39777. * global thread number: Threads. (line 88)
  39778. * GNAT descriptive types: Ada Glitches. (line 57)
  39779. * GNAT encoding: Ada Glitches. (line 57)
  39780. * GNU C++: C. (line 10)
  39781. * GNU Emacs: Emacs. (line 6)
  39782. * GNU Hurd debugging: Hurd Native. (line 6)
  39783. * GNU/Hurd debug messages: Debugging Output. (line 106)
  39784. * GNU/Linux LWP debug messages: Debugging Output. (line 121)
  39785. * GNU/Linux namespaces debug messages: Debugging Output. (line 125)
  39786. * Go (programming language): Go. (line 6)
  39787. * guile api: Guile API. (line 6)
  39788. * guile architectures: Architectures In Guile.
  39789. (line 6)
  39790. * guile auto-loading: Guile Auto-loading. (line 6)
  39791. * guile commands: Guile Commands. (line 6)
  39792. * guile commands <1>: Commands In Guile. (line 6)
  39793. * guile configuration: Guile Configuration.
  39794. (line 6)
  39795. * guile exceptions: Guile Exception Handling.
  39796. (line 6)
  39797. * guile gdb module: Basic Guile. (line 37)
  39798. * guile iterators: Iterators In Guile. (line 6)
  39799. * guile modules: Guile Modules. (line 6)
  39800. * guile pagination: Basic Guile. (line 6)
  39801. * guile parameters: Parameters In Guile.
  39802. (line 6)
  39803. * guile pretty printing api: Guile Pretty Printing API.
  39804. (line 6)
  39805. * guile scripting: Guile. (line 6)
  39806. * guile scripts directory: Guile Introduction. (line 16)
  39807. * guile stdout: Basic Guile. (line 6)
  39808. * guile, working with types: Types In Guile. (line 6)
  39809. * guile, working with values from inferior: Values From Inferior In Guile.
  39810. (line 6)
  39811. * 'H' packet: Packets. (line 193)
  39812. * handling signals: Signals. (line 27)
  39813. * hardware breakpoints: Set Breaks. (line 61)
  39814. * hardware debug registers: Maintenance Commands.
  39815. (line 442)
  39816. * hardware watchpoints: Set Watchpoints. (line 31)
  39817. * hash mark while downloading: Target Commands. (line 98)
  39818. * 'heuristic-fence-post' (Alpha, MIPS): MIPS. (line 14)
  39819. * history events: Event Designators. (line 8)
  39820. * history expansion: History Interaction.
  39821. (line 6)
  39822. * history expansion, turn on/off: Command History. (line 70)
  39823. * history file: Command History. (line 26)
  39824. * history number: Value History. (line 13)
  39825. * history of values printed by GDB: Value History. (line 6)
  39826. * history size: Command History. (line 45)
  39827. * history substitution: Command History. (line 26)
  39828. * hooks, for commands: Hooks. (line 6)
  39829. * hooks, post-command: Hooks. (line 11)
  39830. * hooks, pre-command: Hooks. (line 6)
  39831. * host character set: Character Sets. (line 6)
  39832. * Host I/O, remote protocol: Host I/O Packets. (line 6)
  39833. * how many arguments (user-defined commands): Define. (line 25)
  39834. * HPPA support: HPPA. (line 6)
  39835. * 'i' packet: Packets. (line 207)
  39836. * 'I' packet: Packets. (line 212)
  39837. * i/o: Input/Output. (line 6)
  39838. * I/O registers (Atmel AVR): AVR. (line 10)
  39839. * i386: Remote Stub. (line 56)
  39840. * 'i386-stub.c': Remote Stub. (line 56)
  39841. * IDT: DJGPP Native. (line 24)
  39842. * ignore count (of breakpoint): Conditions. (line 79)
  39843. * in-process agent protocol: In-Process Agent Protocol.
  39844. (line 6)
  39845. * incomplete type: Symbols. (line 345)
  39846. * indentation in structure display: Print Settings. (line 329)
  39847. * index files: Index Files. (line 6)
  39848. * index section format: Index Section Format.
  39849. (line 6)
  39850. * inferior: Inferiors and Programs.
  39851. (line 13)
  39852. * inferior debugging info: Debugging Output. (line 110)
  39853. * inferior events in Python: Events In Python. (line 6)
  39854. * inferior functions, calling: Calling. (line 6)
  39855. * inferior tty: Input/Output. (line 44)
  39856. * inferiors in Python: Inferiors In Python.
  39857. (line 6)
  39858. * infinite recursion in user-defined commands: Define. (line 91)
  39859. * info for known .debug_gdb_scripts-loaded scripts: Maintenance Commands.
  39860. (line 321)
  39861. * info for known object files: Maintenance Commands.
  39862. (line 306)
  39863. * info line, repeated calls: Machine Code. (line 40)
  39864. * info proc cmdline: Process Information.
  39865. (line 41)
  39866. * info proc cwd: Process Information.
  39867. (line 45)
  39868. * info proc exe: Process Information.
  39869. (line 49)
  39870. * info proc files: Process Information.
  39871. (line 53)
  39872. * information about static tracepoint markers: Listing Static Tracepoint Markers.
  39873. (line 6)
  39874. * information about tracepoints: Listing Tracepoints.
  39875. (line 6)
  39876. * inheritance: Debugging C Plus Plus.
  39877. (line 26)
  39878. * init file: Startup. (line 11)
  39879. * init file name: Startup. (line 65)
  39880. * initial frame: Frames. (line 12)
  39881. * initialization file, readline: Readline Init File. (line 6)
  39882. * injecting code: Compiling and Injecting Code.
  39883. (line 6)
  39884. * inline functions, debugging: Inline Functions. (line 6)
  39885. * innermost frame: Frames. (line 12)
  39886. * input syntax for GDB/MI: GDB/MI Input Syntax.
  39887. (line 6)
  39888. * installation: Installing GDB. (line 6)
  39889. * instructions, assembly: Machine Code. (line 43)
  39890. * integral datatypes, in file-i/o protocol: Integral Datatypes.
  39891. (line 6)
  39892. * Intel: Remote Stub. (line 56)
  39893. * Intel disassembly flavor: Machine Code. (line 237)
  39894. * Intel Memory Protection Extensions (MPX).: i386. (line 21)
  39895. * Intel MPX boundary violations: Signals. (line 197)
  39896. * Intel Processor Trace: Process Record and Replay.
  39897. (line 69)
  39898. * interaction, readline: Readline Interaction.
  39899. (line 6)
  39900. * internal commands: Maintenance Commands.
  39901. (line 6)
  39902. * internal errors, control of GDB behavior: Maintenance Commands.
  39903. (line 197)
  39904. * internal GDB breakpoints: Set Breaks. (line 374)
  39905. * interrupt: Quitting GDB. (line 13)
  39906. * interrupt debuggee on MS-Windows: Cygwin Native. (line 9)
  39907. * interrupt remote programs: Remote Configuration.
  39908. (line 36)
  39909. * interrupt remote programs <1>: Remote Configuration.
  39910. (line 108)
  39911. * interrupting remote programs: Connecting. (line 239)
  39912. * interrupting remote targets: Bootstrapping. (line 25)
  39913. * interrupts (remote protocol): Interrupts. (line 6)
  39914. * invalid input: Bug Criteria. (line 16)
  39915. * invoke another interpreter: Interpreters. (line 36)
  39916. * ipa protocol commands: IPA Protocol Commands.
  39917. (line 6)
  39918. * ipa protocol objects: IPA Protocol Objects.
  39919. (line 6)
  39920. * isatty, file-i/o system call: isatty. (line 6)
  39921. * JIT compilation interface: JIT Interface. (line 6)
  39922. * JIT debug info reader: Custom Debug Info. (line 6)
  39923. * just-in-time compilation: JIT Interface. (line 6)
  39924. * just-in-time compilation, debugging messages: Debugging Output.
  39925. (line 117)
  39926. * 'k' packet: Packets. (line 216)
  39927. * kernel crash dump: BSD libkvm Interface.
  39928. (line 6)
  39929. * kernel memory image: BSD libkvm Interface.
  39930. (line 6)
  39931. * kill ring: Readline Killing Commands.
  39932. (line 18)
  39933. * killing text: Readline Killing Commands.
  39934. (line 6)
  39935. * languages: Languages. (line 6)
  39936. * last tracepoint number: Create and Delete Tracepoints.
  39937. (line 122)
  39938. * latest breakpoint: Set Breaks. (line 6)
  39939. * lazy strings in guile: Lazy Strings In Guile.
  39940. (line 6)
  39941. * lazy strings in python: Lazy Strings In Python.
  39942. (line 6)
  39943. * LDT: DJGPP Native. (line 24)
  39944. * leaving GDB: Quitting GDB. (line 6)
  39945. * libkvm: BSD libkvm Interface.
  39946. (line 6)
  39947. * library list format, remote protocol: Library List Format.
  39948. (line 6)
  39949. * library list format, remote protocol <1>: Library List Format for SVR4 Targets.
  39950. (line 6)
  39951. * limit hardware breakpoints and watchpoints: Remote Configuration.
  39952. (line 79)
  39953. * limit hardware watchpoints length: Remote Configuration.
  39954. (line 91)
  39955. * limit on number of printed array elements: Print Settings. (line 141)
  39956. * limits, in file-i/o protocol: Limits. (line 6)
  39957. * line tables in python: Line Tables In Python.
  39958. (line 6)
  39959. * line tables, listing GDB's internal: Symbols. (line 648)
  39960. * linespec locations: Linespec Locations. (line 6)
  39961. * Linux lightweight processes: Debugging Output. (line 121)
  39962. * list active threads, remote request: General Query Packets.
  39963. (line 238)
  39964. * list of supported file-i/o calls: List of Supported Calls.
  39965. (line 6)
  39966. * list output in GDB/MI: GDB/MI Output Syntax.
  39967. (line 117)
  39968. * 'list', how many lines to display: List. (line 30)
  39969. * listing GDB's internal line tables: Symbols. (line 648)
  39970. * listing GDB's internal symbol tables: Symbols. (line 601)
  39971. * listing machine instructions: Machine Code. (line 43)
  39972. * listing mapped overlays: Overlay Commands. (line 60)
  39973. * lists of breakpoints: Breakpoints. (line 45)
  39974. * load address, overlay's: How Overlays Work. (line 6)
  39975. * load shared library: Files. (line 327)
  39976. * load symbols from memory: Files. (line 193)
  39977. * local socket, 'target remote': Connecting. (line 140)
  39978. * local variables: Symbols. (line 410)
  39979. * locate address: Output Formats. (line 35)
  39980. * location: Specify Location. (line 6)
  39981. * lock scheduler: All-Stop Mode. (line 37)
  39982. * log output in GDB/MI: GDB/MI Output Syntax.
  39983. (line 113)
  39984. * logging file name: Logging Output. (line 12)
  39985. * logging GDB output: Logging Output. (line 6)
  39986. * lseek flags, in file-i/o protocol: Lseek Flags. (line 6)
  39987. * lseek, file-i/o system call: lseek. (line 6)
  39988. * 'm' packet: Packets. (line 239)
  39989. * 'M' packet: Packets. (line 259)
  39990. * m680x0: Remote Stub. (line 59)
  39991. * 'm68k-stub.c': Remote Stub. (line 59)
  39992. * Mach-O symbols processing: Debugging Output. (line 130)
  39993. * machine instructions: Machine Code. (line 43)
  39994. * macro definition, showing: Macros. (line 47)
  39995. * macro expansion, showing the results of preprocessor: Macros.
  39996. (line 29)
  39997. * macros, example of debugging with: Macros. (line 83)
  39998. * macros, from debug info: Macros. (line 47)
  39999. * macros, user-defined: Macros. (line 59)
  40000. * mailing lists: GDB/MI Development and Front Ends.
  40001. (line 61)
  40002. * maintenance commands: Maintenance Commands.
  40003. (line 6)
  40004. * Man pages: Man Pages. (line 6)
  40005. * managing frame filters: Frame Filter Management.
  40006. (line 6)
  40007. * manual overlay debugging: Overlay Commands. (line 23)
  40008. * map an overlay: Overlay Commands. (line 30)
  40009. * mapinfo list, QNX Neutrino: Process Information.
  40010. (line 130)
  40011. * mapped address: How Overlays Work. (line 6)
  40012. * mapped overlays: How Overlays Work. (line 6)
  40013. * markers, static tracepoints: Set Tracepoints. (line 28)
  40014. * maximum value for offset of closest symbol: Print Settings.
  40015. (line 70)
  40016. * member functions: C Plus Plus Expressions.
  40017. (line 16)
  40018. * memory address space mappings: Process Information.
  40019. (line 80)
  40020. * memory map format: Memory Map Format. (line 6)
  40021. * memory region attributes: Memory Region Attributes.
  40022. (line 6)
  40023. * memory tracing: Breakpoints. (line 17)
  40024. * memory transfer, in file-i/o protocol: Memory Transfer. (line 6)
  40025. * memory used by commands: Maintenance Commands.
  40026. (line 532)
  40027. * memory used for symbol tables: Files. (line 315)
  40028. * memory, alignment and size of remote accesses: Packets. (line 247)
  40029. * memory, viewing as typed object: Expressions. (line 41)
  40030. * mi interpreter: Interpreters. (line 26)
  40031. * mi1 interpreter: Interpreters. (line 34)
  40032. * mi2 interpreter: Interpreters. (line 31)
  40033. * minimal language: Unsupported Languages.
  40034. (line 6)
  40035. * minimal symbol dump: Symbols. (line 575)
  40036. * Minimal symbols and DLLs: Non-debug DLL Symbols.
  40037. (line 6)
  40038. * MIPS addresses, masking: MIPS. (line 80)
  40039. * MIPS remote floating point: MIPS Embedded. (line 13)
  40040. * MIPS stack: MIPS. (line 6)
  40041. * miscellaneous settings: Other Misc Settings.
  40042. (line 6)
  40043. * MMX registers (x86): Registers. (line 76)
  40044. * mode_t values, in file-i/o protocol: mode_t Values. (line 6)
  40045. * Modula-2: Summary. (line 29)
  40046. * Modula-2 built-ins: Built-In Func/Proc. (line 6)
  40047. * Modula-2 checks: M2 Checks. (line 6)
  40048. * Modula-2 constants: Built-In Func/Proc. (line 114)
  40049. * Modula-2 defaults: M2 Defaults. (line 6)
  40050. * Modula-2 operators: M2 Operators. (line 6)
  40051. * Modula-2 types: M2 Types. (line 6)
  40052. * Modula-2, deviations from: Deviations. (line 6)
  40053. * Modula-2, GDB support: Modula-2. (line 6)
  40054. * monitor commands, for 'gdbserver': Server. (line 217)
  40055. * Motorola 680x0: Remote Stub. (line 59)
  40056. * MS Windows debugging: Cygwin Native. (line 6)
  40057. * MS-DOS system info: DJGPP Native. (line 19)
  40058. * MS-DOS-specific commands: DJGPP Native. (line 6)
  40059. * multiple locations, breakpoints: Set Breaks. (line 200)
  40060. * multiple processes: Forks. (line 6)
  40061. * multiple targets: Active Targets. (line 6)
  40062. * multiple threads: Threads. (line 6)
  40063. * multiple threads, backtrace: Backtrace. (line 53)
  40064. * multiple-symbols menu: Ambiguous Expressions.
  40065. (line 51)
  40066. * multiprocess extensions, in remote protocol: General Query Packets.
  40067. (line 925)
  40068. * name a thread: Threads. (line 241)
  40069. * names of symbols: Symbols. (line 14)
  40070. * namespace in C++: C Plus Plus Expressions.
  40071. (line 20)
  40072. * native Cygwin debugging: Cygwin Native. (line 6)
  40073. * native DJGPP debugging: DJGPP Native. (line 6)
  40074. * native script auto-loading: Auto-loading sequences.
  40075. (line 6)
  40076. * native target: Target Commands. (line 85)
  40077. * negative breakpoint numbers: Set Breaks. (line 374)
  40078. * never read symbols: Files. (line 101)
  40079. * 'New' SYSTAG message: Threads. (line 35)
  40080. * new user interface: Interpreters. (line 65)
  40081. * Newlib OS ABI and its influence on the longjmp handling: ABI.
  40082. (line 11)
  40083. * Nios II architecture: Nios II. (line 6)
  40084. * no debug info functions: Calling. (line 61)
  40085. * no debug info variables: Variables. (line 142)
  40086. * non-member C++ functions, set breakpoint in: Set Breaks. (line 113)
  40087. * non-stop mode: Non-Stop Mode. (line 6)
  40088. * non-stop mode, and process record and replay: Process Record and Replay.
  40089. (line 95)
  40090. * non-stop mode, and 'set displaced-stepping': Maintenance Commands.
  40091. (line 129)
  40092. * non-stop mode, remote request: General Query Packets.
  40093. (line 379)
  40094. * noninvasive task options: Hurd Native. (line 72)
  40095. * notation, readline: Readline Bare Essentials.
  40096. (line 6)
  40097. * notational conventions, for GDB/MI: GDB/MI. (line 25)
  40098. * notification packets: Notification Packets.
  40099. (line 6)
  40100. * notify output in GDB/MI: GDB/MI Output Syntax.
  40101. (line 102)
  40102. * NULL elements in arrays: Print Settings. (line 320)
  40103. * number of array elements to print: Print Settings. (line 141)
  40104. * number representation: Numbers. (line 6)
  40105. * numbers for breakpoints: Breakpoints. (line 38)
  40106. * object files, relocatable, reading symbols from: Files. (line 146)
  40107. * Objective-C: Objective-C. (line 6)
  40108. * Objective-C, classes and selectors: Symbols. (line 526)
  40109. * Objective-C, print objects: The Print Command with Objective-C.
  40110. (line 6)
  40111. * 'OBJFILE-gdb.gdb': objfile-gdbdotext file.
  40112. (line 6)
  40113. * 'OBJFILE-gdb.py': objfile-gdbdotext file.
  40114. (line 6)
  40115. * 'OBJFILE-gdb.scm': objfile-gdbdotext file.
  40116. (line 6)
  40117. * objfiles in guile: Objfiles In Guile. (line 6)
  40118. * objfiles in python: Objfiles In Python. (line 6)
  40119. * observer debugging info: Debugging Output. (line 142)
  40120. * octal escapes in strings: Print Settings. (line 353)
  40121. * online documentation: Help. (line 6)
  40122. * opaque data types: Symbols. (line 538)
  40123. * open flags, in file-i/o protocol: Open Flags. (line 6)
  40124. * open, file-i/o system call: open. (line 6)
  40125. * OpenCL C: OpenCL C. (line 6)
  40126. * OpenCL C Datatypes: OpenCL C Datatypes. (line 6)
  40127. * OpenCL C Expressions: OpenCL C Expressions.
  40128. (line 6)
  40129. * OpenCL C Operators: OpenCL C Operators. (line 6)
  40130. * OpenRISC 1000: OpenRISC 1000. (line 6)
  40131. * operating system information: Operating System Information.
  40132. (line 6)
  40133. * operating system information, process list: Process list. (line 6)
  40134. * optimized code, debugging: Optimized Code. (line 6)
  40135. * optimized code, wrong values of variables: Variables. (line 106)
  40136. * optimized out value in guile: Values From Inferior In Guile.
  40137. (line 102)
  40138. * optimized out value in Python: Values From Inferior.
  40139. (line 70)
  40140. * optimized out, in backtrace: Backtrace. (line 87)
  40141. * optional debugging messages: Debugging Output. (line 6)
  40142. * optional warnings: Messages/Warnings. (line 6)
  40143. * OS ABI: ABI. (line 11)
  40144. * OS information: OS Information. (line 6)
  40145. * out-of-line single-stepping: Maintenance Commands.
  40146. (line 112)
  40147. * outermost frame: Frames. (line 12)
  40148. * output formats: Output Formats. (line 6)
  40149. * output syntax of GDB/MI: GDB/MI Output Syntax.
  40150. (line 6)
  40151. * overlay area: How Overlays Work. (line 6)
  40152. * overlay example program: Overlay Sample Program.
  40153. (line 6)
  40154. * overlays: Overlays. (line 6)
  40155. * overlays, setting breakpoints in: Overlay Commands. (line 91)
  40156. * overloaded functions, calling: C Plus Plus Expressions.
  40157. (line 26)
  40158. * overloaded functions, overload resolution: Debugging C Plus Plus.
  40159. (line 59)
  40160. * overloading in C++: Debugging C Plus Plus.
  40161. (line 15)
  40162. * overloading, Ada: Overloading support for Ada.
  40163. (line 6)
  40164. * 'p' packet: Packets. (line 271)
  40165. * 'P' packet: Packets. (line 284)
  40166. * packet acknowledgment, for GDB remote: Packet Acknowledgment.
  40167. (line 6)
  40168. * packet size, remote protocol: General Query Packets.
  40169. (line 823)
  40170. * packets, notification: Notification Packets.
  40171. (line 6)
  40172. * packets, reporting on stdout: Debugging Output. (line 159)
  40173. * packets, tracepoint: Tracepoint Packets. (line 6)
  40174. * page size: Screen Size. (line 6)
  40175. * page tables display (MS-DOS): DJGPP Native. (line 55)
  40176. * pagination: Screen Size. (line 6)
  40177. * parameters in guile: Parameters In Guile.
  40178. (line 6)
  40179. * parameters in python: Parameters In Python.
  40180. (line 6)
  40181. * partial symbol dump: Symbols. (line 575)
  40182. * partial symbol tables, listing GDB's internal: Symbols. (line 601)
  40183. * Pascal: Summary. (line 35)
  40184. * Pascal objects, static members display: Print Settings. (line 468)
  40185. * Pascal support in GDB, limitations: Pascal. (line 6)
  40186. * pass signals to inferior, remote request: General Query Packets.
  40187. (line 440)
  40188. * patching binaries: Patching. (line 6)
  40189. * patching object files: Files. (line 26)
  40190. * pause current task (GNU Hurd): Hurd Native. (line 48)
  40191. * pause current thread (GNU Hurd): Hurd Native. (line 90)
  40192. * pauses in output: Screen Size. (line 6)
  40193. * pending breakpoints: Set Breaks. (line 245)
  40194. * physical address from linear address: DJGPP Native. (line 80)
  40195. * physname: Debugging Output. (line 41)
  40196. * pipe, 'target remote' to: Connecting. (line 227)
  40197. * pipes: Starting. (line 64)
  40198. * pointer values, in file-i/o protocol: Pointer Values. (line 6)
  40199. * pointer, finding referent: Print Settings. (line 80)
  40200. * port rights, GNU Hurd: Hurd Native. (line 84)
  40201. * port sets, GNU Hurd: Hurd Native. (line 84)
  40202. * PowerPC architecture: PowerPC. (line 6)
  40203. * prefix for data files: Data Files. (line 6)
  40204. * prefix for executable and shared library file names: Files.
  40205. (line 386)
  40206. * premature return from system calls: Interrupted System Calls.
  40207. (line 6)
  40208. * preprocessor macro expansion, showing the results of: Macros.
  40209. (line 29)
  40210. * pretty print arrays: Print Settings. (line 115)
  40211. * pretty print C++ virtual function tables: Print Settings. (line 479)
  40212. * pretty-printer commands: Pretty-Printer Commands.
  40213. (line 6)
  40214. * print all frame argument values: Print Settings. (line 154)
  40215. * print an Objective-C object description: The Print Command with Objective-C.
  40216. (line 11)
  40217. * print array indexes: Print Settings. (line 125)
  40218. * print frame argument values for scalars only: Print Settings.
  40219. (line 154)
  40220. * print list of auto-loaded canned sequences of commands scripts: Auto-loading sequences.
  40221. (line 21)
  40222. * print list of auto-loaded Guile scripts: Guile Auto-loading.
  40223. (line 23)
  40224. * print list of auto-loaded Python scripts: Python Auto-loading.
  40225. (line 23)
  40226. * print messages on inferior start and exit: Inferiors and Programs.
  40227. (line 126)
  40228. * print messages on thread start and exit: Threads. (line 266)
  40229. * print messages when symbols are loaded: Symbols. (line 556)
  40230. * print settings: Print Settings. (line 6)
  40231. * print structures in indented form: Print Settings. (line 329)
  40232. * print/don't print memory addresses: Print Settings. (line 13)
  40233. * printing byte arrays: Output Formats. (line 60)
  40234. * printing data: Data. (line 6)
  40235. * printing frame argument values: Print Settings. (line 154)
  40236. * printing strings: Output Formats. (line 60)
  40237. * probe static tracepoint marker: Create and Delete Tracepoints.
  40238. (line 75)
  40239. * probing markers, static tracepoints: Set Tracepoints. (line 28)
  40240. * process detailed status information: Process Information.
  40241. (line 88)
  40242. * process ID: Process Information.
  40243. (line 25)
  40244. * process info via '/proc': Process Information.
  40245. (line 6)
  40246. * process list, QNX Neutrino: Process Information.
  40247. (line 126)
  40248. * process record and replay: Process Record and Replay.
  40249. (line 6)
  40250. * process status register: Registers. (line 31)
  40251. * processes, multiple: Forks. (line 6)
  40252. * 'procfs' API calls: Process Information.
  40253. (line 105)
  40254. * profiling GDB: Maintenance Commands.
  40255. (line 425)
  40256. * program counter register: Registers. (line 31)
  40257. * program entry point: Backtrace. (line 109)
  40258. * programming in guile: Guile API. (line 6)
  40259. * programming in python: Python API. (line 6)
  40260. * progspaces in guile: Progspaces In Guile.
  40261. (line 6)
  40262. * progspaces in python: Progspaces In Python.
  40263. (line 6)
  40264. * prompt: Prompt. (line 6)
  40265. * protocol basics, file-i/o: Protocol Basics. (line 6)
  40266. * protocol, GDB remote serial: Overview. (line 14)
  40267. * protocol-specific representation of datatypes, in file-i/o protocol: Protocol-specific Representation of Datatypes.
  40268. (line 6)
  40269. * python api: Python API. (line 6)
  40270. * Python architectures: Architectures In Python.
  40271. (line 6)
  40272. * Python auto-loading: Python Auto-loading.
  40273. (line 6)
  40274. * python commands: Python Commands. (line 6)
  40275. * python commands <1>: Commands In Python. (line 6)
  40276. * python convenience functions: Functions In Python.
  40277. (line 6)
  40278. * python directory: Python. (line 12)
  40279. * python exceptions: Exception Handling. (line 6)
  40280. * python finish breakpoints: Finish Breakpoints in Python.
  40281. (line 6)
  40282. * python functions: Basic Python. (line 28)
  40283. * python module: Basic Python. (line 28)
  40284. * python modules: Python modules. (line 6)
  40285. * python pagination: Basic Python. (line 6)
  40286. * python parameters: Parameters In Python.
  40287. (line 6)
  40288. * python pretty printing api: Pretty Printing API.
  40289. (line 6)
  40290. * python scripting: Python. (line 6)
  40291. * python stdout: Basic Python. (line 6)
  40292. * Python, working with types: Types In Python. (line 6)
  40293. * python, working with values from inferior: Values From Inferior.
  40294. (line 6)
  40295. * 'q' packet: Packets. (line 296)
  40296. * 'Q' packet: Packets. (line 296)
  40297. * 'QAllow' packet: General Query Packets.
  40298. (line 44)
  40299. * 'qAttached' packet: General Query Packets.
  40300. (line 1415)
  40301. * 'qC' packet: General Query Packets.
  40302. (line 55)
  40303. * 'QCatchSyscalls' packet: General Query Packets.
  40304. (line 401)
  40305. * 'qCRC' packet: General Query Packets.
  40306. (line 65)
  40307. * 'QDisableRandomization' packet: General Query Packets.
  40308. (line 84)
  40309. * 'QEnvironmentHexEncoded' packet: General Query Packets.
  40310. (line 144)
  40311. * 'QEnvironmentReset' packet: General Query Packets.
  40312. (line 197)
  40313. * 'QEnvironmentUnset' packet: General Query Packets.
  40314. (line 173)
  40315. * 'qfThreadInfo' packet: General Query Packets.
  40316. (line 238)
  40317. * 'qGetTIBAddr' packet: General Query Packets.
  40318. (line 303)
  40319. * 'qGetTLSAddr' packet: General Query Packets.
  40320. (line 271)
  40321. * 'QNonStop' packet: General Query Packets.
  40322. (line 379)
  40323. * 'qOffsets' packet: General Query Packets.
  40324. (line 342)
  40325. * 'qP' packet: General Query Packets.
  40326. (line 369)
  40327. * 'QPassSignals' packet: General Query Packets.
  40328. (line 440)
  40329. * 'QProgramSignals' packet: General Query Packets.
  40330. (line 469)
  40331. * 'qRcmd' packet: General Query Packets.
  40332. (line 536)
  40333. * 'qSearch memory' packet: General Query Packets.
  40334. (line 558)
  40335. * 'QSetWorkingDir' packet: General Query Packets.
  40336. (line 219)
  40337. * 'QStartNoAckMode' packet: General Query Packets.
  40338. (line 575)
  40339. * 'QStartupWithShell' packet: General Query Packets.
  40340. (line 114)
  40341. * 'qsThreadInfo' packet: General Query Packets.
  40342. (line 238)
  40343. * 'qSupported' packet: General Query Packets.
  40344. (line 589)
  40345. * 'qSymbol' packet: General Query Packets.
  40346. (line 1045)
  40347. * 'qTBuffer' packet: Tracepoint Packets. (line 393)
  40348. * 'QTBuffer size' packet: Tracepoint Packets. (line 406)
  40349. * 'QTDisable' packet: Tracepoint Packets. (line 209)
  40350. * 'QTDisconnected' packet: Tracepoint Packets. (line 228)
  40351. * 'QTDP' packet: Tracepoint Packets. (line 10)
  40352. * 'QTDPsrc' packet: Tracepoint Packets. (line 90)
  40353. * 'QTDV' packet: Tracepoint Packets. (line 121)
  40354. * 'QTEnable' packet: Tracepoint Packets. (line 204)
  40355. * 'qTfP' packet: Tracepoint Packets. (line 335)
  40356. * 'QTFrame' packet: Tracepoint Packets. (line 133)
  40357. * 'qTfSTM' packet: Tracepoint Packets. (line 352)
  40358. * 'qTfV' packet: Tracepoint Packets. (line 343)
  40359. * 'QThreadEvents' packet: General Query Packets.
  40360. (line 509)
  40361. * 'qThreadExtraInfo' packet: General Query Packets.
  40362. (line 1088)
  40363. * 'QTinit' packet: Tracepoint Packets. (line 214)
  40364. * 'qTMinFTPILen' packet: Tracepoint Packets. (line 171)
  40365. * 'QTNotes' packet: Tracepoint Packets. (line 411)
  40366. * 'qTP' packet: Tracepoint Packets. (line 307)
  40367. * 'QTro' packet: Tracepoint Packets. (line 217)
  40368. * 'QTSave' packet: Tracepoint Packets. (line 387)
  40369. * 'qTsP' packet: Tracepoint Packets. (line 336)
  40370. * 'qTsSTM' packet: Tracepoint Packets. (line 352)
  40371. * 'QTStart' packet: Tracepoint Packets. (line 195)
  40372. * 'qTStatus' packet: Tracepoint Packets. (line 234)
  40373. * 'qTSTMat' packet: Tracepoint Packets. (line 381)
  40374. * 'QTStop' packet: Tracepoint Packets. (line 201)
  40375. * 'qTsV' packet: Tracepoint Packets. (line 344)
  40376. * 'qTV' packet: Tracepoint Packets. (line 318)
  40377. * qualified thread ID: Threads. (line 52)
  40378. * query attached, remote request: General Query Packets.
  40379. (line 1415)
  40380. * quotes in commands: Completion. (line 82)
  40381. * quoting Ada internal identifiers: Additions to Ada. (line 76)
  40382. * quoting names: Symbols. (line 14)
  40383. * 'qXfer' packet: General Query Packets.
  40384. (line 1125)
  40385. * 'r' packet: Packets. (line 300)
  40386. * 'R' packet: Packets. (line 305)
  40387. * range checking: Type Checking. (line 45)
  40388. * range stepping: Continuing and Stepping.
  40389. (line 210)
  40390. * ranged breakpoint: PowerPC Embedded. (line 33)
  40391. * ranges of breakpoints: Breakpoints. (line 45)
  40392. * Ravenscar Profile: Ravenscar Profile. (line 6)
  40393. * raw printing: Output Formats. (line 76)
  40394. * read special object, remote request: General Query Packets.
  40395. (line 1125)
  40396. * read, file-i/o system call: read. (line 6)
  40397. * read-only sections: Files. (line 265)
  40398. * reading symbols from relocatable object files: Files. (line 146)
  40399. * reading symbols immediately: Files. (line 94)
  40400. * readline: Editing. (line 6)
  40401. * receive rights, GNU Hurd: Hurd Native. (line 84)
  40402. * recent tracepoint number: Create and Delete Tracepoints.
  40403. (line 122)
  40404. * record aggregates (Ada): Omissions from Ada. (line 44)
  40405. * record mode: Process Record and Replay.
  40406. (line 19)
  40407. * record serial communications on file: Remote Configuration.
  40408. (line 64)
  40409. * recording a session script: Bug Reporting. (line 108)
  40410. * recording inferior's execution and replaying it: Process Record and Replay.
  40411. (line 6)
  40412. * recordings in python: Recordings In Python.
  40413. (line 6)
  40414. * redirection: Input/Output. (line 6)
  40415. * reference card: Formatting Documentation.
  40416. (line 6)
  40417. * reference declarations: C Plus Plus Expressions.
  40418. (line 50)
  40419. * register packet format, MIPS: MIPS Register packet Format.
  40420. (line 6)
  40421. * registers: Registers. (line 6)
  40422. * regular expression: Set Breaks. (line 90)
  40423. * reloading the overlay table: Overlay Commands. (line 52)
  40424. * relocatable object files, reading symbols from: Files. (line 146)
  40425. * remote async notification debugging info: Debugging Output.
  40426. (line 136)
  40427. * remote connection commands: Connecting. (line 120)
  40428. * remote connection without stubs: Server. (line 6)
  40429. * remote debugging: Remote Debugging. (line 6)
  40430. * remote debugging, connecting: Connecting. (line 6)
  40431. * remote debugging, detach and program exit: Connecting. (line 19)
  40432. * remote debugging, symbol files: Connecting. (line 90)
  40433. * remote debugging, types of connections: Connecting. (line 6)
  40434. * remote memory comparison: Memory. (line 142)
  40435. * remote packets, enabling and disabling: Remote Configuration.
  40436. (line 159)
  40437. * remote programs, interrupting: Connecting. (line 239)
  40438. * remote protocol debugging: Debugging Output. (line 159)
  40439. * remote protocol, binary data: Overview. (line 63)
  40440. * remote protocol, field separator: Overview. (line 55)
  40441. * remote query requests: General Query Packets.
  40442. (line 6)
  40443. * remote serial debugging summary: Debug Session. (line 6)
  40444. * remote serial debugging, overview: Remote Stub. (line 14)
  40445. * remote serial protocol: Overview. (line 14)
  40446. * remote serial stub: Stub Contents. (line 6)
  40447. * remote serial stub list: Remote Stub. (line 53)
  40448. * remote serial stub, initialization: Stub Contents. (line 10)
  40449. * remote serial stub, main routine: Stub Contents. (line 15)
  40450. * remote stub, example: Remote Stub. (line 6)
  40451. * remote stub, support routines: Bootstrapping. (line 6)
  40452. * remote target: Target Commands. (line 58)
  40453. * remote target, file transfer: File Transfer. (line 6)
  40454. * remote target, limit break- and watchpoints: Remote Configuration.
  40455. (line 79)
  40456. * remote target, limit watchpoints length: Remote Configuration.
  40457. (line 91)
  40458. * remote timeout: Remote Configuration.
  40459. (line 72)
  40460. * remove actions from a tracepoint: Tracepoint Actions. (line 21)
  40461. * remove duplicate history: Command History. (line 54)
  40462. * rename, file-i/o system call: rename. (line 6)
  40463. * Renesas: Remote Stub. (line 62)
  40464. * repeated array elements: Print Settings. (line 307)
  40465. * repeating command sequences: Command Syntax. (line 41)
  40466. * repeating commands: Command Syntax. (line 21)
  40467. * replay log events, remote reply: Stop Reply Packets. (line 70)
  40468. * replay mode: Process Record and Replay.
  40469. (line 10)
  40470. * reporting bugs in GDB: GDB Bugs. (line 6)
  40471. * reprint the last value: Data. (line 23)
  40472. * reprint the last value <1>: Compiling and Injecting Code.
  40473. (line 73)
  40474. * reset environment, remote request: General Query Packets.
  40475. (line 197)
  40476. * resources used by commands: Maintenance Commands.
  40477. (line 486)
  40478. * response time, MIPS debugging: MIPS. (line 10)
  40479. * restart: Checkpoint/Restart. (line 6)
  40480. * restore data from a file: Dump/Restore Files. (line 6)
  40481. * restrictions on Go expressions: Go. (line 35)
  40482. * result records in GDB/MI: GDB/MI Result Records.
  40483. (line 6)
  40484. * resume threads of multiple processes simultaneously: All-Stop Mode.
  40485. (line 54)
  40486. * resuming execution: Continuing and Stepping.
  40487. (line 6)
  40488. * returning from a function: Returning. (line 6)
  40489. * reverse execution: Reverse Execution. (line 6)
  40490. * rewind program state: Checkpoint/Restart. (line 6)
  40491. * run to first instruction: Starting. (line 114)
  40492. * run to main procedure: Starting. (line 81)
  40493. * run until specified location: Continuing and Stepping.
  40494. (line 117)
  40495. * running: Starting. (line 6)
  40496. * running programs backward: Reverse Execution. (line 6)
  40497. * 's' packet: Packets. (line 312)
  40498. * 'S' packet: Packets. (line 321)
  40499. * S12Z support: S12Z. (line 6)
  40500. * save breakpoints to a file for future sessions: Save Breakpoints.
  40501. (line 9)
  40502. * save command history: Command History. (line 36)
  40503. * save GDB output to a file: Logging Output. (line 6)
  40504. * save tracepoints for future sessions: save tracepoints. (line 6)
  40505. * scheduler locking mode: All-Stop Mode. (line 37)
  40506. * scope: M2 Scope. (line 6)
  40507. * screen size: Screen Size. (line 6)
  40508. * scripting commands: Command Files. (line 6)
  40509. * scripting with guile: Guile. (line 6)
  40510. * scripting with python: Python. (line 6)
  40511. * search for a thread: Threads. (line 252)
  40512. * search path for 'libthread_db': Threads. (line 287)
  40513. * searching memory: Searching Memory. (line 6)
  40514. * searching memory, in remote debugging: General Query Packets.
  40515. (line 558)
  40516. * searching source files: Search. (line 6)
  40517. * section offsets, remote request: General Query Packets.
  40518. (line 342)
  40519. * segment descriptor tables: DJGPP Native. (line 24)
  40520. * select Ctrl-C, BREAK or BREAK-g: Remote Configuration.
  40521. (line 108)
  40522. * select trace snapshot: tfind. (line 6)
  40523. * selected frame: Stack. (line 19)
  40524. * selecting guile pretty-printers: Selecting Guile Pretty-Printers.
  40525. (line 6)
  40526. * selecting python pretty-printers: Selecting Pretty-Printers.
  40527. (line 6)
  40528. * self tests: Maintenance Commands.
  40529. (line 360)
  40530. * self tests <1>: Maintenance Commands.
  40531. (line 366)
  40532. * semaphores on static probe points: Static Probe Points.
  40533. (line 20)
  40534. * send command to remote monitor: Connecting. (line 272)
  40535. * send command to simulator: Embedded Processors.
  40536. (line 9)
  40537. * send interrupt-sequence on start: Remote Configuration.
  40538. (line 121)
  40539. * send rights, GNU Hurd: Hurd Native. (line 84)
  40540. * sending files to remote systems: File Transfer. (line 6)
  40541. * separate debug sections: MiniDebugInfo. (line 6)
  40542. * separate debugging information files: Separate Debug Files.
  40543. (line 6)
  40544. * sequence-id, for GDB remote: Overview. (line 30)
  40545. * serial connections, debugging: Debugging Output. (line 159)
  40546. * serial line, 'target remote': Connecting. (line 129)
  40547. * serial protocol, GDB remote: Overview. (line 14)
  40548. * server prefix: Server Prefix. (line 6)
  40549. * 'server', command prefix: Command History. (line 20)
  40550. * set ABI for MIPS: MIPS. (line 32)
  40551. * set breakpoints in many functions: Set Breaks. (line 90)
  40552. * set breakpoints on all functions: Set Breaks. (line 117)
  40553. * set environment variable, remote request: General Query Packets.
  40554. (line 144)
  40555. * set fast tracepoint: Create and Delete Tracepoints.
  40556. (line 50)
  40557. * set inferior controlling terminal: Input/Output. (line 44)
  40558. * set static tracepoint: Create and Delete Tracepoints.
  40559. (line 75)
  40560. * set tdesc filename: Retrieving Descriptions.
  40561. (line 18)
  40562. * set tracepoint: Create and Delete Tracepoints.
  40563. (line 6)
  40564. * set working directory, remote request: General Query Packets.
  40565. (line 219)
  40566. * setting variables: Assignment. (line 6)
  40567. * setting watchpoints: Set Watchpoints. (line 6)
  40568. * SH: Remote Stub. (line 62)
  40569. * 'sh-stub.c': Remote Stub. (line 62)
  40570. * shared libraries: Files. (line 287)
  40571. * shared library events, remote reply: Stop Reply Packets. (line 65)
  40572. * shell escape: Shell Commands. (line 10)
  40573. * show all convenience functions: Convenience Funs. (line 148)
  40574. * show all user variables and functions: Convenience Vars. (line 37)
  40575. * show inferior's working directory: Working Directory. (line 27)
  40576. * show last commands: Command History. (line 95)
  40577. * show tdesc filename: Retrieving Descriptions.
  40578. (line 25)
  40579. * signals: Signals. (line 6)
  40580. * signals the inferior may see, remote request: General Query Packets.
  40581. (line 469)
  40582. * 'SIGQUIT' signal, dump core of GDB: Maintenance Commands.
  40583. (line 169)
  40584. * size of remote memory accesses: Packets. (line 247)
  40585. * size of screen: Screen Size. (line 6)
  40586. * skipping over files via glob-style patterns: Skipping Over Functions and Files.
  40587. (line 55)
  40588. * skipping over functions and files: Skipping Over Functions and Files.
  40589. (line 6)
  40590. * skipping over functions via regular expressions: Skipping Over Functions and Files.
  40591. (line 68)
  40592. * snapshot of a process: Checkpoint/Restart. (line 6)
  40593. * software watchpoints: Set Watchpoints. (line 31)
  40594. * source file and line of a symbol: Print Settings. (line 50)
  40595. * source line and its code address: Machine Code. (line 6)
  40596. * source location: Specify Location. (line 6)
  40597. * source path: Source Path. (line 6)
  40598. * Sparc: Remote Stub. (line 65)
  40599. * 'sparc-stub.c': Remote Stub. (line 65)
  40600. * Sparc64 support: Sparc64. (line 6)
  40601. * 'sparcl-stub.c': Remote Stub. (line 68)
  40602. * SparcLite: Remote Stub. (line 68)
  40603. * Special Fortran commands: Special Fortran Commands.
  40604. (line 6)
  40605. * specifying location: Specify Location. (line 6)
  40606. * SPU: SPU. (line 6)
  40607. * SSE registers (x86): Registers. (line 76)
  40608. * stack frame: Frames. (line 6)
  40609. * stack on Alpha: MIPS. (line 6)
  40610. * stack on MIPS: MIPS. (line 6)
  40611. * stack pointer register: Registers. (line 31)
  40612. * stacking targets: Active Targets. (line 6)
  40613. * standard registers: Registers. (line 31)
  40614. * start a new independent interpreter: Interpreters. (line 49)
  40615. * start a new trace experiment: Starting and Stopping Trace Experiments.
  40616. (line 6)
  40617. * starting: Starting. (line 6)
  40618. * startup code, and backtrace: Backtrace. (line 109)
  40619. * startup with shell, remote request: General Query Packets.
  40620. (line 114)
  40621. * stat, file-i/o system call: stat/fstat. (line 6)
  40622. * static members of C++ objects: Print Settings. (line 457)
  40623. * static members of Pascal objects: Print Settings. (line 468)
  40624. * static probe point, DTrace: Static Probe Points.
  40625. (line 6)
  40626. * static probe point, SystemTap: Static Probe Points.
  40627. (line 6)
  40628. * static tracepoints: Set Tracepoints. (line 28)
  40629. * static tracepoints, in remote protocol: General Query Packets.
  40630. (line 973)
  40631. * static tracepoints, setting: Create and Delete Tracepoints.
  40632. (line 75)
  40633. * status of trace data collection: Starting and Stopping Trace Experiments.
  40634. (line 27)
  40635. * status output in GDB/MI: GDB/MI Output Syntax.
  40636. (line 94)
  40637. * stepping: Continuing and Stepping.
  40638. (line 6)
  40639. * stepping and signal handlers: Signals. (line 106)
  40640. * stepping into functions with no line info: Continuing and Stepping.
  40641. (line 92)
  40642. * stop a running trace experiment: Starting and Stopping Trace Experiments.
  40643. (line 16)
  40644. * stop on C++ exceptions: Set Catchpoints. (line 16)
  40645. * stop reply packets: Stop Reply Packets. (line 6)
  40646. * stopped threads: Thread Stops. (line 6)
  40647. * stream records in GDB/MI: GDB/MI Stream Records.
  40648. (line 6)
  40649. * string tracing, in remote protocol: General Query Packets.
  40650. (line 990)
  40651. * 'struct gdb_reader_funcs': Writing JIT Debug Info Readers.
  40652. (line 22)
  40653. * 'struct gdb_symbol_callbacks': Writing JIT Debug Info Readers.
  40654. (line 43)
  40655. * 'struct gdb_unwind_callbacks': Writing JIT Debug Info Readers.
  40656. (line 43)
  40657. * struct return convention: i386. (line 7)
  40658. * struct stat, in file-i/o protocol: struct stat. (line 6)
  40659. * struct timeval, in file-i/o protocol: struct timeval. (line 6)
  40660. * struct/union returned in registers: i386. (line 7)
  40661. * structure field name completion: Completion. (line 134)
  40662. * stub example, remote debugging: Remote Stub. (line 6)
  40663. * stupid questions: Messages/Warnings. (line 49)
  40664. * styling: Output Styling. (line 6)
  40665. * Super-H: Super-H. (line 6)
  40666. * supported GDB/MI features, list: GDB/MI Support Commands.
  40667. (line 57)
  40668. * supported packets, remote query: General Query Packets.
  40669. (line 589)
  40670. * switching threads: Threads. (line 6)
  40671. * switching threads automatically: All-Stop Mode. (line 28)
  40672. * symbol cache size: Symbols. (line 654)
  40673. * symbol cache, flushing: Symbols. (line 670)
  40674. * symbol cache, printing its contents: Symbols. (line 662)
  40675. * symbol cache, printing usage statistics: Symbols. (line 666)
  40676. * symbol decoding style, C++: Print Settings. (line 427)
  40677. * symbol dump: Symbols. (line 575)
  40678. * symbol file functions: Debugging Output. (line 191)
  40679. * symbol files, remote debugging: Connecting. (line 90)
  40680. * symbol from address: Symbols. (line 95)
  40681. * symbol lookup: Debugging Output. (line 184)
  40682. * symbol lookup, remote request: General Query Packets.
  40683. (line 1045)
  40684. * symbol names: Symbols. (line 14)
  40685. * symbol table: Files. (line 6)
  40686. * symbol table creation: Debugging Output. (line 196)
  40687. * symbol tables in guile: Symbol Tables In Guile.
  40688. (line 6)
  40689. * symbol tables in python: Symbol Tables In Python.
  40690. (line 6)
  40691. * symbol tables, listing GDB's internal: Symbols. (line 601)
  40692. * symbol, source file and line: Print Settings. (line 50)
  40693. * symbols in guile: Symbols In Guile. (line 6)
  40694. * symbols in python: Symbols In Python. (line 6)
  40695. * symbols, never read: Files. (line 101)
  40696. * symbols, reading from relocatable object files: Files. (line 146)
  40697. * symbols, reading immediately: Files. (line 94)
  40698. * Synopsys ARC: ARC. (line 6)
  40699. * 'syscall DSO': Files. (line 193)
  40700. * system calls and thread breakpoints: Interrupted System Calls.
  40701. (line 6)
  40702. * system root, alternate: Files. (line 386)
  40703. * system, file-i/o system call: system. (line 6)
  40704. * system-wide configuration scripts: System-wide Configuration Scripts.
  40705. (line 6)
  40706. * system-wide init file: System-wide configuration.
  40707. (line 6)
  40708. * 't' packet: Packets. (line 331)
  40709. * 'T' packet: Packets. (line 336)
  40710. * 'T' packet reply: Stop Reply Packets. (line 26)
  40711. * tail call frames, debugging: Tail Call Frames. (line 6)
  40712. * target architecture: Targets. (line 17)
  40713. * target byte order: Byte Order. (line 6)
  40714. * target character set: Character Sets. (line 6)
  40715. * target debugging info: Debugging Output. (line 203)
  40716. * target descriptions: Target Descriptions.
  40717. (line 6)
  40718. * target descriptions, AArch64 features: AArch64 Features. (line 6)
  40719. * target descriptions, ARC Features: ARC Features. (line 6)
  40720. * target descriptions, ARM features: ARM Features. (line 6)
  40721. * target descriptions, enum types: Enum Target Types. (line 6)
  40722. * target descriptions, i386 features: i386 Features. (line 6)
  40723. * target descriptions, inclusion: Target Description Format.
  40724. (line 53)
  40725. * target descriptions, M68K features: M68K Features. (line 6)
  40726. * target descriptions, MicroBlaze features: MicroBlaze Features.
  40727. (line 6)
  40728. * target descriptions, MIPS features: MIPS Features. (line 6)
  40729. * target descriptions, NDS32 features: NDS32 Features. (line 6)
  40730. * target descriptions, Nios II features: Nios II Features. (line 6)
  40731. * target descriptions, OpenRISC 1000 features: OpenRISC 1000 Features.
  40732. (line 6)
  40733. * target descriptions, PowerPC features: PowerPC Features. (line 6)
  40734. * target descriptions, predefined types: Predefined Target Types.
  40735. (line 6)
  40736. * target descriptions, RISC-V Features: RISC-V Features. (line 6)
  40737. * target descriptions, S/390 features: S/390 and System z Features.
  40738. (line 6)
  40739. * target descriptions, sparc32 features: Sparc Features. (line 6)
  40740. * target descriptions, sparc64 features: Sparc Features. (line 6)
  40741. * target descriptions, standard features: Standard Target Features.
  40742. (line 6)
  40743. * target descriptions, System z features: S/390 and System z Features.
  40744. (line 6)
  40745. * target descriptions, TIC6x features: TIC6x Features. (line 6)
  40746. * target descriptions, TMS320C6x features: TIC6x Features. (line 6)
  40747. * target descriptions, XML format: Target Description Format.
  40748. (line 6)
  40749. * target memory comparison: Memory. (line 142)
  40750. * target output in GDB/MI: GDB/MI Output Syntax.
  40751. (line 110)
  40752. * target stack description: Maintenance Commands.
  40753. (line 341)
  40754. * target-assisted range stepping: Continuing and Stepping.
  40755. (line 210)
  40756. * task attributes (GNU Hurd): Hurd Native. (line 48)
  40757. * task breakpoints, in Ada: Ada Tasks. (line 135)
  40758. * task exception port, GNU Hurd: Hurd Native. (line 67)
  40759. * task suspend count: Hurd Native. (line 59)
  40760. * task switching with program using Ravenscar Profile: Ravenscar Profile.
  40761. (line 10)
  40762. * TCP port, 'target remote': Connecting. (line 166)
  40763. * terminal: Input/Output. (line 6)
  40764. * Text User Interface: TUI. (line 6)
  40765. * thread attributes info, remote request: General Query Packets.
  40766. (line 1088)
  40767. * thread breakpoints: Thread-Specific Breakpoints.
  40768. (line 10)
  40769. * thread breakpoints and system calls: Interrupted System Calls.
  40770. (line 6)
  40771. * thread create event, remote reply: Stop Reply Packets. (line 152)
  40772. * thread create/exit events, remote request: General Query Packets.
  40773. (line 509)
  40774. * thread default settings, GNU Hurd: Hurd Native. (line 130)
  40775. * thread exit event, remote reply: Stop Reply Packets. (line 181)
  40776. * thread ID lists: Threads. (line 65)
  40777. * thread identifier (GDB): Threads. (line 47)
  40778. * thread identifier (system): Threads. (line 35)
  40779. * thread info (Solaris): Threads. (line 167)
  40780. * thread information, remote request: General Query Packets.
  40781. (line 369)
  40782. * thread list format: Thread List Format. (line 6)
  40783. * thread number, per inferior: Threads. (line 47)
  40784. * thread properties, GNU Hurd: Hurd Native. (line 90)
  40785. * thread suspend count, GNU Hurd: Hurd Native. (line 109)
  40786. * THREAD-ID, in remote protocol: Packets. (line 20)
  40787. * threads and watchpoints: Set Watchpoints. (line 179)
  40788. * threads in python: Threads In Python. (line 6)
  40789. * threads of execution: Threads. (line 6)
  40790. * threads, automatic switching: All-Stop Mode. (line 28)
  40791. * threads, continuing: Thread Stops. (line 6)
  40792. * threads, stopped: Thread Stops. (line 6)
  40793. * time of command execution: Maintenance Commands.
  40794. (line 536)
  40795. * timeout for commands: Maintenance Commands.
  40796. (line 557)
  40797. * timeout for serial communications: Remote Configuration.
  40798. (line 72)
  40799. * timeout, for remote target connection: Remote Configuration.
  40800. (line 147)
  40801. * timestampping debugging info: Debugging Output. (line 210)
  40802. * trace experiment, status of: Starting and Stopping Trace Experiments.
  40803. (line 27)
  40804. * trace file format: Trace File Format. (line 6)
  40805. * trace files: Trace Files. (line 6)
  40806. * trace state variable value, remote request: Tracepoint Packets.
  40807. (line 318)
  40808. * trace state variables: Trace State Variables.
  40809. (line 6)
  40810. * traceback: Backtrace. (line 6)
  40811. * traceframe info format: Traceframe Info Format.
  40812. (line 6)
  40813. * tracepoint actions: Tracepoint Actions. (line 6)
  40814. * tracepoint conditions: Tracepoint Conditions.
  40815. (line 6)
  40816. * tracepoint data, display: tdump. (line 6)
  40817. * tracepoint deletion: Create and Delete Tracepoints.
  40818. (line 125)
  40819. * tracepoint number: Create and Delete Tracepoints.
  40820. (line 122)
  40821. * tracepoint packets: Tracepoint Packets. (line 6)
  40822. * tracepoint pass count: Tracepoint Passcounts.
  40823. (line 6)
  40824. * tracepoint restrictions: Tracepoint Restrictions.
  40825. (line 6)
  40826. * tracepoint status, remote request: Tracepoint Packets. (line 307)
  40827. * tracepoint variables: Tracepoint Variables.
  40828. (line 6)
  40829. * tracepoints: Tracepoints. (line 6)
  40830. * tracepoints support in 'gdbserver': Server. (line 267)
  40831. * trailing underscore, in Fortran symbols: Fortran. (line 9)
  40832. * translating between character sets: Character Sets. (line 6)
  40833. * TUI: TUI. (line 6)
  40834. * TUI commands: TUI Commands. (line 6)
  40835. * TUI configuration variables: TUI Configuration. (line 6)
  40836. * TUI key bindings: TUI Keys. (line 6)
  40837. * TUI single key mode: TUI Single Key Mode.
  40838. (line 6)
  40839. * type casting memory: Expressions. (line 41)
  40840. * type chain of a data type: Maintenance Commands.
  40841. (line 353)
  40842. * type checking: Checks. (line 24)
  40843. * type conversions in C++: C Plus Plus Expressions.
  40844. (line 26)
  40845. * type printer: Type Printing API. (line 9)
  40846. * type printing API for Python: Type Printing API. (line 6)
  40847. * types in guile: Types In Guile. (line 6)
  40848. * types in Python: Types In Python. (line 6)
  40849. * UDP port, 'target remote': Connecting. (line 215)
  40850. * union field name completion: Completion. (line 134)
  40851. * unions in structures, printing: Print Settings. (line 367)
  40852. * Unix domain socket: Connecting. (line 140)
  40853. * unknown address, locating: Output Formats. (line 35)
  40854. * unknown type: Symbols. (line 362)
  40855. * unlink, file-i/o system call: unlink. (line 6)
  40856. * unlinked object files: Files. (line 26)
  40857. * unload symbols from shared libraries: Files. (line 348)
  40858. * unmap an overlay: Overlay Commands. (line 39)
  40859. * unmapped overlays: How Overlays Work. (line 6)
  40860. * unset environment variable, remote request: General Query Packets.
  40861. (line 173)
  40862. * unset tdesc filename: Retrieving Descriptions.
  40863. (line 21)
  40864. * unsupported languages: Unsupported Languages.
  40865. (line 6)
  40866. * unwind stack in called functions: Calling. (line 36)
  40867. * unwind stack in called functions with unhandled exceptions: Calling.
  40868. (line 47)
  40869. * unwinding frames in Python: Unwinding Frames in Python.
  40870. (line 6)
  40871. * use only software watchpoints: Set Watchpoints. (line 108)
  40872. * user registers: Maintenance Commands.
  40873. (line 312)
  40874. * user-defined command: Define. (line 6)
  40875. * user-defined macros: Macros. (line 59)
  40876. * user-defined variables: Convenience Vars. (line 6)
  40877. * value history: Value History. (line 6)
  40878. * values from inferior, in guile: Values From Inferior In Guile.
  40879. (line 6)
  40880. * values from inferior, with Python: Values From Inferior.
  40881. (line 6)
  40882. * variable name conflict: Variables. (line 36)
  40883. * variable object debugging info: Debugging Output. (line 217)
  40884. * variable objects in GDB/MI: GDB/MI Variable Objects.
  40885. (line 9)
  40886. * variable values, wrong: Variables. (line 106)
  40887. * variables, readline: Readline Init File Syntax.
  40888. (line 34)
  40889. * variables, setting: Assignment. (line 16)
  40890. * 'vAttach' packet: Packets. (line 350)
  40891. * 'vCont' packet: Packets. (line 368)
  40892. * 'vCont?' packet: Packets. (line 435)
  40893. * 'vCtrlC' packet: Packets. (line 445)
  40894. * vector unit: Vector Unit. (line 6)
  40895. * vector, auxiliary: OS Information. (line 9)
  40896. * verbose operation: Messages/Warnings. (line 6)
  40897. * verify remote memory image: Memory. (line 142)
  40898. * verify target memory image: Memory. (line 142)
  40899. * 'vFile' packet: Packets. (line 459)
  40900. * 'vFlashDone' packet: Packets. (line 498)
  40901. * 'vFlashErase' packet: Packets. (line 463)
  40902. * 'vFlashWrite' packet: Packets. (line 478)
  40903. * vfork events, remote reply: Stop Reply Packets. (line 116)
  40904. * vforkdone events, remote reply: Stop Reply Packets. (line 128)
  40905. * virtual functions (C++) display: Print Settings. (line 479)
  40906. * 'vKill' packet: Packets. (line 505)
  40907. * 'vMustReplyEmpty' packet: Packets. (line 517)
  40908. * volatile registers: Registers. (line 106)
  40909. * 'vRun' packet: Packets. (line 529)
  40910. * 'vStopped' packet: Packets. (line 544)
  40911. * VTBL display: Print Settings. (line 479)
  40912. * watchdog timer: Maintenance Commands.
  40913. (line 557)
  40914. * watchpoints: Breakpoints. (line 17)
  40915. * watchpoints and threads: Set Watchpoints. (line 179)
  40916. * where to look for shared libraries: Files. (line 381)
  40917. * wild pointer, interpreting: Print Settings. (line 80)
  40918. * Wind River Linux system-wide configuration script: System-wide Configuration Scripts.
  40919. (line 22)
  40920. * word completion: Completion. (line 6)
  40921. * working directory: Source Path. (line 106)
  40922. * working directory (of your program): Working Directory. (line 6)
  40923. * working language: Languages. (line 13)
  40924. * write data into object, remote request: General Query Packets.
  40925. (line 1361)
  40926. * write, file-i/o system call: write. (line 6)
  40927. * writing a frame filter: Writing a Frame Filter.
  40928. (line 6)
  40929. * writing a Guile pretty-printer: Writing a Guile Pretty-Printer.
  40930. (line 6)
  40931. * writing a pretty-printer: Writing a Pretty-Printer.
  40932. (line 6)
  40933. * writing convenience functions: Functions In Python.
  40934. (line 6)
  40935. * writing into corefiles: Patching. (line 6)
  40936. * writing into executables: Patching. (line 6)
  40937. * writing into executables <1>: Compiling and Injecting Code.
  40938. (line 6)
  40939. * writing JIT debug info readers: Writing JIT Debug Info Readers.
  40940. (line 6)
  40941. * writing xmethods in Python: Writing an Xmethod. (line 6)
  40942. * wrong values: Variables. (line 106)
  40943. * 'x' command, default address: Machine Code. (line 34)
  40944. * 'X' packet: Packets. (line 547)
  40945. * Xilinx MicroBlaze: MicroBlaze. (line 6)
  40946. * XInclude: Target Description Format.
  40947. (line 53)
  40948. * XMD, Xilinx Microprocessor Debugger: MicroBlaze. (line 6)
  40949. * xmethod API: Xmethod API. (line 6)
  40950. * xmethods in Python: Xmethods In Python. (line 6)
  40951. * XML parser debugging: Debugging Output. (line 223)
  40952. * yanking text: Readline Killing Commands.
  40953. (line 6)
  40954. * 'z' packet: Packets. (line 560)
  40955. * 'Z' packets: Packets. (line 560)
  40956. * 'z0' packet: Packets. (line 575)
  40957. * 'Z0' packet: Packets. (line 575)
  40958. * 'z1' packet: Packets. (line 630)
  40959. * 'Z1' packet: Packets. (line 630)
  40960. * 'z2' packet: Packets. (line 651)
  40961. * 'Z2' packet: Packets. (line 651)
  40962. * 'z3' packet: Packets. (line 664)
  40963. * 'Z3' packet: Packets. (line 664)
  40964. * 'z4' packet: Packets. (line 677)
  40965. * 'Z4' packet: Packets. (line 677)
  40966. 
  40967. File: gdb.info, Node: Command and Variable Index, Prev: Concept Index, Up: Top
  40968. Command, Variable, and Function Index
  40969. *************************************
  40970. �[index�]
  40971. * Menu:
  40972. * !: Shell Commands. (line 10)
  40973. * "maint info selftests": Maintenance Commands.
  40974. (line 366)
  40975. * # (a comment): Command Syntax. (line 37)
  40976. * $bpnum, convenience variable: Set Breaks. (line 6)
  40977. * $cdir, convenience variable: Source Path. (line 106)
  40978. * $cwd, convenience variable: Source Path. (line 106)
  40979. * $tpnum: Create and Delete Tracepoints.
  40980. (line 122)
  40981. * $tracepoint: Tracepoint Variables.
  40982. (line 10)
  40983. * $trace_file: Tracepoint Variables.
  40984. (line 16)
  40985. * $trace_frame: Tracepoint Variables.
  40986. (line 6)
  40987. * $trace_func: Tracepoint Variables.
  40988. (line 19)
  40989. * $trace_line: Tracepoint Variables.
  40990. (line 13)
  40991. * $_, convenience variable: Convenience Vars. (line 65)
  40992. * $_any_caller_is, convenience function: Convenience Funs. (line 111)
  40993. * $_any_caller_matches, convenience function: Convenience Funs.
  40994. (line 123)
  40995. * $_as_string, convenience function: Convenience Funs. (line 135)
  40996. * $_caller_is, convenience function: Convenience Funs. (line 81)
  40997. * $_caller_matches, convenience function: Convenience Funs. (line 104)
  40998. * $_exception, convenience variable: Set Catchpoints. (line 21)
  40999. * $_exitcode, convenience variable: Convenience Vars. (line 80)
  41000. * $_exitsignal, convenience variable: Convenience Vars. (line 85)
  41001. * $_gthread, convenience variable: Threads. (line 98)
  41002. * $_inferior, convenience variable: Inferiors and Programs.
  41003. (line 56)
  41004. * $_isvoid, convenience function: Convenience Funs. (line 15)
  41005. * $_memeq, convenience function: Convenience Funs. (line 65)
  41006. * $_probe_arg, convenience variable: Static Probe Points. (line 77)
  41007. * $_regex, convenience function: Convenience Funs. (line 69)
  41008. * $_sdata, collect: Tracepoint Actions. (line 86)
  41009. * $_sdata, inspect, convenience variable: Convenience Vars. (line 142)
  41010. * $_siginfo, convenience variable: Convenience Vars. (line 148)
  41011. * $_streq, convenience function: Convenience Funs. (line 74)
  41012. * $_strlen, convenience function: Convenience Funs. (line 78)
  41013. * $_thread, convenience variable: Threads. (line 98)
  41014. * $_tlb, convenience variable: Convenience Vars. (line 154)
  41015. * $__, convenience variable: Convenience Vars. (line 74)
  41016. * (make-command: Commands In Guile. (line 15)
  41017. * (make-parameter: Parameters In Guile. (line 22)
  41018. * -ada-task-info: GDB/MI Ada Tasking Commands.
  41019. (line 9)
  41020. * -add-inferior: GDB/MI Miscellaneous Commands.
  41021. (line 295)
  41022. * -break-after: GDB/MI Breakpoint Commands.
  41023. (line 11)
  41024. * -break-commands: GDB/MI Breakpoint Commands.
  41025. (line 56)
  41026. * -break-condition: GDB/MI Breakpoint Commands.
  41027. (line 90)
  41028. * -break-delete: GDB/MI Breakpoint Commands.
  41029. (line 127)
  41030. * -break-disable: GDB/MI Breakpoint Commands.
  41031. (line 161)
  41032. * -break-enable: GDB/MI Breakpoint Commands.
  41033. (line 197)
  41034. * -break-info: GDB/MI Breakpoint Commands.
  41035. (line 232)
  41036. * -break-insert: GDB/MI Breakpoint Commands.
  41037. (line 256)
  41038. * -break-list: GDB/MI Breakpoint Commands.
  41039. (line 427)
  41040. * -break-passcount: GDB/MI Breakpoint Commands.
  41041. (line 499)
  41042. * -break-watch: GDB/MI Breakpoint Commands.
  41043. (line 511)
  41044. * -catch-assert: Ada Exception GDB/MI Catchpoint Commands.
  41045. (line 12)
  41046. * -catch-exception: Ada Exception GDB/MI Catchpoint Commands.
  41047. (line 46)
  41048. * -catch-handlers: Ada Exception GDB/MI Catchpoint Commands.
  41049. (line 91)
  41050. * -catch-load: Shared Library GDB/MI Catchpoint Commands.
  41051. (line 9)
  41052. * -catch-unload: Shared Library GDB/MI Catchpoint Commands.
  41053. (line 36)
  41054. * -data-disassemble: GDB/MI Data Manipulation.
  41055. (line 15)
  41056. * -data-evaluate-expression: GDB/MI Data Manipulation.
  41057. (line 192)
  41058. * -data-list-changed-registers: GDB/MI Data Manipulation.
  41059. (line 230)
  41060. * -data-list-register-names: GDB/MI Data Manipulation.
  41061. (line 266)
  41062. * -data-list-register-values: GDB/MI Data Manipulation.
  41063. (line 306)
  41064. * -data-read-memory: GDB/MI Data Manipulation.
  41065. (line 393)
  41066. * -data-read-memory-bytes: GDB/MI Data Manipulation.
  41067. (line 500)
  41068. * -data-write-memory-bytes: GDB/MI Data Manipulation.
  41069. (line 575)
  41070. * -dprintf-insert: GDB/MI Breakpoint Commands.
  41071. (line 363)
  41072. * -enable-frame-filters: GDB/MI Stack Manipulation.
  41073. (line 9)
  41074. * -enable-pretty-printing: GDB/MI Variable Objects.
  41075. (line 118)
  41076. * -enable-timings: GDB/MI Miscellaneous Commands.
  41077. (line 392)
  41078. * -environment-cd: GDB/MI Program Context.
  41079. (line 33)
  41080. * -environment-directory: GDB/MI Program Context.
  41081. (line 56)
  41082. * -environment-path: GDB/MI Program Context.
  41083. (line 100)
  41084. * -environment-pwd: GDB/MI Program Context.
  41085. (line 141)
  41086. * -exec-arguments: GDB/MI Program Context.
  41087. (line 9)
  41088. * -exec-continue: GDB/MI Program Execution.
  41089. (line 13)
  41090. * -exec-finish: GDB/MI Program Execution.
  41091. (line 53)
  41092. * -exec-interrupt: GDB/MI Program Execution.
  41093. (line 97)
  41094. * -exec-jump: GDB/MI Program Execution.
  41095. (line 147)
  41096. * -exec-next: GDB/MI Program Execution.
  41097. (line 171)
  41098. * -exec-next-instruction: GDB/MI Program Execution.
  41099. (line 202)
  41100. * -exec-return: GDB/MI Program Execution.
  41101. (line 238)
  41102. * -exec-run: GDB/MI Program Execution.
  41103. (line 283)
  41104. * -exec-step: GDB/MI Program Execution.
  41105. (line 353)
  41106. * -exec-step-instruction: GDB/MI Program Execution.
  41107. (line 395)
  41108. * -exec-until: GDB/MI Program Execution.
  41109. (line 436)
  41110. * -file-exec-and-symbols: GDB/MI File Commands.
  41111. (line 12)
  41112. * -file-exec-file: GDB/MI File Commands.
  41113. (line 40)
  41114. * -file-list-exec-source-file: GDB/MI File Commands.
  41115. (line 67)
  41116. * -file-list-exec-source-files: GDB/MI File Commands.
  41117. (line 93)
  41118. * -file-list-shared-libraries: GDB/MI File Commands.
  41119. (line 123)
  41120. * -file-symbol-file: GDB/MI File Commands.
  41121. (line 157)
  41122. * -gdb-exit: GDB/MI Miscellaneous Commands.
  41123. (line 9)
  41124. * -gdb-set: GDB/MI Miscellaneous Commands.
  41125. (line 31)
  41126. * -gdb-show: GDB/MI Miscellaneous Commands.
  41127. (line 54)
  41128. * -gdb-version: GDB/MI Miscellaneous Commands.
  41129. (line 77)
  41130. * -inferior-tty-set: GDB/MI Miscellaneous Commands.
  41131. (line 343)
  41132. * -inferior-tty-show: GDB/MI Miscellaneous Commands.
  41133. (line 366)
  41134. * -info-ada-exceptions: GDB/MI Ada Exceptions Commands.
  41135. (line 9)
  41136. * -info-gdb-mi-command: GDB/MI Support Commands.
  41137. (line 14)
  41138. * -info-os: GDB/MI Miscellaneous Commands.
  41139. (line 221)
  41140. * -interpreter-exec: GDB/MI Miscellaneous Commands.
  41141. (line 317)
  41142. * -list-features: GDB/MI Support Commands.
  41143. (line 57)
  41144. * -list-target-features: GDB/MI Support Commands.
  41145. (line 115)
  41146. * -list-thread-groups: GDB/MI Miscellaneous Commands.
  41147. (line 111)
  41148. * -stack-info-depth: GDB/MI Stack Manipulation.
  41149. (line 51)
  41150. * -stack-info-frame: GDB/MI Stack Manipulation.
  41151. (line 24)
  41152. * -stack-list-arguments: GDB/MI Stack Manipulation.
  41153. (line 89)
  41154. * -stack-list-frames: GDB/MI Stack Manipulation.
  41155. (line 188)
  41156. * -stack-list-locals: GDB/MI Stack Manipulation.
  41157. (line 305)
  41158. * -stack-list-variables: GDB/MI Stack Manipulation.
  41159. (line 351)
  41160. * -stack-select-frame: GDB/MI Stack Manipulation.
  41161. (line 379)
  41162. * -symbol-list-lines: GDB/MI Symbol Query. (line 9)
  41163. * -target-attach: GDB/MI Target Manipulation.
  41164. (line 9)
  41165. * -target-detach: GDB/MI Target Manipulation.
  41166. (line 36)
  41167. * -target-disconnect: GDB/MI Target Manipulation.
  41168. (line 61)
  41169. * -target-download: GDB/MI Target Manipulation.
  41170. (line 85)
  41171. * -target-file-delete: GDB/MI File Transfer Commands.
  41172. (line 57)
  41173. * -target-file-get: GDB/MI File Transfer Commands.
  41174. (line 33)
  41175. * -target-file-put: GDB/MI File Transfer Commands.
  41176. (line 9)
  41177. * -target-flash-erase: GDB/MI Target Manipulation.
  41178. (line 192)
  41179. * -target-select: GDB/MI Target Manipulation.
  41180. (line 212)
  41181. * -thread-info: GDB/MI Thread Commands.
  41182. (line 9)
  41183. * -thread-list-ids: GDB/MI Thread Commands.
  41184. (line 58)
  41185. * -thread-select: GDB/MI Thread Commands.
  41186. (line 86)
  41187. * -trace-define-variable: GDB/MI Tracepoint Commands.
  41188. (line 80)
  41189. * -trace-find: GDB/MI Tracepoint Commands.
  41190. (line 12)
  41191. * -trace-frame-collected: GDB/MI Tracepoint Commands.
  41192. (line 97)
  41193. * -trace-list-variables: GDB/MI Tracepoint Commands.
  41194. (line 204)
  41195. * -trace-save: GDB/MI Tracepoint Commands.
  41196. (line 246)
  41197. * -trace-start: GDB/MI Tracepoint Commands.
  41198. (line 267)
  41199. * -trace-status: GDB/MI Tracepoint Commands.
  41200. (line 283)
  41201. * -trace-stop: GDB/MI Tracepoint Commands.
  41202. (line 354)
  41203. * -var-assign: GDB/MI Variable Objects.
  41204. (line 497)
  41205. * -var-create: GDB/MI Variable Objects.
  41206. (line 136)
  41207. * -var-delete: GDB/MI Variable Objects.
  41208. (line 224)
  41209. * -var-evaluate-expression: GDB/MI Variable Objects.
  41210. (line 476)
  41211. * -var-info-expression: GDB/MI Variable Objects.
  41212. (line 413)
  41213. * -var-info-num-children: GDB/MI Variable Objects.
  41214. (line 278)
  41215. * -var-info-path-expression: GDB/MI Variable Objects.
  41216. (line 438)
  41217. * -var-info-type: GDB/MI Variable Objects.
  41218. (line 400)
  41219. * -var-list-children: GDB/MI Variable Objects.
  41220. (line 294)
  41221. * -var-set-format: GDB/MI Variable Objects.
  41222. (line 237)
  41223. * -var-set-frozen: GDB/MI Variable Objects.
  41224. (line 641)
  41225. * -var-set-update-range: GDB/MI Variable Objects.
  41226. (line 667)
  41227. * -var-set-visualizer: GDB/MI Variable Objects.
  41228. (line 690)
  41229. * -var-show-attributes: GDB/MI Variable Objects.
  41230. (line 462)
  41231. * -var-show-format: GDB/MI Variable Objects.
  41232. (line 265)
  41233. * -var-update: GDB/MI Variable Objects.
  41234. (line 521)
  41235. * <gdb:arch>: Architectures In Guile.
  41236. (line 6)
  41237. * <gdb:block>: Blocks In Guile. (line 6)
  41238. * <gdb:breakpoint>: Breakpoints In Guile.
  41239. (line 6)
  41240. * <gdb:iterator>: Iterators In Guile. (line 6)
  41241. * <gdb:lazy-string>: Lazy Strings In Guile.
  41242. (line 6)
  41243. * <gdb:objfile>: Objfiles In Guile. (line 6)
  41244. * <gdb:progspace>: Progspaces In Guile. (line 6)
  41245. * <gdb:sal>: Symbol Tables In Guile.
  41246. (line 6)
  41247. * <gdb:symbol>: Symbols In Guile. (line 6)
  41248. * <gdb:symtab>: Symbol Tables In Guile.
  41249. (line 6)
  41250. * <gdb:type>: Types In Guile. (line 6)
  41251. * '<gdb:value>': Values From Inferior In Guile.
  41252. (line 6)
  41253. * @, referencing memory as an array: Arrays. (line 6)
  41254. * ^connected: GDB/MI Result Records.
  41255. (line 22)
  41256. * ^done: GDB/MI Result Records.
  41257. (line 9)
  41258. * ^error: GDB/MI Result Records.
  41259. (line 25)
  41260. * ^exit: GDB/MI Result Records.
  41261. (line 36)
  41262. * ^running: GDB/MI Result Records.
  41263. (line 14)
  41264. * __init__ on TypePrinter: gdb.types. (line 82)
  41265. * abort (C-g): Miscellaneous Commands.
  41266. (line 10)
  41267. * accept-line (Newline or Return): Commands For History.
  41268. (line 6)
  41269. * actions: Tracepoint Actions. (line 6)
  41270. * ada-task-info: GDB/MI Support Commands.
  41271. (line 94)
  41272. * add-auto-load-safe-path: Auto-loading safe path.
  41273. (line 50)
  41274. * add-auto-load-scripts-directory: objfile-gdbdotext file.
  41275. (line 64)
  41276. * add-inferior: Inferiors and Programs.
  41277. (line 69)
  41278. * add-symbol-file: Files. (line 123)
  41279. * add-symbol-file-from-memory: Files. (line 193)
  41280. * adi assign: Sparc64. (line 45)
  41281. * adi examine: Sparc64. (line 27)
  41282. * advance LOCATION: Continuing and Stepping.
  41283. (line 180)
  41284. * alias: Aliases. (line 21)
  41285. * append: Dump/Restore Files. (line 34)
  41286. * append-pretty-printer!: Guile Printing Module.
  41287. (line 18)
  41288. * apropos: Help. (line 62)
  41289. * arch-bool-type: Architectures In Guile.
  41290. (line 84)
  41291. * arch-char-type: Architectures In Guile.
  41292. (line 36)
  41293. * arch-charset: Architectures In Guile.
  41294. (line 23)
  41295. * arch-disassemble: Disassembly In Guile.
  41296. (line 10)
  41297. * arch-double-type: Architectures In Guile.
  41298. (line 76)
  41299. * arch-float-type: Architectures In Guile.
  41300. (line 72)
  41301. * arch-int-type: Architectures In Guile.
  41302. (line 44)
  41303. * arch-int16-type: Architectures In Guile.
  41304. (line 104)
  41305. * arch-int32-type: Architectures In Guile.
  41306. (line 112)
  41307. * arch-int64-type: Architectures In Guile.
  41308. (line 120)
  41309. * arch-int8-type: Architectures In Guile.
  41310. (line 96)
  41311. * arch-long-type: Architectures In Guile.
  41312. (line 48)
  41313. * arch-longdouble-type: Architectures In Guile.
  41314. (line 80)
  41315. * arch-longlong-type: Architectures In Guile.
  41316. (line 88)
  41317. * arch-name: Architectures In Guile.
  41318. (line 20)
  41319. * arch-schar-type: Architectures In Guile.
  41320. (line 52)
  41321. * arch-short-type: Architectures In Guile.
  41322. (line 40)
  41323. * arch-uchar-type: Architectures In Guile.
  41324. (line 56)
  41325. * arch-uint-type: Architectures In Guile.
  41326. (line 64)
  41327. * arch-uint16-type: Architectures In Guile.
  41328. (line 108)
  41329. * arch-uint32-type: Architectures In Guile.
  41330. (line 116)
  41331. * arch-uint64-type: Architectures In Guile.
  41332. (line 124)
  41333. * arch-uint8-type: Architectures In Guile.
  41334. (line 100)
  41335. * arch-ulong-type: Architectures In Guile.
  41336. (line 68)
  41337. * arch-ulonglong-type: Architectures In Guile.
  41338. (line 92)
  41339. * arch-ushort-type: Architectures In Guile.
  41340. (line 60)
  41341. * arch-void-type: Architectures In Guile.
  41342. (line 32)
  41343. * arch-wide-charset: Architectures In Guile.
  41344. (line 26)
  41345. * arch?: Architectures In Guile.
  41346. (line 13)
  41347. * Architecture.disassemble: Architectures In Python.
  41348. (line 15)
  41349. * Architecture.name: Architectures In Python.
  41350. (line 12)
  41351. * attach: Attach. (line 6)
  41352. * attach&: Background Execution.
  41353. (line 25)
  41354. * awatch: Set Watchpoints. (line 83)
  41355. * b ('break'): Set Breaks. (line 6)
  41356. * backtrace: Backtrace. (line 11)
  41357. * backward-char (C-b): Commands For Moving. (line 15)
  41358. * backward-delete-char (Rubout): Commands For Text. (line 11)
  41359. * backward-kill-line (C-x Rubout): Commands For Killing.
  41360. (line 9)
  41361. * backward-kill-word (M-<DEL>): Commands For Killing.
  41362. (line 24)
  41363. * backward-word (M-b): Commands For Moving. (line 22)
  41364. * beginning-of-history (M-<): Commands For History.
  41365. (line 19)
  41366. * beginning-of-line (C-a): Commands For Moving. (line 6)
  41367. * bell-style: Readline Init File Syntax.
  41368. (line 35)
  41369. * bfd caching: File Caching. (line 14)
  41370. * bfd caching <1>: File Caching. (line 24)
  41371. * bfd caching <2>: File Caching. (line 27)
  41372. * bind-tty-special-chars: Readline Init File Syntax.
  41373. (line 42)
  41374. * block-end: Blocks In Guile. (line 70)
  41375. * block-function: Blocks In Guile. (line 73)
  41376. * block-global-block: Blocks In Guile. (line 87)
  41377. * block-global?: Blocks In Guile. (line 93)
  41378. * block-start: Blocks In Guile. (line 67)
  41379. * block-static-block: Blocks In Guile. (line 90)
  41380. * block-static?: Blocks In Guile. (line 97)
  41381. * block-superblock: Blocks In Guile. (line 83)
  41382. * block-symbols: Blocks In Guile. (line 101)
  41383. * block-symbols-progress?: Blocks In Guile. (line 112)
  41384. * block-valid?: Blocks In Guile. (line 59)
  41385. * Block.end: Blocks In Python. (line 83)
  41386. * Block.function: Blocks In Python. (line 87)
  41387. * Block.global_block: Blocks In Python. (line 102)
  41388. * Block.is_global: Blocks In Python. (line 110)
  41389. * Block.is_static: Blocks In Python. (line 114)
  41390. * Block.is_valid: Blocks In Python. (line 70)
  41391. * Block.start: Blocks In Python. (line 80)
  41392. * Block.static_block: Blocks In Python. (line 106)
  41393. * Block.superblock: Blocks In Python. (line 97)
  41394. * block?: Blocks In Guile. (line 55)
  41395. * BP_ACCESS_WATCHPOINT: Breakpoints In Python.
  41396. (line 74)
  41397. * BP_ACCESS_WATCHPOINT <1>: Breakpoints In Guile.
  41398. (line 71)
  41399. * BP_BREAKPOINT: Breakpoints In Python.
  41400. (line 62)
  41401. * BP_BREAKPOINT <1>: Breakpoints In Guile.
  41402. (line 57)
  41403. * BP_HARDWARE_WATCHPOINT: Breakpoints In Python.
  41404. (line 68)
  41405. * BP_HARDWARE_WATCHPOINT <1>: Breakpoints In Guile.
  41406. (line 63)
  41407. * BP_READ_WATCHPOINT: Breakpoints In Python.
  41408. (line 71)
  41409. * BP_READ_WATCHPOINT <1>: Breakpoints In Guile.
  41410. (line 67)
  41411. * BP_WATCHPOINT: Breakpoints In Python.
  41412. (line 65)
  41413. * BP_WATCHPOINT <1>: Breakpoints In Guile.
  41414. (line 60)
  41415. * break: Set Breaks. (line 6)
  41416. * break ... task TASKNO (Ada): Ada Tasks. (line 135)
  41417. * break ... thread THREAD-ID: Thread-Specific Breakpoints.
  41418. (line 10)
  41419. * break, and Objective-C: Method Names in Commands.
  41420. (line 9)
  41421. * break-range: PowerPC Embedded. (line 41)
  41422. * breakpoint annotation: Annotations for Running.
  41423. (line 47)
  41424. * breakpoint-commands: Breakpoints In Guile.
  41425. (line 236)
  41426. * breakpoint-condition: Breakpoints In Guile.
  41427. (line 194)
  41428. * breakpoint-enabled?: Breakpoints In Guile.
  41429. (line 144)
  41430. * breakpoint-expression: Breakpoints In Guile.
  41431. (line 139)
  41432. * breakpoint-hit-count: Breakpoints In Guile.
  41433. (line 169)
  41434. * breakpoint-ignore-count: Breakpoints In Guile.
  41435. (line 163)
  41436. * breakpoint-location: Breakpoints In Guile.
  41437. (line 134)
  41438. * breakpoint-notifications: GDB/MI Support Commands.
  41439. (line 91)
  41440. * breakpoint-number: Breakpoints In Guile.
  41441. (line 122)
  41442. * breakpoint-silent?: Breakpoints In Guile.
  41443. (line 151)
  41444. * breakpoint-stop: Breakpoints In Guile.
  41445. (line 202)
  41446. * breakpoint-task: Breakpoints In Guile.
  41447. (line 185)
  41448. * breakpoint-thread: Breakpoints In Guile.
  41449. (line 176)
  41450. * breakpoint-type: Breakpoints In Guile.
  41451. (line 126)
  41452. * breakpoint-valid?: Breakpoints In Guile.
  41453. (line 112)
  41454. * breakpoint-visible?: Breakpoints In Guile.
  41455. (line 130)
  41456. * Breakpoint.commands: Breakpoints In Python.
  41457. (line 211)
  41458. * Breakpoint.condition: Breakpoints In Python.
  41459. (line 206)
  41460. * Breakpoint.delete: Breakpoints In Python.
  41461. (line 128)
  41462. * Breakpoint.enabled: Breakpoints In Python.
  41463. (line 133)
  41464. * Breakpoint.expression: Breakpoints In Python.
  41465. (line 200)
  41466. * Breakpoint.hit_count: Breakpoints In Python.
  41467. (line 189)
  41468. * Breakpoint.ignore_count: Breakpoints In Python.
  41469. (line 161)
  41470. * Breakpoint.is_valid: Breakpoints In Python.
  41471. (line 120)
  41472. * Breakpoint.location: Breakpoints In Python.
  41473. (line 194)
  41474. * Breakpoint.number: Breakpoints In Python.
  41475. (line 165)
  41476. * Breakpoint.pending: Breakpoints In Python.
  41477. (line 146)
  41478. * Breakpoint.silent: Breakpoints In Python.
  41479. (line 138)
  41480. * Breakpoint.stop: Breakpoints In Python.
  41481. (line 89)
  41482. * Breakpoint.task: Breakpoints In Python.
  41483. (line 155)
  41484. * Breakpoint.temporary: Breakpoints In Python.
  41485. (line 180)
  41486. * Breakpoint.thread: Breakpoints In Python.
  41487. (line 150)
  41488. * Breakpoint.type: Breakpoints In Python.
  41489. (line 170)
  41490. * Breakpoint.visible: Breakpoints In Python.
  41491. (line 175)
  41492. * Breakpoint.__init__: Breakpoints In Python.
  41493. (line 16)
  41494. * Breakpoint.__init__ <1>: Breakpoints In Python.
  41495. (line 49)
  41496. * breakpoint?: Breakpoints In Guile.
  41497. (line 108)
  41498. * BreakpointEvent.breakpoint: Events In Python. (line 105)
  41499. * BreakpointEvent.breakpoints: Events In Python. (line 101)
  41500. * breakpoints: Breakpoints In Guile.
  41501. (line 104)
  41502. * breakpoints-invalid annotation: Invalidation. (line 14)
  41503. * bt ('backtrace'): Backtrace. (line 11)
  41504. * c ('continue'): Continuing and Stepping.
  41505. (line 16)
  41506. * c (SingleKey TUI key): TUI Single Key Mode. (line 10)
  41507. * C-L: TUI Keys. (line 65)
  41508. * C-x 1: TUI Keys. (line 19)
  41509. * C-x 2: TUI Keys. (line 26)
  41510. * C-x a: TUI Keys. (line 11)
  41511. * C-x A: TUI Keys. (line 12)
  41512. * C-x C-a: TUI Keys. (line 10)
  41513. * C-x o: TUI Keys. (line 34)
  41514. * C-x s: TUI Keys. (line 41)
  41515. * call: Calling. (line 11)
  41516. * call-last-kbd-macro (C-x e): Keyboard Macros. (line 13)
  41517. * capitalize-word (M-c): Commands For Text. (line 49)
  41518. * catch: Set Catchpoints. (line 10)
  41519. * catch assert: Set Catchpoints. (line 104)
  41520. * catch catch: Set Catchpoints. (line 16)
  41521. * catch exception: Set Catchpoints. (line 66)
  41522. * catch exception unhandled: Set Catchpoints. (line 100)
  41523. * catch exec: Set Catchpoints. (line 107)
  41524. * catch fork: Set Catchpoints. (line 252)
  41525. * catch handlers: Set Catchpoints. (line 83)
  41526. * catch load: Set Catchpoints. (line 259)
  41527. * catch rethrow: Set Catchpoints. (line 16)
  41528. * catch signal: Set Catchpoints. (line 264)
  41529. * catch syscall: Set Catchpoints. (line 111)
  41530. * catch throw: Set Catchpoints. (line 16)
  41531. * catch unload: Set Catchpoints. (line 259)
  41532. * catch vfork: Set Catchpoints. (line 255)
  41533. * cd: Working Directory. (line 32)
  41534. * cdir: Source Path. (line 106)
  41535. * character-search (C-]): Miscellaneous Commands.
  41536. (line 41)
  41537. * character-search-backward (M-C-]): Miscellaneous Commands.
  41538. (line 46)
  41539. * checkpoint: Checkpoint/Restart. (line 26)
  41540. * clear: Delete Breaks. (line 21)
  41541. * clear, and Objective-C: Method Names in Commands.
  41542. (line 9)
  41543. * clear-screen (C-l): Commands For Moving. (line 26)
  41544. * ClearObjFilesEvent.progspace: Events In Python. (line 125)
  41545. * clone-inferior: Inferiors and Programs.
  41546. (line 76)
  41547. * collect (tracepoints): Tracepoint Actions. (line 49)
  41548. * colon-colon, in Modula-2: M2 Scope. (line 6)
  41549. * Command.complete: Commands In Python. (line 70)
  41550. * Command.dont_repeat: Commands In Python. (line 42)
  41551. * Command.invoke: Commands In Python. (line 48)
  41552. * Command.__init__: Commands In Python. (line 10)
  41553. * command?: Commands In Guile. (line 63)
  41554. * commands: Break Commands. (line 11)
  41555. * commands annotation: Prompting. (line 27)
  41556. * COMMAND_BREAKPOINTS: Commands In Python. (line 142)
  41557. * COMMAND_BREAKPOINTS <1>: Commands In Guile. (line 177)
  41558. * COMMAND_DATA: Commands In Python. (line 113)
  41559. * COMMAND_DATA <1>: Commands In Guile. (line 148)
  41560. * COMMAND_FILES: Commands In Python. (line 124)
  41561. * COMMAND_FILES <1>: Commands In Guile. (line 159)
  41562. * COMMAND_MAINTENANCE: Commands In Python. (line 166)
  41563. * COMMAND_MAINTENANCE <1>: Commands In Guile. (line 201)
  41564. * COMMAND_NONE: Commands In Python. (line 103)
  41565. * COMMAND_NONE <1>: Commands In Guile. (line 137)
  41566. * COMMAND_OBSCURE: Commands In Python. (line 160)
  41567. * COMMAND_OBSCURE <1>: Commands In Guile. (line 195)
  41568. * COMMAND_RUNNING: Commands In Python. (line 107)
  41569. * COMMAND_RUNNING <1>: Commands In Guile. (line 142)
  41570. * COMMAND_STACK: Commands In Python. (line 118)
  41571. * COMMAND_STACK <1>: Commands In Guile. (line 153)
  41572. * COMMAND_STATUS: Commands In Python. (line 136)
  41573. * COMMAND_STATUS <1>: Commands In Guile. (line 171)
  41574. * COMMAND_SUPPORT: Commands In Python. (line 129)
  41575. * COMMAND_SUPPORT <1>: Commands In Guile. (line 164)
  41576. * COMMAND_TRACEPOINTS: Commands In Python. (line 148)
  41577. * COMMAND_TRACEPOINTS <1>: Commands In Guile. (line 183)
  41578. * COMMAND_USER: Commands In Python. (line 154)
  41579. * COMMAND_USER <1>: Commands In Guile. (line 189)
  41580. * comment-begin: Readline Init File Syntax.
  41581. (line 47)
  41582. * compare-sections: Memory. (line 149)
  41583. * compile code: Compiling and Injecting Code.
  41584. (line 11)
  41585. * compile file: Compiling and Injecting Code.
  41586. (line 56)
  41587. * complete: Help. (line 77)
  41588. * complete (<TAB>): Commands For Completion.
  41589. (line 6)
  41590. * COMPLETE_COMMAND: Commands In Python. (line 187)
  41591. * COMPLETE_COMMAND <1>: Commands In Guile. (line 222)
  41592. * COMPLETE_EXPRESSION: Commands In Python. (line 195)
  41593. * COMPLETE_EXPRESSION <1>: Commands In Guile. (line 230)
  41594. * COMPLETE_FILENAME: Commands In Python. (line 180)
  41595. * COMPLETE_FILENAME <1>: Commands In Guile. (line 215)
  41596. * COMPLETE_LOCATION: Commands In Python. (line 183)
  41597. * COMPLETE_LOCATION <1>: Commands In Guile. (line 218)
  41598. * COMPLETE_NONE: Commands In Python. (line 177)
  41599. * COMPLETE_NONE <1>: Commands In Guile. (line 212)
  41600. * COMPLETE_SYMBOL: Commands In Python. (line 191)
  41601. * COMPLETE_SYMBOL <1>: Commands In Guile. (line 226)
  41602. * completion-display-width: Readline Init File Syntax.
  41603. (line 52)
  41604. * completion-ignore-case: Readline Init File Syntax.
  41605. (line 59)
  41606. * completion-map-case: Readline Init File Syntax.
  41607. (line 64)
  41608. * completion-prefix-display-length: Readline Init File Syntax.
  41609. (line 70)
  41610. * completion-query-items: Readline Init File Syntax.
  41611. (line 77)
  41612. * condition: Conditions. (line 58)
  41613. * continue: Continuing and Stepping.
  41614. (line 16)
  41615. * continue&: Background Execution.
  41616. (line 40)
  41617. * convert-meta: Readline Init File Syntax.
  41618. (line 87)
  41619. * copy-backward-word (): Commands For Killing.
  41620. (line 49)
  41621. * copy-forward-word (): Commands For Killing.
  41622. (line 54)
  41623. * copy-region-as-kill (): Commands For Killing.
  41624. (line 45)
  41625. * core-file: Files. (line 107)
  41626. * ctf: Trace Files. (line 28)
  41627. * Ctrl-o (operate-and-get-next): Command Syntax. (line 41)
  41628. * current-arch: Architectures In Guile.
  41629. (line 17)
  41630. * current-objfile: Objfiles In Guile. (line 46)
  41631. * current-progspace: Progspaces In Guile. (line 26)
  41632. * cwd: Source Path. (line 106)
  41633. * d ('delete'): Delete Breaks. (line 41)
  41634. * d (SingleKey TUI key): TUI Single Key Mode. (line 13)
  41635. * data-directory: Guile Configuration. (line 9)
  41636. * data-disassemble-a-option: GDB/MI Support Commands.
  41637. (line 108)
  41638. * data-read-memory-bytes: GDB/MI Support Commands.
  41639. (line 88)
  41640. * default-visualizer: Guile Pretty Printing API.
  41641. (line 126)
  41642. * define: Define. (line 50)
  41643. * delete: Delete Breaks. (line 41)
  41644. * delete checkpoint CHECKPOINT-ID: Checkpoint/Restart. (line 53)
  41645. * delete display: Auto Display. (line 45)
  41646. * delete mem: Memory Region Attributes.
  41647. (line 34)
  41648. * delete tracepoint: Create and Delete Tracepoints.
  41649. (line 125)
  41650. * delete tvariable: Trace State Variables.
  41651. (line 42)
  41652. * delete-breakpoint!: Breakpoints In Guile.
  41653. (line 95)
  41654. * delete-char (C-d): Commands For Text. (line 6)
  41655. * delete-char-or-list (): Commands For Completion.
  41656. (line 39)
  41657. * delete-horizontal-space (): Commands For Killing.
  41658. (line 37)
  41659. * demangle: Symbols. (line 114)
  41660. * detach: Attach. (line 36)
  41661. * detach (remote): Connecting. (line 256)
  41662. * detach inferiors INFNO...: Inferiors and Programs.
  41663. (line 105)
  41664. * digit-argument ('M-0', 'M-1', ... 'M--'): Numeric Arguments.
  41665. (line 6)
  41666. * dir: Source Path. (line 38)
  41667. * directory: Source Path. (line 38)
  41668. * dis ('disable'): Disabling. (line 37)
  41669. * disable: Disabling. (line 37)
  41670. * disable display: Auto Display. (line 56)
  41671. * disable frame-filter: Frame Filter Management.
  41672. (line 16)
  41673. * disable mem: Memory Region Attributes.
  41674. (line 38)
  41675. * disable pretty-printer: Pretty-Printer Commands.
  41676. (line 20)
  41677. * disable probes: Static Probe Points. (line 73)
  41678. * disable tracepoint: Enable and Disable Tracepoints.
  41679. (line 9)
  41680. * disable type-printer: Symbols. (line 406)
  41681. * disable-completion: Readline Init File Syntax.
  41682. (line 93)
  41683. * disassemble: Machine Code. (line 43)
  41684. * disconnect: Connecting. (line 265)
  41685. * display: Auto Display. (line 23)
  41686. * do ('down'): Selection. (line 74)
  41687. * do-uppercase-version (M-a, M-b, M-X, ...): Miscellaneous Commands.
  41688. (line 14)
  41689. * document: Define. (line 62)
  41690. * dont-repeat: Commands In Guile. (line 67)
  41691. * dont-repeat <1>: Define. (line 74)
  41692. * down: Selection. (line 74)
  41693. * Down: TUI Keys. (line 56)
  41694. * down-silently: Selection. (line 106)
  41695. * downcase-word (M-l): Commands For Text. (line 45)
  41696. * dprintf: Dynamic Printf. (line 26)
  41697. * dprintf-style agent: Dynamic Printf. (line 46)
  41698. * dprintf-style call: Dynamic Printf. (line 42)
  41699. * dprintf-style gdb: Dynamic Printf. (line 39)
  41700. * dump: Dump/Restore Files. (line 13)
  41701. * dump-functions (): Miscellaneous Commands.
  41702. (line 69)
  41703. * dump-macros (): Miscellaneous Commands.
  41704. (line 81)
  41705. * dump-variables (): Miscellaneous Commands.
  41706. (line 75)
  41707. * e ('edit'): Edit. (line 6)
  41708. * echo: Output. (line 12)
  41709. * edit: Edit. (line 6)
  41710. * editing-mode: Readline Init File Syntax.
  41711. (line 98)
  41712. * else: Command Files. (line 74)
  41713. * emacs-editing-mode (C-e): Miscellaneous Commands.
  41714. (line 87)
  41715. * enable: Disabling. (line 44)
  41716. * enable display: Auto Display. (line 65)
  41717. * enable frame-filter: Frame Filter Management.
  41718. (line 26)
  41719. * enable mem: Memory Region Attributes.
  41720. (line 42)
  41721. * enable pretty-printer: Pretty-Printer Commands.
  41722. (line 25)
  41723. * enable probes: Static Probe Points. (line 60)
  41724. * enable tracepoint: Enable and Disable Tracepoints.
  41725. (line 19)
  41726. * enable type-printer: Symbols. (line 406)
  41727. * enable-keypad: Readline Init File Syntax.
  41728. (line 109)
  41729. * enabled: Xmethod API. (line 18)
  41730. * enabled of type_printer: Type Printing API. (line 13)
  41731. * end (breakpoint commands): Break Commands. (line 11)
  41732. * end (if/else/while commands): Command Files. (line 103)
  41733. * end (user-defined commands): Define. (line 62)
  41734. * end-kbd-macro (C-x )): Keyboard Macros. (line 9)
  41735. * end-of-history (M->): Commands For History.
  41736. (line 22)
  41737. * end-of-iteration: Iterators In Guile. (line 70)
  41738. * end-of-iteration?: Iterators In Guile. (line 73)
  41739. * end-of-line (C-e): Commands For Moving. (line 9)
  41740. * error annotation: Errors. (line 10)
  41741. * error-begin annotation: Errors. (line 22)
  41742. * error-port: I/O Ports in Guile. (line 12)
  41743. * eval: Output. (line 117)
  41744. * EventRegistry.connect: Events In Python. (line 19)
  41745. * EventRegistry.disconnect: Events In Python. (line 23)
  41746. * exception-args: Guile Exception Handling.
  41747. (line 103)
  41748. * exception-key: Guile Exception Handling.
  41749. (line 100)
  41750. * exception?: Guile Exception Handling.
  41751. (line 96)
  41752. * exceptionHandler: Bootstrapping. (line 38)
  41753. * exchange-point-and-mark (C-x C-x): Miscellaneous Commands.
  41754. (line 36)
  41755. * exec-file: Files. (line 39)
  41756. * exec-run-start-option: GDB/MI Support Commands.
  41757. (line 105)
  41758. * execute: Basic Guile. (line 68)
  41759. * exited annotation: Annotations for Running.
  41760. (line 18)
  41761. * ExitedEvent.exit_code: Events In Python. (line 67)
  41762. * ExitedEvent.inferior: Events In Python. (line 72)
  41763. * expand-tilde: Readline Init File Syntax.
  41764. (line 120)
  41765. * explore: Data. (line 36)
  41766. * f ('frame'): Selection. (line 11)
  41767. * f (SingleKey TUI key): TUI Single Key Mode. (line 16)
  41768. * faas: Frame Apply. (line 89)
  41769. * fg (resume foreground execution): Continuing and Stepping.
  41770. (line 16)
  41771. * field-artificial?: Types In Guile. (line 262)
  41772. * field-base-class?: Types In Guile. (line 266)
  41773. * field-bitpos: Types In Guile. (line 253)
  41774. * field-bitsize: Types In Guile. (line 257)
  41775. * field-enumval: Types In Guile. (line 250)
  41776. * field-name: Types In Guile. (line 243)
  41777. * field-type: Types In Guile. (line 246)
  41778. * field?: Types In Guile. (line 239)
  41779. * file: Files. (line 16)
  41780. * fin ('finish'): Continuing and Stepping.
  41781. (line 109)
  41782. * find: Searching Memory. (line 9)
  41783. * find-pc-line: Symbol Tables In Guile.
  41784. (line 71)
  41785. * finish: Continuing and Stepping.
  41786. (line 109)
  41787. * finish&: Background Execution.
  41788. (line 43)
  41789. * FinishBreakpoint.out_of_scope: Finish Breakpoints in Python.
  41790. (line 21)
  41791. * FinishBreakpoint.return_value: Finish Breakpoints in Python.
  41792. (line 38)
  41793. * FinishBreakpoint.__init__: Finish Breakpoints in Python.
  41794. (line 14)
  41795. * flash-erase: Target Commands. (line 140)
  41796. * flushregs: Maintenance Commands.
  41797. (line 303)
  41798. * flush_i_cache: Bootstrapping. (line 60)
  41799. * fo ('forward-search'): Search. (line 9)
  41800. * focus: TUI Commands. (line 55)
  41801. * forward-backward-delete-char (): Commands For Text. (line 15)
  41802. * forward-char (C-f): Commands For Moving. (line 12)
  41803. * forward-search: Search. (line 9)
  41804. * forward-search-history (C-s): Commands For History.
  41805. (line 30)
  41806. * forward-word (M-f): Commands For Moving. (line 18)
  41807. * frame address: Selection. (line 30)
  41808. * frame apply: Frame Apply. (line 6)
  41809. * frame function: Selection. (line 48)
  41810. * frame level: Selection. (line 16)
  41811. * frame view: Selection. (line 53)
  41812. * frame, selecting: Selection. (line 11)
  41813. * frame-arch: Frames In Guile. (line 35)
  41814. * frame-block: Frames In Guile. (line 121)
  41815. * frame-function: Frames In Guile. (line 125)
  41816. * frame-name: Frames In Guile. (line 32)
  41817. * frame-newer: Frames In Guile. (line 133)
  41818. * frame-older: Frames In Guile. (line 130)
  41819. * frame-pc: Frames In Guile. (line 118)
  41820. * frame-read-register: Frames In Guile. (line 140)
  41821. * frame-read-var: Frames In Guile. (line 144)
  41822. * frame-sal: Frames In Guile. (line 136)
  41823. * frame-select: Frames In Guile. (line 152)
  41824. * frame-type: Frames In Guile. (line 39)
  41825. * frame-unwind-stop-reason: Frames In Guile. (line 67)
  41826. * frame-valid?: Frames In Guile. (line 26)
  41827. * Frame.architecture: Frames In Python. (line 53)
  41828. * Frame.block: Frames In Python. (line 139)
  41829. * Frame.find_sal: Frames In Python. (line 155)
  41830. * Frame.function: Frames In Python. (line 145)
  41831. * Frame.is_valid: Frames In Python. (line 43)
  41832. * Frame.name: Frames In Python. (line 49)
  41833. * Frame.newer: Frames In Python. (line 152)
  41834. * Frame.older: Frames In Python. (line 149)
  41835. * Frame.pc: Frames In Python. (line 136)
  41836. * Frame.read_register: Frames In Python. (line 159)
  41837. * Frame.read_var: Frames In Python. (line 164)
  41838. * Frame.select: Frames In Python. (line 172)
  41839. * Frame.type: Frames In Python. (line 57)
  41840. * Frame.unwind_stop_reason: Frames In Python. (line 84)
  41841. * frame?: Frames In Guile. (line 22)
  41842. * FrameDecorator.address: Frame Decorator API. (line 60)
  41843. * FrameDecorator.elided: Frame Decorator API. (line 29)
  41844. * FrameDecorator.filename: Frame Decorator API. (line 70)
  41845. * FrameDecorator.frame_args: Frame Decorator API. (line 91)
  41846. * FrameDecorator.frame_locals: Frame Decorator API. (line 143)
  41847. * FrameDecorator.function: Frame Decorator API. (line 49)
  41848. * FrameDecorator.inferior_frame: Frame Decorator API. (line 176)
  41849. * FrameDecorator.line: Frame Decorator API. (line 81)
  41850. * FrameFilter.enabled: Frame Filter API. (line 122)
  41851. * FrameFilter.filter: Frame Filter API. (line 75)
  41852. * FrameFilter.name: Frame Filter API. (line 115)
  41853. * FrameFilter.priority: Frame Filter API. (line 131)
  41854. * frames-invalid annotation: Invalidation. (line 9)
  41855. * frozen-varobjs: GDB/MI Support Commands.
  41856. (line 75)
  41857. * ftrace: Create and Delete Tracepoints.
  41858. (line 50)
  41859. * Function: Functions In Python. (line 6)
  41860. * Function.invoke: Functions In Python. (line 19)
  41861. * Function.__init__: Functions In Python. (line 10)
  41862. * gcore: Core File Generation.
  41863. (line 17)
  41864. * gdb-object-kind: GDB Scheme Data Types.
  41865. (line 10)
  41866. * gdb-version: Guile Configuration. (line 17)
  41867. * gdb.Block: Blocks In Python. (line 6)
  41868. * gdb.block_for_pc: Blocks In Python. (line 61)
  41869. * gdb.block_for_pc <1>: Blocks In Python. (line 61)
  41870. * gdb.BP_ACCESS_WATCHPOINT: Breakpoints In Python.
  41871. (line 74)
  41872. * gdb.BP_BREAKPOINT: Breakpoints In Python.
  41873. (line 62)
  41874. * gdb.BP_HARDWARE_WATCHPOINT: Breakpoints In Python.
  41875. (line 68)
  41876. * gdb.BP_READ_WATCHPOINT: Breakpoints In Python.
  41877. (line 71)
  41878. * gdb.BP_WATCHPOINT: Breakpoints In Python.
  41879. (line 65)
  41880. * gdb.Breakpoint: Breakpoints In Python.
  41881. (line 6)
  41882. * gdb.breakpoints: Basic Python. (line 59)
  41883. * gdb.breakpoints <1>: Basic Python. (line 59)
  41884. * gdb.COMMAND_BREAKPOINTS: Commands In Python. (line 142)
  41885. * gdb.COMMAND_DATA: Commands In Python. (line 113)
  41886. * gdb.COMMAND_FILES: Commands In Python. (line 124)
  41887. * gdb.COMMAND_MAINTENANCE: Commands In Python. (line 166)
  41888. * gdb.COMMAND_NONE: Commands In Python. (line 103)
  41889. * gdb.COMMAND_OBSCURE: Commands In Python. (line 160)
  41890. * gdb.COMMAND_RUNNING: Commands In Python. (line 107)
  41891. * gdb.COMMAND_STACK: Commands In Python. (line 118)
  41892. * gdb.COMMAND_STATUS: Commands In Python. (line 136)
  41893. * gdb.COMMAND_SUPPORT: Commands In Python. (line 129)
  41894. * gdb.COMMAND_TRACEPOINTS: Commands In Python. (line 148)
  41895. * gdb.COMMAND_USER: Commands In Python. (line 154)
  41896. * gdb.COMPLETE_COMMAND: Commands In Python. (line 187)
  41897. * gdb.COMPLETE_EXPRESSION: Commands In Python. (line 195)
  41898. * gdb.COMPLETE_FILENAME: Commands In Python. (line 180)
  41899. * gdb.COMPLETE_LOCATION: Commands In Python. (line 183)
  41900. * gdb.COMPLETE_NONE: Commands In Python. (line 177)
  41901. * gdb.COMPLETE_SYMBOL: Commands In Python. (line 191)
  41902. * gdb.convenience_variable: Basic Python. (line 106)
  41903. * gdb.convenience_variable <1>: Basic Python. (line 106)
  41904. * gdb.current_objfile: Objfiles In Python. (line 15)
  41905. * gdb.current_objfile <1>: Objfiles In Python. (line 15)
  41906. * gdb.current_progspace: Progspaces In Python.
  41907. (line 14)
  41908. * gdb.current_progspace <1>: Progspaces In Python.
  41909. (line 14)
  41910. * gdb.current_recording: Recordings In Python.
  41911. (line 21)
  41912. * gdb.decode_line: Basic Python. (line 229)
  41913. * gdb.decode_line <1>: Basic Python. (line 229)
  41914. * gdb.default_visualizer: Pretty Printing API. (line 84)
  41915. * gdb.default_visualizer <1>: Pretty Printing API. (line 84)
  41916. * gdb.error: Exception Handling. (line 22)
  41917. * gdb.execute: Basic Python. (line 40)
  41918. * gdb.execute <1>: Basic Python. (line 40)
  41919. * gdb.find_pc_line: Basic Python. (line 132)
  41920. * gdb.find_pc_line <1>: Basic Python. (line 132)
  41921. * gdb.FinishBreakpoint: Finish Breakpoints in Python.
  41922. (line 6)
  41923. * gdb.flush: Basic Python. (line 193)
  41924. * gdb.flush <1>: Basic Python. (line 193)
  41925. * gdb.FrameDecorator: Frame Decorator API. (line 25)
  41926. * gdb.frame_stop_reason_string: Frames In Python. (line 29)
  41927. * gdb.Function: Functions In Python. (line 6)
  41928. * gdb.GdbError: Exception Handling. (line 48)
  41929. * gdb.history: Basic Python. (line 93)
  41930. * gdb.history <1>: Basic Python. (line 93)
  41931. * gdb.Inferior: Inferiors In Python. (line 6)
  41932. * gdb.InferiorCallPostEvent: Events In Python. (line 145)
  41933. * gdb.InferiorCallPreEvent: Events In Python. (line 135)
  41934. * gdb.inferiors: Inferiors In Python. (line 14)
  41935. * gdb.InferiorThread: Threads In Python. (line 6)
  41936. * gdb.invalidate_cached_frames: Frames In Python. (line 34)
  41937. * gdb.invalidate_cached_frames <1>: Frames In Python. (line 34)
  41938. * gdb.LazyString: Lazy Strings In Python.
  41939. (line 6)
  41940. * gdb.LineTable: Line Tables In Python.
  41941. (line 6)
  41942. * gdb.lookup_global_symbol: Symbols In Python. (line 33)
  41943. * gdb.lookup_global_symbol <1>: Symbols In Python. (line 33)
  41944. * gdb.lookup_objfile: Objfiles In Python. (line 28)
  41945. * gdb.lookup_objfile <1>: Objfiles In Python. (line 28)
  41946. * gdb.lookup_symbol: Symbols In Python. (line 13)
  41947. * gdb.lookup_symbol <1>: Symbols In Python. (line 13)
  41948. * gdb.lookup_type: Types In Python. (line 11)
  41949. * gdb.lookup_type <1>: Types In Python. (line 11)
  41950. * gdb.MemoryError: Exception Handling. (line 30)
  41951. * gdb.newest_frame: Frames In Python. (line 26)
  41952. * gdb.newest_frame <1>: Frames In Python. (line 26)
  41953. * gdb.Objfile: Objfiles In Python. (line 6)
  41954. * gdb.objfiles: Objfiles In Python. (line 21)
  41955. * gdb.objfiles <1>: Objfiles In Python. (line 21)
  41956. * gdb.Parameter: Parameters In Python.
  41957. (line 6)
  41958. * gdb.parameter: Basic Python. (line 82)
  41959. * gdb.parameter <1>: Basic Python. (line 82)
  41960. * gdb.PARAM_AUTO_BOOLEAN: Parameters In Python.
  41961. (line 116)
  41962. * gdb.PARAM_BOOLEAN: Parameters In Python.
  41963. (line 112)
  41964. * gdb.PARAM_ENUM: Parameters In Python.
  41965. (line 160)
  41966. * gdb.PARAM_FILENAME: Parameters In Python.
  41967. (line 142)
  41968. * gdb.PARAM_INTEGER: Parameters In Python.
  41969. (line 125)
  41970. * gdb.PARAM_OPTIONAL_FILENAME: Parameters In Python.
  41971. (line 139)
  41972. * gdb.PARAM_STRING: Parameters In Python.
  41973. (line 129)
  41974. * gdb.PARAM_STRING_NOESCAPE: Parameters In Python.
  41975. (line 135)
  41976. * gdb.PARAM_UINTEGER: Parameters In Python.
  41977. (line 121)
  41978. * gdb.PARAM_ZINTEGER: Parameters In Python.
  41979. (line 146)
  41980. * gdb.PARAM_ZUINTEGER: Parameters In Python.
  41981. (line 150)
  41982. * gdb.PARAM_ZUINTEGER_UNLIMITED: Parameters In Python.
  41983. (line 155)
  41984. * gdb.parse_and_eval: Basic Python. (line 122)
  41985. * gdb.parse_and_eval <1>: Basic Python. (line 122)
  41986. * gdb.post_event: Basic Python. (line 141)
  41987. * gdb.post_event <1>: Basic Python. (line 141)
  41988. * gdb.Progspace: Progspaces In Python.
  41989. (line 6)
  41990. * gdb.progspaces: Progspaces In Python.
  41991. (line 20)
  41992. * gdb.progspaces <1>: Progspaces In Python.
  41993. (line 20)
  41994. * gdb.prompt_hook: Basic Python. (line 241)
  41995. * gdb.PYTHONDIR: Basic Python. (line 37)
  41996. * gdb.PYTHONDIR <1>: Basic Python. (line 37)
  41997. * gdb.rbreak: Basic Python. (line 66)
  41998. * gdb.search_memory: Inferiors In Python. (line 71)
  41999. * gdb.selected_frame: Frames In Python. (line 22)
  42000. * gdb.selected_frame <1>: Frames In Python. (line 22)
  42001. * gdb.selected_inferior: Inferiors In Python. (line 17)
  42002. * gdb.selected_thread: Threads In Python. (line 13)
  42003. * gdb.selected_thread <1>: Threads In Python. (line 13)
  42004. * gdb.set_convenience_variable: Basic Python. (line 113)
  42005. * gdb.set_convenience_variable <1>: Basic Python. (line 113)
  42006. * gdb.solib_name: Basic Python. (line 223)
  42007. * gdb.solib_name <1>: Basic Python. (line 223)
  42008. * gdb.start_recording: Recordings In Python.
  42009. (line 9)
  42010. * gdb.STDERR: Basic Python. (line 183)
  42011. * gdb.STDERR <1>: Basic Python. (line 203)
  42012. * gdb.STDLOG: Basic Python. (line 186)
  42013. * gdb.STDLOG <1>: Basic Python. (line 206)
  42014. * gdb.STDOUT: Basic Python. (line 180)
  42015. * gdb.STDOUT <1>: Basic Python. (line 200)
  42016. * gdb.stop_recording: Recordings In Python.
  42017. (line 25)
  42018. * gdb.string_to_argv: Commands In Python. (line 61)
  42019. * gdb.Symbol: Symbols In Python. (line 6)
  42020. * gdb.SYMBOL_COMMON_BLOCK_DOMAIN: Symbols In Python. (line 133)
  42021. * gdb.SYMBOL_LABEL_DOMAIN: Symbols In Python. (line 127)
  42022. * gdb.SYMBOL_LOC_ARG: Symbols In Python. (line 152)
  42023. * gdb.SYMBOL_LOC_BLOCK: Symbols In Python. (line 173)
  42024. * gdb.SYMBOL_LOC_COMPUTED: Symbols In Python. (line 187)
  42025. * gdb.SYMBOL_LOC_COMPUTED <1>: Symbols In Python. (line 190)
  42026. * gdb.SYMBOL_LOC_CONST: Symbols In Python. (line 143)
  42027. * gdb.SYMBOL_LOC_CONST_BYTES: Symbols In Python. (line 176)
  42028. * gdb.SYMBOL_LOC_LOCAL: Symbols In Python. (line 166)
  42029. * gdb.SYMBOL_LOC_OPTIMIZED_OUT: Symbols In Python. (line 184)
  42030. * gdb.SYMBOL_LOC_REF_ARG: Symbols In Python. (line 156)
  42031. * gdb.SYMBOL_LOC_REGISTER: Symbols In Python. (line 149)
  42032. * gdb.SYMBOL_LOC_REGPARM_ADDR: Symbols In Python. (line 161)
  42033. * gdb.SYMBOL_LOC_STATIC: Symbols In Python. (line 146)
  42034. * gdb.SYMBOL_LOC_TYPEDEF: Symbols In Python. (line 169)
  42035. * gdb.SYMBOL_LOC_UNDEF: Symbols In Python. (line 139)
  42036. * gdb.SYMBOL_LOC_UNRESOLVED: Symbols In Python. (line 179)
  42037. * gdb.SYMBOL_MODULE_DOMAIN: Symbols In Python. (line 130)
  42038. * gdb.SYMBOL_STRUCT_DOMAIN: Symbols In Python. (line 124)
  42039. * gdb.SYMBOL_UNDEF_DOMAIN: Symbols In Python. (line 115)
  42040. * gdb.SYMBOL_VAR_DOMAIN: Symbols In Python. (line 120)
  42041. * gdb.Symtab: Symbol Tables In Python.
  42042. (line 6)
  42043. * gdb.Symtab_and_line: Symbol Tables In Python.
  42044. (line 6)
  42045. * gdb.target_charset: Basic Python. (line 212)
  42046. * gdb.target_charset <1>: Basic Python. (line 212)
  42047. * gdb.target_wide_charset: Basic Python. (line 217)
  42048. * gdb.target_wide_charset <1>: Basic Python. (line 217)
  42049. * gdb.Type: Types In Python. (line 6)
  42050. * gdb.TYPE_CODE_ARRAY: Types In Python. (line 198)
  42051. * gdb.TYPE_CODE_BITSTRING: Types In Python. (line 236)
  42052. * gdb.TYPE_CODE_BOOL: Types In Python. (line 260)
  42053. * gdb.TYPE_CODE_CHAR: Types In Python. (line 257)
  42054. * gdb.TYPE_CODE_COMPLEX: Types In Python. (line 263)
  42055. * gdb.TYPE_CODE_DECFLOAT: Types In Python. (line 272)
  42056. * gdb.TYPE_CODE_ENUM: Types In Python. (line 207)
  42057. * gdb.TYPE_CODE_ERROR: Types In Python. (line 239)
  42058. * gdb.TYPE_CODE_FLAGS: Types In Python. (line 210)
  42059. * gdb.TYPE_CODE_FLT: Types In Python. (line 219)
  42060. * gdb.TYPE_CODE_FUNC: Types In Python. (line 213)
  42061. * gdb.TYPE_CODE_INT: Types In Python. (line 216)
  42062. * gdb.TYPE_CODE_INTERNAL_FUNCTION: Types In Python. (line 275)
  42063. * gdb.TYPE_CODE_MEMBERPTR: Types In Python. (line 248)
  42064. * gdb.TYPE_CODE_METHOD: Types In Python. (line 242)
  42065. * gdb.TYPE_CODE_METHODPTR: Types In Python. (line 245)
  42066. * gdb.TYPE_CODE_NAMESPACE: Types In Python. (line 269)
  42067. * gdb.TYPE_CODE_PTR: Types In Python. (line 195)
  42068. * gdb.TYPE_CODE_RANGE: Types In Python. (line 228)
  42069. * gdb.TYPE_CODE_REF: Types In Python. (line 251)
  42070. * gdb.TYPE_CODE_RVALUE_REF: Types In Python. (line 254)
  42071. * gdb.TYPE_CODE_SET: Types In Python. (line 225)
  42072. * gdb.TYPE_CODE_STRING: Types In Python. (line 231)
  42073. * gdb.TYPE_CODE_STRUCT: Types In Python. (line 201)
  42074. * gdb.TYPE_CODE_TYPEDEF: Types In Python. (line 266)
  42075. * gdb.TYPE_CODE_UNION: Types In Python. (line 204)
  42076. * gdb.TYPE_CODE_VOID: Types In Python. (line 222)
  42077. * gdb.unwinder.register_unwinder: Unwinding Frames in Python.
  42078. (line 157)
  42079. * gdb.UnwindInfo.add_saved_register: Unwinding Frames in Python.
  42080. (line 107)
  42081. * gdb.WP_ACCESS: Breakpoints In Python.
  42082. (line 86)
  42083. * gdb.WP_READ: Breakpoints In Python.
  42084. (line 80)
  42085. * gdb.WP_WRITE: Breakpoints In Python.
  42086. (line 83)
  42087. * gdb.write: Basic Python. (line 175)
  42088. * gdb.write <1>: Basic Python. (line 175)
  42089. * gdb:error: Guile Exception Handling.
  42090. (line 69)
  42091. * gdb:invalid-object: Guile Exception Handling.
  42092. (line 72)
  42093. * gdb:memory-error: Guile Exception Handling.
  42094. (line 80)
  42095. * gdb:pp-type-error: Guile Exception Handling.
  42096. (line 84)
  42097. * gdbserver: Server. (line 6)
  42098. * gdb_init_reader: Writing JIT Debug Info Readers.
  42099. (line 20)
  42100. * generate-core-file: Core File Generation.
  42101. (line 17)
  42102. * get-basic-type: Guile Types Module. (line 13)
  42103. * getDebugChar: Bootstrapping. (line 14)
  42104. * gnu_debuglink_crc32: Separate Debug Files.
  42105. (line 162)
  42106. * gr: Guile Commands. (line 8)
  42107. * gu: Guile Commands. (line 15)
  42108. * guile: Guile Commands. (line 15)
  42109. * guile-data-directory: Guile Configuration. (line 13)
  42110. * guile-repl: Guile Commands. (line 8)
  42111. * h ('help'): Help. (line 9)
  42112. * handle: Signals. (line 49)
  42113. * handle_exception: Stub Contents. (line 15)
  42114. * hbreak: Set Breaks. (line 61)
  42115. * help: Help. (line 6)
  42116. * help function: Convenience Funs. (line 148)
  42117. * help target: Target Commands. (line 19)
  42118. * help user-defined: Define. (line 79)
  42119. * history-append!: Basic Guile. (line 105)
  42120. * history-preserve-point: Readline Init File Syntax.
  42121. (line 124)
  42122. * history-ref: Basic Guile. (line 87)
  42123. * history-search-backward (): Commands For History.
  42124. (line 50)
  42125. * history-search-forward (): Commands For History.
  42126. (line 45)
  42127. * history-size: Readline Init File Syntax.
  42128. (line 130)
  42129. * hook: Hooks. (line 6)
  42130. * hookpost: Hooks. (line 11)
  42131. * horizontal-scroll-mode: Readline Init File Syntax.
  42132. (line 135)
  42133. * host-config: Guile Configuration. (line 20)
  42134. * i ('info'): Help. (line 100)
  42135. * i (SingleKey TUI key): TUI Single Key Mode. (line 34)
  42136. * if: Command Files. (line 74)
  42137. * ignore: Conditions. (line 90)
  42138. * inferior INFNO: Inferiors and Programs.
  42139. (line 51)
  42140. * Inferior.architecture: Inferiors In Python. (line 50)
  42141. * Inferior.is_valid: Inferiors In Python. (line 38)
  42142. * Inferior.num: Inferiors In Python. (line 22)
  42143. * Inferior.pid: Inferiors In Python. (line 25)
  42144. * Inferior.progspace: Inferiors In Python. (line 33)
  42145. * Inferior.read_memory: Inferiors In Python. (line 57)
  42146. * Inferior.read_memory <1>: Inferiors In Python. (line 57)
  42147. * Inferior.search_memory: Inferiors In Python. (line 71)
  42148. * Inferior.threads: Inferiors In Python. (line 45)
  42149. * Inferior.thread_from_thread_handle: Inferiors In Python. (line 80)
  42150. * Inferior.thread_from_thread_handle <1>: Inferiors In Python.
  42151. (line 80)
  42152. * Inferior.was_attached: Inferiors In Python. (line 29)
  42153. * Inferior.write_memory: Inferiors In Python. (line 64)
  42154. * Inferior.write_memory <1>: Inferiors In Python. (line 64)
  42155. * InferiorCallPostEvent.address: Events In Python. (line 152)
  42156. * InferiorCallPostEvent.ptid: Events In Python. (line 149)
  42157. * InferiorCallPreEvent.address: Events In Python. (line 142)
  42158. * InferiorCallPreEvent.ptid: Events In Python. (line 139)
  42159. * InferiorThread.global_num: Threads In Python. (line 32)
  42160. * InferiorThread.inferior: Threads In Python. (line 45)
  42161. * InferiorThread.is_exited: Threads In Python. (line 68)
  42162. * InferiorThread.is_running: Threads In Python. (line 65)
  42163. * InferiorThread.is_stopped: Threads In Python. (line 62)
  42164. * InferiorThread.is_valid: Threads In Python. (line 51)
  42165. * InferiorThread.name: Threads In Python. (line 19)
  42166. * InferiorThread.num: Threads In Python. (line 29)
  42167. * InferiorThread.ptid: Threads In Python. (line 37)
  42168. * InferiorThread.switch: Threads In Python. (line 58)
  42169. * info: Help. (line 100)
  42170. * info address: Symbols. (line 85)
  42171. * info all-registers: Registers. (line 15)
  42172. * info args: Frame Info. (line 43)
  42173. * info auto-load: Auto-loading. (line 60)
  42174. * info auto-load gdb-scripts: Auto-loading sequences.
  42175. (line 21)
  42176. * info auto-load guile-scripts: Guile Auto-loading. (line 23)
  42177. * info auto-load libthread-db: libthread_db.so.1 file.
  42178. (line 29)
  42179. * info auto-load local-gdbinit: Init File in the Current Directory.
  42180. (line 22)
  42181. * info auto-load python-scripts: Python Auto-loading. (line 23)
  42182. * info auxv: OS Information. (line 20)
  42183. * info breakpoints: Set Breaks. (line 133)
  42184. * info checkpoints: Checkpoint/Restart. (line 31)
  42185. * info classes: Symbols. (line 526)
  42186. * info common: Special Fortran Commands.
  42187. (line 9)
  42188. * info copying: Help. (line 138)
  42189. * info dcache: Caching Target Data. (line 46)
  42190. * info display: Auto Display. (line 78)
  42191. * info dll: Files. (line 336)
  42192. * info dos: DJGPP Native. (line 15)
  42193. * info exceptions: Ada Exceptions. (line 8)
  42194. * info extensions: Show. (line 34)
  42195. * info f ('info frame'): Frame Info. (line 17)
  42196. * info files: Files. (line 211)
  42197. * info float: Floating Point Hardware.
  42198. (line 9)
  42199. * info frame: Frame Info. (line 17)
  42200. * info frame, show the source language: Show. (line 15)
  42201. * info frame-filter: Frame Filter Management.
  42202. (line 12)
  42203. * info functions: Symbols. (line 453)
  42204. * info handle: Signals. (line 33)
  42205. * info inferiors [ ID... ]: Inferiors and Programs.
  42206. (line 25)
  42207. * info io_registers, AVR: AVR. (line 10)
  42208. * info line: Machine Code. (line 14)
  42209. * info line, and Objective-C: Method Names in Commands.
  42210. (line 9)
  42211. * info locals: Frame Info. (line 67)
  42212. * info macro: Macros. (line 47)
  42213. * info macros: Macros. (line 54)
  42214. * info mem: Memory Region Attributes.
  42215. (line 45)
  42216. * info meminfo: Process Information. (line 130)
  42217. * info os: OS Information. (line 37)
  42218. * info os cpus: OS Information. (line 43)
  42219. * info os files: OS Information. (line 51)
  42220. * info os modules: OS Information. (line 57)
  42221. * info os msg: OS Information. (line 64)
  42222. * info os processes: OS Information. (line 75)
  42223. * info os procgroups: OS Information. (line 84)
  42224. * info os semaphores: OS Information. (line 94)
  42225. * info os shm: OS Information. (line 102)
  42226. * info os sockets: OS Information. (line 112)
  42227. * info os threads: OS Information. (line 119)
  42228. * info pidlist: Process Information. (line 126)
  42229. * info pretty-printer: Pretty-Printer Commands.
  42230. (line 6)
  42231. * info probes: Static Probe Points. (line 32)
  42232. * info proc: Process Information. (line 25)
  42233. * info program: Stopping. (line 18)
  42234. * info record: Process Record and Replay.
  42235. (line 317)
  42236. * info registers: Registers. (line 11)
  42237. * info scope: Symbols. (line 410)
  42238. * info selectors: Symbols. (line 532)
  42239. * info serial: DJGPP Native. (line 139)
  42240. * info set: Help. (line 121)
  42241. * info share: Files. (line 330)
  42242. * info sharedlibrary: Files. (line 330)
  42243. * info signals: Signals. (line 33)
  42244. * info skip: Skipping Over Functions and Files.
  42245. (line 113)
  42246. * info source: Symbols. (line 431)
  42247. * info source, show the source language: Show. (line 21)
  42248. * info sources: Symbols. (line 447)
  42249. * info spu: SPU. (line 10)
  42250. * info stack: Backtrace. (line 50)
  42251. * info static-tracepoint-markers: Listing Static Tracepoint Markers.
  42252. (line 6)
  42253. * info symbol: Symbols. (line 95)
  42254. * info target: Files. (line 211)
  42255. * info task TASKNO: Ada Tasks. (line 88)
  42256. * info tasks: Ada Tasks. (line 9)
  42257. * info terminal: Input/Output. (line 12)
  42258. * info threads: Threads. (line 115)
  42259. * info tp [N...]: Listing Tracepoints. (line 6)
  42260. * info tracepoints [N...]: Listing Tracepoints. (line 6)
  42261. * info tvariables: Trace State Variables.
  42262. (line 37)
  42263. * info type-printers: Symbols. (line 398)
  42264. * info types: Symbols. (line 377)
  42265. * info variables: Symbols. (line 493)
  42266. * info vector: Vector Unit. (line 9)
  42267. * info w32: Cygwin Native. (line 19)
  42268. * info warranty: Help. (line 142)
  42269. * info watchpoints [LIST...]: Set Watchpoints. (line 87)
  42270. * info win: TUI Commands. (line 26)
  42271. * info-gdb-mi-command: GDB/MI Support Commands.
  42272. (line 99)
  42273. * init-if-undefined: Convenience Vars. (line 42)
  42274. * input-meta: Readline Init File Syntax.
  42275. (line 142)
  42276. * input-port: I/O Ports in Guile. (line 6)
  42277. * insert-comment (M-#): Miscellaneous Commands.
  42278. (line 60)
  42279. * insert-completions (M-*): Commands For Completion.
  42280. (line 18)
  42281. * inspect: Data. (line 6)
  42282. * instantiate on type_printer: Type Printing API. (line 22)
  42283. * Instruction.data: Recordings In Python.
  42284. (line 69)
  42285. * Instruction.decoded: Recordings In Python.
  42286. (line 73)
  42287. * Instruction.pc: Recordings In Python.
  42288. (line 66)
  42289. * Instruction.size: Recordings In Python.
  42290. (line 76)
  42291. * interpreter-exec: Interpreters. (line 36)
  42292. * interrupt: Background Execution.
  42293. (line 59)
  42294. * isearch-terminators: Readline Init File Syntax.
  42295. (line 149)
  42296. * iterator->list: Iterators In Guile. (line 83)
  42297. * iterator-filter: Iterators In Guile. (line 94)
  42298. * iterator-for-each: Iterators In Guile. (line 90)
  42299. * iterator-map: Iterators In Guile. (line 86)
  42300. * iterator-next!: Iterators In Guile. (line 63)
  42301. * iterator-object: Iterators In Guile. (line 53)
  42302. * iterator-progress: Iterators In Guile. (line 57)
  42303. * iterator-until: Iterators In Guile. (line 98)
  42304. * iterator?: Iterators In Guile. (line 49)
  42305. * j ('jump'): Jumping. (line 10)
  42306. * jit-reader-load: Using JIT Debug Info Readers.
  42307. (line 6)
  42308. * jit-reader-unload: Using JIT Debug Info Readers.
  42309. (line 6)
  42310. * jump: Jumping. (line 10)
  42311. * jump, and Objective-C: Method Names in Commands.
  42312. (line 9)
  42313. * KeyboardInterrupt: Exception Handling. (line 34)
  42314. * keymap: Readline Init File Syntax.
  42315. (line 156)
  42316. * kill: Kill Process. (line 6)
  42317. * kill inferiors INFNO...: Inferiors and Programs.
  42318. (line 111)
  42319. * kill-line (C-k): Commands For Killing.
  42320. (line 6)
  42321. * kill-region (): Commands For Killing.
  42322. (line 41)
  42323. * kill-whole-line (): Commands For Killing.
  42324. (line 15)
  42325. * kill-word (M-d): Commands For Killing.
  42326. (line 19)
  42327. * kvm: BSD libkvm Interface.
  42328. (line 24)
  42329. * l ('list'): List. (line 6)
  42330. * language-option: GDB/MI Support Commands.
  42331. (line 96)
  42332. * layout: TUI Commands. (line 29)
  42333. * lazy-string->value: Lazy Strings In Guile.
  42334. (line 46)
  42335. * lazy-string-address: Lazy Strings In Guile.
  42336. (line 26)
  42337. * lazy-string-encoding: Lazy Strings In Guile.
  42338. (line 34)
  42339. * lazy-string-length: Lazy Strings In Guile.
  42340. (line 29)
  42341. * lazy-string-type: Lazy Strings In Guile.
  42342. (line 40)
  42343. * lazy-string?: Lazy Strings In Guile.
  42344. (line 22)
  42345. * LazyString.address: Lazy Strings In Python.
  42346. (line 26)
  42347. * LazyString.encoding: Lazy Strings In Python.
  42348. (line 36)
  42349. * LazyString.length: Lazy Strings In Python.
  42350. (line 30)
  42351. * LazyString.type: Lazy Strings In Python.
  42352. (line 43)
  42353. * LazyString.value: Lazy Strings In Python.
  42354. (line 20)
  42355. * Left: TUI Keys. (line 59)
  42356. * LineTable.has_line: Line Tables In Python.
  42357. (line 57)
  42358. * LineTable.line: Line Tables In Python.
  42359. (line 51)
  42360. * LineTable.source_lines: Line Tables In Python.
  42361. (line 62)
  42362. * LineTableEntry.line: Line Tables In Python.
  42363. (line 16)
  42364. * LineTableEntry.pc: Line Tables In Python.
  42365. (line 21)
  42366. * list: List. (line 6)
  42367. * list, and Objective-C: Method Names in Commands.
  42368. (line 9)
  42369. * load FILENAME OFFSET: Target Commands. (line 114)
  42370. * lookup-block: Blocks In Guile. (line 117)
  42371. * lookup-global-symbol: Symbols In Guile. (line 99)
  42372. * lookup-symbol: Symbols In Guile. (line 79)
  42373. * lookup-type: Types In Guile. (line 15)
  42374. * loop_break: Command Files. (line 93)
  42375. * loop_continue: Command Files. (line 97)
  42376. * macro define: Macros. (line 59)
  42377. * macro exp1: Macros. (line 36)
  42378. * macro expand: Macros. (line 29)
  42379. * macro list: Macros. (line 80)
  42380. * macro undef: Macros. (line 74)
  42381. * maint ada set ignore-descriptive-types: Ada Glitches. (line 73)
  42382. * maint ada show ignore-descriptive-types: Ada Glitches. (line 77)
  42383. * maint agent: Maintenance Commands.
  42384. (line 11)
  42385. * maint agent-eval: Maintenance Commands.
  42386. (line 11)
  42387. * maint agent-printf: Maintenance Commands.
  42388. (line 26)
  42389. * maint btrace clear: Maintenance Commands.
  42390. (line 99)
  42391. * maint btrace clear-packet-history: Maintenance Commands.
  42392. (line 94)
  42393. * maint btrace packet-history: Maintenance Commands.
  42394. (line 65)
  42395. * maint check libthread-db: Maintenance Commands.
  42396. (line 244)
  42397. * maint check xml-descriptions: Maintenance Commands.
  42398. (line 240)
  42399. * maint check-psymtabs: Maintenance Commands.
  42400. (line 134)
  42401. * maint check-symtabs: Maintenance Commands.
  42402. (line 139)
  42403. * maint cplus first_component: Maintenance Commands.
  42404. (line 154)
  42405. * maint cplus namespace: Maintenance Commands.
  42406. (line 157)
  42407. * maint demangler-warning: Maintenance Commands.
  42408. (line 173)
  42409. * maint deprecate: Maintenance Commands.
  42410. (line 160)
  42411. * maint dump-me: Maintenance Commands.
  42412. (line 168)
  42413. * maint expand-symtabs: Maintenance Commands.
  42414. (line 142)
  42415. * maint flush-symbol-cache: Symbols. (line 670)
  42416. * maint info bdccsr, S12Z: S12Z. (line 10)
  42417. * maint info bfds: File Caching. (line 10)
  42418. * maint info breakpoints: Maintenance Commands.
  42419. (line 32)
  42420. * maint info btrace: Maintenance Commands.
  42421. (line 62)
  42422. * maint info line-table: Symbols. (line 648)
  42423. * maint info program-spaces: Inferiors and Programs.
  42424. (line 148)
  42425. * maint info psymtabs: Symbols. (line 601)
  42426. * maint info sections: Files. (line 220)
  42427. * maint info sol-threads: Threads. (line 167)
  42428. * maint info symtabs: Symbols. (line 601)
  42429. * maint internal-error: Maintenance Commands.
  42430. (line 173)
  42431. * maint internal-warning: Maintenance Commands.
  42432. (line 173)
  42433. * maint packet: Maintenance Commands.
  42434. (line 220)
  42435. * maint print arc arc-instruction: ARC. (line 17)
  42436. * maint print architecture: Maintenance Commands.
  42437. (line 226)
  42438. * maint print c-tdesc [FILE]: Maintenance Commands.
  42439. (line 230)
  42440. * maint print cooked-registers: Maintenance Commands.
  42441. (line 268)
  42442. * maint print dummy-frames: Maintenance Commands.
  42443. (line 252)
  42444. * maint print msymbols: Symbols. (line 575)
  42445. * maint print objfiles: Maintenance Commands.
  42446. (line 306)
  42447. * maint print psymbols: Symbols. (line 575)
  42448. * maint print raw-registers: Maintenance Commands.
  42449. (line 268)
  42450. * maint print reggroups: Maintenance Commands.
  42451. (line 287)
  42452. * maint print register-groups: Maintenance Commands.
  42453. (line 268)
  42454. * maint print registers: Maintenance Commands.
  42455. (line 268)
  42456. * maint print remote-registers: Maintenance Commands.
  42457. (line 268)
  42458. * maint print section-scripts: Maintenance Commands.
  42459. (line 321)
  42460. * maint print statistics: Maintenance Commands.
  42461. (line 328)
  42462. * maint print symbol-cache: Symbols. (line 662)
  42463. * maint print symbol-cache-statistics: Symbols. (line 666)
  42464. * maint print symbols: Symbols. (line 575)
  42465. * maint print target-stack: Maintenance Commands.
  42466. (line 341)
  42467. * maint print type: Maintenance Commands.
  42468. (line 353)
  42469. * maint print unwind, HPPA: HPPA. (line 17)
  42470. * maint print user-registers: Maintenance Commands.
  42471. (line 312)
  42472. * maint selftest: Maintenance Commands.
  42473. (line 360)
  42474. * maint set bfd-sharing: File Caching. (line 14)
  42475. * maint set btrace pt skip-pad: Maintenance Commands.
  42476. (line 107)
  42477. * maint set catch-demangler-crashes: Maintenance Commands.
  42478. (line 146)
  42479. * maint set check-libthread-db: Maintenance Commands.
  42480. (line 523)
  42481. * maint set demangler-warning: Maintenance Commands.
  42482. (line 197)
  42483. * maint set dwarf always-disassemble: Maintenance Commands.
  42484. (line 369)
  42485. * maint set dwarf max-cache-age: Maintenance Commands.
  42486. (line 390)
  42487. * maint set dwarf unwinders: Maintenance Commands.
  42488. (line 404)
  42489. * maint set internal-error: Maintenance Commands.
  42490. (line 197)
  42491. * maint set internal-warning: Maintenance Commands.
  42492. (line 197)
  42493. * maint set per-command: Maintenance Commands.
  42494. (line 484)
  42495. * maint set profile: Maintenance Commands.
  42496. (line 425)
  42497. * maint set show-all-tib: Maintenance Commands.
  42498. (line 450)
  42499. * maint set show-debug-regs: Maintenance Commands.
  42500. (line 442)
  42501. * maint set symbol-cache-size: Symbols. (line 654)
  42502. * maint set target-async: Maintenance Commands.
  42503. (line 456)
  42504. * maint set target-non-stop MODE [on|off|auto]: Maintenance Commands.
  42505. (line 464)
  42506. * maint show bfd-sharing: File Caching. (line 14)
  42507. * maint show btrace pt skip-pad: Maintenance Commands.
  42508. (line 108)
  42509. * maint show catch-demangler-crashes: Maintenance Commands.
  42510. (line 146)
  42511. * maint show check-libthread-db: Maintenance Commands.
  42512. (line 523)
  42513. * maint show demangler-warning: Maintenance Commands.
  42514. (line 197)
  42515. * maint show dwarf always-disassemble: Maintenance Commands.
  42516. (line 369)
  42517. * maint show dwarf max-cache-age: Maintenance Commands.
  42518. (line 390)
  42519. * maint show dwarf unwinders: Maintenance Commands.
  42520. (line 404)
  42521. * maint show internal-error: Maintenance Commands.
  42522. (line 197)
  42523. * maint show internal-warning: Maintenance Commands.
  42524. (line 197)
  42525. * maint show per-command: Maintenance Commands.
  42526. (line 484)
  42527. * maint show profile: Maintenance Commands.
  42528. (line 425)
  42529. * maint show show-all-tib: Maintenance Commands.
  42530. (line 450)
  42531. * maint show show-debug-regs: Maintenance Commands.
  42532. (line 442)
  42533. * maint show symbol-cache-size: Symbols. (line 659)
  42534. * maint show target-async: Maintenance Commands.
  42535. (line 456)
  42536. * maint show target-non-stop: Maintenance Commands.
  42537. (line 464)
  42538. * maint space: Maintenance Commands.
  42539. (line 532)
  42540. * maint time: Maintenance Commands.
  42541. (line 536)
  42542. * maint translate-address: Maintenance Commands.
  42543. (line 540)
  42544. * maint undeprecate: Maintenance Commands.
  42545. (line 160)
  42546. * make: Shell Commands. (line 21)
  42547. * make-block-symbols-iterator: Blocks In Guile. (line 105)
  42548. * make-breakpoint: Breakpoints In Guile.
  42549. (line 19)
  42550. * make-enum-hashtable: Guile Types Module. (line 37)
  42551. * make-exception: Guile Exception Handling.
  42552. (line 91)
  42553. * make-field-iterator: Types In Guile. (line 125)
  42554. * make-iterator: Iterators In Guile. (line 11)
  42555. * make-lazy-value: Values From Inferior In Guile.
  42556. (line 327)
  42557. * make-list-iterator: Iterators In Guile. (line 80)
  42558. * make-pretty-printer: Guile Pretty Printing API.
  42559. (line 15)
  42560. * make-pretty-printer-worker: Guile Pretty Printing API.
  42561. (line 42)
  42562. * make-value: Values From Inferior In Guile.
  42563. (line 45)
  42564. * mark-modified-lines: Readline Init File Syntax.
  42565. (line 169)
  42566. * mark-symlinked-directories: Readline Init File Syntax.
  42567. (line 174)
  42568. * match-hidden-files: Readline Init File Syntax.
  42569. (line 179)
  42570. * may-insert-breakpoints: Observer Mode. (line 50)
  42571. * may-insert-fast-tracepoints: Observer Mode. (line 69)
  42572. * may-insert-tracepoints: Observer Mode. (line 59)
  42573. * may-interrupt: Observer Mode. (line 79)
  42574. * may-write-memory: Observer Mode. (line 41)
  42575. * may-write-registers: Observer Mode. (line 32)
  42576. * mem: Memory Region Attributes.
  42577. (line 22)
  42578. * memory-port-range: Memory Ports in Guile.
  42579. (line 33)
  42580. * memory-port-read-buffer-size: Memory Ports in Guile.
  42581. (line 37)
  42582. * memory-port-write-buffer-size: Memory Ports in Guile.
  42583. (line 45)
  42584. * memory-port?: Memory Ports in Guile.
  42585. (line 29)
  42586. * MemoryChangedEvent.address: Events In Python. (line 162)
  42587. * MemoryChangedEvent.length: Events In Python. (line 165)
  42588. * memset: Bootstrapping. (line 70)
  42589. * menu-complete (): Commands For Completion.
  42590. (line 22)
  42591. * menu-complete-backward (): Commands For Completion.
  42592. (line 34)
  42593. * menu-complete-display-prefix: Readline Init File Syntax.
  42594. (line 186)
  42595. * meta-flag: Readline Init File Syntax.
  42596. (line 142)
  42597. * methods: Xmethod API. (line 22)
  42598. * monitor: Connecting. (line 272)
  42599. * n ('next'): Continuing and Stepping.
  42600. (line 77)
  42601. * n (SingleKey TUI key): TUI Single Key Mode. (line 19)
  42602. * name: Xmethod API. (line 15)
  42603. * name of type_printer: Type Printing API. (line 18)
  42604. * new-ui: Interpreters. (line 65)
  42605. * newest-frame: Frames In Guile. (line 160)
  42606. * NewInferiorEvent.inferior: Events In Python. (line 204)
  42607. * NewInferiorEvent.inferior <1>: Events In Python. (line 215)
  42608. * NewObjFileEvent.new_objfile: Events In Python. (line 115)
  42609. * NewThreadEvent.inferior_thread: Events In Python. (line 223)
  42610. * next: Continuing and Stepping.
  42611. (line 77)
  42612. * next&: Background Execution.
  42613. (line 34)
  42614. * next-history (C-n): Commands For History.
  42615. (line 16)
  42616. * nexti: Continuing and Stepping.
  42617. (line 202)
  42618. * nexti&: Background Execution.
  42619. (line 37)
  42620. * ni ('nexti'): Continuing and Stepping.
  42621. (line 202)
  42622. * non-incremental-forward-search-history (M-n): Commands For History.
  42623. (line 40)
  42624. * non-incremental-reverse-search-history (M-p): Commands For History.
  42625. (line 35)
  42626. * nosharedlibrary: Files. (line 348)
  42627. * o (SingleKey TUI key): TUI Single Key Mode. (line 22)
  42628. * Objfile: Objfiles In Python. (line 6)
  42629. * objfile-filename: Objfiles In Guile. (line 28)
  42630. * objfile-pretty-printers: Objfiles In Guile. (line 36)
  42631. * objfile-progspace: Objfiles In Guile. (line 32)
  42632. * objfile-valid?: Objfiles In Guile. (line 21)
  42633. * Objfile.add_separate_debug_file: Objfiles In Python. (line 127)
  42634. * Objfile.build_id: Objfiles In Python. (line 69)
  42635. * Objfile.filename: Objfiles In Python. (line 49)
  42636. * Objfile.frame_filters: Objfiles In Python. (line 95)
  42637. * Objfile.is_valid: Objfiles In Python. (line 120)
  42638. * Objfile.owner: Objfiles In Python. (line 62)
  42639. * Objfile.pretty_printers: Objfiles In Python. (line 83)
  42640. * Objfile.progspace: Objfiles In Python. (line 79)
  42641. * Objfile.type_printers: Objfiles In Python. (line 91)
  42642. * Objfile.username: Objfiles In Python. (line 56)
  42643. * objfile?: Objfiles In Guile. (line 17)
  42644. * objfiles: Objfiles In Guile. (line 52)
  42645. * observer: Observer Mode. (line 22)
  42646. * open-memory: Memory Ports in Guile.
  42647. (line 11)
  42648. * output: Output. (line 35)
  42649. * output-meta: Readline Init File Syntax.
  42650. (line 191)
  42651. * output-port: I/O Ports in Guile. (line 9)
  42652. * overlay: Overlay Commands. (line 17)
  42653. * overload-choice annotation: Prompting. (line 32)
  42654. * overwrite-mode (): Commands For Text. (line 53)
  42655. * page-completions: Readline Init File Syntax.
  42656. (line 196)
  42657. * Parameter: Parameters In Python.
  42658. (line 6)
  42659. * Parameter <1>: Parameters In Guile. (line 6)
  42660. * parameter-value: Parameters In Guile. (line 103)
  42661. * Parameter.get_set_string: Parameters In Python.
  42662. (line 73)
  42663. * Parameter.get_show_string: Parameters In Python.
  42664. (line 102)
  42665. * Parameter.set_doc: Parameters In Python.
  42666. (line 53)
  42667. * Parameter.show_doc: Parameters In Python.
  42668. (line 59)
  42669. * Parameter.value: Parameters In Python.
  42670. (line 65)
  42671. * Parameter.__init__: Parameters In Python.
  42672. (line 18)
  42673. * parameter?: Parameters In Guile. (line 99)
  42674. * PARAM_AUTO_BOOLEAN: Parameters In Python.
  42675. (line 116)
  42676. * PARAM_AUTO_BOOLEAN <1>: Parameters In Guile. (line 120)
  42677. * PARAM_BOOLEAN: Parameters In Python.
  42678. (line 112)
  42679. * PARAM_BOOLEAN <1>: Parameters In Guile. (line 116)
  42680. * PARAM_ENUM: Parameters In Python.
  42681. (line 160)
  42682. * PARAM_ENUM <1>: Parameters In Guile. (line 156)
  42683. * PARAM_FILENAME: Parameters In Python.
  42684. (line 142)
  42685. * PARAM_FILENAME <1>: Parameters In Guile. (line 152)
  42686. * PARAM_INTEGER: Parameters In Python.
  42687. (line 125)
  42688. * PARAM_OPTIONAL_FILENAME: Parameters In Python.
  42689. (line 139)
  42690. * PARAM_OPTIONAL_FILENAME <1>: Parameters In Guile. (line 149)
  42691. * PARAM_STRING: Parameters In Python.
  42692. (line 129)
  42693. * PARAM_STRING <1>: Parameters In Guile. (line 139)
  42694. * PARAM_STRING_NOESCAPE: Parameters In Python.
  42695. (line 135)
  42696. * PARAM_STRING_NOESCAPE <1>: Parameters In Guile. (line 145)
  42697. * PARAM_UINTEGER: Parameters In Python.
  42698. (line 121)
  42699. * PARAM_UINTEGER <1>: Parameters In Guile. (line 125)
  42700. * PARAM_ZINTEGER: Parameters In Python.
  42701. (line 146)
  42702. * PARAM_ZINTEGER <1>: Parameters In Guile. (line 129)
  42703. * PARAM_ZUINTEGER: Parameters In Python.
  42704. (line 150)
  42705. * PARAM_ZUINTEGER <1>: Parameters In Guile. (line 132)
  42706. * PARAM_ZUINTEGER_UNLIMITED: Parameters In Python.
  42707. (line 155)
  42708. * PARAM_ZUINTEGER_UNLIMITED <1>: Parameters In Guile. (line 135)
  42709. * parse-and-eval: Basic Guile. (line 113)
  42710. * passcount: Tracepoint Passcounts.
  42711. (line 6)
  42712. * path: Environment. (line 14)
  42713. * pending-breakpoints: GDB/MI Support Commands.
  42714. (line 79)
  42715. * PendingFrame.create_unwind_info: Unwinding Frames in Python.
  42716. (line 67)
  42717. * PendingFrame.read_register: Unwinding Frames in Python.
  42718. (line 42)
  42719. * PgDn: TUI Keys. (line 50)
  42720. * PgUp: TUI Keys. (line 47)
  42721. * pi: Python Commands. (line 9)
  42722. * po ('print-object'): The Print Command with Objective-C.
  42723. (line 6)
  42724. * possible-completions (M-?): Commands For Completion.
  42725. (line 11)
  42726. * post-commands annotation: Prompting. (line 27)
  42727. * post-overload-choice annotation: Prompting. (line 32)
  42728. * post-prompt annotation: Prompting. (line 24)
  42729. * post-prompt-for-continue annotation: Prompting. (line 40)
  42730. * post-query annotation: Prompting. (line 36)
  42731. * pre-commands annotation: Prompting. (line 27)
  42732. * pre-overload-choice annotation: Prompting. (line 32)
  42733. * pre-prompt annotation: Prompting. (line 24)
  42734. * pre-prompt-for-continue annotation: Prompting. (line 40)
  42735. * pre-query annotation: Prompting. (line 36)
  42736. * prefix-meta (<ESC>): Miscellaneous Commands.
  42737. (line 18)
  42738. * prepend-pretty-printer!: Guile Printing Module.
  42739. (line 13)
  42740. * pretty-printer-enabled?: Guile Pretty Printing API.
  42741. (line 28)
  42742. * pretty-printer?: Guile Pretty Printing API.
  42743. (line 24)
  42744. * pretty-printers: Guile Pretty Printing API.
  42745. (line 35)
  42746. * pretty_printer.children: Pretty Printing API. (line 10)
  42747. * pretty_printer.display_hint: Pretty Printing API. (line 23)
  42748. * pretty_printer.to_string: Pretty Printing API. (line 52)
  42749. * previous-history (C-p): Commands For History.
  42750. (line 12)
  42751. * print: Data. (line 6)
  42752. * print-object: The Print Command with Objective-C.
  42753. (line 6)
  42754. * printf: Output. (line 46)
  42755. * proc-trace-entry: Process Information. (line 122)
  42756. * proc-trace-exit: Process Information. (line 122)
  42757. * proc-untrace-entry: Process Information. (line 122)
  42758. * proc-untrace-exit: Process Information. (line 122)
  42759. * Progspace: Progspaces In Python.
  42760. (line 6)
  42761. * progspace-filename: Progspaces In Guile. (line 34)
  42762. * progspace-objfiles: Progspaces In Guile. (line 44)
  42763. * progspace-pretty-printers: Progspaces In Guile. (line 52)
  42764. * progspace-valid?: Progspaces In Guile. (line 21)
  42765. * Progspace.block_for_pc: Progspaces In Python.
  42766. (line 47)
  42767. * Progspace.block_for_pc <1>: Progspaces In Python.
  42768. (line 47)
  42769. * Progspace.filename: Progspaces In Python.
  42770. (line 26)
  42771. * Progspace.find_pc_line: Progspaces In Python.
  42772. (line 52)
  42773. * Progspace.find_pc_line <1>: Progspaces In Python.
  42774. (line 52)
  42775. * Progspace.frame_filters: Progspaces In Python.
  42776. (line 41)
  42777. * Progspace.is_valid: Progspaces In Python.
  42778. (line 59)
  42779. * Progspace.is_valid <1>: Progspaces In Python.
  42780. (line 59)
  42781. * Progspace.objfiles: Progspaces In Python.
  42782. (line 66)
  42783. * Progspace.objfiles <1>: Progspaces In Python.
  42784. (line 66)
  42785. * Progspace.pretty_printers: Progspaces In Python.
  42786. (line 29)
  42787. * Progspace.solib_name: Progspaces In Python.
  42788. (line 70)
  42789. * Progspace.solib_name <1>: Progspaces In Python.
  42790. (line 70)
  42791. * Progspace.type_printers: Progspaces In Python.
  42792. (line 37)
  42793. * progspace?: Progspaces In Guile. (line 17)
  42794. * progspaces: Progspaces In Guile. (line 31)
  42795. * prompt annotation: Prompting. (line 24)
  42796. * prompt-for-continue annotation: Prompting. (line 40)
  42797. * ptype: Symbols. (line 297)
  42798. * putDebugChar: Bootstrapping. (line 20)
  42799. * pwd: Working Directory. (line 40)
  42800. * py: Python Commands. (line 23)
  42801. * python: GDB/MI Support Commands.
  42802. (line 82)
  42803. * python <1>: Python Commands. (line 23)
  42804. * python-interactive: Python Commands. (line 9)
  42805. * q ('quit'): Quitting GDB. (line 6)
  42806. * q (SingleKey TUI key): TUI Single Key Mode. (line 25)
  42807. * query annotation: Prompting. (line 36)
  42808. * queue-signal: Signaling. (line 36)
  42809. * quit annotation: Errors. (line 6)
  42810. * quit [EXPRESSION]: Quitting GDB. (line 6)
  42811. * quoted-insert (C-q or C-v): Commands For Text. (line 20)
  42812. * r ('run'): Starting. (line 6)
  42813. * r (SingleKey TUI key): TUI Single Key Mode. (line 28)
  42814. * rbreak: Set Breaks. (line 90)
  42815. * rc ('reverse-continue'): Reverse Execution. (line 30)
  42816. * re-read-init-file (C-x C-r): Miscellaneous Commands.
  42817. (line 6)
  42818. * readnow: Files. (line 94)
  42819. * rec: Process Record and Replay.
  42820. (line 38)
  42821. * rec btrace: Process Record and Replay.
  42822. (line 38)
  42823. * rec btrace bts: Process Record and Replay.
  42824. (line 38)
  42825. * rec btrace pt: Process Record and Replay.
  42826. (line 38)
  42827. * rec bts: Process Record and Replay.
  42828. (line 38)
  42829. * rec del: Process Record and Replay.
  42830. (line 351)
  42831. * rec full: Process Record and Replay.
  42832. (line 38)
  42833. * rec function-call-history: Process Record and Replay.
  42834. (line 417)
  42835. * rec instruction-history: Process Record and Replay.
  42836. (line 357)
  42837. * rec pt: Process Record and Replay.
  42838. (line 38)
  42839. * rec s: Process Record and Replay.
  42840. (line 100)
  42841. * recognize on type_recognizer: Type Printing API. (line 42)
  42842. * record: Process Record and Replay.
  42843. (line 38)
  42844. * record btrace: Process Record and Replay.
  42845. (line 38)
  42846. * record btrace bts: Process Record and Replay.
  42847. (line 38)
  42848. * record btrace pt: Process Record and Replay.
  42849. (line 38)
  42850. * record bts: Process Record and Replay.
  42851. (line 38)
  42852. * record delete: Process Record and Replay.
  42853. (line 351)
  42854. * record full: Process Record and Replay.
  42855. (line 38)
  42856. * record function-call-history: Process Record and Replay.
  42857. (line 417)
  42858. * record goto: Process Record and Replay.
  42859. (line 123)
  42860. * record instruction-history: Process Record and Replay.
  42861. (line 357)
  42862. * record pt: Process Record and Replay.
  42863. (line 38)
  42864. * record restore: Process Record and Replay.
  42865. (line 144)
  42866. * record save: Process Record and Replay.
  42867. (line 137)
  42868. * record stop: Process Record and Replay.
  42869. (line 100)
  42870. * Record.begin: Recordings In Python.
  42871. (line 40)
  42872. * Record.end: Recordings In Python.
  42873. (line 44)
  42874. * Record.format: Recordings In Python.
  42875. (line 36)
  42876. * Record.function_call_history: Recordings In Python.
  42877. (line 55)
  42878. * Record.goto: Recordings In Python.
  42879. (line 60)
  42880. * Record.instruction_history: Recordings In Python.
  42881. (line 52)
  42882. * Record.method: Recordings In Python.
  42883. (line 32)
  42884. * Record.replay_position: Recordings In Python.
  42885. (line 48)
  42886. * RecordFunctionSegment.instructions: Recordings In Python.
  42887. (line 126)
  42888. * RecordFunctionSegment.level: Recordings In Python.
  42889. (line 122)
  42890. * RecordFunctionSegment.next: Recordings In Python.
  42891. (line 140)
  42892. * RecordFunctionSegment.number: Recordings In Python.
  42893. (line 113)
  42894. * RecordFunctionSegment.prev: Recordings In Python.
  42895. (line 136)
  42896. * RecordFunctionSegment.symbol: Recordings In Python.
  42897. (line 118)
  42898. * RecordFunctionSegment.up: Recordings In Python.
  42899. (line 130)
  42900. * RecordGap.error_code: Recordings In Python.
  42901. (line 104)
  42902. * RecordGap.error_string: Recordings In Python.
  42903. (line 108)
  42904. * RecordGap.number: Recordings In Python.
  42905. (line 99)
  42906. * RecordInstruction.is_speculative: Recordings In Python.
  42907. (line 91)
  42908. * RecordInstruction.number: Recordings In Python.
  42909. (line 81)
  42910. * RecordInstruction.sal: Recordings In Python.
  42911. (line 86)
  42912. * redraw-current-line (): Commands For Moving. (line 30)
  42913. * refresh: TUI Commands. (line 77)
  42914. * register-breakpoint!: Breakpoints In Guile.
  42915. (line 87)
  42916. * register-command!: Commands In Guile. (line 58)
  42917. * register-parameter!: Parameters In Guile. (line 94)
  42918. * RegisterChangedEvent.frame: Events In Python. (line 172)
  42919. * RegisterChangedEvent.regnum: Events In Python. (line 175)
  42920. * register_xmethod_matcher: Xmethod API. (line 82)
  42921. * remote delete: File Transfer. (line 23)
  42922. * remote get: File Transfer. (line 19)
  42923. * remote put: File Transfer. (line 15)
  42924. * remove-inferiors: Inferiors and Programs.
  42925. (line 95)
  42926. * remove-symbol-file: Files. (line 174)
  42927. * restart CHECKPOINT-ID: Checkpoint/Restart. (line 41)
  42928. * restore: Dump/Restore Files. (line 40)
  42929. * RET (repeat last command): Command Syntax. (line 21)
  42930. * return: Returning. (line 6)
  42931. * reverse-continue: Reverse Execution. (line 30)
  42932. * reverse-finish: Reverse Execution. (line 77)
  42933. * reverse-next: Reverse Execution. (line 60)
  42934. * reverse-nexti: Reverse Execution. (line 69)
  42935. * reverse-search: Search. (line 16)
  42936. * reverse-search-history (C-r): Commands For History.
  42937. (line 26)
  42938. * reverse-step: Reverse Execution. (line 37)
  42939. * reverse-stepi: Reverse Execution. (line 52)
  42940. * revert-all-at-newline: Readline Init File Syntax.
  42941. (line 206)
  42942. * revert-line (M-r): Miscellaneous Commands.
  42943. (line 25)
  42944. * Right: TUI Keys. (line 62)
  42945. * rn ('reverse-next'): Reverse Execution. (line 60)
  42946. * rni ('reverse-nexti'): Reverse Execution. (line 69)
  42947. * rs ('step'): Reverse Execution. (line 37)
  42948. * rsi ('reverse-stepi'): Reverse Execution. (line 52)
  42949. * run: Starting. (line 6)
  42950. * run&: Background Execution.
  42951. (line 21)
  42952. * rwatch: Set Watchpoints. (line 79)
  42953. * s (SingleKey TUI key): TUI Single Key Mode. (line 31)
  42954. * s ('step'): Continuing and Stepping.
  42955. (line 45)
  42956. * sal-last: Symbol Tables In Guile.
  42957. (line 68)
  42958. * sal-line: Symbol Tables In Guile.
  42959. (line 62)
  42960. * sal-pc: Symbol Tables In Guile.
  42961. (line 65)
  42962. * sal-symtab: Symbol Tables In Guile.
  42963. (line 59)
  42964. * sal-valid?: Symbol Tables In Guile.
  42965. (line 53)
  42966. * sal?: Symbol Tables In Guile.
  42967. (line 49)
  42968. * save breakpoints: Save Breakpoints. (line 9)
  42969. * save gdb-index: Index Files. (line 30)
  42970. * save tracepoints: save tracepoints. (line 6)
  42971. * save-tracepoints: save tracepoints. (line 6)
  42972. * search: Search. (line 9)
  42973. * section: Files. (line 203)
  42974. * select-frame: Selection. (line 98)
  42975. * selected-frame: Frames In Guile. (line 156)
  42976. * self: Commands In Guile. (line 100)
  42977. * self-insert (a, b, A, 1, !, ...): Commands For Text. (line 27)
  42978. * set: Help. (line 109)
  42979. * set ada print-signatures: Overloading support for Ada.
  42980. (line 31)
  42981. * set ada trust-PAD-over-XVS: Ada Glitches. (line 42)
  42982. * set agent off: In-Process Agent. (line 47)
  42983. * set agent on: In-Process Agent. (line 38)
  42984. * set annotate: Annotations Overview.
  42985. (line 29)
  42986. * set architecture: Targets. (line 21)
  42987. * set args: Arguments. (line 21)
  42988. * set arm: ARM. (line 9)
  42989. * set auto-connect-native-target: Starting. (line 168)
  42990. * set auto-load gdb-scripts: Auto-loading sequences.
  42991. (line 13)
  42992. * set auto-load guile-scripts: Guile Auto-loading. (line 17)
  42993. * set auto-load libthread-db: libthread_db.so.1 file.
  42994. (line 21)
  42995. * set auto-load local-gdbinit: Init File in the Current Directory.
  42996. (line 14)
  42997. * set auto-load off: Auto-loading. (line 32)
  42998. * set auto-load python-scripts: Python Auto-loading. (line 17)
  42999. * set auto-load safe-path: Auto-loading safe path.
  43000. (line 32)
  43001. * set auto-load scripts-directory: objfile-gdbdotext file.
  43002. (line 37)
  43003. * set auto-solib-add: Files. (line 307)
  43004. * set backtrace: Backtrace. (line 120)
  43005. * set basenames-may-differ: Files. (line 536)
  43006. * set breakpoint always-inserted: Set Breaks. (line 325)
  43007. * set breakpoint auto-hw: Set Breaks. (line 305)
  43008. * set breakpoint condition-evaluation: Set Breaks. (line 346)
  43009. * set breakpoint pending: Set Breaks. (line 275)
  43010. * set can-use-hw-watchpoints: Set Watchpoints. (line 116)
  43011. * set case-sensitive: Symbols. (line 27)
  43012. * set charset: Character Sets. (line 46)
  43013. * set check range: Range Checking. (line 34)
  43014. * set check type: Type Checking. (line 35)
  43015. * set circular-trace-buffer: Starting and Stopping Trace Experiments.
  43016. (line 93)
  43017. * set code-cache: Caching Target Data. (line 36)
  43018. * set coerce-float-to-double: ABI. (line 45)
  43019. * set com1base: DJGPP Native. (line 122)
  43020. * set com1irq: DJGPP Native. (line 122)
  43021. * set com2base: DJGPP Native. (line 122)
  43022. * set com2irq: DJGPP Native. (line 122)
  43023. * set com3base: DJGPP Native. (line 122)
  43024. * set com3irq: DJGPP Native. (line 122)
  43025. * set com4base: DJGPP Native. (line 122)
  43026. * set com4irq: DJGPP Native. (line 122)
  43027. * set complaints: Messages/Warnings. (line 29)
  43028. * set confirm: Messages/Warnings. (line 49)
  43029. * set cp-abi: ABI. (line 57)
  43030. * set cwd: Working Directory. (line 13)
  43031. * set cygwin-exceptions: Cygwin Native. (line 60)
  43032. * set data-directory: Data Files. (line 12)
  43033. * set dcache line-size: Caching Target Data. (line 60)
  43034. * set dcache size: Caching Target Data. (line 57)
  43035. * set debug: Debugging Output. (line 17)
  43036. * set debug aarch64: AArch64. (line 10)
  43037. * set debug arc: ARC. (line 9)
  43038. * set debug auto-load: Auto-loading verbose mode.
  43039. (line 27)
  43040. * set debug bfd-cache LEVEL: File Caching. (line 24)
  43041. * set debug darwin: Darwin. (line 9)
  43042. * set debug entry-values: Tail Call Frames. (line 47)
  43043. * set debug hppa: HPPA. (line 10)
  43044. * set debug libthread-db: Threads. (line 325)
  43045. * set debug mach-o: Darwin. (line 16)
  43046. * set debug mips: MIPS. (line 100)
  43047. * set debug monitor: Target Commands. (line 107)
  43048. * set debug nios2: Nios II. (line 10)
  43049. * set debug skip: Skipping Over Functions and Files.
  43050. (line 149)
  43051. * set debug-file-directory: Separate Debug Files.
  43052. (line 70)
  43053. * set debugevents: Cygwin Native. (line 89)
  43054. * set debugexceptions: Cygwin Native. (line 100)
  43055. * set debugexec: Cygwin Native. (line 96)
  43056. * set debugmemory: Cygwin Native. (line 104)
  43057. * set default-collect: Tracepoint Actions. (line 142)
  43058. * set demangle-style: Print Settings. (line 427)
  43059. * set detach-on-fork: Forks. (line 58)
  43060. * set directories: Source Path. (line 118)
  43061. * set disable-randomization: Starting. (line 212)
  43062. * set disassemble-next-line: Machine Code. (line 249)
  43063. * set disassembler-options: Machine Code. (line 222)
  43064. * set disassembly-flavor: Machine Code. (line 237)
  43065. * set disconnected-dprintf: Dynamic Printf. (line 83)
  43066. * set disconnected-tracing: Starting and Stopping Trace Experiments.
  43067. (line 55)
  43068. * set displaced-stepping: Maintenance Commands.
  43069. (line 112)
  43070. * set dump-excluded-mappings: Core File Generation.
  43071. (line 60)
  43072. * set editing: Editing. (line 15)
  43073. * set endian: Byte Order. (line 13)
  43074. * set environment: Environment. (line 39)
  43075. * set exceptions, Hurd command: Hurd Native. (line 39)
  43076. * set exec-direction: Reverse Execution. (line 83)
  43077. * set exec-done-display: Debugging Output. (line 11)
  43078. * set exec-wrapper: Starting. (line 120)
  43079. * set extended-prompt: Prompt. (line 25)
  43080. * set extension-language: Show. (line 30)
  43081. * set follow-exec-mode: Forks. (line 105)
  43082. * set follow-fork-mode: Forks. (line 39)
  43083. * set frame-filter priority: Frame Filter Management.
  43084. (line 84)
  43085. * set gnutarget: Target Commands. (line 28)
  43086. * set guile print-stack: Guile Exception Handling.
  43087. (line 6)
  43088. * set hash, for remote monitors: Target Commands. (line 98)
  43089. * set height: Screen Size. (line 22)
  43090. * set history expansion: Command History. (line 82)
  43091. * set history filename: Command History. (line 26)
  43092. * set history remove-duplicates: Command History. (line 54)
  43093. * set history save: Command History. (line 36)
  43094. * set history size: Command History. (line 45)
  43095. * set host-charset: Character Sets. (line 33)
  43096. * set inferior-tty: Input/Output. (line 49)
  43097. * set input-radix: Numbers. (line 14)
  43098. * set interactive-mode: Other Misc Settings. (line 6)
  43099. * set language: Manually. (line 9)
  43100. * set libthread-db-search-path: Threads. (line 287)
  43101. * set listsize: List. (line 33)
  43102. * set logging: Logging Output. (line 9)
  43103. * set mach-exceptions: Darwin. (line 27)
  43104. * set max-completions: Completion. (line 69)
  43105. * set max-user-call-depth: Define. (line 91)
  43106. * set max-value-size: Value Sizes. (line 12)
  43107. * set mem inaccessible-by-default: Memory Region Attributes.
  43108. (line 123)
  43109. * set mips abi: MIPS. (line 32)
  43110. * set mips compression: MIPS. (line 49)
  43111. * set mips mask-address: MIPS. (line 80)
  43112. * set mipsfpu: MIPS Embedded. (line 13)
  43113. * set mpx bound: i386. (line 60)
  43114. * set multiple-symbols: Ambiguous Expressions.
  43115. (line 50)
  43116. * set new-console: Cygwin Native. (line 72)
  43117. * set new-group: Cygwin Native. (line 81)
  43118. * set non-stop: Non-Stop Mode. (line 35)
  43119. * set opaque-type-resolution: Symbols. (line 538)
  43120. * set osabi: ABI. (line 11)
  43121. * set output-radix: Numbers. (line 30)
  43122. * set overload-resolution: Debugging C Plus Plus.
  43123. (line 59)
  43124. * set pagination: Screen Size. (line 41)
  43125. * set powerpc: PowerPC Embedded. (line 51)
  43126. * set print: Print Settings. (line 11)
  43127. * set print entry-values: Print Settings. (line 206)
  43128. * set print frame-arguments: Print Settings. (line 154)
  43129. * set print inferior-events: Inferiors and Programs.
  43130. (line 126)
  43131. * set print symbol-loading: Symbols. (line 556)
  43132. * set print thread-events: Threads. (line 266)
  43133. * set print type methods: Symbols. (line 44)
  43134. * set print type nested-type-limit: Symbols. (line 57)
  43135. * set print type typedefs: Symbols. (line 68)
  43136. * set processor: Targets. (line 31)
  43137. * set procfs-file: Process Information. (line 111)
  43138. * set procfs-trace: Process Information. (line 105)
  43139. * set prompt: Prompt. (line 16)
  43140. * set python print-stack: Python Commands. (line 46)
  43141. * set radix: Numbers. (line 43)
  43142. * set range-stepping: Continuing and Stepping.
  43143. (line 221)
  43144. * set ravenscar task-switching off: Ravenscar Profile. (line 14)
  43145. * set ravenscar task-switching on: Ravenscar Profile. (line 10)
  43146. * set record: Process Record and Replay.
  43147. (line 407)
  43148. * set record btrace: Process Record and Replay.
  43149. (line 198)
  43150. * set record btrace bts: Process Record and Replay.
  43151. (line 271)
  43152. * set record btrace pt: Process Record and Replay.
  43153. (line 294)
  43154. * set record full: Process Record and Replay.
  43155. (line 148)
  43156. * set remote: Remote Configuration.
  43157. (line 6)
  43158. * set remote system-call-allowed: system. (line 37)
  43159. * set remote-mips64-transfers-32bit-regs: MIPS. (line 90)
  43160. * set remotecache: Caching Target Data. (line 20)
  43161. * set remoteflow: Remote Configuration.
  43162. (line 48)
  43163. * set schedule-multiple: All-Stop Mode. (line 67)
  43164. * set script-extension: Extending GDB. (line 29)
  43165. * set sh calling-convention: Super-H. (line 9)
  43166. * set shell: Cygwin Native. (line 108)
  43167. * set signal-thread: Hurd Native. (line 21)
  43168. * set signals, Hurd command: Hurd Native. (line 11)
  43169. * set sigs, Hurd command: Hurd Native. (line 11)
  43170. * set sigthread: Hurd Native. (line 21)
  43171. * set solib-absolute-prefix: Files. (line 386)
  43172. * set solib-search-path: Files. (line 462)
  43173. * set spu: SPU. (line 38)
  43174. * set stack-cache: Caching Target Data. (line 28)
  43175. * set startup-with-shell: Starting. (line 145)
  43176. * set step-mode: Continuing and Stepping.
  43177. (line 91)
  43178. * set stop-on-solib-events: Files. (line 363)
  43179. * set stopped, Hurd command: Hurd Native. (line 31)
  43180. * set struct-convention: i386. (line 7)
  43181. * set style: Output Styling. (line 6)
  43182. * set substitute-path: Source Path. (line 125)
  43183. * set sysroot: Files. (line 386)
  43184. * set target-charset: Character Sets. (line 28)
  43185. * set target-file-system-kind (unix|dos-based|auto): Files. (line 476)
  43186. * set target-wide-charset: Character Sets. (line 61)
  43187. * set task, Hurd commands: Hurd Native. (line 48)
  43188. * set tcp: Remote Configuration.
  43189. (line 130)
  43190. * set thread, Hurd command: Hurd Native. (line 90)
  43191. * set trace-buffer-size: Starting and Stopping Trace Experiments.
  43192. (line 107)
  43193. * set trace-commands: Messages/Warnings. (line 65)
  43194. * set trace-notes: Starting and Stopping Trace Experiments.
  43195. (line 126)
  43196. * set trace-stop-notes: Starting and Stopping Trace Experiments.
  43197. (line 132)
  43198. * set trace-user: Starting and Stopping Trace Experiments.
  43199. (line 122)
  43200. * set trust-readonly-sections: Files. (line 265)
  43201. * set tui active-border-mode: TUI Configuration. (line 24)
  43202. * set tui border-kind: TUI Configuration. (line 9)
  43203. * set tui border-mode: TUI Configuration. (line 23)
  43204. * set tui tab-width: TUI Configuration. (line 49)
  43205. * set unwind-on-terminating-exception: Calling. (line 47)
  43206. * set unwindonsignal: Calling. (line 36)
  43207. * set use-coredump-filter: Core File Generation.
  43208. (line 33)
  43209. * set variable: Assignment. (line 16)
  43210. * set varsize-limit: Ada Settings. (line 6)
  43211. * set verbose: Messages/Warnings. (line 15)
  43212. * set watchdog: Maintenance Commands.
  43213. (line 557)
  43214. * set width: Screen Size. (line 22)
  43215. * set write: Patching. (line 15)
  43216. * set-breakpoint-condition!: Breakpoints In Guile.
  43217. (line 198)
  43218. * set-breakpoint-enabled!: Breakpoints In Guile.
  43219. (line 147)
  43220. * set-breakpoint-hit-count!: Breakpoints In Guile.
  43221. (line 172)
  43222. * set-breakpoint-ignore-count!: Breakpoints In Guile.
  43223. (line 166)
  43224. * set-breakpoint-silent!: Breakpoints In Guile.
  43225. (line 158)
  43226. * set-breakpoint-stop!: Breakpoints In Guile.
  43227. (line 206)
  43228. * set-breakpoint-task!: Breakpoints In Guile.
  43229. (line 190)
  43230. * set-breakpoint-thread!: Breakpoints In Guile.
  43231. (line 180)
  43232. * set-iterator-progress!: Iterators In Guile. (line 60)
  43233. * set-mark (C-@): Miscellaneous Commands.
  43234. (line 32)
  43235. * set-memory-port-read-buffer-size!: Memory Ports in Guile.
  43236. (line 41)
  43237. * set-memory-port-write-buffer-size!: Memory Ports in Guile.
  43238. (line 49)
  43239. * set-objfile-pretty-printers!: Objfiles In Guile. (line 40)
  43240. * set-parameter-value!: Parameters In Guile. (line 107)
  43241. * set-pretty-printer-enabled!: Guile Pretty Printing API.
  43242. (line 31)
  43243. * set-pretty-printers!: Guile Pretty Printing API.
  43244. (line 38)
  43245. * set-progspace-pretty-printers!: Progspaces In Guile. (line 57)
  43246. * set_debug_traps: Stub Contents. (line 10)
  43247. * share: Files. (line 339)
  43248. * sharedlibrary: Files. (line 339)
  43249. * shell: Shell Commands. (line 10)
  43250. * show: Help. (line 114)
  43251. * show ada print-signatures: Overloading support for Ada.
  43252. (line 36)
  43253. * show ada trust-PAD-over-XVS: Ada Glitches. (line 42)
  43254. * show agent: In-Process Agent. (line 51)
  43255. * show annotate: Annotations Overview.
  43256. (line 34)
  43257. * show architecture: Targets. (line 21)
  43258. * show args: Arguments. (line 28)
  43259. * show arm: ARM. (line 13)
  43260. * show auto-load: Auto-loading. (line 45)
  43261. * show auto-load gdb-scripts: Auto-loading sequences.
  43262. (line 17)
  43263. * show auto-load guile-scripts: Guile Auto-loading. (line 20)
  43264. * show auto-load libthread-db: libthread_db.so.1 file.
  43265. (line 25)
  43266. * show auto-load local-gdbinit: Init File in the Current Directory.
  43267. (line 18)
  43268. * show auto-load python-scripts: Python Auto-loading. (line 20)
  43269. * show auto-load safe-path: Auto-loading safe path.
  43270. (line 46)
  43271. * show auto-load scripts-directory: objfile-gdbdotext file.
  43272. (line 61)
  43273. * show auto-solib-add: Files. (line 324)
  43274. * show backtrace: Backtrace. (line 127)
  43275. * show basenames-may-differ: Files. (line 539)
  43276. * show breakpoint always-inserted: Set Breaks. (line 325)
  43277. * show breakpoint auto-hw: Set Breaks. (line 305)
  43278. * show breakpoint condition-evaluation: Set Breaks. (line 346)
  43279. * show breakpoint pending: Set Breaks. (line 275)
  43280. * show can-use-hw-watchpoints: Set Watchpoints. (line 119)
  43281. * show case-sensitive: Symbols. (line 40)
  43282. * show charset: Character Sets. (line 52)
  43283. * show check range: Range Checking. (line 34)
  43284. * show check type: Type Checking. (line 35)
  43285. * show circular-trace-buffer: Starting and Stopping Trace Experiments.
  43286. (line 100)
  43287. * show code-cache: Caching Target Data. (line 42)
  43288. * show coerce-float-to-double: ABI. (line 54)
  43289. * show com1base: DJGPP Native. (line 134)
  43290. * show com1irq: DJGPP Native. (line 134)
  43291. * show com2base: DJGPP Native. (line 134)
  43292. * show com2irq: DJGPP Native. (line 134)
  43293. * show com3base: DJGPP Native. (line 134)
  43294. * show com3irq: DJGPP Native. (line 134)
  43295. * show com4base: DJGPP Native. (line 134)
  43296. * show com4irq: DJGPP Native. (line 134)
  43297. * show commands: Command History. (line 95)
  43298. * show complaints: Messages/Warnings. (line 35)
  43299. * show configuration: Help. (line 147)
  43300. * show confirm: Messages/Warnings. (line 57)
  43301. * show convenience: Convenience Vars. (line 37)
  43302. * show copying: Help. (line 138)
  43303. * show cp-abi: ABI. (line 57)
  43304. * show cwd: Working Directory. (line 27)
  43305. * show cygwin-exceptions: Cygwin Native. (line 68)
  43306. * show data-directory: Data Files. (line 16)
  43307. * show dcache line-size: Caching Target Data. (line 68)
  43308. * show dcache size: Caching Target Data. (line 64)
  43309. * show debug: Debugging Output. (line 20)
  43310. * show debug arc: ARC. (line 14)
  43311. * show debug auto-load: Auto-loading verbose mode.
  43312. (line 30)
  43313. * show debug bfd-cache: File Caching. (line 27)
  43314. * show debug darwin: Darwin. (line 13)
  43315. * show debug entry-values: Tail Call Frames. (line 55)
  43316. * show debug libthread-db: Threads. (line 325)
  43317. * show debug mach-o: Darwin. (line 23)
  43318. * show debug mips: MIPS. (line 104)
  43319. * show debug monitor: Target Commands. (line 111)
  43320. * show debug nios2: Nios II. (line 14)
  43321. * show debug skip: Skipping Over Functions and Files.
  43322. (line 153)
  43323. * show debug-file-directory: Separate Debug Files.
  43324. (line 75)
  43325. * show default-collect: Tracepoint Actions. (line 150)
  43326. * show detach-on-fork: Forks. (line 73)
  43327. * show directories: Source Path. (line 122)
  43328. * show disassemble-next-line: Machine Code. (line 249)
  43329. * show disassembler-options: Machine Code. (line 234)
  43330. * show disassembly-flavor: Machine Code. (line 246)
  43331. * show disconnected-dprintf: Dynamic Printf. (line 88)
  43332. * show disconnected-tracing: Starting and Stopping Trace Experiments.
  43333. (line 62)
  43334. * show displaced-stepping: Maintenance Commands.
  43335. (line 112)
  43336. * show editing: Editing. (line 22)
  43337. * show environment: Environment. (line 33)
  43338. * show exceptions, Hurd command: Hurd Native. (line 45)
  43339. * show exec-done-display: Debugging Output. (line 14)
  43340. * show extended-prompt: Prompt. (line 39)
  43341. * show follow-fork-mode: Forks. (line 52)
  43342. * show frame-filter priority: Frame Filter Management.
  43343. (line 91)
  43344. * show gnutarget: Target Commands. (line 40)
  43345. * show hash, for remote monitors: Target Commands. (line 104)
  43346. * show height: Screen Size. (line 22)
  43347. * show history: Command History. (line 87)
  43348. * show host-charset: Character Sets. (line 55)
  43349. * show inferior-tty: Input/Output. (line 54)
  43350. * show input-radix: Numbers. (line 35)
  43351. * show interactive-mode: Other Misc Settings. (line 20)
  43352. * show language: Show. (line 10)
  43353. * show libthread-db-search-path: Threads. (line 322)
  43354. * show listsize: List. (line 39)
  43355. * show logging: Logging Output. (line 22)
  43356. * show mach-exceptions: Darwin. (line 34)
  43357. * show max-completions: Completion. (line 77)
  43358. * show max-user-call-depth: Define. (line 91)
  43359. * show max-value-size: Value Sizes. (line 36)
  43360. * show mem inaccessible-by-default: Memory Region Attributes.
  43361. (line 129)
  43362. * show mips abi: MIPS. (line 46)
  43363. * show mips compression: MIPS. (line 72)
  43364. * show mips mask-address: MIPS. (line 86)
  43365. * show mipsfpu: MIPS Embedded. (line 13)
  43366. * show mpx bound: i386. (line 57)
  43367. * show multiple-symbols: Ambiguous Expressions.
  43368. (line 70)
  43369. * show new-console: Cygwin Native. (line 77)
  43370. * show new-group: Cygwin Native. (line 86)
  43371. * show non-stop: Non-Stop Mode. (line 38)
  43372. * show opaque-type-resolution: Symbols. (line 553)
  43373. * show osabi: ABI. (line 11)
  43374. * show output-radix: Numbers. (line 38)
  43375. * show overload-resolution: Debugging C Plus Plus.
  43376. (line 76)
  43377. * show pagination: Screen Size. (line 47)
  43378. * show paths: Environment. (line 29)
  43379. * show print: Print Settings. (line 39)
  43380. * show print inferior-events: Inferiors and Programs.
  43381. (line 134)
  43382. * show print symbol-loading: Symbols. (line 571)
  43383. * show print thread-events: Threads. (line 276)
  43384. * show print type methods: Symbols. (line 53)
  43385. * show print type nested-type-limit: Symbols. (line 64)
  43386. * show print type typedefs: Symbols. (line 81)
  43387. * show processor: Targets. (line 31)
  43388. * show procfs-file: Process Information. (line 116)
  43389. * show procfs-trace: Process Information. (line 108)
  43390. * show prompt: Prompt. (line 19)
  43391. * show radix: Numbers. (line 43)
  43392. * show range-stepping: Continuing and Stepping.
  43393. (line 221)
  43394. * show ravenscar task-switching: Ravenscar Profile. (line 22)
  43395. * show record: Process Record and Replay.
  43396. (line 413)
  43397. * show record btrace: Process Record and Replay.
  43398. (line 264)
  43399. * show record full: Process Record and Replay.
  43400. (line 166)
  43401. * show remote: Remote Configuration.
  43402. (line 6)
  43403. * show remote system-call-allowed: system. (line 41)
  43404. * show remote-mips64-transfers-32bit-regs: MIPS. (line 96)
  43405. * show remotecache: Caching Target Data. (line 25)
  43406. * show remoteflow: Remote Configuration.
  43407. (line 52)
  43408. * show script-extension: Extending GDB. (line 29)
  43409. * show sh calling-convention: Super-H. (line 22)
  43410. * show shell: Cygwin Native. (line 112)
  43411. * show signal-thread: Hurd Native. (line 27)
  43412. * show signals, Hurd command: Hurd Native. (line 17)
  43413. * show sigs, Hurd command: Hurd Native. (line 17)
  43414. * show sigthread: Hurd Native. (line 27)
  43415. * show solib-search-path: Files. (line 473)
  43416. * show spu: SPU. (line 43)
  43417. * show stack-cache: Caching Target Data. (line 33)
  43418. * show stop-on-solib-events: Files. (line 369)
  43419. * show stopped, Hurd command: Hurd Native. (line 36)
  43420. * show struct-convention: i386. (line 15)
  43421. * show style: Output Styling. (line 6)
  43422. * show substitute-path: Source Path. (line 162)
  43423. * show sysroot: Files. (line 459)
  43424. * show target-charset: Character Sets. (line 58)
  43425. * show target-file-system-kind: Files. (line 476)
  43426. * show target-wide-charset: Character Sets. (line 67)
  43427. * show task, Hurd commands: Hurd Native. (line 56)
  43428. * show tcp: Remote Configuration.
  43429. (line 130)
  43430. * show thread, Hurd command: Hurd Native. (line 100)
  43431. * show trace-buffer-size: Starting and Stopping Trace Experiments.
  43432. (line 114)
  43433. * show trace-notes: Starting and Stopping Trace Experiments.
  43434. (line 129)
  43435. * show trace-stop-notes: Starting and Stopping Trace Experiments.
  43436. (line 137)
  43437. * show trace-user: Starting and Stopping Trace Experiments.
  43438. (line 124)
  43439. * show unwind-on-terminating-exception: Calling. (line 55)
  43440. * show unwindonsignal: Calling. (line 43)
  43441. * show user: Define. (line 84)
  43442. * show values: Value History. (line 47)
  43443. * show varsize-limit: Ada Settings. (line 26)
  43444. * show verbose: Messages/Warnings. (line 21)
  43445. * show version: Help. (line 128)
  43446. * show warranty: Help. (line 142)
  43447. * show width: Screen Size. (line 22)
  43448. * show write: Patching. (line 26)
  43449. * show-all-if-ambiguous: Readline Init File Syntax.
  43450. (line 212)
  43451. * show-all-if-unmodified: Readline Init File Syntax.
  43452. (line 218)
  43453. * si ('stepi'): Continuing and Stepping.
  43454. (line 189)
  43455. * signal: Signaling. (line 6)
  43456. * signal annotation: Annotations for Running.
  43457. (line 42)
  43458. * signal-event: Cygwin Native. (line 35)
  43459. * signal-name annotation: Annotations for Running.
  43460. (line 22)
  43461. * signal-name-end annotation: Annotations for Running.
  43462. (line 22)
  43463. * signal-string annotation: Annotations for Running.
  43464. (line 22)
  43465. * signal-string-end annotation: Annotations for Running.
  43466. (line 22)
  43467. * SignalEvent.stop_signal: Events In Python. (line 91)
  43468. * signalled annotation: Annotations for Running.
  43469. (line 22)
  43470. * silent: Break Commands. (line 43)
  43471. * sim, a command: Embedded Processors. (line 13)
  43472. * skip: Skipping Over Functions and Files.
  43473. (line 44)
  43474. * skip delete: Skipping Over Functions and Files.
  43475. (line 137)
  43476. * skip disable: Skipping Over Functions and Files.
  43477. (line 145)
  43478. * skip enable: Skipping Over Functions and Files.
  43479. (line 141)
  43480. * skip file: Skipping Over Functions and Files.
  43481. (line 100)
  43482. * skip function: Skipping Over Functions and Files.
  43483. (line 89)
  43484. * skip-completed-text: Readline Init File Syntax.
  43485. (line 227)
  43486. * skip-csi-sequence (): Miscellaneous Commands.
  43487. (line 51)
  43488. * source: Command Files. (line 17)
  43489. * source annotation: Source Annotations. (line 6)
  43490. * start: Starting. (line 80)
  43491. * start-kbd-macro (C-x (): Keyboard Macros. (line 6)
  43492. * starti: Starting. (line 113)
  43493. * starting annotation: Annotations for Running.
  43494. (line 6)
  43495. * STDERR: Basic Python. (line 183)
  43496. * STDERR <1>: Basic Python. (line 203)
  43497. * stdio-port?: I/O Ports in Guile. (line 15)
  43498. * STDLOG: Basic Python. (line 186)
  43499. * STDLOG <1>: Basic Python. (line 206)
  43500. * STDOUT: Basic Python. (line 180)
  43501. * STDOUT <1>: Basic Python. (line 200)
  43502. * step: Continuing and Stepping.
  43503. (line 45)
  43504. * step&: Background Execution.
  43505. (line 28)
  43506. * stepi: Continuing and Stepping.
  43507. (line 189)
  43508. * stepi&: Background Execution.
  43509. (line 31)
  43510. * stop, a pseudo-command: Hooks. (line 21)
  43511. * stopping annotation: Annotations for Running.
  43512. (line 6)
  43513. * strace: Create and Delete Tracepoints.
  43514. (line 75)
  43515. * string->argv: Commands In Guile. (line 73)
  43516. * symbol-addr-class: Symbols In Guile. (line 48)
  43517. * symbol-argument?: Symbols In Guile. (line 58)
  43518. * symbol-constant?: Symbols In Guile. (line 62)
  43519. * symbol-file: Files. (line 45)
  43520. * symbol-function?: Symbols In Guile. (line 65)
  43521. * symbol-line: Symbols In Guile. (line 32)
  43522. * symbol-linkage-name: Symbols In Guile. (line 39)
  43523. * symbol-name: Symbols In Guile. (line 36)
  43524. * symbol-needs-frame?: Symbols In Guile. (line 53)
  43525. * symbol-print-name: Symbols In Guile. (line 43)
  43526. * symbol-symtab: Symbols In Guile. (line 28)
  43527. * symbol-type: Symbols In Guile. (line 24)
  43528. * symbol-valid?: Symbols In Guile. (line 17)
  43529. * symbol-value: Symbols In Guile. (line 72)
  43530. * symbol-variable?: Symbols In Guile. (line 69)
  43531. * Symbol.addr_class: Symbols In Python. (line 74)
  43532. * Symbol.is_argument: Symbols In Python. (line 84)
  43533. * Symbol.is_constant: Symbols In Python. (line 87)
  43534. * Symbol.is_function: Symbols In Python. (line 90)
  43535. * Symbol.is_valid: Symbols In Python. (line 98)
  43536. * Symbol.is_variable: Symbols In Python. (line 93)
  43537. * Symbol.line: Symbols In Python. (line 57)
  43538. * Symbol.linkage_name: Symbols In Python. (line 65)
  43539. * Symbol.name: Symbols In Python. (line 61)
  43540. * Symbol.needs_frame: Symbols In Python. (line 79)
  43541. * Symbol.print_name: Symbols In Python. (line 69)
  43542. * Symbol.symtab: Symbols In Python. (line 52)
  43543. * Symbol.type: Symbols In Python. (line 47)
  43544. * Symbol.value: Symbols In Python. (line 105)
  43545. * symbol?: Symbols In Guile. (line 13)
  43546. * SYMBOL_COMMON_BLOCK_DOMAIN: Symbols In Python. (line 133)
  43547. * SYMBOL_FUNCTIONS_DOMAIN: Symbols In Guile. (line 133)
  43548. * SYMBOL_LABEL_DOMAIN: Symbols In Python. (line 127)
  43549. * SYMBOL_LABEL_DOMAIN <1>: Symbols In Guile. (line 126)
  43550. * SYMBOL_LOC_ARG: Symbols In Python. (line 152)
  43551. * SYMBOL_LOC_ARG <1>: Symbols In Guile. (line 155)
  43552. * SYMBOL_LOC_BLOCK: Symbols In Python. (line 173)
  43553. * SYMBOL_LOC_BLOCK <1>: Symbols In Guile. (line 176)
  43554. * SYMBOL_LOC_COMPUTED: Symbols In Python. (line 187)
  43555. * SYMBOL_LOC_COMPUTED <1>: Symbols In Python. (line 190)
  43556. * SYMBOL_LOC_COMPUTED <2>: Symbols In Guile. (line 190)
  43557. * SYMBOL_LOC_CONST: Symbols In Python. (line 143)
  43558. * SYMBOL_LOC_CONST <1>: Symbols In Guile. (line 146)
  43559. * SYMBOL_LOC_CONST_BYTES: Symbols In Python. (line 176)
  43560. * SYMBOL_LOC_CONST_BYTES <1>: Symbols In Guile. (line 179)
  43561. * SYMBOL_LOC_LOCAL: Symbols In Python. (line 166)
  43562. * SYMBOL_LOC_LOCAL <1>: Symbols In Guile. (line 169)
  43563. * SYMBOL_LOC_OPTIMIZED_OUT: Symbols In Python. (line 184)
  43564. * SYMBOL_LOC_OPTIMIZED_OUT <1>: Symbols In Guile. (line 187)
  43565. * SYMBOL_LOC_REF_ARG: Symbols In Python. (line 156)
  43566. * SYMBOL_LOC_REF_ARG <1>: Symbols In Guile. (line 159)
  43567. * SYMBOL_LOC_REGISTER: Symbols In Python. (line 149)
  43568. * SYMBOL_LOC_REGISTER <1>: Symbols In Guile. (line 152)
  43569. * SYMBOL_LOC_REGPARM_ADDR: Symbols In Python. (line 161)
  43570. * SYMBOL_LOC_REGPARM_ADDR <1>: Symbols In Guile. (line 164)
  43571. * SYMBOL_LOC_STATIC: Symbols In Python. (line 146)
  43572. * SYMBOL_LOC_STATIC <1>: Symbols In Guile. (line 149)
  43573. * SYMBOL_LOC_TYPEDEF: Symbols In Python. (line 169)
  43574. * SYMBOL_LOC_TYPEDEF <1>: Symbols In Guile. (line 172)
  43575. * SYMBOL_LOC_UNDEF: Symbols In Python. (line 139)
  43576. * SYMBOL_LOC_UNDEF <1>: Symbols In Guile. (line 142)
  43577. * SYMBOL_LOC_UNRESOLVED: Symbols In Python. (line 179)
  43578. * SYMBOL_LOC_UNRESOLVED <1>: Symbols In Guile. (line 182)
  43579. * SYMBOL_MODULE_DOMAIN: Symbols In Python. (line 130)
  43580. * SYMBOL_STRUCT_DOMAIN: Symbols In Python. (line 124)
  43581. * SYMBOL_STRUCT_DOMAIN <1>: Symbols In Guile. (line 123)
  43582. * SYMBOL_TYPES_DOMAIN: Symbols In Guile. (line 136)
  43583. * SYMBOL_UNDEF_DOMAIN: Symbols In Python. (line 115)
  43584. * SYMBOL_UNDEF_DOMAIN <1>: Symbols In Guile. (line 114)
  43585. * SYMBOL_VARIABLES_DOMAIN: Symbols In Guile. (line 129)
  43586. * SYMBOL_VAR_DOMAIN: Symbols In Python. (line 120)
  43587. * SYMBOL_VAR_DOMAIN <1>: Symbols In Guile. (line 119)
  43588. * symtab-filename: Symbol Tables In Guile.
  43589. (line 28)
  43590. * symtab-fullname: Symbol Tables In Guile.
  43591. (line 31)
  43592. * symtab-global-block: Symbol Tables In Guile.
  43593. (line 38)
  43594. * symtab-objfile: Symbol Tables In Guile.
  43595. (line 34)
  43596. * symtab-static-block: Symbol Tables In Guile.
  43597. (line 42)
  43598. * symtab-valid?: Symbol Tables In Guile.
  43599. (line 21)
  43600. * Symtab.filename: Symbol Tables In Python.
  43601. (line 43)
  43602. * Symtab.fullname: Symbol Tables In Python.
  43603. (line 66)
  43604. * Symtab.global_block: Symbol Tables In Python.
  43605. (line 69)
  43606. * Symtab.is_valid: Symbol Tables In Python.
  43607. (line 59)
  43608. * Symtab.linetable: Symbol Tables In Python.
  43609. (line 77)
  43610. * Symtab.objfile: Symbol Tables In Python.
  43611. (line 47)
  43612. * Symtab.producer: Symbol Tables In Python.
  43613. (line 51)
  43614. * Symtab.static_block: Symbol Tables In Python.
  43615. (line 73)
  43616. * symtab?: Symbol Tables In Guile.
  43617. (line 17)
  43618. * Symtab_and_line.is_valid: Symbol Tables In Python.
  43619. (line 34)
  43620. * Symtab_and_line.last: Symbol Tables In Python.
  43621. (line 24)
  43622. * Symtab_and_line.line: Symbol Tables In Python.
  43623. (line 28)
  43624. * Symtab_and_line.pc: Symbol Tables In Python.
  43625. (line 20)
  43626. * Symtab_and_line.symtab: Symbol Tables In Python.
  43627. (line 16)
  43628. * sysinfo: DJGPP Native. (line 19)
  43629. * taas: Threads. (line 222)
  43630. * tab-insert (M-<TAB>): Commands For Text. (line 24)
  43631. * tabset: TUI Configuration. (line 49)
  43632. * target: Target Commands. (line 49)
  43633. * target ctf: Trace Files. (line 28)
  43634. * target record: Process Record and Replay.
  43635. (line 38)
  43636. * target record-btrace: Process Record and Replay.
  43637. (line 38)
  43638. * target record-full: Process Record and Replay.
  43639. (line 38)
  43640. * target sim: OpenRISC 1000. (line 13)
  43641. * target tfile: Trace Files. (line 28)
  43642. * target-config: Guile Configuration. (line 24)
  43643. * task (Ada): Ada Tasks. (line 105)
  43644. * tbreak: Set Breaks. (line 54)
  43645. * tcatch: Set Catchpoints. (line 289)
  43646. * tdump: tdump. (line 6)
  43647. * teval (tracepoints): Tracepoint Actions. (line 118)
  43648. * tfaas: Threads. (line 226)
  43649. * tfile: Trace Files. (line 28)
  43650. * tfind: tfind. (line 6)
  43651. * thbreak: Set Breaks. (line 80)
  43652. * this, inside C++ member functions: C Plus Plus Expressions.
  43653. (line 20)
  43654. * thread apply: Threads. (line 187)
  43655. * thread find: Threads. (line 252)
  43656. * thread name: Threads. (line 241)
  43657. * thread THREAD-ID: Threads. (line 169)
  43658. * thread-info: GDB/MI Support Commands.
  43659. (line 86)
  43660. * ThreadEvent.inferior_thread: Events In Python. (line 54)
  43661. * throw-user-error: Commands In Guile. (line 81)
  43662. * tilde-expand (M-~): Miscellaneous Commands.
  43663. (line 29)
  43664. * trace: Create and Delete Tracepoints.
  43665. (line 6)
  43666. * transpose-chars (C-t): Commands For Text. (line 30)
  43667. * transpose-words (M-t): Commands For Text. (line 36)
  43668. * tsave: Trace Files. (line 12)
  43669. * tstart [ NOTES ]: Starting and Stopping Trace Experiments.
  43670. (line 6)
  43671. * tstatus: Starting and Stopping Trace Experiments.
  43672. (line 27)
  43673. * tstop [ NOTES ]: Starting and Stopping Trace Experiments.
  43674. (line 16)
  43675. * tty: Input/Output. (line 23)
  43676. * tui disable: TUI Commands. (line 23)
  43677. * tui enable: TUI Commands. (line 18)
  43678. * tui reg: TUI Commands. (line 80)
  43679. * tvariable: Trace State Variables.
  43680. (line 26)
  43681. * type-array: Types In Guile. (line 52)
  43682. * type-code: Types In Guile. (line 25)
  43683. * type-const: Types In Guile. (line 99)
  43684. * type-field: Types In Guile. (line 129)
  43685. * type-fields: Types In Guile. (line 115)
  43686. * type-has-field-deep?: Guile Types Module. (line 32)
  43687. * type-has-field?: Types In Guile. (line 142)
  43688. * type-name: Types In Guile. (line 34)
  43689. * type-num-fields: Types In Guile. (line 112)
  43690. * type-pointer: Types In Guile. (line 73)
  43691. * type-print-name: Types In Guile. (line 38)
  43692. * type-range: Types In Guile. (line 77)
  43693. * type-reference: Types In Guile. (line 81)
  43694. * type-sizeof: Types In Guile. (line 43)
  43695. * type-strip-typedefs: Types In Guile. (line 48)
  43696. * type-tag: Types In Guile. (line 29)
  43697. * type-target: Types In Guile. (line 85)
  43698. * type-unqualified: Types In Guile. (line 107)
  43699. * type-vector: Types In Guile. (line 60)
  43700. * type-volatile: Types In Guile. (line 103)
  43701. * Type.alignof: Types In Python. (line 32)
  43702. * Type.array: Types In Python. (line 108)
  43703. * Type.code: Types In Python. (line 38)
  43704. * Type.const: Types In Python. (line 129)
  43705. * Type.fields: Types In Python. (line 59)
  43706. * Type.name: Types In Python. (line 42)
  43707. * Type.optimized_out: Types In Python. (line 186)
  43708. * Type.pointer: Types In Python. (line 152)
  43709. * Type.range: Types In Python. (line 142)
  43710. * Type.reference: Types In Python. (line 148)
  43711. * Type.sizeof: Types In Python. (line 46)
  43712. * Type.strip_typedefs: Types In Python. (line 156)
  43713. * Type.tag: Types In Python. (line 51)
  43714. * Type.target: Types In Python. (line 160)
  43715. * Type.template_argument: Types In Python. (line 174)
  43716. * Type.unqualified: Types In Python. (line 137)
  43717. * Type.vector: Types In Python. (line 116)
  43718. * Type.volatile: Types In Python. (line 133)
  43719. * type?: Types In Guile. (line 11)
  43720. * TYPE_CODE_ARRAY: Types In Python. (line 198)
  43721. * TYPE_CODE_ARRAY <1>: Types In Guile. (line 153)
  43722. * TYPE_CODE_BITSTRING: Types In Python. (line 236)
  43723. * TYPE_CODE_BITSTRING <1>: Types In Guile. (line 191)
  43724. * TYPE_CODE_BOOL: Types In Python. (line 260)
  43725. * TYPE_CODE_BOOL <1>: Types In Guile. (line 212)
  43726. * TYPE_CODE_CHAR: Types In Python. (line 257)
  43727. * TYPE_CODE_CHAR <1>: Types In Guile. (line 209)
  43728. * TYPE_CODE_COMPLEX: Types In Python. (line 263)
  43729. * TYPE_CODE_COMPLEX <1>: Types In Guile. (line 215)
  43730. * TYPE_CODE_DECFLOAT: Types In Python. (line 272)
  43731. * TYPE_CODE_DECFLOAT <1>: Types In Guile. (line 224)
  43732. * TYPE_CODE_ENUM: Types In Python. (line 207)
  43733. * TYPE_CODE_ENUM <1>: Types In Guile. (line 162)
  43734. * TYPE_CODE_ERROR: Types In Python. (line 239)
  43735. * TYPE_CODE_ERROR <1>: Types In Guile. (line 194)
  43736. * TYPE_CODE_FLAGS: Types In Python. (line 210)
  43737. * TYPE_CODE_FLAGS <1>: Types In Guile. (line 165)
  43738. * TYPE_CODE_FLT: Types In Python. (line 219)
  43739. * TYPE_CODE_FLT <1>: Types In Guile. (line 174)
  43740. * TYPE_CODE_FUNC: Types In Python. (line 213)
  43741. * TYPE_CODE_FUNC <1>: Types In Guile. (line 168)
  43742. * TYPE_CODE_INT: Types In Python. (line 216)
  43743. * TYPE_CODE_INT <1>: Types In Guile. (line 171)
  43744. * TYPE_CODE_INTERNAL_FUNCTION: Types In Python. (line 275)
  43745. * TYPE_CODE_INTERNAL_FUNCTION <1>: Types In Guile. (line 227)
  43746. * TYPE_CODE_MEMBERPTR: Types In Python. (line 248)
  43747. * TYPE_CODE_MEMBERPTR <1>: Types In Guile. (line 203)
  43748. * TYPE_CODE_METHOD: Types In Python. (line 242)
  43749. * TYPE_CODE_METHOD <1>: Types In Guile. (line 197)
  43750. * TYPE_CODE_METHODPTR: Types In Python. (line 245)
  43751. * TYPE_CODE_METHODPTR <1>: Types In Guile. (line 200)
  43752. * TYPE_CODE_NAMESPACE: Types In Python. (line 269)
  43753. * TYPE_CODE_NAMESPACE <1>: Types In Guile. (line 221)
  43754. * TYPE_CODE_PTR: Types In Python. (line 195)
  43755. * TYPE_CODE_PTR <1>: Types In Guile. (line 150)
  43756. * TYPE_CODE_RANGE: Types In Python. (line 228)
  43757. * TYPE_CODE_RANGE <1>: Types In Guile. (line 183)
  43758. * TYPE_CODE_REF: Types In Python. (line 251)
  43759. * TYPE_CODE_REF <1>: Types In Guile. (line 206)
  43760. * TYPE_CODE_RVALUE_REF: Types In Python. (line 254)
  43761. * TYPE_CODE_SET: Types In Python. (line 225)
  43762. * TYPE_CODE_SET <1>: Types In Guile. (line 180)
  43763. * TYPE_CODE_STRING: Types In Python. (line 231)
  43764. * TYPE_CODE_STRING <1>: Types In Guile. (line 186)
  43765. * TYPE_CODE_STRUCT: Types In Python. (line 201)
  43766. * TYPE_CODE_STRUCT <1>: Types In Guile. (line 156)
  43767. * TYPE_CODE_TYPEDEF: Types In Python. (line 266)
  43768. * TYPE_CODE_TYPEDEF <1>: Types In Guile. (line 218)
  43769. * TYPE_CODE_UNION: Types In Python. (line 204)
  43770. * TYPE_CODE_UNION <1>: Types In Guile. (line 159)
  43771. * TYPE_CODE_VOID: Types In Python. (line 222)
  43772. * TYPE_CODE_VOID <1>: Types In Guile. (line 177)
  43773. * u (SingleKey TUI key): TUI Single Key Mode. (line 37)
  43774. * u ('until'): Continuing and Stepping.
  43775. (line 117)
  43776. * undefined-command-error-code: GDB/MI Support Commands.
  43777. (line 101)
  43778. * undisplay: Auto Display. (line 45)
  43779. * undo (C-_ or C-x C-u): Miscellaneous Commands.
  43780. (line 22)
  43781. * universal-argument (): Numeric Arguments. (line 10)
  43782. * unix-filename-rubout (): Commands For Killing.
  43783. (line 32)
  43784. * unix-line-discard (C-u): Commands For Killing.
  43785. (line 12)
  43786. * unix-word-rubout (C-w): Commands For Killing.
  43787. (line 28)
  43788. * unset environment: Environment. (line 65)
  43789. * unset substitute-path: Source Path. (line 154)
  43790. * until: Continuing and Stepping.
  43791. (line 117)
  43792. * until&: Background Execution.
  43793. (line 46)
  43794. * unwind-stop-reason-string: Frames In Guile. (line 163)
  43795. * up: Selection. (line 69)
  43796. * Up: TUI Keys. (line 53)
  43797. * up-silently: Selection. (line 106)
  43798. * upcase-word (M-u): Commands For Text. (line 41)
  43799. * update: TUI Commands. (line 106)
  43800. * v (SingleKey TUI key): TUI Single Key Mode. (line 40)
  43801. * value->bool: Values From Inferior In Guile.
  43802. (line 234)
  43803. * value->bytevector: Values From Inferior In Guile.
  43804. (line 246)
  43805. * value->integer: Values From Inferior In Guile.
  43806. (line 238)
  43807. * value->lazy-string: Values From Inferior In Guile.
  43808. (line 291)
  43809. * value->real: Values From Inferior In Guile.
  43810. (line 242)
  43811. * value->string: Values From Inferior In Guile.
  43812. (line 250)
  43813. * value-abs: Arithmetic In Guile. (line 35)
  43814. * value-add: Arithmetic In Guile. (line 15)
  43815. * value-address: Values From Inferior In Guile.
  43816. (line 106)
  43817. * value-call: Values From Inferior In Guile.
  43818. (line 228)
  43819. * value-cast: Values From Inferior In Guile.
  43820. (line 129)
  43821. * value-dereference: Values From Inferior In Guile.
  43822. (line 143)
  43823. * value-div: Arithmetic In Guile. (line 21)
  43824. * value-dynamic-cast: Values From Inferior In Guile.
  43825. (line 135)
  43826. * value-dynamic-type: Values From Inferior In Guile.
  43827. (line 114)
  43828. * value-fetch-lazy!: Values From Inferior In Guile.
  43829. (line 333)
  43830. * value-field: Values From Inferior In Guile.
  43831. (line 221)
  43832. * value-lazy?: Values From Inferior In Guile.
  43833. (line 316)
  43834. * value-logand: Arithmetic In Guile. (line 47)
  43835. * value-logior: Arithmetic In Guile. (line 49)
  43836. * value-lognot: Arithmetic In Guile. (line 45)
  43837. * value-logxor: Arithmetic In Guile. (line 51)
  43838. * value-lsh: Arithmetic In Guile. (line 37)
  43839. * value-max: Arithmetic In Guile. (line 43)
  43840. * value-min: Arithmetic In Guile. (line 41)
  43841. * value-mod: Arithmetic In Guile. (line 25)
  43842. * value-mul: Arithmetic In Guile. (line 19)
  43843. * value-neg: Arithmetic In Guile. (line 31)
  43844. * value-not: Arithmetic In Guile. (line 29)
  43845. * value-optimized-out?: Values From Inferior In Guile.
  43846. (line 102)
  43847. * value-pos: Arithmetic In Guile. (line 33)
  43848. * value-pow: Arithmetic In Guile. (line 27)
  43849. * value-print: Values From Inferior In Guile.
  43850. (line 342)
  43851. * value-referenced-value: Values From Inferior In Guile.
  43852. (line 196)
  43853. * value-reinterpret-cast: Values From Inferior In Guile.
  43854. (line 139)
  43855. * value-rem: Arithmetic In Guile. (line 23)
  43856. * value-rsh: Arithmetic In Guile. (line 39)
  43857. * value-sub: Arithmetic In Guile. (line 17)
  43858. * value-subscript: Values From Inferior In Guile.
  43859. (line 224)
  43860. * value-type: Values From Inferior In Guile.
  43861. (line 110)
  43862. * Value.address: Values From Inferior.
  43863. (line 65)
  43864. * Value.cast: Values From Inferior.
  43865. (line 148)
  43866. * Value.const_value: Values From Inferior.
  43867. (line 236)
  43868. * Value.dereference: Values From Inferior.
  43869. (line 154)
  43870. * Value.dynamic_cast: Values From Inferior.
  43871. (line 240)
  43872. * Value.dynamic_type: Values From Inferior.
  43873. (line 79)
  43874. * Value.fetch_lazy: Values From Inferior.
  43875. (line 302)
  43876. * Value.is_lazy: Values From Inferior.
  43877. (line 94)
  43878. * Value.is_optimized_out: Values From Inferior.
  43879. (line 70)
  43880. * Value.lazy_string: Values From Inferior.
  43881. (line 280)
  43882. * Value.referenced_value: Values From Inferior.
  43883. (line 207)
  43884. * Value.reference_value: Values From Inferior.
  43885. (line 232)
  43886. * Value.reinterpret_cast: Values From Inferior.
  43887. (line 244)
  43888. * Value.string: Values From Inferior.
  43889. (line 248)
  43890. * Value.type: Values From Inferior.
  43891. (line 75)
  43892. * Value.__init__: Values From Inferior.
  43893. (line 107)
  43894. * Value.__init__ <1>: Values From Inferior.
  43895. (line 141)
  43896. * value<=?: Arithmetic In Guile. (line 57)
  43897. * value<?: Arithmetic In Guile. (line 55)
  43898. * value=?: Arithmetic In Guile. (line 53)
  43899. * value>=?: Arithmetic In Guile. (line 61)
  43900. * value>?: Arithmetic In Guile. (line 59)
  43901. * value?: Values From Inferior In Guile.
  43902. (line 41)
  43903. * vi-editing-mode (M-C-j): Miscellaneous Commands.
  43904. (line 91)
  43905. * visible-stats: Readline Init File Syntax.
  43906. (line 240)
  43907. * w (SingleKey TUI key): TUI Single Key Mode. (line 43)
  43908. * watch: Set Watchpoints. (line 42)
  43909. * watchpoint annotation: Annotations for Running.
  43910. (line 50)
  43911. * whatis: Symbols. (line 125)
  43912. * where: Backtrace. (line 50)
  43913. * while: Command Files. (line 85)
  43914. * while-stepping (tracepoints): Tracepoint Actions. (line 126)
  43915. * winheight: TUI Commands. (line 110)
  43916. * WP_ACCESS: Breakpoints In Python.
  43917. (line 86)
  43918. * WP_ACCESS <1>: Breakpoints In Guile.
  43919. (line 84)
  43920. * WP_READ: Breakpoints In Python.
  43921. (line 80)
  43922. * WP_READ <1>: Breakpoints In Guile.
  43923. (line 78)
  43924. * WP_WRITE: Breakpoints In Python.
  43925. (line 83)
  43926. * WP_WRITE <1>: Breakpoints In Guile.
  43927. (line 81)
  43928. * x (examine memory): Memory. (line 9)
  43929. * x(examine), and info line: Machine Code. (line 34)
  43930. * XMethod.__init__: Xmethod API. (line 38)
  43931. * XMethodMatcher.match: Xmethod API. (line 47)
  43932. * XMethodMatcher.__init__: Xmethod API. (line 43)
  43933. * XMethodWorker.get_arg_types: Xmethod API. (line 60)
  43934. * XMethodWorker.get_result_type: Xmethod API. (line 67)
  43935. * XMethodWorker.__call__: Xmethod API. (line 73)
  43936. * yank (C-y): Commands For Killing.
  43937. (line 59)
  43938. * yank-last-arg (M-. or M-_): Commands For History.
  43939. (line 64)
  43940. * yank-nth-arg (M-C-y): Commands For History.
  43941. (line 55)
  43942. * yank-pop (M-y): Commands For Killing.
  43943. (line 62)
  43944. 
  43945. Tag Table:
  43946. Node: Top1730
  43947. Node: Summary5216
  43948. Node: Free Software7077
  43949. Node: Free Documentation7817
  43950. Node: Contributors12751
  43951. Node: Sample Session21630
  43952. Node: Invocation28481
  43953. Node: Invoking GDB29024
  43954. Node: File Options31358
  43955. Ref: --readnever34429
  43956. Node: Mode Options34903
  43957. Ref: -nx35130
  43958. Ref: -nh36214
  43959. Node: Startup42532
  43960. Ref: Home Directory Init File43083
  43961. Ref: Option -init-eval-command43193
  43962. Ref: Init File in the Current Directory during Startup43533
  43963. Ref: Startup-Footnote-145729
  43964. Node: Quitting GDB45838
  43965. Node: Shell Commands46735
  43966. Node: Logging Output47662
  43967. Node: Commands48499
  43968. Node: Command Syntax49137
  43969. Node: Completion51303
  43970. Ref: Completion-Footnote-158213
  43971. Node: Help58373
  43972. Node: Running64124
  43973. Node: Compilation65353
  43974. Node: Starting67432
  43975. Ref: set exec-wrapper73222
  43976. Ref: set startup-with-shell74311
  43977. Ref: set auto-connect-native-target75372
  43978. Node: Arguments79768
  43979. Node: Environment81037
  43980. Ref: set environment82919
  43981. Ref: unset environment84101
  43982. Node: Working Directory85107
  43983. Ref: set cwd command85679
  43984. Ref: cd command86619
  43985. Node: Input/Output87313
  43986. Node: Attach89373
  43987. Node: Kill Process91839
  43988. Node: Inferiors and Programs92820
  43989. Node: Threads100551
  43990. Ref: thread numbers102662
  43991. Ref: thread ID lists103552
  43992. Ref: global thread numbers104592
  43993. Ref: set libthread-db-search-path113006
  43994. Node: Forks115060
  43995. Node: Checkpoint/Restart121578
  43996. Ref: Checkpoint/Restart-Footnote-1126106
  43997. Node: Stopping126141
  43998. Node: Breakpoints127404
  43999. Node: Set Breaks130661
  44000. Node: Set Watchpoints149620
  44001. Node: Set Catchpoints159002
  44002. Ref: catch syscall164014
  44003. Node: Delete Breaks171779
  44004. Node: Disabling173715
  44005. Node: Conditions177095
  44006. Node: Break Commands182742
  44007. Node: Dynamic Printf185962
  44008. Node: Save Breakpoints190266
  44009. Node: Static Probe Points191441
  44010. Ref: Static Probe Points-Footnote-1195619
  44011. Ref: Static Probe Points-Footnote-2195779
  44012. Node: Error in Breakpoints195919
  44013. Node: Breakpoint-related Warnings196655
  44014. Node: Continuing and Stepping198982
  44015. Ref: range stepping208445
  44016. Node: Skipping Over Functions and Files209525
  44017. Node: Signals215374
  44018. Ref: stepping and signal handlers219808
  44019. Ref: stepping into signal handlers220604
  44020. Ref: extra signal information221837
  44021. Node: Thread Stops224303
  44022. Node: All-Stop Mode225402
  44023. Node: Non-Stop Mode229369
  44024. Node: Background Execution232782
  44025. Node: Thread-Specific Breakpoints234998
  44026. Node: Interrupted System Calls237014
  44027. Node: Observer Mode238528
  44028. Node: Reverse Execution241964
  44029. Ref: Reverse Execution-Footnote-1246589
  44030. Ref: Reverse Execution-Footnote-2247216
  44031. Node: Process Record and Replay247266
  44032. Node: Stack268358
  44033. Node: Frames269975
  44034. Node: Backtrace272313
  44035. Ref: backtrace-command272650
  44036. Ref: Backtrace-Footnote-1278898
  44037. Node: Selection279086
  44038. Node: Frame Info283869
  44039. Node: Frame Apply288291
  44040. Node: Frame Filter Management292194
  44041. Ref: disable frame-filter all292722
  44042. Node: Source297030
  44043. Node: List298096
  44044. Node: Specify Location300798
  44045. Node: Linespec Locations301419
  44046. Node: Explicit Locations304818
  44047. Node: Address Locations308030
  44048. Node: Edit309781
  44049. Ref: Edit-Footnote-1311257
  44050. Node: Search311492
  44051. Node: Source Path312300
  44052. Ref: set substitute-path318666
  44053. Node: Machine Code320886
  44054. Node: Data331230
  44055. Node: Expressions338963
  44056. Node: Ambiguous Expressions341066
  44057. Node: Variables344296
  44058. Node: Arrays350894
  44059. Node: Output Formats353425
  44060. Ref: Output Formats-Footnote-1356798
  44061. Node: Memory356955
  44062. Ref: addressable memory unit363140
  44063. Node: Auto Display364634
  44064. Node: Print Settings369176
  44065. Ref: set print entry-values377338
  44066. Node: Pretty Printing388036
  44067. Node: Pretty-Printer Introduction388550
  44068. Node: Pretty-Printer Example390305
  44069. Node: Pretty-Printer Commands391083
  44070. Node: Value History393507
  44071. Node: Convenience Vars395929
  44072. Node: Convenience Funs402533
  44073. Node: Registers408022
  44074. Ref: standard registers409229
  44075. Ref: Registers-Footnote-1414180
  44076. Node: Floating Point Hardware414575
  44077. Node: Vector Unit415107
  44078. Node: OS Information415494
  44079. Ref: linux info os infotypes417518
  44080. Node: Memory Region Attributes422109
  44081. Node: Dump/Restore Files426773
  44082. Node: Core File Generation429176
  44083. Ref: set use-coredump-filter430736
  44084. Ref: set dump-excluded-mappings432184
  44085. Node: Character Sets432466
  44086. Node: Caching Target Data438831
  44087. Ref: Caching Target Data-Footnote-1441559
  44088. Node: Searching Memory441797
  44089. Node: Value Sizes444940
  44090. Node: Optimized Code446593
  44091. Node: Inline Functions448270
  44092. Node: Tail Call Frames450897
  44093. Ref: set debug entry-values453034
  44094. Node: Macros457096
  44095. Ref: Macros-Footnote-1464672
  44096. Node: Tracepoints464825
  44097. Node: Set Tracepoints466887
  44098. Node: Create and Delete Tracepoints469825
  44099. Node: Enable and Disable Tracepoints476172
  44100. Node: Tracepoint Passcounts477412
  44101. Node: Tracepoint Conditions478823
  44102. Node: Trace State Variables480517
  44103. Node: Tracepoint Actions482712
  44104. Node: Listing Tracepoints489495
  44105. Node: Listing Static Tracepoint Markers491197
  44106. Node: Starting and Stopping Trace Experiments493045
  44107. Ref: disconnected tracing494790
  44108. Node: Tracepoint Restrictions499210
  44109. Node: Analyze Collected Data502979
  44110. Node: tfind504285
  44111. Node: tdump508767
  44112. Node: save tracepoints511282
  44113. Node: Tracepoint Variables511778
  44114. Node: Trace Files512906
  44115. Node: Overlays515282
  44116. Node: How Overlays Work516002
  44117. Ref: A code overlay518557
  44118. Node: Overlay Commands521970
  44119. Node: Automatic Overlay Debugging526152
  44120. Node: Overlay Sample Program528291
  44121. Node: Languages530028
  44122. Node: Setting531191
  44123. Node: Filenames532892
  44124. Node: Manually533703
  44125. Node: Automatically534912
  44126. Node: Show535973
  44127. Ref: show language536261
  44128. Node: Checks537295
  44129. Node: Type Checking538300
  44130. Node: Range Checking540129
  44131. Node: Supported Languages542530
  44132. Node: C543867
  44133. Node: C Operators544831
  44134. Node: C Constants549170
  44135. Node: C Plus Plus Expressions552049
  44136. Node: C Defaults555409
  44137. Node: C Checks556077
  44138. Node: Debugging C556637
  44139. Node: Debugging C Plus Plus557121
  44140. Node: Decimal Floating Point562008
  44141. Node: D563278
  44142. Node: Go563536
  44143. Node: Objective-C564630
  44144. Node: Method Names in Commands565093
  44145. Node: The Print Command with Objective-C566784
  44146. Node: OpenCL C567435
  44147. Node: OpenCL C Datatypes567710
  44148. Node: OpenCL C Expressions568085
  44149. Node: OpenCL C Operators568442
  44150. Node: Fortran568674
  44151. Node: Fortran Operators569395
  44152. Node: Fortran Defaults570251
  44153. Node: Special Fortran Commands570636
  44154. Node: Pascal571142
  44155. Node: Rust571653
  44156. Node: Modula-2574740
  44157. Node: M2 Operators575713
  44158. Node: Built-In Func/Proc578711
  44159. Node: M2 Constants581625
  44160. Node: M2 Types583226
  44161. Node: M2 Defaults586444
  44162. Node: Deviations587045
  44163. Node: M2 Checks588146
  44164. Node: M2 Scope588963
  44165. Node: GDB/M2589987
  44166. Node: Ada590900
  44167. Node: Ada Mode Intro592206
  44168. Node: Omissions from Ada593708
  44169. Node: Additions to Ada598063
  44170. Node: Overloading support for Ada601991
  44171. Node: Stopping Before Main Program603631
  44172. Node: Ada Exceptions604178
  44173. Node: Ada Tasks605377
  44174. Node: Ada Tasks and Core Files611816
  44175. Node: Ravenscar Profile612663
  44176. Node: Ada Settings613734
  44177. Node: Ada Glitches615156
  44178. Node: Unsupported Languages619164
  44179. Node: Symbols619854
  44180. Ref: quoting names620457
  44181. Node: Altering649128
  44182. Node: Assignment650166
  44183. Node: Jumping653272
  44184. Node: Signaling655346
  44185. Node: Returning658275
  44186. Node: Calling661626
  44187. Node: Patching666241
  44188. Node: Compiling and Injecting Code667355
  44189. Ref: set debug compile670812
  44190. Ref: set debug compile-cplus-types671062
  44191. Node: GDB Files681083
  44192. Node: Files681872
  44193. Ref: Shared Libraries695589
  44194. Ref: Files-Footnote-1707789
  44195. Node: File Caching707918
  44196. Node: Separate Debug Files709052
  44197. Ref: debug-file-directory712405
  44198. Node: MiniDebugInfo721019
  44199. Node: Index Files723470
  44200. Node: Symbol Errors727634
  44201. Node: Data Files731250
  44202. Node: Targets732206
  44203. Node: Active Targets733686
  44204. Node: Target Commands734760
  44205. Ref: load739149
  44206. Ref: flash-erase740342
  44207. Node: Byte Order740402
  44208. Node: Remote Debugging741841
  44209. Node: Connecting743103
  44210. Ref: --multi Option in Types of Remote Connnections745329
  44211. Ref: Attaching in Types of Remote Connections746744
  44212. Ref: Host and target files747245
  44213. Node: File Transfer755867
  44214. Node: Server756806
  44215. Ref: Running gdbserver758382
  44216. Ref: Attaching to a program760600
  44217. Ref: Other Command-Line Arguments for gdbserver763125
  44218. Ref: Monitor Commands for gdbserver766341
  44219. Ref: Server-Footnote-1771597
  44220. Node: Remote Configuration771717
  44221. Ref: set remotebreak772977
  44222. Ref: set remote hardware-watchpoint-limit774439
  44223. Ref: set remote hardware-breakpoint-limit774439
  44224. Ref: set remote hardware-watchpoint-length-limit774941
  44225. Ref: set remote exec-file775396
  44226. Node: Remote Stub787405
  44227. Node: Stub Contents790300
  44228. Node: Bootstrapping792407
  44229. Node: Debug Session796222
  44230. Node: Configurations798263
  44231. Node: Native799032
  44232. Node: BSD libkvm Interface799601
  44233. Node: Process Information800653
  44234. Node: DJGPP Native806201
  44235. Node: Cygwin Native812755
  44236. Node: Non-debug DLL Symbols817676
  44237. Node: Hurd Native821915
  44238. Node: Darwin827171
  44239. Node: FreeBSD828448
  44240. Node: Embedded OS829168
  44241. Node: Embedded Processors829579
  44242. Node: ARC830569
  44243. Node: ARM831116
  44244. Node: M68K833663
  44245. Node: MicroBlaze833836
  44246. Node: MIPS Embedded835285
  44247. Node: OpenRISC 1000836582
  44248. Node: PowerPC Embedded837488
  44249. Node: AVR840717
  44250. Node: CRIS841089
  44251. Node: Super-H842065
  44252. Node: Architectures843124
  44253. Node: AArch64843582
  44254. Node: i386844676
  44255. Ref: i386-Footnote-1848886
  44256. Node: Alpha848972
  44257. Node: MIPS849105
  44258. Node: HPPA852999
  44259. Node: SPU853517
  44260. Node: PowerPC855703
  44261. Node: Nios II856438
  44262. Node: Sparc64856843
  44263. Node: S12Z859211
  44264. Node: Controlling GDB859506
  44265. Node: Prompt860449
  44266. Node: Editing862167
  44267. Node: Command History863110
  44268. Node: Screen Size867416
  44269. Node: Output Styling869432
  44270. Node: Numbers872031
  44271. Node: ABI874013
  44272. Node: Auto-loading877186
  44273. Ref: set auto-load off878561
  44274. Ref: show auto-load879197
  44275. Ref: info auto-load879976
  44276. Node: Init File in the Current Directory883033
  44277. Ref: set auto-load local-gdbinit883608
  44278. Ref: show auto-load local-gdbinit883790
  44279. Ref: info auto-load local-gdbinit883954
  44280. Node: libthread_db.so.1 file884102
  44281. Ref: set auto-load libthread-db885041
  44282. Ref: show auto-load libthread-db885172
  44283. Ref: info auto-load libthread-db885309
  44284. Node: Auto-loading safe path885493
  44285. Ref: set auto-load safe-path886799
  44286. Ref: show auto-load safe-path887538
  44287. Ref: add-auto-load-safe-path887661
  44288. Node: Auto-loading verbose mode890563
  44289. Ref: set debug auto-load891726
  44290. Ref: show debug auto-load891827
  44291. Node: Messages/Warnings891949
  44292. Ref: confirmation requests893383
  44293. Node: Debugging Output894587
  44294. Node: Other Misc Settings904407
  44295. Node: Extending GDB905431
  44296. Node: Sequences907284
  44297. Node: Define907945
  44298. Node: Hooks912025
  44299. Node: Command Files914391
  44300. Node: Output919464
  44301. Ref: eval924266
  44302. Node: Auto-loading sequences924428
  44303. Ref: set auto-load gdb-scripts924923
  44304. Ref: show auto-load gdb-scripts925047
  44305. Ref: info auto-load gdb-scripts925177
  44306. Node: Python925408
  44307. Node: Python Commands926694
  44308. Node: Python API928882
  44309. Node: Basic Python931487
  44310. Ref: prompt_hook942524
  44311. Node: Exception Handling943122
  44312. Node: Values From Inferior946024
  44313. Node: Types In Python959594
  44314. Node: Pretty Printing API969454
  44315. Node: Selecting Pretty-Printers973347
  44316. Node: Writing a Pretty-Printer975680
  44317. Node: Type Printing API981002
  44318. Node: Frame Filter API983618
  44319. Node: Frame Decorator API990930
  44320. Ref: frame_args994671
  44321. Node: Writing a Frame Filter998001
  44322. Node: Unwinding Frames in Python1009475
  44323. Node: Xmethods In Python1017113
  44324. Node: Xmethod API1020009
  44325. Node: Writing an Xmethod1023821
  44326. Node: Inferiors In Python1029656
  44327. Node: Events In Python1033274
  44328. Node: Threads In Python1042482
  44329. Node: Recordings In Python1045369
  44330. Node: Commands In Python1052703
  44331. Node: Parameters In Python1062116
  44332. Node: Functions In Python1069054
  44333. Node: Progspaces In Python1071271
  44334. Node: Objfiles In Python1076176
  44335. Node: Frames In Python1082115
  44336. Node: Blocks In Python1089121
  44337. Node: Symbols In Python1093630
  44338. Node: Symbol Tables In Python1100866
  44339. Node: Line Tables In Python1104087
  44340. Node: Breakpoints In Python1106924
  44341. Ref: python_breakpoint_thread1113247
  44342. Node: Finish Breakpoints in Python1116280
  44343. Node: Lazy Strings In Python1118386
  44344. Node: Architectures In Python1120614
  44345. Node: Python Auto-loading1122803
  44346. Ref: set auto-load python-scripts1123432
  44347. Ref: show auto-load python-scripts1123532
  44348. Ref: info auto-load python-scripts1123638
  44349. Node: Python modules1124772
  44350. Node: gdb.printing1125158
  44351. Node: gdb.types1126585
  44352. Node: gdb.prompt1129597
  44353. Node: Guile1131246
  44354. Node: Guile Introduction1131905
  44355. Node: Guile Commands1132776
  44356. Node: Guile API1134630
  44357. Node: Basic Guile1136627
  44358. Node: Guile Configuration1142309
  44359. Node: GDB Scheme Data Types1143285
  44360. Node: Guile Exception Handling1145117
  44361. Node: Values From Inferior In Guile1149151
  44362. Node: Arithmetic In Guile1164686
  44363. Node: Types In Guile1166317
  44364. Ref: Fields of a type in Guile1174258
  44365. Node: Guile Pretty Printing API1175646
  44366. Node: Selecting Guile Pretty-Printers1181248
  44367. Node: Writing a Guile Pretty-Printer1183624
  44368. Node: Commands In Guile1188809
  44369. Node: Parameters In Guile1199589
  44370. Ref: Parameters In Guile-Footnote-11206470
  44371. Node: Progspaces In Guile1206586
  44372. Node: Objfiles In Guile1209174
  44373. Node: Frames In Guile1211455
  44374. Node: Blocks In Guile1218033
  44375. Node: Symbols In Guile1222841
  44376. Node: Symbol Tables In Guile1230176
  44377. Node: Breakpoints In Guile1233139
  44378. Node: Lazy Strings In Guile1243400
  44379. Node: Architectures In Guile1245691
  44380. Node: Disassembly In Guile1249998
  44381. Node: I/O Ports in Guile1253200
  44382. Node: Memory Ports in Guile1253756
  44383. Node: Iterators In Guile1257022
  44384. Node: Guile Auto-loading1261311
  44385. Ref: set auto-load guile-scripts1261934
  44386. Ref: show auto-load guile-scripts1262032
  44387. Ref: info auto-load guile-scripts1262136
  44388. Node: Guile Modules1263095
  44389. Node: Guile Printing Module1263417
  44390. Node: Guile Types Module1264236
  44391. Node: Auto-loading extensions1265529
  44392. Node: objfile-gdbdotext file1266727
  44393. Ref: set auto-load scripts-directory1268163
  44394. Ref: with-auto-load-dir1268539
  44395. Ref: show auto-load scripts-directory1269357
  44396. Ref: add-auto-load-scripts-directory1269437
  44397. Node: dotdebug_gdb_scripts section1269913
  44398. Node: Which flavor to choose?1273663
  44399. Node: Multiple Extension Languages1275484
  44400. Node: Aliases1276548
  44401. Node: Interpreters1279413
  44402. Node: TUI1282506
  44403. Node: TUI Overview1283504
  44404. Node: TUI Keys1285937
  44405. Node: TUI Single Key Mode1288241
  44406. Node: TUI Commands1289248
  44407. Node: TUI Configuration1293015
  44408. Node: Emacs1294504
  44409. Node: GDB/MI1299941
  44410. Node: GDB/MI General Design1301915
  44411. Node: Context management1304435
  44412. Node: Asynchronous and non-stop modes1308222
  44413. Node: Thread groups1311196
  44414. Node: GDB/MI Command Syntax1313474
  44415. Node: GDB/MI Input Syntax1313717
  44416. Node: GDB/MI Output Syntax1315267
  44417. Node: GDB/MI Compatibility with CLI1318852
  44418. Node: GDB/MI Development and Front Ends1319589
  44419. Node: GDB/MI Output Records1322254
  44420. Node: GDB/MI Result Records1322660
  44421. Node: GDB/MI Stream Records1324010
  44422. Node: GDB/MI Async Records1325275
  44423. Node: GDB/MI Breakpoint Information1335712
  44424. Node: GDB/MI Frame Information1339663
  44425. Node: GDB/MI Thread Information1340749
  44426. Node: GDB/MI Ada Exception Information1342219
  44427. Node: GDB/MI Simple Examples1342769
  44428. Node: GDB/MI Command Description Format1345005
  44429. Node: GDB/MI Breakpoint Commands1345885
  44430. Ref: -break-insert1352993
  44431. Node: GDB/MI Catchpoint Commands1366567
  44432. Node: Shared Library GDB/MI Catchpoint Commands1366935
  44433. Node: Ada Exception GDB/MI Catchpoint Commands1368593
  44434. Node: GDB/MI Program Context1372094
  44435. Node: GDB/MI Thread Commands1376362
  44436. Node: GDB/MI Ada Tasking Commands1379663
  44437. Node: GDB/MI Program Execution1381935
  44438. Node: GDB/MI Stack Manipulation1394202
  44439. Ref: -stack-list-arguments1396126
  44440. Ref: -stack-list-frames1399956
  44441. Ref: -stack-list-locals1404285
  44442. Ref: -stack-list-variables1405775
  44443. Node: GDB/MI Variable Objects1407309
  44444. Ref: -var-set-format1417274
  44445. Ref: -var-list-children1418655
  44446. Ref: -var-update1427463
  44447. Ref: -var-set-frozen1430461
  44448. Ref: -var-set-update-range1431258
  44449. Ref: -var-set-visualizer1431787
  44450. Node: GDB/MI Data Manipulation1433277
  44451. Node: GDB/MI Tracepoint Commands1453766
  44452. Node: GDB/MI Symbol Query1465557
  44453. Node: GDB/MI File Commands1466246
  44454. Node: GDB/MI Target Manipulation1470680
  44455. Node: GDB/MI File Transfer Commands1477338
  44456. Node: GDB/MI Ada Exceptions Commands1478661
  44457. Node: GDB/MI Support Commands1480014
  44458. Node: GDB/MI Miscellaneous Commands1484733
  44459. Ref: -interpreter-exec1495086
  44460. Node: Annotations1497445
  44461. Node: Annotations Overview1498364
  44462. Node: Server Prefix1500827
  44463. Node: Prompting1501561
  44464. Node: Errors1503078
  44465. Node: Invalidation1503974
  44466. Node: Annotations for Running1504453
  44467. Node: Source Annotations1505987
  44468. Node: JIT Interface1506916
  44469. Node: Declarations1508715
  44470. Node: Registering Code1510102
  44471. Node: Unregistering Code1511074
  44472. Node: Custom Debug Info1511701
  44473. Node: Using JIT Debug Info Readers1512997
  44474. Node: Writing JIT Debug Info Readers1514009
  44475. Node: In-Process Agent1516204
  44476. Ref: Control Agent1518147
  44477. Node: In-Process Agent Protocol1519014
  44478. Node: IPA Protocol Objects1519805
  44479. Ref: agent expression object1520803
  44480. Ref: tracepoint action object1521008
  44481. Ref: tracepoint object1521088
  44482. Node: IPA Protocol Commands1523664
  44483. Node: GDB Bugs1525134
  44484. Node: Bug Criteria1525866
  44485. Node: Bug Reporting1526743
  44486. Node: Command Line Editing1534572
  44487. Node: Introduction and Notation1535224
  44488. Node: Readline Interaction1536845
  44489. Node: Readline Bare Essentials1538034
  44490. Node: Readline Movement Commands1539815
  44491. Node: Readline Killing Commands1540773
  44492. Node: Readline Arguments1542689
  44493. Node: Searching1543731
  44494. Node: Readline Init File1545881
  44495. Node: Readline Init File Syntax1547032
  44496. Node: Conditional Init Constructs1562131
  44497. Node: Sample Init File1564654
  44498. Node: Bindable Readline Commands1567768
  44499. Node: Commands For Moving1568820
  44500. Node: Commands For History1569678
  44501. Node: Commands For Text1573073
  44502. Node: Commands For Killing1575796
  44503. Node: Numeric Arguments1577936
  44504. Node: Commands For Completion1579072
  44505. Node: Keyboard Macros1581038
  44506. Node: Miscellaneous Commands1581606
  44507. Node: Readline vi Mode1585454
  44508. Node: Using History Interactively1586364
  44509. Node: History Interaction1586879
  44510. Node: Event Designators1588301
  44511. Node: Word Designators1589438
  44512. Node: Modifiers1591073
  44513. Node: In Memoriam1592294
  44514. Node: Formatting Documentation1593177
  44515. Ref: Formatting Documentation-Footnote-11596549
  44516. Node: Installing GDB1596643
  44517. Node: Requirements1597215
  44518. Ref: Expat1597916
  44519. Ref: MPFR1601209
  44520. Node: Running Configure1602830
  44521. Node: Separate Objdir1605690
  44522. Node: Config Names1608658
  44523. Node: Configure Options1610133
  44524. Node: System-wide configuration1619022
  44525. Node: System-wide Configuration Scripts1620982
  44526. Node: Maintenance Commands1622166
  44527. Ref: maint info breakpoints1623821
  44528. Ref: maint check libthread-db1632286
  44529. Node: Remote Protocol1646328
  44530. Node: Overview1647020
  44531. Ref: Binary Data1649565
  44532. Node: Packets1652090
  44533. Ref: thread-id syntax1652990
  44534. Ref: extended mode1654435
  44535. Ref: ? packet1654693
  44536. Ref: bc1656159
  44537. Ref: bs1656369
  44538. Ref: read registers packet1657986
  44539. Ref: cycle step packet1659841
  44540. Ref: write register packet1662552
  44541. Ref: step with signal packet1663531
  44542. Ref: vCont packet1665007
  44543. Ref: vCtrlC packet1668240
  44544. Ref: vKill packet1670658
  44545. Ref: X packet1672191
  44546. Ref: insert breakpoint or watchpoint packet1672560
  44547. Node: Stop Reply Packets1676886
  44548. Ref: swbreak stop reason1680137
  44549. Ref: thread create event1683734
  44550. Ref: thread exit event1684937
  44551. Node: General Query Packets1687146
  44552. Ref: qCRC packet1689976
  44553. Ref: QEnvironmentHexEncoded1693129
  44554. Ref: QEnvironmentUnset1694359
  44555. Ref: QEnvironmentReset1695303
  44556. Ref: QSetWorkingDir packet1696247
  44557. Ref: QNonStop1702698
  44558. Ref: QCatchSyscalls1703374
  44559. Ref: QPassSignals1704911
  44560. Ref: QProgramSignals1706118
  44561. Ref: QThreadEvents1707685
  44562. Ref: qSearch memory1709703
  44563. Ref: QStartNoAckMode1710211
  44564. Ref: qSupported1710742
  44565. Ref: multiprocess extensions1726749
  44566. Ref: install tracepoint in tracing1728779
  44567. Ref: qXfer read1733302
  44568. Ref: qXfer auxiliary vector read1734909
  44569. Ref: qXfer btrace read1735257
  44570. Ref: qXfer btrace-conf read1736322
  44571. Ref: qXfer executable filename read1736673
  44572. Ref: qXfer target description read1737288
  44573. Ref: qXfer library list read1737722
  44574. Ref: qXfer svr4 library list read1738378
  44575. Ref: qXfer memory map read1740231
  44576. Ref: qXfer sdata read1740618
  44577. Ref: qXfer siginfo read1741084
  44578. Ref: qXfer spu read1741481
  44579. Ref: qXfer threads read1742005
  44580. Ref: qXfer traceframe info read1742408
  44581. Ref: qXfer unwind info block1742826
  44582. Ref: qXfer fdpic loadmap read1743060
  44583. Ref: qXfer osdata read1743476
  44584. Ref: qXfer write1743630
  44585. Ref: qXfer siginfo write1744722
  44586. Ref: qXfer spu write1745119
  44587. Ref: General Query Packets-Footnote-11747975
  44588. Node: Architecture-Specific Protocol Details1748302
  44589. Node: ARM-Specific Protocol Details1748811
  44590. Node: ARM Breakpoint Kinds1749059
  44591. Node: MIPS-Specific Protocol Details1749390
  44592. Node: MIPS Register packet Format1749673
  44593. Node: MIPS Breakpoint Kinds1750600
  44594. Node: Tracepoint Packets1751018
  44595. Ref: QTEnable1760332
  44596. Ref: QTDisable1760528
  44597. Ref: qTfSTM1766065
  44598. Ref: qTsSTM1766065
  44599. Ref: qTSTMat1767142
  44600. Ref: QTBuffer-size1768293
  44601. Node: Host I/O Packets1770266
  44602. Node: Interrupts1775846
  44603. Ref: interrupting remote targets1775990
  44604. Node: Notification Packets1778158
  44605. Node: Remote Non-Stop1783577
  44606. Node: Packet Acknowledgment1786693
  44607. Node: Examples1788808
  44608. Node: File-I/O Remote Protocol Extension1789402
  44609. Node: File-I/O Overview1789864
  44610. Node: Protocol Basics1792063
  44611. Node: The F Request Packet1794292
  44612. Node: The F Reply Packet1795193
  44613. Node: The Ctrl-C Message1796111
  44614. Node: Console I/O1797737
  44615. Node: List of Supported Calls1798953
  44616. Node: open1799315
  44617. Node: close1801823
  44618. Node: read1802206
  44619. Node: write1802815
  44620. Node: lseek1803586
  44621. Node: rename1804470
  44622. Node: unlink1805877
  44623. Node: stat/fstat1806824
  44624. Node: gettimeofday1807717
  44625. Node: isatty1808153
  44626. Node: system1808749
  44627. Node: Protocol-specific Representation of Datatypes1810291
  44628. Node: Integral Datatypes1810668
  44629. Node: Pointer Values1811475
  44630. Node: Memory Transfer1812179
  44631. Node: struct stat1812799
  44632. Node: struct timeval1815001
  44633. Node: Constants1815518
  44634. Node: Open Flags1815967
  44635. Node: mode_t Values1816308
  44636. Node: Errno Values1816800
  44637. Node: Lseek Flags1817610
  44638. Node: Limits1817795
  44639. Node: File-I/O Examples1818155
  44640. Node: Library List Format1819243
  44641. Node: Library List Format for SVR4 Targets1822025
  44642. Node: Memory Map Format1824492
  44643. Node: Thread List Format1827016
  44644. Node: Traceframe Info Format1828020
  44645. Node: Branch Trace Format1829706
  44646. Node: Branch Trace Configuration Format1831406
  44647. Node: Agent Expressions1832580
  44648. Node: General Bytecode Design1835401
  44649. Node: Bytecode Descriptions1840195
  44650. Node: Using Agent Expressions1853662
  44651. Node: Varying Target Capabilities1855639
  44652. Node: Rationale1856800
  44653. Node: Target Descriptions1864189
  44654. Node: Retrieving Descriptions1866132
  44655. Node: Target Description Format1867217
  44656. Node: Predefined Target Types1877092
  44657. Node: Enum Target Types1878537
  44658. Node: Standard Target Features1879532
  44659. Node: AArch64 Features1881516
  44660. Node: ARC Features1882091
  44661. Node: ARM Features1884152
  44662. Node: i386 Features1885666
  44663. Node: MicroBlaze Features1887881
  44664. Node: MIPS Features1888458
  44665. Node: M68K Features1889649
  44666. Node: NDS32 Features1890310
  44667. Node: Nios II Features1891334
  44668. Node: OpenRISC 1000 Features1891739
  44669. Node: PowerPC Features1892105
  44670. Node: RISC-V Features1896075
  44671. Node: S/390 and System z Features1897781
  44672. Node: Sparc Features1899925
  44673. Node: TIC6x Features1900830
  44674. Node: Operating System Information1901379
  44675. Node: Process list1902214
  44676. Node: Trace File Format1903277
  44677. Node: Index Section Format1906491
  44678. Node: Man Pages1914417
  44679. Node: gdb man1914887
  44680. Node: gdbserver man1920923
  44681. Node: gcore man1928119
  44682. Node: gdbinit man1929241
  44683. Node: gdb-add-index man1930150
  44684. Ref: gdb-add-index1930259
  44685. Node: Copying1931133
  44686. Node: GNU Free Documentation License1968694
  44687. Node: Concept Index1993841
  44688. Node: Command and Variable Index2132872
  44689. 
  44690. End Tag Table