Ejemplo n.º 1
0
        // <summary>
        //   A breakpoint has been hit; now the sse needs to find out what do do:
        //   either ignore the breakpoint and continue or keep the target stopped
        //   and send out the notification.
        //
        //   If @index is zero, we hit an "unknown" breakpoint - ie. a
        //   breakpoint which we did not create.  Normally, this means that there
        //   is a breakpoint instruction (such as G_BREAKPOINT ()) in the code.
        //   Such unknown breakpoints are handled by the Debugger; one of
        //   the language backends may recognize the breakpoint's address, for
        //   instance if this is the JIT's breakpoint trampoline.
        //
        //   Returns true if the target should remain stopped and false to
        //   continue stepping.
        //
        //   If we can't find a handler for the breakpoint, the default is to stop
        //   the target and let the user decide what to do.
        // </summary>
        bool child_breakpoint(Inferior.ChildEvent cevent, int index, out Breakpoint bpt)
        {
            // The inferior knows about breakpoints from all threads, so if this is
            // zero, then no other thread has set this breakpoint.
            if (index == 0) {
                bpt = null;
                return true;
            }

            Inferior.StackFrame iframe = inferior.GetCurrentFrame ();

            bpt = lookup_breakpoint (index);
            if (bpt == null)
                return false;

            if (bpt is MainMethodBreakpoint) {
                main_retaddr = iframe.StackPointer + inferior.TargetAddressSize;
                reached_main = true;
            }

            if (!bpt.Breaks (thread.ID) || !process.BreakpointManager.IsBreakpointEnabled (index))
                return false;

            index = bpt.Index;

            bool remain_stopped;
            if (bpt.BreakpointHandler (inferior, out remain_stopped))
                return remain_stopped;

            TargetAddress address = inferior.CurrentFrame;
            return bpt.CheckBreakpointHit (thread, address);
        }