当前位置: 首页>>代码示例>>C++>>正文


C++ PrintException函数代码示例

本文整理汇总了C++中PrintException函数的典型用法代码示例。如果您正苦于以下问题:C++ PrintException函数的具体用法?C++ PrintException怎么用?C++ PrintException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PrintException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Printf

bool ProfilerHandler::Attach() {
  try {
    if (amx_path_.empty()) {
      return false;
    }
    if (state_ >= PROFILER_ATTACHED) {
      return false;
    }

    if (amxprof::HasDebugInfo(amx())) {
      if (debug_info_.Load(amx_path_)) {
        profiler_.set_debug_info(&debug_info_);
      } else {
        Printf("Error loading debug info: %s",
                aux_StrError(debug_info_.last_error()));
      }
    }

    if (debug_info_.is_loaded()) {
      Printf("Attached profiler to %s", amx_name_.c_str());
    } else {
      Printf("Attached profiler to %s (no debug info)", amx_name_.c_str());
    }

    state_ = PROFILER_ATTACHED;
    return true;
  }
  catch (const std::exception &e) {
    PrintException(e);
  }
  return false;
}
开发者ID:Zeex,项目名称:samp-plugin-profiler,代码行数:32,代码来源:profilerhandler.cpp

示例2: AppInit

bool AppInit(int argc, char* argv[])
{
    bool fRet = false;
    try
    {
        fRet = AppInit2(argc, argv);
    }
    catch (std::exception& e) {
        PrintException(&e, "AppInit()");
    } catch (...) {
        PrintException(NULL, "AppInit()");
    }
    if (!fRet)
        Shutdown(NULL);
    return fRet;
}
开发者ID:fconcklin,项目名称:namecoin,代码行数:16,代码来源:init.cpp

示例3: switch

int ProfilerHandler::Exec(cell *retval, int index) {
  if (profiler_.call_stack()->is_empty()) {
    switch (state_) {
      case PROFILER_ATTACHING:
        if (!Attach()) {
          break;
        }
        // fallthrough
      case PROFILER_STARTING:
        CompleteStart();
        break;
    }
  }
  if (state_ == PROFILER_STARTED) {
    try {
      int error = profiler_.ExecHook(retval, index, amx_Exec);
      if (state_ == PROFILER_STOPPING
          && profiler_.call_stack()->is_empty()) {
        CompleteStop();
      }
      return error;
    } catch (const std::exception &e) {
      PrintException(e);
    }
  }
  return amx_Exec(amx(), retval, index);
}
开发者ID:Zeex,项目名称:samp-plugin-profiler,代码行数:27,代码来源:profilerhandler.cpp

示例4: Top_Level_Exception_Filter_hack2

LONG __fastcall Top_Level_Exception_Filter_hack2(int exception_id, struct _EXCEPTION_POINTERS *ExceptionInfo)
{
    DWORD *eip = &(ExceptionInfo->ContextRecord->Eip);
    switch (*eip)
    {
    /* Fog of war crashes */
    case 0x0046C7E2:
        *eip = 0x0046C837;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x0046BA24:
        *eip = 0x0046BA55;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x0046AF75:
        *eip = 0x0046AFB5;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x00469129:
        *eip = 0x00469163;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x00469AD6:
        *eip = 0x00469B1A;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x0046C7A7:
        *eip = 0x0046C837;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x0046AF6E:
        *eip = 0x0046AFB5;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x00469AA0:
        *eip = 0x00469B1A;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x0046B9E9:
        *eip = 0x0046BA55;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x004681B4:
        *eip = 0x004681E6;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x004690EF:
        *eip = 0x00469163;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x0046AF8A:
        *eip = 0x0046AFB5;
        return EXCEPTION_CONTINUE_EXECUTION;

    /* non-fog of war crashes*/
    case 0x006A8D16:
        *eip = 0x006A8D1F;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x006703d4:
        *eip = 0x00670499;
        return EXCEPTION_CONTINUE_EXECUTION;
    case 0x004668a8:
        *eip = 0x004668AD;
        return EXCEPTION_CONTINUE_EXECUTION;


    default:
        return PrintException(exception_id, ExceptionInfo);
    }
    return 0;
}
开发者ID:CnCNet,项目名称:ts-patches,代码行数:60,代码来源:exception_catch.c

示例5: PrintException

