OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_69/] [or1ksim/] [support/] [debug.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1389 nogj
/* debug.h -- Trace function declarations
2
   Copyright 1999 Patrik Stridvall (for the wine project: www.winehq.com)
3
   Copyright (C) 2005 György `nog' Jeney, nog@sdf.lonestar.org
4
 
5
This file is part of OpenRISC 1000 Architectural Simulator.
6
(Most of it is ripped from the wine project's wine/include/wine/debug.h)
7
 
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2 of the License, or
11
(at your option) any later version.
12
 
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21
 
22
#ifndef __DEBUG_H_INCLUDED
23
#define __DEBUG_H_INCLUDED
24
 
25
enum __ORSIM_DEBUG_CLASS {
26
  __ORSIM_DBCL_TRACE,
27
  __ORSIM_DBCL_FIXME,
28
  __ORSIM_DBCL_WARN,
29
  __ORSIM_DBCL_ERR,
30
};
31
 
32
void orsim_dbg_log(enum __ORSIM_DEBUG_CLASS dbcl, const char *dbch,
33
                   const char *function, const char *format, ...)
34
                                          __attribute__((format(printf, 4, 5)));
35
void orsim_dbcl_set_name(enum __ORSIM_DEBUG_CLASS dbcl, const char *dbch, int on);
36
void parse_dbchs(const char *str);
37
 
38
#ifndef __ORSIM_DBG_USE_FUNC
39
#define __ORSIM_DBG_USE_FUNC __FUNCTION__
40
#endif
41
 
42
#define __ORSIM_DPRINTF(dbcl, dbch) \
43
  do { const char * const __dbch = dbch; \
44
       const enum __ORSIM_DEBUG_CLASS __dbcl = __ORSIM_DBCL_##dbcl; \
45
       __ORSIM_DEBUG_LOG
46
 
47
#define __ORSIM_DEBUG_LOG(args...) \
48
  orsim_dbg_log(__dbcl, __dbch, __ORSIM_DBG_USE_FUNC, args); } while(0)
49
 
50
#define TRACE_(ch) __ORSIM_DPRINTF(TRACE, __orsim_dbch_##ch)
51
#define FIXME_(ch) __ORSIM_DPRINTF(FIXME, __orsim_dbch_##ch)
52
#define WARN_(ch) __ORSIM_DPRINTF(WARN, __orsim_dbch_##ch)
53
#define ERR_(ch) __ORSIM_DPRINTF(ERR, __orsim_dbch_##ch)
54
 
55
#define TRACE __ORSIM_DPRINTF(TRACE, __orsim_dbch___default)
56
#define FIXME __ORSIM_DPRINTF(FIXME, __orsim_dbch___default)
57
#define WARN __ORSIM_DPRINTF(WARN, __orsim_dbch___default)
58
#define ERR __ORSIM_DPRINTF(ERR, __orsim_dbch___default)
59
 
60
#define DEFAULT_DEBUG_CHANNEL(dbch) \
61
 extern char __orsim_dbch_##dbch[]; \
62
 static char * const __orsim_dbch___default = __orsim_dbch_##dbch;
63
 
64
#ifndef __ORSIM_NO_DEC_DBCH
65
#define DECLARE_DEBUG_CHANNEL(dbch) extern char __orsim_dbch_##dbch[];
66
#endif
67
 
68
void debug(int level, const char *format,...) __attribute__((format(printf, 2, 3)));
69
 
70
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.