1169689Skan/* Generate SDB debugging info.
2169689Skan   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
3169689Skan
4169689SkanThis file is part of GCC.
5169689Skan
6169689SkanGCC is free software; you can redistribute it and/or modify it under
7169689Skanthe terms of the GNU General Public License as published by the Free
8169689SkanSoftware Foundation; either version 2, or (at your option) any later
9169689Skanversion.
10169689Skan
11169689SkanGCC is distributed in the hope that it will be useful, but WITHOUT ANY
12169689SkanWARRANTY; without even the implied warranty of MERCHANTABILITY or
13169689SkanFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14169689Skanfor more details.
15169689Skan
16169689SkanYou should have received a copy of the GNU General Public License
17169689Skanalong with GCC; see the file COPYING.  If not, write to the Free
18169689SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
19169689Skan02110-1301, USA.  */
20169689Skan
21169689Skan/* Note that no configuration uses sdb as its preferred format.  */
22169689Skan
23169689Skan#define SDB_DEBUGGING_INFO 1
24169689Skan
25169689Skan/* Forward references to tags are allowed.  */
26169689Skan#define SDB_ALLOW_FORWARD_REFERENCES
27169689Skan
28169689Skan/* Unknown tags are also allowed.  */
29169689Skan#define SDB_ALLOW_UNKNOWN_REFERENCES
30169689Skan
31169689Skan/* Block start/end next label #.  */
32169689Skanextern int sdb_label_count;
33169689Skan
34169689Skan/* Starting line of current function.  */
35169689Skanextern int sdb_begin_function_line;
36169689Skan
37169689Skan/* For block start and end, we create labels, so that
38169689Skan   later we can figure out where the correct offset is.
39169689Skan   The normal .ent/.end serve well enough for functions,
40169689Skan   so those are just commented out.  */
41169689Skan
42169689Skan#define PUT_SDB_BLOCK_START(LINE)			\
43169689Skando {							\
44169689Skan  fprintf (asm_out_file,				\
45169689Skan	   "%sLb%d:\n\t.begin\t%sLb%d\t%d\n",		\
46169689Skan	   LOCAL_LABEL_PREFIX,				\
47169689Skan	   sdb_label_count,				\
48169689Skan	   LOCAL_LABEL_PREFIX,				\
49169689Skan	   sdb_label_count,				\
50169689Skan	   (LINE));					\
51169689Skan  sdb_label_count++;					\
52169689Skan} while (0)
53169689Skan
54169689Skan#define PUT_SDB_BLOCK_END(LINE)				\
55169689Skando {							\
56169689Skan  fprintf (asm_out_file,				\
57169689Skan	   "%sLe%d:\n\t.bend\t%sLe%d\t%d\n",		\
58169689Skan	   LOCAL_LABEL_PREFIX,				\
59169689Skan	   sdb_label_count,				\
60169689Skan	   LOCAL_LABEL_PREFIX,				\
61169689Skan	   sdb_label_count,				\
62169689Skan	   (LINE));					\
63169689Skan  sdb_label_count++;					\
64169689Skan} while (0)
65169689Skan
66169689Skan#define PUT_SDB_FUNCTION_START(LINE)
67169689Skan
68169689Skan#define PUT_SDB_FUNCTION_END(LINE)			\
69169689Skando {							\
70169689Skan  SDB_OUTPUT_SOURCE_LINE (asm_out_file, LINE + sdb_begin_function_line); \
71169689Skan} while (0)
72169689Skan
73169689Skan#define PUT_SDB_EPILOGUE_END(NAME)
74169689Skan
75169689Skan/* We need to use .esize and .etype instead of .size and .type to
76169689Skan   avoid conflicting with ELF directives.  */
77169689Skan#undef PUT_SDB_SIZE
78169689Skan#define PUT_SDB_SIZE(a)					\
79169689Skando {							\
80169689Skan  fprintf (asm_out_file, "\t.esize\t" HOST_WIDE_INT_PRINT_DEC ";", \
81169689Skan 	   (HOST_WIDE_INT) (a));			\
82169689Skan} while (0)
83169689Skan
84169689Skan#undef PUT_SDB_TYPE
85169689Skan#define PUT_SDB_TYPE(a)					\
86169689Skando {							\
87169689Skan  fprintf (asm_out_file, "\t.etype\t0x%x;", (a));	\
88169689Skan} while (0)
89