HRESULT WScriptJsrt::ModuleMessage::Call(LPCSTR fileName)
{
    JsErrorCode errorCode;
    JsValueRef result = JS_INVALID_REFERENCE;
    HRESULT hr;
    if (specifier == nullptr)
    {
        errorCode = ChakraRTInterface::JsModuleEvaluation(moduleRecord, &result);
        if (errorCode != JsNoError)
        {
            PrintException(fileName, errorCode);
        }
    }
    else
    {
        LPCSTR fileContent = nullptr;
        char* specifierStr = nullptr;
        size_t length;
        errorCode = ChakraRTInterface::JsStringToPointerUtf8Copy(specifier, &specifierStr, &length);
        if (errorCode == JsNoError)
        {
            hr = Helpers::LoadScriptFromFile(specifierStr, fileContent);
            if (FAILED(hr))
            {
                fprintf(stderr, "Couldn't load file.\n");
            }
            else
            {
                LoadScript(nullptr, specifierStr, fileContent, "module", true);
            }
        }
    }
    return errorCode;
}
开发者ID:ianwjhalliday,项目名称:ChakraCore,代码行数:34,代码来源:WScriptJsrt.cpp

示例6: main

int main(int argc, char **argv)
try {
  if (argc < 3) {
    unsigned n = 100;
    if (argc > 1) {
      n = atoi(argv[1]);
    }
    TestTrace(Path(_T("test/data/09kc3ov3.igc")), n);
  } else {
    assert(argc >= 3);
    unsigned n = atoi(argv[2]);
    plan_tests(n);
    
    for (unsigned i=2; i<2+n; i++) {
      unsigned nt = pow(2,i);
      char buf[100];
      sprintf(buf," trace size %d", nt);
      ok(TestTrace(PathName(argv[1]), nt),buf, 0);
    }
  }
  return 0;
} catch (const std::runtime_error &e) {
  PrintException(e);
  return EXIT_FAILURE;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:25,代码来源:TestTrace.cpp

示例7: main

int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(bitcoin);
    QApplication app(argc, argv);

    // Load language file for system locale
    QString locale = QLocale::system().name();
    QTranslator translator;
    translator.load("bitcoin_"+locale);
    app.installTranslator(&translator);

    app.setQuitOnLastWindowClosed(false);

    try
    {
        if(AppInit2(argc, argv))
        {
            {
                // Put this in a block, so that BitcoinGUI is cleaned up properly before
                // calling shutdown.
                BitcoinGUI window;
                ClientModel clientModel(pwalletMain);
                WalletModel walletModel(pwalletMain);
                guiref = &window;
                window.setClientModel(&clientModel);
                window.setWalletModel(&walletModel);

                window.show();

                app.exec();

                guiref = 0;
            }
            Shutdown(NULL);
        }
        else
        {
            return 1;
        }
    } catch (std::exception& e) {
        PrintException(&e, "Runaway exception");
    } catch (...) {
        PrintException(NULL, "Runaway exception");
    }
    return 0;
}
开发者ID:beecee1,项目名称:Fairbrix,代码行数:46,代码来源:bitcoin.cpp

示例8: catch

int ProfilerHandler::Callback(cell index, cell *result, cell *params) {
  if (state_ == PROFILER_STARTED) {
    try {
      return profiler_.CallbackHook(index, result, params, prev_callback_);
    } catch (const std::exception &e) {
      PrintException(e);
    }
  }
  return prev_callback_(amx(), index, result, params);
}
开发者ID:Zeex,项目名称:samp-plugin-profiler,代码行数:10,代码来源:profilerhandler.cpp

示例9: main

