xref: /aosp_15_r20/system/unwinding/libunwindstack/include/unwindstack/DwarfLocation.h (revision eb293b8f56ee8303637c5595cfcdeef8039e85c6)
1 /*
2  * Copyright (C) 2016 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 #pragma once
18 
19 #include <stdint.h>
20 
21 #include <unordered_map>
22 
23 namespace unwindstack {
24 
25 struct DwarfCie;
26 
27 enum DwarfLocationEnum : uint8_t {
28   DWARF_LOCATION_INVALID = 0,
29   DWARF_LOCATION_UNDEFINED,
30   DWARF_LOCATION_OFFSET,
31   DWARF_LOCATION_VAL_OFFSET,
32   DWARF_LOCATION_REGISTER,
33   DWARF_LOCATION_EXPRESSION,
34   DWARF_LOCATION_VAL_EXPRESSION,
35   DWARF_LOCATION_PSEUDO_REGISTER,
36 };
37 
38 struct DwarfLocation {
39   DwarfLocationEnum type;
40   uint64_t values[2];
41 };
42 
43 struct DwarfLocations : public std::unordered_map<uint32_t, DwarfLocation> {
44   const DwarfCie* cie;
45   // The range of PCs where the locations are valid (end is exclusive).
46   uint64_t pc_start = 0;
47   uint64_t pc_end = 0;
48 };
49 
50 }  // namespace unwindstack
51