MapInfo.h revision 6f3981c181677830c33093411b51ad6b0bf2e337
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#ifndef _LIBUNWINDSTACK_MAP_INFO_H
18#define _LIBUNWINDSTACK_MAP_INFO_H
19
20#include <stdint.h>
21
22#include <string>
23
24namespace unwindstack {
25
26// Forward declarations.
27class Elf;
28class Memory;
29
30struct MapInfo {
31  uint64_t start;
32  uint64_t end;
33  uint64_t offset;
34  uint16_t flags;
35  std::string name;
36  Elf* elf = nullptr;
37  // This value is only non-zero if the offset is non-zero but there is
38  // no elf signature found at that offset. This indicates that the
39  // entire file is represented by the Memory object returned by CreateMemory,
40  // instead of a portion of the file.
41  uint64_t elf_offset;
42
43  Memory* CreateMemory(pid_t pid);
44  // This function guarantees it will never return nullptr.
45  Elf* GetElf(pid_t pid, bool init_gnu_debugdata = false);
46};
47
48}  // namespace unwindstack
49
50#endif  // _LIBUNWINDSTACK_MAP_INFO_H
51