File: ass.cpp

package info (click to toggle)
musescore2 2.3.2%2Bdfsg4-16
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 170,464 kB
  • sloc: cpp: 262,612; xml: 176,707; sh: 3,377; ansic: 1,246; python: 356; makefile: 227; perl: 82; pascal: 78
file content (60 lines) | stat: -rw-r--r-- 1,902 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*-
 * Copyright © 2024
 *	mirabilos <m$(date +%Y)@mirbsd.de>
 *
 * Provided that these terms and disclaimer and all copyright notices
 * are retained or reproduced in an accompanying document, permission
 * is granted to deal in this work without restriction, including un‐
 * limited rights to use, publicly perform, distribute, sell, modify,
 * merge, give away, or sublicence.
 *
 * This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
 * the utmost extent permitted by applicable law, neither express nor
 * implied; without malicious intent or gross negligence. In no event
 * may a licensor, author or contributor be held liable for indirect,
 * direct, other damage, loss, or other issues arising in any way out
 * of dealing in the work, even if advised of the possibility of such
 * damage or existence of a defect, except proven that it results out
 * of said person’s immediate fault when using the work as intended.
 */

#ifndef __ALLQT_H__
# error The all.h file was not auto-included first.
#endif

#include <execinfo.h>
#include <stdio.h>
#include <stdlib.h>

#define NBT 128
static void *btbuffer[NBT];

void
mudeb_assert_(const char *xfile, const char *xfunc, const char *where, const char *what, int xline, int xisx)
{
	char **bt;
	int nbt;

	fflush(NULL);
	if (xisx)
		fprintf(stderr, "\r\nE: %s{%s}:%d: assertion failed in %s: %s\n",
		    xfile, xfunc, xline, where ? where : "(nil)", what ? what : "(nil)");
	else
		fprintf(stderr, "\r\nE: %s{%s}:%d: assertion failed: %s\n",
		    xfile, xfunc, xline, what);
	fflush(stderr);
	if ((nbt = backtrace(btbuffer, NBT)) > 0 &&
	    (bt = backtrace_symbols(btbuffer, nbt))) {
		int i;

		for (i = 0; i < nbt; ++i) {
			fprintf(stderr, "N:  %s\n", bt[i]);
			fflush(stderr);
		}
		fprintf(stderr, "N: end of backtrace\n");
		fflush(stderr);
		free(bt);
	}
	if (getenv("MSCORE_ASSERT_ABORT") != NULL)
		abort();
}