Slide 1

Slide 1 text

"QQ&YUFOTJPOͷελοΫτϨʔε৘ใ͔Β ΫϥογϡΛղੳूܭ͢Δ /BSVLJ$IJHJSB !@OBSV@KQO J04%$

Slide 2

Slide 2 text

ϛϥςΟϒΞϓϦͷ͝঺հ

Slide 3

Slide 3 text

ࠓճͷ࿩ͷഎܠ

Slide 4

Slide 4 text

& ΞϓϦຊମ #SPBEDBTU&YUFOTJPO ϛϥςΟϒͷJ04ΞϓϦ͸ #SPBEDBTU&YUFOTJPOΛར༻ͯ͠഑৴ॲཧΛ͍ͯ͠Δ

Slide 5

Slide 5 text

& ΞϓϦຊମ #SPBEDBTU&YUFOTJPO ΞϓϦຊମͱ#SPBEDBTU&YUFOTJPO͸ผͷϓϩηεͱͯ͠ಈ࡞͍ͯͯ͠ɺ ྫ͑͹ͲͪΒ͔͕Ϋϥογϡͯ͠΋ɺ΋͏Ұํ͸ಈ͖ଓ͚͍ͯͨΓ͢Δ 💥 ഑৴ͯ͠ΔΑ Ϋϥογϡͨ͠

Slide 6

Slide 6 text

& ΞϓϦຊମ #SPBEDBTU&YUFOTJPO Ϋϥογϡ͕ൃੜͨ࣌͠ɺ ͦΕͧΕͰߦ͍ͬͯΔॲཧ΋ҟͳ͍ͬͯΔ 💥 💥

Slide 7

Slide 7 text

ΞϓϦຊମ ΞϓϦຊମ͸Ϋϥογϡ৘ใΛ'JSFCBTF$SBTIMZUJDTʹૹ৴͍ͯͯ͠ɺ 'JSFCBTFͷίϯιʔϧ্ͰΫϥογϡΛ֬ೝͯ͠ରԠ͍ͯ͠Δ 💥 📝

Slide 8

Slide 8 text

ϩά༻αʔόʔ & #SPBEDBTU&YUFOTJPO #SPBEDBTU&YUFOTJPOʹ͸'JSFCBTF$SBTIMZUJDT͸૊Έࠐ·Ε͓ͯΒͣɺ ಠࣗʹΫϥογϡ࣌ͷ৘ใΛऔಘ͍ͯ͠Δ 💥 📝 5ISFBEDBMM4UBDL4ZNCPMT

Slide 9

Slide 9 text

ϩά༻αʔόʔ & #SPBEDBTU&YUFOTJPO ݩʑɺϩά͸Ϋϥογϡͷൃੜස౓Λ೺Ѳ͢ΔͨΊʹ࢖༻͞Ε͍ͯͯɺ औಘ͞Ε͍ͯΔ৘ใΛݟ͚ͨͩͰ͸Ϋϥογϡͷৄࡉ͸෼͔Βͳ͍ 💥 📝 5ISFBEDBMM4UBDL4ZNCPMT

Slide 10

Slide 10 text

ˠ#SPBEDBTU&YUFOTJPOͷΫϥογϡͷमਖ਼͸ ΞϓϦຊମͱൺֱͯ͠ɺܦݧʹґΔͱ͜Ζ͕େ͖͔ͬͨ ݩʑɺϩά͸Ϋϥογϡͷൃੜස౓Λ೺Ѳ͢ΔͨΊʹ࢖༻͞Ε͍ͯͯɺ औಘ͞Ε͍ͯΔ৘ใΛݟ͚ͨͩͰ͸Ϋϥογϡͷৄࡉ͸෼͔Βͳ͍

Slide 11

Slide 11 text

& ΞϓϦຊମ #SPBEDBTU&YUFOTJPO ೥ͷ͸͡ΊɺʮΠϠϗϯ഑৴ʯͱݺ͹Ε͍ͯΔػೳͷվमʹ൐ͬͯ #SPBEDBTU&YUFOTJPOͰ৽ͨͳΫϥογϡ͕ൃੜ͢Δ͜ͱ͕ͳΜͱͳ͘෼͔͍ͬͯͨ 💥

Slide 12

Slide 12 text

ˠͲ͏͍͏಺༰ͷΫϥογϡ͕ɺ Ͳͷ͘Β͍ͷׂ߹Ͱൃੜ͍ͯ͠Δ͔ௐ΂Δखஈ͕ཉ͔ͬͨ͠ ೥ͷ͸͡ΊɺʮΠϠϗϯ഑৴ʯͱݺ͹Ε͍ͯΔػೳͷվमʹ൐ͬͯ #SPBEDBTU&YUFOTJPOͰ৽ͨͳΫϥογϡ͕ൃੜ͢Δ͜ͱ͕ͳΜͱͳ͘෼͔͍ͬͯͨ

Slide 13

Slide 13 text

#SPBEDBTU&YUFOTJPOʹ΋'JSFCBTF$SBTIMZUJDTΛ૊ΈࠐΉ ˠͦ΋ͦ΋Ͱ͖Δͷ͔஌Βͳ͍ ΫϥογϡΛௐ΂ͯΔͷʹ৽͍͠໰୊͕ग़ͨΒා͍ Broadcast Extension ͸σϦέʔτͳͷͰۃྗ৮Γͨ͘ͳ͍

Slide 14

Slide 14 text

9DPEFͷ0SHBOJ[FSΛཔΔ ˠ಺༰Λཧղ͢Δͷʹܦݧ͕ඞཁͩͬͨ ͨͱ͑͹4IBSFEʹEP0VUQVU1SPDFTTͱ͍͏ϝιου͸ଘࡏ͠ͳ͍

Slide 15

Slide 15 text

#SPBEDBTU&YUFOTJPOͰϩάͱͯ͠औಘ͍ͯ͠Δ ελοΫτϨʔε DBMM4UBDL4ZNCPMT ͷ৘ใΛ׆༻͢Δ ˠͪΐ͏Ͳ6OJUZ'SBNFXPSLͷΫϥογϡ΋ௐ͍ࠪͯͯ͠ E4:.·ΘΓΛௐ΂͍ͯͨ͜ͱ΋͋ΓɺͰ͖ͦ͏ͳؾ͕ͨ͠ Mirrativ tech blog - ʲiOSʳUnity Framework ͱΫϥογϡղੳͷऔΓ૊Έ

Slide 16

Slide 16 text

"QQ&YUFOTJPOͷελοΫτϨʔε৘ใ͔Β ΫϥογϡΛղੳूܭ͢Δ Ϋϥογϡ࣌ͷελοΫτϨʔεΛऔಘ͢Δ E4:.ϑΝΠϧΛͱͬͯ͘Δ BUPTίϚϯυͰελοΫτϨʔεΛղੳ͢Δ ղੳΛࣗಈԽͯ͠ूܭ͢Δ ΫϥογϡΛमਖ਼͢Δ ඞཁͳࡐྉΛଗ͑Δ खಈͰղੳ͢Δ ࣗಈͰղੳ͢Δ मਖ਼͢Δ

Slide 17

Slide 17 text

Ϋϥογϡ࣌ͷελοΫτϨʔεΛऔಘ͢Δ

Slide 18

Slide 18 text

Ϋϥογϡݕ஌ͱϋϯυϦϯά 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

Slide 19

Slide 19 text

ίʔϧελοΫͷऔಘ let callstack = exception.callStackSymbols.joined(separator: “\n”) // ΋͘͠͸ let callstack = Thread.callStackSymbols.joined(separator: “\n”)

Slide 20

Slide 20 text

ίʔϧελοΫͷऔಘ 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 … ͜ͷίʔϧελοΫͷ৘ใΛղੳͯ͠ɺϓϩάϥϜͷ࣮ߦߦ਺ͳͲΛಛఆ͍ͨ͠

Slide 21

Slide 21 text

E4:.ϑΝΠϧΛͱͬͯ͘Δ

Slide 22

Slide 22 text

"QQ4UPSF$POOFDU͔ΒE4:.ϑΝΠϧΛͱͬͯ͘Δ ͜ͷE4:.ϑΝΠϧ͸ͦΕͧΕ͕֤λʔήοτϥΠϒϥϦʹରԠ͍ͯ͠Δ App Store Connect

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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:.ϑΝΠϧ͕ͲͷλʔήοτϥΠϒϥϦʹରԠ͍ͯ͠Δ͔ௐ΂Δ

Slide 25

Slide 25 text

BUPTίϚϯυͰελοΫτϨʔεΛղੳ͢Δ

Slide 26

Slide 26 text

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 ] [-p | ] [-arch architecture] [-l ] [-s ] [-printHeader] [-fullPath] [-f ] [
…] … NBOίϚϯυͰ֬ೝͯ͠ΈΔ atos [-o ] [-arch architecture] [-l ] [
…] ࠓճͷΫϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ

Slide 27

Slide 27 text

BUPTʹ౉͢ύϥϝʔλE4:.ϑΝΠϧ atos [-o ] [-arch architecture] [-l ] [
…] Ϋϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ E4:.ϑΝΠϧͷύε த਎ 0 broadcast-upload 0x000000010502eaf8 broadcast-upload + 223992 ./appDsyms/310ef0bf-51fa-3535-8078-3fa06c470774.dSYM/Contents/Resources/DWARF/broadcast-upload

Slide 28

Slide 28 text

BUPTʹ౉͢ύϥϝʔλΞʔΩςΫνϟ atos [-o ] [-arch architecture] [-l ] [
…] Ϋϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ Ϋϥογϡ͕ൃੜͨ͠୺຤ͷ$16ΞʔΩςΫνϟ BSN BSNF

Slide 29

Slide 29 text

