Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
App Extension のスタックトレース情報からクラッシュを解析/集計する / Anal...
Search
naru-jpn
September 18, 2021
Technology
3
1.3k
App Extension のスタックトレース情報からクラッシュを解析/集計する / Analyzing app extension's stack trace
配信アプリで使用している Broadcast Extension 上で発生したクラッシュの詳細について、クラッシュ発生時のスタックトレースを取得して解析し、複数のクラッシュの修正に繋げた話。
naru-jpn
September 18, 2021
Tweet
Share
More Decks by naru-jpn
See All by naru-jpn
配信アプリのためのリアルタイムプッシュ通知ぼかしの夢
narujpn
3
760
PiPを応用した配信コメントバー機能の開発秘話と技術の詳解 / pip_streaming_comment_bar
narujpn
3
3.6k
Updating an App to Use Swift Concurrency 解説
narujpn
2
250
PiP で実現するミラティブの配信コメントバー / pip-streaming-comment-bar
narujpn
0
980
ミラティブとWebRTC - WebRTC framework の中身を覗いてみよう / WebRTC framework AudioUnit Processing
narujpn
1
2k
CoreML3のオンデバイストレーニングでつくる母音推定
narujpn
0
390
AltConfと周辺の歩き方
narujpn
0
1.9k
エンジニア経験を活かしたスクラムマスターとして 開発チームとプロダクトを成長させる
narujpn
1
370
GASで作るファネル分析ツール
narujpn
1
150
Other Decks in Technology
See All in Technology
Lambdaと地方とコミュニティ
miu_crescent
2
370
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
9
1.1k
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.7k
Application Development WG Intro at AppDeveloperCon
salaboy
0
190
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
180
SSMRunbook作成の勘所_20241120
koichiotomo
3
160
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
940
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
Flutterによる 効率的なAndroid・iOS・Webアプリケーション開発の事例
recruitengineers
PRO
0
110
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
140
Lexical Analysis
shigashiyama
1
150
Featured
See All Featured
Done Done
chrislema
181
16k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Bash Introduction
62gerente
608
210k
Writing Fast Ruby
sferik
627
61k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Become a Pro
speakerdeck
PRO
25
5k
Designing for humans not robots
tammielis
250
25k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Transcript
"QQ&YUFOTJPOͷελοΫτϨʔεใ͔Β ΫϥογϡΛղੳूܭ͢Δ /BSVLJ$IJHJSB !@OBSV@KQO J04%$
ϛϥςΟϒΞϓϦͷ͝հ
ࠓճͷͷഎܠ
& ΞϓϦຊମ #SPBEDBTU&YUFOTJPO ϛϥςΟϒͷJ04ΞϓϦ #SPBEDBTU&YUFOTJPOΛར༻ͯ͠৴ॲཧΛ͍ͯ͠Δ
& ΞϓϦຊମ #SPBEDBTU&YUFOTJPO ΞϓϦຊମͱ#SPBEDBTU&YUFOTJPOผͷϓϩηεͱͯ͠ಈ࡞͍ͯͯ͠ɺ ྫ͑ͲͪΒ͔͕Ϋϥογϡͯ͠ɺ͏Ұํಈ͖ଓ͚͍ͯͨΓ͢Δ 💥 ৴ͯ͠ΔΑ Ϋϥογϡͨ͠
& ΞϓϦຊମ #SPBEDBTU&YUFOTJPO Ϋϥογϡ͕ൃੜͨ࣌͠ɺ ͦΕͧΕͰߦ͍ͬͯΔॲཧҟͳ͍ͬͯΔ 💥 💥
ΞϓϦຊମ ΞϓϦຊମΫϥογϡใΛ'JSFCBTF$SBTIMZUJDTʹૹ৴͍ͯͯ͠ɺ 'JSFCBTFͷίϯιʔϧ্ͰΫϥογϡΛ֬ೝͯ͠ରԠ͍ͯ͠Δ 💥 📝
ϩά༻αʔόʔ & #SPBEDBTU&YUFOTJPO #SPBEDBTU&YUFOTJPOʹ'JSFCBTF$SBTIMZUJDTΈࠐ·Ε͓ͯΒͣɺ ಠࣗʹΫϥογϡ࣌ͷใΛऔಘ͍ͯ͠Δ 💥 📝 5ISFBEDBMM4UBDL4ZNCPMT
ϩά༻αʔόʔ & #SPBEDBTU&YUFOTJPO ݩʑɺϩάΫϥογϡͷൃੜසΛѲ͢ΔͨΊʹ༻͞Ε͍ͯͯɺ औಘ͞Ε͍ͯΔใΛݟ͚ͨͩͰΫϥογϡͷৄࡉ͔Βͳ͍ 💥 📝 5ISFBEDBMM4UBDL4ZNCPMT
ˠ#SPBEDBTU&YUFOTJPOͷΫϥογϡͷमਖ਼ ΞϓϦຊମͱൺֱͯ͠ɺܦݧʹґΔͱ͜Ζ͕େ͖͔ͬͨ ݩʑɺϩάΫϥογϡͷൃੜසΛѲ͢ΔͨΊʹ༻͞Ε͍ͯͯɺ औಘ͞Ε͍ͯΔใΛݟ͚ͨͩͰΫϥογϡͷৄࡉ͔Βͳ͍
& ΞϓϦຊମ #SPBEDBTU&YUFOTJPO ͷ͡ΊɺʮΠϠϗϯ৴ʯͱݺΕ͍ͯΔػೳͷվमʹͬͯ #SPBEDBTU&YUFOTJPOͰ৽ͨͳΫϥογϡ͕ൃੜ͢Δ͜ͱ͕ͳΜͱͳ͔͍ͬͯͨ͘ 💥
ˠͲ͏͍͏༰ͷΫϥογϡ͕ɺ Ͳͷ͘Β͍ͷׂ߹Ͱൃੜ͍ͯ͠Δ͔ௐΔखஈ͕ཉ͔ͬͨ͠ ͷ͡ΊɺʮΠϠϗϯ৴ʯͱݺΕ͍ͯΔػೳͷվमʹͬͯ #SPBEDBTU&YUFOTJPOͰ৽ͨͳΫϥογϡ͕ൃੜ͢Δ͜ͱ͕ͳΜͱͳ͔͍ͬͯͨ͘
#SPBEDBTU&YUFOTJPOʹ'JSFCBTF$SBTIMZUJDTΛΈࠐΉ ˠͦͦͰ͖Δͷ͔Βͳ͍ ΫϥογϡΛௐͯΔͷʹ৽͍͕͠ग़ͨΒා͍ Broadcast Extension σϦέʔτͳͷͰۃྗ৮Γͨ͘ͳ͍
9DPEFͷ0SHBOJ[FSΛཔΔ ˠ༰Λཧղ͢Δͷʹܦݧ͕ඞཁͩͬͨ ͨͱ͑4IBSFEʹEP0VUQVU1SPDFTTͱ͍͏ϝιουଘࡏ͠ͳ͍
#SPBEDBTU&YUFOTJPOͰϩάͱͯ͠औಘ͍ͯ͠Δ ελοΫτϨʔε DBMM4UBDL4ZNCPMT ͷใΛ׆༻͢Δ ˠͪΐ͏Ͳ6OJUZ'SBNFXPSLͷΫϥογϡௐ͍ࠪͯͯ͠ E4:.·ΘΓΛௐ͍ͯͨ͜ͱ͋ΓɺͰ͖ͦ͏ͳؾ͕ͨ͠ Mirrativ tech blog -
ʲiOSʳUnity Framework ͱΫϥογϡղੳͷऔΓΈ
"QQ&YUFOTJPOͷελοΫτϨʔεใ͔Β ΫϥογϡΛղੳूܭ͢Δ Ϋϥογϡ࣌ͷελοΫτϨʔεΛऔಘ͢Δ E4:.ϑΝΠϧΛͱͬͯ͘Δ BUPTίϚϯυͰελοΫτϨʔεΛղੳ͢Δ ղੳΛࣗಈԽͯ͠ूܭ͢Δ
ΫϥογϡΛमਖ਼͢Δ ඞཁͳࡐྉΛଗ͑Δ खಈͰղੳ͢Δ ࣗಈͰղੳ͢Δ मਖ਼͢Δ
Ϋϥογϡ࣌ͷελοΫτϨʔεΛऔಘ͢Δ
ΫϥογϡݕͱϋϯυϦϯά class func setup() { // ྫ֎ͷݕͱ࣮ߦ͢Δؔͷࢦఆ NSSetUncaughtExceptionHandler(exceptionHandler) // γάφϧͷݕͱ࣮ߦ͢Δؔͷࢦఆ
for sigcontext in [SIGABRT, SIGILL, SIGSEGV, SIGFPE, SIGBUS, SIGPIPE, SIGTRAP] { signal(sigcontext, signalHandler) } } private static let exceptionHandler: @convention(c) (NSException) -> () = { exeption in handleSignalException(exeption: exeption) } private static let signalHandler: @convention(c) (Int32) -> () = { signal in handleSignalException() } https://stackover fl ow.com/questions/36325140/how-to-catch-a-swift-crash-and-do-some-logging
ίʔϧελοΫͷऔಘ let callstack = exception.callStackSymbols.joined(separator: “\n”) // ͘͠ let callstack
= Thread.callStackSymbols.joined(separator: “\n”)
ίʔϧελοΫͷऔಘ let callstack = exception.callStackSymbols.joined(separator: “\n”) // ͘͠ let callstack
= Thread.callStackSymbols.joined(separator: “\n”) 0 broadcast-upload 0x000000010502eaf8 broadcast-upload + 223992 1 libsystem_platform.dylib 0x00000001e3b9c29c 987D48D5-3CAA-34D7-9141-C0BD6E2351E8 + 21148 2 broadcast-upload 0x0000000105106224 broadcast-upload + 1106468 3 broadcast-upload 0x0000000105103604 broadcast-upload + 1095172 4 Foundation 0x00000001991eb438 __NSFireTimer + 104 5 CoreFoundation 0x0000000197d911d4 338F58B1-9B75-38A0-B908-E2574AB1D39A + 672212 6 CoreFoundation 0x0000000197d90dd0 338F58B1-9B75-38A0-B908-E2574AB1D39A + 671184 7 CoreFoundation 0x0000000197d90220 338F58B1-9B75-38A0-B908-E2574AB1D39A + 668192 8 CoreFoundation 0x0000000197d89f8c 338F58B1-9B75-38A0-B908-E2574AB1D39A + 642956 … ͜ͷίʔϧελοΫͷใΛղੳͯ͠ɺϓϩάϥϜͷ࣮ߦߦͳͲΛಛఆ͍ͨ͠
E4:.ϑΝΠϧΛͱͬͯ͘Δ
"QQ4UPSF$POOFDU͔ΒE4:.ϑΝΠϧΛͱͬͯ͘Δ ͜ͷE4:.ϑΝΠϧͦΕͧΕ͕֤λʔήοτϥΠϒϥϦʹରԠ͍ͯ͠Δ App Store Connect
E4:.ϑΝΠϧ͕ͲͷλʔήοτϥΠϒϥϦʹରԠ͍ͯ͠Δ͔ௐΔ Mirrativ tech blog - ʲiOSʳUnity Framework ͱΫϥογϡղੳͷऔΓΈ files=`ls "$1"`
for uuid in ${files[@]}; do module=`ls "$1/${uuid}/Contents/Resources/DWARF/"` echo "${uuid:0:8}: ${module}" done fi OE@ETZNTI
Mirrativ tech blog - ʲiOSʳUnity Framework ͱΫϥογϡղੳͷऔΓΈ $ ./find_dsym.sh /Users/naruki.chigira/Desktop/appDsyms
2d4dd1c9: widget 310ef0bf: broadcast-upload 6d82e920: WebRTC 7cc5d65f: UnityFramework b11f4f4f: Shared de357eed: mirrativ … ֤λʔήοτϥΠϒϥϦʹରԠ͢ΔE4:.͕؆୯ʹ୳ͤΔΑ͏ʹͳͬͨ E4:.ϑΝΠϧ͕ͲͷλʔήοτϥΠϒϥϦʹରԠ͍ͯ͠Δ͔ௐΔ
BUPTίϚϯυͰελοΫτϨʔεΛղੳ͢Δ
BUPTͷجຊతͳ͍ํΛΔ $ man atos atos(1) BSD General Commands Manual atos(1)
NAME atos -- convert numeric addresses to symbols of binary images or processes SYNOPSIS atos [-o <binary-image-file>] [-p <pid> | <partial-executable-name>] [-arch architecture] [-l <load-address>] [-s <slide>] [-printHeader] [-fullPath] [-f <address- input-file>] [<address> …] … NBOίϚϯυͰ֬ೝͯ͠ΈΔ atos [-o <binary-image-file>] [-arch architecture] [-l <load-address>] [<address> …] ࠓճͷΫϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ
BUPTʹ͢ύϥϝʔλE4:.ϑΝΠϧ atos [-o <binary-image-file>] [-arch architecture] [-l <load-address>] [<address> …]
Ϋϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ E4:.ϑΝΠϧͷύε த 0 broadcast-upload 0x000000010502eaf8 broadcast-upload + 223992 ./appDsyms/310ef0bf-51fa-3535-8078-3fa06c470774.dSYM/Contents/Resources/DWARF/broadcast-upload
BUPTʹ͢ύϥϝʔλΞʔΩςΫνϟ atos [-o <binary-image-file>] [-arch architecture] [-l <load-address>] [<address> …]
Ϋϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ Ϋϥογϡ͕ൃੜͨ͠ͷ$16ΞʔΩςΫνϟ BSN BSNF
ɾΞʔΩςΫνϟΛऔಘ͢ΔͨΊͷ4XJGUͷίʔυ IUUQTHJTUHJUIVCDPNOBSVKQOBEEEDBBCFCEFC fi MFEFWJDFTXJGU ɾJ1IPOF ͷΑ͏ͳϞσϧ໊͔ΒΞʔΩςΫνϟΛऔಘ͢ΔͨΊͷTRM IUUQTHJTUHJUIVCDPNOBSVKQOGGFCEEDBDEBD fi MFEFWJDFTRM BUPTʹ͢ύϥϝʔλΞʔΩςΫνϟ
BUPTʹ͢ύϥϝʔλελοΫτϨʔεͷΞυϨε atos [-o <binary-image-file>] [-arch architecture] [-l <load-address>] [<address> …]
Ϋϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ -l 0x104ff8000 0x10502eaf8
atos [-o <binary-image-file>] [-arch architecture] [-l <load-address>] [<address> …] Ϋϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ
-l 0x104ff8000 0x10502eaf8 0 broadcast-upload 0x000000010502eaf8 broadcast-upload + 223992 " # https://stackover fl ow.com/questions/11747802/symbolicating-stack-trace-without-crash " "# BUPTʹ͢ύϥϝʔλελοΫτϨʔεͷΞυϨε
atos [-o <binary-image-file>] [-arch architecture] [-l <load-address>] [<address> …] Ϋϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ
-l 0x104ff8000 0x10502eaf8 0 broadcast-upload 0x000000010502eaf8 broadcast-upload + 223992 " # https://stackover fl ow.com/questions/11747802/symbolicating-stack-trace-without-crash "# BUPTʹ͢ύϥϝʔλελοΫτϨʔεͷΞυϨε "0x" + String(UInt64("10502eaf8", radix: 16)! - UInt64("223992", radix: 10)!, radix: 16)
$ atos -o {path_to_dsym} -arch arm64e -l 0x104ff8000 0x10502eaf8 0
broadcast-upload 0x000000010502eaf8 broadcast-upload + 223992 https://stackover fl ow.com/questions/11747802/symbolicating-stack-trace-without-crash ελοΫτϨʔεΛղੳ͢Δ closure #1 in variable initialization expression of static AnalyticsManager.recieveSignal (in broadcast-upload) (AnalyticsManager+Extension.swift:22) 🎉
$ atos -o {path_to_dsym} -arch arm64e -l 0x104ff8000 0x105106224 0x105103604
2 broadcast-upload 0x0000000105106224 broadcast-upload + 1106468 3 broadcast-upload 0x0000000105103604 broadcast-upload + 1095172 https://stackover fl ow.com/questions/11747802/symbolicating-stack-trace-without-crash ελοΫτϨʔεΛղੳ͢Δ specialized Stream.on(timer:) (in broadcast-upload) (Stream.swift:164) @objc Stream.on(timer:) (in broadcast-upload) (<compiler-generated>:0) 🎉
$ atos -o {path_to_dsym} -arch arm64e -l 0x104ff8000 0x10502eaf8 ࣮༻্ͷ՝
ɾE4:.ϑΝΠϧͷࢦఆΞυϨεͷܭࢉ͕खؒ ɾ࣮ߦʹ͕͔͔࣌ؒΔ ɹɾUJNFίϚϯυͰܭଌ͢Δͱ()[.BD#PPL1SPͰ<T> ˠख࡞ۀͰղੳͰ͖ͳ͍͠ɺେྔͷϩάΛղੳ͢ΔʹΩϟογϡ తͳΈ͕ඞཁ
ղੳΛࣗಈԽͯ͠ूܭ͢Δ
ղੳ༻ΞϓϦʹΑΔࣗಈԽʢ݅ͷΫϥογϡղੳʣ
ूܭ݁Ռͷྫ ൃੜճ ղੳࡁΈͷελοΫτϨʔε ͜͜·Ͱ͘Ε֤Ϋϥογϡͷ༰ͱӨڹͷେ͖͕͞ҰͰ͔Δ
ΫϥογϡΛमਖ਼͢Δ
Ϋϥογϡͷमਖ਼ ৄࡉলུʜ ɾ৴தʹ4JSJΛىಈ͢ΔͱɺԻσʔλͷྲྀΕ͕ෆنଇʹͳΔ ɾ৴தʹଞͷ௨ΞϓϦͰ௨Λ͢Δͱɺఆ֎ͷνϟωϧΛ࣋ͬ ͨԻσʔλ͕ྲྀΕͯ͘Δ ͳͲ
Ϋϥογϡमਖ਼ޙͷΫϥογϡͷվળ मਖ਼൛ͷϦϦʔε ΫϥογϡͷൃੜΛ ݮΒ͢͜ͱ͕Ͱ͖ͨʂ
·ͱΊ ෭࣍తʹಘΒΕͨͷ ɾΫϥογϡͷৄࡉͱ༁͕؆୯ʹ͔ΔΑ͏ʹͳͬͨ͜ͱͰɺ ɹमਖ਼Λ͢ΔࡍͷϝϦοτӨڹྗͷࣄલͷઆ໌͕͘͢͠ͳͬͨ ɾܦݧ͕ͳ͍ͱཧղͰ͖ͳ͔ͬͨྖҬͷղ૾্͕͕Γɺ ɹଐਓੑΛݮΒ͢͜ͱʹܨ͕ͬͨ ɾελοΫτϨʔεͱE4:.͔ΒΫϥογϡͷৄࡉ͕ղੳͰ͖ͯɺ ɹΫϥογϡͷղফʹܨ͕ͬͨ
͓·͚ DBMM4UBDL4ZNCPMT͔ΒऔಘͰ͖ΔจࣈྻΛύʔε͢ΔͨΊͷϥΠϒϥϦ IUUQTHJUIVCDPNOBSVKQO$BMM4UBDL4ZNCPMT
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