debug.h (0edd3ca7780350e672c966387c34a93aad72f09f) debug.h (d3980376e8c139e07958914c5184ab37463e4818)
1/*-
2 * Copyright 1996-1998 John D. Polstra.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 24 unchanged lines hidden (view full) ---

33#define DEBUG_H 1
34
35#ifndef __GNUC__
36#error "This file must be compiled with GCC"
37#endif
38
39#include <sys/cdefs.h>
40
1/*-
2 * Copyright 1996-1998 John D. Polstra.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 24 unchanged lines hidden (view full) ---

33#define DEBUG_H 1
34
35#ifndef __GNUC__
36#error "This file must be compiled with GCC"
37#endif
38
39#include <sys/cdefs.h>
40
41#include <string.h>
42#include <unistd.h>
43
41extern void debug_printf(const char *, ...) __printflike(1, 2);
42extern int debug;
43
44#ifdef DEBUG
45#define dbg(format, args...) debug_printf(format , ## args)
46#else
47#define dbg(format, args...) ((void) 0)
48#endif
49
44extern void debug_printf(const char *, ...) __printflike(1, 2);
45extern int debug;
46
47#ifdef DEBUG
48#define dbg(format, args...) debug_printf(format , ## args)
49#else
50#define dbg(format, args...) ((void) 0)
51#endif
52
53#define assert(cond) ((cond) ? (void) 0 : \
54 (msg("ld-elf.so.1: assert failed: " __FILE__ ":" \
55 __XSTRING(__LINE__) "\n"), abort()))
56#define msg(s) write(1, s, strlen(s))
57#define trace() msg("ld-elf.so.1: " __XSTRING(__LINE__) "\n")
58
50#endif /* DEBUG_H */
59#endif /* DEBUG_H */