summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-06-18 14:15:01 +0300
committerAndreas Kling <kling@serenityos.org>2021-06-19 14:51:18 +0200
commitedd79ddd00836fa48fb128dc7e5affd58de85090 (patch)
tree50cbc5341919af4e7956f35b006ffc2158139fdc /Userland
parentfea9bb8c517ef28fc9a3daffa408398c6636f590 (diff)
downloadserenity-edd79ddd00836fa48fb128dc7e5affd58de85090.zip
LibDebug: Move Dwarf::AttributeValue to a separate file
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/AttributeValue.h39
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/DIE.h5
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h28
3 files changed, 43 insertions, 29 deletions
diff --git a/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h b/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h
new file mode 100644
index 0000000000..c1c9d87888
--- /dev/null
+++ b/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021, Itamar S. <itamar8910@gmail.com>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Types.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 {};
+};
+
+}
diff --git a/Userland/Libraries/LibDebug/Dwarf/DIE.h b/Userland/Libraries/LibDebug/Dwarf/DIE.h
index c234e94fee..67fc1e1e2e 100644
--- a/Userland/Libraries/LibDebug/Dwarf/DIE.h
+++ b/Userland/Libraries/LibDebug/Dwarf/DIE.h
@@ -6,8 +6,7 @@
#pragma once
-#include "CompilationUnit.h"
-#include "DwarfInfo.h"
+#include "AttributeValue.h"
#include "DwarfTypes.h"
#include <AK/Function.h>
#include <AK/NonnullOwnPtr.h>
@@ -21,7 +20,7 @@ class CompilationUnit;
// DIE = Debugging Information Entry
class DIE {
public:
- DIE(const CompilationUnit&, u32 offset);
+ DIE(const CompilationUnit&, u32 offset, Optional<u32> parent_offset = {});
u32 offset() const { return m_offset; }
u32 size() const { return m_size; }
diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h
index 49e41611f8..5942a2acad 100644
--- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h
+++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h
@@ -6,9 +6,11 @@
#pragma once
+#include "AttributeValue.h"
#include "CompilationUnit.h"
#include "DwarfTypes.h"
#include <AK/ByteBuffer.h>
+#include <AK/NonnullOwnPtrVector.h>
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
@@ -16,32 +18,6 @@
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 {};
-};
-
class DwarfInfo {
public:
explicit DwarfInfo(const ELF::Image&);