* dbxout.c (dbxout_source_line_counter): New global variable.
Mark it with GTY(()).
(dbxout_source_line): Increment dbxout_source_line_counter
and pass it to ASM_OUTPUT_SOURCE_LINE.
* sdbout.c (sdbout_source_line_counter): New global variable.
Mark it with GTY(()).
(unnamed_struct_number): Mark it with GTY(()).
(sdbout_source_line): Increment sdbout_source_line_counter
and pass it to ASM_OUTPUT_SOURCE_LINE.
* xcoffout.c (ASM_OUTPUT_SOURCE_LINE): Add third parameter
(xcoffout_source_line): Pass 0 as third argument to
ASM_OUTPUT_SOURCE_LINE.
(xcoffout_begin_prologue): Likewise.
* config/dbxout.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
Use it instead of 'sym_lineno' but without incrementing it.
* config/dbxelf.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
* config/lynx.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
* config/ptx4.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
* config/alpha/alpha.c (alpha_start_function): Pass 0 as third
argument to ASM_OUTPUT_SOURCE_LINE.
* config/alpha/alpha.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
* config/arm/aout.h: Remove useless comment.
* config/avr/avr.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
* config/i960/i960.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
* config/m32r/m32r.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
Use it instead of 'sym_lineno' but without incrementing it.
* config/m68k/hp320.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
* config/mcore/mcore-pe.h (ASM_OUTPUT_SOURCE_LINE): Add third
parameter. Use it instead of 'sym_lineno' but without incrementing it.
* config/mips/mips.c (mips_output_function_prologue): Pass 0 as third
argument to ASM_OUTPUT_SOURCE_LINE.
* config/mips/mips.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
* config/mmix/mmix.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
* config/pa/som.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
Use it instead of 'sym_lineno' but without incrementing it.
* config/rs6000/linux64.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
* config/sh/elf.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
* config/sparc/aout.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
* config/sparc/pbd.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
* doc/tm.texi (ASM_OUTPUT_SOURCE_LINE): Document third parameter.
From-SVN: r68072
+2003-06-17 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * dbxout.c (dbxout_source_line_counter): New global variable.
+ Mark it with GTY(()).
+ (dbxout_source_line): Increment dbxout_source_line_counter
+ and pass it to ASM_OUTPUT_SOURCE_LINE.
+ * sdbout.c (sdbout_source_line_counter): New global variable.
+ Mark it with GTY(()).
+ (unnamed_struct_number): Mark it with GTY(()).
+ (sdbout_source_line): Increment sdbout_source_line_counter
+ and pass it to ASM_OUTPUT_SOURCE_LINE.
+ * xcoffout.c (ASM_OUTPUT_SOURCE_LINE): Add third parameter
+ (xcoffout_source_line): Pass 0 as third argument to
+ ASM_OUTPUT_SOURCE_LINE.
+ (xcoffout_begin_prologue): Likewise.
+ * config/dbxout.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
+ Use it instead of 'sym_lineno' but without incrementing it.
+ * config/dbxelf.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
+ * config/lynx.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
+ * config/ptx4.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
+ * config/alpha/alpha.c (alpha_start_function): Pass 0 as third
+ argument to ASM_OUTPUT_SOURCE_LINE.
+ * config/alpha/alpha.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
+ * config/arm/aout.h: Remove useless comment.
+ * config/avr/avr.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
+ * config/i960/i960.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
+ * config/m32r/m32r.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
+ Use it instead of 'sym_lineno' but without incrementing it.
+ * config/m68k/hp320.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
+ * config/mcore/mcore-pe.h (ASM_OUTPUT_SOURCE_LINE): Add third
+ parameter. Use it instead of 'sym_lineno' but without incrementing it.
+ * config/mips/mips.c (mips_output_function_prologue): Pass 0 as third
+ argument to ASM_OUTPUT_SOURCE_LINE.
+ * config/mips/mips.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
+ * config/mmix/mmix.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
+ * config/pa/som.h (ASM_OUTPUT_SOURCE_LINE): Add third parameter.
+ Use it instead of 'sym_lineno' but without incrementing it.
+ * config/rs6000/linux64.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
+ * config/sh/elf.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
+ * config/sparc/aout.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
+ * config/sparc/pbd.h (ASM_OUTPUT_SOURCE_LINE): Likewise.
+ * doc/tm.texi (ASM_OUTPUT_SOURCE_LINE): Document third parameter.
+
2003-06-17 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips-protos.h (mips_expand_block_move): Declare.
#ifdef ASM_OUTPUT_SOURCE_LINE
if (debug_info_level != DINFO_LEVEL_TERSE)
ASM_OUTPUT_SOURCE_LINE (file,
- DECL_SOURCE_LINE (current_function_decl));
+ DECL_SOURCE_LINE (current_function_decl), 0);
#endif
}
#define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET + alpha_arg_offset)
-#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
+#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE, COUNTER) \
alpha_output_lineno (STREAM, LINE)
#define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
#define ASM_OUTPUT_ALIGNED_BSS(STREAM, DECL, NAME, SIZE, ALIGN) \
asm_output_aligned_bss (STREAM, DECL, NAME, SIZE, ALIGN)
#endif
-
-/* Output a source line for the debugger. */
-/* #define ASM_OUTPUT_SOURCE_LINE(STREAM,LINE) */
/* Output a #ident directive. */
#ifndef ASM_OUTPUT_IDENT
time-saving assumptions that are valid for ordinary compiler
output. */
-#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) fprintf (STREAM,"/* line: %d */\n",LINE)
+#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE, COUNTER) \
+ fprintf (STREAM,"/* line: %d */\n",LINE)
/* A C statement to output DBX or SDB debugging information before
code for line number LINE of the current source file to the stdio
stream STREAM.
current function. */
#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
+#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE, COUNTER) \
{ if (write_symbols == SDB_DEBUG) { \
fprintf ((FILE), "\t.ln\t%d\n", \
((sdb_begin_function_line > -1) \
? (LINE) - sdb_begin_function_line : 1)); \
} else if (write_symbols == DBX_DEBUG) { \
- static int sym_lineno = 1; \
char buffer[256]; \
- ASM_GENERATE_INTERNAL_LABEL (buffer, "LM", sym_lineno); \
+ ASM_GENERATE_INTERNAL_LABEL (buffer, "LM", COUNTER); \
fprintf (FILE, ".stabn 68,0,%d,", LINE); \
assemble_name (FILE, buffer); \
putc ('-', FILE); \
assemble_name (FILE, \
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
putc ('\n', FILE); \
- (*targetm.asm_out.internal_label) (FILE, "LM", sym_lineno); \
- sym_lineno++; \
+ (*targetm.asm_out.internal_label) (FILE, "LM", COUNTER); \
} }
/* When generating stabs debugging, use N_BINCL entries. */
current function. */
#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
+#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE, COUNTER) \
do \
{ \
- static int sym_lineno = 1; \
char temp[256]; \
- ASM_GENERATE_INTERNAL_LABEL (temp, "LM", sym_lineno); \
+ ASM_GENERATE_INTERNAL_LABEL (temp, "LM", COUNTER); \
fprintf (FILE, "\t.stabn 68,0,%d,", LINE); \
assemble_name (FILE, temp); \
putc ('-', FILE); \
assemble_name (FILE, \
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
putc ('\n', FILE); \
- (*targetm.asm_out.internal_label) (FILE, "LM", sym_lineno); \
- sym_lineno += 1; \
+ (*targetm.asm_out.internal_label) (FILE, "LM", COUNTER); \
} \
while (0)
/* This is how to output a note to DBX telling it the line number
to which the following sequence of instructions corresponds. */
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
+#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE, COUNTER) \
{ if (write_symbols == SDB_DEBUG) { \
fprintf ((FILE), "\t.ln %d\n", \
(sdb_begin_function_line \
"\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO)
#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
- { static int sym_lineno = 1; \
- fprintf (file, ".stabn 68,0,%d,.LM%d-", \
- line, sym_lineno); \
+#define ASM_OUTPUT_SOURCE_LINE(file, line, counter) \
+ { fprintf (file, ".stabn 68,0,%d,.LM%d-", \
+ line, counter); \
assemble_name (file, \
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
- fprintf (file, "\n.LM%d:\n", sym_lineno); \
- sym_lineno += 1; }
+ fprintf (file, "\n.LM%d:\n", counter); }
/* Handle #pragma pack and sometimes #pragma weak. */
of a word. */
#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
+#define ASM_OUTPUT_SOURCE_LINE(file, line, counter) \
do \
{ \
- static int sym_lineno = 1; \
fprintf (file, ".stabn 68,0,%d,.LM%d-", \
- line, sym_lineno); \
+ line, counter); \
assemble_name \
(file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
fprintf (file, (optimize_size || TARGET_M32R) \
? "\n\t.debugsym .LM%d\n" \
: "\n.LM%d:\n", \
- sym_lineno); \
- sym_lineno += 1; \
+ counter); \
} \
while (0)
fprintf (FILE, "\tspace %u\n", (int)(SIZE))
#define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME)
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO)
+#define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO, COUNTER)
/* Output a float value (represented as a C double) as an immediate operand.
This macro is a 68k-specific macro. */
while (0)
#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
+#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE, COUNTER) \
{ \
if (write_symbols == DBX_DEBUG) \
{ \
- static int sym_lineno = 1; \
char buffer[256]; \
\
- ASM_GENERATE_INTERNAL_LABEL (buffer, "LM", sym_lineno); \
+ ASM_GENERATE_INTERNAL_LABEL (buffer, "LM", COUNTER); \
fprintf (FILE, ".stabn 68,0,%d,", LINE); \
assemble_name (FILE, buffer); \
putc ('-', FILE); \
assemble_name (FILE, \
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
putc ('\n', FILE); \
- (*targetm.asm_out.internal_label) (FILE, "LM", sym_lineno); \
- sym_lineno ++; \
+ (*targetm.asm_out.internal_label) (FILE, "LM", COUNTER); \
} \
}
#ifdef SDB_DEBUGGING_INFO
if (debug_info_level != DINFO_LEVEL_TERSE && write_symbols == SDB_DEBUG)
- ASM_OUTPUT_SOURCE_LINE (file, DECL_SOURCE_LINE (current_function_decl));
+ ASM_OUTPUT_SOURCE_LINE (file, DECL_SOURCE_LINE (current_function_decl), 0);
#endif
/* In mips16 mode, we may need to generate a 32 bit to handle
#endif
#ifndef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
+#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE, COUNTER) \
mips_output_lineno (STREAM, LINE)
#endif
#define OUTPUT_QUOTED_STRING(STREAM, STRING) \
mmix_output_quoted_string (STREAM, STRING, strlen (STRING))
-#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
+#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE, COUNTER) \
mmix_asm_output_source_line (STREAM, LINE)
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
/* We make the first line stab special to avoid adding several
gross hacks to GAS. */
#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
- { static int sym_lineno = 1; \
- static tree last_function_decl = NULL; \
+#define ASM_OUTPUT_SOURCE_LINE(file, line, counter) \
+ { static tree last_function_decl = NULL; \
if (current_function_decl == last_function_decl) \
fprintf (file, "\t.stabn 68,0,%d,L$M%d-%s\nL$M%d:\n", \
- line, sym_lineno, \
+ line, counter, \
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0) + 1, \
- sym_lineno); \
+ counter); \
else \
fprintf (file, "\t.stabn 68,0,%d,0\n", line); \
last_function_decl = current_function_decl; \
- sym_lineno += 1; }
+ }
/* gdb needs a null N_SO at the end of each file for scattered loading. */
current function. */
#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
+#define ASM_OUTPUT_SOURCE_LINE(file, line, counter) \
do \
{ \
- static int sym_lineno = 1; \
fprintf (file, ".stabn 68,0,%d,.LM%d-", \
- line, sym_lineno); \
+ line, counter); \
assemble_name (file, \
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
- fprintf (file, "\n.LM%d:\n", sym_lineno); \
- sym_lineno += 1; \
+ fprintf (file, "\n.LM%d:\n", counter); \
} \
while (0)
/* This is the same as the dbxelf.h version, except that we need to
use the function code label, not the function descriptor. */
#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
+#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE, COUNTER) \
do \
{ \
- static int sym_lineno = 1; \
char temp[256]; \
- ASM_GENERATE_INTERNAL_LABEL (temp, "LM", sym_lineno); \
+ ASM_GENERATE_INTERNAL_LABEL (temp, "LM", COUNTER); \
fprintf (FILE, "\t.stabn 68,0,%d,", LINE); \
assemble_name (FILE, temp); \
putc ('-', FILE); \
assemble_name (FILE, \
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
putc ('\n', FILE); \
- (*targetm.asm_out.internal_label) (FILE, "LM", sym_lineno); \
- sym_lineno += 1; \
+ (*targetm.asm_out.internal_label) (FILE, "LM", COUNTER); \
} \
while (0)
sprintf ((STRING), "*%s%s%ld", LOCAL_LABEL_PREFIX, (PREFIX), (long)(NUM))
#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
+#define ASM_OUTPUT_SOURCE_LINE(file, line, counter) \
do \
{ \
- static int sym_lineno = 1; \
asm_fprintf ((file), ".stabn 68,0,%d,%LLM%d-", \
- (line), sym_lineno); \
+ (line), (counter)); \
assemble_name ((file), \
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
- asm_fprintf ((file), "\n%LLM%d:\n", sym_lineno); \
- sym_lineno += 1; \
+ asm_fprintf ((file), "\n%LLM%d:\n", (counter)); \
} \
while (0)
This is needed for SunOS 4.0, and should not hurt for 3.2
versions either. */
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
- { static int sym_lineno = 1; \
- fprintf (file, ".stabn 68,0,%d,LM%d\nLM%d:\n", \
- line, sym_lineno, sym_lineno); \
- sym_lineno += 1; }
+#define ASM_OUTPUT_SOURCE_LINE(file, line, counter) \
+ fprintf (file, ".stabn 68,0,%d,LM%d\nLM%d:\n", \
+ line, counter, counter)
/* This is needed for SunOS 4.0, and should not hurt for 3.2
versions either. */
#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
- { static int sym_lineno = 1; \
- fprintf (file, ".stabn 68,0,%d,.LM%d\n.LM%d:\n", \
- line, sym_lineno, sym_lineno); \
- sym_lineno += 1; }
+#define ASM_OUTPUT_SOURCE_LINE(file, line, counter) \
+ fprintf (file, ".stabn 68,0,%d,.LM%d\n.LM%d:\n", \
+ line, counter, counter)
#define ASM_INT_OP "\t.long "
static GTY(()) int scope_labelno;
+/* A counter for dbxout_source_line. */
+
+static GTY(()) int dbxout_source_line_counter;
+
/* Nonzero if we have actually used any of the GDB extensions
to the debugging format. The idea is that we use them for the
first time only if there's a strong reason, but once we have done that,
dbxout_source_file (asmfile, filename);
#ifdef ASM_OUTPUT_SOURCE_LINE
- ASM_OUTPUT_SOURCE_LINE (asmfile, lineno);
+ dbxout_source_line_counter += 1;
+ ASM_OUTPUT_SOURCE_LINE (asmfile, lineno, dbxout_source_line_counter);
#else
fprintf (asmfile, "%s%d,0,%d\n", ASM_STABD_OP, N_SLINE, lineno);
#endif
of the filename using this macro.
@findex ASM_OUTPUT_SOURCE_LINE
-@item ASM_OUTPUT_SOURCE_LINE (@var{stream}, @var{line})
+@item ASM_OUTPUT_SOURCE_LINE (@var{stream}, @var{line}, @var{counter})
A C statement to output DBX or SDB debugging information before code
for line number @var{line} of the current source file to the
-stdio stream @var{stream}.
+stdio stream @var{stream}. @var{counter} is the number of time the
+macro was invoked, including the current invocation; it is intended
+to generate unique labels in the assembly output.
This macro need not be defined if the standard form of debugging
information for the debugger in use is appropriate.
static GTY(()) tree anonymous_types;
+/* Counter for sdbout_source_line. */
+
+static GTY(()) int sdbout_source_line_counter;
+
+/* Counter to generate unique "names" for nameless struct members. */
+
+static GTY(()) int unnamed_struct_number;
+
#ifdef SDB_DEBUGGING_INFO
#include "rtl.h"
int sdb_begin_function_line = -1;
-/* Counter to generate unique "names" for nameless struct members. */
-
-static int unnamed_struct_number = 0;
extern FILE *asm_out_file;
PUT_SDB_BLOCK_END (line - sdb_begin_function_line);
}
+/* Output a line number symbol entry for source file FILENAME and line
+ number LINE. */
+
static void
sdbout_source_line (line, filename)
unsigned int line;
if ((int) line > sdb_begin_function_line)
{
#ifdef ASM_OUTPUT_SOURCE_LINE
- ASM_OUTPUT_SOURCE_LINE (asm_out_file, line);
+ sdbout_source_line_counter += 1;
+ ASM_OUTPUT_SOURCE_LINE (asm_out_file, line, sdbout_source_line_counter);
#else
fprintf (asm_out_file, "\t.ln\t%d\n",
((sdb_begin_function_line > -1)
((xcoff_inlining) ? (LINENO) : (LINENO) - xcoff_begin_function_line)
/* Output source line numbers via ".line" rather than ".stabd". */
-#define ASM_OUTPUT_SOURCE_LINE(FILE,LINENUM) \
+#define ASM_OUTPUT_SOURCE_LINE(FILE,LINENUM,COUNTER) \
do \
{ \
if (xcoff_begin_function_line >= 0) \
xcoffout_source_file (asm_out_file, filename, inline_p);
- ASM_OUTPUT_SOURCE_LINE (asm_out_file, line);
+ ASM_OUTPUT_SOURCE_LINE (asm_out_file, line, 0);
}
\f
/* Output the symbols defined in block number DO_BLOCK.
xcoffout_block (DECL_INITIAL (current_function_decl), 0,
DECL_ARGUMENTS (current_function_decl));
- ASM_OUTPUT_SOURCE_LINE (asm_out_file, line);
+ ASM_OUTPUT_SOURCE_LINE (asm_out_file, line, 0);
}
/* Called at end of function (before epilogue).