public override bool CanLoad(AnELF elf)
        {
            Log.Debug($"Checking if {elf.FilePath} is a Release DSO");

            xapp = null;
            ulong format_tag = 0;

            if (elf.HasSymbol(FormatTag))
            {
                format_tag = elf.GetUInt64(FormatTag);
            }

            XamarinAppReleaseDSO_Version?reader = null;

            switch (format_tag)
            {
            case 0:
            case FormatTag_V1:
                format_tag = 1;
                reader     = new XamarinAppReleaseDSO_V1(ManagedResolver, elf);
                break;

            default:
                Log.Error($"{elf.FilePath} format ({format_tag}) is not supported by this version of TMT");
                return(false);
            }

            if (reader == null || !reader.CanLoad(elf))
            {
                return(false);
            }

            xapp = reader;
            return(true);
        }
 public override bool CanLoad(AnELF elf)
 {
     return
         (HasSymbol(elf, MapModulesSymbolName) &&
          HasSymbol(elf, ModuleCountSymbolName) &&
          HasSymbol(elf, JavaTypeCountSymbolName) &&
          HasSymbol(elf, JavaNameWidthSymbolName) &&
          HasSymbol(elf, MapJavaSymbolName));
 }
Ejemplo n.º 3
0
        protected bool HasSymbol(AnELF elf, string symbolName)
        {
            bool ret = elf.HasSymbol(symbolName);

            if (!ret)
            {
                Log.Debug($"{elf.FilePath} is missing symbol '{symbolName}'");
            }
            return(ret);
        }
Ejemplo n.º 4
0
        public bool CanLoad(Stream stream, string filePath)
        {
            stream.Seek(0, SeekOrigin.Begin);
            if (!AnELF.TryLoad(stream, filePath, out AnELF? elf) || elf == null)
            {
                Log.Debug($"AnELF.TryLoad failed (elf == {elf})");
                return(false);
            }

            if (!CanLoad(elf))
            {
                Log.Debug($"Cannot load {elf} in {this}");
                return(false);
            }

            this.elf = elf;
            return(true);
        }
Ejemplo n.º 5
0
 public abstract bool CanLoad(AnELF elf);
Ejemplo n.º 6
0
 protected XamarinAppDSO(ManagedTypeResolver managedResolver, AnELF elf)
     : this(managedResolver, Path.GetFullPath(elf.FilePath))
 {
     this.elf = elf;
 }
 protected XamarinAppReleaseDSO_Version(ManagedTypeResolver managedResolver, AnELF elf)
     : base(managedResolver, elf)
 {
 }
 public XamarinAppReleaseDSO_V1(ManagedTypeResolver managedResolver, AnELF elf)
     : base(managedResolver, elf)
 {
 }
 public override bool CanLoad(AnELF elf)
 {
     return(HasSymbol(elf, TypeMapSymbolName));
 }