ɾΞʔΩςΫνϟΛऔಘ͢ΔͨΊͷ4XJGUͷίʔυ IUUQTHJTUHJUIVCDPNOBSVKQOBEEEDBBCFCEFC fi MFEFWJDFTXJGU ɾJ1IPOF ͷΑ͏ͳϞσϧ໊͔ΒΞʔΩςΫνϟΛऔಘ͢ΔͨΊͷTRM IUUQTHJTUHJUIVCDPNOBSVKQOGGFCEEDBDEBD fi MFEFWJDFTRM BUPTʹ౉͢ύϥϝʔλΞʔΩςΫνϟ

Slide 30

Slide 30 text

BUPTʹ౉͢ύϥϝʔλελοΫτϨʔεͷΞυϨε atos [-o ] [-arch architecture] [-l ] [
…] Ϋϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ -l 0x104ff8000 0x10502eaf8

Slide 31

Slide 31 text

atos [-o ] [-arch architecture] [-l ] [
…] Ϋϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ -l 0x104ff8000 0x10502eaf8 0 broadcast-upload 0x000000010502eaf8 broadcast-upload + 223992 " # https://stackover fl ow.com/questions/11747802/symbolicating-stack-trace-without-crash " "# BUPTʹ౉͢ύϥϝʔλελοΫτϨʔεͷΞυϨε

Slide 32

Slide 32 text

atos [-o ] [-arch architecture] [-l ] [
…] Ϋϥογϡղੳͷࡍʹඞཁͳύϥϝʔλ -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)

Slide 33

Slide 33 text

$ 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) 🎉

Slide 34

Slide 34 text

$ 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) (:0) 🎉

Slide 35

Slide 35 text

$ atos -o {path_to_dsym} -arch arm64e -l 0x104ff8000 0x10502eaf8 ࣮༻্ͷ՝୊ ɾE4:.ϑΝΠϧͷࢦఆ΍ΞυϨεͷܭࢉ͕खؒ ɾ࣮ߦʹ͕͔͔࣌ؒΔ ɹɾUJNFίϚϯυͰܭଌ͢Δͱ()[.BD#PPL1SPͰ ˠख࡞ۀͰ͸ղੳͰ͖ͳ͍͠ɺେྔͷϩάΛղੳ͢Δʹ͸Ωϟογϡ తͳ࢓૊Έ͕ඞཁ

Slide 36

Slide 36 text

ղੳΛࣗಈԽͯ͠ूܭ͢Δ

Slide 37

Slide 37 text

ղੳ༻ΞϓϦʹΑΔࣗಈԽʢ݅෼ͷΫϥογϡղੳʣ

Slide 38

Slide 38 text

ूܭ݁Ռͷྫ ൃੜճ਺ ղੳࡁΈͷελοΫτϨʔε ͜͜·Ͱ͘Ε͹֤Ϋϥογϡͷ಺༰ͱӨڹͷେ͖͕͞Ұ໨Ͱ෼͔Δ

Slide 39

Slide 39 text

ΫϥογϡΛमਖ਼͢Δ

Slide 40

Slide 40 text

Ϋϥογϡͷमਖ਼ ৄࡉ͸লུʜ ɾ഑৴தʹ4JSJΛىಈ͢ΔͱɺԻ੠σʔλͷྲྀΕ͕ෆنଇʹͳΔ ɾ഑৴தʹଞͷ௨࿩ΞϓϦͰ௨࿩Λ͢Δͱɺ૝ఆ֎ͷνϟωϧ਺Λ࣋ͬ ͨԻ੠σʔλ͕ྲྀΕͯ͘Δ ͳͲ

Slide 41

Slide 41 text

Ϋϥογϡमਖ਼ޙͷΫϥογϡ཰ͷվળ मਖ਼൛ͷϦϦʔε೔ Ϋϥογϡͷൃੜ਺Λ ໿ݮΒ͢͜ͱ͕Ͱ͖ͨʂ

Slide 42

Slide 42 text

·ͱΊ ෭࣍తʹಘΒΕͨ΋ͷ ɾΫϥογϡͷৄࡉͱ಺༁͕؆୯ʹ෼͔ΔΑ͏ʹͳͬͨ͜ͱͰɺ ɹमਖ਼Λ͢ΔࡍͷϝϦοτ΍Өڹྗͷࣄલͷઆ໌͕͠΍͘͢ͳͬͨ ɾܦݧ͕ͳ͍ͱཧղͰ͖ͳ͔ͬͨྖҬͷղ૾౓্͕͕Γɺ ɹଐਓੑΛݮΒ͢͜ͱʹܨ͕ͬͨ ɾελοΫτϨʔεͱE4:.͔ΒΫϥογϡͷৄࡉ͕ղੳͰ͖ͯɺ ɹΫϥογϡͷղফʹܨ͕ͬͨ

Slide 43

Slide 43 text

͓·͚ DBMM4UBDL4ZNCPMT͔ΒऔಘͰ͖ΔจࣈྻΛύʔε͢ΔͨΊͷϥΠϒϥϦ IUUQTHJUIVCDPNOBSVKQO$BMM4UBDL4ZNCPMT

Slide 44

Slide 44 text

͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