forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DWARF] NFC: DWARFDataExtractor combines relocs with DataExtractor.
Requires callers to directly associate relocations with a DataExtractor used to read data from a DWARF section, which helps a callee not make assumptions about which section it is reading. This is the next step in reducing DWARFFormValue's dependence on DWARFUnit. Differential Revision: https://reviews.llvm.org/D34704 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306699 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
25 changed files
with
194 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//===- DWARFDataExtractor.h -------------------------------------*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_DEBUGINFO_DWARFDATAEXTRACTOR_H | ||
#define LLVM_DEBUGINFO_DWARFDATAEXTRACTOR_H | ||
|
||
#include "llvm/DebugInfo/DWARF/DWARFSection.h" | ||
#include "llvm/Support/DataExtractor.h" | ||
|
||
namespace llvm { | ||
|
||
/// A DataExtractor (typically for an in-memory copy of an object-file section) | ||
/// plus a relocation map for that section, if there is one. | ||
class DWARFDataExtractor : public DataExtractor { | ||
const RelocAddrMap *RelocMap = nullptr; | ||
public: | ||
/// Constructor for the normal case of extracting data from a DWARF section. | ||
/// The DWARFSection's lifetime must be at least as long as the extractor's. | ||
DWARFDataExtractor(const DWARFSection &Section, bool IsLittleEndian, | ||
uint8_t AddressSize) | ||
: DataExtractor(Section.Data, IsLittleEndian, AddressSize), | ||
RelocMap(&Section.Relocs) {} | ||
|
||
/// Constructor for cases when there are no relocations. | ||
DWARFDataExtractor(StringRef Data, bool IsLittleEndian, uint8_t AddressSize) | ||
: DataExtractor(Data, IsLittleEndian, AddressSize) {} | ||
|
||
/// Extracts a value and applies a relocation to the result if | ||
/// one exists for the given offset. | ||
uint64_t getRelocatedValue(uint32_t Size, uint32_t *Off, | ||
uint64_t *SectionIndex = nullptr) const; | ||
|
||
/// Extracts an address-sized value and applies a relocation to the result if | ||
/// one exists for the given offset. | ||
uint64_t getRelocatedAddress(uint32_t *Off, uint64_t *SecIx = nullptr) const { | ||
return getRelocatedValue(getAddressSize(), Off, SecIx); | ||
} | ||
}; | ||
|
||
} // end namespace llvm | ||
|
||
#endif // LLVM_DEBUGINFO_DWARFDATAEXTRACTOR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.