mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
LibDebug: Move Dwarf::AttributeValue to a separate file
This commit is contained in:
parent
fea9bb8c51
commit
edd79ddd00
3 changed files with 43 additions and 29 deletions
39
Userland/Libraries/LibDebug/Dwarf/AttributeValue.h
Normal file
39
Userland/Libraries/LibDebug/Dwarf/AttributeValue.h
Normal file
|
@ -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 {};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -6,8 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CompilationUnit.h"
|
#include "AttributeValue.h"
|
||||||
#include "DwarfInfo.h"
|
|
||||||
#include "DwarfTypes.h"
|
#include "DwarfTypes.h"
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include <AK/NonnullOwnPtr.h>
|
#include <AK/NonnullOwnPtr.h>
|
||||||
|
@ -21,7 +20,7 @@ class CompilationUnit;
|
||||||
// DIE = Debugging Information Entry
|
// DIE = Debugging Information Entry
|
||||||
class DIE {
|
class DIE {
|
||||||
public:
|
public:
|
||||||
DIE(const CompilationUnit&, u32 offset);
|
DIE(const CompilationUnit&, u32 offset, Optional<u32> parent_offset = {});
|
||||||
|
|
||||||
u32 offset() const { return m_offset; }
|
u32 offset() const { return m_offset; }
|
||||||
u32 size() const { return m_size; }
|
u32 size() const { return m_size; }
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "AttributeValue.h"
|
||||||
#include "CompilationUnit.h"
|
#include "CompilationUnit.h"
|
||||||
#include "DwarfTypes.h"
|
#include "DwarfTypes.h"
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
|
#include <AK/NonnullOwnPtrVector.h>
|
||||||
#include <AK/NonnullRefPtr.h>
|
#include <AK/NonnullRefPtr.h>
|
||||||
#include <AK/RefCounted.h>
|
#include <AK/RefCounted.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
|
@ -16,32 +18,6 @@
|
||||||
|
|
||||||
namespace Debug::Dwarf {
|
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 {
|
class DwarfInfo {
|
||||||
public:
|
public:
|
||||||
explicit DwarfInfo(const ELF::Image&);
|
explicit DwarfInfo(const ELF::Image&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue