Ejemplo n.º 1
0
        public SymbolsForBinary(string aHostFileName)
            : base(aHostFileName)
        {
            // Add default unknown entry
            SymbolSymbol nullEntry = SymbolSymbol.NewUnknown(this);

            iEntries.Add(nullEntry);
        }
Ejemplo n.º 2
0
 private void Parser_SymbolCreated(SymbolSymbol aSymbol)
 {
     // 1) We accept symbols with an address of zero, providing that their size is greater
     //    than zero.
     //
     // 2) We accept symbols with an address greater than zero, irrespective of their size.
     if ((aSymbol.Address >= 0 || aSymbol.Size > 0) ||     // 1
         (aSymbol.Address == 0 && aSymbol.Size > 0)        // 2
         )
     {
         iCurrentBinary.Add(this, aSymbol, AllowNonRomSymbols);
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("  Discarded symbol: " + aSymbol);
     }
 }
Ejemplo n.º 3
0
        public override GenericSymbol SymbolForAddress(long aAddress)
        {
#if DEBUG
            int x = 0;
            if (x > 0)
            {
                base.Dump(aAddress);
            }
#endif
            GenericSymbol ret = null;
            //
            AddressFindingComparer comparer = new AddressFindingComparer();
            SymbolSymbol           temp     = SymbolSymbol.NewUnknown((uint)aAddress, 0, string.Empty);
            int pos = iEntries.BinarySearch(temp, comparer);
            if (pos >= 0 && pos < iEntries.Count)
            {
                ret = iEntries[pos];
                System.Diagnostics.Debug.Assert(ret.AddressRange.Contains(aAddress));
            }
            //
            return(ret);
        }
Ejemplo n.º 4
0
        private void HandleSymbolLine(string aLine)
        {
            try
            {
                // If we have not yet made a collection for this symbol, then do so now
                CreateNewCollection();

                SymbolSymbol entry   = iEntryCreator.CreateSymbol();
                bool         entryOk = entry.Parse(aLine);
                if (entryOk && SymbolCreated != null)
                {
                    // Notify that we created a symbol
                    SymbolCreated(entry);
                }
            }
            catch (GenericSymbolicCreationException)
            {
#if TRACE
                System.Diagnostics.Debug.WriteLine("SymbolParseException: " + aLine);
#endif
            }
        }
Ejemplo n.º 5
0
        private void UpdateCollectionBaseAddressBasedUponFirstSymbol(GenericSymbol aSymbol)
        {
            // If we are not processing the first Symbol in the collection, then we
            // can rely on the base address being set. Otherwise, we are
            // defining the base address itself.
            if (!((iFlags & TFlags.EFlagsHaveSeenFirstSymbol) == TFlags.EFlagsHaveSeenFirstSymbol))
            {
                // Set collection base address to symbol starting address
                BaseAddress = aSymbol.Address;

                // Since this is the first symbol in the collection, and we're going to use
                // its address as the offset (base) address for the entire collection,
                // if we just set the collection base address to the symbol's address and
                // the continue, this entry will be double offset (the new offset for the collection
                // + the offset of the symbol itself). We must therefore set the symbol's offset
                // address to zero.
                SymbolSymbol realSymbol = (SymbolSymbol)aSymbol;
                realSymbol.ResetOffsetAddress(0);

                // Make sure we set a flag so that we don't attempt to do this again.
                iFlags |= TFlags.EFlagsHaveSeenFirstSymbol;
            }
        }
Ejemplo n.º 6
0
 public SymbolSymbol CreateSymbol()
 {
     return(SymbolSymbol.New(iCurrentBinary));
 }