#include "except.h"
#include "dwarf2.h"
#include "dwarf2out.h"
+#include "dwarf2asm.h"
#include "toplev.h"
#include "varray.h"
#include "ggc.h"
static const char *dwarf_cfi_name PARAMS ((unsigned));
static dw_cfi_ref new_cfi PARAMS ((void));
static void add_cfi PARAMS ((dw_cfi_ref *, dw_cfi_ref));
-static unsigned long size_of_uleb128 PARAMS ((unsigned long));
-static unsigned long size_of_sleb128 PARAMS ((long));
-static void output_uleb128 PARAMS ((unsigned long));
-static void output_sleb128 PARAMS ((long));
static void add_fde_cfi PARAMS ((const char *, dw_cfi_ref));
static void lookup_cfa_1 PARAMS ((dw_cfi_ref, dw_cfa_location *));
static void lookup_cfa PARAMS ((dw_cfa_location *));
PARAMS ((dw_cfa_location *));
static void def_cfa_1 PARAMS ((const char *, dw_cfa_location *));
-/* Definitions of defaults for assembler-dependent names of various
- pseudo-ops and section names.
- Theses may be overridden in the tm.h file (if necessary) for a particular
- assembler. */
-
-#ifdef OBJECT_FORMAT_ELF
-#ifndef UNALIGNED_SHORT_ASM_OP
-#define UNALIGNED_SHORT_ASM_OP "\t.2byte\t"
-#endif
-#ifndef UNALIGNED_INT_ASM_OP
-#define UNALIGNED_INT_ASM_OP "\t.4byte\t"
-#endif
-#ifndef UNALIGNED_DOUBLE_INT_ASM_OP
-#define UNALIGNED_DOUBLE_INT_ASM_OP "\t.8byte\t"
-#endif
-#endif /* OBJECT_FORMAT_ELF */
-
-#ifndef ASM_BYTE_OP
-#define ASM_BYTE_OP "\t.byte\t"
+/* How to start an assembler comment. */
+#ifndef ASM_COMMENT_START
+#define ASM_COMMENT_START ";#"
#endif
/* Data and reference forms for relocatable data. */
#define CIE_AFTER_SIZE_LABEL "LSCIE"
#define CIE_END_LABEL "LECIE"
#define CIE_LENGTH_LABEL "LLCIE"
-#define FDE_AFTER_SIZE_LABEL "LSFDE"
+#define FDE_LABEL "LSFDE"
+#define FDE_AFTER_SIZE_LABEL "LASFDE"
#define FDE_END_LABEL "LEFDE"
#define FDE_LENGTH_LABEL "LLFDE"
+#define LINE_NUMBER_BEGIN_LABEL "LTSTART"
+#define LINE_NUMBER_END_LABEL "LTEND"
#define DIE_LABEL_PREFIX "DW"
/* Definitions of defaults for various types of primitive assembly language
fprintf ((FILE), SECTION_FORMAT, SECTION_ASM_OP, SECTION)
#endif
-#ifndef ASM_OUTPUT_DWARF_DATA1
-#define ASM_OUTPUT_DWARF_DATA1(FILE,VALUE) \
- fprintf ((FILE), "%s0x%x", ASM_BYTE_OP, (unsigned) (VALUE))
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA1
-#define ASM_OUTPUT_DWARF_DELTA1(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "%s", ASM_BYTE_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- } while (0)
-#endif
-
-#ifdef UNALIGNED_INT_ASM_OP
-
-#ifndef UNALIGNED_OFFSET_ASM_OP
-#define UNALIGNED_OFFSET_ASM_OP \
- (DWARF_OFFSET_SIZE == 8 ? UNALIGNED_DOUBLE_INT_ASM_OP : UNALIGNED_INT_ASM_OP)
-#endif
-
-#ifndef UNALIGNED_WORD_ASM_OP
-#define UNALIGNED_WORD_ASM_OP \
- ((DWARF2_ADDR_SIZE) == 8 ? UNALIGNED_DOUBLE_INT_ASM_OP \
- : (DWARF2_ADDR_SIZE) == 2 ? UNALIGNED_SHORT_ASM_OP \
- : UNALIGNED_INT_ASM_OP)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA2
-#define ASM_OUTPUT_DWARF_DELTA2(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "%s", UNALIGNED_SHORT_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA4
-#define ASM_OUTPUT_DWARF_DELTA4(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "%s", UNALIGNED_INT_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA
-#define ASM_OUTPUT_DWARF_DELTA(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "%s", UNALIGNED_OFFSET_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR_DELTA
-#define ASM_OUTPUT_DWARF_ADDR_DELTA(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "%s", UNALIGNED_WORD_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR
-#define ASM_OUTPUT_DWARF_ADDR(FILE,LABEL) \
- do { fprintf ((FILE), "%s", UNALIGNED_WORD_ASM_OP); \
- assemble_name (FILE, LABEL); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR_CONST
-#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) \
- do { \
- fprintf ((FILE), "%s", UNALIGNED_WORD_ASM_OP); \
- output_addr_const ((FILE), (RTX)); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_OFFSET4
-#define ASM_OUTPUT_DWARF_OFFSET4(FILE,LABEL) \
- do { fprintf ((FILE), "%s", UNALIGNED_INT_ASM_OP); \
- assemble_name (FILE, LABEL); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_OFFSET
-#define ASM_OUTPUT_DWARF_OFFSET(FILE,LABEL) \
- do { fprintf ((FILE), "%s", UNALIGNED_OFFSET_ASM_OP); \
- assemble_name (FILE, LABEL); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA2
-#define ASM_OUTPUT_DWARF_DATA2(FILE,VALUE) \
- fprintf ((FILE), "%s0x%x", UNALIGNED_SHORT_ASM_OP, (unsigned) (VALUE))
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA4
-#define ASM_OUTPUT_DWARF_DATA4(FILE,VALUE) \
- fprintf ((FILE), "%s0x%x", UNALIGNED_INT_ASM_OP, (unsigned) (VALUE))
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA8
-#define ASM_OUTPUT_DWARF_DATA8(FILE,VALUE) \
- fprintf ((FILE), "%s0x%lx", UNALIGNED_DOUBLE_INT_ASM_OP, \
- (unsigned long) (VALUE))
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA
-#define ASM_OUTPUT_DWARF_DATA(FILE,VALUE) \
- fprintf ((FILE), "%s0x%lx", UNALIGNED_OFFSET_ASM_OP, \
- (unsigned long) (VALUE))
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR_DATA
-#define ASM_OUTPUT_DWARF_ADDR_DATA(FILE,VALUE) \
- fprintf ((FILE), "%s0x%lx", UNALIGNED_WORD_ASM_OP, \
- (unsigned long) (VALUE))
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_CONST_DOUBLE
-#define ASM_OUTPUT_DWARF_CONST_DOUBLE(FILE,HIGH_VALUE,LOW_VALUE) \
- do { \
- if (WORDS_BIG_ENDIAN) \
- { \
- fprintf ((FILE), "%s0x%lx\n", UNALIGNED_INT_ASM_OP, (HIGH_VALUE));\
- fprintf ((FILE), "%s0x%lx", UNALIGNED_INT_ASM_OP, (LOW_VALUE));\
- } \
- else \
- { \
- fprintf ((FILE), "%s0x%lx\n", UNALIGNED_INT_ASM_OP, (LOW_VALUE)); \
- fprintf ((FILE), "%s0x%lx", UNALIGNED_INT_ASM_OP, (HIGH_VALUE)); \
- } \
- } while (0)
-#endif
-
-#else /* UNALIGNED_INT_ASM_OP */
-
-/* We don't have unaligned support, let's hope the normal output works for
- .debug_frame. But we know it won't work for .debug_info. */
-
-#ifdef DWARF2_DEBUGGING_INFO
- #error DWARF2_DEBUGGING_INFO requires UNALIGNED_INT_ASM_OP.
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR
-#define ASM_OUTPUT_DWARF_ADDR(FILE,LABEL) \
- assemble_integer (gen_rtx_SYMBOL_REF (Pmode, LABEL), DWARF2_ADDR_SIZE, 1)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR_CONST
-#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) ASM_OUTPUT_DWARF_ADDR (FILE,RTX)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_OFFSET4
-#define ASM_OUTPUT_DWARF_OFFSET4(FILE,LABEL) \
- assemble_integer (gen_rtx_SYMBOL_REF (SImode, LABEL), 4, 1)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_OFFSET
-#define ASM_OUTPUT_DWARF_OFFSET(FILE,LABEL) \
- assemble_integer (gen_rtx_SYMBOL_REF (SImode, LABEL), 4, 1)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA2
-#define ASM_OUTPUT_DWARF_DELTA2(FILE,LABEL1,LABEL2) \
- assemble_integer (gen_rtx_MINUS (HImode, \
- gen_rtx_SYMBOL_REF (Pmode, LABEL1), \
- gen_rtx_SYMBOL_REF (Pmode, LABEL2)), \
- 2, 1)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA4
-#define ASM_OUTPUT_DWARF_DELTA4(FILE,LABEL1,LABEL2) \
- assemble_integer (gen_rtx_MINUS (SImode, \
- gen_rtx_SYMBOL_REF (Pmode, LABEL1), \
- gen_rtx_SYMBOL_REF (Pmode, LABEL2)), \
- 4, 1)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR_DELTA
-#define ASM_OUTPUT_DWARF_ADDR_DELTA(FILE,LABEL1,LABEL2) \
- assemble_integer (gen_rtx_MINUS (Pmode, \
- gen_rtx_SYMBOL_REF (Pmode, LABEL1), \
- gen_rtx_SYMBOL_REF (Pmode, LABEL2)), \
- DWARF2_ADDR_SIZE, 1)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA
-#define ASM_OUTPUT_DWARF_DELTA(FILE,LABEL1,LABEL2) \
- ASM_OUTPUT_DWARF_DELTA4 (FILE,LABEL1,LABEL2)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA2
-#define ASM_OUTPUT_DWARF_DATA2(FILE,VALUE) \
- assemble_integer (GEN_INT (VALUE), 2, 1)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA4
-#define ASM_OUTPUT_DWARF_DATA4(FILE,VALUE) \
- assemble_integer (GEN_INT (VALUE), 4, 1)
-#endif
-
-#endif /* UNALIGNED_INT_ASM_OP */
-
#ifdef SET_ASM_OP
#ifndef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
#define ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL(FILE, SY, HI, LO) \
#endif
#endif /* SET_ASM_OP */
-/* This is similar to the default ASM_OUTPUT_ASCII, except that no trailing
- newline is produced. When flag_debug_asm is asserted, we add commentary
- at the end of the line, so we must avoid output of a newline here. */
-#ifndef ASM_OUTPUT_DWARF_NSTRING
-#define ASM_OUTPUT_DWARF_NSTRING(FILE,P,SLEN) \
- do { \
- register int slen = (SLEN); \
- register const char *p = (P); \
- register int i; \
- fprintf (FILE, "\t.ascii \""); \
- for (i = 0; i < slen; i++) \
- { \
- register int c = p[i]; \
- if (c == '\"' || c == '\\') \
- putc ('\\', FILE); \
- if (ISPRINT(c)) \
- putc (c, FILE); \
- else \
- { \
- fprintf (FILE, "\\%o", c); \
- } \
- } \
- fprintf (FILE, "\\0\""); \
- } \
- while (0)
-#endif
-#define ASM_OUTPUT_DWARF_STRING(FILE,P) \
- ASM_OUTPUT_DWARF_NSTRING (FILE, P, strlen (P))
-
/* The DWARF 2 CFA column which tracks the return address. Normally this
is the column for PC, or the first column after all of the hard
registers. */
if (insn == NULL_RTX)
{
- rtx insn;
- int n_alternate_entry_points;
-
/* Set up state for generating call frame debug info. */
lookup_cfa (&cfa);
if (cfa.reg != (unsigned long) DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM))
dwarf2out_frame_debug_expr (insn, label);
}
-/* Return the size of an unsigned LEB128 quantity. */
-
-static inline unsigned long
-size_of_uleb128 (value)
- register unsigned long value;
-{
- register unsigned long size = 0;
- register unsigned byte;
-
- do
- {
- byte = (value & 0x7f);
- value >>= 7;
- size += 1;
- }
- while (value != 0);
-
- return size;
-}
-
-/* Return the size of a signed LEB128 quantity. */
-
-static inline unsigned long
-size_of_sleb128 (value)
- register long value;
-{
- register unsigned long size = 0;
- register unsigned byte;
-
- do
- {
- byte = (value & 0x7f);
- value >>= 7;
- size += 1;
- }
- while (!(((value == 0) && ((byte & 0x40) == 0))
- || ((value == -1) && ((byte & 0x40) != 0))));
-
- return size;
-}
-
-/* Output an unsigned LEB128 quantity. */
-
-static void
-output_uleb128 (value)
- register unsigned long value;
-{
- unsigned long save_value = value;
-
- fprintf (asm_out_file, "%s", ASM_BYTE_OP);
- do
- {
- register unsigned byte = (value & 0x7f);
- value >>= 7;
- if (value != 0)
- /* More bytes to follow. */
- byte |= 0x80;
-
- fprintf (asm_out_file, "0x%x", byte);
- if (value != 0)
- fprintf (asm_out_file, ",");
- }
- while (value != 0);
-
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s ULEB128 0x%lx", ASM_COMMENT_START, save_value);
-}
-
-/* Output an signed LEB128 quantity. */
-
-static void
-output_sleb128 (value)
- register long value;
-{
- register int more;
- register unsigned byte;
- long save_value = value;
-
- fprintf (asm_out_file, "%s", ASM_BYTE_OP);
- do
- {
- byte = (value & 0x7f);
- /* arithmetic shift */
- value >>= 7;
- more = !((((value == 0) && ((byte & 0x40) == 0))
- || ((value == -1) && ((byte & 0x40) != 0))));
- if (more)
- byte |= 0x80;
-
- fprintf (asm_out_file, "0x%x", byte);
- if (more)
- fprintf (asm_out_file, ",");
- }
-
- while (more);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s SLEB128 %ld", ASM_COMMENT_START, save_value);
-}
-
/* Output a Call Frame Information opcode and its operand(s). */
static void
{
if (cfi->dw_cfi_opc == DW_CFA_advance_loc)
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- cfi->dw_cfi_opc
- | (cfi->dw_cfi_oprnd1.dw_cfi_offset & 0x3f));
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_CFA_advance_loc 0x%lx",
- ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_offset);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, (cfi->dw_cfi_opc
+ | (cfi->dw_cfi_oprnd1.dw_cfi_offset & 0x3f)),
+ "DW_CFA_advance_loc 0x%lx",
+ cfi->dw_cfi_oprnd1.dw_cfi_offset);
}
-
else if (cfi->dw_cfi_opc == DW_CFA_offset)
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- cfi->dw_cfi_opc
- | (cfi->dw_cfi_oprnd1.dw_cfi_reg_num & 0x3f));
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_CFA_offset, column 0x%lx",
- ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
-
- fputc ('\n', asm_out_file);
- output_uleb128 (cfi->dw_cfi_oprnd2.dw_cfi_offset);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, (cfi->dw_cfi_opc
+ | (cfi->dw_cfi_oprnd1.dw_cfi_reg_num & 0x3f)),
+ "DW_CFA_offset, column 0x%lx",
+ cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
+ dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd2.dw_cfi_offset, NULL);
}
else if (cfi->dw_cfi_opc == DW_CFA_restore)
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- cfi->dw_cfi_opc
- | (cfi->dw_cfi_oprnd1.dw_cfi_reg_num & 0x3f));
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_CFA_restore, column 0x%lx",
- ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
-
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, (cfi->dw_cfi_opc
+ | (cfi->dw_cfi_oprnd1.dw_cfi_reg_num & 0x3f)),
+ "DW_CFA_restore, column 0x%lx",
+ cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
}
else
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, cfi->dw_cfi_opc);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s %s", ASM_COMMENT_START,
- dwarf_cfi_name (cfi->dw_cfi_opc));
+ dw2_asm_output_data (1, cfi->dw_cfi_opc,
+ "%s", dwarf_cfi_name (cfi->dw_cfi_opc));
- fputc ('\n', asm_out_file);
switch (cfi->dw_cfi_opc)
{
case DW_CFA_set_loc:
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, cfi->dw_cfi_oprnd1.dw_cfi_addr);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE,
+ cfi->dw_cfi_oprnd1.dw_cfi_addr, NULL);
break;
case DW_CFA_advance_loc1:
- ASM_OUTPUT_DWARF_DELTA1 (asm_out_file,
- cfi->dw_cfi_oprnd1.dw_cfi_addr,
- fde->dw_fde_current_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_delta (1, cfi->dw_cfi_oprnd1.dw_cfi_addr,
+ fde->dw_fde_current_label, NULL);
fde->dw_fde_current_label = cfi->dw_cfi_oprnd1.dw_cfi_addr;
break;
case DW_CFA_advance_loc2:
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file,
- cfi->dw_cfi_oprnd1.dw_cfi_addr,
- fde->dw_fde_current_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_delta (2, cfi->dw_cfi_oprnd1.dw_cfi_addr,
+ fde->dw_fde_current_label, NULL);
fde->dw_fde_current_label = cfi->dw_cfi_oprnd1.dw_cfi_addr;
break;
case DW_CFA_advance_loc4:
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file,
- cfi->dw_cfi_oprnd1.dw_cfi_addr,
- fde->dw_fde_current_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_delta (4, cfi->dw_cfi_oprnd1.dw_cfi_addr,
+ fde->dw_fde_current_label, NULL);
fde->dw_fde_current_label = cfi->dw_cfi_oprnd1.dw_cfi_addr;
break;
-#ifdef MIPS_DEBUGGING_INFO
case DW_CFA_MIPS_advance_loc8:
- /* TODO: not currently implemented. */
- abort ();
+ dw2_asm_output_delta (8, cfi->dw_cfi_oprnd1.dw_cfi_addr,
+ fde->dw_fde_current_label, NULL);
+ fde->dw_fde_current_label = cfi->dw_cfi_oprnd1.dw_cfi_addr;
break;
-#endif
case DW_CFA_offset_extended:
case DW_CFA_GNU_negative_offset_extended:
case DW_CFA_def_cfa:
- output_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
- output_uleb128 (cfi->dw_cfi_oprnd2.dw_cfi_offset);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, NULL);
+ dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd2.dw_cfi_offset, NULL);
break;
case DW_CFA_restore_extended:
case DW_CFA_undefined:
- output_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
- break;
case DW_CFA_same_value:
case DW_CFA_def_cfa_register:
- output_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, NULL);
break;
case DW_CFA_register:
- output_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
- output_uleb128 (cfi->dw_cfi_oprnd2.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, NULL);
+ dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd2.dw_cfi_reg_num, NULL);
break;
case DW_CFA_def_cfa_offset:
- output_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_offset);
- fputc ('\n', asm_out_file);
+ case DW_CFA_GNU_args_size:
+ dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_offset, NULL);
break;
case DW_CFA_GNU_window_save:
break;
- case DW_CFA_GNU_args_size:
- output_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_offset);
- fputc ('\n', asm_out_file);
- break;
case DW_CFA_def_cfa_expression:
output_cfa_loc (cfi);
break;
found:;
}
- fputc ('\n', asm_out_file);
-
/* We're going to be generating comments, so turn on app. */
if (flag_debug_asm)
app_enable ();
ASM_GENERATE_INTERNAL_LABEL (l2, CIE_END_LABEL, for_eh);
#ifdef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
ASM_GENERATE_INTERNAL_LABEL (ld, CIE_LENGTH_LABEL, for_eh);
- if (for_eh)
- ASM_OUTPUT_DWARF_OFFSET4 (asm_out_file, ld);
- else
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, ld);
+ dw2_asm_output_offset (for_eh ? 4 : DWARF_OFFSET_SIZE, ld,
+ "Length of Common Information Entry");
#else
- if (for_eh)
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, l2, l1);
- else
- ASM_OUTPUT_DWARF_DELTA (asm_out_file, l2, l1);
+ dw2_asm_output_delta (for_eh ? 4 : DWARF_OFFSET_SIZE, l2, l1,
+ "Length of Common Information Entry");
#endif
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Length of Common Information Entry",
- ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
ASM_OUTPUT_LABEL (asm_out_file, l1);
- if (for_eh)
- /* Now that the CIE pointer is PC-relative for EH,
- use 0 to identify the CIE. */
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
- else
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, DW_CIE_ID);
-
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s CIE Identifier Tag", ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- if (! for_eh && DWARF_OFFSET_SIZE == 8)
- {
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, DW_CIE_ID);
- fputc ('\n', asm_out_file);
- }
+ /* Now that the CIE pointer is PC-relative for EH,
+ use 0 to identify the CIE. */
+ dw2_asm_output_data ((for_eh ? 4 : DWARF_OFFSET_SIZE),
+ (for_eh ? 0 : DW_CIE_ID),
+ "CIE Identifier Tag");
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_CIE_VERSION);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s CIE Version", ASM_COMMENT_START);
+ dw2_asm_output_data (1, DW_CIE_VERSION, "CIE Version");
- fputc ('\n', asm_out_file);
if (eh_ptr)
{
/* The CIE contains a pointer to the exception region info for the
frame. Make the augmentation string three bytes (including the
trailing null) so the pointer is 4-byte aligned. The Solaris ld
can't handle unaligned relocs. */
- if (flag_debug_asm)
- {
- ASM_OUTPUT_DWARF_STRING (asm_out_file, "eh");
- fprintf (asm_out_file, "\t%s CIE Augmentation", ASM_COMMENT_START);
- }
- else
- {
- ASM_OUTPUT_ASCII (asm_out_file, "eh", 3);
- }
- fputc ('\n', asm_out_file);
-
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, "__EXCEPTION_TABLE__");
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s pointer to exception region info",
- ASM_COMMENT_START);
+ dw2_asm_output_nstring ("eh", 3, "CIE Augmentation");
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, "__EXCEPTION_TABLE__",
+ "pointer to exception region info");
}
else
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s CIE Augmentation (none)",
- ASM_COMMENT_START);
+ dw2_asm_output_data (1, 0, "CIE Augmentation (none)");
}
- fputc ('\n', asm_out_file);
- output_uleb128 (1);
- if (flag_debug_asm)
- fprintf (asm_out_file, " (CIE Code Alignment Factor)");
+ dw2_asm_output_data_uleb128 (1, "CIE Code Alignment Factor");
- fputc ('\n', asm_out_file);
- output_sleb128 (DWARF_CIE_DATA_ALIGNMENT);
- if (flag_debug_asm)
- fprintf (asm_out_file, " (CIE Data Alignment Factor)");
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DWARF_FRAME_RETURN_COLUMN);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s CIE RA Column", ASM_COMMENT_START);
+ dw2_asm_output_data_sleb128 (DWARF_CIE_DATA_ALIGNMENT,
+ "CIE Data Alignment Factor");
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DWARF_FRAME_RETURN_COLUMN, "CIE RA Column");
for (cfi = cie_cfi_head; cfi != NULL; cfi = cfi->dw_cfi_next)
output_cfi (cfi, NULL);
if (for_eh && fde->nothrow)
continue;
+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, FDE_LABEL, for_eh + i * 2);
ASM_GENERATE_INTERNAL_LABEL (l1, FDE_AFTER_SIZE_LABEL, for_eh + i * 2);
ASM_GENERATE_INTERNAL_LABEL (l2, FDE_END_LABEL, for_eh + i * 2);
#ifdef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
ASM_GENERATE_INTERNAL_LABEL (ld, FDE_LENGTH_LABEL, for_eh + i * 2);
- if (for_eh)
- ASM_OUTPUT_DWARF_OFFSET4 (asm_out_file, ld);
- else
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, ld);
+ dw2_asm_output_offset (for_eh ? 4 : DWARF_OFFSET_SIZE, ld, "FDE Length");
#else
- if (for_eh)
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, l2, l1);
- else
- ASM_OUTPUT_DWARF_DELTA (asm_out_file, l2, l1);
+ dw2_asm_output_delta (for_eh ? 4 : DWARF_OFFSET_SIZE, l2, l1,
+ "FDE Length");
#endif
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s FDE Length", ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
ASM_OUTPUT_LABEL (asm_out_file, l1);
/* ??? This always emits a 4 byte offset when for_eh is true, but it
If the for_eh case is changed, then the struct in frame.c has
to be adjusted appropriately. */
if (for_eh)
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, l1, "__FRAME_BEGIN__");
+ dw2_asm_output_delta (4, l1, "__FRAME_BEGIN__", "FDE CIE offset");
else
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (FRAME_SECTION));
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s FDE CIE offset", ASM_COMMENT_START);
+ dw2_asm_output_offset (DWARF_OFFSET_SIZE,
+ stripattributes (FRAME_SECTION),
+ "FDE CIE offset");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, fde->dw_fde_begin);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s FDE initial location", ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR_DELTA (asm_out_file,
- fde->dw_fde_end, fde->dw_fde_begin);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s FDE address range", ASM_COMMENT_START);
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, fde->dw_fde_begin,
+ "FDE initial location");
- fputc ('\n', asm_out_file);
+ dw2_asm_output_delta (DWARF2_ADDR_SIZE, fde->dw_fde_end,
+ fde->dw_fde_begin, "FDE address range");
/* Loop through the Call Frame Instructions associated with
this FDE. */
fputc ('\n', asm_out_file);
#endif
}
+
#ifndef EH_FRAME_SECTION
if (for_eh)
- {
- /* Emit terminating zero for table. */
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
- fputc ('\n', asm_out_file);
- }
+ dw2_asm_output_data (4, 0, "End of Table");
#endif
#ifdef MIPS_DEBUGGING_INFO
/* Work around Irix 6 assembler bug whereby labels at the end of a section
{
#ifdef DWARF2_DEBUGGING_INFO
case DW_OP_addr:
- ASM_OUTPUT_DWARF_ADDR_CONST (asm_out_file, val1->v.val_addr);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_addr_rtx (DWARF2_ADDR_SIZE, val1->v.val_addr, NULL);
break;
case DW_OP_const2u:
case DW_OP_const2s:
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, val1->v.val_int);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (2, val1->v.val_int, NULL);
break;
case DW_OP_const4u:
case DW_OP_const4s:
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, val1->v.val_int);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (4, val1->v.val_int, NULL);
break;
case DW_OP_const8u:
case DW_OP_const8s:
- abort ();
- fputc ('\n', asm_out_file);
+ if (HOST_BITS_PER_LONG < 64)
+ abort ();
+ dw2_asm_output_data (8, val1->v.val_int, NULL);
break;
case DW_OP_skip:
case DW_OP_bra:
else
abort ();
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, offset);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (2, offset, NULL);
}
break;
#else
#endif
case DW_OP_const1u:
case DW_OP_const1s:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_flag);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, val1->v.val_int, NULL);
break;
case DW_OP_constu:
- output_uleb128 (val1->v.val_unsigned);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (val1->v.val_unsigned, NULL);
break;
case DW_OP_consts:
- output_sleb128 (val1->v.val_int);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_sleb128 (val1->v.val_int, NULL);
break;
case DW_OP_pick:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_int);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, val1->v.val_int, NULL);
break;
case DW_OP_plus_uconst:
- output_uleb128 (val1->v.val_unsigned);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (val1->v.val_unsigned, NULL);
break;
case DW_OP_breg0:
case DW_OP_breg1:
case DW_OP_breg29:
case DW_OP_breg30:
case DW_OP_breg31:
- output_sleb128 (val1->v.val_int);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_sleb128 (val1->v.val_int, NULL);
break;
case DW_OP_regx:
- output_uleb128 (val1->v.val_unsigned);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (val1->v.val_unsigned, NULL);
break;
case DW_OP_fbreg:
- output_sleb128 (val1->v.val_int);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_sleb128 (val1->v.val_int, NULL);
break;
case DW_OP_bregx:
- output_uleb128 (val1->v.val_unsigned);
- fputc ('\n', asm_out_file);
- output_sleb128 (val2->v.val_int);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (val1->v.val_unsigned, NULL);
+ dw2_asm_output_data_sleb128 (val2->v.val_int, NULL);
break;
case DW_OP_piece:
- output_uleb128 (val1->v.val_unsigned);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (val1->v.val_unsigned, NULL);
break;
case DW_OP_deref_size:
case DW_OP_xderef_size:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_flag);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, val1->v.val_int, NULL);
break;
default:
/* Other codes have no operands. */
for (; loc != NULL; loc = loc->dw_loc_next)
{
/* Output the opcode. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, loc->dw_loc_opc);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s %s", ASM_COMMENT_START,
- dwarf_stack_op_name (loc->dw_loc_opc));
-
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, loc->dw_loc_opc,
+ "%s", dwarf_stack_op_name (loc->dw_loc_opc));
/* Output the operand(s) (if any). */
output_loc_operands (loc);
/* Output the size of the block. */
loc = cfi->dw_cfi_oprnd1.dw_cfi_loc;
size = size_of_locs (loc);
- output_uleb128 (size);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (size, NULL);
/* Now output the operations themselves. */
output_loc_sequence (loc);
static void output_value_format PARAMS ((dw_attr_ref));
static void output_abbrev_section PARAMS ((void));
static void output_die_symbol PARAMS ((dw_die_ref));
-static void output_symbolic_ref PARAMS ((dw_die_ref));
static void output_die PARAMS ((dw_die_ref));
static void output_compilation_unit_header PARAMS ((void));
static void output_comp_unit PARAMS ((dw_die_ref));
size += constant_size (AT_unsigned (a));
break;
case dw_val_class_long_long:
- size += 1 + 8; /* block */
+ size += 1 + 2*HOST_BITS_PER_LONG/HOST_BITS_PER_CHAR; /* block */
break;
case dw_val_class_float:
size += 1 + a->dw_attr_val.v.val_float.length * 4; /* block */
dw_attr_ref a;
{
enum dwarf_form form = value_format (a);
-
- output_uleb128 (form);
- if (flag_debug_asm)
- fprintf (asm_out_file, " (%s)", dwarf_form_name (form));
-
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (form, "(%s)", dwarf_form_name (form));
}
/* Output the .debug_abbrev section which defines the DIE abbreviation
{
register dw_die_ref abbrev = abbrev_die_table[abbrev_id];
- output_uleb128 (abbrev_id);
- if (flag_debug_asm)
- fprintf (asm_out_file, " (abbrev code)");
+ dw2_asm_output_data_uleb128 (abbrev_id, "(abbrev code)");
- fputc ('\n', asm_out_file);
- output_uleb128 (abbrev->die_tag);
- if (flag_debug_asm)
- fprintf (asm_out_file, " (TAG: %s)",
- dwarf_tag_name (abbrev->die_tag));
+ dw2_asm_output_data_uleb128 (abbrev->die_tag, "(TAG: %s)",
+ dwarf_tag_name (abbrev->die_tag));
- fputc ('\n', asm_out_file);
- fprintf (asm_out_file, "%s0x%x", ASM_BYTE_OP,
- abbrev->die_child != NULL ? DW_children_yes : DW_children_no);
-
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START,
- (abbrev->die_child != NULL
- ? "DW_children_yes" : "DW_children_no"));
-
- fputc ('\n', asm_out_file);
+ if (abbrev->die_child != NULL)
+ dw2_asm_output_data (1, DW_children_yes, "DW_children_yes");
+ else
+ dw2_asm_output_data (1, DW_children_no, "DW_children_no");
for (a_attr = abbrev->die_attr; a_attr != NULL;
a_attr = a_attr->dw_attr_next)
{
- output_uleb128 (a_attr->dw_attr);
- if (flag_debug_asm)
- fprintf (asm_out_file, " (%s)",
- dwarf_attr_name (a_attr->dw_attr));
-
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (a_attr->dw_attr, "(%s)",
+ dwarf_attr_name (a_attr->dw_attr));
output_value_format (a_attr);
}
- fprintf (asm_out_file, "%s0,0\n", ASM_BYTE_OP);
+ dw2_asm_output_data (1, 0, NULL);
+ dw2_asm_output_data (1, 0, NULL);
}
/* Terminate the table. */
- fprintf (asm_out_file, "%s0\n", ASM_BYTE_OP);
+ dw2_asm_output_data (1, 0, NULL);
}
/* Output a symbol we can use to refer to this DIE from another CU. */
ASM_OUTPUT_LABEL (asm_out_file, sym);
}
-/* Output a symbolic (i.e. FORM_ref_addr) reference to TARGET_DIE. */
-
-static inline void
-output_symbolic_ref (target_die)
- dw_die_ref target_die;
-{
- char *sym = target_die->die_symbol;
-
- if (sym == 0)
- abort ();
-
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, sym);
-}
-
/* Output the DIE and its attributes. Called recursively to generate
the definitions of each child DIE. */
if (die->die_symbol)
output_die_symbol (die);
- output_uleb128 (die->die_abbrev);
- if (flag_debug_asm)
- fprintf (asm_out_file, " (DIE (0x%lx) %s)",
- die->die_offset, dwarf_tag_name (die->die_tag));
-
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (die->die_abbrev, "(DIE (0x%lx) %s)",
+ die->die_offset, dwarf_tag_name (die->die_tag));
for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
{
+ const char *name = dwarf_attr_name (a->dw_attr);
+
switch (AT_class (a))
{
case dw_val_class_addr:
- ASM_OUTPUT_DWARF_ADDR_CONST (asm_out_file, AT_addr (a));
+ dw2_asm_output_addr_rtx (DWARF2_ADDR_SIZE, AT_addr (a), "%s", name);
break;
case dw_val_class_loc:
size = size_of_locs (AT_loc (a));
/* Output the block length for this list of location operations. */
- switch (constant_size (size))
- {
- case 1:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, size);
- break;
- case 2:
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, size);
- break;
- default:
- abort ();
- }
-
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
-
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (constant_size (size), size, "%s", name);
output_loc_sequence (AT_loc (a));
break;
/* ??? It would be slightly more efficient to use a scheme like is
used for unsigned constants below, but gdb 4.x does not sign
extend. Gdb 5.x does sign extend. */
- output_sleb128 (AT_int (a));
+ dw2_asm_output_data_sleb128 (AT_int (a), "%s", name);
break;
case dw_val_class_unsigned_const:
- switch (constant_size (AT_unsigned (a)))
- {
- case 1:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, AT_unsigned (a));
- break;
- case 2:
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, AT_unsigned (a));
- break;
- case 4:
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, AT_unsigned (a));
- break;
- case 8:
- ASM_OUTPUT_DWARF_DATA8 (asm_out_file, AT_unsigned (a));
- break;
- default:
- abort ();
- }
+ dw2_asm_output_data (constant_size (AT_unsigned (a)),
+ AT_unsigned (a), "%s", name);
break;
case dw_val_class_long_long:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 8);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_CONST_DOUBLE (asm_out_file,
- a->dw_attr_val.v.val_long_long.hi,
- a->dw_attr_val.v.val_long_long.low);
+ {
+ unsigned HOST_WIDE_INT first, second;
- if (flag_debug_asm)
- fprintf (asm_out_file,
- "\t%s long long constant", ASM_COMMENT_START);
+ dw2_asm_output_data (1, 2*HOST_BITS_PER_LONG/HOST_BITS_PER_CHAR,
+ "%s", name);
- fputc ('\n', asm_out_file);
+ if (WORDS_BIG_ENDIAN)
+ {
+ first = a->dw_attr_val.v.val_long_long.hi;
+ second = a->dw_attr_val.v.val_long_long.low;
+ }
+ else
+ {
+ first = a->dw_attr_val.v.val_long_long.low;
+ second = a->dw_attr_val.v.val_long_long.hi;
+ }
+ dw2_asm_output_data (HOST_BITS_PER_LONG/HOST_BITS_PER_CHAR,
+ first, "long long constant");
+ dw2_asm_output_data (HOST_BITS_PER_LONG/HOST_BITS_PER_CHAR,
+ second, NULL);
+ }
break;
case dw_val_class_float:
{
register unsigned int i;
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- a->dw_attr_val.v.val_float.length * 4);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
- fputc ('\n', asm_out_file);
- for (i = 0; i < a->dw_attr_val.v.val_float.length; ++i)
- {
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
- a->dw_attr_val.v.val_float.array[i]);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s fp constant word %u",
- ASM_COMMENT_START, i);
+ dw2_asm_output_data (1, a->dw_attr_val.v.val_float.length * 4,
+ "%s", name);
- fputc ('\n', asm_out_file);
- }
+ for (i = 0; i < a->dw_attr_val.v.val_float.length; ++i)
+ dw2_asm_output_data (4, a->dw_attr_val.v.val_float.array[i],
+ "fp constant word %u", i);
break;
}
case dw_val_class_flag:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, AT_flag (a));
+ dw2_asm_output_data (1, AT_flag (a), "%s", name);
break;
case dw_val_class_die_ref:
if (AT_ref_external (a))
- output_symbolic_ref (AT_ref (a));
+ {
+ char *sym = AT_ref (a)->die_symbol;
+ if (sym == 0)
+ abort ();
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, sym, "%s", name);
+ }
else if (AT_ref (a)->die_offset == 0)
abort ();
else
- ASM_OUTPUT_DWARF_DATA (asm_out_file, AT_ref (a)->die_offset);
+ dw2_asm_output_data (DWARF_OFFSET_SIZE, AT_ref (a)->die_offset,
+ "%s", name);
break;
case dw_val_class_fde_ref:
{
char l1[20];
- ASM_GENERATE_INTERNAL_LABEL
- (l1, FDE_AFTER_SIZE_LABEL, a->dw_attr_val.v.val_fde_index * 2);
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, l1);
- fprintf (asm_out_file, " - %d", DWARF_OFFSET_SIZE);
+ ASM_GENERATE_INTERNAL_LABEL (l1, FDE_LABEL,
+ a->dw_attr_val.v.val_fde_index * 2);
+ dw2_asm_output_offset (DWARF_OFFSET_SIZE, l1, "%s", name);
}
break;
case dw_val_class_lbl_id:
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, AT_lbl (a));
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, AT_lbl (a), "%s", name);
break;
case dw_val_class_lbl_offset:
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, AT_lbl (a));
+ dw2_asm_output_offset (DWARF_OFFSET_SIZE, AT_lbl (a), "%s", name);
break;
case dw_val_class_str:
- if (flag_debug_asm)
- ASM_OUTPUT_DWARF_STRING (asm_out_file, AT_string (a));
- else
- ASM_OUTPUT_ASCII (asm_out_file, AT_string (a),
- (int) strlen (AT_string (a)) + 1);
+ dw2_asm_output_nstring (AT_string (a), -1, "%s", name);
break;
default:
abort ();
}
-
- if (AT_class (a) != dw_val_class_loc
- && AT_class (a) != dw_val_class_long_long
- && AT_class (a) != dw_val_class_float)
- {
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
-
- fputc ('\n', asm_out_file);
- }
}
for (c = die->die_child; c != NULL; c = c->die_sib)
if (die->die_child != NULL)
{
/* Add null byte to terminate sibling list. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s end of children of DIE 0x%lx",
- ASM_COMMENT_START, die->die_offset);
-
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, 0, "end of children of DIE 0x%lx",
+ die->die_offset);
}
}
static void
output_compilation_unit_header ()
{
- ASM_OUTPUT_DWARF_DATA (asm_out_file, next_die_offset - DWARF_OFFSET_SIZE);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Length of Compilation Unit Info.",
- ASM_COMMENT_START);
+ dw2_asm_output_data (DWARF_OFFSET_SIZE, next_die_offset - DWARF_OFFSET_SIZE,
+ "Length of Compilation Unit Info");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DWARF version number", ASM_COMMENT_START);
+ dw2_asm_output_data (2, DWARF_VERSION, "DWARF version number");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, abbrev_section_label);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Offset Into Abbrev. Section",
- ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DWARF2_ADDR_SIZE);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Pointer Size (in bytes)", ASM_COMMENT_START);
+ dw2_asm_output_offset (DWARF_OFFSET_SIZE, abbrev_section_label,
+ "Offset Into Abbrev. Section");
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DWARF2_ADDR_SIZE, "Pointer Size (in bytes)");
}
/* Output the compilation unit DIE and its children. */
secname = (const char *) DEBUG_INFO_SECTION;
/* Output debugging information. */
- fputc ('\n', asm_out_file);
ASM_OUTPUT_SECTION (asm_out_file, secname);
output_compilation_unit_header ();
output_die (die);
register unsigned i;
register unsigned long pubnames_length = size_of_pubnames ();
- ASM_OUTPUT_DWARF_DATA (asm_out_file, pubnames_length);
-
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Length of Public Names Info.",
- ASM_COMMENT_START);
+ dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length,
+ "Length of Public Names Info");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
-
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
+ dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, debug_info_section_label);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
- ASM_COMMENT_START);
+ dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label,
+ "Offset of Compilation Unit Info");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA (asm_out_file, next_die_offset);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Compilation Unit Length", ASM_COMMENT_START);
+ dw2_asm_output_data (DWARF_OFFSET_SIZE, next_die_offset,
+ "Compilation Unit Length");
- fputc ('\n', asm_out_file);
for (i = 0; i < pubname_table_in_use; ++i)
{
register pubname_ref pub = &pubname_table[i];
if (pub->die->die_mark == 0)
abort ();
- ASM_OUTPUT_DWARF_DATA (asm_out_file, pub->die->die_offset);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DIE offset", ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
-
- if (flag_debug_asm)
- {
- ASM_OUTPUT_DWARF_STRING (asm_out_file, pub->name);
- fprintf (asm_out_file, "%s external name", ASM_COMMENT_START);
- }
- else
- {
- ASM_OUTPUT_ASCII (asm_out_file, pub->name,
- (int) strlen (pub->name) + 1);
- }
+ dw2_asm_output_data (DWARF_OFFSET_SIZE, pub->die->die_offset,
+ "DIE offset");
- fputc ('\n', asm_out_file);
+ dw2_asm_output_nstring (pub->name, -1, "external name");
}
- ASM_OUTPUT_DWARF_DATA (asm_out_file, 0);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (DWARF_OFFSET_SIZE, 0, NULL);
}
/* Add a new entry to .debug_aranges if appropriate. */
register unsigned i;
register unsigned long aranges_length = size_of_aranges ();
- ASM_OUTPUT_DWARF_DATA (asm_out_file, aranges_length);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Length of Address Ranges Info.",
- ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
+ dw2_asm_output_data (DWARF_OFFSET_SIZE, aranges_length,
+ "Length of Address Ranges Info");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, debug_info_section_label);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
- ASM_COMMENT_START);
+ dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DWARF2_ADDR_SIZE);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Size of Address", ASM_COMMENT_START);
+ dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label,
+ "Offset of Compilation Unit Info");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Size of Segment Descriptor",
- ASM_COMMENT_START);
+ dw2_asm_output_data (1, DWARF2_ADDR_SIZE, "Size of Address");
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, 0, "Size of Segment Descriptor");
/* We need to align to twice the pointer size here. */
if (DWARF_ARANGES_PAD_SIZE)
{
- /* Pad using a 2 bytes word so that padding is correct
- for any pointer size. */
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, 0);
+ /* Pad using a 2 byte words so that padding is correct for any
+ pointer size. */
+ dw2_asm_output_data (2, 0, "Pad to %d byte boundary",
+ 2 * DWARF2_ADDR_SIZE);
for (i = 2; i < (unsigned) DWARF_ARANGES_PAD_SIZE; i += 2)
- fprintf (asm_out_file, ",0");
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Pad to %d byte boundary",
- ASM_COMMENT_START, 2 * DWARF2_ADDR_SIZE);
+ dw2_asm_output_data (2, 0, NULL);
}
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, text_section_label);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START);
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, text_section_label, "Address");
+ dw2_asm_output_delta (DWARF2_ADDR_SIZE, text_end_label,
+ text_section_label, "Length");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR_DELTA (asm_out_file, text_end_label,
- text_section_label);
- if (flag_debug_asm)
- fprintf (asm_out_file, "%s Length", ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
for (i = 0; i < arange_table_in_use; ++i)
{
dw_die_ref die = arange_table[i];
abort ();
if (die->die_tag == DW_TAG_subprogram)
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, get_AT_low_pc (die));
+ {
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, get_AT_low_pc (die),
+ "Address");
+ dw2_asm_output_delta (DWARF2_ADDR_SIZE, get_AT_hi_pc (die),
+ get_AT_low_pc (die), "Length");
+ }
else
{
/* A static variable; extract the symbol from DW_AT_location.
if (loc->dw_loc_opc != DW_OP_addr)
abort ();
- ASM_OUTPUT_DWARF_ADDR_CONST (asm_out_file,
- loc->dw_loc_oprnd1.v.val_addr);
+ dw2_asm_output_addr_rtx (DWARF2_ADDR_SIZE,
+ loc->dw_loc_oprnd1.v.val_addr, "Address");
+ dw2_asm_output_data (DWARF2_ADDR_SIZE,
+ get_AT_unsigned (die, DW_AT_byte_size),
+ "Length");
}
-
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- if (die->die_tag == DW_TAG_subprogram)
- ASM_OUTPUT_DWARF_ADDR_DELTA (asm_out_file, get_AT_hi_pc (die),
- get_AT_low_pc (die));
- else
- ASM_OUTPUT_DWARF_ADDR_DATA (asm_out_file,
- get_AT_unsigned (die, DW_AT_byte_size));
-
- if (flag_debug_asm)
- fprintf (asm_out_file, "%s Length", ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
}
/* Output the terminator words. */
- ASM_OUTPUT_DWARF_ADDR_DATA (asm_out_file, 0);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR_DATA (asm_out_file, 0);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (DWARF2_ADDR_SIZE, 0, NULL);
+ dw2_asm_output_data (DWARF2_ADDR_SIZE, 0, NULL);
}
if (dirs[i].used != 0)
{
dirs[i].used = idx++;
-
- if (flag_debug_asm)
- {
- ASM_OUTPUT_DWARF_NSTRING (asm_out_file,
- dirs[i].path, dirs[i].length - 1);
- fprintf (asm_out_file, "%s Directory Entry: 0x%x\n",
- ASM_COMMENT_START, dirs[i].used);
- }
- else
- {
- ASM_OUTPUT_ASCII (asm_out_file, dirs[i].path, dirs[i].length - 1);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- fputc ('\n', asm_out_file);
- }
+ dw2_asm_output_nstring (dirs[i].path, dirs[i].length - 1,
+ "Directory Entry: 0x%x", dirs[i].used);
}
+ dw2_asm_output_data (1, 0, "End directory table");
+
/* Correct the index for the current working directory entry if it
exists. */
if (idx_offset == 0)
dirs[0].used = 0;
- /* Terminate the directory name array. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s End directory table", ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
/* Now write all the file names. */
for (i = 1; i < (int) line_file_table.in_use; ++i)
int file_idx = backmap[i];
int dir_idx = dirs[files[file_idx].dir_idx].dir_idx;
- if (flag_debug_asm)
- {
- ASM_OUTPUT_DWARF_STRING (asm_out_file,
- files[file_idx].path
- + dirs[dir_idx].length);
- fprintf (asm_out_file, "%s File Entry: 0x%x\n",
- ASM_COMMENT_START, i);
- }
- else
- ASM_OUTPUT_ASCII (asm_out_file,
- files[file_idx].path + dirs[dir_idx].length,
- (files[file_idx].length
- - dirs[dir_idx].length) + 1);
+ dw2_asm_output_nstring (files[file_idx].path + dirs[dir_idx].length, -1,
+ "File Entry: 0x%x", i);
/* Include directory index. */
- output_uleb128 (dirs[dir_idx].used);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (dirs[dir_idx].used, NULL);
/* Modification time. */
- output_uleb128 (0);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (0, NULL);
/* File length in bytes. */
- output_uleb128 (0);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data_uleb128 (0, NULL);
}
-
- /* Terminate the file name table */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s End file name table", ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, 0, "End file name table");
}
static void
output_line_info ()
{
+ char l1[20], l2[20];
char line_label[MAX_ARTIFICIAL_LABEL_BYTES];
char prev_line_label[MAX_ARTIFICIAL_LABEL_BYTES];
register unsigned opc;
register unsigned long current_file;
register unsigned long function;
- ASM_OUTPUT_DWARF_DELTA (asm_out_file, ".LTEND", ".LTSTART");
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Length of Source Line Info.",
- ASM_COMMENT_START);
+ ASM_GENERATE_INTERNAL_LABEL (l1, LINE_NUMBER_BEGIN_LABEL, 0);
+ ASM_GENERATE_INTERNAL_LABEL (l2, LINE_NUMBER_END_LABEL, 0);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_LABEL (asm_out_file, ".LTSTART");
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
+ dw2_asm_output_delta (DWARF_OFFSET_SIZE, l2, l1,
+ "Length of Source Line Info");
+ ASM_OUTPUT_LABEL (asm_out_file, l1);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA (asm_out_file, size_of_line_prolog ());
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Prolog Length", ASM_COMMENT_START);
+ dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DWARF_LINE_MIN_INSTR_LENGTH);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Minimum Instruction Length",
- ASM_COMMENT_START);
+ dw2_asm_output_data (DWARF_OFFSET_SIZE, size_of_line_prolog (),
+ "Prolog Length");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DWARF_LINE_DEFAULT_IS_STMT_START);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Default is_stmt_start flag",
- ASM_COMMENT_START);
+ dw2_asm_output_data (1, DWARF_LINE_MIN_INSTR_LENGTH,
+ "Minimum Instruction Length");
- fputc ('\n', asm_out_file);
- fprintf (asm_out_file, "%s%d", ASM_BYTE_OP, DWARF_LINE_BASE);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Line Base Value (Special Opcodes)",
- ASM_COMMENT_START);
+ dw2_asm_output_data (1, DWARF_LINE_DEFAULT_IS_STMT_START,
+ "Default is_stmt_start flag");
- fputc ('\n', asm_out_file);
- fprintf (asm_out_file, "%s%u", ASM_BYTE_OP, DWARF_LINE_RANGE);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Line Range Value (Special Opcodes)",
- ASM_COMMENT_START);
+ dw2_asm_output_data (1, DWARF_LINE_BASE,
+ "Line Base Value (Special Opcodes)");
- fputc ('\n', asm_out_file);
- fprintf (asm_out_file, "%s%u", ASM_BYTE_OP, DWARF_LINE_OPCODE_BASE);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s Special Opcode Base", ASM_COMMENT_START);
+ dw2_asm_output_data (1, DWARF_LINE_RANGE,
+ "Line Range Value (Special Opcodes)");
+
+ dw2_asm_output_data (1, DWARF_LINE_OPCODE_BASE,
+ "Special Opcode Base");
- fputc ('\n', asm_out_file);
for (opc = 1; opc < DWARF_LINE_OPCODE_BASE; ++opc)
{
switch (opc)
n_op_args = 0;
break;
}
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, n_op_args);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s opcode: 0x%x has %d args",
- ASM_COMMENT_START, opc, n_op_args);
- fputc ('\n', asm_out_file);
+
+ dw2_asm_output_data (1, n_op_args, "opcode: 0x%x has %d args",
+ opc, n_op_args);
}
/* Write out the information about the files we use. */
continue;
#endif
- /* Emit debug info for the address of the current line, choosing
- the encoding that uses the least amount of space. */
- /* ??? Unfortunately, we have little choice here currently, and must
- always use the most general form. Gcc does not know the address
- delta itself, so we can't use DW_LNS_advance_pc. There are no known
- dwarf2 aware assemblers at this time, so we can't use any special
- pseudo ops that would allow the assembler to optimally encode this for
- us. Many ports do have length attributes which will give an upper
- bound on the address range. We could perhaps use length attributes
- to determine when it is safe to use DW_LNS_fixed_advance_pc. */
+ /* Emit debug info for the address of the current line.
+
+ Unfortunately, we have little choice here currently, and must always
+ use the most general form. Gcc does not know the address delta
+ itself, so we can't use DW_LNS_advance_pc. Many ports do have length
+ attributes which will give an upper bound on the address range. We
+ could perhaps use length attributes to determine when it is safe to
+ use DW_LNS_fixed_advance_pc. */
+
ASM_GENERATE_INTERNAL_LABEL (line_label, LINE_CODE_LABEL, lt_index);
if (0)
{
/* This can handle deltas up to 0xffff. This takes 3 bytes. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_fixed_advance_pc);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_fixed_advance_pc",
- ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, line_label, prev_line_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DW_LNS_fixed_advance_pc,
+ "DW_LNS_fixed_advance_pc");
+ dw2_asm_output_delta (2, line_label, prev_line_label, NULL);
}
else
{
/* This can handle any delta. This takes
4+DWARF2_ADDR_SIZE bytes. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNE_set_address",
- ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
- output_uleb128 (1 + DWARF2_ADDR_SIZE);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, line_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, 0, "DW_LNE_set_address");
+ dw2_asm_output_data_uleb128 (1 + DWARF2_ADDR_SIZE, NULL);
+ dw2_asm_output_data (1, DW_LNE_set_address, NULL);
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, line_label, NULL);
}
strcpy (prev_line_label, line_label);
if (line_info->dw_file_num != current_file)
{
current_file = line_info->dw_file_num;
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_set_file);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_set_file", ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- output_uleb128 (current_file);
- if (flag_debug_asm)
- fprintf (asm_out_file, " (\"%s\")",
- line_file_table.table[current_file]);
-
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DW_LNS_set_file, "DW_LNS_set_file");
+ dw2_asm_output_data_uleb128 (current_file, "(\"%s\")",
+ line_file_table.table[current_file]);
}
/* Emit debug info for the current line number, choosing the encoding
/* This can handle deltas from -10 to 234, using the current
definitions of DWARF_LINE_BASE and DWARF_LINE_RANGE. This
takes 1 byte. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- DWARF_LINE_OPCODE_BASE + line_delta);
- if (flag_debug_asm)
- fprintf (asm_out_file,
- "\t%s line %ld", ASM_COMMENT_START, current_line);
-
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DWARF_LINE_OPCODE_BASE + line_delta,
+ "line %lu", current_line);
}
else
{
/* This can handle any delta. This takes at least 4 bytes,
depending on the value being encoded. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_advance_line);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s advance to line %ld",
- ASM_COMMENT_START, current_line);
-
- fputc ('\n', asm_out_file);
- output_sleb128 (line_offset);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DW_LNS_advance_line,
+ "advance to line %lu", current_line);
+ dw2_asm_output_data_sleb128 (line_offset, NULL);
+ dw2_asm_output_data (1, DW_LNS_copy, "DW_LNS_copy");
}
}
else
{
/* We still need to start a new row, so output a copy insn. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DW_LNS_copy, "DW_LNS_copy");
}
}
/* Emit debug info for the address of the end of the function. */
if (0)
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_fixed_advance_pc);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_fixed_advance_pc",
- ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, text_end_label, prev_line_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DW_LNS_fixed_advance_pc,
+ "DW_LNS_fixed_advance_pc");
+ dw2_asm_output_delta (2, text_end_label, prev_line_label, NULL);
}
else
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNE_set_address", ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
- output_uleb128 (1 + DWARF2_ADDR_SIZE);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, text_end_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, 0, "DW_LNE_set_address");
+ dw2_asm_output_data_uleb128 (1 + DWARF2_ADDR_SIZE, NULL);
+ dw2_asm_output_data (1, DW_LNE_set_address, NULL);
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, text_end_label, NULL);
}
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNE_end_sequence", ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- output_uleb128 (1);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_end_sequence);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, 0, "DW_LNE_end_sequence");
+ dw2_asm_output_data_uleb128 (1, NULL);
+ dw2_asm_output_data (1, DW_LNE_end_sequence, NULL);
function = 0;
current_file = 1;
function = line_info->function;
/* Set the address register to the first line in the function */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNE_set_address",
- ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- output_uleb128 (1 + DWARF2_ADDR_SIZE);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, line_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, 0, "DW_LNE_set_address");
+ dw2_asm_output_data_uleb128 (1 + DWARF2_ADDR_SIZE, NULL);
+ dw2_asm_output_data (1, DW_LNE_set_address, NULL);
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, line_label, NULL);
}
else
{
/* ??? See the DW_LNS_advance_pc comment above. */
if (0)
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_fixed_advance_pc);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_fixed_advance_pc",
- ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, line_label,
- prev_line_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DW_LNS_fixed_advance_pc,
+ "DW_LNS_fixed_advance_pc");
+ dw2_asm_output_delta (2, line_label, prev_line_label, NULL);
}
else
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNE_set_address",
- ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
- output_uleb128 (1 + DWARF2_ADDR_SIZE);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, line_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, 0, "DW_LNE_set_address");
+ dw2_asm_output_data_uleb128 (1 + DWARF2_ADDR_SIZE, NULL);
+ dw2_asm_output_data (1, DW_LNE_set_address, NULL);
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, line_label, NULL);
}
}
strcpy (prev_line_label, line_label);
if (line_info->dw_file_num != current_file)
{
current_file = line_info->dw_file_num;
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_set_file);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_set_file", ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- output_uleb128 (current_file);
- if (flag_debug_asm)
- fprintf (asm_out_file, " (\"%s\")",
- line_file_table.table[current_file]);
-
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DW_LNS_set_file, "DW_LNS_set_file");
+ dw2_asm_output_data_uleb128 (current_file, "(\"%s\")",
+ line_file_table.table[current_file]);
}
/* Emit debug info for the current line number, choosing the encoding
line_delta = line_offset - DWARF_LINE_BASE;
current_line = line_info->dw_line_num;
if (line_delta >= 0 && line_delta < (DWARF_LINE_RANGE - 1))
- {
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- DWARF_LINE_OPCODE_BASE + line_delta);
- if (flag_debug_asm)
- fprintf (asm_out_file,
- "\t%s line %ld", ASM_COMMENT_START, current_line);
-
- fputc ('\n', asm_out_file);
- }
+ dw2_asm_output_data (1, DWARF_LINE_OPCODE_BASE + line_delta,
+ "line %lu", current_line);
else
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_advance_line);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s advance to line %ld",
- ASM_COMMENT_START, current_line);
-
- fputc ('\n', asm_out_file);
- output_sleb128 (line_offset);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DW_LNS_advance_line,
+ "advance to line %lu", current_line);
+ dw2_asm_output_data_sleb128 (line_offset, NULL);
+ dw2_asm_output_data (1, DW_LNS_copy, "DW_LNS_copy");
}
}
else
- {
- /* We still need to start a new row, so output a copy insn. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
- }
+ dw2_asm_output_data (1, DW_LNS_copy, "DW_LNS_copy");
#if 0
cont:
ASM_GENERATE_INTERNAL_LABEL (line_label, FUNC_END_LABEL, function);
if (0)
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_fixed_advance_pc);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_fixed_advance_pc",
- ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, line_label,
- prev_line_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, DW_LNS_fixed_advance_pc,
+ "DW_LNS_fixed_advance_pc");
+ dw2_asm_output_delta (2, line_label, prev_line_label, NULL);
}
else
{
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNE_set_address",
- ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
- output_uleb128 (1 + DWARF2_ADDR_SIZE);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, line_label);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, 0, "DW_LNE_set_address");
+ dw2_asm_output_data_uleb128 (1 + DWARF2_ADDR_SIZE, NULL);
+ dw2_asm_output_data (1, DW_LNE_set_address, NULL);
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, line_label, NULL);
}
/* Output the marker for the end of this sequence. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s DW_LNE_end_sequence",
- ASM_COMMENT_START);
-
- fputc ('\n', asm_out_file);
- output_uleb128 (1);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_end_sequence);
- fputc ('\n', asm_out_file);
+ dw2_asm_output_data (1, 0, "DW_LNE_end_sequence");
+ dw2_asm_output_data_uleb128 (1, NULL);
+ dw2_asm_output_data (1, DW_LNE_end_sequence, NULL);
}
}
/* Output the marker for the end of the line number info. */
- ASM_OUTPUT_LABEL (asm_out_file, ".LTEND");
+ ASM_OUTPUT_LABEL (asm_out_file, l2);
}
\f
/* Given a pointer to a tree node for some base type, return a pointer to
switch (GET_CODE (rtl))
{
case CONST_INT:
- /* Note that a CONST_INT rtx could represent either an integer or a
- floating-point constant. A CONST_INT is used whenever the constant
- will fit into a single word. In all such cases, the original mode
- of the constant value is wiped out, and the CONST_INT rtx is
- assigned VOIDmode. */
- add_AT_unsigned (die, DW_AT_const_value, (unsigned) INTVAL (rtl));
+ /* Note that a CONST_INT rtx could represent either an integer
+ or a floating-point constant. A CONST_INT is used whenever
+ the constant will fit into a single word. In all such
+ cases, the original mode of the constant value is wiped
+ out, and the CONST_INT rtx is assigned VOIDmode. */
+ {
+ HOST_WIDE_INT val = INTVAL (rtl);
+
+ /* ??? We really should be using HOST_WIDE_INT throughout. */
+ if (val < 0)
+ {
+ if ((long) val != val)
+ abort ();
+ add_AT_int (die, DW_AT_const_value, (long) val);
+ }
+ else
+ {
+ if ((unsigned long) val != (unsigned HOST_WIDE_INT) val)
+ abort ();
+ add_AT_int (die, DW_AT_const_value, (unsigned long) val);
+ }
+ }
break;
case CONST_DOUBLE:
add_AT_float (die, DW_AT_const_value, length, array);
}
else
- add_AT_long_long (die, DW_AT_const_value,
- CONST_DOUBLE_HIGH (rtl), CONST_DOUBLE_LOW (rtl));
+ {
+ /* ??? We really should be using HOST_WIDE_INT throughout. */
+ if (HOST_BITS_PER_LONG != HOST_BITS_PER_WIDE_INT)
+ abort ();
+ add_AT_long_long (die, DW_AT_const_value,
+ CONST_DOUBLE_HIGH (rtl), CONST_DOUBLE_LOW (rtl));
+ }
}
break;
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, SEPARATE_LINE_CODE_LABEL,
separate_line_info_table_in_use);
if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s %s:%d", ASM_COMMENT_START,
+ fprintf (asm_out_file, "\t%s %s:%d\n", ASM_COMMENT_START,
filename, line);
- fputc ('\n', asm_out_file);
/* expand the line info table if necessary */
if (separate_line_info_table_in_use
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, LINE_CODE_LABEL,
line_info_table_in_use);
if (flag_debug_asm)
- fprintf (asm_out_file, "\t%s %s:%d", ASM_COMMENT_START,
+ fprintf (asm_out_file, "\t%s %s:%d\n", ASM_COMMENT_START,
filename, line);
- fputc ('\n', asm_out_file);
/* Expand the line info table if necessary. */
if (line_info_table_in_use == line_info_table_allocated)
add_sibling_attributes (node->die);
/* Output a terminator label for the .text section. */
- fputc ('\n', asm_out_file);
ASM_OUTPUT_SECTION (asm_out_file, TEXT_SECTION);
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, TEXT_END_LABEL, 0);
#if 0
/* Output a terminator label for the .data section. */
- fputc ('\n', asm_out_file);
ASM_OUTPUT_SECTION (asm_out_file, DATA_SECTION);
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, DATA_END_LABEL, 0);
/* Output a terminator label for the .bss section. */
- fputc ('\n', asm_out_file);
ASM_OUTPUT_SECTION (asm_out_file, BSS_SECTION);
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, BSS_END_LABEL, 0);
#endif
{
if (! DWARF2_ASM_LINE_DEBUG_INFO)
{
- fputc ('\n', asm_out_file);
ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION);
output_line_info ();
}
output_comp_unit (comp_unit_die);
/* Output the abbreviation table. */
- fputc ('\n', asm_out_file);
ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION);
output_abbrev_section ();
if (pubname_table_in_use)
{
/* Output public names table. */
- fputc ('\n', asm_out_file);
ASM_OUTPUT_SECTION (asm_out_file, PUBNAMES_SECTION);
output_pubnames ();
}
if (fde_table_in_use)
{
/* Output the address range information. */
- fputc ('\n', asm_out_file);
ASM_OUTPUT_SECTION (asm_out_file, ARANGES_SECTION);
output_aranges ();
}