Пример #1
0
        void InsertAssemblerLine(StringBuilder sb, int line, AssemblyLine asm)
        {
            if (asm.Code.Contains("\\t"))
            {
                var opcodeParts = asm.Code.Split(new string[] { "\\t" }, StringSplitOptions.RemoveEmptyEntries);
                sb.AppendFormat("{0:x8}   {1}", asm.Address, opcodeParts[0]);

                if (opcodeParts.Length > 1)
                {
                    var extraSpaces = 8 - opcodeParts[0].Length;

                    if (extraSpaces < 0)
                    {
                        extraSpaces = 4;
                    }

                    sb.Append(' ', 4 + extraSpaces);

                    sb.Append(opcodeParts[1]);

                    sb.Append("\n");
                }
            }
            else
            {
                sb.AppendFormat("{0:x8}   {1}\n", asm.Address, asm.Code);
            }

            addressLines[GetAddrId(asm.Address, asm.AddressSpace)] = line;
        }
Пример #2
0
        protected override void OnExperimentStart(ModelElementBase modelElement)
        {
            AssemblyLine assemblyLine = (AssemblyLine)modelElement;

            bufferContentStatistics = new WeightedStatistic[assemblyLine.Length];
            bufferContents          = new Variable <double> [assemblyLine.Length];
            foreach (Buffer buffer in assemblyLine.Buffers.Skip(1))
            {
                bufferContentStatistics[buffer.Index] = new WeightedStatistic($"{buffer.Name}_content");
                bufferContents[buffer.Index]          = new Variable <double>(this);
            }

            throughPutStatistics = new Statistic[1];
            for (int i = 0; i < 1; i++)
            {
                throughPutStatistics[i] = new Statistic($"Throughput");
            }

            upStatistics      = new Statistic[assemblyLine.Machines.Length];
            downStatistics    = new Statistic[assemblyLine.Machines.Length];
            starvedStatistics = new Statistic[assemblyLine.Machines.Length];
            blockedStatistics = new Statistic[assemblyLine.Machines.Length];
            foreach (Machine machine in assemblyLine.Machines)
            {
                upStatistics[machine.Index]      = new Statistic($"UpTime_{machine.Name}");
                downStatistics[machine.Index]    = new Statistic($"DownTime_{machine.Name}");
                starvedStatistics[machine.Index] = new Statistic($"StarvedTime_{machine.Name}");
                blockedStatistics[machine.Index] = new Statistic($"BlockedTime_{machine.Name}");
            }
        }
Пример #3
0
        public override AssemblyLine[] GetLines(long startAddr, long endAddr)
        {
            GdbCommandResult data = null;

            data = session.RunCommand("-data-disassemble", "-s", startAddr.ToString(), "-e", endAddr.ToString(), "--", "0");

            if (data.Status == CommandStatus.Done)
            {
                ResultData ins = data.GetObject("asm_insns");

                AssemblyLine[] alines = new AssemblyLine[ins.Count];

                for (int n = 0; n < ins.Count; n++)
                {
                    ResultData   aline = ins.GetObject(n);
                    long         addr  = long.Parse(aline.GetValue("address").Substring(2), NumberStyles.HexNumber);
                    AssemblyLine line  = new AssemblyLine(addr, aline.GetValue("inst"));
                    alines[n] = line;
                }

                return(alines);
            }
            else
            {
                long           range    = endAddr - startAddr;
                AssemblyLine[] badlines = new AssemblyLine[range];
                for (int n = 0; n < range; n++)
                {
                    badlines[n] = new AssemblyLine(startAddr + n, "Unable to read data.");
                }

                return(badlines);
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            Settings.FixSeed = true;

            Simulation sim = new Simulation("AssemblyLineSimulation", @"C:\CSSLtest");

            SimpleCalendar calendar = new SimpleCalendar();

            sim.MyExecutive.SetCalendar(calendar);

            AssemblyLine assemblyLine = new AssemblyLine(sim.MyModel, "AssemblyLine", 3);

            assemblyLine.AddMachine(0, 5, new NormalDistribution(5, 1), new NormalDistribution(5, 1));
            assemblyLine.AddMachine(1, 2, new NormalDistribution(5, 1), new NormalDistribution(5, 1));
            assemblyLine.AddMachine(2, 3, new NormalDistribution(5, 1), new NormalDistribution(5, 1));

            assemblyLine.AddBuffer(1, 1);
            assemblyLine.AddBuffer(2, 10);

            AssemblyLineObserver observer = new AssemblyLineObserver(sim);

            assemblyLine.Subscribe(observer);

            sim.MyExperiment.LengthOfReplication  = 1E5;
            sim.MyExperiment.NumberOfReplications = 2;

            sim.Run();
        }
        public void FillUp(int targetLine)
        {
            if (baseIndex + targetLine >= 0)
            {
                return;
            }

            // Lines we are missing
            int linesReq = -(baseIndex + targetLine);

            Console.WriteLine("pp FILLUP: " + linesReq);

            // Last known valid address
            long lastAddr = lines.Count > 0 ? lines [0].Address : baseAddress;

            // Addresses we are going to query to get the required lines
            long addr = lastAddr - (linesReq + ExtraUpLines) * AddrPerLine;             // 4 is just a guess

            int  lastCount  = 0;
            bool limitFound = false;

            AssemblyLine[] alines;
            do
            {
                alines = GetLines(addr, lastAddr);
                if (alines.Length <= lastCount)
                {
                    limitFound = true;
                    break;
                }
                addr     -= (linesReq + ExtraUpLines - alines.Length) * AddrPerLine;
                lastCount = alines.Length;
            }while (alines.Length < linesReq + ExtraUpLines);

            int max = limitFound ? alines.Length : alines.Length - ExtraUpLines;

            if (max < 0)
            {
                max = 0;
            }

            // Fill the lines
            for (int n = 0; n < max; n++)
            {
                lines.Insert(n, alines [n + (alines.Length - max)]);
            }

            long firstAddr = lines [0].Address;

            for (int n = 0; n < (linesReq - max); n++)
            {
                AssemblyLine line = new AssemblyLine(--firstAddr, "");
                lines.Insert(0, line);
                max++;
            }
            baseIndex += max;
        }
Пример #6
0
        public void Control()
        {
            SandwichBuilder builder;

            var shop = new AssemblyLine();

            builder = new TurkeyClub();
            shop.Assemble(builder);
            builder.Sandwich.Show();
        }
Пример #7
0
        protected override void OnExperimentStart(ModelElementBase modelElement)
        {
            AssemblyLine assemblyLine = (AssemblyLine)modelElement;

            bufferContentStatistics = new WeightedStatistic[assemblyLine.Length];
            bufferContents          = new Variable <double> [assemblyLine.Length];
            foreach (Buffer buffer in assemblyLine.Buffers.Skip(1))
            {
                bufferContentStatistics[buffer.Index] = new WeightedStatistic($"{buffer.Name}_content");
                bufferContents[buffer.Index]          = new Variable <double>(this);
            }
        }
Пример #8
0
        protected override void OnReplicationEnd(ModelElementBase modelElement)
        {
            AssemblyLine assemblyLine = (AssemblyLine)modelElement;

            Console.WriteLine($"Total production is {totalProduction}");

            foreach (Buffer buffer in assemblyLine.Buffers.Skip(1))
            {
                double fractionFilled = bufferContentStatistics[buffer.Index].Average() / buffer.Capacity * 100;
                Console.WriteLine($"{buffer.Name} {fractionFilled}");
            }
        }
Пример #9
0
    public void Start()
    {
        line       = GameObject.Find("assemblyLine").GetComponent <AssemblyLine>();
        kingObj    = GameObject.Find("king");
        king       = GameObject.Find("king").GetComponent <King>();
        initialPos = transform.position;
        AudioSource[] audios = GetComponents <AudioSource>();

        barrelSmashSound = audios[0];
        fallSound        = audios[1];
        barrelSmashSound.Stop();
        fallSound.Stop();
    }
        public void FillDown(int targetLine)
        {
            if (baseIndex + targetLine < lines.Count)
            {
                return;
            }

            // Lines we are missing
            int linesReq = (baseIndex + targetLine) - lines.Count + 1;

            Console.WriteLine("pp FILLDOWN: " + linesReq);

            // Last known valid address
            long lastAddr = lines.Count > 0 ? lines [lines.Count - 1].Address : baseAddress;

            // Addresses we are going to query to get the required lines
            long addr = lastAddr + (linesReq + ExtraDownLines) * AddrPerLine;             // 4 is just a guess

            int  lastCount  = 0;
            bool limitFound = false;

            AssemblyLine[] alines;
            do
            {
                alines = GetLines(lastAddr, addr);
                if (alines.Length <= lastCount)
                {
                    limitFound = true;
                    break;
                }
                addr     += (linesReq + ExtraDownLines - alines.Length) * AddrPerLine;
                lastCount = alines.Length;
            }while (alines.Length < linesReq + ExtraDownLines);

            int max = limitFound ? alines.Length : alines.Length - ExtraDownLines;

            // Fill the lines
            for (int n = 0; n < max; n++)
            {
                lines.Add(alines [n]);
            }

            lastAddr = lines [lines.Count - 1].Address;
            for (int n = 0; n < (linesReq - max); n++)
            {
                AssemblyLine line = new AssemblyLine(++lastAddr, "");
                lines.Add(line);
            }
        }
Пример #11
0
        protected override void OnReplicationStart(ModelElementBase modelElement)
        {
            AssemblyLine assemblyLine = (AssemblyLine)modelElement;

            upTimesStatistics      = new Statistic[assemblyLine.Length];
            downTimesStatistics    = new Statistic[assemblyLine.Length];
            starvedTimesStatistics = new Statistic[assemblyLine.Length];
            blockedTimesStatistics = new Statistic[assemblyLine.Length];
            foreach (Machine machine in assemblyLine.Machines)
            {
                upTimesStatistics[machine.Index]      = new Statistic($"{machine.Name}_uptime");
                downTimesStatistics[machine.Index]    = new Statistic($"{machine.Name}_downtime");
                starvedTimesStatistics[machine.Index] = new Statistic($"{machine.Name}_starvedtime");
                blockedTimesStatistics[machine.Index] = new Statistic($"{machine.Name}_blockedtime");
            }
        }
        public AssemblyLine[] GetLines(int firstIndex, int lastIndex)
        {
            Console.WriteLine("pp GET LINES: " + firstIndex + " " + lastIndex + " " + baseIndex);

            if (lastIndex >= 0)
            {
                FillDown(lastIndex);
            }
            if (firstIndex < 0)
            {
                FillUp(firstIndex);
            }

            AssemblyLine[] array = new AssemblyLine [lastIndex - firstIndex + 1];
            lines.CopyTo(baseIndex + firstIndex, array, 0, lastIndex - firstIndex + 1);
            return(array);
        }
Пример #13
0
        static void TestAssemblyWriter()
        {
            using (var aw = new AssemblyWriter()
            {
                Indentation = "  ",
                IndentInstructions = true,
                IndentDirectives = false,
            })
            {
                aw.WriteLine("This is a comment.");
                aw.WriteLine("As is this.");
                aw.WriteLine(AssemblyLine.Label("TEST", -1));
                aw.WriteLine(AssemblyLine.Instruction("add", new[] { "r1", "r2", "r2" }, -1));

                Console.WriteLine(aw);
            }
        }
        protected override void Build(ref Automobile t)
        {
            //// Build chassis
            //MoldWeldChassis(t);
            //AddTrailerHitch(t);
            //AddSuspension(t);
            //AddGasTank(t);
            //AddTransmission(t);
            //AddWheels(t);

            //// Add engine
            //AddEngine(t);

            //// Add body and finishings
            //MateBodyToFrame(t);
            //AddBatterySparkPlugs(t);
            //AddTires(t);
            //TopOffFluids(t);

            //// Quality Inspection
            //InspectQuality(t);

            var assemblyLine = new AssemblyLine();

            assemblyLine.Register(new MoldWeldChassis())
            .Register(new AddTrailerHitch())
            .Register(new AddFrontSuspension())
            .Register(new AddRearSuspension())
            .Register(new AddGasTank())
            .Register(new AddAxles())
            .Register(new AddDriveShafts())
            .Register(new AddGearBoxes())
            .Register(new AddSteeringBoxComponents())
            .Register(new AddWheelDrums())
            .Register(new AddBrakes())
            .Register(new MateEngineWithTransmission())
            .Register(new AttachRadiator())
            .Register(new MateBodyToFrame())
            .Register(new MateBedToFrame())
            .Register(new AddBatteryElements())
            .Register(new AddTires())
            .Register(new TopOffFluids())
            .Register(new InspectQuality())
            .Build(t);
        }
Пример #15
0
        static void Main(string[] args)
        {
            Settings.FixSeed = true;

            Simulation sim = new Simulation("AssemblyLineSimulation", @"C:\CSSLtest");

            AssemblyLine assemblyLine = new AssemblyLine(sim.MyModel, "AssemblyLine", 3);

            double[] machine1Uptimes = new double[2] {
                2, 3
            };
            double[] machine1Downtimes = new double[3] {
                1, 2, 3
            };
            assemblyLine.AddMachine(0, 1500, new EmpericalDistribution(machine1Uptimes), new EmpericalDistribution(machine1Downtimes));

            double[] machine2Uptimes = new double[2] {
                20, 30
            };
            double[] machine2Downtimes = new double[2] {
                1, 2
            };
            assemblyLine.AddMachine(1, 4, new EmpericalDistribution(machine2Uptimes), new EmpericalDistribution(machine2Downtimes));

            double[] machine3Uptimes = new double[2] {
                2, 3
            };
            double[] machine3Downtimes = new double[3] {
                1, 2, 3
            };
            assemblyLine.AddMachine(2, 1200, new EmpericalDistribution(machine3Uptimes), new EmpericalDistribution(machine3Downtimes));

            assemblyLine.AddBuffer(1, 10); // Position, capacity
            assemblyLine.AddBuffer(2, 1);

            AssemblyLineObserver observer = new AssemblyLineObserver(sim);

            assemblyLine.Subscribe(observer);

            sim.MyExperiment.LengthOfReplication  = 1E6;
            sim.MyExperiment.NumberOfReplications = 2;

            sim.Run();
        }
Пример #16
0
        public override AssemblyLine[] GetLines(long startAddr, long endAddr)
        {
            try {
                ResultData data = session.RunCommand("-data-disassemble", "-s", startAddr.ToString(), "-e", endAddr.ToString(), "--", "0");
                ResultData ins  = data.GetObject("asm_insns");

                AssemblyLine[] alines = new AssemblyLine [ins.Count];
                for (int n = 0; n < ins.Count; n++)
                {
                    ResultData   aline = ins.GetObject(n);
                    long         addr  = long.Parse(aline.GetValue("address").Substring(2), NumberStyles.HexNumber);
                    AssemblyLine line  = new AssemblyLine(addr, aline.GetValue("inst"));
                    alines [n] = line;
                }
                return(alines);
            } catch {
                return(new AssemblyLine [0]);
            }
        }
Пример #17
0
        public override Simulation BuildTrainingEnvironment()
        {
            Simulation sim = new Simulation("AssemblyLineSimulation", @"C:\CSSLtest");

            AssemblyLine assemblyLine = new AssemblyLine(sim.MyModel, "AssemblyLine", 3);

            double[] machine1Uptimes = new double[2] {
                2, 3
            };
            double[] machine1Downtimes = new double[3] {
                1, 2, 3
            };
            assemblyLine.AddMachine(0, 1500, new EmpericalDistribution(machine1Uptimes), new EmpericalDistribution(machine1Downtimes));

            double[] machine2Uptimes = new double[2] {
                20, 30
            };
            double[] machine2Downtimes = new double[2] {
                1, 2
            };
            assemblyLine.AddMachine(1, 4, new EmpericalDistribution(machine2Uptimes), new EmpericalDistribution(machine2Downtimes));

            double[] machine3Uptimes = new double[2] {
                2, 3
            };
            double[] machine3Downtimes = new double[3] {
                1, 2, 3
            };
            assemblyLine.AddMachine(2, 1200, new EmpericalDistribution(machine3Uptimes), new EmpericalDistribution(machine3Downtimes));

            assemblyLine.AddBuffer(1, 10); // Position, capacity
            assemblyLine.AddBuffer(2, 1);

            AssemblyLineObserver observer = new AssemblyLineObserver(sim);

            assemblyLine.Subscribe(observer);

            sim.MyExperiment.LengthOfReplication  = 1E6;
            sim.MyExperiment.NumberOfReplications = 2;

            return(sim);
        }
Пример #18
0
        protected override void OnExperimentEnd(ModelElementBase modelElement)
        {
            AssemblyLine assemblyLine = (AssemblyLine)modelElement;

            ExperimentWriter.WriteLine($"Throughput Statistics - Average - stdev - CI");
            ExperimentWriter.WriteLine($"{throughPutStatistics[0].Average()}");
            ExperimentWriter.WriteLine($"{throughPutStatistics[0].StandardDeviation()}");
            ExperimentWriter.WriteLine($"{throughPutStatistics[0].ConfidenceInterval95()}");

            ExperimentWriter.WriteLine($" ");
            ExperimentWriter.WriteLine($"Machine States - Up - Down- Starved - Blocked (1-2-3-4-5-6-7)");
            foreach (Machine machine in assemblyLine.Machines)
            {
                ExperimentWriter.WriteLine($"{upStatistics[machine.Index].Average()}");
                ExperimentWriter.WriteLine($"{downStatistics[machine.Index].Average()}");
                ExperimentWriter.WriteLine($"{starvedStatistics[machine.Index].Average()}");
                ExperimentWriter.WriteLine($"{blockedStatistics[machine.Index].Average()}");
                ExperimentWriter.WriteLine($" ");
            }
        }
Пример #19
0
        protected override void OnUpdate(ModelElementBase modelElement)
        {
            AssemblyLine assemblyLine = (AssemblyLine)modelElement;

            // Accumulate the total production
            Machine lastMachine = assemblyLine.Machines[assemblyLine.Length - 1];

            if (lastMachine.State == MachineState.Up)
            {
                totalProduction += lastMachine.ActualSpeed * (assemblyLine.GetTime - assemblyLine.GetPreviousEventTime);
            }

            // Register buffer contents
            foreach (Buffer buffer in assemblyLine.Buffers.Skip(1))
            {
                bufferContents[buffer.Index].UpdateValue(buffer.Content);
                double weight = bufferContents[buffer.Index].TimeOfUpdate - bufferContents[buffer.Index].PreviousTimeOfUpdate;
                bufferContentStatistics[buffer.Index].Collect(buffer.Content, weight);
            }

            // Register uptimes
            foreach (Machine machine in assemblyLine.Machines)
            {
                if (machine.State == MachineState.Up)
                {
                    upTimesStatistics[machine.Index].Collect(assemblyLine.GetTime - assemblyLine.GetPreviousEventTime);
                }
                if (machine.State == MachineState.Down)
                {
                    downTimesStatistics[machine.Index].Collect(assemblyLine.GetTime - assemblyLine.GetPreviousEventTime);
                }
                if (machine.State == MachineState.Starved)
                {
                    starvedTimesStatistics[machine.Index].Collect(assemblyLine.GetTime - assemblyLine.GetPreviousEventTime);
                }
                if (machine.State == MachineState.Blocked)
                {
                    blockedTimesStatistics[machine.Index].Collect(assemblyLine.GetTime - assemblyLine.GetPreviousEventTime);
                }
            }
        }
Пример #20
0
        public static void BuilderExample()
        {
            SandwichBuilder builder;

            // Create shop with sandwich assembly line
            AssemblyLine shop = new AssemblyLine();

            // Construct and display sandwiches
            builder = new HamAndCheese();
            shop.Assemble(builder);
            builder.Sandwich.Show();

            builder = new BLT();
            shop.Assemble(builder);
            builder.Sandwich.Show();

            builder = new TurkeyClub();
            shop.Assemble(builder);
            builder.Sandwich.Show();

            // Wait for user
            Console.ReadKey();
        }
Пример #21
0
        protected override void OnReplicationEnd(ModelElementBase modelElement)
        {
            AssemblyLine assemblyLine = (AssemblyLine)modelElement;

            //Console.WriteLine($"Throughput is {totalProduction / assemblyLine.GetTime}");

            //foreach (Buffer buffer in assemblyLine.Buffers.Skip(1))
            //{
            //    Console.WriteLine($"Mean content {buffer.Name}: {bufferContentStatistics[buffer.Index].Average()}");
            //}

            //Console.WriteLine($"Throughput in (products/second) is {totalProduction / (MySimulation.MyExperiment.LengthOfReplication - MySimulation.MyExperiment.LengthOfWarmUp)}");


            throughPutStatistics[0].Collect(totalProduction / (MySimulation.MyExperiment.LengthOfReplication - MySimulation.MyExperiment.LengthOfWarmUp));

            foreach (Machine machine in assemblyLine.Machines)
            {
                upStatistics[machine.Index].Collect(upTimesStatistics[machine.Index].Sum() / (MySimulation.MyExperiment.LengthOfReplication - MySimulation.MyExperiment.LengthOfWarmUp));
                downStatistics[machine.Index].Collect(downTimesStatistics[machine.Index].Sum() / (MySimulation.MyExperiment.LengthOfReplication - MySimulation.MyExperiment.LengthOfWarmUp));
                starvedStatistics[machine.Index].Collect(starvedTimesStatistics[machine.Index].Sum() / (MySimulation.MyExperiment.LengthOfReplication - MySimulation.MyExperiment.LengthOfWarmUp));
                blockedStatistics[machine.Index].Collect(blockedTimesStatistics[machine.Index].Sum() / (MySimulation.MyExperiment.LengthOfReplication - MySimulation.MyExperiment.LengthOfWarmUp));
            }
        }
Пример #22
0
 public void ProductionRatePerHourForSpeedZero() =>
 Assert.Equal(0.0, AssemblyLine.ProductionRatePerHour(0));
Пример #23
0
 public void ProductionRatePerHourForSpeedOne() =>
 Assert.Equal(221.0, AssemblyLine.ProductionRatePerHour(1));
Пример #24
0
 public void WorkingItemsPerMinuteForSpeedEight() =>
 Assert.Equal(26, AssemblyLine.WorkingItemsPerMinute(8));
Пример #25
0
 public void WorkingItemsPerMinuteForSpeedTen() =>
 Assert.Equal(28, AssemblyLine.WorkingItemsPerMinute(10));
Пример #26
0
 public void WorkingItemsPerMinuteForSpeedOne() =>
 Assert.Equal(3, AssemblyLine.WorkingItemsPerMinute(1));
Пример #27
0
 public void WorkingItemsPerMinuteForSpeedFive() =>
 Assert.Equal(16, AssemblyLine.WorkingItemsPerMinute(5));
Пример #28
0
 public void ProductionRatePerHourForSpeedNine() =>
 Assert.Equal(1531.53, AssemblyLine.ProductionRatePerHour(9));
Пример #29
0
 public void WorkingItemsPerMinuteForSpeedZero() =>
 Assert.Equal(0, AssemblyLine.WorkingItemsPerMinute(0));
Пример #30
0
 public void ProductionRatePerHourForSpeedSeven() =>
 Assert.Equal(1392.3, AssemblyLine.ProductionRatePerHour(7));
Пример #31
0
        bool tryHandleStep(Match match)
        {
            Address address;
            AssemblyLine asm;
            try
            {
                // Get the execution address
                address = new Address((long)Utils.ParseHex64(match.Groups[1].Value));
                // Get the disassembly
                string disasm = match.Groups[2].Value;

                // Get the raw bytecode
                string bytecode = match.Groups[3].Value;
                byte[] bytes    = new byte[bytecode.Length / 2];

                for (int i = 0; i < bytes.Length; i++) {
                    bytes[i] = Utils.ParseHex8("" + bytecode[i * 2] + bytecode[i * 2 + 1]);
                }

                // Parse out the assembly instruction & operands
                Match    asmMatch = AssemblyLine.AssemblyRegex.Match(disasm);
                string[] args     = asmMatch.Groups[2].Value.Split(',');
                string   meta     = "";

                for (int i = 0; i < args.Length; i++)
                {
                    args[i] = args[i].Trim();

                    int i1 = args[i].IndexOf('<');
                    int i2 = args[i].IndexOf('>');

                    if (i1 != -1 && i2 != -1)
                    {
                        meta = args[i].Substring(i1, 1 + i2 - i1);
                        args[i].Remove(i1, 1 + i2 - i1);
                    }
                }
                asm = new AssemblyLine(AssemblySyntax.Intel, -1, asmMatch.Groups[1].Value, args, bytes, meta);
            }
            catch
            {
                Console.WriteLine("[ERROR] Error parsing bochs step output.");
                return false;
            }

            // Update regs
            this.UpdateRegisters();

            // Fire event
            if (this.Stepped != null) this.Stepped(address, asm);

            return true;
        }
Пример #32
0
        /// <summary>
        /// Called when Bochs is stepped.
        /// </summary>
        private void OnBochsStepped(Address address, AssemblyLine assembly)
        {
            // Update status
            this.CurrentStatus  = DebugStatus.Suspended;
            this.CurrentAddress = address.Value;

            // Give default values for current props
            this.CurrentBreakpoint = null;
            this.CurrentObjectFile = null;
            this.CurrentCodeUnit   = this.liveCodeUnit;

            // Update breakpoint
            foreach (Breakpoint bp in this.breakpoints)
            {
                if (bp.IsActive && bp.Address == address) {
                    this.CurrentBreakpoint = bp; break;
                }
            }

            // Update object file
            foreach (ObjectCodeFile file in Application.Session.LoadedImages)
            {
                if (file.Sections[0].LoadMemoryAddress <= address.Value &&
                    file.Sections[0].LoadMemoryAddress + file.Size > address.Value)
                {
                    this.CurrentObjectFile = file; break;
                }
            }

            // If object file found, try and load current code unit
            if (this.CurrentObjectFile != null)
            {
                this.CurrentCodeUnit = this.CurrentObjectFile.GetCode(address.Value);
            }
            // Otherwise, use the live code unit
            else this.liveCodeUnit.AddAssemblyLine(assembly);

            // Fire the event
            if (this.Suspended != null) this.Suspended(this, null);
        }
 public JunctionParameterAssembler(AssemblyLine<IParameter, ParameterDTO> successor = null)
     : base(successor)
 {
 }
Пример #34
0
 public SimpleParameterAssembler(FieldPathAssembler pathAssembler, AssemblyLine<IParameter, ParameterDTO> successor = null)
     : base(successor)
 {
     PathAssembler = pathAssembler;
 }