SlideShare a Scribd company logo
Xcode - Debug
KKBOX WWDC 2017 Study
Oliver Huang iOS Engineer
Related Video Sessions
404 - Debugging with Xcode 9
https://developer.apple.com/videos/play/wwdc2017/404/
406 - Finding Bugs Using Xcode Runtime Tools
https://developer.apple.com/videos/play/wwdc2017/406/
407 - Understanding Undefined Behavior
https://developer.apple.com/videos/play/wwdc2017/407/
411 - What's New in LLVM
https://developer.apple.com/videos/play/wwdc2017/411/
Debugging with Xcode 9
• Development: Unplugged (Wireless Development)
• Breakpoint Workflow Enhancements
• Debug View Hierarchy Improvements
Wireless Development NEW
Wireless Development
• Minimum requirement
- iOS 11, tvOS 11, macOS 10.12.4+
• Tools support
- Xcode, Instruments, Accessibility Inspector, Console,
Configurator
- (tvOS only) Safari Web Inspector for TVMLKit, QuickTime Screen
Recording
Demo
Wireless Development
tvOS device pairing
Breakpoint Workflow Enhancements
• Code Completion in Text Field
• Options Indicator
• Deep Filtering
Breakpoints
Demo
Debug View Hierarchy Enhancements
• View Controller Debugging
• SpriteKit Debugging
• SceneKit Debugging
View Controller Debugging NEW
SpriteKit Debugging NEW
SpriteKit Debugging
SceneKit Debugging NEW
Finding Bugs Using Xcode Runtime Tools
Improvements in Runtime Checking
Improvements in Runtime Checking
Runtime Issues
Finding Bugs Using Xcode Runtime Tools
Improvements in Runtime Checking
• Main Thread Checker (New)
• Address Sanitizer
• Thread Sanitizer
• Undefined Behavior Sanitizer (New)
4
Main Thread Checker
Designing Asynchronous APIs
Let API user specify callback queue
DeepThought.asyncComputeAnswer(to: theQuestion) { reply in
…
}
Designing Asynchronous APIs
Let API user specify callback queue
DeepThought.asyncComputeAnswer(to: theQuestion, completionQueue: queue) { reply in
…
}
Address Sanitizer
• Detects use-after-scope
• Detects use-after-return (opt-in)
• Compatible with Malloc Scribble
Finding Memory Issues
Security critical bugs
• Use-after-free and buffer overflows
Diagnoses hard-to-reproduce crashes
Advanced Debugging and the Address Sanitizer WWDC 2015
Use of out of scope stack memory
// Use of Stack Memory Out of Scope
int *integer_pointer = NULL;
if (is_some_condition_true()) {
int value = calculate_value();
integer_pointer = &value;
}
*integer_pointer = 42;
// Use of Stack Memory after Return
int *returns_address_of_stack() {
int a = 42;
return &a;
}
int *integer_pointer = returns_address_of_stack();
*integer_pointer = 43;
Thread Sanitizer
• Race on collections
• Swift access races
What is Thread Sanitizer
Multithreading issues
Finds races even if they did not manifest
64-bit macOS, 64-bit simulators
Thread Sanitizer and Static Analysis WWDC 2016
// Thread 1
eventLog.log(source: networkingSubsystem, message: "Download finished")
// Thread 2
eventLog.log(source: databaseSubsystem, message: "Query complete")
Thread 2: Data race in EventLog.log(source:message:)
// Swift Data Race Example
class EventLog {
private var lastEventSource: LogSource?
func log(source: LogSource, message: String) {
print(message)
lastEventSource = source
}
}
// Use DispatchQueue to Synchronize Access
class EventLog {
private var lastEventSource: LogSource?
private var queue = DispatchQueue(label: "com.example.EventLog.queue")
func log(source: LogSource, message: String) {
queue.async {
print(message)
lastEventSource = source
}
}
}
// Swift Access Race with Mutating Methods
struct BluePoliceBoxLocation {
private var x, y, z: Int
private var time: Int
}
mutating func teleport(toPlanet: String) { … }
mutating func fly(toCity: String) { … }
mutating func travelToEndOfTime() { … }
Thread 2: Swift access race
Thread 1: Previous access
// Thread 1
location.teleport(toPlanet: "Mars")
// Thread 2
location.travelToEndOfTime()
changes x, y, z
changes time
Undefined Behavior Sanitizer
Alignment Violation
Nonnull Return Value Violation
Integer Overflow
C++ Dynamic Type Violation Invalid Float Cast
Invalid Shift Exponent
Invalid Boolean Invalid EnumInvalid Variable-Length Array Integer Division by Zero
Invalid Shift BaseInvalid Integer Cast
Out-of-Bounds Array Access
Invalid Object SizeMissing Return Value
Reached Unreachable Code
Nonnull Parameter ViolationNonnull Assignment Violation
Null Dereference
“undefined behavior:

behavior for which this International Standard
imposes no requirements.”

