Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
DebugFrameDataSubsection.cpp
Go to the documentation of this file.
1//===- DebugFrameDataSubsection.cpp -----------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h"
10#include "llvm/DebugInfo/CodeView/CodeViewError.h"
11#include "llvm/Support/BinaryStreamReader.h"
12#include "llvm/Support/BinaryStreamWriter.h"
13
14using namespacellvm;
15using namespacellvm::codeview;
16
17ErrorDebugFrameDataSubsectionRef::initialize(BinaryStreamReader Reader) {
18if (Reader.bytesRemaining() %sizeof(FrameData) != 0) {
19if (autoEC = Reader.readObject(RelocPtr))
20returnEC;
21 }
22
23if (Reader.bytesRemaining() %sizeof(FrameData) != 0)
24return make_error<CodeViewError>(cv_error_code::corrupt_record,
25"Invalid frame data record format!");
26
27uint32_t Count = Reader.bytesRemaining() /sizeof(FrameData);
28if (autoEC = Reader.readArray(Frames, Count))
29returnEC;
30returnError::success();
31}
32
33ErrorDebugFrameDataSubsectionRef::initialize(BinaryStreamRef Section) {
34BinaryStreamReader Reader(Section);
35returninitialize(Reader);
36}
37
38uint32_tDebugFrameDataSubsection::calculateSerializedSize() const{
39uint32_tSize =sizeof(FrameData) * Frames.size();
40if (IncludeRelocPtr)
41Size +=sizeof(uint32_t);
42returnSize;
43}
44
45ErrorDebugFrameDataSubsection::commit(BinaryStreamWriter &Writer) const{
46if (IncludeRelocPtr) {
47if (autoEC = Writer.writeInteger<uint32_t>(0))
48returnEC;
49 }
50
51 std::vector<FrameData> SortedFrames(Frames.begin(), Frames.end());
52llvm::sort(SortedFrames, [](constFrameData &LHS,constFrameData &RHS) {
53returnLHS.RvaStart <RHS.RvaStart;
54 });
55if (autoEC = Writer.writeArray(ArrayRef(SortedFrames)))
56returnEC;
57returnError::success();
58}
59
60voidDebugFrameDataSubsection::addFrameData(constFrameData &Frame) {
61 Frames.push_back(Frame);
62}
BinaryStreamReader.h
BinaryStreamWriter.h
CodeViewError.h
DebugFrameDataSubsection.h
Size
uint64_t Size
Definition:ELFObjHandler.cpp:81
RHS
Value * RHS
Definition:X86PartialReduction.cpp:74
LHS
Value * LHS
Definition:X86PartialReduction.cpp:73
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::BinaryStreamReader
Provides read only access to a subclass of BinaryStream.
Definition:BinaryStreamReader.h:29
llvm::BinaryStreamReader::readObject
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
Definition:BinaryStreamReader.h:160
llvm::BinaryStreamReader::bytesRemaining
uint64_t bytesRemaining() const
Definition:BinaryStreamReader.h:248
llvm::BinaryStreamReader::readArray
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
Definition:BinaryStreamReader.h:178
llvm::BinaryStreamRef
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Definition:BinaryStreamRef.h:154
llvm::BinaryStreamWriter
Provides write only access to a subclass of WritableBinaryStream.
Definition:BinaryStreamWriter.h:30
llvm::BinaryStreamWriter::writeArray
Error writeArray(ArrayRef< T > Array)
Writes an array of objects of type T to the underlying stream, as if by using memcpy.
Definition:BinaryStreamWriter.h:144
llvm::BinaryStreamWriter::writeInteger
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
Definition:BinaryStreamWriter.h:58
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition:Error.h:160
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition:Error.h:337
llvm::codeview::DebugFrameDataSubsectionRef::initialize
Error initialize(BinaryStreamReader Reader)
Definition:DebugFrameDataSubsection.cpp:17
llvm::codeview::DebugFrameDataSubsection::commit
Error commit(BinaryStreamWriter &Writer) const override
Definition:DebugFrameDataSubsection.cpp:45
llvm::codeview::DebugFrameDataSubsection::calculateSerializedSize
uint32_t calculateSerializedSize() const override
Definition:DebugFrameDataSubsection.cpp:38
llvm::codeview::DebugFrameDataSubsection::addFrameData
void addFrameData(const FrameData &Frame)
Definition:DebugFrameDataSubsection.cpp:60
uint32_t
llvm::codeview
Definition:AppendingTypeTableBuilder.h:22
llvm::codeview::cv_error_code::corrupt_record
@ corrupt_record
llvm::codeview::CompileSym2Flags::EC
@ EC
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition:STLExtras.h:1664
llvm::codeview::FrameData
Data in the SUBSEC_FRAMEDATA subection.
Definition:CodeView.h:584

Generated on Fri Jul 18 2025 11:08:39 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp