SlideShare a Scribd company logo
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
 
Roslyn: el futuro de C#
Roslyn: el futuro de C#Roslyn: el futuro de C#
Roslyn: el futuro de C#
Rodolfo Finochietti
 
C programming
C programmingC programming
Builtin Functions and variables naming rules
Builtin Functions and variables naming rulesBuiltin Functions and variables naming rules
Builtin Functions and variables naming rules
Nigah 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 Module
Axway Appcelerator
 
Illicium: Compiling Pharo to C
Illicium: Compiling Pharo to CIllicium: Compiling Pharo to C
Illicium: Compiling Pharo to C
ESUG
 
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
Empatika
 
Do while loop
Do while loopDo while loop
Do while loop
BU
 
Measuring SGX Texturing Performance
Measuring SGX Texturing PerformanceMeasuring SGX Texturing Performance
Measuring SGX Texturing Performance
Prabindh Sundareson
 
Program for axisymmetric problem matlab
Program for axisymmetric problem  matlabProgram for axisymmetric problem  matlab
Program for axisymmetric problem matlab
Indian Institute of Technology, Bombay
 
Scheme 核心概念(一)
Scheme 核心概念(一)Scheme 核心概念(一)
Scheme 核心概念(一)
維然 柯維然
 
Dynamic Swift
Dynamic SwiftDynamic Swift
Dynamic Swift
Saul Mora
 
Ruby performance
Ruby performanceRuby performance
Ruby performance
Sarah Allen
 
Program for axisymmetric problem kant
Program for axisymmetric problem kantProgram for axisymmetric problem kant
Program for axisymmetric problem kant
Indian Institute of Technology, Bombay
 
(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
 
Oop lab report
Oop lab reportOop lab report
Oop lab report
khasmanjalali
 
12
1212
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 tetris
Yodalee
 
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
Linaro
 
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
Linaro
 
Coding with Vim
Coding with VimCoding with Vim
Coding with Vim
Enzo Wang
 
Debugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerDebugging Applications with GNU Debugger
Debugging Applications with GNU Debugger
Priyank 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
 
Short Introduction To "perl -d"
Short Introduction To "perl -d"Short Introduction To "perl -d"
Short Introduction To "perl -d"
Workhorse Computing
 
05-Debug.pdf
05-Debug.pdf05-Debug.pdf
05-Debug.pdf
KalaiselviDevaraj
 
Writing mruby Debugger
Writing mruby DebuggerWriting mruby Debugger
Writing mruby Debugger
yamanekko
 
More than `po`: Debugging in lldb
More than `po`: Debugging in lldbMore than `po`: Debugging in lldb
More than `po`: Debugging in lldb
Michele Titolo
 
Cryptography 202
Cryptography 202Cryptography 202
Cryptography 202
UTD Computer Security Group
 
Learn JavaScript From Scratch
Learn JavaScript From ScratchLearn JavaScript From Scratch
Learn JavaScript From Scratch
Mohd Manzoor Ahmed
 
DALL-E.pdf
DALL-E.pdfDALL-E.pdf
DALL-E.pdf
dsfajkh
 
Designate Install and Operate Workshop
Designate Install and Operate WorkshopDesignate Install and Operate Workshop
Designate Install and Operate Workshop
Graham Hayes
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5
PRADEEP
 
Floripa on Rails - dev workflow
Floripa on Rails - dev workflowFloripa on Rails - dev workflow
Floripa on Rails - dev workflow
Jônatas Paganini
 
C++ theory
C++ theoryC++ theory
C++ theory
Shyam Khant
 
Auto Tuning
Auto TuningAuto Tuning
SOLID Ruby SOLID Rails
SOLID Ruby SOLID RailsSOLID Ruby SOLID Rails
SOLID Ruby SOLID Rails
Michael Mahlberg
 
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
Zhen 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 2
Tales Andrade
 
Delegateless Coordinator
Delegateless CoordinatorDelegateless Coordinator
Delegateless Coordinator
Tales Andrade
 
Swift na linha de comando
Swift na linha de comandoSwift na linha de comando
Swift na linha de comando
Tales Andrade
 
Debugging tips and tricks
Debugging tips and tricksDebugging tips and tricks
Debugging tips and tricks
Tales Andrade
 
Usando POP com Programação Funcional
Usando POP com Programação FuncionalUsando POP com Programação Funcional
Usando POP com Programação Funcional
Tales 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 track
Tales Andrade
 
Tales@tdc
Tales@tdcTales@tdc
Tales@tdc
Tales 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

Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
Aditya Rajan Patra
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
enizeyimana36
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
rpskprasana
 

Recently uploaded (20)

Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
 

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