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
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
110
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
460
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
130
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
3
2.3k
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
210
UI State設計とテスト方針
rmakiyama
2
580
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
170
MLOps の現場から
asei
6
640
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
190
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
13
3.7k
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
330
Featured
See All Featured
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Building Applications with DynamoDB
mza
91
6.1k
Automating Front-end Workflow
addyosmani
1366
200k
The Language of Interfaces
destraynor
154
24k
The Invisible Side of Design
smashingmag
298
50k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
A Tale of Four Properties
chriscoyier
157
23k
GraphQLとの向き合い方2022年版
quramy
44
13k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Typedesign – Prime Four
hannesfritz
40
2.4k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Music & Morning Musume
bryan
46
6.2k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