SlideShare a Scribd company logo
1 of 23
Download to read offline
Brian Kernighan
Debugging tips and tricks
Everyone knows that debugging is twice as hard
as writing a program in the first place. So if you're
as clever as you can be when you write it, how
will you ever debug it?
Brian Kerninghan
Basic notions
○Breakpoint
○Watchpoint
○Continue to Here (gutter)
○Debug bar
○Show debug area (cmd + shift + y)
○variable view
○watch
○console
○Frame
Basic notions
○ Debug bar
○ (de)activate breakpoints
○ Continue execution
○ Step over
○ Execute current line and go to the next
○ Step in
○ “enter” the called method/function
○ Step out
○ “exit” the called method/function
Basic notions
○ Debug bar
○ Debug view hierarchy
○ Simulate location
○ Choose stack frame
Basic notions
○ watchpoint
○ Behaviors like a breakpoint
○ Stop at value change
○ Variable or memory address
○ Command line
○ Click
○ view memory
○ breakpoint navigator
○ edit
○ condition
○ action
lldb - low level debugger
○ Have you done that?: 

print("log just for debug: (self.object)")
○ Or that?

let n = 0 // self.someMethodThatReturnInteger()
○ Or that?

if true !|| self.someMethodThatReturnBool() {
○ Or that?

func someMethodThatReturnBool() !-> Bool {

return true !//TODO: implement

}
lldb - breakpoints
○ Breakpoint stop execution of a instruction
○ Allow add command just for debug
○ May have stop condition
○ Via command

breakpoint set —file ViewController.swift —line 7
○ One shot - code execute just once, automatically removed

breakpoint set —oneshot true —name MyType.myMethod()
○ Via Xcode - just click gutter
lldb - stop conditions
lldb - condições de parada
○ - NSManagedObject.setValue(Any?, forKey: String)
lldb - low level debugger
○ Exception Breakpoint
○ Symbolic Breakpoint

UIKit symbols in Objective-C
○ Method signature
○ Symbols
lldb - exception breakpoint - stopping on crash
- Exception Breakpoint
lldb - commands and expressions
○ Expression (expression)
○ Print - p / expression — : - lldb internal formatters
○ parray
○ Print Object - po / expression -O — - use implementation of debugDescription
○ poarray
○ Frame variable (only Xcode 10.2) - v

Print variables of current stack frame. Can be way faster
○ Watchpoint (watchpoint)
Moving breakpoint position
Skipping line and returning value
Expressions
○ Evaluated as code
○ Result is shown and storage in convenience variable ($1, $2, etc)
○ Can do a lot
○ Arithmetic
○ function/method calling
○ type casting
○ Attributions
○ Variable declaration (let variable: Type = value)
lldb - mais expressões
(lldb) e let user.name = “John Doe”
(lldb) e let $count = 42
(lldb) po $count
42
(lldb) e let $dict: Dictionary<String, Int> = ["answer": 42]
(lldb) po $dict
▿ 1 element
▿ 0 : 2 elements
- key : "answer"
- value : 42
lldb - low level debugger
○ Watchpoint
○ Monitor state/value of a variable
○ Variable inspector
lldb - low level debugger
○ Watchpoint
○ Monitor state/value of a variable
○ Since Xcode 10 shown in breakpoint navigator
lldb - low level debugger
○ Rule of Thumb - keep it fast
○ “Automatically continue after evaluating”
○ po $arg1
○ Audible breakpoints
○ breakpoint with shell command
○ Command: say
○ Arguments: -v, Zarvox, “Your breakpoint %B has been hit %H times”
Referências
○ http://www.slideshare.net/talesp/debugging-fast-track
○ https://github.com/facebook/chisel
○ https://www.objc.io/issues/19-debugging/lldb-debugging/#let-s-
dance
○ http://lldb.llvm.org/tutorial.html
○ https://www.bignerdranch.com/blog/xcode-breakpoint-wizardry/
○ https://developer.apple.com/videos/play/wwdc2018/412/
N Ó S M O V E M O S O M U N D O .
RIO SÃO PAULO BH RECIFE
Centro
Av. Presidente Wilson, 231 
29º andar
(21) 2240-2030
Cidade Monções
Av. Nações Unidas, 11.541 
3º andar

(11) 4119-0449
Savassi
Av. Getúlio Vargas, 671 
Sala 800 - 8º andar
(31) 3360-8900
Ilha do Leite
Rua Sen. José Henrique, 199
2º andar
(81) 3018-6299
W W W. C O N C R E T E . C O M . B R

More Related Content

What's hot

Community-driven Language Design at TC39 on the JavaScript Pipeline Operator ...
Community-driven Language Design at TC39 on the JavaScript Pipeline Operator ...Community-driven Language Design at TC39 on the JavaScript Pipeline Operator ...
Community-driven Language Design at TC39 on the JavaScript Pipeline Operator ...Igalia
 
Concatenation of two strings using class in c++
Concatenation of two strings using class in c++Concatenation of two strings using class in c++
Concatenation of two strings using class in c++Swarup Boro
 
Builtin Functions and variables naming rules
Builtin Functions and variables naming rulesBuiltin Functions and variables naming rules
Builtin Functions and variables naming rulesNigah Mathour
 
Richard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL ModuleRichard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL ModuleAxway Appcelerator
 
Illicium: Compiling Pharo to C
Illicium: Compiling Pharo to CIllicium: Compiling Pharo to C
Illicium: Compiling Pharo to CESUG
 
Android Development Course in HSE lecture #2
Android Development Course in HSE lecture #2Android Development Course in HSE lecture #2
Android Development Course in HSE lecture #2Empatika
 
Do while loop
Do while loopDo while loop
Do while loopBU
 
Measuring SGX Texturing Performance
Measuring SGX Texturing PerformanceMeasuring SGX Texturing Performance
Measuring SGX Texturing PerformancePrabindh Sundareson
 
Dynamic Swift
Dynamic SwiftDynamic Swift
Dynamic SwiftSaul Mora
 
Ruby performance
Ruby performanceRuby performance
Ruby performanceSarah Allen
 
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...Phil Calçado
 
Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Phil Calçado
 
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"LogeekNightUkraine
 

What's hot (20)

Community-driven Language Design at TC39 on the JavaScript Pipeline Operator ...
Community-driven Language Design at TC39 on the JavaScript Pipeline Operator ...Community-driven Language Design at TC39 on the JavaScript Pipeline Operator ...
Community-driven Language Design at TC39 on the JavaScript Pipeline Operator ...
 
Concatenation of two strings using class in c++
Concatenation of two strings using class in c++Concatenation of two strings using class in c++
Concatenation of two strings using class in c++
 
Roslyn: el futuro de C#
Roslyn: el futuro de C#Roslyn: el futuro de C#
Roslyn: el futuro de C#
 
C programming
C programmingC programming
C programming
 
Builtin Functions and variables naming rules
Builtin Functions and variables naming rulesBuiltin Functions and variables naming rules
Builtin Functions and variables naming rules
 
Richard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL ModuleRichard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL Module
 
Illicium: Compiling Pharo to C
Illicium: Compiling Pharo to CIllicium: Compiling Pharo to C
Illicium: Compiling Pharo to C
 
Android Development Course in HSE lecture #2
Android Development Course in HSE lecture #2Android Development Course in HSE lecture #2
Android Development Course in HSE lecture #2
 
Do while loop
Do while loopDo while loop
Do while loop
 
Measuring SGX Texturing Performance
Measuring SGX Texturing PerformanceMeasuring SGX Texturing Performance
Measuring SGX Texturing Performance
 
Program for axisymmetric problem matlab
Program for axisymmetric problem  matlabProgram for axisymmetric problem  matlab
Program for axisymmetric problem matlab
 
Scheme 核心概念(一)
Scheme 核心概念(一)Scheme 核心概念(一)
Scheme 核心概念(一)
 
Dynamic Swift
Dynamic SwiftDynamic Swift
Dynamic Swift
 
Ruby performance
Ruby performanceRuby performance
Ruby performance
 
Program for axisymmetric problem kant
Program for axisymmetric problem kantProgram for axisymmetric problem kant
Program for axisymmetric problem kant
 
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
 
Oop lab report
Oop lab reportOop lab report
Oop lab report
 
12
1212
12
 
Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)
 
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"
Andriy Slobodyanyk "How to Use Hibernate: Key Problems and Solutions"
 

