示例#1
0
        /// <summary>
        /// get/create a single thread group of actions containing the given branch id.
        /// it is used for loading debugger viewer
        /// </summary>
        /// <param name="branchId">the given branch id to be included in the result group</param>
        /// <returns>the action group containing the given branch id</returns>
        public IActionGroup GetThreadGroup(UInt32 branchId)
        {
            List <ActionBranch> independentThreads = FindoutActionThreads(false);

            foreach (ActionBranch a in independentThreads)
            {
                if (a.ContainsAction(branchId))
                {
                    IActionGroup g = a as IActionGroup;
                    if (g != null)
                    {
                        g = (IActionGroup)g.Clone();
                        g.ResetGroupId(_method.MethodID);                        //all threads has the same group id. they can be distinguished at runtime by thread id
                        return(g);
                    }
                    AB_ActionString s = a as AB_ActionString;
                    if (s != null)
                    {
                        IActionGroup sg = s.GetThreadGroup(branchId);
                        sg.ResetGroupId(_method.MethodID);                        //all threads has the same group id. they can be distinguished at runtime by thread id
                        return(sg);
                    }
                    List <UInt32>  used = new List <uint>();
                    AB_ActionGroup ag   = new AB_ActionGroup(_actsHolder);
                    ag.SetOwnerMethod(used, _method);
                    ag.BranchId = _method.MethodID;                     //all threads has the same group id. they can be distinguished at runtime by thread id
                    ag.AppendAction(a);
                    return(ag);
                }
            }
            return(null);
        }
示例#2
0
        public override object Clone()
        {
            AB_ActionString obj = (AB_ActionString)base.Clone();

            obj.JumpToStringId = _jumpToId;
            obj.JumpTo         = _jumpToActionBranch;
            return(obj);
        }
        public override ActionBranch CollectActions(List <ActionViewer> scope, Dictionary <UInt32, ActionBranch> collected)
        {
            AB_ActionString th = new AB_ActionString(ActionsHolder);

            th.AppendAction(this);
            collected.Add(this.FirstActionId, th);
            ActionBranch an = NextActionInScope(scope);

            if (an == null)
            {
                this.IsEndingPointByScope = true;
                th.IsEndingPointByScope   = true;
                return(th);
            }
            this.IsEndingPointByScope = false;
            while (an != null)
            {
                if (an.IsMergingPoint || an.IsBranchingPoint)
                {
                    th.JumpToStringId = an.BranchId;
                    th.JumpTo         = an;
                    break;
                }
                else
                {
                    th.AppendAction(an);
                    ActionBranch an0 = an.NextActionInScope(scope);
                    if (an0 == null)
                    {
                        an.IsEndingPointByScope = true;
                    }
                    if (an == an0)
                    {
                        break;
                    }
                    an = an0;
                }
            }
            return(th);
        }
示例#4
0
 public ActionBranch GetJumpToActionBranch(UInt32 branchId)
 {
     foreach (ActionBranch a in this)
     {
         if (a.BranchId == branchId)
         {
             return(a);
         }
         AB_ActionString abs = a as AB_ActionString;
         if (abs != null)
         {
             if (abs.ActionCount > 0)
             {
                 if (abs.ActionList[0].BranchId == branchId)
                 {
                     return(a);
                 }
             }
         }
         else
         {
             IActionGroup ia = a as IActionGroup;
             if (ia != null)
             {
                 if (ia.ActionList != null)
                 {
                     ActionBranch ab = ia.ActionList.GetJumpToActionBranch(branchId);
                     if (ab != null)
                     {
                         return(ab);
                     }
                 }
             }
         }
     }
     return(null);
 }