Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Melanzana.MachO/LoadCommands/MachDyldInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ public MachDyldInfo(
ArgumentNullException.ThrowIfNull(exportData);

RebaseData = rebaseData;
RebaseData.Parent = this;
BindData = bindData;
BindData.Parent = this;
WeakBindData = weakBindData;
WeakBindData.Parent = this;
LazyBindData = lazyBindData;
LazyBindData.Parent = this;
ExportData = exportData;
ExportData.Parent = this;
}

public MachLinkEditData RebaseData { get; private init; }
Expand Down
3 changes: 3 additions & 0 deletions Melanzana.MachO/LoadCommands/MachSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ internal MachSection(
this.SectionName = sectionName;
this.dataStream = stream;
this.relocationData = relocationData;

if(this.relocationData != null)
this.relocationData.Parent = this;
}

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions Melanzana.MachO/LoadCommands/MachSymbolTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ internal MachSymbolTable(

this.objectFile = objectFile;
this.symbolTableData = symbolTableData;
this.symbolTableData.Parent = this;
this.stringTableData = stringTableData;
this.stringTableData.Parent = this;

// Create a section map now since the section indexes may change later
sectionMap = new Dictionary<byte, MachSection>();
Expand Down
1 change: 1 addition & 0 deletions Melanzana.MachO/LoadCommands/MachTwoLevelHints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class MachTwoLevelHints : MachLoadCommand
public MachTwoLevelHints(MachObjectFile objectFile, MachLinkEditData data)
{
Data = data;
Data.Parent = this;
}

public uint FileOffset => Data.FileOffset;
Expand Down
4 changes: 4 additions & 0 deletions Melanzana.MachO/MachLinkEditData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ internal MachLinkEditData(Stream objectStream, uint offset, uint size)
this.FileOffset = offset;
}

public object? Parent { get; set; }

public uint FileOffset { get; set; }

public ulong Size
Expand Down Expand Up @@ -63,5 +65,7 @@ public Stream GetWriteStream()
dataStream = new UnclosableMemoryStream();
return dataStream;
}

public override string ToString() => $"Link Edit Data: 0x{FileOffset:X}-0x{FileOffset + Size:X} (0x{Size:X})";
}
}