private void Parser_SymbolCreated(MapSymbol aSymbol) { bool addItem = true; if (iMapFile.Count > 0) { int lastEntryIndex = iMapFile.Count - 1; MapSymbol lastEntry = (MapSymbol)iMapFile[lastEntryIndex]; // long lastEntrySize = lastEntry.Size; long newEntrySize = aSymbol.Size; // if (lastEntry.Address == aSymbol.Address) { if (lastEntrySize == 0 && newEntrySize > 0) { // Remove an entry with zero size to replace it with a better definition... iMapFile.RemoveAt(lastEntryIndex); } else if (newEntrySize == 0 && lastEntrySize > 0) { // Don't replace an entry with zero size when we already // have a good item. addItem = false; } } } if (addItem) { iMapFile.Add(this, aSymbol); } }
public override void Add(GenericSymbolEngine aEngine, GenericSymbol aSymbol) { // We don't take data symbols, just code MapSymbol symbol = (MapSymbol)aSymbol; MapSymbol.TType type = symbol.Type; if (type == MapSymbol.TType.EThumbCode || type == MapSymbol.TType.EARMCode) { // Don't take code entries with no size if (aSymbol.Size > 0) { // Make sure we remove the null symbol if this is the first 'valid' symbol for // the collection. if (Count == 1 && this[0].IsUnknownSymbol) { RemoveAt(0); } iEntries.Add(aSymbol); } else { #if TRACE System.Diagnostics.Debug.WriteLine("Discarding zero size entry: " + aSymbol.ToString()); #endif } } }
private MapFile(string aHostBinaryName, string aHostMapFileName) : base(aHostBinaryName) { base.SourceFile = aHostMapFileName; // Make the dummy entry in case we obtain no further symbols MapSymbol dummy = MapSymbol.NewUnknown(this); iEntries.Add(dummy); }
/// ------------------------------------------------------------------------------------------------- /// <summary> Parse file. </summary> /// /// <remarks> 05/11/2017. </remarks> /// /// <param name="infile"> The infile. </param> /// <param name="outfile"> The outfile. </param> /// ------------------------------------------------------------------------------------------------- static void ParseFile(string infile, string outfile) { Console.WriteLine("Parsing"); Regex reg = new Regex( @"(?<label>\w+)\s+= \$(?<address>[a-fA-F0-9]+) ; (?<type>[a-zA-Z]*), (?<local>[a-zA-Z]*), (?<other>\w*), (?<section>\w*), (?<compiler>\w*), (?<path>[a-zA-Z:\\0-9.)_]*)"); List <MapSymbol> mapSymbols = new List <MapSymbol>(); string[] maplines = File.ReadAllLines(infile); if (maplines.Length <= 0) { Console.WriteLine(infile + " empty"); return; } foreach (string s in maplines) { if (!string.IsNullOrEmpty(s)) { var match = reg.Match(s); MapSymbol ms = new MapSymbol(); ms.label = match.Groups["label"].ToString(); ms.address = match.Groups["address"].ToString(); ms.type = match.Groups["type"].ToString(); ms.local = match.Groups["local"].ToString(); ms.other = match.Groups["other"].ToString(); ms.section = match.Groups["section"].ToString(); ms.path = match.Groups["path"].ToString(); mapSymbols.Add(ms); } } Console.WriteLine("Found " + mapSymbols.Count + " symbols"); System.IO.StreamWriter file = new System.IO.StreamWriter(outfile); foreach (MapSymbol ms in mapSymbols) { if (ms.path.Contains(".c:")) { file.WriteLine("0000" + ms.address.ToUpper() + " " + ms.label); } } file.Close(); }
private void ParseGlobalSymbol(string aLine) { try { // Image$$ER_RO$$Base 0x00008000 Number 0 anon$$obj.o(linker$$defined$$symbols) MapSymbol symbol = iEntryCreator.CreateSymbol(); bool parsedOkay = symbol.Parse(aLine); if (parsedOkay && SymbolCreated != null) { SymbolCreated(symbol); } } catch (GenericSymbolicCreationException) { } }
private void ParseGlobalBaseAddress(string aLine) { try { // Image$$ER_RO$$Base 0x00008000 Number 0 anon$$obj.o(linker$$defined$$symbols) MapSymbol baseOffsetEntry = iEntryCreator.CreateSymbol(); // Keep trying to parse until we are successful. First time we succeed // we use the symbol address as the global offset address within the map // file (typically 0x8000) bool parsedOkay = baseOffsetEntry.Parse(aLine); if (parsedOkay && baseOffsetEntry.Address > 0 && BaseAddressHandler != null) { BaseAddressHandler((uint)baseOffsetEntry.Address); iStateGlobal = TGlobalState.EProcessingSymbols; } } catch (GenericSymbolicCreationException) { } }
public MapSymbol CreateSymbol() { return(MapSymbol.New(iMapFile)); }
/// <summary> /// The bubble layer symbol type. Supported symbols are "circle" and "square". /// </summary> /// <param name="value">The value that configures the symbol.</param> public MapLayerDefaultsBubbleSettingsBuilder Symbol(MapSymbol value) { container.Symbol = value; return this; }
//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date name Tracking # Description // --------- ------------------- ------------- ---------------------- // 18JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * copy constructor. * @param symbol the symbol to be copied. */ public MapSymbol(MapSymbol symbol) { Shape = symbol.Shape; Color = symbol.Color; Size = symbol.Size; }