Beispiel #1
0
        public NsoSymbol(Elf64_Sym sym, byte[] strTableBuff)
        {
            List <byte> strBuff = new List <byte>();

            for (uint c = sym.st_name; c < strTableBuff.Length && strTableBuff[c] != 0; c++)
            {
                strBuff.Add(strTableBuff[c]);
            }

            Value   = Encoding.UTF8.GetString(strBuff.ToArray());
            Address = sym.st_value;
            Size    = sym.st_size;
            Binding = (SymbolBindingEnum)(sym.st_info >> 4);
            Type    = (SymbolTypeEnum)(sym.st_info & 0xF);
        }
Beispiel #2
0
        public List <NsoSymbol> GetSymbolTable()
        {
            List <NsoSymbol> symbols = new List <NsoSymbol>();

            byte[] symTableBuff = ReadNso(RodataSegment.Address + DynamicSymbolTable.offset, (int)DynamicSymbolTable.size);
            byte[] strTableBuff = ReadNso(RodataSegment.Address + DynamicStringTable.offset, (int)DynamicStringTable.size);

            using (MemoryStream ms = new MemoryStream(symTableBuff))
            {
                BinaryReader br = new BinaryReader(ms);
                for (int i = 0; i < symTableBuff.Length; i += Elf64_Sym.ELF64_SYM_SIZE)
                {
                    var sym = new Elf64_Sym(br);
                    symbols.Add(new NsoSymbol(sym, strTableBuff));
                }
            }


            return(symbols);
        }