1 |
efrain |
1 |
// Copyright 2019 Google
|
|
|
2 |
//
|
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
|
5 |
// You may obtain a copy of the License at
|
|
|
6 |
//
|
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
8 |
//
|
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
12 |
// See the License for the specific language governing permissions and
|
|
|
13 |
// limitations under the License.
|
|
|
14 |
|
|
|
15 |
#include "Crashlytics/Crashlytics/Handlers/FIRCLSHandler.h"
|
|
|
16 |
|
|
|
17 |
#include "Crashlytics/Crashlytics/Components/FIRCLSCrashedMarkerFile.h"
|
|
|
18 |
#include "Crashlytics/Crashlytics/Components/FIRCLSGlobals.h"
|
|
|
19 |
#include "Crashlytics/Crashlytics/Components/FIRCLSHost.h"
|
|
|
20 |
#include "Crashlytics/Crashlytics/Components/FIRCLSProcess.h"
|
|
|
21 |
#include "Crashlytics/Crashlytics/Helpers/FIRCLSUtility.h"
|
|
|
22 |
|
|
|
23 |
#import "Crashlytics/Crashlytics/Controllers/FIRCLSReportManager_Private.h"
|
|
|
24 |
|
|
|
25 |
void FIRCLSHandler(FIRCLSFile* file, thread_t crashedThread, void* uapVoid) {
|
|
|
26 |
FIRCLSProcess process;
|
|
|
27 |
|
|
|
28 |
FIRCLSProcessInit(&process, crashedThread, uapVoid);
|
|
|
29 |
|
|
|
30 |
FIRCLSProcessSuspendAllOtherThreads(&process);
|
|
|
31 |
|
|
|
32 |
FIRCLSProcessRecordAllThreads(&process, file);
|
|
|
33 |
|
|
|
34 |
FIRCLSProcessRecordRuntimeInfo(&process, file);
|
|
|
35 |
// Get dispatch queue and thread names. Note that getting the thread names
|
|
|
36 |
// can hang, so let's do that last
|
|
|
37 |
FIRCLSProcessRecordDispatchQueueNames(&process, file);
|
|
|
38 |
FIRCLSProcessRecordThreadNames(&process, file);
|
|
|
39 |
|
|
|
40 |
// this stuff isn't super important, but we can try
|
|
|
41 |
FIRCLSProcessRecordStats(&process, file);
|
|
|
42 |
FIRCLSHostWriteDiskUsage(file);
|
|
|
43 |
|
|
|
44 |
// This is the first common point where various crash handlers call into
|
|
|
45 |
// Store a crash file marker to indicate that a crash has occured
|
|
|
46 |
FIRCLSCreateCrashedMarkerFile();
|
|
|
47 |
|
|
|
48 |
FIRCLSProcessResumeAllOtherThreads(&process);
|
|
|
49 |
}
|