1 /*****************************************************************************
2 
3 Copyright (c) 1994, 2021, Oracle and/or its affiliates.
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License, version 2.0,
7 as published by the Free Software Foundation.
8 
9 This program is also distributed with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation.  The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have included with MySQL.
15 
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 GNU General Public License, version 2.0, for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
24 
25 *****************************************************************************/
26 
27 /*****************************************************************//**
28 @file ut/ut0dbg.cc
29 Debug utilities for Innobase.
30 
31 Created 1/30/1994 Heikki Tuuri
32 **********************************************************************/
33 
34 #include "ha_prototypes.h"
35 
36 #include "ut0dbg.h"
37 
38 /*************************************************************//**
39 Report a failed assertion. */
40 void
ut_dbg_assertion_failed(const char * expr,const char * file,ulint line)41 ut_dbg_assertion_failed(
42 /*====================*/
43 	const char* expr,	/*!< in: the failed assertion (optional) */
44 	const char* file,	/*!< in: source file containing the assertion */
45 	ulint line)		/*!< in: line number of the assertion */
46 {
47 	ut_print_timestamp(stderr);
48 #ifdef UNIV_HOTBACKUP
49 	fprintf(stderr, "  InnoDB: Assertion failure in file %s line %lu\n",
50 		file, line);
51 #else /* UNIV_HOTBACKUP */
52 	fprintf(stderr,
53 		"  InnoDB: Assertion failure in thread " ULINTPF
54 		" in file %s line " ULINTPF "\n",
55 		os_thread_pf(os_thread_get_curr_id()),
56 		innobase_basename(file), line);
57 #endif /* UNIV_HOTBACKUP */
58 	if (expr) {
59 		fprintf(stderr,
60 			"InnoDB: Failing assertion: %s\n", expr);
61 	}
62 
63 	fputs("InnoDB: We intentionally generate a memory trap.\n"
64 	      "InnoDB: Submit a detailed bug report"
65 	      " to http://bugs.mysql.com.\n"
66 	      "InnoDB: If you get repeated assertion failures"
67 	      " or crashes, even\n"
68 	      "InnoDB: immediately after the mysqld startup, there may be\n"
69 	      "InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
70 	      "InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
71 	      "InnoDB: about forcing recovery.\n", stderr);
72 
73 	fflush(stderr);
74 	fflush(stdout);
75 	abort();
76 }
77