1 /*-------------------------------------------------------------------------
6 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
11 * $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.20 2001/01/24 19:43:15 momjian Exp $
14 * This should eventually work with elog(), dlog(), etc.
16 *-------------------------------------------------------------------------
23 #include "utils/exc.h"
26 ExceptionalCondition(char *conditionName,
27 Exception *exceptionP,
32 ExcFileName = fileName;
33 ExcLineNumber = lineNumber;
35 if (!PointerIsValid(conditionName)
36 || !PointerIsValid(fileName)
37 || !PointerIsValid(exceptionP))
39 fprintf(stderr, "TRAP: ExceptionalCondition: bad arguments\n");
48 fprintf(stderr, "TRAP: %s(\"%s:%s\", File: \"%s\", Line: %d)\n",
49 exceptionP->message, conditionName,
50 (detail == NULL ? "" : detail),
51 fileName, lineNumber);
54 #ifdef ABORT_ON_ASSERT
57 #ifdef SLEEP_ON_ASSERT
62 * XXX Depending on the Exception and tracing conditions, you will XXX
63 * want to stop here immediately and maybe dump core. XXX This may be
64 * especially true for Assert(), etc.
67 /* TraceDump(); dump the trace stack */
69 /* XXX FIXME: detail is lost */
70 ExcRaise(exceptionP, (ExcDetail) 0, (ExcData) NULL, conditionName);