本文整理汇总了C++中printStackTrace函数的典型用法代码示例。如果您正苦于以下问题:C++ printStackTrace函数的具体用法?C++ printStackTrace怎么用?C++ printStackTrace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printStackTrace函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CToJavaCallHandler
char __cdecl CToJavaCallHandler(DCCallback* callback, DCArgs* args, DCValue* result, void* userdata)
{
CallTempStruct* call;
jthrowable exc;
NativeToJavaCallbackCallInfo* info = (NativeToJavaCallbackCallInfo*)userdata;
JNIEnv *env = GetEnv();
initCallHandler(NULL, &call, env, &info->fInfo);
call->pCallIOs = info->fInfo.fCallIOs;
BEGIN_TRY(env, call);
CToJavaCallHandler_Sub(call, info, args, result);
END_TRY(info->fInfo.fEnv, call);
exc = (*env)->ExceptionOccurred(env);
if (exc) {
(*env)->ExceptionDescribe(env);
printStackTrace(env, exc);
//(*env)->ExceptionClear(env);
}
cleanupCallHandler(call);
return info->fInfo.fDCReturnType;
}
开发者ID:Jeyatharsini,项目名称:BridJ,代码行数:28,代码来源:CallbackHandler.c
示例2: dprintf
void StackTraceNoHeap::log(const char *errorType, const char *tracefn,
const char *pid, const char *buildId,
int debuggerCount) const {
int fd = ::open(tracefn, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR);
if (fd < 0) return;
dprintf(fd, "Host: %s\n",Process::GetHostName().c_str());
dprintf(fd, "ProcessID: %s\n", pid);
dprintf(fd, "ThreadID: %" PRIx64"\n", (int64_t)Process::GetThreadId());
dprintf(fd, "ThreadPID: %u\n", Process::GetThreadPid());
dprintf(fd, "Name: %s\n", Process::GetAppName().c_str());
dprintf(fd, "Type: %s\n", errorType ? errorType : "(unknown error)");
dprintf(fd, "Runtime: hhvm\n");
dprintf(fd, "Version: %s\n", buildId);
dprintf(fd, "DebuggerCount: %d\n", debuggerCount);
dprintf(fd, "\n");
for (auto const& pair : StackTraceLog::s_logData->data) {
dprintf(fd, "%s: %s\n", pair.first.c_str(), pair.second.c_str());
}
dprintf(fd, "\n");
printStackTrace(fd);
::close(fd);
}
开发者ID:Alienfeel,项目名称:hhvm,代码行数:26,代码来源:stack-trace.cpp
示例3: signal_handler
static void signal_handler(int sig) {
char *name;
switch (sig) {
case SIGILL:
name = "SIGILL";
break;
case SIGABRT:
name = "SIGABRT";
break;
case SIGBUS:
name = "SIGBUS";
break;
case SIGSEGV:
name = "SIGSEGV";
break;
default:
name = "??";
}
fprintf(stdout, "received signal %s\n", name);
printStackTrace();
printProfileInfo();
signal(SIGILL, NULL);
signal(SIGABRT, NULL);
signal(SIGBUS, NULL);
signal(SIGSEGV, NULL);
abort();
}
开发者ID:zyb2013,项目名称:kvm-src,代码行数:30,代码来源:runtime_md.c
示例4: assertAlreadyDeclared
void assertAlreadyDeclared(void *p, int len) {
if( commitJob.wi()._debug[p] >= len )
return;
log() << "assertAlreadyDeclared fails " << (void*)p << " len:" << len << ' ' << commitJob.wi()._debug[p] << endl;
printStackTrace();
abort();
}
开发者ID:BendustiK,项目名称:mongo,代码行数:7,代码来源:dur_commitjob.cpp
示例5: dprintf
void StackTraceNoHeap::log(const char *errorType, const char *tracefn,
const char *pid) const {
int fd = ::open(tracefn, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR);
if (fd < 0) return;
dprintf(fd, "Host: %s\n",Process::GetHostName().c_str());
dprintf(fd, "ProcessID: %s\n", pid);
dprintf(fd, "ThreadID: %llx\n", (int64)Process::GetThreadId());
dprintf(fd, "ThreadPID: %u\n", Process::GetThreadPid());
dprintf(fd, "Name: %s\n", Process::GetAppName().c_str());
dprintf(fd, "Type: %s\n", errorType ? errorType : "(unknown error)");
dprintf(fd, "Runtime: %s\n", hhvm ? "hhvm" : "hphp");
dprintf(fd, "Version: %s\n", COMPILER_ID);
dprintf(fd, "\n");
hphp_string_map<std::string> &extra = StackTraceLog::s_logData->data;
for (hphp_string_map<std::string>::const_iterator iter = extra.begin();
iter != extra.end(); ++iter) {
dprintf(fd, "%s: %s\n", iter->first.c_str(), iter->second.c_str());
}
dprintf(fd, "\n");
printStackTrace(fd);
::close(fd);
}
开发者ID:Bathrisyah,项目名称:hiphop-php,代码行数:26,代码来源:stack_trace.cpp
示例6: signalHandler
void signalHandler(int signum)
{
// associate each signal with a signal name string.
const char* name = NULL;
switch(signum)
{
case SIGABRT: name = "SIGABRT"; break;
case SIGSEGV: name = "SIGSEGV"; break;
case SIGILL: name = "SIGILL"; break;
case SIGFPE: name = "SIGFPE"; break;
default: break;
}
// Dump a stack trace to a file.
QFile stackTraceFile;
QString& tmpPath = OpenModelica::tempDirectory();
stackTraceFile.setFileName(QString("%1openmodelica.stacktrace.%2").arg(tmpPath).arg(Helper::OMCServerName));
if (stackTraceFile.open(QIODevice::WriteOnly | QIODevice::Text))
{
printStackTrace(&stackTraceFile, signum, name);
stackTraceFile.close();
}
if (name)
fprintf(stderr, "Caught signal %d", signum);
else
fprintf(stderr, "Caught signal %d (%s)", signum, name);
CrashReportDialog *pCrashReportDialog = new CrashReportDialog;
pCrashReportDialog->exec();
// If you caught one of the above signals, it is likely you just
// want to quit your program right now.
exit(signum);
}
开发者ID:acracan,项目名称:OMEdit,代码行数:32,代码来源:main.cpp
示例7: FatalError
void FatalError(const std::string & errorMessage)
{
std::cerr << "\n\n\nSparCraft Fatal Error: \n\n\n " << errorMessage << "\n\n";
printStackTrace(1);
throw(SPARCRAFT_FATAL_ERROR);
}
开发者ID:eras44,项目名称:sparcraft,代码行数:7,代码来源:Common.cpp
示例8: sigbadHandler
// TODO: if we get a segfault while saving, what then?
void sigbadHandler ( int x , siginfo_t *info , void *y ) {
log("loop: sigbadhandler. disabling handler from recall.");
// . don't allow this handler to be called again
// . does this work if we're in a thread?
struct sigaction sa;
sigemptyset (&sa.sa_mask);
sa.sa_flags = SA_SIGINFO ; //| SA_ONESHOT;
sa.sa_sigaction = NULL;
sigaction(SIGSEGV, &sa, NULL);
sigaction(SIGILL, &sa, NULL);
sigaction(SIGFPE, &sa, NULL);
sigaction(SIGBUS, &sa, NULL);
sigaction(SIGQUIT, &sa, NULL);
sigaction(SIGSYS, &sa, NULL);
// if we've already been here, or don't need to be, then bail
if ( g_loop.m_shutdown ) {
log("loop: sigbadhandler. shutdown already called.");
return;
}
// unwind
printStackTrace();
// if we're a thread, let main process know to shutdown
g_loop.m_shutdown = 2;
log("loop: sigbadhandler. trying to save now. mode=%" PRId32, (int32_t)g_process.m_mode);
// . this will save all Rdb's
// . if "urgent" is true it will dump core
// . if "urgent" is true it won't broadcast its shutdown to all hosts
g_process.shutdown ( true );
}
开发者ID:privacore,项目名称:open-source-search-engine,代码行数:34,代码来源:Loop.cpp
示例9: applyTransactionFromOplog
// takes an entry that was written _logTransactionOps
// and applies them to collections
//
// TODO: possibly improve performance of this. We create and destroy a
// context for each operation. Find a way to amortize it out if necessary
//
void applyTransactionFromOplog(BSONObj entry) {
bool transactionAlreadyApplied = entry["a"].Bool();
if (!transactionAlreadyApplied) {
Client::Transaction transaction(DB_SERIALIZABLE);
if (entry.hasElement("ref")) {
applyRefOp(entry);
} else if (entry.hasElement("ops")) {
applyOps(entry["ops"].Array());
} else {
verify(0);
}
// set the applied bool to true, to let the oplog know that
// this entry has been applied to collections
BSONElementManipulator(entry["a"]).setBool(true);
{
LOCK_REASON(lockReason, "repl: setting oplog entry's applied bit");
Lock::DBRead lk1("local", lockReason);
writeEntryToOplog(entry, false);
}
// If this code fails, it is impossible to recover from
// because we don't know if the transaction successfully committed
// so we might as well crash
// There is currently no known way this code can throw an exception
try {
// we are operating as a secondary. We don't have to fsync
transaction.commit(DB_TXN_NOSYNC);
}
catch (std::exception &e) {
log() << "exception during commit of applyTransactionFromOplog, aborting system: " << e.what() << endl;
printStackTrace();
logflush();
::abort();
}
}
}
开发者ID:nvdnkpr,项目名称:mongo,代码行数:41,代码来源:oplog.cpp
示例10: abortHandler
void abortHandler( int signum )
#endif
{
// associate each signal with a signal name string.
const char * name = NULL;
switch ( signum )
{
case SIGABRT: name = "SIGABRT" ; break ;
case SIGSEGV: name = "SIGSEGV" ; break ;
#ifndef WIN32
case SIGBUS: name = "SIGBUS" ; break ;
#endif
case SIGILL: name = "SIGILL" ; break ;
case SIGFPE: name = "SIGFPE" ; break ;
}
// Notify the user which signal was caught. We use printf, because this is the
// most basic output function. Once you get a crash, it is possible that more
// complex output systems like streams and the like may be corrupted. So we
// make the most basic call possible to the lowest level, most
// standard print function.
if ( name )
fprintf ( stderr, "Caught signal %d(%s)\n" , signum, name );
else
fprintf ( stderr, "Caught signal %d\n" , signum );
// Dump a stack trace. Will do Windows/Cygwin later. Randy
#ifdef UNIX_BACKTRACE_OK
printStackTrace();
#else
// StackDump();
#endif
// If you caught one of the above signals, it is likely you just
// want to quit your program right now.
exit ( signum );
}
开发者ID:carlyjiang,项目名称:UnifyCodeCounterObjectiveCCounter,代码行数:35,代码来源:UCCExceptDump.cpp
示例11: printMemoryLeaks
extern void printMemoryLeaks()
{
// Dump general heap memory leaks
if (__memoryAllocationCount == 0)
{
gameplay::print("[memory] All HEAP allocations successfully cleaned up (no leaks detected).\n");
}
else
{
gameplay::print("[memory] WARNING: %d HEAP allocations still active in memory.\n", __memoryAllocationCount);
MemoryAllocationRecord* rec = __memoryAllocations;
while (rec)
{
#ifdef WIN32
if (rec->trackStackTrace)
{
gameplay::print("[memory] LEAK: HEAP allocation leak at address %#x of size %d:\n", rec->address, rec->size);
printStackTrace(rec);
}
else
gameplay::print("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
#else
gameplay::print("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
#endif
rec = rec->next;
}
}
}
开发者ID:faustgames-ru,项目名称:AndroidWallpapers,代码行数:28,代码来源:DebugNew.cpp
示例12: repl
void repl(Interpreter &interpreter, const Settings &settings)
{
std::cout << "Enter some code, or type \'exit\' when finished:\n";
std::string line;
int count = 0;
while((std::cout << " > ") && std::getline(std::cin, line) && !(line == "quit" || line == "exit"))
{
++count;
try
{
Token token = lex("repl(" + str(count) + ")", line);
Declarations declarations = interpreter.declarations();
InstructionList instructions = parse(token, declarations, settings);
if (!instructions.empty())
{
Value result = interpreter.exec(instructions);
std::cout << " < " << result << std::endl;
}
}
catch(const LexError &e)
{
std::cerr << "Lex error at " << e.sourceLocation() << " " << e.what() << '\n';
printStackTrace(std::cerr, e);
}
catch(const ParseError &e)
{
std::cerr << "Parse error at " << e.sourceLocation() << " " << e.what() << '\n';
printStackTrace(std::cerr, e);
}
catch(const ExecutionError &e)
{
std::cerr << "Execution error at " << e.sourceLocation() << " " << e.what() << '\n';
printStackTrace(std::cerr, e);
}
catch(const RaspError &e)
{
std::cerr << "General error: " << e.what() << '\n';
printStackTrace(std::cerr, e);
}
catch(const std::exception &error)
{
std::cerr << "Internal Error: " << error.what() << std::endl;
}
}
// If you use CTRL-D, nice to output a newline...
std::cout << '\n';
}
开发者ID:rip-off,项目名称:rasp-lang,代码行数:47,代码来源:repl.cpp
示例13: msgasserted
NOINLINE_DECL void msgasserted(int msgid, const char *msg) {
assertionCount.condrollover( ++assertionCount.warning );
tlog() << "Assertion: " << msgid << ":" << msg << endl;
raiseError(msgid,msg && *msg ? msg : "massert failure");
breakpoint();
printStackTrace();
throw MsgAssertionException(msgid, msg);
}
开发者ID:Eric-Lu,项目名称:mongo,代码行数:8,代码来源:assert_util.cpp
示例14: DBException
WriteConflictException::WriteConflictException()
: DBException( "WriteConflict", ErrorCodes::WriteConflict ) {
if ( trace ) {
printStackTrace();
}
}
开发者ID:3rf,项目名称:mongo,代码行数:8,代码来源:write_conflict_exception.cpp
示例15: printNumericStackTrace
/* The given object 'sobj' must have a void println(char[]) method */
JNIEXPORT void JNICALL Java_java_lang_Throwable_printStackTrace0
(JNIEnv *env, jobject thisobj, jobject sobj) {
StackTrace tr;
tr = (StackTrace)FNI_GetJNIData(env, thisobj);
if (printStackTrace(env, sobj, tr) != 0)
printNumericStackTrace(env, sobj, tr);
return;
}
开发者ID:fenghaitao,项目名称:Harpoon,代码行数:9,代码来源:java_lang_Throwable.c
示例16: printStackTrace
/**
* Prints stack trace to stdout
*/
extern SERVER_DECL void printStackTrace()
{
#if defined(WIN32) && defined(_DEBUG)
char buffer[6400];
printStackTrace(&buffer[0], 6400);
printf("%s", buffer);
#endif
}
开发者ID:AriDEV,项目名称:AscEmu,代码行数:11,代码来源:printStackTrace.cpp
示例17: msgasserted
void msgasserted(int msgid, const char *msg) {
assertionCount.condrollover( ++assertionCount.warning );
tlog() << "Assertion: " << msgid << ":" << msg << endl;
lastAssert[2].set(msg, getDbContext().c_str(), "", 0);
raiseError(msgid,msg && *msg ? msg : "massert failure");
breakpoint();
printStackTrace();
throw MsgAssertionException(msgid, msg);
}
开发者ID:kapouer,项目名称:mongo-debian,代码行数:9,代码来源:assert_util.cpp
示例18: arcAssertFailed
/**
* Used for assertions
*/
extern SERVER_DECL void arcAssertFailed(const char* fname, int line, const char* expr)
{
printf("Assertion Failed: (%s)\n", expr);
printf("Location: %s(%i)\n", fname, line);
//printf( "Expression: %s\n", expr );
#if defined(WIN32) && defined(_DEBUG)
printf("Stack trace:\n");
printStackTrace();
#endif
}
开发者ID:AriDEV,项目名称:AscEmu,代码行数:13,代码来源:printStackTrace.cpp
示例19: Abort
void Abort(const char* error, ...) {
va_list argptr;
va_start (argptr, error);
fprintf(stderr,"Abort: ");
vfprintf(stderr,error,argptr);
fprintf(stderr,"\n");
va_end (argptr);
printStackTrace();
throw;
}
开发者ID:ihh,项目名称:wtfgenes,代码行数:10,代码来源:util.cpp
示例20: abortHandler
void abortHandler ( int signum )
{
#ifdef GNUC
FILE* outfile = OpenStackFile ();
FILE* out;
if( outfile == nullptr )
{
printf( "Unable to open !stacktrace.txt\n" );
out = stdout;
}
else
{
out = outfile;
}
// associate each signal with a signal name string.
const char* name = NULL;
switch( signum )
{
case SIGABRT: name = "SIGABRT"; break;
case SIGSEGV: name = "SIGSEGV"; break;
case SIGBUS: name = "SIGBUS"; break;
case SIGILL: name = "SIGILL"; break;
case SIGFPE: name = "SIGFPE"; break;
default: name = "Unknown signum"; break;
}
// Notify the user which signal was caught. We use printf, because this is the
// most basic output function. Once you get a crash, it is possible that more
// complex output systems like streams and the like may be corrupted. So we
// make the most basic call possible to the lowest level, most
// standard print function.
if( name )
fprintf ( out, "Caught signal %d (%s)\n\n", signum, name );
else
fprintf ( out, "Caught signal %d\n\n", signum );
// Dump a stack trace.
// This is the function we will be implementing next.
printStackTrace ( out );
// If you caught one of the above signals, it is likely you just
// want to quit your program right now.
if( outfile )
fclose ( outfile );
exit(signum);
#else
throw signum; // Just use C++ UnhandledException filters on windows.
// This allows us to get current thread context without
// the need to use assembly code.
#endif
}
开发者ID:SM91337,项目名称:NoCheatZ-4,代码行数:55,代码来源:SigHandler.cpp
注:本文中的printStackTrace函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论