•
ISO C++14 Standard
Undefined Behavior Is About Tradeoffs
Performance over safety
(INT_MAX + 1) ≯ INT_MAX
Integer Overflow
Null pointer returned from function declared to never return null
// Nonnull Return Value Violation
@implementation SolarSystem
+ (nonnull NSDictionary *)planetMoons {
return @{@"Earth": @[@"Moon"],
@"Mars" : @[@"Phobos", @"Deimos"],
// …
};
}
- (nonnull NSArray *)moonsOfPlanet:(nonnull NSString *)planet {
return [[self class] planetMoons][planet];
}
@end
// Find the biggest moon for each planet
NSMutableArray *biggestMoons = [NSMutableArray new];
[biggestMoons addObject:[solarSystem moonsOfPlanet:@"Pluto"][0]];
Nonnull Return Value Violation
Compiler 2
Source code
.c, .m, .cpp, .mm
Object file
.o
Let’s Experiment: A Very Simple Optimization Pipeline
Compiler 1
Dead Code
Elimination
Redundant Null
Check Elimination
Redundant Null
Check Elimination
void contains_null_check(int *P) {
int unused = *P;
…Hidden text for MM
*P = 4;
} Keep the brace in MM
if (P == NULL)
return;
Dead Code
Elimination
void contains_null_check(int *P) {
int unused = *P;
…Hidden text for MM
if (P == NULL)
return;
*P = 4;
} Keep the closing brace MM
Compiler Optimization
Compiler 2
Source code
.c, .m, .cpp, .mm
Object file
.o
Let’s Experiment: A Very Simple Optimization Pipeline
Compiler 1
Dead Code
Elimination
Redundant Null
Check Elimination
Redundant Null
Check Elimination
void contains_null_check(int *P) {
int unused = *P;
…Hidden text for MM
*P = 4;
} Keep the brace in MM
Dead Code
Elimination
void contains_null_check(int *P) {
int unused = *P;
…Hidden text for MM
if (P == NULL)
return;
*P = 4;
} Keep the closing brace MM
Compiler Optimization 1
Compiler 2
Source code
.c, .m, .cpp, .mm
Object file
.o
Let’s Experiment: A Very Simple Optimization Pipeline
Compiler 1
Dead Code
Elimination
Redundant Null
Check Elimination
Dead Code
Elimination
int unused = *P;
void contains_null_check(int *P) {
…Hidden text for MM
*P = 4;
} Keep closing brace in MM
void contains_null_check(int *P) {
int unused = *P;
…Hidden text for MM
*P = 4;
} Keep the brace in MM
Compiler Optimization 1
Compiler 2
Source code
.c, .m, .cpp, .mm
Object file
.o
Let’s Experiment: A Very Simple Optimization Pipeline
Compiler 1
Dead Code
Elimination
Redundant Null
Check Elimination
Dead Code
Elimination
void contains_null_check(int *P) {
…Hidden text for MM
*P = 4;
} Keep closing brace in MM
void contains_null_check(int *P) {
int unused = *P;
…Hidden text for MM
*P = 4;
} Keep the brace in MM
Compiler Optimization 1
Compiler 2
Source code
.c, .m, .cpp, .mm
Object file
.o
Let’s Experiment: A Very Simple Optimization Pipeline
Compiler 2
Redundant Null
Check Elimination
Dead Code
Elimination
Dead Code
Elimination
void contains_null_check(int *P) {



…Hidden text for MM
if (P == NULL)
return;
*P = 4;
} Please keep the brace MM
void contains_null_check(int *P) {
int unused = *P;
…Hidden text for MM
if (P == NULL)
return;
*P = 4;
} Keep brace during MM
int unused = *P;
Compiler Optimization 2
Compiler 2
Source code
.c, .m, .cpp, .mm
Object file
.o
Let’s Experiment: A Very Simple Optimization Pipeline
Compiler 2
Redundant Null
Check Elimination
Dead Code
Elimination
Dead Code
Elimination
void contains_null_check(int *P) {



…Hidden text for MM
if (P == NULL)
return;
*P = 4;
} Please keep the brace MM
void contains_null_check(int *P) {
int unused = *P;
…Hidden text for MM
if (P == NULL)
return;
*P = 4;
} Keep brace during MM
Compiler Optimization 2
Source code
.c, .m, .cpp, .mm
Object file
.o
Compiler 2
Let’s Experiment: A Very Simple Optimization Pipeline
Compiler 2
Redundant Null
Check Elimination
Dead Code
Elimination
Redundant Null
Check Elimination
void contains_null_check(int *P) {
…Hidden text for MM
if (P == NULL)
return;
*P = 4;
} Please keep me MM!
void contains_null_check(int *P) {



…Hidden text for MM
if (P == NULL)
return;
*P = 4;
} Please keep the brace MM
Compiler Optimization 2
Let’s Experiment: A Very Simple Optimization Pipeline
A surprising result
void contains_null_check(int *P) {
int unused = *P;
…
if (P == NULL)
return;
*P = 4;
} Keep brace during MM
Compiler 1
void contains_null_check(int *P) {
…
*P = 4;
} Keep closing brace in MM
void contains_null_check(int *P) {
…
if (P == NULL)
return;
*P = 4;
}
void contains_null_check(int *P) {
int unused = *P;
…
if (P == NULL)
return;
*P = 4;
} Keep brace during MM
Compiler 2
Compiler Optimization
Using Runtime Tools Effectively
• Exercise more code
• Use the tools together
Runtime Tool Overhead
Execution overhead Memory overhead
Main Thread Checker 1.02x negligible
Undefined Behavior Sanitizer 1.2x negligible
Address Sanitizer 2–3x 2x
Thread Sanitizer 5–10x 4x
What's New in LLVM
• API Availability Checking for Objective-C
• Static Analyzer Checks
• New Warnings
• C++ Refactoring & Features from C++17
• Link-Time Optimization (LTO)
• API Availability Checking for Objective-C
• Static Analyzer Checks
• New Warnings
• C++ Refactoring & Features from C++17
• Link-Time Optimization (LTO)
API Availability Checking for Objective-C
[UIView instancesRespondToSelector:@selector(addInteraction:)]
[UIDragInteraction class]
[NSOrthography respondsToSelector:@selector(defaultOrthographyForLanguage:)]
&ARErrorDomain != NULL futimens != NULL
[UIView instancesRespondToSelector:@selector(addInteraction:)]
[UIDragInteraction class]
[NSOrthography respondsToSelector:@selector(defaultOrthographyForLanguage:)
&ARErrorDomain != NULL futimens != NULL
w instancesRespondToSelector:@selector(addInteraction:)]
[UIDragInteraction class]
y respondsToSelector:@selector(defaultOrthographyForLanguage:)]
main != NULL futimens != NULL
[UIView instancesRespondToSelector:@selector(addInteraction:)]
[UIDragInteraction class]
[NSOrthography respondsToSelector:@selector(defaultOrthographyForLanguage
&ARErrorDomain != NULL futimens != NULL
[UIView instancesRespondToSelector:@selector(addInteraction:)]
[UIDragInteraction class]
[NSOrthography respondsToSelector:@selector(defaultOrthographyForLanguage:)]
&ARErrorDomain != NULL futimens != NULL
API Availability Checking in Objective-C
if (@available(iOS 11,x*)) {
r = [VNDetectFaceRectanglesRequest new];
if ([handler performRequests:@[r] error:&error]) {
// Draw rectangles
}
} else {
// Fall back when API not available
}
Compiler warns about unguarded uses of new API
Use @available to query API availability at run time
API Availability Checking for Objective-C
Convenient to write entire methods with limited availability
@interface MyAlbumController : UIViewController
- (void)showFaces
@end
API_AVAILABILITY(ios(11.0));
Factor out Code with API_AVAILABILITY()
Convenient to write entire methods with limited availability
@interface MyAlbumController : UIViewController
- (void)showFaces
@end
API_AVAILABILITY(ios(11.0))
;
Can apply to entire classes
Factor out Code with API_AVAILABILITY()
API Availability Checking in C/C++
Use __builtin_available to check availability at runtime
if (__builtin_available(iOS 11, macOS 10.13, *)) {
CFNewAPIOniOS11();
}
API Availability Checking in C/C++
Use __builtin_available to check availability at runtime
Include <os/availability.h> for the API_AVAILABILITY macro
#include <os/availability.h>
void myFunctionForiOS11OrNewer(int i) API_AVAILABILITY(ios(11.0), macos(10.13));
Do Not Compare Number Objects to Scalars
Comparing NSNumber pointer value to 0 checks for nil – not zero number
@property NSNumber *photoCount;
- (BOOL)hasPhotos {
}
Comparing pointer value to a scalar integer valuereturn self.photoCount > 0;
Do Not Auto-Synthesize NSMutable copy Properties
Setter calls -copy, which yields an immutable copy
- (void)replaceWithStockPhoto:(NSImage *)stockPhoto {
self.photos = [NSMutableArray<NSImage *> new];
[self.photos addObject:stockPhoto];
}
-[__NSArray0 addObject:]: unrecognized selector sent to instance
@property (copy) NSMutableArray<NSImage *> *photos;
Static Analyzer Checks
Run Analyzer on Your Code!
Supports Objective-C, C, C++
Analyze during build
Q & A

More Related Content

What's hot

Configuration of Ansible - DevOps: Beginner's Guide To Automation With Ansible
Configuration of Ansible - DevOps: Beginner's Guide To Automation With AnsibleConfiguration of Ansible - DevOps: Beginner's Guide To Automation With Ansible
Configuration of Ansible - DevOps: Beginner's Guide To Automation With Ansible
TetraNoodle_Tech
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
Jason Grimes
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
Nike pop up habitat
Nike pop up   habitatNike pop up   habitat
Nike pop up habitat
Chef
 
Controlling multiple VMs with the power of Python
Controlling multiple VMs with the power of PythonControlling multiple VMs with the power of Python
Controlling multiple VMs with the power of Python
Yurii Vasylenko
 
Compliance as Code
Compliance as CodeCompliance as Code
Compliance as Code
Matt Ray
 
Learn REST API with Python
Learn REST API with PythonLearn REST API with Python
Learn REST API with Python
Larry Cai
 
Flask With Server-Sent Event
Flask With Server-Sent EventFlask With Server-Sent Event
Flask With Server-Sent Event
Tencent
 
Introduction to Elixir
Introduction to ElixirIntroduction to Elixir
Introduction to Elixir
Diacode
 
Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13
Rafael Dohms
 
Jaringan, Linux, Docker
Jaringan, Linux, DockerJaringan, Linux, Docker
Jaringan, Linux, Docker
SatrioBudi10
 
Compliance Automation with Inspec Part 4
Compliance Automation with Inspec Part 4Compliance Automation with Inspec Part 4
Compliance Automation with Inspec Part 4
Chef
 
Ansible-for-openstack
Ansible-for-openstackAnsible-for-openstack
Ansible-for-openstack
Udayendu Kar
 
Testing in Ballerina Language
Testing in Ballerina LanguageTesting in Ballerina Language
Testing in Ballerina Language
Lynn Langit
 
Fluentd v0.12 master guide
Fluentd v0.12 master guideFluentd v0.12 master guide
Fluentd v0.12 master guide
N Masahiro
 
Bootstrap |> Elixir - Easy fun for busy developers
Bootstrap |> Elixir - Easy fun for busy developersBootstrap |> Elixir - Easy fun for busy developers
Bootstrap |> Elixir - Easy fun for busy developers
David Schmitz
 
Eclipse Concierge - an OSGi R5 framework for IoT applications
Eclipse Concierge - an OSGi R5 framework for IoT applicationsEclipse Concierge - an OSGi R5 framework for IoT applications
Eclipse Concierge - an OSGi R5 framework for IoT applications
jochen.hiller
 
Java Day Kharkiv - Next-gen engineering with Docker and Kubernetes
Java Day Kharkiv - Next-gen engineering with Docker and KubernetesJava Day Kharkiv - Next-gen engineering with Docker and Kubernetes
Java Day Kharkiv - Next-gen engineering with Docker and Kubernetes
Antons Kranga
 
London Community Summit - Chef at SkyBet
London Community Summit - Chef at SkyBetLondon Community Summit - Chef at SkyBet
London Community Summit - Chef at SkyBet
Chef
 
FrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) SwiftFrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) Swift
Chris Bailey
 

