From 84609aecc1a2f944b8d037af4459cd3c7a2bf756 Mon Sep 17 00:00:00 2001 From: Itamar Date: Sat, 19 Jun 2021 11:34:59 +0300 Subject: 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. --- Userland/Libraries/LibDebug/Dwarf/AttributeValue.h | 3 +++ Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp | 2 ++ 2 files changed, 5 insertions(+) (limited to 'Userland') diff --git a/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h b/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h index c1c9d87888..d2a5e045e0 100644 --- a/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h +++ b/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h @@ -7,6 +7,7 @@ #pragma once #include +#include namespace Debug::Dwarf { @@ -34,6 +35,8 @@ struct AttributeValue { const u8* bytes; // points to bytes in the memory mapped elf image } as_raw_bytes; } data {}; + + AttributeDataForm form {}; }; } diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp index 71f18545d7..eae91e9874 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp @@ -5,6 +5,7 @@ */ #include "DwarfInfo.h" +#include "AttributeValue.h" #include @@ -61,6 +62,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im InputMemoryStream& debug_info_stream, const CompilationUnit* unit) const { AttributeValue value; + value.form = form; auto assign_raw_bytes_value = [&](size_t length) { value.data.as_raw_bytes.length = length; -- cgit v1.2.3