This repository was archived by the owner on Jan 31, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 358
Expand file tree
/
Copy pathCallstackType.cpp
More file actions
94 lines (86 loc) · 3.99 KB
/
Copy pathCallstackType.cpp
File metadata and controls
94 lines (86 loc) · 3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright (c) 2022 The Orbit Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ClientData/CallstackType.h"
#include "OrbitBase/Logging.h"
using orbit_grpc_protos::Callstack;
namespace orbit_client_data {
std::string CallstackTypeToString(CallstackType callstack_type) {
switch (callstack_type) {
case CallstackType::kComplete:
return "Complete";
case CallstackType::kDwarfUnwindingError:
return "DWARF unwinding error";
case CallstackType::kFramePointerUnwindingError:
return "Frame pointer unwinding error";
case CallstackType::kInUprobes:
return "Callstack inside uprobes (kernel)";
case CallstackType::kInUserSpaceInstrumentation:
return "Callstack inside user-space instrumentation";
case CallstackType::kCallstackPatchingFailed:
return "Callstack patching failed";
case CallstackType::kStackTopForDwarfUnwindingTooSmall:
return "Collected raw stack is too small";
case CallstackType::kStackTopDwarfUnwindingError:
return "DWARF unwinding error in inner frame";
case CallstackType::kFilteredByMajorityOutermostFrame:
return "Unknown unwinding error";
}
ORBIT_UNREACHABLE();
}
std::string CallstackTypeToDescription(CallstackType callstack_type) {
switch (callstack_type) {
case CallstackType::kComplete:
return "Unwinding succeeded.";
case CallstackType::kDwarfUnwindingError:
return "DWARF unwinding failed on the collected sample.";
case CallstackType::kFramePointerUnwindingError:
return "Frame pointer unwinding failed on the collected sample. Likely, the callstack "
"contains a function not compiled with frame pointers (-fno-omit-frame-pointer).";
case CallstackType::kInUprobes:
return "The collected callstack falls inside uprobes (kernel) code.";
case CallstackType::kInUserSpaceInstrumentation:
return "The collected callstack falls inside the user-space instrumentation code.";
case CallstackType::kCallstackPatchingFailed:
return "Repairing a callstack that contains dynamically instrumented functions failed.";
case CallstackType::kStackTopForDwarfUnwindingTooSmall:
return "The collected raw stack is too small to unwind. You can increase the size to collect "
"in the capture options.";
case CallstackType::kStackTopDwarfUnwindingError:
return "DWARF unwinding the inner frame to patch a leaf function (-momit-leaf-frame-pointer) "
"failed.";
case CallstackType::kFilteredByMajorityOutermostFrame:
return "The outermost frame does not match the majority for this thread, so the callstack "
"has been marked as unwound incorrectly.";
}
ORBIT_UNREACHABLE();
}
CallstackType GrpcCallstackTypeToCallstackType(
orbit_grpc_protos::Callstack::CallstackType callstack_type) {
switch (callstack_type) {
case Callstack::kComplete:
return CallstackType::kComplete;
case Callstack::kDwarfUnwindingError:
return CallstackType::kDwarfUnwindingError;
case Callstack::kFramePointerUnwindingError:
return CallstackType::kFramePointerUnwindingError;
case Callstack::kInUprobes:
return CallstackType::kInUprobes;
case Callstack::kInUserSpaceInstrumentation:
return CallstackType::kInUserSpaceInstrumentation;
case Callstack::kCallstackPatchingFailed:
return CallstackType::kCallstackPatchingFailed;
case Callstack::kStackTopForDwarfUnwindingTooSmall:
return CallstackType::kStackTopForDwarfUnwindingTooSmall;
case Callstack::kStackTopDwarfUnwindingError:
return CallstackType::kStackTopDwarfUnwindingError;
case orbit_grpc_protos::
Callstack_CallstackType_Callstack_CallstackType_INT_MIN_SENTINEL_DO_NOT_USE_:
ORBIT_UNREACHABLE();
case orbit_grpc_protos::
Callstack_CallstackType_Callstack_CallstackType_INT_MAX_SENTINEL_DO_NOT_USE_:
ORBIT_UNREACHABLE();
}
ORBIT_UNREACHABLE();
}
} // namespace orbit_client_data