LCOV - differential code coverage report
Current view: top level - src/backend/utils/error - assert.c (source / functions) Coverage Total Hit UNC UIC UBC EUB DUB
Current: Differential Code Coverage HEAD vs 15 Lines: 0.0 % 11 0 3 5 3 5 3
Current Date: 2023-04-08 17:13:01 Functions: 0.0 % 1 0 1
Baseline: 15 Line coverage date bins:
Baseline Date: 2023-04-08 15:09:40 (180,240] days: 0.0 % 3 0 3
Legend: Lines: hit not hit (240..) days: 0.0 % 8 0 5 3 5
Function coverage date bins:
(240..) days: 0.0 % 1 0 1

 Age         Owner                  TLA  Line data    Source code
                                  1                 : /*-------------------------------------------------------------------------
                                  2                 :  *
                                  3                 :  * assert.c
                                  4                 :  *    Assert support code.
                                  5                 :  *
                                  6                 :  * Portions Copyright (c) 1996-2023, 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
 5819 tgl                        30 UBC           0 : ExceptionalCondition(const char *conditionName,
                                 31                 :                      const char *fileName,
                                 32                 :                      int lineNumber)
                                 33                 : {
  916 tgl                        34 EUB             :     /* Report the failure on stderr (or local equivalent) */
 9345 bruce                      35 UBC           0 :     if (!PointerIsValid(conditionName)
  181 tgl                        36 UNC           0 :         || !PointerIsValid(fileName))
  916 tgl                        37 UIC           0 :         write_stderr("TRAP: ExceptionalCondition: bad arguments in PID %d\n",
  916 tgl                        38 UBC           0 :                      (int) getpid());
 9345 bruce                      39 EUB             :     else
  181 tgl                        40 UNC           0 :         write_stderr("TRAP: failed Assert(\"%s\"), File: \"%s\", Line: %d, PID: %d\n",
                                 41               0 :                      conditionName, fileName, lineNumber, (int) getpid());
                                 42                 : 
                                 43                 :     /* Usually this shouldn't be needed, but make sure the msg went out */
 5819 tgl                        44 UIC           0 :     fflush(stderr);
                                 45                 : 
                                 46                 :     /* If we have support for it, dump a simple backtrace */
                                 47                 : #ifdef HAVE_BACKTRACE_SYMBOLS
                                 48                 :     {
 1248 alvherre                   49 EUB             :         void       *buf[100];
                                 50                 :         int         nframes;
                                 51                 : 
 1248 alvherre                   52 UIC           0 :         nframes = backtrace(buf, lengthof(buf));
                                 53               0 :         backtrace_symbols_fd(buf, nframes, fileno(stderr));
                                 54                 :     }
                                 55                 : #endif
                                 56                 : 
                                 57                 :     /*
                                 58                 :      * If configured to do so, sleep indefinitely to allow user to attach a
                                 59                 :      * debugger.  It would be nice to use pg_usleep() here, but that can sleep
                                 60                 :      * at most 2G usec or ~33 minutes, which seems too short.
                                 61                 :      */
                                 62                 : #ifdef SLEEP_ON_ASSERT
 6797 bruce                      63 EUB             :     sleep(1000000);
                                 64                 : #endif
                                 65                 : 
 7547 bruce                      66 UIC           0 :     abort();
                                 67                 : }
        

Generated by: LCOV version v1.16-55-g56c0a2a