1/* Generate SDB debugging info.
2   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 2, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING.  If not, write to the Free
18Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
1902110-1301, USA.  */
20
21/* Note that no configuration uses sdb as its preferred format.  */
22
23#define SDB_DEBUGGING_INFO 1
24
25/* Forward references to tags are allowed.  */
26#define SDB_ALLOW_FORWARD_REFERENCES
27
28/* Unknown tags are also allowed.  */
29#define SDB_ALLOW_UNKNOWN_REFERENCES
30
31/* Block start/end next label #.  */
32extern int sdb_label_count;
33
34/* Starting line of current function.  */
35extern int sdb_begin_function_line;
36
37/* For block start and end, we create labels, so that
38   later we can figure out where the correct offset is.
39   The normal .ent/.end serve well enough for functions,
40   so those are just commented out.  */
41
42#define PUT_SDB_BLOCK_START(LINE)			\
43do {							\
44  fprintf (asm_out_file,				\
45	   "%sLb%d:\n\t.begin\t%sLb%d\t%d\n",		\
46	   LOCAL_LABEL_PREFIX,				\
47	   sdb_label_count,				\
48	   LOCAL_LABEL_PREFIX,				\
49	   sdb_label_count,				\
50	   (LINE));					\
51  sdb_label_count++;					\
52} while (0)
53
54#define PUT_SDB_BLOCK_END(LINE)				\
55do {							\
56  fprintf (asm_out_file,				\
57	   "%sLe%d:\n\t.bend\t%sLe%d\t%d\n",		\
58	   LOCAL_LABEL_PREFIX,				\
59	   sdb_label_count,				\
60	   LOCAL_LABEL_PREFIX,				\
61	   sdb_label_count,				\
62	   (LINE));					\
63  sdb_label_count++;					\
64} while (0)
65
66#define PUT_SDB_FUNCTION_START(LINE)
67
68#define PUT_SDB_FUNCTION_END(LINE)			\
69do {							\
70  SDB_OUTPUT_SOURCE_LINE (asm_out_file, LINE + sdb_begin_function_line); \
71} while (0)
72
73#define PUT_SDB_EPILOGUE_END(NAME)
74
75/* We need to use .esize and .etype instead of .size and .type to
76   avoid conflicting with ELF directives.  */
77#undef PUT_SDB_SIZE
78#define PUT_SDB_SIZE(a)					\
79do {							\
80  fprintf (asm_out_file, "\t.esize\t" HOST_WIDE_INT_PRINT_DEC ";", \
81 	   (HOST_WIDE_INT) (a));			\
82} while (0)
83
84#undef PUT_SDB_TYPE
85#define PUT_SDB_TYPE(a)					\
86do {							\
87  fprintf (asm_out_file, "\t.etype\t0x%x;", (a));	\
88} while (0)
89