17 "Invalid offset for a buffer extent (%d).",
20 auto PreReadOffset = OffsetPtr;
21 R.Size = E.
getU64(&OffsetPtr);
22 if (PreReadOffset == OffsetPtr)
24 "Cannot read buffer extent at offset %d.",
35 "Invalid offset for a wallclock record (%d).",
37 auto BeginOffset = OffsetPtr;
38 auto PreReadOffset = OffsetPtr;
39 R.Seconds = E.
getU64(&OffsetPtr);
40 if (OffsetPtr == PreReadOffset)
43 "Cannot read wall clock 'seconds' field at offset %d.", OffsetPtr);
45 PreReadOffset = OffsetPtr;
46 R.Nanos = E.
getU32(&OffsetPtr);
47 if (OffsetPtr == PreReadOffset)
50 "Cannot read wall clock 'nanos' field at offset %d.", OffsetPtr);
62 "Invalid offset for a new cpu id record (%d).",
64 auto BeginOffset = OffsetPtr;
65 auto PreReadOffset = OffsetPtr;
66 R.CPUId = E.
getU16(&OffsetPtr);
67 if (OffsetPtr == PreReadOffset)
69 "Cannot read CPU id at offset %d.", OffsetPtr);
71 PreReadOffset = OffsetPtr;
72 R.TSC = E.
getU64(&OffsetPtr);
73 if (OffsetPtr == PreReadOffset)
75 "Cannot read CPU TSC at offset %d.", OffsetPtr);
85 "Invalid offset for a new TSC wrap record (%d).",
88 auto PreReadOffset = OffsetPtr;
89 R.BaseTSC = E.
getU64(&OffsetPtr);
90 if (PreReadOffset == OffsetPtr)
92 "Cannot read TSC wrap record at offset %d.",
103 "Invalid offset for a custom event record (%d).",
106 auto BeginOffset = OffsetPtr;
107 auto PreReadOffset = OffsetPtr;
108 R.Size = E.
getSigned(&OffsetPtr,
sizeof(int32_t));
109 if (PreReadOffset == OffsetPtr)
112 "Cannot read a custom event record size field offset %d.", OffsetPtr);
117 "Invalid size for custom event (size = %d) at offset %d.", R.Size,
120 PreReadOffset = OffsetPtr;
121 R.TSC = E.
getU64(&OffsetPtr);
122 if (PreReadOffset == OffsetPtr)
125 "Cannot read a custom event TSC field at offset %d.", OffsetPtr);
130 PreReadOffset = OffsetPtr;
131 R.CPU = E.
getU16(&OffsetPtr);
132 if (PreReadOffset == OffsetPtr)
135 "Missing CPU field at offset %d", OffsetPtr);
138 assert(OffsetPtr > BeginOffset &&
146 "Cannot read %d bytes of custom event data from offset %d.", R.Size,
149 std::vector<uint8_t> Buffer;
150 Buffer.resize(R.Size);
151 PreReadOffset = OffsetPtr;
152 if (E.
getU8(&OffsetPtr, Buffer.data(), R.Size) != Buffer.data())
155 "Failed reading data into buffer of size %d at offset %d.", R.Size,
158 assert(OffsetPtr >= PreReadOffset);
159 if (OffsetPtr - PreReadOffset != static_cast<uint32_t>(R.Size))
162 "Failed reading enough bytes for the custom event payload -- read %d " 163 "expecting %d bytes at offset %d.",
164 OffsetPtr - PreReadOffset, R.Size, PreReadOffset);
166 R.Data.assign(Buffer.begin(), Buffer.end());
174 "Invalid offset for a custom event record (%d).",
177 auto BeginOffset = OffsetPtr;
178 auto PreReadOffset = OffsetPtr;
180 R.Size = E.
getSigned(&OffsetPtr,
sizeof(int32_t));
181 if (PreReadOffset == OffsetPtr)
184 "Cannot read a custom event record size field offset %d.", OffsetPtr);
189 "Invalid size for custom event (size = %d) at offset %d.", R.Size,
192 PreReadOffset = OffsetPtr;
193 R.Delta = E.
getSigned(&OffsetPtr,
sizeof(int32_t));
194 if (PreReadOffset == OffsetPtr)
197 "Cannot read a custom event record TSC delta field at offset %d.",
200 assert(OffsetPtr > BeginOffset &&
208 "Cannot read %d bytes of custom event data from offset %d.", R.Size,
211 std::vector<uint8_t> Buffer;
212 Buffer.resize(R.Size);
213 PreReadOffset = OffsetPtr;
214 if (E.
getU8(&OffsetPtr, Buffer.data(), R.Size) != Buffer.data())
217 "Failed reading data into buffer of size %d at offset %d.", R.Size,
220 assert(OffsetPtr >= PreReadOffset);
221 if (OffsetPtr - PreReadOffset != static_cast<uint32_t>(R.Size))
224 "Failed reading enough bytes for the custom event payload -- read %d " 225 "expecting %d bytes at offset %d.",
226 OffsetPtr - PreReadOffset, R.Size, PreReadOffset);
228 R.Data.assign(Buffer.begin(), Buffer.end());
236 "Invalid offset for a typed event record (%d).",
239 auto BeginOffset = OffsetPtr;
240 auto PreReadOffset = OffsetPtr;
242 R.Size = E.
getSigned(&OffsetPtr,
sizeof(int32_t));
243 if (PreReadOffset == OffsetPtr)
246 "Cannot read a typed event record size field offset %d.", OffsetPtr);
251 "Invalid size for typed event (size = %d) at offset %d.", R.Size,
254 PreReadOffset = OffsetPtr;
255 R.Delta = E.
getSigned(&OffsetPtr,
sizeof(int32_t));
256 if (PreReadOffset == OffsetPtr)
259 "Cannot read a typed event record TSC delta field at offset %d.",
262 PreReadOffset = OffsetPtr;
263 R.EventType = E.
getU16(&OffsetPtr);
264 if (PreReadOffset == OffsetPtr)
267 "Cannot read a typed event record type field at offset %d.", OffsetPtr);
269 assert(OffsetPtr > BeginOffset &&
277 "Cannot read %d bytes of custom event data from offset %d.", R.Size,
280 std::vector<uint8_t> Buffer;
281 Buffer.resize(R.Size);
282 PreReadOffset = OffsetPtr;
283 if (E.
getU8(&OffsetPtr, Buffer.data(), R.Size) != Buffer.data())
286 "Failed reading data into buffer of size %d at offset %d.", R.Size,
289 assert(OffsetPtr >= PreReadOffset);
290 if (OffsetPtr - PreReadOffset != static_cast<uint32_t>(R.Size))
293 "Failed reading enough bytes for the typed event payload -- read %d " 294 "expecting %d bytes at offset %d.",
295 OffsetPtr - PreReadOffset, R.Size, PreReadOffset);
297 R.Data.assign(Buffer.begin(), Buffer.end());
305 "Invalid offset for a call argument record (%d).",
308 auto PreReadOffset = OffsetPtr;
309 R.Arg = E.
getU64(&OffsetPtr);
310 if (PreReadOffset == OffsetPtr)
312 "Cannot read a call arg record at offset %d.",
323 "Invalid offset for a process ID record (%d).",
326 auto PreReadOffset = OffsetPtr;
328 if (PreReadOffset == OffsetPtr)
330 "Cannot read a process ID record at offset %d.",
341 "Invalid offset for a new buffer record (%d).",
344 auto PreReadOffset = OffsetPtr;
345 R.TID = E.
getSigned(&OffsetPtr,
sizeof(int32_t));
346 if (PreReadOffset == OffsetPtr)
348 "Cannot read a new buffer record at offset %d.",
359 "Invalid offset for an end-of-buffer record (%d).",
376 --OffsetPtr, FunctionRecord::kFunctionRecordSize))
378 "Invalid offset for a function record (%d).",
381 auto BeginOffset = OffsetPtr;
382 auto PreReadOffset = BeginOffset;
384 if (PreReadOffset == OffsetPtr)
386 "Cannot read function id field from offset %d.",
393 switch (FunctionType) {
402 "Unknown function record type '%d' at offset %d.",
403 FunctionType, BeginOffset);
406 R.FuncId = Buffer >> 4;
407 PreReadOffset = OffsetPtr;
408 R.Delta = E.
getU32(&OffsetPtr);
409 if (OffsetPtr == PreReadOffset)
411 "Failed reading TSC delta from offset %d.",
413 assert(FunctionRecord::kFunctionRecordSize == (OffsetPtr - BeginOffset));
This class represents lattice values for constants.
std::error_code make_error_code(BitcodeError E)
Class to represent function types.
RecordTypes
Determines the supported types of records that could be seen in XRay traces.
static ErrorSuccess success()
Create a success value.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Error visit(BufferExtents &) override
Lightweight error class with error context and mandatory checking.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.