What's hot (20)

Configuration of Ansible - DevOps: Beginner's Guide To Automation With Ansible
Configuration of Ansible - DevOps: Beginner's Guide To Automation With AnsibleConfiguration of Ansible - DevOps: Beginner's Guide To Automation With Ansible
Configuration of Ansible - DevOps: Beginner's Guide To Automation With Ansible
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Nike pop up habitat
Nike pop up   habitatNike pop up   habitat
Nike pop up habitat
 
Controlling multiple VMs with the power of Python
Controlling multiple VMs with the power of PythonControlling multiple VMs with the power of Python
Controlling multiple VMs with the power of Python
 
Compliance as Code
Compliance as CodeCompliance as Code
Compliance as Code
 
Learn REST API with Python
Learn REST API with PythonLearn REST API with Python
Learn REST API with Python
 
Flask With Server-Sent Event
Flask With Server-Sent EventFlask With Server-Sent Event
Flask With Server-Sent Event
 
Introduction to Elixir
Introduction to ElixirIntroduction to Elixir
Introduction to Elixir
 
Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13
 
Jaringan, Linux, Docker
Jaringan, Linux, DockerJaringan, Linux, Docker
Jaringan, Linux, Docker
 
Compliance Automation with Inspec Part 4
Compliance Automation with Inspec Part 4Compliance Automation with Inspec Part 4
Compliance Automation with Inspec Part 4
 
