1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _LIBUNWINDSTACK_ERROR_H
18 #define _LIBUNWINDSTACK_ERROR_H
19 
20 #include <stdint.h>
21 
22 namespace unwindstack {
23 
24 enum ErrorCode : uint8_t {
25   ERROR_NONE,                 // No error.
26   ERROR_MEMORY_INVALID,       // Memory read failed.
27   ERROR_UNWIND_INFO,          // Unable to use unwind information to unwind.
28   ERROR_UNSUPPORTED,          // Encountered unsupported feature.
29   ERROR_INVALID_MAP,          // Unwind in an invalid map.
30   ERROR_MAX_FRAMES_EXCEEDED,  // The number of frames exceed the total allowed.
31   ERROR_REPEATED_FRAME,       // The last frame has the same pc/sp as the next.
32   ERROR_INVALID_ELF,          // Unwind in an invalid elf.
33 };
34 
35 struct ErrorData {
36   ErrorCode code;
37   uint64_t address;  // Only valid when code is ERROR_MEMORY_INVALID.
38                      // Indicates the failing address.
39 };
40 
41 }  // namespace unwindstack
42 
43 #endif  // _LIBUNWINDSTACK_ERROR_H
44