Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7e7e512
Ensure device tests run on net8.0 and net9.0
jamescrosswell Mar 13, 2025
d569cf0
Move existing reader to V1 directory
jamescrosswell Mar 13, 2025
f660e63
Bumped NSubstitute to versino 5.3.0
jamescrosswell Mar 17, 2025
0b36c8c
Update Sentry.Extensions.Logging.Tests.csproj
jamescrosswell Mar 17, 2025
b94434a
Merge branch 'main' into store-v2
jamescrosswell Mar 17, 2025
4e9183b
Update Sentry.Maui.Tests.csproj
jamescrosswell Mar 17, 2025
0c22666
Update device-tests-android.yml
jamescrosswell Mar 17, 2025
9420d86
Update CHANGELOG.md
jamescrosswell Mar 17, 2025
1291467
Minimal work required to add the store v2 files to the repo with attr…
jamescrosswell Mar 18, 2025
339f4ef
make members internal
jamescrosswell Mar 18, 2025
d18d462
Tests pass on net8.0 and net9.0
jamescrosswell Mar 19, 2025
1c6494e
Merge branch 'main' into store-v2
jamescrosswell Mar 19, 2025
75e15c7
Format code
getsentry-bot Mar 19, 2025
fc3e17a
Removed Xamarin.LibZipSharp dependency
jamescrosswell Mar 19, 2025
d618ac2
Removed dependency on System.IO.Hashing
jamescrosswell Mar 19, 2025
509482b
Format code
getsentry-bot Mar 19, 2025
956f1c6
Update AndroidAssemblyReaderTests.cs
jamescrosswell Mar 19, 2025
8b95555
Merge branch 'store-v2' of github.com:getsentry/sentry-dotnet into st…
jamescrosswell Mar 19, 2025
0a9580b
Revert "Merge branch 'store-v2' of github.com:getsentry/sentry-dotnet…
jamescrosswell Mar 19, 2025
bc58628
Removed junk comments added by dotnet format
jamescrosswell Mar 20, 2025
bbfa502
Format code
getsentry-bot Mar 20, 2025
6f7cbb7
Tweaked ZipFile calls
jamescrosswell Mar 21, 2025
440baf2
Added support for non AssemblyStore APKs
jamescrosswell Mar 21, 2025
de304b9
Format code
getsentry-bot Mar 21, 2025
8a1253d
Merge branch 'main' into store-v2
jamescrosswell Mar 21, 2025
3423f09
Format code
getsentry-bot Mar 21, 2025
45769f9
Removed unused code from ArchiveAssemblyHelper
jamescrosswell Mar 23, 2025
7652f11
Remove unused code from StoreReaderV2
jamescrosswell Mar 24, 2025
fd470f0
Update AndroidAssemblyReaderTests.cs
jamescrosswell Mar 24, 2025
d8ed437
Delete ELFPayloadError.cs
jamescrosswell Mar 24, 2025
e866cee
.
jamescrosswell Mar 25, 2025
d0b8688
Use System.Private.CoreLib.dll instead of System.Runtime.dll in Assem…
jamescrosswell Mar 26, 2025
c024e2e
Merge branch 'main' into store-v2
jamescrosswell Mar 26, 2025
8ede9cd
Test AssemblyReader with APKs published using AOT
jamescrosswell Mar 26, 2025
7ccfa1a
Merge branch 'store-v2' of github.com:getsentry/sentry-dotnet into st…
jamescrosswell Mar 26, 2025
81fac20
Shortened file names for test apks
jamescrosswell Mar 27, 2025
dfc59be
.
jamescrosswell Mar 27, 2025
4af3523
Added logging to the Ubuntu build (Temporary)
jamescrosswell Mar 27, 2025
75bb2ec
Removed dependency on ElfSharp NuGet
jamescrosswell Mar 28, 2025
b3c0948
Add structured build logs to build
jamescrosswell Mar 28, 2025
92a74d8
Format code
getsentry-bot Mar 28, 2025
f22991f
Set RID based on OS Architecture when publishing AndroidTestApp
jamescrosswell Mar 28, 2025
2583dea
Merge branch 'store-v2' of github.com:getsentry/sentry-dotnet into st…
jamescrosswell Mar 28, 2025
9f14f9b
Format code
getsentry-bot Mar 28, 2025
294872c
Update Sentry.Android.AssemblyReader.Tests.csproj
jamescrosswell Mar 28, 2025
d7936f2
Merge branch 'store-v2' of github.com:getsentry/sentry-dotnet into st…
jamescrosswell Mar 28, 2025
2a332b1
Update Sentry.Android.AssemblyReader.Tests.csproj
jamescrosswell Mar 28, 2025
74feb9c
.
jamescrosswell Mar 28, 2025
64fadc1
.
jamescrosswell Mar 28, 2025
7077f90
Merge branch 'main' into store-v2
jamescrosswell Mar 31, 2025
78817b7
Update AndroidAssemblyReaderTests.cs
jamescrosswell Apr 2, 2025
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
Prev Previous commit
Next Next commit
Format code
  • Loading branch information
