XBOX::VError VRemoteDebugPilot::BreakpointReached(
											OpaqueDebuggerContext		inContext,
											int							inLineNumber,
											RemoteDebuggerPauseReason	inDebugReason,
											XBOX::VString&				inException,
											XBOX::VString&				inSourceUrl,
											XBOX::VectorOfVString&		inSourceData)
{

	VError	err = VE_INVALID_PARAMETER;

	XBOX::VSemaphore*	sem = NULL;
	VContextDebugInfos	debugInfos;
	
	debugInfos.fFileName = inSourceUrl;

	VURL::Decode( debugInfos.fFileName );
	VIndex				idx = debugInfos.fFileName.FindUniChar( L'/', debugInfos.fFileName.GetLength(), true );
	if (idx  > 1)
	{
		VString			tmpStr;
		debugInfos.fFileName.GetSubString(idx+1,debugInfos.fFileName.GetLength()-idx,tmpStr);
		debugInfos.fFileName = tmpStr;
	}

	debugInfos.fLineNb = inLineNumber+1;
	debugInfos.fReason = ( inDebugReason == EXCEPTION_RSN ? "exception" : (inDebugReason == BREAKPOINT_RSN ? "breakpoint" : "dbg statement" ) );
	debugInfos.fComment = "To Be Completed";
	debugInfos.fSourceLine = ( inLineNumber < inSourceData.size() ? inSourceData[inLineNumber] : " NO SOURCE AVAILABLE  " );
	err = ContextUpdated(inContext,debugInfos,&sem);

	if (err == VE_OK)
	{
		fPendingContextsNumberSem.Unlock();
		// if sem not NULL then wait for a browser page granted for debug
		if (sem)
		{
			sem->Lock();
			ReleaseRefCountable(&sem);
		}

		RemoteDebugPilotMsg_t	msg;
		msg.type = BREAKPOINT_REACHED_MSG;
		msg.ctx = inContext;
		msg.linenb = inLineNumber;
		msg.datavectstr = inSourceData;
		msg.datastr = inException;
		msg.urlstr = inSourceUrl;
		err = Send( msg );
		//testAssert(err == VE_OK);
		fPendingContextsNumberSem.Lock();
	}
	VString trace = VString("VRemoteDebugPilot::BreakpointReached ctx activation pb for ctxid=");
	trace.AppendLong8((unsigned long long)inContext);
	trace += " ,ok=";
	trace += (!err ? "1" : "0" );
	sPrivateLogHandler->Put( (err ? WAKDBG_ERROR_LEVEL : WAKDBG_INFO_LEVEL),trace);

	return err;
}
XBOX::VError VRemoteDebugPilot::BreakpointReached(
											WAKDebuggerContext_t	inContext,
											int						inLineNumber,
											int						inExceptionHandle,
											char*					inURL,
											int						inURLLength,
											char*					inFunction,
											int 					inFunctionLength,
											char*					inMessage,
											int 					inMessageLength,
											char* 					inName,
											int 					inNameLength,
											long 					inBeginOffset,
											long 					inEndOffset )
{

	VError	l_err = VRemoteDebugPilot::Check(inContext);
	if (!l_err)
	{
		return l_err;
	}

	bool	l_wait;
	XBOX::VSemaphore*	l_sem = new VSemaphore(0);

	l_err = ContextUpdated(inContext,l_sem,&l_wait);
	if (!l_err)
	{
		if (l_wait)
		{
			l_sem->Lock();
			VTask::Sleep(2500);
			delete l_sem;
		}
		RemoteDebugPilotMsg_t	l_msg;
		l_msg.type = BREAKPOINT_REACHED_MSG;
		l_msg.ctx = inContext;
		l_msg.linenb = inLineNumber;
		l_msg.srcid = *(intptr_t *)inURL;// we use the URL param to pass sourceId (to not modify interface of server)
		l_msg.datastr = VString( inFunction, inFunctionLength*2,  VTC_UTF_16 );
		l_msg.urlstr = VString( inMessage, inMessageLength*2,  VTC_UTF_16 );
		l_err = Send( l_msg );
	}
	VString l_trace = VString("VRemoteDebugPilot::BreakpointReached ctx activation pb for ctxid=");
	l_trace.AppendLong8((unsigned long long)inContext);
	l_trace += " ,ok=";
	l_trace += (!l_err ? "1" : "0" );
	sPrivateLogHandler->Put( (l_err ? WAKDBG_ERROR_LEVEL : WAKDBG_INFO_LEVEL),l_trace);

	return l_err;
}