PostgreSQL Source Code git master
Functions
assert.c File Reference
#include "postgres.h"
#include <unistd.h>
Include dependency graph for assert.c:

Go to the source code of this file.

Functions

void  ExceptionalCondition (const char *conditionName, const char *fileName, int lineNumber)
 

Function Documentation

ExceptionalCondition()

void ExceptionalCondition ( const char *  conditionName,
const char *  fileName,
int  lineNumber 
)

Definition at line 30 of file assert.c.

33{
34 /* Report the failure on stderr (or local equivalent) */
35 if (!conditionName || !fileName)
36 write_stderr("TRAP: ExceptionalCondition: bad arguments in PID %d\n",
37 (int) getpid());
38 else
39 write_stderr("TRAP: failed Assert(\"%s\"), File: \"%s\", Line: %d, PID: %d\n",
40 conditionName, fileName, lineNumber, (int) getpid());
41
42 /* Usually this shouldn't be needed, but make sure the msg went out */
43 fflush(stderr);
44
45 /* If we have support for it, dump a simple backtrace */
46#ifdef HAVE_BACKTRACE_SYMBOLS
47 {
48 void *buf[100];
49 int nframes;
50
51 nframes = backtrace(buf, lengthof(buf));
52 backtrace_symbols_fd(buf, nframes, fileno(stderr));
53 }
54#endif
55
56 /*
57 * If configured to do so, sleep indefinitely to allow user to attach a
58 * debugger. It would be nice to use pg_usleep() here, but that can sleep
59 * at most 2G usec or ~33 minutes, which seems too short.
60 */
61#ifdef SLEEP_ON_ASSERT
62 sleep(1000000);
63#endif
64
65 abort();
66}
#define write_stderr(str)
Definition: parallel.c:186
#define lengthof(array)
Definition: c.h:787
static char * buf
Definition: pg_test_fsync.c:72

References buf, lengthof, and write_stderr.

Referenced by pg_re_throw().

AltStyle によって変換されたページ (->オリジナル) /