LLDB
mainline
llvm-project
lldb
source
Plugins
SymbolFile
DWARF
DWARFFormValue.h
Go to the documentation of this file.
1
//===-- DWARFFormValue.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 LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFFORMVALUE_H
10
#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFFORMVALUE_H
11
12
#include "
DWARFDataExtractor.h
"
13
#include <cstddef>
14
#include <optional>
15
16
class
DWARFUnit
;
17
class
SymbolFileDWARF
;
18
class
DWARFDIE
;
19
20
class
DWARFFormValue
{
21
public
:
22
typedef
struct
ValueTypeTag
{
23
ValueTypeTag
() :
value
() {
value
.uval = 0; }
24
25
union
{
26
uint64_t
uval
;
27
int64_t
sval
;
28
const
char
*
cstr
;
29
}
value
;
30
const
uint8_t *
data
=
nullptr
;
31
}
ValueType
;
32
33
enum
{
34
eValueTypeInvalid
= 0,
35
eValueTypeUnsigned
,
36
eValueTypeSigned
,
37
eValueTypeCStr
,
38
eValueTypeBlock
39
};
40
41
DWARFFormValue
() =
default
;
42
DWARFFormValue
(
const
DWARFUnit
*unit) :
m_unit
(unit) {}
43
DWARFFormValue
(
const
DWARFUnit
*unit,
dw_form_t
form)
44
:
m_unit
(unit),
m_form
(form) {}
45
const
DWARFUnit
*
GetUnit
()
const
{
return
m_unit
; }
46
void
SetUnit
(
const
DWARFUnit
*unit) {
m_unit
= unit; }
47
dw_form_t
Form
()
const
{
return
m_form
; }
48
dw_form_t
&
FormRef
() {
return
m_form
; }
49
void
SetForm
(
dw_form_t
form) {
m_form
= form; }
50
const
ValueType
&
Value
()
const
{
return
m_value
; }
51
ValueType
&
ValueRef
() {
return
m_value
; }
52
void
SetValue
(
const
ValueType
&val) {
m_value
= val; }
53
54
void
Dump
(
lldb_private::Stream
&s)
const
;
55
bool
ExtractValue
(
const
lldb_private::DWARFDataExtractor
&data,
56
lldb::offset_t
*offset_ptr);
57
const
uint8_t *
BlockData
()
const
;
58
static
std::optional<uint8_t>
GetFixedSize
(
dw_form_t
form,
59
const
DWARFUnit
*u);
60
std::optional<uint8_t>
GetFixedSize
()
const
;
61
DWARFDIE
Reference
()
const
;
62
uint64_t
Reference
(
dw_offset_t
offset)
const
;
63
bool
Boolean
()
const
{
return
m_value
.
value
.
uval
!= 0; }
64
uint64_t
Unsigned
()
const
{
return
m_value
.
value
.
uval
; }
65
void
SetUnsigned
(uint64_t uval) {
m_value
.
value
.
uval
= uval; }
66
int64_t
Signed
()
const
{
return
m_value
.
value
.
sval
; }
67
void
SetSigned
(int64_t sval) {
m_value
.
value
.
sval
= sval; }
68
const
char
*
AsCString
()
const
;
69
dw_addr_t
Address
()
const
;
70
bool
IsValid
()
const
{
return
m_form
!= 0; }
71
bool
SkipValue
(
const
lldb_private::DWARFDataExtractor
&debug_info_data,
72
lldb::offset_t
*offset_ptr)
const
;
73
static
bool
SkipValue
(
const
dw_form_t
form,
74
const
lldb_private::DWARFDataExtractor
&debug_info_data,
75
lldb::offset_t
*offset_ptr,
const
DWARFUnit
*unit);
76
static
bool
IsBlockForm
(
const
dw_form_t
form);
77
static
bool
IsDataForm
(
const
dw_form_t
form);
78
static
int
Compare
(
const
DWARFFormValue
&a,
const
DWARFFormValue
&b);
79
void
Clear
();
80
static
bool
FormIsSupported
(
dw_form_t
form);
81
82
protected
:
83
// Compile unit where m_value was located.
84
// It may be different from compile unit where m_value refers to.
85
const
DWARFUnit
*
m_unit
=
nullptr
;
// Unit for this form
86
dw_form_t
m_form
= 0;
// Form for this value
87
ValueType
m_value
;
// Contains all data for the form
88
};
89
90
#endif
// LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFFORMVALUE_H
DWARFDataExtractor.h
DWARFDIE
Definition:
DWARFDIE.h:16
DWARFFormValue
Definition:
DWARFFormValue.h:20
DWARFFormValue::Reference
DWARFDIE Reference() const
Definition:
DWARFFormValue.cpp:503
DWARFFormValue::DWARFFormValue
DWARFFormValue()=default
DWARFFormValue::eValueTypeSigned
@ eValueTypeSigned
Definition:
DWARFFormValue.h:36
DWARFFormValue::eValueTypeCStr
@ eValueTypeCStr
Definition:
DWARFFormValue.h:37
DWARFFormValue::eValueTypeBlock
@ eValueTypeBlock
Definition:
DWARFFormValue.h:38
DWARFFormValue::eValueTypeInvalid
@ eValueTypeInvalid
Definition:
DWARFFormValue.h:34
DWARFFormValue::eValueTypeUnsigned
@ eValueTypeUnsigned
Definition:
DWARFFormValue.h:35
DWARFFormValue::FormIsSupported
static bool FormIsSupported(dw_form_t form)
Definition:
DWARFFormValue.cpp:593
DWARFFormValue::IsValid
bool IsValid() const
Definition:
DWARFFormValue.h:70
DWARFFormValue::Form
dw_form_t Form() const
Definition:
DWARFFormValue.h:47
DWARFFormValue::AsCString
const char * AsCString() const
Definition:
DWARFFormValue.cpp:460
DWARFFormValue::Clear
void Clear()
Definition:
DWARFFormValue.cpp:26
DWARFFormValue::SetForm
void SetForm(dw_form_t form)
Definition:
DWARFFormValue.h:49
DWARFFormValue::SetSigned
void SetSigned(int64_t sval)
Definition:
DWARFFormValue.h:67
DWARFFormValue::Unsigned
uint64_t Unsigned() const
Definition:
DWARFFormValue.h:64
DWARFFormValue::IsDataForm
static bool IsDataForm(const dw_form_t form)
Definition:
DWARFFormValue.cpp:580
DWARFFormValue::BlockData
const uint8_t * BlockData() const
Definition:
DWARFFormValue.cpp:566
DWARFFormValue::m_form
dw_form_t m_form
Definition:
DWARFFormValue.h:86
DWARFFormValue::Address
dw_addr_t Address() const
Definition:
DWARFFormValue.cpp:485
DWARFFormValue::GetFixedSize
std::optional< uint8_t > GetFixedSize() const
Definition:
DWARFFormValue.cpp:200
DWARFFormValue::SetUnsigned
void SetUnsigned(uint64_t uval)
Definition:
DWARFFormValue.h:65
DWARFFormValue::ValueType
struct DWARFFormValue::ValueTypeTag ValueType
DWARFFormValue::m_value
ValueType m_value
Definition:
DWARFFormValue.h:87
DWARFFormValue::GetUnit
const DWARFUnit * GetUnit() const
Definition:
DWARFFormValue.h:45
DWARFFormValue::ValueRef
ValueType & ValueRef()
Definition:
DWARFFormValue.h:51
DWARFFormValue::SetUnit
void SetUnit(const DWARFUnit *unit)
Definition:
DWARFFormValue.h:46
DWARFFormValue::IsBlockForm
static bool IsBlockForm(const dw_form_t form)
Definition:
DWARFFormValue.cpp:568
DWARFFormValue::Dump
void Dump(lldb_private::Stream &s) const
Definition:
DWARFFormValue.cpp:335
DWARFFormValue::SetValue
void SetValue(const ValueType &val)
Definition:
DWARFFormValue.h:52
DWARFFormValue::DWARFFormValue
DWARFFormValue(const DWARFUnit *unit, dw_form_t form)
Definition:
DWARFFormValue.h:43
DWARFFormValue::DWARFFormValue
DWARFFormValue(const DWARFUnit *unit)
Definition:
DWARFFormValue.h:42
DWARFFormValue::Compare
static int Compare(const DWARFFormValue &a, const DWARFFormValue &b)
DWARFFormValue::m_unit
const DWARFUnit * m_unit
Definition:
DWARFFormValue.h:85
DWARFFormValue::Boolean
bool Boolean() const
Definition:
DWARFFormValue.h:63
DWARFFormValue::Signed
int64_t Signed() const
Definition:
DWARFFormValue.h:66
DWARFFormValue::FormRef
dw_form_t & FormRef()
Definition:
DWARFFormValue.h:48
DWARFFormValue::Value
const ValueType & Value() const
Definition:
DWARFFormValue.h:50
DWARFFormValue::ExtractValue
bool ExtractValue(const lldb_private::DWARFDataExtractor &data, lldb::offset_t *offset_ptr)
Definition:
DWARFFormValue.cpp:32
DWARFFormValue::SkipValue
bool SkipValue(const lldb_private::DWARFDataExtractor &debug_info_data, lldb::offset_t *offset_ptr) const
Definition:
DWARFFormValue.cpp:204
DWARFUnit
Definition:
DWARFUnit.h:84
SymbolFileDWARF
Definition:
SymbolFileDWARF.h:62
lldb_private::DWARFDataExtractor
Definition:
DWARFDataExtractor.h:18
lldb_private::Stream
A stream class that can stream formatted output to a file.
Definition:
Stream.h:28
uint16_t
dw_offset_t
uint64_t dw_offset_t
Definition:
dwarf.h:33
dw_addr_t
uint64_t dw_addr_t
Definition:
dwarf.h:29
lldb::offset_t
uint64_t offset_t
Definition:
lldb-types.h:83
DWARFFormValue::ValueTypeTag
Definition:
DWARFFormValue.h:22
DWARFFormValue::ValueTypeTag::uval
uint64_t uval
Definition:
DWARFFormValue.h:26
DWARFFormValue::ValueTypeTag::sval
int64_t sval
Definition:
DWARFFormValue.h:27
DWARFFormValue::ValueTypeTag::data
const uint8_t * data
Definition:
DWARFFormValue.h:30
DWARFFormValue::ValueTypeTag::ValueTypeTag
ValueTypeTag()
Definition:
DWARFFormValue.h:23
DWARFFormValue::ValueTypeTag::cstr
const char * cstr
Definition:
DWARFFormValue.h:28
DWARFFormValue::ValueTypeTag::value
union DWARFFormValue::ValueTypeTag::@154 value
Generated on Sun Apr 2 2023 04:06:53 for LLDB by
1.9.6