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
Why does continuous profiling matter to developers? #appdevelopercon
salaboy
0
180
【若手エンジニア応援LT会】ソフトウェアを学んできた私がインフラエンジニアを目指した理由
kazushi_ohata
0
150
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
410
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
120
強いチームと開発生産性
onk
PRO
33
11k
AWS Lambdaと歩んだ“サーバーレス”と今後 #lambda_10years
yoshidashingo
1
170
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
470
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
2
590
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
Can We Measure Developer Productivity?
ewolff
1
150
Evangelismo técnico: ¿qué, cómo y por qué?
trishagee
0
360
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
510
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Producing Creativity
orderedlist
PRO
341
39k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Done Done
chrislema
181
16k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Speed Design
sergeychernyshev
24
610
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
How STYLIGHT went responsive
nonsquared
95
5.2k
Ruby is Unlike a Banana
tanoku
97
11k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