Exemple #1
0
void ExitOnError(AMX *amx, int error)
{
  if (error != AMX_ERR_NONE) {
    #if defined AMXDBG
      FILE *fp;
      AMX_DBG amxdbg;
      long line;
      const char *filename;
    #endif

    printf("Run time error %d: \"%s\" on address %ld\n",
           error, aux_StrError(error), (long)amx->cip);

    /* optionally use the debug library to find the line number (if debug info.
     * is available)
     */
    #if defined AMXDBG
      /* load the debug info. */
      if ((fp=fopen(g_filename,"rb")) != NULL && dbg_LoadInfo(&amxdbg,fp) == AMX_ERR_NONE) {
        dbg_LookupFile(&amxdbg, amx->cip, &filename);
        dbg_LookupLine(&amxdbg, amx->cip, &line);
        printf("File: %s, line: %ld\n", filename, line);
        dbg_FreeInfo(&amxdbg);
        fclose(fp);
      } /* if */
    #endif
    exit(1);
  } /* if */
}
static void ErrorExit(AMX *amx, int errorcode)
{
    printf("Run time error %d: \"%s\" on line %ld\n",
           errorcode, aux_StrError(errorcode),
           (amx != NULL) ? amx->curline : 0);
    exit(1);
}
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;
}
Exemple #4
0
void AMXPrintError(CGameMode* pGameMode, AMX *amx, int error)
{
	if (error != AMX_ERR_NONE)
	{
		logprintf("Script[%s]: Run time error %d: \"%s\"",// on line %ld\n",
			pGameMode->GetFileName(), error, aux_StrError(error));//, (long)amx->curline);
	}
}
Exemple #5
0
void ExitOnError(AMX *amx, int error)
{
  if (error != AMX_ERR_NONE) {
    printf("Run time error %d: \"%s\" on line %ld\n",
           error, aux_StrError(error), (long)amx->curline);
    exit(1);
  } /* if */
}
Exemple #6
0
void AMXPrintError(CGamemodeManager* pGameMode, AMX *amx, int error)
{
	if (error != AMX_ERR_NONE)
	{
		logprintf("Script[%s]: Run time error %d: \"%s\"",
			pGameMode->GetFileName(), error, aux_StrError(error));
	}
}
Exemple #7
0
const char *my_aux_StrError(int status)
{
    if (status == AMX_ERR_FILE_CHANGED)
        return "AMX file changed while running";
    else if (status == AMX_ERR_ABORT)
        return "Program aborted by user";
    else
        return aux_StrError(status);
}
Exemple #8
0
static void ErrorExit(AMX *amx, int errorcode)
{
  printf("Run time error %d: \"%s\"\n", errorcode, aux_StrError(errorcode));
  exit(1);
}
void CNetwork::Error(int error) {
    printf("Run time error %d: \"%s\"\n",
           error, aux_StrError(error));
}
// static
const char *AMXError::GetStringFromCode(int error_code) {
  return aux_StrError(error_code);
}