Exemplo n.º 1
0
void WDbgArkAnalyzeObjType::Analyze(const ExtRemoteTyped &ex_type_info, const ExtRemoteTyped &object) {
    ExtRemoteTyped obj_type_info = ex_type_info;

    try {
        PrintObjectDmlCmd(object);
        PrintFooter();

        auto result = m_obj_helper->GetObjectName(object);

        if ( SUCCEEDED(result.first) )
            AddTempWhiteList(result.second);

        WDbgArkAnalyzeBase* display = static_cast<WDbgArkAnalyzeBase*>(this);

        display->Analyze(obj_type_info.Field("DumpProcedure").GetPtr(), "DumpProcedure", "");
        display->Analyze(obj_type_info.Field("OpenProcedure").GetPtr(), "OpenProcedure", "");
        display->Analyze(obj_type_info.Field("CloseProcedure").GetPtr(), "CloseProcedure", "");
        display->Analyze(obj_type_info.Field("DeleteProcedure").GetPtr(), "DeleteProcedure", "");
        display->Analyze(obj_type_info.Field("ParseProcedure").GetPtr(), "ParseProcedure", "");
        display->Analyze(obj_type_info.Field("SecurityProcedure").GetPtr(), "SecurityProcedure", "");
        display->Analyze(obj_type_info.Field("SecurityProcedure").GetPtr(), "QueryNameProcedure", "");
        PrintFooter();
    }
    catch(const ExtRemoteException &Ex) {
        err << wa::showminus << __FUNCTION__ << ": " << Ex.GetMessage() << endlerr;
    }

    InvalidateTempRanges();
}
Exemplo n.º 2
0
void WDbgArkAnalyzeDriver::DisplayMajorTable(const ExtRemoteTyped &object) {
    WDbgArkAnalyzeBase* display = static_cast<WDbgArkAnalyzeBase*>(this);

    out << wa::showplus << "Major table routines: " << endlout;
    PrintFooter();

    auto major_table = WDbgArkDrvObjHelper(m_sym_cache, object).GetMajorTable();

    for ( auto &entry : major_table )
        display->Analyze(entry.first, entry.second, "");

    PrintFooter();
}
Exemplo n.º 3
0
void WDbgArkAnalyzeDriver::DisplayFsFilterCallbacks(const ExtRemoteTyped &object) {
    WDbgArkAnalyzeBase* display = static_cast<WDbgArkAnalyzeBase*>(this);

    auto fs_cb_table = WDbgArkDrvObjHelper(m_sym_cache, object).GetFsFilterCbTable();

    if ( !fs_cb_table.empty() ) {
        out << wa::showplus << "FsFilterCallbacks table routines: " << endlout;
        PrintFooter();

        for ( auto &entry : fs_cb_table )
            display->Analyze(entry.first, entry.second, "");

        PrintFooter();
    }
}
Exemplo n.º 4
0
void WDbgArkAnalyzeDriver::Analyze(const ExtRemoteTyped &object) {
    ExtRemoteTyped& loc_object = const_cast<ExtRemoteTyped&>(object);

    try {
        PrintObjectDmlCmd(object);
        PrintFooter();

        WDbgArkAnalyzeBase* display = static_cast<WDbgArkAnalyzeBase*>(this);

        auto driver_start = loc_object.Field("DriverStart").GetPtr();
        uint32_t driver_size = loc_object.Field("DriverSize").GetUlong();

        if ( driver_start && driver_size )
            display->AddTempRangeWhiteList(driver_start, driver_size);

        auto result = m_obj_helper->GetObjectName(object);

        if ( SUCCEEDED(result.first) )
            AddTempWhiteList(result.second);

        out << wa::showplus << "Driver routines: " << endlout;
        PrintFooter();

        display->Analyze(loc_object.Field("DriverInit").GetPtr(), "DriverInit", "");
        display->Analyze(loc_object.Field("DriverStartIo").GetPtr(), "DriverStartIo", "");
        display->Analyze(loc_object.Field("DriverUnload").GetPtr(), "DriverUnload", "");

        if ( loc_object.Field("DriverExtension").GetPtr() )
            display->Analyze(loc_object.Field("DriverExtension").Field("AddDevice").GetPtr(), "AddDevice", "");

        PrintFooter();

        // display major table
        DisplayMajorTable(object);

        // display fast i/o table
        DisplayFastIo(object);

        // display FsFilterCallbacks
        DisplayFsFilterCallbacks(object);
    }
    catch(const ExtRemoteException &Ex) {
        err << wa::showminus << __FUNCTION__ << ": " << Ex.GetMessage() << endlerr;
    }

    PrintFooter();
    InvalidateTempRanges();
}
Exemplo n.º 5
0
int SchedBuilder::BuildRandomSchedule(void)
{
  unsigned int uiCnt = 0;

  /* Create Schedule */
  for (uiCnt = 0; uiCnt < m_uiEvents; uiCnt++) { AddRandomEvent(); }
  PrintHeader();
  PrintEvents();
  PrintFooter();
  PrintCompareFile();

  /* Done */
  return 0;
}
int main( int argc, char **argv )
{
    CommandLine()->CreateCmdLine( argc, argv );
    FileSystem_Init( "" );
    PrintHeader();
    LoadShaderDLL( "stdshader_dx6.dll" );
    LoadShaderDLL( "stdshader_dx7.dll" );
    LoadShaderDLL( "stdshader_dx8.dll" );
    LoadShaderDLL( "stdshader_dx9.dll" );
    int i;
    for( i = 0; i < g_ShaderDLLs.Count(); i++ )
    {
        PrintShaderContents( i );
    }
    for( i = 0; i < g_ShaderDLLs.Count(); i++ )
    {
        PrintShaderHelp( i );
    }
    PrintFooter();
    FileSystem_Term();
    return 0;
}
// Solution method
void NewtonSolver::Solve(arma::vec& solution,
    arma::vec& residualHistory,
    ExitFlagType& exitFlag,
    arma::mat* pJacobianExternal)
{

  // Parse parameter list
  Initialise();

  // Eventually print the header
  if (mPrintOutput)
  {
    PrintHeader("Newton Method", mMaxIterations, mTolerance);
  }

  // Check if dimensions are compatible
  int problem_size = mpInitialGuess->n_rows;
  assert( problem_size == solution.n_rows );

  // Iterator
  int iteration = 0;

  // Assign initial guess
  solution = *mpInitialGuess;

  // Initial residual
  arma::vec residual(problem_size);
  mpProblem->ComputeF(solution,residual);

  // Residual norm
  double residual_norm = arma::norm(residual,2);

  // Residual history
  residualHistory.set_size(1+mpParameterList->maxIterations);
  residualHistory(iteration) = residual_norm;

  // Eventually print iteration
  if (mPrintOutput)
  {
    PrintIteration(iteration, residual_norm, true);
  }

  // Check convergence
  bool converged = mpConvergenceCriterion->TestConvergence(residual_norm);

  arma::mat jacobian(problem_size,problem_size);
  // Newton's method main loop
  while ( (iteration < mMaxIterations) && (!converged) )
  {

    // Compute Jacobian (eventually use finite differences)
    if (mpProblemJacobian)
    {
      mpProblemJacobian->ComputeDFDU(solution,jacobian);
    }
    else
    {
      ComputeDFDU(solution,residual,jacobian);
    }

    // Linear solve to find direction
    arma::vec direction = arma::solve( jacobian, -residual);

    // Update solution
    solution += direction;

    // Update iterator
    iteration++;

    // Update residual
    mpProblem->ComputeF(solution,residual);

    // Update residual norm
    residual_norm = arma::norm(residual,2);

    // Check convergence
    converged = mpConvergenceCriterion->TestConvergence(residual_norm);

    // Update residual history
    residualHistory(iteration) = residual_norm;

    // Print infos
    if (mPrintOutput)
    {
      PrintIteration(iteration, residual_norm);
    }


  }

  // Trim residual history
  residualHistory.head(iteration);

  // Assign exit flag
  if (converged)
  {
    exitFlag = AbstractNonlinearSolver::ExitFlagType::converged;
  }
  else
  {
    exitFlag = AbstractNonlinearSolver::ExitFlagType::notConverged;
  }

  // Eventually print final message
  if (mPrintOutput)
  {
    PrintFooter(iteration, exitFlag);
  }

  // Output to external jacobian if requested
  if (pJacobianExternal)
  {
    assert( (*pJacobianExternal).n_rows==problem_size);
    assert( (*pJacobianExternal).n_cols==problem_size);
    assert( jacobian.n_rows==problem_size);
    (*pJacobianExternal) = jacobian;
  }

}
JBoolean
JPTPrinter::Print
	(
	const JCharacter*	text,
	ostream&			trueOutput
	)
{
	ostream* dataOutput  = &trueOutput;
	ofstream* tempOutput = NULL;
	JString tempName;
	if (itsPrintReverseOrderFlag)
		{
		if (!(JCreateTempFile(&tempName)).OK())
			{
			return kJFalse;
			}

		tempOutput = new ofstream(tempName);
		assert( tempOutput != NULL );
		if (tempOutput->bad())
			{
			delete tempOutput;
			JRemoveFile(tempName);
			return kJFalse;
			}
		dataOutput = tempOutput;
		}

	const JSize headerLineCount = GetHeaderLineCount();
	const JSize footerLineCount = GetFooterLineCount();
	assert( itsPageHeight > headerLineCount + footerLineCount );

	const JSize lineCountPerPage = itsPageHeight - headerLineCount - footerLineCount;

	JLatentPG pg;
	pg.VariableLengthProcessBeginning("Printing page...", kJTrue, kJFalse);
	JBoolean keepGoing = kJTrue;

	JUnsignedOffset i   = 0;
	JIndex pageIndex    = 0;
	JSize printCount    = 0;
	JSize textLineCount = 0;
	while (keepGoing && text[i] != '\0')
		{
		pageIndex++;
		const JBoolean shouldPrintPage =
			JI2B(itsFirstPageIndex <= pageIndex &&
				 (itsLastPageIndex == 0 || pageIndex <= itsLastPageIndex));

		std::ostringstream bitBucket;
		ostream* output = shouldPrintPage ? dataOutput : (&bitBucket);

		if (shouldPrintPage)
			{
			printCount++;
			if (printCount > 1)
				{
				*output << kPageSeparatorStr;
				}
			}

		if (headerLineCount > 0)
			{
			PrintHeader(*output, pageIndex);
			}

		JSize lineNumberWidth = 0;
		if (itsPrintLineNumberFlag)
			{
			const JString lastLineIndexStr(pageIndex * lineCountPerPage, 0);
			lineNumberWidth = lastLineIndexStr.GetLength();
			}

		JSize lineCount = 0;
		while (lineCount < lineCountPerPage && text[i] != '\0')
			{
			JSize col = 0;

			if (itsPrintLineNumberFlag)
				{
				const JString lineNumberStr(textLineCount+1, 0);
				const JSize spaceCount = lineNumberWidth - lineNumberStr.GetLength();
				for (JIndex j=1; j<=spaceCount; j++)
					{
					*output << ' ';
					}
				lineNumberStr.Print(*output);
				*output << kLineNumberMarginStr;

				col += lineNumberWidth + kLineNumberMarginWidth;
				}

			if (col >= itsPageWidth)	// insures progress, even in ludicrous boundary case
				{
				col = itsPageWidth - 1;
				}

			while (col < itsPageWidth && text[i] != '\n' && text[i] != '\0')
				{
				if (text[i] == '\t')
					{
					const JSize spaceCount = itsTabWidth - (col % itsTabWidth);
					for (JIndex j=1; j<=spaceCount; j++)
						{
						*output << ' ';
						}
					col += spaceCount;
					}
				else if (text[i] == kJFormFeedKey)
					{
					*output << ' ';
					col++;
					}
				else
					{
					*output << text[i];
					col++;
					}
				i++;
				}

			*output << '\n';
			if (text[i] == '\n')
				{
				i++;
				}

			lineCount++;
			textLineCount++;
			}

		if (footerLineCount > 0)
			{
			while (lineCount < lineCountPerPage)
				{
				*output << '\n';
				lineCount++;
				}

			PrintFooter(*output, pageIndex);
			}

		keepGoing = pg.IncrementProgress();
		}

	pg.ProcessFinished();

	if (itsPrintReverseOrderFlag)
		{
		delete tempOutput;
		if (keepGoing)
			{
			JString text;
			JReadFile(tempName, &text);
			InvertPageOrder(text, trueOutput);
			}
		JRemoveFile(tempName);
		}

	return keepGoing;
}