public string Disassemble(uint aAddress) { string ret = "Unknown instruction"; // RVCTFunctionComparer comparer = new RVCTFunctionComparer(); RVCTDisassemblyFunction temp = new RVCTDisassemblyFunction(aAddress); int pos = iFunctions.BinarySearch(temp, comparer); if (pos >= 0 && pos < iFunctions.Count) { temp = iFunctions[pos]; System.Diagnostics.Debug.Assert(temp.AddressRange.Contains(aAddress)); // ret = temp[aAddress]; } // return(ret); }
public void Read(string aFileName, uint aGlobalBaseAddress) { using (StreamReader reader = new StreamReader(aFileName)) { RVCTDisassemblyFunction fn = LastFunction; // string line = reader.ReadLine(); while (line != null) { Match m = null; // m = KRegExFunction.Match(line); if (m.Success) { if (fn != null) { fn.Finalise(); // Only save functions that contain disassembly if (fn.Count > 0) { iFunctions.Add(fn); } } fn = new RVCTDisassemblyFunction(m.Groups["Name"].Value, aGlobalBaseAddress); } else if (fn != null) { fn.Offer(line); } // line = reader.ReadLine(); } // Finalise any pending function if (fn != null) { fn.Finalise(); } } }