Similar to Debugging tips and tricks - coders on beers Santiago

Introduction to nand2 tetris
Introduction to nand2 tetrisIntroduction to nand2 tetris
Introduction to nand2 tetrisYodalee
 
HKG15-211: Advanced Toolchain Usage Part 4
HKG15-211: Advanced Toolchain Usage Part 4HKG15-211: Advanced Toolchain Usage Part 4
HKG15-211: Advanced Toolchain Usage Part 4Linaro
 
HKG15-207: Advanced Toolchain Usage Part 3
HKG15-207: Advanced Toolchain Usage Part 3HKG15-207: Advanced Toolchain Usage Part 3
HKG15-207: Advanced Toolchain Usage Part 3Linaro
 
Coding with Vim
Coding with VimCoding with Vim
Coding with VimEnzo Wang
 
Debugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerDebugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerPriyank Kapadia
 
BUD17-310: Introducing LLDB for linux on Arm and AArch64
BUD17-310: Introducing LLDB for linux on Arm and AArch64 BUD17-310: Introducing LLDB for linux on Arm and AArch64
BUD17-310: Introducing LLDB for linux on Arm and AArch64 Linaro
 
Writing mruby Debugger
Writing mruby DebuggerWriting mruby Debugger
Writing mruby Debuggeryamanekko
 
