Exemple #1
0
bool PCEventHandler::isValidRTSignal(int signal, PCEventHandler::RTBreakpointVal breakpointVal,
									 Dyninst::Address arg1, int status)
{
	if(signal == EXCEPTION_BREAKPOINT)
	{
        if( breakpointVal == NormalRTBreakpoint ) {
            if( (status != DSE_forkExit) || (arg1 != 0) ) return true;

            proccontrol_printf("%s[%d]: child received signal %d\n",
                    FILE__, __LINE__, EXCEPTION_BREAKPOINT);
        } else if( breakpointVal == SoftRTBreakpoint ) {
            if( status == DSE_forkExit ) {
                if( arg1 == 0 ) return true;

                proccontrol_printf("%s[%d]: parent process received SIGSTOP\n",
                        FILE__, __LINE__);
            }else{
                proccontrol_printf("%s[%d]: SIGSTOP wasn't due to fork exit\n",
                        FILE__, __LINE__);
            }
        } else {
            proccontrol_printf("%s[%d]: mismatch in signal for breakpoint type\n",
                    FILE__, __LINE__);
        }
	} else {
        proccontrol_printf("%s[%d]: signal wasn't sent by RT library\n",
                FILE__, __LINE__);
    }

	return false;
}
/*
 * BPatch_thread::getCallStack
 *
 * Returns information about the frames currently on the thread's stack.
 *
 * stack	The vector to fill with the stack trace information.
 */
bool BPatch_thread::getCallStack(BPatch_Vector<BPatch_frame>& stack)
{
    pdvector<Frame> stackWalk;

    if (!llthread->walkStack(stackWalk) ) {
        proccontrol_printf("%s[%d]: failed to perform stackwalk on thread %d\n",
                           FILE__, __LINE__, llthread->getLWP());
        return false;
    }

    for (unsigned int i = 0; i < stackWalk.size(); i++) {
        bool isSignalFrame = false;
        bool isInstrumentation = false;
        BPatch_point *point = NULL;

        Frame frame = stackWalk[i];
        instPoint *iP = NULL;

        isSignalFrame = frame.isSignalFrame();
        isInstrumentation = frame.isInstrumentation();

        if (isInstrumentation)
        {
            if (NULL != (iP = frame.getPoint()))
            {
                point = proc->findOrCreateBPPoint(NULL, iP, BPatch_point::convertInstPointType_t(iP->type()));
            }

            if (!point)
            {
                isInstrumentation = false;
            }
        }


        stack.push_back(BPatch_frame(this,
                                     (void *)frame.getPC(),
                                     (void *)frame.getFP(),
                                     isSignalFrame,
                                     isInstrumentation,
                                     point));
    }
    return true;
}