Пример #1
0
        public bool TryLookupSymbol(string symbol, out ulong offset)
        {
            if (symbol is null)
            {
                throw new ArgumentNullException(nameof(symbol));
            }

            MachSymtabLoadCommand   symtabLoadCommand   = _symtabLoadCommand.Value;
            MachDySymtabLoadCommand dysymtabLoadCommand = _dysymtabLoadCommand.Value;

            // First, search just the "external" export symbols
            if (TryLookupSymbol(dysymtabLoadCommand.IExtDefSym, dysymtabLoadCommand.NextDefSym, symbol, out offset))
            {
                return(true);
            }

            // If not found in external symbols, search all of them
            if (TryLookupSymbol(0, symtabLoadCommand.SymCount, symbol, out offset))
            {
                return(true);
            }

            offset = 0;
            return(false);
        }
Пример #2
0
        private NList[] ReadSymbolTable()
        {
            MachSymtabLoadCommand symtabLoadCommand = _symtabLoadCommand.Value;

            if (symtabLoadCommand.IsNSymsReasonable.Check() && symtabLoadCommand.SymOffset > 0)
            {
                return(_physicalAddressSpace.ReadArray <NList>(symtabLoadCommand.SymOffset, symtabLoadCommand.SymCount));
            }
            return(null);
        }
Пример #3
0
        private Reader GetStringReader()
        {
            MachSymtabLoadCommand symtabLoadCommand = _symtabLoadCommand.Value;

            return(_physicalAddressSpace.WithRelativeAddressSpace(symtabLoadCommand.StringOffset, symtabLoadCommand.StringSize));
        }