MCPcopy Create free account
hub / github.com/NVIDIA/cuda-tile / parseDebugSection

Function parseDebugSection

lib/Bytecode/Reader/BytecodeReader.cpp:1901–1987  ·  view source on GitHub ↗

debuginfo-section =: diOpsNum[varint] // Total number of operations with debug info padding[bytes] // Align to 4 bytes diIndexOffsets[uint32_t] // Per op offset into the debug info indices diIndicesNum[varint] // Total number of debug info indices padding[bytes] // Align to 8 bytes diIndices[uint64_t] // Array of debug indices to debug info attributes diA

Source from the content-addressed store, hash-verified

1899// DebugTag[byte] // Indicates the debug info attribute type
1900// debuginfo-encoding // Format depends on DebugTag
1901static LogicalResult parseDebugSection(ArrayRef<uint8_t> payload,
1902 DebugInfoReader &debuginfo,
1903 MLIRContext &context) {
1904 EncodingReader reader(payload, context);
1905
1906 // Read the total number of operations with debug info.
1907 uint64_t diOpsNum;
1908 if (failed(reader.readVarInt(diOpsNum)))
1909 return reader.emitError()
1910 << "failed to read total number of operations with debug info";
1911
1912 // Align to 4 bits for the uint32_t diIndexOffsetsPtr.
1913 auto alignment = alignof(uint32_t);
1914 if (failed(reader.skipPadding(alignment)))
1915 return reader.emitError()
1916 << "failed to skip padding for debug info index offset pointer";
1917
1918 // Read the per op offset into the debug info indices.
1919 const uint32_t *diIndexOffsetsPtr =
1920 reinterpret_cast<const uint32_t *>(reader.getCurrentPtr());
1921 if (!diIndexOffsetsPtr)
1922 return reader.emitError()
1923 << "failed to read debug info index offset pointer.";
1924
1925 ArrayRef<uint32_t> diIndexOffsets(diIndexOffsetsPtr, diOpsNum);
1926 if (failed(reader.skip(diOpsNum * sizeof(uint32_t))))
1927 return reader.emitError() << "failed to skip debug info index offsets";
1928
1929 // Read the total number of debug info indices.
1930 uint64_t diIndicesNum = 0;
1931 if (failed(reader.readVarInt(diIndicesNum)))
1932 return reader.emitError()
1933 << "failed to read total number of debug info indices";
1934
1935 // Align to 8 bytes for the uint64_t diIndicesPtr.
1936 auto uint64Alignment = alignof(uint64_t);
1937 if (failed(reader.skipPadding(uint64Alignment)))
1938 return reader.emitError()
1939 << "failed to skip padding for debug info indices pointer";
1940
1941 // Read the array of debug indices to debug info attributes.
1942 const uint64_t *diIndicesPtr =
1943 reinterpret_cast<const uint64_t *>(reader.getCurrentPtr());
1944 if (!diIndicesPtr)
1945 return reader.emitError() << "failed to read debug info indices pointer";
1946
1947 ArrayRef<uint64_t> diIndices(diIndicesPtr, diIndicesNum);
1948 if (failed(reader.skip(diIndicesNum * sizeof(uint64_t))))
1949 return reader.emitError() << "failed to skip debug info indices";
1950
1951 // Read the total number of debug info attributes.
1952 uint64_t diAttrNum;
1953 if (failed(reader.readVarInt(diAttrNum)))
1954 return reader.emitError()
1955 << "failed to read total number of debug info attributes";
1956
1957 if (diAttrNum >
1958 (payload.size() - reader.currentOffset()) / sizeof(uint32_t)) {

Callers 1

readBytecodeMethod · 0.85

Calls 8

readVarIntMethod · 0.80
emitErrorMethod · 0.80
skipPaddingMethod · 0.80
getCurrentPtrMethod · 0.80
skipMethod · 0.80
sizeMethod · 0.80
currentOffsetMethod · 0.80
initializeMethod · 0.45

Tested by

no test coverage detected