int main(int argc, char **argv)
try {
  plan_tests(102);

  TestOpenAir();
  TestTNP();

  return exit_status();
} catch (const std::runtime_error &e) {
  PrintException(e);
  return EXIT_FAILURE;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:12,代码来源:TestAirspaceParser.cpp

示例10: main

int main(int argc, char **argv)
try {
  plan_tests(30);

  TestReader();
  TestWriter();

  return exit_status();
} catch (const std::runtime_error &e) {
  PrintException(e);
  return EXIT_FAILURE;
}
开发者ID:staylo,项目名称:XCSoar,代码行数:12,代码来源:TestPlanes.cpp

示例11: main

/* Main function that builds and runs the application */
int main(void){
    AsteroidGame::AsteroidGame application;

	try {
		application.Init();
		application.MainLoop();
	}
	catch (std::exception &e){
		PrintException(e);
	}

    return 0;
}
开发者ID:Untamedhawk,项目名称:Comp3501,代码行数:14,代码来源:main.cpp

示例12: Test

bool Test()
{
	if( strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY") )
	{
		printf("%s: Skipped due to AS_MAX_PORTABILITY\n", TESTNAME);
		return false;
	}
	bool fail = false;
	int r;

 	asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
	COutStream out;
	engine->SetMessageCallback(asMETHOD(COutStream,Callback), &out, asCALL_THISCALL);

	RegisterStdString(engine);

	engine->RegisterGlobalFunction("void Assert(bool)", asFUNCTION(Assert), asCALL_GENERIC);

	engine->RegisterObjectType("Dict", sizeof(CDict), asOBJ_VALUE | asOBJ_APP_CLASS_CDA);	
	engine->RegisterObjectBehaviour("Dict", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(Construct), asCALL_CDECL_OBJLAST);
	engine->RegisterObjectBehaviour("Dict", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(Destruct), asCALL_CDECL_OBJLAST);
	engine->RegisterObjectMethod("Dict", "Dict &opAssign(const Dict &in)", asMETHOD(CDict,operator=), asCALL_THISCALL);

	engine->RegisterObjectMethod("Dict", "Dict &opIndex(string)", asMETHOD(CDict, operator[]), asCALL_THISCALL);

	asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE);
	mod->AddScriptSection(TESTNAME, script1, strlen(script1), 0);
	r = mod->Build();
	if( r < 0 )
	{
		TEST_FAILED;
		printf("%s: Failed to compile the script\n", TESTNAME);
	}

	asIScriptContext *ctx = engine->CreateContext();
	r = ExecuteString(engine, "TestDict()", mod, ctx);
	if( r != asEXECUTION_FINISHED )
	{
		if( r == asEXECUTION_EXCEPTION )
			PrintException(ctx);

		printf("%s: Failed to execute script\n", TESTNAME);
		TEST_FAILED;
	}
	if( ctx ) ctx->Release();

	engine->Release();

	// Success
	return fail;
}
开发者ID:Naddiseo,项目名称:Angelscript-fork,代码行数:51,代码来源:test_dict.cpp

示例13: IfJsrtErrorHR

HRESULT WScriptJsrt::CallbackMessage::CallFunction(LPCSTR fileName)
{
    HRESULT hr = S_OK;

    JsValueRef global;
    JsValueRef result;
    JsValueRef stringValue;
    JsValueType type;
    JsErrorCode errorCode = JsNoError;

    IfJsrtErrorHR(ChakraRTInterface::JsGetGlobalObject(&global));
    IfJsrtErrorHR(ChakraRTInterface::JsGetValueType(m_function, &type));

    if (type == JsString)
    {
        AutoString script;
        size_t length = 0;

        IfJsrtErrorHR(ChakraRTInterface::JsConvertValueToString(m_function, &stringValue));
        IfJsrtErrorHR(ChakraRTInterface::JsStringToPointerUtf8Copy(stringValue, &script, &length));

        // Run the code
#if ENABLE_TTD
        errorCode = ChakraRTInterface::JsTTDRunScript(this->GetId(), *script, JS_SOURCE_CONTEXT_NONE, "" /*sourceUrl*/, nullptr /*no result needed*/);
#else
        errorCode = ChakraRTInterface::JsRunScriptUtf8(*script, JS_SOURCE_CONTEXT_NONE, "" /*sourceUrl*/, nullptr /*no result needed*/);
#endif
    }
    else
    {
#if ENABLE_TTD
        errorCode = ChakraRTInterface::JsTTDCallFunction(this->GetId(), m_function, &global, 1, &result);
#else
        errorCode = ChakraRTInterface::JsCallFunction(m_function, &global, 1, &result);
#endif
    }

    if (errorCode != JsNoError)
    {
        hr = E_FAIL;
        PrintException(fileName, errorCode);
    }

Error:
    return hr;
}
开发者ID:liminzhu,项目名称:ChakraCore,代码行数:46,代码来源:WScriptJsrt.cpp

示例14: main

int main(int argc, char **argv)
try {
  Args args(argc, argv, "PORT BAUD");
  DebugPort debug_port(args);
  args.ExpectEnd();

  ScopeGlobalAsioThread global_asio_thread;

  NullDataHandler handler;
  auto port = debug_port.Open(*asio_thread, handler);

  ConsoleOperationEnvironment env;

  if (!port->WaitConnected(env)) {
    fprintf(stderr, "Failed to connect the port\n");
    return EXIT_FAILURE;
  }

  char buffer[4096];
  while (true) {
    switch (port->WaitRead(env, std::chrono::minutes(1))) {
    case Port::WaitResult::READY:
      break;

    case Port::WaitResult::TIMEOUT:
      continue;

    case Port::WaitResult::FAILED:
      return EXIT_FAILURE;

    case Port::WaitResult::CANCELLED:
      return EXIT_SUCCESS;
    }

    int nbytes = port->Read(buffer, sizeof(buffer));
    if (nbytes < 0)
      break;

    fwrite((const void *)buffer, 1, nbytes, stdout);
  }

  return EXIT_SUCCESS;
} catch (const std::exception &exception) {
  PrintException(exception);
  return EXIT_FAILURE;
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:46,代码来源:ReadPort.cpp

示例15: main

int
main(int argc, char **argv)
try {
  Args args(argc, argv, "FILE.igc");
  const auto path = args.ExpectNextPath();
  args.ExpectEnd();

  GRecord g;
  g.Initialize();

  g.VerifyGRecordInFile(path);
  fprintf(stderr, "G record is ok\n");
  return EXIT_SUCCESS;
} catch (const std::runtime_error &e) {
  PrintException(e);
  return EXIT_FAILURE;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:17,代码来源:VerifyGRecord.cpp


注:本文中的PrintException函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。