Mercurial > hg > CbC > CbC_llvm
comparison lib/DebugInfo/Symbolize/SymbolizableObjectFile.h @ 147:c2174574ed3a
LLVM 10
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 14 Aug 2019 16:55:33 +0900 |
parents | 803732b1fca8 |
children |
comparison
equal
deleted
inserted
replaced
134:3a76565eade5 | 147:c2174574ed3a |
---|---|
1 //===- SymbolizableObjectFile.h ---------------------------------*- C++ -*-===// | 1 //===- SymbolizableObjectFile.h ---------------------------------*- C++ -*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 // | 4 // See https://llvm.org/LICENSE.txt for license information. |
5 // This file is distributed under the University of Illinois Open Source | 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 // License. See LICENSE.TXT for details. | |
7 // | 6 // |
8 //===----------------------------------------------------------------------===// | 7 //===----------------------------------------------------------------------===// |
9 // | 8 // |
10 // This file declares the SymbolizableObjectFile class. | 9 // This file declares the SymbolizableObjectFile class. |
11 // | 10 // |
30 namespace symbolize { | 29 namespace symbolize { |
31 | 30 |
32 class SymbolizableObjectFile : public SymbolizableModule { | 31 class SymbolizableObjectFile : public SymbolizableModule { |
33 public: | 32 public: |
34 static ErrorOr<std::unique_ptr<SymbolizableObjectFile>> | 33 static ErrorOr<std::unique_ptr<SymbolizableObjectFile>> |
35 create(object::ObjectFile *Obj, std::unique_ptr<DIContext> DICtx); | 34 create(const object::ObjectFile *Obj, std::unique_ptr<DIContext> DICtx, |
35 bool UntagAddresses); | |
36 | 36 |
37 DILineInfo symbolizeCode(uint64_t ModuleOffset, FunctionNameKind FNKind, | 37 DILineInfo symbolizeCode(object::SectionedAddress ModuleOffset, |
38 FunctionNameKind FNKind, | |
38 bool UseSymbolTable) const override; | 39 bool UseSymbolTable) const override; |
39 DIInliningInfo symbolizeInlinedCode(uint64_t ModuleOffset, | 40 DIInliningInfo symbolizeInlinedCode(object::SectionedAddress ModuleOffset, |
40 FunctionNameKind FNKind, | 41 FunctionNameKind FNKind, |
41 bool UseSymbolTable) const override; | 42 bool UseSymbolTable) const override; |
42 DIGlobal symbolizeData(uint64_t ModuleOffset) const override; | 43 DIGlobal symbolizeData(object::SectionedAddress ModuleOffset) const override; |
44 std::vector<DILocal> | |
45 symbolizeFrame(object::SectionedAddress ModuleOffset) const override; | |
43 | 46 |
44 // Return true if this is a 32-bit x86 PE COFF module. | 47 // Return true if this is a 32-bit x86 PE COFF module. |
45 bool isWin32Module() const override; | 48 bool isWin32Module() const override; |
46 | 49 |
47 // Returns the preferred base of the module, i.e. where the loader would place | 50 // Returns the preferred base of the module, i.e. where the loader would place |
61 uint64_t SymbolSize, | 64 uint64_t SymbolSize, |
62 DataExtractor *OpdExtractor = nullptr, | 65 DataExtractor *OpdExtractor = nullptr, |
63 uint64_t OpdAddress = 0); | 66 uint64_t OpdAddress = 0); |
64 std::error_code addCoffExportSymbols(const object::COFFObjectFile *CoffObj); | 67 std::error_code addCoffExportSymbols(const object::COFFObjectFile *CoffObj); |
65 | 68 |
66 object::ObjectFile *Module; | 69 /// Search for the first occurence of specified Address in ObjectFile. |
70 uint64_t getModuleSectionIndexForAddress(uint64_t Address) const; | |
71 | |
72 const object::ObjectFile *Module; | |
67 std::unique_ptr<DIContext> DebugInfoContext; | 73 std::unique_ptr<DIContext> DebugInfoContext; |
74 bool UntagAddresses; | |
68 | 75 |
69 struct SymbolDesc { | 76 struct SymbolDesc { |
70 uint64_t Addr; | 77 uint64_t Addr; |
71 // If size is 0, assume that symbol occupies the whole memory range up to | 78 // If size is 0, assume that symbol occupies the whole memory range up to |
72 // the following symbol. | 79 // the following symbol. |
73 uint64_t Size; | 80 uint64_t Size; |
74 | 81 |
75 friend bool operator<(const SymbolDesc &s1, const SymbolDesc &s2) { | 82 bool operator<(const SymbolDesc &RHS) const { |
76 return s1.Addr < s2.Addr; | 83 return Addr != RHS.Addr ? Addr < RHS.Addr : Size < RHS.Size; |
77 } | 84 } |
78 }; | 85 }; |
79 std::map<SymbolDesc, StringRef> Functions; | 86 std::vector<std::pair<SymbolDesc, StringRef>> Functions; |
80 std::map<SymbolDesc, StringRef> Objects; | 87 std::vector<std::pair<SymbolDesc, StringRef>> Objects; |
81 | 88 |
82 SymbolizableObjectFile(object::ObjectFile *Obj, | 89 SymbolizableObjectFile(const object::ObjectFile *Obj, |
83 std::unique_ptr<DIContext> DICtx); | 90 std::unique_ptr<DIContext> DICtx, |
91 bool UntagAddresses); | |
84 }; | 92 }; |
85 | 93 |
86 } // end namespace symbolize | 94 } // end namespace symbolize |
87 | 95 |
88 } // end namespace llvm | 96 } // end namespace llvm |