Ansible-for-openstack
Ansible-for-openstackAnsible-for-openstack
Ansible-for-openstack
 
Testing in Ballerina Language
Testing in Ballerina LanguageTesting in Ballerina Language
Testing in Ballerina Language
 
Fluentd v0.12 master guide
Fluentd v0.12 master guideFluentd v0.12 master guide
Fluentd v0.12 master guide
 
Bootstrap |> Elixir - Easy fun for busy developers
Bootstrap |> Elixir - Easy fun for busy developersBootstrap |> Elixir - Easy fun for busy developers
Bootstrap |> Elixir - Easy fun for busy developers
 
Eclipse Concierge - an OSGi R5 framework for IoT applications
Eclipse Concierge - an OSGi R5 framework for IoT applicationsEclipse Concierge - an OSGi R5 framework for IoT applications
Eclipse Concierge - an OSGi R5 framework for IoT applications
 
Java Day Kharkiv - Next-gen engineering with Docker and Kubernetes
Java Day Kharkiv - Next-gen engineering with Docker and KubernetesJava Day Kharkiv - Next-gen engineering with Docker and Kubernetes
Java Day Kharkiv - Next-gen engineering with Docker and Kubernetes
 
London Community Summit - Chef at SkyBet
London Community Summit - Chef at SkyBetLondon Community Summit - Chef at SkyBet
London Community Summit - Chef at SkyBet
 
FrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) SwiftFrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) Swift
 

Viewers also liked

KKBOX WWDC17 Notification and Autolayout - Jefferey
KKBOX WWDC17 Notification and Autolayout - JeffereyKKBOX WWDC17 Notification and Autolayout - Jefferey
KKBOX WWDC17 Notification and Autolayout - Jefferey
Liyao Chen
 
KKBOX WWDC17 UIKit - QQ
KKBOX WWDC17 UIKit - QQKKBOX WWDC17 UIKit - QQ
KKBOX WWDC17 UIKit - QQ
Liyao Chen
 
KKBOX WWDC17 UIKit Drag and Drop - Mario
KKBOX WWDC17  UIKit Drag and Drop - MarioKKBOX WWDC17  UIKit Drag and Drop - Mario
KKBOX WWDC17 UIKit Drag and Drop - Mario
Liyao Chen
 
KKBOX WWDC17 WatchOS - Dada
KKBOX WWDC17  WatchOS  - DadaKKBOX WWDC17  WatchOS  - Dada
KKBOX WWDC17 WatchOS - Dada
Liyao Chen
 
KKBOX WWDC17 Xcode IDE - Hardy
KKBOX WWDC17  Xcode IDE - HardyKKBOX WWDC17  Xcode IDE - Hardy
KKBOX WWDC17 Xcode IDE - Hardy
Liyao Chen
 
KKBOX WWDC17 Security - Antony
KKBOX WWDC17 Security - AntonyKKBOX WWDC17 Security - Antony
KKBOX WWDC17 Security - Antony
Liyao Chen
 
KKBOX WWDC17 SiriKit and CoreSpotlight - Seraph
KKBOX WWDC17  SiriKit and CoreSpotlight - SeraphKKBOX WWDC17  SiriKit and CoreSpotlight - Seraph
KKBOX WWDC17 SiriKit and CoreSpotlight - Seraph
Liyao Chen
 
KKBOX WWDC17 Core Image - Daniel Tien
KKBOX WWDC17 Core Image - Daniel TienKKBOX WWDC17 Core Image - Daniel Tien
KKBOX WWDC17 Core Image - Daniel Tien
Liyao Chen
 
KKBOX WWDC17 Swift and Foundation - Liyao
KKBOX WWDC17 Swift and Foundation - LiyaoKKBOX WWDC17 Swift and Foundation - Liyao
KKBOX WWDC17 Swift and Foundation - Liyao
Liyao Chen
 
KKBOX WWDC17 Performance and Testing - Hokila
KKBOX WWDC17 Performance and Testing - HokilaKKBOX WWDC17 Performance and Testing - Hokila
KKBOX WWDC17 Performance and Testing - Hokila
Liyao Chen
 
