LCOV - differential code coverage report
Current view: top level - src/backend/utils/error - assert.c (source / functions) Coverage Total Hit UNC UBC DUB
Current: b45a8d7d8b306b43f31a002f1b3f1dddc8defeaf vs 8767b449a3a1e75626dfb08f24da54933171d4c5 Lines: 0.0 % 10 0 1 9 2
Current Date: 2025-10-28 08:26:42 +0900 Functions: 0.0 % 1 0 1
Baseline: lcov-20251028-005825-baseline Branches: 0.0 % 4 0 4
Baseline Date: 2025-10-27 06:37:35 +0000 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(30,360] days: 0.0 % 1 0 1
(360..) days: 0.0 % 9 0 9
Function coverage date bins:
(360..) days: 0.0 % 1 0 1
Branch coverage date bins:
(30,360] days: 0.0 % 4 0 4

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * assert.c
                                  4                 :                :  *    Assert support code.
                                  5                 :                :  *
                                  6                 :                :  * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
                                  7                 :                :  * Portions Copyright (c) 1994, Regents of the University of California
                                  8                 :                :  *
                                  9                 :                :  *
                                 10                 :                :  * IDENTIFICATION
                                 11                 :                :  *    src/backend/utils/error/assert.c
                                 12                 :                :  *
                                 13                 :                :  *-------------------------------------------------------------------------
                                 14                 :                :  */
                                 15                 :                : #include "postgres.h"
                                 16                 :                : 
                                 17                 :                : #include <unistd.h>
                                 18                 :                : #ifdef HAVE_EXECINFO_H
                                 19                 :                : #include <execinfo.h>
                                 20                 :                : #endif
                                 21                 :                : 
                                 22                 :                : /*
                                 23                 :                :  * ExceptionalCondition - Handles the failure of an Assert()
                                 24                 :                :  *
                                 25                 :                :  * We intentionally do not go through elog() here, on the grounds of
                                 26                 :                :  * wanting to minimize the amount of infrastructure that has to be
                                 27                 :                :  * working to report an assertion failure.
                                 28                 :                :  */
                                 29                 :                : void
 6752 tgl@sss.pgh.pa.us          30                 :UBC           0 : ExceptionalCondition(const char *conditionName,
                                 31                 :                :                      const char *fileName,
                                 32                 :                :                      int lineNumber)
                                 33                 :                : {
                                 34                 :                :     /* Report the failure on stderr (or local equivalent) */
   34 peter@eisentraut.org       35   [ #  #  #  # ]:UNC           0 :     if (!conditionName || !fileName)
 1849 tgl@sss.pgh.pa.us          36                 :UBC           0 :         write_stderr("TRAP: ExceptionalCondition: bad arguments in PID %d\n",
                                 37                 :              0 :                      (int) getpid());
                                 38                 :                :     else
 1114                            39                 :              0 :         write_stderr("TRAP: failed Assert(\"%s\"), File: \"%s\", Line: %d, PID: %d\n",
                                 40                 :              0 :                      conditionName, fileName, lineNumber, (int) getpid());
                                 41                 :                : 
                                 42                 :                :     /* Usually this shouldn't be needed, but make sure the msg went out */
 6752                            43                 :              0 :     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                 :                : 
 2181 alvherre@alvh.no-ip.       51                 :              0 :         nframes = backtrace(buf, lengthof(buf));
                                 52                 :              0 :         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                 :                : 
 8480 bruce@momjian.us           65                 :              0 :     abort();
                                 66                 :                : }
        

Generated by: LCOV version 2.4-beta