예제 #1
0
        /// <summary>
        /// Creates a new DebugSession object.
        /// </summary>
        /// <param name="debuggerName">The name of the session debugger.</param>
        /// <param name="loadedExtensions">The names of the loaded extensions.</param>
        /// <param name="architecture">The executing machine architecture.</param>
        /// <param name="initialProperties">Initial session properties to set.</param>
        public DebugSession(string debuggerName, string[] loadedExtensions, Architecture architecture,
            SessionProperties initialProperties)
            : this()
        {
            if (initialProperties == null)
                throw new ArgumentNullException("initialProperties");
            if (architecture == null)
                throw new ArgumentNullException("architecture");

            this.debuggerName   = debuggerName;
            this.extensionNames = loadedExtensions ?? new string[0];
            this.architecture   = architecture;
            this.properties     = new SessionProperties(initialProperties);
        }
예제 #2
0
 /// <summary>
 /// Creates a new DebugSession object.
 /// </summary>
 /// <param name="debuggerName">The name of the session debugger.</param>
 /// <param name="loadedExtensions">The names of the loaded extensions.</param>
 /// <param name="architecture">The executing machine architecture.</param>
 public DebugSession(string debuggerName, string[] loadedExtensions, Architecture architecture)
     : this(debuggerName, loadedExtensions, architecture, new SessionProperties())
 {
 }
예제 #3
0
        public static Architecture FromStream(Stream input)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(input);

            if (!string.Equals(doc.DocumentElement.Name, "architecture",
                StringComparison.CurrentCultureIgnoreCase))
            {
                throw new InvalidDataException("Missing document element 'architecture'");
            }

            string id      = doc.DocumentElement.GetAttribute("id");
            string addrLen = doc.DocumentElement.GetAttribute("address-width");
            string stacLen = doc.DocumentElement.GetAttribute("stack-width");
            string stacDir = doc.DocumentElement.GetAttribute("stack-direction");
            string byteOrd = doc.DocumentElement.GetAttribute("byte-order");
            string isa     = doc.DocumentElement.GetAttribute("isa");

            Architecture output = new Architecture()
            {
                ID             = id,
                AddressWidth   = ParseSizeInBits(addrLen) / 8,
                StackWidth     = ParseSizeInBits(stacLen) / 8,
                StackDirection = (StackDirection)Enum.Parse(typeof(StackDirection), stacDir, true),
                ByteOrder      = (ByteOrder)Enum.Parse(typeof(ByteOrder), byteOrd, true),
                ISA            = isa
            };

            var registers = doc.GetElementsByTagName("register");
            output.Registers = new Register[registers.Count];

            int i = 0;
            foreach (XmlNode node in registers)
            {
                XmlElement element = (XmlElement)node;

                string name  = element.GetAttribute("name");
                string type  = element.GetAttribute("type");
                string width = element.GetAttribute("width");

                output.Registers[i++] = new Register(name, ParseSizeInBits(width) / 8,
                    (RegisterType)Enum.Parse(typeof(RegisterType), type, true));
            }

            return output;
        }