專利入門
專利入門專利入門
專利入門
Keico Tu
 

Viewers also liked (11)

KKBOX WWDC17 Notification and Autolayout - Jefferey
KKBOX WWDC17 Notification and Autolayout - JeffereyKKBOX WWDC17 Notification and Autolayout - Jefferey
KKBOX WWDC17 Notification and Autolayout - Jefferey
 
KKBOX WWDC17 UIKit - QQ
KKBOX WWDC17 UIKit - QQKKBOX WWDC17 UIKit - QQ
KKBOX WWDC17 UIKit - QQ
 
KKBOX WWDC17 UIKit Drag and Drop - Mario
KKBOX WWDC17  UIKit Drag and Drop - MarioKKBOX WWDC17  UIKit Drag and Drop - Mario
KKBOX WWDC17 UIKit Drag and Drop - Mario
 
KKBOX WWDC17 WatchOS - Dada
KKBOX WWDC17  WatchOS  - DadaKKBOX WWDC17  WatchOS  - Dada
KKBOX WWDC17 WatchOS - Dada
 
KKBOX WWDC17 Xcode IDE - Hardy
KKBOX WWDC17  Xcode IDE - HardyKKBOX WWDC17  Xcode IDE - Hardy
KKBOX WWDC17 Xcode IDE - Hardy
 
KKBOX WWDC17 Security - Antony
KKBOX WWDC17 Security - AntonyKKBOX WWDC17 Security - Antony
KKBOX WWDC17 Security - Antony
 
KKBOX WWDC17 SiriKit and CoreSpotlight - Seraph
KKBOX WWDC17  SiriKit and CoreSpotlight - SeraphKKBOX WWDC17  SiriKit and CoreSpotlight - Seraph
KKBOX WWDC17 SiriKit and CoreSpotlight - Seraph
 
KKBOX WWDC17 Core Image - Daniel Tien
KKBOX WWDC17 Core Image - Daniel TienKKBOX WWDC17 Core Image - Daniel Tien
KKBOX WWDC17 Core Image - Daniel Tien
 
KKBOX WWDC17 Swift and Foundation - Liyao
KKBOX WWDC17 Swift and Foundation - LiyaoKKBOX WWDC17 Swift and Foundation - Liyao
KKBOX WWDC17 Swift and Foundation - Liyao
 
KKBOX WWDC17 Performance and Testing - Hokila
KKBOX WWDC17 Performance and Testing - HokilaKKBOX WWDC17 Performance and Testing - Hokila
KKBOX WWDC17 Performance and Testing - Hokila
 
專利入門
專利入門專利入門
專利入門
 

Similar to KKBOX WWDC17 Xcode debug - Oliver

Boost.Python: C++ and Python Integration
Boost.Python: C++ and Python IntegrationBoost.Python: C++ and Python Integration
Boost.Python: C++ and Python Integration
GlobalLogic Ukraine
 
What's New In Python 2.5
What's New In Python 2.5What's New In Python 2.5
What's New In Python 2.5
Richard Jones
 
Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2
Max Kleiner
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
Diego Freniche Brito
 
A Check of the Open-Source Project WinSCP Developed in Embarcadero C++ Builder
A Check of the Open-Source Project WinSCP Developed in Embarcadero C++ BuilderA Check of the Open-Source Project WinSCP Developed in Embarcadero C++ Builder
A Check of the Open-Source Project WinSCP Developed in Embarcadero C++ Builder
Andrey Karpov
 
Pyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdfPyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdf
Mattupallipardhu
 
Introduction to Python.Net
Introduction to Python.NetIntroduction to Python.Net
Introduction to Python.Net
Stefan Schukat
 
2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english
Jen Yee Hong
 
Brief Introduction to Cython
Brief Introduction to CythonBrief Introduction to Cython
Brief Introduction to Cython
Aleksandar Jelenak
 
C_and_C++_notes.pdf
C_and_C++_notes.pdfC_and_C++_notes.pdf
C_and_C++_notes.pdf
Tigabu Yaya
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
Oon Arfiandwi
 
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
Databricks
 
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CanSecWest
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
Matt Harrison
 
LLVM
LLVMLLVM
Python introduction
Python introductionPython introduction
Python introduction
Joaquim Rocha
 
Lambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive CodeLambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive Code
Ian Robertson
 
.NET @ apache.org
 .NET @ apache.org .NET @ apache.org
.NET @ apache.org
Ted Husted
 
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
apidays
 
API en Protobuf : 3 fois mieux que le JSON par Pascal CORPET
API en Protobuf : 3 fois mieux que le JSON par Pascal CORPETAPI en Protobuf : 3 fois mieux que le JSON par Pascal CORPET
API en Protobuf : 3 fois mieux que le JSON par Pascal CORPET
La Cuisine du Web
 

Similar to KKBOX WWDC17 Xcode debug - Oliver (20)

Boost.Python: C++ and Python Integration
Boost.Python: C++ and Python IntegrationBoost.Python: C++ and Python Integration
Boost.Python: C++ and Python Integration
 
What's New In Python 2.5
What's New In Python 2.5What's New In Python 2.5
What's New In Python 2.5
 
Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
A Check of the Open-Source Project WinSCP Developed in Embarcadero C++ Builder
A Check of the Open-Source Project WinSCP Developed in Embarcadero C++ BuilderA Check of the Open-Source Project WinSCP Developed in Embarcadero C++ Builder
A Check of the Open-Source Project WinSCP Developed in Embarcadero C++ Builder
 
Pyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdfPyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdf
 
Introduction to Python.Net
Introduction to Python.NetIntroduction to Python.Net
Introduction to Python.Net
 
2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english
 
Brief Introduction to Cython
Brief Introduction to CythonBrief Introduction to Cython
Brief Introduction to Cython
 