getsentry-bot committed Mar 28, 2025
commit 92a74d8f8c35f7f4ecbf9be4cdfadf450837c1fe
2 changes: 1 addition & 1 deletion src/Sentry.Android.AssemblyReader/ELFSharp/ELF/Class.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ELFSharp.ELF
namespace ELFSharp.ELF
{
internal enum Class
{
Expand Down
30 changes: 20 additions & 10 deletions src/Sentry.Android.AssemblyReader/ELFSharp/ELF/ELF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ ISection IELF.GetSection(int index)

public void Dispose()
{
if (ownsStream) reader.BaseStream.Dispose();
if (ownsStream)
reader.BaseStream.Dispose();
}

public IEnumerable<TSection> GetSections<TSection>() where TSection : Section<T>
Expand Down Expand Up @@ -224,7 +225,8 @@ private void ReadSegmentHeaders()
private void ReadSections()
{
sectionHeaders = new List<SectionHeader>();
if (HasSectionsStringTable) sectionIndicesByName = new Dictionary<string, int>();
if (HasSectionsStringTable)
sectionIndicesByName = new Dictionary<string, int>();

for (var i = 0; i < sectionHeaderEntryCount; i++)
{
Expand All @@ -245,7 +247,8 @@ private void ReadSections()
sectionHeaders.Count
));
FindStringTables();
for (var i = 0; i < sectionHeaders.Count; i++) TouchSection(i);
for (var i = 0; i < sectionHeaders.Count; i++)
TouchSection(i);
sectionHeaders = null;
currentStage = Stage.AfterSectionsAreRead;
}
Expand All @@ -254,7 +257,8 @@ private void TouchSection(int index)
{
if (currentStage != Stage.Initalizing)
throw new InvalidOperationException("TouchSection invoked in improper state.");
if (sections[index] != null) return;
if (sections[index] != null)
return;
var section = GetSectionFromSectionHeader(sectionHeaders[index]);
sections[index] = section;
}
Expand All @@ -271,7 +275,8 @@ private void FindStringTables()

private void ReadStringTable()
{
if (!HasSectionHeader || !HasSectionsStringTable) return;
if (!HasSectionHeader || !HasSectionsStringTable)
return;

var header = ReadSectionHeader(checked((int)stringTableIndex));
if (header.Type != SectionType.StringTable)
Expand Down Expand Up @@ -353,23 +358,28 @@ private void ReadFields()
// If the index of the string table is larger than or equal to SHN_LORESERVE (0xff00), this member holds SHN_XINDEX (0xffff)
// and the real index of the section name string table section is held in the sh_link member of the initial entry in section
// header table. Otherwise, the sh_link member of the initial entry in section header table contains the value zero.
if (stringTableIndex == 0xffff) stringTableIndex = checked(firstSectionHeader.Link);
if (stringTableIndex == 0xffff)
stringTableIndex = checked(firstSectionHeader.Link);
}
}

private GetSectionResult TryGetSectionInner(string name, out Section<T> section)
{
section = default;
if (!HasSectionsStringTable) return GetSectionResult.NoSectionsStringTable;
if (!sectionIndicesByName.TryGetValue(name, out var index)) return GetSectionResult.NoSuchSection;
if (index == SectionNameNotUniqueMarker) return GetSectionResult.SectionNameNotUnique;
if (!HasSectionsStringTable)
return GetSectionResult.NoSectionsStringTable;
if (!sectionIndicesByName.TryGetValue(name, out var index))
return GetSectionResult.NoSuchSection;
if (index == SectionNameNotUniqueMarker)
return GetSectionResult.SectionNameNotUnique;
return TryGetSectionInner(index, out section);
}

