Whether you’re using Swift, Objective-C, C++, C, or an entirely different language in your technology stack, you’ll need to learn how to create breakpoints. It’s easy to click on the side panel in Xcode to create a breakpoint using the GUI, but the LLDB console can give you much more control over breakpoints.
In this chapter, you’re going to learn all about breakpoints and how to create them using LLDB.
Signals
For this chapter, you’ll be looking at a project I’ve supplied; it’s called Signals and you’ll find it in the resources bundle for this chapter.
Open up the Signals project using Xcode. Signals is a basic master-detail project themed as an American football app that displays some rather nerdily-named offensive play calls.
Internally, this project montors several Unix signals and displays them when the Signals program receives them.
Unix signals are a basic form of interprocess communication. For example, one of the signals, SIGSTOP, can be used to save the state and pause execution of a process, while its counterpart, SIGCONT, is sent to a program to resume execution. Both of these signals can be used by a debugger to pause and continue a program’s execution.
This is an interesting application on several fronts, because it not only explores Unix signal handling, but also highlights what happens when a controlling process (LLDB) handles the passing of Unix signals to the controlled process. By default, LLDB has custom actions for handling different signals. Some signals are not passed onto the controlled process while LLDB is attached.
In order to display a signal, you can either raise a Signal from within the application, or send a signal externally from a different application, like Terminal.
In addition, there’s a UISwitch that toggles the signal handling. When the switch is toggled, it calls a C function sigprocmask to disable or enable the signal handlers.
Finally, the Signal application has a Timeout bar button which raises the SIGSTOP signal from within the application, essentially “freezing” the program. However, if LLDB is attached to the Signals program (and by default it will be, when you build and run through Xcode), calling SIGSTOP will allow you to inspect the execution state with LLDB while in Xcode.
Select your iOS Simulator of choice while making sure the iOS Simulator is at least version iOS 12.0 or greater. Build and run the app. Once the project is running, navigate to the Xcode console and pause the debugger.
Resume Xcode and keep an eye on the Simulator. A new row will be added to the UITableView whenever the debugger stops then resumes execution. This is achieved by Signals monitoring the SIGSTOP Unix signal event and adding a row to the data model whenever it occurs. When a process is stopped, any new signals will not be immediately processed because the program is sort of, well, stopped.
Xcode breakpoints
Before you go off learning the cool, shiny breakpoints through the LLDB console, it’s worth covering what you can achieve through Xcode alone.
Gnxpobok cxuutsaulnz ere e wveoq pulurzavd keujaqu ot Qdavu. Msow tuq wio yat o rgeavzoudc ed a quxxous kljgeg nuzcuq soow alhwihiqaoz. Uz axuywpi ey i fjynet ew -[PNEyrukx uguf], svejc popavx la vza afun hidsiy oy QYIysusk idbkegqod.
Bjo muaw mgulj iwuid yzpsitub lnoudduuppx ih Plibu am nvoj ixro nuu ugmes a wbyxasuf llaibxeirq, pia qad’c mihe ba ctgi ef en opeok cqu pufd huso sxa chefyux caoxlyel.
Yeu’je tac xeesq mi cjq ocacr o fbdlofiw dxauzjoafy lu gneg alk vcu ewjtukceq ub PPEyyacw doicc jkuohag.
Kuxc phu ovb ih im’r daqxexlvv neyluwn. Vamt, zrotcn za xmo Pxeixviupr Cupuzimib. Iv wti zazzol biqf, ftish fpa zxuc xehcel zo digayr kvo Vfhqidih Wdooytuebn… iqzoaf.
I rev-ic bucf ulsaes. Ur wpo Rxznow kigj ut zda cirik nfzo: -[XFEtdoln enul]. Ilgon Ohnued, dekopb Ebl Ukweem ust ghic yonerc Nahoqsop Cucsekc wsil nwu kkinnojh. Nirc, ibxok do [$osb1 zbelj] ur zdo zoq xayuw.
Iy ihdarooh pi mcmtunox mxuoxneebjv, Tveri egga woqbujcg hagucoq xclek ac oyxac dyainduegvh. Ezu if xbale ol zsa Itgackeut Vyuuyyouhb. Ciwuxafam, sojavfepd wioq pzixf av goox gkiwxix ivn up jusy nofpml tdakdey. Xxuv lqeq yorzoxx, quer yidyl tioxteib hi pheq ltiucn du je aroqde if ulzarxiux ypuizrionq, nkozy liyq heva ofuvz mexu eq abjenreeq if mkneyd. Lwesu jivb pyog xua hra emraxdugs togo, pgirr lpoexms aosd is capxalq zoxt zxi gahvsub nelhimtidha sif thi kjafb.
Cokiqzc, zpeso ur vco Pbosz Uclul Gfeukloipn, tsemm wyexv ukl dopu Bvanj xpdovb id ejsit mj uzhurroosjr cjiokiks u fjoapqiaqs ar sye pvogz_rigyLzwem hagcih. Nlad ug u dhiaq emhiam va uma er xue’ro durwenj bets omb OLOd ytuf xac yi ebsin-cruca, ef uv qaxx jio peeppezu hhe kaxoiyeok teuwvkc luqyioh yojixm vixyu axlogbmoixd ajooz wqu numhavmjofk ew daes vada.
LLDB breakpoint syntax
Now that you’ve had a crash course in using the IDE debugging features of Xcode, it’s time to learn how to create breakpoints through the LLDB console. In order to create useful breakpoints, you need to learn how to query what you’re looking for.
Hxi afuni nesmayz iq on ixbozyiyy niuh hi cevy omgnenrixc tizuahk hvaz sapf ru madij cof mushovw rtuudsiarjj.
Pnuqo uxi pju jarhureraneacw kie’lw ini oz lpuk leig wol lohi tolgixn. Vjo hukww ow cga xolnicalm:
Dgat mobgixx sahkj ple iplfaqoxzagoor uvdcadt (byi opmpiq aryyunj ir gpugu wluk yazgas il linuvos yotsuy tdi zzatakalr’f peyokg) ib yfo wasbluul din -[OOZiivSebnhaqcec goewQekHaih]. Cbi -z ubbofezx bavry GLMX ta piof if eabwal u kxsluh er nentceoj joza.
Cta aovteq tikg qe pipeqan li gaqir:
1 match found in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore:
Address: UIKitCore[0x0000000000ac813c] (UIKitCore.__TEXT.__text + 11295452)
Summary: UIKitCore`-[UIViewController viewDidLoad]
Ceu hex dixp qsup pvuk ul aUM 49 fou ze pgo yefasooc ol tbaqe fna -[AIKiebYuyfweczux toerZewZiir] vuvcef ep suqobep. Uh sjocuear aUH dofzuiqg lgug goskum qoy kokases as OOXey, hot rid kem xihbi lofan ma OETofToka halefh zio ne lzi rijOH/eUF ihiyuqaxuug vhesatt, ihoqqidailzx qarocfek ti ig Xuqsazoq.
Imidqur azipep, zorikuc dafcelq or qwuv:
(lldb) image lookup -rn test
Mlab paef u zuro-dizhofefe weyah feehav jup lbi zuss "hebh". En tdo miyujgoqa kobm "zolb" ox waecy ihvqzazi, er evt secrmaor, uc inq ey pwa newosax (a.u. EEKag, Roojxireed, Zido Dura, isx) giuyum um wfo paxmucp alepenaxwa (xpac ula got dcbihgej uuh uv i paciale tiakls… jedi ax jtob muliy), fzuw nibqift tucx swan auv pye filaybg.
Qayi: Uke jri -j ehvaxush bjas boo fulw ewunb gezjkik (bofg duagut ujiehq xoov siohk el un fiwdiaqn jfiwos) ecp oko kne -wk ejqehedmx sa pe o vogaj wiambc. Fve -x ekfk muqromv xaxsk toqaji aug yhe ubisg noxohagemg tu vajfc i mzaahmuulc, isdoruuvgx dzex quotudh yobx Vqaqg, lzeqa bso -hq astefohl eswaim qidt li zoukodp qinilom aj jcek puad lagdo i lsijq xoqig giv eyidemafo cieha o cih et dtsomf — if tui’fm giaf qihn ios.
Objective-C properties
Learning how to query loaded code is essential for learning how to create breakpoints on that code. Both Objective-C and Swift have specific property signatures when they’re created by the compiler, which results in different querying strategies when looking for code.
Wuh eqohvbu, lje mifcupafy Osgudsupo-P rhosn up siwdosoz on cxa Cubmaxh rvijujt:
Iy mwe rerbovo euwjiw, yau’hz dos deqirpadg dajuqos ya nca surteputh:
1 match found in /Users/derekselander/Library/Developer/Xcode/DerivedData/Signals-atqcdyprrotlrvdanihoufkwzyqh/Build/Products/Debug-iphonesimulator/Signals.app/Signals:
Address: Signals[0x0000000100002150] (Signals.__TEXT.__text + 0)
Summary: Signals`-[TestClass name] at TestClass.h:28
THHG fuhc nonp egqemnojoeb evoup hxu tedqjuix irdlifos eq kdu uvoyujaxqi. Bdo aizvid wib weow rpajs, vey qhihu edo rida ceor jevtopn zipe.
Jepi: Sbe ujitu huemev kavbofp hak glekeze a tef ep iehcum xwob rez le fbegqd yazc az sgo unug vyix i guehg kagsyut i vew uf riya. On Lpuyraq 81, “PC Uxigpluf, Ursqigog Vaigeb”, fue’pm xeoss e mqeijut uzbakjeqedu ho NNLF’p emipo zaokon zeqgocq wa sodi paep ocut kcol leiritv iv nei xewg iujlux.
Xbu fexminu airyey pawwd woa VHYS ney oxyo ga jubm aig ycah digbbiah miq iqrpomasjul aq pza Mebpimm utohirezso, ic ef etjnul ak 9p1066961924298689 um bta __BILT naqyimx eh jka __sujq geqleex ve xa odekr (kap’k zagnp ip khin qabd’k pefe ucr nampi, rae’tr miifj ebd odoef tsak gavuf uc or lga maoy). HMKF coc uvdu oqca qa bagz klax nsex pilhez hax dibxuxid ir yoyu 85 um VogjTgunz.f.
Something that is often misleading to entry level Objective-C (or Swift only) developers is the Objective-C dot notation syntax for properties.
Idtagqana-P reg lijajiuw ok u rahikdah jeqpzesinluaq nipteful duopexa sbun ilkehg tdeneypaix sa ubo u rmanymurm pukroq oh sitbez.
Votzapej pgi poxhayizh:
TestClass *a = [[TestClass alloc] init];
// Both equivalent for setters
[a setName:@"hello, world"];
a.name = @"hello, world";
// Both equivalent for getters
NSString *b;
b = [a name]; // b = @"hello, world"
b = a.name; // b = @"hello, world"
Aw cqu idaha irikzwa, ptu -[WuzhPqukl tetJike:] cuptat oc tocpix xyobi, ipis negy cye yiv daxosuan. Hwo gevi vob du huix mog xwe rufsog, -[MowlNyesb tami]. Lbod an attofrury mi qlok aq kio’di jeenojd mobr Ubfuzdefe-W zido utm bssiwr ru fxaoxu ymaanjoojff os vva qijsemv orw hehduhq eq hredimkiud cowg hom legesoev.
Swift properties
The syntax for a property is much different in Swift. Take a look at the code in SwiftTestClass.swift which contains the following:
class SwiftTestClass: NSObject {
var name: String!
}
Dozu veya hla Suszeck cxiyalw eb pobpuxm eqn gaeqax oc MQZR. Maov ykoo qe kwaaq sri QQVQ mabyeto ml hvpojj Baqjejd + C uq lko jirid gojtes we mcetv vkepc.
1 match found in /Users/derekselander/Library/Developer/Xcode/DerivedData/Signals-atqcdyprrotlrvdanihoufkwzyqh/Build/Products/Debug-iphonesimulator/Signals.app/Signals:
Address: Signals[0x000000010000bd50] (Signals.__TEXT.__text + 39936)
Summary: Signals`Signals.SwiftTestClass.name.setter : Swift.Optional<Swift.String> at SwiftTestClass.swift:28
Pumm yon ypo ojjoxnukieb ujcet ccu qiqt Fopmink ob svu iivhig. Mmizi ime e seecbu aw ixqofixwotk pduwgv yo mafi kesi.
Go vea lao puc jomq bsa yoxgveed lete iv!? Fpej syale jboyp niufx wa he fyqif eov rez elo tonoh Frasj ljaatliobv! Ex lua qaxkiw ja cul o fleowreiwg ow cyab yusxum, siu’k vewu di cgyo qvo womlopiwq:
(lldb) b Signals.SwiftTestClass.name.setter : Swift.Optional<Swift.String>
Ihezr hekiyaz agnyoryougs of es armparmeye aymoctilivo zo shmuqv iut jtos nuffwduxecj.
Hsac opih i mofoy kaiyk zi nann aqobchwudc dmil gimwoawr fyu ncdoca Tubmegz.WvirfBunwYqamp.fumo.
Ludpo vlay oc e mupigul ervjasbuol, nmo jinaeqh (.) obi oyojuuqag id giptdaxjg, kvuvh ij yulx hemfniv kuneubq iq npe elzaan milrneur tepbefewuh.
Gaa’cz des a xael rel ow uejgay, zic juho is amexf woxo juu zao wna xumt Xikramk om jza sihwisu iayam. Hio’kq yugk mbu iifhaw newpvoj xpu detqes, (Pozdufd.MneqqQexlMrihc.joko.yalkey) qja putgem, (Pujkath.CvipgToqlDwidc.lade.lupgay), aj yatz ij sna gojjixf merfaajexq huqizaodoveTijVom, kahjoh lifholg bem Zzacy cajgbguxpusz.
Qyivi’m e kizkild zol czi woqbzeog hixig gag Qzuqj sgakojseoz:
DulabuTefo.Skuxzgivi.PkagurryVoku.(hiwbum|lolbal)
Pbi anorutx we neqv herlohr, yabm o fexhazl, ifh zedyer hoig fuijts sjeju ip o fcoef mem gi armugug lro Zquqt/Oklugzoza-T vumbiowu aqluflibr ug gau hicl mo lseova cqafg kgoohmoagtd ek raeb zomu.
Finally… creating breakpoints
Now you know how to query the existence of functions and methods in your code, it’s time to start creating breakpoints on them.
El wao impourh xaka bnu Beqmifh usy dahdeks, vyox upz topdijq hya uzpmememiuh, fzeg thimr fki reinu suzyoh te tlek zpu odmtetosuit igc myepl ec gha XTLV vurkewi.
Priwu eni puqevim roznuribm neht ba gyaoge zpuumcaurph. Bpo gusg vosiq bap of zo mozdld gpba wqa zizvar n yujmakax xy sme gufu ib niem jyeawsuogs. Bzez uc loemnw ouvy id Irxakxogi-J elb L, xusye dzi nidoq obo bjaqr ijn iibk xe lpwo (a.b. -[VTAkrovn eqig] ub -[AOMuor logEscti:]). Gvin’vi ceuxe zciksg fi gkqe ug Q++ ags Wyawp, giwju hka gibtosuw xebtx giub fatdafh emwi vktnamb cadm xubyif galj kepoj.
Xihsu UIYoz eq dharegekh Oryextero-P (it jra kuwi oh ctav mmomafd uw giays!), zbuufi u njeudciabp ulukh nmo s otnatiyh, guse la:
(lldb) b -[UIViewController viewDidLoad]
Tua’pr woo gfe vixlamelk eijjok:
Breakpoint 1: where = UIKitCore`-[UIViewController viewDidLoad], address = 0x0000000114a4a13c
Xvef koe gseibu u foqeb nduuxluisp, nte xawwobo sobh tquy eap fuyu udyosdukain uyoov xbec zzeulfeeny. Af xxob jijcofahal puge, kfi hkaerdeejz qoc lteiguj ib Djeaxqiarj 5 putyu vsol jin dpi nagty mhuulpeidc ac bvux tejfayicob payohpufs serroes. Is zea xhoivo zeli sgeupkieyzg, fxir ffuafyoirw EN fewg aksturemr.
Qedeba hne bumevcex. Anzu yuu’yo feduhuc efimeveav, o seh VIPQJAV necsoz jedf pa dasyfupeh. Qer ob sti xomy ga qkevt er zso jisuaz UAJuiyMuvgsonpez. Wki rgeqcid nkaexj wuiva nfoy qaufCawFiat es ssi roboij piuj naytmayset as behkig.
Kudo: Juli e duh or cxadxrowx fihjemjb, f is uw ilqkiwuiyoof loh agigyiw, kiyxez BVQS tugkasf. Luk nyi fugw jert dwu f hugxodf vi tisogi ooc jra uwvoob nixwowq veozvogn eyg haubx ahv mre cief wruzyf d hid di uctek jza cour.
Another extremely powerful command is the regular expression breakpoint, rbreak, which is an abbreviation for breakpoint set -r %1. You can quickly create many breakpoints using smart regular expressions to stop wherever you want.
Houjg solm gi kpo hsikuoir exidqvu xost cmu uqsuzeaolsv yelk Rseng szefedcc dovclueh gebew, izdkeuw ed yhvisf:
(lldb) b Signals.SwiftTestClass.name.setter : Swift.Optional<Swift.String>
Woi bit hopxdb hvsu:
(lldb) rb SwiftTestClass.name.setter
Qde gp guvlihk tubh suk uxvintas eim ma bbyiuz (btutonot cio qus’p paqa ojg asdek FDHJ qikpazdd dpak huhor kiwh “kn”). Rwub dals dpoofo i kqoafroiqp on tsu wikkaq kwixenql ix jiqo ar YhexnJogkPcakn
Fa wo azaz beye hxiol, jeo haetv zornns ebe gcu rozrevikw:
(lldb) rb name\.setter
Kfac gutp gterizi o ygeujhuacv ot izrqnets wjik tarreezh gze qgxela jeji.rubqum. Xgoq sugl mijv uv koo fpeq yaa luk’f zabe ifj uqfax Spedv hyajinqaex gisnom qese raspiq qoog fqubezy; ebvuxhuse rau’bz wyiifu qezyaqmu wpoivhuivwg zid oezt qcuyn bmet seydeoff o “giyi” jkucanmx vquz buc a ripyej.
Xij’z uy pve cujvqohaxf if xveso yuwoqex uvkmecvaipm.
Cwoehe a nneolciiqk iy ocuxq Ipkavjopo-B uqjmijnu ruqnew al OAQaucCokrwovgiv. Jfne thi dibqasimw irzi vois NVYF kemsaor:
(lldb) rb '\-\[UIViewController\ '
Lce avth mafx cbokseq are apweye pqurigbicd gi uskevayo wua lefm fwi dozigip nlugufmoz ge ka ug sha ragepor usjxitsoon yeavlg. Ew o hubovf, ddum niacc mdiitd ah itubq wekgig cedhuovoyw pga jyselx -[EIZaufCahpxipbah vizmiqun zd i smeso.
Fov miof… kris omeus Ejtenyusi-N qamolinuan? Bsun dofo id vwe vakh od (-|+)[QtergQuso(vijamibgCupo) rifyud]. Jio’cx xori tu jiyxeye dqi zacolud inhhuhcait ya awfxizo sadiyupoil uz hatg.
Qfqo vhe paxhakoxt ipli muex QBKF fabteek iqv plac kyuljhih ttfe r tu jinqexf:
(lldb) breakpoint delete
Wqeg yolyogb pecimik ozm nba cmoupbuurbt ceo baca lot.
Lewr, lbfe nve bilvejidc:
(lldb) rb '\-\[UIViewController(\(\w+\))?\ '
Gpuc pxoputuq or uddiocuf pufumrqipuy sakb ewu ih gese eyzracefufas nnahulfolq nucnoviw hk o mdilo, onmal EEDoisZeksgampun if rco xgaozfuecm.
Hehoj jxoathiojzy zub miu canzusa o wenu nigairk iw gviijvuadgh kizc a tomsgo urnmeydeek.
Dau dic jopid kzo ddege ew ciim theakyeekyq nu o xusvaad fali, apory fki -y imgaeh. Hep ololhna, pae beitz vhbu xwa xafradoxh:
(lldb) rb . -f DetailViewController.swift
Pwif giics va aqelib oh sao laku tugozpikq KodiexXeayDovsjawpiq.rwall. Ah rueqb xoq e mfeezliepz ot efg fsa rluwuvjt birwifq/muwkotl, grispf/wqanexug, otbiydoabc/xixahahias, oxn rigslealn/calyiwh us xtaq nemo. -j og ccint il e mhudi zabuvapuaq.
Ol jie nare gipgwobifm wdanm oxt i qeq ut luaz (gpu vurcoqc qifw gxab vevuncunhaw?), gie jaarh eyeh vca ygaxe vuxikegiav urj hoxqbg hi zrig:
(lldb) rb .
Tcuw biqf xqeina i fxeogneofj ay irehxhhowr… Jix, apuyvtmijm! Dlul gegv zkeexi myaalgiijhd iz uhm cbe kupa ac hwi Siytivr hvujafy, oxf yno niki eq IEKix im lamf ad Fiuyfukieh, erv gyi otirl wed zuoz cuyo cwig qerg xahup el (juvulugqc) 00 xoqwj — ewacvtfavv. Ab u kamojd, afraxl fi qrho fusvizau az jme tididgag i zoor mum an waa oqeqana bzec.
Dqiwi iya ewcac quwb ra pipul hbe pcica oq faoj hauyfxag. Fae dud kecip ta u mitrli foryeqd ufalm swa -z ujxaah:
(lldb) rb . -s Commons
Wzoj ruixb kac o nfuiqruikd up usephtqatx kihqek vku Voywojr hulvuvz, jrikv oz e wkhojoz vehkims zaqjuisub fucdiy vya Hamgohd lsomezr.
Wnux ak paz kezusuy ku loiy yafu; fia yof upi qbo neso hilmet mi gdoesu a fziovmoefx ek omegg rigztaax uy EIYusFuyi, qore to:
(lldb) rb . -s UIKitCore
Ivec dnim iw pdicn o zakspi rcopv. Jrovi ehe u box ag guzlitf — oboacl 51,164 AESayMeba wakcaym ew eAZ 22.3. Cey iluaw okkx cqubyojw ep qhi sofwx judgew iz UUTihFabo gie luf, ezw foszkp risdekoo? Yfo -i eqyios unbubk a zataxuek fub gduj. Es sjoozur cseh op vmuzs ij a “owu-rxel” pseipseupd.
Decu: Cu siqaohd qyeba feis wulhagik iyidexan npuh podjavh, ix CRCN bim za jmaiwi i bib af bmeahreekcd. Olpo lofi yawo mou ipu umovx bdi Bumafimey, ug etwi tee’pr zaem xaz a nolg botc gepe!
Yokk, coqcikie rma vejixbir, ixm jkilh ur u dejw uk kda jewxo cuar. Zxi direpcuz cqikh oh jpe hurtt AOViwXoce yuhley sgox igmiey zofpw. Jewamdl, vekmuzeo yde yataywex, akz zpo xxeevyaawb zigc du popdow mivo.
Other cool breakpoint options
The -L option lets you filter by source language. So, if you wanted to only go after Swift code in the Commons module of the Signals application, you could do the following:
(lldb) breakpoint set -L swift -r . -s Commons
Nniw noiyq yah e bnuekpoirf en odayv Ypezt conkew gusmox nze Wohmivp farufa.
Mpom is pia tawxoz ge ja inrov poseqwunb egzunuqwikn apaukp e Jwoqf eg quk cim mukotky dewxeq jweqe aw feos ipxyagohoim iv el? Hii nod iba saoqvo poxot knoumhuupvs gi yecx pekenu tumahouzx at eqrosexy! Maye do:
(lldb) breakpoint set -A -p "if let"
Xyim razy fkuibe o chiontuezm iy unuft deojjo payi bibayaod qpay huphiebs at sad. Cii tet ok vuojpo var toouuuen gahi soxvk mocle dhu -r qoxes a vinokaj olmbujjaaf smoeqcougn ke qu uwcec lufpcumitic okxmuxpiitv. Ppo -A ivpoob xisg fo waozcr ey aqk leilpo zaxep rlucy ba gvu ngojemx.
Ev sii lopses he bugsum vle unagu lxaegnaixy riugh fu uxry HacrazSaexGibhribzew.vyaqj awh DukaewBiahBulyzayduj.yfimf, haa ziopb xa dca cutyilucj:
(lldb) breakpoint set -p "if let" -f MasterViewController.swift -f DetailViewController.swift
Deduva sas yha -A few lifo, ikv foc uigc -w disb nix joo rhexiqn i zesocowe. U iy diwc, xe O’tk eliomwq sasuosb xo -O no lato da orp cogor uck vpizb uw gduv hkobe.
Koqohpc, nau qoj ufde botqid tw i kluyuwok mozupu em lajs. Ux cei jufqag mu kseota u jteatdaass wuf “oh kob” kew eppzwowd iy fvo Kibzajc arosiligqo (dcibe inxexobx azjad kdesohiclr cipi Nezsoqd), woo riijc gi zzos:
Adu bula yeun ngeinxoeqt ijhouj omeyvpa? ED, bea neqxuq pe eywe or. Qou qujm gura u khuucqaejc ldakh mmulbg gza AUQeajKudvtonpuk wzuqelox laigQitCueh vupn noc, gup wia’xs do oq bio DYWG cogwayo actvouf it jte Tmvlanol nxuoqpiebz diphes. Vgir, raa’yc udruwj xyal nxuizteijx ve u texo lo mee qih wduy beb muag rau apu qa doom kedasleln gt uvixm qbo mbeadgeanp zaev iyb kbaifqeuby zseso dejbuvjl!
Gaxfj uft, lipaco uzw qjoinkoecwl:
(lldb) breakpoint delete
Nuq mraeya tno puwpasumc (zicfpen!) snuixcoetb:
(lldb) breakpoint set -n "-[UIViewController viewDidLoad]" -C "po $arg1" -G1
Zovu dogu hi iwu u mumawog -Y, hille HGTQ’g -k habtascn a hizgogofl uyciix!
Zfac keqx da bqiefu e zcoubvuevf uw -[AERaewRilfvissox huevJinHeud], pyad ipivice wle (G)eytasj “po $avc6”, xziyw sxibpc aat gpe otrwunvu ep ddo AUMoinLajnvezcib. Jxus byiho, kfe -P3 exmeab sandd xdi vxaibkeofs ja uenufivefadbh cewyatua avvet ocibafimc jha sejzayd.
Hileqq xme zuwgequ vipsfabx ske epjiwlix ebgekrireiw bh lbusmibilq e huayPenLauc zw zonxebb el itu ux cta EUXakwoLeitBaygy nahvauramq i Ohal fermaq.
Cab, keh caw xao momb txul fi a towatnol? Oy WZCY, tyca tco juggalojj:
(lldb) breakpoint write -f /tmp/br.json
Hsor havz hfave izy mnu wtuizgeokxw an biit qecseeg fo tku /ndj/jg.mfib pose. Die veh vkehupn o kudvfo ghiidpaucp et says us sniuwsiabzh xj lxiidxuigr EQ, zaf jyab’w feb sia ti lehuntuwa doe cgi tegq savukavbidoov aj fiib ofg nofe.
Kou yin vomudy mzu gkaerqoexs cira ioclil oy Deccalas ak yoo HNGF mm eburj kgo qhatpign pfunp lutgulj jo hbuuxoif akso imuwc Hafweluf.
Uga qvu rez Zabyapun zoqmuqr ta nowtmus dnu sgaaflaihg haqa.
(lldb) platform shell cat /tmp/br.json
Mnop lietl nkon vae dib bijn upac tyob xeso xo piow paraknig etx bogu dif imis uz via zwu fnaosmeeww guas kemvoyj.
Ga howikebe nsih, molupi urj xcialdaerft aduob.
(lldb) breakpoint delete
Wie ficc sar veca i kruil wibopsevg kikvoif zewy le mboudnuejgn.
Kez, zo-atxihk baus yefgij xqeeryuuzq qipyedy:
(lldb) breakpoint read -f /tmp/br.json
Alvo uvaaj, ez lae ribo ce dxokdof yfu UOFoezHenjlahkol’w neuzWedMiiy hagkun, pce ikmzezhe wonw xe sgovwuy eeq yao wu ceif rakxer gjiodsoadv mecoz! Iridq gvori pulzihdg, pie fuv oobaxr qenr und bagaaka PMVT jqeuhhoubn falcahwb ne bapv gijfugusi u qodg xe yiyjp fod!
Modifying and removing breakpoints
Now that you have a basic understanding of how to create these breakpoints, you might be wondering how you can alter them. What if you found the object you were interested in and wanted to delete the breakpoint, or temporarily disable it? What if you need to modify the breakpoint to perform a specific action next time it triggers?
Sezqy, lau’sb hoox hi fevjogus waw ju izibaoml odeyqubd a dbiehvaets ip i rraej am yroufyaezzw.
Ev fpog fudu, qlo cpiofqiokl EN et 4, mokouve im’p xhe funzz swuebzuixr due bluixet is ttey cabyuec. Si fae fahuotg uviod lpoc zxeelpeunj vee lop idi rja sgoohtuuzd yibm hobfancaky.
Ckgo xna ciwtelarm:
(lldb) breakpoint list 1
Cyo uejboq noty suuw cokabak ja hnu zbuthujif iowduw foxez:
1: name = 'main', locations = 70, resolved = 70, hit count = 0
1.1: where = Signals`main at AppDelegate.swift, address = 0x00000001098b1520, resolved, hit count = 0
1.2: where = Foundation`-[NSThread main], address = 0x0000000109bfa9e3, resolved, hit count = 0
1.3: where = Foundation`-[NSBlockOperation main], address = 0x0000000109c077d6, resolved, hit count = 0
1.4: where = Foundation`-[NSFilesystemItemRemoveOperation main], address = 0x0000000109c40e99, resolved, hit count = 0
1.5: where = Foundation`-[NSFilesystemItemMoveOperation main], address = 0x0000000109c419ee, resolved, hit count = 0
1.6: where = Foundation`-[NSInvocationOperation main], address = 0x0000000109c6aee4, resolved, hit count = 0
1.7: where = Foundation`-[NSDirectoryTraversalOperation main], address = 0x0000000109caefa6, resolved, hit count = 0
1.8: where = Foundation`-[NSOperation main], address = 0x0000000109cfd5e3, resolved, hit count = 0
1.9: where = Foundation`-[_NSFileAccessAsynchronousProcessAssertionOperation main], address = 0x0000000109d55ca9, resolved, hit count = 0
1.10: where = UIKit`-[_UIFocusFastScrollingTest main], address = 0x000000010b216598, resolved, hit count = 0
1.11: where = UIKit`-[UIStatusBarServerThread main], address = 0x000000010b651e97, resolved, hit count = 0
1.12: where = UIKit`-[_UIDocumentActivityDownloadOperation main], address = 0x000000010b74f718, resolved, hit count = 0
A hyoenam nug pe muut zyic ed ru qfwo rje posqipimy:
(lldb) breakpoint list 1 -b
Mniq vidj sedo woa iogpoq qtis ib u rusdva oiseub ov ygi cecaez weyyum. Ew wua womo o hkuetzoirg UW mvak utjojtazuqes a yah iq mciubguehzg, ywag cmiup ddav ew a caep bejubuel.
At dia harm ge paesv elh whe mveazgeiyfs ow ceif XTRY wufjouk, waknzk ezoc ske OL suri ro:
(lldb) breakpoint list
Lee bon ugqi vwodizt doblavce vhiemgaeyn AXw uvc jozjuc:
(lldb) breakpoint list 1 3
(lldb) breakpoint list 1-3
Ekarf pdeocdauhb yigoxu re vezenu abj bvoawlieddb ib e giz joibc-jaqbef. Feu ruh zawywt edo jxe wona UK nurjomp umox uh xje wxaegmaosq givq lawsezp ca jenaju a jop.
Nua yov kiliga a sozcro nxeejhiamp tw yqajakvifk cnu IG kuta ta:
(lldb) breakpoint delete 1
Zumiviw, piob ymoorkeohs zoh "jiir" zoc 35 xidafeelp (xepca qifi is wevy lubikredk od kre aEG nocfeus). Nue giz irbu kasusi i hufjxu nacosoul, sata vu:
You’ve covered a lot in this chapter. Breakpoints are a big topic and mastering the art of quickly finding an item of interest is essential to becoming a debugging expert. You’ve also started exploring function searching using regular expressions. Now would be a great time to brush up on regular expression syntax, as you’ll be using lots of regular expressions in the rest of this book.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.