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
800
PiPを応用した配信コメントバー機能の開発秘話と技術の詳解 / pip_streaming_comment_bar
narujpn
3
3.7k
Updating an App to Use Swift Concurrency 解説
narujpn
2
260
PiP で実現するミラティブの配信コメントバー / pip-streaming-comment-bar
narujpn
0
1k
ミラティブとWebRTC - WebRTC framework の中身を覗いてみよう / WebRTC framework AudioUnit Processing
narujpn
1
2.1k
CoreML3のオンデバイストレーニングでつくる母音推定
narujpn
0
390
AltConfと周辺の歩き方
narujpn
0
1.9k
エンジニア経験を活かしたスクラムマスターとして 開発チームとプロダクトを成長させる
narujpn
1
380
GASで作るファネル分析ツール
narujpn
1
160
Other Decks in Technology
See All in Technology
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
170
私なりのAIのご紹介 [2024年版]
qt_luigi
1
120
アップデート紹介:AWS Data Transfer Terminal
stknohg
PRO
0
180
.NET 9 のパフォーマンス改善
nenonaninu
0
730
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
220
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
170
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
330
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
330
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
160
Jetpack Composeで始めるServer Cache State
ogaclejapan
2
170
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
A designer walks into a library…
pauljervisheath
204
24k
The Pragmatic Product Professional
lauravandoore
32
6.3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Building Adaptive Systems
keathley
38
2.3k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Scaling GitHub
holman
458
140k
Practical Orchestrator
shlominoach
186
10k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Rails Girls Zürich Keynote
gr2m
94
13k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