summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-06-19 11:34:59 +0300
committerAndreas Kling <kling@serenityos.org>2021-06-19 14:51:18 +0200
commit84609aecc1a2f944b8d037af4459cd3c7a2bf756 (patch)
tree6f8d9d52b0d415ff858ed8976c8dca647c945da7
parenta45ce0c6ebb5a3230a84da3a8646b8c541e0eb14 (diff)
downloadserenity-84609aecc1a2f944b8d037af4459cd3c7a2bf756.zip
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.
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/AttributeValue.h3
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp2
2 files changed, 5 insertions, 0 deletions
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 <AK/Types.h>
+#include <LibDebug/Dwarf/DwarfTypes.h>
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 <AK/MemoryStream.h>
@@ -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;