C_and_C++_notes.pdf
C_and_C++_notes.pdfC_and_C++_notes.pdf
C_and_C++_notes.pdf
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
 
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
 
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
 
LLVM
LLVMLLVM
LLVM
 
Python introduction
Python introductionPython introduction
Python introduction
 
Lambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive CodeLambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive Code
 
.NET @ apache.org
 .NET @ apache.org .NET @ apache.org
.NET @ apache.org
 
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
 
API en Protobuf : 3 fois mieux que le JSON par Pascal CORPET
API en Protobuf : 3 fois mieux que le JSON par Pascal CORPETAPI en Protobuf : 3 fois mieux que le JSON par Pascal CORPET
API en Protobuf : 3 fois mieux que le JSON par Pascal CORPET
 

More from Liyao Chen

Auto Layout part 1
Auto Layout part 1Auto Layout part 1
Auto Layout part 1
Liyao Chen
 
iOS Unit testing II
iOS Unit testing IIiOS Unit testing II
iOS Unit testing II
Liyao Chen
 
iOS Unit test getting stared
iOS Unit test getting starediOS Unit test getting stared
iOS Unit test getting stared
Liyao Chen
 
Continuous Integration
Continuous  IntegrationContinuous  Integration
Continuous Integration
Liyao Chen
 
iOS Design to Code - Code
iOS Design to Code - CodeiOS Design to Code - Code
iOS Design to Code - Code
Liyao Chen
 
iOS Design to Code - Design
iOS Design to Code - DesigniOS Design to Code - Design
iOS Design to Code - Design
Liyao Chen
 
Beta testing with CI
Beta testing with CIBeta testing with CI
Beta testing with CI
Liyao Chen
 
PTTHOT x IDEAS_HACKATHON 2014
PTTHOT x IDEAS_HACKATHON 2014PTTHOT x IDEAS_HACKATHON 2014
PTTHOT x IDEAS_HACKATHON 2014
Liyao Chen
 
選擇
選擇選擇
選擇
Liyao Chen
 
Windows 8 apps dev.整理及分享
Windows 8 apps dev.整理及分享Windows 8 apps dev.整理及分享
Windows 8 apps dev.整理及分享Liyao Chen
 

More from Liyao Chen (10)

Auto Layout part 1
Auto Layout part 1Auto Layout part 1
Auto Layout part 1
 
iOS Unit testing II
iOS Unit testing IIiOS Unit testing II
iOS Unit testing II
 
iOS Unit test getting stared
iOS Unit test getting starediOS Unit test getting stared
iOS Unit test getting stared
 
Continuous Integration
Continuous  IntegrationContinuous  Integration
Continuous Integration
 
iOS Design to Code - Code
iOS Design to Code - CodeiOS Design to Code - Code
iOS Design to Code - Code
 
iOS Design to Code - Design
iOS Design to Code - DesigniOS Design to Code - Design
iOS Design to Code - Design
 
Beta testing with CI
Beta testing with CIBeta testing with CI
Beta testing with CI
 
PTTHOT x IDEAS_HACKATHON 2014
PTTHOT x IDEAS_HACKATHON 2014PTTHOT x IDEAS_HACKATHON 2014
PTTHOT x IDEAS_HACKATHON 2014
 
選擇
選擇選擇
選擇
 
Windows 8 apps dev.整理及分享
Windows 8 apps dev.整理及分享Windows 8 apps dev.整理及分享
Windows 8 apps dev.整理及分享
 

Recently uploaded

Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 

Recently uploaded (20)

Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 