private GetSectionResult TryGetSectionInner(int index, out Section<T> section)
{
section = default;
if (index >= sections.Count) return GetSectionResult.NoSuchSection;
if (index >= sections.Count)
return GetSectionResult.NoSuchSection;
if (sections[index] != null)
{
section = sections[index];
Expand Down
11 changes: 7 additions & 4 deletions src/Sentry.Android.AssemblyReader/ELFSharp/ELF/ELFReader.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Text;

Expand All @@ -20,7 +20,8 @@ internal static class ELFReader

public static IELF Load(Stream stream, bool shouldOwnStream)
{
if (!TryLoad(stream, shouldOwnStream, out var elf)) throw new ArgumentException(NotELFMessage);
if (!TryLoad(stream, shouldOwnStream, out var elf))
throw new ArgumentException(NotELFMessage);

return elf;
}
Expand Down Expand Up @@ -56,7 +57,8 @@ public static Class CheckELFType(Stream stream)
{
var currentStreamPosition = stream.Position;

if (stream.Length < Consts.MinimalELFSize) return Class.NotELF;
if (stream.Length < Consts.MinimalELFSize)
return Class.NotELF;

using (var reader = new BinaryReader(stream, Encoding.UTF8, true))
{
Expand All @@ -81,7 +83,8 @@ public static Class CheckELFType(string fileName)

public static ELF<T> Load<T>(Stream stream, bool shouldOwnStream) where T : struct
{
if (CheckELFType(stream) == Class.NotELF) throw new ArgumentException(NotELFMessage);
if (CheckELFType(stream) == Class.NotELF)
throw new ArgumentException(NotELFMessage);

return new ELF<T>(stream, shouldOwnStream);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ELFSharp.ELF
namespace ELFSharp.ELF
{
internal enum FileType : ushort
{
Expand Down
30 changes: 15 additions & 15 deletions src/Sentry.Android.AssemblyReader/ELFSharp/ELF/IELF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ namespace ELFSharp.ELF
{
internal interface IELF : IDisposable
{
Endianess Endianess { get; }
Class Class { get; }
FileType Type { get; }
Machine Machine { get; }
bool HasSegmentHeader { get; }
bool HasSectionHeader { get; }
bool HasSectionsStringTable { get; }
IReadOnlyList<ISegment> Segments { get; }
IStringTable SectionsStringTable { get; }
IReadOnlyList<ISection> Sections { get; }
IEnumerable<T> GetSections<T>() where T : ISection;
bool TryGetSection(string name, out ISection section);
ISection GetSection(string name);
bool TryGetSection(int index, out ISection section);
ISection GetSection(int index);
public Endianess Endianess { get; }
public Class Class { get; }
public FileType Type { get; }
public Machine Machine { get; }
public bool HasSegmentHeader { get; }
public bool HasSectionHeader { get; }
public bool HasSectionsStringTable { get; }
public IReadOnlyList<ISegment> Segments { get; }
public IStringTable SectionsStringTable { get; }
public IReadOnlyList<ISection> Sections { get; }
public IEnumerable<T> GetSections<T>() where T : ISection;
public bool TryGetSection(string name, out ISection section);
public ISection GetSection(string name);
public bool TryGetSection(int index, out ISection section);
public ISection GetSection(int index);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This file is based on LLVM's elf.h file. You can find its license
* in the LICENSE file.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ internal enum DynamicTag : ulong
VerNeed = 0X6FFFFFFE, // The address of the version Dependency table.
VerNeedNum = 0X6FFFFFFF // The number of entries in DT_VERNEED.
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ namespace ELFSharp.ELF.Sections
/// </summary>
internal interface IDynamicEntry
{
DynamicTag Tag { get; }
public DynamicTag Tag { get; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ namespace ELFSharp.ELF.Sections
{
internal interface IDynamicSection : ISection
{
IEnumerable<IDynamicEntry> Entries { get; }
public IEnumerable<IDynamicEntry> Entries { get; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace ELFSharp.ELF.Sections
{
internal interface INoteSection : ISection
{
string NoteName { get; }
byte[] Description { get; }
public string NoteName { get; }
public byte[] Description { get; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace ELFSharp.ELF.Sections
{
internal interface IProgBitsSection : ISection
{
void WriteContents(byte[] destination, int offset, int length = 0);
public void WriteContents(byte[] destination, int offset, int length = 0);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ namespace ELFSharp.ELF.Sections
{
internal interface ISection
{
string Name { get; }
uint NameIndex { get; }
SectionType Type { get; }
SectionFlags Flags { get; }
byte[] GetContents();
public string Name { get; }
public uint NameIndex { get; }
public SectionType Type { get; }
public SectionFlags Flags { get; }
public byte[] GetContents();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace ELFSharp.ELF.Sections
{
internal interface IStringTable : ISection
{
string this[long index] { get; }
IEnumerable<string> Strings { get; }
public string this[long index] { get; }
public IEnumerable<string> Strings { get; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ namespace ELFSharp.ELF.Sections
{
internal interface ISymbolEntry
{
string Name { get; }
SymbolBinding Binding { get; }
SymbolType Type { get; }
SymbolVisibility Visibility { get; }
bool IsPointedIndexSpecial { get; }
ISection PointedSection { get; }
ushort PointedSectionIndex { get; }
public string Name { get; }
public SymbolBinding Binding { get; }
public SymbolType Type { get; }
public SymbolVisibility Visibility { get; }
public bool IsPointedIndexSpecial { get; }
public ISection PointedSection { get; }
public ushort PointedSectionIndex { get; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ namespace ELFSharp.ELF.Sections
{
internal interface ISymbolTable : ISection
{
IEnumerable<ISymbolEntry> Entries { get; }
public IEnumerable<ISymbolEntry> Entries { get; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public override string ToString()
return string.Format("{0}: {2}, Type={1}", Name, NoteType, Type);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ internal ProgBitsSection(SectionHeader header, SimpleEndianessAwareReader reader
public void WriteContents(byte[] destination, int offset, int length = 0)
{
SeekToSectionBeginning();
if (length == 0 || (ulong)length > Header.Size) length = Convert.ToInt32(Header.Size);
if (length == 0 || (ulong)length > Header.Size)
length = Convert.ToInt32(Header.Size);
var remaining = length;
while (remaining > 0)
{
Expand All @@ -25,4 +26,4 @@ public void WriteContents(byte[] destination, int offset, int length = 0)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ internal Section(SectionHeader header, SimpleEndianessAwareReader reader)

public virtual byte[] GetContents()
{
if (Type == SectionType.NoBits) return Array.Empty<byte>();
if (Type == SectionType.NoBits)
return Array.Empty<byte>();

Reader.BaseStream.Seek((long)Header.Offset, SeekOrigin.Begin);
return Reader.ReadBytes(Convert.ToInt32(Header.Size));
Expand All @@ -54,4 +55,4 @@ protected void SeekToSectionBeginning()
Reader.BaseStream.Seek((long)Header.Offset, SeekOrigin.Begin);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ internal enum SectionFlags
Allocatable = 2,
Executable = 4
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ELFSharp.Utilities;
using ELFSharp.Utilities;

#nullable disable

Expand Down Expand Up @@ -43,7 +43,8 @@ public override string ToString()
private void ReadSectionHeader()
{
NameIndex = reader.ReadUInt32();
if (table != null) Name = table[NameIndex];
if (table != null)
Name = table[NameIndex];
Type = (SectionType)reader.ReadUInt32();
RawFlags = ReadAddress();
Flags = unchecked((SectionFlags)RawFlags);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ELFSharp.ELF.Sections
namespace ELFSharp.ELF.Sections
{
internal enum SectionType : uint
{
Expand All @@ -15,4 +15,4 @@ internal enum SectionType : uint
Shlib,
DynamicSymbolTable
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace ELFSharp.ELF.Sections
namespace ELFSharp.ELF.Sections
{
internal enum SpecialSectionIndex : ushort
{
Absolute = 0,
Common = 0xFFF1,
Undefined = 0xFFF2
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ELFSharp.ELF.Sections
namespace ELFSharp.ELF.Sections
{
internal enum SpecialSectionType
{
Expand Down
Loading