Lines Matching +full:address +full:- +full:data

1 //===- InlineInfo.cpp -------------------------------------------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
64 /// Skip an InlineInfo object in the specified data at the specified offset.
71 /// \param Data The binary stream to read the data from.
73 /// \param Offset The byte offset within \a Data.
75 /// \param SkippedRanges If true, address ranges have already been skipped.
77 static bool skip(DataExtractor &Data, uint64_t &Offset, bool SkippedRanges) {
79 if (skipRanges(Data, Offset) == 0)
82 bool HasChildren = Data.getU8(&Offset) != 0;
83 Data.getU32(&Offset); // Skip Inline.Name.
84 Data.getULEB128(&Offset); // Skip Inline.CallFile.
85 Data.getULEB128(&Offset); // Skip Inline.CallLine.
87 while (skip(Data, Offset, false /* SkippedRanges */))
97 /// InlineInfo object if the address falls within this object. This avoids
100 /// not contain the address we are looking up.
102 /// \param Data The binary stream to read the data from.
104 /// \param Offset The byte offset within \a Data.
106 /// \param BaseAddr The address that the relative address range offsets are
109 static bool lookup(const GsymReader &GR, DataExtractor &Data, uint64_t &Offset,
113 decodeRanges(Inline.Ranges, Data, BaseAddr, Offset);
116 // Check if the address is contained within the inline information, and if
119 skip(Data, Offset, true /* SkippedRanges */);
123 // The address range is contained within this InlineInfo, add the source
124 // location for this InlineInfo and any children that contain the address.
125 bool HasChildren = Data.getU8(&Offset) != 0;
126 Inline.Name = Data.getU32(&Offset);
127 Inline.CallFile = (uint32_t)Data.getULEB128(&Offset);
128 Inline.CallLine = (uint32_t)Data.getULEB128(&Offset);
130 // Child address ranges are encoded relative to the first address in the
135 Done = lookup(GR, Data, Offset, ChildBaseAddr, Addr, SrcLocs, Err);
146 if (CallFile->Dir || CallFile->Base) {
150 SrcLoc.Dir = GR.getString(CallFile->Dir);
151 SrcLoc.Base = GR.getString(CallFile->Base);
154 SrcLocs.back().Offset = Addr - Inline.Ranges[0].start();
160 llvm::Error InlineInfo::lookup(const GsymReader &GR, DataExtractor &Data,
166 ::lookup(GR, Data, Offset, BaseAddr, Addr, SrcLocs, Err);
170 /// Decode an InlineInfo in Data at the specified offset.
175 /// \param Data The data extractor to decode from.
176 /// \param Offset The offset within \a Data to decode from.
177 /// \param BaseAddr The base address to use when decoding address ranges.
180 static llvm::Expected<InlineInfo> decode(DataExtractor &Data, uint64_t &Offset,
183 if (!Data.isValidOffset(Offset))
185 "0x%8.8" PRIx64 ": missing InlineInfo address ranges data", Offset);
186 decodeRanges(Inline.Ranges, Data, BaseAddr, Offset);
189 if (!Data.isValidOffsetForDataOfSize(Offset, 1))
193 bool HasChildren = Data.getU8(&Offset) != 0;
194 if (!Data.isValidOffsetForDataOfSize(Offset, 4))
197 Inline.Name = Data.getU32(&Offset);
198 if (!Data.isValidOffset(Offset))
201 Inline.CallFile = (uint32_t)Data.getULEB128(&Offset);
202 if (!Data.isValidOffset(Offset))
205 Inline.CallLine = (uint32_t)Data.getULEB128(&Offset);
207 // Child address ranges are encoded relative to the first address in the
211 llvm::Expected<InlineInfo> Child = decode(Data, Offset, ChildBaseAddr);
223 llvm::Expected<InlineInfo> InlineInfo::decode(DataExtractor &Data,
226 return ::decode(Data, Offset, BaseAddr);
243 // Child address ranges are encoded as relative to the first
244 // address in the Ranges for this object. This keeps the offsets
248 // Make sure all child address ranges are contained in the parent address