More than `po`: Debugging in lldb
More than `po`: Debugging in lldbMore than `po`: Debugging in lldb
More than `po`: Debugging in lldbMichele Titolo
 
DALL-E.pdf
DALL-E.pdfDALL-E.pdf
DALL-E.pdfdsfajkh
 
Designate Install and Operate Workshop
Designate Install and Operate WorkshopDesignate Install and Operate Workshop
Designate Install and Operate WorkshopGraham Hayes
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5PRADEEP
 
Floripa on Rails - dev workflow
Floripa on Rails - dev workflowFloripa on Rails - dev workflow
Floripa on Rails - dev workflowJônatas Paganini
 
from Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Worksfrom Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu WorksZhen Wei
 

Similar to Debugging tips and tricks - coders on beers Santiago (20)

Introduction to nand2 tetris
Introduction to nand2 tetrisIntroduction to nand2 tetris
Introduction to nand2 tetris
 
HKG15-211: Advanced Toolchain Usage Part 4
HKG15-211: Advanced Toolchain Usage Part 4HKG15-211: Advanced Toolchain Usage Part 4
HKG15-211: Advanced Toolchain Usage Part 4
 
HKG15-207: Advanced Toolchain Usage Part 3
HKG15-207: Advanced Toolchain Usage Part 3HKG15-207: Advanced Toolchain Usage Part 3
HKG15-207: Advanced Toolchain Usage Part 3
 
Coding with Vim
Coding with VimCoding with Vim
Coding with Vim
 
Debugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerDebugging Applications with GNU Debugger
Debugging Applications with GNU Debugger
 
BUD17-310: Introducing LLDB for linux on Arm and AArch64
BUD17-310: Introducing LLDB for linux on Arm and AArch64 BUD17-310: Introducing LLDB for linux on Arm and AArch64
BUD17-310: Introducing LLDB for linux on Arm and AArch64
 
Short Introduction To "perl -d"
Short Introduction To "perl -d"Short Introduction To "perl -d"
Short Introduction To "perl -d"
 
05-Debug.pdf
05-Debug.pdf05-Debug.pdf
05-Debug.pdf
 
