added new licence header
[libfirm] / ir / be / be_dbgout.h
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief   Debug output support.
23  * @author  Michael Beck
24  * @date    11.9.2006
25  * @version $Id$
26  */
27 #ifndef __BE_DBGOUT_H__
28 #define __BE_DBGOUT_H__
29
30 #include "obst.h"
31 #include "beabi_t.h"
32
33 typedef struct dbg_handle dbg_handle;
34
35 /**
36  * Debug operations.
37  */
38 typedef struct debug_ops {
39         /** close the stabs handler. */
40         void (*close)(dbg_handle *handle);
41
42         /** start a new source object (compilation unit) */
43         void (*so)(dbg_handle *handle, const char *filename);
44
45         /** start an include file */
46         void (*include_begin)(dbg_handle *handle, const char *filename);
47
48         /** end an include file */
49         void (*include_end)(dbg_handle *handle);
50
51         /** Main Program */
52         void (*main_program)(dbg_handle *handle);
53
54         /** dumps the stabs for a method begin */
55         void (*method_begin)(dbg_handle *handle, ir_entity *ent, const be_stack_layout_t *layout);
56
57         /** dumps the stabs for a method end */
58         void (*method_end)(dbg_handle *handle);
59
60         /** dumps a line number */
61         void (*line)(dbg_handle *handle, unsigned lineno, const char *address);
62
63         /** dump types */
64         void (*types)(dbg_handle *handle);
65
66         /** dump a variable in the global type */
67         void (*variable)(dbg_handle *h, struct obstack *obst, ir_entity *ent);
68
69 } debug_ops;
70
71 /** The base class of all debug implementations. */
72 struct dbg_handle {
73         const debug_ops *ops;
74 };
75
76 /** close a debug handler. */
77 void be_dbg_close(dbg_handle *handle);
78
79 /** start a new source object (compilation unit) */
80 void be_dbg_so(dbg_handle *handle, const char *filename);
81
82 /** start an include file */
83 void be_dbg_include_begin(dbg_handle *handle, const char *filename);
84
85 /** end an include file */
86 void be_dbg_include_end(dbg_handle *handle);
87
88 /** Main program */
89 void be_dbg_main_program(dbg_handle *handle);
90
91 /** debug for a method begin */
92 void be_dbg_method_begin(dbg_handle *handle, ir_entity *ent, const be_stack_layout_t *layout);
93
94 /** debug for a method end */
95 void be_dbg_method_end(dbg_handle *handle);
96
97 /** debug for line number */
98 void be_dbg_line(dbg_handle *handle, unsigned lineno, const char *address);
99
100 /** dump types */
101 void be_dbg_types(dbg_handle *handle);
102
103 /** dump a variable in the global type */
104 void be_dbg_variable(dbg_handle *handle, struct obstack *obst, ir_entity *ent);
105
106 /** Opens the NULL handler: no debug support. */
107 dbg_handle *be_nulldbg_open(void);
108
109 /** Opens a stabs handler. */
110 dbg_handle *be_stabs_open(FILE *out);
111
112 #endif /* __BE_DBGOUT_H__ */