File: pdp_debug.c

package info (click to toggle)
pdp 1%3A0.14.1%2Bdarcs20180201-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 3,220 kB
  • sloc: ansic: 22,424; asm: 2,088; makefile: 532; perl: 145; sh: 108; cpp: 4
file content (21 lines) | stat: -rw-r--r-- 491 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
#include "pdp_post.h"

int pdp_debug_sigtrap_on_assert;


void pdp_assert_hook (char *condition, char *file, int line)
{
    pdp_post("PDP_ASSERT (%s) failed in file %s, line %u. ", condition, file, line);
    pdp_post("%s.\n", pdp_debug_sigtrap_on_assert ? "sending SIGTRAP" : "continuing");

    if (pdp_debug_sigtrap_on_assert) kill(getpid(), SIGTRAP);
}


void pdp_debug_setup(void)
{
    pdp_debug_sigtrap_on_assert = 1;
}