Writing mruby Debugger
Writing mruby DebuggerWriting mruby Debugger
Writing mruby Debugger
 
More than `po`: Debugging in lldb
More than `po`: Debugging in lldbMore than `po`: Debugging in lldb
More than `po`: Debugging in lldb
 
Cryptography 202
Cryptography 202Cryptography 202
Cryptography 202
 
Learn JavaScript From Scratch
Learn JavaScript From ScratchLearn JavaScript From Scratch
Learn JavaScript From Scratch
 
DALL-E.pdf
DALL-E.pdfDALL-E.pdf
DALL-E.pdf
 
Designate Install and Operate Workshop
Designate Install and Operate WorkshopDesignate Install and Operate Workshop
Designate Install and Operate Workshop
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5
 
Floripa on Rails - dev workflow
Floripa on Rails - dev workflowFloripa on Rails - dev workflow
Floripa on Rails - dev workflow
 
C++ theory
C++ theoryC++ theory
C++ theory
 
Auto Tuning
Auto TuningAuto Tuning
Auto Tuning
 
SOLID Ruby SOLID Rails
SOLID Ruby SOLID RailsSOLID Ruby SOLID Rails
SOLID Ruby SOLID Rails
 
from Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Worksfrom Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Works
 

More from Tales Andrade

Delegateless Coordinators - take 2
Delegateless Coordinators - take 2Delegateless Coordinators - take 2
Delegateless Coordinators - take 2Tales Andrade
 
Delegateless Coordinator
Delegateless CoordinatorDelegateless Coordinator
Delegateless CoordinatorTales Andrade
 
Swift na linha de comando
Swift na linha de comandoSwift na linha de comando
Swift na linha de comandoTales Andrade
 
Debugging tips and tricks
Debugging tips and tricksDebugging tips and tricks
Debugging tips and tricksTales Andrade
 
Usando POP com Programação Funcional
Usando POP com Programação FuncionalUsando POP com Programação Funcional
Usando POP com Programação FuncionalTales Andrade
 
Swift!.opcionais.oh!.my()?!?
Swift!.opcionais.oh!.my()?!?Swift!.opcionais.oh!.my()?!?
Swift!.opcionais.oh!.my()?!?Tales Andrade
 
Debugging fast track
Debugging fast trackDebugging fast track
Debugging fast trackTales Andrade
 

More from Tales Andrade (8)

Delegateless Coordinators - take 2
Delegateless Coordinators - take 2Delegateless Coordinators - take 2
Delegateless Coordinators - take 2
 
Delegateless Coordinator
Delegateless CoordinatorDelegateless Coordinator
Delegateless Coordinator
 
Swift na linha de comando
Swift na linha de comandoSwift na linha de comando
Swift na linha de comando
 
Debugging tips and tricks
Debugging tips and tricksDebugging tips and tricks
Debugging tips and tricks
 
Usando POP com Programação Funcional
Usando POP com Programação FuncionalUsando POP com Programação Funcional
Usando POP com Programação Funcional
 
Swift!.opcionais.oh!.my()?!?
Swift!.opcionais.oh!.my()?!?Swift!.opcionais.oh!.my()?!?
Swift!.opcionais.oh!.my()?!?
 
Debugging fast track
Debugging fast trackDebugging fast track
Debugging fast track
 
Tales@tdc
Tales@tdcTales@tdc
Tales@tdc
 

Recently uploaded

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 