KKBOX WWDC17 Xcode debug - Oliver

  • 1. Xcode - Debug KKBOX WWDC 2017 Study Oliver Huang iOS Engineer
  • 2. Related Video Sessions 404 - Debugging with Xcode 9 https://developer.apple.com/videos/play/wwdc2017/404/ 406 - Finding Bugs Using Xcode Runtime Tools https://developer.apple.com/videos/play/wwdc2017/406/ 407 - Understanding Undefined Behavior https://developer.apple.com/videos/play/wwdc2017/407/ 411 - What's New in LLVM https://developer.apple.com/videos/play/wwdc2017/411/
  • 3. Debugging with Xcode 9 • Development: Unplugged (Wireless Development) • Breakpoint Workflow Enhancements • Debug View Hierarchy Improvements
  • 4.
  • 6. Wireless Development • Minimum requirement - iOS 11, tvOS 11, macOS 10.12.4+ • Tools support - Xcode, Instruments, Accessibility Inspector, Console, Configurator - (tvOS only) Safari Web Inspector for TVMLKit, QuickTime Screen Recording
  • 8.
  • 10. Breakpoint Workflow Enhancements • Code Completion in Text Field • Options Indicator • Deep Filtering Breakpoints
  • 11. Demo
  • 12. Debug View Hierarchy Enhancements • View Controller Debugging • SpriteKit Debugging • SceneKit Debugging
  • 15.
  • 17.
  • 18. Finding Bugs Using Xcode Runtime Tools Improvements in Runtime Checking
  • 19. Improvements in Runtime Checking Runtime Issues Finding Bugs Using Xcode Runtime Tools
  • 20. Improvements in Runtime Checking • Main Thread Checker (New) • Address Sanitizer • Thread Sanitizer • Undefined Behavior Sanitizer (New)
  • 22.
  • 23. Designing Asynchronous APIs Let API user specify callback queue DeepThought.asyncComputeAnswer(to: theQuestion) { reply in … }
  • 24. Designing Asynchronous APIs Let API user specify callback queue DeepThought.asyncComputeAnswer(to: theQuestion, completionQueue: queue) { reply in … }
  • 25. Address Sanitizer • Detects use-after-scope • Detects use-after-return (opt-in) • Compatible with Malloc Scribble Finding Memory Issues Security critical bugs • Use-after-free and buffer overflows Diagnoses hard-to-reproduce crashes Advanced Debugging and the Address Sanitizer WWDC 2015
  • 26. Use of out of scope stack memory // Use of Stack Memory Out of Scope int *integer_pointer = NULL; if (is_some_condition_true()) { int value = calculate_value(); integer_pointer = &value; } *integer_pointer = 42;
  • 27. // Use of Stack Memory after Return int *returns_address_of_stack() { int a = 42; return &a; } int *integer_pointer = returns_address_of_stack(); *integer_pointer = 43;
  • 28.
  • 29. Thread Sanitizer • Race on collections • Swift access races What is Thread Sanitizer Multithreading issues Finds races even if they did not manifest 64-bit macOS, 64-bit simulators Thread Sanitizer and Static Analysis WWDC 2016
  • 30. // Thread 1 eventLog.log(source: networkingSubsystem, message: "Download finished") // Thread 2 eventLog.log(source: databaseSubsystem, message: "Query complete") Thread 2: Data race in EventLog.log(source:message:) // Swift Data Race Example class EventLog { private var lastEventSource: LogSource? func log(source: LogSource, message: String) { print(message) lastEventSource = source } }
  • 31. // Use DispatchQueue to Synchronize Access class EventLog { private var lastEventSource: LogSource? private var queue = DispatchQueue(label: "com.example.EventLog.queue") func log(source: LogSource, message: String) { queue.async { print(message) lastEventSource = source } } }
  • 32. // Swift Access Race with Mutating Methods struct BluePoliceBoxLocation { private var x, y, z: Int private var time: Int } mutating func teleport(toPlanet: String) { … } mutating func fly(toCity: String) { … } mutating func travelToEndOfTime() { … } Thread 2: Swift access race Thread 1: Previous access // Thread 1 location.teleport(toPlanet: "Mars") // Thread 2 location.travelToEndOfTime() changes x, y, z changes time
  • 34. Alignment Violation Nonnull Return Value Violation Integer Overflow C++ Dynamic Type Violation Invalid Float Cast Invalid Shift Exponent Invalid Boolean Invalid EnumInvalid Variable-Length Array Integer Division by Zero Invalid Shift BaseInvalid Integer Cast Out-of-Bounds Array Access Invalid Object SizeMissing Return Value Reached Unreachable Code Nonnull Parameter ViolationNonnull Assignment Violation Null Dereference
  • 35. “undefined behavior:
 behavior for which this International Standard imposes no requirements.”
 • ISO C++14 Standard
  • 36. Undefined Behavior Is About Tradeoffs Performance over safety
  • 37. (INT_MAX + 1) ≯ INT_MAX Integer Overflow
  • 38. Null pointer returned from function declared to never return null // Nonnull Return Value Violation @implementation SolarSystem + (nonnull NSDictionary *)planetMoons { return @{@"Earth": @[@"Moon"], @"Mars" : @[@"Phobos", @"Deimos"], // … }; } - (nonnull NSArray *)moonsOfPlanet:(nonnull NSString *)planet { return [[self class] planetMoons][planet]; } @end // Find the biggest moon for each planet NSMutableArray *biggestMoons = [NSMutableArray new]; [biggestMoons addObject:[solarSystem moonsOfPlanet:@"Pluto"][0]]; Nonnull Return Value Violation
  • 39. Compiler 2 Source code .c, .m, .cpp, .mm Object file .o Let’s Experiment: A Very Simple Optimization Pipeline Compiler 1 Dead Code Elimination Redundant Null Check Elimination Redundant Null Check Elimination void contains_null_check(int *P) { int unused = *P; …Hidden text for MM *P = 4; } Keep the brace in MM if (P == NULL) return; Dead Code Elimination void contains_null_check(int *P) { int unused = *P; …Hidden text for MM if (P == NULL) return; *P = 4; } Keep the closing brace MM Compiler Optimization
  • 40. Compiler 2 Source code .c, .m, .cpp, .mm Object file .o Let’s Experiment: A Very Simple Optimization Pipeline Compiler 1 Dead Code Elimination Redundant Null Check Elimination Redundant Null Check Elimination void contains_null_check(int *P) { int unused = *P; …Hidden text for MM *P = 4; } Keep the brace in MM Dead Code Elimination void contains_null_check(int *P) { int unused = *P; …Hidden text for MM if (P == NULL) return; *P = 4; } Keep the closing brace MM Compiler Optimization 1
  • 41. Compiler 2 Source code .c, .m, .cpp, .mm Object file .o Let’s Experiment: A Very Simple Optimization Pipeline Compiler 1 Dead Code Elimination Redundant Null Check Elimination Dead Code Elimination int unused = *P; void contains_null_check(int *P) { …Hidden text for MM *P = 4; } Keep closing brace in MM void contains_null_check(int *P) { int unused = *P; …Hidden text for MM *P = 4; } Keep the brace in MM Compiler Optimization 1
  • 42. Compiler 2 Source code .c, .m, .cpp, .mm Object file .o Let’s Experiment: A Very Simple Optimization Pipeline Compiler 1 Dead Code Elimination Redundant Null Check Elimination Dead Code Elimination void contains_null_check(int *P) { …Hidden text for MM *P = 4; } Keep closing brace in MM void contains_null_check(int *P) { int unused = *P; …Hidden text for MM *P = 4; } Keep the brace in MM Compiler Optimization 1
  • 43. Compiler 2 Source code .c, .m, .cpp, .mm Object file .o Let’s Experiment: A Very Simple Optimization Pipeline Compiler 2 Redundant Null Check Elimination Dead Code Elimination Dead Code Elimination void contains_null_check(int *P) {
 
 …Hidden text for MM if (P == NULL) return; *P = 4; } Please keep the brace MM void contains_null_check(int *P) { int unused = *P; …Hidden text for MM if (P == NULL) return; *P = 4; } Keep brace during MM int unused = *P; Compiler Optimization 2
  • 44. Compiler 2 Source code .c, .m, .cpp, .mm Object file .o Let’s Experiment: A Very Simple Optimization Pipeline Compiler 2 Redundant Null Check Elimination Dead Code Elimination Dead Code Elimination void contains_null_check(int *P) {
 
 …Hidden text for MM if (P == NULL) return; *P = 4; } Please keep the brace MM void contains_null_check(int *P) { int unused = *P; …Hidden text for MM if (P == NULL) return; *P = 4; } Keep brace during MM Compiler Optimization 2
  • 45. Source code .c, .m, .cpp, .mm Object file .o Compiler 2 Let’s Experiment: A Very Simple Optimization Pipeline Compiler 2 Redundant Null Check Elimination Dead Code Elimination Redundant Null Check Elimination void contains_null_check(int *P) { …Hidden text for MM if (P == NULL) return; *P = 4; } Please keep me MM! void contains_null_check(int *P) {
 
 …Hidden text for MM if (P == NULL) return; *P = 4; } Please keep the brace MM Compiler Optimization 2
  • 46. Let’s Experiment: A Very Simple Optimization Pipeline A surprising result void contains_null_check(int *P) { int unused = *P; … if (P == NULL) return; *P = 4; } Keep brace during MM Compiler 1 void contains_null_check(int *P) { … *P = 4; } Keep closing brace in MM void contains_null_check(int *P) { … if (P == NULL) return; *P = 4; } void contains_null_check(int *P) { int unused = *P; … if (P == NULL) return; *P = 4; } Keep brace during MM Compiler 2 Compiler Optimization
  • 47. Using Runtime Tools Effectively • Exercise more code • Use the tools together
  • 48. Runtime Tool Overhead Execution overhead Memory overhead Main Thread Checker 1.02x negligible Undefined Behavior Sanitizer 1.2x negligible Address Sanitizer 2–3x 2x Thread Sanitizer 5–10x 4x
  • 49. What's New in LLVM • API Availability Checking for Objective-C • Static Analyzer Checks • New Warnings • C++ Refactoring & Features from C++17 • Link-Time Optimization (LTO) • API Availability Checking for Objective-C • Static Analyzer Checks • New Warnings • C++ Refactoring & Features from C++17 • Link-Time Optimization (LTO)
  • 50. API Availability Checking for Objective-C [UIView instancesRespondToSelector:@selector(addInteraction:)] [UIDragInteraction class] [NSOrthography respondsToSelector:@selector(defaultOrthographyForLanguage:)] &ARErrorDomain != NULL futimens != NULL [UIView instancesRespondToSelector:@selector(addInteraction:)] [UIDragInteraction class] [NSOrthography respondsToSelector:@selector(defaultOrthographyForLanguage:) &ARErrorDomain != NULL futimens != NULL w instancesRespondToSelector:@selector(addInteraction:)] [UIDragInteraction class] y respondsToSelector:@selector(defaultOrthographyForLanguage:)] main != NULL futimens != NULL [UIView instancesRespondToSelector:@selector(addInteraction:)] [UIDragInteraction class] [NSOrthography respondsToSelector:@selector(defaultOrthographyForLanguage &ARErrorDomain != NULL futimens != NULL [UIView instancesRespondToSelector:@selector(addInteraction:)] [UIDragInteraction class] [NSOrthography respondsToSelector:@selector(defaultOrthographyForLanguage:)] &ARErrorDomain != NULL futimens != NULL
  • 51. API Availability Checking in Objective-C if (@available(iOS 11,x*)) { r = [VNDetectFaceRectanglesRequest new]; if ([handler performRequests:@[r] error:&error]) { // Draw rectangles } } else { // Fall back when API not available } Compiler warns about unguarded uses of new API Use @available to query API availability at run time API Availability Checking for Objective-C
  • 52. Convenient to write entire methods with limited availability @interface MyAlbumController : UIViewController - (void)showFaces @end API_AVAILABILITY(ios(11.0)); Factor out Code with API_AVAILABILITY() Convenient to write entire methods with limited availability @interface MyAlbumController : UIViewController - (void)showFaces @end API_AVAILABILITY(ios(11.0)) ; Can apply to entire classes Factor out Code with API_AVAILABILITY()
  • 53. API Availability Checking in C/C++ Use __builtin_available to check availability at runtime if (__builtin_available(iOS 11, macOS 10.13, *)) { CFNewAPIOniOS11(); }
  • 54. API Availability Checking in C/C++ Use __builtin_available to check availability at runtime Include <os/availability.h> for the API_AVAILABILITY macro #include <os/availability.h> void myFunctionForiOS11OrNewer(int i) API_AVAILABILITY(ios(11.0), macos(10.13));
  • 55. Do Not Compare Number Objects to Scalars Comparing NSNumber pointer value to 0 checks for nil – not zero number @property NSNumber *photoCount; - (BOOL)hasPhotos { } Comparing pointer value to a scalar integer valuereturn self.photoCount > 0; Do Not Auto-Synthesize NSMutable copy Properties Setter calls -copy, which yields an immutable copy - (void)replaceWithStockPhoto:(NSImage *)stockPhoto { self.photos = [NSMutableArray<NSImage *> new]; [self.photos addObject:stockPhoto]; } -[__NSArray0 addObject:]: unrecognized selector sent to instance @property (copy) NSMutableArray<NSImage *> *photos; Static Analyzer Checks Run Analyzer on Your Code! Supports Objective-C, C, C++ Analyze during build
  • 56. Q & A