ladybird/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h
Itamar 84609aecc1 LibDebug: Add AttributeForm field to Dwarf::AttributeValue
In some contexts, it's helpful to also know the "Attribute Form",
in addition to the "Attribute Type".

An example for such context is the interpretation of the
"DW_AT_high_pc" attribute, which has different meaning if the form
is an address or a constant.
2021-06-19 14:51:18 +02:00

42 lines
894 B
C++

/*
* Copyright (c) 2021, Itamar S. <itamar8910@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
#include <LibDebug/Dwarf/DwarfTypes.h>
namespace Debug::Dwarf {
struct AttributeValue {
enum class Type : u8 {
UnsignedNumber,
SignedNumber,
LongUnsignedNumber,
String,
DieReference, // Reference to another DIE in the same compilation unit
Boolean,
DwarfExpression,
SecOffset,
RawBytes,
} type;
union {
u32 as_u32;
i32 as_i32;
u64 as_u64;
const char* as_string; // points to bytes in the memory mapped elf image
bool as_bool;
struct {
u32 length;
const u8* bytes; // points to bytes in the memory mapped elf image
} as_raw_bytes;
} data {};
AttributeDataForm form {};
};
}