Debugging tips and tricks - coders on beers Santiago

  • 3. Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it? Brian Kerninghan
  • 4. Basic notions ○Breakpoint ○Watchpoint ○Continue to Here (gutter) ○Debug bar ○Show debug area (cmd + shift + y) ○variable view ○watch ○console ○Frame
  • 5. Basic notions ○ Debug bar ○ (de)activate breakpoints ○ Continue execution ○ Step over ○ Execute current line and go to the next ○ Step in ○ “enter” the called method/function ○ Step out ○ “exit” the called method/function
  • 6. Basic notions ○ Debug bar ○ Debug view hierarchy ○ Simulate location ○ Choose stack frame
  • 7. Basic notions ○ watchpoint ○ Behaviors like a breakpoint ○ Stop at value change ○ Variable or memory address ○ Command line ○ Click ○ view memory ○ breakpoint navigator ○ edit ○ condition ○ action
  • 8. lldb - low level debugger ○ Have you done that?: 
 print("log just for debug: (self.object)") ○ Or that?
 let n = 0 // self.someMethodThatReturnInteger() ○ Or that?
 if true !|| self.someMethodThatReturnBool() { ○ Or that?
 func someMethodThatReturnBool() !-> Bool {
 return true !//TODO: implement
 }
  • 9. lldb - breakpoints ○ Breakpoint stop execution of a instruction ○ Allow add command just for debug ○ May have stop condition ○ Via command
 breakpoint set —file ViewController.swift —line 7 ○ One shot - code execute just once, automatically removed
 breakpoint set —oneshot true —name MyType.myMethod() ○ Via Xcode - just click gutter
  • 10. lldb - stop conditions
  • 11. lldb - condições de parada ○ - NSManagedObject.setValue(Any?, forKey: String)
  • 12. lldb - low level debugger ○ Exception Breakpoint ○ Symbolic Breakpoint
 UIKit symbols in Objective-C ○ Method signature ○ Symbols
  • 13. lldb - exception breakpoint - stopping on crash - Exception Breakpoint
  • 14. lldb - commands and expressions ○ Expression (expression) ○ Print - p / expression — : - lldb internal formatters ○ parray ○ Print Object - po / expression -O — - use implementation of debugDescription ○ poarray ○ Frame variable (only Xcode 10.2) - v
 Print variables of current stack frame. Can be way faster ○ Watchpoint (watchpoint)
  • 16. Skipping line and returning value
  • 17. Expressions ○ Evaluated as code ○ Result is shown and storage in convenience variable ($1, $2, etc) ○ Can do a lot ○ Arithmetic ○ function/method calling ○ type casting ○ Attributions ○ Variable declaration (let variable: Type = value)
  • 18. lldb - mais expressões (lldb) e let user.name = “John Doe” (lldb) e let $count = 42 (lldb) po $count 42 (lldb) e let $dict: Dictionary<String, Int> = ["answer": 42] (lldb) po $dict ▿ 1 element ▿ 0 : 2 elements - key : "answer" - value : 42
  • 19. lldb - low level debugger ○ Watchpoint ○ Monitor state/value of a variable ○ Variable inspector
  • 20. lldb - low level debugger ○ Watchpoint ○ Monitor state/value of a variable ○ Since Xcode 10 shown in breakpoint navigator
  • 21. lldb - low level debugger ○ Rule of Thumb - keep it fast ○ “Automatically continue after evaluating” ○ po $arg1 ○ Audible breakpoints ○ breakpoint with shell command ○ Command: say ○ Arguments: -v, Zarvox, “Your breakpoint %B has been hit %H times”
  • 22. Referências ○ http://www.slideshare.net/talesp/debugging-fast-track ○ https://github.com/facebook/chisel ○ https://www.objc.io/issues/19-debugging/lldb-debugging/#let-s- dance ○ http://lldb.llvm.org/tutorial.html ○ https://www.bignerdranch.com/blog/xcode-breakpoint-wizardry/ ○ https://developer.apple.com/videos/play/wwdc2018/412/
  • 23. N Ó S M O V E M O S O M U N D O . RIO SÃO PAULO BH RECIFE Centro Av. Presidente Wilson, 231  29º andar (21) 2240-2030 Cidade Monções Av. Nações Unidas, 11.541  3º andar
 (11) 4119-0449 Savassi Av. Getúlio Vargas, 671  Sala 800 - 8º andar (31) 3360-8900 Ilha do Leite Rua Sen. José Henrique, 199 2º andar (81) 3018-6299 W W W. C O N C R E T E . C O M . B R