MapInfo.h revision 5f118519fd323a0c71b54de9279e8a9ea6a56271
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 // This function guarantees it will never return nullptr. 44 Elf* GetElf(const std::shared_ptr<Memory>& process_memory, bool init_gnu_debugdata = false); 45 46 private: 47 Memory* GetFileMemory(); 48 49 Memory* CreateMemory(const std::shared_ptr<Memory>& process_memory); 50}; 51 52} // namespace unwindstack 53 54#endif // _LIBUNWINDSTACK_MAP_INFO_H 55