LLVM
24.0.0git
include
llvm
DebugInfo
GSYM
GsymDataExtractor.h
Go to the documentation of this file.
1
//===- GsymDataExtractor.h --------------------------------------*- 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
#ifndef LLVM_DEBUGINFO_GSYM_GSYMDATAEXTRACTOR_H
10
#define LLVM_DEBUGINFO_GSYM_GSYMDATAEXTRACTOR_H
11
12
#include "
llvm/Support/DataExtractor.h
"
13
14
namespace
llvm
{
15
namespace
gsym
{
16
17
/// A DataExtractor subclass that adds GSYM-specific string offset support.
18
///
19
/// GSYM files use variable-width string offsets (1-8 bytes). This subclass
20
/// adds getStringOffsetSize() and getStringOffset() methods to support reading
21
/// string offsets of the configured size.
22
class
GsymDataExtractor
:
public
DataExtractor
{
23
uint8_t
StringOffsetSize;
24
25
public
:
26
/// Construct from raw bytes.
27
GsymDataExtractor
(
StringRef
Data,
bool
IsLittleEndian,
28
uint8_t
StringOffsetSize = 8)
29
:
DataExtractor
(Data, IsLittleEndian),
30
StringOffsetSize(StringOffsetSize) {}
31
32
/// Construct a sub-range extractor from a parent, copying its endianness
33
/// and string offset size.
34
GsymDataExtractor
(
const
GsymDataExtractor
&Parent,
uint64_t
Offset
,
35
uint64_t
Length
)
36
:
DataExtractor
(Parent.
getData
().
substr
(
Offset
,
Length
),
37
Parent.
isLittleEndian
()),
38
StringOffsetSize(Parent.
getStringOffsetSize
()) {}
39
40
/// Get the string offset size in bytes.
41
uint8_t
getStringOffsetSize
()
const
{
return
StringOffsetSize; }
42
43
/// Extract a string offset of StringOffsetSize bytes from \a *offset_ptr.
44
uint64_t
getStringOffset
(
uint64_t
*offset_ptr)
const
{
45
return
getUnsigned
(offset_ptr, StringOffsetSize);
46
}
47
48
/// Extract a string offset of StringOffsetSize bytes from the location given
49
/// by the cursor.
50
uint64_t
getStringOffset
(
Cursor
&
C
)
const
{
51
return
getUnsigned
(
C
, StringOffsetSize);
52
}
53
};
54
55
}
// namespace gsym
56
}
// namespace llvm
57
58
#endif
// LLVM_DEBUGINFO_GSYM_GSYMDATAEXTRACTOR_H
C
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
DataExtractor.h
substr
static StringRef substr(StringRef Str, uint64_t Len)
Definition
SimplifyLibCalls.cpp:370
llvm::DataExtractor::Cursor
A class representing a position in a DataExtractor, as well as any error encountered during extractio...
Definition
DataExtractor.h:51
llvm::DataExtractor::getUnsigned
LLVM_ABI uint64_t getUnsigned(uint64_t *offset_ptr, uint32_t byte_size, Error *Err=nullptr) const
Extract an unsigned integer of size byte_size from *offset_ptr.
Definition
DataExtractor.cpp:126
llvm::DataExtractor::DataExtractor
DataExtractor(StringRef Data, bool IsLittleEndian)
Construct with a buffer that is owned by the caller.
Definition
DataExtractor.h:83
llvm::DataExtractor::getData
StringRef getData() const
Get the data pointed to by this extractor.
Definition
DataExtractor.h:92
llvm::DataExtractor::isLittleEndian
bool isLittleEndian() const
Get the endianness for this extractor.
Definition
DataExtractor.h:94
llvm::StringRef
Represent a constant reference to a string, i.e.
Definition
StringRef.h:56
llvm::gsym::GsymDataExtractor::getStringOffset
uint64_t getStringOffset(Cursor &C) const
Extract a string offset of StringOffsetSize bytes from the location given by the cursor.
Definition
GsymDataExtractor.h:50
llvm::gsym::GsymDataExtractor::getStringOffsetSize
uint8_t getStringOffsetSize() const
Get the string offset size in bytes.
Definition
GsymDataExtractor.h:41
llvm::gsym::GsymDataExtractor::GsymDataExtractor
GsymDataExtractor(StringRef Data, bool IsLittleEndian, uint8_t StringOffsetSize=8)
Construct from raw bytes.
Definition
GsymDataExtractor.h:27
llvm::gsym::GsymDataExtractor::getStringOffset
uint64_t getStringOffset(uint64_t *offset_ptr) const
Extract a string offset of StringOffsetSize bytes from *offset_ptr.
Definition
GsymDataExtractor.h:44
llvm::gsym::GsymDataExtractor::GsymDataExtractor
GsymDataExtractor(const GsymDataExtractor &Parent, uint64_t Offset, uint64_t Length)
Construct a sub-range extractor from a parent, copying its endianness and string offset size.
Definition
GsymDataExtractor.h:34
uint64_t
uint8_t
llvm::gsym
Definition
CallSiteInfo.h:27
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
FunctionInfo.h:25
llvm::Offset
@ Offset
Definition
DWP.cpp:578
llvm::Length
@ Length
Definition
DWP.cpp:578
Generated on
for LLVM by
1.14.0