private BackTraceElement GetElement(int bpaddr)
        {
            BaseViewModel bvmodel = BreakPointManager.GetBVModel(bpaddr);

            if (bvmodel != null)
            {
                LadderNetworkViewModel lnvmodel = ifacade.ProjectModel.GetNetwork(bvmodel);
                if (lnvmodel == null)
                {
                    return(null);
                }
                LadderDiagramViewModel ldvmodel = lnvmodel.LDVModel;
                SimuBrpoElement        brpo     = new SimuBrpoElement();
                brpo.LDVModel = ldvmodel;
                brpo.LNVModel = lnvmodel;
                brpo.BVModel  = bvmodel;
                return(new BackTraceElement(BackTraceType.Diagram, brpo));
            }
            FuncBlock fblock = BreakPointManager.GetFBlock(bpaddr);

            if (fblock != null)
            {
                FuncBlockViewModel fbvmodel = ifacade.ProjectModel.GetFuncBlock(fblock);
                if (fbvmodel == null)
                {
                    return(null);
                }
                FuncBrpoElement brpo = new FuncBrpoElement();
                brpo.FBVModel = fbvmodel;
                brpo.FBlock   = fblock;
                return(new BackTraceElement(BackTraceType.FuncBlock, brpo));
            }
            return(new BackTraceElement(BackTraceType.External));
        }
Example #2
0
        private void OnBreakpointPause(object sender, BreakpointPauseEventArgs e)
        {
            items.Clear();
            FuncBlock fblock = BreakPointManager.GetFBlock(e.Address);
            void *    rbp    = SimulateDllModel.GetRBP();
            int       laddr  = (int)rbp + 0x4;
            int       paddr  = (int)rbp - 0x8;

            if (fblock != null)
            {
                IList <FuncBlock_Assignment> localvars  = fblock.LocalVars;
                IList <FuncBlock_Assignment> parameters = fblock.Parameters;
                LocalVarElement_ForFuncBlock lvelement  = null;
                foreach (FuncBlock_Assignment localvar in localvars)
                {
                    lvelement = new LocalVarElement_ForFuncBlock(localvar);
                    GetValue(lvelement, localvar, laddr);
                    items.Add(lvelement);
                    laddr -= localvar.Sizeof;
                }
                foreach (FuncBlock_Assignment parameter in parameters)
                {
                    lvelement = new LocalVarElement_ForFuncBlock(parameter);
                    GetValue(lvelement, parameter, paddr);
                    items.Add(lvelement);
                    paddr += parameter.Sizeof;
                }
            }
            PropertyChanged(this, new PropertyChangedEventArgs("Items"));
        }